diff --git a/BUILD.gn b/BUILD.gn index 795bc6932..72cab3e07 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -105,6 +105,8 @@ import("//media/media_options.gni") import("//mojo/public/tools/bindings/mojom.gni") import("//ppapi/features/features.gni") import("//printing/features/features.gni") +import("//services/catalog/public/tools/catalog.gni") +import("//services/service_manager/public/service_manifest.gni") import("//third_party/icu/config.gni") import("//third_party/widevine/cdm/widevine.gni") import("//tools/grit/repack.gni") @@ -229,17 +231,6 @@ group("cef") { # libcef static target. # -# Configuration that will be applied to all targets that depend on -# libcef_static. -config("libcef_static_config") { - # CEF targets use includes relative to the CEF root directory. - include_dirs = [ "." ] - defines = [ - "BUILDING_CEF_SHARED", - "USING_CHROMIUM_INCLUDES", - ] -} - # Target for building code that accesses Blink internals. Included from the # //third_party/WebKit/Source/web target. source_set("webkit_set") { @@ -249,7 +240,7 @@ source_set("webkit_set") { ] configs += [ - ":libcef_static_config", + "libcef/features:config", "//build/config:precompiled_headers", # Blink-internal include paths. @@ -301,7 +292,7 @@ if (is_win) { ] configs += [ - ":libcef_static_config", + "libcef/features:config", "//build/config:precompiled_headers", ] @@ -491,16 +482,12 @@ static_library("libcef_static") { "libcef/browser/osr/web_contents_view_osr.cc", "libcef/browser/osr/web_contents_view_osr.h", "libcef/browser/path_util_impl.cc", - "libcef/browser/pepper/browser_pepper_host_factory.cc", - "libcef/browser/pepper/browser_pepper_host_factory.h", "libcef/browser/permissions/permission_context.cc", "libcef/browser/permissions/permission_context.h", "libcef/browser/permissions/permission_manager.cc", "libcef/browser/permissions/permission_manager.h", "libcef/browser/permissions/permission_util.cc", "libcef/browser/permissions/permission_util.h", - "libcef/browser/plugins/plugin_info_message_filter.cc", - "libcef/browser/plugins/plugin_info_message_filter.h", "libcef/browser/plugins/plugin_service_filter.cc", "libcef/browser/plugins/plugin_service_filter.h", "libcef/browser/prefs/browser_prefs.cc", @@ -642,16 +629,6 @@ static_library("libcef_static") { "libcef/renderer/extensions/print_render_frame_helper_delegate.h", "libcef/renderer/frame_impl.cc", "libcef/renderer/frame_impl.h", - "libcef/renderer/media/cef_key_systems.cc", - "libcef/renderer/media/cef_key_systems.h", - "libcef/renderer/pepper/pepper_helper.cc", - "libcef/renderer/pepper/pepper_helper.h", - "libcef/renderer/pepper/renderer_pepper_host_factory.cc", - "libcef/renderer/pepper/renderer_pepper_host_factory.h", - "libcef/renderer/plugins/cef_plugin_placeholder.cc", - "libcef/renderer/plugins/cef_plugin_placeholder.h", - "libcef/renderer/plugins/plugin_preroller.cc", - "libcef/renderer/plugins/plugin_preroller.h", "libcef/renderer/render_frame_observer.cc", "libcef/renderer/render_frame_observer.h", "libcef/renderer/render_frame_util.cc", @@ -675,7 +652,7 @@ static_library("libcef_static") { ] configs += [ - ":libcef_static_config", + "libcef/features:config", "//build/config:precompiled_headers", # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. @@ -683,7 +660,7 @@ static_library("libcef_static") { ] public_configs = [ - ":libcef_static_config", + "libcef/features:config", ] include_dirs = [ @@ -754,12 +731,13 @@ static_library("libcef_static") { "//content/public/child", "//content/public/common", "//content/public/gpu", + "//content/public/network", "//content/public/renderer", "//content/public/utility", "//crypto", "//device/base", "//device/geolocation", - "//device/hid", + "//device/geolocation/public/interfaces", "//extensions/browser", "//extensions/browser/api:api_registration", "//extensions/common/api", @@ -783,7 +761,7 @@ static_library("libcef_static") { "//skia", "//storage/browser", "//third_party/brotli:dec", - "//third_party/cld", + "//third_party/cld_3/src/src:cld_3", "//third_party/hunspell", "//third_party/leveldatabase", "//third_party/libxml", @@ -887,7 +865,7 @@ static_library("libcef_static") { } if (is_win || is_mac) { - deps += [ "//third_party/crashpad/crashpad/handler:handler_lib" ] + deps += [ "//third_party/crashpad/crashpad/handler" ] } if (use_x11) { @@ -992,6 +970,11 @@ static_library("libcef_static") { if (is_win) { sources += [ # Support for UI input events. + # Part of //base/test:test_config which is testingonly. + "//base/test/test_switches.cc", + "//base/test/test_switches.h", + "//base/test/test_timeouts.cc", + "//base/test/test_timeouts.h", # Part of //ui/aura:test_support which is testingonly. "//ui/aura/test/ui_controls_factory_aurawin.cc", # Part of //ui/base:test_support which is testingonly. @@ -1074,6 +1057,42 @@ if (is_win) { } +# +# Service manifests. +# + +cef_packaged_services = [ + "//chrome/app:chrome_manifest", # For spell checking. + "//services/metrics:manifest", +] + +service_manifest("cef_packaged_services_manifest_overlay") { + source = "libcef/common/service_manifests/packaged_services_manifest_overlay.json" + packaged_services = cef_packaged_services +} + +service_manifest("cef_browser_manifest_overlay") { + source = "libcef/common/service_manifests/browser_manifest_overlay.json" +} + +service_manifest("cef_renderer_manifest_overlay") { + source = "libcef/common/service_manifests/renderer_manifest_overlay.json" +} + +service_manifest("cef_utility_manifest_overlay") { + source = "libcef/common/service_manifests/utility_manifest_overlay.json" +} + +group("cef_manifest_overlays") { + deps = [ + ":cef_packaged_services_manifest_overlay", + ":cef_browser_manifest_overlay", + ":cef_renderer_manifest_overlay", + ":cef_utility_manifest_overlay", + ] +} + + # # Resource grit/pack targets. # @@ -1162,6 +1181,7 @@ repack("pak_extensions") { "$root_gen_dir/chrome/component_extension_resources.pak", "$root_gen_dir/extensions/extensions_renderer_resources.pak", "$root_gen_dir/extensions/extensions_resources.pak", + "$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak", "$root_gen_dir/ui/resources/webui_resources.pak", ] @@ -1172,6 +1192,7 @@ repack("pak_extensions") { "//chrome/browser/resources:component_extension_resources", "//extensions:extensions_renderer_resources", "//extensions:extensions_resources_grd", + "//mojo/public/js:resources", "//ui/resources:webui_resources_grd", ] @@ -1212,6 +1233,11 @@ grit("cef_resources") { "grit/cef_resources.h", "cef_resources.pak", ] + grit_flags = [ + "-E", + "root_gen_dir=" + rebase_path(root_gen_dir, root_build_dir), + ] + deps = [ ":cef_manifest_overlays" ] } # Generate cef.pak. @@ -1863,9 +1889,6 @@ if (is_mac) { deps += [ ":cef_sandbox", "//build/win:default_exe_manifest", - - # Tool that can be used for testing crash reporting. - "//content/shell:content_shell_crash_service", ] libs = [ diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index ba3a03e49..5ae6d4084 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -7,5 +7,5 @@ # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding { - 'chromium_checkout': 'adb61db19020ed8ecee5e91b1a0ea4c924ae2988', + 'chromium_checkout': '5fdc0fab22ce7efd32532ee989b223fa12f8171e', } diff --git a/libcef/browser/browser_context.cc b/libcef/browser/browser_context.cc index c2fe6a45f..b2d3fbc23 100644 --- a/libcef/browser/browser_context.cc +++ b/libcef/browser/browser_context.cc @@ -9,6 +9,7 @@ #include "libcef/common/extensions/extensions_util.h" #include "base/logging.h" +#include "chrome/browser/plugins/chrome_plugin_service_filter.h" #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/user_prefs/user_prefs.h" @@ -68,6 +69,9 @@ void CefBrowserContext::PostInitialize() { const bool extensions_enabled = extensions::ExtensionsEnabled(); if (extensions_enabled && !is_proxy_) extension_system_->Init(); + + ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( + this, resource_context_.get()); } void CefBrowserContext::Shutdown() { @@ -76,6 +80,9 @@ void CefBrowserContext::Shutdown() { // Send notifications to clean up objects associated with this Profile. MaybeSendDestroyedNotification(); + ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext( + resource_context_.get()); + // Remove any BrowserContextKeyedServiceFactory associations. This must be // called before the ProxyService owned by CefBrowserContextImpl is destroyed. BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( diff --git a/libcef/browser/browser_context_impl.cc b/libcef/browser/browser_context_impl.cc index 825eb371e..d3cad7e6b 100644 --- a/libcef/browser/browser_context_impl.cc +++ b/libcef/browser/browser_context_impl.cc @@ -389,10 +389,11 @@ bool CefBrowserContextImpl::IsOffTheRecord() const { content::DownloadManagerDelegate* CefBrowserContextImpl::GetDownloadManagerDelegate() { - DCHECK(!download_manager_delegate_.get()); - - content::DownloadManager* manager = BrowserContext::GetDownloadManager(this); - download_manager_delegate_.reset(new CefDownloadManagerDelegate(manager)); + if (!download_manager_delegate_) { + content::DownloadManager* manager = + BrowserContext::GetDownloadManager(this); + download_manager_delegate_.reset(new CefDownloadManagerDelegate(manager)); + } return download_manager_delegate_.get(); } diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index e55dc4c9f..8c0919b41 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -68,6 +68,7 @@ #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/common/browser_side_navigation_policy.h" #include "content/public/common/favicon_url.h" #include "extensions/browser/process_manager.h" #include "net/base/net_errors.h" @@ -2727,8 +2728,12 @@ void CefBrowserHostImpl::DidFinishNavigation( // With PlzNavigate the RenderFrameHost will only be nullptr if the // provisional load fails, in which case |error_code| will be ERR_ABORTED. + // Without PlzNavigate the RenderFrameHost may be nullptr and |error_code| + // may be OK when a pending navigation is canceled (e.g. by calling LoadURL + // from OnCertificateError). DCHECK(navigation_handle->GetRenderFrameHost() || - error_code == net::ERR_ABORTED); + error_code == net::ERR_ABORTED || + !content::IsBrowserSideNavigationEnabled()); const int64 frame_id = navigation_handle->GetRenderFrameHost() diff --git a/libcef/browser/browser_main.cc b/libcef/browser/browser_main.cc index b1b90a408..161eb2844 100644 --- a/libcef/browser/browser_main.cc +++ b/libcef/browser/browser_main.cc @@ -9,7 +9,6 @@ #include #include "libcef/browser/browser_context_impl.h" -#include "libcef/browser/browser_context_proxy.h" #include "libcef/browser/browser_message_loop.h" #include "libcef/browser/content_browser_client.h" #include "libcef/browser/context.h" @@ -25,16 +24,10 @@ #include "libcef/common/net/net_resource_provider.h" #include "base/bind.h" -#include "base/command_line.h" #include "base/message_loop/message_loop.h" #include "base/strings/string_number_conversions.h" #include "chrome/browser/plugins/plugin_finder.h" -#include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/gpu_data_manager.h" -#include "content/public/common/content_switches.h" -#include "device/geolocation/access_token_store.h" -#include "device/geolocation/geolocation_delegate.h" -#include "device/geolocation/geolocation_provider.h" #include "extensions/browser/extension_system.h" #include "extensions/common/constants.h" #include "net/base/net_module.h" diff --git a/libcef/browser/chrome_browser_process_stub.cc b/libcef/browser/chrome_browser_process_stub.cc index ef2486158..d2a5919c5 100644 --- a/libcef/browser/chrome_browser_process_stub.cc +++ b/libcef/browser/chrome_browser_process_stub.cc @@ -96,12 +96,7 @@ metrics::MetricsService* ChromeBrowserProcessStub::metrics_service() { } rappor::RapporServiceImpl* ChromeBrowserProcessStub::rappor_service() { - NOTREACHED(); - return NULL; -} - -ukm::UkmRecorder* ChromeBrowserProcessStub::ukm_recorder() { - NOTREACHED(); + // Called from PluginInfoHostImpl::ReportMetrics. return NULL; } @@ -115,6 +110,12 @@ ChromeBrowserProcessStub::system_network_context_manager() { return NULL; } +content::NetworkConnectionTracker* +ChromeBrowserProcessStub::network_connection_tracker() { + NOTREACHED(); + return NULL; +} + WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() { NOTREACHED(); return NULL; @@ -285,6 +286,12 @@ ChromeBrowserProcessStub::subresource_filter_ruleset_service() { return NULL; } +optimization_guide::OptimizationGuideService* +ChromeBrowserProcessStub::optimization_guide_service() { + NOTREACHED(); + return NULL; +} + #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) void ChromeBrowserProcessStub::StartAutoupdateTimer() {} #endif @@ -311,11 +318,6 @@ ChromeBrowserProcessStub::component_updater() { return NULL; } -CRLSetFetcher* ChromeBrowserProcessStub::crl_set_fetcher() { - NOTREACHED(); - return NULL; -} - component_updater::SupervisedUserWhitelistInstaller* ChromeBrowserProcessStub::supervised_user_whitelist_installer() { NOTREACHED(); diff --git a/libcef/browser/chrome_browser_process_stub.h b/libcef/browser/chrome_browser_process_stub.h index 06bb88d04..fdcb65d53 100644 --- a/libcef/browser/chrome_browser_process_stub.h +++ b/libcef/browser/chrome_browser_process_stub.h @@ -47,9 +47,9 @@ class ChromeBrowserProcessStub : public BrowserProcess, override; metrics::MetricsService* metrics_service() override; rappor::RapporServiceImpl* rappor_service() override; - ukm::UkmRecorder* ukm_recorder() override; IOThread* io_thread() override; SystemNetworkContextManager* system_network_context_manager() override; + content::NetworkConnectionTracker* network_connection_tracker() override; WatchDogThread* watchdog_thread() override; ProfileManager* profile_manager() override; PrefService* local_state() override; @@ -87,6 +87,8 @@ class ChromeBrowserProcessStub : public BrowserProcess, override; subresource_filter::ContentRulesetService* subresource_filter_ruleset_service() override; + optimization_guide::OptimizationGuideService* optimization_guide_service() + override; #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) void StartAutoupdateTimer() override; @@ -94,7 +96,6 @@ class ChromeBrowserProcessStub : public BrowserProcess, net_log::ChromeNetLog* net_log() override; component_updater::ComponentUpdateService* component_updater() override; - CRLSetFetcher* crl_set_fetcher() override; component_updater::SupervisedUserWhitelistInstaller* supervised_user_whitelist_installer() override; MediaFileSystemRegistry* media_file_system_registry() override; diff --git a/libcef/browser/chrome_profile_stub.cc b/libcef/browser/chrome_profile_stub.cc index bf651d56c..726256598 100644 --- a/libcef/browser/chrome_profile_stub.cc +++ b/libcef/browser/chrome_profile_stub.cc @@ -33,7 +33,6 @@ void ChromeProfileStub::DestroyOffTheRecordProfile() { } bool ChromeProfileStub::HasOffTheRecordProfile() { - NOTREACHED(); return false; } @@ -41,6 +40,10 @@ Profile* ChromeProfileStub::GetOriginalProfile() { return this; } +const Profile* ChromeProfileStub::GetOriginalProfile() const { + return this; +} + bool ChromeProfileStub::IsSupervised() const { return false; } @@ -107,12 +110,6 @@ chrome_browser_net::Predictor* ChromeProfileStub::GetNetworkPredictor() { return NULL; } -void ChromeProfileStub::ClearNetworkingHistorySince( - base::Time time, - const base::Closure& completion) { - NOTREACHED(); -} - GURL ChromeProfileStub::GetHomePage() { NOTREACHED(); return GURL(); diff --git a/libcef/browser/chrome_profile_stub.h b/libcef/browser/chrome_profile_stub.h index fafde9101..c9d4f0f0f 100644 --- a/libcef/browser/chrome_profile_stub.h +++ b/libcef/browser/chrome_profile_stub.h @@ -27,6 +27,7 @@ class ChromeProfileStub : public Profile { void DestroyOffTheRecordProfile() override; bool HasOffTheRecordProfile() override; Profile* GetOriginalProfile() override; + const Profile* GetOriginalProfile() const override; bool IsSupervised() const override; bool IsChild() const override; bool IsLegacySupervised() const override; @@ -40,8 +41,6 @@ class ChromeProfileStub : public Profile { void set_last_selected_directory(const base::FilePath& path) override; PrefProxyConfigTracker* GetProxyConfigTracker() override; chrome_browser_net::Predictor* GetNetworkPredictor() override; - void ClearNetworkingHistorySince(base::Time time, - const base::Closure& completion) override; GURL GetHomePage() override; bool WasCreatedByVersionOrLater(const std::string& version) override; void SetExitType(ExitType exit_type) override; diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc index de5f4dccd..d32238132 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/content_browser_client.cc @@ -19,8 +19,6 @@ #include "libcef/browser/extensions/extension_system.h" #include "libcef/browser/media_capture_devices_dispatcher.h" #include "libcef/browser/net/chrome_scheme_handler.h" -#include "libcef/browser/pepper/browser_pepper_host_factory.h" -#include "libcef/browser/plugins/plugin_info_message_filter.h" #include "libcef/browser/plugins/plugin_service_filter.h" #include "libcef/browser/prefs/renderer_prefs.h" #include "libcef/browser/printing/printing_message_filter.h" @@ -43,9 +41,12 @@ #include "base/json/json_reader.h" #include "base/path_service.h" #include "cef/grit/cef_resources.h" +#include "chrome/browser/chrome_service.h" +#include "chrome/browser/plugins/plugin_info_host_impl.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/spellchecker/spell_check_host_impl.h" +#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/constants.mojom.h" #include "chrome/grit/browser_resources.h" #include "components/navigation_interception/intercept_navigation_throttle.h" #include "components/navigation_interception/navigation_params.h" @@ -81,6 +82,8 @@ #include "extensions/common/switches.h" #include "net/ssl/ssl_cert_request_info.h" #include "ppapi/host/ppapi_host.h" +#include "services/metrics/metrics_mojo_service.h" +#include "services/metrics/public/interfaces/constants.mojom.h" #include "storage/browser/quota/quota_settings.h" #include "third_party/WebKit/public/web/WebWindowFeatures.h" #include "ui/base/resource/resource_bundle.h" @@ -471,9 +474,6 @@ void CefContentBrowserClient::RenderProcessWillLaunch( } #endif - host->AddFilter(new CefPluginInfoMessageFilter( - id, static_cast(profile))); - if (extensions::ExtensionsEnabled()) { host->AddFilter(new extensions::ExtensionMessageFilter(id, profile)); host->AddFilter( @@ -587,6 +587,21 @@ void CefContentBrowserClient::SiteInstanceDeleting( site_instance->GetId())); } +void CefContentBrowserClient::RegisterInProcessServices(StaticServiceMap* services) { + { + // For spell checking. + service_manager::EmbeddedServiceInfo info; + info.factory = base::Bind(&ChromeService::Create); + services->insert(std::make_pair(chrome::mojom::kServiceName, info)); + } + { + // For metrics. + service_manager::EmbeddedServiceInfo info; + info.factory = base::Bind(&metrics::CreateMetricsService); + services->emplace(metrics::mojom::kMetricsServiceName, info); + } +} + void CefContentBrowserClient::RegisterOutOfProcessServices( OutOfProcessServiceMap* services) { (*services)[printing::mojom::kServiceName] = @@ -598,6 +613,8 @@ std::unique_ptr CefContentBrowserClient::GetServiceManifestOverlay( int id = -1; if (name == content::mojom::kBrowserServiceName) id = IDR_CEF_BROWSER_MANIFEST_OVERLAY; + else if (name == content::mojom::kPackagedServicesServiceName) + id = IDR_CEF_PACKAGED_SERVICES_MANIFEST_OVERLAY; else if (name == content::mojom::kRendererServiceName) id = IDR_CEF_RENDERER_MANIFEST_OVERLAY; else if (name == content::mojom::kUtilityServiceName) @@ -890,7 +907,7 @@ void CefContentBrowserClient::DidCreatePpapiPlugin( content::BrowserPpapiHost* browser_host) { browser_host->GetPpapiHost()->AddHostFactoryFilter( std::unique_ptr( - new CefBrowserPepperHostFactory(browser_host))); + new ChromeBrowserPepperHostFactory(browser_host))); } content::DevToolsManagerDelegate* @@ -935,7 +952,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation( return throttles; } -#if defined(OS_POSIX) && !defined(OS_MACOSX) +#if defined(OS_LINUX) void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line, int child_process_id, @@ -945,7 +962,7 @@ void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess( mappings->Share(kCrashDumpSignal, crash_signal_fd); } } -#endif // defined(OS_POSIX) && !defined(OS_MACOSX) +#endif // defined(OS_LINUX) #if defined(OS_WIN) const wchar_t* CefContentBrowserClient::GetResourceDllName() { @@ -971,18 +988,12 @@ bool CefContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy) { void CefContentBrowserClient::ExposeInterfacesToRenderer( service_manager::BinderRegistry* registry, - content::AssociatedInterfaceRegistry* associated_registry, - content::RenderProcessHost* render_process_host) { - const base::CommandLine* command_line = - base::CommandLine::ForCurrentProcess(); - scoped_refptr ui_task_runner = - content::BrowserThread::GetTaskRunnerForThread( - content::BrowserThread::UI); - if (!command_line->HasSwitch(switches::kDisableSpellChecking)) { - registry->AddInterface( - base::Bind(&SpellCheckHostImpl::Create, render_process_host->GetID()), - ui_task_runner); - } + 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))); } void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) { diff --git a/libcef/browser/content_browser_client.h b/libcef/browser/content_browser_client.h index 48b2a7536..945f0a3a2 100644 --- a/libcef/browser/content_browser_client.h +++ b/libcef/browser/content_browser_client.h @@ -49,6 +49,7 @@ 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 RegisterInProcessServices(StaticServiceMap* services) override; void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override; std::unique_ptr GetServiceManifestOverlay( base::StringPiece name) override; @@ -104,7 +105,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient { CreateThrottlesForNavigation( content::NavigationHandle* navigation_handle) override; -#if defined(OS_POSIX) && !defined(OS_MACOSX) +#if defined(OS_LINUX) void GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line, int child_process_id, @@ -118,7 +119,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient { void ExposeInterfacesToRenderer( service_manager::BinderRegistry* registry, - content::AssociatedInterfaceRegistry* associated_registry, + blink::AssociatedInterfaceRegistry* associated_registry, content::RenderProcessHost* render_process_host) override; // Perform browser process registration for the custom scheme. diff --git a/libcef/browser/cookie_manager_impl.cc b/libcef/browser/cookie_manager_impl.cc index 3f6572a7c..27f1240ca 100644 --- a/libcef/browser/cookie_manager_impl.cc +++ b/libcef/browser/cookie_manager_impl.cc @@ -564,13 +564,15 @@ void CefCookieManagerImpl::SetCookieInternal( if (cookie.has_expires) cef_time_to_basetime(cookie.expires, expiration_time); - cookie_store->SetCookieWithDetailsAsync( - url, name, value, domain, path, - base::Time(), // Creation time. - expiration_time, - base::Time(), // Last access time. + cookie_store->SetCanonicalCookieAsync( + net::CanonicalCookie::CreateSanitizedCookie( + url, name, value, domain, path, + base::Time(), // Creation time. + expiration_time, + base::Time(), // Last access time. + cookie.secure ? true : false, cookie.httponly ? true : false, + net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT), cookie.secure ? true : false, cookie.httponly ? true : false, - net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT, base::Bind(SetCookieCallbackImpl, callback)); } diff --git a/libcef/browser/devtools_frontend.cc b/libcef/browser/devtools_frontend.cc index bcf356e2e..fd0d74efa 100644 --- a/libcef/browser/devtools_frontend.cc +++ b/libcef/browser/devtools_frontend.cc @@ -455,8 +455,7 @@ void CefDevToolsFrontend::SendMessageAck(int request_id, } void CefDevToolsFrontend::AgentHostClosed( - content::DevToolsAgentHost* agent_host, - bool replaced) { + content::DevToolsAgentHost* agent_host) { DCHECK(agent_host == agent_host_.get()); agent_host_ = nullptr; Close(); diff --git a/libcef/browser/devtools_frontend.h b/libcef/browser/devtools_frontend.h index b4be435c0..40ed072fe 100644 --- a/libcef/browser/devtools_frontend.h +++ b/libcef/browser/devtools_frontend.h @@ -65,8 +65,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver, ~CefDevToolsFrontend() override; // content::DevToolsAgentHostClient implementation. - void AgentHostClosed(content::DevToolsAgentHost* agent_host, - bool replaced) override; + void AgentHostClosed(content::DevToolsAgentHost* agent_host) override; void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host, const std::string& message) override; void SetPreferences(const std::string& json); diff --git a/libcef/browser/devtools_manager_delegate.cc b/libcef/browser/devtools_manager_delegate.cc index 3b3f3b954..6b61f3806 100644 --- a/libcef/browser/devtools_manager_delegate.cc +++ b/libcef/browser/devtools_manager_delegate.cc @@ -107,6 +107,11 @@ void CefDevToolsManagerDelegate::StartHttpHandler( content::DevToolsAgentHost::StartRemoteDebuggingServer( std::move(socket_factory), std::string(), browser_context->GetPath(), base::FilePath()); + + const base::CommandLine& command_line = + *base::CommandLine::ForCurrentProcess(); + if (command_line.HasSwitch(switches::kRemoteDebuggingPipe)) + content::DevToolsAgentHost::StartRemoteDebuggingPipeHandler(); } // static diff --git a/libcef/browser/extensions/api/tabs/tabs_api.cc b/libcef/browser/extensions/api/tabs/tabs_api.cc index ac9c2495a..ff0d6f64d 100644 --- a/libcef/browser/extensions/api/tabs/tabs_api.cc +++ b/libcef/browser/extensions/api/tabs/tabs_api.cc @@ -231,7 +231,8 @@ bool ExecuteCodeInTabFunction::LoadFile(const std::string& file) { void ExecuteCodeInTabFunction::LoadFileComplete( const std::string& file, std::unique_ptr data) { - DidLoadAndLocalizeFile(file, !!data.get(), std::move(data)); + const bool success = !!data.get(); + DidLoadAndLocalizeFile(file, success, std::move(data)); } bool TabsExecuteScriptFunction::ShouldInsertCSS() const { diff --git a/libcef/browser/extensions/browser_context_keyed_service_factories.cc b/libcef/browser/extensions/browser_context_keyed_service_factories.cc index c5bd27c45..19a9178d0 100644 --- a/libcef/browser/extensions/browser_context_keyed_service_factories.cc +++ b/libcef/browser/extensions/browser_context_keyed_service_factories.cc @@ -6,6 +6,9 @@ #include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/extensions/api/streams_private/streams_private_api.h" +#include "chrome/browser/plugins/plugin_prefs_factory.h" +#include "chrome/browser/spellchecker/spellcheck_factory.h" +#include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/ui/prefs/prefs_tab_helper.h" #include "extensions/browser/api/alarms/alarm_manager.h" #include "extensions/browser/api/storage/storage_frontend.h" @@ -17,10 +20,13 @@ namespace cef { void EnsureBrowserContextKeyedServiceFactoriesBuilt() { AlarmManager::GetFactoryInstance(); CookieSettingsFactory::GetInstance(); + PluginPrefsFactory::GetInstance(); PrefsTabHelper::GetServiceInstance(); RendererStartupHelperFactory::GetInstance(); + SpellcheckServiceFactory::GetInstance(); StorageFrontend::GetFactoryInstance(); StreamsPrivateAPI::GetFactoryInstance(); + ThemeServiceFactory::GetInstance(); } } // namespace cef diff --git a/libcef/browser/extensions/extension_function_details.cc b/libcef/browser/extensions/extension_function_details.cc index 5efc4a712..66134d99d 100644 --- a/libcef/browser/extensions/extension_function_details.cc +++ b/libcef/browser/extensions/extension_function_details.cc @@ -92,7 +92,7 @@ class CefGetExtensionLoadFileCallbackImpl static std::unique_ptr LoadFileFromStream( const std::string& file, CefRefPtr stream) { - base::ThreadRestrictions::AssertIOAllowed(); + base::AssertBlockingAllowed(); // Move to the end of the stream. stream->Seek(0, SEEK_END); diff --git a/libcef/browser/extensions/extension_system.cc b/libcef/browser/extensions/extension_system.cc index 28b36816d..51d7ce8e7 100644 --- a/libcef/browser/extensions/extension_system.cc +++ b/libcef/browser/extensions/extension_system.cc @@ -112,7 +112,7 @@ void LoadExtensionWithManifest(base::WeakPtr context, bool internal, CefRefPtr loader_context, CefRefPtr handler) { - base::ThreadRestrictions::AssertIOAllowed(); + base::AssertBlockingAllowed(); std::unique_ptr manifest = ParseManifest(manifest_contents); @@ -131,7 +131,7 @@ void LoadExtensionFromDisk(base::WeakPtr context, bool internal, CefRefPtr loader_context, CefRefPtr handler) { - base::ThreadRestrictions::AssertIOAllowed(); + base::AssertBlockingAllowed(); base::FilePath manifest_path = root_directory.AppendASCII("manifest.json"); std::string manifest_contents; diff --git a/libcef/browser/extensions/extension_web_contents_observer.cc b/libcef/browser/extensions/extension_web_contents_observer.cc index 674c46732..96a8882c7 100644 --- a/libcef/browser/extensions/extension_web_contents_observer.cc +++ b/libcef/browser/extensions/extension_web_contents_observer.cc @@ -36,8 +36,8 @@ void CefExtensionWebContentsObserver::RenderFrameCreated( // are allowed to use chrome://resources/ URLs. if ((extension->is_extension() || extension->is_platform_app()) && Manifest::IsComponentLocation(extension->location())) { - policy->GrantOrigin(process_id, - url::Origin(GURL(content::kChromeUIResourcesURL))); + policy->GrantOrigin( + process_id, url::Origin::Create(GURL(content::kChromeUIResourcesURL))); } } diff --git a/libcef/browser/extensions/extensions_browser_client.cc b/libcef/browser/extensions/extensions_browser_client.cc index 9a9842c9b..f1f61ff8d 100644 --- a/libcef/browser/extensions/extensions_browser_client.cc +++ b/libcef/browser/extensions/extensions_browser_client.cc @@ -124,10 +124,14 @@ CefExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob( } bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad( - net::URLRequest* request, + const GURL& url, + content::ResourceType resource_type, + ui::PageTransition page_transition, + int child_id, bool is_incognito, const Extension* extension, - InfoMap* extension_info_map) { + const ExtensionSet& extensions, + const ProcessMap& process_map) { // TODO(cef): This bypasses additional checks added to // AllowCrossRendererResourceLoad() in https://crrev.com/5cf9d45c. Figure out // why permission is not being granted based on "web_accessible_resources" @@ -137,7 +141,8 @@ bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad( bool allowed = false; if (url_request_util::AllowCrossRendererResourceLoad( - request, is_incognito, extension, extension_info_map, &allowed)) { + url, resource_type, page_transition, child_id, is_incognito, + extension, extensions, process_map, &allowed)) { return allowed; } diff --git a/libcef/browser/extensions/extensions_browser_client.h b/libcef/browser/extensions/extensions_browser_client.h index 4989c0bb6..5c74953df 100644 --- a/libcef/browser/extensions/extensions_browser_client.h +++ b/libcef/browser/extensions/extensions_browser_client.h @@ -51,10 +51,14 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient { const base::FilePath& directory_path, const std::string& content_security_policy, bool send_cors_header) override; - bool AllowCrossRendererResourceLoad(net::URLRequest* request, + bool AllowCrossRendererResourceLoad(const GURL& url, + content::ResourceType resource_type, + ui::PageTransition page_transition, + int child_id, bool is_incognito, const Extension* extension, - InfoMap* extension_info_map) override; + const ExtensionSet& extensions, + const ProcessMap& process_map) override; PrefService* GetPrefServiceForContext( content::BrowserContext* context) override; void GetEarlyExtensionPrefsObservers( diff --git a/libcef/browser/extensions/value_store/cef_value_store.cc b/libcef/browser/extensions/value_store/cef_value_store.cc index 0f4240762..6320782cf 100644 --- a/libcef/browser/extensions/value_store/cef_value_store.cc +++ b/libcef/browser/extensions/value_store/cef_value_store.cc @@ -10,10 +10,26 @@ #include "base/logging.h" #include "base/memory/ptr_util.h" +namespace { + +const char kGenericErrorMessage[] = "CefValueStore configured to error"; + +// Having this utility function allows ValueStore::Status to not have a copy +// constructor. +ValueStore::Status CreateStatusCopy(const ValueStore::Status& status) { + return ValueStore::Status(status.code, status.restore_status, status.message); +} + +} // namespace + CefValueStore::CefValueStore() : read_count_(0), write_count_(0) {} CefValueStore::~CefValueStore() {} +void CefValueStore::set_status_code(StatusCode status_code) { + status_ = ValueStore::Status(status_code, kGenericErrorMessage); +} + size_t CefValueStore::GetBytesInUse(const std::string& key) { // Let SettingsStorageQuotaEnforcer implement this. NOTREACHED(); @@ -39,7 +55,10 @@ ValueStore::ReadResult CefValueStore::Get(const std::string& key) { ValueStore::ReadResult CefValueStore::Get( const std::vector& keys) { read_count_++; - base::DictionaryValue* settings = new base::DictionaryValue(); + if (!status_.ok()) + return ReadResult(CreateStatusCopy(status_)); + + auto settings = std::make_unique(); for (std::vector::const_iterator it = keys.begin(); it != keys.end(); ++it) { base::Value* value = NULL; @@ -47,12 +66,14 @@ ValueStore::ReadResult CefValueStore::Get( settings->SetWithoutPathExpansion(*it, value->CreateDeepCopy()); } } - return MakeReadResult(base::WrapUnique(settings), status_); + return ReadResult(std::move(settings), CreateStatusCopy(status_)); } ValueStore::ReadResult CefValueStore::Get() { read_count_++; - return MakeReadResult(storage_.CreateDeepCopy(), status_); + if (!status_.ok()) + return ReadResult(CreateStatusCopy(status_)); + return ReadResult(storage_.CreateDeepCopy(), CreateStatusCopy(status_)); } ValueStore::WriteResult CefValueStore::Set(WriteOptions options, @@ -67,6 +88,9 @@ ValueStore::WriteResult CefValueStore::Set( WriteOptions options, const base::DictionaryValue& settings) { write_count_++; + if (!status_.ok()) + return WriteResult(CreateStatusCopy(status_)); + std::unique_ptr changes(new ValueStoreChangeList()); for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd(); it.Advance()) { @@ -79,7 +103,7 @@ ValueStore::WriteResult CefValueStore::Set( storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy()); } } - return MakeWriteResult(std::move(changes), status_); + return WriteResult(std::move(changes), CreateStatusCopy(status_)); } ValueStore::WriteResult CefValueStore::Remove(const std::string& key) { @@ -89,6 +113,9 @@ ValueStore::WriteResult CefValueStore::Remove(const std::string& key) { ValueStore::WriteResult CefValueStore::Remove( const std::vector& keys) { write_count_++; + if (!status_.ok()) + return WriteResult(CreateStatusCopy(status_)); + std::unique_ptr changes(new ValueStoreChangeList()); for (std::vector::const_iterator it = keys.begin(); it != keys.end(); ++it) { @@ -97,7 +124,7 @@ ValueStore::WriteResult CefValueStore::Remove( changes->push_back(ValueStoreChange(*it, std::move(old_value), nullptr)); } } - return MakeWriteResult(std::move(changes), status_); + return WriteResult(std::move(changes), CreateStatusCopy(status_)); } ValueStore::WriteResult CefValueStore::Clear() { @@ -107,4 +134,4 @@ ValueStore::WriteResult CefValueStore::Clear() { keys.push_back(it.key()); } return Remove(keys); -} +} \ No newline at end of file diff --git a/libcef/browser/extensions/value_store/cef_value_store.h b/libcef/browser/extensions/value_store/cef_value_store.h index c9fc6332e..c76b46f3d 100644 --- a/libcef/browser/extensions/value_store/cef_value_store.h +++ b/libcef/browser/extensions/value_store/cef_value_store.h @@ -31,6 +31,10 @@ class CefValueStore : public ValueStore { int read_count() const { return read_count_; } int write_count() const { return write_count_; } + // Sets the error code for requests. If OK, errors won't be thrown. + // Defaults to OK. + void set_status_code(StatusCode status_code); + // ValueStore implementation. size_t GetBytesInUse(const std::string& key) override; size_t GetBytesInUse(const std::vector& keys) override; diff --git a/libcef/browser/geolocation_impl.cc b/libcef/browser/geolocation_impl.cc index 5d4ac62a2..ec6ff5b85 100644 --- a/libcef/browser/geolocation_impl.cc +++ b/libcef/browser/geolocation_impl.cc @@ -9,7 +9,7 @@ #include "base/logging.h" #include "device/geolocation/geolocation_provider.h" -#include "device/geolocation/geoposition.h" +#include "device/geolocation/public/interfaces/geoposition.mojom.h" namespace { @@ -31,7 +31,7 @@ class CefLocationRequest ~CefLocationRequest() {} - void OnLocationUpdate(const device::Geoposition& position) { + void OnLocationUpdate(const device::mojom::Geoposition& position) { CEF_REQUIRE_UIT(); if (callback_.get()) { CefGeoposition cef_position; @@ -43,7 +43,8 @@ class CefLocationRequest geo_callback_.Reset(); } - void SetPosition(const device::Geoposition& source, CefGeoposition& target) { + void SetPosition(const device::mojom::Geoposition& source, + CefGeoposition& target) { target.latitude = source.latitude; target.longitude = source.longitude; target.altitude = source.altitude; @@ -54,16 +55,16 @@ class CefLocationRequest cef_time_from_basetime(source.timestamp, target.timestamp); switch (source.error_code) { - case device::Geoposition::ERROR_CODE_NONE: + case device::mojom::Geoposition::ErrorCode::NONE: target.error_code = GEOPOSITON_ERROR_NONE; break; - case device::Geoposition::ERROR_CODE_PERMISSION_DENIED: + case device::mojom::Geoposition::ErrorCode::PERMISSION_DENIED: target.error_code = GEOPOSITON_ERROR_PERMISSION_DENIED; break; - case device::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE: + case device::mojom::Geoposition::ErrorCode::POSITION_UNAVAILABLE: target.error_code = GEOPOSITON_ERROR_POSITION_UNAVAILABLE; break; - case device::Geoposition::ERROR_CODE_TIMEOUT: + case device::mojom::Geoposition::ErrorCode::TIMEOUT: target.error_code = GEOPOSITON_ERROR_TIMEOUT; break; } diff --git a/libcef/browser/javascript_dialog_manager.cc b/libcef/browser/javascript_dialog_manager.cc index 41d1449e6..556905339 100644 --- a/libcef/browser/javascript_dialog_manager.cc +++ b/libcef/browser/javascript_dialog_manager.cc @@ -137,6 +137,7 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog( void CefJavaScriptDialogManager::RunBeforeUnloadDialog( content::WebContents* web_contents, + content::RenderFrameHost* render_frame_host, bool is_reload, DialogClosedCallback callback) { if (browser_->destruction_state() >= diff --git a/libcef/browser/javascript_dialog_manager.h b/libcef/browser/javascript_dialog_manager.h index 5307ed1cd..ca179207b 100644 --- a/libcef/browser/javascript_dialog_manager.h +++ b/libcef/browser/javascript_dialog_manager.h @@ -36,6 +36,7 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager { DialogClosedCallback callback, bool* did_suppress_message) override; void RunBeforeUnloadDialog(content::WebContents* web_contents, + content::RenderFrameHost* render_frame_host, bool is_reload, DialogClosedCallback callback) override; void CancelDialogs(content::WebContents* web_contents, diff --git a/libcef/browser/native/browser_platform_delegate_native_win.cc b/libcef/browser/native/browser_platform_delegate_native_win.cc index 46e675390..3d7445fee 100644 --- a/libcef/browser/native/browser_platform_delegate_native_win.cc +++ b/libcef/browser/native/browser_platform_delegate_native_win.cc @@ -95,23 +95,6 @@ void ExecuteExternalProtocol(const GURL& url) { ShellExecuteA(NULL, "open", address.c_str(), NULL, NULL, SW_SHOWNORMAL); } -WORD KeyStatesToWord() { - static const USHORT kHighBitMaskShort = 0x8000; - WORD result = 0; - - if (GetKeyState(VK_CONTROL) & kHighBitMaskShort) - result |= MK_CONTROL; - if (GetKeyState(VK_SHIFT) & kHighBitMaskShort) - result |= MK_SHIFT; - if (GetKeyState(VK_LBUTTON) & kHighBitMaskShort) - result |= MK_LBUTTON; - if (GetKeyState(VK_MBUTTON) & kHighBitMaskShort) - result |= MK_MBUTTON; - if (GetKeyState(VK_RBUTTON) & kHighBitMaskShort) - result |= MK_RBUTTON; - return result; -} - } // namespace CefBrowserPlatformDelegateNativeWin::CefBrowserPlatformDelegateNativeWin( @@ -387,8 +370,9 @@ void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent( // TODO(cef): CefKeyEvent does not currently pass extended key status (see // WM_KEYDOWN docs) which would be necessary to pass EF_IS_EXTENDED_KEY as // the |flags| parameter to DomKeyFromKeyboardCode(). + int flags = 0; result.dom_key = ui::PlatformKeyMap::DomKeyFromKeyboardCode( - ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), 0); + ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), &flags); } if (result.GetType() == blink::WebInputEvent::kChar || diff --git a/libcef/browser/native/file_dialog_runner_win.cc b/libcef/browser/native/file_dialog_runner_win.cc index 73eeee877..50d097d39 100644 --- a/libcef/browser/native/file_dialog_runner_win.cc +++ b/libcef/browser/native/file_dialog_runner_win.cc @@ -7,6 +7,7 @@ #include #include +#include #include "libcef/browser/browser_host_impl.h" @@ -15,7 +16,6 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/win/registry.h" -#include "base/win/scoped_comptr.h" #include "cef/grit/cef_strings.h" #include "chrome/grit/generated_resources.h" #include "net/base/mime_util.h" @@ -395,7 +395,7 @@ bool RunOpenFolderDialog(const CefFileDialogRunner::FileChooserParams& params, STRRET out_dir_buffer; ZeroMemory(&out_dir_buffer, sizeof(out_dir_buffer)); out_dir_buffer.uType = STRRET_WSTR; - base::win::ScopedComPtr shell_folder; + Microsoft::WRL::ComPtr shell_folder; if (SHGetDesktopFolder(shell_folder.GetAddressOf()) == NOERROR) { HRESULT hr = shell_folder->GetDisplayNameOf(list, SHGDN_FORPARSING, &out_dir_buffer); diff --git a/libcef/browser/native/menu_runner_mac.h b/libcef/browser/native/menu_runner_mac.h index 396df5d55..8cb6a6d7c 100644 --- a/libcef/browser/native/menu_runner_mac.h +++ b/libcef/browser/native/menu_runner_mac.h @@ -11,9 +11,9 @@ #include "base/mac/scoped_nsobject.h" #if __OBJC__ -@class MenuController; +@class MenuControllerCocoa; #else -class MenuController; +class MenuControllerCocoa; #endif class CefMenuRunnerMac : public CefMenuRunner { @@ -28,7 +28,7 @@ class CefMenuRunnerMac : public CefMenuRunner { void CancelContextMenu() override; private: - base::scoped_nsobject menu_controller_; + base::scoped_nsobject menu_controller_; }; #endif // CEF_LIBCEF_BROWSER_NATIVE_MENU_RUNNER_MAC_H_ diff --git a/libcef/browser/native/menu_runner_mac.mm b/libcef/browser/native/menu_runner_mac.mm index de4b733b2..eb39f87b7 100644 --- a/libcef/browser/native/menu_runner_mac.mm +++ b/libcef/browser/native/menu_runner_mac.mm @@ -21,14 +21,16 @@ bool CefMenuRunnerMac::RunContextMenu( CefMenuModelImpl* model, const content::ContextMenuParams& params) { // Create a menu controller based on the model. - menu_controller_.reset([[MenuController alloc] initWithModel:model->model() - useWithPopUpButtonCell:NO]); + menu_controller_.reset([[MenuControllerCocoa alloc] + initWithModel:model->model() + useWithPopUpButtonCell:NO]); // Keep the menu controller alive (by adding an additional retain) until after // the menu has been dismissed. Otherwise it will crash if the browser is // destroyed (and consequently the menu controller is destroyed) while the // menu is still pending. - base::scoped_nsobject menu_controller_ref(menu_controller_); + base::scoped_nsobject menu_controller_ref( + menu_controller_); // Make sure events can be pumped while the menu is up. base::MessageLoop::ScopedNestableTaskAllower allow( diff --git a/libcef/browser/native/native_menu_win.cc b/libcef/browser/native/native_menu_win.cc index a2a50e721..9afe393c6 100644 --- a/libcef/browser/native/native_menu_win.cc +++ b/libcef/browser/native/native_menu_win.cc @@ -109,7 +109,7 @@ static CefNativeMenuWin* GetCefNativeMenuWinFromHMENU(HMENU hmenu) { // structure we have constructed in CefNativeMenuWin. class CefNativeMenuWin::MenuHostWindow { public: - explicit MenuHostWindow(CefNativeMenuWin* parent) : parent_(parent) { + MenuHostWindow() { RegisterClass(); hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName, L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); @@ -389,7 +389,6 @@ class CefNativeMenuWin::MenuHostWindow { } HWND hwnd_; - CefNativeMenuWin* parent_; DISALLOW_COPY_AND_ASSIGN(MenuHostWindow); }; @@ -775,7 +774,7 @@ void CefNativeMenuWin::CreateHostWindow() { // host window per menu hierarchy, no matter how many CefNativeMenuWin objects // exist wrapping submenus. if (!host_window_.get()) - host_window_.reset(new MenuHostWindow(this)); + host_window_.reset(new MenuHostWindow()); } //////////////////////////////////////////////////////////////////////////////// diff --git a/libcef/browser/native/window_x11.cc b/libcef/browser/native/window_x11.cc index a8b3c7fb5..fcbdc211c 100644 --- a/libcef/browser/native/window_x11.cc +++ b/libcef/browser/native/window_x11.cc @@ -38,7 +38,7 @@ const char kXdndProxy[] = "XdndProxy"; ::Window root; ::Window parent; ::Window* children; - ::Window child_window = None; + ::Window child_window = x11::None; unsigned int nchildren; if (XQueryTree(display, window, &root, &parent, &children, &nchildren)) { DCHECK_EQ(1U, nchildren); @@ -50,8 +50,8 @@ const char kXdndProxy[] = "XdndProxy"; ::Window FindToplevelParent(::Display* display, ::Window window) { ::Window top_level_window = window; - ::Window root = None; - ::Window parent = None; + ::Window root = x11::None; + ::Window parent = x11::None; ::Window* children = NULL; unsigned int nchildren = 0; // Enumerate all parents of "window" to find the highest level window @@ -91,12 +91,12 @@ CefWindowX11::CefWindowX11(CefRefPtr browser, bounds_(bounds), focus_pending_(false), weak_ptr_factory_(this) { - if (parent_xwindow_ == None) + if (parent_xwindow_ == x11::None) parent_xwindow_ = DefaultRootWindow(xdisplay_); XSetWindowAttributes swa; memset(&swa, 0, sizeof(swa)); - swa.background_pixmap = None; + swa.background_pixmap = x11::None; swa.override_redirect = false; xwindow_ = XCreateWindow(xdisplay_, parent_xwindow_, bounds.x(), bounds.y(), bounds.width(), bounds.height(), @@ -148,12 +148,12 @@ void CefWindowX11::Close() { ev.xclient.message_type = gfx::GetAtom(kWMProtocols); ev.xclient.format = 32; ev.xclient.data.l[0] = gfx::GetAtom(kWMDeleteWindow); - ev.xclient.data.l[1] = CurrentTime; - XSendEvent(xdisplay_, xwindow_, False, NoEventMask, &ev); + ev.xclient.data.l[1] = x11::CurrentTime; + XSendEvent(xdisplay_, xwindow_, false, NoEventMask, &ev); } void CefWindowX11::Show() { - if (xwindow_ == None) + if (xwindow_ == x11::None) return; if (!window_mapped_) { @@ -205,7 +205,7 @@ void CefWindowX11::Show() { } void CefWindowX11::Hide() { - if (xwindow_ == None) + if (xwindow_ == x11::None) return; if (window_mapped_) { @@ -215,22 +215,22 @@ void CefWindowX11::Hide() { } void CefWindowX11::Focus() { - if (xwindow_ == None || !window_mapped_) + if (xwindow_ == x11::None || !window_mapped_) return; if (browser_.get()) { ::Window child = FindChild(xdisplay_, xwindow_); if (child && ui::IsWindowVisible(child)) { // Give focus to the child DesktopWindowTreeHostX11. - XSetInputFocus(xdisplay_, child, RevertToParent, CurrentTime); + XSetInputFocus(xdisplay_, child, RevertToParent, x11::CurrentTime); } } else { - XSetInputFocus(xdisplay_, xwindow_, RevertToParent, CurrentTime); + XSetInputFocus(xdisplay_, xwindow_, RevertToParent, x11::CurrentTime); } } void CefWindowX11::SetBounds(const gfx::Rect& bounds) { - if (xwindow_ == None) + if (xwindow_ == x11::None) return; bool origin_changed = bounds_.origin() != bounds.origin(); @@ -315,7 +315,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) { // Allow the close. XDestroyWindow(xdisplay_, xwindow_); - xwindow_ = None; + xwindow_ = x11::None; if (browser_.get()) { // Force the browser to be destroyed and release the reference @@ -329,7 +329,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) { XEvent reply_event = *xev; reply_event.xclient.window = parent_xwindow_; - XSendEvent(xdisplay_, reply_event.xclient.window, False, + XSendEvent(xdisplay_, reply_event.xclient.window, false, SubstructureRedirectMask | SubstructureNotifyMask, &reply_event); XFlush(xdisplay_); diff --git a/libcef/browser/net/chrome_scheme_handler.cc b/libcef/browser/net/chrome_scheme_handler.cc index 21f97a003..e271624c6 100644 --- a/libcef/browser/net/chrome_scheme_handler.cc +++ b/libcef/browser/net/chrome_scheme_handler.cc @@ -37,6 +37,7 @@ #include "content/browser/webui/content_web_ui_controller_factory.h" #include "content/public/browser/browser_url_handler.h" #include "content/public/common/url_constants.h" +#include "content/public/common/url_utils.h" #include "content/public/common/user_agent.h" #include "ipc/ipc_channel.h" #include "net/url_request/url_request.h" @@ -169,7 +170,7 @@ bool IsDebugURL(const GURL& url) { // Also include URLs handled by the browser process in // content/browser/frame_host/debug_urls.cc HandleDebugURL(). - for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) { + for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) { GURL host(chrome::kChromeDebugURLs[i]); if (url.GetOrigin() == host.GetOrigin()) return true; @@ -186,7 +187,7 @@ bool IsDebugURL(const GURL& url) { } void GetDebugURLs(std::vector* urls) { - for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) { + for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) { urls->push_back(chrome::kChromeDebugURLs[i]); } diff --git a/libcef/browser/net/cookie_store_proxy.cc b/libcef/browser/net/cookie_store_proxy.cc index 361317da8..38db356cd 100644 --- a/libcef/browser/net/cookie_store_proxy.cc +++ b/libcef/browser/net/cookie_store_proxy.cc @@ -36,29 +36,6 @@ void CefCookieStoreProxy::SetCookieWithOptionsAsync( } } -void CefCookieStoreProxy::SetCookieWithDetailsAsync( - const GURL& url, - const std::string& name, - const std::string& value, - const std::string& domain, - const std::string& path, - base::Time creation_time, - base::Time expiration_time, - base::Time last_access_time, - bool secure, - bool http_only, - net::CookieSameSite same_site, - net::CookiePriority priority, - SetCookiesCallback callback) { - net::CookieStore* cookie_store = GetCookieStore(); - if (cookie_store) { - cookie_store->SetCookieWithDetailsAsync( - url, name, value, domain, path, creation_time, expiration_time, - last_access_time, secure, http_only, same_site, priority, - std::move(callback)); - } -} - void CefCookieStoreProxy::SetCanonicalCookieAsync( std::unique_ptr cookie, bool secure_source, diff --git a/libcef/browser/net/cookie_store_proxy.h b/libcef/browser/net/cookie_store_proxy.h index a87fc41ca..5a7c6e834 100644 --- a/libcef/browser/net/cookie_store_proxy.h +++ b/libcef/browser/net/cookie_store_proxy.h @@ -26,19 +26,6 @@ class CefCookieStoreProxy : public net::CookieStore { const std::string& cookie_line, const net::CookieOptions& options, SetCookiesCallback callback) override; - void SetCookieWithDetailsAsync(const GURL& url, - const std::string& name, - const std::string& value, - const std::string& domain, - const std::string& path, - base::Time creation_time, - base::Time expiration_time, - base::Time last_access_time, - bool secure, - bool http_only, - net::CookieSameSite same_site, - net::CookiePriority priority, - SetCookiesCallback callback) override; void SetCanonicalCookieAsync(std::unique_ptr cookie, bool secure_source, bool modify_http_only, diff --git a/libcef/browser/net/crlset_file_util_impl.cc b/libcef/browser/net/crlset_file_util_impl.cc index 442a44e9f..808d6ffb3 100644 --- a/libcef/browser/net/crlset_file_util_impl.cc +++ b/libcef/browser/net/crlset_file_util_impl.cc @@ -21,19 +21,11 @@ namespace { void SetCRLSetIfNewer(scoped_refptr crl_set) { CEF_REQUIRE_IOT(); - - scoped_refptr old_crl_set(net::SSLConfigService::GetCRLSet()); - if (old_crl_set.get() && old_crl_set->sequence() > crl_set->sequence()) { - LOG(WARNING) << "Refusing to downgrade CRL set from #" - << old_crl_set->sequence() << "to #" << crl_set->sequence(); - } else { - net::SSLConfigService::SetCRLSet(crl_set); - VLOG(1) << "Installed CRL set #" << crl_set->sequence(); - } + net::SSLConfigService::SetCRLSetIfNewer(crl_set); } void LoadFromDisk(const base::FilePath& path) { - base::ThreadRestrictions::AssertIOAllowed(); + base::AssertBlockingAllowed(); std::string crl_set_bytes; if (!base::ReadFileToString(path, &crl_set_bytes)) { diff --git a/libcef/browser/net/resource_request_job.cc b/libcef/browser/net/resource_request_job.cc index fc0e8113c..c6ac9a06d 100644 --- a/libcef/browser/net/resource_request_job.cc +++ b/libcef/browser/net/resource_request_job.cc @@ -500,25 +500,29 @@ void CefResourceRequestJob::SaveNextCookie() { return; } + const std::string& cookie_line = + response_cookies_[response_cookies_save_index_]; + net::CookieOptions options; options.set_include_httponly(); - bool can_set_cookie = - CanSetCookie(response_cookies_[response_cookies_save_index_], &options); + std::unique_ptr cookie = net::CanonicalCookie::Create( + request_->url(), cookie_line, base::Time::Now(), options); + + bool can_set_cookie = cookie && CanSetCookie(*cookie, &options); if (can_set_cookie) { - CefCookie cookie; - if (CefCookieManagerImpl::GetCefCookie( - request_->url(), response_cookies_[response_cookies_save_index_], - cookie)) { - can_set_cookie = handler_->CanSetCookie(cookie); + CefCookie cef_cookie; + if (CefCookieManagerImpl::GetCefCookie(request_->url(), cookie_line, + cef_cookie)) { + can_set_cookie = handler_->CanSetCookie(cef_cookie); } else { can_set_cookie = false; } } if (can_set_cookie) { - request_->context()->cookie_store()->SetCookieWithOptionsAsync( - request_->url(), response_cookies_[response_cookies_save_index_], - options, + request_->context()->cookie_store()->SetCanonicalCookieAsync( + std::move(cookie), request_->url().SchemeIsCryptographic(), + !options.exclude_httponly(), base::Bind(&CefResourceRequestJob::OnCookieSaved, weak_factory_.GetWeakPtr())); return; diff --git a/libcef/browser/net/url_request_context_getter_impl.cc b/libcef/browser/net/url_request_context_getter_impl.cc index c6987f3ff..b5c099f67 100644 --- a/libcef/browser/net/url_request_context_getter_impl.cc +++ b/libcef/browser/net/url_request_context_getter_impl.cc @@ -136,9 +136,9 @@ std::unique_ptr CreateProxyService( dhcp_proxy_script_fetcher = dhcp_factory.Create(context); proxy_service = content::CreateProxyServiceUsingMojoFactory( - ChromeMojoProxyResolverFactory::GetInstance(), + ChromeMojoProxyResolverFactory::CreateWithStrongBinding(), std::move(proxy_config_service), - new net::ProxyScriptFetcherImpl(context), + base::MakeUnique(context), std::move(dhcp_proxy_script_fetcher), context->host_resolver(), net_log, network_delegate); } else { @@ -536,11 +536,11 @@ void CefURLRequestContextGetterImpl::CreateProxyConfigService() { } void CefURLRequestContextGetterImpl::UpdateServerWhitelist() { - io_state_->http_auth_preferences_->set_server_whitelist( + io_state_->http_auth_preferences_->SetServerWhitelist( auth_server_whitelist_.GetValue()); } void CefURLRequestContextGetterImpl::UpdateDelegateWhitelist() { - io_state_->http_auth_preferences_->set_delegate_whitelist( + io_state_->http_auth_preferences_->SetDelegateWhitelist( auth_negotiate_delegate_whitelist_.GetValue()); } diff --git a/libcef/browser/osr/browser_platform_delegate_osr.cc b/libcef/browser/osr/browser_platform_delegate_osr.cc index 3ed41cff9..1fbceebbd 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr.cc +++ b/libcef/browser/osr/browser_platform_delegate_osr.cc @@ -275,12 +275,12 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter( DragTargetDragLeave(); const gfx::Point client_pt(event.x, event.y); - gfx::Point transformed_pt; + gfx::PointF transformed_pt; current_rwh_for_drag_ = web_contents->GetInputEventRouter() ->GetRenderWidgetHostAtPoint( web_contents->GetRenderViewHost()->GetWidget()->GetView(), - client_pt, &transformed_pt) + gfx::PointF(client_pt), &transformed_pt) ->GetWeakPtr(); current_rvh_for_drag_ = web_contents->GetRenderViewHost(); @@ -304,8 +304,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter( return; } - current_rwh_for_drag_->DragTargetDragEnter(*drop_data, transformed_pt, - screen_pt, ops, modifiers); + current_rwh_for_drag_->DragTargetDragEnter( + *drop_data, transformed_pt, gfx::PointF(screen_pt), ops, modifiers); } void CefBrowserPlatformDelegateOsr::DragTargetDragOver( @@ -322,27 +322,27 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver( const gfx::Point client_pt(event.x, event.y); const gfx::Point& screen_pt = GetScreenPoint(client_pt); - gfx::Point transformed_pt; + gfx::PointF transformed_pt; content::RenderWidgetHostImpl* target_rwh = web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint( - web_contents->GetRenderViewHost()->GetWidget()->GetView(), client_pt, - &transformed_pt); + web_contents->GetRenderViewHost()->GetWidget()->GetView(), + gfx::PointF(client_pt), &transformed_pt); if (target_rwh != current_rwh_for_drag_.get()) { if (current_rwh_for_drag_) { - gfx::Point transformed_leave_point = client_pt; - gfx::Point transformed_screen_point = screen_pt; + gfx::PointF transformed_leave_point(client_pt); + gfx::PointF transformed_screen_point(screen_pt); static_cast( web_contents->GetRenderWidgetHostView()) ->TransformPointToCoordSpaceForView( - client_pt, + gfx::PointF(client_pt), static_cast( current_rwh_for_drag_->GetView()), &transformed_leave_point); static_cast( web_contents->GetRenderWidgetHostView()) ->TransformPointToCoordSpaceForView( - screen_pt, + gfx::PointF(screen_pt), static_cast( current_rwh_for_drag_->GetView()), &transformed_screen_point); @@ -359,7 +359,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver( static_cast(allowed_ops); int modifiers = TranslateModifiers(event.modifiers); - target_rwh->DragTargetDragOver(transformed_pt, screen_pt, ops, modifiers); + target_rwh->DragTargetDragOver(transformed_pt, gfx::PointF(screen_pt), ops, + modifiers); } void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() { @@ -369,7 +370,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() { } if (current_rwh_for_drag_) { - current_rwh_for_drag_->DragTargetDragLeave(gfx::Point(), gfx::Point()); + current_rwh_for_drag_->DragTargetDragLeave(gfx::PointF(), gfx::PointF()); current_rwh_for_drag_.reset(); } @@ -388,27 +389,27 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) { gfx::Point client_pt(event.x, event.y); const gfx::Point& screen_pt = GetScreenPoint(client_pt); - gfx::Point transformed_pt; + gfx::PointF transformed_pt; content::RenderWidgetHostImpl* target_rwh = web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint( - web_contents->GetRenderViewHost()->GetWidget()->GetView(), client_pt, - &transformed_pt); + web_contents->GetRenderViewHost()->GetWidget()->GetView(), + gfx::PointF(client_pt), &transformed_pt); if (target_rwh != current_rwh_for_drag_.get()) { if (current_rwh_for_drag_) { - gfx::Point transformed_leave_point = client_pt; - gfx::Point transformed_screen_point = screen_pt; + gfx::PointF transformed_leave_point(client_pt); + gfx::PointF transformed_screen_point(screen_pt); static_cast( web_contents->GetRenderWidgetHostView()) ->TransformPointToCoordSpaceForView( - client_pt, + gfx::PointF(client_pt), static_cast( current_rwh_for_drag_->GetView()), &transformed_leave_point); static_cast( web_contents->GetRenderWidgetHostView()) ->TransformPointToCoordSpaceForView( - screen_pt, + gfx::PointF(screen_pt), static_cast( current_rwh_for_drag_->GetView()), &transformed_screen_point); @@ -428,8 +429,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) { content::DropData* drop_data = data_impl->drop_data(); int modifiers = TranslateModifiers(event.modifiers); - target_rwh->DragTargetDrop(*drop_data, transformed_pt, screen_pt, - modifiers); + target_rwh->DragTargetDrop(*drop_data, transformed_pt, + gfx::PointF(screen_pt), modifiers); } drag_data_ = nullptr; @@ -495,20 +496,20 @@ void CefBrowserPlatformDelegateOsr::DragSourceEndedAt( // |client_loc| and |screen_loc| are in the root coordinate space, for // non-root RenderWidgetHosts they need to be transformed. - gfx::Point transformed_point = client_loc; - gfx::Point transformed_screen_point = screen_loc; + gfx::PointF transformed_point(client_loc); + gfx::PointF transformed_screen_point(screen_loc); if (source_rwh && web_contents->GetRenderWidgetHostView()) { static_cast( web_contents->GetRenderWidgetHostView()) ->TransformPointToCoordSpaceForView( - client_loc, + gfx::PointF(client_loc), static_cast( source_rwh->GetView()), &transformed_point); static_cast( web_contents->GetRenderWidgetHostView()) ->TransformPointToCoordSpaceForView( - screen_loc, + gfx::PointF(screen_loc), static_cast( source_rwh->GetView()), &transformed_screen_point); diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index 4f7c492b3..e9d7e8874 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -21,6 +21,7 @@ #include "components/viz/common/frame_sinks/copy_output_request.h" #include "components/viz/common/frame_sinks/delay_based_time_source.h" #include "components/viz/common/gl_helper.h" +#include "components/viz/common/switches.h" #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" @@ -238,7 +239,8 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( #if !defined(OS_MACOSX) delegated_frame_host_ = base::MakeUnique( AllocateFrameSinkId(is_guest_view_hack), this, - false /* enable_surface_synchronization */); + false /* enable_surface_synchronization */, + base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableViz)); root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); #endif @@ -443,7 +445,8 @@ void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink( void CefRenderWidgetHostViewOSR::SubmitCompositorFrame( const viz::LocalSurfaceId& local_surface_id, - viz::CompositorFrame frame) { + viz::CompositorFrame frame, + viz::mojom::HitTestRegionListPtr hit_test_region_list) { TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame"); if (frame.metadata.root_scroll_offset != last_scroll_offset_) { @@ -472,8 +475,8 @@ void CefRenderWidgetHostViewOSR::SubmitCompositorFrame( // We would normally call BrowserCompositorMac::SubmitCompositorFrame on // macOS, however it contains compositor resize logic that we don't want. // Consequently we instead call the SwapDelegatedFrame method directly. - GetDelegatedFrameHost()->SubmitCompositorFrame(local_surface_id, - std::move(frame)); + GetDelegatedFrameHost()->SubmitCompositorFrame( + local_surface_id, std::move(frame), std::move(hit_test_region_list)); } else { if (!copy_frame_generator_.get()) { copy_frame_generator_.reset( @@ -491,8 +494,8 @@ void CefRenderWidgetHostViewOSR::SubmitCompositorFrame( // We would normally call BrowserCompositorMac::SubmitCompositorFrame on // macOS, however it contains compositor resize logic that we don't want. // Consequently we instead call the SwapDelegatedFrame method directly. - GetDelegatedFrameHost()->SubmitCompositorFrame(local_surface_id, - std::move(frame)); + GetDelegatedFrameHost()->SubmitCompositorFrame( + local_surface_id, std::move(frame), std::move(hit_test_region_list)); // Request a copy of the last compositor frame which will eventually call // OnPaint asynchronously. @@ -827,12 +830,12 @@ void CefRenderWidgetHostViewOSR::ProcessGestureEvent( } bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace( - const gfx::Point& point, + const gfx::PointF& point, const viz::SurfaceId& original_surface, - gfx::Point* transformed_point) { + gfx::PointF* transformed_point) { // Transformations use physical pixels rather than DIP, so conversion // is necessary. - gfx::Point point_in_pixels = + gfx::PointF point_in_pixels = gfx::ConvertPointToPixel(current_device_scale_factor_, point); if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpace( point_in_pixels, original_surface, transformed_point)) { @@ -845,9 +848,9 @@ bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace( } bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView( - const gfx::Point& point, + const gfx::PointF& point, RenderWidgetHostViewBase* target_view, - gfx::Point* transformed_point) { + gfx::PointF* transformed_point) { if (target_view == this) { *transformed_point = point; return true; @@ -926,6 +929,10 @@ bool CefRenderWidgetHostViewOSR::IsAutoResizeEnabled() const { return render_widget_host_->auto_resize_enabled(); } +void CefRenderWidgetHostViewOSR::OnFrameTokenChanged(uint32_t frame_token) { + render_widget_host_->DidProcessFrame(frame_token); +} + std::unique_ptr CefRenderWidgetHostViewOSR::GetCompositorLock( ui::CompositorLockClient* client) { @@ -1294,16 +1301,11 @@ void CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() { current_device_scale_factor_ = new_scale_factor; - if (render_widget_host_ && render_widget_host_->delegate()) - render_widget_host_->delegate()->UpdateDeviceScaleFactor(new_scale_factor); - // Notify the guest hosts if any. for (auto guest_host_view : guest_host_views_) { content::RenderWidgetHostImpl* rwhi = guest_host_view->render_widget_host(); if (!rwhi) continue; - if (rwhi->delegate()) - rwhi->delegate()->UpdateDeviceScaleFactor(new_scale_factor); if (rwhi->GetView()) rwhi->GetView()->set_current_device_scale_factor(new_scale_factor); } diff --git a/libcef/browser/osr/render_widget_host_view_osr.h b/libcef/browser/osr/render_widget_host_view_osr.h index a083950c2..51ac32885 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.h +++ b/libcef/browser/osr/render_widget_host_view_osr.h @@ -86,7 +86,7 @@ class MacHelper; class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, public ui::CompositorDelegate #if !defined(OS_MACOSX) - , + , public content::DelegatedFrameHostClient, public content::CompositorResizeLockClient #endif @@ -132,8 +132,10 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, void DidCreateNewRendererCompositorFrameSink( viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) override; - void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, - viz::CompositorFrame frame) override; + void SubmitCompositorFrame( + const viz::LocalSurfaceId& local_surface_id, + viz::CompositorFrame frame, + viz::mojom::HitTestRegionListPtr hit_test_region_list) override; void ClearCompositorFrame() override; void InitAsPopup(content::RenderWidgetHostView* parent_host_view, const gfx::Rect& pos) override; @@ -188,13 +190,13 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, const ui::LatencyInfo& latency) override; void ProcessGestureEvent(const blink::WebGestureEvent& event, const ui::LatencyInfo& latency) override; - bool TransformPointToLocalCoordSpace(const gfx::Point& point, + bool TransformPointToLocalCoordSpace(const gfx::PointF& point, const viz::SurfaceId& original_surface, - gfx::Point* transformed_point) override; + gfx::PointF* transformed_point) override; bool TransformPointToCoordSpaceForView( - const gfx::Point& point, + const gfx::PointF& point, RenderWidgetHostViewBase* target_view, - gfx::Point* transformed_point) override; + gfx::PointF* transformed_point) override; // ui::CompositorDelegate implementation. std::unique_ptr CreateSoftwareOutputDevice( @@ -212,6 +214,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, viz::LocalSurfaceId GetLocalSurfaceId() const override; void OnBeginFrame() override; bool IsAutoResizeEnabled() const override; + void OnFrameTokenChanged(uint32_t frame_token) override; // CompositorResizeLockClient implementation. std::unique_ptr GetCompositorLock( diff --git a/libcef/browser/osr/render_widget_host_view_osr_mac.mm b/libcef/browser/osr/render_widget_host_view_osr_mac.mm index c0389f6c9..6321f316d 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_mac.mm +++ b/libcef/browser/osr/render_widget_host_view_osr_mac.mm @@ -65,6 +65,10 @@ class MacHelper : public content::BrowserCompositorMacClient, void AcceleratedWidgetSwapCompleted() override {} + void OnFrameTokenChanged(uint32_t frame_token) override { + view_->render_widget_host()->DidProcessFrame(frame_token); + } + private: // Guaranteed to outlive this object. CefRenderWidgetHostViewOSR* view_; diff --git a/libcef/browser/osr/render_widget_host_view_osr_win.cc b/libcef/browser/osr/render_widget_host_view_osr_win.cc index 844c5d43e..ed55b6035 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_win.cc +++ b/libcef/browser/osr/render_widget_host_view_osr_win.cc @@ -127,6 +127,8 @@ LPCWSTR ToCursorID(WebCursorInfo::Type type) { return MAKEINTRESOURCE(IDC_HAND_GRAB); case WebCursorInfo::kTypeGrabbing: return MAKEINTRESOURCE(IDC_HAND_GRABBING); + case WebCursorInfo::kTypeCustom: + break; } NOTREACHED(); return NULL; diff --git a/libcef/browser/osr/web_contents_view_osr.cc b/libcef/browser/osr/web_contents_view_osr.cc index ef51cb54c..2f6c380ab 100644 --- a/libcef/browser/osr/web_contents_view_osr.cc +++ b/libcef/browser/osr/web_contents_view_osr.cc @@ -63,6 +63,8 @@ void CefWebContentsViewOSR::StoreFocus() {} void CefWebContentsViewOSR::RestoreFocus() {} +void CefWebContentsViewOSR::FocusThroughTabTraversal(bool reverse) {} + void CefWebContentsViewOSR::GotFocus( content::RenderWidgetHostImpl* render_widget_host) { if (web_contents_) { diff --git a/libcef/browser/osr/web_contents_view_osr.h b/libcef/browser/osr/web_contents_view_osr.h index 4f7beb07d..c98856ade 100644 --- a/libcef/browser/osr/web_contents_view_osr.h +++ b/libcef/browser/osr/web_contents_view_osr.h @@ -40,6 +40,7 @@ class CefWebContentsViewOSR : public content::WebContentsView, void SetInitialFocus() override; void StoreFocus() override; void RestoreFocus() override; + void FocusThroughTabTraversal(bool reverse) override; content::DropData* GetDropData() const override; gfx::Rect GetViewBounds() const override; void CreateView(const gfx::Size& initial_size, diff --git a/libcef/browser/pepper/browser_pepper_host_factory.cc b/libcef/browser/pepper/browser_pepper_host_factory.cc deleted file mode 100644 index a75c9d1f6..000000000 --- a/libcef/browser/pepper/browser_pepper_host_factory.cc +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/browser/pepper/browser_pepper_host_factory.h" - -#include "base/memory/ptr_util.h" -#include "build/build_config.h" -#include "chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h" -#include "chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h" -#include "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h" -#include "chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h" -#include "chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h" -#include "chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.h" -#include "chrome/browser/renderer_host/pepper/pepper_platform_verification_message_filter.h" -#include "content/public/browser/browser_ppapi_host.h" -#include "ppapi/host/message_filter_host.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/host/resource_host.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/shared_impl/ppapi_permissions.h" - -using ppapi::host::MessageFilterHost; -using ppapi::host::ResourceHost; -using ppapi::host::ResourceMessageFilter; - -CefBrowserPepperHostFactory::CefBrowserPepperHostFactory( - content::BrowserPpapiHost* host) - : host_(host) {} - -CefBrowserPepperHostFactory::~CefBrowserPepperHostFactory() {} - -std::unique_ptr CefBrowserPepperHostFactory::CreateResourceHost( - ppapi::host::PpapiHost* host, - PP_Resource resource, - PP_Instance instance, - const IPC::Message& message) { - DCHECK(host == host_->GetPpapiHost()); - - // Make sure the plugin is giving us a valid instance for this resource. - if (!host_->IsValidInstance(instance)) - return nullptr; - - // Private interfaces. - if (host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_PRIVATE)) { - switch (message.type()) { - case PpapiHostMsg_Broker_Create::ID: { - scoped_refptr broker_filter( - new chrome::PepperBrokerMessageFilter(instance, host_)); - return std::unique_ptr(new MessageFilterHost( - host_->GetPpapiHost(), instance, resource, broker_filter)); - } - case PpapiHostMsg_PlatformVerification_Create::ID: { - scoped_refptr pv_filter( - new chrome::PepperPlatformVerificationMessageFilter(host_, - instance)); - return std::unique_ptr(new MessageFilterHost( - host_->GetPpapiHost(), instance, resource, pv_filter)); - } - case PpapiHostMsg_OutputProtection_Create::ID: { - scoped_refptr output_protection_filter( - new chrome::PepperOutputProtectionMessageFilter(host_, instance)); - return std::unique_ptr( - new MessageFilterHost(host_->GetPpapiHost(), instance, resource, - output_protection_filter)); - } - } - } - - // Flash interfaces. - if (host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_FLASH)) { - switch (message.type()) { - case PpapiHostMsg_Flash_Create::ID: - return base::MakeUnique(host_, instance, - resource); - case PpapiHostMsg_FlashClipboard_Create::ID: { - scoped_refptr clipboard_filter( - new chrome::PepperFlashClipboardMessageFilter); - return base::MakeUnique( - host_->GetPpapiHost(), instance, resource, clipboard_filter); - } - case PpapiHostMsg_FlashDRM_Create::ID: - return base::MakeUnique(host_, instance, - resource); - } - } - - // Permissions for the following interfaces will be checked at the - // time of the corresponding instance's methods calls (because - // permission check can be performed only on the UI - // thread). Currently these interfaces are available only for - // whitelisted apps which may not have access to the other private - // interfaces. - if (message.type() == PpapiHostMsg_IsolatedFileSystem_Create::ID) { - chrome::PepperIsolatedFileSystemMessageFilter* isolated_fs_filter = - chrome::PepperIsolatedFileSystemMessageFilter::Create(instance, host_); - if (!isolated_fs_filter) - return nullptr; - return base::MakeUnique(host, instance, resource, - isolated_fs_filter); - } - - NOTREACHED() << "Unhandled message type: " << message.type(); - return nullptr; -} diff --git a/libcef/browser/pepper/browser_pepper_host_factory.h b/libcef/browser/pepper/browser_pepper_host_factory.h deleted file mode 100644 index 7527261f4..000000000 --- a/libcef/browser/pepper/browser_pepper_host_factory.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CEF_LIBCEF_BROWSER_PEPPER_BROWSER_PEPPER_HOST_FACTORY_H_ -#define CEF_LIBCEF_BROWSER_PEPPER_BROWSER_PEPPER_HOST_FACTORY_H_ - -#include "base/compiler_specific.h" -#include "base/macros.h" -#include "ppapi/host/host_factory.h" - -namespace content { -class BrowserPpapiHost; -} // namespace content - -class CefBrowserPepperHostFactory : public ppapi::host::HostFactory { - public: - // Non-owning pointer to the filter must outlive this class. - explicit CefBrowserPepperHostFactory(content::BrowserPpapiHost* host); - ~CefBrowserPepperHostFactory() override; - - std::unique_ptr CreateResourceHost( - ppapi::host::PpapiHost* host, - PP_Resource resource, - PP_Instance instance, - const IPC::Message& message) override; - - private: - // Non-owning pointer. - content::BrowserPpapiHost* host_; - - DISALLOW_COPY_AND_ASSIGN(CefBrowserPepperHostFactory); -}; - -#endif // CEF_LIBCEF_BROWSER_PEPPER_BROWSER_PEPPER_HOST_FACTORY_H_ diff --git a/libcef/browser/permissions/permission_util.cc b/libcef/browser/permissions/permission_util.cc index ac32c8ff8..95d37a0c8 100644 --- a/libcef/browser/permissions/permission_util.cc +++ b/libcef/browser/permissions/permission_util.cc @@ -10,11 +10,13 @@ using content::PermissionType; namespace permission_util { +// Copied from chrome/browser/permissions/permission_manager.cc. ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) { switch (permission) { + case PermissionType::MIDI: + return CONTENT_SETTINGS_TYPE_MIDI; case PermissionType::MIDI_SYSEX: return CONTENT_SETTINGS_TYPE_MIDI_SYSEX; - case PermissionType::PUSH_MESSAGING: case PermissionType::NOTIFICATIONS: return CONTENT_SETTINGS_TYPE_NOTIFICATIONS; case PermissionType::GEOLOCATION: @@ -28,9 +30,6 @@ ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) { #endif case PermissionType::DURABLE_STORAGE: return CONTENT_SETTINGS_TYPE_DURABLE_STORAGE; - case PermissionType::MIDI: - // This will hit the NOTREACHED below. - break; case PermissionType::AUDIO_CAPTURE: return CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC; case PermissionType::VIDEO_CAPTURE: @@ -43,6 +42,10 @@ ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) { return CONTENT_SETTINGS_TYPE_SENSORS; case PermissionType::ACCESSIBILITY_EVENTS: return CONTENT_SETTINGS_TYPE_ACCESSIBILITY_EVENTS; + case PermissionType::CLIPBOARD_READ: + return CONTENT_SETTINGS_TYPE_CLIPBOARD_READ; + case PermissionType::CLIPBOARD_WRITE: + return CONTENT_SETTINGS_TYPE_CLIPBOARD_WRITE; case PermissionType::NUM: // This will hit the NOTREACHED below. break; diff --git a/libcef/browser/plugins/plugin_info_message_filter.cc b/libcef/browser/plugins/plugin_info_message_filter.cc deleted file mode 100644 index 2a10c3897..000000000 --- a/libcef/browser/plugins/plugin_info_message_filter.cc +++ /dev/null @@ -1,514 +0,0 @@ -// Copyright 2015 The Chromium Embedded Framework Authors. -// Portions copyright 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/browser/plugins/plugin_info_message_filter.h" - -#include - -#include "libcef/browser/browser_context.h" -#include "libcef/browser/plugins/plugin_service_filter.h" -#include "libcef/browser/web_plugin_impl.h" -#include "libcef/common/cef_messages.h" -#include "libcef/common/extensions/extensions_util.h" - -#include "base/bind.h" -#include "base/metrics/histogram_macros.h" -#include "base/strings/utf_string_conversions.h" -#include "base/threading/thread_task_runner_handle.h" -#include "build/build_config.h" -#include "chrome/browser/plugins/plugin_finder.h" -#include "chrome/browser/plugins/plugins_field_trial.h" -#include "chrome/common/features.h" -#include "chrome/common/pref_names.h" -#include "components/content_settings/core/common/content_settings_utils.h" -#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h" -#include "components/nacl/common/features.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/plugin_service.h" -#include "content/public/browser/plugin_service_filter.h" -#include "content/public/common/content_constants.h" -#include "content/public/common/webplugininfo.h" -#include "extensions/browser/extension_registry.h" -#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" -#include "extensions/common/constants.h" -#include "extensions/common/extension.h" -#include "extensions/common/manifest_handlers/webview_info.h" -#include "url/gurl.h" -#include "url/origin.h" - -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. - -#if BUILDFLAG(ENABLE_NACL) -#include "components/nacl/common/nacl_constants.h" -#endif - -using content::PluginService; -using content::WebPluginInfo; - -namespace { - -// There's a race condition between deletion of the CefPluginInfoMessageFilter -// object on the UI thread and deletion of the PrefService (owned by Profile) -// on the UI thread. If the PrefService will be deleted first then -// PrefMember::Destroy() must be called from ShutdownOnUIThread() to avoid -// heap-use-after-free on CefPluginInfoMessageFilter destruction (due to -// ~PrefMember trying to access the already-deleted PrefService). -// ShutdownNotifierFactory makes sure that ShutdownOnUIThread() is called in -// this case. -class ShutdownNotifierFactory - : public BrowserContextKeyedServiceShutdownNotifierFactory { - public: - static ShutdownNotifierFactory* GetInstance(); - - private: - friend struct base::LazyInstanceTraitsBase; - - ShutdownNotifierFactory() - : BrowserContextKeyedServiceShutdownNotifierFactory( - "CefPluginInfoMessageFilter") {} - ~ShutdownNotifierFactory() override {} - - DISALLOW_COPY_AND_ASSIGN(ShutdownNotifierFactory); -}; - -base::LazyInstance::Leaky g_shutdown_notifier_factory = - LAZY_INSTANCE_INITIALIZER; - -// static -ShutdownNotifierFactory* ShutdownNotifierFactory::GetInstance() { - return g_shutdown_notifier_factory.Pointer(); -} - -// For certain sandboxed Pepper plugins, use the JavaScript Content Settings. -bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) { - if (plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS && - plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS) { - return false; - } - -#if BUILDFLAG(ENABLE_NACL) - // Treat Native Client invocations like JavaScript. - if (plugin.name == base::ASCIIToUTF16(nacl::kNaClPluginName)) - return true; -#endif - -#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) - // Treat CDM invocations like JavaScript. - if (plugin.name == base::ASCIIToUTF16(kWidevineCdmDisplayName)) { - DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS); - return true; - } -#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) - - return false; -} - -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) - -enum PluginAvailabilityStatusForUMA { - PLUGIN_NOT_REGISTERED, - PLUGIN_AVAILABLE, - PLUGIN_DISABLED, - PLUGIN_AVAILABILITY_STATUS_MAX -}; - -static void SendPluginAvailabilityUMA(const std::string& mime_type, - PluginAvailabilityStatusForUMA status) { -#if defined(WIDEVINE_CDM_AVAILABLE) - // Only report results for Widevine CDM. - if (mime_type != kWidevineCdmPluginMimeType) - return; - - UMA_HISTOGRAM_ENUMERATION("Plugin.AvailabilityStatus.WidevineCdm", status, - PLUGIN_AVAILABILITY_STATUS_MAX); -#endif // defined(WIDEVINE_CDM_AVAILABLE) -} - -#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) - -void ReportMetrics(const std::string& mime_type, - const GURL& url, - const url::Origin& main_frame_origin) {} - -#if BUILDFLAG(ENABLE_EXTENSIONS) -// Returns whether a request from a plugin to load |resource| from a renderer -// with process id |process_id| is a request for an internal resource by an app -// listed in |accessible_resources| in its manifest. -bool IsPluginLoadingAccessibleResourceInWebView( - extensions::ExtensionRegistry* extension_registry, - int process_id, - const GURL& resource) { - extensions::WebViewRendererState* renderer_state = - extensions::WebViewRendererState::GetInstance(); - std::string partition_id; - if (!renderer_state->IsGuest(process_id) || - !renderer_state->GetPartitionID(process_id, &partition_id)) { - return false; - } - - const std::string extension_id = resource.host(); - const extensions::Extension* extension = extension_registry->GetExtensionById( - extension_id, extensions::ExtensionRegistry::ENABLED); - if (!extension || !extensions::WebviewInfo::IsResourceWebviewAccessible( - extension, partition_id, resource.path())) { - return false; - } - - // Make sure the renderer making the request actually belongs to the - // same extension. - std::string owner_extension; - return renderer_state->GetOwnerInfo(process_id, nullptr, &owner_extension) && - owner_extension == extension_id; -} -#endif // BUILDFLAG(ENABLE_EXTENSIONS) - -} // namespace - -CefPluginInfoMessageFilter::Context::Context(int render_process_id, - CefBrowserContext* profile) - : render_process_id_(render_process_id), - resource_context_( - static_cast(profile->GetResourceContext())), - host_content_settings_map_(profile->GetHostContentSettingsMap()) { -#if BUILDFLAG(ENABLE_EXTENSIONS) - if (extensions::ExtensionsEnabled()) - extension_registry_ = extensions::ExtensionRegistry::Get(profile); -#endif - - allow_outdated_plugins_.Init(prefs::kPluginsAllowOutdated, - profile->GetPrefs()); - allow_outdated_plugins_.MoveToThread( - content::BrowserThread::GetTaskRunnerForThread( - content::BrowserThread::IO)); - always_authorize_plugins_.Init(prefs::kPluginsAlwaysAuthorize, - profile->GetPrefs()); - always_authorize_plugins_.MoveToThread( - content::BrowserThread::GetTaskRunnerForThread( - content::BrowserThread::IO)); -} - -CefPluginInfoMessageFilter::Context::~Context() {} - -void CefPluginInfoMessageFilter::Context::ShutdownOnUIThread() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - always_authorize_plugins_.Destroy(); - allow_outdated_plugins_.Destroy(); -} - -CefPluginInfoMessageFilter::CefPluginInfoMessageFilter( - int render_process_id, - CefBrowserContext* profile) - : BrowserMessageFilter(ExtensionMsgStart), - context_(render_process_id, profile), - main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), - weak_ptr_factory_(this) { - shutdown_notifier_ = - ShutdownNotifierFactory::GetInstance()->Get(profile)->Subscribe( - base::Bind(&CefPluginInfoMessageFilter::ShutdownOnUIThread, - base::Unretained(this))); -} - -void CefPluginInfoMessageFilter::ShutdownOnUIThread() { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - context_.ShutdownOnUIThread(); - shutdown_notifier_.reset(); -} - -bool CefPluginInfoMessageFilter::OnMessageReceived( - const IPC::Message& message) { - IPC_BEGIN_MESSAGE_MAP(CefPluginInfoMessageFilter, message) - IPC_MESSAGE_HANDLER_DELAY_REPLY(CefViewHostMsg_GetPluginInfo, - OnGetPluginInfo) -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) - IPC_MESSAGE_HANDLER(CefViewHostMsg_IsInternalPluginAvailableForMimeType, - OnIsInternalPluginAvailableForMimeType) -#endif - IPC_MESSAGE_UNHANDLED(return false) - IPC_END_MESSAGE_MAP() - return true; -} - -void CefPluginInfoMessageFilter::OnDestruct() const { - const_cast(this) - ->weak_ptr_factory_.InvalidateWeakPtrs(); - - // Destroy on the UI thread because we contain a |PrefMember|. - content::BrowserThread::DeleteOnUIThread::Destruct(this); -} - -CefPluginInfoMessageFilter::~CefPluginInfoMessageFilter() {} - -struct CefPluginInfoMessageFilter::GetPluginInfo_Params { - int render_frame_id; - GURL url; - bool is_main_frame; - url::Origin main_frame_origin; - std::string mime_type; -}; - -void CefPluginInfoMessageFilter::OnGetPluginInfo( - int render_frame_id, - const GURL& url, - bool is_main_frame, - const url::Origin& main_frame_origin, - const std::string& mime_type, - IPC::Message* reply_msg) { - GetPluginInfo_Params params = {render_frame_id, url, is_main_frame, - main_frame_origin, mime_type}; - PluginService::GetInstance()->GetPlugins( - base::Bind(&CefPluginInfoMessageFilter::PluginsLoaded, - weak_ptr_factory_.GetWeakPtr(), params, reply_msg)); -} - -void CefPluginInfoMessageFilter::PluginsLoaded( - const GetPluginInfo_Params& params, - IPC::Message* reply_msg, - const std::vector& plugins) { - CefViewHostMsg_GetPluginInfo_Output output; - - // This also fills in |actual_mime_type|. - std::unique_ptr plugin_metadata; - context_.FindEnabledPlugin(params, &output.status, &output.plugin, - &output.actual_mime_type, &plugin_metadata); - - if (plugin_metadata) { - output.group_identifier = plugin_metadata->identifier(); - output.group_name = plugin_metadata->name(); - } - - CefViewHostMsg_GetPluginInfo::WriteReplyParams(reply_msg, output); - Send(reply_msg); - if (output.status != CefViewHostMsg_GetPluginInfo_Status::kNotFound) { - main_thread_task_runner_->PostTask( - FROM_HERE, base::Bind(&ReportMetrics, output.actual_mime_type, - params.url, params.main_frame_origin)); - } -} - -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) - -void CefPluginInfoMessageFilter::OnIsInternalPluginAvailableForMimeType( - const std::string& mime_type, - bool* is_available, - std::vector* additional_param_names, - std::vector* additional_param_values) { - std::vector plugins; - PluginService::GetInstance()->GetInternalPlugins(&plugins); - - bool is_plugin_disabled = false; - for (size_t i = 0; i < plugins.size(); ++i) { - const WebPluginInfo& plugin = plugins[i]; - const std::vector& mime_types = - plugin.mime_types; - for (size_t j = 0; j < mime_types.size(); ++j) { - if (mime_types[j].mime_type == mime_type) { - if (!context_.IsPluginEnabled(plugin)) { - is_plugin_disabled = true; - break; - } - - *is_available = true; - *additional_param_names = mime_types[j].additional_param_names; - *additional_param_values = mime_types[j].additional_param_values; - SendPluginAvailabilityUMA(mime_type, PLUGIN_AVAILABLE); - return; - } - } - } - - *is_available = false; - SendPluginAvailabilityUMA( - mime_type, is_plugin_disabled ? PLUGIN_DISABLED : PLUGIN_NOT_REGISTERED); -} - -#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) - -void CefPluginInfoMessageFilter::Context::DecidePluginStatus( - const GetPluginInfo_Params& params, - const WebPluginInfo& plugin, - const PluginMetadata* plugin_metadata, - CefViewHostMsg_GetPluginInfo_Status* status) const { - PluginMetadata::SecurityStatus plugin_status = - plugin_metadata->GetSecurityStatus(plugin); - - if (plugin_status == PluginMetadata::SECURITY_STATUS_FULLY_TRUSTED) { - *status = CefViewHostMsg_GetPluginInfo_Status::kAllowed; - return; - } - - ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; - bool uses_default_content_setting = true; - bool is_managed = false; - // Check plugin content settings. The primary URL is the top origin URL and - // the secondary URL is the plugin URL. - GetPluginContentSetting(plugin, params.main_frame_origin.GetURL(), params.url, - plugin_metadata->identifier(), &plugin_setting, - &uses_default_content_setting, &is_managed); - - // TODO(tommycli): Remove once we deprecate the plugin ASK policy. - bool legacy_ask_user = plugin_setting == CONTENT_SETTING_ASK; - plugin_setting = PluginsFieldTrial::EffectiveContentSetting( - host_content_settings_map_, CONTENT_SETTINGS_TYPE_PLUGINS, - plugin_setting); - - DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); - DCHECK(plugin_setting != CONTENT_SETTING_ASK); - - // Check if the plugin is crashing too much. - if (PluginService::GetInstance()->IsPluginUnstable(plugin.path) && - !always_authorize_plugins_.GetValue() && - plugin_setting != CONTENT_SETTING_BLOCK && uses_default_content_setting) { - *status = CefViewHostMsg_GetPluginInfo_Status::kUnauthorized; - return; - } - -#if BUILDFLAG(ENABLE_EXTENSIONS) - // If an app has explicitly made internal resources available by listing them - // in |accessible_resources| in the manifest, then allow them to be loaded by - // plugins inside a guest-view. - if (extensions::ExtensionsEnabled() && - params.url.SchemeIs(extensions::kExtensionScheme) && !is_managed && - plugin_setting == CONTENT_SETTING_BLOCK && - IsPluginLoadingAccessibleResourceInWebView( - extension_registry_, render_process_id_, params.url)) { - plugin_setting = CONTENT_SETTING_ALLOW; - } -#endif // BUILDFLAG(ENABLE_EXTENSIONS) - - if (plugin_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) { - *status = CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent; - } else if (plugin_setting == CONTENT_SETTING_BLOCK) { - // For managed users with the ASK policy, we allow manually running plugins - // via context menu. This is the closest to admin intent. - *status = is_managed && !legacy_ask_user - ? CefViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy - : CefViewHostMsg_GetPluginInfo_Status::kBlocked; - } - -#if BUILDFLAG(ENABLE_EXTENSIONS) - // Allow an embedder of to block a plugin from being loaded inside - // the guest. In order to do this, set the status to 'Unauthorized' here, - // and update the status as appropriate depending on the response from the - // embedder. - if (*status == CefViewHostMsg_GetPluginInfo_Status::kAllowed || - *status == CefViewHostMsg_GetPluginInfo_Status::kBlocked || - *status == CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) { - if (extensions::WebViewRendererState::GetInstance()->IsGuest( - render_process_id_)) { - *status = CefViewHostMsg_GetPluginInfo_Status::kUnauthorized; - } - } -#endif -} - -bool CefPluginInfoMessageFilter::Context::FindEnabledPlugin( - const GetPluginInfo_Params& params, - CefViewHostMsg_GetPluginInfo_Status* status, - WebPluginInfo* plugin, - std::string* actual_mime_type, - std::unique_ptr* plugin_metadata) const { - *status = CefViewHostMsg_GetPluginInfo_Status::kAllowed; - - bool allow_wildcard = true; - std::vector matching_plugins; - std::vector mime_types; - PluginService::GetInstance()->GetPluginInfoArray( - params.url, params.mime_type, allow_wildcard, &matching_plugins, - &mime_types); - if (matching_plugins.empty()) { - *status = CefViewHostMsg_GetPluginInfo_Status::kNotFound; - return false; - } - - CefPluginServiceFilter* filter = static_cast( - PluginService::GetInstance()->GetFilter()); - DCHECK(filter); - - CefViewHostMsg_GetPluginInfo_Status first_status = *status; - - size_t i = 0; - for (; i < matching_plugins.size(); ++i) { - *plugin = matching_plugins[i]; - *actual_mime_type = mime_types[i]; - *plugin_metadata = PluginFinder::GetInstance()->GetPluginMetadata(*plugin); - - DecidePluginStatus(params, *plugin, (*plugin_metadata).get(), status); - if (filter->IsPluginAvailable(render_process_id_, resource_context_, - params.url, params.is_main_frame, - params.main_frame_origin, plugin, status)) { - break; - } - - if (i == 0) - first_status = *status; - } - - // If we broke out of the loop, we have found an enabled plugin. - bool enabled = i < matching_plugins.size(); - if (!enabled) { - // Otherwise, we only found disabled/not-found plugins, so we take the first - // one. - *plugin = matching_plugins[0]; - *actual_mime_type = mime_types[0]; - *plugin_metadata = PluginFinder::GetInstance()->GetPluginMetadata(*plugin); - *status = first_status; - } - - return enabled; -} - -void CefPluginInfoMessageFilter::Context::GetPluginContentSetting( - const WebPluginInfo& plugin, - const GURL& policy_url, - const GURL& plugin_url, - const std::string& resource, - ContentSetting* setting, - bool* uses_default_content_setting, - bool* is_managed) const { - std::unique_ptr value; - content_settings::SettingInfo info; - bool uses_plugin_specific_setting = false; - if (ShouldUseJavaScriptSettingForPlugin(plugin)) { - value = host_content_settings_map_->GetWebsiteSetting( - policy_url, policy_url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(), - &info); - } else { - content_settings::SettingInfo specific_info; - std::unique_ptr specific_setting = - host_content_settings_map_->GetWebsiteSetting( - policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, resource, - &specific_info); - content_settings::SettingInfo general_info; - std::unique_ptr general_setting = - host_content_settings_map_->GetWebsiteSetting( - policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, - std::string(), &general_info); - - // If there is a plugin-specific setting, we use it, unless the general - // setting was set by policy, in which case it takes precedence. - uses_plugin_specific_setting = - specific_setting && - general_info.source != content_settings::SETTING_SOURCE_POLICY; - if (uses_plugin_specific_setting) { - value = std::move(specific_setting); - info = specific_info; - } else { - value = std::move(general_setting); - info = general_info; - } - } - *setting = content_settings::ValueToContentSetting(value.get()); - *uses_default_content_setting = - !uses_plugin_specific_setting && - info.primary_pattern == ContentSettingsPattern::Wildcard() && - info.secondary_pattern == ContentSettingsPattern::Wildcard(); - *is_managed = info.source == content_settings::SETTING_SOURCE_POLICY; -} - -bool CefPluginInfoMessageFilter::Context::IsPluginEnabled( - const content::WebPluginInfo& plugin) const { - return true; -} diff --git a/libcef/browser/plugins/plugin_info_message_filter.h b/libcef/browser/plugins/plugin_info_message_filter.h deleted file mode 100644 index 39ccfffdb..000000000 --- a/libcef/browser/plugins/plugin_info_message_filter.h +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright 2015 The Chromium Embedded Framework Authors. -// Portions copyright 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 CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_ -#define CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_ - -#include -#include - -#include "base/compiler_specific.h" -#include "base/memory/ref_counted.h" -#include "base/memory/weak_ptr.h" -#include "base/sequenced_task_runner_helpers.h" -#include "chrome/browser/plugins/plugin_metadata.h" -#include "components/content_settings/core/browser/host_content_settings_map.h" -#include "components/content_settings/core/common/content_settings.h" -#include "components/keyed_service/core/keyed_service_shutdown_notifier.h" -#include "components/prefs/pref_member.h" -#include "content/public/browser/browser_message_filter.h" -#include "extensions/features/features.h" -#include "media/media_features.h" - -class CefBrowserContext; -class CefResourceContext; -struct CefViewHostMsg_GetPluginInfo_Output; -enum class CefViewHostMsg_GetPluginInfo_Status; -class GURL; - -namespace content { -struct WebPluginInfo; -} - -namespace extensions { -class ExtensionRegistry; -} - -namespace url { -class Origin; -} - -// This class filters out incoming IPC messages requesting plugin information. -class CefPluginInfoMessageFilter : public content::BrowserMessageFilter { - public: - struct GetPluginInfo_Params; - - // Contains all the information needed by the CefPluginInfoMessageFilter. - class Context { - public: - Context(int render_process_id, CefBrowserContext* profile); - - ~Context(); - void ShutdownOnUIThread(); - - void DecidePluginStatus(const GetPluginInfo_Params& params, - const content::WebPluginInfo& plugin, - const PluginMetadata* plugin_metadata, - CefViewHostMsg_GetPluginInfo_Status* status) const; - bool FindEnabledPlugin( - const GetPluginInfo_Params& params, - CefViewHostMsg_GetPluginInfo_Status* status, - content::WebPluginInfo* plugin, - std::string* actual_mime_type, - std::unique_ptr* plugin_metadata) const; - void GetPluginContentSetting(const content::WebPluginInfo& plugin, - const GURL& policy_url, - const GURL& plugin_url, - const std::string& resource, - ContentSetting* setting, - bool* is_default, - bool* is_managed) const; - bool IsPluginEnabled(const content::WebPluginInfo& plugin) const; - - private: - int render_process_id_; - CefResourceContext* resource_context_; -#if BUILDFLAG(ENABLE_EXTENSIONS) - extensions::ExtensionRegistry* extension_registry_; -#endif - const HostContentSettingsMap* host_content_settings_map_; - - BooleanPrefMember allow_outdated_plugins_; - BooleanPrefMember always_authorize_plugins_; - }; - - CefPluginInfoMessageFilter(int render_process_id, CefBrowserContext* profile); - - // content::BrowserMessageFilter methods: - bool OnMessageReceived(const IPC::Message& message) override; - void OnDestruct() const override; - - private: - friend struct content::BrowserThread::DeleteOnThread< - content::BrowserThread::UI>; - friend class base::DeleteHelper; - - void ShutdownOnUIThread(); - ~CefPluginInfoMessageFilter() override; - - void OnGetPluginInfo(int render_frame_id, - const GURL& url, - bool is_main_frame, - const url::Origin& main_frame_origin, - const std::string& mime_type, - IPC::Message* reply_msg); - - // |params| wraps the parameters passed to |OnGetPluginInfo|, because - // |base::Bind| doesn't support the required arity . - void PluginsLoaded(const GetPluginInfo_Params& params, - IPC::Message* reply_msg, - const std::vector& plugins); - -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) - // Returns whether any internal plugin supporting |mime_type| is registered - // and enabled. Does not determine whether the plugin can actually be - // instantiated (e.g. whether it has all its dependencies). - // When the returned *|is_available| is true, |additional_param_names| and - // |additional_param_values| contain the name-value pairs, if any, specified - // for the *first* non-disabled plugin found that is registered for - // |mime_type|. - void OnIsInternalPluginAvailableForMimeType( - const std::string& mime_type, - bool* is_available, - std::vector* additional_param_names, - std::vector* additional_param_values); -#endif - - Context context_; - std::unique_ptr - shutdown_notifier_; - - scoped_refptr main_thread_task_runner_; - base::WeakPtrFactory weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(CefPluginInfoMessageFilter); -}; - -#endif // CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_ diff --git a/libcef/browser/plugins/plugin_service_filter.cc b/libcef/browser/plugins/plugin_service_filter.cc index 13cbe4aa6..63d32f2f4 100644 --- a/libcef/browser/plugins/plugin_service_filter.cc +++ b/libcef/browser/plugins/plugin_service_filter.cc @@ -9,7 +9,6 @@ #include "libcef/browser/resource_context.h" #include "libcef/browser/thread_util.h" #include "libcef/browser/web_plugin_impl.h" -#include "libcef/common/cef_messages.h" #include "libcef/common/content_client.h" #include "extensions/common/constants.h" @@ -30,8 +29,7 @@ bool CefPluginServiceFilter::IsPluginAvailable( CefResourceContext* resource_context = const_cast( reinterpret_cast(context)); - CefViewHostMsg_GetPluginInfo_Status status = - CefViewHostMsg_GetPluginInfo_Status::kAllowed; + chrome::mojom::PluginStatus status = chrome::mojom::PluginStatus::kAllowed; // Perform origin check here because we're passing an empty origin value to // IsPluginAvailable() below. @@ -54,8 +52,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, resource_context, url, - is_main_frame, url::Origin(), plugin, &status); + return IsPluginAvailable(render_process_id, render_frame_id, resource_context, + url, is_main_frame, url::Origin(), plugin, &status); } bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id, @@ -65,21 +63,24 @@ bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id, bool CefPluginServiceFilter::IsPluginAvailable( int render_process_id, - CefResourceContext* resource_context, + 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, - CefViewHostMsg_GetPluginInfo_Status* status) { - if (*status == CefViewHostMsg_GetPluginInfo_Status::kNotFound || - *status == CefViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported) { + chrome::mojom::PluginStatus* status) { + CefResourceContext* resource_context = + static_cast(content_resource_context); + + if (*status == chrome::mojom::PluginStatus::kNotFound) { // The plugin does not exist so no need to query the handler. return false; } if (plugin->path == CefString(CefContentClient::kPDFPluginPath)) { // Always allow the internal PDF plugin to load. - *status = CefViewHostMsg_GetPluginInfo_Status::kAllowed; + *status = chrome::mojom::PluginStatus::kAllowed; return true; } @@ -89,41 +90,41 @@ bool CefPluginServiceFilter::IsPluginAvailable( // Always allow extension origins to load plugins. // TODO(extensions): Revisit this decision once CEF supports more than just // the PDF extension. - *status = CefViewHostMsg_GetPluginInfo_Status::kAllowed; + *status = chrome::mojom::PluginStatus::kAllowed; return true; } CefRefPtr handler = resource_context->GetHandler(); if (!handler) { // No handler so go with the default plugin load decision. - return *status != CefViewHostMsg_GetPluginInfo_Status::kDisabled; + 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)) { - return *status != CefViewHostMsg_GetPluginInfo_Status::kDisabled; + return *status != chrome::mojom::PluginStatus::kDisabled; } CefRefPtr pluginInfo(new CefWebPluginInfoImpl(*plugin)); cef_plugin_policy_t plugin_policy = PLUGIN_POLICY_ALLOW; switch (*status) { - case CefViewHostMsg_GetPluginInfo_Status::kAllowed: + case chrome::mojom::PluginStatus::kAllowed: plugin_policy = PLUGIN_POLICY_ALLOW; break; - case CefViewHostMsg_GetPluginInfo_Status::kBlocked: - case CefViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy: - case CefViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked: - case CefViewHostMsg_GetPluginInfo_Status::kOutdatedDisallowed: - case CefViewHostMsg_GetPluginInfo_Status::kUnauthorized: + case chrome::mojom::PluginStatus::kBlocked: + case chrome::mojom::PluginStatus::kBlockedByPolicy: + case chrome::mojom::PluginStatus::kOutdatedBlocked: + case chrome::mojom::PluginStatus::kOutdatedDisallowed: + case chrome::mojom::PluginStatus::kUnauthorized: plugin_policy = PLUGIN_POLICY_BLOCK; break; - case CefViewHostMsg_GetPluginInfo_Status::kDisabled: + case chrome::mojom::PluginStatus::kDisabled: plugin_policy = PLUGIN_POLICY_DISABLE; break; - case CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent: + case chrome::mojom::PluginStatus::kPlayImportantContent: plugin_policy = PLUGIN_POLICY_DETECT_IMPORTANT; break; default: @@ -137,16 +138,16 @@ bool CefPluginServiceFilter::IsPluginAvailable( pluginInfo.get(), &plugin_policy)) { switch (plugin_policy) { case PLUGIN_POLICY_ALLOW: - *status = CefViewHostMsg_GetPluginInfo_Status::kAllowed; + *status = chrome::mojom::PluginStatus::kAllowed; break; case PLUGIN_POLICY_DETECT_IMPORTANT: - *status = CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent; + *status = chrome::mojom::PluginStatus::kPlayImportantContent; break; case PLUGIN_POLICY_BLOCK: - *status = CefViewHostMsg_GetPluginInfo_Status::kBlocked; + *status = chrome::mojom::PluginStatus::kBlocked; break; case PLUGIN_POLICY_DISABLE: - *status = CefViewHostMsg_GetPluginInfo_Status::kDisabled; + *status = chrome::mojom::PluginStatus::kDisabled; break; } } @@ -156,5 +157,5 @@ bool CefPluginServiceFilter::IsPluginAvailable( is_main_frame, main_frame_origin, *status); - return *status != CefViewHostMsg_GetPluginInfo_Status::kDisabled; + 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 ef61eb0a3..36268ba1e 100644 --- a/libcef/browser/plugins/plugin_service_filter.h +++ b/libcef/browser/plugins/plugin_service_filter.h @@ -5,14 +5,16 @@ #ifndef CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_SERVICE_FILTER_H_ #define CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_SERVICE_FILTER_H_ +#include "chrome/common/plugin.mojom.h" #include "content/public/browser/plugin_service_filter.h" #include "include/internal/cef_types.h" #include "base/macros.h" -class CefResourceContext; -enum class CefViewHostMsg_GetPluginInfo_Status; +namespace content { +class ResourceContext; +} class CefPluginServiceFilter : public content::PluginServiceFilter { public: @@ -32,16 +34,19 @@ class CefPluginServiceFilter : public content::PluginServiceFilter { bool CanLoadPlugin(int render_process_id, const base::FilePath& path) override; + // Called from the above IsPluginAvailable method and from + // PluginInfoHostImpl::Context::FindEnabledPlugin. // Returns false if the plugin is not found or disabled. May call // CefRequestContextHandler::OnBeforePluginLoad if possible/necessary. // See related discussion in issue #2015. bool IsPluginAvailable(int render_process_id, - CefResourceContext* resource_context, + int render_frame_id, + content::ResourceContext* resource_context, const GURL& url, bool is_main_frame, const url::Origin& main_frame_origin, content::WebPluginInfo* plugin, - CefViewHostMsg_GetPluginInfo_Status* status); + chrome::mojom::PluginStatus* status); private: DISALLOW_COPY_AND_ASSIGN(CefPluginServiceFilter); diff --git a/libcef/browser/prefs/browser_prefs.cc b/libcef/browser/prefs/browser_prefs.cc index e5d42dbcf..3f0d723c9 100644 --- a/libcef/browser/prefs/browser_prefs.cc +++ b/libcef/browser/prefs/browser_prefs.cc @@ -16,7 +16,9 @@ #include "base/task_scheduler/post_task.h" #include "base/values.h" #include "chrome/browser/net/prediction_options.h" +#include "chrome/browser/plugins/plugin_info_host_impl.h" #include "chrome/browser/prefs/chrome_command_line_pref_store.h" +#include "chrome/browser/renderer_host/pepper/device_id_fetcher.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" @@ -27,6 +29,7 @@ #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/keyed_service/content/browser_context_dependency_manager.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/json_pref_store.h" #include "components/prefs/pref_filter.h" @@ -45,55 +48,6 @@ namespace browser_prefs { -namespace { - -// A helper function for registering localized values. -// Based on CreateLocaleDefaultValue from -// components/pref_registry/pref_registry_syncable.cc. -void RegisterLocalizedValue(PrefRegistrySimple* registry, - const char* path, - base::Value::Type type, - int message_id) { - const std::string resource_string = l10n_util::GetStringUTF8(message_id); - DCHECK(!resource_string.empty()); - switch (type) { - case base::Value::Type::BOOLEAN: { - if ("true" == resource_string) - registry->RegisterBooleanPref(path, true); - else if ("false" == resource_string) - registry->RegisterBooleanPref(path, false); - return; - } - - case base::Value::Type::INTEGER: { - int val; - base::StringToInt(resource_string, &val); - registry->RegisterIntegerPref(path, val); - return; - } - - case base::Value::Type::DOUBLE: { - double val; - base::StringToDouble(resource_string, &val); - registry->RegisterDoublePref(path, val); - return; - } - - case base::Value::Type::STRING: { - registry->RegisterStringPref(path, resource_string); - return; - } - - default: { - NOTREACHED() - << "list and dictionary types cannot have default locale values"; - } - } - NOTREACHED(); -} - -} // namespace - const char kUserPrefsFileName[] = "UserPrefs.json"; std::unique_ptr CreatePrefService(Profile* profile, @@ -165,71 +119,70 @@ std::unique_ptr CreatePrefService(Profile* profile, scoped_refptr registry( new user_prefs::PrefRegistrySyncable()); + // Some preferences are specific to CEF and others are defined in Chromium. + // The preferred approach for registering preferences defined in Chromium is + // as follows: + // + // 1. If a non-static RegisterProfilePrefs() method exists in a *Factory + // class then add a *Factory::GetInstance() call in + // EnsureBrowserContextKeyedServiceFactoriesBuilt(). + // 2. If a static RegisterPrefs() method exists then call that method in the + // "Default preferences" section below. + // 3. If the default values are not appropriate but the set of registered + // preferences is otherwise fine then change the defaults by calling + // SetDefaultPrefValue after calling the existing registration method. + // 4. If the original registration method contains many unused preferences or + // otherwise inappropiate logic (e.g. calls to objects that CEF doesn't + // use) then register the preferences directly instead of calling the + // existing registration method. + + // Call RegisterProfilePrefs() for all services listed by + // EnsureBrowserContextKeyedServiceFactoriesBuilt(). + BrowserContextDependencyManager::GetInstance() + ->RegisterProfilePrefsForServices(profile, registry.get()); + // Default preferences. CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get()); - PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get()); - extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get()); - HostContentSettingsMap::RegisterProfilePrefs(registry.get()); CefURLRequestContextGetterImpl::RegisterPrefs(registry.get()); + chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get()); + DeviceIDFetcher::RegisterProfilePrefs(registry.get()); + extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get()); + GoogleURLTracker::RegisterProfilePrefs(registry.get()); + HostContentSettingsMap::RegisterProfilePrefs(registry.get()); + PluginInfoHostImpl::RegisterUserPrefs(registry.get()); + PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get()); renderer_prefs::RegisterProfilePrefs(registry.get()); update_client::RegisterPrefs(registry.get()); - content_settings::CookieSettings::RegisterProfilePrefs(registry.get()); - chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get()); - GoogleURLTracker::RegisterProfilePrefs(registry.get()); // Print preferences. + // Based on ProfileImpl::RegisterProfilePrefs. registry->RegisterBooleanPref(prefs::kPrintingEnabled, true); // Spell checking preferences. - // Based on SpellcheckServiceFactory::RegisterProfilePrefs. - registry->RegisterListPref(spellcheck::prefs::kSpellCheckDictionaries, - base::MakeUnique()); + // Modify defaults from SpellcheckServiceFactory::RegisterProfilePrefs. std::string spellcheck_lang = command_line->GetSwitchValueASCII(switches::kOverrideSpellCheckLang); if (!spellcheck_lang.empty()) { - registry->RegisterStringPref(spellcheck::prefs::kSpellCheckDictionary, - spellcheck_lang); - } else { - RegisterLocalizedValue( - registry.get(), spellcheck::prefs::kSpellCheckDictionary, - base::Value::Type::STRING, IDS_SPELLCHECK_DICTIONARY); + registry->SetDefaultPrefValue(spellcheck::prefs::kSpellCheckDictionary, + base::Value(spellcheck_lang)); } - registry->RegisterBooleanPref( + const bool enable_spelling_service_ = + command_line->HasSwitch(switches::kEnableSpellingService); + registry->SetDefaultPrefValue( spellcheck::prefs::kSpellCheckUseSpellingService, - command_line->HasSwitch(switches::kEnableSpellingService)); - registry->RegisterBooleanPref( - spellcheck::prefs::kEnableSpellcheck, - !command_line->HasSwitch(switches::kDisableSpellChecking)); + base::Value(enable_spelling_service_)); + registry->SetDefaultPrefValue(spellcheck::prefs::kEnableSpellcheck, + base::Value(!enable_spelling_service_)); // Pepper flash preferences. - // Based on DeviceIDFetcher::RegisterProfilePrefs. - registry->RegisterBooleanPref(prefs::kEnableDRM, false); - registry->RegisterStringPref(prefs::kDRMSalt, ""); + // Modify defaults from DeviceIDFetcher::RegisterProfilePrefs. + registry->SetDefaultPrefValue(prefs::kEnableDRM, base::Value(false)); // Authentication preferences. + // Based on IOThread::RegisterPrefs. registry->RegisterStringPref(prefs::kAuthServerWhitelist, ""); registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist, ""); - // Plugin preferences. - // Based on chrome::RegisterBrowserUserPrefs. - registry->RegisterBooleanPref(prefs::kPluginsAllowOutdated, false); - registry->RegisterBooleanPref(prefs::kPluginsAlwaysAuthorize, false); - -// Theme preferences. -// Based on ThemeServiceFactory::RegisterProfilePrefs. -// TODO(cef/chrome): Remove this once CEF supports ThemeService. -#if defined(USE_X11) - registry->RegisterBooleanPref(prefs::kUsesSystemTheme, false); -#endif - registry->RegisterFilePathPref(prefs::kCurrentThemePackFilename, - base::FilePath()); - registry->RegisterStringPref(prefs::kCurrentThemeID, - ThemeService::kDefaultThemeID); - registry->RegisterDictionaryPref(prefs::kCurrentThemeImages); - registry->RegisterDictionaryPref(prefs::kCurrentThemeColors); - registry->RegisterDictionaryPref(prefs::kCurrentThemeTints); - registry->RegisterDictionaryPref(prefs::kCurrentThemeDisplayProperties); - // Browser UI preferences. // Based on chrome/browser/ui/browser_ui_prefs.cc RegisterBrowserPrefs. registry->RegisterBooleanPref(prefs::kAllowFileSelectionDialogs, true); diff --git a/libcef/browser/printing/print_view_manager_base.cc b/libcef/browser/printing/print_view_manager_base.cc index 0da409927..42beb3592 100644 --- a/libcef/browser/printing/print_view_manager_base.cc +++ b/libcef/browser/printing/print_view_manager_base.cc @@ -9,9 +9,9 @@ #include "base/auto_reset.h" #include "base/bind.h" -#include "base/feature_list.h" #include "base/location.h" #include "base/memory/ptr_util.h" +#include "base/memory/shared_memory.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" @@ -25,11 +25,13 @@ #include "chrome/browser/printing/print_job_manager.h" #include "chrome/browser/printing/printer_query.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/common/chrome_features.h" #include "chrome/common/pref_names.h" #include "chrome/grit/generated_resources.h" #include "components/prefs/pref_service.h" +#include "components/printing/browser/print_composite_client.h" +#include "components/printing/browser/print_manager_utils.h" #include "components/printing/common/print_messages.h" +#include "components/printing/service/public/cpp/pdf_service_mojo_utils.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" @@ -37,14 +39,16 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" +#include "mojo/public/cpp/system/buffer.h" #include "printing/features/features.h" #include "printing/pdf_metafile_skia.h" +#include "printing/print_settings.h" #include "printing/printed_document.h" #include "ui/base/l10n/l10n_util.h" #if defined(OS_WIN) #include "base/command_line.h" -#include "chrome/common/chrome_switches.h" +#include "chrome/common/chrome_features.h" #endif using base::TimeDelta; @@ -58,10 +62,9 @@ CefPrintViewManagerBase::CefPrintViewManagerBase( printing_rfh_(nullptr), printing_succeeded_(false), inside_inner_message_loop_(false), -#if !defined(OS_MACOSX) expecting_first_page_(true), -#endif - queue_(g_browser_process->print_job_manager()->queue()) { + queue_(g_browser_process->print_job_manager()->queue()), + weak_ptr_factory_(this) { DCHECK(queue_.get()); Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); @@ -110,8 +113,22 @@ void CefPrintViewManagerBase::OnDidGetPrintedPagesCount(int cookie, OpportunisticallyCreatePrintJob(cookie); } +void CefPrintViewManagerBase::OnComposePdfDone( + const PrintHostMsg_DidPrintPage_Params& params, + mojom::PdfCompositor::Status status, + mojo::ScopedSharedBufferHandle handle) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + if (status != mojom::PdfCompositor::Status::SUCCESS) { + DLOG(ERROR) << "Compositing pdf failed with error " << status; + return; + } + + UpdateForPrintedPage(params, true, GetShmFromMojoHandle(std::move(handle))); +} + void CefPrintViewManagerBase::OnDidPrintPage( const PrintHostMsg_DidPrintPage_Params& params) { + // Ready to composite. Starting a print job. if (!OpportunisticallyCreatePrintJob(params.document_cookie)) return; @@ -122,12 +139,8 @@ void CefPrintViewManagerBase::OnDidPrintPage( return; } -#if defined(OS_MACOSX) - const bool metafile_must_be_valid = true; -#else const bool metafile_must_be_valid = expecting_first_page_; expecting_first_page_ = false; -#endif // Only used when |metafile_must_be_valid| is true. std::unique_ptr shared_buf; @@ -137,8 +150,18 @@ void CefPrintViewManagerBase::OnDidPrintPage( web_contents()->Stop(); return; } + + auto* client = PrintCompositeClient::FromWebContents(web_contents()); + if (IsOopifEnabled() && !client->for_preview() && + !document->settings().is_modifiable()) { + client->DoComposite( + params.metafile_data_handle, params.data_size, + base::BindOnce(&CefPrintViewManagerBase::OnComposePdfDone, + weak_ptr_factory_.GetWeakPtr(), params)); + return; + } shared_buf = - base::MakeUnique(params.metafile_data_handle, true); + std::make_unique(params.metafile_data_handle, true); if (!shared_buf->Map(params.data_size)) { NOTREACHED() << "couldn't map"; web_contents()->Stop(); @@ -153,22 +176,23 @@ void CefPrintViewManagerBase::OnDidPrintPage( } } - std::unique_ptr metafile( - new PdfMetafileSkia(SkiaDocumentType::PDF)); - if (metafile_must_be_valid) { - if (!metafile->InitFromData(shared_buf->memory(), params.data_size)) { - NOTREACHED() << "Invalid metafile header"; - web_contents()->Stop(); - return; - } - } + UpdateForPrintedPage(params, metafile_must_be_valid, std::move(shared_buf)); +} + +void CefPrintViewManagerBase::UpdateForPrintedPage( + const PrintHostMsg_DidPrintPage_Params& params, + bool has_valid_page_data, + std::unique_ptr shared_buf) { + PrintedDocument* document = print_job_->document(); + if (!document) + return; #if defined(OS_WIN) print_job_->AppendPrintedPage(params.page_number); - if (metafile_must_be_valid) { - scoped_refptr bytes = new base::RefCountedBytes( + if (has_valid_page_data) { + scoped_refptr bytes(new base::RefCountedBytes( reinterpret_cast(shared_buf->memory()), - params.data_size); + shared_buf->mapped_size())); document->DebugDumpData(bytes.get(), FILE_PATH_LITERAL(".pdf")); @@ -195,12 +219,20 @@ void CefPrintViewManagerBase::OnDidPrintPage( } } #else + std::unique_ptr metafile = + std::make_unique(SkiaDocumentType::PDF); + if (has_valid_page_data) { + if (!metafile->InitFromData(shared_buf->memory(), + shared_buf->mapped_size())) { + NOTREACHED() << "Invalid metafile header"; + web_contents()->Stop(); + return; + } + } + // Update the rendered document. It will send notifications to the listener. - document->SetPage(params.page_number, std::move(metafile), -#if defined(OS_WIN) - 0.0f /* dummy shrink_factor */, -#endif - params.page_size, params.content_area); + document->SetPage(params.page_number, std::move(metafile), params.page_size, + params.content_area); ShouldQuitFromInnerMessageLoop(); #endif @@ -405,9 +437,7 @@ void CefPrintViewManagerBase::DisconnectFromCurrentPrintJob() { // DO NOT wait for the job to finish. ReleasePrintJob(); } -#if !defined(OS_MACOSX) expecting_first_page_ = true; -#endif } void CefPrintViewManagerBase::TerminatePrintJob(bool cancel) { diff --git a/libcef/browser/printing/print_view_manager_base.h b/libcef/browser/printing/print_view_manager_base.h index 60e6009a8..d2d54ac59 100644 --- a/libcef/browser/printing/print_view_manager_base.h +++ b/libcef/browser/printing/print_view_manager_base.h @@ -9,16 +9,23 @@ #include "base/macros.h" #include "base/memory/ref_counted.h" +#include "base/memory/weak_ptr.h" #include "base/strings/string16.h" #include "build/build_config.h" #include "components/prefs/pref_member.h" #include "components/printing/browser/print_manager.h" +#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" +#include "mojo/public/cpp/system/platform_handle.h" #include "printing/features/features.h" struct PrintHostMsg_DidPrintPage_Params; +namespace base { +class SharedMemory; +} + namespace content { class RenderFrameHost; } @@ -26,7 +33,6 @@ class RenderFrameHost; namespace printing { class JobEventDetails; -class MetafilePlayer; class PrintJob; class PrintJobWorkerOwner; class PrintQueriesQueue; @@ -77,9 +83,19 @@ class CefPrintViewManagerBase : public content::NotificationObserver, // IPC Message handlers. void OnDidGetPrintedPagesCount(int cookie, int number_pages) override; - void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); void OnPrintingFailed(int cookie) override; void OnShowInvalidPrinterSettingsError(); + void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); + + // Handle extra tasks once a page or doc is printed. + void UpdateForPrintedPage(const PrintHostMsg_DidPrintPage_Params& params, + bool has_valid_page_data, + std::unique_ptr shared_buf); + + // IPC message handlers for service. + void OnComposePdfDone(const PrintHostMsg_DidPrintPage_Params& params, + mojom::PdfCompositor::Status status, + mojo::ScopedSharedBufferHandle handle); // Processes a NOTIFY_PRINT_JOB_EVENT notification. void OnNotifyPrintJobEvent(const JobEventDetails& event_details); @@ -148,16 +164,16 @@ class CefPrintViewManagerBase : public content::NotificationObserver, // print settings are being loaded. bool inside_inner_message_loop_; -#if !defined(OS_MACOSX) // Set to true when OnDidPrintPage() should be expecting the first page. bool expecting_first_page_; -#endif // OS_MACOSX // Whether printing is enabled. BooleanPrefMember printing_enabled_; scoped_refptr queue_; + base::WeakPtrFactory weak_ptr_factory_; + DISALLOW_COPY_AND_ASSIGN(CefPrintViewManagerBase); }; diff --git a/libcef/browser/request_context_impl.cc b/libcef/browser/request_context_impl.cc index 0533d4a57..a0e3bc30b 100644 --- a/libcef/browser/request_context_impl.cc +++ b/libcef/browser/request_context_impl.cc @@ -436,10 +436,10 @@ bool CefRequestContextImpl::SetPreference(const CefString& name, CefValueImpl::ScopedLockedValue scoped_locked_value(impl); base::Value* impl_value = impl->GetValueUnsafe(); - if (pref->GetType() != impl_value->GetType()) { + if (pref->GetType() != impl_value->type()) { error = base::StringPrintf( "Trying to set a preference of type %s to value of type %s", - GetTypeString(pref->GetType()), GetTypeString(impl_value->GetType())); + GetTypeString(pref->GetType()), GetTypeString(impl_value->type())); return false; } diff --git a/libcef/browser/resource_context.cc b/libcef/browser/resource_context.cc index 90a576793..41c1418cc 100644 --- a/libcef/browser/resource_context.cc +++ b/libcef/browser/resource_context.cc @@ -118,7 +118,7 @@ void CefResourceContext::AddPluginLoadDecision( const base::FilePath& plugin_path, bool is_main_frame, const url::Origin& main_frame_origin, - CefViewHostMsg_GetPluginInfo_Status status) { + chrome::mojom::PluginStatus status) { CEF_REQUIRE_IOT(); DCHECK_GE(render_process_id, 0); DCHECK(!plugin_path.empty()); @@ -134,7 +134,7 @@ bool CefResourceContext::HasPluginLoadDecision( const base::FilePath& plugin_path, bool is_main_frame, const url::Origin& main_frame_origin, - CefViewHostMsg_GetPluginInfo_Status* status) const { + chrome::mojom::PluginStatus* status) const { CEF_REQUIRE_IOT(); DCHECK_GE(render_process_id, 0); DCHECK(!plugin_path.empty()); diff --git a/libcef/browser/resource_context.h b/libcef/browser/resource_context.h index 19c4b2bf3..238733f5b 100644 --- a/libcef/browser/resource_context.h +++ b/libcef/browser/resource_context.h @@ -10,13 +10,13 @@ #include "include/cef_request_context_handler.h" #include "base/files/file_path.h" +#include "chrome/common/plugin.mojom.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 CefURLRequestContextGetter; -enum class CefViewHostMsg_GetPluginInfo_Status; // Acts as a bridge for resource loading. Life span is controlled by // CefBrowserContext. Created on the UI thread but accessed and destroyed on the @@ -53,12 +53,12 @@ class CefResourceContext : public content::ResourceContext { const base::FilePath& plugin_path, bool is_main_frame, const url::Origin& main_frame_origin, - CefViewHostMsg_GetPluginInfo_Status status); + 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, - CefViewHostMsg_GetPluginInfo_Status* status) const; + 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. @@ -88,7 +88,7 @@ class CefResourceContext : public content::ResourceContext { // plugin load decision. typedef std::map< std::pair, std::pair>, - CefViewHostMsg_GetPluginInfo_Status> + chrome::mojom::PluginStatus> PluginLoadDecisionMap; PluginLoadDecisionMap plugin_load_decision_map_; diff --git a/libcef/browser/ssl_host_state_delegate.cc b/libcef/browser/ssl_host_state_delegate.cc index f51c42a5a..f5e6b206f 100644 --- a/libcef/browser/ssl_host_state_delegate.cc +++ b/libcef/browser/ssl_host_state_delegate.cc @@ -11,13 +11,6 @@ using content::SSLHostStateDelegate; namespace internal { -net::SHA256HashValue getChainFingerprint256(const net::X509Certificate& cert) { - net::SHA256HashValue fingerprint = - net::X509Certificate::CalculateChainFingerprint256( - cert.os_cert_handle(), cert.GetIntermediateCertificates()); - return fingerprint; -} - CertPolicy::CertPolicy() {} CertPolicy::~CertPolicy() {} @@ -26,7 +19,7 @@ CertPolicy::~CertPolicy() {} // in the saved CertStatus. bool CertPolicy::Check(const net::X509Certificate& cert, net::CertStatus error) const { - net::SHA256HashValue fingerprint = getChainFingerprint256(cert); + net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256(); std::map::const_iterator allowed_iter = allowed_.find(fingerprint); @@ -41,7 +34,7 @@ void CertPolicy::Allow(const net::X509Certificate& cert, net::CertStatus error) { // If this same cert had already been saved with a different error status, // this will replace it with the new error status. - net::SHA256HashValue fingerprint = getChainFingerprint256(cert); + net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256(); allowed_[fingerprint] = error; } diff --git a/libcef/browser/storage_partition_proxy.cc b/libcef/browser/storage_partition_proxy.cc index c52a3c34d..58a54819c 100644 --- a/libcef/browser/storage_partition_proxy.cc +++ b/libcef/browser/storage_partition_proxy.cc @@ -125,10 +125,9 @@ void CefStoragePartitionProxy::ClearDataForOrigin( uint32_t remove_mask, uint32_t quota_storage_remove_mask, const GURL& storage_origin, - net::URLRequestContextGetter* rq_context, - const base::Closure& callback) { + net::URLRequestContextGetter* rq_context) { parent_->ClearDataForOrigin(remove_mask, quota_storage_remove_mask, - storage_origin, rq_context, callback); + storage_origin, rq_context); } void CefStoragePartitionProxy::ClearData( @@ -138,9 +137,9 @@ void CefStoragePartitionProxy::ClearData( const OriginMatcherFunction& origin_matcher, const base::Time begin, const base::Time end, - const base::Closure& callback) { + base::OnceClosure callback) { parent_->ClearData(remove_mask, quota_storage_remove_mask, storage_origin, - origin_matcher, begin, end, callback); + origin_matcher, begin, end, std::move(callback)); } void CefStoragePartitionProxy::ClearData( @@ -150,17 +149,18 @@ void CefStoragePartitionProxy::ClearData( const CookieMatcherFunction& cookie_matcher, const base::Time begin, const base::Time end, - const base::Closure& callback) { + base::OnceClosure callback) { parent_->ClearData(remove_mask, quota_storage_remove_mask, origin_matcher, - cookie_matcher, begin, end, callback); + cookie_matcher, begin, end, std::move(callback)); } void CefStoragePartitionProxy::ClearHttpAndMediaCaches( const base::Time begin, const base::Time end, const base::Callback& url_matcher, - const base::Closure& callback) { - parent_->ClearHttpAndMediaCaches(begin, end, url_matcher, callback); + base::OnceClosure callback) { + parent_->ClearHttpAndMediaCaches(begin, end, url_matcher, + std::move(callback)); } void CefStoragePartitionProxy::Flush() { @@ -171,6 +171,11 @@ void CefStoragePartitionProxy::ClearBluetoothAllowedDevicesMapForTesting() { parent_->ClearBluetoothAllowedDevicesMapForTesting(); } +void CefStoragePartitionProxy::SetNetworkFactoryForTesting( + content::mojom::URLLoaderFactory* test_factory) { + parent_->SetNetworkFactoryForTesting(test_factory); +} + content::URLLoaderFactoryGetter* CefStoragePartitionProxy::url_loader_factory_getter() { return parent_->url_loader_factory_getter(); diff --git a/libcef/browser/storage_partition_proxy.h b/libcef/browser/storage_partition_proxy.h index acbb7de65..2c1df8247 100644 --- a/libcef/browser/storage_partition_proxy.h +++ b/libcef/browser/storage_partition_proxy.h @@ -50,29 +50,30 @@ class CefStoragePartitionProxy : public content::StoragePartition { void ClearDataForOrigin(uint32_t remove_mask, uint32_t quota_storage_remove_mask, const GURL& storage_origin, - net::URLRequestContextGetter* rq_context, - const base::Closure& callback); + net::URLRequestContextGetter* rq_context) override; void ClearData(uint32_t remove_mask, uint32_t quota_storage_remove_mask, const GURL& storage_origin, const OriginMatcherFunction& origin_matcher, const base::Time begin, const base::Time end, - const base::Closure& callback); + base::OnceClosure callback) override; void ClearData(uint32_t remove_mask, uint32_t quota_storage_remove_mask, const OriginMatcherFunction& origin_matcher, const CookieMatcherFunction& cookie_matcher, const base::Time begin, const base::Time end, - const base::Closure& callback) override; + base::OnceClosure callback) override; void ClearHttpAndMediaCaches( const base::Time begin, const base::Time end, const base::Callback& url_matcher, - const base::Closure& callback) override; + base::OnceClosure callback) override; void Flush() override; void ClearBluetoothAllowedDevicesMapForTesting() override; + void SetNetworkFactoryForTesting( + content::mojom::URLLoaderFactory* test_factory) override; content::URLLoaderFactoryGetter* url_loader_factory_getter() override; content::BrowserContext* browser_context() const override; mojo::BindingId Bind( diff --git a/libcef/browser/views/view_util.cc b/libcef/browser/views/view_util.cc index 040090b71..4e22f99e4 100644 --- a/libcef/browser/views/view_util.cc +++ b/libcef/browser/views/view_util.cc @@ -182,8 +182,10 @@ display::Display GetDisplayNearestPoint(const gfx::Point& point, bool input_pixel_coords) { gfx::Point find_point = point; #if defined(OS_WIN) - if (input_pixel_coords) - find_point = display::win::ScreenWin::ScreenToDIPPoint(point); + if (input_pixel_coords) { + find_point = gfx::ToFlooredPoint( + display::win::ScreenWin::ScreenToDIPPoint(gfx::PointF(point))); + } #endif return display::Screen::GetScreen()->GetDisplayNearestPoint(find_point); } diff --git a/libcef/common/cef_crash_report_upload_thread.cc b/libcef/common/cef_crash_report_upload_thread.cc index 0635aa0aa..99562a46f 100644 --- a/libcef/common/cef_crash_report_upload_thread.cc +++ b/libcef/common/cef_crash_report_upload_thread.cc @@ -43,15 +43,9 @@ class CallRecordUploadAttempt { CefCrashReportUploadThread::CefCrashReportUploadThread( CrashReportDatabase* database, const std::string& url, - bool watch_pending_reports, - bool rate_limit, - bool upload_gzip, + const Options& options, int max_uploads) - : CrashReportUploadThread(database, - url, - watch_pending_reports, - rate_limit, - upload_gzip), + : CrashReportUploadThread(database, url, options), max_uploads_(max_uploads) {} CefCrashReportUploadThread::~CefCrashReportUploadThread() {} @@ -173,7 +167,7 @@ bool CefCrashReportUploadThread::UploadsEnabled() const { } bool CefCrashReportUploadThread::MaxUploadsEnabled() const { - return rate_limit_ && max_uploads_ > 0; + return options_.rate_limit && max_uploads_ > 0; } bool CefCrashReportUploadThread::MaxUploadsExceeded() const { @@ -181,7 +175,7 @@ bool CefCrashReportUploadThread::MaxUploadsExceeded() const { } bool CefCrashReportUploadThread::BackoffPending() const { - if (!rate_limit_) + if (!options_.rate_limit) return false; Settings* const settings = database_->GetSettings(); @@ -198,7 +192,7 @@ bool CefCrashReportUploadThread::BackoffPending() const { } void CefCrashReportUploadThread::IncreaseBackoff() { - if (!rate_limit_) + if (!options_.rate_limit) return; const int kHour = 60 * 60; // 1 hour @@ -236,7 +230,7 @@ void CefCrashReportUploadThread::IncreaseBackoff() { } void CefCrashReportUploadThread::ResetBackoff() { - if (!rate_limit_) + if (!options_.rate_limit) return; Settings* settings = database_->GetSettings(); diff --git a/libcef/common/cef_crash_report_upload_thread.h b/libcef/common/cef_crash_report_upload_thread.h index 77883dc7f..260eec5e1 100644 --- a/libcef/common/cef_crash_report_upload_thread.h +++ b/libcef/common/cef_crash_report_upload_thread.h @@ -11,9 +11,7 @@ class CefCrashReportUploadThread : public crashpad::CrashReportUploadThread { public: CefCrashReportUploadThread(crashpad::CrashReportDatabase* database, const std::string& url, - bool watch_pending_reports, - bool rate_limit, - bool upload_gzip, + const Options& options, int max_uploads); ~CefCrashReportUploadThread(); diff --git a/libcef/common/cef_messages.h b/libcef/common/cef_messages.h index 6c6502b89..dfd11aaaf 100644 --- a/libcef/common/cef_messages.h +++ b/libcef/common/cef_messages.h @@ -21,20 +21,6 @@ #ifndef CEF_LIBCEF_COMMON_CEF_MESSAGES_H_ #define CEF_LIBCEF_COMMON_CEF_MESSAGES_H_ -// Based on ChromeViewHostMsg_GetPluginInfo_Status. -enum class CefViewHostMsg_GetPluginInfo_Status { - kAllowed, - kBlocked, - kBlockedByPolicy, - kDisabled, - kNotFound, - kNPAPINotSupported, - kOutdatedBlocked, - kOutdatedDisallowed, - kPlayImportantContent, - kUnauthorized, -}; - namespace IPC { // Extracted from chrome/common/automation_messages.h. @@ -207,44 +193,6 @@ IPC_SYNC_MESSAGE_CONTROL1_1( int /* render_frame_routing_id */, CefProcessHostMsg_GetNewBrowserInfo_Params /* params*/) -IPC_ENUM_TRAITS_MAX_VALUE(CefViewHostMsg_GetPluginInfo_Status, - CefViewHostMsg_GetPluginInfo_Status::kUnauthorized) - -// Output parameters for CefViewHostMsg_GetPluginInfo message. -IPC_STRUCT_BEGIN(CefViewHostMsg_GetPluginInfo_Output) - IPC_STRUCT_MEMBER(CefViewHostMsg_GetPluginInfo_Status, status) - IPC_STRUCT_MEMBER(content::WebPluginInfo, plugin) - IPC_STRUCT_MEMBER(std::string, actual_mime_type) - IPC_STRUCT_MEMBER(std::string, group_identifier) - IPC_STRUCT_MEMBER(base::string16, group_name) -IPC_STRUCT_END() - -// Return information about a plugin for the given URL and MIME type. -// In contrast to ViewHostMsg_GetPluginInfo in content/, this IPC call knows -// about specific reasons why a plugin can't be used, for example because it's -// disabled. Based on ChromeViewHostMsg_GetPluginInfo. -IPC_SYNC_MESSAGE_CONTROL5_1(CefViewHostMsg_GetPluginInfo, - int /* render_frame_id */, - GURL /* url */, - bool /* is_main_frame */, - url::Origin /* top_origin_url */, - std::string /* mime_type */, - CefViewHostMsg_GetPluginInfo_Output /* output */) - -// Returns whether any internal plugin supporting |mime_type| is registered and -// enabled. Does not determine whether the plugin can actually be instantiated -// (e.g. whether it has all its dependencies). -// When the returned *|is_available| is true, |additional_param_names| and -// |additional_param_values| contain the name-value pairs, if any, specified -// for the *first* non-disabled plugin found that is registered for |mime_type|. -// Based on ChromeViewHostMsg_IsInternalPluginAvailableForMimeType. -IPC_SYNC_MESSAGE_CONTROL1_3( - CefViewHostMsg_IsInternalPluginAvailableForMimeType, - std::string /* mime_type */, - bool /* is_available */, - std::vector /* additional_param_names */, - std::vector /* additional_param_values */) - // Sent when a frame is identified for the first time. IPC_MESSAGE_ROUTED3(CefHostMsg_FrameIdentified, int64_t /* frame_id */, diff --git a/libcef/common/content_client.cc b/libcef/common/content_client.cc index 807194243..2119437b3 100644 --- a/libcef/common/content_client.cc +++ b/libcef/common/content_client.cc @@ -91,7 +91,7 @@ content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path, plugin.is_out_of_process = true; plugin.name = content::kFlashPluginName; plugin.path = path; - plugin.permissions = chrome::kPepperFlashPermissions; + plugin.permissions = kPepperFlashPermissions; std::vector flash_version_numbers = base::SplitString( version, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); @@ -170,7 +170,7 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) { return false; base::Version version; - if (!chrome::CheckPepperFlashManifest(*manifest, &version)) + if (!CheckPepperFlashManifest(*manifest, &version)) return false; *plugin = CreatePepperFlashInfo(flash_filename, version.GetString()); diff --git a/libcef/common/crash_reporting.cc b/libcef/common/crash_reporting.cc index f9dc56d93..4b8943be6 100644 --- a/libcef/common/crash_reporting.cc +++ b/libcef/common/crash_reporting.cc @@ -12,6 +12,7 @@ #include "base/debug/crash_logging.h" #include "base/strings/string_util.h" #include "chrome/common/crash_keys.h" +#include "components/crash/core/common/crash_key.h" #include "content/public/common/content_switches.h" #if defined(OS_MACOSX) @@ -161,6 +162,8 @@ void PreSandboxStartup(const base::CommandLine& command_line, << (process_type.empty() ? "browser" : process_type.c_str()); } + crash_reporter::InitializeCrashKeys(); + // After platform crash reporting have been initialized, store the command // line for crash reporting. crash_keys::SetSwitchesFromCommandLine(command_line, &IsBoringCEFSwitch); diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc index ed2ad57dc..88e77e503 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/main_delegate.cc @@ -541,7 +541,7 @@ void CefMainDelegate::PreSandboxStartup() { crash_reporting::PreSandboxStartup(*command_line, process_type); InitializeResourceBundle(); - chrome::InitializePDF(); + InitializePDF(); } void CefMainDelegate::SandboxInitialized(const std::string& process_type) { @@ -589,7 +589,7 @@ void CefMainDelegate::ProcessExiting(const std::string& process_type) { ui::ResourceBundle::CleanupSharedInstance(); } -#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) +#if defined(OS_LINUX) void CefMainDelegate::ZygoteForked() { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); const std::string& process_type = diff --git a/libcef/common/main_delegate.h b/libcef/common/main_delegate.h index 3e188734b..bf70c5529 100644 --- a/libcef/common/main_delegate.h +++ b/libcef/common/main_delegate.h @@ -17,7 +17,7 @@ namespace base { class CommandLine; class Thread; -} +} // namespace base namespace content { class BrowserMainRunner; @@ -39,7 +39,7 @@ class CefMainDelegate : public content::ContentMainDelegate { const std::string& process_type, const content::MainFunctionParams& main_function_params) override; void ProcessExiting(const std::string& process_type) override; -#if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) +#if defined(OS_LINUX) void ZygoteForked() override; #endif content::ContentBrowserClient* CreateContentBrowserClient() override; diff --git a/libcef/common/request_impl.cc b/libcef/common/request_impl.cc index 6e3aa0d72..9d1e4e372 100644 --- a/libcef/common/request_impl.cc +++ b/libcef/common/request_impl.cc @@ -33,12 +33,12 @@ #include "net/http/http_util.h" #include "net/url_request/url_fetcher.h" #include "net/url_request/url_request.h" -#include "third_party/WebKit/public/platform/WebCachePolicy.h" #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/WebURLError.h" #include "third_party/WebKit/public/platform/WebURLRequest.h" +#include "third_party/WebKit/public/platform/modules/fetch/fetch_api_request.mojom-shared.h" #include "third_party/WebKit/public/web/WebSecurityPolicy.h" namespace { @@ -149,24 +149,24 @@ int GetCacheControlHeaderPolicy(CefRequest::HeaderMap headerMap) { } // Convert cef_urlrequest_flags_t to blink::WebCachePolicy. -blink::WebCachePolicy GetWebCachePolicy(int ur_flags) { +blink::mojom::FetchCacheMode GetFetchCacheMode(int ur_flags) { if ((ur_flags & kURCachePolicyMask) == kURCachePolicyMask) { - return blink::WebCachePolicy::kBypassCacheLoadOnlyFromCache; + return blink::mojom::FetchCacheMode::kUnspecifiedForceCacheMiss; } else if (ur_flags & UR_FLAG_SKIP_CACHE) { - return blink::WebCachePolicy::kBypassingCache; + return blink::mojom::FetchCacheMode::kBypassCache; } else if (ur_flags & UR_FLAG_ONLY_FROM_CACHE) { - return blink::WebCachePolicy::kReturnCacheDataDontLoad; + return blink::mojom::FetchCacheMode::kOnlyIfCached; } - return blink::WebCachePolicy::kUseProtocolCachePolicy; + return blink::mojom::FetchCacheMode::kDefault; } // Convert blink::WebCachePolicy to cef_urlrequest_flags_t. -int GetURCachePolicy(blink::WebCachePolicy web_policy) { - if (web_policy == blink::WebCachePolicy::kBypassCacheLoadOnlyFromCache) { +int GetURCachePolicy(blink::mojom::FetchCacheMode cache_mode) { + if (cache_mode == blink::mojom::FetchCacheMode::kUnspecifiedForceCacheMiss) { return kURCachePolicyMask; - } else if (web_policy == blink::WebCachePolicy::kBypassingCache) { + } else if (cache_mode == blink::mojom::FetchCacheMode::kBypassCache) { return UR_FLAG_SKIP_CACHE; - } else if (web_policy == blink::WebCachePolicy::kReturnCacheDataDontLoad) { + } else if (cache_mode == blink::mojom::FetchCacheMode::kOnlyIfCached) { return UR_FLAG_ONLY_FROM_CACHE; } return 0; @@ -566,7 +566,7 @@ void CefRequestImpl::Set(const blink::WebURLRequest& request) { site_for_cookies_ = request.SiteForCookies(); - flags_ |= GetURCachePolicy(request.GetCachePolicy()); + flags_ |= GetURCachePolicy(request.GetCacheMode()); if (request.AllowStoredCredentials()) flags_ |= UR_FLAG_ALLOW_STORED_CREDENTIALS; if (request.ReportUploadProgress()) @@ -621,7 +621,7 @@ void CefRequestImpl::Get(blink::WebURLRequest& request, // explicitly set on the request. flags |= GetCacheControlHeaderPolicy(headermap_); } - request.SetCachePolicy(GetWebCachePolicy(flags)); + request.SetCacheMode(GetFetchCacheMode(flags)); SETBOOLFLAG(request, flags_, SetAllowStoredCredentials, UR_FLAG_ALLOW_STORED_CREDENTIALS); @@ -706,7 +706,7 @@ void CefRequestImpl::Get(const CefMsg_LoadRequest_Params& params, // explicitly set on the request. flags |= GetCacheControlHeaderPolicy(headerMap); } - request.SetCachePolicy(GetWebCachePolicy(flags)); + request.SetCacheMode(GetFetchCacheMode(flags)); SETBOOLFLAG(request, params.load_flags, SetAllowStoredCredentials, UR_FLAG_ALLOW_STORED_CREDENTIALS); @@ -804,7 +804,7 @@ void CefRequestImpl::Get(net::URLFetcher& fetcher, } if (!site_for_cookies_.is_empty()) - fetcher.SetInitiator(url::Origin(site_for_cookies_)); + fetcher.SetInitiator(url::Origin::Create(site_for_cookies_)); int flags = flags_; if (!(flags & kURCachePolicyMask)) { @@ -1415,8 +1415,7 @@ void CefPostDataElementImpl::Get(blink::WebHTTPBody::Element& element) const { data_.bytes.size); } else if (type_ == PDE_TYPE_FILE) { element.type = blink::WebHTTPBody::Element::kTypeFile; - element.file_path.Assign( - blink::WebString::FromUTF16(CefString(&data_.filename))); + element.file_path = blink::WebString::FromUTF16(CefString(&data_.filename)); } else { NOTREACHED(); } diff --git a/libcef/common/extensions/api/browser_manifest_overlay.json b/libcef/common/service_manifests/browser_manifest_overlay.json similarity index 78% rename from libcef/common/extensions/api/browser_manifest_overlay.json rename to libcef/common/service_manifests/browser_manifest_overlay.json index 3ec4cfa42..6964d6a2a 100644 --- a/libcef/common/extensions/api/browser_manifest_overlay.json +++ b/libcef/common/service_manifests/browser_manifest_overlay.json @@ -7,9 +7,7 @@ "renderer": [ "blink::mojom::BudgetService", "metrics::mojom::LeakDetector", - "mojom::ModuleEventSink", - "spellcheck::mojom::SpellCheckHost", - "startup_metric_utils::mojom::StartupMetricHost" + "mojom::ModuleEventSink" ] } }, diff --git a/libcef/common/service_manifests/packaged_services_manifest_overlay.json b/libcef/common/service_manifests/packaged_services_manifest_overlay.json new file mode 100644 index 000000000..33fc4cdfb --- /dev/null +++ b/libcef/common/service_manifests/packaged_services_manifest_overlay.json @@ -0,0 +1,5 @@ +{ + "name": "content_packaged_services", + "display_name": "CEF Packaged Services", + "interface_provider_specs": {} +} \ No newline at end of file diff --git a/libcef/common/extensions/api/renderer_manifest_overlay.json b/libcef/common/service_manifests/renderer_manifest_overlay.json similarity index 77% rename from libcef/common/extensions/api/renderer_manifest_overlay.json rename to libcef/common/service_manifests/renderer_manifest_overlay.json index c5b5ccc29..2d3535cc9 100644 --- a/libcef/common/extensions/api/renderer_manifest_overlay.json +++ b/libcef/common/service_manifests/renderer_manifest_overlay.json @@ -6,6 +6,9 @@ "browser": [ "spellcheck::mojom::SpellChecker" ] + }, + "requires": { + "chrome": [ "renderer" ] } } } diff --git a/libcef/common/extensions/api/utility_manifest_overlay.json b/libcef/common/service_manifests/utility_manifest_overlay.json similarity index 100% rename from libcef/common/extensions/api/utility_manifest_overlay.json rename to libcef/common/service_manifests/utility_manifest_overlay.json diff --git a/libcef/common/values_impl.cc b/libcef/common/values_impl.cc index 9803a6384..a96e40cc6 100644 --- a/libcef/common/values_impl.cc +++ b/libcef/common/values_impl.cc @@ -219,7 +219,7 @@ CefValueType CefValueImpl::GetType() { return VTYPE_LIST; if (value_) { - switch (value_->GetType()) { + switch (value_->type()) { case base::Value::Type::NONE: return VTYPE_NULL; case base::Value::Type::BOOLEAN: @@ -345,7 +345,7 @@ void CefValueImpl::SetValueInternal(base::Value* value) { list_value_ = NULL; if (value) { - switch (value->GetType()) { + switch (value->type()) { case base::Value::Type::BINARY: binary_value_ = new CefBinaryValueImpl(value, true); return; @@ -731,7 +731,7 @@ CefValueType CefDictionaryValueImpl::GetType(const CefString& key) { const base::Value* out_value = NULL; if (const_value().GetWithoutPathExpansion(base::StringPiece(key), &out_value)) { - switch (out_value->GetType()) { + switch (out_value->type()) { case base::Value::Type::NONE: return VTYPE_NULL; case base::Value::Type::BOOLEAN: @@ -1140,7 +1140,7 @@ CefValueType CefListValueImpl::GetType(size_t index) { const base::Value* out_value = NULL; if (const_value().Get(index, &out_value)) { - switch (out_value->GetType()) { + switch (out_value->type()) { case base::Value::Type::NONE: return VTYPE_NULL; case base::Value::Type::BOOLEAN: diff --git a/libcef/common/widevine_loader.cc b/libcef/common/widevine_loader.cc index 021c4dac7..f0b48f874 100644 --- a/libcef/common/widevine_loader.cc +++ b/libcef/common/widevine_loader.cc @@ -180,10 +180,10 @@ void GetPluginInfo(const base::FilePath& cdm_adapter_path, kWidevineCdmPluginMimeType, kWidevineCdmPluginExtension, kWidevineCdmPluginMimeTypeDescription); - widevine_cdm_mime_type.additional_param_names.push_back( - base::ASCIIToUTF16(kCdmSupportedCodecsParamName)); - widevine_cdm_mime_type.additional_param_values.push_back( - base::ASCIIToUTF16(cdm_codecs)); + widevine_cdm_mime_type.additional_params.emplace_back( + content::WebPluginMimeType::Param( + base::ASCIIToUTF16(kCdmSupportedCodecsParamName), + base::ASCIIToUTF16(cdm_codecs))); widevine_cdm->mime_types.push_back(widevine_cdm_mime_type); widevine_cdm->permissions = kWidevineCdmPluginPermissions; diff --git a/libcef/features/BUILD.gn b/libcef/features/BUILD.gn index bdedff82c..8c19cd247 100644 --- a/libcef/features/BUILD.gn +++ b/libcef/features/BUILD.gn @@ -8,7 +8,73 @@ import("//cef/libcef/features/features.gni") # This file is in a separate directory so all targets in the build can refer to # the buildflag header to get the necessary preprocessor defines without # bringing in any CEF targets. Other targets can depend on this target -# regardless of whether CEF is being built. +# regardless of whether CEF is being built. Set the `enable_cef=false` GN arg to +# disable the CEF changes when building Chrome. +# +# Example usage: +# +# 1. An existing GN configuration file at path/to/foo/BUILD.gn: +# +# # Import the `enable_cef` arg. +# import("//cef/libcef/features/features.gni") +# ... +# +# # An existing target that is modified for CEF. +# # The target type might instead be `component`, `source_set`, etc. +# static_library("foo") { +# sources = [ ... ] +# +# deps = [ +# # Always include the CEF features. +# "//cef/libcef/features", +# ... +# ] +# +# if (enable_cef) { +# # Actions to perform when the CEF build is enabled. +# +# # Optionally include CEF source files directly in this target. This +# # approach is required for targets that are either directly or +# # indirectly included in a `component` target (otherwise +# # `is_component_build=true` builds will fail). Keep in mind that these +# # files are part of this target instead of the `libcef_static` target +# # and therefore subject to any target-specific configuration settings +# # such as include paths, defines, compiler flags, etc. +# sources += [ +# "//cef/libcef/browser/foo_helper.cc", +# "//cef/libcef/browser/foo_helper.h", +# ] +# +# # Always include the CEF configuration. +# configs += [ "//cef/libcef/features:config" ] +# } +# ... +# } +# +# 2. An existing C++ source file at path/to/foo/foo.cc: +# +# // Include the `BUILDFLAG(ENABLE_CEF)` definition. +# #include "cef/libcef/features/features.h" +# ... +# +# #if BUILDFLAG(ENABLE_CEF) +# // CEF headers here... +# #include "cef/libcef/browser/foo_helper.h" +# #else +# // Chrome headers here... +# #endif +# +# // An existing function that is modified for CEF. +# void DoFoo() { +# #if BUILDFLAG(ENABLE_CEF) +# // CEF implementation here... +# cef_foo_helper::DoFoo(); +# #else +# // Chrome implementation here... +# #endif // !BUILDFLAG(ENABLE_CEF) +# } +# ... +# buildflag_header("features") { header = "features.h" @@ -17,3 +83,13 @@ buildflag_header("features") { "ENABLE_CEF=$enable_cef", ] } + +# Configuration for all targets that include CEF source code library-side. +config("config") { + # CEF sources use includes relative to the CEF root directory. + include_dirs = [ "//cef" ] + defines = [ + "BUILDING_CEF_SHARED", + "USING_CHROMIUM_INCLUDES", + ] +} diff --git a/libcef/renderer/browser_impl.cc b/libcef/renderer/browser_impl.cc index 618cedbb0..281204018 100644 --- a/libcef/renderer/browser_impl.cc +++ b/libcef/renderer/browser_impl.cc @@ -718,9 +718,9 @@ void CefBrowserImpl::OnLoadError(blink::WebLocalFrame* frame, if (load_handler.get()) { CefRefPtr cef_frame = GetWebFrameImpl(frame); const cef_errorcode_t errorCode = - static_cast(error.reason); - const std::string& errorText = error.localized_description.Utf8(); - const GURL& failedUrl = error.unreachable_url; + static_cast(error.reason()); + const std::string& errorText = net::ErrorToString(error.reason()); + const GURL& failedUrl = error.url(); load_handler->OnLoadError(this, cef_frame.get(), errorCode, errorText, failedUrl.spec()); } diff --git a/libcef/renderer/content_renderer_client.cc b/libcef/renderer/content_renderer_client.cc index 310f71209..2e312027e 100644 --- a/libcef/renderer/content_renderer_client.cc +++ b/libcef/renderer/content_renderer_client.cc @@ -26,10 +26,6 @@ #include "libcef/renderer/browser_impl.h" #include "libcef/renderer/extensions/extensions_renderer_client.h" #include "libcef/renderer/extensions/print_render_frame_helper_delegate.h" -#include "libcef/renderer/media/cef_key_systems.h" -#include "libcef/renderer/pepper/pepper_helper.h" -#include "libcef/renderer/plugins/cef_plugin_placeholder.h" -#include "libcef/renderer/plugins/plugin_preroller.h" #include "libcef/renderer/render_frame_observer.h" #include "libcef/renderer/render_message_filter.h" #include "libcef/renderer/render_thread_observer.h" @@ -47,14 +43,14 @@ #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/common/chrome_switches.h" -#include "chrome/common/pepper_permission_util.h" +#include "chrome/common/constants.mojom.h" #include "chrome/common/url_constants.h" -#include "chrome/grit/generated_resources.h" -#include "chrome/grit/renderer_resources.h" -#include "chrome/renderer/content_settings_observer.h" +#include "chrome/renderer/chrome_content_renderer_client.h" #include "chrome/renderer/loadtimes_extension_bindings.h" +#include "chrome/renderer/media/chrome_key_systems.h" #include "chrome/renderer/pepper/chrome_pdf_print_client.h" -#include "chrome/renderer/plugins/power_saver_info.h" +#include "chrome/renderer/pepper/pepper_helper.h" +#include "chrome/renderer/plugins/chrome_plugin_placeholder.h" #include "components/content_settings/core/common/content_settings_types.h" #include "components/nacl/common/nacl_constants.h" #include "components/printing/renderer/print_render_frame_helper.h" @@ -70,7 +66,6 @@ #include "content/public/common/content_paths.h" #include "content/public/common/content_switches.h" #include "content/public/renderer/plugin_instance_throttler.h" -#include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view_visitor.h" #include "content/renderer/render_widget.h" @@ -79,6 +74,10 @@ #include "ipc/ipc_sync_channel.h" #include "media/base/media.h" #include "printing/print_settings.h" +#include "services/service_manager/public/cpp/connector.h" +#include "services/service_manager/public/cpp/interface_provider.h" +#include "third_party/WebKit/common/associated_interfaces/associated_interface_provider.h" +#include "third_party/WebKit/public/platform/Platform.h" #include "third_party/WebKit/public/platform/URLConversion.h" #include "third_party/WebKit/public/platform/WebPrerenderingSupport.h" #include "third_party/WebKit/public/platform/WebRuntimeFeatures.h" @@ -131,34 +130,6 @@ class CefPrerendererClient : public content::RenderViewObserver, bool IsPrefetchOnly() override { return false; } }; -void AppendParams(const std::vector& additional_names, - const std::vector& additional_values, - blink::WebVector* existing_names, - blink::WebVector* existing_values) { - DCHECK(additional_names.size() == additional_values.size()); - DCHECK(existing_names->size() == existing_values->size()); - - size_t existing_size = existing_names->size(); - size_t total_size = existing_size + additional_names.size(); - - blink::WebVector names(total_size); - blink::WebVector values(total_size); - - for (size_t i = 0; i < existing_size; ++i) { - names[i] = (*existing_names)[i]; - values[i] = (*existing_values)[i]; - } - - for (size_t i = 0; i < additional_names.size(); ++i) { - names[existing_size + i] = blink::WebString::FromUTF16(additional_names[i]); - values[existing_size + i] = - blink::WebString::FromUTF16(additional_values[i]); - } - - existing_names->Swap(names); - existing_values->Swap(values); -} - bool IsStandaloneExtensionProcess() { return extensions::ExtensionsEnabled() && extensions::CefExtensionsRendererClient:: @@ -319,6 +290,9 @@ void CefContentRendererClient::WebKitInitialized() { } } + url_loader_factory_ = + blink::Platform::Current()->CreateDefaultURLLoaderFactory(); + // Notify the render process handler. CefRefPtr application = CefContentClient::Get()->application(); if (application.get()) { @@ -329,21 +303,6 @@ void CefContentRendererClient::WebKitInitialized() { } } -void CefContentRendererClient::DevToolsAgentAttached() { - CEF_REQUIRE_RT(); - ++devtools_agent_count_; -} - -void CefContentRendererClient::DevToolsAgentDetached() { - CEF_REQUIRE_RT(); - --devtools_agent_count_; - if (devtools_agent_count_ == 0 && uncaught_exception_stack_size_ > 0) { - // When the last DevToolsAgent is detached the stack size is set to 0. - // Restore the user-specified stack size here. - CefV8SetUncaughtExceptionStackSize(uncaught_exception_stack_size_); - } -} - scoped_refptr CefContentRendererClient::GetCurrentTaskRunner() { // Check if currently on the render thread. @@ -401,7 +360,7 @@ void CefContentRendererClient::RenderThreadStarted() { thread->GetChannel()->AddFilter(new CefRenderMessageFilter); if (!command_line->HasSwitch(switches::kDisableSpellChecking)) { - spellcheck_.reset(new SpellCheck()); + spellcheck_.reset(new SpellCheck(this)); thread->AddObserver(spellcheck_.get()); } @@ -474,7 +433,7 @@ void CefContentRendererClient::RenderFrameCreated( new CefRenderFrameObserver(render_frame); service_manager::BinderRegistry* registry = render_frame_observer->registry(); - new CefPepperHelper(render_frame); + new PepperHelper(render_frame); new printing::PrintRenderFrameHelper( render_frame, base::WrapUnique(new extensions::CefPrintRenderFrameHelperDelegate())); @@ -484,8 +443,18 @@ void CefContentRendererClient::RenderFrameCreated( const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - if (!command_line->HasSwitch(switches::kDisableSpellChecking)) - new SpellCheckProvider(render_frame, spellcheck_.get()); + if (!command_line->HasSwitch(switches::kDisableSpellChecking)) { + SpellCheckProvider* spell_check_provider = + new SpellCheckProvider(render_frame, spellcheck_.get(), this); + // TODO(xiaochengh): Design better way to sync between Chrome-side and + // Blink-side spellcheck enabled states. See crbug.com/710097. + // + // TODO(alexmos): Do this for all frames so that this works properly for + // OOPIFs. See https://crbug.com/789273. + if (render_frame->IsMainFrame()) + spell_check_provider->EnableSpellcheck( + spellcheck_->IsSpellcheckEnabled()); + } BrowserCreated(render_frame->GetRenderView(), render_frame); } @@ -494,22 +463,6 @@ void CefContentRendererClient::RenderViewCreated( content::RenderView* render_view) { new CefPrerendererClient(render_view); - if (extensions::ExtensionsEnabled()) - extensions_renderer_client_->RenderViewCreated(render_view); - - const base::CommandLine* command_line = - base::CommandLine::ForCurrentProcess(); - if (!command_line->HasSwitch(switches::kDisableSpellChecking)) { - // This is a workaround keeping the behavior that, the Blink side spellcheck - // enabled state is initialized on RenderView creation. - // TODO(xiaochengh): Design better way to sync between Chrome-side and - // Blink-side spellcheck enabled states. See crbug.com/710097. - if (SpellCheckProvider* provider = - SpellCheckProvider::Get(render_view->GetMainRenderFrame())) { - provider->EnableSpellcheck(spellcheck_->IsSpellcheckEnabled()); - } - } - BrowserCreated(render_view, render_view->GetMainRenderFrame()); } @@ -525,13 +478,13 @@ bool CefContentRendererClient::OverrideCreatePlugin( } GURL url(params.url); - CefViewHostMsg_GetPluginInfo_Output output; - render_frame->Send(new CefViewHostMsg_GetPluginInfo( + chrome::mojom::PluginInfoPtr plugin_info = chrome::mojom::PluginInfo::New(); + ChromeContentRendererClient::GetPluginInfoHost()->GetPluginInfo( render_frame->GetRoutingID(), url, - render_frame->GetWebFrame()->Parent() == nullptr, render_frame->GetWebFrame()->Top()->GetSecurityOrigin(), orig_mime_type, - &output)); - *plugin = CreatePlugin(render_frame, params, output); + &plugin_info); + *plugin = ChromeContentRendererClient::CreatePlugin(render_frame, params, + *plugin_info); return true; } @@ -657,7 +610,7 @@ CefContentRendererClient::CreateBrowserPluginDelegate( void CefContentRendererClient::AddSupportedKeySystems( std::vector>* key_systems) { - AddCefKeySystems(key_systems); + AddChromeKeySystems(key_systems); } void CefContentRendererClient::RunScriptsAtDocumentStart( @@ -678,158 +631,38 @@ void CefContentRendererClient::RunScriptsAtDocumentIdle( extensions_renderer_client_->RunScriptsAtDocumentIdle(render_frame); } +void CefContentRendererClient::DevToolsAgentAttached( + content::RenderFrame* render_frame, + int session_id) { + CEF_REQUIRE_RT(); + ++devtools_agent_count_; +} + +void CefContentRendererClient::DevToolsAgentDetached( + content::RenderFrame* render_frame, + int session_id) { + CEF_REQUIRE_RT(); + --devtools_agent_count_; + if (devtools_agent_count_ == 0 && uncaught_exception_stack_size_ > 0) { + // When the last DevToolsAgent is detached the stack size is set to 0. + // Restore the user-specified stack size here. + CefV8SetUncaughtExceptionStackSize(uncaught_exception_stack_size_); + } +} + +void CefContentRendererClient::GetInterface( + const std::string& interface_name, + mojo::ScopedMessagePipeHandle interface_pipe) { + content::RenderThread::Get()->GetConnector()->BindInterface( + service_manager::Identity(chrome::mojom::kServiceName), interface_name, + std::move(interface_pipe)); +} + void CefContentRendererClient::WillDestroyCurrentMessageLoop() { base::AutoLock lock_scope(single_process_cleanup_lock_); single_process_cleanup_complete_ = true; } -// static -blink::WebPlugin* CefContentRendererClient::CreatePlugin( - content::RenderFrame* render_frame, - const blink::WebPluginParams& original_params, - const CefViewHostMsg_GetPluginInfo_Output& output) { - const content::WebPluginInfo& info = output.plugin; - const std::string& actual_mime_type = output.actual_mime_type; - const base::string16& group_name = output.group_name; - const std::string& identifier = output.group_identifier; - CefViewHostMsg_GetPluginInfo_Status status = output.status; - GURL url(original_params.url); - std::string orig_mime_type = original_params.mime_type.Utf8(); - CefPluginPlaceholder* placeholder = NULL; - - // If the browser plugin is to be enabled, this should be handled by the - // renderer, so the code won't reach here due to the early exit in - // OverrideCreatePlugin. - if (status == CefViewHostMsg_GetPluginInfo_Status::kNotFound || - orig_mime_type == content::kBrowserPluginMimeType) { - placeholder = CefPluginPlaceholder::CreateLoadableMissingPlugin( - render_frame, original_params); - } else { - // TODO(bauerb): This should be in content/. - blink::WebPluginParams params(original_params); - for (const auto& mime_type : info.mime_types) { - if (mime_type.mime_type == actual_mime_type) { - AppendParams(mime_type.additional_param_names, - mime_type.additional_param_values, ¶ms.attribute_names, - ¶ms.attribute_values); - break; - } - } - if (params.mime_type.IsNull() && (actual_mime_type.size() > 0)) { - // Webkit might say that mime type is null while we already know the - // actual mime type via CefViewHostMsg_GetPluginInfo. In that case - // we should use what we know since WebpluginDelegateProxy does some - // specific initializations based on this information. - params.mime_type = blink::WebString::FromUTF8(actual_mime_type); - } - - auto create_blocked_plugin = [&render_frame, ¶ms, &info, &identifier, - &group_name](int template_id, - const base::string16& message) { - return CefPluginPlaceholder::CreateBlockedPlugin( - render_frame, params, info, identifier, group_name, template_id, - message, PowerSaverInfo()); - }; - blink::WebLocalFrame* frame = render_frame->GetWebFrame(); - switch (status) { - case CefViewHostMsg_GetPluginInfo_Status::kNotFound: { - NOTREACHED(); - break; - } - case CefViewHostMsg_GetPluginInfo_Status::kAllowed: - case CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent: { - // Delay loading plugins if prerendering. - // TODO(mmenke): In the case of prerendering, feed into - // CefContentRendererClient::CreatePlugin instead, to - // reduce the chance of future regressions. - bool is_prerendering = false; - bool power_saver_setting_on = - status == - CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent; - - PowerSaverInfo power_saver_info = - PowerSaverInfo::Get(render_frame, power_saver_setting_on, params, - info, frame->GetDocument().Url()); - if (power_saver_info.blocked_for_background_tab || is_prerendering || - !power_saver_info.poster_attribute.empty()) { - placeholder = CefPluginPlaceholder::CreateBlockedPlugin( - render_frame, params, info, identifier, group_name, - power_saver_info.poster_attribute.empty() - ? IDR_BLOCKED_PLUGIN_HTML - : IDR_PLUGIN_POSTER_HTML, - l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name), - power_saver_info); - placeholder->set_blocked_for_prerendering(is_prerendering); - placeholder->AllowLoading(); - break; - } - - std::unique_ptr throttler; - if (power_saver_info.power_saver_enabled) { - throttler = content::PluginInstanceThrottler::Create( - content::RenderFrame::DONT_RECORD_DECISION); - // PluginPreroller manages its own lifetime. - new CefPluginPreroller( - render_frame, params, info, identifier, group_name, - l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name), - throttler.get()); - } - - return render_frame->CreatePlugin(info, params, std::move(throttler)); - } - case CefViewHostMsg_GetPluginInfo_Status::kDisabled: { - // Intentionally using the blocked plugin resources instead of the - // disabled plugin resources. This provides better messaging (no link to - // chrome://plugins) and adds testing support. - placeholder = create_blocked_plugin( - IDR_BLOCKED_PLUGIN_HTML, - l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED_BY_POLICY, - group_name)); - break; - } - case CefViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked: { - NOTREACHED() << "Plugin installation is not supported."; - break; - } - case CefViewHostMsg_GetPluginInfo_Status::kOutdatedDisallowed: { - placeholder = create_blocked_plugin( - IDR_BLOCKED_PLUGIN_HTML, - l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED, group_name)); - break; - } - case CefViewHostMsg_GetPluginInfo_Status::kUnauthorized: { - placeholder = create_blocked_plugin( - IDR_BLOCKED_PLUGIN_HTML, - l10n_util::GetStringFUTF16(IDS_PLUGIN_NOT_AUTHORIZED, group_name)); - placeholder->AllowLoading(); - break; - } - case CefViewHostMsg_GetPluginInfo_Status::kBlocked: { - placeholder = create_blocked_plugin( - IDR_BLOCKED_PLUGIN_HTML, - l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); - placeholder->AllowLoading(); - content::RenderThread::Get()->RecordAction( - base::UserMetricsAction("Plugin_Blocked")); - break; - } - case CefViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy: { - placeholder = create_blocked_plugin( - IDR_BLOCKED_PLUGIN_HTML, - l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED_BY_POLICY, - group_name)); - content::RenderThread::Get()->RecordAction( - base::UserMetricsAction("Plugin_BlockedByPolicy")); - break; - } - default: - break; - } - } - placeholder->SetStatus(status); - return placeholder->plugin(); -} - void CefContentRendererClient::BrowserCreated( content::RenderView* render_view, content::RenderFrame* render_frame) { diff --git a/libcef/renderer/content_renderer_client.h b/libcef/renderer/content_renderer_client.h index fa09efe99..8b28fbc6c 100644 --- a/libcef/renderer/content_renderer_client.h +++ b/libcef/renderer/content_renderer_client.h @@ -18,7 +18,14 @@ #include "base/compiler_specific.h" #include "base/message_loop/message_loop.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 "services/service_manager/public/cpp/local_interface_provider.h" + +namespace blink { +class WebURLLoaderFactory; +} namespace extensions { class CefExtensionsRendererClient; @@ -37,11 +44,11 @@ class WebCacheImpl; class CefGuestView; class CefRenderThreadObserver; struct Cef_CrossOriginWhiteListEntry_Params; -struct CefViewHostMsg_GetPluginInfo_Output; class ChromePDFPrintClient; class SpellCheck; class CefContentRendererClient : public content::ContentRendererClient, + public service_manager::LocalInterfaceProvider, public base::MessageLoop::DestructionObserver { public: CefContentRendererClient(); @@ -74,10 +81,12 @@ class CefContentRendererClient : public content::ContentRendererClient, return uncaught_exception_stack_size_; } - void WebKitInitialized(); + // Used by CefRenderURLRequest to create WebURLLoaders. + blink::WebURLLoaderFactory* url_loader_factory() const { + return url_loader_factory_.get(); + } - void DevToolsAgentAttached(); - void DevToolsAgentDetached(); + void WebKitInitialized(); // Returns the task runner for the current thread. Returns NULL if the current // thread is not the main render process thread. @@ -128,15 +137,18 @@ class CefContentRendererClient : public content::ContentRendererClient, void RunScriptsAtDocumentStart(content::RenderFrame* render_frame) override; void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override; void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame) override; + void DevToolsAgentAttached(content::RenderFrame* render_frame, + int session_id) override; + void DevToolsAgentDetached(content::RenderFrame* render_frame, + int session_id) override; + + // service_manager::LocalInterfaceProvider implementation. + void GetInterface(const std::string& name, + mojo::ScopedMessagePipeHandle request_handle) override; // MessageLoop::DestructionObserver implementation. void WillDestroyCurrentMessageLoop() override; - static blink::WebPlugin* CreatePlugin( - content::RenderFrame* render_frame, - const blink::WebPluginParams& params, - const CefViewHostMsg_GetPluginInfo_Output& output); - private: void BrowserCreated(content::RenderView* render_view, content::RenderFrame* render_frame); @@ -148,6 +160,7 @@ class CefContentRendererClient : public content::ContentRendererClient, std::unique_ptr observer_; std::unique_ptr web_cache_impl_; std::unique_ptr spellcheck_; + std::unique_ptr url_loader_factory_; // Map of RenderView pointers to CefBrowserImpl references. typedef std::map> BrowserMap; diff --git a/libcef/renderer/extensions/extensions_renderer_client.cc b/libcef/renderer/extensions/extensions_renderer_client.cc index 1654751bb..7efbc88b4 100644 --- a/libcef/renderer/extensions/extensions_renderer_client.cc +++ b/libcef/renderer/extensions/extensions_renderer_client.cc @@ -18,7 +18,6 @@ #include "content/public/renderer/render_thread.h" #include "extensions/common/constants.h" #include "extensions/common/switches.h" -#include "extensions/renderer/api/automation/automation_api_helper.h" #include "extensions/renderer/dispatcher.h" #include "extensions/renderer/extension_frame_helper.h" #include "extensions/renderer/extensions_render_frame_observer.h" @@ -150,12 +149,6 @@ void CefExtensionsRendererClient::RenderFrameCreated( extension_dispatcher_->OnRenderFrameCreated(render_frame); } -void CefExtensionsRendererClient::RenderViewCreated( - content::RenderView* render_view) { - // Manages its own lifetime. - new extensions::AutomationApiHelper(render_view); -} - bool CefExtensionsRendererClient::OverrideCreatePlugin( content::RenderFrame* render_frame, const blink::WebPluginParams& params) { diff --git a/libcef/renderer/extensions/extensions_renderer_client.h b/libcef/renderer/extensions/extensions_renderer_client.h index 8d2f112d6..7240c73d6 100644 --- a/libcef/renderer/extensions/extensions_renderer_client.h +++ b/libcef/renderer/extensions/extensions_renderer_client.h @@ -25,7 +25,6 @@ class WebURL; namespace content { class BrowserPluginDelegate; class RenderFrame; -class RenderView; } // namespace content namespace extensions { @@ -52,7 +51,6 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient { void RenderThreadStarted(); void RenderFrameCreated(content::RenderFrame* render_frame, service_manager::BinderRegistry* registry); - void RenderViewCreated(content::RenderView* render_view); bool OverrideCreatePlugin(content::RenderFrame* render_frame, const blink::WebPluginParams& params); bool WillSendRequest(blink::WebLocalFrame* frame, diff --git a/libcef/renderer/media/cef_key_systems.cc b/libcef/renderer/media/cef_key_systems.cc deleted file mode 100644 index f43860b50..000000000 --- a/libcef/renderer/media/cef_key_systems.cc +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/renderer/media/cef_key_systems.h" - -#include -#include - -#include "base/logging.h" -#include "base/strings/string16.h" -#include "base/strings/string_split.h" -#include "base/strings/utf_string_conversions.h" -#include "components/cdm/renderer/widevine_key_system_properties.h" -#include "content/public/renderer/render_thread.h" -#include "libcef/common/cef_messages.h" -#include "media/base/eme_constants.h" -#include "media/base/key_system_properties.h" -#include "media/media_features.h" - -#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. - -// The following must be after widevine_cdm_version.h. - -#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) -#include -#include "base/version.h" -#endif - -using media::KeySystemProperties; -using media::SupportedCodecs; - -namespace { - -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) -bool IsPepperCdmAvailable( - const std::string& pepper_type, - std::vector* additional_param_names, - std::vector* additional_param_values) { - bool is_available = false; - content::RenderThread::Get()->Send( - new CefViewHostMsg_IsInternalPluginAvailableForMimeType( - pepper_type, &is_available, additional_param_names, - additional_param_values)); - - return is_available; -} - -#if defined(WIDEVINE_CDM_AVAILABLE) -// This function finds "codecs" and parses the value into the vector |codecs|. -// Converts the codec strings to UTF-8 since we only expect ASCII strings and -// this simplifies the rest of the code in this file. -void GetSupportedCodecsForPepperCdm( - const std::vector& additional_param_names, - const std::vector& additional_param_values, - std::vector* codecs) { - DCHECK(codecs->empty()); - DCHECK_EQ(additional_param_names.size(), additional_param_values.size()); - for (size_t i = 0; i < additional_param_names.size(); ++i) { - if (additional_param_names[i] == - base::ASCIIToUTF16(kCdmSupportedCodecsParamName)) { - const base::string16& codecs_string16 = additional_param_values[i]; - std::string codecs_string; - if (!base::UTF16ToUTF8(codecs_string16.c_str(), codecs_string16.length(), - &codecs_string)) { - DLOG(WARNING) << "Non-UTF-8 codecs string."; - // Continue using the best effort conversion. - } - *codecs = base::SplitString( - codecs_string, std::string(1, kCdmSupportedCodecsValueDelimiter), - base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); - break; - } - } -} - -void AddPepperBasedWidevine( - std::vector>* concrete_key_systems) { -#if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) - base::Version glibc_version(gnu_get_libc_version()); - DCHECK(glibc_version.IsValid()); - if (glibc_version < base::Version(WIDEVINE_CDM_MIN_GLIBC_VERSION)) - return; -#endif // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) - - std::vector additional_param_names; - std::vector additional_param_values; - if (!IsPepperCdmAvailable(kWidevineCdmPluginMimeType, &additional_param_names, - &additional_param_values)) { - DVLOG(1) << "Widevine CDM is not currently available."; - return; - } - - std::vector codecs; - GetSupportedCodecsForPepperCdm(additional_param_names, - additional_param_values, &codecs); - - SupportedCodecs supported_codecs = media::EME_CODEC_NONE; - - // Audio codecs are always supported. - // TODO(sandersd): Distinguish these from those that are directly supported, - // as those may offer a higher level of protection. - supported_codecs |= media::EME_CODEC_WEBM_OPUS; - supported_codecs |= media::EME_CODEC_WEBM_VORBIS; -#if BUILDFLAG(USE_PROPRIETARY_CODECS) - supported_codecs |= media::EME_CODEC_MP4_AAC; -#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) - - for (size_t i = 0; i < codecs.size(); ++i) { - if (codecs[i] == kCdmSupportedCodecVp8) - supported_codecs |= media::EME_CODEC_WEBM_VP8; - if (codecs[i] == kCdmSupportedCodecVp9) { - supported_codecs |= media::EME_CODEC_WEBM_VP9; - supported_codecs |= media::EME_CODEC_COMMON_VP9; - } -#if BUILDFLAG(USE_PROPRIETARY_CODECS) - if (codecs[i] == kCdmSupportedCodecAvc1) - supported_codecs |= media::EME_CODEC_MP4_AVC1; -#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) - } - - using Robustness = cdm::WidevineKeySystemProperties::Robustness; - concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties( - supported_codecs, - Robustness::SW_SECURE_CRYPTO, // Maximum audio robustness. - Robustness::SW_SECURE_DECODE, // Maximum video robustness. - media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. - media::EmeSessionTypeSupport:: - NOT_SUPPORTED, // persistent-release-message. - media::EmeFeatureSupport::REQUESTABLE, // Persistent state. - media::EmeFeatureSupport::NOT_SUPPORTED)); // Distinctive identifier. -} -#endif // defined(WIDEVINE_CDM_AVAILABLE) -#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) - -} // namespace - -void AddCefKeySystems( - std::vector>* key_systems_properties) { -#if BUILDFLAG(ENABLE_LIBRARY_CDMS) -#if defined(WIDEVINE_CDM_AVAILABLE) - AddPepperBasedWidevine(key_systems_properties); -#endif // defined(WIDEVINE_CDM_AVAILABLE) -#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) -} diff --git a/libcef/renderer/media/cef_key_systems.h b/libcef/renderer/media/cef_key_systems.h deleted file mode 100644 index cf4b01f91..000000000 --- a/libcef/renderer/media/cef_key_systems.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CEF_LIBCEF_RENDERER_MEDIA_CEF_KEY_SYSTEMS_H_ -#define CEF_LIBCEF_RENDERER_MEDIA_CEF_KEY_SYSTEMS_H_ - -#include -#include - -namespace media { -class KeySystemProperties; -} - -// Register the key systems supported by populating |key_systems_properties|. -void AddCefKeySystems(std::vector>* - key_systems_properties); - -#endif // CEF_LIBCEF_RENDERER_MEDIA_CEF_KEY_SYSTEMS_H_ diff --git a/libcef/renderer/pepper/pepper_helper.cc b/libcef/renderer/pepper/pepper_helper.cc deleted file mode 100644 index 64a2f728b..000000000 --- a/libcef/renderer/pepper/pepper_helper.cc +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/renderer/pepper/pepper_helper.h" - -#include - -#include "libcef/renderer/pepper/renderer_pepper_host_factory.h" - -#include "base/memory/ptr_util.h" -#include "content/public/renderer/renderer_ppapi_host.h" -#include "ppapi/host/ppapi_host.h" - -CefPepperHelper::CefPepperHelper(content::RenderFrame* render_frame) - : RenderFrameObserver(render_frame) {} - -CefPepperHelper::~CefPepperHelper() {} - -void CefPepperHelper::DidCreatePepperPlugin(content::RendererPpapiHost* host) { - // TODO(brettw) figure out how to hook up the host factory. It needs some - // kind of filter-like system to allow dynamic additions. - host->GetPpapiHost()->AddHostFactoryFilter( - base::MakeUnique(host)); -} - -void CefPepperHelper::OnDestruct() { - delete this; -} diff --git a/libcef/renderer/pepper/pepper_helper.h b/libcef/renderer/pepper/pepper_helper.h deleted file mode 100644 index 67d766035..000000000 --- a/libcef/renderer/pepper/pepper_helper.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CEF_LIBCEF_RENDERER_PEPPER_PEPPER_HELPER_H_ -#define CEF_LIBCEF_RENDERER_PEPPER_PEPPER_HELPER_H_ - -#include "base/compiler_specific.h" -#include "content/public/renderer/render_frame_observer.h" - -// This class listens for Pepper creation events from the RenderFrame and -// attaches the parts required for Chrome-specific plugin support. -class CefPepperHelper : public content::RenderFrameObserver { - public: - explicit CefPepperHelper(content::RenderFrame* render_frame); - ~CefPepperHelper() override; - - // RenderFrameObserver. - void DidCreatePepperPlugin(content::RendererPpapiHost* host) override; - void OnDestruct() override; - - private: - DISALLOW_COPY_AND_ASSIGN(CefPepperHelper); -}; - -#endif // CEF_LIBCEF_RENDERER_PEPPER_PEPPER_HELPER_H_ diff --git a/libcef/renderer/pepper/renderer_pepper_host_factory.cc b/libcef/renderer/pepper/renderer_pepper_host_factory.cc deleted file mode 100644 index 2e2f73f83..000000000 --- a/libcef/renderer/pepper/renderer_pepper_host_factory.cc +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/renderer/pepper/renderer_pepper_host_factory.h" - -#include "base/logging.h" -#include "base/memory/ptr_util.h" -#include "chrome/renderer/pepper/pepper_flash_drm_renderer_host.h" -#include "chrome/renderer/pepper/pepper_flash_font_file_host.h" -#include "chrome/renderer/pepper/pepper_flash_fullscreen_host.h" -#include "chrome/renderer/pepper/pepper_flash_menu_host.h" -#include "chrome/renderer/pepper/pepper_flash_renderer_host.h" -#include "chrome/renderer/pepper/pepper_uma_host.h" -#include "components/pdf/renderer/pepper_pdf_host.h" -#include "content/public/renderer/renderer_ppapi_host.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/host/resource_host.h" -#include "ppapi/proxy/ppapi_message_utils.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/shared_impl/ppapi_permissions.h" - -using ppapi::host::ResourceHost; - -CefRendererPepperHostFactory::CefRendererPepperHostFactory( - content::RendererPpapiHost* host) - : host_(host) {} - -CefRendererPepperHostFactory::~CefRendererPepperHostFactory() {} - -std::unique_ptr CefRendererPepperHostFactory::CreateResourceHost( - ppapi::host::PpapiHost* host, - PP_Resource resource, - PP_Instance instance, - const IPC::Message& message) { - DCHECK_EQ(host_->GetPpapiHost(), host); - - // Make sure the plugin is giving us a valid instance for this resource. - if (!host_->IsValidInstance(instance)) - return nullptr; - - if (host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_FLASH)) { - switch (message.type()) { - case PpapiHostMsg_Flash_Create::ID: { - return base::MakeUnique(host_, instance, - resource); - } - case PpapiHostMsg_FlashFullscreen_Create::ID: { - return base::MakeUnique(host_, instance, - resource); - } - case PpapiHostMsg_FlashMenu_Create::ID: { - ppapi::proxy::SerializedFlashMenu serialized_menu; - if (ppapi::UnpackMessage( - message, &serialized_menu)) { - return base::MakeUnique( - host_, instance, resource, serialized_menu); - } - break; - } - } - } - - // TODO(raymes): PDF also needs access to the FlashFontFileHost currently. - // We should either rename PPB_FlashFont_File to PPB_FontFile_Private or get - // rid of its use in PDF if possible. - if (host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_FLASH) || - host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_PRIVATE)) { - switch (message.type()) { - case PpapiHostMsg_FlashFontFile_Create::ID: { - ppapi::proxy::SerializedFontDescription description; - PP_PrivateFontCharset charset; - if (ppapi::UnpackMessage( - message, &description, &charset)) { - return base::MakeUnique( - host_, instance, resource, description, charset); - } - break; - } - case PpapiHostMsg_FlashDRM_Create::ID: - return base::MakeUnique(host_, instance, - resource); - } - } - - if (host_->GetPpapiHost()->permissions().HasPermission( - ppapi::PERMISSION_PRIVATE)) { - switch (message.type()) { - case PpapiHostMsg_PDF_Create::ID: { - return base::MakeUnique(host_, instance, resource); - } - } - } - - // Permissions for the following interfaces will be checked at the - // time of the corresponding instance's method calls. Currently these - // interfaces are available only for whitelisted apps which may not have - // access to the other private interfaces. - switch (message.type()) { - case PpapiHostMsg_UMA_Create::ID: { - return base::MakeUnique(host_, instance, resource); - } - } - - NOTREACHED() << "Unhandled message type: " << message.type(); - return nullptr; -} diff --git a/libcef/renderer/pepper/renderer_pepper_host_factory.h b/libcef/renderer/pepper/renderer_pepper_host_factory.h deleted file mode 100644 index a2da1cce1..000000000 --- a/libcef/renderer/pepper/renderer_pepper_host_factory.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef LIBCEF_RENDERER_PEPPER_RENDERER_PEPPER_HOST_FACTORY_H_ -#define LIBCEF_RENDERER_PEPPER_RENDERER_PEPPER_HOST_FACTORY_H_ - -#include "base/macros.h" -#include "ppapi/host/host_factory.h" - -namespace content { -class RendererPpapiHost; -} - -class CefRendererPepperHostFactory : public ppapi::host::HostFactory { - public: - explicit CefRendererPepperHostFactory(content::RendererPpapiHost* host); - ~CefRendererPepperHostFactory() override; - - // HostFactory. - std::unique_ptr CreateResourceHost( - ppapi::host::PpapiHost* host, - PP_Resource resource, - PP_Instance instance, - const IPC::Message& message) override; - - private: - // Not owned by this object. - content::RendererPpapiHost* host_; - - DISALLOW_COPY_AND_ASSIGN(CefRendererPepperHostFactory); -}; - -#endif // LIBCEF_RENDERER_PEPPER_RENDERER_PEPPER_HOST_FACTORY_H_ diff --git a/libcef/renderer/plugins/cef_plugin_placeholder.cc b/libcef/renderer/plugins/cef_plugin_placeholder.cc deleted file mode 100644 index 1a33fcc1b..000000000 --- a/libcef/renderer/plugins/cef_plugin_placeholder.cc +++ /dev/null @@ -1,313 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/renderer/plugins/cef_plugin_placeholder.h" - -#include - -#include "libcef/common/cef_messages.h" -#include "libcef/renderer/content_renderer_client.h" -#include "libcef/renderer/plugins/plugin_preroller.h" - -#include "base/command_line.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/utf_string_conversions.h" -#include "base/values.h" -#include "chrome/grit/generated_resources.h" -#include "chrome/grit/renderer_resources.h" -#include "chrome/renderer/custom_menu_commands.h" -#include "components/strings/grit/components_strings.h" -#include "content/public/common/content_switches.h" -#include "content/public/common/context_menu_params.h" -#include "content/public/renderer/render_frame.h" -#include "content/public/renderer/render_thread.h" -#include "gin/object_template_builder.h" -#include "third_party/WebKit/public/platform/URLConversion.h" -#include "third_party/WebKit/public/platform/WebInputEvent.h" -#include "third_party/WebKit/public/platform/WebMouseEvent.h" -#include "third_party/WebKit/public/web/WebDocument.h" -#include "third_party/WebKit/public/web/WebLocalFrame.h" -#include "third_party/WebKit/public/web/WebPluginContainer.h" -#include "third_party/WebKit/public/web/WebScriptSource.h" -#include "third_party/WebKit/public/web/WebView.h" -#include "ui/base/l10n/l10n_util.h" -#include "ui/base/resource/resource_bundle.h" -#include "ui/base/webui/jstemplate_builder.h" -#include "ui/gfx/geometry/size.h" -#include "url/url_util.h" - -using base::UserMetricsAction; -using content::RenderThread; -using content::RenderView; - -namespace { -const CefPluginPlaceholder* g_last_active_menu = NULL; -} // namespace - -gin::WrapperInfo CefPluginPlaceholder::kWrapperInfo = {gin::kEmbedderNativeGin}; - -CefPluginPlaceholder::CefPluginPlaceholder(content::RenderFrame* render_frame, - const blink::WebPluginParams& params, - const std::string& html_data, - const base::string16& title) - : plugins::LoadablePluginPlaceholder(render_frame, params, html_data), - status_(CefViewHostMsg_GetPluginInfo_Status::kAllowed), - title_(title), - context_menu_request_id_(0) { - RenderThread::Get()->AddObserver(this); -} - -CefPluginPlaceholder::~CefPluginPlaceholder() { - RenderThread::Get()->RemoveObserver(this); - if (context_menu_request_id_ && render_frame()) - render_frame()->CancelContextMenu(context_menu_request_id_); -} - -// static -CefPluginPlaceholder* CefPluginPlaceholder::CreateLoadableMissingPlugin( - content::RenderFrame* render_frame, - const blink::WebPluginParams& params) { - const base::StringPiece template_html( - ui::ResourceBundle::GetSharedInstance().GetRawDataResource( - IDR_BLOCKED_PLUGIN_HTML)); - - base::DictionaryValue values; - values.SetString("message", - l10n_util::GetStringUTF8(IDS_PLUGIN_NOT_SUPPORTED)); - - std::string html_data = webui::GetI18nTemplateHtml(template_html, &values); - - // Will destroy itself when its WebViewPlugin is going away. - return new CefPluginPlaceholder(render_frame, params, html_data, - params.mime_type.Utf16()); -} - -// static -CefPluginPlaceholder* CefPluginPlaceholder::CreateBlockedPlugin( - content::RenderFrame* render_frame, - const blink::WebPluginParams& params, - const content::WebPluginInfo& info, - const std::string& identifier, - const base::string16& name, - int template_id, - const base::string16& message, - const PowerSaverInfo& power_saver_info) { - base::DictionaryValue values; - values.SetString("message", message); - values.SetString("name", name); - values.SetString("hide", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE)); - values.SetString( - "pluginType", - render_frame->IsMainFrame() && - render_frame->GetWebFrame()->GetDocument().IsPluginDocument() - ? "document" - : "embedded"); - - if (!power_saver_info.poster_attribute.empty()) { - values.SetString("poster", power_saver_info.poster_attribute); - values.SetString("baseurl", power_saver_info.base_url.spec()); - - if (!power_saver_info.custom_poster_size.IsEmpty()) { - float zoom_factor = blink::WebView::ZoomLevelToZoomFactor( - render_frame->GetWebFrame()->View()->ZoomLevel()); - int width = - roundf(power_saver_info.custom_poster_size.width() / zoom_factor); - int height = - roundf(power_saver_info.custom_poster_size.height() / zoom_factor); - values.SetString("visibleWidth", base::IntToString(width) + "px"); - values.SetString("visibleHeight", base::IntToString(height) + "px"); - } - } - - const base::StringPiece template_html( - ui::ResourceBundle::GetSharedInstance().GetRawDataResource(template_id)); - - DCHECK(!template_html.empty()) - << "unable to load template. ID: " << template_id; - std::string html_data = webui::GetI18nTemplateHtml(template_html, &values); - - // |blocked_plugin| will destroy itself when its WebViewPlugin is going away. - CefPluginPlaceholder* blocked_plugin = - new CefPluginPlaceholder(render_frame, params, html_data, name); - - if (!power_saver_info.poster_attribute.empty()) - blocked_plugin->BlockForPowerSaverPoster(); - blocked_plugin->SetPluginInfo(info); - blocked_plugin->SetIdentifier(identifier); - - blocked_plugin->set_power_saver_enabled(power_saver_info.power_saver_enabled); - blocked_plugin->set_blocked_for_background_tab( - power_saver_info.blocked_for_background_tab); - - return blocked_plugin; -} - -void CefPluginPlaceholder::SetStatus( - CefViewHostMsg_GetPluginInfo_Status status) { - status_ = status; -} - -bool CefPluginPlaceholder::OnMessageReceived(const IPC::Message& message) { - // We don't swallow these messages because multiple blocked plugins and other - // objects have an interest in them. - IPC_BEGIN_MESSAGE_MAP(CefPluginPlaceholder, message) - IPC_MESSAGE_HANDLER(CefViewMsg_LoadBlockedPlugins, OnLoadBlockedPlugins) - IPC_END_MESSAGE_MAP() - - return false; -} - -void CefPluginPlaceholder::ShowPermissionBubbleCallback() { - // CEF does not use IDR_PREFER_HTML_PLUGIN_HTML which would originate this - // callback. - NOTREACHED(); -} - -void CefPluginPlaceholder::PluginListChanged() { - if (!render_frame() || !plugin()) - return; - blink::WebLocalFrame* web_frame = render_frame()->GetWebFrame(); - if (!web_frame->Top()->IsWebLocalFrame()) - return; - blink::WebDocument document = - web_frame->Top()->ToWebLocalFrame()->GetDocument(); - if (document.IsNull()) - return; - - CefViewHostMsg_GetPluginInfo_Output output; - std::string mime_type(GetPluginParams().mime_type.Utf8()); - render_frame()->Send(new CefViewHostMsg_GetPluginInfo( - routing_id(), GURL(GetPluginParams().url), web_frame->Parent() == nullptr, - web_frame->Top()->GetSecurityOrigin(), mime_type, &output)); - if (output.status == status_) - return; - blink::WebPlugin* new_plugin = CefContentRendererClient::CreatePlugin( - render_frame(), GetPluginParams(), output); - ReplacePlugin(new_plugin); -} - -void CefPluginPlaceholder::OnMenuAction(int request_id, unsigned action) { - DCHECK_EQ(context_menu_request_id_, request_id); - if (g_last_active_menu != this) - return; - switch (action) { - case chrome::MENU_COMMAND_PLUGIN_RUN: { - RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Load_Menu")); - MarkPluginEssential( - content::PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_CLICK); - LoadPlugin(); - break; - } - case chrome::MENU_COMMAND_PLUGIN_HIDE: { - RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Hide_Menu")); - HidePlugin(); - break; - } - default: - NOTREACHED(); - } -} - -void CefPluginPlaceholder::OnMenuClosed(int request_id) { - DCHECK_EQ(context_menu_request_id_, request_id); - context_menu_request_id_ = 0; -} - -v8::Local CefPluginPlaceholder::GetV8Handle(v8::Isolate* isolate) { - return gin::CreateHandle(isolate, this).ToV8(); -} - -void CefPluginPlaceholder::ShowContextMenu(const blink::WebMouseEvent& event) { - if (context_menu_request_id_) - return; // Don't allow nested context menu requests. - if (!render_frame()) - return; - - content::ContextMenuParams params; - - if (!title_.empty()) { - content::MenuItem name_item; - name_item.label = title_; - params.custom_items.push_back(name_item); - - content::MenuItem separator_item; - separator_item.type = content::MenuItem::SEPARATOR; - params.custom_items.push_back(separator_item); - } - - if (!GetPluginInfo().path.value().empty()) { - content::MenuItem run_item; - run_item.action = chrome::MENU_COMMAND_PLUGIN_RUN; - // Disable this menu item if the plugin is blocked by policy. - run_item.enabled = LoadingAllowed(); - run_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_RUN); - params.custom_items.push_back(run_item); - } - - content::MenuItem hide_item; - hide_item.action = chrome::MENU_COMMAND_PLUGIN_HIDE; - bool is_main_frame_plugin_document = - render_frame()->IsMainFrame() && - render_frame()->GetWebFrame()->GetDocument().IsPluginDocument(); - hide_item.enabled = !is_main_frame_plugin_document; - hide_item.label = l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_PLUGIN_HIDE); - params.custom_items.push_back(hide_item); - - blink::WebPoint point(event.PositionInWidget().x, event.PositionInWidget().y); - if (plugin() && plugin()->Container()) - point = plugin()->Container()->LocalToRootFramePoint(point); - - params.x = point.x; - params.y = point.y; - - context_menu_request_id_ = render_frame()->ShowContextMenu(this, params); - g_last_active_menu = this; -} - -blink::WebPlugin* CefPluginPlaceholder::CreatePlugin() { - std::unique_ptr throttler; - // If the plugin has already been marked essential in its placeholder form, - // we shouldn't create a new throttler and start the process all over again. - if (power_saver_enabled()) { - throttler = content::PluginInstanceThrottler::Create( - content::RenderFrame::DONT_RECORD_DECISION); - // PluginPreroller manages its own lifetime. - new CefPluginPreroller( - render_frame(), GetPluginParams(), GetPluginInfo(), GetIdentifier(), - title_, l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_), - throttler.get()); - } - return render_frame()->CreatePlugin(GetPluginInfo(), GetPluginParams(), - std::move(throttler)); -} - -void CefPluginPlaceholder::OnBlockedContent( - content::RenderFrame::PeripheralContentStatus status, - bool is_same_origin) { - DCHECK(render_frame()); -} - -gin::ObjectTemplateBuilder CefPluginPlaceholder::GetObjectTemplateBuilder( - v8::Isolate* isolate) { - gin::ObjectTemplateBuilder builder = - gin::Wrappable::GetObjectTemplateBuilder(isolate) - .SetMethod( - "hide", &CefPluginPlaceholder::HideCallback) - .SetMethod( - "load", &CefPluginPlaceholder::LoadCallback) - .SetMethod( - "didFinishLoading", - &CefPluginPlaceholder::DidFinishLoadingCallback) - .SetMethod("showPermissionBubble", - &CefPluginPlaceholder::ShowPermissionBubbleCallback); - - if (base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnablePluginPlaceholderTesting)) { - builder.SetMethod( - "didFinishIconRepositionForTesting", - &CefPluginPlaceholder::DidFinishIconRepositionForTestingCallback); - } - - return builder; -} diff --git a/libcef/renderer/plugins/cef_plugin_placeholder.h b/libcef/renderer/plugins/cef_plugin_placeholder.h deleted file mode 100644 index a2ee1336e..000000000 --- a/libcef/renderer/plugins/cef_plugin_placeholder.h +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_ -#define CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_ - -#include - -#include "base/macros.h" -#include "chrome/renderer/plugins/power_saver_info.h" -#include "components/plugins/renderer/loadable_plugin_placeholder.h" -#include "content/public/renderer/context_menu_client.h" -#include "content/public/renderer/render_thread_observer.h" - -enum class CefViewHostMsg_GetPluginInfo_Status; - -class CefPluginPlaceholder final : public plugins::LoadablePluginPlaceholder, - public content::RenderThreadObserver, - public content::ContextMenuClient, - public gin::Wrappable { - public: - static gin::WrapperInfo kWrapperInfo; - - static CefPluginPlaceholder* CreateBlockedPlugin( - content::RenderFrame* render_frame, - const blink::WebPluginParams& params, - const content::WebPluginInfo& info, - const std::string& identifier, - const base::string16& name, - int resource_id, - const base::string16& message, - const PowerSaverInfo& power_saver_info); - - // Creates a new WebViewPlugin with a MissingPlugin as a delegate. - static CefPluginPlaceholder* CreateLoadableMissingPlugin( - content::RenderFrame* render_frame, - const blink::WebPluginParams& params); - - void SetStatus(CefViewHostMsg_GetPluginInfo_Status status); - - private: - CefPluginPlaceholder(content::RenderFrame* render_frame, - const blink::WebPluginParams& params, - const std::string& html_data, - const base::string16& title); - ~CefPluginPlaceholder() override; - - // content::LoadablePluginPlaceholder overrides: - blink::WebPlugin* CreatePlugin() override; - void OnBlockedContent(content::RenderFrame::PeripheralContentStatus status, - bool is_same_origin) override; - - // gin::Wrappable (via PluginPlaceholder) method - gin::ObjectTemplateBuilder GetObjectTemplateBuilder( - v8::Isolate* isolate) final; - - // content::RenderViewObserver (via PluginPlaceholder) override: - bool OnMessageReceived(const IPC::Message& message) override; - - // WebViewPlugin::Delegate (via PluginPlaceholder) methods: - v8::Local GetV8Handle(v8::Isolate* isolate) override; - void ShowContextMenu(const blink::WebMouseEvent&) override; - - // content::RenderThreadObserver methods: - void PluginListChanged() override; - - // content::ContextMenuClient methods: - void OnMenuAction(int request_id, unsigned action) override; - void OnMenuClosed(int request_id) override; - - // Show the Plugins permission bubble. - void ShowPermissionBubbleCallback(); - - CefViewHostMsg_GetPluginInfo_Status status_; - - base::string16 title_; - - int context_menu_request_id_; // Nonzero when request pending. - base::string16 plugin_name_; - - DISALLOW_COPY_AND_ASSIGN(CefPluginPlaceholder); -}; - -#endif // CEF_LIBCEF_RENDERER_PLUGINS_CEF_PLUGIN_PLACEHOLDER_H_ diff --git a/libcef/renderer/plugins/plugin_preroller.cc b/libcef/renderer/plugins/plugin_preroller.cc deleted file mode 100644 index 746df50a7..000000000 --- a/libcef/renderer/plugins/plugin_preroller.cc +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "libcef/renderer/plugins/plugin_preroller.h" - -#include "libcef/renderer/plugins/cef_plugin_placeholder.h" - -#include "base/base64.h" -#include "chrome/grit/generated_resources.h" -#include "chrome/grit/renderer_resources.h" -#include "chrome/renderer/plugins/power_saver_info.h" -#include "third_party/WebKit/public/platform/WebRect.h" -#include "third_party/WebKit/public/web/WebElement.h" -#include "third_party/WebKit/public/web/WebPlugin.h" -#include "third_party/WebKit/public/web/WebPluginContainer.h" -#include "ui/gfx/codec/png_codec.h" - -CefPluginPreroller::CefPluginPreroller( - content::RenderFrame* render_frame, - const blink::WebPluginParams& params, - const content::WebPluginInfo& info, - const std::string& identifier, - const base::string16& name, - const base::string16& message, - content::PluginInstanceThrottler* throttler) - : RenderFrameObserver(render_frame), - params_(params), - info_(info), - identifier_(identifier), - name_(name), - message_(message), - throttler_(throttler) { - DCHECK(throttler); - throttler_->AddObserver(this); -} - -CefPluginPreroller::~CefPluginPreroller() { - if (throttler_) - throttler_->RemoveObserver(this); -} - -void CefPluginPreroller::OnKeyframeExtracted(const SkBitmap* bitmap) { - std::vector png_data; - if (!gfx::PNGCodec::EncodeBGRASkBitmap(*bitmap, false, &png_data)) { - DLOG(ERROR) << "Provided keyframe could not be encoded as PNG."; - return; - } - - base::StringPiece png_as_string(reinterpret_cast(&png_data[0]), - png_data.size()); - - std::string data_url_header = "data:image/png;base64,"; - std::string data_url_body; - base::Base64Encode(png_as_string, &data_url_body); - keyframe_data_url_ = GURL(data_url_header + data_url_body); -} - -void CefPluginPreroller::OnThrottleStateChange() { - if (!throttler_->IsThrottled()) - return; - - PowerSaverInfo power_saver_info; - power_saver_info.power_saver_enabled = true; - power_saver_info.poster_attribute = keyframe_data_url_.spec(); - power_saver_info.custom_poster_size = throttler_->GetSize(); - - CefPluginPlaceholder* placeholder = CefPluginPlaceholder::CreateBlockedPlugin( - render_frame(), params_, info_, identifier_, name_, - IDR_PLUGIN_POSTER_HTML, message_, power_saver_info); - placeholder->SetPremadePlugin(throttler_); - placeholder->set_power_saver_enabled(true); - placeholder->AllowLoading(); - - blink::WebPluginContainer* container = - throttler_->GetWebPlugin()->Container(); - container->SetPlugin(placeholder->plugin()); - - bool success = placeholder->plugin()->Initialize(container); - DCHECK(success); - - container->Invalidate(); - container->ReportGeometry(); - - delete this; -} - -void CefPluginPreroller::OnThrottlerDestroyed() { - throttler_ = nullptr; - delete this; -} - -void CefPluginPreroller::OnDestruct() { - delete this; -} diff --git a/libcef/renderer/plugins/plugin_preroller.h b/libcef/renderer/plugins/plugin_preroller.h deleted file mode 100644 index ab257d940..000000000 --- a/libcef/renderer/plugins/plugin_preroller.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CEF_LIBCEF_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ -#define CEF_LIBCEF_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ - -#include "base/macros.h" -#include "content/public/common/webplugininfo.h" -#include "content/public/renderer/plugin_instance_throttler.h" -#include "content/public/renderer/render_frame_observer.h" -#include "third_party/WebKit/public/web/WebPluginParams.h" -#include "url/gurl.h" - -class SkBitmap; - -// This class manages a plugin briefly for the purposes of keyframe extraction. -// Once a keyframe has been extracted, this class will replace the plugin with -// a ChromePluginPlaceholder. The actual plugin will continue to live in a -// throttled state. This class manages its own lifetime. -class CefPluginPreroller : public content::PluginInstanceThrottler::Observer, - public content::RenderFrameObserver { - public: - // Does not take ownership of |render_frame| or |throttler|. - CefPluginPreroller(content::RenderFrame* render_frame, - const blink::WebPluginParams& params, - const content::WebPluginInfo& info, - const std::string& identifier, - const base::string16& name, - const base::string16& message, - content::PluginInstanceThrottler* throttler); - - ~CefPluginPreroller() override; - - private: - // content::PluginInstanceThrottler::Observer methods: - void OnKeyframeExtracted(const SkBitmap* bitmap) override; - void OnThrottleStateChange() override; - void OnThrottlerDestroyed() override; - - // content::RenderFrameObserver implementation. - void OnDestruct() override; - - blink::WebPluginParams params_; - content::WebPluginInfo info_; - std::string identifier_; - base::string16 name_; - base::string16 message_; - - content::PluginInstanceThrottler* throttler_; - - GURL keyframe_data_url_; - - DISALLOW_COPY_AND_ASSIGN(CefPluginPreroller); -}; - -#endif // CEF_LIBCEF_RENDERER_PLUGINS_PLUGIN_PREROLLER_H_ diff --git a/libcef/renderer/render_message_filter.cc b/libcef/renderer/render_message_filter.cc index 85d7f783c..eb5c2d065 100644 --- a/libcef/renderer/render_message_filter.cc +++ b/libcef/renderer/render_message_filter.cc @@ -11,9 +11,7 @@ #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "chrome/common/render_messages.h" -#include "content/common/devtools_messages.h" #include "content/public/browser/browser_thread.h" -#include "content/renderer/devtools/devtools_agent.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/web/WebSecurityPolicy.h" #include "url/gurl.h" @@ -35,17 +33,7 @@ void CefRenderMessageFilter::OnFilterRemoved() { bool CefRenderMessageFilter::OnMessageReceived(const IPC::Message& message) { bool handled = true; - - // Observe the DevTools messages but don't handle them. - if (message.type() == DevToolsAgentMsg_Attach::ID) { - handled = false; - } else if (message.type() == DevToolsAgentMsg_Detach::ID) { - OnDevToolsAgentDetach(message.routing_id()); - return false; - } - IPC_BEGIN_MESSAGE_MAP(CefRenderMessageFilter, message) - IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Attach, OnDevToolsAgentAttach) IPC_MESSAGE_HANDLER(ChromeViewHostMsg_IsCrashReportingEnabled, OnIsCrashReportingEnabled) IPC_MESSAGE_UNHANDLED(handled = false) @@ -79,44 +67,8 @@ bool CefRenderMessageFilter::Send(IPC::Message* message) { return false; } -void CefRenderMessageFilter::OnDevToolsAgentAttach(const std::string& host_id, - int session_id) { - CEF_POST_TASK_RT( - base::Bind(&CefRenderMessageFilter::OnDevToolsAgentAttach_RT, this)); -} - -void CefRenderMessageFilter::OnDevToolsAgentDetach(int32_t routing_id) { - CEF_POST_TASK_RT(base::Bind(&CefRenderMessageFilter::OnDevToolsAgentDetach_RT, - this, routing_id)); -} - void CefRenderMessageFilter::OnIsCrashReportingEnabled(bool* enabled) { // TODO(cef): Explore whether it's useful for CEF clients to report when crash // reporting is enabled. *enabled = false; } - -void CefRenderMessageFilter::OnDevToolsAgentAttach_RT() { - CEF_REQUIRE_RT(); - CefContentRendererClient::Get()->DevToolsAgentAttached(); -} - -void CefRenderMessageFilter::OnDevToolsAgentDetach_RT(int32_t routing_id) { - CEF_REQUIRE_RT(); - - // Wait for the DevToolsAgent to detach. It would be better to receive - // notification when the DevToolsAgent detaches but that's not currently - // available. - content::DevToolsAgent* agent = - content::DevToolsAgent::FromRoutingId(routing_id); - if (agent && agent->IsAttached()) { - // Try again in a bit. - CEF_POST_DELAYED_TASK_RT( - base::Bind(&CefRenderMessageFilter::OnDevToolsAgentDetach_RT, this, - routing_id), - 50); - return; - } - - CefContentRendererClient::Get()->DevToolsAgentDetached(); -} diff --git a/libcef/renderer/render_message_filter.h b/libcef/renderer/render_message_filter.h index 0899171e2..db9a8cb7d 100644 --- a/libcef/renderer/render_message_filter.h +++ b/libcef/renderer/render_message_filter.h @@ -28,13 +28,8 @@ class CefRenderMessageFilter : public IPC::MessageFilter { private: // Message handlers called on the IO thread. - void OnDevToolsAgentAttach(const std::string& host_id, int session_id); - void OnDevToolsAgentDetach(int32_t routing_id); void OnIsCrashReportingEnabled(bool* enabled); - void OnDevToolsAgentAttach_RT(); - void OnDevToolsAgentDetach_RT(int32_t routing_id); - IPC::Channel* channel_; DISALLOW_COPY_AND_ASSIGN(CefRenderMessageFilter); diff --git a/libcef/renderer/render_urlrequest_impl.cc b/libcef/renderer/render_urlrequest_impl.cc index cd8c30b20..d9fc440d8 100644 --- a/libcef/renderer/render_urlrequest_impl.cc +++ b/libcef/renderer/render_urlrequest_impl.cc @@ -9,15 +9,16 @@ #include "libcef/common/request_impl.h" #include "libcef/common/response_impl.h" #include "libcef/common/task_runner_impl.h" +#include "libcef/renderer/content_renderer_client.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" -#include "third_party/WebKit/public/platform/Platform.h" #include "third_party/WebKit/public/platform/WebString.h" #include "third_party/WebKit/public/platform/WebURL.h" #include "third_party/WebKit/public/platform/WebURLError.h" #include "third_party/WebKit/public/platform/WebURLLoader.h" #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" +#include "third_party/WebKit/public/platform/WebURLLoaderFactory.h" #include "third_party/WebKit/public/platform/WebURLRequest.h" #include "third_party/WebKit/public/platform/WebURLResponse.h" @@ -102,8 +103,9 @@ class CefRenderURLRequest::Context urlRequest.SetRequestorOrigin( blink::WebSecurityOrigin::Create(urlRequest.Url())); - loader_ = blink::Platform::Current()->CreateURLLoader(urlRequest, - task_runner_.get()); + loader_ = + CefContentRendererClient::Get()->url_loader_factory()->CreateURLLoader( + urlRequest, task_runner_.get()); loader_->LoadAsynchronously(urlRequest, url_client_.get()); return true; } @@ -139,7 +141,7 @@ class CefRenderURLRequest::Context if (status_ == UR_IO_PENDING) { status_ = UR_FAILED; - error_code_ = static_cast(error.reason); + error_code_ = static_cast(error.reason()); } OnComplete(); diff --git a/libcef/renderer/v8_impl.cc b/libcef/renderer/v8_impl.cc index 9922fe61a..72fff3f77 100644 --- a/libcef/renderer/v8_impl.cc +++ b/libcef/renderer/v8_impl.cc @@ -713,8 +713,11 @@ void MessageListenerCallbackImpl(v8::Handle message, CefRefPtr exception = new CefV8ExceptionImpl( static_cast(context.get())->GetV8Context(), message); - handler->OnUncaughtException(context->GetBrowser(), context->GetFrame(), - context, exception, stackTrace); + CefRefPtr browser = context->GetBrowser(); + if (browser) { + handler->OnUncaughtException(browser, context->GetFrame(), context, + exception, stackTrace); + } } } // namespace @@ -898,7 +901,9 @@ CefRefPtr CefV8ContextImpl::GetFrame() { if (webframe) { CefRefPtr browser = CefBrowserImpl::GetBrowserForMainFrame(webframe->Top()); - frame = browser->GetFrame(render_frame_util::GetIdentifier(webframe)); + if (browser) { + frame = browser->GetFrame(render_frame_util::GetIdentifier(webframe)); + } } return frame; diff --git a/libcef/renderer/webkit_glue.cc b/libcef/renderer/webkit_glue.cc index d91cd27c7..18943ae56 100644 --- a/libcef/renderer/webkit_glue.cc +++ b/libcef/renderer/webkit_glue.cc @@ -24,7 +24,7 @@ MSVC_PUSH_WARNING_LEVEL(0); #include "third_party/WebKit/Source/core/frame/LocalFrame.h" #include "third_party/WebKit/Source/core/frame/Settings.h" #include "third_party/WebKit/Source/core/frame/WebLocalFrameImpl.h" -#include "third_party/WebKit/Source/platform/ScriptForbiddenScope.h" +#include "third_party/WebKit/Source/platform/bindings/ScriptForbiddenScope.h" #include "third_party/WebKit/Source/platform/bindings/V8Binding.h" #include "third_party/WebKit/Source/platform/weborigin/SchemeRegistry.h" MSVC_POP_WARNING(); @@ -158,12 +158,9 @@ v8::MaybeLocal ExecuteV8ScriptAndReturnValue( if (start_line < 1) start_line = 1; - const blink::KURL kurl = - source_url.IsEmpty() ? blink::KURL() - : blink::KURL(blink::kParsedURLString, source_url); - const blink::ScriptSourceCode ssc = blink::ScriptSourceCode( - source, kurl, blink::WebString() /* nonce */, blink::kNotParserInserted, + source, blink::ScriptSourceLocationType::kInternal, + blink::KURL(source_url), WTF::TextPosition(WTF::OrdinalNumber::FromOneBasedInt(start_line), WTF::OrdinalNumber::FromZeroBasedInt(0))); @@ -179,8 +176,8 @@ v8::MaybeLocal ExecuteV8ScriptAndReturnValue( v8::Local script; if (!blink::V8ScriptRunner::CompileScript(blink::ScriptState::From(context), - ssc, accessControlStatus, - v8CacheOptions) + ssc, blink::ScriptFetchOptions(), + accessControlStatus, v8CacheOptions) .ToLocal(&script)) { DCHECK(tryCatch.HasCaught()); return result; diff --git a/libcef/resources/cef_resources.grd b/libcef/resources/cef_resources.grd index 166a145d5..b4dd992a4 100644 --- a/libcef/resources/cef_resources.grd +++ b/libcef/resources/cef_resources.grd @@ -15,9 +15,12 @@ - - - + + + + + + diff --git a/patch/patch.cfg b/patch/patch.cfg index 9fa63293d..0e79df15e 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -148,7 +148,7 @@ patches = [ # Revert ENABLE_PRINT_PREVIEW changes from the following changeset. # https://codereview.chromium.org/1556463003 # - # Add missing ENABLE_PRINT_PREVIEW checks in chrome/ on Mac. + # Add ENABLE_CEF checks in chrome/browser/ui. 'name': 'print_header_footer_1478_1565', }, { @@ -159,12 +159,6 @@ patches = [ # https://bitbucket.org/chromiumembedded/cef/issue/1639 'name': 'service_manager_654986', }, - { - # Fix rendering of the PDF extension with OSR when the device scale factor - # is not 1. - # https://bitbucket.org/chromiumembedded/cef/issues/1687 - 'name': 'browser_frame_host_guest_1687', - }, { # Fix loading of the PDF extension with proxy BrowserContext. # https://bitbucket.org/chromiumembedded/cef/issues/1710 @@ -223,10 +217,22 @@ patches = [ # Fix chrome Widevine build on Linux. 'name': 'chrome_widevine', }, + { + # Support CEF changes in chrome/browser. + 'name': 'chrome_browser', + }, + { + # Support CEF changes in chrome/renderer. + 'name': 'chrome_renderer', + }, { # Make some methods of ProfileManager virtual. # Allow CEF to intercept GetBrowserContext*InIncognito functions. - 'name': 'chrome_profile', + 'name': 'chrome_browser_profiles', + }, + { + # Allow CEF to share Chrome plugin loading code. + 'name': 'chrome_plugins', }, { # Support StoragePartition proxy by: @@ -256,11 +262,6 @@ patches = [ # https://bitbucket.org/chromiumembedded/cef/issues/1994 'name': 'net_security_expiration_1994', }, - { - # Remove DCHECK hit during latency reporting when using OSR. - # https://bitbucket.org/chromiumembedded/cef/issues/2060 - 'name': 'render_widget_latency_2060', - }, { # Implement breakpad/crashpad customization required by CEF. # https://bitbucket.org/chromiumembedded/cef/issues/1995 @@ -300,6 +301,8 @@ patches = [ # https://bugs.chromium.org/p/chromium/issues/detail?id=728195 # # Add RenderFrameObserver::FrameFocused method. + # + # Add ContentRendererClient::DevToolsAgent[Attached|Detached] methods. 'name': 'content_1129_2015', }, { @@ -316,6 +319,11 @@ patches = [ # Linux: Fix 32-bit build fails with ld.gold: internal error in # get_section_contents, at icf.cc:467 # https://bitbucket.org/chromiumembedded/cef/issues/2256 + # + # Linux: Fix GTK2 compile errors. + # https://bugs.chromium.org/p/chromium/issues/detail?id=771365#c16 + # https://bugs.chromium.org/p/chromium/issues/detail?id=610428#c88 + # https://bugs.chromium.org/p/chromium/issues/detail?id=780973#c15 'name': 'linux_build', }, { @@ -336,4 +344,16 @@ patches = [ # https://bitbucket.org/chromiumembedded/cef/issues/2314 'name': 'mac_widevine_2314', }, + { + # Windows: Fix rc.py ico processing and add support for menuitem separators. + # https://bugs.chromium.org/p/chromium/issues/detail?id=792576 + # https://bugs.chromium.org/p/chromium/issues/detail?id=792594 + # Using 'DEPS' because it must be applied before the `gclient sync` step. + 'name': 'DEPS', + }, + { + # Fix ReportingServiceProxy mojo binding failure messages. + # https://bugs.chromium.org/p/chromium/issues/detail?id=784518 + 'name': 'blink_mojo_806477', + }, ] diff --git a/patch/patches/DEPS.patch b/patch/patches/DEPS.patch new file mode 100644 index 000000000..51e02688e --- /dev/null +++ b/patch/patches/DEPS.patch @@ -0,0 +1,27 @@ +diff --git build/toolchain/win/rc/linux64/rc.sha1 build/toolchain/win/rc/linux64/rc.sha1 +index 76f7627..11440ae 100644 +--- build/toolchain/win/rc/linux64/rc.sha1 ++++ build/toolchain/win/rc/linux64/rc.sha1 +@@ -1 +1 @@ +-a6d75f015275c8a65ff855e8b78437dd03a9bb7d +\ No newline at end of file ++e642170ce663c75a44822c3bffb1579068ab6f17 +\ No newline at end of file +diff --git build/toolchain/win/rc/mac/rc.sha1 build/toolchain/win/rc/mac/rc.sha1 +index 8a817c5..ff0c32e 100644 +--- build/toolchain/win/rc/mac/rc.sha1 ++++ build/toolchain/win/rc/mac/rc.sha1 +@@ -1 +1 @@ +-3ccc7a61fc5368e8db33364093e42a92de874a26 +\ No newline at end of file ++58489426ecea29e276c94529201bc6a0cc1da027 +\ No newline at end of file +diff --git build/toolchain/win/rc/win/rc.exe.sha1 build/toolchain/win/rc/win/rc.exe.sha1 +index c74dce41..165e4688 100644 +--- build/toolchain/win/rc/win/rc.exe.sha1 ++++ build/toolchain/win/rc/win/rc.exe.sha1 +@@ -1 +1 @@ +-9887dc07d042bf58d20b5557e3f91d18d0254022 +\ No newline at end of file ++9de6c3d751b4432a3a7b1cf96f432a21187764e9 +\ No newline at end of file \ No newline at end of file diff --git a/patch/patches/blink_mojo_806477.patch b/patch/patches/blink_mojo_806477.patch new file mode 100644 index 000000000..4b648c097 --- /dev/null +++ b/patch/patches/blink_mojo_806477.patch @@ -0,0 +1,52 @@ +diff --git third_party/WebKit/Source/core/frame/Deprecation.cpp third_party/WebKit/Source/core/frame/Deprecation.cpp +index db80f4a67b11..f3191313f929 100644 +--- third_party/WebKit/Source/core/frame/Deprecation.cpp ++++ third_party/WebKit/Source/core/frame/Deprecation.cpp +@@ -16,8 +16,9 @@ + #include "core/page/Page.h" + #include "core/workers/WorkerOrWorkletGlobalScope.h" + #include "platform/runtime_enabled_features.h" ++#include "public/platform/Platform.h" + #include "public/platform/reporting.mojom-blink.h" +-#include "services/service_manager/public/cpp/interface_provider.h" ++#include "services/service_manager/public/cpp/connector.h" + #include "third_party/WebKit/common/feature_policy/feature_policy_feature.h" + + using blink::WebFeature; +@@ -796,7 +797,9 @@ void Deprecation::GenerateReport(const LocalFrame* frame, WebFeature feature) { + + // Send the deprecation report to the Reporting API. + mojom::blink::ReportingServiceProxyPtr service; +- frame->Client()->GetInterfaceProvider()->GetInterface(&service); ++ Platform* platform = Platform::Current(); ++ platform->GetConnector()->BindInterface(platform->GetBrowserServiceName(), ++ &service); + service->QueueDeprecationReport(document->Url(), info.message, + body->sourceFile(), body->lineNumber(), + body->columnNumber()); +diff --git third_party/WebKit/Source/core/frame/Intervention.cpp third_party/WebKit/Source/core/frame/Intervention.cpp +index fb342ba765db..089eb6a3d662 100644 +--- third_party/WebKit/Source/core/frame/Intervention.cpp ++++ third_party/WebKit/Source/core/frame/Intervention.cpp +@@ -11,8 +11,9 @@ + #include "core/frame/Report.h" + #include "core/frame/ReportingContext.h" + #include "core/inspector/ConsoleMessage.h" ++#include "public/platform/Platform.h" + #include "public/platform/reporting.mojom-blink.h" +-#include "services/service_manager/public/cpp/interface_provider.h" ++#include "services/service_manager/public/cpp/connector.h" + + namespace blink { + +@@ -44,7 +45,9 @@ void Intervention::GenerateReport(const LocalFrame* frame, + + // Send the intervention report to the Reporting API. + mojom::blink::ReportingServiceProxyPtr service; +- frame->Client()->GetInterfaceProvider()->GetInterface(&service); ++ Platform* platform = Platform::Current(); ++ platform->GetConnector()->BindInterface(platform->GetBrowserServiceName(), ++ &service); + service->QueueInterventionReport(document->Url(), message, body->sourceFile(), + body->lineNumber(), body->columnNumber()); + } diff --git a/patch/patches/browser_compositor_mac.patch b/patch/patches/browser_compositor_mac.patch index e7be3cb18..6beca87f5 100644 --- a/patch/patches/browser_compositor_mac.patch +++ b/patch/patches/browser_compositor_mac.patch @@ -1,8 +1,8 @@ diff --git content/browser/renderer_host/browser_compositor_view_mac.h content/browser/renderer_host/browser_compositor_view_mac.h -index 8bc4ebd0d771..42949486cf98 100644 +index 3ed8b18dfabd..f0c30a60376a 100644 --- content/browser/renderer_host/browser_compositor_view_mac.h +++ content/browser/renderer_host/browser_compositor_view_mac.h -@@ -52,6 +52,7 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient { +@@ -53,6 +53,7 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient { // These will not return nullptr until Destroy is called. DelegatedFrameHost* GetDelegatedFrameHost(); @@ -10,7 +10,7 @@ index 8bc4ebd0d771..42949486cf98 100644 // Ensure that the currect compositor frame be cleared (even if it is // potentially visible). -@@ -59,6 +60,7 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient { +@@ -60,6 +61,7 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient { // This may return nullptr, if this has detached itself from its // ui::Compositor. @@ -19,10 +19,10 @@ index 8bc4ebd0d771..42949486cf98 100644 void DidCreateNewRendererCompositorFrameSink( diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm -index 04ca86589a13..796a874d0e13 100644 +index 00169dea145c..cb3d2b3175b1 100644 --- content/browser/renderer_host/browser_compositor_view_mac.mm +++ content/browser/renderer_host/browser_compositor_view_mac.mm -@@ -209,6 +209,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { +@@ -211,6 +211,12 @@ BrowserCompositorMac::~BrowserCompositorMac() { g_spare_recyclable_compositors.Get().clear(); } @@ -35,7 +35,7 @@ index 04ca86589a13..796a874d0e13 100644 ui::AcceleratedWidgetMac* BrowserCompositorMac::GetAcceleratedWidgetMac() { if (recyclable_compositor_) return recyclable_compositor_->accelerated_widget_mac(); -@@ -439,8 +445,13 @@ SkColor BrowserCompositorMac::DelegatedFrameHostGetGutterColor( +@@ -441,8 +447,13 @@ SkColor BrowserCompositorMac::DelegatedFrameHostGetGutterColor( } gfx::Size BrowserCompositorMac::DelegatedFrameHostDesiredSizeInDIP() const { diff --git a/patch/patches/browser_frame_host_guest_1687.patch b/patch/patches/browser_frame_host_guest_1687.patch deleted file mode 100644 index c4f573522..000000000 --- a/patch/patches/browser_frame_host_guest_1687.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git content/browser/frame_host/render_widget_host_view_guest.cc content/browser/frame_host/render_widget_host_view_guest.cc -index e885721017fd..7a20a016b389 100644 ---- content/browser/frame_host/render_widget_host_view_guest.cc -+++ content/browser/frame_host/render_widget_host_view_guest.cc -@@ -251,13 +251,14 @@ void RenderWidgetHostViewGuest::Destroy() { - } - - gfx::Size RenderWidgetHostViewGuest::GetPhysicalBackingSize() const { -+ RenderWidgetHostViewBase* rwhv = GetOwnerRenderWidgetHostView(); -+ if (rwhv) -+ return rwhv->GetPhysicalBackingSize(); - // We obtain the reference to native view from the owner RenderWidgetHostView. - // If the guest is embedded inside a cross-process frame, it is possible to - // reach here after the frame is detached in which case there will be no owner - // view. -- if (!GetOwnerRenderWidgetHostView()) -- return gfx::Size(); -- return RenderWidgetHostViewBase::GetPhysicalBackingSize(); -+ return gfx::Size(); - } - - base::string16 RenderWidgetHostViewGuest::GetSelectedText() { diff --git a/patch/patches/browser_plugin_guest_1565.patch b/patch/patches/browser_plugin_guest_1565.patch index df6a92f5c..1023c0af5 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 e6e79a68e263..c8007ccea445 100644 +index ccdafd2e9280..3d3651cf5b26 100644 --- content/browser/browser_plugin/browser_plugin_guest.cc +++ content/browser/browser_plugin/browser_plugin_guest.cc -@@ -337,8 +337,11 @@ void BrowserPluginGuest::InitInternal( +@@ -339,8 +339,11 @@ void BrowserPluginGuest::InitInternal( static_cast(GetWebContents()->GetView()); } @@ -15,7 +15,7 @@ index e6e79a68e263..c8007ccea445 100644 // Once a BrowserPluginGuest has an embedder WebContents, it's considered to // be attached. -@@ -832,10 +835,19 @@ void BrowserPluginGuest::OnWillAttachComplete( +@@ -837,10 +840,19 @@ void BrowserPluginGuest::OnWillAttachComplete( static_cast(GetWebContents()->GetView()); if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) { web_contents_view->CreateViewForWidget( @@ -37,7 +37,7 @@ index e6e79a68e263..c8007ccea445 100644 attached_ = true; diff --git content/browser/frame_host/interstitial_page_impl.cc content/browser/frame_host/interstitial_page_impl.cc -index 5db34c6d5f92..cdd9d1245571 100644 +index 2f24f1b959d4..5cfb0b3e97c6 100644 --- content/browser/frame_host/interstitial_page_impl.cc +++ content/browser/frame_host/interstitial_page_impl.cc @@ -613,7 +613,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() { @@ -50,7 +50,7 @@ index 5db34c6d5f92..cdd9d1245571 100644 render_view_host_->GetMainFrame()->AllowBindings( BINDINGS_POLICY_DOM_AUTOMATION); diff --git content/browser/web_contents/web_contents_view.h content/browser/web_contents/web_contents_view.h -index e4401f85bf3f..20b85609a23f 100644 +index a38a936af6df..5380e09ee023 100644 --- content/browser/web_contents/web_contents_view.h +++ content/browser/web_contents/web_contents_view.h @@ -24,7 +24,7 @@ struct ScreenInfo; @@ -62,7 +62,7 @@ index e4401f85bf3f..20b85609a23f 100644 public: virtual ~WebContentsView() {} -@@ -86,13 +86,9 @@ class WebContentsView { +@@ -91,13 +91,9 @@ class WebContentsView { // Sets up the View that holds the rendered web page, receives messages for // it and contains page plugins. The host view should be sized to the current // size of the WebContents. @@ -79,10 +79,10 @@ index e4401f85bf3f..20b85609a23f 100644 // Creates a new View that holds a popup and receives messages for it. virtual RenderWidgetHostViewBase* CreateViewForPopupWidget( diff --git content/browser/web_contents/web_contents_view_aura.cc content/browser/web_contents/web_contents_view_aura.cc -index 3395028a568b..5364563c606b 100644 +index ee18b4dd66bd..9e447f7d9511 100644 --- content/browser/web_contents/web_contents_view_aura.cc +++ content/browser/web_contents/web_contents_view_aura.cc -@@ -840,7 +840,8 @@ void WebContentsViewAura::CreateView( +@@ -886,7 +886,8 @@ void WebContentsViewAura::CreateView(const gfx::Size& initial_size, } RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( @@ -92,7 +92,7 @@ index 3395028a568b..5364563c606b 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 -@@ -852,6 +853,7 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( +@@ -898,6 +899,7 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( render_widget_host->GetView()); } @@ -101,10 +101,10 @@ index 3395028a568b..5364563c606b 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 359032e66343..b45b8c426421 100644 +index 7b2078f53dc4..e65fd914dd0d 100644 --- content/browser/web_contents/web_contents_view_aura.h +++ content/browser/web_contents/web_contents_view_aura.h -@@ -116,7 +116,7 @@ class CONTENT_EXPORT WebContentsViewAura +@@ -120,7 +120,7 @@ class CONTENT_EXPORT WebContentsViewAura gfx::NativeView context) override; RenderWidgetHostViewBase* CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -114,10 +114,10 @@ index 359032e66343..b45b8c426421 100644 RenderWidgetHost* render_widget_host) override; void SetPageTitle(const base::string16& title) override; diff --git content/browser/web_contents/web_contents_view_child_frame.cc content/browser/web_contents/web_contents_view_child_frame.cc -index e1aca335ede0..47e02fc73f74 100644 +index e1db175c25cb..1ef7b20a7add 100644 --- content/browser/web_contents/web_contents_view_child_frame.cc +++ content/browser/web_contents/web_contents_view_child_frame.cc -@@ -94,7 +94,7 @@ void WebContentsViewChildFrame::CreateView(const gfx::Size& initial_size, +@@ -96,7 +96,7 @@ void WebContentsViewChildFrame::CreateView(const gfx::Size& initial_size, RenderWidgetHostViewBase* WebContentsViewChildFrame::CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -127,10 +127,10 @@ index e1aca335ede0..47e02fc73f74 100644 } diff --git content/browser/web_contents/web_contents_view_child_frame.h content/browser/web_contents/web_contents_view_child_frame.h -index 18d45eea524f..6aa738daf5b5 100644 +index ca3c586f9f8f..5fd0e860a5ff 100644 --- content/browser/web_contents/web_contents_view_child_frame.h +++ content/browser/web_contents/web_contents_view_child_frame.h -@@ -40,7 +40,7 @@ class WebContentsViewChildFrame : public WebContentsView, +@@ -41,7 +41,7 @@ class WebContentsViewChildFrame : public WebContentsView, gfx::NativeView context) override; RenderWidgetHostViewBase* CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -140,10 +140,10 @@ index 18d45eea524f..6aa738daf5b5 100644 RenderWidgetHost* render_widget_host) override; void SetPageTitle(const base::string16& title) override; diff --git content/browser/web_contents/web_contents_view_guest.cc content/browser/web_contents/web_contents_view_guest.cc -index 025686922ade..da7a9b88cabc 100644 +index f1370d294ef9..d7a451028e64 100644 --- content/browser/web_contents/web_contents_view_guest.cc +++ content/browser/web_contents/web_contents_view_guest.cc -@@ -72,6 +72,8 @@ void WebContentsViewGuest::GetScreenInfo(ScreenInfo* screen_info) const { +@@ -73,6 +73,8 @@ void WebContentsViewGuest::GetScreenInfo(ScreenInfo* screen_info) const { void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) { #if defined(USE_AURA) @@ -152,16 +152,16 @@ index 025686922ade..da7a9b88cabc 100644 // In aura, ScreenPositionClient doesn't work properly if we do // not have the native view associated with this WebContentsViewGuest in the // view hierarchy. We add this view as embedder's child here. -@@ -83,6 +85,8 @@ void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) { +@@ -85,6 +87,8 @@ void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) { void WebContentsViewGuest::OnGuestDetached(WebContentsView* old_parent_view) { #if defined(USE_AURA) + if (!platform_view_->GetNativeView()) + return; - old_parent_view->GetNativeView()->RemoveChild( - platform_view_->GetNativeView()); - #endif // defined(USE_AURA) -@@ -134,7 +138,8 @@ void WebContentsViewGuest::CreateView(const gfx::Size& initial_size, + if (!IsUsingMus()) { + old_parent_view->GetNativeView()->RemoveChild( + platform_view_->GetNativeView()); +@@ -138,7 +142,8 @@ void WebContentsViewGuest::CreateView(const gfx::Size& initial_size, } RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( @@ -171,7 +171,7 @@ index 025686922ade..da7a9b88cabc 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 -@@ -146,11 +151,19 @@ RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( +@@ -150,11 +155,19 @@ RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( render_widget_host->GetView()); } @@ -195,10 +195,10 @@ index 025686922ade..da7a9b88cabc 100644 RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForPopupWidget( diff --git content/browser/web_contents/web_contents_view_guest.h content/browser/web_contents/web_contents_view_guest.h -index 464ea8f780e4..0d3118df538a 100644 +index c04fe9bc23c4..5dba7a8b9e76 100644 --- content/browser/web_contents/web_contents_view_guest.h +++ content/browser/web_contents/web_contents_view_guest.h -@@ -58,7 +58,7 @@ class WebContentsViewGuest : public WebContentsView, +@@ -59,7 +59,7 @@ class WebContentsViewGuest : public WebContentsView, gfx::NativeView context) override; RenderWidgetHostViewBase* CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -208,7 +208,7 @@ index 464ea8f780e4..0d3118df538a 100644 RenderWidgetHost* render_widget_host) override; void SetPageTitle(const base::string16& title) override; diff --git content/browser/web_contents/web_contents_view_mac.h content/browser/web_contents/web_contents_view_mac.h -index 12675d077c8a..46db5596618e 100644 +index 95ba5f05e4f7..39d4d764136c 100644 --- content/browser/web_contents/web_contents_view_mac.h +++ content/browser/web_contents/web_contents_view_mac.h @@ -90,7 +90,7 @@ class WebContentsViewMac : public WebContentsView, @@ -221,10 +221,10 @@ index 12675d077c8a..46db5596618e 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 abcbb302f417..63e73721f155 100644 +index 2c5dd9e99e6d..39d6bceb55ed 100644 --- content/browser/web_contents/web_contents_view_mac.mm +++ content/browser/web_contents/web_contents_view_mac.mm -@@ -353,7 +353,8 @@ void WebContentsViewMac::CreateView( +@@ -376,7 +376,8 @@ void WebContentsViewMac::CreateView( } RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget( @@ -234,7 +234,7 @@ index abcbb302f417..63e73721f155 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 -@@ -365,6 +366,7 @@ RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget( +@@ -388,6 +389,7 @@ RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget( render_widget_host->GetView()); } @@ -243,7 +243,7 @@ index abcbb302f417..63e73721f155 100644 g_create_render_widget_host_view ? g_create_render_widget_host_view(render_widget_host, diff --git content/public/browser/browser_plugin_guest_delegate.h content/public/browser/browser_plugin_guest_delegate.h -index ef0ff9d6f67b..4eab513ba4ce 100644 +index 9a3c2375c7f6..f95ea9cbe9ba 100644 --- content/public/browser/browser_plugin_guest_delegate.h +++ content/public/browser/browser_plugin_guest_delegate.h @@ -19,6 +19,7 @@ namespace content { @@ -254,7 +254,7 @@ index ef0ff9d6f67b..4eab513ba4ce 100644 // Objects implement this interface to get notified about changes in the guest // WebContents and to provide necessary functionality. -@@ -72,6 +73,10 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate { +@@ -67,6 +68,10 @@ class CONTENT_EXPORT BrowserPluginGuestDelegate { // content module. virtual void SetGuestHost(GuestHost* guest_host) {} diff --git a/patch/patches/chrome_browser.patch b/patch/patches/chrome_browser.patch new file mode 100644 index 000000000..d67ef0506 --- /dev/null +++ b/patch/patches/chrome_browser.patch @@ -0,0 +1,31 @@ +diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn +index 1126d7e63c30..64ecb8982428 100644 +--- chrome/browser/BUILD.gn ++++ chrome/browser/BUILD.gn +@@ -7,6 +7,7 @@ import("//build/config/crypto.gni") + import("//build/config/features.gni") + import("//build/config/ui.gni") + import("//build/split_static_library.gni") ++import("//cef/libcef/features/features.gni") + import("//chrome/common/features.gni") + import("//components/feature_engagement/features.gni") + import("//components/nacl/features.gni") +@@ -1551,6 +1552,7 @@ split_static_library("browser") { + "//base:i18n", + "//base/allocator:features", + "//cc", ++ "//cef/libcef/features", + "//chrome:extra_resources", + "//chrome:resources", + "//chrome:strings", +@@ -1797,6 +1799,10 @@ split_static_library("browser") { + "//ui/web_dialogs", + ] + ++ if (enable_cef) { ++ configs += [ "//cef/libcef/features:config" ] ++ } ++ + if (is_android) { + sources += [ + "after_startup_task_utils_android.cc", diff --git a/patch/patches/chrome_profile.patch b/patch/patches/chrome_browser_profiles.patch similarity index 89% rename from patch/patches/chrome_profile.patch rename to patch/patches/chrome_browser_profiles.patch index cf894f3aa..c550433fd 100644 --- a/patch/patches/chrome_profile.patch +++ b/patch/patches/chrome_browser_profiles.patch @@ -1,11 +1,12 @@ diff --git chrome/browser/profiles/incognito_helpers.cc chrome/browser/profiles/incognito_helpers.cc -index 6155e9606d67..2125a436c87e 100644 +index ce4f72b98a05..f7d57b854399 100644 --- chrome/browser/profiles/incognito_helpers.cc +++ chrome/browser/profiles/incognito_helpers.cc -@@ -8,13 +8,35 @@ +@@ -7,19 +7,42 @@ + #include "chrome/browser/profiles/profile.h" namespace chrome { - ++ +namespace { +BrowserContextIncognitoHelper* g_helper = nullptr; +} // namespace @@ -13,7 +14,7 @@ index 6155e9606d67..2125a436c87e 100644 +void SetBrowserContextIncognitoHelper(BrowserContextIncognitoHelper* helper) { + g_helper = helper; +} -+ + content::BrowserContext* GetBrowserContextRedirectedInIncognito( content::BrowserContext* context) { + if (g_helper) { @@ -26,6 +27,13 @@ index 6155e9606d67..2125a436c87e 100644 return static_cast(context)->GetOriginalProfile(); } + const content::BrowserContext* GetBrowserContextRedirectedInIncognito( + const content::BrowserContext* context) { +- return static_cast(context)->GetOriginalProfile(); ++ return GetBrowserContextRedirectedInIncognito( ++ const_cast(context)); + } + content::BrowserContext* GetBrowserContextOwnInstanceInIncognito( content::BrowserContext* context) { + if (g_helper) { @@ -39,7 +47,7 @@ index 6155e9606d67..2125a436c87e 100644 } diff --git chrome/browser/profiles/incognito_helpers.h chrome/browser/profiles/incognito_helpers.h -index 4b430133e16f..169ca4765907 100644 +index e8e76ce5b954..1dd338dd0142 100644 --- chrome/browser/profiles/incognito_helpers.h +++ chrome/browser/profiles/incognito_helpers.h @@ -11,6 +11,19 @@ class BrowserContext; @@ -63,7 +71,7 @@ index 4b430133e16f..169ca4765907 100644 content::BrowserContext* GetBrowserContextRedirectedInIncognito( content::BrowserContext* context); diff --git chrome/browser/profiles/profile_manager.cc chrome/browser/profiles/profile_manager.cc -index a711472a63a9..47212b151d41 100644 +index 0fe78f76aaa7..8fb527cc2636 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) diff --git a/patch/patches/chrome_plugins.patch b/patch/patches/chrome_plugins.patch new file mode 100644 index 000000000..daaf56bbb --- /dev/null +++ b/patch/patches/chrome_plugins.patch @@ -0,0 +1,189 @@ +diff --git chrome/browser/plugins/plugin_info_host_impl.cc chrome/browser/plugins/plugin_info_host_impl.cc +index 1afbaf86ac40..e2edec854ca7 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/build_config.h" ++#include "cef/libcef/features/features.h" + #include "chrome/browser/browser_process.h" + #include "chrome/browser/content_settings/host_content_settings_map_factory.h" + #include "chrome/browser/plugins/chrome_plugin_service_filter.h" +@@ -56,6 +57,11 @@ + #include "url/origin.h" + #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. + ++#if BUILDFLAG(ENABLE_CEF) ++#include "cef/libcef/browser/plugins/plugin_service_filter.h" ++#include "cef/libcef/common/extensions/extensions_util.h" ++#endif ++ + #if BUILDFLAG(ENABLE_EXTENSIONS) + #include "components/guest_view/browser/guest_view_base.h" + #include "extensions/browser/extension_registry.h" +@@ -77,12 +83,10 @@ namespace { + class ShutdownNotifierFactory + : public BrowserContextKeyedServiceShutdownNotifierFactory { + public: +- static ShutdownNotifierFactory* GetInstance() { +- return base::Singleton::get(); +- } ++ static ShutdownNotifierFactory* GetInstance(); + + private: +- friend struct base::DefaultSingletonTraits; ++ friend struct base::LazyInstanceTraitsBase; + + ShutdownNotifierFactory() + : BrowserContextKeyedServiceShutdownNotifierFactory( +@@ -93,6 +97,14 @@ class ShutdownNotifierFactory + DISALLOW_COPY_AND_ASSIGN(ShutdownNotifierFactory); + }; + ++base::LazyInstance::Leaky g_shutdown_notifier_factory = ++ LAZY_INSTANCE_INITIALIZER; ++ ++// static ++ShutdownNotifierFactory* ShutdownNotifierFactory::GetInstance() { ++ return g_shutdown_notifier_factory.Pointer(); ++} ++ + #if BUILDFLAG(ENABLE_LIBRARY_CDMS) + + enum PluginAvailabilityStatusForUMA { +@@ -124,6 +136,9 @@ bool IsPluginLoadingAccessibleResourceInWebView( + extensions::ExtensionRegistry* extension_registry, + int process_id, + const GURL& resource) { ++ if (!extension_registry) ++ return false; ++ + extensions::WebViewRendererState* renderer_state = + extensions::WebViewRendererState::GetInstance(); + std::string partition_id; +@@ -153,12 +168,16 @@ 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)) { ++#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_.MoveToThread( +@@ -325,6 +344,14 @@ void PluginInfoHostImpl::Context::DecidePluginStatus( + PluginMetadata::SecurityStatus security_status, + const std::string& plugin_identifier, + chrome::mojom::PluginStatus* status) const { ++#if BUILDFLAG(ENABLE_CEF) ++ // Don't override the user decision. ++ if (*status == chrome::mojom::PluginStatus::kBlocked || ++ *status == chrome::mojom::PluginStatus::kDisabled) { ++ return; ++ } ++#endif ++ + if (security_status == PluginMetadata::SECURITY_STATUS_FULLY_TRUSTED) { + *status = chrome::mojom::PluginStatus::kAllowed; + return; +@@ -450,16 +477,36 @@ bool PluginInfoHostImpl::Context::FindEnabledPlugin( + return false; + } + ++ const bool is_main_frame = ++ main_frame_origin.IsSameOriginWith(url::Origin::Create(url)); ++ ++#if BUILDFLAG(ENABLE_CEF) ++ CefPluginServiceFilter* filter = static_cast( ++ PluginService::GetInstance()->GetFilter()); ++ DCHECK(filter); ++ ++ 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)) { ++ break; ++ } ++ } ++#else // !BUILDFLAG(ENABLE_CEF) + content::PluginServiceFilter* filter = + 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])) { + break; + } + } ++#endif // !BUILDFLAG(ENABLE_CEF) + + // If we broke out of the loop, we have found an enabled plugin. + bool enabled = i < matching_plugins.size(); +diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc +index 5dc888bfb2df..297737be682e 100644 +--- chrome/renderer/chrome_content_renderer_client.cc ++++ chrome/renderer/chrome_content_renderer_client.cc +@@ -805,6 +805,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( + + if ((status == chrome::mojom::PluginStatus::kUnauthorized || + status == chrome::mojom::PluginStatus::kBlocked) && ++ observer && + observer->IsPluginTemporarilyAllowed(identifier)) { + status = chrome::mojom::PluginStatus::kAllowed; + } +@@ -992,7 +993,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( + render_frame->GetRemoteAssociatedInterfaces()->GetInterface( + &plugin_auth_host); + plugin_auth_host->BlockedUnauthorizedPlugin(group_name, identifier); +- observer->DidBlockContentType(content_type, group_name); ++ if (observer) ++ observer->DidBlockContentType(content_type, group_name); + break; + } + case chrome::mojom::PluginStatus::kBlocked: { +@@ -1001,7 +1003,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( + l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); + placeholder->AllowLoading(); + RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked")); +- observer->DidBlockContentType(content_type, group_name); ++ if (observer) ++ observer->DidBlockContentType(content_type, group_name); + break; + } + case chrome::mojom::PluginStatus::kBlockedByPolicy: { +@@ -1011,7 +1014,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( + group_name)); + RenderThread::Get()->RecordAction( + UserMetricsAction("Plugin_BlockedByPolicy")); +- observer->DidBlockContentType(content_type, group_name); ++ if (observer) ++ observer->DidBlockContentType(content_type, group_name); + break; + } + case chrome::mojom::PluginStatus::kBlockedNoLoading: { +@@ -1019,7 +1023,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( + IDR_BLOCKED_PLUGIN_HTML, + l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED_NO_LOADING, + group_name)); +- observer->DidBlockContentType(content_type, group_name); ++ if (observer) ++ observer->DidBlockContentType(content_type, group_name); + break; + } + case chrome::mojom::PluginStatus::kComponentUpdateRequired: { diff --git a/patch/patches/chrome_renderer.patch b/patch/patches/chrome_renderer.patch new file mode 100644 index 000000000..d25dde76f --- /dev/null +++ b/patch/patches/chrome_renderer.patch @@ -0,0 +1,31 @@ +diff --git chrome/renderer/BUILD.gn chrome/renderer/BUILD.gn +index da3b9d31a05b..78c15d30755d 100644 +--- chrome/renderer/BUILD.gn ++++ chrome/renderer/BUILD.gn +@@ -3,6 +3,7 @@ + # found in the LICENSE file. + + import("//build/config/features.gni") ++import("//cef/libcef/features/features.gni") + import("//chrome/common/features.gni") + import("//components/nacl/features.gni") + import("//components/spellcheck/spellcheck_build_features.gni") +@@ -102,6 +103,7 @@ static_library("renderer") { + defines = [] + + deps = [ ++ "//cef/libcef/features", + "//chrome:resources", + "//chrome:strings", + "//chrome/common", +@@ -161,6 +163,10 @@ static_library("renderer") { + + configs += [ "//build/config/compiler:wexit_time_destructors" ] + ++ if (enable_cef) { ++ configs += [ "//cef/libcef/features:config" ] ++ } ++ + if (enable_nacl) { + deps += [ + "//components/nacl/loader", diff --git a/patch/patches/chrome_widevine.patch b/patch/patches/chrome_widevine.patch index 1b88e6e8d..d3124567d 100644 --- a/patch/patches/chrome_widevine.patch +++ b/patch/patches/chrome_widevine.patch @@ -1,5 +1,5 @@ diff --git chrome/common/chrome_content_client.cc chrome/common/chrome_content_client.cc -index 84016e8ad769..684b9d1f6089 100644 +index 8171be4d4249..1d437dabd35e 100644 --- chrome/common/chrome_content_client.cc +++ chrome/common/chrome_content_client.cc @@ -90,7 +90,8 @@ diff --git a/patch/patches/component_build_1617.patch b/patch/patches/component_build_1617.patch index 4c8cb6674..6f454993b 100644 --- a/patch/patches/component_build_1617.patch +++ b/patch/patches/component_build_1617.patch @@ -1,17 +1,5 @@ -diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn -index 82f43b9591ae..1ef9adad166f 100644 ---- chrome/browser/ui/BUILD.gn -+++ chrome/browser/ui/BUILD.gn -@@ -369,6 +369,7 @@ split_static_library("ui") { - "//chrome/browser/ui/webui/usb_internals:mojo_bindings", - "//chrome/common", - "//chrome/common:search_mojom", -+ "//chrome/common:service_process_mojom", - "//chrome/common/net", - "//chrome/installer/util:with_no_strings", - "//components/about_ui", diff --git content/app/content_service_manager_main_delegate.h content/app/content_service_manager_main_delegate.h -index 7563ce48bf5e..6c594749d57b 100644 +index 4393a8fac233..860715e86900 100644 --- content/app/content_service_manager_main_delegate.h +++ content/app/content_service_manager_main_delegate.h @@ -16,7 +16,8 @@ namespace content { @@ -25,7 +13,7 @@ index 7563ce48bf5e..6c594749d57b 100644 explicit ContentServiceManagerMainDelegate(const ContentMainParams& params); ~ContentServiceManagerMainDelegate() override; diff --git third_party/WebKit/Source/controller/BUILD.gn third_party/WebKit/Source/controller/BUILD.gn -index 1d29633ba10d..1a42fe1d37fa 100644 +index 714113da5d67..08130f97b76c 100644 --- third_party/WebKit/Source/controller/BUILD.gn +++ third_party/WebKit/Source/controller/BUILD.gn @@ -16,6 +16,7 @@ component("controller") { diff --git a/patch/patches/compositor_1368.patch b/patch/patches/compositor_1368.patch index 0d1dbe3ec..8a4ce93d0 100644 --- a/patch/patches/compositor_1368.patch +++ b/patch/patches/compositor_1368.patch @@ -1,23 +1,30 @@ diff --git content/browser/compositor/gpu_process_transport_factory.cc content/browser/compositor/gpu_process_transport_factory.cc -index 45bf6b1b4618..f41d40a6887b 100644 +index cddd17ca8682..c8641e9d0fdc 100644 --- content/browser/compositor/gpu_process_transport_factory.cc +++ content/browser/compositor/gpu_process_transport_factory.cc -@@ -274,6 +274,13 @@ GpuProcessTransportFactory::~GpuProcessTransportFactory() { - std::unique_ptr - GpuProcessTransportFactory::CreateSoftwareOutputDevice( - ui::Compositor* compositor) { -+ if (compositor->delegate()) { -+ std::unique_ptr output_device = -+ compositor->delegate()->CreateSoftwareOutputDevice(compositor); -+ if (output_device) -+ return output_device; -+ } +@@ -502,9 +502,19 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( + // surfaces as they are not following the correct mode. + DisableGpuCompositing(compositor.get()); + } + - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(switches::kHeadless)) - return base::WrapUnique(new viz::SoftwareOutputDevice); ++ std::unique_ptr output_device; ++ if (compositor->delegate()) { ++ output_device = compositor->delegate()->CreateSoftwareOutputDevice( ++ compositor.get()); ++ } ++ if (!output_device) { ++ output_device = CreateSoftwareOutputDevice(compositor->widget()); ++ } ++ + display_output_surface = + std::make_unique( +- CreateSoftwareOutputDevice(compositor->widget()), vsync_callback, ++ std::move(output_device), vsync_callback, + compositor->task_runner()); + } else { + DCHECK(context_provider); diff --git ui/compositor/compositor.h ui/compositor/compositor.h -index d842aa55175b..5683e6fb68f8 100644 +index 00885cbac420..874ec42e3825 100644 --- ui/compositor/compositor.h +++ ui/compositor/compositor.h @@ -23,6 +23,7 @@ @@ -46,7 +53,7 @@ index d842aa55175b..5683e6fb68f8 100644 // Compositor object to take care of GPU painting. // A Browser compositor object is responsible for generating the final // displayable form of pixels comprising a single widget's contents. It draws an -@@ -215,6 +227,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, +@@ -218,6 +230,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, // Schedules a redraw of the layer tree associated with this compositor. void ScheduleDraw(); @@ -56,7 +63,7 @@ index d842aa55175b..5683e6fb68f8 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 -@@ -426,6 +441,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, +@@ -436,6 +451,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, ui::ContextFactory* context_factory_; ui::ContextFactoryPrivate* context_factory_private_; diff --git a/patch/patches/content_1129_2015.patch b/patch/patches/content_1129_2015.patch index 6a798ecd4..fe5d29ef4 100644 --- a/patch/patches/content_1129_2015.patch +++ b/patch/patches/content_1129_2015.patch @@ -50,21 +50,6 @@ index 8027836d925e..71f8d5a3f9dc 100644 &pdf_plugin_info)) { return nullptr; } -diff --git chrome/browser/plugins/plugin_info_message_filter.cc chrome/browser/plugins/plugin_info_message_filter.cc -index 5a807cdf51a2..7cec2bdb773b 100644 ---- chrome/browser/plugins/plugin_info_message_filter.cc -+++ chrome/browser/plugins/plugin_info_message_filter.cc -@@ -468,8 +468,8 @@ bool PluginInfoMessageFilter::Context::FindEnabledPlugin( - 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])) { -+ resource_context_, url, true, -+ main_frame_origin, &matching_plugins[i])) { - break; - } - } diff --git chrome/browser/ui/cocoa/drag_util.mm chrome/browser/ui/cocoa/drag_util.mm index 6a2122ee1ed7..68831894695a 100644 --- chrome/browser/ui/cocoa/drag_util.mm @@ -79,10 +64,10 @@ index 6a2122ee1ed7..68831894695a 100644 } diff --git chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc -index ba2dacd6f420..803b5bc929bd 100644 +index 34c9855a251e..0e09454569e2 100644 --- chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc -@@ -597,6 +597,6 @@ void BrowserTabStripController::OnFindURLMimeTypeCompleted( +@@ -596,6 +596,6 @@ void BrowserTabStripController::OnFindURLMimeTypeCompleted( content::PluginService::GetInstance()->GetPluginInfo( -1, // process ID MSG_ROUTING_NONE, // routing ID @@ -91,10 +76,10 @@ index ba2dacd6f420..803b5bc929bd 100644 mime_type, false, NULL, &plugin, NULL)); } diff --git content/browser/frame_host/navigation_handle_impl.cc content/browser/frame_host/navigation_handle_impl.cc -index 28048bdb2046..b295b7a33601 100644 +index 73afa8b3908c..c9edab729e94 100644 --- content/browser/frame_host/navigation_handle_impl.cc +++ content/browser/frame_host/navigation_handle_impl.cc -@@ -312,12 +312,6 @@ net::Error NavigationHandleImpl::GetNetErrorCode() { +@@ -321,12 +321,6 @@ net::Error NavigationHandleImpl::GetNetErrorCode() { } RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { @@ -108,23 +93,10 @@ index 28048bdb2046..b295b7a33601 100644 } diff --git content/browser/frame_host/render_frame_host_impl.cc content/browser/frame_host/render_frame_host_impl.cc -index 2b2e16f95e48..17731d783a63 100644 +index 1a4440241992..172190cb3339 100644 --- content/browser/frame_host/render_frame_host_impl.cc +++ content/browser/frame_host/render_frame_host_impl.cc -@@ -359,9 +359,9 @@ void ForwardRequest(const char* service_name, - - void CreatePaymentManager(RenderFrameHostImpl* rfh, - payments::mojom::PaymentManagerRequest request) { -- StoragePartitionImpl* storage_partition = -- static_cast(BrowserContext::GetStoragePartition( -- rfh->GetSiteInstance()->GetBrowserContext(), rfh->GetSiteInstance())); -+ StoragePartition* storage_partition = -+ BrowserContext::GetStoragePartition( -+ rfh->GetSiteInstance()->GetBrowserContext(), rfh->GetSiteInstance()); - storage_partition->GetPaymentAppContext()->CreatePaymentManager( - std::move(request)); - } -@@ -1452,6 +1452,7 @@ void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( +@@ -1499,6 +1499,7 @@ void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( if (navigation_handle_) { navigation_handle_->set_net_error_code( static_cast(params.error_code)); @@ -132,11 +104,24 @@ index 2b2e16f95e48..17731d783a63 100644 } frame_tree_node_->navigator()->DidFailProvisionalLoadWithError(this, params); +@@ -3484,9 +3485,9 @@ void RenderFrameHostImpl::CommitNavigation( + // however only do this for cross-document navigations, because the + // alternative would be redundant effort. + mojom::URLLoaderFactoryPtr default_factory; +- StoragePartitionImpl* storage_partition = +- static_cast(BrowserContext::GetStoragePartition( +- GetSiteInstance()->GetBrowserContext(), GetSiteInstance())); ++ StoragePartition* storage_partition = ++ BrowserContext::GetStoragePartition( ++ GetSiteInstance()->GetBrowserContext(), GetSiteInstance()); + if (subresource_loader_params && + subresource_loader_params->loader_factory_info.is_valid()) { + // If the caller has supplied a default URLLoaderFactory override (for diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc -index a842664b32a8..93b489020e2a 100644 +index 4099c6a7ea9f..5c0d94d6062d 100644 --- content/browser/frame_host/render_frame_message_filter.cc +++ content/browser/frame_host/render_frame_message_filter.cc -@@ -516,6 +516,7 @@ void RenderFrameMessageFilter::GetCookies(int render_frame_id, +@@ -542,6 +542,7 @@ void RenderFrameMessageFilter::GetCookies(int render_frame_id, void RenderFrameMessageFilter::OnGetPlugins( bool refresh, @@ -144,7 +129,7 @@ index a842664b32a8..93b489020e2a 100644 const url::Origin& main_frame_origin, IPC::Message* reply_msg) { // Don't refresh if the specified threshold has not been passed. Note that -@@ -537,18 +538,19 @@ void RenderFrameMessageFilter::OnGetPlugins( +@@ -563,18 +564,19 @@ void RenderFrameMessageFilter::OnGetPlugins( PluginServiceImpl::GetInstance()->GetPlugins( base::BindOnce(&RenderFrameMessageFilter::GetPluginsCallback, this, @@ -166,7 +151,7 @@ index a842664b32a8..93b489020e2a 100644 int routing_id = MSG_ROUTING_NONE; // In this loop, copy the WebPluginInfo (and do not use a reference) because // the filter might mutate it. -@@ -557,7 +559,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( +@@ -583,7 +585,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( if (!filter || filter->IsPluginAvailable(child_process_id, routing_id, resource_context_, main_frame_origin.GetURL(), @@ -175,7 +160,7 @@ index a842664b32a8..93b489020e2a 100644 plugins.push_back(plugin); } } -@@ -569,6 +571,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( +@@ -595,6 +597,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( void RenderFrameMessageFilter::OnGetPluginInfo( int render_frame_id, const GURL& url, @@ -183,7 +168,7 @@ index a842664b32a8..93b489020e2a 100644 const url::Origin& main_frame_origin, const std::string& mime_type, bool* found, -@@ -577,8 +580,8 @@ void RenderFrameMessageFilter::OnGetPluginInfo( +@@ -603,8 +606,8 @@ void RenderFrameMessageFilter::OnGetPluginInfo( bool allow_wildcard = true; *found = plugin_service_->GetPluginInfo( render_process_id_, render_frame_id, resource_context_, url, @@ -195,10 +180,10 @@ index a842664b32a8..93b489020e2a 100644 void RenderFrameMessageFilter::OnOpenChannelToPepperPlugin( diff --git content/browser/frame_host/render_frame_message_filter.h content/browser/frame_host/render_frame_message_filter.h -index 1826101c76d0..eafe5930cfc1 100644 +index 0b884a7558a9..98ecd1ca2460 100644 --- content/browser/frame_host/render_frame_message_filter.h +++ content/browser/frame_host/render_frame_message_filter.h -@@ -130,13 +130,16 @@ class CONTENT_EXPORT RenderFrameMessageFilter +@@ -136,13 +136,16 @@ class CONTENT_EXPORT RenderFrameMessageFilter #if BUILDFLAG(ENABLE_PLUGINS) void OnGetPlugins(bool refresh, @@ -216,25 +201,25 @@ index 1826101c76d0..eafe5930cfc1 100644 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 482bb55c2bfe..fbbac2ab26b1 100644 +index 130041fe86c2..90b4e6e21167 100644 --- content/browser/loader/mime_sniffing_resource_handler.cc +++ content/browser/loader/mime_sniffing_resource_handler.cc -@@ -489,8 +489,8 @@ bool MimeSniffingResourceHandler::CheckForPluginHandler( +@@ -449,8 +449,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, NULL); +- allow_wildcard, &stale, &plugin, nullptr); + request()->url(), info->IsMainFrame(), url::Origin(), -+ response_->head.mime_type, allow_wildcard, &stale, &plugin, NULL); ++ response_->head.mime_type, 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 4bdfa1d5455f..cf9b9166ae43 100644 +index 0378ab3c5013..21b7157f7ac8 100644 --- content/browser/plugin_service_impl.cc +++ content/browser/plugin_service_impl.cc -@@ -242,6 +242,7 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id, +@@ -260,6 +260,7 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id, int render_frame_id, ResourceContext* context, const GURL& url, @@ -242,7 +227,7 @@ index 4bdfa1d5455f..cf9b9166ae43 100644 const url::Origin& main_frame_origin, const std::string& mime_type, bool allow_wildcard, -@@ -258,7 +259,8 @@ bool PluginServiceImpl::GetPluginInfo(int render_process_id, +@@ -276,7 +277,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, @@ -253,7 +238,7 @@ index 4bdfa1d5455f..cf9b9166ae43 100644 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 b654bf3c98b4..1b09cd3d0a23 100644 +index fb9226fd1b1c..0e13f2df47a3 100644 --- content/browser/plugin_service_impl.h +++ content/browser/plugin_service_impl.h @@ -63,6 +63,7 @@ class CONTENT_EXPORT PluginServiceImpl : public PluginService { @@ -265,10 +250,10 @@ index b654bf3c98b4..1b09cd3d0a23 100644 const std::string& mime_type, bool allow_wildcard, diff --git content/common/frame_messages.h content/common/frame_messages.h -index 18c4b420d781..c9cd1cac49fc 100644 +index 3e00480ee1bc..34421dcd3c20 100644 --- content/common/frame_messages.h +++ content/common/frame_messages.h -@@ -1327,8 +1327,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback, +@@ -1359,8 +1359,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback, // Used to get the list of plugins. |main_frame_origin| is used to handle // exceptions for plugin content settings. @@ -279,7 +264,7 @@ index 18c4b420d781..c9cd1cac49fc 100644 url::Origin /* main_frame_origin */, std::vector /* plugins */) -@@ -1336,9 +1337,10 @@ IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins, +@@ -1368,9 +1369,10 @@ IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins, // type. If there is no matching plugin, |found| is false. // |actual_mime_type| is the actual mime type supported by the // found plugin. @@ -292,10 +277,10 @@ index 18c4b420d781..c9cd1cac49fc 100644 std::string /* mime_type */, bool /* found */, diff --git content/ppapi_plugin/ppapi_blink_platform_impl.cc content/ppapi_plugin/ppapi_blink_platform_impl.cc -index e26ffe9ab2d0..3bbe19ae4146 100644 +index bf3c786b5093..ea8f85700e86 100644 --- content/ppapi_plugin/ppapi_blink_platform_impl.cc +++ content/ppapi_plugin/ppapi_blink_platform_impl.cc -@@ -207,6 +207,7 @@ std::unique_ptr PpapiBlinkPlatformImpl::CreateURLLoader( +@@ -199,6 +199,7 @@ blink::WebThemeEngine* PpapiBlinkPlatformImpl::ThemeEngine() { void PpapiBlinkPlatformImpl::GetPluginList( bool refresh, @@ -304,12 +289,12 @@ index e26ffe9ab2d0..3bbe19ae4146 100644 blink::WebPluginListBuilder* builder) { NOTREACHED(); diff --git content/ppapi_plugin/ppapi_blink_platform_impl.h content/ppapi_plugin/ppapi_blink_platform_impl.h -index dfc2f2b1f4c6..d931301523ec 100644 +index 8a58a2ae1e2f..21b18ff2eba7 100644 --- content/ppapi_plugin/ppapi_blink_platform_impl.h +++ content/ppapi_plugin/ppapi_blink_platform_impl.h -@@ -43,6 +43,7 @@ class PpapiBlinkPlatformImpl : public BlinkPlatformImpl { - const blink::WebURLRequest& request, - scoped_refptr task_runner) override; +@@ -40,6 +40,7 @@ class PpapiBlinkPlatformImpl : public BlinkPlatformImpl { + blink::WebString DefaultLocale() override; + blink::WebThemeEngine* ThemeEngine() override; void GetPluginList(bool refresh, + bool isMainFrame, const blink::WebSecurityOrigin& mainFrameOrigin, @@ -340,10 +325,10 @@ index 3b610b1f554e..7c439e060779 100644 WebPluginInfo* plugin) = 0; diff --git content/public/renderer/content_renderer_client.cc content/public/renderer/content_renderer_client.cc -index d8a56e64875d..4b66b2fc0efc 100644 +index 3e3d132705a8..4a972b4475e6 100644 --- content/public/renderer/content_renderer_client.cc +++ content/public/renderer/content_renderer_client.cc -@@ -103,7 +103,6 @@ bool ContentRendererClient::AllowPopup() { +@@ -101,7 +101,6 @@ bool ContentRendererClient::AllowPopup() { return false; } @@ -351,7 +336,7 @@ index d8a56e64875d..4b66b2fc0efc 100644 bool ContentRendererClient::HandleNavigation( RenderFrame* render_frame, bool is_content_initiated, -@@ -116,6 +115,7 @@ bool ContentRendererClient::HandleNavigation( +@@ -114,6 +113,7 @@ bool ContentRendererClient::HandleNavigation( return false; } @@ -360,10 +345,10 @@ index d8a56e64875d..4b66b2fc0efc 100644 return false; } diff --git content/public/renderer/content_renderer_client.h content/public/renderer/content_renderer_client.h -index a05d000287b6..682a3e61d980 100644 +index 3d34633700dd..6cee67f439f7 100644 --- content/public/renderer/content_renderer_client.h +++ content/public/renderer/content_renderer_client.h -@@ -75,6 +75,9 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -73,6 +73,9 @@ class CONTENT_EXPORT ContentRendererClient { // Notifies us that the RenderThread has been created. virtual void RenderThreadStarted() {} @@ -373,7 +358,7 @@ index a05d000287b6..682a3e61d980 100644 // Notifies that a new RenderFrame has been created. virtual void RenderFrameCreated(RenderFrame* render_frame) {} -@@ -193,7 +196,6 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -190,7 +193,6 @@ class CONTENT_EXPORT ContentRendererClient { // Returns true if a popup window should be allowed. virtual bool AllowPopup(); @@ -381,7 +366,7 @@ index a05d000287b6..682a3e61d980 100644 // TODO(sgurun) This callback is deprecated and will be removed as soon // as android webview completes implementation of a resource throttle based // shouldoverrideurl implementation. See crbug.com/325351 -@@ -209,6 +211,7 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -206,6 +208,7 @@ class CONTENT_EXPORT ContentRendererClient { blink::WebNavigationPolicy default_policy, bool is_redirect); @@ -389,6 +374,19 @@ index a05d000287b6..682a3e61d980 100644 // Indicates if the Android MediaPlayer should be used instead of Chrome's // built in media player for the given |url|. Defaults to false. virtual bool ShouldUseMediaPlayerForURL(const GURL& url); +@@ -331,6 +334,12 @@ class CONTENT_EXPORT ContentRendererClient { + // This method may invalidate the frame. + virtual void RunScriptsAtDocumentIdle(RenderFrame* render_frame) {} + ++ // Notifies that a DevTools agent has attached or detached. ++ virtual void DevToolsAgentAttached(RenderFrame* render_frame, ++ int session_id) {} ++ virtual void DevToolsAgentDetached(RenderFrame* render_frame, ++ int session_id) {} ++ + // Allows subclasses to enable some runtime features before Blink has + // started. + virtual void SetRuntimeFeaturesDefaultsBeforeBlinkInitialization() {} diff --git content/public/renderer/render_frame_observer.h content/public/renderer/render_frame_observer.h index 4f8478bfa87a..52471407518e 100644 --- content/public/renderer/render_frame_observer.h @@ -403,11 +401,54 @@ index 4f8478bfa87a..52471407518e 100644 // Called when the focused node has changed to |node|. virtual void FocusedNodeChanged(const blink::WebNode& node) {} +diff --git content/renderer/devtools/devtools_agent.cc content/renderer/devtools/devtools_agent.cc +index 685c39f6aca2..cee77800770a 100644 +--- content/renderer/devtools/devtools_agent.cc ++++ content/renderer/devtools/devtools_agent.cc +@@ -20,7 +20,9 @@ + #include "content/child/child_process.h" + #include "content/common/devtools_messages.h" + #include "content/common/frame_messages.h" ++#include "content/public/common/content_client.h" + #include "content/public/common/manifest.h" ++#include "content/public/renderer/content_renderer_client.h" + #include "content/renderer/devtools/devtools_cpu_throttler.h" + #include "content/renderer/render_frame_impl.h" + #include "content/renderer/render_widget.h" +@@ -218,6 +220,8 @@ void DevToolsAgent::AttachDevToolsSession( + GetWebAgent()->Attach(session_id); + } + ++ GetContentClient()->renderer()->DevToolsAgentAttached(frame_, session_id); ++ + sessions_[session_id].reset( + new Session(session_id, this, std::move(session))); + +@@ -237,6 +241,7 @@ void DevToolsAgent::AttachDevToolsSession( + + void DevToolsAgent::DetachSession(int session_id) { + GetWebAgent()->Detach(session_id); ++ GetContentClient()->renderer()->DevToolsAgentDetached(frame_, session_id); + io_sessions_.erase(session_id); + sessions_.erase(session_id); + hosts_.erase(session_id); +@@ -382,8 +387,10 @@ bool DevToolsAgent::IsAttached() { + } + + void DevToolsAgent::DetachAllSessions() { +- for (auto& it : hosts_) ++ for (auto& it : hosts_) { + GetWebAgent()->Detach(it.first); ++ GetContentClient()->renderer()->DevToolsAgentDetached(frame_, it.first); ++ } + hosts_.clear(); + io_sessions_.clear(); + sessions_.clear(); diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc -index 285d1d6fb031..8024d725d86c 100644 +index 40f9cef599dc..323084e643d7 100644 --- content/renderer/render_frame_impl.cc +++ content/renderer/render_frame_impl.cc -@@ -2975,7 +2975,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin( +@@ -3210,7 +3210,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin( std::string mime_type; bool found = false; Send(new FrameHostMsg_GetPluginInfo( @@ -417,7 +458,7 @@ index 285d1d6fb031..8024d725d86c 100644 params.mime_type.Utf8(), &found, &info, &mime_type)); if (!found) return nullptr; -@@ -3283,6 +3284,8 @@ void RenderFrameImpl::FrameDetached(DetachType type) { +@@ -3552,6 +3553,8 @@ void RenderFrameImpl::FrameDetached(DetachType type) { void RenderFrameImpl::FrameFocused() { Send(new FrameHostMsg_FrameFocused(routing_id_)); @@ -426,7 +467,7 @@ index 285d1d6fb031..8024d725d86c 100644 } void RenderFrameImpl::WillCommitProvisionalLoad() { -@@ -5459,9 +5462,8 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( +@@ -5643,9 +5646,8 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( (!IsBrowserSideNavigationEnabled() || url != pending_navigation_params_->request_params.redirects[0])); @@ -438,7 +479,7 @@ index 285d1d6fb031..8024d725d86c 100644 // The handlenavigation API is deprecated and will be removed once // crbug.com/325351 is resolved. if ((!IsBrowserSideNavigationEnabled() || !IsURLHandledByNetworkStack(url)) && -@@ -5471,7 +5473,6 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( +@@ -5655,7 +5657,6 @@ WebNavigationPolicy RenderFrameImpl::DecidePolicyForNavigation( is_redirect)) { return blink::kWebNavigationPolicyIgnore; } @@ -447,10 +488,10 @@ index 285d1d6fb031..8024d725d86c 100644 // If the browser is interested, then give it a chance to look at the request. if (is_content_initiated && IsTopLevelNavigation(frame_) && diff --git content/renderer/render_thread_impl.cc content/renderer/render_thread_impl.cc -index dc0111728c3e..b8ab8834fc97 100644 +index 10b32b1254c6..6ba3dfbe9d15 100644 --- content/renderer/render_thread_impl.cc +++ content/renderer/render_thread_impl.cc -@@ -779,6 +779,8 @@ void RenderThreadImpl::Init( +@@ -819,6 +819,8 @@ void RenderThreadImpl::Init( StartServiceManagerConnection(); @@ -460,10 +501,10 @@ index dc0111728c3e..b8ab8834fc97 100644 base::Bind(&RenderThreadImpl::OnRendererInterfaceRequest, base::Unretained(this))); diff --git content/renderer/renderer_blink_platform_impl.cc content/renderer/renderer_blink_platform_impl.cc -index 1a9d6c2e7ef2..25166d5d9730 100644 +index 3cd99e14d1d5..96e8d51625d7 100644 --- content/renderer/renderer_blink_platform_impl.cc +++ content/renderer/renderer_blink_platform_impl.cc -@@ -794,6 +794,7 @@ RendererBlinkPlatformImpl::CreateMIDIAccessor( +@@ -846,6 +846,7 @@ RendererBlinkPlatformImpl::CreateMIDIAccessor( void RendererBlinkPlatformImpl::GetPluginList( bool refresh, @@ -471,7 +512,7 @@ index 1a9d6c2e7ef2..25166d5d9730 100644 const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder* builder) { #if BUILDFLAG(ENABLE_PLUGINS) -@@ -801,7 +802,8 @@ void RendererBlinkPlatformImpl::GetPluginList( +@@ -853,7 +854,8 @@ void RendererBlinkPlatformImpl::GetPluginList( if (!plugin_refresh_allowed_) refresh = false; RenderThread::Get()->Send( @@ -482,10 +523,10 @@ index 1a9d6c2e7ef2..25166d5d9730 100644 builder->AddPlugin(WebString::FromUTF16(plugin.name), WebString::FromUTF16(plugin.desc), diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h -index 8d68defb758a..6891eb484eec 100644 +index 72649102bfcc..6067abc4c8c0 100644 --- content/renderer/renderer_blink_platform_impl.h +++ content/renderer/renderer_blink_platform_impl.h -@@ -126,6 +126,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -130,6 +130,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { viz::FrameSinkId GenerateFrameSinkId() override; void GetPluginList(bool refresh, @@ -542,10 +583,10 @@ index db23a83ed079..57a4c536118c 100644 const std::string& mime_type, bool allow_wildcard, diff --git content/test/test_blink_web_unit_test_support.cc content/test/test_blink_web_unit_test_support.cc -index 9f4c763b336b..2cd2087d11e3 100644 +index cb545a4ddea4..f21d056e50a2 100644 --- content/test/test_blink_web_unit_test_support.cc +++ content/test/test_blink_web_unit_test_support.cc -@@ -290,6 +290,7 @@ blink::WebThread* TestBlinkWebUnitTestSupport::CurrentThread() { +@@ -318,6 +318,7 @@ blink::WebThread* TestBlinkWebUnitTestSupport::CurrentThread() { void TestBlinkWebUnitTestSupport::GetPluginList( bool refresh, @@ -554,7 +595,7 @@ index 9f4c763b336b..2cd2087d11e3 100644 blink::WebPluginListBuilder* builder) { builder->AddPlugin("pdf", "pdf", "pdf-files"); diff --git content/test/test_blink_web_unit_test_support.h content/test/test_blink_web_unit_test_support.h -index 93df7c8c312a..7829493c88a3 100644 +index 200f40eb51f5..afba549f0cdf 100644 --- content/test/test_blink_web_unit_test_support.h +++ content/test/test_blink_web_unit_test_support.h @@ -70,6 +70,7 @@ class TestBlinkWebUnitTestSupport : public BlinkPlatformImpl { diff --git a/patch/patches/crashpad_1995.patch b/patch/patches/crashpad_1995.patch index 9b2c691dd..631d1e8bb 100644 --- a/patch/patches/crashpad_1995.patch +++ b/patch/patches/crashpad_1995.patch @@ -1,37 +1,5 @@ -diff --git build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn -index 4d385dd5512b..1b51f2d17491 100644 ---- build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn -+++ build/secondary/third_party/crashpad/crashpad/handler/BUILD.gn -@@ -2,6 +2,8 @@ - # Use of this source code is governed by a BSD-style license that can be - # found in the LICENSE file. - -+import("//cef/libcef/features/features.gni") -+ - static_library("handler_lib") { - sources = [ - "crash_report_upload_thread.cc", -@@ -30,8 +32,18 @@ static_library("handler_lib") { - "../snapshot", - "../tools:tool_support", - "//base", -+ "//cef/libcef/features", - ] - -+ if (enable_cef) { -+ sources += [ -+ "//cef/libcef/common/cef_crash_report_upload_thread.cc", -+ "//cef/libcef/common/cef_crash_report_upload_thread.h", -+ ] -+ -+ include_dirs += [ "//cef" ] -+ } -+ - if (is_win) { - cflags = [ "/wd4201" ] - } diff --git chrome/common/crash_keys.cc chrome/common/crash_keys.cc -index ff516e246948..47e474c1840d 100644 +index 631772316423..f00a94403c61 100644 --- chrome/common/crash_keys.cc +++ chrome/common/crash_keys.cc @@ -4,6 +4,8 @@ @@ -43,7 +11,7 @@ index ff516e246948..47e474c1840d 100644 #include "base/base_switches.h" #include "base/command_line.h" #include "base/format_macros.h" -@@ -89,7 +91,7 @@ const char kZeroEncodeDetails[] = "zero-encode-details"; +@@ -84,7 +86,7 @@ const char kViewCount[] = "view-count"; const char kUserCloudPolicyManagerConnectTrace[] = "user-cloud-policy-manager-connect-trace"; @@ -52,7 +20,7 @@ index ff516e246948..47e474c1840d 100644 // The following keys may be chunked by the underlying crash logging system, // but ultimately constitute a single key-value pair. // -@@ -223,10 +225,16 @@ size_t RegisterChromeCrashKeys() { +@@ -200,10 +202,16 @@ size_t RegisterChromeCrashKeys() { // This dynamic set of keys is used for sets of key value pairs when gathering // a collection of data, like command line switches or extension IDs. @@ -71,7 +39,7 @@ index ff516e246948..47e474c1840d 100644 // Register the extension IDs. { -@@ -260,7 +268,7 @@ size_t RegisterChromeCrashKeys() { +@@ -237,7 +245,7 @@ size_t RegisterChromeCrashKeys() { return base::debug::InitCrashKeys(&keys.at(0), keys.size(), kChunkMaxLength); } @@ -80,7 +48,7 @@ index ff516e246948..47e474c1840d 100644 static const char* const kIgnoreSwitches[] = { switches::kEnableLogging, switches::kFlagSwitchesBegin, -@@ -316,7 +324,7 @@ static bool IsBoringSwitch(const std::string& flag) { +@@ -292,7 +300,7 @@ static bool IsBoringSwitch(const std::string& flag) { } void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { @@ -90,7 +58,7 @@ index ff516e246948..47e474c1840d 100644 void SetActiveExtensions(const std::set& extensions) { diff --git chrome/common/crash_keys.h chrome/common/crash_keys.h -index 687146e9e92c..b1b73d6e36b2 100644 +index 38e43f247477..62fe45582661 100644 --- chrome/common/crash_keys.h +++ chrome/common/crash_keys.h @@ -22,10 +22,18 @@ class CommandLine; @@ -113,7 +81,7 @@ index 687146e9e92c..b1b73d6e36b2 100644 // on the given |command_line|. void SetCrashKeysFromCommandLine(const base::CommandLine& command_line); diff --git chrome_elf/BUILD.gn chrome_elf/BUILD.gn -index 1276a06ac02a..f5198bc4be48 100644 +index 60c6636bddf2..7e582f797653 100644 --- chrome_elf/BUILD.gn +++ chrome_elf/BUILD.gn @@ -7,6 +7,7 @@ @@ -124,7 +92,7 @@ index 1276a06ac02a..f5198bc4be48 100644 import("//chrome/process_version_rc_template.gni") import("//testing/test.gni") -@@ -166,9 +167,6 @@ static_library("blacklist") { +@@ -174,9 +175,6 @@ static_library("blacklist") { static_library("crash") { sources = [ @@ -134,7 +102,7 @@ index 1276a06ac02a..f5198bc4be48 100644 "crash/crash_helper.cc", "crash/crash_helper.h", ] -@@ -176,6 +174,7 @@ static_library("crash") { +@@ -184,6 +182,7 @@ static_library("crash") { ":hook_util", "//base", # This needs to go. DEP of app, crash_keys, client. "//base:base_static", # pe_image @@ -142,7 +110,7 @@ index 1276a06ac02a..f5198bc4be48 100644 "//chrome/install_static:install_static_util", "//components/crash/content/app", "//components/crash/core/common", # crash_keys -@@ -184,6 +183,17 @@ static_library("crash") { +@@ -192,6 +191,17 @@ static_library("crash") { "//gpu/config:crash_keys", "//third_party/crashpad/crashpad/client", # DumpWithoutCrash ] @@ -195,7 +163,7 @@ index e8e27dc4ebd7..7cb2149ec41d 100644 g_crash_helper_enabled = true; return true; diff --git components/crash/content/app/breakpad_linux.cc components/crash/content/app/breakpad_linux.cc -index 526c410915f3..347385906357 100644 +index 42a50e8381c1..718f945573a3 100644 --- components/crash/content/app/breakpad_linux.cc +++ components/crash/content/app/breakpad_linux.cc @@ -29,6 +29,7 @@ @@ -214,7 +182,7 @@ index 526c410915f3..347385906357 100644 #endif bool g_is_crash_reporter_enabled = false; -@@ -688,7 +690,7 @@ bool CrashDone(const MinidumpDescriptor& minidump, +@@ -686,7 +688,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); @@ -223,7 +191,7 @@ index 526c410915f3..347385906357 100644 info.process_start_time = g_process_start_time; info.oom_size = base::g_oom_size; info.pid = g_pid; -@@ -1357,7 +1359,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info, +@@ -1356,7 +1358,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info, header_content_encoding, header_content_type, post_file, @@ -254,7 +222,7 @@ index 526c410915f3..347385906357 100644 if (info.pid > 0) { char pid_value_buf[kUint64StringSize]; uint64_t pid_value_len = my_uint64_len(info.pid); -@@ -2013,6 +2024,17 @@ void InitCrashReporter(const std::string& process_type) { +@@ -2017,6 +2028,17 @@ void InitCrashReporter(const std::string& process_type) { PostEnableBreakpadInitialization(); } @@ -287,7 +255,7 @@ index 4a2a429fc052..70f3adbc73cf 100644 extern void InitCrashKeysForTesting(); diff --git components/crash/content/app/crash_reporter_client.cc components/crash/content/app/crash_reporter_client.cc -index 2e9ee28e1b00..de53f5927143 100644 +index 72849b964f1c..6a78f9b9c832 100644 --- components/crash/content/app/crash_reporter_client.cc +++ components/crash/content/app/crash_reporter_client.cc @@ -88,11 +88,12 @@ int CrashReporterClient::GetResultCodeRespawnFailed() { @@ -356,7 +324,7 @@ index 2e9ee28e1b00..de53f5927143 100644 - } // namespace crash_reporter diff --git components/crash/content/app/crash_reporter_client.h components/crash/content/app/crash_reporter_client.h -index 46ba162cd35a..19afc3c6215f 100644 +index d2a805289c0d..25d026583c37 100644 --- components/crash/content/app/crash_reporter_client.h +++ components/crash/content/app/crash_reporter_client.h @@ -8,6 +8,7 @@ @@ -367,7 +335,7 @@ index 46ba162cd35a..19afc3c6215f 100644 #include "base/strings/string16.h" #include "build/build_config.h" -@@ -104,12 +105,13 @@ class CrashReporterClient { +@@ -93,12 +94,13 @@ class CrashReporterClient { virtual int GetResultCodeRespawnFailed(); #endif @@ -382,7 +350,7 @@ index 46ba162cd35a..19afc3c6215f 100644 virtual base::FilePath GetReporterLogFilename(); // Custom crash minidump handler after the minidump is generated. -@@ -118,6 +120,7 @@ class CrashReporterClient { +@@ -107,6 +109,7 @@ class CrashReporterClient { // WARNING: this handler runs in a compromised context. It may not call into // libc nor allocate memory normally. virtual bool HandleCrashDump(const char* crashdump_filename); @@ -390,7 +358,7 @@ index 46ba162cd35a..19afc3c6215f 100644 #endif // The location where minidump files should be written. Returns true if -@@ -197,6 +200,23 @@ class CrashReporterClient { +@@ -186,6 +189,23 @@ class CrashReporterClient { // Returns true if breakpad should run in the given process type. virtual bool EnableBreakpadForProcess(const std::string& process_type); @@ -415,10 +383,10 @@ index 46ba162cd35a..19afc3c6215f 100644 } // namespace crash_reporter diff --git components/crash/content/app/crashpad.cc components/crash/content/app/crashpad.cc -index af31c1a40d4f..0452cfb5dc39 100644 +index 6949d5e7dcc4..d9b052382a6a 100644 --- components/crash/content/app/crashpad.cc +++ components/crash/content/app/crashpad.cc -@@ -135,7 +135,8 @@ void InitializeCrashpadImpl(bool initial_client, +@@ -137,7 +137,8 @@ void InitializeCrashpadImpl(bool initial_client, // fallback. Forwarding is turned off for debug-mode builds even for the // browser process, because the system's crash reporter can take a very long // time to chew on symbols. @@ -600,7 +568,7 @@ index 3a33c9bb8e92..961d600f7452 100644 if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) { diff --git content/browser/frame_host/debug_urls.cc content/browser/frame_host/debug_urls.cc -index c1764c511286..46165027b9d8 100644 +index 46954327b9c7..62a7ce8d4e46 100644 --- content/browser/frame_host/debug_urls.cc +++ content/browser/frame_host/debug_urls.cc @@ -139,7 +139,9 @@ bool HandleDebugURL(const GURL& url, ui::PageTransition transition) { diff --git a/patch/patches/crashpad_tp_1995.patch b/patch/patches/crashpad_tp_1995.patch index 17785f85a..3d60028de 100644 --- a/patch/patches/crashpad_tp_1995.patch +++ b/patch/patches/crashpad_tp_1995.patch @@ -1,8 +1,8 @@ diff --git third_party/crashpad/crashpad/client/prune_crash_reports.cc third_party/crashpad/crashpad/client/prune_crash_reports.cc -index 3aaaeee5d07f..d99fcb418d9e 100644 +index d045eb6a65a0..bc347a30ea26 100644 --- third_party/crashpad/crashpad/client/prune_crash_reports.cc +++ third_party/crashpad/crashpad/client/prune_crash_reports.cc -@@ -67,13 +67,19 @@ void PruneCrashReportDatabase(CrashReportDatabase* database, +@@ -66,13 +66,19 @@ void PruneCrashReportDatabase(CrashReportDatabase* database, } // static @@ -16,12 +16,12 @@ index 3aaaeee5d07f..d99fcb418d9e 100644 + max_size_in_mb = 128; + if (max_age_in_days <= 0) + max_age_in_days = 365; - return base::WrapUnique( - new BinaryPruneCondition(BinaryPruneCondition::OR, -- new DatabaseSizePruneCondition(1024 * 128), -- new AgePruneCondition(365))); -+ new DatabaseSizePruneCondition(max_size_in_mb), -+ new AgePruneCondition(max_age_in_days))); + return std::make_unique( + BinaryPruneCondition::OR, +- new DatabaseSizePruneCondition(1024 * 128), +- new AgePruneCondition(365)); ++ new DatabaseSizePruneCondition(1024 * max_size_in_mb), ++ new AgePruneCondition(max_age_in_days)); } static const time_t kSecondsInDay = 60 * 60 * 24; @@ -145,11 +145,42 @@ index b64f74fbaf28..0c3c22e215b6 100644 private: struct Data; +diff --git third_party/crashpad/crashpad/handler/BUILD.gn third_party/crashpad/crashpad/handler/BUILD.gn +index 05f554b73036..5b6d1a2a98e1 100644 +--- third_party/crashpad/crashpad/handler/BUILD.gn ++++ third_party/crashpad/crashpad/handler/BUILD.gn +@@ -12,6 +12,7 @@ + # See the License for the specific language governing permissions and + # limitations under the License. + ++import("//cef/libcef/features/features.gni") + import("//testing/test.gni") + + static_library("handler") { +@@ -56,8 +57,18 @@ static_library("handler") { + "../tools:tool_support", + "../util", + "//base", ++ "//cef/libcef/features", + ] + ++ if (enable_cef) { ++ sources += [ ++ "//cef/libcef/common/cef_crash_report_upload_thread.cc", ++ "//cef/libcef/common/cef_crash_report_upload_thread.h", ++ ] ++ ++ configs += [ "//cef/libcef/features:config" ] ++ } ++ + if (is_win) { + cflags = [ "/wd4201" ] # nonstandard extension used : nameless struct/union + } diff --git third_party/crashpad/crashpad/handler/crash_report_upload_thread.h third_party/crashpad/crashpad/handler/crash_report_upload_thread.h -index c769efed5c54..daec6cd17f37 100644 +index cdd1502b7e2f..db47f0a8b559 100644 --- third_party/crashpad/crashpad/handler/crash_report_upload_thread.h +++ third_party/crashpad/crashpad/handler/crash_report_upload_thread.h -@@ -89,7 +89,7 @@ class CrashReportUploadThread : public WorkerThread::Delegate { +@@ -99,7 +99,7 @@ class CrashReportUploadThread : public WorkerThread::Delegate { //! This method may be called from any thread. void ReportPending(const UUID& report_uuid); @@ -158,7 +189,7 @@ index c769efed5c54..daec6cd17f37 100644 //! \brief The result code from UploadReport(). enum class UploadResult { //! \brief The crash report was uploaded successfully. -@@ -117,7 +117,7 @@ class CrashReportUploadThread : public WorkerThread::Delegate { +@@ -127,7 +127,7 @@ class CrashReportUploadThread : public WorkerThread::Delegate { //! object was constructed with \a watch_pending_reports, it will also scan //! the crash report database for other pending reports, and process those as //! well. @@ -167,7 +198,7 @@ index c769efed5c54..daec6cd17f37 100644 //! \brief Processes a single pending report from the database. //! -@@ -131,7 +131,7 @@ class CrashReportUploadThread : public WorkerThread::Delegate { +@@ -141,7 +141,7 @@ class CrashReportUploadThread : public WorkerThread::Delegate { //! remain in the “pending” state. If the upload fails and no more retries are //! desired, or report upload is disabled, it will be marked as “completed” in //! the database without ever having been uploaded. @@ -177,7 +208,7 @@ index c769efed5c54..daec6cd17f37 100644 //! \brief Attempts to upload a crash report. //! diff --git third_party/crashpad/crashpad/handler/handler_main.cc third_party/crashpad/crashpad/handler/handler_main.cc -index abc22bf3ef0c..05753af3c2a1 100644 +index 2e46f86a6522..faf4f1072ad0 100644 --- third_party/crashpad/crashpad/handler/handler_main.cc +++ third_party/crashpad/crashpad/handler/handler_main.cc @@ -35,8 +35,10 @@ @@ -202,7 +233,7 @@ index abc22bf3ef0c..05753af3c2a1 100644 namespace crashpad { namespace { -@@ -147,6 +153,9 @@ struct Options { +@@ -151,6 +157,9 @@ struct Options { bool periodic_tasks; bool rate_limit; bool upload_gzip; @@ -212,7 +243,7 @@ index abc22bf3ef0c..05753af3c2a1 100644 }; // Splits |key_value| on '=' and inserts the resulting key and value into |map|. -@@ -430,6 +439,9 @@ int HandlerMain(int argc, +@@ -438,6 +447,9 @@ int HandlerMain(int argc, kOptionResetOwnCrashExceptionPortToSystemDefault, #endif // OS_MACOSX kOptionURL, @@ -222,7 +253,7 @@ index abc22bf3ef0c..05753af3c2a1 100644 // Standard options. kOptionHelp = -2, -@@ -476,6 +488,9 @@ int HandlerMain(int argc, +@@ -488,6 +500,9 @@ int HandlerMain(int argc, {"url", required_argument, nullptr, kOptionURL}, {"help", no_argument, nullptr, kOptionHelp}, {"version", no_argument, nullptr, kOptionVersion}, @@ -232,7 +263,7 @@ index abc22bf3ef0c..05753af3c2a1 100644 {nullptr, 0, nullptr, 0}, }; -@@ -575,6 +590,27 @@ int HandlerMain(int argc, +@@ -592,6 +607,27 @@ int HandlerMain(int argc, options.url = optarg; break; } @@ -260,23 +291,19 @@ index abc22bf3ef0c..05753af3c2a1 100644 case kOptionHelp: { Usage(me); MetricsRecordExit(Metrics::LifetimeMilestone::kExitedEarly); -@@ -734,17 +770,27 @@ int HandlerMain(int argc, - // TODO(scottmg): options.rate_limit should be removed when we have a - // configurable database setting to control upload limiting. - // See https://crashpad.chromium.org/bug/23. +@@ -757,15 +793,23 @@ int HandlerMain(int argc, + upload_thread_options.rate_limit = options.rate_limit; + upload_thread_options.upload_gzip = options.upload_gzip; + upload_thread_options.watch_pending_reports = options.periodic_tasks; +#if BUILDFLAG(ENABLE_CEF) + CefCrashReportUploadThread upload_thread(database.get(), + options.url, -+ options.periodic_tasks, -+ options.rate_limit, -+ options.upload_gzip, ++ upload_thread_options, + options.max_uploads); +#else CrashReportUploadThread upload_thread(database.get(), options.url, - options.periodic_tasks, - options.rate_limit, - options.upload_gzip); + upload_thread_options); +#endif upload_thread.Start(); diff --git a/patch/patches/extensions_1947.patch b/patch/patches/extensions_1947.patch index 88b6e7227..4635a7e2d 100644 --- a/patch/patches/extensions_1947.patch +++ b/patch/patches/extensions_1947.patch @@ -1,8 +1,8 @@ diff --git content/browser/frame_host/render_frame_host_manager.cc content/browser/frame_host/render_frame_host_manager.cc -index 7e444585731f..2355ab4fec2b 100644 +index 0663535e3f81..e0e20722c820 100644 --- content/browser/frame_host/render_frame_host_manager.cc +++ content/browser/frame_host/render_frame_host_manager.cc -@@ -1072,10 +1072,11 @@ bool RenderFrameHostManager::ShouldSwapBrowsingInstancesForNavigation( +@@ -1082,10 +1082,11 @@ bool RenderFrameHostManager::ShouldSwapBrowsingInstancesForNavigation( // TODO(alexmos): This check should've been enforced earlier in the // navigation, in chrome::Navigate(). Verify this, and then convert this to // a CHECK and remove the fallback. @@ -18,7 +18,7 @@ index 7e444585731f..2355ab4fec2b 100644 return true; } -@@ -1214,7 +1215,8 @@ RenderFrameHostManager::GetSiteInstanceForNavigation( +@@ -1224,7 +1225,8 @@ RenderFrameHostManager::GetSiteInstanceForNavigation( // Double-check that the new SiteInstance is associated with the right // BrowserContext. @@ -29,10 +29,10 @@ index 7e444585731f..2355ab4fec2b 100644 // If |new_instance| is a new SiteInstance for a subframe with an isolated // origin, set its process reuse policy so that such subframes are diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h -index 842557d5fcb7..fc254e2b7bb8 100644 +index e56b320170df..26aa6fe50311 100644 --- content/public/browser/content_browser_client.h +++ content/public/browser/content_browser_client.h -@@ -325,6 +325,13 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -343,6 +343,13 @@ class CONTENT_EXPORT ContentBrowserClient { const GURL& current_url, const GURL& new_url); @@ -117,10 +117,10 @@ index e85940e1123a..7d4e3c13204b 100644 ExtensionRegistry::Get(browser_context_)->RemoveObserver(this); diff --git extensions/browser/extension_host.h extensions/browser/extension_host.h -index fea09edc247f..16f81b139476 100644 +index 34812c083bf5..1ccfaf6e1c45 100644 --- extensions/browser/extension_host.h +++ extensions/browser/extension_host.h -@@ -51,11 +51,17 @@ class ExtensionHost : public DeferredStartRenderHost, +@@ -51,13 +51,19 @@ class ExtensionHost : public DeferredStartRenderHost, ExtensionHost(const Extension* extension, content::SiteInstance* site_instance, const GURL& url, ViewType host_type); @@ -132,14 +132,16 @@ index fea09edc247f..16f81b139476 100644 + ViewType host_type); ~ExtensionHost() override; + // This may be null if the extension has been or is being unloaded. const Extension* extension() const { return extension_; } + const std::string& extension_id() const { return extension_id_; } - content::WebContents* host_contents() const { return host_contents_.get(); } + content::WebContents* host_contents() const { return host_contents_; } content::RenderViewHost* render_view_host() const; content::RenderProcessHost* render_process_host() const; bool has_loaded_once() const { return has_loaded_once_; } -@@ -173,7 +179,8 @@ class ExtensionHost : public DeferredStartRenderHost, +@@ -175,7 +181,8 @@ class ExtensionHost : public DeferredStartRenderHost, content::BrowserContext* browser_context_; // The host for our HTML content. @@ -150,18 +152,10 @@ index fea09edc247f..16f81b139476 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 0c70794823d3..4922df0d5398 100644 +index 69434c704f2f..f31b65fcd192 100644 --- extensions/browser/extensions_browser_client.h +++ extensions/browser/extensions_browser_client.h -@@ -18,6 +18,7 @@ - #include "services/service_manager/public/cpp/binder_registry.h" - - class ExtensionFunctionRegistry; -+class GURL; - class PrefService; - - namespace base { -@@ -49,6 +50,7 @@ class ComponentExtensionResourceManager; +@@ -53,6 +53,7 @@ class ComponentExtensionResourceManager; class Extension; class ExtensionCache; class ExtensionError; @@ -169,7 +163,7 @@ index 0c70794823d3..4922df0d5398 100644 class ExtensionHostDelegate; class ExtensionPrefsObserver; class ExtensionApiFrameIdMap; -@@ -103,6 +105,11 @@ class ExtensionsBrowserClient { +@@ -108,6 +109,11 @@ class ExtensionsBrowserClient { virtual content::BrowserContext* GetOriginalContext( content::BrowserContext* context) = 0; @@ -181,7 +175,7 @@ index 0c70794823d3..4922df0d5398 100644 #if defined(OS_CHROMEOS) // Returns a user id hash from |context| or an empty string if no hash could // be extracted. -@@ -163,6 +170,14 @@ class ExtensionsBrowserClient { +@@ -173,6 +179,14 @@ class ExtensionsBrowserClient { virtual std::unique_ptr CreateExtensionHostDelegate() = 0; @@ -197,7 +191,7 @@ index 0c70794823d3..4922df0d5398 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 383b13c51e08..b3cde7df636a 100644 +index 5a06db3d4495..b960853f02b2 100644 --- extensions/browser/process_manager.cc +++ extensions/browser/process_manager.cc @@ -349,9 +349,16 @@ bool ProcessManager::CreateBackgroundHost(const Extension* extension, diff --git a/patch/patches/gn_config.patch b/patch/patches/gn_config.patch index d1a4710a0..c31b52321 100644 --- a/patch/patches/gn_config.patch +++ b/patch/patches/gn_config.patch @@ -1,8 +1,8 @@ diff --git .gn .gn -index 7a7160de63c1..2b715af702dc 100644 +index db85e5f4092f..779c93c07523 100644 --- .gn +++ .gn -@@ -221,6 +221,8 @@ exec_script_whitelist = +@@ -230,6 +230,8 @@ exec_script_whitelist = # in the Chromium repo outside of //build. "//build_overrides/build.gni", @@ -12,7 +12,7 @@ index 7a7160de63c1..2b715af702dc 100644 # https://crbug.com/474506. "//clank/java/BUILD.gn", diff --git BUILD.gn BUILD.gn -index df54a97736bd..6a2938a28f8c 100644 +index 5c26c723bf8b..fa4994456865 100644 --- BUILD.gn +++ BUILD.gn @@ -179,6 +179,7 @@ group("gn_all") { @@ -56,7 +56,7 @@ index 982fbe8d3f0d..e757be4688f1 100644 + "studio path") } diff --git build/toolchain/win/setup_toolchain.py build/toolchain/win/setup_toolchain.py -index bb599d62968f..410c888cbe54 100644 +index a1d2ea4b2394..50514a54e64f 100644 --- build/toolchain/win/setup_toolchain.py +++ build/toolchain/win/setup_toolchain.py @@ -132,19 +132,22 @@ def _LoadToolchainEnv(cpu, sdk_dir): @@ -96,7 +96,7 @@ index bb599d62968f..410c888cbe54 100644 diff --git build/vs_toolchain.py build/vs_toolchain.py -index 7626880b142a..009eab551c90 100755 +index 7a258ed1dacc..4165c1f9d07b 100755 --- build/vs_toolchain.py +++ build/vs_toolchain.py @@ -81,11 +81,18 @@ def SetEnvironmentAndGetRuntimeDllDirs(): @@ -119,10 +119,10 @@ index 7626880b142a..009eab551c90 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 91dc01d5ca6e..129f0a4db7f0 100644 +index bd0fc70bb87f..79315464c57b 100644 --- chrome/chrome_paks.gni +++ chrome/chrome_paks.gni -@@ -250,7 +250,7 @@ template("chrome_paks") { +@@ -255,7 +255,7 @@ template("chrome_paks") { } input_locales = locales @@ -132,10 +132,10 @@ index 91dc01d5ca6e..129f0a4db7f0 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 cc3782f4a91d..7f0e8aa3f82e 100644 +index 88a6d8627d51..4a25b5d1b713 100644 --- chrome/installer/mini_installer/BUILD.gn +++ chrome/installer/mini_installer/BUILD.gn -@@ -131,7 +131,7 @@ template("generate_mini_installer") { +@@ -130,7 +130,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 e86bb4f0d..02283889e 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 b0c2f87c10e6..521022553ec9 100644 +index e95450a1ff2b..5fee0604be15 100644 --- tools/gritsettings/resource_ids +++ tools/gritsettings/resource_ids -@@ -386,4 +386,11 @@ +@@ -390,4 +390,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/linux_build.patch b/patch/patches/linux_build.patch index 001500554..9aef7bb48 100644 --- a/patch/patches/linux_build.patch +++ b/patch/patches/linux_build.patch @@ -1,8 +1,8 @@ diff --git build/config/compiler/BUILD.gn build/config/compiler/BUILD.gn -index 7888e2f8589d..2b3e8dff4637 100644 +index fff8488778d7..0443bcace1d4 100644 --- build/config/compiler/BUILD.gn +++ build/config/compiler/BUILD.gn -@@ -398,7 +398,7 @@ config("compiler") { +@@ -399,7 +399,7 @@ config("compiler") { # chromeos binutils has been patched with the fix, so always use icf there. # The bug only affects x86 and x64, so we can still use ICF when targeting # other architectures. @@ -11,3 +11,53 @@ index 7888e2f8589d..2b3e8dff4637 100644 !(current_cpu == "x86" || current_cpu == "x64")) { ldflags += [ "-Wl,--icf=all" ] } +diff --git chrome/browser/ui/libgtkui/gtk_ui.cc chrome/browser/ui/libgtkui/gtk_ui.cc +index bf37dd5c3799..ad5693e38487 100644 +--- chrome/browser/ui/libgtkui/gtk_ui.cc ++++ chrome/browser/ui/libgtkui/gtk_ui.cc +@@ -404,11 +404,13 @@ SkColor GetToolbarTopSeparatorColor(SkColor header_fg, + } + #endif + ++#if GTK_MAJOR_VERSION >= 3 + using GdkSetAllowedBackendsFn = void (*)(const gchar*); + // Place this function pointers in read-only memory after being resolved to + // prevent it being tampered with. See crbug.com/771365 for details. + PROTECTED_MEMORY_SECTION base::ProtectedMemory + g_gdk_set_allowed_backends; ++#endif + + } // namespace + +diff --git chrome/browser/ui/libgtkui/native_theme_gtk2.cc chrome/browser/ui/libgtkui/native_theme_gtk2.cc +index af67e8343f5a..1e6d1e5818e4 100644 +--- chrome/browser/ui/libgtkui/native_theme_gtk2.cc ++++ chrome/browser/ui/libgtkui/native_theme_gtk2.cc +@@ -348,6 +348,7 @@ SkColor NativeThemeGtk2::GetSystemColor(ColorId color_id) const { + } + + case kColorId_NumColors: ++ default: + NOTREACHED(); + break; + } +diff --git ui/accessibility/platform/atk_util_auralinux_gtk2.cc ui/accessibility/platform/atk_util_auralinux_gtk2.cc +index 9c50ead85605..54cbd52c7de0 100644 +--- ui/accessibility/platform/atk_util_auralinux_gtk2.cc ++++ ui/accessibility/platform/atk_util_auralinux_gtk2.cc +@@ -56,6 +56,8 @@ void FinishAccessibilityInitOnMainThread( + init_func(); + } + ++namespace ui { ++ + bool AtkUtilAuraLinux::PlatformShouldEnableAccessibility() { + std::unique_ptr env(base::Environment::Create()); + std::string gtk_modules; +@@ -78,3 +80,6 @@ void AtkUtilAuraLinux::PlatformInitializeAsync() { + base::Bind(&GetAccessibilityModuleInitFunc), + base::Bind(&FinishAccessibilityInitOnMainThread)); + } ++ ++} // namespace ui ++ diff --git a/patch/patches/mac_widevine_2314.patch b/patch/patches/mac_widevine_2314.patch index 9b702d5eb..ec0e346a2 100644 --- a/patch/patches/mac_widevine_2314.patch +++ b/patch/patches/mac_widevine_2314.patch @@ -1,19 +1,13 @@ diff --git third_party/widevine/cdm/BUILD.gn third_party/widevine/cdm/BUILD.gn -index a3eac59cc2eb..d14e71e0319b 100644 +index f35d81872096..d14e71e0319b 100644 --- third_party/widevine/cdm/BUILD.gn +++ third_party/widevine/cdm/BUILD.gn -@@ -111,14 +111,8 @@ if (widevine_cdm_binary_files != []) { +@@ -110,7 +110,9 @@ if (widevine_cdm_binary_files != []) { + "//build/config:exe_and_shlib_deps", ] - if (is_mac) { -- ldflags = [ -- # Not to strip important symbols by -Wl,-dead_strip. -- "-Wl,-exported_symbol,_PPP_GetInterface", -- "-Wl,-exported_symbol,_PPP_InitializeModule", -- "-Wl,-exported_symbol,_PPP_ShutdownModule", -- ] -- #TODO(jrummell) Mac: 'DYLIB_INSTALL_NAME_BASE': '@loader_path', -- } else if (is_posix && !is_mac) { +- if (is_posix && !is_mac) { ++ if (is_mac) { + ldflags = [ "-Wl,-install_name,@loader_path/libwidevinecdm.dylib" ] + } else if (is_posix) { cflags = [ "-fvisibility=hidden" ] diff --git a/patch/patches/message_loop_443_1992243003.patch b/patch/patches/message_loop_443_1992243003.patch index 55b62ae59..1c058928b 100644 --- a/patch/patches/message_loop_443_1992243003.patch +++ b/patch/patches/message_loop_443_1992243003.patch @@ -1,8 +1,8 @@ diff --git base/message_loop/message_loop.h base/message_loop/message_loop.h -index 0c82e51dfcd4..e5cb6fdb4c80 100644 +index bff60ef11025..33b430dadaf7 100644 --- base/message_loop/message_loop.h +++ base/message_loop/message_loop.h -@@ -277,6 +277,16 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate, +@@ -266,6 +266,16 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate, void AddTaskObserver(TaskObserver* task_observer); void RemoveTaskObserver(TaskObserver* task_observer); @@ -19,9 +19,9 @@ index 0c82e51dfcd4..e5cb6fdb4c80 100644 // Returns true if the message loop is "idle". Provided for testing. bool IsIdleForTesting(); -@@ -376,6 +386,12 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate, - // need to be checked in conditionals). - bool nestable_tasks_allowed_; +@@ -369,6 +379,12 @@ class BASE_EXPORT MessageLoop : public MessagePump::Delegate, + // is known to generate a system-driven nested loop. + bool task_execution_allowed_ = true; +#if defined(OS_WIN) + // Should be set to true before calling Windows APIs like TrackPopupMenu, etc. diff --git a/patch/patches/net_filter_515.patch b/patch/patches/net_filter_515.patch index d9a53aa71..775097ca9 100644 --- a/patch/patches/net_filter_515.patch +++ b/patch/patches/net_filter_515.patch @@ -1,5 +1,5 @@ diff --git net/base/network_delegate.h net/base/network_delegate.h -index 22d22d03554a..c9a1c6df8f1b 100644 +index 22c428f90b16..1e0e6deaa7df 100644 --- net/base/network_delegate.h +++ net/base/network_delegate.h @@ -16,6 +16,7 @@ @@ -22,10 +22,10 @@ index 22d22d03554a..c9a1c6df8f1b 100644 THREAD_CHECKER(thread_checker_); diff --git net/url_request/url_request_job.cc net/url_request/url_request_job.cc -index d9719f0bb720..2a798690a932 100644 +index 25e971d7e6bc..2d14710ed4fe 100644 --- net/url_request/url_request_job.cc +++ net/url_request/url_request_job.cc -@@ -442,6 +442,12 @@ void URLRequestJob::NotifyHeadersComplete() { +@@ -447,6 +447,12 @@ void URLRequestJob::NotifyHeadersComplete() { DCHECK(!source_stream_); source_stream_ = SetUpSourceStream(); diff --git a/patch/patches/net_security_expiration_1994.patch b/patch/patches/net_security_expiration_1994.patch index 5fea43450..f4b2e5723 100644 --- a/patch/patches/net_security_expiration_1994.patch +++ b/patch/patches/net_security_expiration_1994.patch @@ -1,5 +1,5 @@ diff --git net/cert/ct_policy_enforcer.cc net/cert/ct_policy_enforcer.cc -index 61d169cb5bfa..6e16906c7cc2 100644 +index 0f7778089273..40111e89a2e0 100644 --- net/cert/ct_policy_enforcer.cc +++ net/cert/ct_policy_enforcer.cc @@ -35,15 +35,6 @@ namespace net { @@ -18,7 +18,7 @@ index 61d169cb5bfa..6e16906c7cc2 100644 // Returns a rounded-down months difference of |start| and |end|, // together with an indication of whether the last month was // a full month, because the range starts specified in the policy -@@ -301,4 +292,13 @@ ct::CertPolicyCompliance CTPolicyEnforcer::DoesConformToCertPolicy( +@@ -302,4 +293,13 @@ ct::CTPolicyCompliance CTPolicyEnforcer::CheckCompliance( return compliance; } @@ -33,7 +33,7 @@ index 61d169cb5bfa..6e16906c7cc2 100644 + } // namespace net diff --git net/cert/ct_policy_enforcer.h net/cert/ct_policy_enforcer.h -index b594cba1a6fc..285eae814c50 100644 +index fb6f4847cfe9..aa4c1cdafb9f 100644 --- net/cert/ct_policy_enforcer.h +++ net/cert/ct_policy_enforcer.h @@ -42,6 +42,17 @@ class NET_EXPORT CTPolicyEnforcer { @@ -55,10 +55,10 @@ index b594cba1a6fc..285eae814c50 100644 } // namespace net diff --git net/http/transport_security_state.cc net/http/transport_security_state.cc -index 5af15d92ef49..f459c4355860 100644 +index a433afd02178..ff92489ed243 100644 --- net/http/transport_security_state.cc +++ net/http/transport_security_state.cc -@@ -1541,8 +1541,10 @@ void TransportSecurityState::ClearReportCachesForTesting() { +@@ -1553,8 +1553,10 @@ void TransportSecurityState::ClearReportCachesForTesting() { sent_expect_ct_reports_cache_.Clear(); } @@ -72,10 +72,10 @@ index 5af15d92ef49..f459c4355860 100644 // We consider built-in information to be timely for 10 weeks. return (base::Time::Now() - build_time).InDays() < 70 /* 10 weeks */; diff --git net/http/transport_security_state.h net/http/transport_security_state.h -index b4bab0db79db..6c11351b43ba 100644 +index 79d3a1c3453f..d97e26b4b024 100644 --- net/http/transport_security_state.h +++ net/http/transport_security_state.h -@@ -574,6 +574,10 @@ class NET_EXPORT TransportSecurityState { +@@ -576,6 +576,10 @@ class NET_EXPORT TransportSecurityState { // Expect-CT reports. void ClearReportCachesForTesting(); @@ -86,7 +86,7 @@ index b4bab0db79db..6c11351b43ba 100644 private: friend class TransportSecurityStateTest; friend class TransportSecurityStateStaticFuzzer; -@@ -594,7 +598,7 @@ class NET_EXPORT TransportSecurityState { +@@ -596,7 +600,7 @@ class NET_EXPORT TransportSecurityState { // IsBuildTimely returns true if the current build is new enough ensure that // built in security information (i.e. HSTS preloading and pinning // information) is timely. @@ -95,7 +95,7 @@ index b4bab0db79db..6c11351b43ba 100644 // Helper method for actually checking pins. PKPStatus CheckPublicKeyPinsImpl( -@@ -703,6 +707,8 @@ class NET_EXPORT TransportSecurityState { +@@ -705,6 +709,8 @@ class NET_EXPORT TransportSecurityState { // True if public key pinning bypass is enabled for local trust anchors. bool enable_pkp_bypass_for_local_trust_anchors_; diff --git a/patch/patches/net_urlrequest_1327.patch b/patch/patches/net_urlrequest_1327.patch index 219cf4023..971474bb5 100644 --- a/patch/patches/net_urlrequest_1327.patch +++ b/patch/patches/net_urlrequest_1327.patch @@ -1,8 +1,8 @@ diff --git net/url_request/url_request.h net/url_request/url_request.h -index 378fe780f11d..2a9b37b3ad8d 100644 +index 0635448f00a1..3d91e1d92d7f 100644 --- net/url_request/url_request.h +++ net/url_request/url_request.h -@@ -681,10 +681,10 @@ class NET_EXPORT URLRequest : public base::SupportsUserData { +@@ -684,10 +684,10 @@ class NET_EXPORT URLRequest : public base::SupportsUserData { // called with a response from the server. void SetResponseHeadersCallback(ResponseHeadersCallback callback); diff --git a/patch/patches/pdfium_print_549365.patch b/patch/patches/pdfium_print_549365.patch index e2fe55ee6..691b7801a 100644 --- a/patch/patches/pdfium_print_549365.patch +++ b/patch/patches/pdfium_print_549365.patch @@ -1,8 +1,8 @@ diff --git BUILD.gn BUILD.gn -index 3e3f22fdd..b5c2e5265 100644 +index 6fb2bd888..b275bfd2b 100644 --- BUILD.gn +++ BUILD.gn -@@ -227,6 +227,10 @@ static_library("pdfium") { +@@ -229,6 +229,10 @@ static_library("pdfium") { if (pdf_is_complete_lib) { complete_static_lib = true } @@ -14,18 +14,18 @@ index 3e3f22fdd..b5c2e5265 100644 static_library("test_support") { diff --git fpdfsdk/fpdfview.cpp fpdfsdk/fpdfview.cpp -index af1d0db1a..9b0397391 100644 +index 2736b8dd6..830f074b7 100644 --- fpdfsdk/fpdfview.cpp +++ fpdfsdk/fpdfview.cpp -@@ -37,6 +37,7 @@ +@@ -36,6 +36,7 @@ + #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/fsdk_define.h" #include "fpdfsdk/fsdk_pauseadapter.h" - #include "fpdfsdk/javascript/ijs_runtime.h" +#include "fxjs/fxjs_v8.h" + #include "fxjs/ijs_runtime.h" #include "public/fpdf_edit.h" #include "public/fpdf_ext.h" - #include "public/fpdf_progressive.h" -@@ -486,6 +487,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyLibrary() { +@@ -497,6 +498,7 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_DestroyLibrary() { CPDF_ModuleMgr::Destroy(); CFX_GEModule::Destroy(); diff --git a/patch/patches/prefs_content_1161.patch b/patch/patches/prefs_content_1161.patch index 884b1ff55..5051403ea 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 90951a5d5e56..940fe86b6587 100644 +index 63a73ad504d5..9b8cde03ecf4 100644 --- content/public/common/common_param_traits_macros.h +++ content/public/common/common_param_traits_macros.h -@@ -208,6 +208,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) +@@ -195,6 +195,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 90951a5d5e56..940fe86b6587 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 722afb30f662..42274dd9cc8c 100644 +index cc20936125f4..a1cde3a9a2b2 100644 --- content/public/common/web_preferences.cc +++ content/public/common/web_preferences.cc -@@ -179,6 +179,7 @@ WebPreferences::WebPreferences() +@@ -178,6 +178,7 @@ WebPreferences::WebPreferences() spatial_navigation_enabled(false), use_solid_color_scrollbars(false), navigate_on_drag_drop(true), @@ -23,10 +23,10 @@ index 722afb30f662..42274dd9cc8c 100644 record_whole_document(false), save_previous_document_resources(SavePreviousDocumentResources::NEVER), diff --git content/public/common/web_preferences.h content/public/common/web_preferences.h -index c81979993ad5..f0a4474c4023 100644 +index 361505babff0..341873d000bc 100644 --- content/public/common/web_preferences.h +++ content/public/common/web_preferences.h -@@ -198,6 +198,7 @@ struct CONTENT_EXPORT WebPreferences { +@@ -197,6 +197,7 @@ struct CONTENT_EXPORT WebPreferences { bool spatial_navigation_enabled; bool use_solid_color_scrollbars; bool navigate_on_drag_drop; @@ -35,10 +35,10 @@ index c81979993ad5..f0a4474c4023 100644 bool record_whole_document; SavePreviousDocumentResources save_previous_document_resources; diff --git content/renderer/render_view_impl.cc content/renderer/render_view_impl.cc -index 22bd13a28fb7..027eaf5b65da 100644 +index 0f5f1d8e1649..ae5c98646619 100644 --- content/renderer/render_view_impl.cc +++ content/renderer/render_view_impl.cc -@@ -1308,6 +1308,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal( +@@ -1250,6 +1250,8 @@ void RenderViewImpl::ApplyWebPreferencesInternal( blink::WebView* web_view, CompositorDependencies* compositor_deps) { ApplyWebPreferences(prefs, web_view); diff --git a/patch/patches/print_header_footer_1478_1565.patch b/patch/patches/print_header_footer_1478_1565.patch index 9f929997d..07d4149d4 100644 --- a/patch/patches/print_header_footer_1478_1565.patch +++ b/patch/patches/print_header_footer_1478_1565.patch @@ -1,34 +1,44 @@ +diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn +index 02b2c4212767..5a89d17b06a4 100644 +--- chrome/browser/ui/BUILD.gn ++++ chrome/browser/ui/BUILD.gn +@@ -344,6 +344,7 @@ split_static_library("ui") { + "//base:i18n", + "//base/allocator:features", + "//cc/paint", ++ "//cef/libcef/features", + "//chrome:extra_resources", + "//chrome:resources", + "//chrome:strings", diff --git chrome/browser/ui/cocoa/applescript/tab_applescript.mm chrome/browser/ui/cocoa/applescript/tab_applescript.mm -index 0cd84f38c229..2f872dd3dfe2 100644 +index e5ac419b8f4c..ced62e390bc4 100644 --- chrome/browser/ui/cocoa/applescript/tab_applescript.mm +++ chrome/browser/ui/cocoa/applescript/tab_applescript.mm -@@ -9,7 +9,6 @@ +@@ -9,7 +9,7 @@ #include "base/logging.h" #import "base/mac/scoped_nsobject.h" #include "base/strings/sys_string_conversions.h" -#include "chrome/browser/printing/print_view_manager.h" ++#include "cef/libcef/features/features.h" + #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sessions/session_tab_helper.h" #include "chrome/browser/ui/cocoa/applescript/apple_event_util.h" - #include "chrome/browser/ui/cocoa/applescript/error_applescript.h" -@@ -25,8 +24,13 @@ - #include "content/public/browser/save_page_type.h" - #include "content/public/browser/web_contents.h" +@@ -27,6 +27,10 @@ #include "content/public/browser/web_contents_delegate.h" -+#include "printing/features/features.h" #include "url/gurl.h" -+#if BUILDFLAG(ENABLE_PRINT_PREVIEW) ++#if !BUILDFLAG(ENABLE_CEF) +#include "chrome/browser/printing/print_view_manager.h" +#endif + using content::NavigationController; using content::NavigationEntry; using content::OpenURLParams; -@@ -231,11 +235,15 @@ void ResumeAppleEventAndSendReply(NSAppleEventManagerSuspensionID suspension_id, +@@ -232,11 +236,15 @@ void ResumeAppleEventAndSendReply(NSAppleEventManagerSuspensionID suspension_id, - (void)handlesPrintScriptCommand:(NSScriptCommand*)command { AppleScript::LogAppleScriptUMA(AppleScript::AppleScriptCommand::TAB_PRINT); -+#if BUILDFLAG(ENABLE_PRINT_PREVIEW) ++#if !BUILDFLAG(ENABLE_CEF) bool initiated = printing::PrintViewManager::FromWebContents(webContents_) ->PrintNow(webContents_->GetMainFrame()); if (!initiated) { @@ -40,11 +50,42 @@ index 0cd84f38c229..2f872dd3dfe2 100644 } - (void)handlesSaveScriptCommand:(NSScriptCommand*)command { +diff --git chrome/browser/ui/webui/settings/printing_handler.cc chrome/browser/ui/webui/settings/printing_handler.cc +index 45644030eb24..c894209e1530 100644 +--- chrome/browser/ui/webui/settings/printing_handler.cc ++++ chrome/browser/ui/webui/settings/printing_handler.cc +@@ -6,9 +6,13 @@ + + #include "base/bind.h" + #include "base/bind_helpers.h" +-#include "chrome/browser/printing/printer_manager_dialog.h" ++#include "cef/libcef/features/features.h" + #include "content/public/browser/web_ui.h" + ++#if !BUILDFLAG(ENABLE_CEF) ++#include "chrome/browser/printing/printer_manager_dialog.h" ++#endif ++ + namespace settings { + + PrintingHandler::PrintingHandler() {} +@@ -27,7 +31,11 @@ void PrintingHandler::OnJavascriptAllowed() {} + void PrintingHandler::OnJavascriptDisallowed() {} + + void PrintingHandler::HandleOpenSystemPrintDialog(const base::ListValue* args) { ++#if !BUILDFLAG(ENABLE_CEF) + printing::PrinterManagerDialog::ShowPrinterManagerDialog(); ++#else ++ NOTIMPLEMENTED(); ++#endif + } + + } // namespace settings diff --git chrome/common/chrome_utility_printing_messages.h chrome/common/chrome_utility_printing_messages.h -index fa7702857f75..874a37146fb5 100644 +index cb6092794c46..2db218d9f140 100644 --- chrome/common/chrome_utility_printing_messages.h +++ chrome/common/chrome_utility_printing_messages.h -@@ -26,7 +26,6 @@ +@@ -27,7 +27,6 @@ #define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart // Preview and Cloud Print messages. @@ -52,7 +93,7 @@ index fa7702857f75..874a37146fb5 100644 IPC_ENUM_TRAITS_MAX_VALUE(printing::PdfRenderSettings::Mode, printing::PdfRenderSettings::Mode::LAST) -@@ -38,6 +37,7 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PdfRenderSettings) +@@ -39,6 +38,7 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PdfRenderSettings) IPC_STRUCT_TRAITS_MEMBER(mode) IPC_STRUCT_TRAITS_END() @@ -61,10 +102,10 @@ index fa7702857f75..874a37146fb5 100644 IPC_STRUCT_TRAITS_MEMBER(printer_capabilities) IPC_STRUCT_TRAITS_MEMBER(caps_mime_type) diff --git components/printing/common/print_messages.cc components/printing/common/print_messages.cc -index 6767c4af66ab..c860394ba411 100644 +index 5ccf87b28860..48e557d84d5e 100644 --- components/printing/common/print_messages.cc +++ components/printing/common/print_messages.cc -@@ -101,7 +101,6 @@ void PrintMsg_PrintPages_Params::Reset() { +@@ -125,7 +125,6 @@ void PrintMsg_PrintPages_Params::Reset() { pages = std::vector(); } @@ -72,16 +113,16 @@ index 6767c4af66ab..c860394ba411 100644 PrintHostMsg_RequestPrintPreview_Params:: PrintHostMsg_RequestPrintPreview_Params() : is_modifiable(false), -@@ -123,4 +122,3 @@ PrintHostMsg_SetOptionsFromDocument_Params:: +@@ -147,4 +146,3 @@ PrintHostMsg_SetOptionsFromDocument_Params:: PrintHostMsg_SetOptionsFromDocument_Params:: ~PrintHostMsg_SetOptionsFromDocument_Params() { } -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) diff --git components/printing/common/print_messages.h components/printing/common/print_messages.h -index ed443d2a8117..a0180ec440f0 100644 +index 339e63c3294b..75673f2de92f 100644 --- components/printing/common/print_messages.h +++ components/printing/common/print_messages.h -@@ -76,7 +76,6 @@ struct PrintMsg_PrintPages_Params { +@@ -77,7 +77,6 @@ struct PrintMsg_PrintPages_Params { std::vector pages; }; @@ -89,15 +130,15 @@ index ed443d2a8117..a0180ec440f0 100644 struct PrintHostMsg_RequestPrintPreview_Params { PrintHostMsg_RequestPrintPreview_Params(); ~PrintHostMsg_RequestPrintPreview_Params(); -@@ -95,7 +94,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params { +@@ -96,7 +95,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params { printing::DuplexMode duplex; printing::PageRanges page_ranges; }; -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) - #endif // COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_ + #endif // INTERNAL_COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_ -@@ -180,7 +178,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange) +@@ -181,7 +179,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange) IPC_STRUCT_TRAITS_MEMBER(to) IPC_STRUCT_TRAITS_END() @@ -105,7 +146,7 @@ index ed443d2a8117..a0180ec440f0 100644 IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_RequestPrintPreview_Params) IPC_STRUCT_TRAITS_MEMBER(is_modifiable) IPC_STRUCT_TRAITS_MEMBER(webnode_only) -@@ -201,7 +198,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_SetOptionsFromDocument_Params) +@@ -202,7 +199,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_SetOptionsFromDocument_Params) // Specifies page range to be printed. IPC_STRUCT_TRAITS_MEMBER(page_ranges) IPC_STRUCT_TRAITS_END() @@ -113,7 +154,7 @@ index ed443d2a8117..a0180ec440f0 100644 IPC_STRUCT_TRAITS_BEGIN(printing::PageSizeMargins) IPC_STRUCT_TRAITS_MEMBER(content_width) -@@ -221,7 +217,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params) +@@ -222,7 +218,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params) IPC_STRUCT_TRAITS_MEMBER(pages) IPC_STRUCT_TRAITS_END() @@ -121,7 +162,7 @@ index ed443d2a8117..a0180ec440f0 100644 // Parameters to describe a rendered document. IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params) // A shared memory handle to metafile data. -@@ -272,7 +267,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params) +@@ -273,7 +268,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params) // Indicates whether the existing preview data needs to be cleared or not. IPC_STRUCT_MEMBER(bool, clear_preview_data) IPC_STRUCT_END() @@ -129,7 +170,7 @@ index ed443d2a8117..a0180ec440f0 100644 // Parameters to describe a rendered page. IPC_STRUCT_BEGIN(PrintHostMsg_DidPrintPage_Params) -@@ -315,22 +309,20 @@ IPC_STRUCT_END() +@@ -316,22 +310,20 @@ IPC_STRUCT_END() // Messages sent from the browser to the renderer. @@ -154,7 +195,7 @@ index ed443d2a8117..a0180ec440f0 100644 #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Tells the RenderFrame to switch the CSS to print media type, renders every -@@ -348,13 +340,13 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone, +@@ -349,13 +341,13 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone, // Tells the RenderFrame whether printing is enabled or not. IPC_MESSAGE_ROUTED1(PrintMsg_SetPrintingEnabled, bool /* enabled */) @@ -169,7 +210,7 @@ index ed443d2a8117..a0180ec440f0 100644 // Tells the RenderFrame that print preview dialog was closed. IPC_MESSAGE_ROUTED0(PrintMsg_ClosePrintPreviewDialog) #endif -@@ -414,7 +406,6 @@ IPC_MESSAGE_CONTROL3(PrintHostMsg_TempFileForPrintingWritten, +@@ -415,7 +407,6 @@ IPC_MESSAGE_CONTROL3(PrintHostMsg_TempFileForPrintingWritten, int /* page count */) #endif // defined(OS_ANDROID) @@ -177,7 +218,7 @@ index ed443d2a8117..a0180ec440f0 100644 // Asks the browser to do print preview. IPC_MESSAGE_ROUTED1(PrintHostMsg_RequestPrintPreview, PrintHostMsg_RequestPrintPreview_Params /* params */) -@@ -448,7 +439,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel, +@@ -449,7 +440,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel, // The memory handle in this message is already valid in the browser process. IPC_MESSAGE_ROUTED1(PrintHostMsg_MetafileReadyForPrinting, PrintHostMsg_DidPreviewDocument_Params /* params */) @@ -185,7 +226,7 @@ index ed443d2a8117..a0180ec440f0 100644 // This is sent when there are invalid printer settings. IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) -@@ -457,7 +447,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) +@@ -458,7 +448,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed, int /* document cookie */) @@ -193,16 +234,18 @@ index ed443d2a8117..a0180ec440f0 100644 // Tell the browser print preview failed. IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed, int /* document cookie */) -@@ -484,4 +473,3 @@ IPC_MESSAGE_ROUTED1(PrintHostMsg_ShowScriptedPrintPreview, +@@ -485,6 +474,5 @@ IPC_MESSAGE_ROUTED1(PrintHostMsg_ShowScriptedPrintPreview, // Notify the browser to set print presets based on source PDF document. IPC_MESSAGE_ROUTED1(PrintHostMsg_SetOptionsFromDocument, PrintHostMsg_SetOptionsFromDocument_Params /* params */) -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) + + #endif // COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_ diff --git components/printing/renderer/print_render_frame_helper.cc components/printing/renderer/print_render_frame_helper.cc -index c6b03ed6ad9a..5f6545a3dee7 100644 +index 663cd7748493..588797775ead 100644 --- components/printing/renderer/print_render_frame_helper.cc +++ components/printing/renderer/print_render_frame_helper.cc -@@ -319,7 +319,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame, +@@ -320,7 +320,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame, return plugin && plugin->SupportsPaginatedPrint(); } @@ -210,7 +253,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 // Returns true if the current destination printer is PRINT_TO_PDF. bool IsPrintToPdfRequested(const base::DictionaryValue& job_settings) { bool print_to_pdf = false; -@@ -341,7 +340,6 @@ bool PrintingFrameHasPageSizeStyle(blink::WebLocalFrame* frame, +@@ -342,7 +341,6 @@ bool PrintingFrameHasPageSizeStyle(blink::WebLocalFrame* frame, } return frame_has_custom_page_size_style; } @@ -218,7 +261,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 #if BUILDFLAG(ENABLE_PRINTING) // Disable scaling when either: -@@ -398,7 +396,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame, +@@ -399,7 +397,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame, } #endif @@ -226,7 +269,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 bool FitToPageEnabled(const base::DictionaryValue& job_settings) { bool fit_to_paper_size = false; if (!job_settings.GetBoolean(kSettingFitToPageEnabled, &fit_to_paper_size)) { -@@ -440,7 +437,6 @@ blink::WebPrintScalingOption GetPrintScalingOption( +@@ -441,7 +438,6 @@ blink::WebPrintScalingOption GetPrintScalingOption( } return blink::kWebPrintScalingOptionFitToPrintableArea; } @@ -234,7 +277,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 // Helper function to scale and round an integer value with a double valued // scaling. -@@ -959,6 +955,7 @@ PrintRenderFrameHelper::PrintRenderFrameHelper( +@@ -948,6 +944,7 @@ PrintRenderFrameHelper::PrintRenderFrameHelper( print_for_preview_(false), delegate_(std::move(delegate)), print_node_in_progress_(false), @@ -242,7 +285,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 is_loading_(false), is_scripted_preview_delayed_(false), ipc_nesting_level_(0), -@@ -1020,10 +1017,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { +@@ -1009,10 +1006,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { return; if (g_is_preview_enabled) { @@ -253,7 +296,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 } else { #if BUILDFLAG(ENABLE_BASIC_PRINTING) auto weak_this = weak_ptr_factory_.GetWeakPtr(); -@@ -1055,13 +1050,11 @@ bool PrintRenderFrameHelper::OnMessageReceived(const IPC::Message& message) { +@@ -1044,13 +1039,11 @@ bool PrintRenderFrameHelper::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages) IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog) #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -268,7 +311,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 IPC_MESSAGE_HANDLER(PrintMsg_ClosePrintPreviewDialog, OnClosePrintPreviewDialog) #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) -@@ -1121,7 +1114,6 @@ void PrintRenderFrameHelper::OnPrintForSystemDialog() { +@@ -1110,7 +1103,6 @@ void PrintRenderFrameHelper::OnPrintForSystemDialog() { } #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -276,7 +319,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 void PrintRenderFrameHelper::OnPrintForPrintPreview( const base::DictionaryValue& job_settings) { CHECK_LE(ipc_nesting_level_, 1); -@@ -1181,7 +1173,6 @@ void PrintRenderFrameHelper::OnPrintForPrintPreview( +@@ -1170,7 +1162,6 @@ void PrintRenderFrameHelper::OnPrintForPrintPreview( DidFinishPrinting(FAIL_PRINT); } } @@ -284,7 +327,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 void PrintRenderFrameHelper::GetPageSizeAndContentAreaFromPageLayout( const PageSizeMargins& page_layout_in_points, -@@ -1206,7 +1197,6 @@ void PrintRenderFrameHelper::UpdateFrameMarginsCssInfo( +@@ -1195,7 +1186,6 @@ void PrintRenderFrameHelper::UpdateFrameMarginsCssInfo( ignore_css_margins_ = (margins_type != DEFAULT_MARGINS); } @@ -292,7 +335,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 void PrintRenderFrameHelper::OnPrintPreview( const base::DictionaryValue& settings) { if (ipc_nesting_level_ > 1) -@@ -1398,7 +1388,7 @@ bool PrintRenderFrameHelper::CreatePreviewDocument() { +@@ -1387,7 +1377,7 @@ bool PrintRenderFrameHelper::CreatePreviewDocument() { return true; } @@ -301,7 +344,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 bool PrintRenderFrameHelper::RenderPreviewPage( int page_number, const PrintMsg_Print_Params& print_params) { -@@ -1428,7 +1418,7 @@ bool PrintRenderFrameHelper::RenderPreviewPage( +@@ -1417,7 +1407,7 @@ bool PrintRenderFrameHelper::RenderPreviewPage( } return PreviewPageRendered(page_number, draft_metafile.get()); } @@ -310,7 +353,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 bool PrintRenderFrameHelper::FinalizePrintReadyDocument() { DCHECK(!is_print_ready_metafile_sent_); -@@ -1457,7 +1447,6 @@ bool PrintRenderFrameHelper::FinalizePrintReadyDocument() { +@@ -1446,7 +1436,6 @@ bool PrintRenderFrameHelper::FinalizePrintReadyDocument() { Send(new PrintHostMsg_MetafileReadyForPrinting(routing_id(), preview_params)); return true; } @@ -318,7 +361,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 void PrintRenderFrameHelper::OnPrintingDone(bool success) { if (ipc_nesting_level_ > 1) -@@ -1472,7 +1461,6 @@ void PrintRenderFrameHelper::OnSetPrintingEnabled(bool enabled) { +@@ -1461,7 +1450,6 @@ void PrintRenderFrameHelper::OnSetPrintingEnabled(bool enabled) { is_printing_enabled_ = enabled; } @@ -326,7 +369,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) { if (ipc_nesting_level_ > 1) return; -@@ -1483,7 +1471,9 @@ void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) { +@@ -1472,7 +1460,9 @@ void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) { // that instead. auto plugin = delegate_->GetPdfElement(frame); if (!plugin.IsNull()) { @@ -336,7 +379,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 return; } print_preview_context_.InitWithFrame(frame); -@@ -1492,10 +1482,11 @@ void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) { +@@ -1481,10 +1471,11 @@ void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) { : PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME); } @@ -349,7 +392,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 bool PrintRenderFrameHelper::IsPrintingEnabled() const { return is_printing_enabled_; -@@ -1517,11 +1508,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { +@@ -1506,11 +1497,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { print_node_in_progress_ = true; @@ -362,7 +405,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 } else { #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Make a copy of the node, in case RenderView::OnContextMenuClosed() resets -@@ -1611,7 +1600,6 @@ void PrintRenderFrameHelper::DidFinishPrinting(PrintingResult result) { +@@ -1600,7 +1589,6 @@ void PrintRenderFrameHelper::DidFinishPrinting(PrintingResult result) { } break; @@ -370,7 +413,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 case FAIL_PREVIEW: if (!is_print_ready_metafile_sent_) { if (notify_browser_of_print_failure_) { -@@ -1628,7 +1616,6 @@ void PrintRenderFrameHelper::DidFinishPrinting(PrintingResult result) { +@@ -1617,7 +1605,6 @@ void PrintRenderFrameHelper::DidFinishPrinting(PrintingResult result) { cookie)); print_preview_context_.Failed(false); break; @@ -378,7 +421,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 } prep_frame_view_.reset(); print_pages_params_.reset(); -@@ -1757,7 +1744,6 @@ bool PrintRenderFrameHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, +@@ -1798,7 +1785,6 @@ bool PrintRenderFrameHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, return true; } @@ -386,7 +429,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 bool PrintRenderFrameHelper::SetOptionsFromPdfDocument( PrintHostMsg_SetOptionsFromDocument_Params* options) { blink::WebLocalFrame* source_frame = print_preview_context_.source_frame(); -@@ -1864,7 +1850,6 @@ bool PrintRenderFrameHelper::UpdatePrintSettings( +@@ -1905,7 +1891,6 @@ bool PrintRenderFrameHelper::UpdatePrintSettings( print_preview_context_.set_error(PREVIEW_ERROR_INVALID_PRINTER_SETTINGS); return false; } @@ -394,7 +437,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 #if BUILDFLAG(ENABLE_BASIC_PRINTING) void PrintRenderFrameHelper::GetPrintSettingsFromUser( -@@ -2023,7 +2008,6 @@ bool PrintRenderFrameHelper::CopyMetafileDataToSharedMem( +@@ -2058,7 +2043,6 @@ bool PrintRenderFrameHelper::CopyMetafileDataToSharedMem( return true; } @@ -402,7 +445,7 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 void PrintRenderFrameHelper::ShowScriptedPrintPreview() { if (is_scripted_preview_delayed_) { is_scripted_preview_delayed_ = false; -@@ -2158,7 +2142,6 @@ bool PrintRenderFrameHelper::PreviewPageRendered(int page_number, +@@ -2193,7 +2177,6 @@ bool PrintRenderFrameHelper::PreviewPageRendered(int page_number, Send(new PrintHostMsg_DidPreviewPage(routing_id(), preview_page_params)); return true; } @@ -411,10 +454,10 @@ index c6b03ed6ad9a..5f6545a3dee7 100644 PrintRenderFrameHelper::PrintPreviewContext::PrintPreviewContext() : total_page_count_(0), diff --git components/printing/renderer/print_render_frame_helper.h components/printing/renderer/print_render_frame_helper.h -index a9fe8cb7dcaf..ea35ea3cc920 100644 +index cd174ca65085..bbef96f246ef 100644 --- components/printing/renderer/print_render_frame_helper.h +++ components/printing/renderer/print_render_frame_helper.h -@@ -156,10 +156,8 @@ class PrintRenderFrameHelper +@@ -147,10 +147,8 @@ class PrintRenderFrameHelper OK, FAIL_PRINT_INIT, FAIL_PRINT, @@ -425,7 +468,7 @@ index a9fe8cb7dcaf..ea35ea3cc920 100644 }; enum PrintPreviewErrorBuckets { -@@ -196,9 +194,9 @@ class PrintRenderFrameHelper +@@ -187,9 +185,9 @@ class PrintRenderFrameHelper void OnPrintForSystemDialog(); void OnPrintForPrintPreview(const base::DictionaryValue& job_settings); #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -436,7 +479,7 @@ index a9fe8cb7dcaf..ea35ea3cc920 100644 void OnClosePrintPreviewDialog(); #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) void OnPrintingDone(bool success); -@@ -213,7 +211,6 @@ class PrintRenderFrameHelper +@@ -204,7 +202,6 @@ class PrintRenderFrameHelper // Update |ignore_css_margins_| based on settings. void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings); @@ -444,7 +487,7 @@ index a9fe8cb7dcaf..ea35ea3cc920 100644 // Prepare frame for creating preview document. void PrepareFrameForPreviewDocument(); -@@ -230,7 +227,6 @@ class PrintRenderFrameHelper +@@ -221,7 +218,6 @@ class PrintRenderFrameHelper // Finalize the print ready preview document. bool FinalizePrintReadyDocument(); @@ -452,7 +495,7 @@ index a9fe8cb7dcaf..ea35ea3cc920 100644 // Enable/Disable printing. void OnSetPrintingEnabled(bool enabled); -@@ -260,7 +256,6 @@ class PrintRenderFrameHelper +@@ -251,7 +247,6 @@ class PrintRenderFrameHelper const blink::WebNode& node, int* number_of_pages); @@ -460,7 +503,7 @@ index a9fe8cb7dcaf..ea35ea3cc920 100644 // Set options for print preset from source PDF document. bool SetOptionsFromPdfDocument( PrintHostMsg_SetOptionsFromDocument_Params* options); -@@ -271,7 +266,6 @@ class PrintRenderFrameHelper +@@ -262,7 +257,6 @@ class PrintRenderFrameHelper bool UpdatePrintSettings(blink::WebLocalFrame* frame, const blink::WebNode& node, const base::DictionaryValue& passed_job_settings); @@ -468,7 +511,7 @@ index a9fe8cb7dcaf..ea35ea3cc920 100644 #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Get final print settings from the user. -@@ -375,7 +369,6 @@ class PrintRenderFrameHelper +@@ -347,7 +341,6 @@ class PrintRenderFrameHelper bool IsScriptInitiatedPrintAllowed(blink::WebLocalFrame* frame, bool user_initiated); @@ -476,7 +519,7 @@ index a9fe8cb7dcaf..ea35ea3cc920 100644 // Shows scripted print preview when options from plugin are available. void ShowScriptedPrintPreview(); -@@ -393,7 +386,6 @@ class PrintRenderFrameHelper +@@ -365,7 +358,6 @@ class PrintRenderFrameHelper // |metafile| is the rendered page. Otherwise |metafile| is NULL. // Returns true if print preview should continue, false on failure. bool PreviewPageRendered(int page_number, PdfMetafileSkia* metafile); @@ -484,7 +527,7 @@ index a9fe8cb7dcaf..ea35ea3cc920 100644 void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings); -@@ -554,6 +546,7 @@ class PrintRenderFrameHelper +@@ -526,6 +518,7 @@ class PrintRenderFrameHelper ScriptingThrottler scripting_throttler_; bool print_node_in_progress_; @@ -493,22 +536,22 @@ index a9fe8cb7dcaf..ea35ea3cc920 100644 bool is_loading_; bool is_scripted_preview_delayed_; diff --git components/printing/renderer/print_render_frame_helper_mac.mm components/printing/renderer/print_render_frame_helper_mac.mm -index 42149955ee2c..ca6cb42ffce1 100644 +index 8cc4806de501..ba3d0dc6e621 100644 --- components/printing/renderer/print_render_frame_helper_mac.mm +++ components/printing/renderer/print_render_frame_helper_mac.mm -@@ -76,7 +76,6 @@ void PrintRenderFrameHelper::PrintPagesInternal( - } - } +@@ -18,7 +18,6 @@ + + namespace printing { -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) bool PrintRenderFrameHelper::RenderPreviewPage( int page_number, const PrintMsg_Print_Params& print_params) { -@@ -115,7 +114,6 @@ bool PrintRenderFrameHelper::RenderPreviewPage( +@@ -56,7 +55,6 @@ bool PrintRenderFrameHelper::RenderPreviewPage( } return PreviewPageRendered(page_number, draft_metafile.get()); } -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) - void PrintRenderFrameHelper::RenderPage(const PrintMsg_Print_Params& params, - int page_number, + void PrintRenderFrameHelper::PrintPageInternal( + const PrintMsg_Print_Params& params, diff --git a/patch/patches/printing_context_2196.patch b/patch/patches/printing_context_2196.patch index 6c17ca9a6..c4f6f38fb 100644 --- a/patch/patches/printing_context_2196.patch +++ b/patch/patches/printing_context_2196.patch @@ -1,17 +1,17 @@ diff --git chrome/browser/printing/print_job_worker.cc chrome/browser/printing/print_job_worker.cc -index 13434ba2f6cd..9e6734501057 100644 +index 6f185aef2feb..1c2e0fae7f47 100644 --- chrome/browser/printing/print_job_worker.cc +++ chrome/browser/printing/print_job_worker.cc -@@ -125,6 +125,7 @@ PrintJobWorker::PrintJobWorker(int render_process_id, - printing_context_delegate_ = base::MakeUnique( - render_process_id, render_frame_id); - printing_context_ = PrintingContext::Create(printing_context_delegate_.get()); +@@ -129,6 +129,7 @@ PrintJobWorker::PrintJobWorker(int render_process_id, + weak_factory_(this) { + // The object is created in the IO thread. + DCHECK(owner_->RunsTasksInCurrentSequence()); + printing_context_->set_render_ids(render_process_id, render_frame_id); } PrintJobWorker::~PrintJobWorker() { diff --git printing/printing_context.h printing/printing_context.h -index 03f940ca4684..d23a4a354d57 100644 +index 96934fb0d0c8..39d0019a9826 100644 --- printing/printing_context.h +++ printing/printing_context.h @@ -127,6 +127,13 @@ class PRINTING_EXPORT PrintingContext { diff --git a/patch/patches/render_widget_latency_2060.patch b/patch/patches/render_widget_latency_2060.patch deleted file mode 100644 index 220a4ab48..000000000 --- a/patch/patches/render_widget_latency_2060.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git ui/latency/latency_histogram_macros.h ui/latency/latency_histogram_macros.h -index 77e3eeef70ba..f8dd6350c120 100644 ---- ui/latency/latency_histogram_macros.h -+++ ui/latency/latency_histogram_macros.h -@@ -10,8 +10,7 @@ - // Check valid timing for start and end latency components. - #define CONFIRM_VALID_TIMING(start, end) \ - DCHECK(!start.first_event_time.is_null()); \ -- DCHECK(!end.last_event_time.is_null()); \ -- DCHECK_GE(end.last_event_time, start.first_event_time); -+ DCHECK(!end.last_event_time.is_null()); - - // Event latency that is mostly under 1 second. We should only use 100 buckets - // when needed. diff --git a/patch/patches/renderer_preferences_util_545103.patch b/patch/patches/renderer_preferences_util_545103.patch index b942b6aad..ef1038d5e 100644 --- a/patch/patches/renderer_preferences_util_545103.patch +++ b/patch/patches/renderer_preferences_util_545103.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/renderer_preferences_util.cc chrome/browser/renderer_preferences_util.cc -index 7296a04a56cc..c702d3178eb6 100644 +index ef8350dd1f99..601db5845c8a 100644 --- chrome/browser/renderer_preferences_util.cc +++ chrome/browser/renderer_preferences_util.cc @@ -32,7 +32,8 @@ @@ -12,8 +12,8 @@ index 7296a04a56cc..c702d3178eb6 100644 #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" #include "ui/views/linux_ui/linux_ui.h" -@@ -134,7 +135,8 @@ void UpdateFromSystemSettings(content::RendererPreferences* prefs, - prefs->caret_blink_interval = interval.InSecondsF(); +@@ -136,7 +137,8 @@ void UpdateFromSystemSettings(content::RendererPreferences* prefs, + prefs->caret_blink_interval = interval; #endif -#if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) diff --git a/patch/patches/rwh_background_color_1984.patch b/patch/patches/rwh_background_color_1984.patch index 71803975a..dcd4da530 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 7f727c290067..9d8a4683411f 100644 +index 3adf96eda163..673f4c689fcb 100644 --- content/browser/renderer_host/render_widget_host_view_aura.cc +++ content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -426,13 +426,6 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura( +@@ -435,13 +435,6 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura( selection_controller_client_.reset( new TouchSelectionControllerClientAura(this)); CreateSelectionController(); @@ -16,7 +16,7 @@ index 7f727c290067..9d8a4683411f 100644 } //////////////////////////////////////////////////////////////////////////////// -@@ -750,8 +743,10 @@ void RenderWidgetHostViewAura::UpdateBackgroundColorFromRenderer( +@@ -775,8 +768,10 @@ void RenderWidgetHostViewAura::UpdateBackgroundColorFromRenderer( background_color_ = color; bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE; @@ -29,7 +29,7 @@ index 7f727c290067..9d8a4683411f 100644 } bool RenderWidgetHostViewAura::IsMouseLocked() { -@@ -1913,6 +1908,15 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) { +@@ -1961,6 +1956,15 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) { window_->Init(ui::LAYER_SOLID_COLOR); window_->layer()->SetColor(background_color_); @@ -42,6 +42,6 @@ index 7f727c290067..9d8a4683411f 100644 + ignore_result(rvh->GetWebkitPreferences()); + } + - if (!IsMus()) + if (!IsUsingMus()) return; diff --git a/patch/patches/service_factory_1680.patch b/patch/patches/service_factory_1680.patch index 5e04984d0..f26c3e6ee 100644 --- a/patch/patches/service_factory_1680.patch +++ b/patch/patches/service_factory_1680.patch @@ -1,9 +1,9 @@ diff --git chrome/browser/spellchecker/spellcheck_factory.cc chrome/browser/spellchecker/spellcheck_factory.cc -index 9f9eb3bdd044..63988fba828d 100644 +index 148ec2086d1f..cc7f9ac83481 100644 --- chrome/browser/spellchecker/spellcheck_factory.cc +++ chrome/browser/spellchecker/spellcheck_factory.cc -@@ -17,6 +17,13 @@ - #include "content/public/browser/render_process_host.h" +@@ -18,6 +18,13 @@ + #include "services/service_manager/public/cpp/identity.h" #include "ui/base/l10n/l10n_util.h" +namespace { @@ -16,7 +16,7 @@ index 9f9eb3bdd044..63988fba828d 100644 // static SpellcheckService* SpellcheckServiceFactory::GetForContext( content::BrowserContext* context) { -@@ -39,7 +46,7 @@ SpellcheckService* SpellcheckServiceFactory::GetForRenderProcessId( +@@ -38,7 +45,7 @@ SpellcheckService* SpellcheckServiceFactory::GetForRenderer( // static SpellcheckServiceFactory* SpellcheckServiceFactory::GetInstance() { @@ -26,7 +26,7 @@ index 9f9eb3bdd044..63988fba828d 100644 SpellcheckServiceFactory::SpellcheckServiceFactory() diff --git chrome/browser/spellchecker/spellcheck_factory.h chrome/browser/spellchecker/spellcheck_factory.h -index e8eb9f7e8aa6..2e1b7cf84081 100644 +index fd4e6643725c..fcdbb8e4db88 100644 --- chrome/browser/spellchecker/spellcheck_factory.h +++ chrome/browser/spellchecker/spellcheck_factory.h @@ -7,7 +7,7 @@ @@ -38,7 +38,7 @@ index e8eb9f7e8aa6..2e1b7cf84081 100644 #include "components/keyed_service/content/browser_context_keyed_service_factory.h" class SpellcheckService; -@@ -26,7 +26,7 @@ class SpellcheckServiceFactory : public BrowserContextKeyedServiceFactory { +@@ -31,7 +31,7 @@ class SpellcheckServiceFactory : public BrowserContextKeyedServiceFactory { static SpellcheckServiceFactory* GetInstance(); private: @@ -97,7 +97,7 @@ index 2907619549ba..f941fba363b5 100644 SupervisedUserSettingsServiceFactory(); diff --git chrome/browser/ui/prefs/prefs_tab_helper.cc chrome/browser/ui/prefs/prefs_tab_helper.cc -index 149dbc568f54..ec01bd851d9c 100644 +index 23dfe243fb83..7eb879cadcbb 100644 --- chrome/browser/ui/prefs/prefs_tab_helper.cc +++ chrome/browser/ui/prefs/prefs_tab_helper.cc @@ -11,8 +11,8 @@ diff --git a/patch/patches/service_manager_654986.patch b/patch/patches/service_manager_654986.patch index d43fe1d7b..7a4c31d5b 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 87ac6f053947..868ff9e0c115 100644 +index 08ea94a11772..873726c6ea19 100644 --- services/service_manager/embedder/main.cc +++ services/service_manager/embedder/main.cc -@@ -317,13 +317,30 @@ int RunService(MainDelegate* delegate) { +@@ -304,13 +304,30 @@ int RunService(MainDelegate* delegate) { return exit_code; } @@ -34,7 +34,7 @@ index 87ac6f053947..868ff9e0c115 100644 MainDelegate* delegate = params.delegate; DCHECK(delegate); -@@ -391,30 +408,14 @@ int Main(const MainParams& params) { +@@ -378,30 +395,14 @@ int Main(const MainParams& params) { MainDelegate::InitializeParams init_params; #if defined(OS_MACOSX) @@ -43,7 +43,7 @@ index 87ac6f053947..868ff9e0c115 100644 - // Each "main" needs to flush this pool right before it goes into its main - // event loop to get rid of the cruft. - std::unique_ptr autorelease_pool = -- base::MakeUnique(); +- std::make_unique(); - init_params.autorelease_pool = autorelease_pool.get(); + init_params.autorelease_pool = params.autorelease_pool.get(); InitializeMac(); @@ -69,7 +69,7 @@ index 87ac6f053947..868ff9e0c115 100644 mojo_config.max_message_num_bytes = kMaximumMojoMessageSize; delegate->OverrideMojoConfiguration(&mojo_config); mojo::edk::Init(mojo_config); -@@ -449,6 +450,16 @@ int Main(const MainParams& params) { +@@ -436,6 +437,16 @@ int Main(const MainParams& params) { trace_config, base::trace_event::TraceLog::RECORDING_MODE); } @@ -86,7 +86,7 @@ index 87ac6f053947..868ff9e0c115 100644 switch (process_type) { case ProcessType::kDefault: NOTREACHED(); -@@ -470,6 +481,8 @@ int Main(const MainParams& params) { +@@ -457,6 +468,8 @@ int Main(const MainParams& params) { break; } @@ -95,7 +95,7 @@ index 87ac6f053947..868ff9e0c115 100644 if (tracker) { if (exit_code == 0) { tracker->SetProcessPhaseIfEnabled( -@@ -481,13 +494,38 @@ int Main(const MainParams& params) { +@@ -468,13 +481,38 @@ int Main(const MainParams& params) { } } diff --git a/patch/patches/storage_partition_1973.patch b/patch/patches/storage_partition_1973.patch index 52e161bb9..c52b9b7df 100644 --- a/patch/patches/storage_partition_1973.patch +++ b/patch/patches/storage_partition_1973.patch @@ -14,10 +14,10 @@ index 71bf90c54ae5..d3308da307d7 100644 } diff --git content/browser/blob_storage/chrome_blob_storage_context.cc content/browser/blob_storage/chrome_blob_storage_context.cc -index 325736ab142b..cbb25b803aa6 100644 +index bf41a25bcd29..9e6dd89497e7 100644 --- content/browser/blob_storage/chrome_blob_storage_context.cc +++ content/browser/blob_storage/chrome_blob_storage_context.cc -@@ -78,6 +78,11 @@ class BlobHandleImpl : public BlobHandle { +@@ -76,6 +76,11 @@ class BlobHandleImpl : public BlobHandle { ChromeBlobStorageContext::ChromeBlobStorageContext() {} @@ -30,7 +30,7 @@ index 325736ab142b..cbb25b803aa6 100644 BrowserContext* context) { DCHECK_CURRENTLY_ON(BrowserThread::UI); diff --git content/browser/blob_storage/chrome_blob_storage_context.h content/browser/blob_storage/chrome_blob_storage_context.h -index 00b61232c391..aa915f3130d1 100644 +index 2412f15c5fb7..3434d129af64 100644 --- content/browser/blob_storage/chrome_blob_storage_context.h +++ content/browser/blob_storage/chrome_blob_storage_context.h @@ -47,6 +47,8 @@ class CONTENT_EXPORT ChromeBlobStorageContext @@ -43,7 +43,7 @@ index 00b61232c391..aa915f3130d1 100644 static ChromeBlobStorageContext* GetFor( BrowserContext* browser_context); diff --git content/browser/bluetooth/web_bluetooth_service_impl.cc content/browser/bluetooth/web_bluetooth_service_impl.cc -index 13d802fa72cd..a2d34d1d72eb 100644 +index e5c7291dcc8f..0eec8a11db35 100644 --- content/browser/bluetooth/web_bluetooth_service_impl.cc +++ content/browser/bluetooth/web_bluetooth_service_impl.cc @@ -1233,9 +1233,9 @@ url::Origin WebBluetoothServiceImpl::GetOrigin() { @@ -59,10 +59,10 @@ index 13d802fa72cd..a2d34d1d72eb 100644 partition->GetBluetoothAllowedDevicesMap(); return allowed_devices_map->GetOrCreateAllowedDevices(GetOrigin()); diff --git content/browser/browser_context.cc content/browser/browser_context.cc -index 1e3eb64f87ba..593e3d15d5ec 100644 +index 125078b9cb44..b24609a807ba 100644 --- content/browser/browser_context.cc +++ content/browser/browser_context.cc -@@ -123,11 +123,18 @@ StoragePartition* GetStoragePartitionFromConfig( +@@ -127,11 +127,18 @@ StoragePartition* GetStoragePartitionFromConfig( StoragePartitionImplMap* partition_map = GetStoragePartitionMap(browser_context); @@ -84,7 +84,7 @@ index 1e3eb64f87ba..593e3d15d5ec 100644 } void SaveSessionStateOnIOThread( -@@ -548,6 +555,11 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor( +@@ -553,6 +560,11 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor( BrowserContext::BrowserContext() : media_device_id_salt_(CreateRandomMediaDeviceIDSalt()) {} @@ -97,10 +97,10 @@ index 1e3eb64f87ba..593e3d15d5ec 100644 CHECK(GetUserData(kMojoWasInitialized)) << "Attempting to destroy a BrowserContext that never called " diff --git content/browser/devtools/protocol/service_worker_handler.cc content/browser/devtools/protocol/service_worker_handler.cc -index a65884075126..241653eb4fd6 100644 +index d2478ae31473..5fd30c1cd72c 100644 --- content/browser/devtools/protocol/service_worker_handler.cc +++ content/browser/devtools/protocol/service_worker_handler.cc -@@ -334,8 +334,7 @@ Response ServiceWorkerHandler::DispatchSyncEvent( +@@ -337,8 +337,7 @@ Response ServiceWorkerHandler::DispatchSyncEvent( if (!base::StringToInt64(registration_id, &id)) return CreateInvalidVersionIdErrorResponse(); @@ -111,12 +111,12 @@ index a65884075126..241653eb4fd6 100644 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, diff --git content/browser/download/download_manager_impl.cc content/browser/download/download_manager_impl.cc -index 68293acdadc6..ca613c9218c8 100644 +index 0992aad5fe6c..788d432c48d9 100644 --- content/browser/download/download_manager_impl.cc +++ content/browser/download/download_manager_impl.cc -@@ -69,9 +69,9 @@ - namespace content { - namespace { +@@ -83,9 +83,9 @@ WebContents* GetWebContents(int render_process_id, + return WebContents::FromFrameTreeNodeId(frame_tree_node_id); + } -StoragePartitionImpl* GetStoragePartition(BrowserContext* context, - int render_process_id, @@ -127,7 +127,7 @@ index 68293acdadc6..ca613c9218c8 100644 DCHECK_CURRENTLY_ON(BrowserThread::UI); SiteInstance* site_instance = nullptr; -@@ -81,8 +81,7 @@ StoragePartitionImpl* GetStoragePartition(BrowserContext* context, +@@ -95,8 +95,7 @@ StoragePartitionImpl* GetStoragePartition(BrowserContext* context, if (render_frame_host_) site_instance = render_frame_host_->GetSiteInstance(); } @@ -137,7 +137,7 @@ index 68293acdadc6..ca613c9218c8 100644 } bool CanRequestURLFromRenderer(int render_process_id, GURL url) { -@@ -737,14 +736,15 @@ void DownloadManagerImpl::DownloadUrl( +@@ -987,16 +986,17 @@ void DownloadManagerImpl::BeginDownloadInternal( if (base::FeatureList::IsEnabled(features::kNetworkService)) { std::unique_ptr request = CreateResourceRequest( params.get()); @@ -150,31 +150,39 @@ index 68293acdadc6..ca613c9218c8 100644 base::BindOnce( &BeginResourceDownload, std::move(params), std::move(request), - storage_partition->url_loader_factory_getter(), +- base::WrapRefCounted(storage_partition->GetFileSystemContext()), +- id, weak_factory_.GetWeakPtr()), + base::WrapRefCounted( + storage_partition->url_loader_factory_getter()), - base::WrapRefCounted(storage_partition->GetFileSystemContext()), - content::DownloadItem::kInvalidId, weak_factory_.GetWeakPtr()), ++ base::WrapRefCounted(storage_partition->GetFileSystemContext()), ++ id, weak_factory_.GetWeakPtr()), base::BindOnce(&DownloadManagerImpl::AddUrlDownloadHandler, + weak_factory_.GetWeakPtr())); + } else { diff --git content/browser/loader/navigation_url_loader_network_service.cc content/browser/loader/navigation_url_loader_network_service.cc -index dadbbdcc8fc8..1fd206309eb8 100644 +index 70148056059b..599b068dfdea 100644 --- content/browser/loader/navigation_url_loader_network_service.cc +++ content/browser/loader/navigation_url_loader_network_service.cc -@@ -579,8 +579,8 @@ NavigationURLLoaderNetworkService::NavigationURLLoaderNetworkService( +@@ -615,11 +615,12 @@ NavigationURLLoaderNetworkService::NavigationURLLoaderNetworkService( + + g_next_request_id--; + +- auto* partition = static_cast(storage_partition); ++ auto* partition = storage_partition; DCHECK(!request_controller_); - request_controller_ = base::MakeUnique( + request_controller_ = std::make_unique( std::move(initial_handlers), std::move(new_request), resource_context, -- static_cast(storage_partition) -- ->url_loader_factory_getter(), -+ scoped_refptr( -+ storage_partition->url_loader_factory_getter()), - weak_factory_.GetWeakPtr()); +- partition->url_loader_factory_getter(), weak_factory_.GetWeakPtr()); ++ base::WrapRefCounted(partition->url_loader_factory_getter()), ++ weak_factory_.GetWeakPtr()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, + base::BindOnce(&URLLoaderRequestController::Start, diff --git content/browser/payments/payment_app_provider_impl.cc content/browser/payments/payment_app_provider_impl.cc -index 337411c80e5a..7acc48a745a2 100644 +index 8816724941ff..6b9a26b7c615 100644 --- content/browser/payments/payment_app_provider_impl.cc +++ content/browser/payments/payment_app_provider_impl.cc -@@ -328,10 +328,11 @@ void StartServiceWorkerForDispatch(BrowserContext* browser_context, +@@ -329,10 +329,11 @@ void StartServiceWorkerForDispatch(BrowserContext* browser_context, ServiceWorkerStartCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -189,7 +197,7 @@ index 337411c80e5a..7acc48a745a2 100644 BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, -@@ -357,8 +358,8 @@ void PaymentAppProviderImpl::GetAllPaymentApps( +@@ -358,8 +359,8 @@ void PaymentAppProviderImpl::GetAllPaymentApps( GetAllPaymentAppsCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -201,10 +209,10 @@ index 337411c80e5a..7acc48a745a2 100644 partition->GetPaymentAppContext(); diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc -index 44207cf02ab6..a59cd89a31f8 100644 +index a61b8ab0886e..5be550085df1 100644 --- content/browser/renderer_host/render_process_host_impl.cc +++ content/browser/renderer_host/render_process_host_impl.cc -@@ -493,9 +493,8 @@ class SpareRenderProcessHostManager : public RenderProcessHostObserver { +@@ -500,9 +500,8 @@ class SpareRenderProcessHostManager : public RenderProcessHostObserver { SpareRenderProcessHostManager() {} void WarmupSpareRenderProcessHost(BrowserContext* browser_context) { @@ -216,7 +224,7 @@ index 44207cf02ab6..a59cd89a31f8 100644 if (spare_render_process_host_ && matching_browser_context_ == browser_context && -@@ -634,11 +633,10 @@ class DefaultSubframeProcessHostHolder : public base::SupportsUserData::Data, +@@ -641,11 +640,10 @@ class DefaultSubframeProcessHostHolder : public base::SupportsUserData::Data, // Gets the correct render process to use for this SiteInstance. RenderProcessHost* GetProcessHost(SiteInstance* site_instance, bool is_for_guests_only) { @@ -232,7 +240,7 @@ index 44207cf02ab6..a59cd89a31f8 100644 // Is this the default storage partition? If it isn't, then just give it its // own non-shared process. -@@ -1206,7 +1204,7 @@ void RenderProcessHost::SetMaxRendererProcessCount(size_t count) { +@@ -1240,7 +1238,7 @@ void RenderProcessHost::SetMaxRendererProcessCount(size_t count) { // static RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost( BrowserContext* browser_context, @@ -241,7 +249,7 @@ index 44207cf02ab6..a59cd89a31f8 100644 SiteInstance* site_instance, bool is_for_guests_only) { if (g_render_process_host_factory_) { -@@ -1215,8 +1213,8 @@ RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost( +@@ -1249,8 +1247,8 @@ RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost( } if (!storage_partition_impl) { @@ -252,7 +260,7 @@ index 44207cf02ab6..a59cd89a31f8 100644 } return new RenderProcessHostImpl(browser_context, storage_partition_impl, -@@ -1226,7 +1224,7 @@ RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost( +@@ -1260,7 +1258,7 @@ RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost( // static RenderProcessHost* RenderProcessHostImpl::CreateOrUseSpareRenderProcessHost( BrowserContext* browser_context, @@ -261,7 +269,7 @@ index 44207cf02ab6..a59cd89a31f8 100644 SiteInstance* site_instance, bool is_for_guests_only) { RenderProcessHost* render_process_host = -@@ -1246,7 +1244,7 @@ RenderProcessHost* RenderProcessHostImpl::CreateOrUseSpareRenderProcessHost( +@@ -1280,7 +1278,7 @@ RenderProcessHost* RenderProcessHostImpl::CreateOrUseSpareRenderProcessHost( RenderProcessHostImpl::RenderProcessHostImpl( BrowserContext* browser_context, @@ -270,7 +278,7 @@ index 44207cf02ab6..a59cd89a31f8 100644 bool is_for_guests_only) : fast_shutdown_started_(false), deleting_soon_(false), -@@ -1282,7 +1280,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( +@@ -1316,7 +1314,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( indexed_db_factory_(new IndexedDBDispatcherHost( id_, storage_partition_impl_->GetURLRequestContext(), @@ -280,7 +288,7 @@ index 44207cf02ab6..a59cd89a31f8 100644 ChromeBlobStorageContext::GetFor(browser_context_))), channel_connected_(false), sent_render_process_ready_(false), -@@ -1316,7 +1315,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( +@@ -1350,7 +1349,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( } push_messaging_manager_.reset(new PushMessagingManager( @@ -290,7 +298,7 @@ index 44207cf02ab6..a59cd89a31f8 100644 AddObserver(indexed_db_factory_.get()); -@@ -1620,6 +1620,20 @@ void RenderProcessHostImpl::ResetChannelProxy() { +@@ -1665,6 +1665,20 @@ void RenderProcessHostImpl::ResetChannelProxy() { void RenderProcessHostImpl::CreateMessageFilters() { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -311,7 +319,7 @@ index 44207cf02ab6..a59cd89a31f8 100644 AddFilter(new ResourceSchedulerFilter(GetID())); MediaInternals* media_internals = MediaInternals::GetInstance(); // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages -@@ -1634,8 +1648,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1679,8 +1693,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { new RenderMessageFilter( GetID(), GetBrowserContext(), request_context.get(), widget_helper_.get(), media_internals, @@ -322,7 +330,7 @@ index 44207cf02ab6..a59cd89a31f8 100644 AddFilter(render_message_filter.get()); render_frame_message_filter_ = new RenderFrameMessageFilter( -@@ -1664,10 +1678,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1709,10 +1723,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { ChromeBlobStorageContext::GetFor(browser_context); resource_message_filter_ = new ResourceMessageFilter( @@ -335,20 +343,19 @@ index 44207cf02ab6..a59cd89a31f8 100644 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); AddFilter(resource_message_filter_.get()); -@@ -1694,10 +1708,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1735,9 +1749,9 @@ void RenderProcessHostImpl::CreateMessageFilters() { AddFilter( new MidiHost(GetID(), BrowserMainLoop::GetInstance()->midi_service())); AddFilter(new AppCacheDispatcherHost( - storage_partition_impl_->GetAppCacheService(), GetID())); + app_cache_service, GetID())); - AddFilter(new ClipboardMessageFilter(blob_storage_context)); AddFilter(new DOMStorageMessageFilter( - storage_partition_impl_->GetDOMStorageContext())); + dom_storage_context)); #if BUILDFLAG(ENABLE_WEBRTC) peer_connection_tracker_host_ = new PeerConnectionTrackerHost( -@@ -1731,13 +1745,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1765,13 +1779,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { scoped_refptr cache_storage_filter = new CacheStorageDispatcherHost(); @@ -364,9 +371,9 @@ index 44207cf02ab6..a59cd89a31f8 100644 AddFilter(service_worker_filter.get()); #if BUILDFLAG(ENABLE_WEBRTC) -@@ -1752,11 +1765,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { - GetID(), storage_partition_impl_->GetQuotaManager(), - GetContentClient()->browser()->CreateQuotaPermissionContext())); +@@ -1783,11 +1796,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { + AddFilter(new TraceMessageFilter(GetID())); + AddFilter(new ResolveProxyMsgHelper(request_context.get())); - scoped_refptr service_worker_context( - static_cast( @@ -377,41 +384,19 @@ index 44207cf02ab6..a59cd89a31f8 100644 resource_context, service_worker_context, browser_context); AddFilter(notification_message_filter_.get()); -@@ -1771,6 +1781,11 @@ void RenderProcessHostImpl::CreateMessageFilters() { - void RenderProcessHostImpl::RegisterMojoInterfaces() { - auto registry = base::MakeUnique(); - -+ // Cast to the derived type from StoragePartitionImpl. -+ auto platform_notification_context = -+ static_cast( -+ storage_partition_impl_->GetPlatformNotificationContext()); -+ - channel_->AddAssociatedInterfaceForIOThread( - base::Bind(&IndexedDBDispatcherHost::AddBinding, - base::Unretained(indexed_db_factory_.get()))); -@@ -1825,8 +1840,7 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { - AddUIThreadInterface( - registry.get(), - base::Bind(&PlatformNotificationContextImpl::CreateService, -- base::Unretained( -- storage_partition_impl_->GetPlatformNotificationContext()), -+ base::Unretained(platform_notification_context), - GetID())); - AddUIThreadInterface( - registry.get(), diff --git content/browser/renderer_host/render_process_host_impl.h content/browser/renderer_host/render_process_host_impl.h -index dd7df59cb5c4..3c802e969d80 100644 +index b5528d49e678..aaecb9f0b0f7 100644 --- content/browser/renderer_host/render_process_host_impl.h +++ content/browser/renderer_host/render_process_host_impl.h -@@ -87,7 +87,6 @@ class ResourceMessageFilter; +@@ -84,7 +84,6 @@ class ResourceMessageFilter; class SiteInstance; class SiteInstanceImpl; class StoragePartition; -class StoragePartitionImpl; - typedef base::Thread* (*RendererMainThreadFactoryFunction)( - const InProcessChildThreadParams& params); -@@ -126,7 +125,7 @@ class CONTENT_EXPORT RenderProcessHostImpl + #if BUILDFLAG(ENABLE_WEBRTC) + class MediaStreamDispatcherHost; +@@ -128,7 +127,7 @@ class CONTENT_EXPORT RenderProcessHostImpl // legal). static RenderProcessHost* CreateOrUseSpareRenderProcessHost( BrowserContext* browser_context, @@ -420,7 +405,7 @@ index dd7df59cb5c4..3c802e969d80 100644 SiteInstance* site_instance, bool is_for_guests_only); -@@ -138,7 +137,7 @@ class CONTENT_EXPORT RenderProcessHostImpl +@@ -140,7 +139,7 @@ class CONTENT_EXPORT RenderProcessHostImpl // null. static RenderProcessHost* CreateRenderProcessHost( BrowserContext* browser_context, @@ -429,7 +414,7 @@ index dd7df59cb5c4..3c802e969d80 100644 SiteInstance* site_instance, bool is_for_guests_only); -@@ -417,7 +416,7 @@ class CONTENT_EXPORT RenderProcessHostImpl +@@ -422,7 +421,7 @@ class CONTENT_EXPORT RenderProcessHostImpl // Use CreateRenderProcessHost() instead of calling this constructor // directly. RenderProcessHostImpl(BrowserContext* browser_context, @@ -438,7 +423,7 @@ index dd7df59cb5c4..3c802e969d80 100644 bool is_for_guests_only); // Initializes a new IPC::ChannelProxy in |channel_|, which will be connected -@@ -647,10 +646,10 @@ class CONTENT_EXPORT RenderProcessHostImpl +@@ -657,10 +656,10 @@ class CONTENT_EXPORT RenderProcessHostImpl // called. int instance_id_ = 1; @@ -451,15 +436,102 @@ index dd7df59cb5c4..3c802e969d80 100644 // The observers watching our lifetime. base::ObserverList observers_; +diff --git content/browser/renderer_interface_binders.cc content/browser/renderer_interface_binders.cc +index 082e5c990dcc..8398a8613b08 100644 +--- content/browser/renderer_interface_binders.cc ++++ content/browser/renderer_interface_binders.cc +@@ -112,7 +112,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { + parameterized_binder_registry_.AddInterface( + base::Bind([](payments::mojom::PaymentManagerRequest request, + RenderProcessHost* host, const url::Origin& origin) { +- static_cast(host->GetStoragePartition()) ++ host->GetStoragePartition() + ->GetPaymentAppContext() + ->CreatePaymentManager(std::move(request)); + })); +@@ -128,9 +128,10 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { + parameterized_binder_registry_.AddInterface( + base::Bind([](blink::mojom::NotificationServiceRequest request, + RenderProcessHost* host, const url::Origin& origin) { +- static_cast(host->GetStoragePartition()) +- ->GetPlatformNotificationContext() +- ->CreateService(host->GetID(), origin, std::move(request)); ++ static_cast( ++ host->GetStoragePartition() ++ ->GetPlatformNotificationContext()) ++ ->CreateService(host->GetID(), origin, std::move(request)); + })); + } + +diff --git content/browser/shared_worker/shared_worker_connector_impl.cc content/browser/shared_worker/shared_worker_connector_impl.cc +index 4fb7fcdb85c9..bf0155992715 100644 +--- content/browser/shared_worker/shared_worker_connector_impl.cc ++++ content/browser/shared_worker/shared_worker_connector_impl.cc +@@ -23,20 +23,22 @@ void SharedWorkerConnectorImpl::Create( + RenderProcessHost* host = RenderProcessHost::FromID(process_id); + ResourceContext* resource_context = + host->GetBrowserContext()->GetResourceContext(); +- StoragePartitionImpl* storage_partition_impl = +- static_cast(host->GetStoragePartition()); ++ StoragePartition* storage_partition_impl = host->GetStoragePartition(); + + // TODO(darin): Surely there can be a better way to extract a comparable + // identifier from a StoragePartition instance. + WorkerStoragePartition worker_storage_partition( + storage_partition_impl->GetURLRequestContext(), + storage_partition_impl->GetMediaURLRequestContext(), +- storage_partition_impl->GetAppCacheService(), ++ static_cast( ++ storage_partition_impl->GetAppCacheService()), + storage_partition_impl->GetQuotaManager(), + storage_partition_impl->GetFileSystemContext(), + storage_partition_impl->GetDatabaseTracker(), +- storage_partition_impl->GetIndexedDBContext(), +- storage_partition_impl->GetServiceWorkerContext()); ++ static_cast( ++ storage_partition_impl->GetIndexedDBContext()), ++ static_cast( ++ storage_partition_impl->GetServiceWorkerContext())); + + CreateInternal(process_id, frame_id, resource_context, + worker_storage_partition, std::move(request)); +diff --git content/browser/shared_worker/shared_worker_service_impl.cc content/browser/shared_worker/shared_worker_service_impl.cc +index ecf29e7851da..bba93010b3ad 100644 +--- content/browser/shared_worker/shared_worker_service_impl.cc ++++ content/browser/shared_worker/shared_worker_service_impl.cc +@@ -63,17 +63,19 @@ bool SharedWorkerServiceImpl::TerminateWorker( + const url::Origin& constructor_origin, + StoragePartition* storage_partition, + ResourceContext* resource_context) { +- StoragePartitionImpl* storage_partition_impl = +- static_cast(storage_partition); ++ StoragePartition* storage_partition_impl = storage_partition; + WorkerStoragePartitionId partition_id(WorkerStoragePartition( + storage_partition_impl->GetURLRequestContext(), + storage_partition_impl->GetMediaURLRequestContext(), +- storage_partition_impl->GetAppCacheService(), ++ static_cast( ++ storage_partition_impl->GetAppCacheService()), + storage_partition_impl->GetQuotaManager(), + storage_partition_impl->GetFileSystemContext(), + storage_partition_impl->GetDatabaseTracker(), +- storage_partition_impl->GetIndexedDBContext(), +- storage_partition_impl->GetServiceWorkerContext())); ++ static_cast( ++ storage_partition_impl->GetIndexedDBContext()), ++ static_cast( ++ storage_partition_impl->GetServiceWorkerContext()))); + + for (const auto& iter : worker_hosts_) { + SharedWorkerHost* host = iter.second.get(); diff --git content/browser/storage_partition_impl.h content/browser/storage_partition_impl.h -index 6e62286f3f09..11a3cd5f07cb 100644 +index 54818f596e4c..58bd25f9bd24 100644 --- content/browser/storage_partition_impl.h +++ content/browser/storage_partition_impl.h -@@ -117,32 +117,31 @@ class CONTENT_EXPORT StoragePartitionImpl - const base::Closure& callback) override; - void Flush() override; +@@ -119,13 +119,13 @@ class CONTENT_EXPORT StoragePartitionImpl void ClearBluetoothAllowedDevicesMapForTesting() override; -- + void SetNetworkFactoryForTesting( + mojom::URLLoaderFactory* test_factory) override; - BackgroundFetchContext* GetBackgroundFetchContext(); - BackgroundSyncContext* GetBackgroundSyncContext(); - PaymentAppContextImpl* GetPaymentAppContext(); @@ -477,6 +549,7 @@ index 6e62286f3f09..11a3cd5f07cb 100644 // mojom::StoragePartitionService interface. void OpenLocalStorage( +@@ -136,18 +136,18 @@ class CONTENT_EXPORT StoragePartitionImpl const url::Origin& origin, mojo::InterfaceRequest request) override; @@ -500,7 +573,7 @@ index 6e62286f3f09..11a3cd5f07cb 100644 auto& bindings_for_testing() { return bindings_; } diff --git content/browser/streams/stream_context.cc content/browser/streams/stream_context.cc -index b23d083c7342..49d52038a049 100644 +index 7aafca3aafcd..aac07962f6a5 100644 --- content/browser/streams/stream_context.cc +++ content/browser/streams/stream_context.cc @@ -22,6 +22,11 @@ namespace content { @@ -528,12 +601,12 @@ index 075ae3e7431e..57fb5fd2c4a8 100644 void InitializeOnIOThread(); diff --git content/browser/webui/web_ui_url_loader_factory.cc content/browser/webui/web_ui_url_loader_factory.cc -index 579df51d8083..09298a8d042a 100644 +index 8996f11d328e..75b658f5a2d2 100644 --- content/browser/webui/web_ui_url_loader_factory.cc +++ content/browser/webui/web_ui_url_loader_factory.cc -@@ -19,13 +19,13 @@ - #include "content/browser/frame_host/render_frame_host_impl.h" +@@ -20,13 +20,13 @@ #include "content/browser/histogram_internals_url_loader.h" + #include "content/browser/loader/global_routing_id.h" #include "content/browser/resource_context_impl.h" -#include "content/browser/storage_partition_impl.h" #include "content/browser/webui/network_error_url_loader.h" @@ -544,33 +617,25 @@ index 579df51d8083..09298a8d042a 100644 #include "content/public/browser/render_process_host.h" +#include "content/public/browser/storage_partition.h" #include "content/public/browser/web_contents.h" + #include "content/public/browser/web_contents_observer.h" #include "content/public/common/network_service.mojom.h" - #include "content/public/common/url_constants.h" -@@ -209,8 +209,8 @@ class WebUIURLLoaderFactory : public mojom::URLLoaderFactory, - public: - WebUIURLLoaderFactory(FrameTreeNode* ftn) - : frame_tree_node_id_(ftn->frame_tree_node_id()), -- storage_partition_(static_cast( -- ftn->current_frame_host()->GetProcess()->GetStoragePartition())) { -+ storage_partition_( -+ ftn->current_frame_host()->GetProcess()->GetStoragePartition()) { - ftn->AddObserver(this); - } - -@@ -278,7 +278,7 @@ class WebUIURLLoaderFactory : public mojom::URLLoaderFactory, +@@ -296,9 +296,8 @@ class WebUIURLLoaderFactory : public mojom::URLLoaderFactory, + const std::string& scheme() const { return scheme_; } private: - int frame_tree_node_id_; -- StoragePartitionImpl* storage_partition_; -+ StoragePartition* storage_partition_; - mojo::BindingSet loader_factory_bindings_; +- StoragePartitionImpl* GetStoragePartition() { +- return static_cast( +- render_frame_host_->GetProcess()->GetStoragePartition()); ++ StoragePartition* GetStoragePartition() { ++ return render_frame_host_->GetProcess()->GetStoragePartition(); + } - DISALLOW_COPY_AND_ASSIGN(WebUIURLLoaderFactory); + RenderFrameHost* render_frame_host_; diff --git content/public/browser/browser_context.h content/public/browser/browser_context.h -index eff149812e0e..d0484fa48674 100644 +index f75be61ccdef..84f1063fb081 100644 --- content/public/browser/browser_context.h +++ content/public/browser/browser_context.h -@@ -194,6 +194,8 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { +@@ -200,6 +200,8 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { BrowserContext(); @@ -579,7 +644,7 @@ index eff149812e0e..d0484fa48674 100644 ~BrowserContext() override; // Shuts down the storage partitions associated to this browser context. -@@ -282,6 +284,14 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { +@@ -288,6 +290,14 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { const base::FilePath& partition_path, bool in_memory) = 0; @@ -595,18 +660,18 @@ index eff149812e0e..d0484fa48674 100644 std::map; diff --git content/public/browser/storage_partition.h content/public/browser/storage_partition.h -index c3c1aa9d5351..08555f42ac39 100644 +index fa9a14e82472..7ed0814308aa 100644 --- content/public/browser/storage_partition.h +++ content/public/browser/storage_partition.h -@@ -13,6 +13,7 @@ - #include "base/files/file_path.h" +@@ -14,6 +14,7 @@ #include "base/time/time.h" #include "content/common/content_export.h" + #include "content/public/common/url_loader_factory.mojom.h" +#include "mojo/public/cpp/bindings/binding_set.h" #include "net/cookies/cookie_store.h" class GURL; -@@ -41,12 +42,20 @@ class DatabaseTracker; +@@ -42,12 +43,20 @@ class DatabaseTracker; namespace content { class AppCacheService; @@ -627,7 +692,7 @@ index c3c1aa9d5351..08555f42ac39 100644 #if !defined(OS_ANDROID) class HostZoomLevelContext; -@@ -59,6 +68,11 @@ class NetworkContext; +@@ -60,6 +69,11 @@ class NetworkContext; class URLLoaderFactory; } @@ -639,7 +704,7 @@ index c3c1aa9d5351..08555f42ac39 100644 // Defines what persistent state a child process can access. // // The StoragePartition defines the view each child process has of the -@@ -91,6 +105,13 @@ class CONTENT_EXPORT StoragePartition { +@@ -92,6 +106,13 @@ class CONTENT_EXPORT StoragePartition { virtual ZoomLevelDelegate* GetZoomLevelDelegate() = 0; #endif // !defined(OS_ANDROID) virtual PlatformNotificationContext* GetPlatformNotificationContext() = 0; @@ -653,9 +718,9 @@ index c3c1aa9d5351..08555f42ac39 100644 enum : uint32_t { REMOVE_DATA_MASK_APPCACHE = 1 << 0, -@@ -196,6 +217,14 @@ class CONTENT_EXPORT StoragePartition { - // Clear the bluetooth allowed devices map. For test use only. - virtual void ClearBluetoothAllowedDevicesMapForTesting() = 0; +@@ -200,6 +221,14 @@ class CONTENT_EXPORT StoragePartition { + virtual void SetNetworkFactoryForTesting( + mojom::URLLoaderFactory* test_factory) = 0; + virtual URLLoaderFactoryGetter* url_loader_factory_getter() = 0; + virtual BrowserContext* browser_context() const = 0; @@ -669,10 +734,10 @@ index c3c1aa9d5351..08555f42ac39 100644 virtual ~StoragePartition() {} }; diff --git storage/browser/database/database_tracker.cc storage/browser/database/database_tracker.cc -index 86fb9f41fc71..7a8be02473a3 100644 +index e4ee15fd49ab..5adc8867d6df 100644 --- storage/browser/database/database_tracker.cc +++ storage/browser/database/database_tracker.cc -@@ -495,7 +495,7 @@ bool DatabaseTracker::LazyInit() { +@@ -492,7 +492,7 @@ bool DatabaseTracker::LazyInit() { meta_table_.reset(new sql::MetaTable()); is_initialized_ = diff --git a/patch/patches/views_1749_2102.patch b/patch/patches/views_1749_2102.patch index fde2a1c03..bc0637753 100644 --- a/patch/patches/views_1749_2102.patch +++ b/patch/patches/views_1749_2102.patch @@ -39,10 +39,10 @@ index 0755f2752f1d..0322b8c638e7 100644 virtual void MenuWillShow() {} diff --git ui/gfx/render_text.cc ui/gfx/render_text.cc -index 43603c028e5e..a06aaf037153 100644 +index cb77d5b27ccf..4abcb5712945 100644 --- ui/gfx/render_text.cc +++ ui/gfx/render_text.cc -@@ -495,6 +495,14 @@ void RenderText::SetElideBehavior(ElideBehavior elide_behavior) { +@@ -501,6 +501,14 @@ void RenderText::SetElideBehavior(ElideBehavior elide_behavior) { } } @@ -57,7 +57,7 @@ index 43603c028e5e..a06aaf037153 100644 void RenderText::SetDisplayRect(const Rect& r) { if (r != display_rect_) { display_rect_ = r; -@@ -1433,6 +1441,19 @@ void RenderText::OnTextAttributeChanged() { +@@ -1448,6 +1456,19 @@ void RenderText::OnTextAttributeChanged() { if (!multiline_ && replace_newline_chars_with_symbols_) base::ReplaceChars(layout_text_, kNewline, kNewlineSymbol, &layout_text_); @@ -78,10 +78,10 @@ index 43603c028e5e..a06aaf037153 100644 } diff --git ui/gfx/render_text.h ui/gfx/render_text.h -index fb9ab0f6cc85..17f182198b06 100644 +index 259f39b2825b..5b71cd6c6a46 100644 --- ui/gfx/render_text.h +++ ui/gfx/render_text.h -@@ -280,6 +280,10 @@ class GFX_EXPORT RenderText { +@@ -283,6 +283,10 @@ class GFX_EXPORT RenderText { void SetElideBehavior(ElideBehavior elide_behavior); ElideBehavior elide_behavior() const { return elide_behavior_; } @@ -92,9 +92,9 @@ index fb9ab0f6cc85..17f182198b06 100644 const Rect& display_rect() const { return display_rect_; } void SetDisplayRect(const Rect& r); -@@ -833,6 +837,8 @@ class GFX_EXPORT RenderText { - // The ratio of strike-through line thickness to text height. - SkScalar strike_thickness_factor_; +@@ -840,6 +844,8 @@ class GFX_EXPORT RenderText { + // Extra spacing placed between glyphs; used for obscured text styling. + int glyph_spacing_ = 0; + int draw_strings_flags_ = 0; + @@ -115,7 +115,7 @@ index 8ac475fa752c..ec58c2b28441 100644 static constexpr int kInkDropSmallCornerRadius = 2; static constexpr int kInkDropLargeCornerRadius = 4; diff --git ui/views/controls/button/label_button.cc ui/views/controls/button/label_button.cc -index 68be16e39a1d..8038f932444d 100644 +index 57e2b0a910f0..6a17ba24a7d3 100644 --- ui/views/controls/button/label_button.cc +++ ui/views/controls/button/label_button.cc @@ -188,6 +188,7 @@ gfx::Size LabelButton::CalculatePreferredSize() const { @@ -124,9 +124,9 @@ index 68be16e39a1d..8038f932444d 100644 label.SetShadows(label_->shadows()); + label.SetDrawStringsFlags(label_->draw_strings_flags()); - if (style_ == STYLE_BUTTON && PlatformStyle::kDefaultLabelButtonHasBoldFont) { + if (style_ == STYLE_BUTTON) { // Some text appears wider when rendered normally than when rendered bold. -@@ -399,6 +400,12 @@ std::unique_ptr LabelButton::CreateInkDropHighlight() +@@ -400,6 +401,12 @@ std::unique_ptr LabelButton::CreateInkDropHighlight() gfx::RectF(image()->GetMirroredBounds()).CenterPoint()); } @@ -140,7 +140,7 @@ index 68be16e39a1d..8038f932444d 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 bc5190a4bc76..053cb7ce900b 100644 +index 259c355b1d2d..d86f909d95ed 100644 --- ui/views/controls/button/label_button.h +++ ui/views/controls/button/label_button.h @@ -105,6 +105,9 @@ class VIEWS_EXPORT LabelButton : public Button, public NativeThemeDelegate { @@ -211,7 +211,7 @@ index e38200b8a43a..f40b079f82ec 100644 // The time is used for simulating menu behavior for the menu button; that // is, if the menu is shown and the button is pressed, we need to close the diff --git ui/views/controls/label.cc ui/views/controls/label.cc -index def97220e051..cbe1568cbda3 100644 +index df6851e8d212..8f5047f4aec7 100644 --- ui/views/controls/label.cc +++ ui/views/controls/label.cc @@ -25,6 +25,7 @@ @@ -243,7 +243,7 @@ index def97220e051..cbe1568cbda3 100644 } // namespace const char Label::kViewClassName[] = "Label"; -@@ -226,6 +241,15 @@ void Label::SetElideBehavior(gfx::ElideBehavior elide_behavior) { +@@ -224,6 +239,15 @@ void Label::SetElideBehavior(gfx::ElideBehavior elide_behavior) { ResetLayout(); } @@ -259,7 +259,7 @@ index def97220e051..cbe1568cbda3 100644 void Label::SetTooltipText(const base::string16& tooltip_text) { DCHECK(handles_tooltips_); tooltip_text_ = tooltip_text; -@@ -453,7 +477,19 @@ std::unique_ptr Label::CreateRenderText( +@@ -460,7 +484,19 @@ std::unique_ptr Label::CreateRenderText( render_text->SetFontList(font_list()); render_text->set_shadows(shadows()); render_text->SetCursorEnabled(false); @@ -304,10 +304,10 @@ index ab6487ee6a60..0b105a658e8f 100644 // TODO(ckocagil): Remove is_first_paint_text_ before crbug.com/441028 is // closed. diff --git ui/views/controls/menu/menu_controller.cc ui/views/controls/menu/menu_controller.cc -index 2f78dfd30849..313a26e85e3b 100644 +index 9389f25f034d..60f546b55951 100644 --- ui/views/controls/menu/menu_controller.cc +++ ui/views/controls/menu/menu_controller.cc -@@ -2262,8 +2262,13 @@ MenuItemView* MenuController::FindNextSelectableMenuItem( +@@ -2261,8 +2261,13 @@ MenuItemView* MenuController::FindNextSelectableMenuItem( void MenuController::OpenSubmenuChangeSelectionIfCan() { MenuItemView* item = pending_state_.item; @@ -322,7 +322,7 @@ index 2f78dfd30849..313a26e85e3b 100644 MenuItemView* to_select = NULL; if (item->GetSubmenu()->GetMenuItemCount() > 0) to_select = FindInitialSelectableMenuItem(item, INCREMENT_SELECTION_DOWN); -@@ -2278,8 +2283,10 @@ void MenuController::OpenSubmenuChangeSelectionIfCan() { +@@ -2277,8 +2282,10 @@ void MenuController::OpenSubmenuChangeSelectionIfCan() { void MenuController::CloseSubmenu() { MenuItemView* item = state_.item; DCHECK(item); @@ -521,7 +521,7 @@ index 0ac493c3c6a0..741769e90eb0 100644 void WillHideMenu(MenuItemView* menu) override; void OnMenuClosed(MenuItemView* menu) override; diff --git ui/views/controls/menu/menu_scroll_view_container.cc ui/views/controls/menu/menu_scroll_view_container.cc -index 08ba198141b2..595b3750c544 100644 +index fc9e3426f7c6..d0513a05eff1 100644 --- ui/views/controls/menu/menu_scroll_view_container.cc +++ ui/views/controls/menu/menu_scroll_view_container.cc @@ -184,6 +184,11 @@ MenuScrollViewContainer::MenuScrollViewContainer(SubmenuView* content_view) @@ -537,10 +537,10 @@ index 08ba198141b2..595b3750c544 100644 content_view_->GetMenuItem()->GetMenuController()->GetAnchorPosition()); diff --git ui/views/test/ui_controls_factory_desktop_aurax11.cc ui/views/test/ui_controls_factory_desktop_aurax11.cc -index 534e0c4cb41d..974d82da99cb 100644 +index 875ac82283b3..44424b2ce138 100644 --- ui/views/test/ui_controls_factory_desktop_aurax11.cc +++ ui/views/test/ui_controls_factory_desktop_aurax11.cc -@@ -147,10 +147,6 @@ class UIControlsDesktopX11 : public UIControlsAura { +@@ -140,10 +140,6 @@ class UIControlsDesktopX11 : public UIControlsAura { aura::test::QueryLatestMousePositionRequestInHost(host); host->ConvertPixelsToDIP(&root_current_location); @@ -552,7 +552,7 @@ index 534e0c4cb41d..974d82da99cb 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 bfacdb72edaa..b7684349c0cc 100644 +index da4b110ecec8..f03291dcd330 100644 --- ui/views/view.h +++ ui/views/view.h @@ -18,6 +18,7 @@ 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 26bb44e2e..6ced73a10 100644 --- a/patch/patches/views_widget_180_1481_1565_1677_1749.patch +++ b/patch/patches/views_widget_180_1481_1565_1677_1749.patch @@ -1,9 +1,9 @@ diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc -index 964578b4d170..6a3f3c347031 100644 +index 34248e7b2ef8..8ed9c3759202 100644 --- content/browser/renderer_host/render_widget_host_view_base.cc +++ content/browser/renderer_host/render_widget_host_view_base.cc -@@ -301,6 +301,14 @@ void RenderWidgetHostViewBase::FocusedNodeTouched( - DVLOG(1) << "FocusedNodeTouched: " << editable; +@@ -326,6 +326,14 @@ void RenderWidgetHostViewBase::GetScreenInfo(ScreenInfo* screen_info) { + host->delegate()->GetScreenInfo(screen_info); } +void RenderWidgetHostViewBase::SetHasExternalParent(bool val) { @@ -18,10 +18,10 @@ index 964578b4d170..6a3f3c347031 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 1764ea8c31cd..c772ae729d08 100644 +index aac5858b18d8..652b07955fe8 100644 --- content/browser/renderer_host/render_widget_host_view_base.h +++ content/browser/renderer_host/render_widget_host_view_base.h -@@ -82,6 +82,7 @@ class BrowserAccessibilityManager; +@@ -83,6 +83,7 @@ class BrowserAccessibilityManager; class CursorManager; class RenderWidgetHostImpl; class RenderWidgetHostViewBaseObserver; @@ -29,7 +29,7 @@ index 1764ea8c31cd..c772ae729d08 100644 class SyntheticGestureTarget; class TextInputManager; class TouchSelectionControllerClientManager; -@@ -99,6 +100,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -100,6 +101,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, float current_device_scale_factor() const { return current_device_scale_factor_; } @@ -39,16 +39,16 @@ index 1764ea8c31cd..c772ae729d08 100644 // Returns the focused RenderWidgetHost inside this |view|'s RWH. RenderWidgetHostImpl* GetFocusedWidget() const; -@@ -128,6 +132,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, - void EndFrameSubscription() override; +@@ -130,6 +134,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, void FocusedNodeTouched(const gfx::Point& location_dips_screen, bool editable) override; + void GetScreenInfo(ScreenInfo* screen_info) override; + void SetHasExternalParent(bool val) override; + bool HasExternalParent() const override; TouchSelectionControllerClientManager* GetTouchSelectionControllerClientManager() override; -@@ -376,6 +382,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -396,6 +402,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, // helps to position the full screen widget on the correct monitor. virtual void InitAsFullscreen(RenderWidgetHostView* reference_host_view) = 0; @@ -61,7 +61,7 @@ index 1764ea8c31cd..c772ae729d08 100644 // Sets the cursor for this view to the one associated with the specified // cursor_type. virtual void UpdateCursor(const WebCursor& cursor) = 0; -@@ -519,6 +531,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -542,6 +554,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, WebContentsAccessibility* web_contents_accessibility_; @@ -73,7 +73,7 @@ index 1764ea8c31cd..c772ae729d08 100644 #if defined(USE_AURA) void OnDidScheduleEmbed(int routing_id, 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 02614b2e7eff..38c207888aba 100644 +index 8302a8563d85..7ae0a870071c 100644 --- content/browser/renderer_host/render_widget_host_view_event_handler.cc +++ content/browser/renderer_host/render_widget_host_view_event_handler.cc @@ -28,6 +28,10 @@ @@ -87,7 +87,7 @@ index 02614b2e7eff..38c207888aba 100644 #if defined(OS_WIN) #include "content/browser/frame_host/render_frame_host_impl.h" #include "content/public/common/context_menu_params.h" -@@ -850,6 +854,14 @@ void RenderWidgetHostViewEventHandler::SetKeyboardFocus() { +@@ -857,6 +861,14 @@ void RenderWidgetHostViewEventHandler::SetKeyboardFocus() { ::SetFocus(hwnd); } } @@ -103,12 +103,12 @@ index 02614b2e7eff..38c207888aba 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 995f917d9ebc..dbbd8833b6fe 100644 +index 6aa5a869ddc3..e00559a2958a 100644 --- content/public/browser/render_widget_host_view.h +++ content/public/browser/render_widget_host_view.h -@@ -236,6 +236,14 @@ class CONTENT_EXPORT RenderWidgetHostView { - // when the value has changed. Views must initially default to false. - virtual void SetNeedsBeginFrames(bool needs_begin_frames) = 0; +@@ -248,6 +248,14 @@ class CONTENT_EXPORT RenderWidgetHostView { + // This method returns the ScreenInfo used by the view to render. + virtual void GetScreenInfo(ScreenInfo* screen_info) = 0; + // Set whether the widget has a external parent view/window outside of the + // Chromium-controlled view/window hierarchy. @@ -135,7 +135,7 @@ index f772f64d656e..7d13f9f81b6c 100644 return host ? host->GetAcceleratedWidget() : NULL; } 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 8e0c55fbba08..49e519244c97 100644 +index 2128b18525f1..66420b860fc1 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -84,6 +84,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( @@ -160,7 +160,7 @@ index 8e0c55fbba08..49e519244c97 100644 remove_standard_frame_ = params.remove_standard_frame; has_non_client_view_ = Widget::RequiresNonClientView(params.type); -@@ -829,11 +834,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() { +@@ -832,11 +837,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() { } void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { @@ -194,10 +194,10 @@ index db66147f0e9c..2b9bdfa2ec53 100644 // 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 ebb251545434..14f1320470cd 100644 +index 88486500f8d8..b1743e330a3d 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc -@@ -152,6 +152,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( +@@ -147,6 +147,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( use_native_frame_(false), should_maximize_after_map_(false), use_argb_visual_(false), @@ -205,7 +205,7 @@ index ebb251545434..14f1320470cd 100644 drag_drop_client_(NULL), native_widget_delegate_(native_widget_delegate), desktop_native_widget_aura_(desktop_native_widget_aura), -@@ -165,6 +166,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( +@@ -160,6 +161,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( has_window_focus_(false), has_pointer_focus_(false), modal_dialog_counter_(0), @@ -213,7 +213,7 @@ index ebb251545434..14f1320470cd 100644 close_widget_factory_(this), weak_factory_(this) {} -@@ -200,6 +202,8 @@ std::vector DesktopWindowTreeHostX11::GetAllOpenWindows() { +@@ -195,6 +197,8 @@ std::vector DesktopWindowTreeHostX11::GetAllOpenWindows() { } gfx::Rect DesktopWindowTreeHostX11::GetX11RootWindowBounds() const { @@ -222,17 +222,17 @@ index ebb251545434..14f1320470cd 100644 return bounds_in_pixels_; } -@@ -511,7 +515,8 @@ void DesktopWindowTreeHostX11::CloseNow() { +@@ -506,7 +510,8 @@ void DesktopWindowTreeHostX11::CloseNow() { // Actually free our native resources. if (ui::PlatformEventSource::GetInstance()) ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); - XDestroyWindow(xdisplay_, xwindow_); + if (!xwindow_destroyed_) + XDestroyWindow(xdisplay_, xwindow_); - xwindow_ = None; + xwindow_ = x11::None; desktop_native_widget_aura_->OnHostClosed(); -@@ -652,6 +657,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( +@@ -647,6 +652,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( } gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const { @@ -241,7 +241,7 @@ index ebb251545434..14f1320470cd 100644 return ToDIPRect(bounds_in_pixels_); } -@@ -1247,6 +1254,8 @@ void DesktopWindowTreeHostX11::SetBoundsInPixels( +@@ -1243,6 +1250,8 @@ void DesktopWindowTreeHostX11::SetBoundsInPixels( } gfx::Point DesktopWindowTreeHostX11::GetLocationOnScreenInPixels() const { @@ -250,15 +250,15 @@ index ebb251545434..14f1320470cd 100644 return bounds_in_pixels_.origin(); } -@@ -1339,7 +1348,6 @@ void DesktopWindowTreeHostX11::InitX11Window( +@@ -1335,7 +1344,6 @@ void DesktopWindowTreeHostX11::InitX11Window( ::Atom window_type; switch (params.type) { case Widget::InitParams::TYPE_MENU: -- swa.override_redirect = True; +- swa.override_redirect = x11::True; window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_MENU"); break; case Widget::InitParams::TYPE_TOOLTIP: -@@ -1395,9 +1403,15 @@ void DesktopWindowTreeHostX11::InitX11Window( +@@ -1391,9 +1399,15 @@ void DesktopWindowTreeHostX11::InitX11Window( attribute_mask |= CWBorderPixel; swa.border_pixel = 0; @@ -275,7 +275,7 @@ index ebb251545434..14f1320470cd 100644 bounds_in_pixels_.y(), bounds_in_pixels_.width(), bounds_in_pixels_.height(), 0, // border width -@@ -2012,6 +2026,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( +@@ -2010,6 +2024,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( } break; } @@ -287,10 +287,10 @@ index ebb251545434..14f1320470cd 100644 case FocusOut: OnFocusEvent(xev->type == FocusIn, event->xfocus.mode, 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 a47b80fe8a82..624ac7764c83 100644 +index fcf87700458c..9aecc0e48939 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h -@@ -86,6 +86,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -84,6 +84,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // Disables event listening to make |dialog| modal. std::unique_ptr DisableEventListening(); @@ -303,7 +303,7 @@ index a47b80fe8a82..624ac7764c83 100644 protected: // Overridden from DesktopWindowTreeHost: void Init(aura::Window* content_window, -@@ -308,6 +314,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -301,6 +307,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // The bounds of |xwindow_|. gfx::Rect bounds_in_pixels_; @@ -313,7 +313,7 @@ index a47b80fe8a82..624ac7764c83 100644 // Whenever the bounds are set, we keep the previous set of bounds around so // we can have a better chance of getting the real // |restored_bounds_in_pixels_|. Window managers tend to send a Configure -@@ -347,6 +356,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -340,6 +349,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // Whether we used an ARGB visual for our window. bool use_argb_visual_; @@ -324,7 +324,7 @@ index a47b80fe8a82..624ac7764c83 100644 DesktopDragDropClientAuraX11* drag_drop_client_; std::unique_ptr x11_non_client_event_filter_; -@@ -434,6 +447,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -427,6 +440,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 uint32_t modal_dialog_counter_; @@ -335,7 +335,7 @@ index a47b80fe8a82..624ac7764c83 100644 base::WeakPtrFactory weak_factory_; diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc -index 8911591f9afa..a0103f5aeb99 100644 +index d685bf4f40e3..2e22ba96827e 100644 --- ui/views/widget/widget.cc +++ ui/views/widget/widget.cc @@ -130,6 +130,7 @@ Widget::InitParams::InitParams(Type type) @@ -427,10 +427,10 @@ index 163e4b54b033..58f594db5019 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 9776325defc8..f86f1409bdd2 100644 +index 60c6c0e235ea..7a08a49320a2 100644 --- ui/views/win/hwnd_message_handler.cc +++ ui/views/win/hwnd_message_handler.cc -@@ -2664,8 +2664,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -2665,8 +2665,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, active_mouse_tracking_flags_ = 0; } else if (event.type() == ui::ET_MOUSEWHEEL) { // Reroute the mouse wheel to the window under the pointer if applicable. diff --git a/patch/patches/web_contents_1257_1565.patch b/patch/patches/web_contents_1257_1565.patch index e2c731d44..c2404404d 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 7297db47cf2d..d47c44680415 100644 +index c1ae2a911735..e45e3e388a5e 100644 --- content/browser/web_contents/web_contents_impl.cc +++ content/browser/web_contents/web_contents_impl.cc -@@ -1762,6 +1762,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1783,6 +1783,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { std::string unique_name; frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name); @@ -15,15 +15,15 @@ index 7297db47cf2d..d47c44680415 100644 WebContentsViewDelegate* delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); -@@ -1772,6 +1778,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { - view_.reset(CreateWebContentsView(this, delegate, - &render_view_host_delegate_view_)); +@@ -1837,6 +1843,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { + GetRenderViewHost()->DispatchRenderViewCreated(); + GetRenderManager()->current_frame_host()->SetRenderFrameCreated(true); } + } - if (browser_plugin_guest_ && !GuestMode::IsCrossProcessFrameGuest(this)) { - view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(), -@@ -2340,6 +2347,15 @@ void WebContentsImpl::CreateNewWindow( + // Create the renderer process in advance if requested. + if (params.initialize_renderer) { +@@ -2349,6 +2356,15 @@ void WebContentsImpl::CreateNewWindow( create_params.renderer_initiated_creation = main_frame_route_id != MSG_ROUTING_NONE; @@ -36,10 +36,10 @@ index 7297db47cf2d..d47c44680415 100644 + &create_params.delegate_view); + } + - WebContentsImpl* new_contents = NULL; + WebContentsImpl* new_contents = nullptr; if (!is_guest) { create_params.context = view_->GetNativeView(); -@@ -2369,7 +2385,7 @@ void WebContentsImpl::CreateNewWindow( +@@ -2378,7 +2394,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( @@ -48,7 +48,7 @@ index 7297db47cf2d..d47c44680415 100644 } // Save the created window associated with the route so we can show it // later. -@@ -5507,7 +5523,7 @@ InterstitialPageImpl* WebContentsImpl::GetInterstitialForRenderManager() { +@@ -5546,7 +5562,7 @@ InterstitialPageImpl* WebContentsImpl::GetInterstitialForRenderManager() { void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager( RenderViewHost* render_view_host) { RenderWidgetHostViewBase* rwh_view = @@ -58,26 +58,26 @@ index 7297db47cf2d..d47c44680415 100644 // Now that the RenderView has been created, we need to tell it its size. if (rwh_view) diff --git content/public/browser/web_contents.cc content/public/browser/web_contents.cc -index fa0afb545df9..d677b310e5ec 100644 +index 53d56abb35a3..d7b955f42ca5 100644 --- content/public/browser/web_contents.cc +++ content/public/browser/web_contents.cc -@@ -29,7 +29,9 @@ WebContents::CreateParams::CreateParams(BrowserContext* context, - guest_delegate(nullptr), +@@ -30,7 +30,9 @@ WebContents::CreateParams::CreateParams(BrowserContext* context, context(nullptr), renderer_initiated_creation(false), -- initialize_renderer(false) { -+ initialize_renderer(false), + initialize_renderer(false), +- starting_sandbox_flags(blink::WebSandboxFlags::kNone) {} ++ starting_sandbox_flags(blink::WebSandboxFlags::kNone), + view(nullptr), -+ delegate_view(nullptr) { - } ++ delegate_view(nullptr) {} WebContents::CreateParams::CreateParams(const CreateParams& other) = default; + diff --git content/public/browser/web_contents.h content/public/browser/web_contents.h -index 453942537f6c..be871fbb677b 100644 +index d6252667ed68..83265f9b6b41 100644 --- content/public/browser/web_contents.h +++ content/public/browser/web_contents.h -@@ -68,9 +68,11 @@ class InterstitialPage; - class PageState; +@@ -68,9 +68,11 @@ class BrowserPluginGuestDelegate; + class InterstitialPage; class RenderFrameHost; class RenderViewHost; +class RenderViewHostDelegateView; @@ -88,10 +88,10 @@ index 453942537f6c..be871fbb677b 100644 struct CustomContextMenuContext; struct DropData; struct Manifest; -@@ -170,6 +172,10 @@ class WebContents : public PageNavigator, - // Note that the pre-created renderer process may not be used if the first - // navigation requires a dedicated or privileged process, such as a WebUI. - bool initialize_renderer; +@@ -173,6 +175,10 @@ class WebContents : public PageNavigator, + + // Sandboxing flags set on the new WebContents. + blink::WebSandboxFlags starting_sandbox_flags; + + // Optionally specify the view and delegate view. + content::WebContentsView* view; @@ -100,12 +100,12 @@ index 453942537f6c..be871fbb677b 100644 // Creates a new WebContents. diff --git content/public/browser/web_contents_delegate.h content/public/browser/web_contents_delegate.h -index 3f31a372ecbb..0958fe90bb31 100644 +index 37db677b7438..4f4a8574e47d 100644 --- content/public/browser/web_contents_delegate.h +++ content/public/browser/web_contents_delegate.h -@@ -44,11 +44,13 @@ class ColorChooser; +@@ -43,11 +43,13 @@ namespace content { + class ColorChooser; class JavaScriptDialogManager; - class PageState; class RenderFrameHost; +class RenderViewHostDelegateView; class RenderWidgetHost; @@ -117,7 +117,7 @@ index 3f31a372ecbb..0958fe90bb31 100644 struct ColorSuggestion; struct ContextMenuParams; struct DropData; -@@ -318,6 +320,14 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -308,6 +310,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 4f05469a1..a675293fa 100644 --- a/patch/patches/webkit_plugin_info_2015.patch +++ b/patch/patches/webkit_plugin_info_2015.patch @@ -1,11 +1,11 @@ diff --git third_party/WebKit/Source/core/dom/DOMImplementation.cpp third_party/WebKit/Source/core/dom/DOMImplementation.cpp -index b26a7d6b8413..476b5c138555 100644 +index 1d861b036458..3b20c991659b 100644 --- third_party/WebKit/Source/core/dom/DOMImplementation.cpp +++ third_party/WebKit/Source/core/dom/DOMImplementation.cpp @@ -242,10 +242,11 @@ Document* DOMImplementation::createDocument(const String& type, // For that reason, the origin must be retrieved directly from init.url(). if (init.GetFrame()->IsMainFrame()) { - RefPtr origin = SecurityOrigin::Create(init.Url()); + scoped_refptr origin = SecurityOrigin::Create(init.Url()); - plugin_data = init.GetFrame()->GetPage()->GetPluginData(origin.get()); + plugin_data = init.GetFrame()->GetPage()->GetPluginData(true, + origin.get()); @@ -17,10 +17,10 @@ index b26a7d6b8413..476b5c138555 100644 .Top() .GetSecurityContext() diff --git third_party/WebKit/Source/core/frame/LocalFrame.cpp third_party/WebKit/Source/core/frame/LocalFrame.cpp -index bf29beabedf7..e45901940d91 100644 +index 123258b23cb2..f00869df94e3 100644 --- third_party/WebKit/Source/core/frame/LocalFrame.cpp +++ third_party/WebKit/Source/core/frame/LocalFrame.cpp -@@ -1026,7 +1026,7 @@ FrameResourceCoordinator* LocalFrame::GetFrameResourceCoordinator() { +@@ -1046,7 +1046,7 @@ FrameResourceCoordinator* LocalFrame::GetFrameResourceCoordinator() { PluginData* LocalFrame::GetPluginData() const { if (!Loader().AllowPlugins(kNotAboutToInstantiatePlugin)) return nullptr; @@ -30,10 +30,10 @@ index bf29beabedf7..e45901940d91 100644 } diff --git third_party/WebKit/Source/core/page/Page.cpp third_party/WebKit/Source/core/page/Page.cpp -index 769fb58698a4..5372984b342a 100644 +index c6071e8ba68e..4304cc95ba2e 100644 --- third_party/WebKit/Source/core/page/Page.cpp +++ third_party/WebKit/Source/core/page/Page.cpp -@@ -126,7 +126,8 @@ Page::Page(PageClients& page_clients) +@@ -129,7 +129,8 @@ Page::Page(PageClients& page_clients) overscroll_controller_( OverscrollController::Create(GetVisualViewport(), GetChromeClient())), main_frame_(nullptr), @@ -41,9 +41,9 @@ index 769fb58698a4..5372984b342a 100644 + plugin_data_main_frame_(nullptr), + plugin_data_sub_frame_(nullptr), editor_client_(page_clients.editor_client), - spell_checker_client_(page_clients.spell_checker_client), use_counter_(page_clients.chrome_client && -@@ -300,21 +301,38 @@ void Page::RefreshPlugins() { + page_clients.chrome_client->IsSVGImageChromeClient() +@@ -303,21 +304,38 @@ void Page::RefreshPlugins() { PluginData::RefreshBrowserSidePluginCache(); } @@ -91,7 +91,7 @@ index 769fb58698a4..5372984b342a 100644 page->NotifyPluginsChanged(); } } -@@ -661,7 +679,8 @@ DEFINE_TRACE(Page) { +@@ -675,7 +693,8 @@ void Page::Trace(blink::Visitor* visitor) { visitor->Trace(visual_viewport_); visitor->Trace(overscroll_controller_); visitor->Trace(main_frame_); @@ -102,7 +102,7 @@ index 769fb58698a4..5372984b342a 100644 visitor->Trace(use_counter_); visitor->Trace(plugins_changed_observers_); diff --git third_party/WebKit/Source/core/page/Page.h third_party/WebKit/Source/core/page/Page.h -index 0ba364b0a934..e9b79de58841 100644 +index 1a02eb31d52a..d7d2c372f0c9 100644 --- third_party/WebKit/Source/core/page/Page.h +++ third_party/WebKit/Source/core/page/Page.h @@ -135,7 +135,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, @@ -115,7 +115,7 @@ index 0ba364b0a934..e9b79de58841 100644 // Refreshes the browser-side plugin cache. static void RefreshPlugins(); -@@ -351,7 +352,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, +@@ -361,7 +362,8 @@ class CORE_EXPORT Page final : public GarbageCollectedFinalized, // longer needed. Member main_frame_; @@ -124,12 +124,12 @@ index 0ba364b0a934..e9b79de58841 100644 + Member plugin_data_sub_frame_; EditorClient* const editor_client_; - SpellCheckerClient* const spell_checker_client_; + SpellCheckStatus spell_check_status_ = SpellCheckStatus::kAutomatic; diff --git third_party/WebKit/Source/platform/plugins/PluginData.cpp third_party/WebKit/Source/platform/plugins/PluginData.cpp -index 5eb6af5fbdd5..eac85461c7de 100644 +index 385972d2e150..88a8e018b2e2 100644 --- third_party/WebKit/Source/platform/plugins/PluginData.cpp +++ third_party/WebKit/Source/platform/plugins/PluginData.cpp -@@ -79,16 +79,18 @@ DEFINE_TRACE(PluginData) { +@@ -79,16 +79,18 @@ void PluginData::Trace(blink::Visitor* visitor) { // static void PluginData::RefreshBrowserSidePluginCache() { PluginListBuilder builder(nullptr); @@ -152,10 +152,10 @@ index 5eb6af5fbdd5..eac85461c7de 100644 for (PluginInfo* plugin_info : plugins_) { for (MimeClassInfo* mime_class_info : plugin_info->mimes_) diff --git third_party/WebKit/Source/platform/plugins/PluginData.h third_party/WebKit/Source/platform/plugins/PluginData.h -index 14a944467373..f4333c6a5f09 100644 +index c2bdba557a6b..039446cef015 100644 --- third_party/WebKit/Source/platform/plugins/PluginData.h +++ third_party/WebKit/Source/platform/plugins/PluginData.h -@@ -94,7 +94,7 @@ class PLATFORM_EXPORT PluginData final +@@ -95,7 +95,7 @@ class PLATFORM_EXPORT PluginData final const HeapVector>& Plugins() const { return plugins_; } const HeapVector>& Mimes() const { return mimes_; } const SecurityOrigin* Origin() const { return main_frame_origin_.get(); } @@ -165,10 +165,10 @@ index 14a944467373..f4333c6a5f09 100644 bool SupportsMimeType(const String& mime_type) const; diff --git third_party/WebKit/public/platform/Platform.h third_party/WebKit/public/platform/Platform.h -index 379b033facc4..fcea4c7171b7 100644 +index 09c2e1516512..00f634a16dc5 100644 --- third_party/WebKit/public/platform/Platform.h +++ third_party/WebKit/public/platform/Platform.h -@@ -369,6 +369,7 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -377,6 +377,7 @@ class BLINK_PLATFORM_EXPORT Platform { // satisfy this call. mainFrameOrigin is used by the browser process to // filter plugins from the plugin list based on content settings. virtual void GetPluginList(bool refresh, diff --git a/patch/patches/webkit_popups.patch b/patch/patches/webkit_popups.patch index 5c32e5b47..422c2a993 100644 --- a/patch/patches/webkit_popups.patch +++ b/patch/patches/webkit_popups.patch @@ -1,8 +1,8 @@ diff --git third_party/WebKit/Source/core/exported/WebViewImpl.cpp third_party/WebKit/Source/core/exported/WebViewImpl.cpp -index 1cc7c6eb7182..67129b9719b5 100644 +index b73e62a0420f..b9b463b87031 100644 --- third_party/WebKit/Source/core/exported/WebViewImpl.cpp +++ third_party/WebKit/Source/core/exported/WebViewImpl.cpp -@@ -249,8 +249,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { +@@ -256,8 +256,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { g_should_use_external_popup_menus = use_external_popup_menus; } @@ -18,7 +18,7 @@ index 1cc7c6eb7182..67129b9719b5 100644 } namespace { -@@ -346,6 +351,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, +@@ -352,6 +357,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, enable_fake_page_scale_animation_for_testing_(false), fake_page_scale_animation_page_scale_factor_(0), fake_page_scale_animation_use_anchor_(false), @@ -27,10 +27,10 @@ index 1cc7c6eb7182..67129b9719b5 100644 suppress_next_keypress_event_(false), ime_accept_events_(true), diff --git third_party/WebKit/Source/core/exported/WebViewImpl.h third_party/WebKit/Source/core/exported/WebViewImpl.h -index 820c1d2a8500..653c868a8444 100644 +index bfacefa1cf8b..9361917e0a3b 100644 --- third_party/WebKit/Source/core/exported/WebViewImpl.h +++ third_party/WebKit/Source/core/exported/WebViewImpl.h -@@ -108,7 +108,8 @@ class CORE_EXPORT WebViewImpl final +@@ -107,7 +107,8 @@ class CORE_EXPORT WebViewImpl final static const WebInputEvent* CurrentInputEvent(); // Returns true if popup menus should be rendered by the browser, false if // they should be rendered by WebKit (which is the default). @@ -40,7 +40,7 @@ index 820c1d2a8500..653c868a8444 100644 // WebWidget methods: void Close() override; -@@ -613,6 +614,8 @@ class CORE_EXPORT WebViewImpl final +@@ -608,6 +609,8 @@ class CORE_EXPORT WebViewImpl final float fake_page_scale_animation_page_scale_factor_; bool fake_page_scale_animation_use_anchor_; @@ -50,10 +50,10 @@ index 820c1d2a8500..653c868a8444 100644 TransformationMatrix device_emulation_transform_; diff --git third_party/WebKit/Source/core/page/ChromeClientImpl.cpp third_party/WebKit/Source/core/page/ChromeClientImpl.cpp -index a68ce2c67710..c85fd4cdfa43 100644 +index 129f3f1cb6c7..4dafa0474923 100644 --- third_party/WebKit/Source/core/page/ChromeClientImpl.cpp +++ third_party/WebKit/Source/core/page/ChromeClientImpl.cpp -@@ -774,7 +774,7 @@ PopupMenu* ChromeClientImpl::OpenPopupMenu(LocalFrame& frame, +@@ -777,7 +777,7 @@ PopupMenu* ChromeClientImpl::OpenPopupMenu(LocalFrame& frame, return nullptr; NotifyPopupOpeningObservers(); @@ -63,10 +63,10 @@ index a68ce2c67710..c85fd4cdfa43 100644 DCHECK(RuntimeEnabledFeatures::PagePopupEnabled()); diff --git third_party/WebKit/public/web/WebView.h third_party/WebKit/public/web/WebView.h -index 03bfa9b85e7e..6f970fe0802e 100644 +index ccaade785697..61a406fb4ee1 100644 --- third_party/WebKit/public/web/WebView.h +++ third_party/WebKit/public/web/WebView.h -@@ -367,6 +367,7 @@ class WebView : protected WebWidget { +@@ -361,6 +361,7 @@ class WebView : protected WebWidget { // Sets whether select popup menus should be rendered by the browser. BLINK_EXPORT static void SetUseExternalPopupMenus(bool); diff --git a/patch/patches/webui_2037.patch b/patch/patches/webui_2037.patch index a6dbd71f8..e1e44b9de 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 6b81e1e0f6c5..7509c2b18b47 100644 +index ff39e3e2b103..a507deeef179 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 @@ -164,6 +164,10 @@ void ChromeInternalLogSource::Fetch(const SysLogsSourceCallback& callback) { @@ -14,10 +14,10 @@ index 6b81e1e0f6c5..7509c2b18b47 100644 Profile* profile = ProfileManager::GetPrimaryUserProfile(); if (!profile || diff --git chrome/browser/ui/webui/net_internals/net_internals_ui.cc chrome/browser/ui/webui/net_internals/net_internals_ui.cc -index 442ee5b2a91f..23c3feb4dea3 100644 +index c45df62f3d56..78b855d34d73 100644 --- chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ chrome/browser/ui/webui/net_internals/net_internals_ui.cc -@@ -515,41 +515,31 @@ void NetInternalsMessageHandler::OnClearBrowserCache( +@@ -553,41 +553,31 @@ void NetInternalsMessageHandler::OnClearBrowserCache( void NetInternalsMessageHandler::OnGetPrerenderInfo( const base::ListValue* list) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -64,7 +64,7 @@ index 442ee5b2a91f..23c3feb4dea3 100644 } //////////////////////////////////////////////////////////////////////////////// -@@ -629,9 +619,17 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( +@@ -667,9 +657,17 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( PrePopulateEventList(); @@ -85,7 +85,7 @@ index 442ee5b2a91f..23c3feb4dea3 100644 } void NetInternalsMessageHandler::IOThreadImpl::OnGetNetInfo( -@@ -1105,7 +1103,8 @@ void NetInternalsMessageHandler::IOThreadImpl::PrePopulateEventList() { +@@ -1181,7 +1179,8 @@ void NetInternalsMessageHandler::IOThreadImpl::PrePopulateEventList() { std::set contexts; for (const auto& getter : context_getters_) contexts.insert(getter->GetURLRequestContext()); @@ -96,10 +96,10 @@ index 442ee5b2a91f..23c3feb4dea3 100644 // Add entries for ongoing network objects. CreateNetLogEntriesForActiveObjects(contexts, this); diff --git content/browser/resource_context_impl.cc content/browser/resource_context_impl.cc -index 141a08305332..b16b4d61988d 100644 +index 895a9367b85b..eeb9c6922a3c 100644 --- content/browser/resource_context_impl.cc +++ content/browser/resource_context_impl.cc -@@ -58,6 +58,10 @@ URLDataManagerBackend* GetURLDataManagerForResourceContext( +@@ -57,6 +57,10 @@ URLDataManagerBackend* GetURLDataManagerForResourceContext( context->GetUserData(kURLDataManagerBackendKeyName)); } @@ -124,7 +124,7 @@ index 903cc543a242..5bd30ae82974 100644 CONTENT_EXPORT void InitializeResourceContext(BrowserContext* browser_context); diff --git content/browser/webui/url_data_manager.cc content/browser/webui/url_data_manager.cc -index f45d227fe94a..32e37bd0a79e 100644 +index bdfc5d93765c..5464716aead4 100644 --- content/browser/webui/url_data_manager.cc +++ content/browser/webui/url_data_manager.cc @@ -150,6 +150,11 @@ void URLDataManager::UpdateWebUIDataSource( diff --git a/patch/patches/webview_plugin_2020.patch b/patch/patches/webview_plugin_2020.patch index 4dcb839e8..0e1530cfd 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 acf5d47d03b2..1d126bb79633 100644 +index 991b42c3e041..ecdc0aaad9a5 100644 --- chrome/app/generated_resources.grd +++ chrome/app/generated_resources.grd -@@ -4807,7 +4807,7 @@ Keep your key file in a safe place. You will need it to create new versions of y +@@ -4928,7 +4928,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 4a504d914..5ff030352 100644 --- a/patch/patches/win_rt_2274.patch +++ b/patch/patches/win_rt_2274.patch @@ -1,18 +1,18 @@ -diff --git content/common/sandbox_win.cc content/common/sandbox_win.cc -index 3c8150376bbe..5d505838ec1d 100644 ---- content/common/sandbox_win.cc -+++ content/common/sandbox_win.cc -@@ -783,8 +783,11 @@ sandbox::ResultCode StartSandboxedProcess( +diff --git services/service_manager/sandbox/win/sandbox_win.cc services/service_manager/sandbox/win/sandbox_win.cc +index b66f6b27b4e4..56f69739320a 100644 +--- services/service_manager/sandbox/win/sandbox_win.cc ++++ services/service_manager/sandbox/win/sandbox_win.cc +@@ -757,8 +757,11 @@ sandbox::ResultCode SandboxWin::StartSandboxedProcess( #endif // Post-startup mitigations. - mitigations = sandbox::MITIGATION_STRICT_HANDLE_CHECKS | - sandbox::MITIGATION_DLL_SEARCH_ORDER; + mitigations = sandbox::MITIGATION_DLL_SEARCH_ORDER; -+ if (!browser_command_line.HasSwitch("win-rt-app")) { ++ if (!launcher_process_command_line.HasSwitch("win-rt-app")) { + // Don't enable this mitigation in WinRT apps. See issue #2274. + mitigations |= sandbox::MITIGATION_STRICT_HANDLE_CHECKS; + } - if (base::FeatureList::IsEnabled(features::kWinSboxForceMsSigned)) - mitigations |= sandbox::MITIGATION_FORCE_MS_SIGNED_BINS; - + if (base::FeatureList::IsEnabled( + service_manager::features::kWinSboxForceMsSigned) && + !cmd_line->HasSwitch(switches::kAllowThirdPartyModules)) { diff --git a/tests/cefclient/browser/osr_accessibility_node_win.cc b/tests/cefclient/browser/osr_accessibility_node_win.cc index ba025ec76..73e6f9478 100644 --- a/tests/cefclient/browser/osr_accessibility_node_win.cc +++ b/tests/cefclient/browser/osr_accessibility_node_win.cc @@ -214,13 +214,15 @@ struct CefIAccessible : public IAccessible { EXCEPINFO FAR* pExcepInfo, unsigned int FAR* puArgErr); - CefIAccessible(OsrAXNode* node) : node_(node), ref_count_(0) {} + CefIAccessible(OsrAXNode* node) : ref_count_(0), node_(node) {} // Remove the node reference when OsrAXNode is destroyed, so that // MSAA clients get CO_E_OBJNOTCONNECTED void MarkDestroyed() { node_ = NULL; } protected: + virtual ~CefIAccessible() {} + // Ref Count ULONG ref_count_; // OsrAXNode* proxy object @@ -680,8 +682,7 @@ CefNativeAccessible* OsrAXNode::GetNativeAccessibleObject(OsrAXNode* parent) { namespace client { -void OsrAXNode::NotifyAccessibilityEvent(std::string event_type) const { -} +void OsrAXNode::NotifyAccessibilityEvent(std::string event_type) const {} void OsrAXNode::Destroy() {} diff --git a/tests/cefclient/browser/osr_dragdrop_win.cc b/tests/cefclient/browser/osr_dragdrop_win.cc index 206eb2452..317ab1e8a 100644 --- a/tests/cefclient/browser/osr_dragdrop_win.cc +++ b/tests/cefclient/browser/osr_dragdrop_win.cc @@ -69,7 +69,7 @@ template void GetStorageForString(STGMEDIUM* stgmed, const std::basic_string& data) { GetStorageForBytes( stgmed, data.c_str(), - (data.size() + 1) * sizeof(std::basic_string::value_type)); + (data.size() + 1) * sizeof(typename std::basic_string::value_type)); } void GetStorageForFileDescriptor(STGMEDIUM* storage, @@ -269,7 +269,7 @@ bool DragDataToDataObject(CefRefPtr drag_data, } DCHECK_LT(curr_index, kMaxDataObjects); - CComPtr obj = + CComPtr obj = DataObjectWin::Create(fmtetcs, stgmeds, curr_index); (*data_object) = obj.Detach(); return true; @@ -389,7 +389,7 @@ CefBrowserHost::DragOperationsMask DropTargetWin::StartDragging( CComPtr dataObject; DWORD resEffect = DROPEFFECT_NONE; if (DragDataToDataObject(drag_data, &dataObject)) { - CComPtr dropSource = DropSourceWin::Create(); + CComPtr dropSource = DropSourceWin::Create(); DWORD effect = DragOperationToDropEffect(allowed_ops); current_drag_data_ = drag_data->Clone(); current_drag_data_->ResetFileContents(); diff --git a/tests/cefclient/browser/osr_dragdrop_win.h b/tests/cefclient/browser/osr_dragdrop_win.h index 7bb4fcba8..823b9fc37 100644 --- a/tests/cefclient/browser/osr_dragdrop_win.h +++ b/tests/cefclient/browser/osr_dragdrop_win.h @@ -130,7 +130,7 @@ class DragEnumFormatEtc : public IEnumFORMATETC { // Construction / Destruction // DragEnumFormatEtc(FORMATETC* pFormatEtc, int nNumFormats); - ~DragEnumFormatEtc(); + virtual ~DragEnumFormatEtc(); static void DeepCopyFormatEtc(FORMATETC* dest, FORMATETC* source); @@ -181,6 +181,7 @@ class DataObjectWin : public IDataObject { int LookupFormatEtc(FORMATETC* pFormatEtc); explicit DataObjectWin(FORMATETC* fmtetc, STGMEDIUM* stgmed, int count); + virtual ~DataObjectWin() {} }; } // namespace client diff --git a/tests/cefclient/browser/osr_ime_handler_win.cc b/tests/cefclient/browser/osr_ime_handler_win.cc index 495525e73..aac4d3d2a 100644 --- a/tests/cefclient/browser/osr_ime_handler_win.cc +++ b/tests/cefclient/browser/osr_ime_handler_win.cc @@ -92,12 +92,11 @@ void GetCompositionUnderlines( } // namespace OsrImeHandlerWin::OsrImeHandlerWin(HWND hwnd) - : ime_status_(false), - hwnd_(hwnd), + : is_composing_(false), input_language_id_(LANG_USER_DEFAULT), - is_composing_(false), + system_caret_(false), cursor_index_(-1), - system_caret_(false) { + hwnd_(hwnd) { ime_rect_ = {-1, -1, 0, 0}; } diff --git a/tests/cefclient/browser/osr_ime_handler_win.h b/tests/cefclient/browser/osr_ime_handler_win.h index 82aced53d..875898506 100644 --- a/tests/cefclient/browser/osr_ime_handler_win.h +++ b/tests/cefclient/browser/osr_ime_handler_win.h @@ -88,9 +88,6 @@ class OsrImeHandlerWin { // The current composition character range and its bounds. std::vector composition_bounds_; - // This value represents whether or not the current input context has IMEs. - bool ime_status_; - // The current input Language ID retrieved from Windows - // used for processing language-specific operations in IME. LANGID input_language_id_; diff --git a/tests/cefclient/browser/resource_util_win_idmap.cc b/tests/cefclient/browser/resource_util_win_idmap.cc index 94ece31ba..ec398263b 100644 --- a/tests/cefclient/browser/resource_util_win_idmap.cc +++ b/tests/cefclient/browser/resource_util_win_idmap.cc @@ -11,7 +11,7 @@ namespace client { int GetResourceId(const char* resource_name) { // Map of resource labels to BINARY id values. static struct _resource_map { - char* name; + const char* name; int id; } resource_map[] = { {"binding.html", IDS_BINDING_HTML}, @@ -48,7 +48,7 @@ int GetResourceId(const char* resource_name) { {"xmlhttprequest.html", IDS_XMLHTTPREQUEST_HTML}, }; - for (int i = 0; i < sizeof(resource_map) / sizeof(_resource_map); ++i) { + for (size_t i = 0; i < sizeof(resource_map) / sizeof(_resource_map); ++i) { if (!strcmp(resource_map[i].name, resource_name)) return resource_map[i].id; } diff --git a/tests/ceftests/navigation_unittest.cc b/tests/ceftests/navigation_unittest.cc index 399d67451..0ce17195d 100644 --- a/tests/ceftests/navigation_unittest.cc +++ b/tests/ceftests/navigation_unittest.cc @@ -3193,7 +3193,7 @@ class CancelAfterNavTestHandler : public TestHandler { // The required delay is longer when browser-side navigation is enabled. CefPostDelayedTask(TID_UI, base::Bind(&CancelAfterNavTestHandler::CancelLoad, this), - IsBrowserSideNavigationEnabled() ? 500 : 100); + IsBrowserSideNavigationEnabled() ? 1000 : 100); return new StalledSchemeHandler(); } diff --git a/tests/ceftests/resource_manager_unittest.cc b/tests/ceftests/resource_manager_unittest.cc index d6d040969..4d9234e53 100644 --- a/tests/ceftests/resource_manager_unittest.cc +++ b/tests/ceftests/resource_manager_unittest.cc @@ -6,6 +6,7 @@ #include "include/base/cef_bind.h" #include "include/cef_file_util.h" +#include "include/cef_waitable_event.h" #include "include/wrapper/cef_closure_task.h" #include "include/wrapper/cef_resource_manager.h" #include "include/wrapper/cef_scoped_temp_dir.h" @@ -53,10 +54,7 @@ const char kNotHandled[] = "NotHandled"; class ResourceManagerTestHandler : public RoutingTestHandler { public: struct State { - State() - : manager_(new CefResourceManager()), - expected_message_ct_(0), - timeout_(0) {} + State() : manager_(new CefResourceManager()), expected_message_ct_(0) {} CefRefPtr manager_; @@ -69,10 +67,6 @@ class ResourceManagerTestHandler : public RoutingTestHandler { // If non-zero the test will not complete until the expected number of // messages have been received. size_t expected_message_ct_; - - // If non-zero the test will be timed out after the specified amount of - // time, and the timeout will not be considered an error. - int timeout_; }; explicit ResourceManagerTestHandler(State* state) @@ -87,10 +81,7 @@ class ResourceManagerTestHandler : public RoutingTestHandler { // Create the browser. CreateBrowser(GetNextURL()); - if (state_->timeout_ != 0) - SetTestTimeout(state_->timeout_, false); - else - SetTestTimeout(); + SetTestTimeout(); } cef_return_value_t OnBeforeResourceLoad( @@ -132,6 +123,13 @@ class ResourceManagerTestHandler : public RoutingTestHandler { return true; } + // Wait a bit before destroying the test. Used with ProviderDoNothing. + void DelayedDestroyTest() { + CefPostDelayedTask( + TID_UI, base::Bind(&ResourceManagerTestHandler::DestroyTest, this), + 100); + } + private: void Continue(CefRefPtr browser) { if (state_->expected_message_ct_ == 0) { @@ -190,6 +188,7 @@ class TestProvider : public CefResourceManager::Provider { TrackCallback got_on_request_; TrackCallback got_on_request_canceled_; TrackCallback got_destruct_; + base::Closure destruct_callback_; std::string request_url_; }; @@ -198,6 +197,8 @@ class TestProvider : public CefResourceManager::Provider { ~TestProvider() { CEF_REQUIRE_IO_THREAD(); state_->got_destruct_.yes(); + if (!state_->destruct_callback_.is_null()) + state_->destruct_callback_.Run(); } bool OnRequest(scoped_refptr request) override { @@ -227,6 +228,32 @@ class TestProvider : public CefResourceManager::Provider { DISALLOW_COPY_AND_ASSIGN(TestProvider); }; +// Helper that blocks on destruction of 1 or more TestProviders. +class ProviderDestructHelper { + public: + explicit ProviderDestructHelper(int expected_count) : current_count_(0) { + event_ = CefWaitableEvent::CreateWaitableEvent(true, false); + callback_ = + base::Bind(&DestructCallback, expected_count, ¤t_count_, event_); + } + + const base::Closure& callback() const { return callback_; } + + void Wait() { event_->Wait(); } + + private: + static void DestructCallback(int expected_count, + int* current_count, + CefRefPtr event) { + if (++(*current_count) == expected_count) + event->Signal(); + } + + int current_count_; + CefRefPtr event_; + base::Closure callback_; +}; + // Test that that the URL retrieved via Request::url() is parsed as expected. // Fragment or query components in any order should be removed. void TestUrlParsing(const char* kUrl) { @@ -237,6 +264,9 @@ void TestUrlParsing(const char* kUrl) { TestProvider::State provider_state; + ProviderDestructHelper destruct_helper(1); + provider_state.destruct_callback_ = destruct_helper.callback(); + state.manager_->AddProvider(new TestProvider(&provider_state), 0, std::string()); @@ -249,7 +279,7 @@ void TestUrlParsing(const char* kUrl) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // The provider is called. EXPECT_TRUE(provider_state.got_on_request_); @@ -305,6 +335,15 @@ class SimpleTestProvider : public TestProvider { SimpleTestProvider(State* state, Mode mode, CefResourceManager* manager) : TestProvider(state), mode_(mode), manager_(manager) {} + SimpleTestProvider(State* state, + Mode mode, + CefResourceManager* manager, + base::Closure do_nothing_callback) + : TestProvider(state), + mode_(mode), + manager_(manager), + do_nothing_callback_(do_nothing_callback) {} + bool OnRequest(scoped_refptr request) override { TestProvider::OnRequest(request); @@ -318,6 +357,11 @@ class SimpleTestProvider : public TestProvider { manager_->RemoveProviders(kProviderId); else if (mode_ == REMOVE_ALL) manager_->RemoveAllProviders(); + else if (mode_ == DO_NOTHING) { + EXPECT_FALSE(do_nothing_callback_.is_null()); + do_nothing_callback_.Run(); + do_nothing_callback_.Reset(); + } return true; } @@ -325,6 +369,7 @@ class SimpleTestProvider : public TestProvider { private: Mode mode_; CefResourceManager* manager_; // Weak reference. + base::Closure do_nothing_callback_; DISALLOW_COPY_AND_ASSIGN(SimpleTestProvider); }; @@ -341,6 +386,10 @@ TEST(ResourceManagerTest, ProviderNotHandled) { TestProvider::State provider_state1; TestProvider::State provider_state2; + ProviderDestructHelper destruct_helper(2); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + state.manager_->AddProvider( new SimpleTestProvider(&provider_state1, SimpleTestProvider::NOT_HANDLED, NULL), @@ -359,7 +408,7 @@ TEST(ResourceManagerTest, ProviderNotHandled) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // All providers are called. EXPECT_TRUE(provider_state1.got_on_request_); @@ -384,6 +433,10 @@ TEST(ResourceManagerTest, ProviderContinue) { TestProvider::State provider_state1; TestProvider::State provider_state2; + ProviderDestructHelper destruct_helper(2); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + state.manager_->AddProvider( new SimpleTestProvider(&provider_state1, SimpleTestProvider::CONTINUE, NULL), @@ -402,7 +455,7 @@ TEST(ResourceManagerTest, ProviderContinue) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // All providers are called. EXPECT_TRUE(provider_state1.got_on_request_); @@ -427,6 +480,10 @@ TEST(ResourceManagerTest, ProviderStop) { TestProvider::State provider_state1; TestProvider::State provider_state2; + ProviderDestructHelper destruct_helper(2); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + state.manager_->AddProvider( new SimpleTestProvider(&provider_state1, SimpleTestProvider::STOP, NULL), 0, std::string()); @@ -444,7 +501,7 @@ TEST(ResourceManagerTest, ProviderStop) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // 1st provider is called. EXPECT_TRUE(provider_state1.got_on_request_); @@ -472,6 +529,11 @@ TEST(ResourceManagerTest, ProviderRemove) { TestProvider::State provider_state2; TestProvider::State provider_state3; + ProviderDestructHelper destruct_helper(3); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + provider_state3.destruct_callback_ = destruct_helper.callback(); + state.manager_->AddProvider( new SimpleTestProvider(&provider_state1, SimpleTestProvider::REMOVE, state.manager_.get()), @@ -494,7 +556,7 @@ TEST(ResourceManagerTest, ProviderRemove) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // 1st provider is called and canceled. EXPECT_TRUE(provider_state1.got_on_request_); @@ -527,6 +589,11 @@ TEST(ResourceManagerTest, ProviderRemoveAll) { TestProvider::State provider_state2; TestProvider::State provider_state3; + ProviderDestructHelper destruct_helper(3); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + provider_state3.destruct_callback_ = destruct_helper.callback(); + state.manager_->AddProvider( new SimpleTestProvider(&provider_state1, SimpleTestProvider::REMOVE_ALL, state.manager_.get()), @@ -549,7 +616,7 @@ TEST(ResourceManagerTest, ProviderRemoveAll) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // 1st provider is called and canceled. EXPECT_TRUE(provider_state1.got_on_request_); @@ -577,23 +644,27 @@ TEST(ResourceManagerTest, ProviderDoNothing) { ResourceManagerTestHandler::State state; state.urls_.push_back(kUrl); - // The provider does nothing so intentionally time out the test. - state.timeout_ = 500; - TestProvider::State provider_state1; TestProvider::State provider_state2; + ProviderDestructHelper destruct_helper(2); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + + CefRefPtr handler = + new ResourceManagerTestHandler(&state); + + // DelayedDestroyTest will be executed from SimpleTestHandler::OnRequest. state.manager_->AddProvider( - new SimpleTestProvider(&provider_state1, SimpleTestProvider::DO_NOTHING, - NULL), + new SimpleTestProvider( + &provider_state1, SimpleTestProvider::DO_NOTHING, NULL, + base::Bind(&ResourceManagerTestHandler::DelayedDestroyTest, handler)), 0, std::string()); state.manager_->AddProvider( new SimpleTestProvider(&provider_state2, SimpleTestProvider::DO_NOTHING, NULL), 0, std::string()); - CefRefPtr handler = - new ResourceManagerTestHandler(&state); handler->ExecuteTest(); // Destroy the resource manager before the handler so that pending requests @@ -602,7 +673,7 @@ TEST(ResourceManagerTest, ProviderDoNothing) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); ReleaseAndWaitForDestructor(handler); @@ -791,11 +862,17 @@ namespace { // Content provider that only handles a single request. class OneShotProvider : public CefResourceManager::Provider { public: - explicit OneShotProvider(const std::string& content) - : done_(false), content_(content) { + OneShotProvider(const std::string& content, + const base::Closure& destruct_callback) + : done_(false), content_(content), destruct_callback_(destruct_callback) { EXPECT_FALSE(content.empty()); } + ~OneShotProvider() { + CEF_REQUIRE_IO_THREAD(); + destruct_callback_.Run(); + } + bool OnRequest(scoped_refptr request) override { CEF_REQUIRE_IO_THREAD(); @@ -817,6 +894,7 @@ class OneShotProvider : public CefResourceManager::Provider { private: bool done_; std::string content_; + base::Closure destruct_callback_; DISALLOW_COPY_AND_ASSIGN(OneShotProvider); }; @@ -845,17 +923,25 @@ TEST(ResourceManagerTest, ProviderOrder) { state.urls_.push_back(kUrl4); state.urls_.push_back(kUrl5); + ProviderDestructHelper destruct_helper(4); + // Resulting order should be sequential; success1 .. success4. state.manager_->AddProvider( - new OneShotProvider(CreateContents(success2_message)), 0, std::string()); + new OneShotProvider(CreateContents(success2_message), + destruct_helper.callback()), + 0, std::string()); state.manager_->AddProvider( - new OneShotProvider(CreateContents(success1_message)), -100, - std::string()); + new OneShotProvider(CreateContents(success1_message), + destruct_helper.callback()), + -100, std::string()); state.manager_->AddProvider( - new OneShotProvider(CreateContents(success4_message)), 100, - std::string()); + new OneShotProvider(CreateContents(success4_message), + destruct_helper.callback()), + 100, std::string()); state.manager_->AddProvider( - new OneShotProvider(CreateContents(success3_message)), 0, std::string()); + new OneShotProvider(CreateContents(success3_message), + destruct_helper.callback()), + 0, std::string()); CefRefPtr handler = new ResourceManagerTestHandler(&state); @@ -866,7 +952,7 @@ TEST(ResourceManagerTest, ProviderOrder) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); EXPECT_EQ(state.messages_.size(), 5U); EXPECT_EQ(success1_message, state.messages_[0]); @@ -1049,6 +1135,12 @@ TEST(ResourceManagerTest, RemoveProviderAfterContinue) { TestProvider::State provider_state3; TestProvider::State provider_state4; + ProviderDestructHelper destruct_helper(4); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + provider_state3.destruct_callback_ = destruct_helper.callback(); + provider_state4.destruct_callback_ = destruct_helper.callback(); + const char kIdentifier1[] = "id1"; const char kIdentifier2[] = "id2"; const char kIdentifier4[] = "id4"; @@ -1085,7 +1177,7 @@ TEST(ResourceManagerTest, RemoveProviderAfterContinue) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // All providers except for 3 (which is removed at the same time as 2 and // therefore never executed) should complete. @@ -1138,6 +1230,12 @@ TEST(ResourceManagerTest, RemoveProviderBeforeContinue) { TestProvider::State provider_state3; TestProvider::State provider_state4; + ProviderDestructHelper destruct_helper(4); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + provider_state3.destruct_callback_ = destruct_helper.callback(); + provider_state4.destruct_callback_ = destruct_helper.callback(); + const char kIdentifier1[] = "id1"; const char kIdentifier2[] = "id2"; const char kIdentifier4[] = "id4"; @@ -1173,7 +1271,7 @@ TEST(ResourceManagerTest, RemoveProviderBeforeContinue) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // No providers should complete. EXPECT_EQ(state.messages_.size(), 4U); @@ -1225,6 +1323,12 @@ TEST(ResourceManagerTest, RemoveAllProvidersAfterContinue) { TestProvider::State provider_state3; TestProvider::State provider_state4; + ProviderDestructHelper destruct_helper(4); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + provider_state3.destruct_callback_ = destruct_helper.callback(); + provider_state4.destruct_callback_ = destruct_helper.callback(); + // Resulting order should be sequential; success1 .. success4. state.manager_->AddProvider( new OneShotRemovalProvider(&provider_state2, @@ -1257,7 +1361,7 @@ TEST(ResourceManagerTest, RemoveAllProvidersAfterContinue) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // Only the 1st provider should complete EXPECT_EQ(state.messages_.size(), 4U); @@ -1307,6 +1411,12 @@ TEST(ResourceManagerTest, RemoveAllProvidersBeforeContinue) { TestProvider::State provider_state3; TestProvider::State provider_state4; + ProviderDestructHelper destruct_helper(4); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + provider_state3.destruct_callback_ = destruct_helper.callback(); + provider_state4.destruct_callback_ = destruct_helper.callback(); + // Resulting order should be sequential; success1 .. success4. state.manager_->AddProvider( new OneShotRemovalProvider(&provider_state2, @@ -1339,7 +1449,7 @@ TEST(ResourceManagerTest, RemoveAllProvidersBeforeContinue) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // No providers should complete. EXPECT_EQ(state.messages_.size(), 4U); @@ -1435,6 +1545,10 @@ TEST(ResourceManagerTest, UrlFilter) { TestProvider::State provider_state1; TestProvider::State provider_state2; + ProviderDestructHelper destruct_helper(2); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + state.manager_->AddProvider( new UrlFilterTestProvider(&provider_state1, kExpectedUrl, kExpectedUrl), 0, std::string()); @@ -1451,7 +1565,7 @@ TEST(ResourceManagerTest, UrlFilter) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // All providers are called. EXPECT_TRUE(provider_state1.got_on_request_); @@ -1482,6 +1596,10 @@ TEST(ResourceManagerTest, UrlFilterWithQuery) { TestProvider::State provider_state1; TestProvider::State provider_state2; + ProviderDestructHelper destruct_helper(2); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + state.manager_->AddProvider( new UrlFilterTestProvider(&provider_state1, kExpectedUrl, kExpectedUrlAfterFilter), @@ -1500,7 +1618,7 @@ TEST(ResourceManagerTest, UrlFilterWithQuery) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // All providers are called. EXPECT_TRUE(provider_state1.got_on_request_); @@ -1532,6 +1650,10 @@ TEST(ResourceManagerTest, UrlFilterWithFragment) { TestProvider::State provider_state1; TestProvider::State provider_state2; + ProviderDestructHelper destruct_helper(2); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + state.manager_->AddProvider( new UrlFilterTestProvider(&provider_state1, kExpectedUrl, kExpectedUrlAfterFilter), @@ -1550,7 +1672,7 @@ TEST(ResourceManagerTest, UrlFilterWithFragment) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // All providers are called. EXPECT_TRUE(provider_state1.got_on_request_); @@ -1610,6 +1732,10 @@ TEST(ResourceManagerTest, MimeTypeResolver) { TestProvider::State provider_state1; TestProvider::State provider_state2; + ProviderDestructHelper destruct_helper(2); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + state.manager_->AddProvider( new MimeTypeTestProvider(&provider_state1, kExpectedMimeType), 0, std::string()); @@ -1626,7 +1752,7 @@ TEST(ResourceManagerTest, MimeTypeResolver) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // All providers are called. EXPECT_TRUE(provider_state1.got_on_request_); @@ -1687,6 +1813,10 @@ TEST(ResourceManagerTest, AddProviderAfter) { TestProvider::State provider_state1; TestProvider::State provider_state2; + ProviderDestructHelper destruct_helper(2); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + state.manager_->AddProvider( new AddingTestProvider(&provider_state1, &provider_state2, state.manager_.get(), false), @@ -1701,7 +1831,7 @@ TEST(ResourceManagerTest, AddProviderAfter) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // All providers are called. EXPECT_TRUE(provider_state1.got_on_request_); @@ -1726,6 +1856,10 @@ TEST(ResourceManagerTest, AddProviderBefore) { TestProvider::State provider_state1; TestProvider::State provider_state2; + ProviderDestructHelper destruct_helper(2); + provider_state1.destruct_callback_ = destruct_helper.callback(); + provider_state2.destruct_callback_ = destruct_helper.callback(); + state.manager_->AddProvider( new AddingTestProvider(&provider_state1, &provider_state2, state.manager_.get(), true), @@ -1740,7 +1874,7 @@ TEST(ResourceManagerTest, AddProviderBefore) { state.manager_ = NULL; // Wait for the manager to be deleted. - WaitForIOThread(); + destruct_helper.Wait(); // 1st provider is called. EXPECT_TRUE(provider_state1.got_on_request_); diff --git a/tests/ceftests/resource_util_win_idmap.cc b/tests/ceftests/resource_util_win_idmap.cc index 6cb66e4c1..cd54dba4e 100644 --- a/tests/ceftests/resource_util_win_idmap.cc +++ b/tests/ceftests/resource_util_win_idmap.cc @@ -11,7 +11,7 @@ namespace client { int GetResourceId(const char* resource_name) { // Map of resource labels to BINARY id values. static struct _resource_map { - char* name; + const char* name; int id; } resource_map[] = { {"osr_test.html", IDS_OSRTEST_HTML}, @@ -21,7 +21,7 @@ int GetResourceId(const char* resource_name) { {"window_icon.2x.png", IDS_WINDOW_ICON_2X_PNG}, }; - for (int i = 0; i < sizeof(resource_map) / sizeof(_resource_map); ++i) { + for (size_t i = 0; i < sizeof(resource_map) / sizeof(_resource_map); ++i) { if (!strcmp(resource_map[i].name, resource_name)) return resource_map[i].id; } diff --git a/tools/gn_args.py b/tools/gn_args.py index e36f37d9e..218410edd 100644 --- a/tools/gn_args.py +++ b/tools/gn_args.py @@ -241,11 +241,10 @@ def GetRequiredArgs(): # Enable support for Widevine CDM. 'enable_widevine': True, - } - if platform == 'linux' or platform == 'macosx': - # Don't use the chrome style plugin. - result['clang_use_chrome_plugins'] = False + # Don't use the chrome style plugin. + 'clang_use_chrome_plugins': False, + } if platform == 'linux': # Don't generate Chromium installer packages. This avoids GN dependency