From f8e0797773d5aa8ab7b4a7a3368b3bc4a8724849 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Tue, 1 Oct 2019 13:55:16 +0000 Subject: [PATCH] Update to Chromium version 78.0.3904.0 (#693954) --- BUILD.gn | 95 +------ CHROMIUM_BUILD_COMPATIBILITY.txt | 2 +- include/capi/cef_print_settings_capi.h | 8 +- include/capi/cef_ssl_info_capi.h | 10 +- include/capi/test/cef_translator_test_capi.h | 6 +- include/cef_api_hash.h | 10 +- include/cef_print_settings.h | 6 - include/cef_ssl_info.h | 9 +- libcef/browser/browser_context.cc | 233 +++++++++++----- libcef/browser/browser_context.h | 79 +++++- libcef/browser/browser_host_impl.cc | 2 +- libcef/browser/browser_main.cc | 80 +----- libcef/browser/browser_main.h | 17 -- libcef/browser/chrome_browser_process_stub.cc | 12 - libcef/browser/chrome_browser_process_stub.h | 3 - libcef/browser/chrome_profile_stub.cc | 9 + libcef/browser/chrome_profile_stub.h | 2 + libcef/browser/content_browser_client.cc | 174 ++++-------- libcef/browser/content_browser_client.h | 41 ++- .../browser/devtools/devtools_file_manager.cc | 4 +- libcef/browser/devtools/devtools_frontend.cc | 6 +- libcef/browser/extensions/api/tabs/tabs_api.h | 6 +- .../extensions/extension_function_details.cc | 19 +- .../extensions/extension_function_details.h | 14 +- libcef/browser/extensions/extension_system.cc | 4 +- .../extensions/extensions_browser_client.cc | 5 +- .../extensions/extensions_browser_client.h | 3 +- .../extensions/value_store/cef_value_store.cc | 9 +- libcef/browser/menu_model_impl.cc | 2 +- libcef/browser/native/window_delegate_view.cc | 2 +- libcef/browser/native/window_x11.cc | 4 +- libcef/browser/net/chrome_scheme_handler.cc | 76 +----- libcef/browser/net_service/cookie_helper.cc | 29 +- .../net_service/cookie_manager_impl.cc | 35 +-- .../net_service/proxy_url_loader_factory.cc | 93 ++++--- .../net_service/proxy_url_loader_factory.h | 28 +- .../resource_request_handler_wrapper.cc | 4 +- .../resource_request_handler_wrapper.h | 4 +- .../net_service/stream_reader_url_loader.cc | 4 +- .../net_service/stream_reader_url_loader.h | 2 +- .../net_service/url_loader_factory_getter.cc | 4 +- libcef/browser/osr/host_display_client_osr.cc | 2 +- .../osr/render_widget_host_view_osr.cc | 18 +- .../browser/osr/render_widget_host_view_osr.h | 4 +- .../osr/software_output_device_proxy.h | 4 +- .../browser/plugins/plugin_service_filter.cc | 42 ++- .../browser/plugins/plugin_service_filter.h | 2 - libcef/browser/prefs/browser_prefs.cc | 19 +- libcef/browser/print_settings_impl.cc | 33 ++- libcef/browser/print_settings_impl.h | 10 +- libcef/browser/printing/print_dialog_linux.cc | 27 +- libcef/browser/printing/print_dialog_linux.h | 6 +- libcef/browser/printing/print_view_manager.cc | 9 +- .../printing/printing_message_filter.cc | 2 +- libcef/browser/request_context_handler_map.cc | 69 +++++ libcef/browser/request_context_handler_map.h | 61 +++++ libcef/browser/request_context_impl.cc | 17 +- libcef/browser/resource_context.cc | 110 +------- libcef/browser/resource_context.h | 74 +---- libcef/browser/server_impl.cc | 2 +- .../speech_recognition_manager_delegate.cc | 4 +- libcef/browser/ssl_host_state_delegate.cc | 3 +- libcef/browser/ssl_host_state_delegate.h | 3 +- libcef/browser/ssl_info_impl.cc | 4 - libcef/browser/thread_util.h | 20 +- libcef/browser/views/textfield_impl.cc | 8 +- libcef/browser/views/window_view.cc | 7 +- libcef/common/content_client.cc | 4 - libcef/common/content_client.h | 1 - libcef/common/main_delegate.cc | 8 +- libcef/common/main_delegate.h | 4 +- libcef/common/request_impl.cc | 4 +- .../builtin_service_manifests.cc | 63 ----- .../builtin_service_manifests.h | 17 -- .../cef_content_browser_overlay_manifest.cc | 10 +- .../cef_content_gpu_overlay_manifest.cc | 20 -- .../cef_content_gpu_overlay_manifest.h | 15 - .../cef_content_renderer_overlay_manifest.cc | 4 - .../cef_content_utility_overlay_manifest.cc | 19 -- .../cef_content_utility_overlay_manifest.h | 15 - .../cef_renderer_manifest.cc | 21 -- .../service_manifests/cef_renderer_manifest.h | 16 -- libcef/common/task_runner_impl.cc | 4 +- libcef/common/thread_impl.cc | 6 +- libcef/renderer/blink_glue.cc | 4 +- libcef/renderer/content_renderer_client.cc | 42 ++- libcef/renderer/content_renderer_client.h | 18 +- libcef/renderer/render_message_filter.cc | 7 +- libcef/renderer/render_urlrequest_impl.cc | 24 +- .../url_loader_throttle_provider_impl.cc | 4 +- .../url_loader_throttle_provider_impl.h | 2 +- libcef/renderer/v8_impl.cc | 8 +- libcef/utility/content_utility_client.cc | 105 ------- libcef/utility/content_utility_client.h | 44 --- libcef_dll/cpptoc/print_settings_cpptoc.cc | 21 +- libcef_dll/ctocpp/print_settings_ctocpp.cc | 19 +- libcef_dll/ctocpp/print_settings_ctocpp.h | 3 +- libcef_dll/libcef_dll.cc | 12 +- libcef_dll/wrapper/libcef_dll_dylib.cc | 54 ++-- libcef_dll/wrapper/libcef_dll_wrapper.cc | 13 +- patch/patch.cfg | 9 +- patch/patches/base_value_646113.patch | 2 +- patch/patches/browser_child_frame_2507.patch | 8 +- patch/patches/browser_compositor_mac.patch | 2 +- patch/patches/browser_plugin_guest_1565.patch | 22 +- patch/patches/browser_scheduler.patch | 4 +- patch/patches/build.patch | 6 +- patch/patches/chrome_browser.patch | 8 +- patch/patches/chrome_browser_net_export.patch | 8 +- .../chrome_browser_product_override.patch | 10 +- patch/patches/chrome_browser_profiles.patch | 16 +- patch/patches/chrome_plugins.patch | 87 ++---- patch/patches/chrome_pref_watcher.patch | 4 +- patch/patches/chrome_renderer.patch | 6 +- patch/patches/chrome_widevine.patch | 15 +- patch/patches/content_2015.patch | 258 ++++++++---------- patch/patches/content_pepper_flash_1586.patch | 2 +- patch/patches/crashpad_1995.patch | 59 ++-- patch/patches/crashpad_tp_1995.patch | 42 +-- patch/patches/extensions_1947.patch | 12 +- patch/patches/gn_config.patch | 18 +- patch/patches/gritsettings.patch | 4 +- patch/patches/ime_1610.patch | 4 +- patch/patches/linux_gtk_2014.patch | 6 +- patch/patches/linux_poll_2466.patch | 2 +- patch/patches/message_loop.patch | 32 +-- patch/patches/prefs_content_1161.patch | 16 +- patch/patches/print_preview_123.patch | 32 +-- patch/patches/printing_context_2196.patch | 8 +- .../render_accessibility_1675917.patch | 51 ---- patch/patches/resource_bundle_2512.patch | 8 +- patch/patches/rwh_background_color_1984.patch | 6 +- patch/patches/service_manager_654986.patch | 12 +- patch/patches/services_network_2622.patch | 67 +++-- .../services_network_request_id_2718.patch | 23 +- .../patches/set_resize_background_color.patch | 6 +- patch/patches/storage_incognito_2289.patch | 32 +-- patch/patches/trace_event.patch | 4 +- patch/patches/views_1749_2102.patch | 58 ++-- ...views_widget_180_1481_1565_1677_1749.patch | 224 +++++++-------- patch/patches/viz_osr_2575.patch | 44 +-- patch/patches/web_contents_1257_1565.patch | 30 +- patch/patches/webkit_plugin_info_2015.patch | 42 +-- .../patches/webkit_pointer_event_781966.patch | 2 +- patch/patches/webkit_popups.patch | 26 +- patch/patches/webui_2037.patch | 10 +- patch/patches/webview_plugin_2020.patch | 4 +- patch/patches/win_rt_2274.patch | 4 +- tests/ceftests/navigation_unittest.cc | 5 +- tests/ceftests/plugin_unittest.cc | 5 +- tests/ceftests/print_unittest.cc | 32 --- 151 files changed, 1485 insertions(+), 2238 deletions(-) create mode 100644 libcef/browser/request_context_handler_map.cc create mode 100644 libcef/browser/request_context_handler_map.h delete mode 100644 libcef/common/service_manifests/builtin_service_manifests.cc delete mode 100644 libcef/common/service_manifests/builtin_service_manifests.h delete mode 100644 libcef/common/service_manifests/cef_content_gpu_overlay_manifest.cc delete mode 100644 libcef/common/service_manifests/cef_content_gpu_overlay_manifest.h delete mode 100644 libcef/common/service_manifests/cef_content_utility_overlay_manifest.cc delete mode 100644 libcef/common/service_manifests/cef_content_utility_overlay_manifest.h delete mode 100644 libcef/common/service_manifests/cef_renderer_manifest.cc delete mode 100644 libcef/common/service_manifests/cef_renderer_manifest.h delete mode 100644 libcef/utility/content_utility_client.cc delete mode 100644 libcef/utility/content_utility_client.h delete mode 100644 patch/patches/render_accessibility_1675917.patch diff --git a/BUILD.gn b/BUILD.gn index f5dd5cadf..d4c668652 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -93,7 +93,7 @@ # https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/language.md # -import("//build/config/allocator.gni") +import("//base/allocator/allocator.gni") import("//build/config/features.gni") import("//build/config/locales.gni") import("//build/config/sanitizers/sanitizers.gni") @@ -544,6 +544,8 @@ static_library("libcef_static") { "libcef/browser/process_util_impl.cc", "libcef/browser/resource_context.cc", "libcef/browser/resource_context.h", + "libcef/browser/request_context_handler_map.cc", + "libcef/browser/request_context_handler_map.h", "libcef/browser/request_context_impl.cc", "libcef/browser/request_context_impl.h", "libcef/browser/scheme_impl.cc", @@ -687,8 +689,6 @@ static_library("libcef_static") { "libcef/renderer/url_loader_throttle_provider_impl.h", "libcef/renderer/v8_impl.cc", "libcef/renderer/v8_impl.h", - "libcef/utility/content_utility_client.cc", - "libcef/utility/content_utility_client.h", "//chrome/browser/local_discovery/service_discovery_device_lister.cc", "//chrome/browser/local_discovery/service_discovery_device_lister.h", @@ -750,7 +750,7 @@ static_library("libcef_static") { "//components/content_settings/core/common", "//components/crx_file", "//components/data_use_measurement/core", - "//components/google/core/browser", + "//components/google/core/common", "//components/keyed_service/content:content", "//components/keyed_service/core:core", "//components/navigation_interception", @@ -764,7 +764,7 @@ static_library("libcef_static") { "//components/printing/renderer", "//components/proxy_config", "//components/safe_browsing/db:test_database_manager", - "//components/services/pdf_compositor/public/cpp:factory", + "//components/services/pdf_compositor/public/cpp", "//components/services/pdf_compositor/public/mojom", "//components/tracing", "//components/update_client", @@ -1169,7 +1169,6 @@ source_set("cef_content_browser_overlay_manifest") { deps = [ "//base", - "//components/services/heap_profiling/public/mojom", "//extensions/buildflags", "//extensions/common:mojom", "//extensions/common/api:mojom", @@ -1178,23 +1177,6 @@ source_set("cef_content_browser_overlay_manifest") { ] } -source_set("cef_content_gpu_overlay_manifest") { - sources = [ - "libcef/common/service_manifests/cef_content_gpu_overlay_manifest.cc", - "libcef/common/service_manifests/cef_content_gpu_overlay_manifest.h", - ] - - configs += [ - "libcef/features:config" - ] - - deps = [ - "//base", - "//components/services/heap_profiling/public/mojom", - "//services/service_manager/public/cpp", - ] -} - source_set("cef_content_renderer_overlay_manifest") { sources = [ "libcef/common/service_manifests/cef_content_renderer_overlay_manifest.cc", @@ -1207,85 +1189,18 @@ source_set("cef_content_renderer_overlay_manifest") { deps = [ "//base", - "//components/services/heap_profiling/public/mojom", "//components/subresource_filter/content/mojom", "//extensions/buildflags", "//extensions/common:mojom", "//services/service_manager/public/cpp", "//third_party/blink/public/common", ] - - if (is_mac) { - deps += [ "//components/spellcheck/common:interfaces" ] - } -} - -source_set("cef_content_utility_overlay_manifest") { - sources = [ - "libcef/common/service_manifests/cef_content_utility_overlay_manifest.cc", - "libcef/common/service_manifests/cef_content_utility_overlay_manifest.h", - ] - - configs += [ - "libcef/features:config" - ] - - deps = [ - "//base", - "//components/services/heap_profiling/public/mojom", - "//services/service_manager/public/cpp", - ] -} - -source_set("builtin_service_manifests") { - sources = [ - "libcef/common/service_manifests/builtin_service_manifests.cc", - "libcef/common/service_manifests/builtin_service_manifests.h", - ] - - configs += [ - "libcef/features:config" - ] - - deps = [ - "//base", - "//chrome/common:mojo_bindings", - "//chrome/services/printing/public/cpp:manifest", - "//components/services/pdf_compositor/public/cpp:manifest", - "//components/spellcheck/common:interfaces", - "//components/startup_metric_utils/common:interfaces", - "//extensions/buildflags", - "//printing/buildflags", - "//services/service_manager/public/cpp", - ] -} - -source_set("cef_renderer_manifest") { - sources = [ - "libcef/common/service_manifests/cef_renderer_manifest.cc", - "libcef/common/service_manifests/cef_renderer_manifest.h", - ] - - configs += [ - "libcef/features:config" - ] - - deps = [ - "//base", - "//chrome/common:mojo_bindings", - "//components/spellcheck/common:interfaces", - "//services/service_manager/public/cpp", - ] } source_set("cef_service_manifests") { public_deps = [ ":cef_content_browser_overlay_manifest", - ":cef_content_gpu_overlay_manifest", ":cef_content_renderer_overlay_manifest", - ":cef_content_utility_overlay_manifest", - ":builtin_service_manifests", - ":cef_renderer_manifest", ] } diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 9d345e915..101567440 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -7,5 +7,5 @@ # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding { - 'chromium_checkout': 'refs/tags/77.0.3865.0' + 'chromium_checkout': 'refs/tags/78.0.3904.0' } diff --git a/include/capi/cef_print_settings_capi.h b/include/capi/cef_print_settings_capi.h index 0fb9e1d20..59c481fc4 100644 --- a/include/capi/cef_print_settings_capi.h +++ b/include/capi/cef_print_settings_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=e4acb9c80e79f3e0784c1dc44f5ce885a8fb7fff$ +// $hash=a132b1b06541afe31536aadf06c4acf7371cd98f$ // #ifndef CEF_INCLUDE_CAPI_CEF_PRINT_SETTINGS_CAPI_H_ @@ -67,12 +67,6 @@ typedef struct _cef_print_settings_t { /// int(CEF_CALLBACK* is_read_only)(struct _cef_print_settings_t* self); - /// - // Returns a writable copy of this object. - /// - struct _cef_print_settings_t*(CEF_CALLBACK* copy)( - struct _cef_print_settings_t* self); - /// // Set the page orientation. /// diff --git a/include/capi/cef_ssl_info_capi.h b/include/capi/cef_ssl_info_capi.h index e5ab51512..c00ae2841 100644 --- a/include/capi/cef_ssl_info_capi.h +++ b/include/capi/cef_ssl_info_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=9c9e2d87b54564137f970081f25d09157c5903d2$ +// $hash=53c090308ab6406dcba8a1fb9282febe4795cd4f$ // #ifndef CEF_INCLUDE_CAPI_CEF_SSL_INFO_CAPI_H_ @@ -71,16 +71,10 @@ typedef struct _cef_sslinfo_t { } cef_sslinfo_t; /// -// Returns true (1) if the certificate status has any error, major or minor. +// Returns true (1) if the certificate status represents an error. /// CEF_EXPORT int cef_is_cert_status_error(cef_cert_status_t status); -/// -// Returns true (1) if the certificate status represents only minor errors (e.g. -// failure to verify certificate revocation). -/// -CEF_EXPORT int cef_is_cert_status_minor_error(cef_cert_status_t status); - #ifdef __cplusplus } #endif diff --git a/include/capi/test/cef_translator_test_capi.h b/include/capi/test/cef_translator_test_capi.h index daacc8523..abd3b036b 100644 --- a/include/capi/test/cef_translator_test_capi.h +++ b/include/capi/test/cef_translator_test_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=ae3b4b169b668985a8f641af215b7db7c26f964b$ +// $hash=e1a269bd8ef9436eba8257f958b5720d092d584b$ // #ifndef CEF_INCLUDE_CAPI_TEST_CEF_TRANSLATOR_TEST_CAPI_H_ @@ -323,7 +323,7 @@ typedef struct _cef_translator_test_t { /// // Set an object. Returns the value from - // cef_translator_test_ref_ptr_client_t::get_value(). This tests input and + // cef_translator_test_tRefPtrClient::get_value(). This tests input and // execution of a client-side object type. /// int(CEF_CALLBACK* set_ref_ptr_client)( @@ -341,7 +341,7 @@ typedef struct _cef_translator_test_t { /// // Set a child object. Returns the value from - // cef_translator_test_ref_ptr_client_t::get_value(). This tests input of a + // cef_translator_test_tRefPtrClient::get_value(). This tests input of a // client- side child object type and execution as the parent type. /// int(CEF_CALLBACK* set_child_ref_ptr_client)( diff --git a/include/cef_api_hash.h b/include/cef_api_hash.h index 7d009196f..f030f44b7 100644 --- a/include/cef_api_hash.h +++ b/include/cef_api_hash.h @@ -34,7 +34,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=420dfefdb6497faaa2c0280ad70e66e0b7d37dfc$ +// $hash=e1836e5dade0a6f19f058dbfd55df881f454d1e3$ // #ifndef CEF_INCLUDE_API_HASH_H_ @@ -47,13 +47,13 @@ // way that may cause binary incompatibility with other builds. The universal // hash value will change if any platform is affected whereas the platform hash // values will change only if that particular platform is affected. -#define CEF_API_HASH_UNIVERSAL "440be38b46f14493a9981a1d9282742a83b9070e" +#define CEF_API_HASH_UNIVERSAL "14afb7265af06a50b900ddd775adc235dc34ec77" #if defined(OS_WIN) -#define CEF_API_HASH_PLATFORM "e5386095f03ffc204bdeacac7a13275918c66eb1" +#define CEF_API_HASH_PLATFORM "228f8ff0c24b688aa36db6f0bf88b0c301738c1a" #elif defined(OS_MACOSX) -#define CEF_API_HASH_PLATFORM "1c87ca78fce1bd15cd78f33f8f4e1763d616556a" +#define CEF_API_HASH_PLATFORM "dd1c23009c1356fcb066f195af3da9fcf3175799" #elif defined(OS_LINUX) -#define CEF_API_HASH_PLATFORM "0050dbeab6fe92dd6b954241224cb67c9d9ac23e" +#define CEF_API_HASH_PLATFORM "ebc0f044eab1238ff313ad4496dd2ff22bd261ec" #endif #ifdef __cplusplus diff --git a/include/cef_print_settings.h b/include/cef_print_settings.h index 576ac4e52..ba1c2945b 100644 --- a/include/cef_print_settings.h +++ b/include/cef_print_settings.h @@ -72,12 +72,6 @@ class CefPrintSettings : public virtual CefBaseRefCounted { /*--cef()--*/ virtual bool IsReadOnly() = 0; - /// - // Returns a writable copy of this object. - /// - /*--cef()--*/ - virtual CefRefPtr Copy() = 0; - /// // Set the page orientation. /// diff --git a/include/cef_ssl_info.h b/include/cef_ssl_info.h index 1ede59084..40dc5c00f 100644 --- a/include/cef_ssl_info.h +++ b/include/cef_ssl_info.h @@ -64,16 +64,9 @@ class CefSSLInfo : public virtual CefBaseRefCounted { }; /// -// Returns true if the certificate status has any error, major or minor. +// Returns true if the certificate status represents an error. /// /*--cef()--*/ bool CefIsCertStatusError(cef_cert_status_t status); -/// -// Returns true if the certificate status represents only minor errors -// (e.g. failure to verify certificate revocation). -/// -/*--cef()--*/ -bool CefIsCertStatusMinorError(cef_cert_status_t status); - #endif // CEF_INCLUDE_CEF_SSL_INFO_H_ diff --git a/libcef/browser/browser_context.cc b/libcef/browser/browser_context.cc index fc0c19c46..71ca3a063 100644 --- a/libcef/browser/browser_context.cc +++ b/libcef/browser/browser_context.cc @@ -89,24 +89,39 @@ class ImplManager { return GetImplPos(impl) != all_.end(); } + CefBrowserContext* GetImplForIDs(int render_process_id, + int render_frame_id, + int frame_tree_node_id, + bool require_frame_match) { + CEF_REQUIRE_UIT(); + for (const auto& context : all_) { + if (context->IsAssociatedContext(render_process_id, render_frame_id, + frame_tree_node_id, + require_frame_match)) { + return context; + } + } + return nullptr; + } + CefBrowserContext* GetImplForContext(const content::BrowserContext* context) { CEF_REQUIRE_UIT(); if (!context) - return NULL; + return nullptr; Vector::iterator it = all_.begin(); for (; it != all_.end(); ++it) { if (*it == context) return *it; } - return NULL; + return nullptr; } void SetImplPath(CefBrowserContext* impl, const base::FilePath& path) { CEF_REQUIRE_UIT(); DCHECK(!path.empty()); DCHECK(IsValidImpl(impl)); - DCHECK(GetImplForPath(path) == NULL); + DCHECK(GetImplForPath(path) == nullptr); map_.insert(std::make_pair(path, impl)); } @@ -116,7 +131,7 @@ class ImplManager { PathMap::const_iterator it = map_.find(path); if (it != map_.end()) return it->second; - return NULL; + return nullptr; } const Vector GetAllImpl() const { return all_; } @@ -219,8 +234,7 @@ CefBrowserContext::~CefBrowserContext() { // Send notifications to clean up objects associated with this Profile. MaybeSendDestroyedNotification(); - ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( - resource_context_.get()); + ChromePluginServiceFilter::GetInstance()->UnregisterProfile(this); // Remove any BrowserContextKeyedServiceFactory associations. This must be // called before the ProxyService owned by CefBrowserContext is destroyed. @@ -253,7 +267,7 @@ CefBrowserContext::~CefBrowserContext() { // The FontFamilyCache references the ProxyService so delete it before the // ProxyService is deleted. - SetUserData(&kFontFamilyCacheKey, NULL); + SetUserData(&kFontFamilyCacheKey, nullptr); pref_proxy_config_tracker_->DetachFromPrefService(); @@ -263,7 +277,7 @@ CefBrowserContext::~CefBrowserContext() { // Delete the download manager delegate here because otherwise we'll crash // when it's accessed from the content::BrowserContext destructor. if (download_manager_delegate_) - download_manager_delegate_.reset(NULL); + download_manager_delegate_.reset(nullptr); } void CefBrowserContext::Initialize() { @@ -313,7 +327,6 @@ void CefBrowserContext::Initialize() { extension_system_ = static_cast( extensions::ExtensionSystem::Get(this)); extension_system_->InitForRegularProfile(true); - resource_context_->set_extensions_info_map(extension_system_->info_map()); // Make sure the ProcessManager is created so that it receives extension // load notifications. This is necessary for the proper initialization of @@ -334,8 +347,7 @@ void CefBrowserContext::Initialize() { // Initialize proxy configuration tracker. pref_proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl( - GetPrefs(), - base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}))); + GetPrefs(), base::CreateSingleThreadTaskRunner({BrowserThread::IO}))); // Spell checking support and possibly other subsystems retrieve the // PrefService associated with a BrowserContext via UserPrefs::Get(). @@ -347,8 +359,7 @@ void CefBrowserContext::Initialize() { if (extensions_enabled) extension_system_->Init(); - ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( - this, resource_context_.get()); + ChromePluginServiceFilter::GetInstance()->RegisterProfile(this); } void CefBrowserContext::AddCefRequestContext(CefRequestContextImpl* context) { @@ -377,6 +388,15 @@ CefBrowserContext* CefBrowserContext::GetForCachePath( return g_manager.Get().GetImplForPath(cache_path); } +// static +CefBrowserContext* CefBrowserContext::GetForIDs(int render_process_id, + int render_frame_id, + int frame_tree_node_id, + bool require_frame_match) { + return g_manager.Get().GetImplForIDs(render_process_id, render_frame_id, + frame_tree_node_id, require_frame_match); +} + // static CefBrowserContext* CefBrowserContext::GetForContext( content::BrowserContext* context) { @@ -397,15 +417,6 @@ CefBrowserContext::GetClientHintsControllerDelegate() { return nullptr; } -net::URLRequestContextGetter* CefBrowserContext::GetRequestContext() { - NOTREACHED() << "NetworkService is required"; - return nullptr; -} - -net::URLRequestContextGetter* CefBrowserContext::CreateMediaRequestContext() { - return GetRequestContext(); -} - void CefBrowserContext::SetCorsOriginAccessListForOrigin( const url::Origin& source_origin, std::vector allow_patterns, @@ -417,7 +428,7 @@ void CefBrowserContext::SetCorsOriginAccessListForOrigin( ChromeZoomLevelPrefs* CefBrowserContext::GetZoomLevelPrefs() { return static_cast( - GetStoragePartition(this, NULL)->GetZoomLevelDelegate()); + GetStoragePartition(this, nullptr)->GetZoomLevelDelegate()); } scoped_refptr @@ -467,11 +478,11 @@ content::BrowserPluginGuestManager* CefBrowserContext::GetGuestManager() { } storage::SpecialStoragePolicy* CefBrowserContext::GetSpecialStoragePolicy() { - return NULL; + return nullptr; } content::PushMessagingService* CefBrowserContext::GetPushMessagingService() { - return NULL; + return nullptr; } content::SSLHostStateDelegate* CefBrowserContext::GetSSLHostStateDelegate() { @@ -500,13 +511,6 @@ CefBrowserContext::GetBrowsingDataRemoverDelegate() { return nullptr; } -net::URLRequestContextGetter* CefBrowserContext::CreateRequestContext( - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) { - NOTREACHED() << "NetworkService is required"; - return nullptr; -} - PrefService* CefBrowserContext::GetPrefs() { return pref_service_.get(); } @@ -599,16 +603,24 @@ void CefBrowserContext::OnRenderFrameCreated( DCHECK_GE(render_frame_id, 0); DCHECK_GE(frame_tree_node_id, 0); + render_id_set_.insert(std::make_pair(render_process_id, render_frame_id)); + node_id_set_.insert(frame_tree_node_id); + CefRefPtr handler = request_context->GetHandler(); - if (handler && resource_context_) { - DCHECK_GE(render_process_id, 0); - // Using base::Unretained() is safe because both this callback and possible - // deletion of |resource_context_| will execute on the IO thread, and this - // callback will be executed first. - CEF_POST_TASK(CEF_IOT, base::Bind(&CefResourceContext::AddHandler, - base::Unretained(resource_context_.get()), - render_process_id, render_frame_id, - frame_tree_node_id, handler)); + if (handler) { + handler_map_.AddHandler(render_process_id, render_frame_id, + frame_tree_node_id, handler); + + if (resource_context_) { + // Using base::Unretained() is safe because both this callback and + // possible deletion of |resource_context_| will execute on the IO thread, + // and this callback will be executed first. + CEF_POST_TASK(CEF_IOT, + base::Bind(&CefResourceContext::AddHandler, + base::Unretained(resource_context_.get()), + render_process_id, render_frame_id, + frame_tree_node_id, handler)); + } } } @@ -624,39 +636,126 @@ void CefBrowserContext::OnRenderFrameDeleted( DCHECK_GE(render_frame_id, 0); DCHECK_GE(frame_tree_node_id, 0); + auto it1 = + render_id_set_.find(std::make_pair(render_process_id, render_frame_id)); + if (it1 != render_id_set_.end()) + render_id_set_.erase(it1); + + auto it2 = node_id_set_.find(frame_tree_node_id); + if (it2 != node_id_set_.end()) + node_id_set_.erase(it2); + CefRefPtr handler = request_context->GetHandler(); - if (handler && resource_context_) { - DCHECK_GE(render_process_id, 0); - // Using base::Unretained() is safe because both this callback and possible - // deletion of |resource_context_| will execute on the IO thread, and this - // callback will be executed first. - CEF_POST_TASK(CEF_IOT, base::Bind(&CefResourceContext::RemoveHandler, - base::Unretained(resource_context_.get()), - render_process_id, render_frame_id, - frame_tree_node_id)); + if (handler) { + handler_map_.RemoveHandler(render_process_id, render_frame_id, + frame_tree_node_id); + + if (resource_context_) { + // Using base::Unretained() is safe because both this callback and + // possible deletion of |resource_context_| will execute on the IO thread, + // and this callback will be executed first. + CEF_POST_TASK( + CEF_IOT, + base::Bind(&CefResourceContext::RemoveHandler, + base::Unretained(resource_context_.get()), + render_process_id, render_frame_id, frame_tree_node_id)); + } } - if (resource_context_ && is_main_frame) { - DCHECK_GE(render_process_id, 0); - // Using base::Unretained() is safe because both this callback and possible - // deletion of |resource_context_| will execute on the IO thread, and this - // callback will be executed first. - CEF_POST_TASK(CEF_IOT, - base::Bind(&CefResourceContext::ClearPluginLoadDecision, - base::Unretained(resource_context_.get()), - render_process_id)); + if (is_main_frame) { + ClearPluginLoadDecision(render_process_id); } } -void CefBrowserContext::OnPurgePluginListCache() { +CefRefPtr CefBrowserContext::GetHandler( + int render_process_id, + int render_frame_id, + int frame_tree_node_id, + bool require_frame_match) const { CEF_REQUIRE_UIT(); - if (resource_context_) { - // Using base::Unretained() is safe because both this callback and possible - // deletion of |resource_context_| will execute on the IO thread, and this - // callback will be executed first. - CEF_POST_TASK(CEF_IOT, - base::Bind(&CefResourceContext::ClearPluginLoadDecision, - base::Unretained(resource_context_.get()), -1)); + return handler_map_.GetHandler(render_process_id, render_frame_id, + frame_tree_node_id, require_frame_match); +} + +bool CefBrowserContext::IsAssociatedContext(int render_process_id, + int render_frame_id, + int frame_tree_node_id, + bool require_frame_match) const { + CEF_REQUIRE_UIT(); + + if (render_process_id >= 0 && render_frame_id >= 0) { + const auto it1 = + render_id_set_.find(std::make_pair(render_process_id, render_frame_id)); + if (it1 != render_id_set_.end()) + return true; + } + + if (frame_tree_node_id >= 0) { + const auto it2 = node_id_set_.find(frame_tree_node_id); + if (it2 != node_id_set_.end()) + return true; + } + + if (render_process_id >= 0 && !require_frame_match) { + // Choose an arbitrary handler for the same process. + for (const auto& render_ids : render_id_set_) { + if (render_ids.first == render_process_id) + return true; + } + } + + return false; +} + +void CefBrowserContext::AddPluginLoadDecision( + int render_process_id, + const base::FilePath& plugin_path, + bool is_main_frame, + const url::Origin& main_frame_origin, + chrome::mojom::PluginStatus status) { + CEF_REQUIRE_UIT(); + DCHECK_GE(render_process_id, 0); + DCHECK(!plugin_path.empty()); + + plugin_load_decision_map_.insert(std::make_pair( + std::make_pair(std::make_pair(render_process_id, plugin_path), + std::make_pair(is_main_frame, main_frame_origin)), + status)); +} + +bool CefBrowserContext::HasPluginLoadDecision( + int render_process_id, + const base::FilePath& plugin_path, + bool is_main_frame, + const url::Origin& main_frame_origin, + chrome::mojom::PluginStatus* status) const { + CEF_REQUIRE_UIT(); + DCHECK_GE(render_process_id, 0); + DCHECK(!plugin_path.empty()); + + PluginLoadDecisionMap::const_iterator it = plugin_load_decision_map_.find( + std::make_pair(std::make_pair(render_process_id, plugin_path), + std::make_pair(is_main_frame, main_frame_origin))); + if (it == plugin_load_decision_map_.end()) + return false; + + *status = it->second; + return true; +} + +void CefBrowserContext::ClearPluginLoadDecision(int render_process_id) { + CEF_REQUIRE_UIT(); + + if (render_process_id == -1) { + plugin_load_decision_map_.clear(); + } else { + PluginLoadDecisionMap::iterator it = plugin_load_decision_map_.begin(); + while (it != plugin_load_decision_map_.end()) { + if (it->first.first.first == render_process_id) + it = plugin_load_decision_map_.erase(it); + else + ++it; + } } } diff --git a/libcef/browser/browser_context.h b/libcef/browser/browser_context.h index fc6c24038..2c5238025 100644 --- a/libcef/browser/browser_context.h +++ b/libcef/browser/browser_context.h @@ -6,18 +6,23 @@ #define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_ #pragma once +#include + #include "include/cef_request_context_handler.h" #include "libcef/browser/chrome_profile_stub.h" +#include "libcef/browser/request_context_handler_map.h" #include "libcef/browser/resource_context.h" #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "chrome/browser/download/download_prefs.h" +#include "chrome/common/plugin.mojom.h" #include "components/proxy_config/pref_proxy_config_tracker.h" #include "components/visitedlink/browser/visitedlink_delegate.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/content_browser_client.h" +#include "url/origin.h" /* // Classes used in request processing (network, storage, service, etc.): @@ -105,6 +110,13 @@ class CefBrowserContext : public ChromeProfileStub, // |cache_path|. static CefBrowserContext* GetForCachePath(const base::FilePath& cache_path); + // Returns the existing instance, if any, associated with the specified IDs. + // See comments on IsAssociatedContext() for usage. + static CefBrowserContext* GetForIDs(int render_process_id, + int render_frame_id, + int frame_tree_node_id, + bool require_frame_match); + // Returns the underlying CefBrowserContext if any. static CefBrowserContext* GetForContext(content::BrowserContext* context); @@ -123,8 +135,6 @@ class CefBrowserContext : public ChromeProfileStub, content::ResourceContext* GetResourceContext() override; content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate() override; - net::URLRequestContextGetter* GetRequestContext() override; - net::URLRequestContextGetter* CreateMediaRequestContext() override; void SetCorsOriginAccessListForOrigin( const url::Origin& source_origin, std::vector allow_patterns, @@ -146,9 +156,6 @@ class CefBrowserContext : public ChromeProfileStub, content::BackgroundSyncController* GetBackgroundSyncController() override; content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate() override; - net::URLRequestContextGetter* CreateRequestContext( - content::ProtocolHandlerMap* protocol_handlers, - content::URLRequestInterceptorScopedVector request_interceptors) override; // Profile methods. ChromeZoomLevelPrefs* GetZoomLevelPrefs() override; @@ -205,9 +212,42 @@ class CefBrowserContext : public ChromeProfileStub, bool is_main_frame, bool is_guest_view); - // Called from CefRequestContextImpl::PurgePluginListCacheInternal when the - // plugin list cache should be purged. - void OnPurgePluginListCache(); + // Returns the handler that matches the specified IDs. Pass -1 for unknown + // values. If |require_frame_match| is true only exact matches will be + // returned. If |require_frame_match| is false, and there is not an exact + // match, then the first handler for the same |render_process_id| will be + // returned. + CefRefPtr GetHandler( + int render_process_id, + int render_frame_id, + int frame_tree_node_id, + bool require_frame_match) const; + + // Returns true if this context is associated with the specified IDs. Pass -1 + // for unknown values. If |require_frame_match| is true only exact matches + // will qualify. If |require_frame_match| is false, and there is not an exact + // match, then any match for |render_process_id| will qualify. + bool IsAssociatedContext(int render_process_id, + int render_frame_id, + int frame_tree_node_id, + bool require_frame_match) const; + + // Remember the plugin load decision for plugin status requests that arrive + // via CefPluginServiceFilter::IsPluginAvailable. + void AddPluginLoadDecision(int render_process_id, + const base::FilePath& plugin_path, + bool is_main_frame, + const url::Origin& main_frame_origin, + chrome::mojom::PluginStatus status); + bool HasPluginLoadDecision(int render_process_id, + const base::FilePath& plugin_path, + bool is_main_frame, + const url::Origin& main_frame_origin, + chrome::mojom::PluginStatus* status) const; + + // Clear the plugin load decisions associated with |render_process_id|, or all + // plugin load decisions if |render_process_id| is -1. + void ClearPluginLoadDecision(int render_process_id); // Called from CefRequestContextImpl methods of the same name. void RegisterSchemeHandlerFactory(const std::string& scheme_name, @@ -274,6 +314,29 @@ class CefBrowserContext : public ChromeProfileStub, std::unique_ptr download_prefs_; + // Map IDs to CefRequestContextHandler objects. + CefRequestContextHandlerMap handler_map_; + + // Map (render_process_id, plugin_path, is_main_frame, main_frame_origin) to + // plugin load decision. + typedef std::map< + std::pair, std::pair>, + chrome::mojom::PluginStatus> + PluginLoadDecisionMap; + PluginLoadDecisionMap plugin_load_decision_map_; + + // Set of (render_process_id, render_frame_id) associated with this context. + typedef std::set> RenderIdSet; + RenderIdSet render_id_set_; + + // Set of frame_tree_node_id associated with this context. Keeping this list + // is necessary because, when navigating the main frame, a new (pre-commit) + // network request will be created before the RenderFrameHost. Consequently we + // can't rely on valid render IDs. See https://crbug.com/776884 for + // background. + typedef std::set NodeIdSet; + NodeIdSet node_id_set_; + DISALLOW_COPY_AND_ASSIGN(CefBrowserContext); }; diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index c8ee66d98..3a192f177 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -67,7 +67,7 @@ #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host.h" -#include "content/public/browser/resource_request_info.h" +#include "content/public/browser/web_contents.h" #include "content/public/common/favicon_url.h" #include "extensions/browser/process_manager.h" #include "net/base/net_errors.h" diff --git a/libcef/browser/browser_main.cc b/libcef/browser/browser_main.cc index 85530d0c0..9447da957 100644 --- a/libcef/browser/browser_main.cc +++ b/libcef/browser/browser_main.cc @@ -28,7 +28,6 @@ #include "base/strings/string_number_conversions.h" #include "base/task/post_task.h" #include "chrome/browser/browser_process.h" -#include "chrome/browser/chrome_browser_main_extra_parts.h" #include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/plugins/plugin_finder.h" #include "components/constrained_window/constrained_window_views.h" @@ -75,13 +74,6 @@ CefBrowserMainParts::CefBrowserMainParts( CefBrowserMainParts::~CefBrowserMainParts() { constrained_window::SetConstrainedWindowViewsClient(nullptr); - for (int i = static_cast(chrome_extra_parts_.size()) - 1; i >= 0; --i) - delete chrome_extra_parts_[i]; - chrome_extra_parts_.clear(); -} - -void CefBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { - chrome_extra_parts_.push_back(parts); } int CefBrowserMainParts::PreEarlyInitialization() { @@ -91,17 +83,9 @@ int CefBrowserMainParts::PreEarlyInitialization() { ui::InitializeInputMethodForTesting(); #endif - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PreEarlyInitialization(); - return service_manager::RESULT_CODE_NORMAL_EXIT; } -void CefBrowserMainParts::PostEarlyInitialization() { - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PostEarlyInitialization(); -} - void CefBrowserMainParts::ToolkitInitialized() { SetConstrainedWindowViewsClient(CreateCefConstrainedWindowViewsClient()); #if defined(USE_AURA) @@ -116,9 +100,6 @@ void CefBrowserMainParts::ToolkitInitialized() { CefContentBrowserClient::Get()->GetResourceDllName()); #endif #endif // defined(USE_AURA) - - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->ToolkitInitialized(); } void CefBrowserMainParts::PreMainMessageLoopStart() { @@ -132,9 +113,6 @@ void CefBrowserMainParts::PreMainMessageLoopStart() { DCHECK(local_state); OSCrypt::Init(local_state); #endif - - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PreMainMessageLoopStart(); } void CefBrowserMainParts::PostMainMessageLoopStart() { @@ -144,9 +122,6 @@ void CefBrowserMainParts::PostMainMessageLoopStart() { printing::PrintingContextLinux::SetPdfPaperSizeFunction( &CefPrintDialogLinux::GetPdfPaperSize); #endif - - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PostMainMessageLoopStart(); } int CefBrowserMainParts::PreCreateThreads() { @@ -161,17 +136,9 @@ int CefBrowserMainParts::PreCreateThreads() { content::GpuDataManager::GetInstance(); SystemNetworkContextManager::CreateInstance(g_browser_process->local_state()); - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PreCreateThreads(); - return 0; } -void CefBrowserMainParts::PostCreateThreads() { - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PostCreateThreads(); -} - void CefBrowserMainParts::PreMainMessageLoopRun() { #if defined(USE_AURA) display::Screen::SetScreenInstance(views::CreateDesktopScreen()); @@ -179,9 +146,6 @@ void CefBrowserMainParts::PreMainMessageLoopRun() { ui::MaterialDesignController::Initialize(); - // CEF's profile is a BrowserContext. - PreProfileInit(); - if (extensions::ExtensionsEnabled()) { // Initialize extension global objects before creating the global // BrowserContext. @@ -200,14 +164,14 @@ void CefBrowserMainParts::PreMainMessageLoopRun() { printing::CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt(); - background_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits( - {base::TaskPriority::BEST_EFFORT, + background_task_runner_ = base::CreateSingleThreadTaskRunner( + {base::ThreadPool(), base::TaskPriority::BEST_EFFORT, base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()}); - user_visible_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits( - {base::TaskPriority::USER_VISIBLE, + user_visible_task_runner_ = base::CreateSingleThreadTaskRunner( + {base::ThreadPool(), base::TaskPriority::USER_VISIBLE, base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()}); - user_blocking_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits( - {base::TaskPriority::USER_BLOCKING, + user_blocking_task_runner_ = base::CreateSingleThreadTaskRunner( + {base::ThreadPool(), base::TaskPriority::USER_BLOCKING, base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()}); CefRequestContextSettings settings; @@ -219,21 +183,12 @@ void CefBrowserMainParts::PreMainMessageLoopRun() { CefBrowserContext* browser_context = static_cast( global_request_context_->GetBrowserContext()); - PostProfileInit(); - CefDevToolsManagerDelegate::StartHttpHandler(browser_context); // Triggers initialization of the singleton instance on UI thread. PluginFinder::GetInstance()->Init(); scheme::RegisterWebUIControllerFactory(); - - // These have no equivalent in CEF. - PreBrowserStart(); - PostBrowserStart(); - - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PreMainMessageLoopRun(); } void CefBrowserMainParts::PostMainMessageLoopRun() { @@ -244,9 +199,6 @@ void CefBrowserMainParts::PostMainMessageLoopRun() { // during shutdown. Did you forget to release a CefBrowser reference? DCHECK(global_request_context_->HasOneRef()); global_request_context_ = NULL; - - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PostMainMessageLoopRun(); } void CefBrowserMainParts::PostDestroyThreads() { @@ -260,23 +212,3 @@ void CefBrowserMainParts::PostDestroyThreads() { delete views::ViewsDelegate::GetInstance(); #endif } - -void CefBrowserMainParts::PreProfileInit() { - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PreProfileInit(); -} - -void CefBrowserMainParts::PostProfileInit() { - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PostProfileInit(); -} - -void CefBrowserMainParts::PreBrowserStart() { - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PreBrowserStart(); -} - -void CefBrowserMainParts::PostBrowserStart() { - for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) - chrome_extra_parts_[i]->PostBrowserStart(); -} diff --git a/libcef/browser/browser_main.h b/libcef/browser/browser_main.h index 70ffe58fa..4b9363438 100644 --- a/libcef/browser/browser_main.h +++ b/libcef/browser/browser_main.h @@ -30,34 +30,21 @@ class WMState; #endif class CefDevToolsDelegate; -class ChromeBrowserMainExtraParts; class CefBrowserMainParts : public content::BrowserMainParts { public: explicit CefBrowserMainParts(const content::MainFunctionParams& parameters); ~CefBrowserMainParts() override; - // Add additional ChromeBrowserMainExtraParts. - void AddParts(ChromeBrowserMainExtraParts* parts); - int PreEarlyInitialization() override; - void PostEarlyInitialization() override; void ToolkitInitialized() override; void PreMainMessageLoopStart() override; void PostMainMessageLoopStart() override; int PreCreateThreads() override; - void PostCreateThreads() override; void PreMainMessageLoopRun() override; void PostMainMessageLoopRun() override; void PostDestroyThreads() override; - // Additional stages for ChromeBrowserMainExtraParts. These stages are called - // in order from PreMainMessageLoopRun(). See implementation for details. - void PreProfileInit(); - void PostProfileInit(); - void PreBrowserStart(); - void PostBrowserStart(); - CefRefPtr request_context() const { return global_request_context_; } @@ -98,10 +85,6 @@ class CefBrowserMainParts : public content::BrowserMainParts { std::unique_ptr wm_state_; #endif - // Vector of additional ChromeBrowserMainExtraParts. - // Parts are deleted in the inverse order they are added. - std::vector chrome_extra_parts_; - DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts); }; diff --git a/libcef/browser/chrome_browser_process_stub.cc b/libcef/browser/chrome_browser_process_stub.cc index 31a06f3b6..d869af031 100644 --- a/libcef/browser/chrome_browser_process_stub.cc +++ b/libcef/browser/chrome_browser_process_stub.cc @@ -338,12 +338,6 @@ ChromeBrowserProcessStub::component_updater() { return NULL; } -component_updater::SupervisedUserWhitelistInstaller* -ChromeBrowserProcessStub::supervised_user_whitelist_installer() { - NOTREACHED(); - return NULL; -} - MediaFileSystemRegistry* ChromeBrowserProcessStub::media_file_system_registry() { NOTREACHED(); @@ -382,9 +376,3 @@ ChromeBrowserProcessStub::resource_coordinator_parts() { NOTREACHED(); return NULL; } - -prefs::InProcessPrefServiceFactory* -ChromeBrowserProcessStub::pref_service_factory() const { - NOTREACHED(); - return NULL; -} diff --git a/libcef/browser/chrome_browser_process_stub.h b/libcef/browser/chrome_browser_process_stub.h index 11e171c4c..60908d3de 100644 --- a/libcef/browser/chrome_browser_process_stub.h +++ b/libcef/browser/chrome_browser_process_stub.h @@ -91,8 +91,6 @@ class ChromeBrowserProcessStub : public BrowserProcess { #endif component_updater::ComponentUpdateService* component_updater() override; - component_updater::SupervisedUserWhitelistInstaller* - supervised_user_whitelist_installer() override; MediaFileSystemRegistry* media_file_system_registry() override; WebRtcLogUploader* webrtc_log_uploader() override; network_time::NetworkTimeTracker* network_time_tracker() override; @@ -102,7 +100,6 @@ class ChromeBrowserProcessStub : public BrowserProcess { resource_coordinator::TabManager* GetTabManager() override; resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts() override; - prefs::InProcessPrefServiceFactory* pref_service_factory() const override; private: bool initialized_; diff --git a/libcef/browser/chrome_profile_stub.cc b/libcef/browser/chrome_profile_stub.cc index a70951299..999d61b99 100644 --- a/libcef/browser/chrome_profile_stub.cc +++ b/libcef/browser/chrome_profile_stub.cc @@ -120,3 +120,12 @@ Profile::ExitType ChromeProfileStub::GetLastSessionExitType() { NOTREACHED(); return EXIT_NORMAL; } + +base::Time ChromeProfileStub::GetCreationTime() const { + NOTREACHED(); + return base::Time(); +} + +void ChromeProfileStub::SetCreationTimeForTesting(base::Time creation_time) { + NOTREACHED(); +} diff --git a/libcef/browser/chrome_profile_stub.h b/libcef/browser/chrome_profile_stub.h index f0527901f..3ab782fb9 100644 --- a/libcef/browser/chrome_profile_stub.h +++ b/libcef/browser/chrome_profile_stub.h @@ -44,6 +44,8 @@ class ChromeProfileStub : public Profile { bool IsIndependentOffTheRecordProfile() override; void SetExitType(ExitType exit_type) override; ExitType GetLastSessionExitType() override; + base::Time GetCreationTime() const override; + void SetCreationTimeForTesting(base::Time creation_time) override; private: DISALLOW_COPY_AND_ASSIGN(ChromeProfileStub); diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc index fa038e574..a9a3a6f8e 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/content_browser_client.cc @@ -38,12 +38,8 @@ #include "libcef/common/extensions/extensions_util.h" #include "libcef/common/net/scheme_registration.h" #include "libcef/common/request_impl.h" -#include "libcef/common/service_manifests/builtin_service_manifests.h" #include "libcef/common/service_manifests/cef_content_browser_overlay_manifest.h" -#include "libcef/common/service_manifests/cef_content_gpu_overlay_manifest.h" #include "libcef/common/service_manifests/cef_content_renderer_overlay_manifest.h" -#include "libcef/common/service_manifests/cef_content_utility_overlay_manifest.h" -#include "libcef/common/service_manifests/cef_renderer_manifest.h" #include "base/base_switches.h" #include "base/command_line.h" @@ -55,27 +51,22 @@ #include "cef/grit/cef_resources.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_content_browser_client.h" -#include "chrome/browser/chrome_service.h" #include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/plugins/plugin_info_host_impl.h" #include "chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.h" #include "chrome/browser/plugins/plugin_utils.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h" +#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/constants.mojom.h" #include "chrome/common/webui_url_constants.h" #include "chrome/grit/browser_resources.h" #include "chrome/grit/generated_resources.h" #include "chrome/services/printing/printing_service.h" -#include "chrome/services/printing/public/mojom/constants.mojom.h" #include "components/navigation_interception/intercept_navigation_throttle.h" #include "components/navigation_interception/navigation_params.h" -#include "components/services/heap_profiling/heap_profiling_service.h" -#include "components/services/heap_profiling/public/mojom/constants.mojom.h" -#include "components/services/pdf_compositor/public/cpp/pdf_compositor_service_factory.h" -#include "components/services/pdf_compositor/public/mojom/pdf_compositor.mojom.h" +#include "components/spellcheck/common/spellcheck.mojom.h" #include "components/version_info/version_info.h" #include "content/browser/frame_host/navigation_handle_impl.h" #include "content/browser/frame_host/render_frame_host_impl.h" @@ -93,7 +84,6 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host.h" #include "content/public/browser/render_widget_host_view.h" -#include "content/public/browser/resource_dispatcher_host.h" #include "content/public/browser/storage_partition.h" #include "content/public/browser/web_ui_url_loader_factory.h" #include "content/public/common/content_switches.h" @@ -112,6 +102,7 @@ #include "extensions/common/constants.h" #include "extensions/common/switches.h" #include "mojo/public/cpp/bindings/remote.h" +#include "mojo/public/cpp/bindings/strong_associated_binding.h" #include "net/base/auth.h" #include "net/ssl/ssl_cert_request_info.h" #include "ppapi/host/ppapi_host.h" @@ -149,6 +140,10 @@ #include "sandbox/win/src/sandbox_policy.h" #endif +#if BUILDFLAG(HAS_SPELLCHECK_PANEL) +#include "chrome/browser/spellchecker/spell_check_panel_host_impl.h" +#endif + namespace { class CefQuotaCallbackImpl : public CefRequestCallback { @@ -483,28 +478,20 @@ bool NavigationOnUIThread( return ignore_navigation; } -const extensions::ExtensionSet* GetEnabledExtensions( - content::BrowserContext* context) { - auto registry = extensions::ExtensionRegistry::Get(context); - return ®istry->enabled_extensions(); -} +// From chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc. +void BindPluginInfoHost( + int render_process_id, + chrome::mojom::PluginInfoHostAssociatedRequest request) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + content::RenderProcessHost* host = + content::RenderProcessHost::FromID(render_process_id); + if (!host) + return; -const extensions::ExtensionSet* GetEnabledExtensions( - content::ResourceContext* context) { - auto cef_context = static_cast(context); - if (!cef_context) - return nullptr; - - return &cef_context->GetExtensionInfoMap()->extensions(); -} - -const extensions::ExtensionSet* GetEnabledExtensions( - content::BrowserOrResourceContext context) { - if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { - return GetEnabledExtensions(context.ToBrowserContext()); - } - DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); - return GetEnabledExtensions(context.ToResourceContext()); + Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); + mojo::MakeStrongAssociatedBinding( + std::make_unique(render_process_id, profile), + std::move(request)); } } // namespace @@ -529,14 +516,11 @@ std::unique_ptr CefContentBrowserClient::CreateBrowserMainParts( const content::MainFunctionParams& parameters) { browser_main_parts_ = new CefBrowserMainParts(parameters); - browser_main_parts_->AddParts( - ChromeService::GetInstance()->CreateExtraParts()); return base::WrapUnique(browser_main_parts_); } void CefContentBrowserClient::RenderProcessWillLaunch( - content::RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) { + content::RenderProcessHost* host) { const int id = host->GetID(); Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); @@ -545,8 +529,7 @@ void CefContentBrowserClient::RenderProcessWillLaunch( if (extensions::ExtensionsEnabled()) { host->AddFilter(new extensions::ExtensionMessageFilter(id, profile)); - host->AddFilter( - new extensions::IOThreadExtensionMessageFilter(id, profile)); + host->AddFilter(new extensions::IOThreadExtensionMessageFilter()); host->AddFilter( new extensions::ExtensionsGuestViewMessageFilter(id, profile)); } @@ -559,17 +542,6 @@ void CefContentBrowserClient::RenderProcessWillLaunch( host->Send( new CefProcessMsg_SetIsIncognitoProcess(profile->IsOffTheRecord())); - - service_manager::mojom::ServicePtrInfo service; - *service_request = mojo::MakeRequest(&service); - service_manager::Identity renderer_identity = host->GetChildIdentity(); - mojo::Remote metadata; - ChromeService::GetInstance()->connector()->RegisterServiceInstance( - service_manager::Identity(chrome::mojom::kRendererServiceName, - renderer_identity.instance_group(), - renderer_identity.instance_id(), - base::Token::CreateRandom()), - std::move(service), metadata.BindNewPipeAndPassReceiver()); } bool CefContentBrowserClient::ShouldUseProcessPerSite( @@ -602,13 +574,15 @@ bool CefContentBrowserClient::ShouldUseProcessPerSite( // Based on // ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess. bool CefContentBrowserClient::DoesSiteRequireDedicatedProcess( - content::BrowserOrResourceContext browser_or_resource_context, + content::BrowserContext* browser_context, const GURL& effective_site_url) { if (!extensions::ExtensionsEnabled()) return false; - auto extension = GetEnabledExtensions(browser_or_resource_context) - ->GetExtensionOrAppByURL(effective_site_url); + const extensions::Extension* extension = + extensions::ExtensionRegistry::Get(browser_context) + ->enabled_extensions() + .GetExtensionOrAppByURL(effective_site_url); // Isolate all extensions. return extension != nullptr; } @@ -708,59 +682,36 @@ void CefContentBrowserClient::SiteInstanceDeleting( site_instance->GetId())); } -void CefContentBrowserClient::RunServiceInstance( - const service_manager::Identity& identity, - mojo::PendingReceiver* receiver) { - const std::string& service_name = identity.name(); - if (service_name == printing::mojom::kServiceName) { - service_manager::Service::RunAsyncUntilTermination( - printing::CreatePdfCompositorService(std::move(*receiver))); +void CefContentBrowserClient::BindHostReceiverForRenderer( + content::RenderProcessHost* render_process_host, + mojo::GenericPendingReceiver receiver) { + if (auto host_receiver = receiver.As()) { + SpellCheckHostChromeImpl::Create(render_process_host->GetID(), + std::move(host_receiver)); return; } - if (service_name == printing::mojom::kChromePrintingServiceName) { - service_manager::Service::RunAsyncUntilTermination( - std::make_unique(std::move(*receiver))); - return; - } -} -void CefContentBrowserClient::RunServiceInstanceOnIOThread( - const service_manager::Identity& identity, - mojo::PendingReceiver* receiver) { - if (identity.name() == chrome::mojom::kServiceName) { - ChromeService::GetInstance()->CreateChromeServiceRequestHandler().Run( - std::move(*receiver)); - return; - } - if (identity.name() == heap_profiling::mojom::kServiceName) { - heap_profiling::HeapProfilingService::GetServiceFactory().Run( - std::move(*receiver)); +#if BUILDFLAG(HAS_SPELLCHECK_PANEL) + if (auto panel_host_receiver = + receiver.As()) { + SpellCheckPanelHostImpl::Create(render_process_host->GetID(), + std::move(panel_host_receiver)); return; } +#endif // BUILDFLAG(HAS_SPELLCHECK_PANEL) } base::Optional CefContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) { if (name == content::mojom::kBrowserServiceName) { return GetCefContentBrowserOverlayManifest(); - } else if (name == content::mojom::kGpuServiceName) { - return GetCefContentGpuOverlayManifest(); } else if (name == content::mojom::kRendererServiceName) { return GetCefContentRendererOverlayManifest(); - } else if (name == content::mojom::kUtilityServiceName) { - return GetCefContentUtilityOverlayManifest(); } return base::nullopt; } -std::vector -CefContentBrowserClient::GetExtraServiceManifests() { - auto manifests = GetBuiltinServiceManifests(); - manifests.push_back(GetCefRendererManifest()); - return manifests; -} - void CefContentBrowserClient::AppendExtraCommandLineSwitches( base::CommandLine* command_line, int child_process_id) { @@ -976,7 +927,6 @@ void CefContentBrowserClient::AllowCertificateError( const GURL& request_url, bool is_main_frame_request, bool strict_enforcement, - bool expired_previous_decision, const base::Callback& callback) { CEF_REQUIRE_UIT(); @@ -1144,18 +1094,18 @@ CefContentBrowserClient::CreateThrottlesForNavigation( return throttles; } -std::vector> +std::vector> CefContentBrowserClient::CreateURLLoaderThrottles( const network::ResourceRequest& request, - content::BrowserContext* resource_context, + content::BrowserContext* browser_context, const base::RepeatingCallback& wc_getter, content::NavigationUIData* navigation_ui_data, int frame_tree_node_id) { - std::vector> result; + std::vector> result; // Used to substitute View ID for PDF contents when using the PDF plugin. result.push_back(std::make_unique( - resource_context, request.resource_type, frame_tree_node_id)); + request.resource_type, frame_tree_node_id)); return result; } @@ -1189,7 +1139,8 @@ const wchar_t* CefContentBrowserClient::GetResourceDllName() { return file_path; } -bool CefContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy) { +bool CefContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy, + RendererSpawnFlags flags) { return true; } #endif // defined(OS_WIN) @@ -1198,10 +1149,8 @@ void CefContentBrowserClient::ExposeInterfacesToRenderer( service_manager::BinderRegistry* registry, blink::AssociatedInterfaceRegistry* associated_registry, content::RenderProcessHost* host) { - Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); - host->GetChannel()->AddAssociatedInterfaceForIOThread(base::Bind( - &PluginInfoHostImpl::OnPluginInfoHostRequest, - base::MakeRefCounted(host->GetID(), profile))); + associated_registry->AddInterface( + base::BindRepeating(&BindPluginInfoHost, host->GetID())); } std::unique_ptr @@ -1297,23 +1246,19 @@ bool CefContentBrowserClient::WillCreateURLLoaderFactory( content::BrowserContext* browser_context, content::RenderFrameHost* frame, int render_process_id, - bool is_navigation, - bool is_download, + URLLoaderFactoryType type, const url::Origin& request_initiator, mojo::PendingReceiver* factory_receiver, - network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client, + mojo::PendingRemote* + header_client, bool* bypass_redirect_checks) { auto request_handler = net_service::CreateInterceptedRequestHandler( - browser_context, frame, render_process_id, is_navigation, is_download, - request_initiator); - - auto proxied_receiver = std::move(*factory_receiver); - network::mojom::URLLoaderFactoryPtrInfo target_factory_info; - *factory_receiver = mojo::MakeRequest(&target_factory_info); + browser_context, frame, render_process_id, + type == URLLoaderFactoryType::kNavigation, + type == URLLoaderFactoryType::kDownload, request_initiator); net_service::ProxyURLLoaderFactory::CreateProxy( - browser_context, std::move(proxied_receiver), - std::move(target_factory_info), header_client, + browser_context, factory_receiver, header_client, std::move(request_handler)); return true; } @@ -1362,7 +1307,7 @@ CefContentBrowserClient::GetNetworkContextsParentDirectory() { bool CefContentBrowserClient::HandleExternalProtocol( const GURL& url, - content::ResourceRequestInfo::WebContentsGetter web_contents_getter, + content::WebContents::Getter web_contents_getter, int child_id, content::NavigationUIData* navigation_data, bool is_main_frame, @@ -1374,7 +1319,7 @@ bool CefContentBrowserClient::HandleExternalProtocol( } bool CefContentBrowserClient::HandleExternalProtocol( - content::ResourceRequestInfo::WebContentsGetter web_contents_getter, + content::WebContents::Getter web_contents_getter, int frame_tree_node_id, content::NavigationUIData* navigation_data, const network::ResourceRequest& resource_request, @@ -1396,8 +1341,7 @@ bool CefContentBrowserClient::HandleExternalProtocol( [](network::mojom::URLLoaderFactoryRequest request, std::unique_ptr request_handler, - content::ResourceRequestInfo::WebContentsGetter - web_contents_getter) { + content::WebContents::Getter web_contents_getter) { // Manages its own lifetime. net_service::ProxyURLLoaderFactory::CreateProxy( @@ -1440,9 +1384,9 @@ blink::UserAgentMetadata CefContentBrowserClient::GetUserAgentMetadata() { base::flat_set CefContentBrowserClient::GetPluginMimeTypesWithExternalHandlers( - content::ResourceContext* resource_context) { + content::BrowserContext* browser_context) { base::flat_set mime_types; - auto map = PluginUtils::GetMimeTypeToExtensionIdMap(resource_context); + auto map = PluginUtils::GetMimeTypeToExtensionIdMap(browser_context); for (const auto& pair : map) mime_types.insert(pair.first); return mime_types; diff --git a/libcef/browser/content_browser_client.h b/libcef/browser/content_browser_client.h index c39e8e7d8..5ac9e9890 100644 --- a/libcef/browser/content_browser_client.h +++ b/libcef/browser/content_browser_client.h @@ -41,14 +41,11 @@ class CefContentBrowserClient : public content::ContentBrowserClient { // ContentBrowserClient implementation. std::unique_ptr CreateBrowserMainParts( const content::MainFunctionParams& parameters) override; - void RenderProcessWillLaunch( - content::RenderProcessHost* host, - service_manager::mojom::ServiceRequest* service_request) override; + void RenderProcessWillLaunch(content::RenderProcessHost* host) override; bool ShouldUseProcessPerSite(content::BrowserContext* browser_context, const GURL& effective_url) override; - bool DoesSiteRequireDedicatedProcess( - content::BrowserOrResourceContext browser_or_resource_contexts, - const GURL& effective_site_url) override; + bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context, + const GURL& effective_site_url) override; void GetAdditionalWebUISchemes( std::vector* additional_schemes) override; void GetAdditionalViewSourceSchemes( @@ -59,17 +56,11 @@ class CefContentBrowserClient : public content::ContentBrowserClient { bool IsHandledURL(const GURL& url) override; void SiteInstanceGotProcess(content::SiteInstance* site_instance) override; void SiteInstanceDeleting(content::SiteInstance* site_instance) override; - void RunServiceInstance( - const service_manager::Identity& identity, - mojo::PendingReceiver* receiver) - override; - void RunServiceInstanceOnIOThread( - const service_manager::Identity& identity, - mojo::PendingReceiver* receiver) - override; + void BindHostReceiverForRenderer( + content::RenderProcessHost* render_process_host, + mojo::GenericPendingReceiver receiver) override; base::Optional GetServiceManifestOverlay( base::StringPiece name) override; - std::vector GetExtraServiceManifests() override; void AppendExtraCommandLineSwitches(base::CommandLine* command_line, int child_process_id) override; void AdjustUtilityServiceProcessCommandLine( @@ -98,7 +89,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient { const GURL& request_url, bool is_main_frame_request, bool strict_enforcement, - bool expired_previous_decision, const base::Callback& callback) override; base::OnceClosure SelectClientCertificate( @@ -128,10 +118,10 @@ class CefContentBrowserClient : public content::ContentBrowserClient { std::vector> CreateThrottlesForNavigation( content::NavigationHandle* navigation_handle) override; - std::vector> + std::vector> CreateURLLoaderThrottles( const network::ResourceRequest& request, - content::BrowserContext* resource_context, + content::BrowserContext* browser_context, const base::RepeatingCallback& wc_getter, content::NavigationUIData* navigation_ui_data, int frame_tree_node_id) override; @@ -145,7 +135,8 @@ class CefContentBrowserClient : public content::ContentBrowserClient { #if defined(OS_WIN) const wchar_t* GetResourceDllName(); - bool PreSpawnRenderer(sandbox::TargetPolicy* policy) override; + bool PreSpawnRenderer(sandbox::TargetPolicy* policy, + RendererSpawnFlags flags) override; #endif void ExposeInterfacesToRenderer( @@ -174,11 +165,11 @@ class CefContentBrowserClient : public content::ContentBrowserClient { content::BrowserContext* browser_context, content::RenderFrameHost* frame, int render_process_id, - bool is_navigation, - bool is_download, + URLLoaderFactoryType type, const url::Origin& request_initiator, mojo::PendingReceiver* factory_receiver, - network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client, + mojo::PendingRemote* + header_client, bool* bypass_redirect_checks) override; void OnNetworkServiceCreated( network::mojom::NetworkService* network_service) override; @@ -189,7 +180,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient { std::vector GetNetworkContextsParentDirectory() override; bool HandleExternalProtocol( const GURL& url, - content::ResourceRequestInfo::WebContentsGetter web_contents_getter, + content::WebContents::Getter web_contents_getter, int child_id, content::NavigationUIData* navigation_data, bool is_main_frame, @@ -197,7 +188,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient { bool has_user_gesture, network::mojom::URLLoaderFactoryPtr* out_factory) override; bool HandleExternalProtocol( - content::ResourceRequestInfo::WebContentsGetter web_contents_getter, + content::WebContents::Getter web_contents_getter, int frame_tree_node_id, content::NavigationUIData* navigation_data, const network::ResourceRequest& request, @@ -209,7 +200,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient { std::string GetUserAgent() override; blink::UserAgentMetadata GetUserAgentMetadata() override; base::flat_set GetPluginMimeTypesWithExternalHandlers( - content::ResourceContext* resource_context) override; + content::BrowserContext* browser_context) override; // Perform browser process registration for the custom scheme. void RegisterCustomScheme(const std::string& scheme); diff --git a/libcef/browser/devtools/devtools_file_manager.cc b/libcef/browser/devtools/devtools_file_manager.cc index de440b504..f6e1cffa4 100644 --- a/libcef/browser/devtools/devtools_file_manager.cc +++ b/libcef/browser/devtools/devtools_file_manager.cc @@ -43,8 +43,8 @@ CefDevToolsFileManager::CefDevToolsFileManager(CefBrowserHostImpl* browser_impl, PrefService* prefs) : browser_impl_(browser_impl), prefs_(prefs), - file_task_runner_( - base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()})), + file_task_runner_(base::CreateSequencedTaskRunner( + {base::ThreadPool(), base::MayBlock()})), weak_factory_(this) {} void CefDevToolsFileManager::SaveToFile(const std::string& url, diff --git a/libcef/browser/devtools/devtools_frontend.cc b/libcef/browser/devtools/devtools_frontend.cc index 2a5601eeb..262a1280a 100644 --- a/libcef/browser/devtools/devtools_frontend.cc +++ b/libcef/browser/devtools/devtools_frontend.cc @@ -197,9 +197,9 @@ void CefDevToolsFrontend::InspectElementAt(int x, int y) { } void CefDevToolsFrontend::Close() { - base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::UI}, - base::Bind(&CefBrowserHostImpl::CloseBrowser, - frontend_browser_.get(), true)); + base::PostTask(FROM_HERE, {content::BrowserThread::UI}, + base::Bind(&CefBrowserHostImpl::CloseBrowser, + frontend_browser_.get(), true)); } void CefDevToolsFrontend::DisconnectFromTarget() { diff --git a/libcef/browser/extensions/api/tabs/tabs_api.h b/libcef/browser/extensions/api/tabs/tabs_api.h index 13cff0270..a195109f7 100644 --- a/libcef/browser/extensions/api/tabs/tabs_api.h +++ b/libcef/browser/extensions/api/tabs/tabs_api.h @@ -21,7 +21,7 @@ class WebContents; namespace extensions { namespace cef { -class TabsGetFunction : public UIThreadExtensionFunction { +class TabsGetFunction : public ExtensionFunction { ~TabsGetFunction() override {} ResponseAction Run() override; @@ -29,7 +29,7 @@ class TabsGetFunction : public UIThreadExtensionFunction { DECLARE_EXTENSION_FUNCTION("tabs.get", TABS_GET) }; -class TabsCreateFunction : public UIThreadExtensionFunction { +class TabsCreateFunction : public ExtensionFunction { public: TabsCreateFunction(); ~TabsCreateFunction() override {} @@ -88,7 +88,7 @@ class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { }; // Based on ChromeAsyncExtensionFunction. -class ZoomAPIFunction : public UIThreadExtensionFunction { +class ZoomAPIFunction : public ExtensionFunction { public: ZoomAPIFunction(); diff --git a/libcef/browser/extensions/extension_function_details.cc b/libcef/browser/extensions/extension_function_details.cc index 86f658970..73f77d048 100644 --- a/libcef/browser/extensions/extension_function_details.cc +++ b/libcef/browser/extensions/extension_function_details.cc @@ -83,9 +83,10 @@ class CefGetExtensionLoadFileCallbackImpl return; } - base::PostTaskWithTraitsAndReplyWithResult( + base::PostTaskAndReplyWithResult( FROM_HERE, - {base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, + {base::ThreadPool(), base::MayBlock(), + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}, base::BindOnce(LoadFileFromStream, file, stream), std::move(callback)); } @@ -135,7 +136,7 @@ class CefGetExtensionLoadFileCallbackImpl } // namespace CefExtensionFunctionDetails::CefExtensionFunctionDetails( - UIThreadExtensionFunction* function) + ExtensionFunction* function) : function_(function) {} CefExtensionFunctionDetails::~CefExtensionFunctionDetails() {} @@ -401,9 +402,17 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab( return nullptr; // Return data about the newly created tab. + auto extension = function()->extension(); + auto web_contents = new_browser->web_contents(); auto result = CreateTabObject(new_browser, opener_browser_id, active, index); - ExtensionTabUtil::ScrubTabForExtension( - function()->extension(), new_browser->web_contents(), result.get()); + auto scrub_tab_behavior = ExtensionTabUtil::GetScrubTabBehavior( + extension, extensions::Feature::Context::UNSPECIFIED_CONTEXT, + web_contents); + if (scrub_tab_behavior != ExtensionTabUtil::kDontScrubTab) { + ExtensionTabUtil::ScrubTabForExtension(extension, web_contents, + result.get(), scrub_tab_behavior); + } + return result->ToValue().release(); } diff --git a/libcef/browser/extensions/extension_function_details.h b/libcef/browser/extensions/extension_function_details.h index 7304b170c..1ba710230 100644 --- a/libcef/browser/extensions/extension_function_details.h +++ b/libcef/browser/extensions/extension_function_details.h @@ -15,7 +15,7 @@ #include "ui/gfx/native_widget_types.h" class Profile; -class UIThreadExtensionFunction; +class ExtensionFunction; namespace content { class WebContents; @@ -23,13 +23,13 @@ class WebContents; namespace extensions { -// Provides CEF-specific details to UIThreadExtensionFunction implementations. +// Provides CEF-specific details to ExtensionFunction implementations. // Based on chrome/browser/extensions/chrome_extension_function_details.h. class CefExtensionFunctionDetails { public: // Constructs a new ChromeExtensionFunctionDetails instance for |function|. // This instance does not own |function| and must outlive it. - explicit CefExtensionFunctionDetails(UIThreadExtensionFunction* function); + explicit CefExtensionFunctionDetails(ExtensionFunction* function); ~CefExtensionFunctionDetails(); Profile* GetProfile() const; @@ -124,9 +124,9 @@ class CefExtensionFunctionDetails { static std::unique_ptr CreateMutedInfo( content::WebContents* contents); - // Returns a pointer to the associated UIThreadExtensionFunction - UIThreadExtensionFunction* function() { return function_; } - const UIThreadExtensionFunction* function() const { return function_; } + // Returns a pointer to the associated ExtensionFunction + ExtensionFunction* function() { return function_; } + const ExtensionFunction* function() const { return function_; } protected: CefRefPtr GetCefExtension() const; @@ -134,7 +134,7 @@ class CefExtensionFunctionDetails { private: // The function for which these details have been created. Must outlive the // CefExtensionFunctionDetails instance. - UIThreadExtensionFunction* function_; + ExtensionFunction* function_; mutable CefRefPtr cef_extension_; diff --git a/libcef/browser/extensions/extension_system.cc b/libcef/browser/extensions/extension_system.cc index 12ef49235..66f521b52 100644 --- a/libcef/browser/extensions/extension_system.cc +++ b/libcef/browser/extensions/extension_system.cc @@ -419,7 +419,7 @@ void CefExtensionSystem::RegisterExtensionWithRequestContexts( const base::Closure& callback) { // TODO(extensions): The |incognito_enabled| value should be set based on // manifest settings. - base::PostTaskWithTraitsAndReply( + base::PostTaskAndReply( FROM_HERE, {BrowserThread::IO}, base::Bind(&InfoMap::AddExtension, info_map(), base::RetainedRef(extension), base::Time::Now(), @@ -433,7 +433,7 @@ void CefExtensionSystem::RegisterExtensionWithRequestContexts( void CefExtensionSystem::UnregisterExtensionWithRequestContexts( const std::string& extension_id, const UnloadedExtensionReason reason) { - base::PostTaskWithTraits( + base::PostTask( FROM_HERE, {BrowserThread::IO}, base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason)); } diff --git a/libcef/browser/extensions/extensions_browser_client.cc b/libcef/browser/extensions/extensions_browser_client.cc index 3b902f823..75d55161b 100644 --- a/libcef/browser/extensions/extensions_browser_client.cc +++ b/libcef/browser/extensions/extensions_browser_client.cc @@ -281,10 +281,11 @@ CefExtensionsBrowserClient::GetComponentExtensionResourceManager() { void CefExtensionsBrowserClient::BroadcastEventToRenderers( events::HistogramValue histogram_value, const std::string& event_name, - std::unique_ptr args) { + std::unique_ptr args, + bool dispatch_to_off_the_record_profiles) { g_browser_process->extension_event_router_forwarder() ->BroadcastEventToRenderers(histogram_value, event_name, std::move(args), - GURL()); + GURL(), dispatch_to_off_the_record_profiles); } ExtensionCache* CefExtensionsBrowserClient::GetExtensionCache() { diff --git a/libcef/browser/extensions/extensions_browser_client.h b/libcef/browser/extensions/extensions_browser_client.h index c6faacff0..ebd8b97f2 100644 --- a/libcef/browser/extensions/extensions_browser_client.h +++ b/libcef/browser/extensions/extensions_browser_client.h @@ -93,7 +93,8 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient { void BroadcastEventToRenderers( events::HistogramValue histogram_value, const std::string& event_name, - std::unique_ptr args) override; + std::unique_ptr args, + bool dispatch_to_off_the_record_profiles) override; ExtensionCache* GetExtensionCache() override; bool IsBackgroundUpdateAllowed() override; bool IsMinBrowserVersionSupported(const std::string& min_version) override; diff --git a/libcef/browser/extensions/value_store/cef_value_store.cc b/libcef/browser/extensions/value_store/cef_value_store.cc index 6320782cf..fc7e1c880 100644 --- a/libcef/browser/extensions/value_store/cef_value_store.cc +++ b/libcef/browser/extensions/value_store/cef_value_store.cc @@ -98,8 +98,10 @@ ValueStore::WriteResult CefValueStore::Set( if (!storage_.GetWithoutPathExpansion(it.key(), &old_value) || !old_value->Equals(&it.value())) { changes->push_back(ValueStoreChange( - it.key(), old_value ? old_value->CreateDeepCopy() : nullptr, - it.value().CreateDeepCopy())); + it.key(), + old_value ? base::Optional(old_value->Clone()) + : base::nullopt, + it.value().Clone())); storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy()); } } @@ -121,7 +123,8 @@ ValueStore::WriteResult CefValueStore::Remove( it != keys.end(); ++it) { std::unique_ptr old_value; if (storage_.RemoveWithoutPathExpansion(*it, &old_value)) { - changes->push_back(ValueStoreChange(*it, std::move(old_value), nullptr)); + changes->push_back( + ValueStoreChange(*it, std::move(*old_value), base::nullopt)); } } return WriteResult(std::move(changes), CreateStatusCopy(status_)); diff --git a/libcef/browser/menu_model_impl.cc b/libcef/browser/menu_model_impl.cc index 1708bfc92..4051766a6 100644 --- a/libcef/browser/menu_model_impl.cc +++ b/libcef/browser/menu_model_impl.cc @@ -104,7 +104,7 @@ class CefSimpleMenuModel : public ui::MenuModel { return impl_->GetGroupIdAt(index); } - bool GetIconAt(int index, gfx::Image* icon) override { return false; } + bool GetIconAt(int index, gfx::Image* icon) const override { return false; } ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const override { return NULL; diff --git a/libcef/browser/native/window_delegate_view.cc b/libcef/browser/native/window_delegate_view.cc index d3489c636..7600d139c 100644 --- a/libcef/browser/native/window_delegate_view.cc +++ b/libcef/browser/native/window_delegate_view.cc @@ -54,7 +54,7 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget, : ui::ZOrderLevel::kNormal; // Results in a call to InitContent(). - widget->Init(params); + widget->Init(std::move(params)); // |widget| should now be associated with |this|. DCHECK_EQ(widget, GetWidget()); diff --git a/libcef/browser/native/window_x11.cc b/libcef/browser/native/window_x11.cc index 5ce95c522..6a2a57384 100644 --- a/libcef/browser/native/window_x11.cc +++ b/libcef/browser/native/window_x11.cc @@ -41,8 +41,8 @@ const char kUTF8String[] = "UTF8_STRING"; ::Window* children; ::Window child_window = x11::None; unsigned int nchildren; - if (XQueryTree(display, window, &root, &parent, &children, &nchildren)) { - DCHECK_EQ(1U, nchildren); + if (XQueryTree(display, window, &root, &parent, &children, &nchildren) && + nchildren == 1) { child_window = children[0]; XFree(children); } diff --git a/libcef/browser/net/chrome_scheme_handler.cc b/libcef/browser/net/chrome_scheme_handler.cc index d9e7bc0c6..4a71ee8f2 100644 --- a/libcef/browser/net/chrome_scheme_handler.cc +++ b/libcef/browser/net/chrome_scheme_handler.cc @@ -462,7 +462,7 @@ class CefURLDataSource : public content::URLDataSource { void StartDataRequest( const std::string& path, - const content::ResourceRequestInfo::WebContentsGetter& wc_getter, + const content::WebContents::Getter& wc_getter, const content::URLDataSource::GotDataCallback& callback) override { callback.Run(output_); } @@ -638,87 +638,19 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory { // From chrome/browser/chrome_content_browser_client.cc - // Returns a copy of the given url with its host set to given host and path - // set to given path. Other parts of the url will be the same. - static GURL ReplaceURLHostAndPath(const GURL& url, - const std::string& host, - const std::string& path) { - url::Replacements replacements; - replacements.SetHost(host.c_str(), url::Component(0, host.length())); - replacements.SetPath(path.c_str(), url::Component(0, path.length())); - return url.ReplaceComponents(replacements); - } - - // Maps "foo://bar/baz/" to "foo://chrome/bar/baz/". - static GURL AddUberHost(const GURL& url) { - const std::string uber_host = chrome::kChromeUIUberHost; - std::string new_path; - url.host_piece().AppendToString(&new_path); - url.path_piece().AppendToString(&new_path); - - return ReplaceURLHostAndPath(url, uber_host, new_path); - } - - // If url->host() is "chrome" and url->path() has characters other than the - // first slash, changes the url from "foo://chrome/bar/" to "foo://bar/" and - // returns true. Otherwise returns false. - static bool RemoveUberHost(GURL* url) { - if (url->host() != chrome::kChromeUIUberHost) - return false; - - if (url->path().empty() || url->path() == "/") - return false; - - const std::string old_path = url->path(); - - const std::string::size_type separator = old_path.find('/', 1); - std::string new_host; - std::string new_path; - if (separator == std::string::npos) { - new_host = old_path.substr(1); - } else { - new_host = old_path.substr(1, separator - 1); - new_path = old_path.substr(separator); - } - - // Do not allow URLs with paths empty before the first slash since we can't - // have an empty host. (e.g "foo://chrome//") - if (new_host.empty()) - return false; - - *url = ReplaceURLHostAndPath(*url, new_host, new_path); - - DCHECK(url->is_valid()); - - return true; - } - // Handles rewriting Web UI URLs. static bool HandleWebUI(GURL* url, content::BrowserContext* browser_context) { - // Do not handle special URLs such as "about:foo" - if (!url->host().empty()) { - const GURL chrome_url = AddUberHost(*url); - - // Handle valid "chrome://chrome/foo" URLs so the reverse handler will - // be called. - if (GetInstance()->UseWebUIForURL(browser_context, chrome_url)) - return true; - } - if (!GetInstance()->UseWebUIForURL(browser_context, *url)) return false; return true; } - // Reverse URL handler for Web UI. Maps "chrome://chrome/foo/" to - // "chrome://foo/". + // Reverse URL handler for Web UI. static bool HandleWebUIReverse(GURL* url, content::BrowserContext* browser_context) { - if (!url->is_valid() || !url->SchemeIs(content::kChromeUIScheme)) - return false; - - return RemoveUberHost(url); + // No need to actually reverse-rewrite the URL. + return false; } DISALLOW_COPY_AND_ASSIGN(CefWebUIControllerFactory); diff --git a/libcef/browser/net_service/cookie_helper.cc b/libcef/browser/net_service/cookie_helper.cc index 7c15475df..75aab5699 100644 --- a/libcef/browser/net_service/cookie_helper.cc +++ b/libcef/browser/net_service/cookie_helper.cc @@ -35,26 +35,26 @@ network::mojom::CookieManager* GetCookieManager( void ContinueWithLoadedCookies(const AllowCookieCallback& allow_cookie_callback, DoneCookieCallback done_callback, - const net::CookieList& cookies) { + const net::CookieStatusList& cookies) { CEF_REQUIRE_IOT(); net::CookieList allowed_cookies; - for (const auto& cookie : cookies) { + for (const auto& status : cookies) { bool allow = false; - allow_cookie_callback.Run(cookie, &allow); + allow_cookie_callback.Run(status.cookie, &allow); if (allow) - allowed_cookies.push_back(cookie); + allowed_cookies.push_back(status.cookie); } std::move(done_callback).Run(cookies.size(), std::move(allowed_cookies)); } void GetCookieListCallback(const AllowCookieCallback& allow_cookie_callback, DoneCookieCallback done_callback, - const net::CookieList& cookies, + const net::CookieStatusList& included_cookies, const net::CookieStatusList&) { CEF_REQUIRE_UIT(); CEF_POST_TASK(CEF_IOT, base::BindOnce(ContinueWithLoadedCookies, allow_cookie_callback, - std::move(done_callback), cookies)); + std::move(done_callback), included_cookies)); } void LoadCookiesOnUIThread(content::BrowserContext* browser_context, @@ -87,7 +87,7 @@ void SetCanonicalCookieCallback( net::CanonicalCookie::CookieInclusionStatus status) { CEF_REQUIRE_UIT(); progress->num_cookie_lines_left_--; - if (status == net::CanonicalCookie::CookieInclusionStatus::INCLUDE) { + if (status.IsInclude()) { progress->allowed_cookies_.push_back(cookie); } @@ -133,7 +133,8 @@ void SaveCookiesOnUIThread(content::BrowserContext* browser_context, SetCanonicalCookieCallback( progress, net::CanonicalCookie(), - net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR); + net::CanonicalCookie::CookieInclusionStatus( + net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR)); } } // namespace @@ -145,7 +146,7 @@ void LoadCookies(content::BrowserContext* browser_context, CEF_REQUIRE_IOT(); if ((request.load_flags & net::LOAD_DO_NOT_SEND_COOKIES) || - !request.allow_credentials) { + request.credentials_mode == network::mojom::CredentialsMode::kOmit) { // Continue immediately without loading cookies. std::move(done_callback).Run(0, {}); return; @@ -172,7 +173,7 @@ void SaveCookies(content::BrowserContext* browser_context, DoneCookieCallback done_callback) { CEF_REQUIRE_IOT(); - if (!request.allow_credentials || + if (request.credentials_mode == network::mojom::CredentialsMode::kOmit || !head.headers->HasHeader(net_service::kHTTPSetCookieHeaderName)) { // Continue immediately without saving cookies. std::move(done_callback).Run(0, {}); @@ -187,7 +188,6 @@ void SaveCookies(content::BrowserContext* browser_context, net::CookieOptions options; options.set_include_httponly(); - options.set_server_time(response_date); options.set_same_site_cookie_context( net::cookie_util::ComputeSameSiteContextForRequest( request.method, request.url, request.site_for_cookies, @@ -204,10 +204,9 @@ void SaveCookies(content::BrowserContext* browser_context, net::CanonicalCookie::CookieInclusionStatus returned_status; std::unique_ptr cookie = net::CanonicalCookie::Create( - request.url, cookie_string, base::Time::Now(), options, - &returned_status); - if (returned_status != - net::CanonicalCookie::CookieInclusionStatus::INCLUDE) { + request.url, cookie_string, base::Time::Now(), + base::make_optional(response_date), &returned_status); + if (!returned_status.IsInclude()) { continue; } diff --git a/libcef/browser/net_service/cookie_manager_impl.cc b/libcef/browser/net_service/cookie_manager_impl.cc index dc680eeef..00c960394 100644 --- a/libcef/browser/net_service/cookie_manager_impl.cc +++ b/libcef/browser/net_service/cookie_manager_impl.cc @@ -38,11 +38,8 @@ void SetCookieCallbackImpl(CefRefPtr callback, net::CanonicalCookie::CookieInclusionStatus status) { if (!callback.get()) return; - CEF_POST_TASK( - CEF_UIT, - base::Bind( - &CefSetCookieCallback::OnComplete, callback.get(), - status == net::CanonicalCookie::CookieInclusionStatus::INCLUDE)); + CEF_POST_TASK(CEF_UIT, base::Bind(&CefSetCookieCallback::OnComplete, + callback.get(), status.IsInclude())); } // Always execute the callback asynchronously. @@ -79,19 +76,22 @@ void ExecuteVisitor(CefRefPtr visitor, } // Always execute the callback asynchronously. -void GetCookiesCallbackImpl(CefRefPtr visitor, - CefRefPtr request_context, - const net::CookieList& cookies, - const net::CookieStatusList&) { +void GetAllCookiesCallbackImpl(CefRefPtr visitor, + CefRefPtr request_context, + const net::CookieList& cookies) { CEF_POST_TASK(CEF_UIT, base::Bind(&ExecuteVisitor, visitor, request_context, cookies)); } -void GetAllCookiesCallbackImpl(CefRefPtr visitor, - CefRefPtr request_context, - const net::CookieList& cookies) { - GetCookiesCallbackImpl(visitor, request_context, cookies, - net::CookieStatusList()); +void GetCookiesCallbackImpl(CefRefPtr visitor, + CefRefPtr request_context, + const net::CookieStatusList& include_cookies, + const net::CookieStatusList&) { + net::CookieList cookies; + for (const auto& status : include_cookies) { + cookies.push_back(status.cookie); + } + GetAllCookiesCallbackImpl(visitor, request_context, cookies); } } // namespace @@ -221,9 +221,10 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url, net::CookieSameSite::UNSPECIFIED, net::COOKIE_PRIORITY_DEFAULT); if (!canonical_cookie) { - SetCookieCallbackImpl( - callback, - net::CanonicalCookie::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR); + SetCookieCallbackImpl(callback, + net::CanonicalCookie::CookieInclusionStatus( + net::CanonicalCookie::CookieInclusionStatus:: + EXCLUDE_UNKNOWN_ERROR)); return true; } diff --git a/libcef/browser/net_service/proxy_url_loader_factory.cc b/libcef/browser/net_service/proxy_url_loader_factory.cc index 3046e7fbf..7fe56e50b 100644 --- a/libcef/browser/net_service/proxy_url_loader_factory.cc +++ b/libcef/browser/net_service/proxy_url_loader_factory.cc @@ -16,6 +16,7 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/resource_context.h" #include "content/public/browser/web_contents.h" +#include "mojo/public/cpp/base/big_buffer.h" #include "net/http/http_status_code.h" #include "services/network/public/cpp/cors/cors.h" @@ -37,7 +38,7 @@ class ResourceContextData : public base::SupportsUserData::Data { static void AddProxyOnUIThread( ProxyURLLoaderFactory* proxy, - content::ResourceRequestInfo::WebContentsGetter web_contents_getter) { + content::WebContents::Getter web_contents_getter) { CEF_REQUIRE_UIT(); content::WebContents* web_contents = web_contents_getter.Run(); @@ -130,7 +131,8 @@ class InterceptedRequest : public network::mojom::URLLoader, void Restart(); // Called from ProxyURLLoaderFactory::OnLoaderCreated. - void OnLoaderCreated(network::mojom::TrustedHeaderClientRequest request); + void OnLoaderCreated( + mojo::PendingReceiver receiver); // Called from InterceptDelegate::OnInputStreamOpenFailed. void InputStreamFailed(bool restart_needed); @@ -142,9 +144,9 @@ class InterceptedRequest : public network::mojom::URLLoader, OnHeadersReceivedCallback callback) override; // mojom::URLLoaderClient methods: - void OnReceiveResponse(const network::ResourceResponseHead& head) override; + void OnReceiveResponse(network::mojom::URLResponseHeadPtr head) override; void OnReceiveRedirect(const net::RedirectInfo& redirect_info, - const network::ResourceResponseHead& head) override; + network::mojom::URLResponseHeadPtr head) override; void OnUploadProgress(int64_t current_position, int64_t total_size, OnUploadProgressCallback callback) override; @@ -158,7 +160,6 @@ class InterceptedRequest : public network::mojom::URLLoader, void FollowRedirect(const std::vector& removed_headers, const net::HttpRequestHeaders& modified_headers, const base::Optional& new_url) override; - void ProceedWithResponse() override; void SetPriority(net::RequestPriority priority, int32_t intra_priority_value) override; void PauseReadingBodyFromNet() override; @@ -259,7 +260,8 @@ class InterceptedRequest : public network::mojom::URLLoader, bool current_request_uses_header_client_ = false; OnHeadersReceivedCallback on_headers_received_callback_; - mojo::Binding header_client_binding_; + mojo::Receiver header_client_receiver_{ + this}; StreamReaderURLLoader* stream_loader_ = nullptr; @@ -321,7 +323,6 @@ InterceptedRequest::InterceptedRequest( target_client_(std::move(client)), proxied_client_binding_(this), target_factory_(std::move(target_factory)), - header_client_binding_(this), weak_factory_(this) { status_ = network::URLLoaderCompletionStatus(net::OK); @@ -354,11 +355,11 @@ void InterceptedRequest::Restart() { target_loader_.reset(); } - if (header_client_binding_.is_bound()) - header_client_binding_.Unbind(); + if (header_client_receiver_.is_bound()) + ignore_result(header_client_receiver_.Unbind()); current_request_uses_header_client_ = - !!factory_->url_loader_header_client_binding_; + !!factory_->url_loader_header_client_receiver_; const GURL original_url = request_.url; @@ -371,11 +372,11 @@ void InterceptedRequest::Restart() { } void InterceptedRequest::OnLoaderCreated( - network::mojom::TrustedHeaderClientRequest request) { + mojo::PendingReceiver receiver) { DCHECK(current_request_uses_header_client_); // Only called if we're using the default loader. - header_client_binding_.Bind(std::move(request)); + header_client_receiver_.Bind(std::move(receiver)); } void InterceptedRequest::InputStreamFailed(bool restart_needed) { @@ -443,7 +444,7 @@ void InterceptedRequest::OnHeadersReceived(const std::string& headers, // URLLoaderClient methods. void InterceptedRequest::OnReceiveResponse( - const network::ResourceResponseHead& head) { + network::mojom::URLResponseHeadPtr head) { if (current_request_uses_header_client_) { // Use the headers we got from OnHeadersReceived as that'll contain // Set-Cookie if it existed. @@ -463,7 +464,7 @@ void InterceptedRequest::OnReceiveResponse( void InterceptedRequest::OnReceiveRedirect( const net::RedirectInfo& redirect_info, - const network::ResourceResponseHead& head) { + network::mojom::URLResponseHeadPtr head) { bool needs_callback = false; if (current_request_uses_header_client_) { @@ -575,11 +576,6 @@ void InterceptedRequest::FollowRedirect( Restart(); } -void InterceptedRequest::ProceedWithResponse() { - if (target_loader_) - target_loader_->ProceedWithResponse(); -} - void InterceptedRequest::SetPriority(net::RequestPriority priority, int32_t intra_priority_value) { if (target_loader_) @@ -699,7 +695,7 @@ void InterceptedRequest::ContinueAfterInterceptWithOverride( // avoid having Set-Cookie headers stripped by the IPC layer. current_request_uses_header_client_ = true; network::mojom::TrustedHeaderClientPtr header_client; - header_client_binding_.Bind(mojo::MakeRequest(&header_client)); + header_client_receiver_.Bind(mojo::MakeRequest(&header_client)); stream_loader_ = new StreamReaderURLLoader( id_, request_, std::move(proxied_client), std::move(header_client), @@ -951,7 +947,7 @@ void InterceptedRequest::CallOnComplete( // Since the original client is gone no need to continue loading the // request. proxied_client_binding_.Close(); - header_client_binding_.Close(); + header_client_receiver_.reset(); target_loader_.reset(); // In case there are pending checks as to whether this request should be @@ -1034,13 +1030,12 @@ InterceptedRequestHandler::OnFilterResponseBody( //============================== ProxyURLLoaderFactory::ProxyURLLoaderFactory( - network::mojom::URLLoaderFactoryRequest loader_request, + mojo::PendingReceiver factory_receiver, network::mojom::URLLoaderFactoryPtrInfo target_factory_info, - network::mojom::TrustedURLLoaderHeaderClientRequest header_client_request, + mojo::PendingReceiver + header_client_receiver, std::unique_ptr request_handler) - : url_loader_header_client_binding_(this), - request_handler_(std::move(request_handler)), - weak_factory_(this) { + : request_handler_(std::move(request_handler)), weak_factory_(this) { CEF_REQUIRE_IOT(); DCHECK(request_handler_); @@ -1050,12 +1045,12 @@ ProxyURLLoaderFactory::ProxyURLLoaderFactory( target_factory_.set_connection_error_handler(base::BindOnce( &ProxyURLLoaderFactory::OnTargetFactoryError, base::Unretained(this))); } - proxy_bindings_.AddBinding(this, std::move(loader_request)); + proxy_bindings_.AddBinding(this, std::move(factory_receiver)); proxy_bindings_.set_connection_error_handler(base::BindRepeating( &ProxyURLLoaderFactory::OnProxyBindingError, base::Unretained(this))); - if (header_client_request) - url_loader_header_client_binding_.Bind(std::move(header_client_request)); + if (header_client_receiver) + url_loader_header_client_receiver_.Bind(std::move(header_client_receiver)); } ProxyURLLoaderFactory::~ProxyURLLoaderFactory() { @@ -1064,15 +1059,16 @@ ProxyURLLoaderFactory::~ProxyURLLoaderFactory() { // static void ProxyURLLoaderFactory::CreateOnIOThread( - network::mojom::URLLoaderFactoryRequest loader_request, + mojo::PendingReceiver factory_receiver, network::mojom::URLLoaderFactoryPtrInfo target_factory_info, - network::mojom::TrustedURLLoaderHeaderClientRequest header_client_request, + mojo::PendingReceiver + header_client_receiver, content::ResourceContext* resource_context, std::unique_ptr request_handler) { CEF_REQUIRE_IOT(); auto proxy = new ProxyURLLoaderFactory( - std::move(loader_request), std::move(target_factory_info), - std::move(header_client_request), std::move(request_handler)); + std::move(factory_receiver), std::move(target_factory_info), + std::move(header_client_receiver), std::move(request_handler)); ResourceContextData::AddProxy(proxy, resource_context); } @@ -1087,16 +1083,21 @@ void ProxyURLLoaderFactory::SetDisconnectCallback( // static void ProxyURLLoaderFactory::CreateProxy( content::BrowserContext* browser_context, - network::mojom::URLLoaderFactoryRequest loader_request, - network::mojom::URLLoaderFactoryPtrInfo target_factory_info, - network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client, + mojo::PendingReceiver* factory_receiver, + mojo::PendingRemote* + header_client, std::unique_ptr request_handler) { CEF_REQUIRE_UIT(); DCHECK(request_handler); - network::mojom::TrustedURLLoaderHeaderClientRequest header_client_request; + auto proxied_receiver = std::move(*factory_receiver); + network::mojom::URLLoaderFactoryPtrInfo target_factory_info; + *factory_receiver = mojo::MakeRequest(&target_factory_info); + + mojo::PendingReceiver + header_client_receiver; if (header_client) - header_client_request = mojo::MakeRequest(header_client); + header_client_receiver = header_client->InitWithNewPipeAndPassReceiver(); content::ResourceContext* resource_context = browser_context->GetResourceContext(); @@ -1105,21 +1106,23 @@ void ProxyURLLoaderFactory::CreateProxy( CEF_POST_TASK( CEF_IOT, base::BindOnce( - &ProxyURLLoaderFactory::CreateOnIOThread, std::move(loader_request), - std::move(target_factory_info), std::move(header_client_request), + &ProxyURLLoaderFactory::CreateOnIOThread, std::move(proxied_receiver), + std::move(target_factory_info), std::move(header_client_receiver), base::Unretained(resource_context), std::move(request_handler))); } // static ProxyURLLoaderFactory* ProxyURLLoaderFactory::CreateProxy( - content::ResourceRequestInfo::WebContentsGetter web_contents_getter, + content::WebContents::Getter web_contents_getter, network::mojom::URLLoaderFactoryRequest loader_request, std::unique_ptr request_handler) { CEF_REQUIRE_IOT(); DCHECK(request_handler); - auto proxy = new ProxyURLLoaderFactory(std::move(loader_request), nullptr, - nullptr, std::move(request_handler)); + auto proxy = new ProxyURLLoaderFactory( + std::move(loader_request), nullptr, + mojo::PendingReceiver(), + std::move(request_handler)); CEF_POST_TASK(CEF_UIT, base::BindOnce(ResourceContextData::AddProxyOnUIThread, base::Unretained(proxy), web_contents_getter)); @@ -1169,11 +1172,11 @@ void ProxyURLLoaderFactory::Clone( void ProxyURLLoaderFactory::OnLoaderCreated( int32_t request_id, - network::mojom::TrustedHeaderClientRequest request) { + mojo::PendingReceiver receiver) { CEF_REQUIRE_IOT(); auto request_it = requests_.find(request_id); if (request_it != requests_.end()) - request_it->second->OnLoaderCreated(std::move(request)); + request_it->second->OnLoaderCreated(std::move(receiver)); } void ProxyURLLoaderFactory::OnTargetFactoryError() { diff --git a/libcef/browser/net_service/proxy_url_loader_factory.h b/libcef/browser/net_service/proxy_url_loader_factory.h index 124e217dd..e063c80e4 100644 --- a/libcef/browser/net_service/proxy_url_loader_factory.h +++ b/libcef/browser/net_service/proxy_url_loader_factory.h @@ -12,10 +12,13 @@ #include "base/containers/unique_ptr_adapters.h" #include "base/hash/hash.h" #include "base/macros.h" +#include "base/optional.h" #include "base/strings/string_piece.h" #include "content/public/browser/content_browser_client.h" -#include "content/public/browser/resource_request_info.h" +#include "content/public/browser/web_contents.h" #include "mojo/public/cpp/bindings/binding_set.h" +#include "mojo/public/cpp/bindings/pending_receiver.h" +#include "services/network/public/cpp/resource_response.h" #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" @@ -137,14 +140,14 @@ class ProxyURLLoaderFactory // Create a proxy object on the UI thread. static void CreateProxy( content::BrowserContext* browser_context, - network::mojom::URLLoaderFactoryRequest loader_request, - network::mojom::URLLoaderFactoryPtrInfo target_factory_info, - network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client, + mojo::PendingReceiver* factory_receiver, + mojo::PendingRemote* + header_client, std::unique_ptr request_handler); // Create a proxy object on the IO thread. static ProxyURLLoaderFactory* CreateProxy( - content::ResourceRequestInfo::WebContentsGetter web_contents_getter, + content::WebContents::Getter web_contents_getter, network::mojom::URLLoaderFactoryRequest loader_request, std::unique_ptr request_handler); @@ -162,22 +165,25 @@ class ProxyURLLoaderFactory // network::mojom::TrustedURLLoaderHeaderClient: void OnLoaderCreated( int32_t request_id, - network::mojom::TrustedHeaderClientRequest request) override; + mojo::PendingReceiver receiver) + override; private: friend class InterceptedRequest; friend class ResourceContextData; ProxyURLLoaderFactory( - network::mojom::URLLoaderFactoryRequest loader_request, + mojo::PendingReceiver factory_receiver, network::mojom::URLLoaderFactoryPtrInfo target_factory_info, - network::mojom::TrustedURLLoaderHeaderClientRequest header_client_request, + mojo::PendingReceiver + header_client_receiver, std::unique_ptr request_handler); static void CreateOnIOThread( - network::mojom::URLLoaderFactoryRequest loader_request, + mojo::PendingReceiver factory_receiver, network::mojom::URLLoaderFactoryPtrInfo target_factory_info, - network::mojom::TrustedURLLoaderHeaderClientRequest header_client_request, + mojo::PendingReceiver + header_client_receiver, content::ResourceContext* resource_context, std::unique_ptr request_handler); @@ -192,7 +198,7 @@ class ProxyURLLoaderFactory mojo::BindingSet proxy_bindings_; network::mojom::URLLoaderFactoryPtr target_factory_; mojo::Binding - url_loader_header_client_binding_; + url_loader_header_client_receiver_{this}; std::unique_ptr request_handler_; diff --git a/libcef/browser/net_service/resource_request_handler_wrapper.cc b/libcef/browser/net_service/resource_request_handler_wrapper.cc index 629672856..a0ddb3e34 100644 --- a/libcef/browser/net_service/resource_request_handler_wrapper.cc +++ b/libcef/browser/net_service/resource_request_handler_wrapper.cc @@ -1175,7 +1175,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler { void InitOnUIThread( scoped_refptr init_helper, - content::ResourceRequestInfo::WebContentsGetter web_contents_getter, + content::WebContents::Getter web_contents_getter, int frame_tree_node_id, const network::ResourceRequest& request) { CEF_REQUIRE_UIT(); @@ -1300,7 +1300,7 @@ std::unique_ptr CreateInterceptedRequestHandler( } std::unique_ptr CreateInterceptedRequestHandler( - content::ResourceRequestInfo::WebContentsGetter web_contents_getter, + content::WebContents::Getter web_contents_getter, int frame_tree_node_id, const network::ResourceRequest& request) { auto wrapper = std::make_unique(); diff --git a/libcef/browser/net_service/resource_request_handler_wrapper.h b/libcef/browser/net_service/resource_request_handler_wrapper.h index 00816ad45..4ed933a20 100644 --- a/libcef/browser/net_service/resource_request_handler_wrapper.h +++ b/libcef/browser/net_service/resource_request_handler_wrapper.h @@ -5,7 +5,7 @@ #ifndef CEF_LIBCEF_BROWSER_NET_SERVICE_RESOURCE_REQUEST_HANDLER_WRAPPER_H_ #define CEF_LIBCEF_BROWSER_NET_SERVICE_RESOURCE_REQUEST_HANDLER_WRAPPER_H_ -#include "content/public/browser/resource_request_info.h" +#include "content/public/browser/web_contents.h" namespace content { class BrowserContext; @@ -39,7 +39,7 @@ std::unique_ptr CreateInterceptedRequestHandler( // CefResourceRequestHandler. The resulting object should be passed to // ProxyURLLoaderFactory::CreateProxy. Called on the IO thread only. std::unique_ptr CreateInterceptedRequestHandler( - content::ResourceRequestInfo::WebContentsGetter web_contents_getter, + content::WebContents::Getter web_contents_getter, int frame_tree_node_id, const network::ResourceRequest& request); diff --git a/libcef/browser/net_service/stream_reader_url_loader.cc b/libcef/browser/net_service/stream_reader_url_loader.cc index 6d76bac1b..dce8c45b7 100644 --- a/libcef/browser/net_service/stream_reader_url_loader.cc +++ b/libcef/browser/net_service/stream_reader_url_loader.cc @@ -478,7 +478,7 @@ StreamReaderURLLoader::StreamReaderURLLoader( // All InputStream work will be performed on this task runner. stream_work_task_runner_ = - base::CreateSequencedTaskRunnerWithTraits({base::MayBlock()}); + base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock()}); } StreamReaderURLLoader::~StreamReaderURLLoader() { @@ -537,8 +537,6 @@ void StreamReaderURLLoader::FollowRedirect( NOTREACHED(); } -void StreamReaderURLLoader::ProceedWithResponse() {} - void StreamReaderURLLoader::SetPriority(net::RequestPriority priority, int intra_priority_value) {} diff --git a/libcef/browser/net_service/stream_reader_url_loader.h b/libcef/browser/net_service/stream_reader_url_loader.h index 301158e63..4b391975e 100644 --- a/libcef/browser/net_service/stream_reader_url_loader.h +++ b/libcef/browser/net_service/stream_reader_url_loader.h @@ -13,6 +13,7 @@ #include "mojo/public/cpp/system/simple_watcher.h" #include "net/http/http_byte_range.h" #include "services/network/public/cpp/net_adapters.h" +#include "services/network/public/cpp/resource_response.h" #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/url_loader.mojom.h" @@ -173,7 +174,6 @@ class StreamReaderURLLoader : public network::mojom::URLLoader { void FollowRedirect(const std::vector& removed_headers, const net::HttpRequestHeaders& modified_headers, const base::Optional& new_url) override; - void ProceedWithResponse() override; void SetPriority(net::RequestPriority priority, int intra_priority_value) override; void PauseReadingBodyFromNet() override; diff --git a/libcef/browser/net_service/url_loader_factory_getter.cc b/libcef/browser/net_service/url_loader_factory_getter.cc index f57dba0ea..346482219 100644 --- a/libcef/browser/net_service/url_loader_factory_getter.cc +++ b/libcef/browser/net_service/url_loader_factory_getter.cc @@ -61,8 +61,8 @@ scoped_refptr URLLoaderFactoryGetter::Create( // Allow the Content embedder to inject itself if it wants to. should_proxy |= CefContentBrowserClient::Get()->WillCreateURLLoaderFactory( browser_context, render_frame_host, render_process_id, - false /* is_navigation */, false /* is_download */, url::Origin(), - &maybe_proxy_factory_request, nullptr /* header_client */, + content::ContentBrowserClient::URLLoaderFactoryType::kDocumentSubResource, + url::Origin(), &maybe_proxy_factory_request, nullptr /* header_client */, nullptr /* bypass_redirect_checks */); // If anyone above indicated that they care about proxying, pass the diff --git a/libcef/browser/osr/host_display_client_osr.cc b/libcef/browser/osr/host_display_client_osr.cc index ee8b01be2..fa4c82f43 100644 --- a/libcef/browser/osr/host_display_client_osr.cc +++ b/libcef/browser/osr/host_display_client_osr.cc @@ -13,7 +13,7 @@ #include "components/viz/common/resources/resource_format.h" #include "components/viz/common/resources/resource_sizes.h" #include "mojo/public/cpp/system/platform_handle.h" -#include "services/viz/privileged/interfaces/compositing/layered_window_updater.mojom.h" +#include "services/viz/privileged/mojom/compositing/layered_window_updater.mojom.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkRect.h" diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index c61a1f896..f1a1601c4 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -29,6 +29,7 @@ #include "content/browser/bad_message.h" #include "content/browser/compositor/image_transport_factory.h" #include "content/browser/frame_host/render_widget_host_view_guest.h" +#include "content/browser/gpu/gpu_data_manager_impl.h" #include "content/browser/renderer_host/cursor_manager.h" #include "content/browser/renderer_host/delegated_frame_host.h" #include "content/browser/renderer_host/dip_util.h" @@ -247,7 +248,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( Show(); } - if (!factory->IsGpuCompositingDisabled()) { + if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled()) { video_consumer_.reset(new CefVideoConsumerOSR(this)); video_consumer_->SetActive(true); video_consumer_->SetFrameRate( @@ -258,8 +259,10 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() { // Marking the DelegatedFrameHost as removed from the window hierarchy is // necessary to remove all connections to its old ui::Compositor. - if (is_showing_) - delegated_frame_host_->WasHidden(); + if (is_showing_) { + delegated_frame_host_->WasHidden( + content::DelegatedFrameHost::HiddenCause::kOther); + } delegated_frame_host_->DetachFromCompositor(); delegated_frame_host_.reset(nullptr); @@ -347,7 +350,8 @@ void CefRenderWidgetHostViewOSR::Hide() { if (render_widget_host_) render_widget_host_->WasHidden(); - GetDelegatedFrameHost()->WasHidden(); + GetDelegatedFrameHost()->WasHidden( + content::DelegatedFrameHost::HiddenCause::kOther); GetDelegatedFrameHost()->DetachFromCompositor(); } @@ -395,7 +399,7 @@ base::Optional CefRenderWidgetHostViewOSR::GetBackgroundColor() { void CefRenderWidgetHostViewOSR::UpdateBackgroundColor() {} -bool CefRenderWidgetHostViewOSR::LockMouse() { +bool CefRenderWidgetHostViewOSR::LockMouse(bool request_unadjusted_movement) { return false; } @@ -447,10 +451,6 @@ void CefRenderWidgetHostViewOSR::SubmitCompositorFrame( NOTREACHED(); } -void CefRenderWidgetHostViewOSR::ClearCompositorFrame() { - NOTREACHED(); -} - void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() { GetDelegatedFrameHost()->ResetFallbackToFirstNavigationSurface(); } diff --git a/libcef/browser/osr/render_widget_host_view_osr.h b/libcef/browser/osr/render_widget_host_view_osr.h index 44c987412..26cf5f2ef 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.h +++ b/libcef/browser/osr/render_widget_host_view_osr.h @@ -18,6 +18,7 @@ #include "libcef/browser/osr/motion_event_osr.h" #include "base/memory/weak_ptr.h" +#include "base/optional.h" #include "build/build_config.h" #include "components/viz/common/frame_sinks/begin_frame_source.h" #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h" @@ -125,7 +126,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, void SetBackgroundColor(SkColor color) override; base::Optional GetBackgroundColor() override; void UpdateBackgroundColor() override; - bool LockMouse() override; + bool LockMouse(bool request_unadjusted_movement) override; void UnlockMouse() override; void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override; @@ -143,7 +144,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, const viz::LocalSurfaceId& local_surface_id, viz::CompositorFrame frame, base::Optional hit_test_region_list) override; - void ClearCompositorFrame() override; void ResetFallbackToFirstNavigationSurface() override; void InitAsPopup(content::RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) override; diff --git a/libcef/browser/osr/software_output_device_proxy.h b/libcef/browser/osr/software_output_device_proxy.h index 0eede5bb6..38e9ce3f3 100644 --- a/libcef/browser/osr/software_output_device_proxy.h +++ b/libcef/browser/osr/software_output_device_proxy.h @@ -5,8 +5,8 @@ #include "base/threading/thread_checker.h" #include "components/viz/service/display/software_output_device.h" #include "components/viz/service/viz_service_export.h" -#include "services/viz/privileged/interfaces/compositing/display_private.mojom.h" -#include "services/viz/privileged/interfaces/compositing/layered_window_updater.mojom.h" +#include "services/viz/privileged/mojom/compositing/display_private.mojom.h" +#include "services/viz/privileged/mojom/compositing/layered_window_updater.mojom.h" namespace viz { diff --git a/libcef/browser/plugins/plugin_service_filter.cc b/libcef/browser/plugins/plugin_service_filter.cc index dee12095f..e1dbdcd4d 100644 --- a/libcef/browser/plugins/plugin_service_filter.cc +++ b/libcef/browser/plugins/plugin_service_filter.cc @@ -5,8 +5,7 @@ #include "libcef/browser/plugins/plugin_service_filter.h" #include "include/cef_request_context_handler.h" -#include "libcef/browser/browser_host_impl.h" -#include "libcef/browser/resource_context.h" +#include "libcef/browser/browser_context.h" #include "libcef/browser/thread_util.h" #include "libcef/browser/web_plugin_impl.h" #include "libcef/common/content_client.h" @@ -18,17 +17,13 @@ CefPluginServiceFilter::CefPluginServiceFilter() {} bool CefPluginServiceFilter::IsPluginAvailable( int render_process_id, int render_frame_id, - const void* context, const GURL& url, bool is_main_frame, const url::Origin& main_frame_origin, content::WebPluginInfo* plugin) { - // With PlzNavigate this can be called before the renderer process exists. - if (render_process_id < 0) - return true; + CEF_REQUIRE_UIT(); + DCHECK_GT(render_process_id, 0); - CefResourceContext* resource_context = const_cast( - reinterpret_cast(context)); chrome::mojom::PluginStatus status = chrome::mojom::PluginStatus::kAllowed; // Perform origin check here because we're passing an empty origin value to @@ -52,8 +47,8 @@ bool CefPluginServiceFilter::IsPluginAvailable( // retrieve the actual load decision with a non-empty origin. That will // determine whether the plugin load is allowed or the plugin placeholder is // displayed. - return IsPluginAvailable(render_process_id, render_frame_id, resource_context, - url, is_main_frame, url::Origin(), plugin, &status); + return IsPluginAvailable(render_process_id, render_frame_id, url, + is_main_frame, url::Origin(), plugin, &status); } bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id, @@ -64,14 +59,13 @@ bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id, bool CefPluginServiceFilter::IsPluginAvailable( int render_process_id, int render_frame_id, - content::ResourceContext* content_resource_context, const GURL& url, bool is_main_frame, const url::Origin& main_frame_origin, content::WebPluginInfo* plugin, chrome::mojom::PluginStatus* status) { - CefResourceContext* resource_context = - static_cast(content_resource_context); + CEF_REQUIRE_UIT(); + DCHECK_GT(render_process_id, 0); if (*status == chrome::mojom::PluginStatus::kNotFound) { // The plugin does not exist so no need to query the handler. @@ -94,19 +88,23 @@ bool CefPluginServiceFilter::IsPluginAvailable( return true; } - // The |render_frame_id| value may not be valid, so allow matches with any - // handler that shares the same |render_process_id| value. - CefRefPtr handler = resource_context->GetHandler( + auto browser_context = CefBrowserContext::GetForIDs( render_process_id, render_frame_id, -1, false); + CefRefPtr handler; + if (browser_context) { + handler = browser_context->GetHandler(render_process_id, render_frame_id, + -1, false); + } + if (!handler) { // No handler so go with the default plugin load decision. return *status != chrome::mojom::PluginStatus::kDisabled; } // Check for a cached plugin load decision. - if (resource_context->HasPluginLoadDecision(render_process_id, plugin->path, - is_main_frame, main_frame_origin, - status)) { + if (browser_context->HasPluginLoadDecision(render_process_id, plugin->path, + is_main_frame, main_frame_origin, + status)) { return *status != chrome::mojom::PluginStatus::kDisabled; } @@ -156,9 +154,9 @@ bool CefPluginServiceFilter::IsPluginAvailable( } // Cache the plugin load decision. - resource_context->AddPluginLoadDecision(render_process_id, plugin->path, - is_main_frame, main_frame_origin, - *status); + browser_context->AddPluginLoadDecision(render_process_id, plugin->path, + is_main_frame, main_frame_origin, + *status); return *status != chrome::mojom::PluginStatus::kDisabled; } diff --git a/libcef/browser/plugins/plugin_service_filter.h b/libcef/browser/plugins/plugin_service_filter.h index 36268ba1e..3322bac97 100644 --- a/libcef/browser/plugins/plugin_service_filter.h +++ b/libcef/browser/plugins/plugin_service_filter.h @@ -25,7 +25,6 @@ class CefPluginServiceFilter : public content::PluginServiceFilter { // exposed to JavaScript via 'navigator.plugins'. bool IsPluginAvailable(int render_process_id, int render_frame_id, - const void* context, const GURL& url, bool is_main_frame, const url::Origin& main_frame_origin, @@ -41,7 +40,6 @@ class CefPluginServiceFilter : public content::PluginServiceFilter { // See related discussion in issue #2015. bool IsPluginAvailable(int render_process_id, int render_frame_id, - content::ResourceContext* resource_context, const GURL& url, bool is_main_frame, const url::Origin& main_frame_origin, diff --git a/libcef/browser/prefs/browser_prefs.cc b/libcef/browser/prefs/browser_prefs.cc index e3ef85870..f65d90b35 100644 --- a/libcef/browser/prefs/browser_prefs.cc +++ b/libcef/browser/prefs/browser_prefs.cc @@ -25,18 +25,16 @@ #include "chrome/browser/prefs/chrome_command_line_pref_store.h" #include "chrome/browser/renderer_host/pepper/device_id_fetcher.h" #include "chrome/browser/ssl/ssl_config_service_manager.h" -#include "chrome/browser/supervised_user/supervised_user_pref_store.h" -#include "chrome/browser/supervised_user/supervised_user_settings_service.h" -#include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/ui/webui/print_preview/sticky_settings.h" +#include "chrome/common/buildflags.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/grit/locale_settings.h" #include "components/certificate_transparency/pref_names.h" #include "components/content_settings/core/browser/cookie_settings.h" #include "components/content_settings/core/browser/host_content_settings_map.h" -#include "components/google/core/browser/google_url_tracker.h" +#include "components/flags_ui/pref_service_flags_storage.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/language/core/browser/language_prefs.h" #include "components/language/core/browser/pref_names.h" @@ -61,6 +59,12 @@ #include "components/os_crypt/os_crypt.h" #endif +#if BUILDFLAG(ENABLE_SUPERVISED_USERS) +#include "chrome/browser/supervised_user/supervised_user_pref_store.h" +#include "chrome/browser/supervised_user/supervised_user_settings_service.h" +#include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h" +#endif + namespace browser_prefs { namespace { @@ -104,8 +108,9 @@ std::unique_ptr CreatePrefService(Profile* profile, // Get sequenced task runner for making sure that file operations are // executed in expected order (what was previously assured by the FILE // thread). - sequenced_task_runner = base::CreateSequencedTaskRunnerWithTraits( - {base::MayBlock(), base::TaskShutdownBehavior::BLOCK_SHUTDOWN}); + sequenced_task_runner = base::CreateSequencedTaskRunner( + {base::ThreadPool(), base::MayBlock(), + base::TaskShutdownBehavior::BLOCK_SHUTDOWN}); } // Used to store user preferences. @@ -170,6 +175,7 @@ std::unique_ptr CreatePrefService(Profile* profile, // Default preferences. CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get()); certificate_transparency::prefs::RegisterPrefs(registry.get()); + flags_ui::PrefServiceFlagsStorage::RegisterPrefs(registry.get()); PluginInfoHostImpl::RegisterUserPrefs(registry.get()); PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get()); SSLConfigServiceManager::RegisterPrefs(registry.get()); @@ -215,7 +221,6 @@ std::unique_ptr CreatePrefService(Profile* profile, chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get()); DeviceIDFetcher::RegisterProfilePrefs(registry.get()); extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get()); - GoogleURLTracker::RegisterProfilePrefs(registry.get()); HostContentSettingsMap::RegisterProfilePrefs(registry.get()); language::LanguagePrefs::RegisterProfilePrefs(registry.get()); ProfileNetworkContextService::RegisterProfilePrefs(registry.get()); diff --git a/libcef/browser/print_settings_impl.cc b/libcef/browser/print_settings_impl.cc index a284a5f38..b91942fe7 100644 --- a/libcef/browser/print_settings_impl.cc +++ b/libcef/browser/print_settings_impl.cc @@ -6,15 +6,15 @@ #include "base/logging.h" -CefPrintSettingsImpl::CefPrintSettingsImpl(printing::PrintSettings* value, - bool will_delete, - bool read_only) - : CefValueBase( - value, - NULL, - will_delete ? kOwnerWillDelete : kOwnerNoDelete, - read_only, - NULL) {} +CefPrintSettingsImpl::CefPrintSettingsImpl( + std::unique_ptr settings, + bool read_only) + : CefValueBase(settings.get(), + nullptr, + kOwnerNoDelete, + read_only, + nullptr), + settings_(std::move(settings)) {} bool CefPrintSettingsImpl::IsValid() { return !detached(); @@ -24,13 +24,6 @@ bool CefPrintSettingsImpl::IsReadOnly() { return read_only(); } -CefRefPtr CefPrintSettingsImpl::Copy() { - CEF_VALUE_VERIFY_RETURN(false, NULL); - printing::PrintSettings* new_settings = new printing::PrintSettings; - *new_settings = const_value(); - return new CefPrintSettingsImpl(new_settings, true, false); -} - void CefPrintSettingsImpl::SetOrientation(bool landscape) { CEF_VALUE_VERIFY_RETURN_VOID(true); mutable_value()->SetOrientation(landscape); @@ -155,9 +148,15 @@ CefPrintSettings::DuplexMode CefPrintSettingsImpl::GetDuplexMode() { return static_cast(const_value().duplex_mode()); } +std::unique_ptr CefPrintSettingsImpl::TakeOwnership() { + Detach(nullptr); + return std::move(settings_); +} + // CefPrintSettings implementation. // static CefRefPtr CefPrintSettings::Create() { - return new CefPrintSettingsImpl(new printing::PrintSettings(), true, false); + return new CefPrintSettingsImpl(std::make_unique(), + false); } diff --git a/libcef/browser/print_settings_impl.h b/libcef/browser/print_settings_impl.h index 0855038a2..589048eb7 100644 --- a/libcef/browser/print_settings_impl.h +++ b/libcef/browser/print_settings_impl.h @@ -15,14 +15,12 @@ class CefPrintSettingsImpl : public CefValueBase { public: - CefPrintSettingsImpl(printing::PrintSettings* value, - bool will_delete, + CefPrintSettingsImpl(std::unique_ptr settings, bool read_only); // CefPrintSettings methods. bool IsValid() override; bool IsReadOnly() override; - CefRefPtr Copy() override; void SetOrientation(bool landscape) override; bool IsLandscape() override; void SetPrinterPrintableArea(const CefSize& physical_size_device_units, @@ -46,8 +44,10 @@ class CefPrintSettingsImpl void SetDuplexMode(DuplexMode mode) override; DuplexMode GetDuplexMode() override; - // Must hold the controller lock while using this value. - const printing::PrintSettings& print_settings() { return const_value(); } + std::unique_ptr TakeOwnership() WARN_UNUSED_RESULT; + + private: + std::unique_ptr settings_; DISALLOW_COPY_AND_ASSIGN(CefPrintSettingsImpl); }; diff --git a/libcef/browser/printing/print_dialog_linux.cc b/libcef/browser/printing/print_dialog_linux.cc index 5092c6f53..e56de5286 100644 --- a/libcef/browser/printing/print_dialog_linux.cc +++ b/libcef/browser/printing/print_dialog_linux.cc @@ -173,12 +173,12 @@ CefPrintDialogLinux::~CefPrintDialogLinux() { } void CefPrintDialogLinux::UseDefaultSettings() { - PrintSettings settings; - UpdateSettings(&settings, true); + UpdateSettings(std::make_unique(), true); } -void CefPrintDialogLinux::UpdateSettings(printing::PrintSettings* settings) { - UpdateSettings(settings, false); +void CefPrintDialogLinux::UpdateSettings( + std::unique_ptr settings) { + UpdateSettings(std::move(settings), false); } void CefPrintDialogLinux::ShowDialog( @@ -267,8 +267,9 @@ void CefPrintDialogLinux::ReleaseHandler() { } } -bool CefPrintDialogLinux::UpdateSettings(printing::PrintSettings* settings, - bool get_defaults) { +bool CefPrintDialogLinux::UpdateSettings( + std::unique_ptr settings, + bool get_defaults) { CEF_REQUIRE_UIT(); SetHandler(); @@ -276,11 +277,10 @@ bool CefPrintDialogLinux::UpdateSettings(printing::PrintSettings* settings, return false; CefRefPtr settings_impl( - new CefPrintSettingsImpl(settings, false, false)); + new CefPrintSettingsImpl(std::move(settings), false)); handler_->OnPrintSettings(browser_.get(), settings_impl.get(), get_defaults); - settings_impl->Detach(NULL); - context_->InitWithSettings(*settings); + context_->InitWithSettings(settings_impl->TakeOwnership()); return true; } @@ -305,12 +305,9 @@ void CefPrintDialogLinux::SendDocumentToPrinter( void CefPrintDialogLinux::OnPrintContinue( CefRefPtr settings) { - { - CefPrintSettingsImpl* impl = - static_cast(settings.get()); - CefValueController::AutoLock lock_scope(impl->controller()); - context_->InitWithSettings(impl->print_settings()); - } + CefPrintSettingsImpl* impl = + static_cast(settings.get()); + context_->InitWithSettings(impl->TakeOwnership()); std::move(callback_).Run(PrintingContextLinux::OK); } diff --git a/libcef/browser/printing/print_dialog_linux.h b/libcef/browser/printing/print_dialog_linux.h index 44cbb6fa7..7f01e09e8 100644 --- a/libcef/browser/printing/print_dialog_linux.h +++ b/libcef/browser/printing/print_dialog_linux.h @@ -42,7 +42,8 @@ class CefPrintDialogLinux : public printing::PrintDialogGtkInterface, // PrintDialogGtkInterface implementation. void UseDefaultSettings() override; - void UpdateSettings(printing::PrintSettings* settings) override; + void UpdateSettings( + std::unique_ptr settings) override; void ShowDialog( gfx::NativeView parent_view, bool has_selection, @@ -68,7 +69,8 @@ class CefPrintDialogLinux : public printing::PrintDialogGtkInterface, void SetHandler(); void ReleaseHandler(); - bool UpdateSettings(printing::PrintSettings* settings, bool get_defaults); + bool UpdateSettings(std::unique_ptr settings, + bool get_defaults); // Prints document named |document_name|. void SendDocumentToPrinter(const base::string16& document_name); diff --git a/libcef/browser/printing/print_view_manager.cc b/libcef/browser/printing/print_view_manager.cc index 3a23fa250..af374ffb7 100644 --- a/libcef/browser/printing/print_view_manager.cc +++ b/libcef/browser/printing/print_view_manager.cc @@ -137,7 +137,7 @@ void StopWorker(int document_cookie) { std::unique_ptr printer_query = queue->PopPrinterQuery(document_cookie); if (printer_query.get()) { - base::PostTaskWithTraits( + base::PostTask( FROM_HERE, {BrowserThread::IO}, base::BindOnce(&PrinterQuery::StopWorker, std::move(printer_query))); } @@ -158,8 +158,7 @@ void SavePdfFile(scoped_refptr data, bool ok = file.IsValid() && metafile.SaveTo(&file); if (!callback.is_null()) { - base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, - base::Bind(callback, ok)); + base::PostTask(FROM_HERE, {BrowserThread::UI}, base::Bind(callback, ok)); } } @@ -330,8 +329,8 @@ void CefPrintViewManager::TerminatePdfPrintJob() { if (!pdf_print_state_->callback_.is_null()) { // Execute the callback. - base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, - base::Bind(pdf_print_state_->callback_, false)); + base::PostTask(FROM_HERE, {BrowserThread::UI}, + base::Bind(pdf_print_state_->callback_, false)); } // Reset state information. diff --git a/libcef/browser/printing/printing_message_filter.cc b/libcef/browser/printing/printing_message_filter.cc index 1d597ce02..cfe0e2d50 100644 --- a/libcef/browser/printing/printing_message_filter.cc +++ b/libcef/browser/printing/printing_message_filter.cc @@ -80,7 +80,7 @@ CefPrintingMessageFilter::CefPrintingMessageFilter(int render_process_id, base::Unretained(this))); is_printing_enabled_.Init(prefs::kPrintingEnabled, profile->GetPrefs()); is_printing_enabled_.MoveToSequence( - base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO})); + base::CreateSingleThreadTaskRunner({BrowserThread::IO})); } void CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt() { diff --git a/libcef/browser/request_context_handler_map.cc b/libcef/browser/request_context_handler_map.cc new file mode 100644 index 000000000..91098989b --- /dev/null +++ b/libcef/browser/request_context_handler_map.cc @@ -0,0 +1,69 @@ +// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#include "libcef/browser/request_context_handler_map.h" + +CefRequestContextHandlerMap::CefRequestContextHandlerMap() = default; +CefRequestContextHandlerMap::~CefRequestContextHandlerMap() = default; + +void CefRequestContextHandlerMap::AddHandler( + int render_process_id, + int render_frame_id, + int frame_tree_node_id, + CefRefPtr handler) { + DCHECK_GE(render_process_id, 0); + DCHECK_GE(render_frame_id, 0); + DCHECK_GE(frame_tree_node_id, 0); + DCHECK(handler); + + render_id_handler_map_.insert(std::make_pair( + std::make_pair(render_process_id, render_frame_id), handler)); + node_id_handler_map_.insert(std::make_pair(frame_tree_node_id, handler)); +} + +void CefRequestContextHandlerMap::RemoveHandler(int render_process_id, + int render_frame_id, + int frame_tree_node_id) { + DCHECK_GE(render_process_id, 0); + DCHECK_GE(render_frame_id, 0); + DCHECK_GE(frame_tree_node_id, 0); + + auto it1 = render_id_handler_map_.find( + std::make_pair(render_process_id, render_frame_id)); + if (it1 != render_id_handler_map_.end()) + render_id_handler_map_.erase(it1); + + auto it2 = node_id_handler_map_.find(frame_tree_node_id); + if (it2 != node_id_handler_map_.end()) + node_id_handler_map_.erase(it2); +} + +CefRefPtr CefRequestContextHandlerMap::GetHandler( + int render_process_id, + int render_frame_id, + int frame_tree_node_id, + bool require_frame_match) const { + if (render_process_id >= 0 && render_frame_id >= 0) { + const auto it1 = render_id_handler_map_.find( + std::make_pair(render_process_id, render_frame_id)); + if (it1 != render_id_handler_map_.end()) + return it1->second; + } + + if (frame_tree_node_id >= 0) { + const auto it2 = node_id_handler_map_.find(frame_tree_node_id); + if (it2 != node_id_handler_map_.end()) + return it2->second; + } + + if (render_process_id >= 0 && !require_frame_match) { + // Choose an arbitrary handler for the same process. + for (auto& kv : render_id_handler_map_) { + if (kv.first.first == render_process_id) + return kv.second; + } + } + + return nullptr; +} diff --git a/libcef/browser/request_context_handler_map.h b/libcef/browser/request_context_handler_map.h new file mode 100644 index 000000000..51487d541 --- /dev/null +++ b/libcef/browser/request_context_handler_map.h @@ -0,0 +1,61 @@ +// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that +// can be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_REQUEST_CONTEXT_HANDLER_MAP_ +#define CEF_LIBCEF_BROWSER_REQUEST_CONTEXT_HANDLER_MAP_ +#pragma once + +#include + +#include "include/cef_request_context.h" +#include "include/cef_request_context_handler.h" + +#include "base/macros.h" + +// Tracks CefRequestContextHandler associations on a single thread. +class CefRequestContextHandlerMap { + public: + CefRequestContextHandlerMap(); + ~CefRequestContextHandlerMap(); + + // Keep track of handlers associated with specific frames. This information + // originates from frame create/delete notifications in CefBrowserHostImpl or + // CefMimeHandlerViewGuestDelegate which are forwarded via + // CefRequestContextImpl and CefBrowserContext. + void AddHandler(int render_process_id, + int render_frame_id, + int frame_tree_node_id, + CefRefPtr handler); + void RemoveHandler(int render_process_id, + int render_frame_id, + int frame_tree_node_id); + + // Returns the handler that matches the specified IDs. Pass -1 for unknown + // values. If |require_frame_match| is true only exact matches will be + // returned. If |require_frame_match| is false, and there is not an exact + // match, then the first handler for the same |render_process_id| will be + // returned. + CefRefPtr GetHandler( + int render_process_id, + int render_frame_id, + int frame_tree_node_id, + bool require_frame_match) const; + + private: + // Map of (render_process_id, render_frame_id) to handler. + typedef std::map, CefRefPtr> + RenderIdHandlerMap; + RenderIdHandlerMap render_id_handler_map_; + + // Map of frame_tree_node_id to handler. Keeping this map is necessary + // because, when navigating the main frame, a new (pre-commit) network request + // will be created before the RenderFrameHost. Consequently we can't rely + // on valid render IDs. See https://crbug.com/776884 for background. + typedef std::map> NodeIdHandlerMap; + NodeIdHandlerMap node_id_handler_map_; + + DISALLOW_COPY_AND_ASSIGN(CefRequestContextHandlerMap); +}; + +#endif // CEF_LIBCEF_BROWSER_REQUEST_CONTEXT_HANDLER_MAP_ diff --git a/libcef/browser/request_context_impl.cc b/libcef/browser/request_context_impl.cc index 055edcc9a..3e449b090 100644 --- a/libcef/browser/request_context_impl.cc +++ b/libcef/browser/request_context_impl.cc @@ -358,7 +358,7 @@ bool CefRequestContextImpl::ClearSchemeHandlerFactories() { void CefRequestContextImpl::PurgePluginListCache(bool reload_pages) { GetBrowserContext( - base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}), + base::CreateSingleThreadTaskRunner({BrowserThread::UI}), base::Bind(&CefRequestContextImpl::PurgePluginListCacheInternal, this, reload_pages)); } @@ -490,7 +490,7 @@ bool CefRequestContextImpl::SetPreference(const CefString& name, void CefRequestContextImpl::ClearCertificateExceptions( CefRefPtr callback) { GetBrowserContext( - base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}), + base::CreateSingleThreadTaskRunner({BrowserThread::UI}), base::Bind(&CefRequestContextImpl::ClearCertificateExceptionsInternal, this, callback)); } @@ -498,7 +498,7 @@ void CefRequestContextImpl::ClearCertificateExceptions( void CefRequestContextImpl::ClearHttpAuthCredentials( CefRefPtr callback) { GetBrowserContext( - base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}), + base::CreateSingleThreadTaskRunner({BrowserThread::UI}), base::Bind(&CefRequestContextImpl::ClearHttpAuthCredentialsInternal, this, callback)); } @@ -506,7 +506,7 @@ void CefRequestContextImpl::ClearHttpAuthCredentials( void CefRequestContextImpl::CloseAllConnections( CefRefPtr callback) { GetBrowserContext( - base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}), + base::CreateSingleThreadTaskRunner({BrowserThread::UI}), base::Bind(&CefRequestContextImpl::CloseAllConnectionsInternal, this, callback)); } @@ -514,10 +514,9 @@ void CefRequestContextImpl::CloseAllConnections( void CefRequestContextImpl::ResolveHost( const CefString& origin, CefRefPtr callback) { - GetBrowserContext( - base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::UI}), - base::Bind(&CefRequestContextImpl::ResolveHostInternal, this, origin, - callback)); + GetBrowserContext(base::CreateSingleThreadTaskRunner({BrowserThread::UI}), + base::Bind(&CefRequestContextImpl::ResolveHostInternal, + this, origin, callback)); } void CefRequestContextImpl::LoadExtension( @@ -711,7 +710,7 @@ void CefRequestContextImpl::PurgePluginListCacheInternal( bool reload_pages, CefBrowserContext* browser_context) { CEF_REQUIRE_UIT(); - browser_context->OnPurgePluginListCache(); + browser_context->ClearPluginLoadDecision(-1); content::PluginService::GetInstance()->PurgePluginListCache(browser_context, false); } diff --git a/libcef/browser/resource_context.cc b/libcef/browser/resource_context.cc index f066e0750..77d7da5a2 100644 --- a/libcef/browser/resource_context.cc +++ b/libcef/browser/resource_context.cc @@ -12,7 +12,6 @@ #include "base/logging.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" -#include "content/browser/loader/resource_dispatcher_host_impl.h" #include "content/browser/resource_context_impl.h" #include "content/public/browser/browser_thread.h" @@ -58,127 +57,32 @@ CefResourceContext::CreateClientCertStore() { #endif } -void CefResourceContext::set_extensions_info_map( - extensions::InfoMap* extensions_info_map) { - DCHECK(!extension_info_map_); - extension_info_map_ = extensions_info_map; -} - void CefResourceContext::AddHandler( int render_process_id, int render_frame_id, int frame_tree_node_id, CefRefPtr handler) { CEF_REQUIRE_IOT(); - DCHECK_GE(render_process_id, 0); - DCHECK_GE(render_frame_id, 0); - DCHECK_GE(frame_tree_node_id, 0); - DCHECK(handler); - - render_id_handler_map_.insert(std::make_pair( - std::make_pair(render_process_id, render_frame_id), handler)); - node_id_handler_map_.insert(std::make_pair(frame_tree_node_id, handler)); + handler_map_.AddHandler(render_process_id, render_frame_id, + frame_tree_node_id, handler); } void CefResourceContext::RemoveHandler(int render_process_id, int render_frame_id, int frame_tree_node_id) { CEF_REQUIRE_IOT(); - DCHECK_GE(render_process_id, 0); - DCHECK_GE(render_frame_id, 0); - DCHECK_GE(frame_tree_node_id, 0); - - auto it1 = render_id_handler_map_.find( - std::make_pair(render_process_id, render_frame_id)); - if (it1 != render_id_handler_map_.end()) - render_id_handler_map_.erase(it1); - - auto it2 = node_id_handler_map_.find(frame_tree_node_id); - if (it2 != node_id_handler_map_.end()) - node_id_handler_map_.erase(it2); + handler_map_.RemoveHandler(render_process_id, render_frame_id, + frame_tree_node_id); } CefRefPtr CefResourceContext::GetHandler( int render_process_id, int render_frame_id, int frame_tree_node_id, - bool require_frame_match) { + bool require_frame_match) const { CEF_REQUIRE_IOT(); - - if (render_process_id >= 0 && render_frame_id >= 0) { - const auto it1 = render_id_handler_map_.find( - std::make_pair(render_process_id, render_frame_id)); - if (it1 != render_id_handler_map_.end()) - return it1->second; - } - - if (frame_tree_node_id >= 0) { - const auto it2 = node_id_handler_map_.find(frame_tree_node_id); - if (it2 != node_id_handler_map_.end()) - return it2->second; - } - - if (render_process_id >= 0 && !require_frame_match) { - // Choose an arbitrary handler for the same process. - for (auto& kv : render_id_handler_map_) { - if (kv.first.first == render_process_id) - return kv.second; - } - } - - return nullptr; -} - -void CefResourceContext::AddPluginLoadDecision( - int render_process_id, - const base::FilePath& plugin_path, - bool is_main_frame, - const url::Origin& main_frame_origin, - chrome::mojom::PluginStatus status) { - CEF_REQUIRE_IOT(); - DCHECK_GE(render_process_id, 0); - DCHECK(!plugin_path.empty()); - - plugin_load_decision_map_.insert(std::make_pair( - std::make_pair(std::make_pair(render_process_id, plugin_path), - std::make_pair(is_main_frame, main_frame_origin)), - status)); -} - -bool CefResourceContext::HasPluginLoadDecision( - int render_process_id, - const base::FilePath& plugin_path, - bool is_main_frame, - const url::Origin& main_frame_origin, - chrome::mojom::PluginStatus* status) const { - CEF_REQUIRE_IOT(); - DCHECK_GE(render_process_id, 0); - DCHECK(!plugin_path.empty()); - - PluginLoadDecisionMap::const_iterator it = plugin_load_decision_map_.find( - std::make_pair(std::make_pair(render_process_id, plugin_path), - std::make_pair(is_main_frame, main_frame_origin))); - if (it == plugin_load_decision_map_.end()) - return false; - - *status = it->second; - return true; -} - -void CefResourceContext::ClearPluginLoadDecision(int render_process_id) { - CEF_REQUIRE_IOT(); - - if (render_process_id == -1) { - plugin_load_decision_map_.clear(); - } else { - PluginLoadDecisionMap::iterator it = plugin_load_decision_map_.begin(); - while (it != plugin_load_decision_map_.end()) { - if (it->first.first.first == render_process_id) - it = plugin_load_decision_map_.erase(it); - else - ++it; - } - } + return handler_map_.GetHandler(render_process_id, render_frame_id, + frame_tree_node_id, require_frame_match); } void CefResourceContext::RegisterSchemeHandlerFactory( diff --git a/libcef/browser/resource_context.h b/libcef/browser/resource_context.h index 9dd429ca0..758d6393e 100644 --- a/libcef/browser/resource_context.h +++ b/libcef/browser/resource_context.h @@ -10,12 +10,12 @@ #include "include/cef_request_context_handler.h" #include "include/cef_scheme.h" -#include "base/files/file_path.h" -#include "chrome/common/plugin.mojom.h" +#include "libcef/browser/request_context_handler_map.h" + #include "content/public/browser/resource_context.h" -#include "extensions/browser/info_map.h" #include "net/ssl/client_cert_store.h" -#include "url/origin.h" + +class GURL; // Acts as a bridge for resource loading. Life span is controlled by // CefBrowserContext. Created on the UI thread but accessed and destroyed on the @@ -30,12 +30,7 @@ class CefResourceContext : public content::ResourceContext { std::unique_ptr CreateClientCertStore(); - void set_extensions_info_map(extensions::InfoMap* extensions_info_map); - - // Keep track of handlers associated with specific frames. This information - // originates from frame create/delete notifications in CefBrowserHostImpl or - // CefMimeHandlerViewGuestDelegate which are forwarded via - // CefRequestContextImpl and CefBrowserContext. + // See comments in CefRequestContextHandlerMap. void AddHandler(int render_process_id, int render_frame_id, int frame_tree_node_id, @@ -43,33 +38,11 @@ class CefResourceContext : public content::ResourceContext { void RemoveHandler(int render_process_id, int render_frame_id, int frame_tree_node_id); - - // Returns the handler that matches the specified IDs. Pass -1 for unknown - // values. If |require_frame_match| is true only exact matches will be - // returned. If |require_frame_match| is false, and there is not an exact - // match, then the first handler for the same |render_process_id| will be - // returned. - CefRefPtr GetHandler(int render_process_id, - int render_frame_id, - int frame_tree_node_id, - bool require_frame_match); - - // Remember the plugin load decision for plugin status requests that arrive - // via CefPluginServiceFilter::IsPluginAvailable. - void AddPluginLoadDecision(int render_process_id, - const base::FilePath& plugin_path, - bool is_main_frame, - const url::Origin& main_frame_origin, - chrome::mojom::PluginStatus status); - bool HasPluginLoadDecision(int render_process_id, - const base::FilePath& plugin_path, - bool is_main_frame, - const url::Origin& main_frame_origin, - chrome::mojom::PluginStatus* status) const; - - // Clear the plugin load decisions associated with |render_process_id|, or all - // plugin load decisions if |render_process_id| is -1. - void ClearPluginLoadDecision(int render_process_id); + CefRefPtr GetHandler( + int render_process_id, + int render_frame_id, + int frame_tree_node_id, + bool require_frame_match) const; // Manage scheme handler factories associated with this context. void RegisterSchemeHandlerFactory(const std::string& scheme_name, @@ -80,36 +53,15 @@ class CefResourceContext : public content::ResourceContext { // State transferred from the BrowserContext for use on the IO thread. bool IsOffTheRecord() const { return is_off_the_record_; } - const extensions::InfoMap* GetExtensionInfoMap() const { - return extension_info_map_.get(); - } private: void InitOnIOThread(); // Only accessed on the IO thread. - bool is_off_the_record_; - scoped_refptr extension_info_map_; + const bool is_off_the_record_; - // Map of (render_process_id, render_frame_id) to handler. - typedef std::map, CefRefPtr> - RenderIdHandlerMap; - RenderIdHandlerMap render_id_handler_map_; - - // Map of frame_tree_node_id to handler. Keeping this map is necessary - // because, when navigating the main frame, a new (pre-commit) network request - // will be created before the RenderFrameHost. Consequently we can't rely - // on valid render IDs. See https://crbug.com/776884 for background. - typedef std::map> NodeIdHandlerMap; - NodeIdHandlerMap node_id_handler_map_; - - // Map (render_process_id, plugin_path, is_main_frame, main_frame_origin) to - // plugin load decision. - typedef std::map< - std::pair, std::pair>, - chrome::mojom::PluginStatus> - PluginLoadDecisionMap; - PluginLoadDecisionMap plugin_load_decision_map_; + // Map IDs to CefRequestContextHandler objects. + CefRequestContextHandlerMap handler_map_; // Map (scheme, domain) to factories. typedef std::map, diff --git a/libcef/browser/server_impl.cc b/libcef/browser/server_impl.cc index b978f99f6..c3b08cacc 100644 --- a/libcef/browser/server_impl.cc +++ b/libcef/browser/server_impl.cc @@ -521,7 +521,7 @@ void CefServerImpl::StartOnUIThread(const std::string& address, std::unique_ptr thread( new base::Thread(base::StringPrintf("%s:%d", address.c_str(), port))); base::Thread::Options options; - options.message_loop_type = base::MessageLoop::TYPE_IO; + options.message_pump_type = base::MessagePumpType::IO; if (thread->StartWithOptions(options)) { // Add a reference that will be released in ShutdownOnUIThread(). AddRef(); diff --git a/libcef/browser/speech_recognition_manager_delegate.cc b/libcef/browser/speech_recognition_manager_delegate.cc index 7ecabd937..206a32960 100644 --- a/libcef/browser/speech_recognition_manager_delegate.cc +++ b/libcef/browser/speech_recognition_manager_delegate.cc @@ -76,8 +76,8 @@ void CefSpeechRecognitionManagerDelegate::CheckRecognitionIsAllowed( // Make sure that initiators properly set the |render_process_id| field. DCHECK_NE(context.render_process_id, 0); - base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, - base::BindOnce(std::move(callback), false, true)); + base::PostTask(FROM_HERE, {content::BrowserThread::IO}, + base::BindOnce(std::move(callback), false, true)); } content::SpeechRecognitionEventListener* diff --git a/libcef/browser/ssl_host_state_delegate.cc b/libcef/browser/ssl_host_state_delegate.cc index 67c44332b..95ca2ba42 100644 --- a/libcef/browser/ssl_host_state_delegate.cc +++ b/libcef/browser/ssl_host_state_delegate.cc @@ -82,8 +82,7 @@ void CefSSLHostStateDelegate::Clear( SSLHostStateDelegate::CertJudgment CefSSLHostStateDelegate::QueryPolicy( const std::string& host, const net::X509Certificate& cert, - int error, - bool* expired_previous_decision) { + int error) { return cert_policy_for_host_[host].Check(cert, error) ? SSLHostStateDelegate::ALLOWED : SSLHostStateDelegate::DENIED; diff --git a/libcef/browser/ssl_host_state_delegate.h b/libcef/browser/ssl_host_state_delegate.h index f8c3c57cd..1af7477aa 100644 --- a/libcef/browser/ssl_host_state_delegate.h +++ b/libcef/browser/ssl_host_state_delegate.h @@ -55,8 +55,7 @@ class CefSSLHostStateDelegate : public content::SSLHostStateDelegate { content::SSLHostStateDelegate::CertJudgment QueryPolicy( const std::string& host, const net::X509Certificate& cert, - int error, - bool* expired_previous_decision) override; + int error) override; void HostRanInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) override; diff --git a/libcef/browser/ssl_info_impl.cc b/libcef/browser/ssl_info_impl.cc index 025ef085f..7c8812758 100644 --- a/libcef/browser/ssl_info_impl.cc +++ b/libcef/browser/ssl_info_impl.cc @@ -26,7 +26,3 @@ CefRefPtr CefSSLInfoImpl::GetX509Certificate() { bool CefIsCertStatusError(cef_cert_status_t status) { return net::IsCertStatusError(status); } - -bool CefIsCertStatusMinorError(cef_cert_status_t status) { - return net::IsCertStatusMinorError(status); -} diff --git a/libcef/browser/thread_util.h b/libcef/browser/thread_util.h index c2e98902e..c9d718c98 100644 --- a/libcef/browser/thread_util.h +++ b/libcef/browser/thread_util.h @@ -41,25 +41,25 @@ #define CEF_REQUIRE_UIT_RETURN_VOID() CEF_REQUIRE_RETURN_VOID(CEF_UIT) #define CEF_REQUIRE_IOT_RETURN_VOID() CEF_REQUIRE_RETURN_VOID(CEF_IOT) -#define CEF_POST_TASK(id, task) base::PostTaskWithTraits(FROM_HERE, {id}, task) -#define CEF_POST_DELAYED_TASK(id, task, delay_ms) \ - base::PostDelayedTaskWithTraits(FROM_HERE, {id}, task, \ - base::TimeDelta::FromMilliseconds(delay_ms)) +#define CEF_POST_TASK(id, task) base::PostTask(FROM_HERE, {id}, task) +#define CEF_POST_DELAYED_TASK(id, task, delay_ms) \ + base::PostDelayedTask(FROM_HERE, {id}, task, \ + base::TimeDelta::FromMilliseconds(delay_ms)) // Post a blocking task with the specified |priority|. Tasks that have not // started executing at shutdown will never run. However, any task that has // already begun executing when shutdown is invoked will be allowed to continue // and will block shutdown until completion. // Tasks posted with this method are not guaranteed to run sequentially. Use -// base::CreateSequencedTaskRunnerWithTraits instead if sequence is important. +// base::CreateSequencedTaskRunner instead if sequence is important. // Sequenced runners at various priorities that always execute all pending tasks // before shutdown are available via CefContentBrowserClient::*_task_runner() // and exposed by the CEF API. -#define CEF_POST_BLOCKING_TASK(priority, task) \ - base::PostTaskWithTraits( \ - FROM_HERE, \ - {priority, base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN, \ - base::MayBlock()}, \ +#define CEF_POST_BLOCKING_TASK(priority, task) \ + base::PostTask( \ + FROM_HERE, \ + {base::ThreadPool(), priority, \ + base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN, base::MayBlock()}, \ task) // Post a blocking task that affects UI or responsiveness of future user diff --git a/libcef/browser/views/textfield_impl.cc b/libcef/browser/views/textfield_impl.cc index 0765e9c68..1437fdf2f 100644 --- a/libcef/browser/views/textfield_impl.cc +++ b/libcef/browser/views/textfield_impl.cc @@ -39,12 +39,12 @@ void CefTextfieldImpl::SetReadOnly(bool read_only) { bool CefTextfieldImpl::IsReadOnly() { CEF_REQUIRE_VALID_RETURN(false); - return root_view()->read_only(); + return root_view()->GetReadOnly(); } CefString CefTextfieldImpl::GetText() { CEF_REQUIRE_VALID_RETURN(CefString()); - return root_view()->text(); + return root_view()->GetText(); } void CefTextfieldImpl::SetText(const CefString& text) { @@ -90,7 +90,7 @@ CefRange CefTextfieldImpl::GetSelectedRange() { void CefTextfieldImpl::SelectRange(const CefRange& range) { CEF_REQUIRE_VALID_RETURN_VOID(); - root_view()->SelectRange(gfx::Range(range.from, range.to)); + root_view()->SetSelectedRange(gfx::Range(range.from, range.to)); } size_t CefTextfieldImpl::GetCursorPosition() { @@ -172,7 +172,7 @@ void CefTextfieldImpl::ClearEditHistory() { void CefTextfieldImpl::SetPlaceholderText(const CefString& text) { CEF_REQUIRE_VALID_RETURN_VOID(); - root_view()->set_placeholder_text(text); + root_view()->SetPlaceholderText(text); } CefString CefTextfieldImpl::GetPlaceholderText() { diff --git a/libcef/browser/views/window_view.cc b/libcef/browser/views/window_view.cc index 6d21ccf37..5bd6bdde3 100644 --- a/libcef/browser/views/window_view.cc +++ b/libcef/browser/views/window_view.cc @@ -283,7 +283,7 @@ void CefWindowView::CreateWidget() { } #endif - widget->Init(params); + widget->Init(std::move(params)); // |widget| should now be associated with |this|. DCHECK_EQ(widget, GetWidget()); @@ -519,8 +519,9 @@ void CefWindowView::SetDraggableRegions( draggable_region_.reset(new SkRegion); for (const CefDraggableRegion& region : regions) { draggable_region_->op( - region.bounds.x, region.bounds.y, region.bounds.x + region.bounds.width, - region.bounds.y + region.bounds.height, + {region.bounds.x, region.bounds.y, + region.bounds.x + region.bounds.width, + region.bounds.y + region.bounds.height}, region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); } } diff --git a/libcef/common/content_client.cc b/libcef/common/content_client.cc index 504d22402..627910ca3 100644 --- a/libcef/common/content_client.cc +++ b/libcef/common/content_client.cc @@ -279,10 +279,6 @@ base::RefCountedMemory* CefContentClient::GetDataResourceBytes( return value; } -bool CefContentClient::IsDataResourceGzipped(int resource_id) { - return ui::ResourceBundle::GetSharedInstance().IsGzipped(resource_id); -} - gfx::Image& CefContentClient::GetNativeImageNamed(int resource_id) { gfx::Image& value = ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); diff --git a/libcef/common/content_client.h b/libcef/common/content_client.h index 65f1a3371..81963e1e9 100644 --- a/libcef/common/content_client.h +++ b/libcef/common/content_client.h @@ -42,7 +42,6 @@ class CefContentClient : public content::ContentClient { base::StringPiece GetDataResource(int resource_id, ui::ScaleFactor scale_factor) override; base::RefCountedMemory* GetDataResourceBytes(int resource_id) override; - bool IsDataResourceGzipped(int resource_id) override; gfx::Image& GetNativeImageNamed(int resource_id) override; // Values are registered with all processes (url/url_util.h) and with Blink diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc index c832523e0..aa0cf85e5 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/main_delegate.cc @@ -16,7 +16,6 @@ #include "libcef/common/crash_reporting.h" #include "libcef/common/extensions/extensions_util.h" #include "libcef/renderer/content_renderer_client.h" -#include "libcef/utility/content_utility_client.h" #include "base/at_exit.h" #include "base/base_switches.h" @@ -35,6 +34,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_switches.h" +#include "chrome/utility/chrome_content_utility_client.h" #include "components/content_settings/core/common/content_settings_pattern.h" #include "components/viz/common/features.h" #include "content/browser/browser_process_sub_thread.h" @@ -321,7 +321,7 @@ class CefUIThread : public base::PlatformThread::Delegate { if (!stopping_) { stopping_ = true; - base::PostTaskWithTraits( + base::PostTask( FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(&CefUIThread::ThreadQuitHelper, Unretained(this))); } @@ -628,7 +628,7 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) { const base::FilePath& log_file = command_line->GetSwitchValuePath(switches::kLogFile); DCHECK(!log_file.empty()); - log_settings.log_file = log_file.value().c_str(); + log_settings.log_file_path = log_file.value().c_str(); log_settings.lock_log = logging::DONT_LOCK_LOG_FILE; log_settings.delete_old = logging::APPEND_TO_OLD_LOG_FILE; @@ -802,7 +802,7 @@ content::ContentRendererClient* CefMainDelegate::CreateContentRendererClient() { } content::ContentUtilityClient* CefMainDelegate::CreateContentUtilityClient() { - utility_client_.reset(new CefContentUtilityClient); + utility_client_.reset(new ChromeContentUtilityClient); return utility_client_.get(); } diff --git a/libcef/common/main_delegate.h b/libcef/common/main_delegate.h index 83e5fbad6..fecc697a4 100644 --- a/libcef/common/main_delegate.h +++ b/libcef/common/main_delegate.h @@ -26,8 +26,8 @@ class BrowserMainRunner; class CefContentBrowserClient; class CefContentRendererClient; -class CefContentUtilityClient; class CefUIThread; +class ChromeContentUtilityClient; class CefMainDelegate : public content::ContentMainDelegate { public: @@ -65,7 +65,7 @@ class CefMainDelegate : public content::ContentMainDelegate { std::unique_ptr browser_client_; std::unique_ptr renderer_client_; - std::unique_ptr utility_client_; + std::unique_ptr utility_client_; CefContentClient content_client_; DISALLOW_COPY_AND_ASSIGN(CefMainDelegate); diff --git a/libcef/common/request_impl.cc b/libcef/common/request_impl.cc index 57a8b81bc..fbba0ade2 100644 --- a/libcef/common/request_impl.cc +++ b/libcef/common/request_impl.cc @@ -74,8 +74,8 @@ class BytesElementReader : public net::UploadBytesElementReader { }; scoped_refptr GetFileTaskRunner() { - return base::CreateSequencedTaskRunnerWithTraits( - {base::MayBlock(), base::TaskPriority::USER_VISIBLE}); + return base::CreateSequencedTaskRunner( + {base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE}); } // A subclass of net::UploadFileElementReader that keeps the associated diff --git a/libcef/common/service_manifests/builtin_service_manifests.cc b/libcef/common/service_manifests/builtin_service_manifests.cc deleted file mode 100644 index 283383cbf..000000000 --- a/libcef/common/service_manifests/builtin_service_manifests.cc +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/common/service_manifests/builtin_service_manifests.h" - -#include "base/no_destructor.h" -#include "build/build_config.h" -#include "chrome/common/buildflags.h" -#include "chrome/common/constants.mojom.h" -#include "chrome/services/printing/public/cpp/manifest.h" -#include "components/services/pdf_compositor/public/cpp/manifest.h" // nogncheck -#include "components/spellcheck/common/spellcheck.mojom.h" -#include "components/startup_metric_utils/common/startup_metric.mojom.h" -#include "extensions/buildflags/buildflags.h" -#include "printing/buildflags/buildflags.h" -#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" -#include "services/service_manager/public/cpp/manifest_builder.h" - -#if defined(OS_MACOSX) -#include "components/spellcheck/common/spellcheck_panel.mojom.h" -#endif - -namespace { - -const service_manager::Manifest& GetCefManifest() { - static base::NoDestructor manifest { - service_manager::ManifestBuilder() - .WithServiceName(chrome::mojom::kServiceName) - .WithDisplayName("CEF") - .WithOptions( - service_manager::ManifestOptionsBuilder() - .WithExecutionMode( - service_manager::Manifest::ExecutionMode::kInProcessBuiltin) - .WithInstanceSharingPolicy( - service_manager::Manifest::InstanceSharingPolicy:: - kSharedAcrossGroups) - .CanConnectToInstancesWithAnyId(true) - .CanRegisterOtherServiceInstances(true) - .Build()) - .ExposeCapability("renderer", - service_manager::Manifest::InterfaceList< -#if defined(OS_MACOSX) - spellcheck::mojom::SpellCheckPanelHost, -#endif - spellcheck::mojom::SpellCheckHost, - startup_metric_utils::mojom::StartupMetricHost>()) - .RequireCapability(chrome::mojom::kRendererServiceName, "browser") - .Build() - }; - return *manifest; -} - -} // namespace - -const std::vector& GetBuiltinServiceManifests() { - static base::NoDestructor> manifests{{ - GetCefManifest(), - printing::GetPdfCompositorManifest(), - GetChromePrintingManifest(), - }}; - return *manifests; -} diff --git a/libcef/common/service_manifests/builtin_service_manifests.h b/libcef/common/service_manifests/builtin_service_manifests.h deleted file mode 100644 index 0e7a12c31..000000000 --- a/libcef/common/service_manifests/builtin_service_manifests.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_PACKAGED_SERVICE_MANIFESTS_H_ -#define CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_PACKAGED_SERVICE_MANIFESTS_H_ - -#include - -#include "services/service_manager/public/cpp/manifest.h" - -// Returns manifests for all shared (i.e. cross-profile) services packaged by -// CEF but not packaged by Content. This includes both in- and out-of-process -// services. -const std::vector& GetBuiltinServiceManifests(); - -#endif // CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_PACKAGED_SERVICE_MANIFESTS_H_ diff --git a/libcef/common/service_manifests/cef_content_browser_overlay_manifest.cc b/libcef/common/service_manifests/cef_content_browser_overlay_manifest.cc index 91f2a3559..0267f04b7 100644 --- a/libcef/common/service_manifests/cef_content_browser_overlay_manifest.cc +++ b/libcef/common/service_manifests/cef_content_browser_overlay_manifest.cc @@ -7,8 +7,7 @@ #include "base/command_line.h" #include "base/no_destructor.h" #include "build/build_config.h" -#include "components/metrics/public/interfaces/call_stack_profile_collector.mojom.h" -#include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom.h" +#include "components/metrics/public/mojom/call_stack_profile_collector.mojom.h" #include "extensions/buildflags/buildflags.h" #include "extensions/common/api/mime_handler.mojom.h" // nogncheck #include "extensions/common/mojom/keep_alive.mojom.h" // nogncheck @@ -24,9 +23,6 @@ const service_manager::Manifest& GetCefContentBrowserOverlayManifest() { .ExposeCapability("gpu", service_manager::Manifest::InterfaceList< metrics::mojom::CallStackProfileCollector>()) - .ExposeCapability("profiling_client", - service_manager::Manifest::InterfaceList< - heap_profiling::mojom::ProfilingClient>()) .ExposeCapability("renderer", service_manager::Manifest::InterfaceList< #if defined(OS_WIN) @@ -34,10 +30,6 @@ const service_manager::Manifest& GetCefContentBrowserOverlayManifest() { #endif metrics::mojom::CallStackProfileCollector>()) .RequireCapability("chrome_printing", "converter") - .RequireCapability("heap_profiling", "heap_profiler") - .RequireCapability("heap_profiling", "profiling") - .RequireCapability("pdf_compositor", "compositor") - .RequireCapability("proxy_resolver", "factory") .ExposeInterfaceFilterCapability_Deprecated( "navigation:frame", "renderer", service_manager::Manifest::InterfaceList< diff --git a/libcef/common/service_manifests/cef_content_gpu_overlay_manifest.cc b/libcef/common/service_manifests/cef_content_gpu_overlay_manifest.cc deleted file mode 100644 index af5989060..000000000 --- a/libcef/common/service_manifests/cef_content_gpu_overlay_manifest.cc +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/common/service_manifests/cef_content_gpu_overlay_manifest.h" - -#include "base/no_destructor.h" -#include "build/build_config.h" -#include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom.h" -#include "services/service_manager/public/cpp/manifest_builder.h" - -const service_manager::Manifest& GetCefContentGpuOverlayManifest() { - static base::NoDestructor manifest{ - service_manager::ManifestBuilder() - .ExposeCapability("browser", - service_manager::Manifest::InterfaceList< - heap_profiling::mojom::ProfilingClient>()) - .Build()}; - return *manifest; -} diff --git a/libcef/common/service_manifests/cef_content_gpu_overlay_manifest.h b/libcef/common/service_manifests/cef_content_gpu_overlay_manifest.h deleted file mode 100644 index ec6a8a9ea..000000000 --- a/libcef/common/service_manifests/cef_content_gpu_overlay_manifest.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_CONTENT_GPU_OVERLAY_MANIFEST_H_ -#define CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_CONTENT_GPU_OVERLAY_MANIFEST_H_ - -#include "services/service_manager/public/cpp/manifest.h" - -// Returns the Manifest CEF amends to Contents's content_gpu service -// manifest. This allows CEF to extend the capabilities exposed and/or -// required by content_gpu service instances -const service_manager::Manifest& GetCefContentGpuOverlayManifest(); - -#endif // CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_CONTENT_GPU_OVERLAY_MANIFEST_H_ diff --git a/libcef/common/service_manifests/cef_content_renderer_overlay_manifest.cc b/libcef/common/service_manifests/cef_content_renderer_overlay_manifest.cc index d6e8d7ee9..405ac89ac 100644 --- a/libcef/common/service_manifests/cef_content_renderer_overlay_manifest.cc +++ b/libcef/common/service_manifests/cef_content_renderer_overlay_manifest.cc @@ -6,7 +6,6 @@ #include "base/no_destructor.h" #include "build/build_config.h" -#include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom.h" #include "components/subresource_filter/content/mojom/subresource_filter_agent.mojom.h" #include "extensions/buildflags/buildflags.h" #include "services/service_manager/public/cpp/manifest_builder.h" @@ -18,9 +17,6 @@ const service_manager::Manifest& GetCefContentRendererOverlayManifest() { static base::NoDestructor manifest { service_manager::ManifestBuilder() - .ExposeCapability("browser", - service_manager::Manifest::InterfaceList< - heap_profiling::mojom::ProfilingClient>()) #if defined(OS_MACOSX) .ExposeInterfaceFilterCapability_Deprecated( "navigation:frame", "browser", diff --git a/libcef/common/service_manifests/cef_content_utility_overlay_manifest.cc b/libcef/common/service_manifests/cef_content_utility_overlay_manifest.cc deleted file mode 100644 index 925b35ce3..000000000 --- a/libcef/common/service_manifests/cef_content_utility_overlay_manifest.cc +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/common/service_manifests/cef_content_utility_overlay_manifest.h" - -#include "base/no_destructor.h" -#include "components/services/heap_profiling/public/mojom/heap_profiling_client.mojom.h" -#include "services/service_manager/public/cpp/manifest_builder.h" - -const service_manager::Manifest& GetCefContentUtilityOverlayManifest() { - static base::NoDestructor manifest{ - service_manager::ManifestBuilder() - .ExposeCapability("browser", - service_manager::Manifest::InterfaceList< - heap_profiling::mojom::ProfilingClient>()) - .Build()}; - return *manifest; -} diff --git a/libcef/common/service_manifests/cef_content_utility_overlay_manifest.h b/libcef/common/service_manifests/cef_content_utility_overlay_manifest.h deleted file mode 100644 index 563bbd3b1..000000000 --- a/libcef/common/service_manifests/cef_content_utility_overlay_manifest.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_CONTENT_UTILITY_OVERLAY_MANIFEST_H_ -#define CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_CONTENT_UTILITY_OVERLAY_MANIFEST_H_ - -#include "services/service_manager/public/cpp/manifest.h" - -// Returns the Manifest CEF amends to Contents's content_utility service -// manifest. This allows CEF to extend the capabilities exposed and/or -// required by content_utility service instances -const service_manager::Manifest& GetCefContentUtilityOverlayManifest(); - -#endif // CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_CONTENT_UTILITY_OVERLAY_MANIFEST_H_ diff --git a/libcef/common/service_manifests/cef_renderer_manifest.cc b/libcef/common/service_manifests/cef_renderer_manifest.cc deleted file mode 100644 index 47ea31a6c..000000000 --- a/libcef/common/service_manifests/cef_renderer_manifest.cc +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/common/service_manifests/cef_renderer_manifest.h" - -#include "base/no_destructor.h" -#include "chrome/common/constants.mojom.h" -#include "components/spellcheck/common/spellcheck.mojom.h" -#include "services/service_manager/public/cpp/manifest_builder.h" - -const service_manager::Manifest& GetCefRendererManifest() { - static base::NoDestructor manifest{ - service_manager::ManifestBuilder() - .WithServiceName(chrome::mojom::kRendererServiceName) - .ExposeCapability("browser", service_manager::Manifest::InterfaceList< - spellcheck::mojom::SpellChecker>()) - .RequireCapability(chrome::mojom::kServiceName, "renderer") - .Build()}; - return *manifest; -} diff --git a/libcef/common/service_manifests/cef_renderer_manifest.h b/libcef/common/service_manifests/cef_renderer_manifest.h deleted file mode 100644 index 8c65c8721..000000000 --- a/libcef/common/service_manifests/cef_renderer_manifest.h +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_RENDERER_MANIFEST_H_ -#define CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_RENDERER_MANIFEST_H_ - -#include "services/service_manager/public/cpp/manifest.h" - -// Returns the Manifest for the cef_renderer service. CEF registers an -// instance of this service for each renderer process started by Content, and -// that instance lives in the corresponding renderer process alongside the -// content_renderer instance. -const service_manager::Manifest& GetCefRendererManifest(); - -#endif // CEF_LIBCEF_COMMON_SERVICE_MANIFESTS_CEF_RENDERER_MANIFEST_H_ diff --git a/libcef/common/task_runner_impl.cc b/libcef/common/task_runner_impl.cc index 1d9c4b2dc..d5afbafaf 100644 --- a/libcef/common/task_runner_impl.cc +++ b/libcef/common/task_runner_impl.cc @@ -88,7 +88,7 @@ scoped_refptr CefTaskRunnerImpl::GetTaskRunner( BrowserThread::IsThreadInitialized(static_cast(id))) { // Specify USER_BLOCKING so that BrowserTaskExecutor::GetTaskRunner always // gives us the same TaskRunner object. - return base::CreateSingleThreadTaskRunnerWithTraits( + return base::CreateSingleThreadTaskRunner( {static_cast(id), base::TaskPriority::USER_BLOCKING}); } @@ -108,7 +108,7 @@ CefTaskRunnerImpl::GetCurrentTaskRunner() { BrowserThread::IsThreadInitialized(current_id)) { // Specify USER_BLOCKING so that BrowserTaskExecutor::GetTaskRunner always // gives us the same TaskRunner object. - task_runner = base::CreateSingleThreadTaskRunnerWithTraits( + task_runner = base::CreateSingleThreadTaskRunner( {current_id, base::TaskPriority::USER_BLOCKING}); } diff --git a/libcef/common/thread_impl.cc b/libcef/common/thread_impl.cc index e3929c94f..adcce19da 100644 --- a/libcef/common/thread_impl.cc +++ b/libcef/common/thread_impl.cc @@ -86,10 +86,10 @@ bool CefThreadImpl::Create(const CefString& display_name, switch (message_loop_type) { case ML_TYPE_UI: - options.message_loop_type = base::MessageLoop::TYPE_UI; + options.message_pump_type = base::MessagePumpType::UI; break; case ML_TYPE_IO: - options.message_loop_type = base::MessageLoop::TYPE_IO; + options.message_pump_type = base::MessagePumpType::IO; break; default: break; @@ -100,7 +100,7 @@ bool CefThreadImpl::Create(const CefString& display_name, #if defined(OS_WIN) if (com_init_mode != COM_INIT_MODE_NONE) { if (com_init_mode == COM_INIT_MODE_STA) - options.message_loop_type = base::MessageLoop::TYPE_UI; + options.message_pump_type = base::MessagePumpType::UI; thread_->init_com_with_mta(com_init_mode == COM_INIT_MODE_MTA); } #endif diff --git a/libcef/renderer/blink_glue.cc b/libcef/renderer/blink_glue.cc index f8a464734..69559b471 100644 --- a/libcef/renderer/blink_glue.cc +++ b/libcef/renderer/blink_glue.cc @@ -61,7 +61,7 @@ void GoBack(blink::WebView* view) { blink::WebViewImpl* view_impl = reinterpret_cast(view); if (view_impl->Client()->HistoryBackListCount() > 0) { main_frame->ToWebLocalFrame()->Client()->NavigateBackForwardSoon( - -1, true /* has_user_gesture */); + -1, true /* has_user_gesture */, false /* from_script */); } } } @@ -75,7 +75,7 @@ void GoForward(blink::WebView* view) { blink::WebViewImpl* view_impl = reinterpret_cast(view); if (view_impl->Client()->HistoryForwardListCount() > 0) { main_frame->ToWebLocalFrame()->Client()->NavigateBackForwardSoon( - 1, true /* has_user_gesture */); + 1, true /* has_user_gesture */, false /* from_script */); } } } diff --git a/libcef/renderer/content_renderer_client.cc b/libcef/renderer/content_renderer_client.cc index 4d0dc4cb3..564f46b3c 100644 --- a/libcef/renderer/content_renderer_client.cc +++ b/libcef/renderer/content_renderer_client.cc @@ -51,7 +51,6 @@ #include "base/task/post_task.h" #include "build/build_config.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/constants.mojom.h" #include "chrome/common/url_constants.h" #include "chrome/renderer/chrome_content_renderer_client.h" #include "chrome/renderer/extensions/chrome_extensions_renderer_client.h" @@ -85,6 +84,7 @@ #include "extensions/renderer/renderer_extension_registry.h" #include "ipc/ipc_sync_channel.h" #include "media/base/media.h" +#include "mojo/public/cpp/bindings/generic_pending_receiver.h" #include "printing/print_settings.h" #include "services/network/public/cpp/is_potentially_trustworthy.h" #include "services/service_manager/public/cpp/connector.h" @@ -346,7 +346,7 @@ void CefContentRendererClient::RunSingleProcessCleanup() { if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { RunSingleProcessCleanupOnUIThread(); } else { - base::PostTaskWithTraits( + base::PostTask( FROM_HERE, {content::BrowserThread::UI}, base::Bind(&CefContentRendererClient::RunSingleProcessCleanupOnUIThread, base::Unretained(this))); @@ -382,9 +382,9 @@ void CefContentRendererClient::RenderThreadStarted() { : blink::scheduler::WebRendererProcessType::kRenderer); { - startup_metric_utils::mojom::StartupMetricHostPtr startup_metric_host; - GetConnector()->BindInterface(chrome::mojom::kServiceName, - &startup_metric_host); + mojo::Remote + startup_metric_host; + thread->BindHostReceiver(startup_metric_host.BindNewPipeAndPassReceiver()); startup_metric_host->RecordRendererMainEntryTime(main_entry_time_); } @@ -678,31 +678,31 @@ void CefContentRendererClient::DevToolsAgentDetached() { } } -void CefContentRendererClient::CreateRendererService( - service_manager::mojom::ServiceRequest service_request) { - DCHECK(!service_binding_.is_bound()); - service_binding_.Bind(std::move(service_request)); -} - std::unique_ptr CefContentRendererClient::CreateURLLoaderThrottleProvider( content::URLLoaderThrottleProviderType provider_type) { return std::make_unique(provider_type); } -void CefContentRendererClient::OnBindInterface( - const service_manager::BindSourceInfo& remote_info, - const std::string& name, - mojo::ScopedMessagePipeHandle handle) { - registry_.TryBindInterface(name, &handle); +void CefContentRendererClient::BindReceiverOnMainThread( + mojo::GenericPendingReceiver receiver) { + // TODO(crbug.com/977637): Get rid of the use of BinderRegistry here. This is + // only used to bind a spellcheck interface. + std::string interface_name = *receiver.interface_name(); + auto pipe = receiver.PassPipe(); + registry_.TryBindInterface(interface_name, &pipe); } void CefContentRendererClient::GetInterface( const std::string& interface_name, mojo::ScopedMessagePipeHandle interface_pipe) { - service_binding_.GetConnector()->BindInterface( - service_manager::ServiceFilter::ByName(chrome::mojom::kServiceName), - interface_name, std::move(interface_pipe)); + // TODO(crbug.com/977637): Get rid of the use of this implementation of + // |service_manager::LocalInterfaceProvider|. This was done only to avoid + // churning spellcheck code while eliminating the "chrome" and + // "chrome_renderer" services. Spellcheck is (and should remain) the only + // consumer of this implementation. + content::RenderThread::Get()->BindHostReceiver( + mojo::GenericPendingReceiver(interface_name, std::move(interface_pipe))); } void CefContentRendererClient::WillDestroyCurrentMessageLoop() { @@ -808,10 +808,6 @@ void CefContentRendererClient::RunSingleProcessCleanupOnUIThread() { delete host; } -service_manager::Connector* CefContentRendererClient::GetConnector() { - return service_binding_.GetConnector(); -} - // Enable deprecation warnings on Windows. See http://crbug.com/585142. #if defined(OS_WIN) #if defined(__clang__) diff --git a/libcef/renderer/content_renderer_client.h b/libcef/renderer/content_renderer_client.h index 0e10d37ce..8d2a4a34f 100644 --- a/libcef/renderer/content_renderer_client.h +++ b/libcef/renderer/content_renderer_client.h @@ -16,16 +16,14 @@ #include "libcef/renderer/browser_impl.h" #include "base/compiler_specific.h" -#include "base/message_loop/message_loop.h" +#include "base/message_loop/message_loop_current.h" #include "base/sequenced_task_runner.h" #include "chrome/common/plugin.mojom.h" #include "content/public/renderer/content_renderer_client.h" #include "content/public/renderer/render_thread.h" +#include "mojo/public/cpp/bindings/generic_pending_receiver.h" #include "services/service_manager/public/cpp/binder_registry.h" -#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/local_interface_provider.h" -#include "services/service_manager/public/cpp/service.h" -#include "services/service_manager/public/cpp/service_binding.h" namespace blink { class WebURLLoaderFactory; @@ -53,7 +51,6 @@ class SpellCheck; class CefContentRendererClient : public content::ContentRendererClient, - public service_manager::Service, public service_manager::LocalInterfaceProvider, public base::MessageLoopCurrent::DestructionObserver { public: @@ -140,16 +137,10 @@ class CefContentRendererClient void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame) override; void DevToolsAgentAttached() override; void DevToolsAgentDetached() override; - void CreateRendererService( - service_manager::mojom::ServiceRequest service_request) override; std::unique_ptr CreateURLLoaderThrottleProvider( content::URLLoaderThrottleProviderType provider_type) override; - - // service_manager::Service implementation. - void OnBindInterface(const service_manager::BindSourceInfo& remote_info, - const std::string& name, - mojo::ScopedMessagePipeHandle handle) override; + void BindReceiverOnMainThread(mojo::GenericPendingReceiver receiver) override; // service_manager::LocalInterfaceProvider implementation. void GetInterface(const std::string& name, @@ -168,8 +159,6 @@ class CefContentRendererClient // Perform cleanup work for single-process mode. void RunSingleProcessCleanupOnUIThread(); - service_manager::Connector* GetConnector(); - // Time at which this object was created. This is very close to the time at // which the RendererMain function was entered. base::TimeTicks main_entry_time_; @@ -208,7 +197,6 @@ class CefContentRendererClient bool single_process_cleanup_complete_; base::Lock single_process_cleanup_lock_; - service_manager::ServiceBinding service_binding_{this}; service_manager::BinderRegistry registry_; DISALLOW_COPY_AND_ASSIGN(CefContentRendererClient); diff --git a/libcef/renderer/render_message_filter.cc b/libcef/renderer/render_message_filter.cc index a7c1b48e4..2d8d4e255 100644 --- a/libcef/renderer/render_message_filter.cc +++ b/libcef/renderer/render_message_filter.cc @@ -55,10 +55,9 @@ bool CefRenderMessageFilter::Send(IPC::Message* message) { } if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { - base::PostTaskWithTraits( - FROM_HERE, {content::BrowserThread::IO}, - base::Bind(base::IgnoreResult(&CefRenderMessageFilter::Send), this, - message)); + base::PostTask(FROM_HERE, {content::BrowserThread::IO}, + base::Bind(base::IgnoreResult(&CefRenderMessageFilter::Send), + this, message)); return true; } diff --git a/libcef/renderer/render_urlrequest_impl.cc b/libcef/renderer/render_urlrequest_impl.cc index 73a5428e0..1055043af 100644 --- a/libcef/renderer/render_urlrequest_impl.cc +++ b/libcef/renderer/render_urlrequest_impl.cc @@ -44,13 +44,11 @@ class CefWebURLLoaderClient : public blink::WebURLLoaderClient { uint64_t total_bytes_to_be_sent) override; void DidReceiveResponse(const WebURLResponse& response) override; void DidReceiveData(const char* data, int dataLength) override; - void DidFinishLoading( - base::TimeTicks finish_time, - int64_t total_encoded_data_length, - int64_t total_encoded_body_length, - int64_t total_decoded_body_length, - bool should_report_corb_blocking, - const blink::WebVector&) override; + void DidFinishLoading(base::TimeTicks finish_time, + int64_t total_encoded_data_length, + int64_t total_encoded_body_length, + int64_t total_decoded_body_length, + bool should_report_corb_blocking) override; void DidFail(const WebURLError&, int64_t total_encoded_data_length, int64_t total_encoded_body_length, @@ -374,13 +372,11 @@ void CefWebURLLoaderClient::DidReceiveData(const char* data, int dataLength) { context_->OnDownloadData(data, dataLength); } -void CefWebURLLoaderClient::DidFinishLoading( - base::TimeTicks finish_time, - int64_t total_encoded_data_length, - int64_t total_encoded_body_length, - int64_t total_decoded_body_length, - bool should_report_corb_blocking, - const blink::WebVector&) { +void CefWebURLLoaderClient::DidFinishLoading(base::TimeTicks finish_time, + int64_t total_encoded_data_length, + int64_t total_encoded_body_length, + int64_t total_decoded_body_length, + bool should_report_corb_blocking) { context_->OnComplete(); } diff --git a/libcef/renderer/url_loader_throttle_provider_impl.cc b/libcef/renderer/url_loader_throttle_provider_impl.cc index daecf3405..697096c3b 100644 --- a/libcef/renderer/url_loader_throttle_provider_impl.cc +++ b/libcef/renderer/url_loader_throttle_provider_impl.cc @@ -37,14 +37,14 @@ CefURLLoaderThrottleProviderImpl::Clone() { return base::WrapUnique(new CefURLLoaderThrottleProviderImpl(*this)); } -std::vector> +std::vector> CefURLLoaderThrottleProviderImpl::CreateThrottles( int render_frame_id, const blink::WebURLRequest& request, content::ResourceType resource_type) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); - std::vector> throttles; + std::vector> throttles; // Some throttles have already been added in the browser for frame resources. // Don't add them for frame requests. diff --git a/libcef/renderer/url_loader_throttle_provider_impl.h b/libcef/renderer/url_loader_throttle_provider_impl.h index a1269f4e9..5be0a1df7 100644 --- a/libcef/renderer/url_loader_throttle_provider_impl.h +++ b/libcef/renderer/url_loader_throttle_provider_impl.h @@ -23,7 +23,7 @@ class CefURLLoaderThrottleProviderImpl // content::URLLoaderThrottleProvider implementation. std::unique_ptr Clone() override; - std::vector> CreateThrottles( + std::vector> CreateThrottles( int render_frame_id, const blink::WebURLRequest& request, content::ResourceType resource_type) override; diff --git a/libcef/renderer/v8_impl.cc b/libcef/renderer/v8_impl.cc index a46d32382..735040305 100644 --- a/libcef/renderer/v8_impl.cc +++ b/libcef/renderer/v8_impl.cc @@ -340,7 +340,7 @@ class V8TrackArrayBuffer : public CefTrackNode { return release_callback_; } - void Neuter() { buffer_ = nullptr; } + void Detach() { buffer_ = nullptr; } // Attach this track object to the specified V8 object. void AttachTo(v8::Local context, @@ -2283,12 +2283,12 @@ bool CefV8ValueImpl::NeuterArrayBuffer() { } v8::Local obj = value->ToObject(context).ToLocalChecked(); v8::Local arr = v8::Local::Cast(obj); - if (!arr->IsNeuterable()) { + if (!arr->IsDetachable()) { return false; } - arr->Neuter(); + arr->Detach(); V8TrackArrayBuffer* tracker = V8TrackArrayBuffer::Unwrap(context, obj); - tracker->Neuter(); + tracker->Detach(); return true; } diff --git a/libcef/utility/content_utility_client.cc b/libcef/utility/content_utility_client.cc deleted file mode 100644 index 427c1fcfd..000000000 --- a/libcef/utility/content_utility_client.cc +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2014 the Chromium Embedded Framework authors. -// Portions Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/utility/content_utility_client.h" - -#include - -#include "build/build_config.h" -#include "chrome/services/printing/printing_service.h" -#include "chrome/services/printing/public/mojom/constants.mojom.h" -#include "components/services/pdf_compositor/public/cpp/pdf_compositor_service_factory.h" -#include "components/services/pdf_compositor/public/mojom/pdf_compositor.mojom.h" -#include "content/public/child/child_thread.h" -#include "content/public/common/service_manager_connection.h" -#include "content/public/common/simple_connection_filter.h" -#include "content/public/utility/utility_thread.h" -#include "mojo/public/cpp/bindings/strong_binding.h" -#include "services/network/url_request_context_builder_mojo.h" -#include "services/proxy_resolver/proxy_resolver_factory_impl.h" // nogncheck -#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" -#include "services/service_manager/public/cpp/binder_registry.h" - -#if defined(OS_WIN) -#include "chrome/utility/printing_handler.h" -#endif - -namespace { -void RunServiceAsyncThenTerminateProcess( - std::unique_ptr service) { - service_manager::Service::RunAsyncUntilTermination( - std::move(service), - base::BindOnce([] { content::UtilityThread::Get()->ReleaseProcess(); })); -} - -} // namespace - -CefContentUtilityClient::CefContentUtilityClient() { -#if defined(OS_WIN) - printing_handler_ = std::make_unique(); -#endif -} - -CefContentUtilityClient::~CefContentUtilityClient() {} - -void CefContentUtilityClient::UtilityThreadStarted() { - content::ServiceManagerConnection* connection = - content::ChildThread::Get()->GetServiceManagerConnection(); - - // NOTE: Some utility process instances are not connected to the Service - // Manager. Nothing left to do in that case. - if (!connection) - return; - - auto registry = std::make_unique(); - - connection->AddConnectionFilter( - std::make_unique(std::move(registry))); -} - -bool CefContentUtilityClient::OnMessageReceived(const IPC::Message& message) { - bool handled = false; - -#if defined(OS_WIN) - if (printing_handler_->OnMessageReceived(message)) - return true; -#endif - - return handled; -} - -void CefContentUtilityClient::RunIOThreadService( - mojo::GenericPendingReceiver* receiver) { - if (auto factory_receiver = - receiver->As()) { - static base::NoDestructor factory( - std::move(factory_receiver)); - return; - } -} - -std::unique_ptr -CefContentUtilityClient::MaybeCreateMainThreadService( - const std::string& service_name, - service_manager::mojom::ServiceRequest request) { - if (service_name == printing::mojom::kServiceName) { - return printing::CreatePdfCompositorService(std::move(request)); - } - if (service_name == printing::mojom::kChromePrintingServiceName) { - return std::make_unique(std::move(request)); - } - return nullptr; -} - -bool CefContentUtilityClient::HandleServiceRequest( - const std::string& service_name, - service_manager::mojom::ServiceRequest request) { - auto service = MaybeCreateMainThreadService(service_name, std::move(request)); - if (service) { - RunServiceAsyncThenTerminateProcess(std::move(service)); - return true; - } - return false; -} diff --git a/libcef/utility/content_utility_client.h b/libcef/utility/content_utility_client.h deleted file mode 100644 index beb325d23..000000000 --- a/libcef/utility/content_utility_client.h +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2014 the Chromium Embedded Framework authors. -// Portions Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef LIBCEF_UTILITY_CONTENT_UTILITY_CLIENT_H_ -#define LIBCEF_UTILITY_CONTENT_UTILITY_CLIENT_H_ - -#include -#include - -#include "content/public/utility/content_utility_client.h" - -#if defined(OS_WIN) -namespace printing { -class PrintingHandler; -} -#endif - -class CefContentUtilityClient : public content::ContentUtilityClient { - public: - CefContentUtilityClient(); - ~CefContentUtilityClient() override; - - void UtilityThreadStarted() override; - bool OnMessageReceived(const IPC::Message& message) override; - bool HandleServiceRequest( - const std::string& service_name, - service_manager::mojom::ServiceRequest request) override; - void RunIOThreadService(mojo::GenericPendingReceiver* receiver) override; - - private: - std::unique_ptr MaybeCreateMainThreadService( - const std::string& service_name, - service_manager::mojom::ServiceRequest request); - -#if defined(OS_WIN) - std::unique_ptr printing_handler_; -#endif - - DISALLOW_COPY_AND_ASSIGN(CefContentUtilityClient); -}; - -#endif // LIBCEF_UTILITY_CONTENT_UTILITY_CLIENT_H_ diff --git a/libcef_dll/cpptoc/print_settings_cpptoc.cc b/libcef_dll/cpptoc/print_settings_cpptoc.cc index 10c5da01e..03424dded 100644 --- a/libcef_dll/cpptoc/print_settings_cpptoc.cc +++ b/libcef_dll/cpptoc/print_settings_cpptoc.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=d4f6d6a06e05d1d0d2938a2aa73c8a25885fc3ef$ +// $hash=989794be6ca669465f6d0ee3c81de8c9a11c8fca$ // #include "libcef_dll/cpptoc/print_settings_cpptoc.h" @@ -67,24 +67,6 @@ print_settings_is_read_only(struct _cef_print_settings_t* self) { return _retval; } -struct _cef_print_settings_t* CEF_CALLBACK -print_settings_copy(struct _cef_print_settings_t* self) { - shutdown_checker::AssertNotShutdown(); - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = - CefPrintSettingsCppToC::Get(self)->Copy(); - - // Return type: refptr_same - return CefPrintSettingsCppToC::Wrap(_retval); -} - void CEF_CALLBACK print_settings_set_orientation(struct _cef_print_settings_t* self, int landscape) { @@ -465,7 +447,6 @@ print_settings_get_duplex_mode(struct _cef_print_settings_t* self) { CefPrintSettingsCppToC::CefPrintSettingsCppToC() { GetStruct()->is_valid = print_settings_is_valid; GetStruct()->is_read_only = print_settings_is_read_only; - GetStruct()->copy = print_settings_copy; GetStruct()->set_orientation = print_settings_set_orientation; GetStruct()->is_landscape = print_settings_is_landscape; GetStruct()->set_printer_printable_area = diff --git a/libcef_dll/ctocpp/print_settings_ctocpp.cc b/libcef_dll/ctocpp/print_settings_ctocpp.cc index 5b7a1f568..f82101d4c 100644 --- a/libcef_dll/ctocpp/print_settings_ctocpp.cc +++ b/libcef_dll/ctocpp/print_settings_ctocpp.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=a24e37a1b0fbff6c8489c8a054bba14c99907cd3$ +// $hash=5d50d3e5c268b1304db14532f6f010286b85b1d1$ // #include "libcef_dll/ctocpp/print_settings_ctocpp.h" @@ -65,23 +65,6 @@ NO_SANITIZE("cfi-icall") bool CefPrintSettingsCToCpp::IsReadOnly() { return _retval ? true : false; } -NO_SANITIZE("cfi-icall") -CefRefPtr CefPrintSettingsCToCpp::Copy() { - shutdown_checker::AssertNotShutdown(); - - cef_print_settings_t* _struct = GetStruct(); - if (CEF_MEMBER_MISSING(_struct, copy)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_print_settings_t* _retval = _struct->copy(_struct); - - // Return type: refptr_same - return CefPrintSettingsCToCpp::Wrap(_retval); -} - NO_SANITIZE("cfi-icall") void CefPrintSettingsCToCpp::SetOrientation(bool landscape) { shutdown_checker::AssertNotShutdown(); diff --git a/libcef_dll/ctocpp/print_settings_ctocpp.h b/libcef_dll/ctocpp/print_settings_ctocpp.h index c3879a81e..686536d56 100644 --- a/libcef_dll/ctocpp/print_settings_ctocpp.h +++ b/libcef_dll/ctocpp/print_settings_ctocpp.h @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=d031ce1331738df412c61dd9bf4c6d36f94b82a8$ +// $hash=b9e902ff99086dca1a15f17daaeda2f9e32f6d89$ // #ifndef CEF_LIBCEF_DLL_CTOCPP_PRINT_SETTINGS_CTOCPP_H_ @@ -37,7 +37,6 @@ class CefPrintSettingsCToCpp // CefPrintSettings methods. bool IsValid() OVERRIDE; bool IsReadOnly() OVERRIDE; - CefRefPtr Copy() OVERRIDE; void SetOrientation(bool landscape) OVERRIDE; bool IsLandscape() OVERRIDE; void SetPrinterPrintableArea(const CefSize& physical_size_device_units, diff --git a/libcef_dll/libcef_dll.cc b/libcef_dll/libcef_dll.cc index a51acb8e7..a448d0df1 100644 --- a/libcef_dll/libcef_dll.cc +++ b/libcef_dll/libcef_dll.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=d75ab7306d1e7f3633403c15b38edda291a2077e$ +// $hash=1f856cdb27fed708d944b6188812799e9e27c67d$ // #include "include/capi/cef_app_capi.h" @@ -717,16 +717,6 @@ CEF_EXPORT int cef_is_cert_status_error(cef_cert_status_t status) { return _retval; } -CEF_EXPORT int cef_is_cert_status_minor_error(cef_cert_status_t status) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - bool _retval = CefIsCertStatusMinorError(status); - - // Return type: bool - return _retval; -} - CEF_EXPORT int cef_currently_on(cef_thread_id_t threadId) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING diff --git a/libcef_dll/wrapper/libcef_dll_dylib.cc b/libcef_dll/wrapper/libcef_dll_dylib.cc index 6eded6c19..6a10a7357 100644 --- a/libcef_dll/wrapper/libcef_dll_dylib.cc +++ b/libcef_dll/wrapper/libcef_dll_dylib.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=231f2dd6f300c93a38ef8c18e19141691b3337ac$ +// $hash=33f5c103833cb9b4e6555f6a82fcaec06f3ff449$ // #include @@ -153,7 +153,6 @@ typedef int (*cef_register_scheme_handler_factory_ptr)( struct _cef_scheme_handler_factory_t*); typedef int (*cef_clear_scheme_handler_factories_ptr)(); typedef int (*cef_is_cert_status_error_ptr)(cef_cert_status_t); -typedef int (*cef_is_cert_status_minor_error_ptr)(cef_cert_status_t); typedef int (*cef_currently_on_ptr)(cef_thread_id_t); typedef int (*cef_post_task_ptr)(cef_thread_id_t, struct _cef_task_t*); typedef int (*cef_post_delayed_task_ptr)(cef_thread_id_t, @@ -553,7 +552,6 @@ struct libcef_pointers { cef_register_scheme_handler_factory_ptr cef_register_scheme_handler_factory; cef_clear_scheme_handler_factories_ptr cef_clear_scheme_handler_factories; cef_is_cert_status_error_ptr cef_is_cert_status_error; - cef_is_cert_status_minor_error_ptr cef_is_cert_status_minor_error; cef_currently_on_ptr cef_currently_on; cef_post_task_ptr cef_post_task; cef_post_delayed_task_ptr cef_post_delayed_task; @@ -769,7 +767,6 @@ int libcef_init_pointers(const char* path) { INIT_ENTRY(cef_register_scheme_handler_factory); INIT_ENTRY(cef_clear_scheme_handler_factories); INIT_ENTRY(cef_is_cert_status_error); - INIT_ENTRY(cef_is_cert_status_minor_error); INIT_ENTRY(cef_currently_on); INIT_ENTRY(cef_post_task); INIT_ENTRY(cef_post_delayed_task); @@ -1089,8 +1086,8 @@ int cef_create_url(const struct _cef_urlparts_t* parts, cef_string_t* url) { } NO_SANITIZE("cfi-icall") -cef_string_userfree_t - cef_format_url_for_security_display(const cef_string_t* origin_url) { +cef_string_userfree_t cef_format_url_for_security_display( + const cef_string_t* origin_url) { return g_libcef_pointers.cef_format_url_for_security_display(origin_url); } @@ -1177,11 +1174,6 @@ int cef_is_cert_status_error(cef_cert_status_t status) { return g_libcef_pointers.cef_is_cert_status_error(status); } -NO_SANITIZE("cfi-icall") -int cef_is_cert_status_minor_error(cef_cert_status_t status) { - return g_libcef_pointers.cef_is_cert_status_minor_error(status); -} - NO_SANITIZE("cfi-icall") int cef_currently_on(cef_thread_id_t threadId) { return g_libcef_pointers.cef_currently_on(threadId); } @@ -1569,54 +1561,46 @@ struct _cef_translator_test_t* cef_translator_test_create() { } NO_SANITIZE("cfi-icall") -struct - _cef_translator_test_ref_ptr_library_t* cef_translator_test_ref_ptr_library_create( - int value) { +struct _cef_translator_test_ref_ptr_library_t* +cef_translator_test_ref_ptr_library_create(int value) { return g_libcef_pointers.cef_translator_test_ref_ptr_library_create(value); } NO_SANITIZE("cfi-icall") -struct - _cef_translator_test_ref_ptr_library_child_t* cef_translator_test_ref_ptr_library_child_create( - int value, - int other_value) { +struct _cef_translator_test_ref_ptr_library_child_t* +cef_translator_test_ref_ptr_library_child_create(int value, int other_value) { return g_libcef_pointers.cef_translator_test_ref_ptr_library_child_create( value, other_value); } NO_SANITIZE("cfi-icall") -struct - _cef_translator_test_ref_ptr_library_child_child_t* cef_translator_test_ref_ptr_library_child_child_create( - int value, - int other_value, - int other_other_value) { +struct _cef_translator_test_ref_ptr_library_child_child_t* +cef_translator_test_ref_ptr_library_child_child_create(int value, + int other_value, + int other_other_value) { return g_libcef_pointers .cef_translator_test_ref_ptr_library_child_child_create( value, other_value, other_other_value); } NO_SANITIZE("cfi-icall") -struct - _cef_translator_test_scoped_library_t* cef_translator_test_scoped_library_create( - int value) { +struct _cef_translator_test_scoped_library_t* +cef_translator_test_scoped_library_create(int value) { return g_libcef_pointers.cef_translator_test_scoped_library_create(value); } NO_SANITIZE("cfi-icall") -struct - _cef_translator_test_scoped_library_child_t* cef_translator_test_scoped_library_child_create( - int value, - int other_value) { +struct _cef_translator_test_scoped_library_child_t* +cef_translator_test_scoped_library_child_create(int value, int other_value) { return g_libcef_pointers.cef_translator_test_scoped_library_child_create( value, other_value); } NO_SANITIZE("cfi-icall") -struct - _cef_translator_test_scoped_library_child_child_t* cef_translator_test_scoped_library_child_child_create( - int value, - int other_value, - int other_other_value) { +struct _cef_translator_test_scoped_library_child_child_t* +cef_translator_test_scoped_library_child_child_create(int value, + int other_value, + int other_other_value) { return g_libcef_pointers .cef_translator_test_scoped_library_child_child_create(value, other_value, other_other_value); diff --git a/libcef_dll/wrapper/libcef_dll_wrapper.cc b/libcef_dll/wrapper/libcef_dll_wrapper.cc index 7e94495a4..baa4e3d1b 100644 --- a/libcef_dll/wrapper/libcef_dll_wrapper.cc +++ b/libcef_dll/wrapper/libcef_dll_wrapper.cc @@ -9,7 +9,7 @@ // implementations. See the translator.README.txt file in the tools directory // for more information. // -// $hash=32eea715f2566d1b6a4e3d263e35400cf7c53869$ +// $hash=b12081eab77cac5baf1134e9fba8a23c6aef770a$ // #include "include/capi/cef_app_capi.h" @@ -669,17 +669,6 @@ CEF_GLOBAL bool CefIsCertStatusError(cef_cert_status_t status) { return _retval ? true : false; } -NO_SANITIZE("cfi-icall") -CEF_GLOBAL bool CefIsCertStatusMinorError(cef_cert_status_t status) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - int _retval = cef_is_cert_status_minor_error(status); - - // Return type: bool - return _retval ? true : false; -} - NO_SANITIZE("cfi-icall") CEF_GLOBAL bool CefCurrentlyOn(CefThreadId threadId) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING diff --git a/patch/patch.cfg b/patch/patch.cfg index 952cfea12..9c7081fd4 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -184,6 +184,9 @@ patches = [ }, { # Fix chrome Widevine build on Linux. + # + # Remove incorrect assertion on Windows/macOS by cherry-picking this commit: + # https://chromium.googlesource.com/chromium/src/+/ec992a43e7 'name': 'chrome_widevine', }, { @@ -430,11 +433,5 @@ patches = [ # - Remove unsupported print preview UI options. # https://bitbucket.org/chromiumembedded/cef/issues/123 'name': 'print_preview_123', - }, - { - # Fix execution of OnAccessibilityLocationChange by adding the following - # Chromium change: - # https://chromium.googlesource.com/chromium/src/+/7952ae45c4 - 'name': 'render_accessibility_1675917', } ] diff --git a/patch/patches/base_value_646113.patch b/patch/patches/base_value_646113.patch index 8e1a6436b..a9828e0e3 100644 --- a/patch/patches/base_value_646113.patch +++ b/patch/patches/base_value_646113.patch @@ -1,5 +1,5 @@ diff --git base/values.cc base/values.cc -index 7d042cdcd459..09eb01af5745 100644 +index 02e92b7e082b..b227923a6220 100644 --- base/values.cc +++ base/values.cc @@ -23,20 +23,6 @@ diff --git a/patch/patches/browser_child_frame_2507.patch b/patch/patches/browser_child_frame_2507.patch index 03aaad799..acb300a35 100644 --- a/patch/patches/browser_child_frame_2507.patch +++ b/patch/patches/browser_child_frame_2507.patch @@ -1,8 +1,8 @@ diff --git content/browser/renderer_host/render_widget_host_view_child_frame.cc content/browser/renderer_host/render_widget_host_view_child_frame.cc -index fbb86a38a7ac..bd1c70e53371 100644 +index 2531e9d6b344..87cadc541057 100644 --- content/browser/renderer_host/render_widget_host_view_child_frame.cc +++ content/browser/renderer_host/render_widget_host_view_child_frame.cc -@@ -613,6 +613,7 @@ void RenderWidgetHostViewChildFrame::SubmitCompositorFrame( +@@ -598,6 +598,7 @@ void RenderWidgetHostViewChildFrame::SubmitCompositorFrame( "RenderWidgetHostViewChildFrame::OnSwapCompositorFrame"); support_->SubmitCompositorFrame(local_surface_id, std::move(frame), std::move(hit_test_region_list)); @@ -10,7 +10,7 @@ index fbb86a38a7ac..bd1c70e53371 100644 } void RenderWidgetHostViewChildFrame::OnDidNotProduceFrame( -@@ -621,6 +622,15 @@ void RenderWidgetHostViewChildFrame::OnDidNotProduceFrame( +@@ -606,6 +607,15 @@ void RenderWidgetHostViewChildFrame::OnDidNotProduceFrame( support_->DidNotProduceFrame(ack); } @@ -26,7 +26,7 @@ index fbb86a38a7ac..bd1c70e53371 100644 void RenderWidgetHostViewChildFrame::TransformPointToRootSurface( gfx::PointF* point) { // This function is called by RenderWidgetHostInputEventRouter only for -@@ -818,6 +828,11 @@ void RenderWidgetHostViewChildFrame::ShowDefinitionForSelection() { +@@ -802,6 +812,11 @@ void RenderWidgetHostViewChildFrame::ShowDefinitionForSelection() { void RenderWidgetHostViewChildFrame::SpeakSelection() {} #endif // defined(OS_MACOSX) diff --git a/patch/patches/browser_compositor_mac.patch b/patch/patches/browser_compositor_mac.patch index 546271ffc..d9a7d5765 100644 --- a/patch/patches/browser_compositor_mac.patch +++ b/patch/patches/browser_compositor_mac.patch @@ -12,7 +12,7 @@ index de89d291e5cb..9ce7bf4cb250 100644 // Force a new surface id to be allocated. Returns true if the // RenderWidgetHostImpl sent the resulting surface id to the renderer. diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm -index 4b3f3c7e97e7..0ce693402b99 100644 +index 8ddd790decc4..3ffd3db8da4b 100644 --- content/browser/renderer_host/browser_compositor_view_mac.mm +++ content/browser/renderer_host/browser_compositor_view_mac.mm @@ -85,6 +85,12 @@ DelegatedFrameHost* BrowserCompositorMac::GetDelegatedFrameHost() { diff --git a/patch/patches/browser_plugin_guest_1565.patch b/patch/patches/browser_plugin_guest_1565.patch index 01116777b..0809b3e6c 100644 --- a/patch/patches/browser_plugin_guest_1565.patch +++ b/patch/patches/browser_plugin_guest_1565.patch @@ -1,8 +1,8 @@ diff --git content/browser/browser_plugin/browser_plugin_guest.cc content/browser/browser_plugin/browser_plugin_guest.cc -index ddb17ac729df..255d2ec9729d 100644 +index 6eb21be63dec..87ccc46f4d43 100644 --- content/browser/browser_plugin/browser_plugin_guest.cc +++ content/browser/browser_plugin/browser_plugin_guest.cc -@@ -307,8 +307,11 @@ void BrowserPluginGuest::InitInternal( +@@ -306,8 +306,11 @@ void BrowserPluginGuest::InitInternal( static_cast(GetWebContents()->GetView()); } @@ -15,7 +15,7 @@ index ddb17ac729df..255d2ec9729d 100644 // Once a BrowserPluginGuest has an embedder WebContents, it's considered to // be attached. -@@ -821,10 +824,19 @@ void BrowserPluginGuest::OnWillAttachComplete( +@@ -820,10 +823,19 @@ void BrowserPluginGuest::OnWillAttachComplete( static_cast(GetWebContents()->GetView()); if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) { web_contents_view->CreateViewForWidget( @@ -37,10 +37,10 @@ index ddb17ac729df..255d2ec9729d 100644 attached_ = true; diff --git content/browser/frame_host/interstitial_page_impl.cc content/browser/frame_host/interstitial_page_impl.cc -index 875ec8ce299b..a8e1119d4b03 100644 +index be1334c46132..60abcebf7422 100644 --- content/browser/frame_host/interstitial_page_impl.cc +++ content/browser/frame_host/interstitial_page_impl.cc -@@ -624,7 +624,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() { +@@ -622,7 +622,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() { WebContentsView* wcv = static_cast(web_contents())->GetView(); RenderWidgetHostViewBase* view = @@ -79,10 +79,10 @@ index bfb918a2cba3..a193b5a0fed8 100644 // Creates a new View that holds a non-top-level widget and receives messages // for it. diff --git content/browser/web_contents/web_contents_view_aura.cc content/browser/web_contents/web_contents_view_aura.cc -index ab27502c3509..282985c05c45 100644 +index dda92e4006db..23f86f9f1564 100644 --- content/browser/web_contents/web_contents_view_aura.cc +++ content/browser/web_contents/web_contents_view_aura.cc -@@ -947,7 +947,8 @@ void WebContentsViewAura::CreateView(const gfx::Size& initial_size, +@@ -948,7 +948,8 @@ void WebContentsViewAura::CreateView(const gfx::Size& initial_size, } RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( @@ -92,7 +92,7 @@ index ab27502c3509..282985c05c45 100644 if (render_widget_host->GetView()) { // During testing, the view will already be set up in most cases to the // test view, so we don't want to clobber it with a real one. To verify that -@@ -959,6 +960,7 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( +@@ -960,6 +961,7 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( render_widget_host->GetView()); } @@ -101,7 +101,7 @@ index ab27502c3509..282985c05c45 100644 g_create_render_widget_host_view ? g_create_render_widget_host_view(render_widget_host, diff --git content/browser/web_contents/web_contents_view_aura.h content/browser/web_contents/web_contents_view_aura.h -index 9be20d50ba4b..84c5106d15f2 100644 +index ed3c8d86cacc..70f869da762f 100644 --- content/browser/web_contents/web_contents_view_aura.h +++ content/browser/web_contents/web_contents_view_aura.h @@ -122,7 +122,7 @@ class CONTENT_EXPORT WebContentsViewAura @@ -221,7 +221,7 @@ index 35da7e53b6a6..df938f455be2 100644 RenderWidgetHost* render_widget_host) override; void SetPageTitle(const base::string16& title) override; diff --git content/browser/web_contents/web_contents_view_mac.mm content/browser/web_contents/web_contents_view_mac.mm -index 1d1f44d6a943..275e928d6bd1 100644 +index b35b9b48b53c..bfa5f5409d5d 100644 --- content/browser/web_contents/web_contents_view_mac.mm +++ content/browser/web_contents/web_contents_view_mac.mm @@ -327,7 +327,8 @@ void WebContentsViewMac::CreateView( @@ -266,7 +266,7 @@ index ea12af6b86b8..f1211f374328 100644 // a BrowserPlugin even when we are using cross process frames for guests. It // should be removed after resolving https://crbug.com/642826). diff --git extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc -index b7cb9fc9df13..a4a81ee1c863 100644 +index 1578ad4f86bd..a07ed1044d60 100644 --- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc +++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc @@ -212,6 +212,8 @@ void MimeHandlerViewGuest::CreateWebContents( diff --git a/patch/patches/browser_scheduler.patch b/patch/patches/browser_scheduler.patch index 93654755b..d4a13eff1 100644 --- a/patch/patches/browser_scheduler.patch +++ b/patch/patches/browser_scheduler.patch @@ -1,8 +1,8 @@ diff --git content/browser/scheduler/browser_task_executor.cc content/browser/scheduler/browser_task_executor.cc -index 3025bd308a4a..f7fb156a75d8 100644 +index f2ddb987a4de..a309caf4c670 100644 --- content/browser/scheduler/browser_task_executor.cc +++ content/browser/scheduler/browser_task_executor.cc -@@ -135,10 +135,11 @@ void BrowserTaskExecutor::PostFeatureListSetup() { +@@ -136,10 +136,11 @@ void BrowserTaskExecutor::PostFeatureListSetup() { // static void BrowserTaskExecutor::Shutdown() { diff --git a/patch/patches/build.patch b/patch/patches/build.patch index 08d05afcb..fb3d1616a 100644 --- a/patch/patches/build.patch +++ b/patch/patches/build.patch @@ -1,8 +1,8 @@ diff --git build/config/compiler/BUILD.gn build/config/compiler/BUILD.gn -index 66f3b325be58..b3bdbd5c39d9 100644 +index d1a9bfa30cb2..3c74d4acdda2 100644 --- build/config/compiler/BUILD.gn +++ build/config/compiler/BUILD.gn -@@ -160,7 +160,7 @@ declare_args() { +@@ -152,7 +152,7 @@ declare_args() { !use_clang_coverage && !(is_android && use_order_profiling) && (use_lld || (use_gold && @@ -11,7 +11,7 @@ index 66f3b325be58..b3bdbd5c39d9 100644 !(current_cpu == "x86" || current_cpu == "x64")))) } -@@ -1734,8 +1734,6 @@ config("thin_archive") { +@@ -1728,8 +1728,6 @@ config("thin_archive") { # archive names to 16 characters, which is not what we want). if ((is_posix && !is_nacl && !is_mac && !is_ios) || is_fuchsia) { arflags = [ "-T" ] diff --git a/patch/patches/chrome_browser.patch b/patch/patches/chrome_browser.patch index 2a4ad9bb4..6b6e78916 100644 --- a/patch/patches/chrome_browser.patch +++ b/patch/patches/chrome_browser.patch @@ -1,8 +1,8 @@ diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn -index 8ce5e842bbb2..95b0356cab27 100644 +index 0bc6da647d95..aa57c4d046d5 100644 --- chrome/browser/BUILD.gn +++ chrome/browser/BUILD.gn -@@ -9,6 +9,7 @@ import("//build/config/jumbo.gni") +@@ -10,6 +10,7 @@ import("//build/config/jumbo.gni") import("//build/config/linux/gtk/gtk.gni") import("//build/config/ui.gni") import("//build/split_static_library.gni") @@ -10,7 +10,7 @@ index 8ce5e842bbb2..95b0356cab27 100644 import("//chrome/common/features.gni") import("//components/feature_engagement/features.gni") import("//components/feed/features.gni") -@@ -1889,6 +1890,7 @@ jumbo_split_static_library("browser") { +@@ -1938,6 +1939,7 @@ jumbo_split_static_library("browser") { "//base/util/values:values_util", "//build:branding_buildflags", "//cc", @@ -18,7 +18,7 @@ index 8ce5e842bbb2..95b0356cab27 100644 "//chrome:extra_resources", "//chrome:resources", "//chrome:strings", -@@ -2192,6 +2194,10 @@ jumbo_split_static_library("browser") { +@@ -2238,6 +2240,10 @@ jumbo_split_static_library("browser") { ] } diff --git a/patch/patches/chrome_browser_net_export.patch b/patch/patches/chrome_browser_net_export.patch index 3c6df5542..c21107935 100644 --- a/patch/patches/chrome_browser_net_export.patch +++ b/patch/patches/chrome_browser_net_export.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn -index 50f7329cca40..c6cae9beda15 100644 +index 3b387d754736..2c537f9c15c1 100644 --- chrome/browser/ui/BUILD.gn +++ chrome/browser/ui/BUILD.gn @@ -10,6 +10,7 @@ import("//build/config/jumbo.gni") @@ -10,7 +10,7 @@ index 50f7329cca40..c6cae9beda15 100644 import("//chrome/common/features.gni") import("//chromeos/assistant/assistant.gni") import("//components/feature_engagement/features.gni") -@@ -368,6 +369,10 @@ jumbo_split_static_library("ui") { +@@ -370,6 +371,10 @@ jumbo_split_static_library("ui") { "//build/config/compiler:wexit_time_destructors", ] @@ -21,7 +21,7 @@ index 50f7329cca40..c6cae9beda15 100644 # Since browser and browser_ui actually depend on each other, # we must omit the dependency from browser_ui to browser. # However, this means browser_ui and browser should more or less -@@ -385,6 +390,7 @@ jumbo_split_static_library("ui") { +@@ -388,6 +393,7 @@ jumbo_split_static_library("ui") { "//base:i18n", "//base/allocator:buildflags", "//cc/paint", @@ -30,7 +30,7 @@ index 50f7329cca40..c6cae9beda15 100644 "//chrome:resources", "//chrome:strings", diff --git chrome/browser/ui/webui/net_export_ui.cc chrome/browser/ui/webui/net_export_ui.cc -index c50cd8b8f779..31aa7a2a696b 100644 +index 081ef17bf0d9..46b1d1af2baa 100644 --- chrome/browser/ui/webui/net_export_ui.cc +++ chrome/browser/ui/webui/net_export_ui.cc @@ -20,13 +20,12 @@ diff --git a/patch/patches/chrome_browser_product_override.patch b/patch/patches/chrome_browser_product_override.patch index 5d1286548..8119f22b4 100644 --- a/patch/patches/chrome_browser_product_override.patch +++ b/patch/patches/chrome_browser_product_override.patch @@ -1,8 +1,8 @@ diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc -index 0b29bc11f07c..9c0ffba4dc20 100644 +index b1d5ac049933..cfb78bb97597 100644 --- chrome/browser/chrome_content_browser_client.cc +++ chrome/browser/chrome_content_browser_client.cc -@@ -1067,10 +1067,6 @@ void LaunchURL( +@@ -1013,10 +1013,6 @@ void LaunchURL(const GURL& url, } } @@ -13,7 +13,7 @@ index 0b29bc11f07c..9c0ffba4dc20 100644 void MaybeAppendSecureOriginsAllowlistSwitch(base::CommandLine* cmdline) { // |allowlist| combines pref/policy + cmdline switch in the browser process. // For renderer and utility (e.g. NetworkService) processes the switch is the -@@ -1088,6 +1084,14 @@ void MaybeAppendSecureOriginsAllowlistSwitch(base::CommandLine* cmdline) { +@@ -1059,6 +1055,14 @@ base::FilePath GetModulePath(base::StringPiece16 module_name) { } // namespace @@ -29,10 +29,10 @@ index 0b29bc11f07c..9c0ffba4dc20 100644 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kUserAgent)) { diff --git chrome/browser/chrome_content_browser_client.h chrome/browser/chrome_content_browser_client.h -index 069f597633a2..e81d7718cfca 100644 +index 6bb50192ce17..6cb6a28d3114 100644 --- chrome/browser/chrome_content_browser_client.h +++ chrome/browser/chrome_content_browser_client.h -@@ -84,7 +84,8 @@ enum class Channel; +@@ -85,7 +85,8 @@ enum class Channel; class ChromeHidDelegate; class ChromeSerialDelegate; diff --git a/patch/patches/chrome_browser_profiles.patch b/patch/patches/chrome_browser_profiles.patch index 3b1539b29..1039ad57b 100644 --- a/patch/patches/chrome_browser_profiles.patch +++ b/patch/patches/chrome_browser_profiles.patch @@ -1,10 +1,10 @@ diff --git chrome/browser/profiles/profile_manager.cc chrome/browser/profiles/profile_manager.cc -index bd2715738d89..a61a0765301f 100644 +index 5fb5b84258a8..e28db2e984f6 100644 --- chrome/browser/profiles/profile_manager.cc +++ chrome/browser/profiles/profile_manager.cc -@@ -375,7 +375,7 @@ ProfileManager::ProfileManager(const base::FilePath& user_data_dir) - chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, - content::NotificationService::AllSources()); +@@ -359,7 +359,7 @@ ProfileManager::ProfileManager(const base::FilePath& user_data_dir) + registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, + content::NotificationService::AllSources()); - if (ProfileShortcutManager::IsFeatureEnabled() && !user_data_dir_.empty()) + if (!user_data_dir_.empty() && ProfileShortcutManager::IsFeatureEnabled()) @@ -12,10 +12,10 @@ index bd2715738d89..a61a0765301f 100644 } diff --git chrome/browser/profiles/profile_manager.h chrome/browser/profiles/profile_manager.h -index 985c64458bdf..f46ddbb8c05d 100644 +index 87ecf1fc998b..924c24fa42a2 100644 --- chrome/browser/profiles/profile_manager.h +++ chrome/browser/profiles/profile_manager.h -@@ -94,7 +94,7 @@ class ProfileManager : public content::NotificationObserver, +@@ -99,7 +99,7 @@ class ProfileManager : public content::NotificationObserver, // acceptable. Returns null if creation of the new profile fails. // TODO(bauerb): Migrate calls from other code to GetProfileByPath(), then // make this method private. @@ -24,7 +24,7 @@ index 985c64458bdf..f46ddbb8c05d 100644 // Returns total number of profiles available on this machine. size_t GetNumberOfProfiles(); -@@ -124,7 +124,7 @@ class ProfileManager : public content::NotificationObserver, +@@ -129,7 +129,7 @@ class ProfileManager : public content::NotificationObserver, // Returns true if the profile pointer is known to point to an existing // profile. @@ -33,7 +33,7 @@ index 985c64458bdf..f46ddbb8c05d 100644 // Returns the directory where the first created profile is stored, // relative to the user data directory currently in use. -@@ -133,7 +133,7 @@ class ProfileManager : public content::NotificationObserver, +@@ -138,7 +138,7 @@ class ProfileManager : public content::NotificationObserver, // Get the Profile last used (the Profile to which owns the most recently // focused window) with this Chrome build. If no signed profile has been // stored in Local State, hand back the Default profile. diff --git a/patch/patches/chrome_plugins.patch b/patch/patches/chrome_plugins.patch index 2414ca1f0..5b6308bde 100644 --- a/patch/patches/chrome_plugins.patch +++ b/patch/patches/chrome_plugins.patch @@ -1,10 +1,10 @@ diff --git chrome/browser/plugins/plugin_info_host_impl.cc chrome/browser/plugins/plugin_info_host_impl.cc -index f2223e24ec7c..8374b7f0d56d 100644 +index 865ca9288de7..8f736f081b86 100644 --- chrome/browser/plugins/plugin_info_host_impl.cc +++ chrome/browser/plugins/plugin_info_host_impl.cc @@ -18,6 +18,7 @@ #include "base/task_runner_util.h" - #include "base/threading/thread_task_runner_handle.h" + #include "build/branding_buildflags.h" #include "build/build_config.h" +#include "cef/libcef/features/features.h" #include "chrome/browser/browser_process.h" @@ -32,38 +32,42 @@ index f2223e24ec7c..8374b7f0d56d 100644 extensions::WebViewRendererState* renderer_state = extensions::WebViewRendererState::GetInstance(); std::string partition_id; -@@ -130,12 +139,16 @@ bool IsPluginLoadingAccessibleResourceInWebView( +@@ -129,9 +138,6 @@ bool IsPluginLoadingAccessibleResourceInWebView( + PluginInfoHostImpl::Context::Context(int render_process_id, Profile* profile) : render_process_id_(render_process_id), - resource_context_(profile->GetResourceContext()), -#if BUILDFLAG(ENABLE_EXTENSIONS) - extension_registry_(extensions::ExtensionRegistry::Get(profile)), -#endif host_content_settings_map_( HostContentSettingsMapFactory::GetForProfile(profile)), plugin_prefs_(PluginPrefs::GetForProfile(profile)) { +@@ -139,6 +145,13 @@ PluginInfoHostImpl::Context::Context(int render_process_id, Profile* profile) + profile->GetPrefs()); + run_all_flash_in_allow_mode_.Init(prefs::kRunAllFlashInAllowMode, + profile->GetPrefs()); ++ +#if BUILDFLAG(ENABLE_EXTENSIONS) +#if BUILDFLAG(ENABLE_CEF) + if (extensions::ExtensionsEnabled()) +#endif + extension_registry_ = extensions::ExtensionRegistry::Get(profile); +#endif -+ - allow_outdated_plugins_.Init(prefs::kPluginsAllowOutdated, - profile->GetPrefs()); - allow_outdated_plugins_.MoveToSequence( -@@ -234,6 +247,7 @@ void PluginInfoHostImpl::PluginsLoaded( + } + + PluginInfoHostImpl::Context::~Context() {} +@@ -209,6 +222,7 @@ void PluginInfoHostImpl::PluginsLoaded( plugin_metadata->identifier(), &output->status); } +#if !BUILDFLAG(ENABLE_CEF) if (output->status == chrome::mojom::PluginStatus::kNotFound) { // Check to see if the component updater can fetch an implementation. - base::PostTaskAndReplyWithResult( -@@ -245,7 +259,9 @@ void PluginInfoHostImpl::PluginsLoaded( - base::BindOnce(&PluginInfoHostImpl::ComponentPluginLookupDone, this, - params, std::move(output), std::move(callback), - std::move(plugin_metadata))); + std::unique_ptr cus_plugin_info = +@@ -217,7 +231,9 @@ void PluginInfoHostImpl::PluginsLoaded( + ComponentPluginLookupDone(params, std::move(output), std::move(callback), + std::move(plugin_metadata), + std::move(cus_plugin_info)); - } else { + } else +#endif // !BUILDFLAG(ENABLE_CEF) @@ -71,7 +75,7 @@ index f2223e24ec7c..8374b7f0d56d 100644 GetPluginInfoFinish(params, std::move(output), std::move(callback), std::move(plugin_metadata)); } -@@ -258,6 +274,14 @@ void PluginInfoHostImpl::Context::DecidePluginStatus( +@@ -230,6 +246,14 @@ void PluginInfoHostImpl::Context::DecidePluginStatus( PluginMetadata::SecurityStatus security_status, const std::string& plugin_identifier, chrome::mojom::PluginStatus* status) const { @@ -86,7 +90,7 @@ index f2223e24ec7c..8374b7f0d56d 100644 if (security_status == PluginMetadata::SECURITY_STATUS_FULLY_TRUSTED) { *status = chrome::mojom::PluginStatus::kAllowed; return; -@@ -366,16 +390,36 @@ bool PluginInfoHostImpl::Context::FindEnabledPlugin( +@@ -338,16 +362,35 @@ bool PluginInfoHostImpl::Context::FindEnabledPlugin( return false; } @@ -101,9 +105,8 @@ index f2223e24ec7c..8374b7f0d56d 100644 + size_t i = 0; + for (; i < matching_plugins.size(); ++i) { + if (filter->IsPluginAvailable(render_process_id_, render_frame_id, -+ resource_context_, url, is_main_frame, -+ main_frame_origin, &matching_plugins[i], -+ status)) { ++ url, is_main_frame, main_frame_origin, ++ &matching_plugins[i], status)) { + break; + } + } @@ -112,11 +115,11 @@ index f2223e24ec7c..8374b7f0d56d 100644 PluginService::GetInstance()->GetFilter(); size_t i = 0; for (; i < matching_plugins.size(); ++i) { - if (!filter || filter->IsPluginAvailable( - render_process_id_, render_frame_id, resource_context_, -- url, main_frame_origin, &matching_plugins[i])) { -+ url, is_main_frame, main_frame_origin, -+ &matching_plugins[i])) { + if (!filter || + filter->IsPluginAvailable(render_process_id_, render_frame_id, url, +- main_frame_origin, &matching_plugins[i])) { ++ is_main_frame, main_frame_origin, ++ &matching_plugins[i])) { break; } } @@ -125,7 +128,7 @@ index f2223e24ec7c..8374b7f0d56d 100644 // If we broke out of the loop, we have found an enabled plugin. bool enabled = i < matching_plugins.size(); diff --git chrome/browser/plugins/plugin_utils.cc chrome/browser/plugins/plugin_utils.cc -index 73d60aa7f77c..89bff0de7186 100644 +index 56f147d2fc56..90553ec27d23 100644 --- chrome/browser/plugins/plugin_utils.cc +++ chrome/browser/plugins/plugin_utils.cc @@ -5,6 +5,7 @@ @@ -148,40 +151,8 @@ index 73d60aa7f77c..89bff0de7186 100644 #if BUILDFLAG(ENABLE_EXTENSIONS) #include "chrome/common/pref_names.h" #include "components/prefs/pref_service.h" -@@ -251,12 +257,29 @@ base::flat_map - PluginUtils::GetMimeTypeToExtensionIdMap( - content::ResourceContext* resource_context) { - #if BUILDFLAG(ENABLE_EXTENSIONS) -+ -+#if BUILDFLAG(ENABLE_CEF) -+ if (!extensions::ExtensionsEnabled()) -+ return {}; -+ -+ CefResourceContext* context = -+ static_cast(resource_context); -+ bool profile_is_off_the_record = context->IsOffTheRecord(); -+ scoped_refptr extension_info_map( -+ const_cast(context->GetExtensionInfoMap())); -+ bool always_open_pdf_externally = !extensions::PdfExtensionEnabled(); -+#else - ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); - scoped_refptr extension_info_map( - io_data->GetExtensionInfoMap()); -+ bool profile_is_off_the_record = io_data->IsOffTheRecord(); -+ bool always_open_pdf_externally = -+ io_data->always_open_pdf_externally()->GetValue(); -+#endif -+ - return GetMimeTypeToExtensionIdMapInternal( -- io_data->IsOffTheRecord(), -- io_data->always_open_pdf_externally()->GetValue(), -+ profile_is_off_the_record, -+ always_open_pdf_externally, - base::BindRepeating( - [](const scoped_refptr& info_map, - const std::string& extension_id) { diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc -index ae7e07340ea4..f193040e8bca 100644 +index 03781c0b08e0..37dc3e93c7d9 100644 --- chrome/renderer/chrome_content_renderer_client.cc +++ chrome/renderer/chrome_content_renderer_client.cc @@ -794,6 +794,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( diff --git a/patch/patches/chrome_pref_watcher.patch b/patch/patches/chrome_pref_watcher.patch index 5e9b717e5..ce0c45021 100644 --- a/patch/patches/chrome_pref_watcher.patch +++ b/patch/patches/chrome_pref_watcher.patch @@ -1,10 +1,10 @@ diff --git chrome/browser/ui/prefs/pref_watcher.h chrome/browser/ui/prefs/pref_watcher.h -index b5ccdc521a36..716117c141cc 100644 +index dd06c6d22b16..1f3a5aa7ac2b 100644 --- chrome/browser/ui/prefs/pref_watcher.h +++ chrome/browser/ui/prefs/pref_watcher.h @@ -29,10 +29,10 @@ class PrefWatcher : public KeyedService { void RegisterRendererPreferenceWatcher( - blink::mojom::RendererPreferenceWatcherPtr watcher); + mojo::PendingRemote watcher); - private: // KeyedService overrides: diff --git a/patch/patches/chrome_renderer.patch b/patch/patches/chrome_renderer.patch index 0bb135131..3a0e8fb38 100644 --- a/patch/patches/chrome_renderer.patch +++ b/patch/patches/chrome_renderer.patch @@ -1,5 +1,5 @@ diff --git chrome/renderer/BUILD.gn chrome/renderer/BUILD.gn -index 4f3ed79d0500..357a0b260e85 100644 +index a008c196d020..bf91ed98b864 100644 --- chrome/renderer/BUILD.gn +++ chrome/renderer/BUILD.gn @@ -4,6 +4,7 @@ @@ -10,7 +10,7 @@ index 4f3ed79d0500..357a0b260e85 100644 import("//chrome/common/features.gni") import("//components/nacl/features.gni") import("//components/offline_pages/buildflags/features.gni") -@@ -125,6 +126,7 @@ jumbo_static_library("renderer") { +@@ -118,6 +119,7 @@ jumbo_static_library("renderer") { defines = [] deps = [ @@ -18,7 +18,7 @@ index 4f3ed79d0500..357a0b260e85 100644 "//chrome:resources", "//chrome:strings", "//chrome/common", -@@ -190,6 +192,10 @@ jumbo_static_library("renderer") { +@@ -185,6 +187,10 @@ jumbo_static_library("renderer") { configs += [ "//build/config/compiler:wexit_time_destructors" ] diff --git a/patch/patches/chrome_widevine.patch b/patch/patches/chrome_widevine.patch index 8611c9f37..9ecf30b0d 100644 --- a/patch/patches/chrome_widevine.patch +++ b/patch/patches/chrome_widevine.patch @@ -1,8 +1,8 @@ diff --git chrome/common/chrome_content_client.cc chrome/common/chrome_content_client.cc -index 1e9bc3b924db..eaf4ac0f22f8 100644 +index fb0059b3e652..452f58ab4a0a 100644 --- chrome/common/chrome_content_client.cc +++ chrome/common/chrome_content_client.cc -@@ -92,7 +92,8 @@ +@@ -93,7 +93,8 @@ // Registers Widevine CDM if Widevine is enabled, the Widevine CDM is // bundled and not a component. When the Widevine CDM is a component, it is // registered in widevine_cdm_component_installer.cc. @@ -13,7 +13,7 @@ index 1e9bc3b924db..eaf4ac0f22f8 100644 #include "third_party/widevine/cdm/widevine_cdm_common.h" // nogncheck // TODO(crbug.com/663554): Needed for WIDEVINE_CDM_VERSION_STRING. Support diff --git third_party/widevine/cdm/BUILD.gn third_party/widevine/cdm/BUILD.gn -index 27b3e9150832..bf5b96c5f69f 100644 +index 18177ec2e536..dca927a726b9 100644 --- third_party/widevine/cdm/BUILD.gn +++ third_party/widevine/cdm/BUILD.gn @@ -5,6 +5,7 @@ @@ -24,3 +24,12 @@ index 27b3e9150832..bf5b96c5f69f 100644 import("//media/cdm/library_cdm/cdm_paths.gni") import("//media/media_options.gni") import("//third_party/widevine/cdm/widevine.gni") +@@ -106,8 +107,6 @@ if (widevine_cdm_manifest_and_license_files != []) { + ] + } + } else { +- assert(!enable_widevine_cdm_component, +- "Widevine as a component requires a manifest.") + group("widevine_cdm_manifest_and_license") { + # NOP + } diff --git a/patch/patches/content_2015.patch b/patch/patches/content_2015.patch index 9013e2c97..ef48841b7 100644 --- a/patch/patches/content_2015.patch +++ b/patch/patches/content_2015.patch @@ -1,75 +1,73 @@ diff --git chrome/browser/download/download_target_determiner.cc chrome/browser/download/download_target_determiner.cc -index e0d2c5c42517..0849c5bf6b7e 100644 +index 2d5b195caecb..827fcc962640 100644 --- chrome/browser/download/download_target_determiner.cc +++ chrome/browser/download/download_target_determiner.cc -@@ -631,8 +631,8 @@ void IsHandledBySafePlugin(content::ResourceContext* resource_context, +@@ -636,7 +636,7 @@ void IsHandledBySafePlugin(int render_process_id, content::PluginService* plugin_service = content::PluginService::GetInstance(); bool plugin_found = plugin_service->GetPluginInfo( -- -1, -1, resource_context, url, url::Origin(), mime_type, false, &is_stale, -- &plugin_info, &actual_mime_type); -+ -1, -1, resource_context, url, true, url::Origin(), mime_type, false, -+ &is_stale, &plugin_info, &actual_mime_type); +- render_process_id, routing_id, url, url::Origin(), mime_type, false, ++ render_process_id, routing_id, url, true, url::Origin(), mime_type, false, + &is_stale, &plugin_info, &actual_mime_type); if (is_stale && stale_plugin_action == RETRY_IF_STALE_PLUGIN_LIST) { // The GetPlugins call causes the plugin list to be refreshed. Once that's - // done we can retry the GetPluginInfo call. We break out of this cycle diff --git chrome/browser/plugins/chrome_plugin_service_filter.cc chrome/browser/plugins/chrome_plugin_service_filter.cc -index 55801ac0fee7..8e993e959ca2 100644 +index 8916d9329a6c..bd1174231578 100644 --- chrome/browser/plugins/chrome_plugin_service_filter.cc +++ chrome/browser/plugins/chrome_plugin_service_filter.cc -@@ -167,6 +167,7 @@ bool ChromePluginServiceFilter::IsPluginAvailable( +@@ -163,6 +163,7 @@ bool ChromePluginServiceFilter::IsPluginAvailable( + int render_process_id, int render_frame_id, - const void* context, const GURL& plugin_content_url, + bool is_main_frame, const url::Origin& main_frame_origin, content::WebPluginInfo* plugin) { base::AutoLock auto_lock(lock_); diff --git chrome/browser/plugins/chrome_plugin_service_filter.h chrome/browser/plugins/chrome_plugin_service_filter.h -index c707c8773a74..20bdf74abf01 100644 +index 937d3d5bc84f..ac327392dcf3 100644 --- chrome/browser/plugins/chrome_plugin_service_filter.h +++ chrome/browser/plugins/chrome_plugin_service_filter.h -@@ -65,6 +65,7 @@ class ChromePluginServiceFilter : public content::PluginServiceFilter, +@@ -64,6 +64,7 @@ class ChromePluginServiceFilter : public content::PluginServiceFilter, + bool IsPluginAvailable(int render_process_id, int render_frame_id, - const void* context, const GURL& plugin_content_url, + bool is_main_frame, const url::Origin& main_frame_origin, content::WebPluginInfo* plugin) override; diff --git chrome/browser/plugins/pdf_iframe_navigation_throttle.cc chrome/browser/plugins/pdf_iframe_navigation_throttle.cc -index 2eb7f21919fd..4218d3352d70 100644 +index 2c66cd46d84b..f81854a7b25f 100644 --- chrome/browser/plugins/pdf_iframe_navigation_throttle.cc +++ chrome/browser/plugins/pdf_iframe_navigation_throttle.cc -@@ -71,8 +71,8 @@ bool IsPDFPluginEnabled(content::NavigationHandle* navigation_handle, +@@ -68,7 +68,7 @@ bool IsPDFPluginEnabled(content::NavigationHandle* navigation_handle, + content::WebPluginInfo plugin_info; return content::PluginService::GetInstance()->GetPluginInfo( - process_id, routing_id, resource_context, navigation_handle->GetURL(), -- web_contents->GetMainFrame()->GetLastCommittedOrigin(), kPDFMimeType, -- false /* allow_wildcard */, is_stale, &plugin_info, -+ false, web_contents->GetMainFrame()->GetLastCommittedOrigin(), -+ kPDFMimeType, false /* allow_wildcard */, is_stale, &plugin_info, +- process_id, routing_id, navigation_handle->GetURL(), ++ process_id, routing_id, navigation_handle->GetURL(), false, + web_contents->GetMainFrame()->GetLastCommittedOrigin(), kPDFMimeType, + false /* allow_wildcard */, is_stale, &plugin_info, nullptr /* actual_mime_type */); - } - #endif diff --git chrome/browser/ui/views/frame/browser_root_view.cc chrome/browser/ui/views/frame/browser_root_view.cc -index 786365927e71..27d32872d8d0 100644 +index e7f241e8db68..fe0b6e546b86 100644 --- chrome/browser/ui/views/frame/browser_root_view.cc +++ chrome/browser/ui/views/frame/browser_root_view.cc -@@ -70,7 +70,7 @@ void OnFindURLMimeType(const GURL& url, - content::PluginService::GetInstance()->GetPluginInfo( - -1, // process ID - MSG_ROUTING_NONE, // routing ID -- profile->GetResourceContext(), url, url::Origin(), mime_type, -+ profile->GetResourceContext(), url, true, url::Origin(), mime_type, - false, nullptr, &plugin, nullptr)); +@@ -69,8 +69,8 @@ void OnFindURLMimeType(const GURL& url, + std::move(callback).Run( + url, mime_type.empty() || blink::IsSupportedMimeType(mime_type) || + content::PluginService::GetInstance()->GetPluginInfo( +- process_id, routing_id, url, url::Origin(), mime_type, false, +- nullptr, &plugin, nullptr)); ++ process_id, routing_id, url, true, url::Origin(), mime_type, ++ false, nullptr, &plugin, nullptr)); } + bool GetURLForDrop(const ui::DropTargetEvent& event, GURL* url) { diff --git content/browser/devtools/devtools_http_handler.cc content/browser/devtools/devtools_http_handler.cc -index 83772ae8cca7..0eadd7c9a37a 100644 +index 569503d5f870..26e8b0c207c6 100644 --- content/browser/devtools/devtools_http_handler.cc +++ content/browser/devtools/devtools_http_handler.cc -@@ -572,7 +572,7 @@ void DevToolsHttpHandler::OnJsonRequest( +@@ -570,7 +570,7 @@ void DevToolsHttpHandler::OnJsonRequest( version.SetString("Protocol-Version", DevToolsAgentHost::GetProtocolVersion()); version.SetString("WebKit-Version", GetWebKitVersion()); @@ -79,10 +77,10 @@ index 83772ae8cca7..0eadd7c9a37a 100644 GetContentClient()->browser()->GetUserAgent()); version.SetString("V8-Version", V8_VERSION_STRING); diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc -index 5815fdfd6259..307c222c0d40 100644 +index 1202e49da23f..a829f2f6b1ad 100644 --- content/browser/frame_host/render_frame_message_filter.cc +++ content/browser/frame_host/render_frame_message_filter.cc -@@ -493,6 +493,7 @@ void RenderFrameMessageFilter::OnAre3DAPIsBlocked(int render_frame_id, +@@ -468,6 +468,7 @@ void RenderFrameMessageFilter::OnAre3DAPIsBlocked(int render_frame_id, void RenderFrameMessageFilter::OnGetPluginInfo( int render_frame_id, const GURL& url, @@ -90,22 +88,23 @@ index 5815fdfd6259..307c222c0d40 100644 const url::Origin& main_frame_origin, const std::string& mime_type, bool* found, -@@ -504,8 +505,8 @@ void RenderFrameMessageFilter::OnGetPluginInfo( +@@ -475,8 +476,9 @@ void RenderFrameMessageFilter::OnGetPluginInfo( + std::string* actual_mime_type) { bool allow_wildcard = true; *found = plugin_service_->GetPluginInfo( - render_process_id_, render_frame_id, resource_context_, url, -- main_frame_origin, mime_type, allow_wildcard, nullptr, info, -- actual_mime_type); -+ is_main_frame, main_frame_origin, mime_type, allow_wildcard, nullptr, -+ info, actual_mime_type); +- render_process_id_, render_frame_id, url, main_frame_origin, mime_type, +- allow_wildcard, nullptr, info, actual_mime_type); ++ render_process_id_, render_frame_id, url, is_main_frame, ++ main_frame_origin, mime_type, allow_wildcard, nullptr, info, ++ actual_mime_type); } void RenderFrameMessageFilter::OnOpenChannelToPepperPlugin( diff --git content/browser/frame_host/render_frame_message_filter.h content/browser/frame_host/render_frame_message_filter.h -index e7900ef22a0d..f05d2ee128bd 100644 +index d3510133b2dc..ebcfb56a6034 100644 --- content/browser/frame_host/render_frame_message_filter.h +++ content/browser/frame_host/render_frame_message_filter.h -@@ -113,6 +113,7 @@ class CONTENT_EXPORT RenderFrameMessageFilter : public BrowserMessageFilter { +@@ -111,6 +111,7 @@ class CONTENT_EXPORT RenderFrameMessageFilter : public BrowserMessageFilter { #if BUILDFLAG(ENABLE_PLUGINS) void OnGetPluginInfo(int render_frame_id, const GURL& url, @@ -113,26 +112,11 @@ index e7900ef22a0d..f05d2ee128bd 100644 const url::Origin& main_frame_origin, const std::string& mime_type, bool* found, -diff --git content/browser/loader/mime_sniffing_resource_handler.cc content/browser/loader/mime_sniffing_resource_handler.cc -index b0458c1168d9..98f7ae7b7899 100644 ---- content/browser/loader/mime_sniffing_resource_handler.cc -+++ content/browser/loader/mime_sniffing_resource_handler.cc -@@ -510,8 +510,8 @@ bool MimeSniffingResourceHandler::CheckForPluginHandler( - WebPluginInfo plugin; - bool has_plugin = plugin_service_->GetPluginInfo( - info->GetChildID(), info->GetRenderFrameID(), info->GetContext(), -- request()->url(), url::Origin(), response_->head.mime_type, -- allow_wildcard, &stale, &plugin, nullptr); -+ request()->url(), info->IsMainFrame(), url::Origin(), -+ response_->head.mime_type, allow_wildcard, &stale, &plugin, nullptr); - - if (stale) { - // Refresh the plugins asynchronously. diff --git content/browser/loader/navigation_url_loader_impl.cc content/browser/loader/navigation_url_loader_impl.cc -index 7dafa5c27290..14d97d465f2c 100644 +index c82860885d1b..db78f147b39a 100644 --- content/browser/loader/navigation_url_loader_impl.cc +++ content/browser/loader/navigation_url_loader_impl.cc -@@ -1061,6 +1061,13 @@ class NavigationURLLoaderImpl::URLLoaderRequestController +@@ -661,6 +661,13 @@ class NavigationURLLoaderImpl::URLLoaderRequestController static_cast(resource_request_->transition_type), resource_request_->has_user_gesture, &loader_factory); @@ -146,22 +130,25 @@ index 7dafa5c27290..14d97d465f2c 100644 if (loader_factory) { factory = base::MakeRefCounted( -@@ -1310,7 +1317,7 @@ class NavigationURLLoaderImpl::URLLoaderRequestController - // path does as well for navigations. +@@ -874,8 +881,9 @@ class NavigationURLLoaderImpl::URLLoaderRequestController + frame_tree_node->current_frame_host()->GetProcess()->GetID(); + int routing_id = frame_tree_node->current_frame_host()->GetRoutingID(); bool has_plugin = PluginService::GetInstance()->GetPluginInfo( - -1 /* render_process_id */, -1 /* render_frame_id */, resource_context_, -- resource_request_->url, url::Origin(), head.mime_type, -+ resource_request_->url, true, url::Origin(), head.mime_type, - false /* allow_wildcard */, &stale, &plugin, nullptr); +- render_process_id, routing_id, resource_request_->url, url::Origin(), +- head.mime_type, false /* allow_wildcard */, &stale, &plugin, nullptr); ++ render_process_id, routing_id, resource_request_->url, true, ++ url::Origin(), head.mime_type, false /* allow_wildcard */, &stale, ++ &plugin, nullptr); if (stale) { + // Refresh the plugins asynchronously. diff --git content/browser/plugin_service_impl.cc content/browser/plugin_service_impl.cc -index a599f989065f..115867edec92 100644 +index 06bd3e74a1cb..a6d3a0956c7e 100644 --- content/browser/plugin_service_impl.cc +++ content/browser/plugin_service_impl.cc -@@ -302,6 +302,7 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id, +@@ -301,6 +301,7 @@ bool PluginServiceImpl::GetPluginInfoArray( + bool PluginServiceImpl::GetPluginInfo(int render_process_id, int render_frame_id, - ResourceContext* context, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, @@ -170,30 +157,30 @@ index a599f989065f..115867edec92 100644 @@ -318,7 +319,8 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id, for (size_t i = 0; i < plugins.size(); ++i) { if (!filter_ || - filter_->IsPluginAvailable(render_process_id, render_frame_id, context, -- url, main_frame_origin, &plugins[i])) { -+ url, is_main_frame, main_frame_origin, + filter_->IsPluginAvailable(render_process_id, render_frame_id, url, +- main_frame_origin, &plugins[i])) { ++ is_main_frame, main_frame_origin, + &plugins[i])) { *info = plugins[i]; if (actual_mime_type) *actual_mime_type = mime_types[i]; diff --git content/browser/plugin_service_impl.h content/browser/plugin_service_impl.h -index c4c0ed551697..b234e239bba4 100644 +index 6c39259a2c67..b3d18b1135d3 100644 --- content/browser/plugin_service_impl.h +++ content/browser/plugin_service_impl.h -@@ -57,6 +57,7 @@ class CONTENT_EXPORT PluginServiceImpl : public PluginService { +@@ -54,6 +54,7 @@ class CONTENT_EXPORT PluginServiceImpl : public PluginService { + bool GetPluginInfo(int render_process_id, int render_frame_id, - ResourceContext* context, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, const std::string& mime_type, bool allow_wildcard, diff --git content/browser/renderer_host/plugin_registry_impl.cc content/browser/renderer_host/plugin_registry_impl.cc -index 717db1507d66..d44142b67ff7 100644 +index a6d6188fb139..7ac57de6fd55 100644 --- content/browser/renderer_host/plugin_registry_impl.cc +++ content/browser/renderer_host/plugin_registry_impl.cc -@@ -27,6 +27,7 @@ void PluginRegistryImpl::Bind(blink::mojom::PluginRegistryRequest request) { +@@ -29,6 +29,7 @@ void PluginRegistryImpl::Bind( } void PluginRegistryImpl::GetPlugins(bool refresh, @@ -201,7 +188,7 @@ index 717db1507d66..d44142b67ff7 100644 const url::Origin& main_frame_origin, GetPluginsCallback callback) { auto* plugin_service = PluginServiceImpl::GetInstance(); -@@ -48,10 +49,11 @@ void PluginRegistryImpl::GetPlugins(bool refresh, +@@ -50,10 +51,11 @@ void PluginRegistryImpl::GetPlugins(bool refresh, plugin_service->GetPlugins(base::BindOnce( &PluginRegistryImpl::GetPluginsComplete, weak_factory_.GetWeakPtr(), @@ -214,29 +201,19 @@ index 717db1507d66..d44142b67ff7 100644 const url::Origin& main_frame_origin, GetPluginsCallback callback, const std::vector& all_plugins) { -@@ -61,7 +63,7 @@ void PluginRegistryImpl::GetPluginsComplete( - GetContentClient()->browser()->GetPluginMimeTypesWithExternalHandlers( - resource_context_); - -- const int child_process_id = -1; -+ const int child_process_id = render_process_id_; - const int routing_id = MSG_ROUTING_NONE; - // In this loop, copy the WebPluginInfo (and do not use a reference) because - // the filter might mutate it. -@@ -70,7 +72,7 @@ void PluginRegistryImpl::GetPluginsComplete( - if (!filter || - filter->IsPluginAvailable(child_process_id, routing_id, - resource_context_, main_frame_origin.GetURL(), -- main_frame_origin, &plugin)) { -+ is_main_frame, main_frame_origin, &plugin)) { +@@ -76,6 +78,7 @@ void PluginRegistryImpl::GetPluginsComplete( + // TODO(crbug.com/621724): Pass an url::Origin instead of a GURL. + if (!filter || filter->IsPluginAvailable(render_process_id_, routing_id, + main_frame_origin.GetURL(), ++ is_main_frame, + main_frame_origin, &plugin)) { auto plugin_blink = blink::mojom::PluginInfo::New(); plugin_blink->name = plugin.name; - plugin_blink->description = plugin.desc; diff --git content/browser/renderer_host/plugin_registry_impl.h content/browser/renderer_host/plugin_registry_impl.h -index 061dd21cbbd1..a418b8d08091 100644 +index 632ae86c6fd6..55b749ec1242 100644 --- content/browser/renderer_host/plugin_registry_impl.h +++ content/browser/renderer_host/plugin_registry_impl.h -@@ -24,17 +24,24 @@ class PluginRegistryImpl : public blink::mojom::PluginRegistry { +@@ -24,11 +24,13 @@ class PluginRegistryImpl : public blink::mojom::PluginRegistry { // blink::mojom::PluginRegistry void GetPlugins(bool refresh, @@ -244,10 +221,6 @@ index 061dd21cbbd1..a418b8d08091 100644 const url::Origin& main_frame_origin, GetPluginsCallback callback) override; -+ void set_render_process_id(int render_process_id) { -+ render_process_id_ = render_process_id; -+ } -+ private: - void GetPluginsComplete(const url::Origin& main_frame_origin, + void GetPluginsComplete(bool is_main_frame, @@ -255,18 +228,11 @@ index 061dd21cbbd1..a418b8d08091 100644 GetPluginsCallback callback, const std::vector& all_plugins); - ResourceContext* const resource_context_; - mojo::BindingSet bindings_; - base::TimeTicks last_plugin_refresh_time_; -+ int render_process_id_ = -1; - base::WeakPtrFactory weak_factory_{this}; - }; - diff --git content/common/frame_messages.h content/common/frame_messages.h -index 60077e7ec11a..1e703ba07b4d 100644 +index 318e199de304..2baed51cc931 100644 --- content/common/frame_messages.h +++ content/common/frame_messages.h -@@ -1228,9 +1228,10 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback, +@@ -1146,9 +1146,10 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback, // type. If there is no matching plugin, |found| is false. // |actual_mime_type| is the actual mime type supported by the // found plugin. @@ -279,16 +245,16 @@ index 60077e7ec11a..1e703ba07b4d 100644 std::string /* mime_type */, bool /* found */, diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h -index a14b357dca01..780861333a4b 100644 +index dcb77c781146..50d54464e790 100644 --- content/public/browser/content_browser_client.h +++ content/public/browser/content_browser_client.h -@@ -1492,6 +1492,15 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1512,6 +1512,15 @@ class CONTENT_EXPORT ContentBrowserClient { bool has_user_gesture, network::mojom::URLLoaderFactoryPtr* out_factory); + // Same as above, but exposing the whole ResourceRequest object. + virtual bool HandleExternalProtocol( -+ ResourceRequestInfo::WebContentsGetter web_contents_getter, ++ WebContents::Getter web_contents_getter, + int frame_tree_node_id, + NavigationUIData* navigation_data, + const network::ResourceRequest& request, @@ -298,7 +264,7 @@ index a14b357dca01..780861333a4b 100644 // Creates an OverlayWindow to be used for Picture-in-Picture. This window // will house the content shown when in Picture-in-Picture mode. This will // return a new OverlayWindow. -@@ -1562,6 +1571,10 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1579,6 +1588,10 @@ class CONTENT_EXPORT ContentBrowserClient { // Used as part of the user agent string. virtual std::string GetProduct(); @@ -310,34 +276,34 @@ index a14b357dca01..780861333a4b 100644 virtual std::string GetUserAgent(); diff --git content/public/browser/plugin_service.h content/public/browser/plugin_service.h -index 7646bdad2061..887ac022f2a1 100644 +index dcfd3ff37186..4e822ee5f750 100644 --- content/public/browser/plugin_service.h +++ content/public/browser/plugin_service.h -@@ -75,6 +75,7 @@ class CONTENT_EXPORT PluginService { +@@ -74,6 +74,7 @@ class CONTENT_EXPORT PluginService { + virtual bool GetPluginInfo(int render_process_id, int render_frame_id, - ResourceContext* context, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, const std::string& mime_type, bool allow_wildcard, diff --git content/public/browser/plugin_service_filter.h content/public/browser/plugin_service_filter.h -index 3b610b1f554e..7c439e060779 100644 +index 98c59005599e..69752184745d 100644 --- content/public/browser/plugin_service_filter.h +++ content/public/browser/plugin_service_filter.h -@@ -33,6 +33,7 @@ class PluginServiceFilter { +@@ -32,6 +32,7 @@ class PluginServiceFilter { + virtual bool IsPluginAvailable(int render_process_id, int render_frame_id, - const void* context, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, WebPluginInfo* plugin) = 0; diff --git content/public/renderer/content_renderer_client.h content/public/renderer/content_renderer_client.h -index bfc62d176668..b9f695eaad5a 100644 +index 7d53414dfbe7..fdbe566ee2bb 100644 --- content/public/renderer/content_renderer_client.h +++ content/public/renderer/content_renderer_client.h -@@ -74,6 +74,9 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -72,6 +72,9 @@ class CONTENT_EXPORT ContentRendererClient { // Notifies us that the RenderThread has been created. virtual void RenderThreadStarted() {} @@ -347,7 +313,7 @@ index bfc62d176668..b9f695eaad5a 100644 // Notifies that a new RenderFrame has been created. virtual void RenderFrameCreated(RenderFrame* render_frame) {} -@@ -326,6 +329,10 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -318,6 +321,10 @@ class CONTENT_EXPORT ContentRendererClient { // This method may invalidate the frame. virtual void RunScriptsAtDocumentIdle(RenderFrame* render_frame) {} @@ -359,10 +325,10 @@ index bfc62d176668..b9f695eaad5a 100644 // started. virtual void SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() {} diff --git content/public/renderer/render_frame_observer.h content/public/renderer/render_frame_observer.h -index 0e2e86e6a2af..b44e90f69263 100644 +index 1f4868132226..96a0fbfd8188 100644 --- content/public/renderer/render_frame_observer.h +++ content/public/renderer/render_frame_observer.h -@@ -214,6 +214,9 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, +@@ -216,6 +216,9 @@ class CONTENT_EXPORT RenderFrameObserver : public IPC::Listener, virtual void DidReceiveTransferSizeUpdate(int resource_id, int received_data_length) {} @@ -373,10 +339,10 @@ index 0e2e86e6a2af..b44e90f69263 100644 virtual void FocusedElementChanged(const blink::WebElement& element) {} diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc -index e2a9d4a370f3..2919772fef77 100644 +index f8f8209786ff..c181986c246a 100644 --- content/renderer/render_frame_impl.cc +++ content/renderer/render_frame_impl.cc -@@ -4095,7 +4095,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin( +@@ -4166,7 +4166,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin( std::string mime_type; bool found = false; Send(new FrameHostMsg_GetPluginInfo( @@ -386,20 +352,20 @@ index e2a9d4a370f3..2919772fef77 100644 params.mime_type.Utf8(), &found, &info, &mime_type)); if (!found) return nullptr; -@@ -4510,6 +4511,8 @@ void RenderFrameImpl::FrameDetached(DetachType type) { +@@ -4586,6 +4587,8 @@ void RenderFrameImpl::FrameDetached(DetachType type) { void RenderFrameImpl::FrameFocused() { - Send(new FrameHostMsg_FrameFocused(routing_id_)); + GetFrameHost()->FrameFocused(); + for (auto& observer : observers_) + observer.FrameFocused(); } void RenderFrameImpl::DidChangeName(const blink::WebString& name) { diff --git content/renderer/render_thread_impl.cc content/renderer/render_thread_impl.cc -index f2d4f932341e..409eabcdabc3 100644 +index f133e1651a27..1785e961f089 100644 --- content/renderer/render_thread_impl.cc +++ content/renderer/render_thread_impl.cc -@@ -786,6 +786,8 @@ void RenderThreadImpl::Init() { +@@ -790,6 +790,8 @@ void RenderThreadImpl::Init() { StartServiceManagerConnection(); @@ -409,10 +375,10 @@ index f2d4f932341e..409eabcdabc3 100644 &RenderThreadImpl::OnRendererInterfaceRequest, base::Unretained(this))); diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc -index a89a61d35a4b..5d8369cc2eda 100644 +index 6a81c4a2a94e..2c52d6085df9 100644 --- content/renderer/renderer_blink_platform_impl.cc +++ content/renderer/renderer_blink_platform_impl.cc -@@ -949,6 +949,15 @@ RendererBlinkPlatformImpl::GetGpuFactories() { +@@ -959,6 +959,15 @@ RendererBlinkPlatformImpl::GetGpuFactories() { //------------------------------------------------------------------------------ @@ -427,12 +393,12 @@ index a89a61d35a4b..5d8369cc2eda 100644 + blink::mojom::CodeCacheHost& RendererBlinkPlatformImpl::GetCodeCacheHost() { if (!code_cache_host_) { - code_cache_host_ = blink::mojom::ThreadSafeCodeCacheHostPtr::Create( + code_cache_host_ = mojo::SharedRemote( diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h -index f1bc21b53606..0706ff050349 100644 +index 0db3cf9498a1..a13458688a08 100644 --- content/renderer/renderer_blink_platform_impl.h +++ content/renderer/renderer_blink_platform_impl.h -@@ -211,6 +211,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -205,6 +205,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { media::GpuVideoAcceleratorFactories* GetGpuFactories() override; @@ -443,48 +409,48 @@ index f1bc21b53606..0706ff050349 100644 // It is invalid to call this in an incomplete env where // RenderThreadImpl::current() returns nullptr (e.g. in some tests). diff --git content/shell/browser/shell_plugin_service_filter.cc content/shell/browser/shell_plugin_service_filter.cc -index 3a48c59b7e3e..d10ef64adbba 100644 +index 427132c6920e..4809ddaf21e1 100644 --- content/shell/browser/shell_plugin_service_filter.cc +++ content/shell/browser/shell_plugin_service_filter.cc -@@ -18,6 +18,7 @@ bool ShellPluginServiceFilter::IsPluginAvailable( +@@ -17,6 +17,7 @@ bool ShellPluginServiceFilter::IsPluginAvailable( + int render_process_id, int render_frame_id, - const void* context, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, WebPluginInfo* plugin) { return plugin->name == base::ASCIIToUTF16("Blink Test Plugin") || diff --git content/shell/browser/shell_plugin_service_filter.h content/shell/browser/shell_plugin_service_filter.h -index 7767a620a9fd..8a95377f5f3b 100644 +index 337b4b0653fe..107ab4c9d8a8 100644 --- content/shell/browser/shell_plugin_service_filter.h +++ content/shell/browser/shell_plugin_service_filter.h -@@ -21,6 +21,7 @@ class ShellPluginServiceFilter : public PluginServiceFilter { +@@ -20,6 +20,7 @@ class ShellPluginServiceFilter : public PluginServiceFilter { + bool IsPluginAvailable(int render_process_id, int render_frame_id, - const void* context, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, WebPluginInfo* plugin) override; diff --git content/test/fake_plugin_service.cc content/test/fake_plugin_service.cc -index 6500af1d859f..0d078a4a4281 100644 +index eb280cd21c6d..b499b2536b2d 100644 --- content/test/fake_plugin_service.cc +++ content/test/fake_plugin_service.cc -@@ -29,6 +29,7 @@ bool FakePluginService::GetPluginInfo(int render_process_id, +@@ -28,6 +28,7 @@ bool FakePluginService::GetPluginInfoArray( + bool FakePluginService::GetPluginInfo(int render_process_id, int render_frame_id, - ResourceContext* context, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, const std::string& mime_type, bool allow_wildcard, diff --git content/test/fake_plugin_service.h content/test/fake_plugin_service.h -index 205dfc39dfa7..ec250828b0ba 100644 +index df49da7cbec0..edf526fff7f8 100644 --- content/test/fake_plugin_service.h +++ content/test/fake_plugin_service.h -@@ -30,6 +30,7 @@ class FakePluginService : public PluginService { +@@ -29,6 +29,7 @@ class FakePluginService : public PluginService { + bool GetPluginInfo(int render_process_id, int render_frame_id, - ResourceContext* context, const GURL& url, + bool is_main_frame, const url::Origin& main_frame_origin, diff --git a/patch/patches/content_pepper_flash_1586.patch b/patch/patches/content_pepper_flash_1586.patch index b82117887..5d5e29b63 100644 --- a/patch/patches/content_pepper_flash_1586.patch +++ b/patch/patches/content_pepper_flash_1586.patch @@ -1,5 +1,5 @@ diff --git content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc -index 3619dfae8c83..7efdf571dec8 100644 +index 6c40589cc989..a34b0eb0eb15 100644 --- content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc +++ content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc @@ -55,7 +55,7 @@ PepperFlashFileMessageFilter::PepperFlashFileMessageFilter( diff --git a/patch/patches/crashpad_1995.patch b/patch/patches/crashpad_1995.patch index aaad13e1e..a49eeed23 100644 --- a/patch/patches/crashpad_1995.patch +++ b/patch/patches/crashpad_1995.patch @@ -1,5 +1,5 @@ diff --git chrome/chrome_elf/BUILD.gn chrome/chrome_elf/BUILD.gn -index 9c59c4b5e7a6..e470635e88d2 100644 +index 99ef45605fb5..2e16fc44a242 100644 --- chrome/chrome_elf/BUILD.gn +++ chrome/chrome_elf/BUILD.gn @@ -7,6 +7,7 @@ @@ -10,7 +10,7 @@ index 9c59c4b5e7a6..e470635e88d2 100644 import("//chrome/process_version_rc_template.gni") import("//testing/test.gni") -@@ -132,9 +133,6 @@ source_set("constants") { +@@ -110,9 +111,6 @@ source_set("constants") { static_library("crash") { sources = [ @@ -20,7 +20,7 @@ index 9c59c4b5e7a6..e470635e88d2 100644 "crash/crash_helper.cc", "crash/crash_helper.h", ] -@@ -142,6 +140,7 @@ static_library("crash") { +@@ -120,6 +118,7 @@ static_library("crash") { ":hook_util", "//base", # This needs to go. DEP of app, crash_keys, client. "//base:base_static", # pe_image @@ -28,7 +28,7 @@ index 9c59c4b5e7a6..e470635e88d2 100644 "//chrome/install_static:install_static_util", "//components/crash/content/app", "//components/crash/core/common", # crash_keys -@@ -149,6 +148,17 @@ static_library("crash") { +@@ -127,6 +126,17 @@ static_library("crash") { "//content/public/common:result_codes", "//third_party/crashpad/crashpad/client", # DumpWithoutCrash ] @@ -127,7 +127,7 @@ index bcf172e645a2..f879aa745adf 100644 // on the given |command_line|. void SetCrashKeysFromCommandLine(const base::CommandLine& command_line); diff --git components/crash/content/app/breakpad_linux.cc components/crash/content/app/breakpad_linux.cc -index bb5ee46d3f2b..639958e189ad 100644 +index 505156ada2d8..34ad815d20c6 100644 --- components/crash/content/app/breakpad_linux.cc +++ components/crash/content/app/breakpad_linux.cc @@ -28,6 +28,7 @@ @@ -138,7 +138,7 @@ index bb5ee46d3f2b..639958e189ad 100644 #include "base/files/file_path.h" #include "base/lazy_instance.h" #include "base/linux_util.h" -@@ -101,6 +102,7 @@ namespace { +@@ -104,6 +105,7 @@ namespace { uint64_t g_crash_loop_before_time = 0; #else const char kUploadURL[] = "https://clients2.google.com/cr/report"; @@ -146,7 +146,7 @@ index bb5ee46d3f2b..639958e189ad 100644 #endif bool g_is_crash_reporter_enabled = false; -@@ -714,7 +716,7 @@ bool CrashDone(const MinidumpDescriptor& minidump, +@@ -717,7 +719,7 @@ bool CrashDone(const MinidumpDescriptor& minidump, info.process_type_length = 7; info.distro = base::g_linux_distro; info.distro_length = my_strlen(base::g_linux_distro); @@ -155,7 +155,7 @@ index bb5ee46d3f2b..639958e189ad 100644 info.process_start_time = g_process_start_time; info.oom_size = base::g_oom_size; info.pid = g_pid; -@@ -1400,7 +1402,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info, +@@ -1404,7 +1406,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info, header_content_encoding, header_content_type, post_file, @@ -164,7 +164,7 @@ index bb5ee46d3f2b..639958e189ad 100644 "--timeout=10", // Set a timeout so we don't hang forever. "--tries=1", // Don't retry if the upload fails. "-O", // Output reply to the file descriptor path. -@@ -1740,10 +1742,19 @@ void HandleCrashDump(const BreakpadInfo& info) { +@@ -1744,10 +1746,19 @@ void HandleCrashDump(const BreakpadInfo& info) { GetCrashReporterClient()->GetProductNameAndVersion(&product_name, &version); writer.AddBoundary(); @@ -186,7 +186,7 @@ index bb5ee46d3f2b..639958e189ad 100644 if (info.pid > 0) { char pid_value_buf[kUint64StringSize]; uint64_t pid_value_len = my_uint64_len(info.pid); -@@ -1860,10 +1871,20 @@ void HandleCrashDump(const BreakpadInfo& info) { +@@ -1864,10 +1875,20 @@ void HandleCrashDump(const BreakpadInfo& info) { crash_reporter::internal::TransitionalCrashKeyStorage; CrashKeyStorage::Iterator crash_key_iterator(*info.crash_keys); const CrashKeyStorage::Entry* entry; @@ -208,7 +208,7 @@ index bb5ee46d3f2b..639958e189ad 100644 writer.AddBoundary(); writer.Flush(); } -@@ -2075,6 +2096,17 @@ void SetChannelCrashKey(const std::string& channel) { +@@ -2079,6 +2100,17 @@ void SetChannelCrashKey(const std::string& channel) { channel_key.Set(channel); } @@ -227,7 +227,7 @@ index bb5ee46d3f2b..639958e189ad 100644 void InitNonBrowserCrashReporterForAndroid(const std::string& process_type) { SanitizationInfo sanitization_info; diff --git components/crash/content/app/breakpad_linux.h components/crash/content/app/breakpad_linux.h -index fb7f0a8af261..0d25d227fb8a 100644 +index 6e95af6ca7f5..061fb189d60f 100644 --- components/crash/content/app/breakpad_linux.h +++ components/crash/content/app/breakpad_linux.h @@ -20,6 +20,9 @@ extern void InitCrashReporter(const std::string& process_type); @@ -402,10 +402,10 @@ index 5eba3742684b..9bc66b0dbfb9 100644 ->set_system_crash_reporter_forwarding(crashpad::TriState::kDisabled); } diff --git components/crash/content/app/crashpad_mac.mm components/crash/content/app/crashpad_mac.mm -index a76d264648d2..ff9a19e259fb 100644 +index c2de9fe867c5..29cda67a1f72 100644 --- components/crash/content/app/crashpad_mac.mm +++ components/crash/content/app/crashpad_mac.mm -@@ -16,11 +16,14 @@ +@@ -16,12 +16,15 @@ #include "base/logging.h" #include "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h" @@ -414,13 +414,14 @@ index a76d264648d2..ff9a19e259fb 100644 #include "base/strings/string_piece.h" #include "base/strings/stringprintf.h" #include "base/strings/sys_string_conversions.h" + #include "build/branding_buildflags.h" #include "components/crash/content/app/crash_reporter_client.h" +#include "components/crash/content/app/crash_switches.h" +#include "content/public/common/content_paths.h" #include "third_party/crashpad/crashpad/client/crash_report_database.h" #include "third_party/crashpad/crashpad/client/crashpad_client.h" #include "third_party/crashpad/crashpad/client/crashpad_info.h" -@@ -36,12 +39,25 @@ namespace { +@@ -37,12 +40,25 @@ namespace { std::map GetProcessSimpleAnnotations() { static std::map annotations = []() -> auto { std::map process_annotations; @@ -448,9 +449,9 @@ index a76d264648d2..ff9a19e259fb 100644 + process_annotations["product"] = product_name; + } - #if defined(GOOGLE_CHROME_BUILD) + #if BUILDFLAG(GOOGLE_CHROME_BRANDING) // Empty means stable. -@@ -57,12 +73,16 @@ std::map GetProcessSimpleAnnotations() { +@@ -58,12 +74,16 @@ std::map GetProcessSimpleAnnotations() { process_annotations["channel"] = ""; } @@ -472,7 +473,7 @@ index a76d264648d2..ff9a19e259fb 100644 } // @autoreleasepool return process_annotations; }(); -@@ -122,10 +142,10 @@ base::FilePath PlatformCrashpadInitialization( +@@ -123,10 +143,10 @@ base::FilePath PlatformCrashpadInitialization( if (initial_client) { @autoreleasepool { @@ -487,7 +488,7 @@ index a76d264648d2..ff9a19e259fb 100644 // Is there a way to recover if this fails? CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); -@@ -137,7 +157,7 @@ base::FilePath PlatformCrashpadInitialization( +@@ -138,7 +158,7 @@ base::FilePath PlatformCrashpadInitialization( // crash server won't have symbols for any other build types. std::string url = "https://clients2.google.com/cr/report"; #else @@ -496,7 +497,7 @@ index a76d264648d2..ff9a19e259fb 100644 #endif std::vector arguments; -@@ -160,6 +180,12 @@ base::FilePath PlatformCrashpadInitialization( +@@ -161,6 +181,12 @@ base::FilePath PlatformCrashpadInitialization( "--reset-own-crash-exception-port-to-system-default"); } @@ -510,10 +511,10 @@ index a76d264648d2..ff9a19e259fb 100644 handler_path, database_path, metrics_path, url, GetProcessSimpleAnnotations(), arguments, true, false); diff --git components/crash/content/app/crashpad_win.cc components/crash/content/app/crashpad_win.cc -index 8f55759a6f4a..5d60fc3f84eb 100644 +index d13ae5cf7e40..f87f84d3121c 100644 --- components/crash/content/app/crashpad_win.cc +++ components/crash/content/app/crashpad_win.cc -@@ -35,8 +35,8 @@ void GetPlatformCrashpadAnnotations( +@@ -36,8 +36,8 @@ void GetPlatformCrashpadAnnotations( base::string16 product_name, version, special_build, channel_name; crash_reporter_client->GetProductNameAndVersion( exe_file, &product_name, &version, &special_build, &channel_name); @@ -521,10 +522,10 @@ index 8f55759a6f4a..5d60fc3f84eb 100644 - (*annotations)["ver"] = base::UTF16ToUTF8(version); + (*annotations)["product"] = base::UTF16ToUTF8(product_name); + (*annotations)["version"] = base::UTF16ToUTF8(version); - #if defined(GOOGLE_CHROME_BUILD) + #if BUILDFLAG(GOOGLE_CHROME_BRANDING) // Empty means stable. const bool allow_empty_channel = true; -@@ -48,9 +48,9 @@ void GetPlatformCrashpadAnnotations( +@@ -49,9 +49,9 @@ void GetPlatformCrashpadAnnotations( if (!special_build.empty()) (*annotations)["special"] = base::UTF16ToUTF8(special_build); #if defined(ARCH_CPU_X86) @@ -536,7 +537,7 @@ index 8f55759a6f4a..5d60fc3f84eb 100644 #endif } -@@ -65,7 +65,9 @@ base::FilePath PlatformCrashpadInitialization( +@@ -66,7 +66,9 @@ base::FilePath PlatformCrashpadInitialization( base::FilePath metrics_path; // Only valid in the browser process. const char kPipeNameVar[] = "CHROME_CRASHPAD_PIPE_NAME"; @@ -546,9 +547,9 @@ index 8f55759a6f4a..5d60fc3f84eb 100644 std::unique_ptr env(base::Environment::Create()); if (initial_client) { CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); -@@ -85,13 +87,13 @@ base::FilePath PlatformCrashpadInitialization( +@@ -86,13 +88,13 @@ base::FilePath PlatformCrashpadInitialization( - #if defined(GOOGLE_CHROME_BUILD) + #if BUILDFLAG(GOOGLE_CHROME_BRANDING) std::string url = "https://clients2.google.com/cr/report"; -#else - std::string url; @@ -563,7 +564,7 @@ index 8f55759a6f4a..5d60fc3f84eb 100644 base::FilePath exe_file(exe_path); if (exe_file.empty()) { -@@ -109,13 +111,14 @@ base::FilePath PlatformCrashpadInitialization( +@@ -110,13 +112,14 @@ base::FilePath PlatformCrashpadInitialization( crashpad::TriState::kEnabled, kIndirectMemoryLimit); } @@ -583,7 +584,7 @@ index 8f55759a6f4a..5d60fc3f84eb 100644 if (!user_data_dir.empty()) { start_arguments.push_back(std::string("--user-data-dir=") + user_data_dir); -@@ -126,9 +129,12 @@ base::FilePath PlatformCrashpadInitialization( +@@ -127,9 +130,12 @@ base::FilePath PlatformCrashpadInitialization( start_arguments.push_back("/prefetch:7"); } else { base::FilePath exe_dir = exe_file.DirName(); diff --git a/patch/patches/crashpad_tp_1995.patch b/patch/patches/crashpad_tp_1995.patch index 5b5f84916..010d43528 100644 --- a/patch/patches/crashpad_tp_1995.patch +++ b/patch/patches/crashpad_tp_1995.patch @@ -146,7 +146,7 @@ index a2b0c74636f4..01370fdc20d9 100644 struct Data; diff --git third_party/crashpad/crashpad/handler/BUILD.gn third_party/crashpad/crashpad/handler/BUILD.gn -index b841b0ccd3a2..94ff9177d842 100644 +index 550f686a4562..b6cc04846d42 100644 --- third_party/crashpad/crashpad/handler/BUILD.gn +++ third_party/crashpad/crashpad/handler/BUILD.gn @@ -12,6 +12,7 @@ @@ -157,7 +157,7 @@ index b841b0ccd3a2..94ff9177d842 100644 import("../build/crashpad_buildconfig.gni") static_library("handler") { -@@ -65,6 +66,17 @@ static_library("handler") { +@@ -74,6 +75,17 @@ static_library("handler") { ] } @@ -175,7 +175,7 @@ index b841b0ccd3a2..94ff9177d842 100644 public_configs = [ "..:crashpad_config" ] public_deps = [ -@@ -77,6 +89,7 @@ static_library("handler") { +@@ -86,6 +98,7 @@ static_library("handler") { "../minidump", "../snapshot", "../tools:tool_support", @@ -248,7 +248,7 @@ index 2ec1147d2620..8ff9a72e0bd7 100644 //! \brief Calls ProcessPendingReports() in response to ReportPending() having //! been called on any thread, as well as periodically on a timer. diff --git third_party/crashpad/crashpad/handler/handler_main.cc third_party/crashpad/crashpad/handler/handler_main.cc -index 05a2e7b44e41..6e72c17a57e6 100644 +index 7b69e8481ffa..2cee1da0dc4b 100644 --- third_party/crashpad/crashpad/handler/handler_main.cc +++ third_party/crashpad/crashpad/handler/handler_main.cc @@ -36,8 +36,10 @@ @@ -262,7 +262,7 @@ index 05a2e7b44e41..6e72c17a57e6 100644 #include "client/crash_report_database.h" #include "client/crashpad_client.h" #include "client/crashpad_info.h" -@@ -96,6 +98,10 @@ +@@ -100,6 +102,10 @@ #include "handler/linux/exception_handler_server.h" #endif // OS_MACOSX @@ -273,28 +273,28 @@ index 05a2e7b44e41..6e72c17a57e6 100644 namespace crashpad { namespace { -@@ -188,6 +194,9 @@ struct Options { +@@ -195,6 +201,9 @@ struct Options { bool periodic_tasks; bool rate_limit; bool upload_gzip; + int max_uploads; + int max_database_size; + int max_database_age; - }; - - // Splits |key_value| on '=' and inserts the resulting key and value into |map|. -@@ -553,6 +562,9 @@ int HandlerMain(int argc, + #if defined(OS_CHROMEOS) + bool use_cros_crash_reporter; + #endif // OS_CHROMEOS +@@ -569,6 +578,9 @@ int HandlerMain(int argc, kOptionTraceParentWithException, #endif kOptionURL, + kOptionMaxUploads, + kOptionMaxDatabaseSize, + kOptionMaxDatabaseAge, - - // Standard options. - kOptionHelp = -2, -@@ -620,6 +632,9 @@ int HandlerMain(int argc, - {"url", required_argument, nullptr, kOptionURL}, + #if defined(OS_CHROMEOS) + kOptionUseCrosCrashReporter, + #endif // OS_CHROMEOS +@@ -645,6 +657,9 @@ int HandlerMain(int argc, + #endif // OS_CHROMEOS {"help", no_argument, nullptr, kOptionHelp}, {"version", no_argument, nullptr, kOptionVersion}, + {"max-uploads", required_argument, nullptr, kOptionMaxUploads}, @@ -303,7 +303,7 @@ index 05a2e7b44e41..6e72c17a57e6 100644 {nullptr, 0, nullptr, 0}, }; -@@ -759,6 +774,27 @@ int HandlerMain(int argc, +@@ -784,6 +799,27 @@ int HandlerMain(int argc, options.url = optarg; break; } @@ -328,10 +328,10 @@ index 05a2e7b44e41..6e72c17a57e6 100644 + } + break; + } - case kOptionHelp: { - Usage(me); - MetricsRecordExit(Metrics::LifetimeMilestone::kExitedEarly); -@@ -879,8 +915,14 @@ int HandlerMain(int argc, + #if defined(OS_CHROMEOS) + case kOptionUseCrosCrashReporter: { + options.use_cros_crash_reporter = true; +@@ -910,8 +946,14 @@ int HandlerMain(int argc, upload_thread_options.upload_gzip = options.upload_gzip; upload_thread_options.watch_pending_reports = options.periodic_tasks; @@ -346,7 +346,7 @@ index 05a2e7b44e41..6e72c17a57e6 100644 upload_thread.Get()->Start(); } -@@ -908,7 +950,8 @@ int HandlerMain(int argc, +@@ -961,7 +1003,8 @@ int HandlerMain(int argc, ScopedStoppable prune_thread; if (options.periodic_tasks) { prune_thread.Reset(new PruneCrashReportThread( diff --git a/patch/patches/extensions_1947.patch b/patch/patches/extensions_1947.patch index 0a7feda07..36b69e315 100644 --- a/patch/patches/extensions_1947.patch +++ b/patch/patches/extensions_1947.patch @@ -132,7 +132,7 @@ index c0f80fd848d6..75b0e53ae68e 100644 // A weak pointer to the current or pending RenderViewHost. We don't access // this through the host_contents because we want to deal with the pending diff --git extensions/browser/extensions_browser_client.h extensions/browser/extensions_browser_client.h -index 2f4890b54897..84164c1170a3 100644 +index ed47ee5227ac..6b9e93784eaf 100644 --- extensions/browser/extensions_browser_client.h +++ extensions/browser/extensions_browser_client.h @@ -54,6 +54,7 @@ class ComponentExtensionResourceManager; @@ -141,9 +141,9 @@ index 2f4890b54897..84164c1170a3 100644 class ExtensionError; +class ExtensionHost; class ExtensionHostDelegate; - class ExtensionApiFrameIdMap; - class ExtensionApiFrameIdMapHelper; -@@ -195,6 +196,14 @@ class ExtensionsBrowserClient { + class ExtensionSet; + class ExtensionSystem; +@@ -193,6 +194,14 @@ class ExtensionsBrowserClient { virtual std::unique_ptr CreateExtensionHostDelegate() = 0; @@ -159,10 +159,10 @@ index 2f4890b54897..84164c1170a3 100644 // once each time the extensions system is loaded per browser_context. The // implementation may wish to use the BrowserContext to record the current diff --git extensions/browser/process_manager.cc extensions/browser/process_manager.cc -index e0f053ce45bd..3bf13bc0ad03 100644 +index 55dcd62be9fc..c19fa68da048 100644 --- extensions/browser/process_manager.cc +++ extensions/browser/process_manager.cc -@@ -382,9 +382,16 @@ bool ProcessManager::CreateBackgroundHost(const Extension* extension, +@@ -380,9 +380,16 @@ bool ProcessManager::CreateBackgroundHost(const Extension* extension, return true; // TODO(kalman): return false here? It might break things... DVLOG(1) << "CreateBackgroundHost " << extension->id(); diff --git a/patch/patches/gn_config.patch b/patch/patches/gn_config.patch index db49a8bae..45eda4fce 100644 --- a/patch/patches/gn_config.patch +++ b/patch/patches/gn_config.patch @@ -1,8 +1,8 @@ diff --git .gn .gn -index 70856f65e720..649c347a899b 100644 +index b66e15317bb2..79f09da67517 100644 --- .gn +++ .gn -@@ -670,6 +670,8 @@ exec_script_whitelist = +@@ -667,6 +667,8 @@ exec_script_whitelist = "//chrome/android/webapk/shell_apk/prepare_upload_dir/BUILD.gn", @@ -12,10 +12,10 @@ index 70856f65e720..649c347a899b 100644 # https://crbug.com/474506. "//clank/java/BUILD.gn", diff --git BUILD.gn BUILD.gn -index 19fd588dfed1..30d3a9774eb3 100644 +index 5e2f6b9b0f41..8ce1c0d77f76 100644 --- BUILD.gn +++ BUILD.gn -@@ -204,6 +204,7 @@ group("gn_all") { +@@ -209,6 +209,7 @@ group("gn_all") { if (!is_ios && !is_fuchsia) { deps += [ @@ -100,7 +100,7 @@ index ef8aeda56458..5b7f057311b9 100644 diff --git build/vs_toolchain.py build/vs_toolchain.py -index 97f503bff408..fe1f0344dd77 100755 +index 3f2506128643..bf3a34778458 100755 --- build/vs_toolchain.py +++ build/vs_toolchain.py @@ -81,11 +81,18 @@ def SetEnvironmentAndGetRuntimeDllDirs(): @@ -123,10 +123,10 @@ index 97f503bff408..fe1f0344dd77 100755 # directory in order to run binaries locally, but they are needed in order # to create isolates or the mini_installer. Copying them to the output diff --git chrome/chrome_paks.gni chrome/chrome_paks.gni -index 93af4dcd03bb..e1a8543a5f14 100644 +index 5b58ed59878e..2e45266d21db 100644 --- chrome/chrome_paks.gni +++ chrome/chrome_paks.gni -@@ -271,7 +271,7 @@ template("chrome_paks") { +@@ -277,7 +277,7 @@ template("chrome_paks") { } input_locales = locales @@ -136,10 +136,10 @@ index 93af4dcd03bb..e1a8543a5f14 100644 if (is_mac) { output_locales = locales_as_mac_outputs diff --git chrome/installer/mini_installer/BUILD.gn chrome/installer/mini_installer/BUILD.gn -index 7a779fc3ce1a..2ba4d85fa276 100644 +index cc2bfe0642d1..688ae4d8be2c 100644 --- chrome/installer/mini_installer/BUILD.gn +++ chrome/installer/mini_installer/BUILD.gn -@@ -133,7 +133,7 @@ template("generate_mini_installer") { +@@ -138,7 +138,7 @@ template("generate_mini_installer") { inputs = [ "$chrome_dll_file", "$root_out_dir/chrome.exe", diff --git a/patch/patches/gritsettings.patch b/patch/patches/gritsettings.patch index f174584df..c8223dd16 100644 --- a/patch/patches/gritsettings.patch +++ b/patch/patches/gritsettings.patch @@ -1,8 +1,8 @@ diff --git tools/gritsettings/resource_ids tools/gritsettings/resource_ids -index 7ac3cf37b481..0ad6d1b8c31d 100644 +index a4c39b1f6b14..5706254c1ec4 100644 --- tools/gritsettings/resource_ids +++ tools/gritsettings/resource_ids -@@ -466,4 +466,11 @@ +@@ -472,4 +472,11 @@ # Please read the header and find the right section above instead. # Resource ids starting at 31000 are reserved for projects built on Chromium. diff --git a/patch/patches/ime_1610.patch b/patch/patches/ime_1610.patch index f399ac87e..e5e2b4c89 100644 --- a/patch/patches/ime_1610.patch +++ b/patch/patches/ime_1610.patch @@ -1,8 +1,8 @@ diff --git ui/base/ime/win/input_method_win_base.cc ui/base/ime/win/input_method_win_base.cc -index 9d014932e5cd..8fcf988f5897 100644 +index d88e691ee118..e89dade3ff04 100644 --- ui/base/ime/win/input_method_win_base.cc +++ ui/base/ime/win/input_method_win_base.cc -@@ -264,8 +264,9 @@ bool InputMethodWinBase::IsWindowFocused(const TextInputClient* client) const { +@@ -263,8 +263,9 @@ bool InputMethodWinBase::IsWindowFocused(const TextInputClient* client) const { // receiving keyboard input as long as it is an active window. This works well // even when the |attached_window_handle| becomes active but has not received // WM_FOCUS yet. diff --git a/patch/patches/linux_gtk_2014.patch b/patch/patches/linux_gtk_2014.patch index 1ed311970..44171a82c 100644 --- a/patch/patches/linux_gtk_2014.patch +++ b/patch/patches/linux_gtk_2014.patch @@ -39,10 +39,10 @@ index 07f06ac694f5..831fd9f82dbe 100644 void ChromeBrowserMainExtraPartsViewsLinux::ToolkitInitialized() { diff --git chrome/test/BUILD.gn chrome/test/BUILD.gn -index f60af132bcdd..626c0081b78a 100644 +index 9e12dd26146d..4748af4b1cc8 100644 --- chrome/test/BUILD.gn +++ chrome/test/BUILD.gn -@@ -4457,7 +4457,7 @@ test("unit_tests") { +@@ -4545,7 +4545,7 @@ test("unit_tests") { if (use_gio) { configs += [ "//build/linux:gio_config" ] } @@ -51,7 +51,7 @@ index f60af132bcdd..626c0081b78a 100644 deps += [ "//chrome/browser/ui/libgtkui" ] } -@@ -5471,7 +5471,7 @@ if (!is_android) { +@@ -5599,7 +5599,7 @@ if (!is_android) { # suites, it seems like one or another starts timing out too. "../browser/ui/views/keyboard_access_browsertest.cc", ] diff --git a/patch/patches/linux_poll_2466.patch b/patch/patches/linux_poll_2466.patch index 5840b9a0e..3590e8f7c 100644 --- a/patch/patches/linux_poll_2466.patch +++ b/patch/patches/linux_poll_2466.patch @@ -1,5 +1,5 @@ diff --git base/files/file_path_watcher_linux.cc base/files/file_path_watcher_linux.cc -index 4b727c37c4f3..ba97a9e38ae7 100644 +index 51cecad2eb04..004054491187 100644 --- base/files/file_path_watcher_linux.cc +++ base/files/file_path_watcher_linux.cc @@ -5,6 +5,7 @@ diff --git a/patch/patches/message_loop.patch b/patch/patches/message_loop.patch index 6e6bf8761..7d64ecb44 100644 --- a/patch/patches/message_loop.patch +++ b/patch/patches/message_loop.patch @@ -1,31 +1,31 @@ diff --git base/message_loop/message_loop.cc base/message_loop/message_loop.cc -index 90cb3e3fc7dd..903f258f2e1c 100644 +index a8a66308a1c5..65ff368c5a72 100644 --- base/message_loop/message_loop.cc +++ base/message_loop/message_loop.cc -@@ -100,6 +100,9 @@ bool MessageLoop::IsIdleForTesting() { - - //------------------------------------------------------------------------------ +@@ -174,6 +174,9 @@ MessageLoopForUI::MessageLoopForUI(MessagePumpType type) : MessageLoop(type) { + #endif + } +MessageLoopForUI::MessageLoopForUI(std::unique_ptr pump) -+ : MessageLoop(TYPE_UI, std::move(pump)) {} ++ : MessageLoop(MessagePumpType::UI, std::move(pump)) {} + - // static - std::unique_ptr MessageLoop::CreateUnbound(Type type) { - return WrapUnique(new MessageLoop(type, nullptr)); + #if defined(OS_IOS) + void MessageLoopForUI::Attach() { + sequence_manager_->AttachToMessagePump(); diff --git base/message_loop/message_loop.h base/message_loop/message_loop.h -index a1d6acc4e78d..f9518bc96ce4 100644 +index cc760ffab174..131ccbb6520d 100644 --- base/message_loop/message_loop.h +++ base/message_loop/message_loop.h -@@ -229,6 +229,7 @@ class BASE_EXPORT MessageLoop { +@@ -217,6 +217,7 @@ class BASE_EXPORT MessageLoop { class BASE_EXPORT MessageLoopForUI : public MessageLoop { public: - explicit MessageLoopForUI(Type type = TYPE_UI); + explicit MessageLoopForUI(MessagePumpType type = MessagePumpType::UI); + explicit MessageLoopForUI(std::unique_ptr pump); #if defined(OS_IOS) // On iOS, the main message loop cannot be Run(). Instead call Attach(), diff --git base/message_loop/message_loop_current.cc base/message_loop/message_loop_current.cc -index 54e2d2b41dbd..cd299c90618b 100644 +index 7688ba3d7b0d..9acaaa0d5c7f 100644 --- base/message_loop/message_loop_current.cc +++ base/message_loop/message_loop_current.cc @@ -47,6 +47,8 @@ void MessageLoopCurrent::AddDestructionObserver( @@ -38,10 +38,10 @@ index 54e2d2b41dbd..cd299c90618b 100644 current_->RemoveDestructionObserver(destruction_observer); } diff --git base/message_loop/message_loop_current.h base/message_loop/message_loop_current.h -index 08a1c5e36735..48c5f8d102d0 100644 +index a3b48b58d367..57f8dc7fe2fa 100644 --- base/message_loop/message_loop_current.h +++ base/message_loop/message_loop_current.h -@@ -124,6 +124,12 @@ class BASE_EXPORT MessageLoopCurrent { +@@ -120,6 +120,12 @@ class BASE_EXPORT MessageLoopCurrent { // posted tasks. void SetAddQueueTimeToTasks(bool enable); @@ -54,8 +54,8 @@ index 08a1c5e36735..48c5f8d102d0 100644 // Enables or disables the recursive task processing. This happens in the case // of recursive message loops. Some unwanted message loops may occur when // using common controls or printer functions. By default, recursive task -@@ -194,6 +200,13 @@ class BASE_EXPORT MessageLoopCurrent { - friend class web::TestWebThreadBundle; +@@ -190,6 +196,13 @@ class BASE_EXPORT MessageLoopCurrent { + friend class web::WebTaskEnvironment; sequence_manager::internal::SequenceManagerImpl* current_; + diff --git a/patch/patches/prefs_content_1161.patch b/patch/patches/prefs_content_1161.patch index aa3cca1c2..05a97a0f7 100644 --- a/patch/patches/prefs_content_1161.patch +++ b/patch/patches/prefs_content_1161.patch @@ -1,8 +1,8 @@ diff --git content/public/common/common_param_traits_macros.h content/public/common/common_param_traits_macros.h -index c0c22fa5429f..f0a6215f3f54 100644 +index dd1363a6b295..b69c7895c0e3 100644 --- content/public/common/common_param_traits_macros.h +++ content/public/common/common_param_traits_macros.h -@@ -191,6 +191,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) +@@ -189,6 +189,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) IPC_STRUCT_TRAITS_MEMBER(main_frame_resizes_are_orientation_changes) IPC_STRUCT_TRAITS_MEMBER(initialize_at_minimum_page_scale) IPC_STRUCT_TRAITS_MEMBER(smart_insert_delete_enabled) @@ -11,10 +11,10 @@ index c0c22fa5429f..f0a6215f3f54 100644 IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop) IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled) diff --git content/public/common/web_preferences.cc content/public/common/web_preferences.cc -index 678bd07c0753..1ae838c3de32 100644 +index 114b0f7d04cd..adce9ab8c3b5 100644 --- content/public/common/web_preferences.cc +++ content/public/common/web_preferences.cc -@@ -169,6 +169,7 @@ WebPreferences::WebPreferences() +@@ -167,6 +167,7 @@ WebPreferences::WebPreferences() caret_browsing_enabled(false), use_solid_color_scrollbars(false), navigate_on_drag_drop(true), @@ -23,10 +23,10 @@ index 678bd07c0753..1ae838c3de32 100644 record_whole_document(false), cookie_enabled(true), diff --git content/public/common/web_preferences.h content/public/common/web_preferences.h -index ca883e52fee0..0bc16d1e8330 100644 +index e47b250f52bd..dfa18577d402 100644 --- content/public/common/web_preferences.h +++ content/public/common/web_preferences.h -@@ -186,6 +186,7 @@ struct CONTENT_EXPORT WebPreferences { +@@ -184,6 +184,7 @@ struct CONTENT_EXPORT WebPreferences { bool caret_browsing_enabled; bool use_solid_color_scrollbars; bool navigate_on_drag_drop; @@ -35,10 +35,10 @@ index ca883e52fee0..0bc16d1e8330 100644 bool record_whole_document; diff --git content/renderer/render_view_impl.cc content/renderer/render_view_impl.cc -index d0ca81590d2b..8f2f30878650 100644 +index f780c653d6e5..4b07220bac8c 100644 --- content/renderer/render_view_impl.cc +++ content/renderer/render_view_impl.cc -@@ -1018,6 +1018,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs, +@@ -998,6 +998,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs, #endif WebRuntimeFeatures::EnableTranslateService(prefs.translate_service_available); diff --git a/patch/patches/print_preview_123.patch b/patch/patches/print_preview_123.patch index fabf0c7b4..6363bef35 100644 --- a/patch/patches/print_preview_123.patch +++ b/patch/patches/print_preview_123.patch @@ -34,18 +34,18 @@ index 323534a720c1..72b232f0ed85 100644 bool DownloadPrefs::IsFromTrustedSource(const download::DownloadItem& item) { diff --git chrome/browser/printing/print_preview_dialog_controller.cc chrome/browser/printing/print_preview_dialog_controller.cc -index d2a3be7590a0..883825bfc996 100644 +index 3dcc3aa7bea2..637661e9d0b9 100644 --- chrome/browser/printing/print_preview_dialog_controller.cc +++ chrome/browser/printing/print_preview_dialog_controller.cc -@@ -15,6 +15,7 @@ - #include "base/path_service.h" +@@ -16,6 +16,7 @@ #include "base/strings/utf_string_conversions.h" + #include "build/branding_buildflags.h" #include "build/build_config.h" +#include "cef/libcef/features/features.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/chrome_extension_web_contents_observer.h" #include "chrome/browser/printing/print_view_manager.h" -@@ -440,8 +441,11 @@ WebContents* PrintPreviewDialogController::CreatePrintPreviewDialog( +@@ -456,8 +457,11 @@ WebContents* PrintPreviewDialogController::CreatePrintPreviewDialog( content::HostZoomMap::Get(preview_dialog->GetSiteInstance()) ->SetZoomLevelForHostAndScheme(print_url.scheme(), print_url.host(), 0); PrintViewManager::CreateForWebContents(preview_dialog); @@ -112,7 +112,7 @@ index 12f77178ea92..470b13bd7879 100644 ConstrainedWebDialogUI::~ConstrainedWebDialogUI() { diff --git chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc -index 6147b07f6dad..a68b5bfaf193 100644 +index 00cf10991ede..8087cb6aab05 100644 --- chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc +++ chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc @@ -143,8 +143,10 @@ PdfPrinterHandler::PdfPrinterHandler(Profile* profile, @@ -141,7 +141,7 @@ index 6147b07f6dad..a68b5bfaf193 100644 DCHECK(!print_callback_); print_callback_ = std::move(callback); -@@ -323,7 +327,11 @@ void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename, +@@ -324,7 +328,11 @@ void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename, // If the directory is empty there is no reason to create it or use the // default location. if (path.empty()) { @@ -153,9 +153,9 @@ index 6147b07f6dad..a68b5bfaf193 100644 return; } -@@ -333,8 +341,14 @@ void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename, - base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, +@@ -335,8 +343,14 @@ void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename, + FROM_HERE, + {base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT}, base::BindOnce(&SelectSaveDirectory, path, default_path), +#if !BUILDFLAG(ENABLE_CEF) base::BindOnce(&PdfPrinterHandler::OnDirectorySelected, @@ -168,7 +168,7 @@ index 6147b07f6dad..a68b5bfaf193 100644 } void PdfPrinterHandler::PostPrintToPdfTask() { -@@ -350,6 +364,7 @@ void PdfPrinterHandler::OnGotUniqueFileName(const base::FilePath& path) { +@@ -353,6 +367,7 @@ void PdfPrinterHandler::OnGotUniqueFileName(const base::FilePath& path) { FileSelected(path, 0, nullptr); } @@ -176,7 +176,7 @@ index 6147b07f6dad..a68b5bfaf193 100644 void PdfPrinterHandler::OnDirectorySelected(const base::FilePath& filename, const base::FilePath& directory) { base::FilePath path = directory.Append(filename); -@@ -374,5 +389,36 @@ void PdfPrinterHandler::OnDirectorySelected(const base::FilePath& filename, +@@ -377,5 +392,36 @@ void PdfPrinterHandler::OnDirectorySelected(const base::FilePath& filename, &file_type_info, 0, base::FilePath::StringType(), platform_util::GetTopLevel(preview_web_contents_->GetNativeView()), NULL); } @@ -262,7 +262,7 @@ index 06f5799efbb9..6119691b2700 100644 Profile* const profile_; StickySettings* const sticky_settings_; diff --git chrome/browser/ui/webui/print_preview/print_preview_handler.cc chrome/browser/ui/webui/print_preview/print_preview_handler.cc -index e3d7c5f14cd5..70d1b47d35c9 100644 +index 0a6c4d4de3aa..a22377a02343 100644 --- chrome/browser/ui/webui/print_preview/print_preview_handler.cc +++ chrome/browser/ui/webui/print_preview/print_preview_handler.cc @@ -26,6 +26,7 @@ @@ -273,7 +273,7 @@ index e3d7c5f14cd5..70d1b47d35c9 100644 #include "chrome/browser/app_mode/app_mode_utils.h" #include "chrome/browser/bad_message.h" #include "chrome/browser/browser_process.h" -@@ -1226,6 +1227,9 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler( +@@ -1253,6 +1254,9 @@ PrinterHandler* PrintPreviewHandler::GetPrinterHandler( } return privet_printer_handler_.get(); } @@ -283,7 +283,7 @@ index e3d7c5f14cd5..70d1b47d35c9 100644 #endif if (printer_type == PrinterType::kPdfPrinter) { if (!pdf_printer_handler_) { -@@ -1308,6 +1312,7 @@ void PrintPreviewHandler::OnPrintResult(const std::string& callback_id, +@@ -1335,6 +1339,7 @@ void PrintPreviewHandler::OnPrintResult(const std::string& callback_id, } void PrintPreviewHandler::RegisterForGaiaCookieChanges() { @@ -291,7 +291,7 @@ index e3d7c5f14cd5..70d1b47d35c9 100644 DCHECK(!identity_manager_); cloud_print_enabled_ = GetPrefs()->GetBoolean(prefs::kCloudPrintSubmitEnabled); -@@ -1323,6 +1328,7 @@ void PrintPreviewHandler::RegisterForGaiaCookieChanges() { +@@ -1350,6 +1355,7 @@ void PrintPreviewHandler::RegisterForGaiaCookieChanges() { identity_manager_ = IdentityManagerFactory::GetForProfile(profile); identity_manager_->AddObserver(this); @@ -300,7 +300,7 @@ index e3d7c5f14cd5..70d1b47d35c9 100644 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { diff --git chrome/browser/ui/webui/print_preview/print_preview_ui.cc chrome/browser/ui/webui/print_preview/print_preview_ui.cc -index 2dfc91469b8e..c6fd71452fb9 100644 +index a855e2f1d974..755f386deebf 100644 --- chrome/browser/ui/webui/print_preview/print_preview_ui.cc +++ chrome/browser/ui/webui/print_preview/print_preview_ui.cc @@ -25,6 +25,7 @@ diff --git a/patch/patches/printing_context_2196.patch b/patch/patches/printing_context_2196.patch index d8590387f..9a48c5e39 100644 --- a/patch/patches/printing_context_2196.patch +++ b/patch/patches/printing_context_2196.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/printing/print_job_worker.cc chrome/browser/printing/print_job_worker.cc -index 63f432b58371..fe664e69427a 100644 +index 13f9d7af3ae7..22d991fc1c14 100644 --- chrome/browser/printing/print_job_worker.cc +++ chrome/browser/printing/print_job_worker.cc @@ -130,6 +130,7 @@ PrintJobWorker::PrintJobWorker(int render_process_id, int render_frame_id) @@ -11,10 +11,10 @@ index 63f432b58371..fe664e69427a 100644 PrintJobWorker::~PrintJobWorker() { diff --git printing/printing_context.h printing/printing_context.h -index 9ccc1a6680bc..c0494a1cc2e2 100644 +index 6a5a7c90ef5b..04c0535046dc 100644 --- printing/printing_context.h +++ printing/printing_context.h -@@ -129,6 +129,13 @@ class PRINTING_EXPORT PrintingContext { +@@ -131,6 +131,13 @@ class PRINTING_EXPORT PrintingContext { int job_id() const { return job_id_; } @@ -28,7 +28,7 @@ index 9ccc1a6680bc..c0494a1cc2e2 100644 protected: explicit PrintingContext(Delegate* delegate); -@@ -153,6 +160,10 @@ class PRINTING_EXPORT PrintingContext { +@@ -155,6 +162,10 @@ class PRINTING_EXPORT PrintingContext { // The job id for the current job. The value is 0 if no jobs are active. int job_id_; diff --git a/patch/patches/render_accessibility_1675917.patch b/patch/patches/render_accessibility_1675917.patch deleted file mode 100644 index 70b03e14a..000000000 --- a/patch/patches/render_accessibility_1675917.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff --git content/renderer/accessibility/render_accessibility_impl.cc content/renderer/accessibility/render_accessibility_impl.cc -index 96ac02ca4dda..8812c390b681 100644 ---- content/renderer/accessibility/render_accessibility_impl.cc -+++ content/renderer/accessibility/render_accessibility_impl.cc -@@ -194,7 +194,6 @@ void RenderAccessibilityImpl::DidCreateNewDocument() { - void RenderAccessibilityImpl::DidCommitProvisionalLoad( - bool is_same_document_navigation, - ui::PageTransition transition) { -- is_initial_load_processed_ = false; - has_injected_stylesheet_ = false; - // Remove the image annotator if the page is loading and it was added for - // the one-shot image annotation (i.e. AXMode for image annotation is not -@@ -642,8 +641,6 @@ void RenderAccessibilityImpl::SendPendingAccessibilityEvents() { - // ids to locations. - for (size_t j = 0; j < update.nodes.size(); ++j) { - ui::AXNodeData& src = update.nodes[j]; -- // TODO(accessibility) What if location hasn't been set yet? -- // Get cached location for this node or create a new entry if none exists. - ui::AXRelativeBounds& dst = locations_[update.nodes[j].id]; - dst = src.relative_bounds; - } -@@ -663,13 +660,11 @@ void RenderAccessibilityImpl::SendPendingAccessibilityEvents() { - ack_token_)); - reset_token_ = 0; - -- if (had_layout_complete_messages && is_initial_load_processed_) -+ if (had_layout_complete_messages) - SendLocationChanges(); - -- if (had_load_complete_messages) { -+ if (had_load_complete_messages) - has_injected_stylesheet_ = false; -- is_initial_load_processed_ = true; -- } - - if (image_annotation_debugging_) - AddImageAnnotationDebuggingAttributes(bundle.updates); -diff --git content/renderer/accessibility/render_accessibility_impl.h content/renderer/accessibility/render_accessibility_impl.h -index e5e6325c1cf6..ebc2db666772 100644 ---- content/renderer/accessibility/render_accessibility_impl.h -+++ content/renderer/accessibility/render_accessibility_impl.h -@@ -238,9 +238,6 @@ class CONTENT_EXPORT RenderAccessibilityImpl - // for debugging. - bool image_annotation_debugging_ = false; - -- // Has all data related to the initial page load been processed. -- bool is_initial_load_processed_ = false; -- - // So we can queue up tasks to be executed later. - base::WeakPtrFactory weak_factory_{this}; - diff --git a/patch/patches/resource_bundle_2512.patch b/patch/patches/resource_bundle_2512.patch index c5f0dc3f4..24b900d9a 100644 --- a/patch/patches/resource_bundle_2512.patch +++ b/patch/patches/resource_bundle_2512.patch @@ -1,8 +1,8 @@ diff --git ui/base/resource/resource_bundle.cc ui/base/resource/resource_bundle.cc -index fa666755d5f3..779ebb5949cf 100644 +index 5b2f19834d43..db733ea25bdc 100644 --- ui/base/resource/resource_bundle.cc +++ ui/base/resource/resource_bundle.cc -@@ -809,6 +809,12 @@ ResourceBundle::ResourceBundle(Delegate* delegate) +@@ -817,6 +817,12 @@ ResourceBundle::ResourceBundle(Delegate* delegate) : delegate_(delegate), locale_resources_data_lock_(new base::Lock), max_scale_factor_(SCALE_FACTOR_100P) { @@ -15,7 +15,7 @@ index fa666755d5f3..779ebb5949cf 100644 mangle_localized_strings_ = base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kMangleLocalizedStrings); } -@@ -818,6 +824,11 @@ ResourceBundle::~ResourceBundle() { +@@ -826,6 +832,11 @@ ResourceBundle::~ResourceBundle() { UnloadLocaleResources(); } @@ -28,7 +28,7 @@ index fa666755d5f3..779ebb5949cf 100644 void ResourceBundle::InitSharedInstance(Delegate* delegate) { DCHECK(g_shared_instance_ == NULL) << "ResourceBundle initialized twice"; diff --git ui/base/resource/resource_bundle.h ui/base/resource/resource_bundle.h -index f5a09173007e..36734b2ed811 100644 +index a342b41335a6..67bbffb9bbda 100644 --- ui/base/resource/resource_bundle.h +++ ui/base/resource/resource_bundle.h @@ -155,6 +155,11 @@ class UI_BASE_EXPORT ResourceBundle { diff --git a/patch/patches/rwh_background_color_1984.patch b/patch/patches/rwh_background_color_1984.patch index d5c3da1cf..5fe4ff1be 100644 --- a/patch/patches/rwh_background_color_1984.patch +++ b/patch/patches/rwh_background_color_1984.patch @@ -1,8 +1,8 @@ diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc -index 7bea1b72e4d0..a0c6c00d48a7 100644 +index 09e58950d351..54bbb72e2a38 100644 --- content/browser/renderer_host/render_widget_host_view_aura.cc +++ content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -696,10 +696,12 @@ gfx::Rect RenderWidgetHostViewAura::GetViewBounds() { +@@ -711,10 +711,12 @@ gfx::Rect RenderWidgetHostViewAura::GetViewBounds() { void RenderWidgetHostViewAura::UpdateBackgroundColor() { DCHECK(GetBackgroundColor()); @@ -19,7 +19,7 @@ index 7bea1b72e4d0..a0c6c00d48a7 100644 } void RenderWidgetHostViewAura::WindowTitleChanged() { -@@ -2024,6 +2026,15 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) { +@@ -2037,6 +2039,15 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) { // Init(), because it needs to have the layer. if (frame_sink_id_.is_valid()) window_->SetEmbedFrameSinkId(frame_sink_id_); diff --git a/patch/patches/service_manager_654986.patch b/patch/patches/service_manager_654986.patch index 7c48733ba..3cb806422 100644 --- a/patch/patches/service_manager_654986.patch +++ b/patch/patches/service_manager_654986.patch @@ -1,8 +1,8 @@ diff --git services/service_manager/embedder/main.cc services/service_manager/embedder/main.cc -index 0d1fa74a3f43..c06c98acffb2 100644 +index 099a76a207a3..25080688384f 100644 --- services/service_manager/embedder/main.cc +++ services/service_manager/embedder/main.cc -@@ -240,22 +240,36 @@ int RunService(MainDelegate* delegate) { +@@ -241,22 +241,36 @@ int RunService(MainDelegate* delegate) { return 0; } @@ -43,7 +43,7 @@ index 0d1fa74a3f43..c06c98acffb2 100644 // A flag to indicate whether Main() has been called before. On Android, we // may re-run Main() without restarting the browser process. This flag -@@ -341,12 +355,7 @@ int Main(const MainParams& params) { +@@ -342,12 +356,7 @@ int Main(const MainParams& params) { MainDelegate::InitializeParams init_params; #if defined(OS_MACOSX) @@ -57,7 +57,7 @@ index 0d1fa74a3f43..c06c98acffb2 100644 InitializeMac(); #endif -@@ -390,18 +399,16 @@ int Main(const MainParams& params) { +@@ -391,18 +400,16 @@ int Main(const MainParams& params) { } } @@ -85,7 +85,7 @@ index 0d1fa74a3f43..c06c98acffb2 100644 switch (process_type) { case ProcessType::kDefault: NOTREACHED(); -@@ -423,6 +430,8 @@ int Main(const MainParams& params) { +@@ -424,6 +431,8 @@ int Main(const MainParams& params) { break; } @@ -94,7 +94,7 @@ index 0d1fa74a3f43..c06c98acffb2 100644 if (tracker) { if (exit_code == 0) { tracker->SetProcessPhaseIfEnabled( -@@ -434,13 +443,38 @@ int Main(const MainParams& params) { +@@ -435,13 +444,38 @@ int Main(const MainParams& params) { } } diff --git a/patch/patches/services_network_2622.patch b/patch/patches/services_network_2622.patch index af55dc1a6..92cd1e6bb 100644 --- a/patch/patches/services_network_2622.patch +++ b/patch/patches/services_network_2622.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/net/profile_network_context_service.cc chrome/browser/net/profile_network_context_service.cc -index 27ebbc3dd176..063ba271c51e 100644 +index 35302d90a73f..73424c925e13 100644 --- chrome/browser/net/profile_network_context_service.cc +++ chrome/browser/net/profile_network_context_service.cc @@ -14,6 +14,7 @@ @@ -10,7 +10,7 @@ index 27ebbc3dd176..063ba271c51e 100644 #include "chrome/browser/browser_process.h" #include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" -@@ -427,16 +428,23 @@ ProfileNetworkContextService::CreateNetworkContextParams( +@@ -463,9 +464,22 @@ ProfileNetworkContextService::CreateNetworkContextParams( network_context_params->cookie_manager_params = CreateCookieManagerParams(profile_, *cookie_settings_); @@ -18,27 +18,34 @@ index 27ebbc3dd176..063ba271c51e 100644 + // Configure on-disk storage for non-OTR profiles. OTR profiles just use // default behavior (in memory storage, default sizes). - PrefService* prefs = profile_->GetPrefs(); if (!in_memory) { ++#if BUILDFLAG(ENABLE_CEF) ++ PrefService* prefs = profile_->GetPrefs(); ++ // Configure the HTTP cache path and size. ++ const base::FilePath& base_cache_path = ++ prefs->GetFilePath(prefs::kDiskCacheDir); ++ DCHECK(!base_cache_path.empty()); ++ network_context_params->http_cache_path = ++ base_cache_path.Append(chrome::kCacheDirname); ++ network_context_params->http_cache_max_size = ++ prefs->GetInteger(prefs::kDiskCacheSize); ++#else + PrefService* local_state = g_browser_process->local_state(); // Configure the HTTP cache path and size. base::FilePath base_cache_path; -+#if BUILDFLAG(ENABLE_CEF) -+ base_cache_path = prefs->GetFilePath(prefs::kDiskCacheDir); -+ DCHECK(!base_cache_path.empty()); -+#else - chrome::GetUserCacheDirectory(path, &base_cache_path); - base::FilePath disk_cache_dir = prefs->GetFilePath(prefs::kDiskCacheDir); - if (!disk_cache_dir.empty()) - base_cache_path = disk_cache_dir.Append(base_cache_path.BaseName()); -+#endif - network_context_params->http_cache_path = +@@ -478,6 +492,7 @@ ProfileNetworkContextService::CreateNetworkContextParams( base_cache_path.Append(chrome::kCacheDirname); network_context_params->http_cache_max_size = + local_state->GetInteger(prefs::kDiskCacheSize); ++#endif + + // Currently this just contains HttpServerProperties, but that will likely + // change. diff --git chrome/browser/profiles/profile.h chrome/browser/profiles/profile.h -index e47a8949199f..c713ada1b206 100644 +index 6a7b2e1c9c99..d119da2910fe 100644 --- chrome/browser/profiles/profile.h +++ chrome/browser/profiles/profile.h -@@ -365,6 +365,11 @@ class Profile : public content::BrowserContext { +@@ -373,6 +373,11 @@ class Profile : public content::BrowserContext { virtual bool ShouldRestoreOldSessionCookies(); virtual bool ShouldPersistSessionCookies(); @@ -51,10 +58,10 @@ index e47a8949199f..c713ada1b206 100644 // itself, if |relative_path| is empty). virtual network::mojom::NetworkContextPtr CreateNetworkContext( diff --git net/cookies/cookie_monster.cc net/cookies/cookie_monster.cc -index 83a309d40b1b..7d93f7891426 100644 +index d522c4d82094..f4979561fdf0 100644 --- net/cookies/cookie_monster.cc +++ net/cookies/cookie_monster.cc -@@ -509,6 +509,25 @@ void CookieMonster::SetCookieableSchemes( +@@ -493,6 +493,25 @@ void CookieMonster::SetCookieableSchemes( MaybeRunCookieCallback(std::move(callback), true); } @@ -81,10 +88,10 @@ index 83a309d40b1b..7d93f7891426 100644 void CookieMonster::SetPersistSessionCookies(bool persist_session_cookies) { DCHECK(thread_checker_.CalledOnValidThread()); diff --git net/cookies/cookie_monster.h net/cookies/cookie_monster.h -index 913737e78194..05ad0e8deffd 100644 +index a0bd017e9c18..87f8ed8989d4 100644 --- net/cookies/cookie_monster.h +++ net/cookies/cookie_monster.h -@@ -180,6 +180,8 @@ class NET_EXPORT CookieMonster : public CookieStore { +@@ -177,6 +177,8 @@ class NET_EXPORT CookieMonster : public CookieStore { CookieChangeDispatcher& GetChangeDispatcher() override; void SetCookieableSchemes(const std::vector& schemes, SetCookieableSchemesCallback callback) override; @@ -94,10 +101,10 @@ index 913737e78194..05ad0e8deffd 100644 // Enables writing session cookies into the cookie database. If this this // method is called, it must be called before first use of the instance diff --git net/cookies/cookie_store.h net/cookies/cookie_store.h -index d6299f543edd..ac8edd449452 100644 +index bcd72c1b56f7..67ff2c0edb32 100644 --- net/cookies/cookie_store.h +++ net/cookies/cookie_store.h -@@ -145,6 +145,11 @@ class NET_EXPORT CookieStore { +@@ -127,6 +127,11 @@ class NET_EXPORT CookieStore { virtual void SetCookieableSchemes(const std::vector& schemes, SetCookieableSchemesCallback callback) = 0; @@ -110,10 +117,10 @@ index d6299f543edd..ac8edd449452 100644 virtual void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd, const std::string& parent_absolute_name) const; diff --git services/network/cookie_manager.cc services/network/cookie_manager.cc -index a73b9f31cf17..4e0d4b4b4746 100644 +index c0f105aec142..6afd5f9e25fc 100644 --- services/network/cookie_manager.cc +++ services/network/cookie_manager.cc -@@ -206,14 +206,9 @@ void CookieManager::FlushCookieStore(FlushCookieStoreCallback callback) { +@@ -214,14 +214,9 @@ void CookieManager::FlushCookieStore(FlushCookieStoreCallback callback) { void CookieManager::AllowFileSchemeCookies( bool allow, AllowFileSchemeCookiesCallback callback) { @@ -132,10 +139,10 @@ index a73b9f31cf17..4e0d4b4b4746 100644 void CookieManager::SetForceKeepSessionState() { diff --git services/network/network_context.cc services/network/network_context.cc -index dffa1299b1cf..169ea2925274 100644 +index 8e848688225a..cbbf5de461d6 100644 --- services/network/network_context.cc +++ services/network/network_context.cc -@@ -1726,6 +1726,7 @@ URLRequestContextOwner NetworkContext::ApplyContextParamsToBuilder( +@@ -1762,6 +1762,7 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext() { } scoped_refptr session_cleanup_cookie_store; @@ -143,7 +150,7 @@ index dffa1299b1cf..169ea2925274 100644 if (params_->cookie_path) { scoped_refptr client_task_runner = base::ThreadTaskRunnerHandle::Get(); -@@ -1753,18 +1754,27 @@ URLRequestContextOwner NetworkContext::ApplyContextParamsToBuilder( +@@ -1789,18 +1790,27 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext() { session_cleanup_cookie_store = base::MakeRefCounted(sqlite_store); @@ -154,7 +161,7 @@ index dffa1299b1cf..169ea2925274 100644 if (params_->persist_session_cookies) cookie_store->SetPersistSessionCookies(true); - -- builder->SetCookieStore(std::move(cookie_store)); +- builder.SetCookieStore(std::move(cookie_store)); } else { DCHECK(!params_->restore_old_session_cookies); DCHECK(!params_->persist_session_cookies); @@ -169,16 +176,16 @@ index dffa1299b1cf..169ea2925274 100644 + net::CookieStore::SetCookieableSchemesCallback()); + } + -+ builder->SetCookieStore(std::move(cookie_store)); ++ builder.SetCookieStore(std::move(cookie_store)); + std::unique_ptr user_agent_settings = std::make_unique( params_->accept_language, params_->user_agent); diff --git services/network/public/mojom/network_context.mojom services/network/public/mojom/network_context.mojom -index 58b18e0c3c2b..38020694872a 100644 +index 873bce449b63..3189e268d950 100644 --- services/network/public/mojom/network_context.mojom +++ services/network/public/mojom/network_context.mojom -@@ -206,6 +206,9 @@ struct NetworkContextParams { +@@ -210,6 +210,9 @@ struct NetworkContextParams { // cookies. Otherwise it should be false. bool persist_session_cookies = false; diff --git a/patch/patches/services_network_request_id_2718.patch b/patch/patches/services_network_request_id_2718.patch index 956f76a66..2c5b1249c 100644 --- a/patch/patches/services_network_request_id_2718.patch +++ b/patch/patches/services_network_request_id_2718.patch @@ -1,8 +1,8 @@ -diff --git content/browser/network_service_client.cc content/browser/network_service_client.cc -index b89e764feb03..0bb056852db2 100644 ---- content/browser/network_service_client.cc -+++ content/browser/network_service_client.cc -@@ -207,10 +207,6 @@ class LoginHandlerDelegate { +diff --git content/browser/storage_partition_impl.cc content/browser/storage_partition_impl.cc +index c626801963af..9d05b869101b 100644 +--- content/browser/storage_partition_impl.cc ++++ content/browser/storage_partition_impl.cc +@@ -583,10 +583,6 @@ class LoginHandlerDelegate { } WebContents* web_contents = web_contents_getter_.Run(); @@ -13,20 +13,21 @@ index b89e764feb03..0bb056852db2 100644 // WeakPtr is not strictly necessary here due to OnRequestCancelled. creating_login_delegate_ = true; -@@ -332,10 +328,7 @@ void OnAuthRequiredContinuation( +@@ -643,12 +639,6 @@ void OnAuthRequiredContinuation( web_contents_getter = base::BindRepeating(GetWebContents, process_id, routing_id); } - if (!web_contents_getter.Run()) { -- std::move(auth_challenge_responder)->OnAuthCredentials(base::nullopt); +- mojo::Remote +- auth_challenge_responder_remote(std::move(auth_challenge_responder)); +- auth_challenge_responder_remote->OnAuthCredentials(base::nullopt); - return; - } -+ new LoginHandlerDelegate(std::move(auth_challenge_responder), std::move(web_contents_getter), auth_info, is_request_for_main_frame, process_id, routing_id, diff --git services/network/public/cpp/simple_url_loader.cc services/network/public/cpp/simple_url_loader.cc -index b575b0bb3a35..a04e74d5896f 100644 +index 1ab5688d10d6..7e8d8242a06f 100644 --- services/network/public/cpp/simple_url_loader.cc +++ services/network/public/cpp/simple_url_loader.cc @@ -227,6 +227,7 @@ class SimpleURLLoaderImpl : public SimpleURLLoader, @@ -69,10 +70,10 @@ index b575b0bb3a35..a04e74d5896f 100644 net::MutableNetworkTrafficAnnotationTag(annotation_tag_)); diff --git services/network/public/cpp/simple_url_loader.h services/network/public/cpp/simple_url_loader.h -index f81788d25fda..ba8948be5ebf 100644 +index 255cb1830c5c..bd89d66d2520 100644 --- services/network/public/cpp/simple_url_loader.h +++ services/network/public/cpp/simple_url_loader.h -@@ -324,6 +324,9 @@ class COMPONENT_EXPORT(NETWORK_CPP) SimpleURLLoader { +@@ -327,6 +327,9 @@ class COMPONENT_EXPORT(NETWORK_CPP) SimpleURLLoader { // as much time as it wants. virtual void SetTimeoutDuration(base::TimeDelta timeout_duration) = 0; diff --git a/patch/patches/set_resize_background_color.patch b/patch/patches/set_resize_background_color.patch index f6449a866..9b66bf37e 100644 --- a/patch/patches/set_resize_background_color.patch +++ b/patch/patches/set_resize_background_color.patch @@ -1,8 +1,8 @@ diff --git ui/views/controls/native/native_view_host.cc ui/views/controls/native/native_view_host.cc -index d6116fdbdd09..99191c7e46a9 100644 +index bc1cb3a9e6fc..f68bdeb8786c 100644 --- ui/views/controls/native/native_view_host.cc +++ ui/views/controls/native/native_view_host.cc -@@ -150,7 +150,7 @@ void NativeViewHost::OnPaint(gfx::Canvas* canvas) { +@@ -151,7 +151,7 @@ void NativeViewHost::OnPaint(gfx::Canvas* canvas) { // It would be nice if this used some approximation of the page's // current background color. if (native_wrapper_->HasInstalledClip()) @@ -39,7 +39,7 @@ index 2a6cfc54d866..48623ab5d672 100644 }; diff --git ui/views/controls/webview/webview.cc ui/views/controls/webview/webview.cc -index 805703d5f79a..4f86e1982a8e 100644 +index 982ab4872532..e24c59e4e363 100644 --- ui/views/controls/webview/webview.cc +++ ui/views/controls/webview/webview.cc @@ -112,6 +112,10 @@ void WebView::EnableSizingFromWebContents(const gfx::Size& min_size, diff --git a/patch/patches/storage_incognito_2289.patch b/patch/patches/storage_incognito_2289.patch index c4aecca18..9e96c78bf 100644 --- a/patch/patches/storage_incognito_2289.patch +++ b/patch/patches/storage_incognito_2289.patch @@ -1,5 +1,5 @@ diff --git content/browser/blob_storage/chrome_blob_storage_context.cc content/browser/blob_storage/chrome_blob_storage_context.cc -index 859cf37ae470..ddf7c87e9327 100644 +index 0d5a04d7af76..b4610f07b0c2 100644 --- content/browser/blob_storage/chrome_blob_storage_context.cc +++ content/browser/blob_storage/chrome_blob_storage_context.cc @@ -117,7 +117,8 @@ ChromeBlobStorageContext* ChromeBlobStorageContext::GetFor( @@ -9,14 +9,14 @@ index 859cf37ae470..ddf7c87e9327 100644 - if (!context->IsOffTheRecord() && io_thread_valid) { + if (!context->GetPath().empty() && !context->IsOffTheRecord() && + io_thread_valid) { - file_task_runner = base::CreateTaskRunnerWithTraits( - {base::MayBlock(), base::TaskPriority::BEST_EFFORT, - base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}); + file_task_runner = base::CreateTaskRunner( + {base::ThreadPool(), base::MayBlock(), + base::TaskPriority::USER_VISIBLE, diff --git content/browser/browser_context.cc content/browser/browser_context.cc -index 5fbd75f67fb7..b92df84a2abf 100644 +index 9e5b73896b85..153c089421f9 100644 --- content/browser/browser_context.cc +++ content/browser/browser_context.cc -@@ -58,6 +58,7 @@ +@@ -57,6 +57,7 @@ #include "content/public/common/content_switches.h" #include "content/public/common/service_manager_connection.h" #include "content/public/common/service_names.mojom.h" @@ -33,7 +33,7 @@ index 5fbd75f67fb7..b92df84a2abf 100644 in_memory = true; return partition_map->Get(partition_domain, partition_name, in_memory, -@@ -798,7 +799,7 @@ media::VideoDecodePerfHistory* BrowserContext::GetVideoDecodePerfHistory() { +@@ -792,7 +793,7 @@ media::VideoDecodePerfHistory* BrowserContext::GetVideoDecodePerfHistory() { kUseInMemoryDBDefault); std::unique_ptr stats_db; @@ -42,25 +42,11 @@ index 5fbd75f67fb7..b92df84a2abf 100644 stats_db = std::make_unique(nullptr); } else { -diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc -index c49bdcea4b64..a578f26a7aa7 100644 ---- content/browser/renderer_host/render_process_host_impl.cc -+++ content/browser/renderer_host/render_process_host_impl.cc -@@ -2213,6 +2213,9 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { - plugin_registry_.reset( - new PluginRegistryImpl(GetBrowserContext()->GetResourceContext())); - } -+ // Needed for proper routing of IsPluginAvailable callbacks. -+ DCHECK_GE(GetID(), 0); -+ plugin_registry_->set_render_process_id(GetID()); - registry->AddInterface(base::BindRepeating( - &PluginRegistryImpl::Bind, base::Unretained(plugin_registry_.get()))); - #endif diff --git storage/browser/database/database_tracker.cc storage/browser/database/database_tracker.cc -index 18f8b0a11438..a10ab23aaceb 100644 +index a0065cac99f0..2d808ea8d33f 100644 --- storage/browser/database/database_tracker.cc +++ storage/browser/database/database_tracker.cc -@@ -509,7 +509,7 @@ bool DatabaseTracker::LazyInit() { +@@ -510,7 +510,7 @@ bool DatabaseTracker::LazyInit() { meta_table_.reset(new sql::MetaTable()); is_initialized_ = diff --git a/patch/patches/trace_event.patch b/patch/patches/trace_event.patch index f71fd0c77..afbb8d68c 100644 --- a/patch/patches/trace_event.patch +++ b/patch/patches/trace_event.patch @@ -1,8 +1,8 @@ diff --git base/trace_event/builtin_categories.h base/trace_event/builtin_categories.h -index 7c0723ffd493..96e2af4c0588 100644 +index 6717a2bd93b7..25136f5e99ba 100644 --- base/trace_event/builtin_categories.h +++ base/trace_event/builtin_categories.h -@@ -47,6 +47,8 @@ +@@ -48,6 +48,8 @@ X("cc") \ X("cc.debug") \ X("cdp.perf") \ diff --git a/patch/patches/views_1749_2102.patch b/patch/patches/views_1749_2102.patch index f553da490..20e7cb631 100644 --- a/patch/patches/views_1749_2102.patch +++ b/patch/patches/views_1749_2102.patch @@ -1,5 +1,5 @@ diff --git ui/base/models/menu_model.h ui/base/models/menu_model.h -index cce16a111356..9f0a8b73adb5 100644 +index e0324ff11fb8..6a2455caaab8 100644 --- ui/base/models/menu_model.h +++ ui/base/models/menu_model.h @@ -15,6 +15,7 @@ @@ -39,7 +39,7 @@ index cce16a111356..9f0a8b73adb5 100644 virtual void MenuWillShow() {} diff --git ui/gfx/render_text.cc ui/gfx/render_text.cc -index 2ed814d50a9b..4a1fec248663 100644 +index 8aedc0ecc317..2d9c6cd5452a 100644 --- ui/gfx/render_text.cc +++ ui/gfx/render_text.cc @@ -539,6 +539,14 @@ void RenderText::SetWhitespaceElision(base::Optional whitespace_elision) { @@ -57,7 +57,7 @@ index 2ed814d50a9b..4a1fec248663 100644 void RenderText::SetDisplayRect(const Rect& r) { if (r != display_rect_) { display_rect_ = r; -@@ -1661,6 +1669,19 @@ void RenderText::OnTextAttributeChanged() { +@@ -1666,6 +1674,19 @@ void RenderText::OnTextAttributeChanged() { if (!multiline_ && replace_newline_chars_with_symbols_) base::ReplaceChars(layout_text_, kNewline, kNewlineSymbol, &layout_text_); @@ -78,10 +78,10 @@ index 2ed814d50a9b..4a1fec248663 100644 } diff --git ui/gfx/render_text.h ui/gfx/render_text.h -index 3c3fc3e8eb16..c6e46c0082d8 100644 +index d0dc1d08c912..7496b2620bd3 100644 --- ui/gfx/render_text.h +++ ui/gfx/render_text.h -@@ -318,6 +318,10 @@ class GFX_EXPORT RenderText { +@@ -320,6 +320,10 @@ class GFX_EXPORT RenderText { return whitespace_elision_; } @@ -92,7 +92,7 @@ index 3c3fc3e8eb16..c6e46c0082d8 100644 const Rect& display_rect() const { return display_rect_; } void SetDisplayRect(const Rect& r); -@@ -977,6 +981,8 @@ class GFX_EXPORT RenderText { +@@ -979,6 +983,8 @@ class GFX_EXPORT RenderText { // The cursor position in view space, used to traverse lines of varied widths. base::Optional cached_cursor_x_; @@ -132,7 +132,7 @@ index 214b1a74c5b2..fd15c4dfcb50 100644 const gfx::Size previous_image_size(image_->GetPreferredSize()); UpdateImage(); diff --git ui/views/controls/button/label_button.h ui/views/controls/button/label_button.h -index c183274ec443..63fee0c613ab 100644 +index 2162f9ef52b1..10b1f9120aa3 100644 --- ui/views/controls/button/label_button.h +++ ui/views/controls/button/label_button.h @@ -107,6 +107,9 @@ class VIEWS_EXPORT LabelButton : public Button, public NativeThemeDelegate { @@ -146,10 +146,10 @@ index c183274ec443..63fee0c613ab 100644 ImageView* image() const { return image_; } Label* label() const { return label_; } diff --git ui/views/controls/label.cc ui/views/controls/label.cc -index e2d51fc87b23..258b50c8ea11 100644 +index a4f20420e9ee..ae38c737d8c2 100644 --- ui/views/controls/label.cc +++ ui/views/controls/label.cc -@@ -40,6 +40,20 @@ bool IsOpaque(SkColor color) { +@@ -52,6 +52,20 @@ bool IsOpaque(SkColor color) { return SkColorGetA(color) == SK_AlphaOPAQUE; } @@ -170,7 +170,7 @@ index e2d51fc87b23..258b50c8ea11 100644 } // namespace namespace views { -@@ -271,6 +285,14 @@ base::string16 Label::GetTooltipText() const { +@@ -309,6 +323,14 @@ base::string16 Label::GetTooltipText() const { return tooltip_text_; } @@ -185,9 +185,9 @@ index e2d51fc87b23..258b50c8ea11 100644 void Label::SetTooltipText(const base::string16& tooltip_text) { DCHECK(handles_tooltips_); if (tooltip_text_ == tooltip_text) -@@ -539,7 +561,19 @@ std::unique_ptr Label::CreateRenderText() const { +@@ -578,7 +600,19 @@ std::unique_ptr Label::CreateRenderText() const { render_text->SetFontList(font_list()); - render_text->set_shadows(shadows()); + render_text->set_shadows(GetShadows()); render_text->SetCursorEnabled(false); - render_text->SetText(GetText()); + @@ -203,14 +203,14 @@ index e2d51fc87b23..258b50c8ea11 100644 + render_text->SetText(GetText()); + } + - render_text->SetMultiline(GetMultiLine()); - render_text->SetMaxLines(GetMultiLine() ? GetMaxLines() : 0); - render_text->SetWordWrapBehavior(full_text_->word_wrap_behavior()); + const bool multiline = GetMultiLine(); + render_text->SetMultiline(multiline); + render_text->SetMaxLines(multiline ? GetMaxLines() : 0); diff --git ui/views/controls/label.h ui/views/controls/label.h -index ce169b164bc7..743509aa6acb 100644 +index bc90b6fbf5bd..596c21476e2f 100644 --- ui/views/controls/label.h +++ ui/views/controls/label.h -@@ -164,6 +164,10 @@ class VIEWS_EXPORT Label : public View, +@@ -176,6 +176,10 @@ class VIEWS_EXPORT Label : public View, gfx::ElideBehavior GetElideBehavior() const; void SetElideBehavior(gfx::ElideBehavior elide_behavior); @@ -221,7 +221,7 @@ index ce169b164bc7..743509aa6acb 100644 // Gets/Sets the tooltip text. Default behavior for a label (single-line) is // to show the full text if it is wider than its bounds. Calling this // overrides the default behavior and lets you set a custom tooltip. To -@@ -396,6 +400,7 @@ class VIEWS_EXPORT Label : public View, +@@ -409,6 +413,7 @@ class VIEWS_EXPORT Label : public View, bool collapse_when_hidden_; int fixed_width_; int max_width_; @@ -230,10 +230,10 @@ index ce169b164bc7..743509aa6acb 100644 std::unique_ptr selection_controller_; diff --git ui/views/controls/menu/menu_controller.cc ui/views/controls/menu/menu_controller.cc -index 354216cafea8..16ec7b4c4c3f 100644 +index ee4fbf418def..12bd665da4ce 100644 --- ui/views/controls/menu/menu_controller.cc +++ ui/views/controls/menu/menu_controller.cc -@@ -2571,8 +2571,13 @@ MenuItemView* MenuController::FindNextSelectableMenuItem( +@@ -2614,8 +2614,13 @@ MenuItemView* MenuController::FindNextSelectableMenuItem( void MenuController::OpenSubmenuChangeSelectionIfCan() { MenuItemView* item = pending_state_.item; @@ -248,7 +248,7 @@ index 354216cafea8..16ec7b4c4c3f 100644 MenuItemView* to_select = nullptr; if (!item->GetSubmenu()->GetMenuItems().empty()) to_select = FindInitialSelectableMenuItem(item, INCREMENT_SELECTION_DOWN); -@@ -2591,8 +2596,10 @@ void MenuController::OpenSubmenuChangeSelectionIfCan() { +@@ -2634,8 +2639,10 @@ void MenuController::OpenSubmenuChangeSelectionIfCan() { void MenuController::CloseSubmenu() { MenuItemView* item = state_.item; DCHECK(item); @@ -300,10 +300,10 @@ index bdbd9c7e37b8..86138fd1d21c 100644 virtual int GetMaxWidthForMenu(MenuItemView* menu); diff --git ui/views/controls/menu/menu_item_view.cc ui/views/controls/menu/menu_item_view.cc -index c8a32b58cf7d..9d67171c89a8 100644 +index a37e13686535..cb0d3fb5ef45 100644 --- ui/views/controls/menu/menu_item_view.cc +++ ui/views/controls/menu/menu_item_view.cc -@@ -1057,6 +1057,15 @@ void MenuItemView::PaintBackground(gfx::Canvas* canvas, +@@ -1065,6 +1065,15 @@ void MenuItemView::PaintBackground(gfx::Canvas* canvas, spilling_rect.set_y(spilling_rect.y() - corner_radius_); spilling_rect.set_height(spilling_rect.height() + corner_radius_); canvas->DrawRoundRect(spilling_rect, corner_radius_, flags); @@ -319,7 +319,7 @@ index c8a32b58cf7d..9d67171c89a8 100644 } else if (render_selection) { gfx::Rect item_bounds = GetLocalBounds(); if (type_ == ACTIONABLE_SUBMENU) { -@@ -1123,6 +1132,13 @@ void MenuItemView::PaintMinorIconAndText( +@@ -1131,6 +1140,13 @@ void MenuItemView::PaintMinorIconAndText( } SkColor MenuItemView::GetTextColor(bool minor, bool render_selection) const { @@ -334,10 +334,10 @@ index c8a32b58cf7d..9d67171c89a8 100644 minor ? ui::NativeTheme::kColorId_MenuItemMinorTextColor : ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor; diff --git ui/views/controls/menu/menu_model_adapter.cc ui/views/controls/menu/menu_model_adapter.cc -index bae77a21e0d5..ac01a8a5c52c 100644 +index 09b72733e66d..4bcee9da5b8a 100644 --- ui/views/controls/menu/menu_model_adapter.cc +++ ui/views/controls/menu/menu_model_adapter.cc -@@ -225,6 +225,77 @@ bool MenuModelAdapter::IsItemChecked(int id) const { +@@ -226,6 +226,77 @@ bool MenuModelAdapter::IsItemChecked(int id) const { return false; } @@ -472,7 +472,7 @@ index 4f865802a6e9..42d047bd68ad 100644 // Move the cursor because EnterNotify/LeaveNotify are generated with the // current mouse position as a result of XGrabPointer() diff --git ui/views/view.h ui/views/view.h -index a4f2ba254fb0..8d76cfa46fa6 100644 +index 722b98d676ed..3c7e27cf6eb0 100644 --- ui/views/view.h +++ ui/views/view.h @@ -22,6 +22,7 @@ @@ -482,8 +482,8 @@ index a4f2ba254fb0..8d76cfa46fa6 100644 +#include "base/supports_user_data.h" #include "build/build_config.h" #include "third_party/skia/include/core/SkPath.h" - #include "ui/accessibility/ax_enums.mojom.h" -@@ -275,7 +276,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, + #include "ui/accessibility/ax_enums.mojom-forward.h" +@@ -274,7 +275,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, public ui::EventTarget, public ui::EventHandler, public ui::PropertyHandler, diff --git a/patch/patches/views_widget_180_1481_1565_1677_1749.patch b/patch/patches/views_widget_180_1481_1565_1677_1749.patch index 4ddedc0d2..85a483e47 100644 --- a/patch/patches/views_widget_180_1481_1565_1677_1749.patch +++ b/patch/patches/views_widget_180_1481_1565_1677_1749.patch @@ -1,8 +1,8 @@ diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc -index f41270e26278..38303c9c3ec8 100644 +index dbfcd1da5c85..5b3f20f18ea5 100644 --- content/browser/renderer_host/render_widget_host_view_base.cc +++ content/browser/renderer_host/render_widget_host_view_base.cc -@@ -577,6 +577,14 @@ float RenderWidgetHostViewBase::GetDeviceScaleFactor() { +@@ -581,6 +581,14 @@ float RenderWidgetHostViewBase::GetDeviceScaleFactor() { return screen_info.device_scale_factor; } @@ -18,7 +18,7 @@ index f41270e26278..38303c9c3ec8 100644 return renderer_frame_number_; } diff --git content/browser/renderer_host/render_widget_host_view_base.h content/browser/renderer_host/render_widget_host_view_base.h -index 8e523d78e765..d951d8915864 100644 +index 2bd5d56bc37d..c14d9a858796 100644 --- content/browser/renderer_host/render_widget_host_view_base.h +++ content/browser/renderer_host/render_widget_host_view_base.h @@ -71,6 +71,7 @@ class CursorManager; @@ -39,7 +39,7 @@ index 8e523d78e765..d951d8915864 100644 // Returns the focused RenderWidgetHost inside this |view|'s RWH. RenderWidgetHostImpl* GetFocusedWidget() const; -@@ -125,6 +129,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase +@@ -126,6 +130,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase void DisableAutoResize(const gfx::Size& new_size) override; bool IsScrollOffsetAtTop() override; float GetDeviceScaleFactor() final; @@ -48,7 +48,7 @@ index 8e523d78e765..d951d8915864 100644 TouchSelectionControllerClientManager* GetTouchSelectionControllerClientManager() override; void SetRecordTabSwitchTimeRequest(base::TimeTicks start_time, -@@ -479,6 +485,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase +@@ -475,6 +481,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase // helps to position the full screen widget on the correct monitor. virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0; @@ -61,19 +61,19 @@ index 8e523d78e765..d951d8915864 100644 // Sets the cursor for this view to the one associated with the specified // cursor_type. virtual void UpdateCursor(const WebCursor& cursor) = 0; -@@ -643,6 +655,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase +@@ -639,6 +651,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase bool is_currently_scrolling_viewport_ = false; + // True if the widget has a external parent view/window outside of the + // Chromium-controlled view/window hierarchy. -+ bool has_external_parent_; ++ bool has_external_parent_ = false; + private: FRIEND_TEST_ALL_PREFIXES( BrowserSideFlingBrowserTest, diff --git content/browser/renderer_host/render_widget_host_view_event_handler.cc content/browser/renderer_host/render_widget_host_view_event_handler.cc -index 21f93de01aa5..8b7ec41d94da 100644 +index caaec4aabb93..42067642c699 100644 --- content/browser/renderer_host/render_widget_host_view_event_handler.cc +++ content/browser/renderer_host/render_widget_host_view_event_handler.cc @@ -32,6 +32,10 @@ @@ -87,7 +87,7 @@ index 21f93de01aa5..8b7ec41d94da 100644 #if defined(OS_WIN) #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/public/common/context_menu_params.h" -@@ -922,6 +926,14 @@ void RenderWidgetHostViewEventHandler::SetKeyboardFocus() { +@@ -903,6 +907,14 @@ void RenderWidgetHostViewEventHandler::SetKeyboardFocus() { ::SetFocus(hwnd); } } @@ -103,10 +103,10 @@ index 21f93de01aa5..8b7ec41d94da 100644 // TODO(wjmaclean): can host_ ever be null? if (host_ && set_focus_on_mouse_down_or_key_event_) { diff --git content/public/browser/render_widget_host_view.h content/public/browser/render_widget_host_view.h -index 07d4351d0a8a..4ad78ab76a7c 100644 +index 78e055820447..9f8a6fd1cd65 100644 --- content/public/browser/render_widget_host_view.h +++ content/public/browser/render_widget_host_view.h -@@ -246,6 +246,14 @@ class CONTENT_EXPORT RenderWidgetHostView { +@@ -249,6 +249,14 @@ class CONTENT_EXPORT RenderWidgetHostView { // This must always return the same device scale factor as GetScreenInfo. virtual float GetDeviceScaleFactor() = 0; @@ -122,10 +122,10 @@ index 07d4351d0a8a..4ad78ab76a7c 100644 // Set the view's active state (i.e., tint state of controls). virtual void SetActive(bool active) = 0; diff --git ui/base/x/x11_window.cc ui/base/x/x11_window.cc -index 7df0a3a8ed26..4078efb5ad10 100644 +index 1bb97da34481..f56a74312d67 100644 --- ui/base/x/x11_window.cc +++ ui/base/x/x11_window.cc -@@ -190,8 +190,12 @@ void XWindow::Init(const Configuration& config) { +@@ -205,8 +205,12 @@ void XWindow::Init(const Configuration& config) { attribute_mask |= CWBorderPixel; swa.border_pixel = 0; @@ -140,7 +140,7 @@ index 7df0a3a8ed26..4078efb5ad10 100644 bounds_in_pixels_.height(), 0, // border width diff --git ui/base/x/x11_window.h ui/base/x/x11_window.h -index 97d8273414fa..b8784d044c61 100644 +index 9db97d2f5214..4eb41eaf12aa 100644 --- ui/base/x/x11_window.h +++ ui/base/x/x11_window.h @@ -20,6 +20,7 @@ @@ -151,14 +151,26 @@ index 97d8273414fa..b8784d044c61 100644 #include "ui/gfx/x/x11.h" #include "ui/gfx/x/x11_types.h" -@@ -86,6 +87,7 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow { +@@ -83,6 +84,7 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow { std::string wm_class_name; std::string wm_class_class; std::string wm_role_name; -+ gfx::AcceleratedWidget parent_widget; ++ gfx::AcceleratedWidget parent_widget = gfx::kNullAcceleratedWidget; }; - explicit XWindow(Delegate* delegate); + XWindow(); +diff --git ui/platform_window/x11/x11_window.cc ui/platform_window/x11/x11_window.cc +index c181b69f49ac..9bb225975488 100644 +--- ui/platform_window/x11/x11_window.cc ++++ ui/platform_window/x11/x11_window.cc +@@ -66,6 +66,7 @@ ui::XWindow::Configuration ConvertInitPropertiesToXWindowConfig( + config.wm_class_class = properties.wm_class_class; + config.wm_role_name = properties.wm_role_name; + config.activatable = properties.activatable; ++ config.parent_widget = properties.parent_widget; + return config; + } + diff --git ui/views/widget/desktop_aura/desktop_screen_win.cc ui/views/widget/desktop_aura/desktop_screen_win.cc index 70553b153c44..ecd99bc78373 100644 --- ui/views/widget/desktop_aura/desktop_screen_win.cc @@ -172,19 +184,23 @@ index 70553b153c44..ecd99bc78373 100644 aura::WindowTreeHost* host = window->GetHost(); return host ? host->GetAcceleratedWidget() : nullptr; } +diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_linux.cc ui/views/widget/desktop_aura/desktop_window_tree_host_linux.cc +index da401532ffbe..e878204e71db 100644 +--- ui/views/widget/desktop_aura/desktop_window_tree_host_linux.cc ++++ ui/views/widget/desktop_aura/desktop_window_tree_host_linux.cc +@@ -78,6 +78,7 @@ void DesktopWindowTreeHostLinux::AddAdditionalInitProperties( + properties->wm_class_name = params.wm_class_name; + properties->wm_class_class = params.wm_class_class; + properties->wm_role_name = params.wm_role_name; ++ properties->parent_widget = params.parent_widget; + } + + } // namespace views diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -index 7e31a1c159af..eb0451b8913a 100644 +index 0eedc2665313..1bbc2abc7514 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc -@@ -95,6 +95,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( - should_animate_window_close_(false), - pending_close_(false), - has_non_client_view_(false), -+ has_external_parent_(false), - tooltip_(nullptr) {} - - DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() { -@@ -128,8 +129,12 @@ void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) { +@@ -128,8 +128,12 @@ void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) { native_widget_delegate_); HWND parent_hwnd = nullptr; @@ -198,7 +214,7 @@ index 7e31a1c159af..eb0451b8913a 100644 remove_standard_frame_ = params.remove_standard_frame; has_non_client_view_ = Widget::RequiresNonClientView(params.type); -@@ -891,11 +896,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() { +@@ -900,11 +904,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() { } void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { @@ -217,7 +233,7 @@ index 7e31a1c159af..eb0451b8913a 100644 bool DesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) { diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index 335db0db49bb..7f60402ed086 100644 +index 335db0db49bb..35c30789741a 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h @@ -288,6 +288,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin @@ -226,68 +242,49 @@ index 335db0db49bb..7f60402ed086 100644 + // True if the widget has a external parent view/window outside of the + // Chromium-controlled view/window hierarchy. -+ bool has_external_parent_; ++ bool has_external_parent_ = false; + // Owned by TooltipController, but we need to forward events to it so we keep // a reference. corewm::TooltipWin* tooltip_; diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc -index b03a5bc9d509..bcbf960a130e 100644 +index 2b6a9d013039..023e12b3a2bb 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc -@@ -139,6 +139,7 @@ ui::XWindow::Configuration ConvertInitParamsToX11WindowConfig( - config.wm_class_name = params.wm_class_name; - config.wm_class_class = params.wm_class_class; - config.wm_role_name = params.wm_role_name; -+ config.parent_widget = params.parent_widget; +@@ -247,6 +247,9 @@ void DesktopWindowTreeHostX11::Init(const Widget::InitParams& params) { + window_parent_->window_children_.insert(this); + } - return config; - } -@@ -246,6 +247,8 @@ std::vector DesktopWindowTreeHostX11::GetAllOpenWindows() { - } - - gfx::Rect DesktopWindowTreeHostX11::GetX11RootWindowBounds() const { -+ if (!screen_bounds_.IsEmpty()) -+ return screen_bounds_; - return x11_window_->bounds(); - } - -@@ -540,6 +543,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( - } - - gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const { -+ if (!screen_bounds_.IsEmpty()) -+ return screen_bounds_; - gfx::Rect bounds_in_pixels = x11_window_->bounds(); - return ToDIPRect(bounds_in_pixels); - } -@@ -954,6 +959,9 @@ void DesktopWindowTreeHostX11::SetBoundsInPixels( - } - - gfx::Point DesktopWindowTreeHostX11::GetLocationOnScreenInPixels() const { -+ if (!screen_bounds_.IsEmpty()) -+ return screen_bounds_.origin(); -+ - return x11_window_->bounds().origin(); - } - -@@ -1280,6 +1288,11 @@ void DesktopWindowTreeHostX11::InitX11Window(const Widget::InitParams& params) { - config.background_color = background_color; - config.prefer_dark_theme = linux_ui && linux_ui->PreferDarkTheme(); - config.icon = ViewsDelegate::GetInstance()->GetDefaultWindowIcon(); -+ -+ gfx::AcceleratedWidget parent_widget = config.parent_widget; -+ if (parent_widget != gfx::kNullAcceleratedWidget) ++ if (params.parent_widget != gfx::kNullAcceleratedWidget) + has_external_parent_ = true; + - x11_window_->Init(config); + DesktopWindowTreeHostPlatform::Init(params); - // Disable compositing on tooltips as a workaround for + // Set XEventDelegate to receive selection, drag&drop and raw key events. +@@ -435,6 +438,18 @@ void DesktopWindowTreeHostX11::StackAtTop() { + GetXWindow()->StackAtTop(); + } + ++gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const { ++ if (!screen_bounds_.IsEmpty()) ++ return screen_bounds_; ++ return DesktopWindowTreeHostLinux::GetWindowBoundsInScreen(); ++} ++ ++gfx::Point DesktopWindowTreeHostX11::GetLocationOnScreenInPixels() const { ++ if (!screen_bounds_.IsEmpty()) ++ return screen_bounds_.origin(); ++ return DesktopWindowTreeHostLinux::GetLocationOnScreenInPixels(); ++} ++ + void DesktopWindowTreeHostX11::GetWindowPlacement( + gfx::Rect* bounds, + ui::WindowShowState* show_state) const { diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h -index e32726ad4616..cad33f22bf74 100644 +index 09baef384772..8895a31c611b 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h -@@ -102,6 +102,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -98,6 +98,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux, // be changed after. void SetVisualId(VisualID visual_id); @@ -300,7 +297,16 @@ index e32726ad4616..cad33f22bf74 100644 protected: // Overridden from DesktopWindowTreeHost: void Init(const Widget::InitParams& params) override; -@@ -294,6 +300,13 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -112,6 +118,8 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux, + void SetSize(const gfx::Size& requested_size) override; + void StackAbove(aura::Window* window) override; + void StackAtTop() override; ++ gfx::Rect GetWindowBoundsInScreen() const override; ++ gfx::Point GetLocationOnScreenInPixels() const override; + void GetWindowPlacement(gfx::Rect* bounds, + ui::WindowShowState* show_state) const override; + gfx::Rect GetRestoredBounds() const override; +@@ -255,6 +263,13 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux, // behavior if > 0. ui::ZOrderLevel z_order_ = ui::ZOrderLevel::kNormal; @@ -313,43 +319,46 @@ index e32726ad4616..cad33f22bf74 100644 + DesktopDragDropClientAuraX11* drag_drop_client_ = nullptr; - std::unique_ptr x11_non_client_event_filter_; + std::unique_ptr non_client_event_filter_; +@@ -285,6 +300,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : public DesktopWindowTreeHostLinux, + + std::unique_ptr compositor_observer_; + ++ // True if the xwindow has already been destroyed. ++ bool xwindow_destroyed_ = false; ++ + // The display and the native X window hosting the root window. + base::WeakPtrFactory close_widget_factory_{this}; + base::WeakPtrFactory weak_factory_{this}; diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc -index 0cb75272c2ca..ef79679114d4 100644 +index 3e4c62c49f07..778c984b59b3 100644 --- ui/views/widget/widget.cc +++ ui/views/widget/widget.cc -@@ -157,6 +157,7 @@ Widget::InitParams::InitParams(Type type) - use_system_default_icon(false), - show_state(ui::SHOW_STATE_DEFAULT), - parent(nullptr), -+ parent_widget(gfx::kNullAcceleratedWidget), - native_widget(nullptr), - desktop_window_tree_host(nullptr), - layer_type(ui::LAYER_TEXTURED), -@@ -325,7 +326,7 @@ void Widget::Init(const InitParams& in_params) { +@@ -304,7 +304,8 @@ void Widget::Init(InitParams params) { params.name = params.delegate->GetContentsView()->GetClassName(); params.child |= (params.type == InitParams::TYPE_CONTROL); - is_top_level_ = !params.child; -+ is_top_level_ = !params.child || params.parent_widget; ++ is_top_level_ = !params.child || ++ params.parent_widget != gfx::kNullAcceleratedWidget; if (params.opacity == views::Widget::InitParams::INFER_OPACITY && params.type != views::Widget::InitParams::TYPE_WINDOW) { -@@ -389,7 +390,12 @@ void Widget::Init(const InitParams& in_params) { +@@ -387,7 +388,12 @@ void Widget::Init(InitParams params) { } - } else if (params.delegate) { - SetContentsView(params.delegate->GetContentsView()); -- SetInitialBoundsForFramelessWindow(params.bounds); -+ if (params.parent_widget) { + } else if (delegate) { + SetContentsView(delegate->GetContentsView()); +- SetInitialBoundsForFramelessWindow(bounds); ++ if (params.parent_widget != gfx::kNullAcceleratedWidget) { + // Set the bounds directly instead of applying an inset. -+ SetBounds(params.bounds); ++ SetBounds(bounds); + } else { -+ SetInitialBoundsForFramelessWindow(params.bounds); ++ SetInitialBoundsForFramelessWindow(bounds); + } } // TODO(https://crbug.com/953978): Use GetNativeTheme() for all platforms. #if defined(OS_MACOSX) || defined(OS_WIN) -@@ -1175,10 +1181,16 @@ void Widget::OnNativeWidgetDestroyed() { +@@ -1174,10 +1180,16 @@ void Widget::OnNativeWidgetDestroyed() { } gfx::Size Widget::GetMinimumSize() const { @@ -367,19 +376,20 @@ index 0cb75272c2ca..ef79679114d4 100644 } diff --git ui/views/widget/widget.h ui/views/widget/widget.h -index 83ba608199b4..546cbe32020c 100644 +index 4d622c392db3..a610bff37782 100644 --- ui/views/widget/widget.h +++ ui/views/widget/widget.h -@@ -259,6 +259,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, - // Whether the widget should be maximized or minimized. - ui::WindowShowState show_state; - gfx::NativeView parent; -+ gfx::AcceleratedWidget parent_widget; +@@ -284,6 +284,8 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, + + gfx::NativeView parent = nullptr; + ++ gfx::AcceleratedWidget parent_widget = gfx::kNullAcceleratedWidget; ++ // Specifies the initial bounds of the Widget. Default is empty, which means // the NativeWidget may specify a default size. If the parent is specified, // |bounds| is in the parent's coordinate system. If the parent is not diff --git ui/views/widget/widget_delegate.h ui/views/widget/widget_delegate.h -index 77585733e699..77c5db949902 100644 +index e71776db8db7..783bf1f45bdb 100644 --- ui/views/widget/widget_delegate.h +++ ui/views/widget/widget_delegate.h @@ -191,6 +191,10 @@ class VIEWS_EXPORT WidgetDelegate { @@ -407,10 +417,10 @@ index 9edfa2c00c4b..8a9217578609 100644 if (native_widget_delegate->IsDialogBox()) { *style |= DS_MODALFRAME; diff --git ui/views/win/hwnd_message_handler.cc ui/views/win/hwnd_message_handler.cc -index 9b683f301913..8609f61ebd0f 100644 +index 67202004ea3a..50e240bdb6c8 100644 --- ui/views/win/hwnd_message_handler.cc +++ ui/views/win/hwnd_message_handler.cc -@@ -2963,10 +2963,13 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -2972,10 +2972,13 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, } else if (event.type() == ui::ET_MOUSEWHEEL) { ui::MouseWheelEvent mouse_wheel_event(msg); // Reroute the mouse wheel to the window under the pointer if applicable. diff --git a/patch/patches/viz_osr_2575.patch b/patch/patches/viz_osr_2575.patch index 072a267db..9e7508947 100644 --- a/patch/patches/viz_osr_2575.patch +++ b/patch/patches/viz_osr_2575.patch @@ -29,7 +29,7 @@ index f5e18df4e06e..58a8e8ef125b 100644 #if defined(USE_X11) void HostDisplayClient::DidCompleteSwapWithNewSize(const gfx::Size& size) { diff --git components/viz/host/host_display_client.h components/viz/host/host_display_client.h -index 5e5c5da4a3cf..30eca49765bd 100644 +index b8177277ebca..955e5a146be5 100644 --- components/viz/host/host_display_client.h +++ components/viz/host/host_display_client.h @@ -30,17 +30,17 @@ class VIZ_HOST_EXPORT HostDisplayClient : public mojom::DisplayClient { @@ -67,7 +67,7 @@ index 65c26e2f7ae8..e0f60e2ac25e 100644 if (!canvas_) { diff --git components/viz/host/layered_window_updater_impl.h components/viz/host/layered_window_updater_impl.h -index d9a9730a78b9..d98426e9f789 100644 +index ced30727ab67..f422786fe6cd 100644 --- components/viz/host/layered_window_updater_impl.h +++ components/viz/host/layered_window_updater_impl.h @@ -33,7 +33,7 @@ class VIZ_HOST_EXPORT LayeredWindowUpdaterImpl @@ -80,7 +80,7 @@ index d9a9730a78b9..d98426e9f789 100644 private: const HWND hwnd_; diff --git components/viz/service/BUILD.gn components/viz/service/BUILD.gn -index fdd358f741e6..57afa1d3855e 100644 +index a3fc1b3bdc9c..33f2b5206ca2 100644 --- components/viz/service/BUILD.gn +++ components/viz/service/BUILD.gn @@ -13,6 +13,8 @@ config("viz_service_implementation") { @@ -93,7 +93,7 @@ index fdd358f741e6..57afa1d3855e 100644 "display/bsp_tree.h", "display/bsp_walk_action.cc", diff --git components/viz/service/display_embedder/output_surface_provider_impl.cc components/viz/service/display_embedder/output_surface_provider_impl.cc -index 7f61cb7c847b..f1e3f2fec151 100644 +index e3c8e9dbca69..5ee6f60584d1 100644 --- components/viz/service/display_embedder/output_surface_provider_impl.cc +++ components/viz/service/display_embedder/output_surface_provider_impl.cc @@ -12,6 +12,7 @@ @@ -104,7 +104,7 @@ index 7f61cb7c847b..f1e3f2fec151 100644 #include "components/viz/common/display/renderer_settings.h" #include "components/viz/common/frame_sinks/begin_frame_source.h" #include "components/viz/service/display_embedder/gl_output_surface.h" -@@ -219,6 +220,20 @@ OutputSurfaceProviderImpl::CreateSoftwareOutputDeviceForPlatform( +@@ -223,6 +224,20 @@ OutputSurfaceProviderImpl::CreateSoftwareOutputDeviceForPlatform( if (headless_) return std::make_unique(); @@ -126,7 +126,7 @@ index 7f61cb7c847b..f1e3f2fec151 100644 return CreateSoftwareOutputDeviceWin(surface_handle, &output_device_backing_, display_client); diff --git components/viz/service/display_embedder/software_output_device_win.cc components/viz/service/display_embedder/software_output_device_win.cc -index 73ea1986b214..d437e045de2f 100644 +index 74316edc0e0b..14c9339027a2 100644 --- components/viz/service/display_embedder/software_output_device_win.cc +++ components/viz/service/display_embedder/software_output_device_win.cc @@ -265,8 +265,9 @@ void SoftwareOutputDeviceWinProxy::EndPaintDelegated( @@ -142,10 +142,10 @@ index 73ea1986b214..d437e045de2f 100644 TRACE_EVENT_ASYNC_BEGIN0("viz", "SoftwareOutputDeviceWinProxy::Draw", this); diff --git mojo/public/cpp/bindings/sync_call_restrictions.h mojo/public/cpp/bindings/sync_call_restrictions.h -index 906be544c90f..a110f254d7ec 100644 +index f273901017ad..c04e4bcea80f 100644 --- mojo/public/cpp/bindings/sync_call_restrictions.h +++ mojo/public/cpp/bindings/sync_call_restrictions.h -@@ -34,6 +34,7 @@ class HostContextFactoryPrivate; +@@ -33,6 +33,7 @@ class HostContextFactoryPrivate; namespace viz { class HostFrameSinkManager; @@ -153,7 +153,7 @@ index 906be544c90f..a110f254d7ec 100644 } namespace mojo { -@@ -91,6 +92,8 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) SyncCallRestrictions { +@@ -88,6 +89,8 @@ class COMPONENT_EXPORT(MOJO_CPP_BINDINGS) SyncCallRestrictions { // For preventing frame swaps of wrong size during resize on Windows. // (https://crbug.com/811945) friend class ui::HostContextFactoryPrivate; @@ -162,10 +162,10 @@ index 906be544c90f..a110f254d7ec 100644 // END ALLOWED USAGE. #if ENABLE_SYNC_CALL_RESTRICTIONS -diff --git services/viz/privileged/interfaces/compositing/display_private.mojom services/viz/privileged/interfaces/compositing/display_private.mojom -index 8898b9162a65..3a93996f9893 100644 ---- services/viz/privileged/interfaces/compositing/display_private.mojom -+++ services/viz/privileged/interfaces/compositing/display_private.mojom +diff --git services/viz/privileged/mojom/compositing/display_private.mojom services/viz/privileged/mojom/compositing/display_private.mojom +index 5c6292cfb3b8..c85a4c8991de 100644 +--- services/viz/privileged/mojom/compositing/display_private.mojom ++++ services/viz/privileged/mojom/compositing/display_private.mojom @@ -79,12 +79,14 @@ interface DisplayPrivate { }; @@ -182,10 +182,10 @@ index 8898b9162a65..3a93996f9893 100644 CreateLayeredWindowUpdater(LayeredWindowUpdater& layered_window_updater); // Notifies that a swap has occurred and provides information about the pixel -diff --git services/viz/privileged/interfaces/compositing/layered_window_updater.mojom services/viz/privileged/interfaces/compositing/layered_window_updater.mojom -index 58a7e221eaab..dd141b16eace 100644 ---- services/viz/privileged/interfaces/compositing/layered_window_updater.mojom -+++ services/viz/privileged/interfaces/compositing/layered_window_updater.mojom +diff --git services/viz/privileged/mojom/compositing/layered_window_updater.mojom services/viz/privileged/mojom/compositing/layered_window_updater.mojom +index 6b7fbb6cf13d..e2af75168cb9 100644 +--- services/viz/privileged/mojom/compositing/layered_window_updater.mojom ++++ services/viz/privileged/mojom/compositing/layered_window_updater.mojom @@ -26,5 +26,5 @@ interface LayeredWindowUpdater { // Draws to the HWND by copying pixels from shared memory. Callback must be // called after draw operation is complete to signal shared memory can be @@ -194,7 +194,7 @@ index 58a7e221eaab..dd141b16eace 100644 + Draw(gfx.mojom.Rect damage_rect) => (); }; diff --git ui/compositor/compositor.h ui/compositor/compositor.h -index 5158731bd851..07d3bda5f6ff 100644 +index ff4562c024be..9e964381f904 100644 --- ui/compositor/compositor.h +++ ui/compositor/compositor.h @@ -23,7 +23,9 @@ @@ -204,7 +204,7 @@ index 5158731bd851..07d3bda5f6ff 100644 +#include "components/viz/host/host_display_client.h" #include "components/viz/host/host_frame_sink_client.h" +#include "components/viz/service/display/software_output_device.h" - #include "services/viz/privileged/interfaces/compositing/vsync_parameter_observer.mojom-forward.h" + #include "services/viz/privileged/mojom/compositing/vsync_parameter_observer.mojom-forward.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkMatrix44.h" @@ -194,6 +196,14 @@ class COMPOSITOR_EXPORT ContextFactory { @@ -232,7 +232,7 @@ index 5158731bd851..07d3bda5f6ff 100644 // Sets the root of the layer tree drawn by this Compositor. The root layer // must have no parent. The compositor's root layer is reset if the root layer // is destroyed. NULL can be passed to reset the root layer, in which case the -@@ -448,6 +461,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, +@@ -450,6 +463,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, ui::ContextFactory* context_factory_; ui::ContextFactoryPrivate* context_factory_private_; @@ -242,10 +242,10 @@ index 5158731bd851..07d3bda5f6ff 100644 Layer* root_layer_ = nullptr; diff --git ui/compositor/host/host_context_factory_private.cc ui/compositor/host/host_context_factory_private.cc -index 1c84de621781..3ebde59a8041 100644 +index d32c154b965b..b5ba8426670f 100644 --- ui/compositor/host/host_context_factory_private.cc +++ ui/compositor/host/host_context_factory_private.cc -@@ -99,8 +99,13 @@ void HostContextFactoryPrivate::ConfigureCompositor( +@@ -98,8 +98,13 @@ void HostContextFactoryPrivate::ConfigureCompositor( mojo::MakeRequest(&root_params->compositor_frame_sink_client); root_params->display_private = mojo::MakeRequest(&compositor_data.display_private); diff --git a/patch/patches/web_contents_1257_1565.patch b/patch/patches/web_contents_1257_1565.patch index 3a69708de..ae0b524c3 100644 --- a/patch/patches/web_contents_1257_1565.patch +++ b/patch/patches/web_contents_1257_1565.patch @@ -1,8 +1,8 @@ diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc -index ae1bcfa7db7d..0ff65dcfe38f 100644 +index a4e4a612d82c..3bf880312d5e 100644 --- content/browser/web_contents/web_contents_impl.cc +++ content/browser/web_contents/web_contents_impl.cc -@@ -2131,21 +2131,30 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -2137,21 +2137,30 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { std::string unique_name; frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name); @@ -45,7 +45,7 @@ index ae1bcfa7db7d..0ff65dcfe38f 100644 CHECK(render_view_host_delegate_view_); CHECK(view_.get()); -@@ -2844,6 +2853,15 @@ void WebContentsImpl::CreateNewWindow( +@@ -2852,6 +2861,15 @@ void WebContentsImpl::CreateNewWindow( create_params.renderer_initiated_creation = main_frame_route_id != MSG_ROUTING_NONE; @@ -61,16 +61,16 @@ index ae1bcfa7db7d..0ff65dcfe38f 100644 std::unique_ptr new_contents; if (!is_guest) { create_params.context = view_->GetNativeView(); -@@ -2876,7 +2894,7 @@ void WebContentsImpl::CreateNewWindow( +@@ -2884,7 +2902,7 @@ void WebContentsImpl::CreateNewWindow( // TODO(brettw): It seems bogus that we have to call this function on the // newly created object and give it one of its own member variables. - new_view->CreateViewForWidget( + RenderWidgetHostView* widget_view = new_view->CreateViewForWidget( - new_contents_impl->GetRenderViewHost()->GetWidget(), false); + new_contents_impl->GetRenderViewHost()->GetWidget(), nullptr); - } - // Save the created window associated with the route so we can show it - // later. -@@ -6516,7 +6534,7 @@ InterstitialPageImpl* WebContentsImpl::GetInterstitialForRenderManager() { + if (!renderer_started_hidden) { + // RenderWidgets for frames always initialize as hidden. If the renderer + // created this window as visible, then we show it here. +@@ -6544,7 +6562,7 @@ InterstitialPageImpl* WebContentsImpl::GetInterstitialForRenderManager() { void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager( RenderViewHost* render_view_host) { RenderWidgetHostViewBase* rwh_view = @@ -95,10 +95,10 @@ index df508da0aef2..f6f4bf42b108 100644 WebContents::CreateParams::CreateParams(const CreateParams& other) = default; diff --git content/public/browser/web_contents.h content/public/browser/web_contents.h -index 50236e972100..8c09c1b53d27 100644 +index b5ff1cc5d6f6..f1a2ba836ea1 100644 --- content/public/browser/web_contents.h +++ content/public/browser/web_contents.h -@@ -76,9 +76,11 @@ class BrowserPluginGuestDelegate; +@@ -78,9 +78,11 @@ class BrowserPluginGuestDelegate; class InterstitialPage; class RenderFrameHost; class RenderViewHost; @@ -110,7 +110,7 @@ index 50236e972100..8c09c1b53d27 100644 struct CustomContextMenuContext; struct DropData; struct MHTMLGenerationParams; -@@ -217,6 +219,10 @@ class WebContents : public PageNavigator, +@@ -219,6 +221,10 @@ class WebContents : public PageNavigator, // Sandboxing flags set on the new WebContents. blink::WebSandboxFlags starting_sandbox_flags; @@ -122,10 +122,10 @@ index 50236e972100..8c09c1b53d27 100644 // the value that'll be returned by GetLastActiveTime(). If this is left // default initialized then the value is not passed on to the WebContents diff --git content/public/browser/web_contents_delegate.h content/public/browser/web_contents_delegate.h -index 23c2a2bdaa77..67fd2a66cab4 100644 +index 70afb5357631..d78b15c3a83b 100644 --- content/public/browser/web_contents_delegate.h +++ content/public/browser/web_contents_delegate.h -@@ -59,10 +59,12 @@ class FileSelectListener; +@@ -58,10 +58,12 @@ class FileSelectListener; class JavaScriptDialogManager; class RenderFrameHost; class RenderProcessHost; @@ -138,7 +138,7 @@ index 23c2a2bdaa77..67fd2a66cab4 100644 struct ContextMenuParams; struct DropData; struct NativeWebKeyboardEvent; -@@ -334,6 +336,14 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -333,6 +335,14 @@ class CONTENT_EXPORT WebContentsDelegate { const std::string& partition_id, SessionStorageNamespace* session_storage_namespace); diff --git a/patch/patches/webkit_plugin_info_2015.patch b/patch/patches/webkit_plugin_info_2015.patch index 0fbaa131a..08bd6d333 100644 --- a/patch/patches/webkit_plugin_info_2015.patch +++ b/patch/patches/webkit_plugin_info_2015.patch @@ -10,10 +10,10 @@ index ff7a8ed89e94..77f44956ff22 100644 + GetPlugins(bool refresh, bool is_main_frame, url.mojom.Origin main_frame_origin) => (array plugins); }; diff --git third_party/blink/public/platform/platform.h third_party/blink/public/platform/platform.h -index 9ae02783be95..b64538cbe8b6 100644 +index 68051e35252c..bda59d747a62 100644 --- third_party/blink/public/platform/platform.h +++ third_party/blink/public/platform/platform.h -@@ -685,6 +685,11 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -731,6 +731,11 @@ class BLINK_PLATFORM_EXPORT Platform { // runs during Chromium's build step). virtual bool IsTakingV8ContextSnapshot() { return false; } @@ -44,10 +44,10 @@ index 80a9ec9bc75b..13cbb056cdfa 100644 .Top() .GetSecurityContext() diff --git third_party/blink/renderer/core/frame/local_frame.cc third_party/blink/renderer/core/frame/local_frame.cc -index 60b3fe655dc8..8dedb75b8d8b 100644 +index 52f56794f2ed..9bbef168e262 100644 --- third_party/blink/renderer/core/frame/local_frame.cc +++ third_party/blink/renderer/core/frame/local_frame.cc -@@ -1182,7 +1182,7 @@ WebContentSettingsClient* LocalFrame::GetContentSettingsClient() { +@@ -1236,7 +1236,7 @@ WebContentSettingsClient* LocalFrame::GetContentSettingsClient() { PluginData* LocalFrame::GetPluginData() const { if (!Loader().AllowPlugins(kNotAboutToInstantiatePlugin)) return nullptr; @@ -57,18 +57,18 @@ index 60b3fe655dc8..8dedb75b8d8b 100644 } diff --git third_party/blink/renderer/core/inspector/devtools_session.cc third_party/blink/renderer/core/inspector/devtools_session.cc -index 789b09417ceb..56d60ee8cb70 100644 +index 3f0763384089..6919c6f0b2b8 100644 --- third_party/blink/renderer/core/inspector/devtools_session.cc +++ third_party/blink/renderer/core/inspector/devtools_session.cc -@@ -5,6 +5,7 @@ - #include "third_party/blink/renderer/core/inspector/devtools_session.h" +@@ -9,6 +9,7 @@ + #include #include "base/containers/span.h" +#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/bindings/core/v8/script_controller.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/inspector/devtools_agent.h" -@@ -184,6 +185,7 @@ DevToolsSession::DevToolsSession( +@@ -188,6 +189,7 @@ DevToolsSession::DevToolsSession( for (wtf_size_t i = 0; i < agents_.size(); i++) agents_[i]->Restore(); } @@ -76,7 +76,7 @@ index 789b09417ceb..56d60ee8cb70 100644 } DevToolsSession::~DevToolsSession() { -@@ -223,6 +225,7 @@ void DevToolsSession::Detach() { +@@ -227,6 +229,7 @@ void DevToolsSession::Detach() { agents_.clear(); v8_session_.reset(); agent_->client_->DebuggerTaskFinished(); @@ -85,10 +85,10 @@ index 789b09417ceb..56d60ee8cb70 100644 void DevToolsSession::FlushProtocolNotifications() { diff --git third_party/blink/renderer/core/page/page.cc third_party/blink/renderer/core/page/page.cc -index d3f15ac9569d..6823265f1ff0 100644 +index 5b2c09a61111..858725e57438 100644 --- third_party/blink/renderer/core/page/page.cc +++ third_party/blink/renderer/core/page/page.cc -@@ -185,7 +185,8 @@ Page::Page(PageClients& page_clients) +@@ -183,7 +183,8 @@ Page::Page(PageClients& page_clients) MakeGarbageCollected(GetVisualViewport(), GetChromeClient())), link_highlights_(MakeGarbageCollected(*this)), @@ -98,7 +98,7 @@ index d3f15ac9569d..6823265f1ff0 100644 // TODO(pdr): Initialize |validation_message_client_| lazily. validation_message_client_( MakeGarbageCollected(*this)), -@@ -345,21 +346,40 @@ void Page::InitialStyleChanged() { +@@ -343,21 +344,40 @@ void Page::InitialStyleChanged() { } } @@ -148,7 +148,7 @@ index d3f15ac9569d..6823265f1ff0 100644 page->NotifyPluginsChanged(); } } -@@ -832,7 +852,8 @@ void Page::Trace(blink::Visitor* visitor) { +@@ -830,7 +850,8 @@ void Page::Trace(blink::Visitor* visitor) { visitor->Trace(link_highlights_); visitor->Trace(spatial_navigation_controller_); visitor->Trace(main_frame_); @@ -159,10 +159,10 @@ index d3f15ac9569d..6823265f1ff0 100644 visitor->Trace(plugins_changed_observers_); visitor->Trace(next_related_page_); diff --git third_party/blink/renderer/core/page/page.h third_party/blink/renderer/core/page/page.h -index cc3fa3e02fad..bfb8986958ba 100644 +index 9f70ee045546..aad92d9e2e90 100644 --- third_party/blink/renderer/core/page/page.h +++ third_party/blink/renderer/core/page/page.h -@@ -141,7 +141,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, +@@ -140,7 +140,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, ViewportDescription GetViewportDescription() const; // Returns the plugin data associated with |main_frame_origin|. @@ -172,7 +172,7 @@ index cc3fa3e02fad..bfb8986958ba 100644 // Resets the plugin data for all pages in the renderer process and notifies // PluginsChangedObservers. -@@ -374,7 +375,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, +@@ -371,7 +372,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, const Member link_highlights_; Member spatial_navigation_controller_; @@ -183,12 +183,12 @@ index cc3fa3e02fad..bfb8986958ba 100644 Member validation_message_client_; diff --git third_party/blink/renderer/core/page/plugin_data.cc third_party/blink/renderer/core/page/plugin_data.cc -index 53a380945307..ae05d1ae36ee 100644 +index 7ea0e09e47a0..69a5c8f8e3d5 100644 --- third_party/blink/renderer/core/page/plugin_data.cc +++ third_party/blink/renderer/core/page/plugin_data.cc -@@ -90,10 +90,12 @@ void PluginData::RefreshBrowserSidePluginCache() { +@@ -91,10 +91,12 @@ void PluginData::RefreshBrowserSidePluginCache() { Platform::Current()->GetInterfaceProvider()->GetInterface( - mojo::MakeRequest(®istry)); + registry.BindNewPipeAndPassReceiver()); Vector plugins; - registry->GetPlugins(true, SecurityOrigin::CreateUniqueOpaque(), &plugins); + registry->GetPlugins(true, true, SecurityOrigin::CreateUniqueOpaque(), @@ -201,9 +201,9 @@ index 53a380945307..ae05d1ae36ee 100644 ResetPluginData(); main_frame_origin_ = main_frame_origin; -@@ -101,7 +103,7 @@ void PluginData::UpdatePluginList(const SecurityOrigin* main_frame_origin) { +@@ -102,7 +104,7 @@ void PluginData::UpdatePluginList(const SecurityOrigin* main_frame_origin) { Platform::Current()->GetInterfaceProvider()->GetInterface( - mojo::MakeRequest(®istry)); + registry.BindNewPipeAndPassReceiver()); Vector plugins; - registry->GetPlugins(false, main_frame_origin_, &plugins); + registry->GetPlugins(false, is_main_frame, main_frame_origin_, &plugins); diff --git a/patch/patches/webkit_pointer_event_781966.patch b/patch/patches/webkit_pointer_event_781966.patch index d04c69ecc..4c9e782d5 100644 --- a/patch/patches/webkit_pointer_event_781966.patch +++ b/patch/patches/webkit_pointer_event_781966.patch @@ -1,5 +1,5 @@ diff --git third_party/blink/renderer/core/input/pointer_event_manager.cc third_party/blink/renderer/core/input/pointer_event_manager.cc -index 1ccbd3b948f0..98a67619990d 100644 +index 152866713e16..89bca464b90b 100644 --- third_party/blink/renderer/core/input/pointer_event_manager.cc +++ third_party/blink/renderer/core/input/pointer_event_manager.cc @@ -312,7 +312,7 @@ void PointerEventManager::HandlePointerInterruption( diff --git a/patch/patches/webkit_popups.patch b/patch/patches/webkit_popups.patch index 3841dbdaa..b3dc8efe6 100644 --- a/patch/patches/webkit_popups.patch +++ b/patch/patches/webkit_popups.patch @@ -1,8 +1,8 @@ diff --git third_party/blink/public/web/web_view.h third_party/blink/public/web/web_view.h -index 20bd110babb1..4f5301c77bda 100644 +index db7d7c87686a..a7c6beb6a6f1 100644 --- third_party/blink/public/web/web_view.h +++ third_party/blink/public/web/web_view.h -@@ -371,6 +371,7 @@ class WebView { +@@ -366,6 +366,7 @@ class WebView { // Sets whether select popup menus should be rendered by the browser. BLINK_EXPORT static void SetUseExternalPopupMenus(bool); @@ -11,10 +11,10 @@ index 20bd110babb1..4f5301c77bda 100644 // Cancels and hides the current popup (datetime, select...) if any. virtual void CancelPagePopup() = 0; diff --git third_party/blink/renderer/core/exported/web_view_impl.cc third_party/blink/renderer/core/exported/web_view_impl.cc -index 414e7de22b08..9db9ea786e27 100644 +index 58e4fbcf6ee2..51f2645e6154 100644 --- third_party/blink/renderer/core/exported/web_view_impl.cc +++ third_party/blink/renderer/core/exported/web_view_impl.cc -@@ -217,8 +217,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { +@@ -219,8 +219,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { g_should_use_external_popup_menus = use_external_popup_menus; } @@ -30,7 +30,7 @@ index 414e7de22b08..9db9ea786e27 100644 } namespace { -@@ -276,6 +281,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, +@@ -278,6 +283,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, chrome_client_(MakeGarbageCollected(this)), minimum_zoom_level_(ZoomFactorToZoomLevel(kMinTextSizeMultiplier)), maximum_zoom_level_(ZoomFactorToZoomLevel(kMaxTextSizeMultiplier)), @@ -39,10 +39,10 @@ index 414e7de22b08..9db9ea786e27 100644 fullscreen_controller_(std::make_unique(this)) { if (!AsView().client) { diff --git third_party/blink/renderer/core/exported/web_view_impl.h third_party/blink/renderer/core/exported/web_view_impl.h -index 720ea6fcfb7f..9116fbdcf673 100644 +index 61d54c30b50c..d08ad65454ac 100644 --- third_party/blink/renderer/core/exported/web_view_impl.h +++ third_party/blink/renderer/core/exported/web_view_impl.h -@@ -109,7 +109,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, +@@ -115,7 +115,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, static HashSet& AllInstances(); // Returns true if popup menus should be rendered by the browser, false if // they should be rendered by WebKit (which is the default). @@ -50,9 +50,9 @@ index 720ea6fcfb7f..9116fbdcf673 100644 + void SetUseExternalPopupMenusThisInstance(bool) override; + bool UseExternalPopupMenus() const; - // Returns whether frames under this WebView are backed by a compositor. When - // false there may be no WebWidgetClient present. When true, there must be a -@@ -619,6 +620,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, + // Returns whether frames under this WebView are backed by a compositor. + bool does_composite() const { return does_composite_; } +@@ -617,6 +618,8 @@ class CORE_EXPORT WebViewImpl final : public WebView, float fake_page_scale_animation_page_scale_factor_ = 0.f; bool fake_page_scale_animation_use_anchor_ = false; @@ -62,15 +62,15 @@ index 720ea6fcfb7f..9116fbdcf673 100644 TransformationMatrix device_emulation_transform_; diff --git third_party/blink/renderer/core/page/chrome_client_impl.cc third_party/blink/renderer/core/page/chrome_client_impl.cc -index 2df0aefc5764..6ef2dae97acd 100644 +index 6d90e9c8e0be..b9e56a2f48e5 100644 --- third_party/blink/renderer/core/page/chrome_client_impl.cc +++ third_party/blink/renderer/core/page/chrome_client_impl.cc -@@ -848,7 +848,7 @@ bool ChromeClientImpl::HasOpenedPopup() const { +@@ -856,7 +856,7 @@ bool ChromeClientImpl::HasOpenedPopup() const { PopupMenu* ChromeClientImpl::OpenPopupMenu(LocalFrame& frame, HTMLSelectElement& select) { NotifyPopupOpeningObservers(); - if (WebViewImpl::UseExternalPopupMenus()) + if (web_view_->UseExternalPopupMenus()) - return MakeGarbageCollected(frame, select, *web_view_); + return MakeGarbageCollected(frame, select); DCHECK(RuntimeEnabledFeatures::PagePopupEnabled()); diff --git a/patch/patches/webui_2037.patch b/patch/patches/webui_2037.patch index a43cfee81..3dad061ac 100644 --- a/patch/patches/webui_2037.patch +++ b/patch/patches/webui_2037.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc -index 827f49d3a00f..2ddfbbab1ab7 100644 +index ab59df1d9b16..d8a853bd110c 100644 --- chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc +++ chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc @@ -21,6 +21,7 @@ @@ -10,7 +10,7 @@ index 827f49d3a00f..2ddfbbab1ab7 100644 #include "components/prefs/pref_service.h" #include "components/sync/driver/about_sync_util.h" #include "components/sync/driver/sync_service.h" -@@ -267,6 +268,10 @@ void ChromeInternalLogSource::Fetch(SysLogsSourceCallback callback) { +@@ -269,6 +270,10 @@ void ChromeInternalLogSource::Fetch(SysLogsSourceCallback callback) { } void ChromeInternalLogSource::PopulateSyncLogs(SystemLogsResponse* response) { @@ -21,7 +21,7 @@ index 827f49d3a00f..2ddfbbab1ab7 100644 // We are only interested in sync logs for the primary user profile. Profile* profile = ProfileManager::GetPrimaryUserProfile(); if (!profile || !ProfileSyncServiceFactory::HasSyncService(profile)) -@@ -309,6 +314,12 @@ void ChromeInternalLogSource::PopulateExtensionInfoLogs( +@@ -311,6 +316,12 @@ void ChromeInternalLogSource::PopulateExtensionInfoLogs( if (!profile) return; @@ -34,7 +34,7 @@ index 827f49d3a00f..2ddfbbab1ab7 100644 extensions::ExtensionRegistry* extension_registry = extensions::ExtensionRegistry::Get(profile); std::string extensions_list; -@@ -387,6 +398,8 @@ void ChromeInternalLogSource::PopulateLocalStateSettings( +@@ -389,6 +400,8 @@ void ChromeInternalLogSource::PopulateLocalStateSettings( #if defined(OS_WIN) void ChromeInternalLogSource::PopulateUsbKeyboardDetected( SystemLogsResponse* response) { @@ -44,7 +44,7 @@ index 827f49d3a00f..2ddfbbab1ab7 100644 bool result = base::win::IsKeyboardPresentOnSlate(&reason, ui::GetHiddenWindow()); diff --git chrome/browser/memory_details.cc chrome/browser/memory_details.cc -index 14b789a35c34..19a1f340a101 100644 +index 8a32ddd423c1..34abc57cc3a2 100644 --- chrome/browser/memory_details.cc +++ chrome/browser/memory_details.cc @@ -17,6 +17,7 @@ diff --git a/patch/patches/webview_plugin_2020.patch b/patch/patches/webview_plugin_2020.patch index 3a5c5ab10..5a9940a13 100644 --- a/patch/patches/webview_plugin_2020.patch +++ b/patch/patches/webview_plugin_2020.patch @@ -1,8 +1,8 @@ diff --git chrome/app/generated_resources.grd chrome/app/generated_resources.grd -index 0f25c61d5170..201f4d1c1651 100644 +index 7ba7a4d37f83..b2ca5edc150c 100644 --- chrome/app/generated_resources.grd +++ chrome/app/generated_resources.grd -@@ -4648,7 +4648,7 @@ Keep your key file in a safe place. You will need it to create new versions of y +@@ -4732,7 +4732,7 @@ Keep your key file in a safe place. You will need it to create new versions of y diff --git a/patch/patches/win_rt_2274.patch b/patch/patches/win_rt_2274.patch index 593a88bec..f28694691 100644 --- a/patch/patches/win_rt_2274.patch +++ b/patch/patches/win_rt_2274.patch @@ -1,8 +1,8 @@ diff --git services/service_manager/sandbox/win/sandbox_win.cc services/service_manager/sandbox/win/sandbox_win.cc -index d4370c2797c0..7509eb4d734d 100644 +index 5c915f75f985..f8ec8a81ce44 100644 --- services/service_manager/sandbox/win/sandbox_win.cc +++ services/service_manager/sandbox/win/sandbox_win.cc -@@ -934,8 +934,11 @@ sandbox::ResultCode SandboxWin::StartSandboxedProcess( +@@ -927,8 +927,11 @@ sandbox::ResultCode SandboxWin::StartSandboxedProcess( } // TODO(wfh): Relax strict handle checks for network process until root cause // for this crash can be resolved. See https://crbug.com/939590. diff --git a/tests/ceftests/navigation_unittest.cc b/tests/ceftests/navigation_unittest.cc index b8ee94b87..8911675b4 100644 --- a/tests/ceftests/navigation_unittest.cc +++ b/tests/ceftests/navigation_unittest.cc @@ -2063,8 +2063,11 @@ class LoadNavTestHandler : public TestHandler { // The renderer process should always be reused. EXPECT_EQ(2, renderer_load_ct_); } else { - if (mode_ == LEFT_CLICK) { + if (mode_ != LOAD) { // For left click on link the renderer process will be reused. + // For ctrl + left click or middle click on link the renderer process + // will be reused when the ProcessSharingWithDefaultSiteInstances + // feature is enabled (see https://crbug.com/958060). EXPECT_EQ(2, renderer_load_ct_); } else { // Each renderer process is only used for a single navigation. diff --git a/tests/ceftests/plugin_unittest.cc b/tests/ceftests/plugin_unittest.cc index ffd006d37..074d1ba00 100644 --- a/tests/ceftests/plugin_unittest.cc +++ b/tests/ceftests/plugin_unittest.cc @@ -128,16 +128,13 @@ class PluginTestHandler : public RoutingTestHandler, if (!handler_->got_on_before_plugin_empty_origin_) { // Checking for PDF support in the plugin frame (navigator.plugins // listing, pdf load, etc). - EXPECT_EQ(handler_->HasDirectPluginLoad(), is_main_frame); handler_->got_on_before_plugin_empty_origin_.yes(); } else if (handler_->HasNoList()) { // When listing is disabled there should be an additional check in the // main frame for the navigator.plugins listing. if (!handler_->got_on_before_plugin_empty_origin2_) { - EXPECT_EQ(true, is_main_frame); + EXPECT_TRUE(is_main_frame); handler_->got_on_before_plugin_empty_origin2_.yes(); - } else { - NOTREACHED(); } } diff --git a/tests/ceftests/print_unittest.cc b/tests/ceftests/print_unittest.cc index 87a571d8e..19a59075f 100644 --- a/tests/ceftests/print_unittest.cc +++ b/tests/ceftests/print_unittest.cc @@ -7,32 +7,6 @@ #include "include/cef_print_settings.h" #include "tests/gtest/include/gtest/gtest.h" -namespace { - -bool IsEqual(CefRefPtr expected, - CefRefPtr actual) { - if (expected->IsLandscape() != actual->IsLandscape() || - expected->GetDeviceName() != actual->GetDeviceName() || - expected->GetDPI() != actual->GetDPI() || - expected->GetPageRangesCount() != actual->GetPageRangesCount() || - expected->IsSelectionOnly() != actual->IsSelectionOnly() || - expected->WillCollate() != actual->WillCollate() || - expected->GetColorModel() != actual->GetColorModel() || - expected->GetCopies() != actual->GetCopies() || - expected->GetDuplexMode() != actual->GetDuplexMode()) { - return false; - } - - CefPrintSettings::PageRangeList expected_ranges, actual_ranges; - expected->GetPageRanges(expected_ranges); - actual->GetPageRanges(actual_ranges); - return std::equal(expected_ranges.begin(), - expected_ranges.begin() + expected_ranges.size(), - actual_ranges.begin()); -} - -} // namespace - // Verify Set/Get methods for CefPrintSettings. TEST(PrintTest, SettingsSetGet) { // CefRequest CreateRequest @@ -92,10 +66,4 @@ TEST(PrintTest, SettingsSetGet) { CefPrintSettings::DuplexMode duplex_mode = DUPLEX_MODE_SIMPLEX; settings->SetDuplexMode(duplex_mode); EXPECT_EQ(duplex_mode, settings->GetDuplexMode()); - - CefRefPtr settings2 = settings->Copy(); - EXPECT_TRUE(IsEqual(settings, settings2)); - - settings2->SetOrientation(!landscape); - EXPECT_FALSE(IsEqual(settings, settings2)); }