diff --git a/BUILD.gn b/BUILD.gn index 3aa4bcf46..a6b3513b6 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -123,7 +123,7 @@ if (is_mac) { import("//build/config/mac/rules.gni") import("//build/mac/tweak_info_plist.gni") import("//build/util/version.gni") - import("//media/cdm/ppapi/cdm_paths.gni") + import("//media/cdm/library_cdm/cdm_paths.gni") } if (is_win) { import("//build/config/win/console_app.gni") @@ -266,7 +266,7 @@ if (is_win) { "//components/crash/core/common", # crash_keys # Required by chrome_switches.cc - "//chrome/common:features", + "//chrome/common:buildflags", "//ppapi/features:features", "//printing/features:features", "//ui/base:ui_features", @@ -709,7 +709,7 @@ static_library("libcef_static") { "//services/network:network_service", "//services/network/public/cpp", "//services/service_manager/embedder", - "//services/service_manager/public/interfaces", + "//services/service_manager/public/cpp", "//services/service_manager/runner/common", "//skia", "//storage/browser", @@ -1023,6 +1023,7 @@ if (is_win) { cef_packaged_services = [ "//chrome/app:chrome_manifest", # For spell checking. + "//chrome/app:chrome_renderer_manifest", # For spell checking. "//chrome/services/printing:manifest", "//services/metrics:manifest", "//services/proxy_resolver:proxy_resolver_manifest", diff --git a/CHROMIUM_BUILD_COMPATIBILITY.txt b/CHROMIUM_BUILD_COMPATIBILITY.txt index 2c718740b..930f00b14 100644 --- a/CHROMIUM_BUILD_COMPATIBILITY.txt +++ b/CHROMIUM_BUILD_COMPATIBILITY.txt @@ -7,5 +7,5 @@ # https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding { - 'chromium_checkout': 'bc084a8b5afa3744a74927344e304c02ae54189f', + 'chromium_checkout': '66afc5e5d10127546cc4b98b9117aff588b5e66b', } diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h index ebee15c18..c066abadf 100644 --- a/include/internal/cef_types.h +++ b/include/internal/cef_types.h @@ -1379,38 +1379,49 @@ typedef enum { /// // The main thread in the browser. This will be the same as the main // application thread if CefInitialize() is called with a - // CefSettings.multi_threaded_message_loop value of false. + // CefSettings.multi_threaded_message_loop value of false. Do not perform + // blocking tasks on this thread. All tasks posted after + // CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown() + // are guaranteed to run. This thread will outlive all other CEF threads. /// TID_UI, /// - // Used to interact with the database. + // Used for blocking tasks (e.g. file system access) where the user won't + // notice if the task takes an arbitrarily long time to complete. All tasks + // posted after CefBrowserProcessHandler::OnContextInitialized() and before + // CefShutdown() are guaranteed to run. /// - TID_DB, + TID_FILE_BACKGROUND, + TID_FILE = TID_FILE_BACKGROUND, /// - // Used to interact with the file system. + // Used for blocking tasks (e.g. file system access) that affect UI or + // responsiveness of future user interactions. Do not use if an immediate + // response to a user interaction is expected. All tasks posted after + // CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown() + // are guaranteed to run. + // Examples: + // - Updating the UI to reflect progress on a long task. + // - Loading data that might be shown in the UI after a future user + // interaction. /// - TID_FILE, + TID_FILE_USER_VISIBLE, /// - // Used for file system operations that block user interactions. - // Responsiveness of this thread affects users. + // Used for blocking tasks (e.g. file system access) that affect UI + // immediately after a user interaction. All tasks posted after + // CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown() + // are guaranteed to run. + // Example: Generating data shown in the UI immediately after a click. /// TID_FILE_USER_BLOCKING, /// - // Used to launch and terminate browser processes. - /// - TID_PROCESS_LAUNCHER, - - /// - // Used to handle slow HTTP cache operations. - /// - TID_CACHE, - - /// - // Used to process IPC and network messages. + // Used to process IPC and network messages. Do not perform blocking tasks on + // this thread. All tasks posted after + // CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown() + // are guaranteed to run. /// TID_IO, @@ -1418,6 +1429,10 @@ typedef enum { /// // The main thread in the renderer. Used for all WebKit and V8 interaction. + // Tasks may be posted to this thread after + // CefRenderProcessHandler::OnRenderThreadCreated but are not guaranteed to + // run before sub-process termination (sub-processes may be killed at any time + // without warning). /// TID_RENDERER, } cef_thread_id_t; diff --git a/libcef/browser/browser_context_impl.cc b/libcef/browser/browser_context_impl.cc index add0841cd..ce0b42916 100644 --- a/libcef/browser/browser_context_impl.cc +++ b/libcef/browser/browser_context_impl.cc @@ -39,8 +39,8 @@ #include "content/public/browser/storage_partition.h" #include "extensions/browser/extension_protocols.h" #include "extensions/common/constants.h" -#include "net/proxy/proxy_config_service.h" -#include "net/proxy/proxy_service.h" +#include "net/proxy_resolution/proxy_config_service.h" +#include "net/proxy_resolution/proxy_service.h" using content::BrowserThread; @@ -162,7 +162,7 @@ class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener { void CreateListenerForContext(const CefBrowserContext* context) { CEF_REQUIRE_UIT(); - auto listener = base::MakeUnique( + auto listener = std::make_unique( const_cast(context)); listener_map_.insert(std::make_pair(context, std::move(listener))); } @@ -450,7 +450,8 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext( // TODO(cef): Determine if we can use the Chrome/Mojo implementation from // https://crrev.com/d0d0d050 std::unique_ptr base_service( - net::ProxyService::CreateSystemProxyConfigService(io_thread_runner)); + net::ProxyResolutionService::CreateSystemProxyConfigService( + io_thread_runner)); std::unique_ptr proxy_config_service( pref_proxy_config_tracker_->CreateTrackingProxyConfigService( std::move(base_service))); diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 4ed5da1f5..742341a57 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -53,7 +53,7 @@ #include "content/common/view_messages.h" #include "content/public/browser/desktop_media_id.h" #include "content/public/browser/download_manager.h" -#include "content/public/browser/download_url_parameters.h" +#include "content/public/browser/download_request_utils.h" #include "content/public/browser/host_zoom_map.h" #include "content/public/browser/keyboard_event_processing_result.h" #include "content/public/browser/native_web_keyboard_event.h" @@ -745,8 +745,8 @@ void CefBrowserHostImpl::StartDownload(const CefString& url) { if (!manager) return; - std::unique_ptr params( - content::DownloadUrlParameters::CreateForWebContentsMainFrame( + std::unique_ptr params( + content::DownloadRequestUtils::CreateDownloadForWebContentsMainFrame( web_contents(), gurl, NO_TRAFFIC_ANNOTATION_YET)); manager->DownloadUrl(std::move(params)); } diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/browser_host_impl.h index 799b472fb..e23bd9e2e 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/browser_host_impl.h @@ -478,7 +478,6 @@ class CefBrowserHostImpl : public CefBrowserHost, // content::WebContentsObserver methods. using content::WebContentsObserver::BeforeUnloadFired; - using content::WebContentsObserver::WasHidden; void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; void RenderFrameHostChanged(content::RenderFrameHost* old_host, content::RenderFrameHost* new_host) override; diff --git a/libcef/browser/browser_info_manager.cc b/libcef/browser/browser_info_manager.cc index 2b50180ac..1a7474fe3 100644 --- a/libcef/browser/browser_info_manager.cc +++ b/libcef/browser/browser_info_manager.cc @@ -154,7 +154,7 @@ bool CefBrowserInfoManager::CanCreateWindow( window_info->SetAsPopup(NULL, CefString()); #endif - auto pending_popup = base::MakeUnique(); + auto pending_popup = std::make_unique(); pending_popup->step = CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW; pending_popup->opener_process_id = opener->GetProcess()->GetID(); pending_popup->opener_frame_id = opener->GetRoutingID(); diff --git a/libcef/browser/browser_main.cc b/libcef/browser/browser_main.cc index 72125f6cf..abe2aec33 100644 --- a/libcef/browser/browser_main.cc +++ b/libcef/browser/browser_main.cc @@ -26,6 +26,8 @@ #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/strings/string_number_conversions.h" +#include "base/task_scheduler/post_task.h" +#include "chrome/browser/chrome_browser_main_extra_parts.h" #include "chrome/browser/plugins/plugin_finder.h" #include "content/public/browser/gpu_data_manager.h" #include "content/public/common/result_codes.h" @@ -58,13 +60,14 @@ CefBrowserMainParts::CefBrowserMainParts( const content::MainFunctionParams& parameters) : BrowserMainParts(), devtools_delegate_(NULL) {} -CefBrowserMainParts::~CefBrowserMainParts() {} +CefBrowserMainParts::~CefBrowserMainParts() { + for (int i = static_cast(chrome_extra_parts_.size()) - 1; i >= 0; --i) + delete chrome_extra_parts_[i]; + chrome_extra_parts_.clear(); +} -void CefBrowserMainParts::PreMainMessageLoopStart() { - if (!base::MessageLoop::current()) { - // Create the browser message loop. - message_loop_.reset(new CefBrowserMessageLoop()); - } +void CefBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { + chrome_extra_parts_.push_back(parts); } int CefBrowserMainParts::PreEarlyInitialization() { @@ -73,9 +76,18 @@ int CefBrowserMainParts::PreEarlyInitialization() { // views::LinuxUI::SetInstance. ui::InitializeInputMethodForTesting(); #endif + + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->PreEarlyInitialization(); + return content::RESULT_CODE_NORMAL_EXIT; } +void CefBrowserMainParts::PostEarlyInitialization() { + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->PostEarlyInitialization(); +} + void CefBrowserMainParts::ToolkitInitialized() { #if defined(USE_AURA) CHECK(aura::Env::GetInstance()); @@ -89,6 +101,19 @@ void CefBrowserMainParts::ToolkitInitialized() { CefContentBrowserClient::Get()->GetResourceDllName()); #endif #endif // defined(USE_AURA) + + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->ToolkitInitialized(); +} + +void CefBrowserMainParts::PreMainMessageLoopStart() { + if (!base::MessageLoop::current()) { + // Create the browser message loop. + message_loop_.reset(new CefBrowserMessageLoop()); + } + + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->PreMainMessageLoopStart(); } void CefBrowserMainParts::PostMainMessageLoopStart() { @@ -98,6 +123,9 @@ void CefBrowserMainParts::PostMainMessageLoopStart() { printing::PrintingContextLinux::SetPdfPaperSizeFunction( &CefPrintDialogLinux::GetPdfPaperSize); #endif + + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->PostMainMessageLoopStart(); } int CefBrowserMainParts::PreCreateThreads() { @@ -111,14 +139,26 @@ int CefBrowserMainParts::PreCreateThreads() { // before the IO thread is started. content::GpuDataManager::GetInstance(); + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->PreCreateThreads(); + return 0; } +void CefBrowserMainParts::ServiceManagerConnectionStarted( + content::ServiceManagerConnection* connection) { + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->ServiceManagerConnectionStarted(connection); +} + void CefBrowserMainParts::PreMainMessageLoopRun() { #if defined(USE_AURA) display::Screen::SetScreenInstance(views::CreateDesktopScreen()); #endif + // CEF's profile is a BrowserContext. + PreProfileInit(); + if (extensions::ExtensionsEnabled()) { // Initialize extension global objects before creating the global // BrowserContext. @@ -137,6 +177,16 @@ void CefBrowserMainParts::PreMainMessageLoopRun() { printing::CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt(); + background_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits( + {base::TaskPriority::BACKGROUND, + base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()}); + user_visible_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits( + {base::TaskPriority::USER_VISIBLE, + base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()}); + user_blocking_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits( + {base::TaskPriority::USER_BLOCKING, + base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()}); + CefRequestContextSettings settings; CefContext::Get()->PopulateRequestContextSettings(&settings); @@ -146,12 +196,21 @@ void CefBrowserMainParts::PreMainMessageLoopRun() { CefBrowserContextImpl* browser_context = static_cast( global_request_context_->GetBrowserContext()); + PostProfileInit(); + CefDevToolsManagerDelegate::StartHttpHandler(browser_context); // Triggers initialization of the singleton instance on UI thread. PluginFinder::GetInstance()->Init(); scheme::RegisterWebUIControllerFactory(); + + // These have no equivalent in CEF. + PreBrowserStart(); + PostBrowserStart(); + + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->PreMainMessageLoopRun(); } void CefBrowserMainParts::PostMainMessageLoopRun() { @@ -167,6 +226,9 @@ void CefBrowserMainParts::PostMainMessageLoopRun() { extensions::ExtensionsBrowserClient::Set(NULL); extensions_browser_client_.reset(); } + + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->PostMainMessageLoopRun(); } void CefBrowserMainParts::PostDestroyThreads() { @@ -175,3 +237,23 @@ void CefBrowserMainParts::PostDestroyThreads() { delete views::ViewsDelegate::GetInstance(); #endif } + +void CefBrowserMainParts::PreProfileInit() { + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->PreProfileInit(); +} + +void CefBrowserMainParts::PostProfileInit() { + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->PostProfileInit(); +} + +void CefBrowserMainParts::PreBrowserStart() { + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->PreBrowserStart(); +} + +void CefBrowserMainParts::PostBrowserStart() { + for (size_t i = 0; i < chrome_extra_parts_.size(); ++i) + chrome_extra_parts_[i]->PostBrowserStart(); +} diff --git a/libcef/browser/browser_main.h b/libcef/browser/browser_main.h index 87056031c..66aeb1dee 100644 --- a/libcef/browser/browser_main.h +++ b/libcef/browser/browser_main.h @@ -37,26 +37,51 @@ class WMState; #endif class CefDevToolsDelegate; +class ChromeBrowserMainExtraParts; class CefBrowserMainParts : public content::BrowserMainParts { public: explicit CefBrowserMainParts(const content::MainFunctionParams& parameters); ~CefBrowserMainParts() override; + // Add additional ChromeBrowserMainExtraParts. + void AddParts(ChromeBrowserMainExtraParts* parts); + + int PreEarlyInitialization() override; + void PostEarlyInitialization() override; + void ToolkitInitialized() override; void PreMainMessageLoopStart() override; void PostMainMessageLoopStart() override; - int PreEarlyInitialization() override; - void ToolkitInitialized() override; int PreCreateThreads() override; + void ServiceManagerConnectionStarted( + content::ServiceManagerConnection* connection); void PreMainMessageLoopRun() override; void PostMainMessageLoopRun() override; void PostDestroyThreads() override; + // Additional stages for ChromeBrowserMainExtraParts. These stages are called + // in order from PreMainMessageLoopRun(). See implementation for details. + void PreProfileInit(); + void PostProfileInit(); + void PreBrowserStart(); + void PostBrowserStart(); + CefRefPtr request_context() const { return global_request_context_; } CefDevToolsDelegate* devtools_delegate() const { return devtools_delegate_; } + scoped_refptr background_task_runner() const { + return background_task_runner_; + } + scoped_refptr user_visible_task_runner() const { + return user_visible_task_runner_; + } + scoped_refptr user_blocking_task_runner() + const { + return user_blocking_task_runner_; + } + private: #if defined(OS_WIN) void PlatformInitialize(); @@ -70,10 +95,22 @@ class CefBrowserMainParts : public content::BrowserMainParts { std::unique_ptr extensions_browser_client_; + // Blocking task runners exposed via CefTaskRunner. For consistency with + // previous named thread behavior always execute all pending tasks before + // shutdown (e.g. to make sure critical data is saved to disk). + // |background_task_runner_| is also passed to SQLitePersistentCookieStore. + scoped_refptr background_task_runner_; + scoped_refptr user_visible_task_runner_; + scoped_refptr user_blocking_task_runner_; + #if defined(USE_AURA) std::unique_ptr wm_state_; #endif + // Vector of additional ChromeBrowserMainExtraParts. + // Parts are deleted in the inverse order they are added. + std::vector chrome_extra_parts_; + DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts); }; diff --git a/libcef/browser/browser_platform_delegate_create.cc b/libcef/browser/browser_platform_delegate_create.cc index 80aca9289..77c701a92 100644 --- a/libcef/browser/browser_platform_delegate_create.cc +++ b/libcef/browser/browser_platform_delegate_create.cc @@ -36,13 +36,13 @@ std::unique_ptr CreateNativeDelegate( const CefWindowInfo& window_info, SkColor background_color) { #if defined(OS_WIN) - return base::MakeUnique( + return std::make_unique( window_info, background_color); #elif defined(OS_MACOSX) - return base::MakeUnique( + return std::make_unique( window_info, background_color); #elif defined(OS_LINUX) - return base::MakeUnique( + return std::make_unique( window_info, background_color); #endif } @@ -50,13 +50,13 @@ std::unique_ptr CreateNativeDelegate( std::unique_ptr CreateOSRDelegate( std::unique_ptr native_delegate) { #if defined(OS_WIN) - return base::MakeUnique( + return std::make_unique( std::move(native_delegate)); #elif defined(OS_MACOSX) - return base::MakeUnique( + return std::make_unique( std::move(native_delegate)); #elif defined(OS_LINUX) - return base::MakeUnique( + return std::make_unique( std::move(native_delegate)); #endif } @@ -85,7 +85,7 @@ std::unique_ptr CefBrowserPlatformDelegate::Create( // Creating a background extension host without a window. std::unique_ptr native_delegate = CreateNativeDelegate(CefWindowInfo(), background_color); - return base::MakeUnique( + return std::make_unique( std::move(native_delegate)); } #if defined(USE_AURA) @@ -93,7 +93,7 @@ std::unique_ptr CefBrowserPlatformDelegate::Create( // CefWindowInfo is not used in this case. std::unique_ptr native_delegate = CreateNativeDelegate(CefWindowInfo(), background_color); - return base::MakeUnique( + return std::make_unique( std::move(native_delegate), static_cast(create_params.browser_view.get())); } diff --git a/libcef/browser/chrome_browser_process_stub.cc b/libcef/browser/chrome_browser_process_stub.cc index cc2cd424c..e56840291 100644 --- a/libcef/browser/chrome_browser_process_stub.cc +++ b/libcef/browser/chrome_browser_process_stub.cc @@ -15,7 +15,7 @@ #include "chrome/browser/printing/print_job_manager.h" #include "components/net_log/chrome_net_log.h" #include "content/public/common/content_switches.h" -#include "ui/message_center/message_center.h" +#include "services/network/public/cpp/network_switches.h" ChromeBrowserProcessStub::ChromeBrowserProcessStub() : initialized_(false), @@ -165,11 +165,6 @@ ChromeBrowserProcessStub::notification_platform_bridge() { return NULL; } -message_center::MessageCenter* ChromeBrowserProcessStub::message_center() { - NOTREACHED(); - return NULL; -} - policy::ChromeBrowserPolicyConnector* ChromeBrowserProcessStub::browser_policy_connector() { NOTREACHED(); @@ -191,9 +186,7 @@ GpuModeManager* ChromeBrowserProcessStub::gpu_mode_manager() { return NULL; } -void ChromeBrowserProcessStub::CreateDevToolsHttpProtocolHandler( - const std::string& ip, - uint16_t port) { +void ChromeBrowserProcessStub::CreateDevToolsProtocolHandler() { NOTREACHED(); } @@ -296,10 +289,10 @@ net_log::ChromeNetLog* ChromeBrowserProcessStub::net_log() { if (!net_log_) { const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); - net_log_ = base::MakeUnique(); - if (command_line.HasSwitch(switches::kLogNetLog)) { + net_log_ = std::make_unique(); + if (command_line.HasSwitch(network::switches::kLogNetLog)) { net_log_->StartWritingToFile( - command_line.GetSwitchValuePath(switches::kLogNetLog), + command_line.GetSwitchValuePath(network::switches::kLogNetLog), GetNetCaptureModeFromCommandLine(command_line), command_line.GetCommandLineString(), std::string()); } diff --git a/libcef/browser/chrome_browser_process_stub.h b/libcef/browser/chrome_browser_process_stub.h index e1e9a6c21..011caf57f 100644 --- a/libcef/browser/chrome_browser_process_stub.h +++ b/libcef/browser/chrome_browser_process_stub.h @@ -59,13 +59,11 @@ class ChromeBrowserProcessStub : public BrowserProcess, extensions::EventRouterForwarder* extension_event_router_forwarder() override; NotificationUIManager* notification_ui_manager() override; NotificationPlatformBridge* notification_platform_bridge() override; - message_center::MessageCenter* message_center() override; policy::ChromeBrowserPolicyConnector* browser_policy_connector() override; policy::PolicyService* policy_service() override; IconManager* icon_manager() override; GpuModeManager* gpu_mode_manager() override; - void CreateDevToolsHttpProtocolHandler(const std::string& ip, - uint16_t port) override; + void CreateDevToolsProtocolHandler() override; void CreateDevToolsAutoOpener() override; bool IsShuttingDown() override; printing::PrintJobManager* print_job_manager() override; diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc index 285b26cf0..2bba826b8 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/content_browser_client.cc @@ -49,7 +49,7 @@ #include "chrome/common/constants.mojom.h" #include "chrome/grit/browser_resources.h" #include "chrome/grit/generated_resources.h" -#include "chrome/services/printing/public/interfaces/constants.mojom.h" +#include "chrome/services/printing/public/mojom/constants.mojom.h" #include "components/navigation_interception/intercept_navigation_throttle.h" #include "components/navigation_interception/navigation_params.h" #include "components/printing/service/public/interfaces/pdf_compositor.mojom.h" @@ -84,7 +84,7 @@ #include "extensions/common/switches.h" #include "net/ssl/ssl_cert_request_info.h" #include "ppapi/host/ppapi_host.h" -#include "services/proxy_resolver/public/interfaces/proxy_resolver.mojom.h" +#include "services/service_manager/public/mojom/connector.mojom.h" #include "storage/browser/quota/quota_settings.h" #include "third_party/WebKit/public/web/WebWindowFeatures.h" #include "ui/base/l10n/l10n_util.h" @@ -96,10 +96,6 @@ #include "libcef/common/widevine_loader.h" #endif -#if defined(OS_MACOSX) -#include "components/spellcheck/browser/spellcheck_message_filter_platform.h" -#endif - #if defined(OS_POSIX) && !defined(OS_MACOSX) #include "base/debug/leak_annotations.h" #include "chrome/common/chrome_paths.h" @@ -450,6 +446,8 @@ CefContentBrowserClient::~CefContentBrowserClient() {} // static CefContentBrowserClient* CefContentBrowserClient::Get() { + if (!CefContentClient::Get()) + return nullptr; return static_cast( CefContentClient::Get()->browser()); } @@ -457,25 +455,20 @@ CefContentBrowserClient* CefContentBrowserClient::Get() { content::BrowserMainParts* CefContentBrowserClient::CreateBrowserMainParts( const content::MainFunctionParams& parameters) { browser_main_parts_ = new CefBrowserMainParts(parameters); + browser_main_parts_->AddParts( + ChromeService::GetInstance()->CreateExtraParts()); return browser_main_parts_; } void CefContentBrowserClient::RenderProcessWillLaunch( - content::RenderProcessHost* host) { + content::RenderProcessHost* host, + service_manager::mojom::ServiceRequest* service_request) { const int id = host->GetID(); Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); host->AddFilter(new CefBrowserMessageFilter(id)); host->AddFilter(new printing::CefPrintingMessageFilter(id, profile)); -#if defined(OS_MACOSX) - const base::CommandLine* command_line = - base::CommandLine::ForCurrentProcess(); - if (!command_line->HasSwitch(switches::kDisableSpellChecking)) { - host->AddFilter(new SpellCheckMessageFilterPlatform(id)); - } -#endif - if (extensions::ExtensionsEnabled()) { host->AddFilter(new extensions::ExtensionMessageFilter(id, profile)); host->AddFilter( @@ -492,6 +485,16 @@ void CefContentBrowserClient::RenderProcessWillLaunch( host->Send( new CefProcessMsg_SetIsIncognitoProcess(profile->IsOffTheRecord())); + + service_manager::mojom::ServicePtr service; + *service_request = mojo::MakeRequest(&service); + service_manager::mojom::PIDReceiverPtr pid_receiver; + service_manager::Identity renderer_identity = host->GetChildIdentity(); + ChromeService::GetInstance()->connector()->StartService( + service_manager::Identity(chrome::mojom::kRendererServiceName, + renderer_identity.user_id(), + renderer_identity.instance()), + std::move(service), mojo::MakeRequest(&pid_receiver)); } bool CefContentBrowserClient::ShouldUseProcessPerSite( @@ -594,7 +597,7 @@ void CefContentBrowserClient::RegisterInProcessServices( { // For spell checking. service_manager::EmbeddedServiceInfo info; - info.factory = base::Bind(&ChromeService::Create); + info.factory = ChromeService::GetInstance()->CreateChromeServiceFactory(); services->insert(std::make_pair(chrome::mojom::kServiceName, info)); } } @@ -633,6 +636,8 @@ std::vector CefContentBrowserClient::GetExtraServiceManifests() { return std::vector({ {printing::mojom::kServiceName, IDR_PDF_COMPOSITOR_MANIFEST}, + {chrome::mojom::kRendererServiceName, + IDR_CHROME_RENDERER_SERVICE_MANIFEST}, }); } @@ -958,7 +963,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation( } std::unique_ptr throttle = - base::MakeUnique( + std::make_unique( navigation_handle, base::Bind(&NavigationOnUIThread, is_main_frame, frame_id, parent_frame_id)); throttles.push_back(std::move(throttle)); @@ -1010,6 +1015,15 @@ void CefContentBrowserClient::ExposeInterfacesToRenderer( base::MakeRefCounted(host->GetID(), profile))); } +std::unique_ptr +CefContentBrowserClient::CreateClientCertStore( + content::ResourceContext* resource_context) { + if (!resource_context) + return nullptr; + return static_cast(resource_context) + ->CreateClientCertStore(); +} + void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) { // Register as a Web-safe scheme so that requests for the scheme from a // render process will be allowed in resource_dispatcher_host_impl.cc @@ -1029,6 +1043,21 @@ CefDevToolsDelegate* CefContentBrowserClient::devtools_delegate() const { return browser_main_parts_->devtools_delegate(); } +scoped_refptr +CefContentBrowserClient::background_task_runner() const { + return browser_main_parts_->background_task_runner(); +} + +scoped_refptr +CefContentBrowserClient::user_visible_task_runner() const { + return browser_main_parts_->user_visible_task_runner(); +} + +scoped_refptr +CefContentBrowserClient::user_blocking_task_runner() const { + return browser_main_parts_->user_blocking_task_runner(); +} + const extensions::Extension* CefContentBrowserClient::GetExtension( content::SiteInstance* site_instance) { extensions::ExtensionRegistry* registry = diff --git a/libcef/browser/content_browser_client.h b/libcef/browser/content_browser_client.h index 945f0a3a2..b8650b15b 100644 --- a/libcef/browser/content_browser_client.h +++ b/libcef/browser/content_browser_client.h @@ -43,7 +43,9 @@ class CefContentBrowserClient : public content::ContentBrowserClient { // ContentBrowserClient implementation. content::BrowserMainParts* CreateBrowserMainParts( const content::MainFunctionParams& parameters) override; - void RenderProcessWillLaunch(content::RenderProcessHost* host) override; + void RenderProcessWillLaunch( + content::RenderProcessHost* host, + service_manager::mojom::ServiceRequest* service_request) override; bool ShouldUseProcessPerSite(content::BrowserContext* browser_context, const GURL& effective_url) override; bool IsHandledURL(const GURL& url) override; @@ -122,12 +124,19 @@ class CefContentBrowserClient : public content::ContentBrowserClient { blink::AssociatedInterfaceRegistry* associated_registry, content::RenderProcessHost* render_process_host) override; + std::unique_ptr CreateClientCertStore( + content::ResourceContext* resource_context) override; + // Perform browser process registration for the custom scheme. void RegisterCustomScheme(const std::string& scheme); CefRefPtr request_context() const; CefDevToolsDelegate* devtools_delegate() const; + scoped_refptr background_task_runner() const; + scoped_refptr user_visible_task_runner() const; + scoped_refptr user_blocking_task_runner() const; + private: // Returns the extension or app associated with |site_instance| or NULL. const extensions::Extension* GetExtension( diff --git a/libcef/browser/cookie_manager_impl.cc b/libcef/browser/cookie_manager_impl.cc index 19a81caea..f62e96eeb 100644 --- a/libcef/browser/cookie_manager_impl.cc +++ b/libcef/browser/cookie_manager_impl.cc @@ -303,7 +303,10 @@ bool CefCookieManagerImpl::SetStoragePath( const base::FilePath& cookie_path = new_path.AppendASCII("Cookies"); persistent_store = new net::SQLitePersistentCookieStore( cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), - BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), + // Intentionally using the background task runner exposed by CEF to + // facilitate unit test expectations. This task runner MUST be + // configured with BLOCK_SHUTDOWN. + CefContentBrowserClient::Get()->background_task_runner(), persist_session_cookies, NULL); } else { NOTREACHED() << "The cookie storage directory could not be created"; diff --git a/libcef/browser/devtools_frontend.cc b/libcef/browser/devtools_frontend.cc index a18b11d05..b66e4541d 100644 --- a/libcef/browser/devtools_frontend.cc +++ b/libcef/browser/devtools_frontend.cc @@ -163,7 +163,7 @@ void CefDevToolsFrontend::InspectElementAt(int x, int y) { if (inspect_element_at_.x != x || inspect_element_at_.y != y) inspect_element_at_.Set(x, y); if (agent_host_) - agent_host_->InspectElement(this, x, y); + agent_host_->InspectElement(inspected_contents_->GetFocusedFrame(), x, y); } void CefDevToolsFrontend::Close() { @@ -226,8 +226,8 @@ void CefDevToolsFrontend::DocumentAvailableInMainFrame() { agent_host_ = agent_host; agent_host_->AttachClient(this); if (!inspect_element_at_.IsEmpty()) { - agent_host_->InspectElement(this, inspect_element_at_.x, - inspect_element_at_.y); + agent_host_->InspectElement(inspected_contents_->GetFocusedFrame(), + inspect_element_at_.x, inspect_element_at_.y); } } } @@ -392,7 +392,7 @@ void CefDevToolsFrontend::OnURLFetchComplete(const net::URLFetcher* source) { DCHECK(it != pending_requests_.end()); base::DictionaryValue response; - auto headers = base::MakeUnique(); + auto headers = std::make_unique(); net::HttpResponseHeaders* rh = source->GetResponseHeaders(); response.SetInteger("statusCode", rh ? rh->response_code() : 200); diff --git a/libcef/browser/devtools_manager_delegate.cc b/libcef/browser/devtools_manager_delegate.cc index 6b61f3806..105399746 100644 --- a/libcef/browser/devtools_manager_delegate.cc +++ b/libcef/browser/devtools_manager_delegate.cc @@ -105,8 +105,7 @@ void CefDevToolsManagerDelegate::StartHttpHandler( if (!socket_factory) return; content::DevToolsAgentHost::StartRemoteDebuggingServer( - std::move(socket_factory), std::string(), browser_context->GetPath(), - base::FilePath()); + std::move(socket_factory), browser_context->GetPath(), base::FilePath()); const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); @@ -138,7 +137,6 @@ std::string CefDevToolsManagerDelegate::GetDiscoveryPageHTML() { .as_string(); } -std::string CefDevToolsManagerDelegate::GetFrontendResource( - const std::string& path) { - return content::DevToolsFrontendHost::GetFrontendResource(path).as_string(); +bool CefDevToolsManagerDelegate::HasBundledFrontendResources() { + return true; } diff --git a/libcef/browser/devtools_manager_delegate.h b/libcef/browser/devtools_manager_delegate.h index bbd8db243..72fbb09a8 100644 --- a/libcef/browser/devtools_manager_delegate.h +++ b/libcef/browser/devtools_manager_delegate.h @@ -25,7 +25,7 @@ class CefDevToolsManagerDelegate : public content::DevToolsManagerDelegate { scoped_refptr CreateNewTarget( const GURL& url) override; std::string GetDiscoveryPageHTML() override; - std::string GetFrontendResource(const std::string& path) override; + bool HasBundledFrontendResources() override; private: DISALLOW_COPY_AND_ASSIGN(CefDevToolsManagerDelegate); diff --git a/libcef/browser/download_item_impl.cc b/libcef/browser/download_item_impl.cc index cc7e5ca03..ac98785eb 100644 --- a/libcef/browser/download_item_impl.cc +++ b/libcef/browser/download_item_impl.cc @@ -6,11 +6,11 @@ #include "libcef/common/time_util.h" -#include "content/public/browser/download_item.h" +#include "components/download/public/common/download_item.h" #include "url/gurl.h" -CefDownloadItemImpl::CefDownloadItemImpl(content::DownloadItem* value) - : CefValueBase( +CefDownloadItemImpl::CefDownloadItemImpl(download::DownloadItem* value) + : CefValueBase( value, NULL, kOwnerNoDelete, @@ -26,17 +26,17 @@ bool CefDownloadItemImpl::IsValid() { bool CefDownloadItemImpl::IsInProgress() { CEF_VALUE_VERIFY_RETURN(false, false); - return const_value().GetState() == content::DownloadItem::IN_PROGRESS; + return const_value().GetState() == download::DownloadItem::IN_PROGRESS; } bool CefDownloadItemImpl::IsComplete() { CEF_VALUE_VERIFY_RETURN(false, false); - return const_value().GetState() == content::DownloadItem::COMPLETE; + return const_value().GetState() == download::DownloadItem::COMPLETE; } bool CefDownloadItemImpl::IsCanceled() { CEF_VALUE_VERIFY_RETURN(false, false); - return const_value().GetState() == content::DownloadItem::CANCELLED; + return const_value().GetState() == download::DownloadItem::CANCELLED; } int64 CefDownloadItemImpl::GetCurrentSpeed() { diff --git a/libcef/browser/download_item_impl.h b/libcef/browser/download_item_impl.h index adc3d01c8..ab7f4de2c 100644 --- a/libcef/browser/download_item_impl.h +++ b/libcef/browser/download_item_impl.h @@ -9,15 +9,15 @@ #include "include/cef_download_item.h" #include "libcef/common/value_base.h" -namespace content { +namespace download { class DownloadItem; } // CefDownloadItem implementation class CefDownloadItemImpl - : public CefValueBase { + : public CefValueBase { public: - explicit CefDownloadItemImpl(content::DownloadItem* value); + explicit CefDownloadItemImpl(download::DownloadItem* value); // CefDownloadItem methods. bool IsValid() override; diff --git a/libcef/browser/download_manager_delegate.cc b/libcef/browser/download_manager_delegate.cc index 5db1154d0..0f2e62b60 100644 --- a/libcef/browser/download_manager_delegate.cc +++ b/libcef/browser/download_manager_delegate.cc @@ -15,11 +15,12 @@ #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "content/public/browser/browser_context.h" +#include "content/public/browser/download_item_utils.h" #include "content/public/browser/web_contents.h" #include "content/public/common/file_chooser_params.h" #include "net/base/filename_util.h" -using content::DownloadItem; +using download::DownloadItem; using content::DownloadManager; using content::WebContents; @@ -53,11 +54,9 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback { if (manager_) { base::FilePath path = base::FilePath(download_path); - CEF_POST_TASK( - CEF_FILET, - base::Bind(&CefBeforeDownloadCallbackImpl::GenerateFilename, - manager_, download_id_, suggested_name_, path, - show_dialog, callback_)); + CEF_POST_USER_VISIBLE_TASK(base::Bind( + &CefBeforeDownloadCallbackImpl::GenerateFilename, manager_, + download_id_, suggested_name_, path, show_dialog, callback_)); } download_id_ = 0; @@ -77,6 +76,8 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback { const base::FilePath& download_path, bool show_dialog, const content::DownloadTargetCallback& callback) { + CEF_REQUIRE_BLOCKING(); + base::FilePath suggested_path = download_path; if (!suggested_path.empty()) { // Create the directory if necessary. @@ -114,13 +115,14 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback { return; DownloadItem* item = manager->GetDownload(download_id); - if (!item || item->GetState() != content::DownloadItem::IN_PROGRESS) + if (!item || item->GetState() != DownloadItem::IN_PROGRESS) return; bool handled = false; if (show_dialog) { - WebContents* web_contents = item->GetWebContents(); + WebContents* web_contents = + content::DownloadItemUtils::GetWebContents(item); CefRefPtr browser = CefBrowserHostImpl::GetBrowserForContents(web_contents); if (browser.get()) { @@ -146,8 +148,8 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback { if (!handled) { callback.Run(suggested_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, - content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, suggested_path, - content::DOWNLOAD_INTERRUPT_REASON_NONE); + download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, suggested_path, + download::DOWNLOAD_INTERRUPT_REASON_NONE); } } @@ -163,8 +165,8 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback { // The download will be cancelled if |path| is empty. callback.Run(path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, - content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path, - content::DOWNLOAD_INTERRUPT_REASON_NONE); + download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path, + download::DOWNLOAD_INTERRUPT_REASON_NONE); } base::WeakPtr manager_; @@ -206,7 +208,7 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback { if (manager_) { DownloadItem* item = manager_->GetDownload(download_id_); - if (item && item->GetState() == content::DownloadItem::IN_PROGRESS) + if (item && item->GetState() == DownloadItem::IN_PROGRESS) item->Cancel(true); } @@ -219,7 +221,7 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback { if (manager_) { DownloadItem* item = manager_->GetDownload(download_id_); - if (item && item->GetState() == content::DownloadItem::IN_PROGRESS) + if (item && item->GetState() == DownloadItem::IN_PROGRESS) item->Pause(); } } @@ -316,7 +318,8 @@ void CefDownloadManagerDelegate::OnDownloadDestroyed(DownloadItem* item) { void CefDownloadManagerDelegate::OnDownloadCreated(DownloadManager* manager, DownloadItem* item) { CefBrowserHostImpl* browser = nullptr; - content::WebContents* contents = item->GetWebContents(); + content::WebContents* contents = + content::DownloadItemUtils::GetWebContents(item); if (contents) { browser = CefBrowserHostImpl::GetBrowserForContents(contents).get(); DCHECK(browser); @@ -360,8 +363,8 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget( if (!item->GetForcedFilePath().empty()) { callback.Run( item->GetForcedFilePath(), DownloadItem::TARGET_DISPOSITION_OVERWRITE, - content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, item->GetForcedFilePath(), - content::DOWNLOAD_INTERRUPT_REASON_NONE); + download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, item->GetForcedFilePath(), + download::DOWNLOAD_INTERRUPT_REASON_NONE); return true; } @@ -419,6 +422,6 @@ CefBrowserHostImpl* CefDownloadManagerDelegate::GetBrowser(DownloadItem* item) { // StartDownloadWithId (originating from CreateInterruptedDownload) with no // associated WebContents and consequently no associated CEF browser. In that // case DetermineDownloadTarget will be called before OnDownloadCreated. - DCHECK(!item->GetWebContents()); + DCHECK(!content::DownloadItemUtils::GetWebContents(item)); return nullptr; } diff --git a/libcef/browser/download_manager_delegate.h b/libcef/browser/download_manager_delegate.h index d0a7627b9..1bf542820 100644 --- a/libcef/browser/download_manager_delegate.h +++ b/libcef/browser/download_manager_delegate.h @@ -12,11 +12,11 @@ #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" -#include "content/public/browser/download_item.h" +#include "components/download/public/common/download_item.h" #include "content/public/browser/download_manager.h" #include "content/public/browser/download_manager_delegate.h" -class CefDownloadManagerDelegate : public content::DownloadItem::Observer, +class CefDownloadManagerDelegate : public download::DownloadItem::Observer, public content::DownloadManager::Observer, public content::DownloadManagerDelegate, public CefBrowserHostImpl::Observer { @@ -26,24 +26,24 @@ class CefDownloadManagerDelegate : public content::DownloadItem::Observer, private: // DownloadItem::Observer methods. - void OnDownloadUpdated(content::DownloadItem* item) override; - void OnDownloadDestroyed(content::DownloadItem* item) override; + void OnDownloadUpdated(download::DownloadItem* item) override; + void OnDownloadDestroyed(download::DownloadItem* item) override; // DownloadManager::Observer methods. void OnDownloadCreated(content::DownloadManager* manager, - content::DownloadItem* item) override; + download::DownloadItem* item) override; void ManagerGoingDown(content::DownloadManager* manager) override; // DownloadManagerDelegate methods. bool DetermineDownloadTarget( - content::DownloadItem* item, + download::DownloadItem* item, const content::DownloadTargetCallback& callback) override; void GetNextId(const content::DownloadIdCallback& callback) override; // CefBrowserHostImpl::Observer methods. void OnBrowserDestroyed(CefBrowserHostImpl* browser) override; - CefBrowserHostImpl* GetBrowser(content::DownloadItem* item); + CefBrowserHostImpl* GetBrowser(download::DownloadItem* item); content::DownloadManager* manager_; base::WeakPtrFactory manager_ptr_factory_; @@ -51,7 +51,7 @@ class CefDownloadManagerDelegate : public content::DownloadItem::Observer, // Map of DownloadItem to originating CefBrowserHostImpl. Maintaining this // map is necessary because DownloadItem::GetWebContents() may return NULL if // the browser navigates while the download is in progress. - typedef std::map ItemBrowserMap; + typedef std::map ItemBrowserMap; ItemBrowserMap item_browser_map_; DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate); diff --git a/libcef/browser/extensions/extension_function_details.cc b/libcef/browser/extensions/extension_function_details.cc index 66134d99d..66940bfa8 100644 --- a/libcef/browser/extensions/extension_function_details.cc +++ b/libcef/browser/extensions/extension_function_details.cc @@ -415,36 +415,36 @@ std::unique_ptr CefExtensionFunctionDetails::CreateTabObject( content::WebContents* contents = new_browser->web_contents(); bool is_loading = contents->IsLoading(); - auto tab_object = base::MakeUnique(); - tab_object->id = base::MakeUnique(new_browser->GetIdentifier()); + auto tab_object = std::make_unique(); + tab_object->id = std::make_unique(new_browser->GetIdentifier()); tab_object->index = index; tab_object->window_id = *tab_object->id; - tab_object->status = base::MakeUnique( + tab_object->status = std::make_unique( is_loading ? keys::kStatusValueLoading : keys::kStatusValueComplete); tab_object->active = active; tab_object->selected = true; tab_object->highlighted = true; tab_object->pinned = false; - tab_object->audible = base::MakeUnique(contents->WasRecentlyAudible()); + tab_object->audible = std::make_unique(contents->WasRecentlyAudible()); tab_object->discarded = false; tab_object->auto_discardable = false; tab_object->muted_info = CreateMutedInfo(contents); tab_object->incognito = false; gfx::Size contents_size = contents->GetContainerBounds().size(); - tab_object->width = base::MakeUnique(contents_size.width()); - tab_object->height = base::MakeUnique(contents_size.height()); - tab_object->url = base::MakeUnique(contents->GetURL().spec()); + tab_object->width = std::make_unique(contents_size.width()); + tab_object->height = std::make_unique(contents_size.height()); + tab_object->url = std::make_unique(contents->GetURL().spec()); tab_object->title = - base::MakeUnique(base::UTF16ToUTF8(contents->GetTitle())); + std::make_unique(base::UTF16ToUTF8(contents->GetTitle())); content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); if (entry && entry->GetFavicon().valid) { tab_object->fav_icon_url = - base::MakeUnique(entry->GetFavicon().url.spec()); + std::make_unique(entry->GetFavicon().url.spec()); } if (opener_browser_id >= 0) - tab_object->opener_tab_id = base::MakeUnique(opener_browser_id); + tab_object->opener_tab_id = std::make_unique(opener_browser_id); return tab_object; } diff --git a/libcef/browser/extensions/extension_system.cc b/libcef/browser/extensions/extension_system.cc index d68477f38..193b13ddc 100644 --- a/libcef/browser/extensions/extension_system.cc +++ b/libcef/browser/extensions/extension_system.cc @@ -20,7 +20,6 @@ #include "base/path_service.h" #include "base/strings/string_tokenizer.h" #include "base/strings/utf_string_conversions.h" -#include "base/task_scheduler/post_task.h" #include "base/threading/thread_restrictions.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/chrome_paths.h" @@ -112,7 +111,7 @@ void LoadExtensionWithManifest(base::WeakPtr context, bool internal, CefRefPtr loader_context, CefRefPtr handler) { - base::AssertBlockingAllowed(); + CEF_REQUIRE_BLOCKING(); std::unique_ptr manifest = ParseManifest(manifest_contents); @@ -131,7 +130,7 @@ void LoadExtensionFromDisk(base::WeakPtr context, bool internal, CefRefPtr loader_context, CefRefPtr handler) { - base::AssertBlockingAllowed(); + CEF_REQUIRE_BLOCKING(); base::FilePath manifest_path = root_directory.AppendASCII("manifest.json"); std::string manifest_contents; @@ -239,8 +238,7 @@ void CefExtensionSystem::LoadExtension( CefRefPtr loader_context, CefRefPtr handler) { CEF_REQUIRE_UIT(); - base::PostTaskWithTraits( - FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()}, + CEF_POST_USER_VISIBLE_TASK( base::BindOnce(LoadExtensionFromDisk, weak_ptr_factory_.GetWeakPtr(), root_directory, internal, loader_context, handler)); } @@ -252,11 +250,9 @@ void CefExtensionSystem::LoadExtension( CefRefPtr loader_context, CefRefPtr handler) { CEF_REQUIRE_UIT(); - base::PostTaskWithTraits( - FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()}, - base::BindOnce(LoadExtensionWithManifest, weak_ptr_factory_.GetWeakPtr(), - manifest_contents, root_directory, internal, - loader_context, handler)); + CEF_POST_USER_VISIBLE_TASK(base::BindOnce( + LoadExtensionWithManifest, weak_ptr_factory_.GetWeakPtr(), + manifest_contents, root_directory, internal, loader_context, handler)); } // Implementation based on ComponentLoader::Add. @@ -453,7 +449,7 @@ ContentVerifier* CefExtensionSystem::content_verifier() { std::unique_ptr CefExtensionSystem::GetDependentExtensions( const Extension* extension) { - return base::MakeUnique(); + return std::make_unique(); } void CefExtensionSystem::InstallUpdate( @@ -465,6 +461,13 @@ void CefExtensionSystem::InstallUpdate( base::DeleteFile(temp_dir, true /* recursive */); } +bool CefExtensionSystem::FinishDelayedInstallationIfReady( + const std::string& extension_id, + bool install_immediately) { + NOTREACHED(); + return false; +} + CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo( const base::DictionaryValue* manifest, const base::FilePath& directory, diff --git a/libcef/browser/extensions/extension_system.h b/libcef/browser/extensions/extension_system.h index b836febd4..a96c267f9 100644 --- a/libcef/browser/extensions/extension_system.h +++ b/libcef/browser/extensions/extension_system.h @@ -115,6 +115,8 @@ class CefExtensionSystem : public ExtensionSystem { const std::string& public_key, const base::FilePath& temp_dir, InstallUpdateCallback install_update_callback) override; + bool FinishDelayedInstallationIfReady(const std::string& extension_id, + bool install_immediately) override; bool initialized() const { return initialized_; } diff --git a/libcef/browser/extensions/extensions_browser_client.cc b/libcef/browser/extensions/extensions_browser_client.cc index f1f61ff8d..6e774df01 100644 --- a/libcef/browser/extensions/extensions_browser_client.cc +++ b/libcef/browser/extensions/extensions_browser_client.cc @@ -123,6 +123,25 @@ CefExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob( send_cors_header); } +base::FilePath CefExtensionsBrowserClient::GetBundleResourcePath( + const network::ResourceRequest& request, + const base::FilePath& extension_resources_path, + int* resource_id) const { + *resource_id = 0; + return base::FilePath(); +} + +void CefExtensionsBrowserClient::LoadResourceFromResourceBundle( + const network::ResourceRequest& request, + network::mojom::URLLoaderRequest loader, + const base::FilePath& resource_relative_path, + int resource_id, + const std::string& content_security_policy, + network::mojom::URLLoaderClientPtr client, + bool send_cors_header) { + NOTREACHED() << "Load resources from bundles not supported."; +} + bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad( const GURL& url, content::ResourceType resource_type, @@ -239,6 +258,11 @@ bool CefExtensionsBrowserClient::IsRunningInForcedAppMode() { return false; } +bool CefExtensionsBrowserClient::IsAppModeForcedForApp( + const ExtensionId& extension_id) { + return false; +} + bool CefExtensionsBrowserClient::IsLoggedInAsPublicAccount() { return false; } diff --git a/libcef/browser/extensions/extensions_browser_client.h b/libcef/browser/extensions/extensions_browser_client.h index 5c74953df..82394fee7 100644 --- a/libcef/browser/extensions/extensions_browser_client.h +++ b/libcef/browser/extensions/extensions_browser_client.h @@ -51,6 +51,18 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient { const base::FilePath& directory_path, const std::string& content_security_policy, bool send_cors_header) override; + base::FilePath GetBundleResourcePath( + const network::ResourceRequest& request, + const base::FilePath& extension_resources_path, + int* resource_id) const override; + void LoadResourceFromResourceBundle( + const network::ResourceRequest& request, + network::mojom::URLLoaderRequest loader, + const base::FilePath& resource_relative_path, + int resource_id, + const std::string& content_security_policy, + network::mojom::URLLoaderClientPtr client, + bool send_cors_header) override; bool AllowCrossRendererResourceLoad(const GURL& url, content::ResourceType resource_type, ui::PageTransition page_transition, @@ -73,6 +85,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient { bool DidVersionUpdate(content::BrowserContext* context) override; void PermitExternalProtocolHandler() override; bool IsRunningInForcedAppMode() override; + bool IsAppModeForcedForApp(const ExtensionId& extension_id) override; bool IsLoggedInAsPublicAccount() override; ExtensionSystemProvider* GetExtensionSystemFactory() override; void RegisterExtensionFunctions( diff --git a/libcef/browser/javascript_dialog_manager.cc b/libcef/browser/javascript_dialog_manager.cc index 9dfb11093..d27909b52 100644 --- a/libcef/browser/javascript_dialog_manager.cc +++ b/libcef/browser/javascript_dialog_manager.cc @@ -79,12 +79,14 @@ void CefJavaScriptDialogManager::Destroy() { void CefJavaScriptDialogManager::RunJavaScriptDialog( content::WebContents* web_contents, - const GURL& origin_url, + content::RenderFrameHost* render_frame_host, content::JavaScriptDialogType message_type, const base::string16& message_text, const base::string16& default_prompt_text, DialogClosedCallback callback, bool* did_suppress_message) { + const GURL& origin_url = render_frame_host->GetLastCommittedURL(); + CefRefPtr client = browser_->GetClient(); if (client.get()) { CefRefPtr handler = client->GetJSDialogHandler(); diff --git a/libcef/browser/javascript_dialog_manager.h b/libcef/browser/javascript_dialog_manager.h index ca179207b..227cb5262 100644 --- a/libcef/browser/javascript_dialog_manager.h +++ b/libcef/browser/javascript_dialog_manager.h @@ -29,7 +29,7 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager { // JavaScriptDialogManager methods. void RunJavaScriptDialog(content::WebContents* web_contents, - const GURL& origin_url, + content::RenderFrameHost* render_frame_host, content::JavaScriptDialogType message_type, const base::string16& message_text, const base::string16& default_prompt_text, diff --git a/libcef/browser/native/browser_platform_delegate_native_win.cc b/libcef/browser/native/browser_platform_delegate_native_win.cc index db85b8acb..f47d53e72 100644 --- a/libcef/browser/native/browser_platform_delegate_native_win.cc +++ b/libcef/browser/native/browser_platform_delegate_native_win.cc @@ -42,7 +42,7 @@ namespace { void WriteTempFileAndView(scoped_refptr str) { - CEF_REQUIRE_FILET(); + CEF_REQUIRE_BLOCKING(); base::FilePath tmp_file; if (!base::CreateTemporaryFile(&tmp_file)) @@ -84,7 +84,7 @@ bool HasExternalHandler(const std::string& scheme) { } void ExecuteExternalProtocol(const GURL& url) { - CEF_REQUIRE_FILET(); + CEF_REQUIRE_BLOCKING(); if (!HasExternalHandler(url.scheme())) return; @@ -324,7 +324,7 @@ void CefBrowserPlatformDelegateNativeWin::ViewText(const std::string& text) { std::string str = text; scoped_refptr str_ref = base::RefCountedString::TakeString(&str); - CEF_POST_TASK(CEF_FILET, base::Bind(WriteTempFileAndView, str_ref)); + CEF_POST_USER_VISIBLE_TASK(base::Bind(WriteTempFileAndView, str_ref)); } void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent( @@ -370,8 +370,7 @@ void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent( void CefBrowserPlatformDelegateNativeWin::HandleExternalProtocol( const GURL& url) { - // Execute on the FILE thread. - CEF_POST_TASK(CEF_FILET, base::Bind(ExecuteExternalProtocol, url)); + CEF_POST_USER_VISIBLE_TASK(base::Bind(ExecuteExternalProtocol, url)); } void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent( diff --git a/libcef/browser/native/native_menu_win.cc b/libcef/browser/native/native_menu_win.cc index 9afe393c6..7dc81d6aa 100644 --- a/libcef/browser/native/native_menu_win.cc +++ b/libcef/browser/native/native_menu_win.cc @@ -647,7 +647,7 @@ void CefNativeMenuWin::AddMenuItemAt(int menu_index, int model_index) { else mii.fType = MFT_OWNERDRAW; - std::unique_ptr item_data = base::MakeUnique(); + std::unique_ptr item_data = std::make_unique(); item_data->label = base::string16(); ui::MenuModel::ItemType type = model_->GetTypeAt(model_index); if (type == ui::MenuModel::TYPE_SUBMENU) { @@ -676,7 +676,7 @@ void CefNativeMenuWin::AddSeparatorItemAt(int menu_index, int model_index) { mii.fType = MFT_SEPARATOR; // Insert a dummy entry into our label list so we can index directly into it // using item indices if need be. - items_.insert(items_.begin() + model_index, base::MakeUnique()); + items_.insert(items_.begin() + model_index, std::make_unique()); InsertMenuItem(menu_, menu_index, TRUE, &mii); } diff --git a/libcef/browser/native/window_x11.cc b/libcef/browser/native/window_x11.cc index 626968374..32b840f01 100644 --- a/libcef/browser/native/window_x11.cc +++ b/libcef/browser/native/window_x11.cc @@ -333,7 +333,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) { } break; } - case FocusIn: + case x11::FocusIn: // This message is received first followed by a "_NET_ACTIVE_WINDOW" // message sent to the root window. When X11DesktopHandler handles the // "_NET_ACTIVE_WINDOW" message it will erroneously mark the WebView @@ -347,7 +347,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) { 100); } break; - case FocusOut: + case x11::FocusOut: // Cancel the pending focus change if some other window has gained focus // while waiting for the async task to run. Otherwise we can get stuck in // a focus change loop. diff --git a/libcef/browser/net/chrome_scheme_handler.cc b/libcef/browser/net/chrome_scheme_handler.cc index e271624c6..8139ae0a2 100644 --- a/libcef/browser/net/chrome_scheme_handler.cc +++ b/libcef/browser/net/chrome_scheme_handler.cc @@ -72,7 +72,6 @@ const char* kAllowedWebUIHosts[] = { chrome::kChromeUINetInternalsHost, content::kChromeUINetworkErrorHost, content::kChromeUINetworkErrorsListingHost, - content::kChromeUINetworkViewCacheHost, content::kChromeUIResourcesHost, content::kChromeUIServiceWorkerInternalsHost, chrome::kChromeUISystemInfoHost, @@ -794,6 +793,7 @@ void DidFinishChromeLoad(CefRefPtr frame, const GURL& validated_url) { switch (host_id) { case CHROME_VERSION: DidFinishChromeVersionLoad(frame); + break; default: break; } diff --git a/libcef/browser/net/cookie_store_proxy.cc b/libcef/browser/net/cookie_store_proxy.cc index 50aef38ce..17daea96e 100644 --- a/libcef/browser/net/cookie_store_proxy.cc +++ b/libcef/browser/net/cookie_store_proxy.cc @@ -11,6 +11,32 @@ #include "base/logging.h" #include "net/url_request/url_request_context.h" +namespace { + +class NullCookieChangeDispatcher : public net::CookieChangeDispatcher { + public: + NullCookieChangeDispatcher() {} + ~NullCookieChangeDispatcher() override {} + + // net::CookieChangeDispatcher + std::unique_ptr AddCallbackForCookie( + const GURL& url, + const std::string& name, + net::CookieChangeCallback callback) override WARN_UNUSED_RESULT { + return nullptr; + } + + std::unique_ptr AddCallbackForAllChanges( + net::CookieChangeCallback callback) override WARN_UNUSED_RESULT { + return nullptr; + } + + private: + DISALLOW_COPY_AND_ASSIGN(NullCookieChangeDispatcher); +}; + +} // namespace + CefCookieStoreProxy::CefCookieStoreProxy( CefURLRequestContextImpl* parent, CefRefPtr handler) @@ -53,18 +79,6 @@ void CefCookieStoreProxy::SetCanonicalCookieAsync( } } -void CefCookieStoreProxy::GetCookiesWithOptionsAsync( - const GURL& url, - const net::CookieOptions& options, - GetCookiesCallback callback) { - net::CookieStore* cookie_store = GetCookieStore(); - if (cookie_store) { - cookie_store->GetCookiesWithOptionsAsync(url, options, std::move(callback)); - } else if (!callback.is_null()) { - std::move(callback).Run(std::string()); - } -} - void CefCookieStoreProxy::GetCookieListWithOptionsAsync( const GURL& url, const net::CookieOptions& options, @@ -154,26 +168,14 @@ void CefCookieStoreProxy::FlushStore(base::OnceClosure callback) { } } -std::unique_ptr -CefCookieStoreProxy::AddCallbackForCookie( - const GURL& url, - const std::string& name, - const CookieChangedCallback& callback) { +net::CookieChangeDispatcher& CefCookieStoreProxy::GetChangeDispatcher() { net::CookieStore* cookie_store = GetCookieStore(); - if (cookie_store) { - return cookie_store->AddCallbackForCookie(url, name, callback); - } - return nullptr; -} + if (cookie_store) + return cookie_store->GetChangeDispatcher(); -std::unique_ptr -CefCookieStoreProxy::AddCallbackForAllChanges( - const CookieChangedCallback& callback) { - net::CookieStore* cookie_store = GetCookieStore(); - if (cookie_store) { - return cookie_store->AddCallbackForAllChanges(callback); - } - return nullptr; + if (!null_dispatcher_) + null_dispatcher_.reset(new NullCookieChangeDispatcher()); + return *null_dispatcher_; } bool CefCookieStoreProxy::IsEphemeral() { diff --git a/libcef/browser/net/cookie_store_proxy.h b/libcef/browser/net/cookie_store_proxy.h index 5a7c6e834..e8b72cc84 100644 --- a/libcef/browser/net/cookie_store_proxy.h +++ b/libcef/browser/net/cookie_store_proxy.h @@ -30,9 +30,6 @@ class CefCookieStoreProxy : public net::CookieStore { bool secure_source, bool modify_http_only, SetCookiesCallback callback) override; - void GetCookiesWithOptionsAsync(const GURL& url, - const net::CookieOptions& options, - GetCookiesCallback callback) override; void GetCookieListWithOptionsAsync(const GURL& url, const net::CookieOptions& options, GetCookieListCallback callback) override; @@ -52,12 +49,7 @@ class CefCookieStoreProxy : public net::CookieStore { DeleteCallback callback) override; void DeleteSessionCookiesAsync(DeleteCallback callback) override; void FlushStore(base::OnceClosure callback) override; - std::unique_ptr AddCallbackForCookie( - const GURL& url, - const std::string& name, - const CookieChangedCallback& callback) override; - std::unique_ptr AddCallbackForAllChanges( - const CookieChangedCallback& callback) override; + net::CookieChangeDispatcher& GetChangeDispatcher() override; bool IsEphemeral() override; private: @@ -68,6 +60,8 @@ class CefCookieStoreProxy : public net::CookieStore { CefURLRequestContextImpl* parent_; CefRefPtr handler_; + std::unique_ptr null_dispatcher_; + DISALLOW_COPY_AND_ASSIGN(CefCookieStoreProxy); }; diff --git a/libcef/browser/net/crlset_file_util_impl.cc b/libcef/browser/net/crlset_file_util_impl.cc index 808d6ffb3..191d879d0 100644 --- a/libcef/browser/net/crlset_file_util_impl.cc +++ b/libcef/browser/net/crlset_file_util_impl.cc @@ -9,10 +9,8 @@ #include "base/files/file_util.h" #include "base/logging.h" -#include "base/task_scheduler/post_task.h" #include "base/threading/thread_restrictions.h" #include "net/cert/crl_set.h" -#include "net/cert/crl_set_storage.h" #include "net/ssl/ssl_config_service.h" namespace { @@ -25,7 +23,7 @@ void SetCRLSetIfNewer(scoped_refptr crl_set) { } void LoadFromDisk(const base::FilePath& path) { - base::AssertBlockingAllowed(); + CEF_REQUIRE_BLOCKING(); std::string crl_set_bytes; if (!base::ReadFileToString(path, &crl_set_bytes)) { @@ -34,7 +32,7 @@ void LoadFromDisk(const base::FilePath& path) { } scoped_refptr crl_set; - if (!net::CRLSetStorage::Parse(crl_set_bytes, &crl_set)) { + if (!net::CRLSet::Parse(crl_set_bytes, &crl_set)) { LOG(WARNING) << "Failed to parse CRL set from " << path.MaybeAsASCII(); return; } @@ -51,7 +49,5 @@ void CefLoadCRLSetsFile(const CefString& path) { return; } - base::PostTaskWithTraits(FROM_HERE, - {base::TaskPriority::BACKGROUND, base::MayBlock()}, - base::BindOnce(&LoadFromDisk, path)); + CEF_POST_USER_VISIBLE_TASK(base::BindOnce(&LoadFromDisk, path)); } diff --git a/libcef/browser/net/network_delegate.cc b/libcef/browser/net/network_delegate.cc index 7c94a2689..4ded88779 100644 --- a/libcef/browser/net/network_delegate.cc +++ b/libcef/browser/net/network_delegate.cc @@ -272,7 +272,7 @@ std::unique_ptr CefNetworkDelegate::CreateSourceStream( } if (cef_filter && cef_filter->InitFilter()) - return base::MakeUnique(cef_filter, std::move(upstream)); + return std::make_unique(cef_filter, std::move(upstream)); return upstream; } diff --git a/libcef/browser/net/resource_request_job.cc b/libcef/browser/net/resource_request_job.cc index bdfd8b731..30512eb57 100644 --- a/libcef/browser/net/resource_request_job.cc +++ b/libcef/browser/net/resource_request_job.cc @@ -331,7 +331,7 @@ bool CefResourceRequestJob::GetMimeType(std::string* mime_type) const { bool CefResourceRequestJob::GetCharset(std::string* charset) { CEF_REQUIRE_IOT(); - if (net::HttpResponseHeaders *headers = GetResponseHeaders()) + if (net::HttpResponseHeaders* headers = GetResponseHeaders()) return headers->GetCharset(charset); return false; } @@ -411,7 +411,7 @@ void CefResourceRequestJob::AddCookieHeaderAndStart() { void CefResourceRequestJob::DoLoadCookies() { net::CookieOptions options; options.set_include_httponly(); - request_->context()->cookie_store()->GetCookiesWithOptionsAsync( + request_->context()->cookie_store()->GetCookieListWithOptionsAsync( request_->url(), options, base::Bind(&CefResourceRequestJob::OnCookiesLoaded, weak_factory_.GetWeakPtr())); @@ -438,8 +438,11 @@ void CefResourceRequestJob::CheckCookiePolicyAndLoad( DoStartTransaction(); } -void CefResourceRequestJob::OnCookiesLoaded(const std::string& cookie_line) { - if (!cookie_line.empty()) { +void CefResourceRequestJob::OnCookiesLoaded( + const net::CookieList& cookie_list) { + if (!cookie_list.empty()) { + const std::string& cookie_line = + net::CanonicalCookie::BuildCookieLine(cookie_list); CefRequest::HeaderMap headerMap; cef_request_->GetHeaderMap(headerMap); headerMap.insert( diff --git a/libcef/browser/net/resource_request_job.h b/libcef/browser/net/resource_request_job.h index aad333619..362dd6847 100644 --- a/libcef/browser/net/resource_request_job.h +++ b/libcef/browser/net/resource_request_job.h @@ -20,7 +20,7 @@ namespace net { class HttpResponseHeaders; class URLRequest; -} +} // namespace net class CefResourceRequestJobCallback; @@ -48,7 +48,7 @@ class CefResourceRequestJob : public net::URLRequestJob { void AddCookieHeaderAndStart(); void DoLoadCookies(); void CheckCookiePolicyAndLoad(const net::CookieList& cookie_list); - void OnCookiesLoaded(const std::string& cookie_line); + void OnCookiesLoaded(const net::CookieList& cookie_list); void DoStartTransaction(); void StartTransaction(); diff --git a/libcef/browser/net/scheme_handler.cc b/libcef/browser/net/scheme_handler.cc index eb7dc5861..7f27f5c2e 100644 --- a/libcef/browser/net/scheme_handler.cc +++ b/libcef/browser/net/scheme_handler.cc @@ -35,7 +35,7 @@ void InstallInternalProtectedHandlers( url::kFileScheme, linked_ptr( new net::FileProtocolHandler(base::CreateTaskRunnerWithTraits( - {base::MayBlock(), base::TaskPriority::BACKGROUND, + {base::MayBlock(), base::TaskPriority::USER_VISIBLE, base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))))); #if !BUILDFLAG(DISABLE_FTP_SUPPORT) protocol_handlers->insert(std::make_pair( diff --git a/libcef/browser/net/url_request_context_getter_impl.cc b/libcef/browser/net/url_request_context_getter_impl.cc index 50c432933..f85418899 100644 --- a/libcef/browser/net/url_request_context_getter_impl.cc +++ b/libcef/browser/net/url_request_context_getter_impl.cc @@ -8,6 +8,7 @@ #include #include +#include "libcef/browser/content_browser_client.h" #include "libcef/browser/cookie_manager_impl.h" #include "libcef/browser/net/network_delegate.h" #include "libcef/browser/net/scheme_handler.h" @@ -31,7 +32,6 @@ #include "components/network_session_configurator/browser/network_session_configurator.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" -#include "content/network/proxy_service_mojo.h" #include "content/public/browser/browser_thread.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" @@ -51,9 +51,9 @@ #include "net/http/http_server_properties_impl.h" #include "net/http/http_util.h" #include "net/http/transport_security_state.h" -#include "net/proxy/dhcp_proxy_script_fetcher_factory.h" -#include "net/proxy/proxy_script_fetcher_impl.h" -#include "net/proxy/proxy_service.h" +#include "net/proxy_resolution/dhcp_pac_file_fetcher_factory.h" +#include "net/proxy_resolution/pac_file_fetcher_impl.h" +#include "net/proxy_resolution/proxy_service.h" #include "net/ssl/ssl_config_service_defaults.h" #include "net/url_request/http_user_agent_settings.h" #include "net/url_request/url_request.h" @@ -62,6 +62,7 @@ #include "net/url_request/url_request_intercepting_job_factory.h" #include "net/url_request/url_request_job_factory_impl.h" #include "net/url_request/url_request_job_manager.h" +#include "services/network/proxy_service_mojo.h" #include "url/url_constants.h" #if defined(OS_WIN) @@ -108,9 +109,9 @@ class CefHttpUserAgentSettings : public net::HttpUserAgentSettings { DISALLOW_COPY_AND_ASSIGN(CefHttpUserAgentSettings); }; -// Based on ProxyServiceFactory::CreateProxyService which was deleted in -// http://crrev.com/1c261ff4. -std::unique_ptr CreateProxyService( +// Based on ProxyResolutionServiceFactory::CreateProxyResolutionService which +// was deleted in http://crrev.com/1c261ff4. +std::unique_ptr CreateProxyResolutionService( net::NetLog* net_log, net::URLRequestContext* context, net::NetworkDelegate* network_delegate, @@ -129,27 +130,27 @@ std::unique_ptr CreateProxyService( use_v8 = false; // Fallback to non-v8 implementation. } - std::unique_ptr proxy_service; + std::unique_ptr proxy_service; if (use_v8) { std::unique_ptr dhcp_proxy_script_fetcher; net::DhcpProxyScriptFetcherFactory dhcp_factory; dhcp_proxy_script_fetcher = dhcp_factory.Create(context); - proxy_service = content::CreateProxyServiceUsingMojoFactory( + proxy_service = network::CreateProxyServiceUsingMojoFactory( std::move(proxy_resolver_factory), std::move(proxy_config_service), - base::MakeUnique(context), + std::make_unique(context), std::move(dhcp_proxy_script_fetcher), context->host_resolver(), net_log, network_delegate); } else { - proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( + proxy_service = net::ProxyResolutionService::CreateUsingSystemProxyResolver( std::move(proxy_config_service), net_log); } proxy_service->set_quick_check_enabled(quick_check_enabled); proxy_service->set_sanitize_url_policy( pac_https_url_stripping_enabled - ? net::ProxyService::SanitizeUrlPolicy::SAFE - : net::ProxyService::SanitizeUrlPolicy::UNSAFE); + ? net::ProxyResolutionService::SanitizeUrlPolicy::SAFE + : net::ProxyResolutionService::SanitizeUrlPolicy::UNSAFE); return proxy_service; } @@ -163,7 +164,7 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl( content::ProtocolHandlerMap* protocol_handlers, std::unique_ptr proxy_config_service, content::URLRequestInterceptorScopedVector request_interceptors) - : settings_(settings), io_state_(base::MakeUnique()) { + : settings_(settings), io_state_(std::make_unique()) { // Must first be created on the UI thread. CEF_REQUIRE_UIT(); @@ -246,9 +247,9 @@ void CefURLRequestContextGetterImpl::ShutdownOnIOThread() { shutting_down_ = true; - // Delete the ProxyService object here so that any pending requests will be - // canceled before the URLRequestContext is destroyed. - io_state_->storage_->set_proxy_service(NULL); + // Delete the ProxyResolutionService object here so that any pending requests + // will be canceled before the URLRequestContext is destroyed. + io_state_->storage_->set_proxy_resolution_service(NULL); io_state_.reset(); @@ -315,15 +316,16 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() { settings_.enable_net_security_expiration ? true : false); io_state_->storage_->set_ct_policy_enforcer(std::move(ct_policy_enforcer)); - std::unique_ptr system_proxy_service = - CreateProxyService(io_state_->net_log_, - io_state_->url_request_context_.get(), - io_state_->url_request_context_->network_delegate(), - std::move(io_state_->proxy_resolver_factory_), - std::move(io_state_->proxy_config_service_), - *command_line, quick_check_enabled_.GetValue(), - pac_https_url_stripping_enabled_.GetValue()); - io_state_->storage_->set_proxy_service(std::move(system_proxy_service)); + std::unique_ptr system_proxy_service = + CreateProxyResolutionService( + io_state_->net_log_, io_state_->url_request_context_.get(), + io_state_->url_request_context_->network_delegate(), + std::move(io_state_->proxy_resolver_factory_), + std::move(io_state_->proxy_config_service_), *command_line, + quick_check_enabled_.GetValue(), + pac_https_url_stripping_enabled_.GetValue()); + io_state_->storage_->set_proxy_resolution_service( + std::move(system_proxy_service)); io_state_->storage_->set_ssl_config_service( new net::SSLConfigServiceDefaults); @@ -372,8 +374,8 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() { io_state_->url_request_context_->cert_transparency_verifier(); network_session_context.ct_policy_enforcer = io_state_->url_request_context_->ct_policy_enforcer(); - network_session_context.proxy_service = - io_state_->url_request_context_->proxy_service(); + network_session_context.proxy_resolution_service = + io_state_->url_request_context_->proxy_resolution_service(); network_session_context.ssl_config_service = io_state_->url_request_context_->ssl_config_service(); network_session_context.http_auth_handler_factory = @@ -414,7 +416,7 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() { scheme::RegisterInternalHandlers(io_state_->url_request_manager_.get()); io_state_->request_interceptors_.push_back( - base::MakeUnique()); + std::make_unique()); // Set up interceptors in the reverse order. std::unique_ptr top_job_factory = @@ -472,7 +474,10 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath( const base::FilePath& cookie_path = path.AppendASCII("Cookies"); persistent_store = new net::SQLitePersistentCookieStore( cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), - BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), + // Intentionally using the background task runner exposed by CEF to + // facilitate unit test expectations. This task runner MUST be + // configured with BLOCK_SHUTDOWN. + CefContentBrowserClient::Get()->background_task_runner(), persist_session_cookies, NULL); } else { NOTREACHED() << "The cookie storage directory could not be created"; diff --git a/libcef/browser/net/url_request_context_proxy.cc b/libcef/browser/net/url_request_context_proxy.cc index 78e3e4dd0..d1b6b64b8 100644 --- a/libcef/browser/net/url_request_context_proxy.cc +++ b/libcef/browser/net/url_request_context_proxy.cc @@ -28,7 +28,7 @@ CefURLRequestContextProxy::CefURLRequestContextProxy( set_cert_transparency_verifier(parent->cert_transparency_verifier()); set_ct_policy_enforcer(parent->ct_policy_enforcer()); set_channel_id_service(parent->channel_id_service()); - set_proxy_service(parent->proxy_service()); + set_proxy_resolution_service(parent->proxy_resolution_service()); set_ssl_config_service(parent->ssl_config_service()); set_http_auth_handler_factory(parent->http_auth_handler_factory()); set_http_transaction_factory(parent->http_transaction_factory()); diff --git a/libcef/browser/osr/osr_accessibility_util.cc b/libcef/browser/osr/osr_accessibility_util.cc index 05369627c..dba1b0d60 100644 --- a/libcef/browser/osr/osr_accessibility_util.cc +++ b/libcef/browser/osr/osr_accessibility_util.cc @@ -12,7 +12,8 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" #include "content/public/browser/ax_event_notification_details.h" -#include "ui/accessibility/ax_enums.h" +#include "ui/accessibility/ax_enum_util.h" +#include "ui/accessibility/ax_enums.mojom.h" #include "ui/accessibility/ax_text_utils.h" #include "ui/accessibility/ax_tree_update.h" #include "ui/gfx/transform.h" @@ -39,9 +40,10 @@ CefRefPtr ToCefValue(uint32_t state) { int index = 0; // Iterate and find which states are set. - for (unsigned i = ui::AX_STATE_NONE; i <= ui::AX_STATE_LAST; i++) { + for (unsigned i = static_cast(ax::mojom::Role::kNone); + i <= static_cast(ax::mojom::Role::kLast); i++) { if (state & (1 << i)) - value->SetString(index++, ToString(static_cast(i))); + value->SetString(index++, ToString(static_cast(i))); } return value; } @@ -65,127 +67,124 @@ struct PopulateAxNodeAttributes { : attributes(attrs) {} // Int Attributes - void operator()(const std::pair attr) { - if (attr.first == ui::AX_INT_ATTRIBUTE_NONE) + void operator()(const std::pair attr) { + if (attr.first == ax::mojom::IntAttribute::kNone) return; switch (attr.first) { - case ui::AX_INT_ATTRIBUTE_NONE: + case ax::mojom::IntAttribute::kNone: break; - case ui::AX_ATTR_SCROLL_X: - case ui::AX_ATTR_SCROLL_X_MIN: - case ui::AX_ATTR_SCROLL_X_MAX: - case ui::AX_ATTR_SCROLL_Y: - case ui::AX_ATTR_SCROLL_Y_MIN: - case ui::AX_ATTR_SCROLL_Y_MAX: - case ui::AX_ATTR_HIERARCHICAL_LEVEL: - case ui::AX_ATTR_TEXT_SEL_START: - case ui::AX_ATTR_TEXT_SEL_END: - case ui::AX_ATTR_ARIA_COLUMN_COUNT: - case ui::AX_ATTR_ARIA_CELL_COLUMN_INDEX: - case ui::AX_ATTR_ARIA_ROW_COUNT: - case ui::AX_ATTR_ARIA_CELL_ROW_INDEX: - case ui::AX_ATTR_TABLE_ROW_COUNT: - case ui::AX_ATTR_TABLE_COLUMN_COUNT: - case ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX: - case ui::AX_ATTR_TABLE_CELL_ROW_INDEX: - case ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN: - case ui::AX_ATTR_TABLE_CELL_ROW_SPAN: - case ui::AX_ATTR_TABLE_COLUMN_HEADER_ID: - case ui::AX_ATTR_TABLE_COLUMN_INDEX: - case ui::AX_ATTR_TABLE_HEADER_ID: - case ui::AX_ATTR_TABLE_ROW_HEADER_ID: - case ui::AX_ATTR_TABLE_ROW_INDEX: - case ui::AX_ATTR_ACTIVEDESCENDANT_ID: - case ui::AX_ATTR_IN_PAGE_LINK_TARGET_ID: - case ui::AX_ATTR_ERRORMESSAGE_ID: - case ui::AX_ATTR_DETAILS_ID: - case ui::AX_ATTR_MEMBER_OF_ID: - case ui::AX_ATTR_NEXT_FOCUS_ID: - case ui::AX_ATTR_NEXT_ON_LINE_ID: - case ui::AX_ATTR_PREVIOUS_FOCUS_ID: - case ui::AX_ATTR_PREVIOUS_ON_LINE_ID: - case ui::AX_ATTR_CHILD_TREE_ID: - case ui::AX_ATTR_SET_SIZE: - case ui::AX_ATTR_POS_IN_SET: + case ax::mojom::IntAttribute::kScrollX: + case ax::mojom::IntAttribute::kScrollXMin: + case ax::mojom::IntAttribute::kScrollXMax: + case ax::mojom::IntAttribute::kScrollY: + case ax::mojom::IntAttribute::kScrollYMin: + case ax::mojom::IntAttribute::kScrollYMax: + case ax::mojom::IntAttribute::kHierarchicalLevel: + case ax::mojom::IntAttribute::kTextSelStart: + case ax::mojom::IntAttribute::kTextSelEnd: + case ax::mojom::IntAttribute::kAriaColumnCount: + case ax::mojom::IntAttribute::kAriaCellColumnIndex: + case ax::mojom::IntAttribute::kAriaRowCount: + case ax::mojom::IntAttribute::kAriaCellRowIndex: + case ax::mojom::IntAttribute::kTableRowCount: + case ax::mojom::IntAttribute::kTableColumnCount: + case ax::mojom::IntAttribute::kTableCellColumnIndex: + case ax::mojom::IntAttribute::kTableCellRowIndex: + case ax::mojom::IntAttribute::kTableCellColumnSpan: + case ax::mojom::IntAttribute::kTableCellRowSpan: + case ax::mojom::IntAttribute::kTableColumnHeaderId: + case ax::mojom::IntAttribute::kTableColumnIndex: + case ax::mojom::IntAttribute::kTableHeaderId: + case ax::mojom::IntAttribute::kTableRowHeaderId: + case ax::mojom::IntAttribute::kTableRowIndex: + case ax::mojom::IntAttribute::kActivedescendantId: + case ax::mojom::IntAttribute::kInPageLinkTargetId: + case ax::mojom::IntAttribute::kErrormessageId: + case ax::mojom::IntAttribute::kDetailsId: + case ax::mojom::IntAttribute::kMemberOfId: + case ax::mojom::IntAttribute::kNextFocusId: + case ax::mojom::IntAttribute::kNextOnLineId: + case ax::mojom::IntAttribute::kPreviousFocusId: + case ax::mojom::IntAttribute::kPreviousOnLineId: + case ax::mojom::IntAttribute::kChildTreeId: + case ax::mojom::IntAttribute::kSetSize: + case ax::mojom::IntAttribute::kPosInSet: attributes->SetInt(ToString(attr.first), attr.second); break; - case ui::AX_ATTR_DEFAULT_ACTION_VERB: + case ax::mojom::IntAttribute::kDefaultActionVerb: attributes->SetString( ToString(attr.first), ui::ActionVerbToUnlocalizedString( - static_cast(attr.second))); + static_cast(attr.second))); break; - case ui::AX_ATTR_INVALID_STATE: - if (ui::AX_INVALID_STATE_NONE != attr.second) { - attributes->SetString( - ToString(attr.first), - ToString(static_cast(attr.second))); + case ax::mojom::IntAttribute::kInvalidState: { + auto state = static_cast(attr.second); + if (ax::mojom::InvalidState::kNone != state) { + attributes->SetString(ToString(attr.first), ToString(state)); } - break; - case ui::AX_ATTR_CHECKED_STATE: - if (ui::AX_CHECKED_STATE_NONE != attr.second) { - attributes->SetString( - ToString(attr.first), - ToString(static_cast(attr.second))); + } break; + case ax::mojom::IntAttribute::kCheckedState: { + auto state = static_cast(attr.second); + if (ax::mojom::CheckedState::kNone != state) { + attributes->SetString(ToString(attr.first), ToString(state)); } - break; - case ui::AX_ATTR_RESTRICTION: + } break; + case ax::mojom::IntAttribute::kRestriction: attributes->SetString( ToString(attr.first), - ToString(static_cast(attr.second))); + ToString(static_cast(attr.second))); break; - case ui::AX_ATTR_SORT_DIRECTION: - if (ui::AX_SORT_DIRECTION_NONE != attr.second) { - attributes->SetString( - ToString(attr.first), - ToString(static_cast(attr.second))); + case ax::mojom::IntAttribute::kSortDirection: { + auto state = static_cast(attr.second); + if (ax::mojom::SortDirection::kNone != state) { + attributes->SetString(ToString(attr.first), ToString(state)); } - break; - case ui::AX_ATTR_NAME_FROM: + } break; + case ax::mojom::IntAttribute::kNameFrom: attributes->SetString( ToString(attr.first), - ToString(static_cast(attr.second))); + ToString(static_cast(attr.second))); break; - case ui::AX_ATTR_COLOR_VALUE: - case ui::AX_ATTR_BACKGROUND_COLOR: - case ui::AX_ATTR_COLOR: + case ax::mojom::IntAttribute::kColorValue: + case ax::mojom::IntAttribute::kBackgroundColor: + case ax::mojom::IntAttribute::kColor: attributes->SetString(ToString(attr.first), base::StringPrintf("0x%X", attr.second)); break; - case ui::AX_ATTR_DESCRIPTION_FROM: + case ax::mojom::IntAttribute::kDescriptionFrom: attributes->SetString( ToString(attr.first), - ToString(static_cast(attr.second))); + ToString(static_cast(attr.second))); break; - case ui::AX_ATTR_ARIA_CURRENT_STATE: - if (ui::AX_ARIA_CURRENT_STATE_NONE != attr.second) { - attributes->SetString( - ToString(attr.first), - ToString(static_cast(attr.second))); + case ax::mojom::IntAttribute::kAriaCurrentState: { + auto state = static_cast(attr.second); + if (ax::mojom::AriaCurrentState::kNone != state) { + attributes->SetString(ToString(attr.first), ToString(state)); } - break; - case ui::AX_ATTR_TEXT_DIRECTION: - if (ui::AX_TEXT_DIRECTION_NONE != attr.second) { - attributes->SetString( - ToString(attr.first), - ToString(static_cast(attr.second))); + } break; + case ax::mojom::IntAttribute::kTextDirection: { + auto state = static_cast(attr.second); + if (ax::mojom::TextDirection::kNone != state) { + attributes->SetString(ToString(attr.first), ToString(state)); } - break; - case ui::AX_ATTR_TEXT_STYLE: { - auto text_style = static_cast(attr.second); - if (text_style == ui::AX_TEXT_STYLE_NONE) + } break; + case ax::mojom::IntAttribute::kTextStyle: { + auto text_style = static_cast(attr.second); + if (text_style == ax::mojom::TextStyle::kNone) break; - static ui::AXTextStyle textStyleArr[] = { - ui::AX_TEXT_STYLE_BOLD, ui::AX_TEXT_STYLE_ITALIC, - ui::AX_TEXT_STYLE_UNDERLINE, ui::AX_TEXT_STYLE_LINE_THROUGH}; + static ax::mojom::TextStyle textStyleArr[] = { + ax::mojom::TextStyle::kTextStyleBold, + ax::mojom::TextStyle::kTextStyleItalic, + ax::mojom::TextStyle::kTextStyleUnderline, + ax::mojom::TextStyle::kTextStyleLineThrough}; CefRefPtr list = CefListValue::Create(); int index = 0; // Iterate and find which states are set. for (unsigned i = 0; i < arraysize(textStyleArr); i++) { - if (text_style & textStyleArr[i]) + if (attr.second & static_cast(textStyleArr[i])) list->SetString(index++, ToString(textStyleArr[i])); } attributes->SetList(ToString(attr.first), list); @@ -194,43 +193,44 @@ struct PopulateAxNodeAttributes { } // Set Bool Attributes. - void operator()(const std::pair attr) { - if (attr.first != ui::AX_BOOL_ATTRIBUTE_NONE) + void operator()(const std::pair attr) { + if (attr.first != ax::mojom::BoolAttribute::kNone) attributes->SetBool(ToString(attr.first), attr.second); } // Set String Attributes. - void operator()(const std::pair& attr) { - if (attr.first != ui::AX_STRING_ATTRIBUTE_NONE) + void operator()( + const std::pair& attr) { + if (attr.first != ax::mojom::StringAttribute::kNone) attributes->SetString(ToString(attr.first), attr.second); } // Set Float attributes. - void operator()(const std::pair& attr) { - if (attr.first != ui::AX_FLOAT_ATTRIBUTE_NONE) + void operator()(const std::pair& attr) { + if (attr.first != ax::mojom::FloatAttribute::kNone) attributes->SetDouble(ToString(attr.first), attr.second); } // Set Int list attributes. - void operator()( - const std::pair>& attr) { - if (attr.first != ui::AX_INT_LIST_ATTRIBUTE_NONE) { + void operator()(const std::pair>& attr) { + if (attr.first != ax::mojom::IntListAttribute::kNone) { CefRefPtr list; - if (ui::AX_ATTR_MARKER_TYPES == attr.first) { + if (ax::mojom::IntListAttribute::kMarkerTypes == attr.first) { list = CefListValue::Create(); int index = 0; for (size_t i = 0; i < attr.second.size(); ++i) { - auto type = static_cast(attr.second[i]); + auto type = static_cast(attr.second[i]); - if (type == ui::AX_MARKER_TYPE_NONE) + if (type == ax::mojom::MarkerType::kNone) continue; - static ui::AXMarkerType marktypeArr[] = { - ui::AX_MARKER_TYPE_SPELLING, ui::AX_MARKER_TYPE_GRAMMAR, - ui::AX_MARKER_TYPE_TEXT_MATCH}; + static ax::mojom::MarkerType marktypeArr[] = { + ax::mojom::MarkerType::kSpelling, ax::mojom::MarkerType::kGrammar, + ax::mojom::MarkerType::kTextMatch}; // Iterate and find which markers are set. for (unsigned j = 0; j < arraysize(marktypeArr); j++) { - if (type & marktypeArr[j]) + if (attr.second[i] & static_cast(marktypeArr[j])) list->SetString(index++, ToString(marktypeArr[j])); } } @@ -267,9 +267,10 @@ CefRefPtr ToCefValue(const ui::AXNodeData& node) { CefRefPtr actions_strings; size_t actions_idx = 0; - for (int action_index = ui::AX_ACTION_NONE + 1; - action_index <= ui::AX_ACTION_LAST; ++action_index) { - auto action = static_cast(action_index); + for (int action_index = static_cast(ax::mojom::Action::kNone) + 1; + action_index <= static_cast(ax::mojom::Action::kLast); + ++action_index) { + auto action = static_cast(action_index); if (node.HasAction(action)) { if (!actions_strings) actions_strings = CefListValue::Create(); @@ -383,10 +384,10 @@ CefRefPtr ToCefValue( if (eventData.ax_tree_id != -1) value->SetInt("ax_tree_id", eventData.ax_tree_id); - if (eventData.event_type != ui::AX_EVENT_NONE) + if (eventData.event_type != ax::mojom::Event::kNone) value->SetString("event_type", ToString(eventData.event_type)); - if (eventData.event_from != ui::AX_EVENT_FROM_NONE) + if (eventData.event_from != ax::mojom::EventFrom::kNone) value->SetString("event_from", ToString(eventData.event_from)); value->SetDictionary("update", ToCefValue(eventData.update)); diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index d6757de04..9f0447478 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -18,6 +18,7 @@ #include "base/command_line.h" #include "base/memory/ptr_util.h" #include "cc/base/switches.h" +#include "components/viz/common/features.h" #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" @@ -28,14 +29,15 @@ #include "content/browser/renderer_host/dip_util.h" #include "content/browser/renderer_host/render_widget_host_delegate.h" #include "content/browser/renderer_host/render_widget_host_impl.h" -#include "content/browser/renderer_host/render_widget_host_view_frame_subscriber.h" #include "content/common/input_messages.h" #include "content/common/view_messages.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/context_factory.h" +#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/common/content_switches.h" #include "media/base/video_frame.h" +#include "ui/compositor/compositor_vsync_manager.h" #include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/geometry/size_conversions.h" @@ -236,10 +238,16 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( local_surface_id_ = local_surface_id_allocator_.GenerateId(); + // Surface synchronization is not supported with OSR. + DCHECK(!features::IsSurfaceSynchronizationEnabled()); + #if !defined(OS_MACOSX) - delegated_frame_host_ = base::MakeUnique( + // Matching the attributes from BrowserCompositorMac. + delegated_frame_host_ = std::make_unique( AllocateFrameSinkId(is_guest_view_hack), this, - false /* enable_surface_synchronization */, false /* enable_viz */); + features::IsSurfaceSynchronizationEnabled(), + base::FeatureList::IsEnabled(features::kVizDisplayCompositor), + true /* should_register_frame_sink_id */); root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); #endif @@ -256,11 +264,12 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( content::ImageTransportFactory::GetInstance(); ui::ContextFactoryPrivate* context_factory_private = factory->GetContextFactoryPrivate(); + // Matching the attributes from RecyclableCompositorMac. compositor_.reset( new ui::Compositor(context_factory_private->AllocateFrameSinkId(), content::GetContextFactory(), context_factory_private, base::ThreadTaskRunnerHandle::Get(), - false /* enable_surface_synchronization */, + features::IsSurfaceSynchronizationEnabled(), false /* enable_pixel_canvas */)); compositor_->SetAcceleratedWidget(compositor_widget_); compositor_->SetDelegate(this); @@ -359,9 +368,12 @@ void CefRenderWidgetHostViewOSR::Show() { browser_compositor_->SetRenderWidgetHostIsHidden(false); #else delegated_frame_host_->SetCompositor(compositor_.get()); - delegated_frame_host_->WasShown(ui::LatencyInfo()); + delegated_frame_host_->WasShown( + GetLocalSurfaceId(), GetRootLayer()->bounds().size(), ui::LatencyInfo()); #endif + // Note that |render_widget_host_| will retrieve size parameters from the + // DelegatedFrameHost, so it must have WasShown called after. if (render_widget_host_) render_widget_host_->WasShown(ui::LatencyInfo()); } @@ -658,38 +670,49 @@ gfx::Size CefRenderWidgetHostViewOSR::GetPhysicalBackingSize() const { } void CefRenderWidgetHostViewOSR::CopyFromSurface( - const gfx::Rect& src_subrect, - const gfx::Size& dst_size, - const content::ReadbackRequestCallback& callback, - const SkColorType color_type) { - GetDelegatedFrameHost()->CopyFromCompositingSurface(src_subrect, dst_size, - callback, color_type); + const gfx::Rect& src_rect, + const gfx::Size& output_size, + base::OnceCallback callback) { + GetDelegatedFrameHost()->CopyFromCompositingSurface(src_rect, output_size, + std::move(callback)); } -void CefRenderWidgetHostViewOSR::CopyFromSurfaceToVideoFrame( - const gfx::Rect& src_subrect, - scoped_refptr target, - const base::Callback& callback) { - GetDelegatedFrameHost()->CopyFromCompositingSurfaceToVideoFrame( - src_subrect, target, callback); +void CefRenderWidgetHostViewOSR::GetScreenInfo( + content::ScreenInfo* results) const { + if (!browser_impl_.get()) + return; + + CefScreenInfo screen_info(kDefaultScaleFactor, 0, 0, false, CefRect(), + CefRect()); + + CefRefPtr handler = + browser_impl_->client()->GetRenderHandler(); + if (handler.get() && + (!handler->GetScreenInfo(browser_impl_.get(), screen_info) || + screen_info.rect.width == 0 || screen_info.rect.height == 0 || + screen_info.available_rect.width == 0 || + screen_info.available_rect.height == 0)) { + // If a screen rectangle was not provided, try using the view rectangle + // instead. Otherwise, popup views may be drawn incorrectly, or not at all. + CefRect screenRect; + if (!handler->GetViewRect(browser_impl_.get(), screenRect)) { + NOTREACHED(); + screenRect = CefRect(); + } + + if (screen_info.rect.width == 0 && screen_info.rect.height == 0) + screen_info.rect = screenRect; + + if (screen_info.available_rect.width == 0 && + screen_info.available_rect.height == 0) + screen_info.available_rect = screenRect; + } + + *results = ScreenInfoFrom(screen_info); } -void CefRenderWidgetHostViewOSR::BeginFrameSubscription( - std::unique_ptr subscriber) { - GetDelegatedFrameHost()->BeginFrameSubscription(std::move(subscriber)); -} - -void CefRenderWidgetHostViewOSR::EndFrameSubscription() { - GetDelegatedFrameHost()->EndFrameSubscription(); -} - -bool CefRenderWidgetHostViewOSR::HasAcceleratedSurface( - const gfx::Size& desired_size) { - // CEF doesn't use GetBackingStore for accelerated pages, so it doesn't - // matter what is returned here as GetBackingStore is the only caller of this - // method. - NOTREACHED(); - return false; +gfx::Vector2d CefRenderWidgetHostViewOSR::GetOffsetFromRootSurface() { + return gfx::Vector2d(); } gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() { @@ -844,6 +867,16 @@ bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView( point, target_view, transformed_point); } +void CefRenderWidgetHostViewOSR::DidNavigate() { +#if defined(OS_MACOSX) + browser_compositor_->DidNavigate(); +#else + ResizeRootLayer(); + if (delegated_frame_host_) + delegated_frame_host_->DidNavigate(); +#endif +} + std::unique_ptr CefRenderWidgetHostViewOSR::CreateSoftwareOutputDevice( ui::Compositor* compositor) { @@ -878,11 +911,6 @@ SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor() const { return background_color_; } -gfx::Size CefRenderWidgetHostViewOSR::DelegatedFrameHostDesiredSizeInDIP() - const { - return GetRootLayer()->bounds().size(); -} - bool CefRenderWidgetHostViewOSR::DelegatedFrameCanCreateResizeLock() const { return !render_widget_host_->auto_resize_enabled(); } @@ -892,13 +920,16 @@ CefRenderWidgetHostViewOSR::DelegatedFrameHostCreateResizeLock() { HoldResize(); const gfx::Size& desired_size = GetRootLayer()->bounds().size(); - return base::MakeUnique(this, desired_size); + return std::make_unique(this, desired_size); } viz::LocalSurfaceId CefRenderWidgetHostViewOSR::GetLocalSurfaceId() const { return local_surface_id_; } +void CefRenderWidgetHostViewOSR::OnFirstSurfaceActivation( + const viz::SurfaceInfo& surface_info) {} + void CefRenderWidgetHostViewOSR::OnBeginFrame(base::TimeTicks frame_time) { // TODO(cef): Maybe we can use this method in combination with // OnSetNeedsBeginFrames() instead of using CefBeginFrameTimer. @@ -913,6 +944,10 @@ void CefRenderWidgetHostViewOSR::OnFrameTokenChanged(uint32_t frame_token) { render_widget_host_->DidProcessFrame(frame_token); } +void CefRenderWidgetHostViewOSR::DidReceiveFirstFrameAfterNavigation() { + render_widget_host_->DidReceiveFirstFrameAfterNavigation(); +} + std::unique_ptr CefRenderWidgetHostViewOSR::GetCompositorLock( ui::CompositorLockClient* client) { @@ -946,42 +981,6 @@ void CefRenderWidgetHostViewOSR::WasResized() { } ResizeRootLayer(); - if (render_widget_host_) - render_widget_host_->WasResized(); - GetDelegatedFrameHost()->WasResized(); -} - -void CefRenderWidgetHostViewOSR::GetScreenInfo(content::ScreenInfo* results) { - if (!browser_impl_.get()) - return; - - CefScreenInfo screen_info(kDefaultScaleFactor, 0, 0, false, CefRect(), - CefRect()); - - CefRefPtr handler = - browser_impl_->client()->GetRenderHandler(); - if (handler.get() && - (!handler->GetScreenInfo(browser_impl_.get(), screen_info) || - screen_info.rect.width == 0 || screen_info.rect.height == 0 || - screen_info.available_rect.width == 0 || - screen_info.available_rect.height == 0)) { - // If a screen rectangle was not provided, try using the view rectangle - // instead. Otherwise, popup views may be drawn incorrectly, or not at all. - CefRect screenRect; - if (!handler->GetViewRect(browser_impl_.get(), screenRect)) { - NOTREACHED(); - screenRect = CefRect(); - } - - if (screen_info.rect.width == 0 && screen_info.rect.height == 0) - screen_info.rect = screenRect; - - if (screen_info.available_rect.width == 0 && - screen_info.available_rect.height == 0) - screen_info.available_rect = screenRect; - } - - *results = ScreenInfoFrom(screen_info); } void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() { @@ -991,7 +990,22 @@ void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() { // TODO(OSR): Update the backing store. + if (render_widget_host_->delegate()) + render_widget_host_->delegate()->SendScreenRects(); + else + render_widget_host_->SendScreenRects(); + +#if defined(OS_MACOSX) + // RenderWidgetHostImpl will query BrowserCompositorMac for the dimensions + // to send to the renderer, so it is required that BrowserCompositorMac be + // updated first. Only notify RenderWidgetHostImpl of the update if any + // properties it will query have changed. + if (browser_compositor_->UpdateNSViewAndDisplay()) + render_widget_host_->NotifyScreenInfoChanged(); +#else render_widget_host_->NotifyScreenInfoChanged(); +#endif + // We might want to change the cursor scale factor here as well - see the // cache for the current_cursor_, as passed by UpdateCursor from the renderer // in the rwhv_aura (current_cursor_.SetScaleFactor) @@ -1317,6 +1331,19 @@ void CefRenderWidgetHostViewOSR::ResizeRootLayer() { GetCompositor()->SetScaleAndSize(current_device_scale_factor_, size_in_pixels, local_surface_id_); PlatformResizeCompositorWidget(size_in_pixels); + +#if defined(OS_MACOSX) + bool resized = browser_compositor_->UpdateNSViewAndDisplay(); +#else + bool resized = true; + GetDelegatedFrameHost()->WasResized(local_surface_id_, size, + cc::DeadlinePolicy::UseDefaultDeadline()); +#endif + + // Note that |render_widget_host_| will retrieve resize parameters from the + // DelegatedFrameHost, so it must have WasResized called after. + if (resized && render_widget_host_) + render_widget_host_->WasResized(); } void CefRenderWidgetHostViewOSR::OnBeginFrameTimerTick() { @@ -1416,10 +1443,9 @@ void CefRenderWidgetHostViewOSR::RemoveGuestHostView( void CefRenderWidgetHostViewOSR::RegisterGuestViewFrameSwappedCallback( content::RenderWidgetHostViewGuest* guest_host_view) { - guest_host_view->RegisterFrameSwappedCallback( - base::MakeUnique(base::Bind( - &CefRenderWidgetHostViewOSR::OnGuestViewFrameSwapped, - weak_ptr_factory_.GetWeakPtr(), base::Unretained(guest_host_view)))); + guest_host_view->RegisterFrameSwappedCallback(base::BindOnce( + &CefRenderWidgetHostViewOSR::OnGuestViewFrameSwapped, + weak_ptr_factory_.GetWeakPtr(), base::Unretained(guest_host_view))); guest_host_view->set_current_device_scale_factor( current_device_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 5c2fbec1d..f63d2726e 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.h +++ b/libcef/browser/osr/render_widget_host_view_osr.h @@ -124,6 +124,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, void SpeakSelection() override; bool IsSpeaking() const override; void StopSpeaking() override; + bool ShouldContinueToPauseForFrame() override; #endif // defined(OS_MACOSX) // RenderWidgetHostViewBase implementation. @@ -150,19 +151,12 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, gfx::Size GetRequestedRendererSize() const override; gfx::Size GetPhysicalBackingSize() const override; - void CopyFromSurface(const gfx::Rect& src_subrect, - const gfx::Size& dst_size, - const content::ReadbackRequestCallback& callback, - const SkColorType color_type) override; - void CopyFromSurfaceToVideoFrame( - const gfx::Rect& src_subrect, - scoped_refptr target, - const base::Callback& callback) override; - void BeginFrameSubscription( - std::unique_ptr subscriber) - override; - void EndFrameSubscription() override; - bool HasAcceleratedSurface(const gfx::Size& desired_size) override; + void CopyFromSurface( + const gfx::Rect& src_rect, + const gfx::Size& output_size, + base::OnceCallback callback) override; + void GetScreenInfo(content::ScreenInfo* results) const override; + gfx::Vector2d GetOffsetFromRootSurface() override; gfx::Rect GetBoundsInRootWindow() override; content::RenderWidgetHostImpl* GetRenderWidgetHostImpl() const override; viz::SurfaceId GetCurrentSurfaceId() const override; @@ -188,6 +182,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, const gfx::PointF& point, RenderWidgetHostViewBase* target_view, gfx::PointF* transformed_point) override; + void DidNavigate() override; // ui::CompositorDelegate implementation. std::unique_ptr CreateSoftwareOutputDevice( @@ -198,14 +193,15 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, ui::Layer* DelegatedFrameHostGetLayer() const override; bool DelegatedFrameHostIsVisible() const override; SkColor DelegatedFrameHostGetGutterColor() const override; - gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override; bool DelegatedFrameCanCreateResizeLock() const override; std::unique_ptr DelegatedFrameHostCreateResizeLock() override; viz::LocalSurfaceId GetLocalSurfaceId() const override; + void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override; void OnBeginFrame(base::TimeTicks frame_time) override; bool IsAutoResizeEnabled() const override; void OnFrameTokenChanged(uint32_t frame_token) override; + void DidReceiveFirstFrameAfterNavigation() override; // CompositorResizeLockClient implementation. std::unique_ptr GetCompositorLock( @@ -216,7 +212,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, bool InstallTransparency(); void WasResized(); - void GetScreenInfo(content::ScreenInfo* results); void OnScreenInfoChanged(); void Invalidate(CefBrowserHost::PaintElementType type); void SendKeyEvent(const content::NativeWebKeyboardEvent& event); 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 6a822f286..46f07b57d 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_mac.mm +++ b/libcef/browser/osr/render_widget_host_view_osr_mac.mm @@ -60,6 +60,10 @@ class MacHelper : public content::BrowserCompositorMacClient, void AcceleratedWidgetSwapCompleted() override {} + void DidReceiveFirstFrameAfterNavigation() override { + view_->render_widget_host()->DidReceiveFirstFrameAfterNavigation(); + } + private: // Guaranteed to outlive this object. CefRenderWidgetHostViewOSR* view_; @@ -83,6 +87,10 @@ bool CefRenderWidgetHostViewOSR::IsSpeaking() const { void CefRenderWidgetHostViewOSR::StopSpeaking() {} +bool CefRenderWidgetHostViewOSR::ShouldContinueToPauseForFrame() { + return browser_compositor_->ShouldContinueToPauseForFrame(); +} + ui::Compositor* CefRenderWidgetHostViewOSR::GetCompositor() const { return browser_compositor_->GetCompositor(); } diff --git a/libcef/browser/osr/web_contents_view_osr.cc b/libcef/browser/osr/web_contents_view_osr.cc index ae64b1d8a..804ea3736 100644 --- a/libcef/browser/osr/web_contents_view_osr.cc +++ b/libcef/browser/osr/web_contents_view_osr.cc @@ -41,14 +41,6 @@ gfx::NativeWindow CefWebContentsViewOSR::GetTopLevelNativeWindow() const { return gfx::NativeWindow(); } -void CefWebContentsViewOSR::GetScreenInfo(content::ScreenInfo* results) const { - CefRenderWidgetHostViewOSR* view = GetView(); - if (view) - view->GetScreenInfo(results); - else - WebContentsView::GetDefaultScreenInfo(results); -} - void CefWebContentsViewOSR::GetContainerBounds(gfx::Rect* out) const { *out = GetViewBounds(); } diff --git a/libcef/browser/osr/web_contents_view_osr.h b/libcef/browser/osr/web_contents_view_osr.h index c98856ade..d06f3e909 100644 --- a/libcef/browser/osr/web_contents_view_osr.h +++ b/libcef/browser/osr/web_contents_view_osr.h @@ -33,7 +33,6 @@ class CefWebContentsViewOSR : public content::WebContentsView, gfx::NativeView GetNativeView() const override; gfx::NativeView GetContentNativeView() const override; gfx::NativeWindow GetTopLevelNativeWindow() const override; - void GetScreenInfo(content::ScreenInfo* screen_info) const override; void GetContainerBounds(gfx::Rect* out) const override; void SizeContents(const gfx::Size& size) override; void Focus() override; diff --git a/libcef/browser/prefs/pref_store.cc b/libcef/browser/prefs/pref_store.cc index 0b89c653e..040daf8fb 100644 --- a/libcef/browser/prefs/pref_store.cc +++ b/libcef/browser/prefs/pref_store.cc @@ -131,15 +131,15 @@ void CefPrefStore::ReportValueChanged(const std::string& key, uint32_t flags) { } void CefPrefStore::SetString(const std::string& key, const std::string& value) { - SetValue(key, base::MakeUnique(value), DEFAULT_PREF_WRITE_FLAGS); + SetValue(key, std::make_unique(value), DEFAULT_PREF_WRITE_FLAGS); } void CefPrefStore::SetInteger(const std::string& key, int value) { - SetValue(key, base::MakeUnique(value), DEFAULT_PREF_WRITE_FLAGS); + SetValue(key, std::make_unique(value), DEFAULT_PREF_WRITE_FLAGS); } void CefPrefStore::SetBoolean(const std::string& key, bool value) { - SetValue(key, base::MakeUnique(value), DEFAULT_PREF_WRITE_FLAGS); + SetValue(key, std::make_unique(value), DEFAULT_PREF_WRITE_FLAGS); } bool CefPrefStore::GetString(const std::string& key, std::string* value) const { diff --git a/libcef/browser/printing/print_dialog_linux.cc b/libcef/browser/printing/print_dialog_linux.cc index 5ea2f60b7..1321ed1e4 100644 --- a/libcef/browser/printing/print_dialog_linux.cc +++ b/libcef/browser/printing/print_dialog_linux.cc @@ -183,16 +183,16 @@ bool CefPrintDialogLinux::UpdateSettings(printing::PrintSettings* settings) { void CefPrintDialogLinux::ShowDialog( gfx::NativeView parent_view, bool has_selection, - const PrintingContextLinux::PrintSettingsCallback& callback) { + PrintingContextLinux::PrintSettingsCallback callback) { CEF_REQUIRE_UIT(); SetHandler(); if (!handler_.get()) { - callback.Run(PrintingContextLinux::CANCEL); + std::move(callback).Run(PrintingContextLinux::CANCEL); return; } - callback_ = callback; + callback_ = std::move(callback); CefRefPtr callback_impl( new CefPrintDialogCallbackImpl(this)); @@ -310,18 +310,15 @@ void CefPrintDialogLinux::OnPrintContinue( CefValueController::AutoLock lock_scope(impl->controller()); context_->InitWithSettings(impl->print_settings()); } - callback_.Run(PrintingContextLinux::OK); - callback_.Reset(); + std::move(callback_).Run(PrintingContextLinux::OK); } void CefPrintDialogLinux::OnPrintCancel() { - callback_.Run(PrintingContextLinux::CANCEL); - callback_.Reset(); + std::move(callback_).Run(PrintingContextLinux::CANCEL); } void CefPrintDialogLinux::OnJobCompleted() { - content::BrowserThread::PostTask( - content::BrowserThread::FILE, FROM_HERE, + CEF_POST_BACKGROUND_TASK( base::Bind(base::IgnoreResult(&base::DeleteFile), path_to_pdf_, false)); // Printing finished. Matches AddRef() in PrintDocument(); diff --git a/libcef/browser/printing/print_dialog_linux.h b/libcef/browser/printing/print_dialog_linux.h index d8b49ba11..dc10ecd96 100644 --- a/libcef/browser/printing/print_dialog_linux.h +++ b/libcef/browser/printing/print_dialog_linux.h @@ -40,13 +40,13 @@ class CefPrintDialogLinux : public printing::PrintDialogGtkInterface, // Notify the client when printing has started. static void OnPrintStart(int render_process_id, int render_routing_id); - // printing::CefPrintDialogLinuxInterface implementation. + // PrintDialogGtkInterface implementation. void UseDefaultSettings() override; bool UpdateSettings(printing::PrintSettings* settings) override; void ShowDialog( gfx::NativeView parent_view, bool has_selection, - const PrintingContextLinux::PrintSettingsCallback& callback) override; + PrintingContextLinux::PrintSettingsCallback callback) override; void PrintDocument(const printing::MetafilePlayer& metafile, const base::string16& document_name) override; void AddRefToDialog() override; diff --git a/libcef/browser/printing/print_view_manager.cc b/libcef/browser/printing/print_view_manager.cc index c41e1c7a6..95fe80ef2 100644 --- a/libcef/browser/printing/print_view_manager.cc +++ b/libcef/browser/printing/print_view_manager.cc @@ -22,6 +22,8 @@ #include "content/public/browser/web_contents.h" #include "printing/pdf_metafile_skia.h" +#include "libcef/browser/thread_util.h" + using content::BrowserThread; DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::CefPrintViewManager); @@ -130,7 +132,7 @@ scoped_refptr GetDataFromHandle( base::SharedMemoryHandle handle, uint32_t data_size) { std::unique_ptr shared_buf = - base::MakeUnique(handle, true); + std::make_unique(handle, true); if (!shared_buf->Map(data_size)) { NOTREACHED(); @@ -146,10 +148,10 @@ scoped_refptr GetDataFromHandle( void SavePdfFile(scoped_refptr data, const base::FilePath& path, const CefPrintViewManager::PdfPrintCallback& callback) { - DCHECK_CURRENTLY_ON(BrowserThread::FILE); + CEF_REQUIRE_BLOCKING(); DCHECK_GT(data->size(), 0U); - PdfMetafileSkia metafile(SkiaDocumentType::PDF); + PdfMetafileSkia metafile; metafile.InitFromData(static_cast(data->front()), data->size()); base::File file(path, @@ -265,8 +267,8 @@ void CefPrintViewManager::OnMetafileReadyForPrinting( if (!pdf_print_state_) return; - scoped_refptr data_bytes = - GetDataFromHandle(params.metafile_data_handle, params.data_size); + scoped_refptr data_bytes = GetDataFromHandle( + params.content.metafile_data_handle, params.content.data_size); if (!data_bytes || !data_bytes->size()) { TerminatePdfPrintJob(); return; @@ -279,8 +281,7 @@ void CefPrintViewManager::OnMetafileReadyForPrinting( pdf_print_state_.reset(); // Save the PDF file to disk and then execute the callback. - BrowserThread::PostTask( - BrowserThread::FILE, FROM_HERE, + CEF_POST_USER_VISIBLE_TASK( base::Bind(&SavePdfFile, data_bytes, output_path, print_callback)); } diff --git a/libcef/browser/printing/print_view_manager_base.cc b/libcef/browser/printing/print_view_manager_base.cc index d5aca5b9b..180e59220 100644 --- a/libcef/browser/printing/print_view_manager_base.cc +++ b/libcef/browser/printing/print_view_manager_base.cc @@ -32,6 +32,7 @@ #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_types.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" @@ -86,7 +87,7 @@ bool CefPrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) { SetPrintingRFH(rfh); int32_t id = rfh->GetRoutingID(); - return PrintNowInternal(rfh, base::MakeUnique(id)); + return PrintNowInternal(rfh, std::make_unique(id)); } #endif @@ -122,7 +123,7 @@ void CefPrintViewManagerBase::PrintDocument( } #else std::unique_ptr metafile = - std::make_unique(SkiaDocumentType::PDF); + std::make_unique(); CHECK(metafile->InitFromData(print_data->front(), print_data->size())); // Update the rendered document. It will send notifications to the listener. @@ -195,12 +196,14 @@ void CefPrintViewManagerBase::OnComposePdfDone( } void CefPrintViewManagerBase::OnDidPrintDocument( + content::RenderFrameHost* render_frame_host, const PrintHostMsg_DidPrintDocument_Params& params) { PrintedDocument* document = GetDocument(params.document_cookie); if (!document) return; - if (!base::SharedMemory::IsHandleValid(params.metafile_data_handle)) { + const PrintHostMsg_DidPrintContent_Params& content = params.content; + if (!base::SharedMemory::IsHandleValid(content.metafile_data_handle)) { NOTREACHED() << "invalid memory handle"; web_contents()->Stop(); return; @@ -208,17 +211,18 @@ void CefPrintViewManagerBase::OnDidPrintDocument( auto* client = PrintCompositeClient::FromWebContents(web_contents()); if (IsOopifEnabled() && !client->for_preview() && - !document->settings().is_modifiable()) { - client->DoComposite( - params.metafile_data_handle, params.data_size, + document->settings().is_modifiable()) { + client->DoCompositeDocumentToPdf( + params.document_cookie, render_frame_host, content.metafile_data_handle, + content.data_size, content.subframe_content_info, base::BindOnce(&CefPrintViewManagerBase::OnComposePdfDone, weak_ptr_factory_.GetWeakPtr(), params)); return; } - std::unique_ptr shared_buf = - std::make_unique(params.metafile_data_handle, true); - if (!shared_buf->Map(params.data_size)) { + auto shared_buf = + std::make_unique(content.metafile_data_handle, true); + if (!shared_buf->Map(content.data_size)) { NOTREACHED() << "couldn't map"; web_contents()->Stop(); return; @@ -226,7 +230,7 @@ void CefPrintViewManagerBase::OnDidPrintDocument( scoped_refptr bytes = base::MakeRefCounted( reinterpret_cast(shared_buf->memory()), - params.data_size); + content.data_size); PrintDocument(document, bytes, params.page_size, params.content_area, params.physical_offsets); } @@ -275,8 +279,16 @@ bool CefPrintViewManagerBase::OnMessageReceived( const IPC::Message& message, content::RenderFrameHost* render_frame_host) { bool handled = true; - IPC_BEGIN_MESSAGE_MAP(CefPrintViewManagerBase, message) + IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(CefPrintViewManagerBase, message, + render_frame_host) IPC_MESSAGE_HANDLER(PrintHostMsg_DidPrintDocument, OnDidPrintDocument) + IPC_MESSAGE_UNHANDLED(handled = false) + IPC_END_MESSAGE_MAP() + if (handled) + return true; + + handled = true; + IPC_BEGIN_MESSAGE_MAP(CefPrintViewManagerBase, message) IPC_MESSAGE_HANDLER(PrintHostMsg_ShowInvalidPrinterSettingsError, OnShowInvalidPrinterSettingsError) IPC_MESSAGE_UNHANDLED(handled = false) @@ -461,7 +473,7 @@ void CefPrintViewManagerBase::ReleasePrintJob() { return; if (rfh) { - auto msg = base::MakeUnique(rfh->GetRoutingID(), + auto msg = std::make_unique(rfh->GetRoutingID(), printing_succeeded_); rfh->Send(msg.release()); } diff --git a/libcef/browser/printing/print_view_manager_base.h b/libcef/browser/printing/print_view_manager_base.h index 675e8aa34..edc3c3960 100644 --- a/libcef/browser/printing/print_view_manager_base.h +++ b/libcef/browser/printing/print_view_manager_base.h @@ -87,7 +87,8 @@ class CefPrintViewManagerBase : public content::NotificationObserver, void OnDidGetPrintedPagesCount(int cookie, int number_pages) override; void OnPrintingFailed(int cookie) override; void OnShowInvalidPrinterSettingsError(); - void OnDidPrintDocument(const PrintHostMsg_DidPrintDocument_Params& params); + void OnDidPrintDocument(content::RenderFrameHost* render_frame_host, + const PrintHostMsg_DidPrintDocument_Params& params); // IPC message handlers for service. void OnComposePdfDone(const PrintHostMsg_DidPrintDocument_Params& params, diff --git a/libcef/browser/printing/printing_message_filter.cc b/libcef/browser/printing/printing_message_filter.cc index 6f8b14c20..a4d8a8776 100644 --- a/libcef/browser/printing/printing_message_filter.cc +++ b/libcef/browser/printing/printing_message_filter.cc @@ -215,7 +215,7 @@ void CefPrintingMessageFilter::OnScriptedPrintReply( } PrintHostMsg_ScriptedPrint::WriteReplyParams(reply_msg, params); Send(reply_msg); - if (params.params.dpi && params.params.document_cookie) { + if (!params.params.dpi.IsEmpty() && params.params.document_cookie) { #if defined(OS_ANDROID) int file_descriptor; const base::string16& device_name = printer_query->settings().device_name(); diff --git a/libcef/browser/resource_dispatcher_host_delegate.cc b/libcef/browser/resource_dispatcher_host_delegate.cc index 640fa409f..8c6f48d87 100644 --- a/libcef/browser/resource_dispatcher_host_delegate.cc +++ b/libcef/browser/resource_dispatcher_host_delegate.cc @@ -93,7 +93,6 @@ bool CefResourceDispatcherHostDelegate::HandleExternalProtocol( // ChromeResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream. bool CefResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream( net::URLRequest* request, - const base::FilePath& plugin_path, const std::string& mime_type, GURL* origin, std::string* payload) { @@ -125,29 +124,14 @@ bool CefResourceDispatcherHostDelegate::ShouldInterceptResourceAsStream( if (!handler) continue; - // If a plugin path is provided then a stream is being intercepted for the - // mimeHandlerPrivate API. Otherwise a stream is being intercepted for the - // streamsPrivate API. - if (!plugin_path.empty()) { - if (handler->HasPlugin() && plugin_path == handler->GetPluginPath()) { - StreamTargetInfo target_info; - *origin = - extensions::Extension::GetBaseURLFromExtensionId(extension_id); - target_info.extension_id = extension_id; - target_info.view_id = base::GenerateGUID(); - *payload = target_info.view_id; - stream_target_info_[request] = target_info; - return true; - } - } else { - if (!handler->HasPlugin() && handler->CanHandleMIMEType(mime_type)) { - StreamTargetInfo target_info; - *origin = - extensions::Extension::GetBaseURLFromExtensionId(extension_id); - target_info.extension_id = extension_id; - stream_target_info_[request] = target_info; - return true; - } + if (handler->CanHandleMIMEType(mime_type)) { + StreamTargetInfo target_info; + *origin = extensions::Extension::GetBaseURLFromExtensionId(extension_id); + target_info.extension_id = extension_id; + target_info.view_id = base::GenerateGUID(); + *payload = target_info.view_id; + stream_target_info_[request] = target_info; + return true; } } @@ -195,13 +179,6 @@ void CefResourceDispatcherHostDelegate::OnRequestRedirected( } } -std::unique_ptr -CefResourceDispatcherHostDelegate::CreateClientCertStore( - content::ResourceContext* resource_context) { - return static_cast(resource_context) - ->CreateClientCertStore(); -} - void CefResourceDispatcherHostDelegate::HandleExternalProtocolOnUIThread( const GURL& url, const content::ResourceRequestInfo::WebContentsGetter& diff --git a/libcef/browser/resource_dispatcher_host_delegate.h b/libcef/browser/resource_dispatcher_host_delegate.h index 29cf8c0bd..a801b6f98 100644 --- a/libcef/browser/resource_dispatcher_host_delegate.h +++ b/libcef/browser/resource_dispatcher_host_delegate.h @@ -24,7 +24,6 @@ class CefResourceDispatcherHostDelegate bool HandleExternalProtocol(const GURL& url, content::ResourceRequestInfo* info) override; bool ShouldInterceptResourceAsStream(net::URLRequest* request, - const base::FilePath& plugin_path, const std::string& mime_type, GURL* origin, std::string* payload) override; @@ -34,8 +33,6 @@ class CefResourceDispatcherHostDelegate net::URLRequest* request, content::ResourceContext* resource_context, network::ResourceResponse* response) override; - std::unique_ptr CreateClientCertStore( - content::ResourceContext* resource_context) override; private: void HandleExternalProtocolOnUIThread( diff --git a/libcef/browser/server_impl.cc b/libcef/browser/server_impl.cc index 261710921..11e3589b3 100644 --- a/libcef/browser/server_impl.cc +++ b/libcef/browser/server_impl.cc @@ -12,7 +12,6 @@ #include "base/format_macros.h" #include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" -#include "base/task_scheduler/post_task.h" #include "base/threading/thread.h" #include "net/base/net_errors.h" #include "net/http/http_request_headers.h" @@ -20,6 +19,7 @@ #include "net/server/http_server_response_info.h" #include "net/socket/server_socket.h" #include "net/socket/tcp_server_socket.h" +#include "net/traffic_annotation/network_traffic_annotation.h" #define CEF_CURRENTLY_ON_HT() CurrentlyOnHandlerThread() #define CEF_REQUIRE_HT() DCHECK(CEF_CURRENTLY_ON_HT()) @@ -237,7 +237,7 @@ void CefServerImpl::SendHttp404Response(int connection_id) { return; } - server_->Send404(connection_id); + server_->Send404(connection_id, NO_TRAFFIC_ANNOTATION_YET); server_->Close(connection_id); } @@ -262,7 +262,7 @@ void CefServerImpl::SendHttp500Response(int connection_id, return; } - server_->Send500(connection_id, error_message); + server_->Send500(connection_id, error_message, NO_TRAFFIC_ANNOTATION_YET); server_->Close(connection_id); } @@ -305,7 +305,7 @@ void CefServerImpl::SendHttpResponse(int connection_id, base::StringPrintf("%" PRIuS, static_cast(content_length))); } - server_->SendResponse(connection_id, response); + server_->SendResponse(connection_id, response, NO_TRAFFIC_ANNOTATION_YET); if (content_length == 0) { server_->Close(connection_id); } @@ -366,7 +366,8 @@ void CefServerImpl::ContinueWebSocketRequest( info->is_websocket_pending = false; if (allow) { - server_->AcceptWebSocket(connection_id, request_info); + server_->AcceptWebSocket(connection_id, request_info, + NO_TRAFFIC_ANNOTATION_YET); handler_->OnWebSocketConnected(this, connection_id); } else { server_->Close(connection_id); @@ -397,7 +398,8 @@ void CefServerImpl::SendHttp200ResponseInternal( return; } - server_->Send200(connection_id, *data, content_type); + server_->Send200(connection_id, *data, content_type, + NO_TRAFFIC_ANNOTATION_YET); server_->Close(connection_id); } @@ -416,7 +418,7 @@ void CefServerImpl::SendRawDataInternal(int connection_id, if (!GetConnectionInfo(connection_id)) return; - server_->SendRaw(connection_id, *data); + server_->SendRaw(connection_id, *data, NO_TRAFFIC_ANNOTATION_YET); } void CefServerImpl::SendWebSocketMessageInternal( @@ -442,7 +444,7 @@ void CefServerImpl::SendWebSocketMessageInternal( return; } - server_->SendOverWebSocket(connection_id, *data); + server_->SendOverWebSocket(connection_id, *data, NO_TRAFFIC_ANNOTATION_YET); } void CefServerImpl::OnConnect(int connection_id) { @@ -595,8 +597,7 @@ void CefServerImpl::ShutdownOnUIThread() { if (thread_) { // Stop the handler thread as a background task so the UI thread isn't // blocked. - base::PostTaskWithTraits( - FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, + CEF_POST_BACKGROUND_TASK( BindOnce([](std::unique_ptr) {}, std::move(thread_))); // Release the reference that was added in StartupOnUIThread(). diff --git a/libcef/browser/storage_partition_proxy.cc b/libcef/browser/storage_partition_proxy.cc index 73c64752d..6d941e651 100644 --- a/libcef/browser/storage_partition_proxy.cc +++ b/libcef/browser/storage_partition_proxy.cc @@ -30,7 +30,7 @@ network::mojom::NetworkContext* CefStoragePartitionProxy::GetNetworkContext() { return parent_->GetNetworkContext(); } -network::mojom::URLLoaderFactory* +scoped_refptr CefStoragePartitionProxy::GetURLLoaderFactoryForBrowserProcess() { return parent_->GetURLLoaderFactoryForBrowserProcess(); } @@ -154,6 +154,10 @@ void CefStoragePartitionProxy::FlushNetworkInterfaceForTesting() { parent_->FlushNetworkInterfaceForTesting(); } +void CefStoragePartitionProxy::WaitForDeletionTasksForTesting() { + parent_->WaitForDeletionTasksForTesting(); +} + content::BackgroundFetchContext* CefStoragePartitionProxy::GetBackgroundFetchContext() { return parent_->GetBackgroundFetchContext(); @@ -188,6 +192,11 @@ content::BlobRegistryWrapper* CefStoragePartitionProxy::GetBlobRegistry() { return parent_->GetBlobRegistry(); } +content::PrefetchURLLoaderService* +CefStoragePartitionProxy::GetPrefetchURLLoaderService() { + return parent_->GetPrefetchURLLoaderService(); +} + 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 22b69bbfb..5fed7bbcd 100644 --- a/libcef/browser/storage_partition_proxy.h +++ b/libcef/browser/storage_partition_proxy.h @@ -25,8 +25,8 @@ class CefStoragePartitionProxy : public content::StoragePartition { net::URLRequestContextGetter* GetURLRequestContext() override; net::URLRequestContextGetter* GetMediaURLRequestContext() override; network::mojom::NetworkContext* GetNetworkContext() override; - network::mojom::URLLoaderFactory* GetURLLoaderFactoryForBrowserProcess() - override; + scoped_refptr + GetURLLoaderFactoryForBrowserProcess() override; network::mojom::CookieManager* GetCookieManagerForBrowserProcess() override; storage::QuotaManager* GetQuotaManager() override; content::AppCacheService* GetAppCacheService() override; @@ -68,6 +68,7 @@ class CefStoragePartitionProxy : public content::StoragePartition { void Flush() override; void ClearBluetoothAllowedDevicesMapForTesting() override; void FlushNetworkInterfaceForTesting() override; + void WaitForDeletionTasksForTesting() override; content::BackgroundFetchContext* GetBackgroundFetchContext() override; content::BackgroundSyncContext* GetBackgroundSyncContext() override; content::PaymentAppContextImpl* GetPaymentAppContext() override; @@ -75,6 +76,7 @@ class CefStoragePartitionProxy : public content::StoragePartition { content::BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override; content::BlobURLLoaderFactory* GetBlobURLLoaderFactory() override; content::BlobRegistryWrapper* GetBlobRegistry() override; + content::PrefetchURLLoaderService* GetPrefetchURLLoaderService() override; content::URLLoaderFactoryGetter* url_loader_factory_getter() override; content::BrowserContext* browser_context() const override; mojo::BindingId Bind( diff --git a/libcef/browser/thread_util.h b/libcef/browser/thread_util.h index e3deeb761..ec3e7f09d 100644 --- a/libcef/browser/thread_util.h +++ b/libcef/browser/thread_util.h @@ -8,21 +8,20 @@ #include "base/location.h" #include "base/logging.h" +#include "base/task_scheduler/post_task.h" +#include "base/threading/thread_restrictions.h" #include "content/public/browser/browser_thread.h" #define CEF_UIT content::BrowserThread::UI #define CEF_IOT content::BrowserThread::IO -#define CEF_FILET content::BrowserThread::FILE #define CEF_CURRENTLY_ON(id) content::BrowserThread::CurrentlyOn(id) #define CEF_CURRENTLY_ON_UIT() CEF_CURRENTLY_ON(CEF_UIT) #define CEF_CURRENTLY_ON_IOT() CEF_CURRENTLY_ON(CEF_IOT) -#define CEF_CURRENTLY_ON_FILET() CEF_CURRENTLY_ON(CEF_FILET) #define CEF_REQUIRE(id) DCHECK(CEF_CURRENTLY_ON(id)) #define CEF_REQUIRE_UIT() CEF_REQUIRE(CEF_UIT) #define CEF_REQUIRE_IOT() CEF_REQUIRE(CEF_IOT) -#define CEF_REQUIRE_FILET() CEF_REQUIRE(CEF_FILET) #define CEF_REQUIRE_RETURN(id, var) \ if (!CEF_CURRENTLY_ON(id)) { \ @@ -46,6 +45,36 @@ content::BrowserThread::PostDelayedTask( \ id, FROM_HERE, task, base::TimeDelta::FromMilliseconds(delay_ms)) +// Post a blocking task with the specified |priority|. Tasks that have not +// started executing at shutdown will never run. However, any task that has +// already begun executing when shutdown is invoked will be allowed to continue +// and will block shutdown until completion. +// Tasks posted with this method are not guaranteed to run sequentially. Use +// base::CreateSequencedTaskRunnerWithTraits instead if sequence is important. +// Sequenced runners at various priorities that always execute all pending tasks +// before shutdown are available via CefContentBrowserClient::*_task_runner() +// and exposed by the CEF API. +#define CEF_POST_BLOCKING_TASK(priority, task) \ + base::PostTaskWithTraits( \ + FROM_HERE, \ + {priority, base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN, \ + base::MayBlock()}, \ + task) + +// Post a blocking task that affects UI or responsiveness of future user +// interactions. Do not use if an immediate response to a user interaction is +// expected. +#define CEF_POST_USER_VISIBLE_TASK(task) \ + CEF_POST_BLOCKING_TASK(base::TaskPriority::USER_VISIBLE, task) + +// Post a blocking task where the user won't notice if it takes an arbitrarily +// long time to complete. +#define CEF_POST_BACKGROUND_TASK(task) \ + CEF_POST_BLOCKING_TASK(base::TaskPriority::BACKGROUND, task) + +// Assert that blocking is allowed on the current thread. +#define CEF_REQUIRE_BLOCKING() base::AssertBlockingAllowed() + // Same as IMPLEMENT_REFCOUNTING() but using the specified Destructor. #define IMPLEMENT_REFCOUNTING_EX(ClassName, Destructor) \ public: \ diff --git a/libcef/browser/trace_subscriber.cc b/libcef/browser/trace_subscriber.cc index b14ab21ca..813ea38a6 100644 --- a/libcef/browser/trace_subscriber.cc +++ b/libcef/browser/trace_subscriber.cc @@ -15,10 +15,10 @@ namespace { // Create the temporary file and then execute |callback| on the thread // represented by |message_loop_proxy|. -void CreateTemporaryFileOnFileThread( +void CreateTemporaryFileOnBackgroundThread( scoped_refptr message_loop_proxy, base::Callback callback) { - CEF_REQUIRE_FILET(); + CEF_REQUIRE_BLOCKING(); base::FilePath file_path; if (!base::CreateTemporaryFile(&file_path)) LOG(ERROR) << "Failed to create temporary file."; @@ -101,11 +101,11 @@ bool CefTraceSubscriber::EndTracing(const base::FilePath& tracing_file, if (tracing_file.empty()) { // Create a new temporary file path on the FILE thread, then continue. - CEF_POST_TASK(CEF_FILET, - base::Bind(CreateTemporaryFileOnFileThread, - base::ThreadTaskRunnerHandle::Get(), - base::Bind(&CefTraceSubscriber::ContinueEndTracing, - weak_factory_.GetWeakPtr(), callback))); + CEF_POST_USER_VISIBLE_TASK( + base::Bind(CreateTemporaryFileOnBackgroundThread, + base::ThreadTaskRunnerHandle::Get(), + base::Bind(&CefTraceSubscriber::ContinueEndTracing, + weak_factory_.GetWeakPtr(), callback))); return true; } diff --git a/libcef/browser/views/window_impl.cc b/libcef/browser/views/window_impl.cc index b6ab4a41a..afd82157f 100644 --- a/libcef/browser/views/window_impl.cc +++ b/libcef/browser/views/window_impl.cc @@ -634,7 +634,7 @@ void CefWindowImpl::CreateWidget() { #if defined(USE_AURA) unhandled_key_event_handler_ = - base::MakeUnique(this, widget_); + std::make_unique(this, widget_); #endif // The Widget and root View are owned by the native window. Therefore don't diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc index 3ef296383..13f462636 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/main_delegate.cc @@ -27,6 +27,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "components/content_settings/core/common/content_settings_pattern.h" +#include "components/viz/common/features.h" #include "content/public/browser/browser_main_runner.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_features.h" @@ -34,7 +35,7 @@ #include "content/public/common/main_function_params.h" #include "extensions/common/constants.h" #include "ipc/ipc_features.h" -#include "pdf/pdf.h" +#include "pdf/pdf_ppapi.h" #include "ui/base/layout.h" #include "ui/base/material_design/material_design_controller.h" #include "ui/base/resource/resource_bundle.h" @@ -437,19 +438,36 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) { base::IntToString(settings.uncaught_exception_stack_size)); } - // Disable AsyncWheelEvents when OSR is enabled to avoid DCHECKs in - // MouseWheelEventQueue. - if (settings.windowless_rendering_enabled && - features::kAsyncWheelEvents.default_state == - base::FEATURE_ENABLED_BY_DEFAULT) { + std::vector disable_features; + + if (settings.windowless_rendering_enabled) { + // Disable AsyncWheelEvents when OSR is enabled to avoid DCHECKs in + // MouseWheelEventQueue. + if (features::kAsyncWheelEvents.default_state == + base::FEATURE_ENABLED_BY_DEFAULT) { + disable_features.push_back(features::kAsyncWheelEvents.name); + } + + // Disable SurfaceSynchronization when OSR is enabled, otherwise rendering + // will fail. + if (features::kEnableSurfaceSynchronization.default_state == + base::FEATURE_ENABLED_BY_DEFAULT) { + disable_features.push_back( + features::kEnableSurfaceSynchronization.name); + } + } + + if (!disable_features.empty()) { DCHECK(!base::FeatureList::GetInstance()); - std::string disable_features = + std::string disable_features_str = command_line->GetSwitchValueASCII(switches::kDisableFeatures); - if (!disable_features.empty()) - disable_features += ","; - disable_features += features::kAsyncWheelEvents.name; + for (auto feature_str : disable_features) { + if (!disable_features_str.empty()) + disable_features_str += ","; + disable_features_str += feature_str; + } command_line->AppendSwitchASCII(switches::kDisableFeatures, - disable_features); + disable_features_str); } } diff --git a/libcef/common/net/upload_data.cc b/libcef/common/net/upload_data.cc index 272b62e91..a3ca8ed98 100644 --- a/libcef/common/net/upload_data.cc +++ b/libcef/common/net/upload_data.cc @@ -15,7 +15,7 @@ UploadData::UploadData() void UploadData::AppendBytes(const char* bytes, int bytes_len) { DCHECK(!is_chunked_); if (bytes_len > 0) { - elements_.push_back(base::MakeUnique()); + elements_.push_back(std::make_unique()); elements_.back()->SetToBytes(bytes, bytes_len); } } @@ -25,7 +25,7 @@ void UploadData::AppendFileRange(const base::FilePath& file_path, uint64_t length, const base::Time& expected_modification_time) { DCHECK(!is_chunked_); - elements_.push_back(base::MakeUnique()); + elements_.push_back(std::make_unique()); elements_.back()->SetToFilePathRange(file_path, offset, length, expected_modification_time); } diff --git a/libcef/common/request_impl.cc b/libcef/common/request_impl.cc index 3cc5ebf88..866a1da16 100644 --- a/libcef/common/request_impl.cc +++ b/libcef/common/request_impl.cc @@ -18,6 +18,7 @@ #include "base/logging.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/task_scheduler/post_task.h" #include "components/navigation_interception/navigation_params.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/resource_request_info.h" @@ -70,10 +71,9 @@ class BytesElementReader : public net::UploadBytesElementReader { DISALLOW_COPY_AND_ASSIGN(BytesElementReader); }; -base::TaskRunner* GetFileTaskRunner() { - return content::BrowserThread::GetTaskRunnerForThread( - content::BrowserThread::FILE) - .get(); +scoped_refptr GetFileTaskRunner() { + return base::CreateSequencedTaskRunnerWithTraits( + {base::MayBlock(), base::TaskPriority::USER_VISIBLE}); } // A subclass of net::UploadFileElementReader that keeps the associated @@ -82,7 +82,7 @@ class FileElementReader : public net::UploadFileElementReader { public: explicit FileElementReader(std::unique_ptr element) : net::UploadFileElementReader( - GetFileTaskRunner(), + GetFileTaskRunner().get(), element->file_path(), element->file_range_offset(), element->file_range_length(), @@ -92,6 +92,7 @@ class FileElementReader : public net::UploadFileElementReader { } private: + scoped_refptr task_runner_; std::unique_ptr element_; DISALLOW_COPY_AND_ASSIGN(FileElementReader); @@ -207,8 +208,9 @@ void SetHeaderMap(const CefRequest::HeaderMap& map, blink::WebURLRequest& request) { CefRequest::HeaderMap::const_iterator it = map.begin(); for (; it != map.end(); ++it) { - request.SetHTTPHeaderField(blink::WebString::FromUTF16(it->first), - blink::WebString::FromUTF16(it->second)); + request.SetHTTPHeaderField( + blink::WebString::FromUTF16(it->first.ToString16()), + blink::WebString::FromUTF16(it->second.ToString16())); } } @@ -1030,7 +1032,7 @@ void CefPostDataImpl::Get(net::UploadData& data) const { net::UploadData::ElementsVector data_elements; for (const auto& element : elements_) { std::unique_ptr data_element = - base::MakeUnique(); + std::make_unique(); static_cast(element.get()) ->Get(*data_element.get()); data_elements.push_back(std::move(data_element)); @@ -1047,7 +1049,7 @@ std::unique_ptr CefPostDataImpl::Get() const { static_cast(element.get())->Get()); } - return base::MakeUnique( + return std::make_unique( std::move(element_readers), 0); } @@ -1299,12 +1301,12 @@ std::unique_ptr CefPostDataElementImpl::Get() const { net::UploadElement* element = new net::UploadElement(); element->SetToBytes(static_cast(data_.bytes.bytes), data_.bytes.size); - return base::MakeUnique(base::WrapUnique(element)); + return std::make_unique(base::WrapUnique(element)); } else if (type_ == PDE_TYPE_FILE) { net::UploadElement* element = new net::UploadElement(); base::FilePath path = base::FilePath(CefString(&data_.filename)); element->SetToFilePath(path); - return base::MakeUnique(base::WrapUnique(element)); + return std::make_unique(base::WrapUnique(element)); } else { NOTREACHED(); return nullptr; @@ -1343,7 +1345,8 @@ 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 = blink::WebString::FromUTF16(CefString(&data_.filename)); + element.file_path = + blink::WebString::FromUTF16(CefString(&data_.filename).ToString16()); } else { NOTREACHED(); } diff --git a/libcef/common/task_runner_impl.cc b/libcef/common/task_runner_impl.cc index 7c5df99d4..c5151d64a 100644 --- a/libcef/common/task_runner_impl.cc +++ b/libcef/common/task_runner_impl.cc @@ -3,6 +3,7 @@ // can be found in the LICENSE file. #include "libcef/common/task_runner_impl.h" +#include "libcef/browser/content_browser_client.h" #include "libcef/common/content_client.h" #include "libcef/renderer/content_renderer_client.h" @@ -57,26 +58,21 @@ scoped_refptr CefTaskRunnerImpl::GetTaskRunner( } // Browser process. + CefContentBrowserClient* client = CefContentBrowserClient::Get(); + if (!client) + return NULL; + int id = -1; switch (threadId) { case TID_UI: id = BrowserThread::UI; break; - case TID_DB: - id = BrowserThread::DB; - break; - case TID_FILE: - id = BrowserThread::FILE; - break; + case TID_FILE_BACKGROUND: + return client->background_task_runner(); + case TID_FILE_USER_VISIBLE: + return client->user_visible_task_runner(); case TID_FILE_USER_BLOCKING: - id = BrowserThread::FILE_USER_BLOCKING; - break; - case TID_PROCESS_LAUNCHER: - id = BrowserThread::PROCESS_LAUNCHER; - break; - case TID_CACHE: - id = BrowserThread::CACHE; - break; + return client->user_blocking_task_runner(); case TID_IO: id = BrowserThread::IO; break; @@ -84,8 +80,7 @@ scoped_refptr CefTaskRunnerImpl::GetTaskRunner( break; }; - if (id >= 0 && CefContentClient::Get() && - CefContentClient::Get()->browser() && + if (id >= 0 && BrowserThread::IsMessageLoopValid(static_cast(id))) { return BrowserThread::GetTaskRunnerForThread( static_cast(id)); diff --git a/libcef/common/values_impl.cc b/libcef/common/values_impl.cc index 374e316c4..2bf4ffa26 100644 --- a/libcef/common/values_impl.cc +++ b/libcef/common/values_impl.cc @@ -1109,7 +1109,7 @@ bool CefListValueImpl::SetSize(size_t size) { RemoveInternal(i); } else if (size > 0) { // Expand the list size. - mutable_value()->Set(size - 1, base::MakeUnique()); + mutable_value()->Set(size - 1, std::make_unique()); } return true; } diff --git a/libcef/common/widevine_loader.cc b/libcef/common/widevine_loader.cc index 29cf2083e..0e181f302 100644 --- a/libcef/common/widevine_loader.cc +++ b/libcef/common/widevine_loader.cc @@ -93,7 +93,7 @@ const char kCdmSupportedCodecAvc1[] = "avc1"; std::unique_ptr ParseManifestFile( const base::FilePath& manifest_path) { - CEF_REQUIRE_FILET(); + CEF_REQUIRE_BLOCKING(); // Manifest file should be < 1kb. Read at most 2kb. std::string manifest_contents; @@ -318,10 +318,10 @@ void RegisterWidevineCdmOnUIThread(const base::FilePath& cdm_adapter_path, callback); } -void LoadWidevineCdmInfoOnFileThread( +void LoadWidevineCdmInfoOnBlockingThread( const base::FilePath& base_path, CefRefPtr callback) { - CEF_REQUIRE_FILET(); + CEF_REQUIRE_BLOCKING(); base::FilePath cdm_adapter_path; base::FilePath cdm_path; @@ -363,9 +363,8 @@ void CefWidevineLoader::LoadWidevineCdm( return; } - // Continue execution on the FILE thread. - CEF_POST_TASK(CEF_FILET, - base::Bind(LoadWidevineCdmInfoOnFileThread, path, callback)); + CEF_POST_USER_VISIBLE_TASK( + base::Bind(LoadWidevineCdmInfoOnBlockingThread, path, callback)); } void CefWidevineLoader::OnContextInitialized() { diff --git a/libcef/renderer/browser_impl.cc b/libcef/renderer/browser_impl.cc index d73857be5..70895af18 100644 --- a/libcef/renderer/browser_impl.cc +++ b/libcef/renderer/browser_impl.cc @@ -202,7 +202,8 @@ CefRefPtr CefBrowserImpl::GetFrame(const CefString& name) { blink::WebView* web_view = render_view()->GetWebView(); if (web_view) { - const blink::WebString& frame_name = blink::WebString::FromUTF16(name); + const blink::WebString& frame_name = + blink::WebString::FromUTF16(name.ToString16()); // Search by assigned frame name (Frame::name). WebFrame* frame = web_view->MainFrame(); if (frame && frame->IsWebLocalFrame()) diff --git a/libcef/renderer/content_renderer_client.cc b/libcef/renderer/content_renderer_client.cc index d3ba5fdd6..806c8640c 100644 --- a/libcef/renderer/content_renderer_client.cc +++ b/libcef/renderer/content_renderer_client.cc @@ -56,6 +56,7 @@ #include "components/printing/renderer/print_render_frame_helper.h" #include "components/spellcheck/renderer/spellcheck.h" #include "components/spellcheck/renderer/spellcheck_provider.h" +#include "components/startup_metric_utils/common/startup_metric.mojom.h" #include "components/visitedlink/renderer/visitedlink_slave.h" #include "components/web_cache/renderer/web_cache_impl.h" #include "content/common/frame_messages.h" @@ -76,7 +77,8 @@ #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 "services/service_manager/public/cpp/service_context.h" +#include "third_party/WebKit/public/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" @@ -152,7 +154,8 @@ class CefGuestView : public content::RenderViewObserver { }; CefContentRendererClient::CefContentRendererClient() - : devtools_agent_count_(0), + : main_entry_time_(base::TimeTicks::Now()), + devtools_agent_count_(0), uncaught_exception_stack_size_(0), single_process_cleanup_complete_(false) { if (extensions::ExtensionsEnabled()) { @@ -356,12 +359,18 @@ void CefContentRendererClient::RenderThreadStarted() { ? blink::scheduler::RendererProcessType::kExtensionRenderer : blink::scheduler::RendererProcessType::kRenderer); + { + startup_metric_utils::mojom::StartupMetricHostPtr startup_metric_host; + GetConnector()->BindInterface(chrome::mojom::kServiceName, + &startup_metric_host); + startup_metric_host->RecordRendererMainEntryTime(main_entry_time_); + } + thread->AddObserver(observer_.get()); thread->GetChannel()->AddFilter(new CefRenderMessageFilter); if (!command_line->HasSwitch(switches::kDisableSpellChecking)) { - spellcheck_.reset(new SpellCheck(this)); - thread->AddObserver(spellcheck_.get()); + spellcheck_ = std::make_unique(®istry_, this); } if (content::RenderProcessHost::run_renderer_in_process()) { @@ -574,10 +583,28 @@ void CefContentRendererClient::DevToolsAgentDetached() { } } +void CefContentRendererClient::CreateRendererService( + service_manager::mojom::ServiceRequest service_request) { + service_context_ = std::make_unique( + std::make_unique(this), + std::move(service_request)); +} + +void CefContentRendererClient::OnStart() { + context()->connector()->BindConnectorRequest(std::move(connector_request_)); +} + +void CefContentRendererClient::OnBindInterface( + const service_manager::BindSourceInfo& remote_info, + const std::string& name, + mojo::ScopedMessagePipeHandle handle) { + registry_.TryBindInterface(name, &handle); +} + void CefContentRendererClient::GetInterface( const std::string& interface_name, mojo::ScopedMessagePipeHandle interface_pipe) { - content::RenderThread::Get()->GetConnector()->BindInterface( + connector_->BindInterface( service_manager::Identity(chrome::mojom::kServiceName), interface_name, std::move(interface_pipe)); } @@ -613,7 +640,7 @@ void CefContentRendererClient::BrowserCreated( if (params.is_guest_view) { // Don't create a CefBrowser for guest views. guest_views_.insert(std::make_pair( - render_view, base::MakeUnique(render_view))); + render_view, std::make_unique(render_view))); return; } @@ -669,6 +696,12 @@ void CefContentRendererClient::RunSingleProcessCleanupOnUIThread() { delete host; } +service_manager::Connector* CefContentRendererClient::GetConnector() { + if (!connector_) + connector_ = service_manager::Connector::Create(&connector_request_); + return connector_.get(); +} + // Enable deprecation warnings for MSVC. See http://crbug.com/585142. #if defined(OS_WIN) #pragma warning(pop) diff --git a/libcef/renderer/content_renderer_client.h b/libcef/renderer/content_renderer_client.h index b5213353b..a0b253d67 100644 --- a/libcef/renderer/content_renderer_client.h +++ b/libcef/renderer/content_renderer_client.h @@ -21,7 +21,10 @@ #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/binder_registry.h" +#include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/local_interface_provider.h" +#include "services/service_manager/public/cpp/service.h" namespace blink { class WebURLLoaderFactory; @@ -48,6 +51,7 @@ class ChromePDFPrintClient; class SpellCheck; class CefContentRendererClient : public content::ContentRendererClient, + public service_manager::Service, public service_manager::LocalInterfaceProvider, public base::MessageLoop::DestructionObserver { public: @@ -129,6 +133,14 @@ class CefContentRendererClient : public content::ContentRendererClient, void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame) override; void DevToolsAgentAttached() override; void DevToolsAgentDetached() override; + void CreateRendererService( + service_manager::mojom::ServiceRequest service_request) override; + + // service_manager::Service implementation. + void OnStart() override; + void OnBindInterface(const service_manager::BindSourceInfo& remote_info, + const std::string& name, + mojo::ScopedMessagePipeHandle handle) override; // service_manager::LocalInterfaceProvider implementation. void GetInterface(const std::string& name, @@ -144,6 +156,12 @@ class CefContentRendererClient : public content::ContentRendererClient, // Perform cleanup work for single-process mode. void RunSingleProcessCleanupOnUIThread(); + service_manager::Connector* GetConnector(); + + // Time at which this object was created. This is very close to the time at + // which the RendererMain function was entered. + base::TimeTicks main_entry_time_; + scoped_refptr render_task_runner_; std::unique_ptr observer_; std::unique_ptr web_cache_impl_; @@ -177,6 +195,11 @@ class CefContentRendererClient : public content::ContentRendererClient, bool single_process_cleanup_complete_; base::Lock single_process_cleanup_lock_; + std::unique_ptr connector_; + service_manager::mojom::ConnectorRequest connector_request_; + std::unique_ptr service_context_; + service_manager::BinderRegistry registry_; + DISALLOW_COPY_AND_ASSIGN(CefContentRendererClient); }; diff --git a/libcef/renderer/dom_document_impl.cc b/libcef/renderer/dom_document_impl.cc index a7230444d..1c4c1609d 100644 --- a/libcef/renderer/dom_document_impl.cc +++ b/libcef/renderer/dom_document_impl.cc @@ -81,7 +81,8 @@ CefString CefDOMDocumentImpl::GetTitle() { CefRefPtr CefDOMDocumentImpl::GetElementById(const CefString& id) { const WebDocument& document = frame_->GetDocument(); - return GetOrCreateNode(document.GetElementById(WebString::FromUTF16(id))); + return GetOrCreateNode( + document.GetElementById(WebString::FromUTF16(id.ToString16()))); } CefRefPtr CefDOMDocumentImpl::GetFocusedNode() { @@ -175,7 +176,8 @@ CefString CefDOMDocumentImpl::GetCompleteURL(const CefString& partialURL) { return str; const WebDocument& document = frame_->GetDocument(); - const WebURL& url = document.CompleteURL(WebString::FromUTF16(partialURL)); + const WebURL& url = + document.CompleteURL(WebString::FromUTF16(partialURL.ToString16())); if (!url.IsNull()) { GURL gurl = url; str = gurl.spec(); diff --git a/libcef/renderer/dom_node_impl.cc b/libcef/renderer/dom_node_impl.cc index 254ced0d2..1d80b15ba 100644 --- a/libcef/renderer/dom_node_impl.cc +++ b/libcef/renderer/dom_node_impl.cc @@ -196,7 +196,8 @@ bool CefDOMNodeImpl::SetValue(const CefString& value) { if (node_.IsElementNode()) return false; - return webkit_glue::SetNodeValue(node_, WebString::FromUTF16(value)); + return webkit_glue::SetNodeValue(node_, + WebString::FromUTF16(value.ToString16())); } CefString CefDOMNodeImpl::GetAsMarkup() { @@ -301,7 +302,7 @@ bool CefDOMNodeImpl::HasElementAttribute(const CefString& attrName) { } const WebElement& element = node_.ToConst(); - return element.HasAttribute(WebString::FromUTF16(attrName)); + return element.HasAttribute(WebString::FromUTF16(attrName.ToString16())); } CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) { @@ -315,7 +316,8 @@ CefString CefDOMNodeImpl::GetElementAttribute(const CefString& attrName) { } const WebElement& element = node_.ToConst(); - const WebString& attr = element.GetAttribute(WebString::FromUTF16(attrName)); + const WebString& attr = + element.GetAttribute(WebString::FromUTF16(attrName.ToString16())); if (!attr.IsNull()) str = attr.Utf16(); @@ -354,8 +356,8 @@ bool CefDOMNodeImpl::SetElementAttribute(const CefString& attrName, } WebElement element = node_.To(); - element.SetAttribute(WebString::FromUTF16(attrName), - WebString::FromUTF16(value)); + element.SetAttribute(WebString::FromUTF16(attrName.ToString16()), + WebString::FromUTF16(value.ToString16())); return true; } diff --git a/libcef/renderer/render_thread_observer.cc b/libcef/renderer/render_thread_observer.cc index df20c04dc..4a16e0206 100644 --- a/libcef/renderer/render_thread_observer.cc +++ b/libcef/renderer/render_thread_observer.cc @@ -26,13 +26,13 @@ CefRenderThreadObserver::CefRenderThreadObserver() : visited_link_slave_(new visitedlink::VisitedLinkSlave) { net::NetModule::SetResourceProvider(NetResourceProvider); - auto registry = base::MakeUnique(); + auto registry = std::make_unique(); registry->AddInterface(visited_link_slave_->GetBindCallback(), base::ThreadTaskRunnerHandle::Get()); if (content::ChildThread::Get()) { content::ChildThread::Get() ->GetServiceManagerConnection() - ->AddConnectionFilter(base::MakeUnique( + ->AddConnectionFilter(std::make_unique( std::move(registry))); } } diff --git a/libcef/renderer/v8_impl.cc b/libcef/renderer/v8_impl.cc index b0195dc4a..302b1aa77 100644 --- a/libcef/renderer/v8_impl.cc +++ b/libcef/renderer/v8_impl.cc @@ -669,12 +669,16 @@ class CefV8ExceptionImpl : public CefV8Exception { return; GetCefString(message->Get(), message_); - GetCefString(message->GetSourceLine(), source_line_); + v8::MaybeLocal source_line = message->GetSourceLine(context); + if (!source_line.IsEmpty()) + GetCefString(source_line.ToLocalChecked(), source_line_); if (!message->GetScriptResourceName().IsEmpty()) GetCefString(message->GetScriptResourceName()->ToString(), script_); - line_number_ = message->GetLineNumber(); + v8::Maybe line_number = message->GetLineNumber(context); + if (!line_number.IsNothing()) + line_number_ = line_number.ToChecked(); start_position_ = message->GetStartPosition(); end_position_ = message->GetEndPosition(); start_column_ = message->GetStartColumn(context).FromJust(); @@ -1011,8 +1015,10 @@ bool CefV8ContextImpl::Eval(const CefString& code, v8::Local context = GetV8Context(); v8::Context::Scope context_scope(context); - const blink::WebString& source = blink::WebString::FromUTF16(code); - const blink::WebString& source_url = blink::WebString::FromUTF16(script_url); + const blink::WebString& source = + blink::WebString::FromUTF16(code.ToString16()); + const blink::WebString& source_url = + blink::WebString::FromUTF16(script_url.ToString16()); v8::TryCatch try_catch(isolate); try_catch.SetVerbose(true); diff --git a/libcef/renderer/webkit_glue.cc b/libcef/renderer/webkit_glue.cc index be9219754..752362ee5 100644 --- a/libcef/renderer/webkit_glue.cc +++ b/libcef/renderer/webkit_glue.cc @@ -177,10 +177,25 @@ v8::MaybeLocal ExecuteV8ScriptAndReturnValue( if (frame && frame->GetSettings()) v8CacheOptions = frame->GetSettings()->GetV8CacheOptions(); + // Based on V8ScriptRunner::CompileAndRunInternalScript: + v8::ScriptCompiler::CompileOptions compile_options; + blink::V8ScriptRunner::ProduceCacheOptions produce_cache_options; + v8::ScriptCompiler::NoCacheReason no_cache_reason; + std::tie(compile_options, produce_cache_options, no_cache_reason) = + blink::V8ScriptRunner::GetCompileOptions(v8CacheOptions, ssc); + + // Currently internal scripts don't have cache handlers, so we should not + // produce cache for them. + DCHECK_EQ(produce_cache_options, + blink::V8ScriptRunner::ProduceCacheOptions::kNoProduceCache); + v8::Local script; + // Use default ReferrerScriptInfo here: + // - nonce: empty for internal script, and + // - parser_state: always "not parser inserted" for internal scripts. if (!blink::V8ScriptRunner::CompileScript( blink::ScriptState::From(context), ssc, accessControlStatus, - v8CacheOptions, blink::ReferrerScriptInfo()) + compile_options, no_cache_reason, blink::ReferrerScriptInfo()) .ToLocal(&script)) { DCHECK(tryCatch.HasCaught()); return result; diff --git a/libcef/utility/content_utility_client.cc b/libcef/utility/content_utility_client.cc index c51ceb2e3..def7adb2e 100644 --- a/libcef/utility/content_utility_client.cc +++ b/libcef/utility/content_utility_client.cc @@ -9,17 +9,16 @@ #include "build/build_config.h" #include "chrome/services/printing/printing_service.h" -#include "chrome/services/printing/public/interfaces/constants.mojom.h" -#include "chrome/utility/utility_message_handler.h" +#include "chrome/services/printing/public/mojom/constants.mojom.h" #include "components/printing/service/public/cpp/pdf_compositor_service_factory.h" #include "components/printing/service/public/interfaces/pdf_compositor.mojom.h" #include "content/public/child/child_thread.h" #include "content/public/common/service_manager_connection.h" #include "content/public/common/simple_connection_filter.h" -#include "content/public/network/url_request_context_builder_mojo.h" #include "mojo/public/cpp/bindings/strong_binding.h" +#include "services/network/url_request_context_builder_mojo.h" #include "services/proxy_resolver/proxy_resolver_service.h" // nogncheck -#include "services/proxy_resolver/public/interfaces/proxy_resolver.mojom.h" // nogncheck +#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h" // nogncheck #include "services/service_manager/public/cpp/binder_registry.h" #if defined(OS_WIN) @@ -28,7 +27,7 @@ CefContentUtilityClient::CefContentUtilityClient() { #if defined(OS_WIN) - handlers_.push_back(base::MakeUnique()); + printing_handler_ = std::make_unique(); #endif } @@ -43,19 +42,19 @@ void CefContentUtilityClient::UtilityThreadStarted() { if (!connection) return; - auto registry = base::MakeUnique(); + auto registry = std::make_unique(); connection->AddConnectionFilter( - base::MakeUnique(std::move(registry))); + std::make_unique(std::move(registry))); } bool CefContentUtilityClient::OnMessageReceived(const IPC::Message& message) { bool handled = false; - for (Handlers::iterator it = handlers_.begin(); - !handled && it != handlers_.end(); ++it) { - handled = (*it)->OnMessageReceived(message); - } +#if defined(OS_WIN) + if (printing_handler_->OnMessageReceived(message)) + return true; +#endif return handled; } diff --git a/libcef/utility/content_utility_client.h b/libcef/utility/content_utility_client.h index f8c84183f..ff48e0518 100644 --- a/libcef/utility/content_utility_client.h +++ b/libcef/utility/content_utility_client.h @@ -11,7 +11,11 @@ #include "content/public/utility/content_utility_client.h" -class UtilityMessageHandler; +#if defined(OS_WIN) +namespace printing { +class PrintingHandler; +} +#endif class CefContentUtilityClient : public content::ContentUtilityClient { public: @@ -23,8 +27,9 @@ class CefContentUtilityClient : public content::ContentUtilityClient { void RegisterServices(StaticServiceMap* services) override; private: - using Handlers = std::vector>; - Handlers handlers_; +#if defined(OS_WIN) + std::unique_ptr printing_handler_; +#endif DISALLOW_COPY_AND_ASSIGN(CefContentUtilityClient); }; diff --git a/patch/patch.cfg b/patch/patch.cfg index b99b6a6bc..7140581b5 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -358,4 +358,9 @@ patches = [ # https://bitbucket.org/chromiumembedded/cef/issues/2398 'name': 'mac_gpu_2398', }, + { + # Windows: Resolve conflict between base::StrCat and Win32 StrCat. + # https://bugs.chromium.org/p/chromium/issues/detail?id=817738 + 'name': 'win_strcat_817738', + }, ] diff --git a/patch/patches/browser_compositor_mac.patch b/patch/patches/browser_compositor_mac.patch index c0613e9a3..e2e586836 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 81376ab57c4b..364305777492 100644 +index dad7599ed999..c8daf2ba58c8 100644 --- content/browser/renderer_host/browser_compositor_view_mac.h +++ content/browser/renderer_host/browser_compositor_view_mac.h -@@ -51,11 +51,13 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient { +@@ -52,11 +52,13 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient { // These will not return nullptr until Destroy is called. DelegatedFrameHost* GetDelegatedFrameHost(); @@ -17,10 +17,10 @@ index 81376ab57c4b..364305777492 100644 void DidCreateNewRendererCompositorFrameSink( viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink); diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm -index 8e98fb37c1d4..8dc887eac61b 100644 +index 07d42e680951..46699b959d2d 100644 --- content/browser/renderer_host/browser_compositor_view_mac.mm +++ content/browser/renderer_host/browser_compositor_view_mac.mm -@@ -214,6 +214,12 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {} +@@ -215,6 +215,12 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {} g_spare_recyclable_compositors.Get().clear(); } @@ -33,30 +33,22 @@ index 8e98fb37c1d4..8dc887eac61b 100644 gfx::AcceleratedWidget BrowserCompositorMac::GetAcceleratedWidget() { if (recyclable_compositor_) { return recyclable_compositor_->accelerated_widget_mac() -@@ -473,10 +479,16 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {} - NSView* ns_view = +@@ -268,7 +274,9 @@ void OnCompositingShuttingDown(ui::Compositor* compositor) override {} accelerated_widget_mac_ns_view_->AcceleratedWidgetGetNSView(); - if (bounds_in_dip) { -- NSSize dip_ns_size = [ns_view bounds].size; -- *bounds_in_dip = gfx::Size(dip_ns_size.width, dip_ns_size.height); -+ if (ns_view) { -+ NSSize dip_ns_size = [ns_view bounds].size; -+ *bounds_in_dip = gfx::Size(dip_ns_size.width, dip_ns_size.height); -+ } else { -+ // |ns_view| will be nullptr for CEF. -+ *bounds_in_dip = root_layer_->bounds().size(); -+ } - } - if (scale_factor || color_space) { -+ // TODO(cef): Return values from CEF callbacks here. - display::Display display = - display::Screen::GetScreen()->GetDisplayNearestView(ns_view); - if (scale_factor) + display::Display new_display = + display::Screen::GetScreen()->GetDisplayNearestView(ns_view); +- gfx::Size new_size_dip([ns_view bounds].size); ++ // TODO(cef): Get display info from callbacks. |ns_view| will be nullptr. ++ gfx::Size new_size_dip(ns_view ? gfx::Size([ns_view bounds].size) : ++ root_layer_->bounds().size()); + if (new_size_dip == dfh_size_dip_ && new_display == dfh_display_) + return false; + diff --git ui/accelerated_widget_mac/accelerated_widget_mac.mm ui/accelerated_widget_mac/accelerated_widget_mac.mm -index 7ff59beee63c..48efe5ac93fa 100644 +index 8306398431d9..5ab4fef9ac0f 100644 --- ui/accelerated_widget_mac/accelerated_widget_mac.mm +++ ui/accelerated_widget_mac/accelerated_widget_mac.mm -@@ -66,6 +66,10 @@ - (void)setContentsChanged; +@@ -71,6 +71,10 @@ - (void)setContentsChanged; DCHECK(view && !view_); view_ = view; diff --git a/patch/patches/browser_plugin_guest_1565.patch b/patch/patches/browser_plugin_guest_1565.patch index c13cb068c..3d29e8f76 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 c83e5babe405..92efd9e12561 100644 +index 593f46130e32..5f7d2fe7355d 100644 --- content/browser/browser_plugin/browser_plugin_guest.cc +++ content/browser/browser_plugin/browser_plugin_guest.cc -@@ -339,8 +339,11 @@ void BrowserPluginGuest::InitInternal( +@@ -322,8 +322,11 @@ void BrowserPluginGuest::InitInternal( static_cast(GetWebContents()->GetView()); } @@ -15,7 +15,7 @@ index c83e5babe405..92efd9e12561 100644 // Once a BrowserPluginGuest has an embedder WebContents, it's considered to // be attached. -@@ -836,10 +839,19 @@ void BrowserPluginGuest::OnWillAttachComplete( +@@ -806,10 +809,19 @@ void BrowserPluginGuest::OnWillAttachComplete( static_cast(GetWebContents()->GetView()); if (!web_contents()->GetRenderViewHost()->GetWidget()->GetView()) { web_contents_view->CreateViewForWidget( @@ -37,10 +37,10 @@ index c83e5babe405..92efd9e12561 100644 attached_ = true; diff --git content/browser/frame_host/interstitial_page_impl.cc content/browser/frame_host/interstitial_page_impl.cc -index 5a7aa396e372..8f80ed6d340c 100644 +index 7c83d2a63b2c..070982ea2298 100644 --- content/browser/frame_host/interstitial_page_impl.cc +++ content/browser/frame_host/interstitial_page_impl.cc -@@ -613,7 +613,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() { +@@ -614,7 +614,7 @@ WebContentsView* InterstitialPageImpl::CreateWebContentsView() { WebContentsView* wcv = static_cast(web_contents())->GetView(); RenderWidgetHostViewBase* view = @@ -50,7 +50,7 @@ index 5a7aa396e372..8f80ed6d340c 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 a38a936af6df..5380e09ee023 100644 +index cf8c74f4c744..b8cefb4b154b 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 a38a936af6df..5380e09ee023 100644 public: virtual ~WebContentsView() {} -@@ -91,13 +91,9 @@ class WebContentsView { +@@ -88,13 +88,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 a38a936af6df..5380e09ee023 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 c5ce75e10e2b..9968d86d4d48 100644 +index 13d687ea411e..f16415faa23f 100644 --- content/browser/web_contents/web_contents_view_aura.cc +++ content/browser/web_contents/web_contents_view_aura.cc -@@ -887,7 +887,8 @@ void WebContentsViewAura::CreateView(const gfx::Size& initial_size, +@@ -781,7 +781,8 @@ void WebContentsViewAura::CreateView(const gfx::Size& initial_size, } RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( @@ -92,7 +92,7 @@ index c5ce75e10e2b..9968d86d4d48 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 -@@ -899,6 +900,7 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( +@@ -793,6 +794,7 @@ RenderWidgetHostViewBase* WebContentsViewAura::CreateViewForWidget( render_widget_host->GetView()); } @@ -101,10 +101,10 @@ index c5ce75e10e2b..9968d86d4d48 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 534f92c4cd6a..6f2ec63f09e6 100644 +index 2371c819e665..40fa46097de1 100644 --- content/browser/web_contents/web_contents_view_aura.h +++ content/browser/web_contents/web_contents_view_aura.h -@@ -120,7 +120,7 @@ class CONTENT_EXPORT WebContentsViewAura +@@ -114,7 +114,7 @@ class CONTENT_EXPORT WebContentsViewAura gfx::NativeView context) override; RenderWidgetHostViewBase* CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -114,10 +114,10 @@ index 534f92c4cd6a..6f2ec63f09e6 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 e1db175c25cb..1ef7b20a7add 100644 +index e95c31d677f5..2e14ca1fabcf 100644 --- content/browser/web_contents/web_contents_view_child_frame.cc +++ content/browser/web_contents/web_contents_view_child_frame.cc -@@ -96,7 +96,7 @@ void WebContentsViewChildFrame::CreateView(const gfx::Size& initial_size, +@@ -84,7 +84,7 @@ void WebContentsViewChildFrame::CreateView(const gfx::Size& initial_size, RenderWidgetHostViewBase* WebContentsViewChildFrame::CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -127,10 +127,10 @@ index e1db175c25cb..1ef7b20a7add 100644 } diff --git content/browser/web_contents/web_contents_view_child_frame.h content/browser/web_contents/web_contents_view_child_frame.h -index ca3c586f9f8f..5fd0e860a5ff 100644 +index 17275be93025..6c73effc578b 100644 --- content/browser/web_contents/web_contents_view_child_frame.h +++ content/browser/web_contents/web_contents_view_child_frame.h -@@ -41,7 +41,7 @@ class WebContentsViewChildFrame : public WebContentsView, +@@ -40,7 +40,7 @@ class WebContentsViewChildFrame : public WebContentsView, gfx::NativeView context) override; RenderWidgetHostViewBase* CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -140,10 +140,10 @@ index ca3c586f9f8f..5fd0e860a5ff 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 227a66c7c836..f4d47bbed1a8 100644 +index 699570cc1390..0c8bb808e657 100644 --- content/browser/web_contents/web_contents_view_guest.cc +++ content/browser/web_contents/web_contents_view_guest.cc -@@ -74,6 +74,8 @@ void WebContentsViewGuest::GetScreenInfo(ScreenInfo* screen_info) const { +@@ -67,6 +67,8 @@ gfx::NativeWindow WebContentsViewGuest::GetTopLevelNativeWindow() const { void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) { #if defined(USE_AURA) @@ -152,16 +152,16 @@ index 227a66c7c836..f4d47bbed1a8 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. -@@ -86,6 +88,8 @@ void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) { +@@ -79,6 +81,8 @@ void WebContentsViewGuest::OnGuestAttached(WebContentsView* parent_view) { void WebContentsViewGuest::OnGuestDetached(WebContentsView* old_parent_view) { #if defined(USE_AURA) + if (!platform_view_->GetNativeView()) + return; - if (!switches::IsMusHostingViz()) { + if (!base::FeatureList::IsEnabled(features::kMash)) { old_parent_view->GetNativeView()->RemoveChild( platform_view_->GetNativeView()); -@@ -139,7 +143,8 @@ void WebContentsViewGuest::CreateView(const gfx::Size& initial_size, +@@ -132,7 +136,8 @@ void WebContentsViewGuest::CreateView(const gfx::Size& initial_size, } RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( @@ -171,7 +171,7 @@ index 227a66c7c836..f4d47bbed1a8 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 -@@ -151,11 +156,19 @@ RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( +@@ -144,11 +149,19 @@ RenderWidgetHostViewBase* WebContentsViewGuest::CreateViewForWidget( render_widget_host->GetView()); } @@ -195,10 +195,10 @@ index 227a66c7c836..f4d47bbed1a8 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 c04fe9bc23c4..5dba7a8b9e76 100644 +index 4a06fe5f6880..ecad941c2638 100644 --- content/browser/web_contents/web_contents_view_guest.h +++ content/browser/web_contents/web_contents_view_guest.h -@@ -59,7 +59,7 @@ class WebContentsViewGuest : public WebContentsView, +@@ -58,7 +58,7 @@ class WebContentsViewGuest : public WebContentsView, gfx::NativeView context) override; RenderWidgetHostViewBase* CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -208,10 +208,10 @@ index c04fe9bc23c4..5dba7a8b9e76 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 95ba5f05e4f7..39d4d764136c 100644 +index 968c5157ab41..22aad9fbafa4 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, +@@ -89,7 +89,7 @@ class WebContentsViewMac : public WebContentsView, gfx::NativeView context) override; RenderWidgetHostViewBase* CreateViewForWidget( RenderWidgetHost* render_widget_host, @@ -221,10 +221,10 @@ index 95ba5f05e4f7..39d4d764136c 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 2c5dd9e99e6d..39d6bceb55ed 100644 +index 6a9ee15776b6..e4872d47e3d2 100644 --- content/browser/web_contents/web_contents_view_mac.mm +++ content/browser/web_contents/web_contents_view_mac.mm -@@ -376,7 +376,8 @@ void WebContentsViewMac::CreateView( +@@ -346,7 +346,8 @@ void WebContentsViewMac::CreateView( } RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget( @@ -234,7 +234,7 @@ index 2c5dd9e99e6d..39d6bceb55ed 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 -@@ -388,6 +389,7 @@ RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget( +@@ -358,6 +359,7 @@ RenderWidgetHostViewBase* WebContentsViewMac::CreateViewForWidget( render_widget_host->GetView()); } @@ -243,7 +243,7 @@ index 2c5dd9e99e6d..39d6bceb55ed 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 9a3c2375c7f6..f95ea9cbe9ba 100644 +index d05dd5421458..fa13775f0512 100644 --- content/public/browser/browser_plugin_guest_delegate.h +++ content/public/browser/browser_plugin_guest_delegate.h @@ -19,6 +19,7 @@ namespace content { @@ -262,9 +262,9 @@ index 9a3c2375c7f6..f95ea9cbe9ba 100644 + virtual void OnGuestAttached(content::WebContentsView* parent_view) {} + virtual void OnGuestDetached(content::WebContentsView* parent_view) {} + - // Sets the position of the context menu for the guest contents. The value - // reported from the guest renderer should be ignored. The reported value - // from the guest renderer is incorrect in situations where BrowserPlugin is + // TODO(ekaramad): A short workaround to force some types of guests to use + // a BrowserPlugin even when we are using cross process frames for guests. It + // should be removed after resolving https://crbug.com/642826). diff --git extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc index 6f2b56d0cd90..ec6f15c0a789 100644 --- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc diff --git a/patch/patches/chrome_browser.patch b/patch/patches/chrome_browser.patch index bef69267f..4a73a60ca 100644 --- a/patch/patches/chrome_browser.patch +++ b/patch/patches/chrome_browser.patch @@ -1,24 +1,24 @@ diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn -index 472d5ea34687..575960cb4a37 100644 +index ac49d3b83913..69696c72d0f3 100644 --- chrome/browser/BUILD.gn +++ chrome/browser/BUILD.gn -@@ -7,6 +7,7 @@ import("//build/config/crypto.gni") - import("//build/config/features.gni") +@@ -8,6 +8,7 @@ import("//build/config/features.gni") + import("//build/config/jumbo.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") -@@ -1586,6 +1587,7 @@ split_static_library("browser") { +@@ -1591,6 +1592,7 @@ jumbo_split_static_library("browser") { "//base:i18n", - "//base/allocator:features", + "//base/allocator:buildflags", "//cc", + "//cef/libcef/features", "//chrome:extra_resources", "//chrome:resources", "//chrome:strings", -@@ -1837,6 +1839,10 @@ split_static_library("browser") { +@@ -1845,6 +1847,10 @@ jumbo_split_static_library("browser") { "//ui/web_dialogs", ] diff --git a/patch/patches/chrome_browser_content_settings.patch b/patch/patches/chrome_browser_content_settings.patch index 73848f90c..fb83464cc 100644 --- a/patch/patches/chrome_browser_content_settings.patch +++ b/patch/patches/chrome_browser_content_settings.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/content_settings/host_content_settings_map_factory.cc chrome/browser/content_settings/host_content_settings_map_factory.cc -index 7bb265a57ba4..6917d09be48a 100644 +index 2e8e68563c3c..54a1834c6055 100644 --- chrome/browser/content_settings/host_content_settings_map_factory.cc +++ chrome/browser/content_settings/host_content_settings_map_factory.cc @@ -7,6 +7,7 @@ @@ -36,8 +36,8 @@ index 7bb265a57ba4..6917d09be48a 100644 #endif } -@@ -88,9 +99,15 @@ scoped_refptr - store_last_modified)); +@@ -86,9 +97,15 @@ scoped_refptr + /*store_last_modified=*/true)); #if BUILDFLAG(ENABLE_EXTENSIONS) +#if BUILDFLAG(ENABLE_CEF) diff --git a/patch/patches/chrome_browser_profiles.patch b/patch/patches/chrome_browser_profiles.patch index 6b7fe538c..b50c1f761 100644 --- a/patch/patches/chrome_browser_profiles.patch +++ b/patch/patches/chrome_browser_profiles.patch @@ -71,7 +71,7 @@ index e8e76ce5b954..1dd338dd0142 100644 content::BrowserContext* GetBrowserContextRedirectedInIncognito( content::BrowserContext* context); diff --git chrome/browser/profiles/profile_manager.cc chrome/browser/profiles/profile_manager.cc -index c5ab3d4e4d7a..69f54123f2cc 100644 +index 06cc4ca5c59c..a610360829d8 100644 --- chrome/browser/profiles/profile_manager.cc +++ chrome/browser/profiles/profile_manager.cc @@ -377,7 +377,7 @@ ProfileManager::ProfileManager(const base::FilePath& user_data_dir) @@ -84,7 +84,7 @@ index c5ab3d4e4d7a..69f54123f2cc 100644 this)); } diff --git chrome/browser/profiles/profile_manager.h chrome/browser/profiles/profile_manager.h -index 9c410dc3ba6d..219d42503fa7 100644 +index 95d20f01a062..96834378f487 100644 --- chrome/browser/profiles/profile_manager.h +++ chrome/browser/profiles/profile_manager.h @@ -93,7 +93,7 @@ class ProfileManager : public content::NotificationObserver, diff --git a/patch/patches/chrome_plugins.patch b/patch/patches/chrome_plugins.patch index 9518faaf5..5d27e902d 100644 --- a/patch/patches/chrome_plugins.patch +++ b/patch/patches/chrome_plugins.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/plugins/plugin_info_host_impl.cc chrome/browser/plugins/plugin_info_host_impl.cc -index 312e27d1b562..03eb1fda05cb 100644 +index ab3fd0de9e07..298db88e685f 100644 --- chrome/browser/plugins/plugin_info_host_impl.cc +++ chrome/browser/plugins/plugin_info_host_impl.cc @@ -17,6 +17,7 @@ @@ -157,10 +157,10 @@ index 312e27d1b562..03eb1fda05cb 100644 // 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 47aceed2a513..2f1dae33e865 100644 +index 700886c6ce89..8a47ec9f91a3 100644 --- chrome/renderer/chrome_content_renderer_client.cc +++ chrome/renderer/chrome_content_renderer_client.cc -@@ -795,6 +795,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( +@@ -774,6 +774,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( if ((status == chrome::mojom::PluginStatus::kUnauthorized || status == chrome::mojom::PluginStatus::kBlocked) && @@ -168,7 +168,7 @@ index 47aceed2a513..2f1dae33e865 100644 observer->IsPluginTemporarilyAllowed(identifier)) { status = chrome::mojom::PluginStatus::kAllowed; } -@@ -982,7 +983,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( +@@ -961,7 +962,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( render_frame->GetRemoteAssociatedInterfaces()->GetInterface( &plugin_auth_host); plugin_auth_host->BlockedUnauthorizedPlugin(group_name, identifier); @@ -178,7 +178,7 @@ index 47aceed2a513..2f1dae33e865 100644 break; } case chrome::mojom::PluginStatus::kBlocked: { -@@ -991,7 +993,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( +@@ -970,7 +972,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); placeholder->AllowLoading(); RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Blocked")); @@ -188,7 +188,7 @@ index 47aceed2a513..2f1dae33e865 100644 break; } case chrome::mojom::PluginStatus::kBlockedByPolicy: { -@@ -1001,7 +1004,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( +@@ -980,7 +983,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( group_name)); RenderThread::Get()->RecordAction( UserMetricsAction("Plugin_BlockedByPolicy")); @@ -198,7 +198,7 @@ index 47aceed2a513..2f1dae33e865 100644 break; } case chrome::mojom::PluginStatus::kBlockedNoLoading: { -@@ -1009,7 +1013,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( +@@ -988,7 +992,8 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin( IDR_BLOCKED_PLUGIN_HTML, l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED_NO_LOADING, group_name)); @@ -209,7 +209,7 @@ index 47aceed2a513..2f1dae33e865 100644 } case chrome::mojom::PluginStatus::kComponentUpdateRequired: { diff --git chrome/renderer/plugins/chrome_plugin_placeholder.cc chrome/renderer/plugins/chrome_plugin_placeholder.cc -index 63b86138b4fe..4ed38c132efb 100644 +index 6bc73727e61b..4f84ab989060 100644 --- chrome/renderer/plugins/chrome_plugin_placeholder.cc +++ chrome/renderer/plugins/chrome_plugin_placeholder.cc @@ -350,8 +350,11 @@ void ChromePluginPlaceholder::OnBlockedContent( diff --git a/patch/patches/chrome_renderer.patch b/patch/patches/chrome_renderer.patch index b62c70606..2ade81e23 100644 --- a/patch/patches/chrome_renderer.patch +++ b/patch/patches/chrome_renderer.patch @@ -1,5 +1,5 @@ diff --git chrome/renderer/BUILD.gn chrome/renderer/BUILD.gn -index 3f68c173d1c2..3906f588c7c2 100644 +index 1ec9a536a378..8ab180c18d8e 100644 --- chrome/renderer/BUILD.gn +++ chrome/renderer/BUILD.gn @@ -3,6 +3,7 @@ diff --git a/patch/patches/chrome_widevine.patch b/patch/patches/chrome_widevine.patch index fec15c78f..36585723a 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 3c0ce2e2f701..7b078635d3b9 100644 +index 750df2f7fbbe..5b46bb127102 100644 --- chrome/common/chrome_content_client.cc +++ chrome/common/chrome_content_client.cc @@ -91,7 +91,8 @@ diff --git a/patch/patches/component_build_1617.patch b/patch/patches/component_build_1617.patch index b55fdcfa7..bcf3a0f1d 100644 --- a/patch/patches/component_build_1617.patch +++ b/patch/patches/component_build_1617.patch @@ -13,7 +13,7 @@ index 4393a8fac233..860715e86900 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 d10cff4a0fdd..89673c9c5250 100644 +index 67afa8b0bcef..20591788d173 100644 --- third_party/WebKit/Source/controller/BUILD.gn +++ third_party/WebKit/Source/controller/BUILD.gn @@ -25,6 +25,7 @@ component("controller") { diff --git a/patch/patches/compositor_1368.patch b/patch/patches/compositor_1368.patch index e9319ef1e..c180e239f 100644 --- a/patch/patches/compositor_1368.patch +++ b/patch/patches/compositor_1368.patch @@ -1,8 +1,8 @@ diff --git content/browser/compositor/gpu_process_transport_factory.cc content/browser/compositor/gpu_process_transport_factory.cc -index 33b9aa78462d..0653e11dbef1 100644 +index b40de2a2910a..da20699a5d64 100644 --- content/browser/compositor/gpu_process_transport_factory.cc +++ content/browser/compositor/gpu_process_transport_factory.cc -@@ -491,9 +491,19 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( +@@ -492,9 +492,19 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( // surfaces as they are not following the correct mode. DisableGpuCompositing(compositor.get()); } @@ -24,18 +24,18 @@ index 33b9aa78462d..0653e11dbef1 100644 } else { DCHECK(context_provider); diff --git ui/compositor/compositor.h ui/compositor/compositor.h -index eb56a103f8cb..ec2a44f1f5d0 100644 +index 78b361460638..bbde6e19916d 100644 --- ui/compositor/compositor.h +++ ui/compositor/compositor.h @@ -24,6 +24,7 @@ + #include "components/viz/common/surfaces/frame_sink_id.h" #include "components/viz/common/surfaces/local_surface_id.h" - #include "components/viz/common/surfaces/surface_sequence.h" #include "components/viz/host/host_frame_sink_client.h" +#include "components/viz/service/display/software_output_device.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkMatrix44.h" #include "ui/compositor/compositor_animation_observer.h" -@@ -186,6 +187,17 @@ class COMPOSITOR_EXPORT ContextFactory { +@@ -182,6 +183,17 @@ class COMPOSITOR_EXPORT ContextFactory { virtual void RemoveObserver(ContextFactoryObserver* observer) = 0; }; @@ -53,7 +53,7 @@ index eb56a103f8cb..ec2a44f1f5d0 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 -@@ -225,6 +237,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, +@@ -221,6 +233,9 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, // Schedules a redraw of the layer tree associated with this compositor. void ScheduleDraw(); @@ -63,7 +63,7 @@ index eb56a103f8cb..ec2a44f1f5d0 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 -@@ -445,6 +460,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, +@@ -441,6 +456,8 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, ui::ContextFactory* context_factory_; ui::ContextFactoryPrivate* context_factory_private_; diff --git a/patch/patches/content_2015.patch b/patch/patches/content_2015.patch index a43081619..cbb539297 100644 --- a/patch/patches/content_2015.patch +++ b/patch/patches/content_2015.patch @@ -1,8 +1,8 @@ diff --git chrome/browser/download/download_target_determiner.cc chrome/browser/download/download_target_determiner.cc -index 4f4dadd98fd9..840c1df997dd 100644 +index 03ca8ad55078..0899131ab154 100644 --- chrome/browser/download/download_target_determiner.cc +++ chrome/browser/download/download_target_determiner.cc -@@ -539,8 +539,8 @@ void IsHandledBySafePlugin(content::ResourceContext* resource_context, +@@ -540,8 +540,8 @@ void IsHandledBySafePlugin(content::ResourceContext* resource_context, content::PluginService* plugin_service = content::PluginService::GetInstance(); bool plugin_found = plugin_service->GetPluginInfo( @@ -14,10 +14,10 @@ index 4f4dadd98fd9..840c1df997dd 100644 // The GetPlugins call causes the plugin list to be refreshed. Once that's // done we can retry the GetPluginInfo call. We break out of this cycle diff --git chrome/browser/plugins/chrome_plugin_service_filter.cc chrome/browser/plugins/chrome_plugin_service_filter.cc -index 5b07f3a407bf..7dffe84fc17c 100644 +index 8e6ef99239ab..24ceaf229702 100644 --- chrome/browser/plugins/chrome_plugin_service_filter.cc +++ chrome/browser/plugins/chrome_plugin_service_filter.cc -@@ -169,6 +169,7 @@ bool ChromePluginServiceFilter::IsPluginAvailable( +@@ -178,6 +178,7 @@ bool ChromePluginServiceFilter::IsPluginAvailable( int render_frame_id, const void* context, const GURL& plugin_content_url, @@ -38,7 +38,7 @@ index 133145db74bf..021ab307ee2a 100644 content::WebPluginInfo* plugin) override; diff --git chrome/browser/plugins/pdf_iframe_navigation_throttle.cc chrome/browser/plugins/pdf_iframe_navigation_throttle.cc -index 8027836d925e..71f8d5a3f9dc 100644 +index 3b0948c90a00..f0fb3b5d9d55 100644 --- chrome/browser/plugins/pdf_iframe_navigation_throttle.cc +++ chrome/browser/plugins/pdf_iframe_navigation_throttle.cc @@ -53,7 +53,7 @@ PDFIFrameNavigationThrottle::MaybeCreateThrottleFor( @@ -51,10 +51,10 @@ index 8027836d925e..71f8d5a3f9dc 100644 return nullptr; } diff --git chrome/browser/ui/cocoa/drag_util.mm chrome/browser/ui/cocoa/drag_util.mm -index 6a2122ee1ed7..68831894695a 100644 +index b1a49f718226..cb56c9fd4765 100644 --- chrome/browser/ui/cocoa/drag_util.mm +++ chrome/browser/ui/cocoa/drag_util.mm -@@ -54,7 +54,7 @@ BOOL IsSupportedFileURL(Profile* profile, const GURL& url) { +@@ -51,7 +51,7 @@ BOOL IsSupportedFileURL(Profile* profile, const GURL& url) { return PluginService::GetInstance()->GetPluginInfo( -1, // process ID MSG_ROUTING_NONE, // routing ID @@ -64,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 fcbea93113dd..0cd61aaf0aae 100644 +index f4eb41e948bb..7e47a184d8c0 100644 --- chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc -@@ -596,6 +596,6 @@ void BrowserTabStripController::OnFindURLMimeTypeCompleted( +@@ -601,6 +601,6 @@ void BrowserTabStripController::OnFindURLMimeTypeCompleted( content::PluginService::GetInstance()->GetPluginInfo( -1, // process ID MSG_ROUTING_NONE, // routing ID @@ -76,10 +76,10 @@ index fcbea93113dd..0cd61aaf0aae 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 89a41274745c..586864a9d827 100644 +index 2986bf0e340e..6ef8486960ce 100644 --- content/browser/frame_host/navigation_handle_impl.cc +++ content/browser/frame_host/navigation_handle_impl.cc -@@ -325,12 +325,6 @@ net::Error NavigationHandleImpl::GetNetErrorCode() { +@@ -368,12 +368,6 @@ net::Error NavigationHandleImpl::GetNetErrorCode() { } RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() { @@ -93,21 +93,34 @@ index 89a41274745c..586864a9d827 100644 } diff --git content/browser/frame_host/render_frame_host_impl.cc content/browser/frame_host/render_frame_host_impl.cc -index fc3412cb2680..385a7c591689 100644 +index 1f566ef1f437..cffef1c8a2f2 100644 --- content/browser/frame_host/render_frame_host_impl.cc +++ content/browser/frame_host/render_frame_host_impl.cc -@@ -1499,6 +1499,7 @@ void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( - if (navigation_handle_) { - navigation_handle_->set_net_error_code( +@@ -1527,6 +1527,7 @@ void RenderFrameHostImpl::OnDidFailProvisionalLoadWithError( + if (GetNavigationHandle()) { + GetNavigationHandle()->set_net_error_code( static_cast(params.error_code)); -+ navigation_handle_->set_render_frame_host(this); ++ GetNavigationHandle()->set_render_frame_host(this); } frame_tree_node_->navigator()->DidFailProvisionalLoadWithError(this, params); -@@ -3515,9 +3516,9 @@ void RenderFrameHostImpl::CommitNavigation( +@@ -3269,9 +3270,9 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() { + &QuotaDispatcherHost::CreateForFrame, GetProcess(), routing_id_)); + + if (base::FeatureList::IsEnabled(network::features::kNetworkService)) { +- StoragePartitionImpl* storage_partition = +- static_cast(BrowserContext::GetStoragePartition( +- GetSiteInstance()->GetBrowserContext(), GetSiteInstance())); ++ StoragePartition* storage_partition = ++ BrowserContext::GetStoragePartition( ++ GetSiteInstance()->GetBrowserContext(), GetSiteInstance()); + // TODO(https://crbug.com/813479): Investigate why we need to explicitly + // specify task runner for BrowserThread::IO here. + // Bind calls to the BindRegistry should come on to the IO thread by +@@ -3545,9 +3546,9 @@ void RenderFrameHostImpl::CommitNavigation( // however only do this for cross-document navigations, because the // alternative would be redundant effort. - network::mojom::URLLoaderFactoryPtr default_factory; + network::mojom::URLLoaderFactoryPtrInfo default_factory_info; - StoragePartitionImpl* storage_partition = - static_cast(BrowserContext::GetStoragePartition( - GetSiteInstance()->GetBrowserContext(), GetSiteInstance())); @@ -117,24 +130,22 @@ index fc3412cb2680..385a7c591689 100644 if (subresource_loader_params && subresource_loader_params->loader_factory_info.is_valid()) { // If the caller has supplied a default URLLoaderFactory override (for -@@ -3652,9 +3653,9 @@ void RenderFrameHostImpl::FailedNavigation( - // completing an unload handler. - ResetWaitingState(); - -- StoragePartitionImpl* storage_partition = -- static_cast(BrowserContext::GetStoragePartition( -- GetSiteInstance()->GetBrowserContext(), GetSiteInstance())); +@@ -4162,8 +4163,8 @@ void RenderFrameHostImpl::CreateNetworkServiceDefaultFactoryAndObserve( + auto* context = GetSiteInstance()->GetBrowserContext(); + GetContentClient()->browser()->WillCreateURLLoaderFactory( + this, false /* is_navigation */, &default_factory_request); +- StoragePartitionImpl* storage_partition = static_cast( +- BrowserContext::GetStoragePartition(context, GetSiteInstance())); + StoragePartition* storage_partition = -+ BrowserContext::GetStoragePartition( -+ GetSiteInstance()->GetBrowserContext(), GetSiteInstance()); - - network::mojom::URLLoaderFactoryPtr default_factory; - if (g_url_loader_factory_callback_for_test.Get().is_null()) { ++ BrowserContext::GetStoragePartition(context, GetSiteInstance()); + if (g_create_network_factory_callback_for_test.Get().is_null()) { + storage_partition->GetNetworkContext()->CreateURLLoaderFactory( + std::move(default_factory_request), GetProcess()->GetID()); diff --git content/browser/frame_host/render_frame_message_filter.cc content/browser/frame_host/render_frame_message_filter.cc -index 6e105e13b6c5..99815c49cbc1 100644 +index b3653373a51f..6db0652284ec 100644 --- content/browser/frame_host/render_frame_message_filter.cc +++ content/browser/frame_host/render_frame_message_filter.cc -@@ -540,6 +540,7 @@ void RenderFrameMessageFilter::GetCookies(int render_frame_id, +@@ -546,6 +546,7 @@ void RenderFrameMessageFilter::GetCookies(int render_frame_id, void RenderFrameMessageFilter::OnGetPlugins( bool refresh, @@ -142,7 +153,7 @@ index 6e105e13b6c5..99815c49cbc1 100644 const url::Origin& main_frame_origin, IPC::Message* reply_msg) { // Don't refresh if the specified threshold has not been passed. Note that -@@ -561,18 +562,19 @@ void RenderFrameMessageFilter::OnGetPlugins( +@@ -567,18 +568,19 @@ void RenderFrameMessageFilter::OnGetPlugins( PluginServiceImpl::GetInstance()->GetPlugins( base::BindOnce(&RenderFrameMessageFilter::GetPluginsCallback, this, @@ -164,7 +175,7 @@ index 6e105e13b6c5..99815c49cbc1 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. -@@ -581,7 +583,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( +@@ -587,7 +589,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( if (!filter || filter->IsPluginAvailable(child_process_id, routing_id, resource_context_, main_frame_origin.GetURL(), @@ -173,7 +184,7 @@ index 6e105e13b6c5..99815c49cbc1 100644 plugins.push_back(plugin); } } -@@ -593,6 +595,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( +@@ -599,6 +601,7 @@ void RenderFrameMessageFilter::GetPluginsCallback( void RenderFrameMessageFilter::OnGetPluginInfo( int render_frame_id, const GURL& url, @@ -181,7 +192,7 @@ index 6e105e13b6c5..99815c49cbc1 100644 const url::Origin& main_frame_origin, const std::string& mime_type, bool* found, -@@ -601,8 +604,8 @@ void RenderFrameMessageFilter::OnGetPluginInfo( +@@ -607,8 +610,8 @@ void RenderFrameMessageFilter::OnGetPluginInfo( bool allow_wildcard = true; *found = plugin_service_->GetPluginInfo( render_process_id_, render_frame_id, resource_context_, url, @@ -193,7 +204,7 @@ index 6e105e13b6c5..99815c49cbc1 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 8c3371209034..ae382bf750c0 100644 +index db9398a07607..ce062d8a9ccd 100644 --- content/browser/frame_host/render_frame_message_filter.h +++ content/browser/frame_host/render_frame_message_filter.h @@ -136,13 +136,16 @@ class CONTENT_EXPORT RenderFrameMessageFilter @@ -214,10 +225,10 @@ index 8c3371209034..ae382bf750c0 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 f951a3fd5cad..4740a49d4d38 100644 +index a9322bc8b5d7..0b3bfef2237b 100644 --- content/browser/loader/mime_sniffing_resource_handler.cc +++ content/browser/loader/mime_sniffing_resource_handler.cc -@@ -447,8 +447,8 @@ bool MimeSniffingResourceHandler::CheckForPluginHandler( +@@ -494,8 +494,8 @@ bool MimeSniffingResourceHandler::CheckForPluginHandler( WebPluginInfo plugin; bool has_plugin = plugin_service_->GetPluginInfo( info->GetChildID(), info->GetRenderFrameID(), info->GetContext(), @@ -263,10 +274,10 @@ index e6de4ca6c8b3..18eea4948e43 100644 const std::string& mime_type, bool allow_wildcard, diff --git content/common/frame_messages.h content/common/frame_messages.h -index 7bce348a78d4..bc27dbcdda37 100644 +index 8e482fa78e3a..99b8e486e88f 100644 --- content/common/frame_messages.h +++ content/common/frame_messages.h -@@ -1342,8 +1342,9 @@ IPC_MESSAGE_ROUTED1(FrameHostMsg_PepperStopsPlayback, +@@ -1362,8 +1362,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. @@ -277,7 +288,7 @@ index 7bce348a78d4..bc27dbcdda37 100644 url::Origin /* main_frame_origin */, std::vector /* plugins */) -@@ -1351,9 +1352,10 @@ IPC_SYNC_MESSAGE_CONTROL2_1(FrameHostMsg_GetPlugins, +@@ -1371,9 +1372,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. @@ -338,10 +349,10 @@ index 3b610b1f554e..7c439e060779 100644 WebPluginInfo* plugin) = 0; diff --git content/public/renderer/content_renderer_client.h content/public/renderer/content_renderer_client.h -index b51a04da8ca0..ca13e9a6a07e 100644 +index 34aed4fd3565..364f042ee903 100644 --- content/public/renderer/content_renderer_client.h +++ content/public/renderer/content_renderer_client.h -@@ -73,6 +73,9 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -74,6 +74,9 @@ class CONTENT_EXPORT ContentRendererClient { // Notifies us that the RenderThread has been created. virtual void RenderThreadStarted() {} @@ -351,7 +362,7 @@ index b51a04da8ca0..ca13e9a6a07e 100644 // Notifies that a new RenderFrame has been created. virtual void RenderFrameCreated(RenderFrame* render_frame) {} -@@ -327,6 +330,10 @@ class CONTENT_EXPORT ContentRendererClient { +@@ -333,6 +336,10 @@ class CONTENT_EXPORT ContentRendererClient { // This method may invalidate the frame. virtual void RunScriptsAtDocumentIdle(RenderFrame* render_frame) {} @@ -377,10 +388,10 @@ index aa77b86eee98..097d26a80aa9 100644 virtual void FocusedNodeChanged(const blink::WebNode& node) {} diff --git content/renderer/render_frame_impl.cc content/renderer/render_frame_impl.cc -index f341fb4aec24..28f3105f15c0 100644 +index 259d31191208..890ec89bbaee 100644 --- content/renderer/render_frame_impl.cc +++ content/renderer/render_frame_impl.cc -@@ -3468,7 +3468,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin( +@@ -3447,7 +3447,8 @@ blink::WebPlugin* RenderFrameImpl::CreatePlugin( std::string mime_type; bool found = false; Send(new FrameHostMsg_GetPluginInfo( @@ -390,7 +401,7 @@ index f341fb4aec24..28f3105f15c0 100644 params.mime_type.Utf8(), &found, &info, &mime_type)); if (!found) return nullptr; -@@ -3824,6 +3825,8 @@ void RenderFrameImpl::FrameDetached(DetachType type) { +@@ -3808,6 +3809,8 @@ void RenderFrameImpl::FrameDetached(DetachType type) { void RenderFrameImpl::FrameFocused() { Send(new FrameHostMsg_FrameFocused(routing_id_)); @@ -400,10 +411,10 @@ index f341fb4aec24..28f3105f15c0 100644 void RenderFrameImpl::WillCommitProvisionalLoad() { diff --git content/renderer/render_thread_impl.cc content/renderer/render_thread_impl.cc -index f55d956f05ec..ec2292acb1c3 100644 +index 81d3f80db8ef..1e349f80ed23 100644 --- content/renderer/render_thread_impl.cc +++ content/renderer/render_thread_impl.cc -@@ -822,6 +822,8 @@ void RenderThreadImpl::Init( +@@ -925,6 +925,8 @@ void RenderThreadImpl::Init( StartServiceManagerConnection(); @@ -413,10 +424,10 @@ index f55d956f05ec..ec2292acb1c3 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 561593754e91..18273663e17e 100644 +index 0affacaa0294..8c08aad965a2 100644 --- content/renderer/renderer_blink_platform_impl.cc +++ content/renderer/renderer_blink_platform_impl.cc -@@ -842,6 +842,7 @@ RendererBlinkPlatformImpl::CreateMIDIAccessor( +@@ -849,6 +849,7 @@ RendererBlinkPlatformImpl::CreateMIDIAccessor( void RendererBlinkPlatformImpl::GetPluginList( bool refresh, @@ -424,7 +435,7 @@ index 561593754e91..18273663e17e 100644 const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder* builder) { #if BUILDFLAG(ENABLE_PLUGINS) -@@ -849,7 +850,8 @@ void RendererBlinkPlatformImpl::GetPluginList( +@@ -856,7 +857,8 @@ void RendererBlinkPlatformImpl::GetPluginList( if (!plugin_refresh_allowed_) refresh = false; RenderThread::Get()->Send( @@ -434,7 +445,7 @@ index 561593754e91..18273663e17e 100644 for (const WebPluginInfo& plugin : plugins) { builder->AddPlugin(WebString::FromUTF16(plugin.name), WebString::FromUTF16(plugin.desc), -@@ -1424,6 +1426,14 @@ void RendererBlinkPlatformImpl::RequestPurgeMemory() { +@@ -1417,6 +1419,14 @@ void RendererBlinkPlatformImpl::RequestPurgeMemory() { base::MemoryCoordinatorClientRegistry::GetInstance()->PurgeMemory(); } @@ -450,7 +461,7 @@ index 561593754e91..18273663e17e 100644 if (!web_database_host_) { web_database_host_ = blink::mojom::ThreadSafeWebDatabaseHostPtr::Create( diff --git content/renderer/renderer_blink_platform_impl.h content/renderer/renderer_blink_platform_impl.h -index 65ddfde81aff..d92a0b316270 100644 +index e8a4578009d1..780d8b29acb2 100644 --- content/renderer/renderer_blink_platform_impl.h +++ content/renderer/renderer_blink_platform_impl.h @@ -128,6 +128,7 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { @@ -461,7 +472,7 @@ index 65ddfde81aff..d92a0b316270 100644 const blink::WebSecurityOrigin& mainFrameOrigin, blink::WebPluginListBuilder* builder) override; blink::WebPublicSuffixList* PublicSuffixList() override; -@@ -258,6 +259,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { +@@ -256,6 +257,9 @@ class CONTENT_EXPORT RendererBlinkPlatformImpl : public BlinkPlatformImpl { mojo::ScopedDataPipeConsumerHandle handle) override; void RequestPurgeMemory() override; @@ -520,10 +531,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 ae5e6942fe34..a8fead11a023 100644 +index 25182fdb0928..9cc19c4016d3 100644 --- content/test/test_blink_web_unit_test_support.cc +++ content/test/test_blink_web_unit_test_support.cc -@@ -325,6 +325,7 @@ blink::WebThread* TestBlinkWebUnitTestSupport::CurrentThread() { +@@ -324,6 +324,7 @@ blink::WebThread* TestBlinkWebUnitTestSupport::CurrentThread() { void TestBlinkWebUnitTestSupport::GetPluginList( bool refresh, @@ -532,7 +543,7 @@ index ae5e6942fe34..a8fead11a023 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 9b5c0a94fa7f..f31678481f0f 100644 +index d8ad7b6e4435..5eda4bc3c2d5 100644 --- content/test/test_blink_web_unit_test_support.h +++ content/test/test_blink_web_unit_test_support.h @@ -72,6 +72,7 @@ class TestBlinkWebUnitTestSupport : public BlinkPlatformImpl { diff --git a/patch/patches/crashpad_1995.patch b/patch/patches/crashpad_1995.patch index e178e46e6..846b81c89 100644 --- a/patch/patches/crashpad_1995.patch +++ b/patch/patches/crashpad_1995.patch @@ -1,5 +1,5 @@ diff --git chrome/common/crash_keys.cc chrome/common/crash_keys.cc -index 5e0eabb..f862908 100644 +index 887e13776dd2..de30ebff25e4 100644 --- chrome/common/crash_keys.cc +++ chrome/common/crash_keys.cc @@ -4,6 +4,8 @@ @@ -20,7 +20,7 @@ index 5e0eabb..f862908 100644 static const char* const kIgnoreSwitches[] = { switches::kEnableLogging, switches::kFlagSwitchesBegin, -@@ -81,7 +83,7 @@ static bool IsBoringSwitch(const std::string& flag) { +@@ -77,7 +79,7 @@ static bool IsBoringSwitch(const std::string& flag) { } void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) { @@ -30,7 +30,7 @@ index 5e0eabb..f862908 100644 void SetActiveExtensions(const std::set& extensions) { diff --git chrome/common/crash_keys.h chrome/common/crash_keys.h -index a18c8fc..011bcc2 100644 +index bcf172e645a2..a46141ea43e0 100644 --- chrome/common/crash_keys.h +++ chrome/common/crash_keys.h @@ -16,6 +16,10 @@ class CommandLine; @@ -45,7 +45,7 @@ index a18c8fc..011bcc2 100644 // Sets the kNumSwitches key and the set of keys named using kSwitchFormat based // on the given |command_line|. diff --git chrome_elf/BUILD.gn chrome_elf/BUILD.gn -index fd5a28b..df46cb0 100644 +index 08dc1ddba75a..e2bc7c365980 100644 --- chrome_elf/BUILD.gn +++ chrome_elf/BUILD.gn @@ -7,6 +7,7 @@ @@ -56,7 +56,7 @@ index fd5a28b..df46cb0 100644 import("//chrome/process_version_rc_template.gni") import("//testing/test.gni") -@@ -181,9 +182,6 @@ static_library("blacklist") { +@@ -186,9 +187,6 @@ static_library("blacklist") { static_library("crash") { sources = [ @@ -66,7 +66,7 @@ index fd5a28b..df46cb0 100644 "crash/crash_helper.cc", "crash/crash_helper.h", ] -@@ -191,6 +189,7 @@ static_library("crash") { +@@ -196,6 +194,7 @@ static_library("crash") { ":hook_util", "//base", # This needs to go. DEP of app, crash_keys, client. "//base:base_static", # pe_image @@ -74,7 +74,7 @@ index fd5a28b..df46cb0 100644 "//chrome/install_static:install_static_util", "//components/crash/content/app", "//components/crash/core/common", # crash_keys -@@ -198,6 +197,17 @@ static_library("crash") { +@@ -203,6 +202,17 @@ static_library("crash") { "//content/public/common:result_codes", "//third_party/crashpad/crashpad/client", # DumpWithoutCrash ] @@ -93,7 +93,7 @@ index fd5a28b..df46cb0 100644 static_library("hook_util") { diff --git chrome_elf/crash/crash_helper.cc chrome_elf/crash/crash_helper.cc -index e8e27dc..7cb2149 100644 +index e8e27dc4ebd7..7cb2149ec41d 100644 --- chrome_elf/crash/crash_helper.cc +++ chrome_elf/crash/crash_helper.cc @@ -11,12 +11,17 @@ @@ -127,7 +127,7 @@ index e8e27dc..7cb2149 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 c72cd36..e9a79dd 100644 +index 460f7ac4defa..1c1b11f87e91 100644 --- components/crash/content/app/breakpad_linux.cc +++ components/crash/content/app/breakpad_linux.cc @@ -28,6 +28,7 @@ @@ -146,7 +146,7 @@ index c72cd36..e9a79dd 100644 #endif bool g_is_crash_reporter_enabled = false; -@@ -685,7 +687,7 @@ bool CrashDone(const MinidumpDescriptor& minidump, +@@ -689,7 +691,7 @@ bool CrashDone(const MinidumpDescriptor& minidump, info.process_type_length = 7; info.distro = base::g_linux_distro; info.distro_length = my_strlen(base::g_linux_distro); @@ -155,7 +155,7 @@ index c72cd36..e9a79dd 100644 info.process_start_time = g_process_start_time; info.oom_size = base::g_oom_size; info.pid = g_pid; -@@ -1341,7 +1343,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info, +@@ -1345,7 +1347,7 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info, header_content_encoding, header_content_type, post_file, @@ -164,7 +164,7 @@ index c72cd36..e9a79dd 100644 "--timeout=10", // Set a timeout so we don't hang forever. "--tries=1", // Don't retry if the upload fails. "-O", // Output reply to the file descriptor path. -@@ -1681,10 +1683,19 @@ void HandleCrashDump(const BreakpadInfo& info) { +@@ -1685,10 +1687,19 @@ void HandleCrashDump(const BreakpadInfo& info) { GetCrashReporterClient()->GetProductNameAndVersion(&product_name, &version); writer.AddBoundary(); @@ -186,7 +186,7 @@ index c72cd36..e9a79dd 100644 if (info.pid > 0) { char pid_value_buf[kUint64StringSize]; uint64_t pid_value_len = my_uint64_len(info.pid); -@@ -1789,10 +1800,20 @@ void HandleCrashDump(const BreakpadInfo& info) { +@@ -1793,10 +1804,20 @@ void HandleCrashDump(const BreakpadInfo& info) { crash_reporter::internal::TransitionalCrashKeyStorage; CrashKeyStorage::Iterator crash_key_iterator(*info.crash_keys); const CrashKeyStorage::Entry* entry; @@ -208,7 +208,7 @@ index c72cd36..e9a79dd 100644 writer.AddBoundary(); writer.Flush(); } -@@ -2002,6 +2023,17 @@ void SetChannelCrashKey(const std::string& channel) { +@@ -2006,6 +2027,17 @@ void SetChannelCrashKey(const std::string& channel) { channel_key.Set(channel); } @@ -227,7 +227,7 @@ index c72cd36..e9a79dd 100644 void InitNonBrowserCrashReporterForAndroid(const std::string& process_type) { SanitizationInfo sanitization_info; diff --git components/crash/content/app/breakpad_linux.h components/crash/content/app/breakpad_linux.h -index 9ee8555..7af55dd 100644 +index 9ee85554812c..7af55ddda8fe 100644 --- components/crash/content/app/breakpad_linux.h +++ components/crash/content/app/breakpad_linux.h @@ -19,6 +19,9 @@ extern void InitCrashReporter(const std::string& process_type); @@ -241,7 +241,7 @@ index 9ee8555..7af55dd 100644 extern void InitCrashKeysForTesting(); diff --git components/crash/content/app/crash_reporter_client.cc components/crash/content/app/crash_reporter_client.cc -index a37619c..e13a0f7 100644 +index a37619c815e3..e13a0f7ade86 100644 --- components/crash/content/app/crash_reporter_client.cc +++ components/crash/content/app/crash_reporter_client.cc @@ -88,11 +88,12 @@ int CrashReporterClient::GetResultCodeRespawnFailed() { @@ -315,7 +315,7 @@ index a37619c..e13a0f7 100644 } // namespace crash_reporter diff --git components/crash/content/app/crash_reporter_client.h components/crash/content/app/crash_reporter_client.h -index 75d3d6d..aa86f45 100644 +index 75d3d6d93873..aa86f45c9746 100644 --- components/crash/content/app/crash_reporter_client.h +++ components/crash/content/app/crash_reporter_client.h @@ -5,7 +5,9 @@ @@ -343,14 +343,14 @@ index 75d3d6d..aa86f45 100644 virtual base::FilePath GetReporterLogFilename(); // Custom crash minidump handler after the minidump is generated. -@@ -106,6 +109,7 @@ class CrashReporterClient { +@@ -105,6 +108,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); - #endif +#endif + #endif // The location where minidump files should be written. Returns true if - // |crash_dir| was set. Windows has to use base::string16 because this code @@ -180,6 +184,30 @@ class CrashReporterClient { // Returns true if breakpad should run in the given process type. @@ -383,10 +383,10 @@ index 75d3d6d..aa86f45 100644 } // namespace crash_reporter diff --git components/crash/content/app/crashpad.cc components/crash/content/app/crashpad.cc -index dde11ea..1a1f8b0 100644 +index 36ff7c219ad5..241156316efc 100644 --- components/crash/content/app/crashpad.cc +++ components/crash/content/app/crashpad.cc -@@ -133,7 +133,8 @@ void InitializeCrashpadImpl(bool initial_client, +@@ -142,7 +142,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. @@ -397,7 +397,7 @@ index dde11ea..1a1f8b0 100644 ->set_system_crash_reporter_forwarding(crashpad::TriState::kDisabled); } diff --git components/crash/content/app/crashpad_mac.mm components/crash/content/app/crashpad_mac.mm -index 6508c2a..f51ce5a 100644 +index 6508c2a06760..f51ce5a17e63 100644 --- components/crash/content/app/crashpad_mac.mm +++ components/crash/content/app/crashpad_mac.mm @@ -16,11 +16,14 @@ @@ -498,7 +498,7 @@ index 6508c2a..f51ce5a 100644 handler_path, database_path, metrics_path, url, process_annotations, arguments, true, false); diff --git components/crash/content/app/crashpad_win.cc components/crash/content/app/crashpad_win.cc -index a5d1afc..91815d9 100644 +index a5d1afc409f4..91815d949f2e 100644 --- components/crash/content/app/crashpad_win.cc +++ components/crash/content/app/crashpad_win.cc @@ -34,8 +34,8 @@ void GetPlatformCrashpadAnnotations( @@ -568,7 +568,7 @@ index a5d1afc..91815d9 100644 if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) { diff --git content/browser/frame_host/debug_urls.cc content/browser/frame_host/debug_urls.cc -index 4695432..62a7ce8 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 e442adc32..1325515b4 100644 --- a/patch/patches/crashpad_tp_1995.patch +++ b/patch/patches/crashpad_tp_1995.patch @@ -146,7 +146,7 @@ index b64f74fbaf28..0c3c22e215b6 100644 struct Data; diff --git third_party/crashpad/crashpad/handler/BUILD.gn third_party/crashpad/crashpad/handler/BUILD.gn -index 71037bb04d5d..61f7e8ca04ca 100644 +index 9c337697b605..b1fbd1de6074 100644 --- third_party/crashpad/crashpad/handler/BUILD.gn +++ third_party/crashpad/crashpad/handler/BUILD.gn @@ -12,6 +12,7 @@ diff --git a/patch/patches/devtools_product_2300.patch b/patch/patches/devtools_product_2300.patch index 006fc5f53..50b7661b4 100644 --- a/patch/patches/devtools_product_2300.patch +++ b/patch/patches/devtools_product_2300.patch @@ -1,8 +1,8 @@ diff --git content/browser/devtools/devtools_http_handler.cc content/browser/devtools/devtools_http_handler.cc -index 36525162ff0e..db28486fa6c0 100644 +index 1a93ba92a9e0..2c4b116d25ea 100644 --- content/browser/devtools/devtools_http_handler.cc +++ content/browser/devtools/devtools_http_handler.cc -@@ -503,7 +503,7 @@ void DevToolsHttpHandler::OnJsonRequest( +@@ -543,7 +543,7 @@ void DevToolsHttpHandler::OnJsonRequest( version.SetString("Protocol-Version", DevToolsAgentHost::GetProtocolVersion()); version.SetString("WebKit-Version", GetWebKitVersion()); diff --git a/patch/patches/extensions_1947.patch b/patch/patches/extensions_1947.patch index d20b504b3..91b89b838 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 3263eb9e324a..b5bde4cea8f7 100644 +index d7342d69dd8e..33d538952375 100644 --- content/browser/frame_host/render_frame_host_manager.cc +++ content/browser/frame_host/render_frame_host_manager.cc -@@ -890,10 +890,11 @@ bool RenderFrameHostManager::ShouldSwapBrowsingInstancesForNavigation( +@@ -891,10 +891,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 3263eb9e324a..b5bde4cea8f7 100644 return true; } -@@ -1032,7 +1033,8 @@ RenderFrameHostManager::GetSiteInstanceForNavigation( +@@ -1033,7 +1034,8 @@ RenderFrameHostManager::GetSiteInstanceForNavigation( // Double-check that the new SiteInstance is associated with the right // BrowserContext. @@ -29,10 +29,10 @@ index 3263eb9e324a..b5bde4cea8f7 100644 // If |new_instance| is a new SiteInstance for a subframe that requires a // dedicated process, 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 18767b608ce9..41f5dc26ffdc 100644 +index 5373ee07b5cd..2558e590ba7c 100644 --- content/public/browser/content_browser_client.h +++ content/public/browser/content_browser_client.h -@@ -341,6 +341,13 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -354,6 +354,13 @@ class CONTENT_EXPORT ContentBrowserClient { const GURL& current_url, const GURL& new_url); @@ -152,10 +152,10 @@ index 34812c083bf5..1ccfaf6e1c45 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 267a40121d8e..fc68e632465c 100644 +index 9e8ebb1a4d59..b42e88b11f6a 100644 --- extensions/browser/extensions_browser_client.h +++ extensions/browser/extensions_browser_client.h -@@ -53,6 +53,7 @@ class ComponentExtensionResourceManager; +@@ -54,6 +54,7 @@ class ComponentExtensionResourceManager; class Extension; class ExtensionCache; class ExtensionError; @@ -163,7 +163,7 @@ index 267a40121d8e..fc68e632465c 100644 class ExtensionHostDelegate; class ExtensionPrefsObserver; class ExtensionApiFrameIdMap; -@@ -108,6 +109,11 @@ class ExtensionsBrowserClient { +@@ -109,6 +110,11 @@ class ExtensionsBrowserClient { virtual content::BrowserContext* GetOriginalContext( content::BrowserContext* context) = 0; @@ -175,7 +175,7 @@ index 267a40121d8e..fc68e632465c 100644 #if defined(OS_CHROMEOS) // Returns a user id hash from |context| or an empty string if no hash could // be extracted. -@@ -173,6 +179,14 @@ class ExtensionsBrowserClient { +@@ -191,6 +197,14 @@ class ExtensionsBrowserClient { virtual std::unique_ptr CreateExtensionHostDelegate() = 0; diff --git a/patch/patches/gn_config.patch b/patch/patches/gn_config.patch index cc247f043..ef2c01e19 100644 --- a/patch/patches/gn_config.patch +++ b/patch/patches/gn_config.patch @@ -1,8 +1,8 @@ diff --git .gn .gn -index 20f642efb056..7f73f53c70ad 100644 +index 50a8a2fe9f1e..719adff0da9b 100644 --- .gn +++ .gn -@@ -234,6 +234,8 @@ exec_script_whitelist = +@@ -241,6 +241,8 @@ exec_script_whitelist = # in the Chromium repo outside of //build. "//build_overrides/build.gni", @@ -12,10 +12,10 @@ index 20f642efb056..7f73f53c70ad 100644 # https://crbug.com/474506. "//clank/java/BUILD.gn", diff --git BUILD.gn BUILD.gn -index 92a8578280e6..11eb3b16a812 100644 +index 161519ebfeac..c034f54603e8 100644 --- BUILD.gn +++ BUILD.gn -@@ -183,6 +183,7 @@ group("gn_all") { +@@ -190,6 +190,7 @@ group("gn_all") { if (!is_ios && !is_fuchsia) { deps += [ @@ -96,7 +96,7 @@ index a1d2ea4b2394..50514a54e64f 100644 diff --git build/vs_toolchain.py build/vs_toolchain.py -index 0a54e113f30f..d8ff277fcda6 100755 +index 5f9541e4556f..c1144b30f237 100755 --- build/vs_toolchain.py +++ build/vs_toolchain.py @@ -81,11 +81,18 @@ def SetEnvironmentAndGetRuntimeDllDirs(): @@ -119,10 +119,10 @@ index 0a54e113f30f..d8ff277fcda6 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 bd0fc70bb87f..79315464c57b 100644 +index 94c5f759a0dd..a166b6302eeb 100644 --- chrome/chrome_paks.gni +++ chrome/chrome_paks.gni -@@ -255,7 +255,7 @@ template("chrome_paks") { +@@ -253,7 +253,7 @@ template("chrome_paks") { } input_locales = locales @@ -132,15 +132,15 @@ index bd0fc70bb87f..79315464c57b 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 3f65aa27ca38..3227cb17e460 100644 +index 3ed598db3989..b23170bc4591 100644 --- chrome/installer/mini_installer/BUILD.gn +++ chrome/installer/mini_installer/BUILD.gn -@@ -130,7 +130,7 @@ template("generate_mini_installer") { +@@ -143,7 +143,7 @@ template("generate_mini_installer") { inputs = [ "$chrome_dll_file", "$root_out_dir/chrome.exe", - "$root_out_dir/locales/en-US.pak", + "$root_out_dir/chrome/locales/en-US.pak", "$root_out_dir/setup.exe", - "$root_out_dir/v8_context_snapshot.bin", "//chrome/tools/build/win/makecab.py", + release_file, diff --git a/patch/patches/gritsettings.patch b/patch/patches/gritsettings.patch index 755e0e1d3..324bd05a6 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 fc1c4aa91190..dfa9e7a43799 100644 +index 499d041b08c0..b036897264f7 100644 --- tools/gritsettings/resource_ids +++ tools/gritsettings/resource_ids -@@ -393,4 +393,11 @@ +@@ -396,4 +396,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 8240e2128..f6ef1f418 100644 --- a/patch/patches/linux_build.patch +++ b/patch/patches/linux_build.patch @@ -1,29 +1,29 @@ diff --git build/config/compiler/BUILD.gn build/config/compiler/BUILD.gn -index 2673c6a79889..ca5726966ac0 100644 +index 9a10137aa405..6dd8033a0b33 100644 --- build/config/compiler/BUILD.gn +++ build/config/compiler/BUILD.gn -@@ -443,7 +443,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. -- if ((!is_android && linux_use_bundled_binutils) || is_chromeos || -+ if ((!is_android && linux_use_bundled_binutils && current_cpu != "x86") || is_chromeos || - !(current_cpu == "x86" || current_cpu == "x64")) { - ldflags += [ "-Wl,--icf=all" ] - } +@@ -137,7 +137,7 @@ declare_args() { + is_posix && !using_sanitizer && !(is_android && use_order_profiling) && + ((use_lld && !is_nacl) || + (use_gold && +- ((!is_android && linux_use_bundled_binutils) || is_chromeos || ++ ((!is_android && linux_use_bundled_binutils && current_cpu != "x86") || is_chromeos || + !(current_cpu == "x86" || current_cpu == "x64")))) + } + diff --git chrome/browser/ui/libgtkui/gtk_util.cc chrome/browser/ui/libgtkui/gtk_util.cc -index fc6ffb9d..f6c22e5 100644 +index 96f8c0e71472..49c462b37e12 100644 --- chrome/browser/ui/libgtkui/gtk_util.cc +++ chrome/browser/ui/libgtkui/gtk_util.cc -@@ -56,6 +56,7 @@ void CommonInitFromCommandLine(const base::CommandLine& command_line, - } +@@ -237,6 +237,7 @@ float GetDeviceScaleFactor() { + return linux_ui ? linux_ui->GetDeviceScaleFactor() : 1; } +#if GTK_MAJOR_VERSION > 2 using GtkSetState = void (*)(GtkWidgetPath*, gint, GtkStateFlags); PROTECTED_MEMORY_SECTION base::ProtectedMemory _gtk_widget_path_iter_set_state; -@@ -63,6 +64,7 @@ PROTECTED_MEMORY_SECTION base::ProtectedMemory +@@ -244,6 +245,7 @@ PROTECTED_MEMORY_SECTION base::ProtectedMemory using GtkSetObjectName = void (*)(GtkWidgetPath*, gint, const char*); PROTECTED_MEMORY_SECTION base::ProtectedMemory _gtk_widget_path_iter_set_object_name; diff --git a/patch/patches/message_loop_443_1992243003.patch b/patch/patches/message_loop_443_1992243003.patch index 86fab2f1a..fa4f2c6a7 100644 --- a/patch/patches/message_loop_443_1992243003.patch +++ b/patch/patches/message_loop_443_1992243003.patch @@ -33,7 +33,7 @@ index 27ee7fe8155b..353a61c3badd 100644 // if type_ is TYPE_CUSTOM and pump_ is null. MessagePumpFactoryCallback pump_factory_; diff --git base/message_loop/message_pump_win.cc base/message_loop/message_pump_win.cc -index 6f48da1c744e..e427941bfd06 100644 +index 5069b8524924..e88a3c7974f2 100644 --- base/message_loop/message_pump_win.cc +++ base/message_loop/message_pump_win.cc @@ -366,20 +366,28 @@ bool MessagePumpForUI::ProcessMessageHelper(const MSG& msg) { diff --git a/patch/patches/net_filter_515.patch b/patch/patches/net_filter_515.patch index 775097ca9..95b0cb90a 100644 --- a/patch/patches/net_filter_515.patch +++ b/patch/patches/net_filter_515.patch @@ -1,16 +1,16 @@ diff --git net/base/network_delegate.h net/base/network_delegate.h -index 22c428f90b16..1e0e6deaa7df 100644 +index e3b6502ff7ee..a3b4b2d40d5f 100644 --- net/base/network_delegate.h +++ net/base/network_delegate.h -@@ -16,6 +16,7 @@ +@@ -17,6 +17,7 @@ #include "net/base/completion_callback.h" #include "net/base/net_export.h" #include "net/cookies/canonical_cookie.h" +#include "net/filter/source_stream.h" - #include "net/proxy/proxy_retry_info.h" + #include "net/proxy_resolution/proxy_retry_info.h" class GURL; -@@ -124,6 +125,10 @@ class NET_EXPORT NetworkDelegate { +@@ -127,6 +128,10 @@ class NET_EXPORT NetworkDelegate { bool CanUseReportingClient(const url::Origin& origin, const GURL& endpoint) const; @@ -22,10 +22,10 @@ index 22c428f90b16..1e0e6deaa7df 100644 THREAD_CHECKER(thread_checker_); diff --git net/url_request/url_request_job.cc net/url_request/url_request_job.cc -index 25e971d7e6bc..2d14710ed4fe 100644 +index 2dad8a230652..71666b08a212 100644 --- net/url_request/url_request_job.cc +++ net/url_request/url_request_job.cc -@@ -447,6 +447,12 @@ void URLRequestJob::NotifyHeadersComplete() { +@@ -450,6 +450,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 6a568e427..49b8a1050 100644 --- a/patch/patches/net_security_expiration_1994.patch +++ b/patch/patches/net_security_expiration_1994.patch @@ -55,10 +55,10 @@ index fb6f4847cfe9..aa4c1cdafb9f 100644 } // namespace net diff --git net/http/transport_security_state.cc net/http/transport_security_state.cc -index 6eaa321ef4b8..9926ea6afc40 100644 +index cd4e9c74a31c..66e3598bb127 100644 --- net/http/transport_security_state.cc +++ net/http/transport_security_state.cc -@@ -1567,8 +1567,10 @@ void TransportSecurityState::ClearReportCachesForTesting() { +@@ -1564,8 +1564,10 @@ void TransportSecurityState::ClearReportCachesForTesting() { sent_expect_ct_reports_cache_.Clear(); } diff --git a/patch/patches/net_urlrequest_1327.patch b/patch/patches/net_urlrequest_1327.patch index 257438f98..d4ca5719c 100644 --- a/patch/patches/net_urlrequest_1327.patch +++ b/patch/patches/net_urlrequest_1327.patch @@ -1,10 +1,10 @@ diff --git net/url_request/url_request.h net/url_request/url_request.h -index 60fbf78c7886..9597011602ba 100644 +index c0fc8aeee535..0a16da034f80 100644 --- net/url_request/url_request.h +++ net/url_request/url_request.h -@@ -693,10 +693,10 @@ class NET_EXPORT URLRequest : public base::SupportsUserData { - // called with a response from the server. - void SetResponseHeadersCallback(ResponseHeadersCallback callback); +@@ -705,10 +705,10 @@ class NET_EXPORT URLRequest : public base::SupportsUserData { + void set_socket_tag(const SocketTag& socket_tag); + const SocketTag& socket_tag() const { return socket_tag_; } - protected: // Allow the URLRequestJob class to control the is_pending() flag. diff --git a/patch/patches/pdfium_print_549365.patch b/patch/patches/pdfium_print_549365.patch index e83e2fb58..baa880421 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 c771b8191..6a5f1f3e4 100644 +index d7c8640a2..7f508fdae 100644 --- BUILD.gn +++ BUILD.gn -@@ -230,6 +230,10 @@ jumbo_static_library("pdfium") { +@@ -231,6 +231,10 @@ jumbo_static_library("pdfium") { if (pdf_is_complete_lib) { complete_static_lib = true } @@ -14,14 +14,14 @@ index c771b8191..6a5f1f3e4 100644 jumbo_static_library("test_support") { diff --git fpdfsdk/fpdfview.cpp fpdfsdk/fpdfview.cpp -index 97fc02a23..000b4a7d3 100644 +index e890aa009..cabb73bb6 100644 --- fpdfsdk/fpdfview.cpp +++ fpdfsdk/fpdfview.cpp @@ -36,6 +36,7 @@ #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/fsdk_define.h" #include "fpdfsdk/fsdk_pauseadapter.h" -+#include "fxjs/fxjs_v8.h" ++#include "fxjs/cfxjs_engine.h" #include "fxjs/ijs_runtime.h" #include "public/fpdf_edit.h" #include "public/fpdf_ext.h" diff --git a/patch/patches/prefs_content_1161.patch b/patch/patches/prefs_content_1161.patch index eba0ff894..cdc8b0fc4 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 a714130a50d8..2a835d7282b3 100644 +index 6b1fa1ceb553..d3c6c961ccdf 100644 --- content/public/common/common_param_traits_macros.h +++ content/public/common/common_param_traits_macros.h -@@ -187,6 +187,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences) +@@ -183,6 +183,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 a714130a50d8..2a835d7282b3 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 06069a576dfd..912155ebec7c 100644 +index e147056305cb..ee7d1a7d8c87 100644 --- content/public/common/web_preferences.cc +++ content/public/common/web_preferences.cc -@@ -178,6 +178,7 @@ WebPreferences::WebPreferences() +@@ -166,6 +166,7 @@ WebPreferences::WebPreferences() spatial_navigation_enabled(false), use_solid_color_scrollbars(false), navigate_on_drag_drop(true), @@ -23,10 +23,10 @@ index 06069a576dfd..912155ebec7c 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 49be57cd2aad..417be7a55184 100644 +index 43606a755fa2..967190fc8f83 100644 --- content/public/common/web_preferences.h +++ content/public/common/web_preferences.h -@@ -198,6 +198,7 @@ struct CONTENT_EXPORT WebPreferences { +@@ -186,6 +186,7 @@ struct CONTENT_EXPORT WebPreferences { bool spatial_navigation_enabled; bool use_solid_color_scrollbars; bool navigate_on_drag_drop; @@ -35,10 +35,10 @@ index 49be57cd2aad..417be7a55184 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 1d136aa56ff4..2151ad629dd9 100644 +index 6e57733e6657..18cb21550b0b 100644 --- content/renderer/render_view_impl.cc +++ content/renderer/render_view_impl.cc -@@ -1261,6 +1261,7 @@ void RenderViewImpl::ApplyWebPreferencesInternal( +@@ -1235,6 +1235,7 @@ 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 a053e4711..4447546e8 100644 --- a/patch/patches/print_header_footer_1478_1565.patch +++ b/patch/patches/print_header_footer_1478_1565.patch @@ -1,10 +1,10 @@ diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn -index 1a43eba4852b..eccb01ca818e 100644 +index c50380806706..011b63531a33 100644 --- chrome/browser/ui/BUILD.gn +++ chrome/browser/ui/BUILD.gn -@@ -344,6 +344,7 @@ split_static_library("ui") { +@@ -919,6 +919,7 @@ split_static_library("ui") { "//base:i18n", - "//base/allocator:features", + "//base/allocator:buildflags", "//cc/paint", + "//cef/libcef/features", "//chrome:extra_resources", @@ -81,56 +81,70 @@ index 45644030eb24..c894209e1530 100644 } } // namespace settings -diff --git chrome/utility/printing_handler.cc chrome/utility/printing_handler.cc -index 1eb818639134..4525da919180 100644 ---- chrome/utility/printing_handler.cc -+++ chrome/utility/printing_handler.cc -@@ -23,6 +23,7 @@ namespace printing { +diff --git chrome/common/chrome_utility_printing_messages.h chrome/common/chrome_utility_printing_messages.h +index 6dfe3b430d7d..82e3ab03bdc4 100644 +--- chrome/common/chrome_utility_printing_messages.h ++++ chrome/common/chrome_utility_printing_messages.h +@@ -16,7 +16,7 @@ - namespace { + #define IPC_MESSAGE_START ChromeUtilityPrintingMsgStart -+#if BUILDFLAG(ENABLE_PRINT_PREVIEW) - bool Send(IPC::Message* message) { - return content::UtilityThread::Get()->Send(message); - } -@@ -30,6 +31,7 @@ bool Send(IPC::Message* message) { - void ReleaseProcess() { - content::UtilityThread::Get()->ReleaseProcess(); - } -+#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) +-#if defined(OS_WIN) && BUILDFLAG(ENABLE_PRINT_PREVIEW) ++#if defined(OS_WIN) + // Preview and Cloud Print messages. + IPC_STRUCT_TRAITS_BEGIN(printing::PrinterCapsAndDefaults) + IPC_STRUCT_TRAITS_MEMBER(printer_capabilities) +@@ -94,6 +94,6 @@ IPC_MESSAGE_CONTROL1(ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed, + IPC_MESSAGE_CONTROL1( + ChromeUtilityHostMsg_GetPrinterSemanticCapsAndDefaults_Failed, + std::string /* printer name */) +-#endif // defined(OS_WIN) && BUILDFLAG(ENABLE_PRINT_PREVIEW) ++#endif // defined(OS_WIN) - } // namespace + #endif // CHROME_COMMON_CHROME_UTILITY_PRINTING_MESSAGES_H_ +diff --git chrome/utility/printing_handler.h chrome/utility/printing_handler.h +index b56deaf18589..3d931b55686f 100644 +--- chrome/utility/printing_handler.h ++++ chrome/utility/printing_handler.h +@@ -11,7 +11,7 @@ + #include "build/build_config.h" + #include "printing/features/features.h" + +-#if !defined(OS_WIN) || !BUILDFLAG(ENABLE_PRINT_PREVIEW) ++#if !defined(OS_WIN) + #error "Windows printing and print preview must be enabled" + #endif diff --git components/printing/common/print_messages.cc components/printing/common/print_messages.cc -index ef1e25b11afe..a12e21450a59 100644 +index 6df98550d22d..3192faf033f8 100644 --- components/printing/common/print_messages.cc +++ components/printing/common/print_messages.cc -@@ -129,7 +129,6 @@ void PrintMsg_PrintPages_Params::Reset() { - pages = std::vector(); - } +@@ -148,7 +148,6 @@ PrintMsg_PrintFrame_Params::PrintMsg_PrintFrame_Params() {} + + PrintMsg_PrintFrame_Params::~PrintMsg_PrintFrame_Params() {} -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) PrintHostMsg_RequestPrintPreview_Params:: PrintHostMsg_RequestPrintPreview_Params() : is_modifiable(false), -@@ -151,4 +150,3 @@ PrintHostMsg_SetOptionsFromDocument_Params:: +@@ -170,4 +169,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 6d02771d018d..cb8608f5b523 100644 +index 22469f97d1f9..fd303fd1e764 100644 --- components/printing/common/print_messages.h +++ components/printing/common/print_messages.h -@@ -79,7 +79,6 @@ struct PrintMsg_PrintPages_Params { - std::vector pages; +@@ -85,7 +85,6 @@ struct PrintMsg_PrintFrame_Params { + int document_cookie; }; -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) struct PrintHostMsg_RequestPrintPreview_Params { PrintHostMsg_RequestPrintPreview_Params(); ~PrintHostMsg_RequestPrintPreview_Params(); -@@ -98,7 +97,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params { +@@ -104,7 +103,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params { printing::DuplexMode duplex; printing::PageRanges page_ranges; }; @@ -138,7 +152,7 @@ index 6d02771d018d..cb8608f5b523 100644 #endif // INTERNAL_COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_ -@@ -189,7 +187,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange) +@@ -198,7 +196,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange) IPC_STRUCT_TRAITS_MEMBER(to) IPC_STRUCT_TRAITS_END() @@ -146,7 +160,7 @@ index 6d02771d018d..cb8608f5b523 100644 IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_RequestPrintPreview_Params) IPC_STRUCT_TRAITS_MEMBER(is_modifiable) IPC_STRUCT_TRAITS_MEMBER(webnode_only) -@@ -210,7 +207,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_SetOptionsFromDocument_Params) +@@ -219,7 +216,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_SetOptionsFromDocument_Params) // Specifies page range to be printed. IPC_STRUCT_TRAITS_MEMBER(page_ranges) IPC_STRUCT_TRAITS_END() @@ -154,23 +168,23 @@ index 6d02771d018d..cb8608f5b523 100644 IPC_STRUCT_TRAITS_BEGIN(printing::PageSizeMargins) IPC_STRUCT_TRAITS_MEMBER(content_width) -@@ -230,7 +226,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params) - IPC_STRUCT_TRAITS_MEMBER(pages) - IPC_STRUCT_TRAITS_END() +@@ -264,7 +260,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidPrintContent_Params) + IPC_STRUCT_MEMBER(printing::ContentToProxyIdMap, subframe_content_info) + IPC_STRUCT_END() -#if BUILDFLAG(ENABLE_PRINT_PREVIEW) // Parameters to describe a rendered document. IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params) - // A shared memory handle to metafile data. -@@ -281,7 +276,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) + // Document's content including metafile data and subframe info. +@@ -309,7 +304,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params) + // The id of the preview request. + IPC_STRUCT_MEMBER(int, preview_request_id) IPC_STRUCT_END() -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) // Parameters to describe a rendered page. IPC_STRUCT_BEGIN(PrintHostMsg_DidPrintDocument_Params) -@@ -321,10 +315,8 @@ IPC_STRUCT_END() +@@ -345,10 +339,8 @@ IPC_STRUCT_END() // Messages sent from the browser to the renderer. @@ -181,7 +195,7 @@ index 6d02771d018d..cb8608f5b523 100644 // Tells the RenderFrame to initiate printing or print preview for a particular // node, depending on which mode the RenderFrame is in. -@@ -346,13 +338,13 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone, +@@ -373,13 +365,13 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone, // Tells the RenderFrame whether printing is enabled or not. IPC_MESSAGE_ROUTED1(PrintMsg_SetPrintingEnabled, bool /* enabled */) @@ -196,7 +210,7 @@ index 6d02771d018d..cb8608f5b523 100644 // Tells the RenderFrame that print preview dialog was closed. IPC_MESSAGE_ROUTED0(PrintMsg_ClosePrintPreviewDialog) #endif -@@ -412,7 +404,6 @@ IPC_MESSAGE_CONTROL3(PrintHostMsg_TempFileForPrintingWritten, +@@ -445,7 +437,6 @@ IPC_MESSAGE_CONTROL3(PrintHostMsg_TempFileForPrintingWritten, int /* page count */) #endif // defined(OS_ANDROID) @@ -204,7 +218,7 @@ index 6d02771d018d..cb8608f5b523 100644 // Asks the browser to do print preview. IPC_MESSAGE_ROUTED1(PrintHostMsg_RequestPrintPreview, PrintHostMsg_RequestPrintPreview_Params /* params */) -@@ -446,7 +437,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel, +@@ -479,7 +470,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 */) @@ -212,7 +226,7 @@ index 6d02771d018d..cb8608f5b523 100644 // This is sent when there are invalid printer settings. IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) -@@ -455,7 +445,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) +@@ -488,7 +478,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError) IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed, int /* document cookie */) @@ -220,7 +234,7 @@ index 6d02771d018d..cb8608f5b523 100644 // Tell the browser print preview failed. IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed, int /* document cookie */) -@@ -482,6 +471,5 @@ IPC_MESSAGE_ROUTED1(PrintHostMsg_ShowScriptedPrintPreview, +@@ -515,6 +504,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 */) @@ -228,10 +242,10 @@ index 6d02771d018d..cb8608f5b523 100644 #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 86c3b7a291e3..7a645cea6ebe 100644 +index 2d81ba90d69c..0f70f15f2deb 100644 --- components/printing/renderer/print_render_frame_helper.cc +++ components/printing/renderer/print_render_frame_helper.cc -@@ -322,7 +322,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame, +@@ -326,7 +326,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame, return plugin && plugin->SupportsPaginatedPrint(); } @@ -239,7 +253,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 // Returns true if the current destination printer is PRINT_TO_PDF. bool IsPrintToPdfRequested(const base::DictionaryValue& job_settings) { bool print_to_pdf = false; -@@ -344,7 +343,6 @@ bool PrintingFrameHasPageSizeStyle(blink::WebLocalFrame* frame, +@@ -348,7 +347,6 @@ bool PrintingFrameHasPageSizeStyle(blink::WebLocalFrame* frame, } return frame_has_custom_page_size_style; } @@ -247,7 +261,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 #if BUILDFLAG(ENABLE_PRINTING) // Disable scaling when either: -@@ -401,7 +399,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame, +@@ -405,7 +403,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame, } #endif @@ -255,7 +269,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 bool FitToPageEnabled(const base::DictionaryValue& job_settings) { bool fit_to_paper_size = false; if (!job_settings.GetBoolean(kSettingFitToPageEnabled, &fit_to_paper_size)) { -@@ -443,7 +440,6 @@ blink::WebPrintScalingOption GetPrintScalingOption( +@@ -447,7 +444,6 @@ blink::WebPrintScalingOption GetPrintScalingOption( } return blink::kWebPrintScalingOptionFitToPrintableArea; } @@ -263,7 +277,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 // Helper function to scale and round an integer value with a double valued // scaling. -@@ -952,6 +948,7 @@ PrintRenderFrameHelper::PrintRenderFrameHelper( +@@ -951,6 +947,7 @@ PrintRenderFrameHelper::PrintRenderFrameHelper( notify_browser_of_print_failure_(true), delegate_(std::move(delegate)), print_node_in_progress_(false), @@ -271,7 +285,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 is_loading_(false), is_scripted_preview_delayed_(false), ipc_nesting_level_(0), -@@ -1013,10 +1010,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { +@@ -1012,10 +1009,8 @@ void PrintRenderFrameHelper::ScriptedPrint(bool user_initiated) { return; if (g_is_preview_enabled) { @@ -282,7 +296,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 } else { #if BUILDFLAG(ENABLE_BASIC_PRINTING) auto weak_this = weak_ptr_factory_.GetWeakPtr(); -@@ -1048,10 +1043,10 @@ bool PrintRenderFrameHelper::OnMessageReceived(const IPC::Message& message) { +@@ -1047,10 +1042,10 @@ bool PrintRenderFrameHelper::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages) IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog) #endif // BUILDFLAG(ENABLE_BASIC_PRINTING) @@ -302,25 +316,23 @@ index 86c3b7a291e3..7a645cea6ebe 100644 void PrintRenderFrameHelper::OnPrintPreview( const base::DictionaryValue& settings) { if (ipc_nesting_level_ > 1) -@@ -1326,7 +1320,7 @@ bool PrintRenderFrameHelper::CreatePreviewDocument() { +@@ -1319,7 +1313,6 @@ bool PrintRenderFrameHelper::CreatePreviewDocument() { return true; } --#if !defined(OS_MACOSX) && BUILDFLAG(ENABLE_PRINT_PREVIEW) -+#if !defined(OS_MACOSX) +-#if BUILDFLAG(ENABLE_PRINT_PREVIEW) bool PrintRenderFrameHelper::RenderPreviewPage( int page_number, const PrintMsg_Print_Params& print_params) { -@@ -1356,7 +1350,7 @@ bool PrintRenderFrameHelper::RenderPreviewPage( - } - return PreviewPageRendered(page_number, draft_metafile.get()); +@@ -1347,7 +1340,6 @@ bool PrintRenderFrameHelper::RenderPreviewPage( + print_params.printed_doc_type); + return PreviewPageRendered(page_number, std::move(metafile)); } --#endif // !defined(OS_MACOSX) && BUILDFLAG(ENABLE_PRINT_PREVIEW) -+#endif // !defined(OS_MACOSX) +-#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) bool PrintRenderFrameHelper::FinalizePrintReadyDocument() { DCHECK(!is_print_ready_metafile_sent_); -@@ -1385,7 +1379,6 @@ bool PrintRenderFrameHelper::FinalizePrintReadyDocument() { +@@ -1375,7 +1367,6 @@ bool PrintRenderFrameHelper::FinalizePrintReadyDocument() { Send(new PrintHostMsg_MetafileReadyForPrinting(routing_id(), preview_params)); return true; } @@ -328,7 +340,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 void PrintRenderFrameHelper::OnPrintingDone(bool success) { if (ipc_nesting_level_ > 1) -@@ -1400,7 +1393,6 @@ void PrintRenderFrameHelper::OnSetPrintingEnabled(bool enabled) { +@@ -1390,7 +1381,6 @@ void PrintRenderFrameHelper::OnSetPrintingEnabled(bool enabled) { is_printing_enabled_ = enabled; } @@ -336,7 +348,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) { if (ipc_nesting_level_ > 1) return; -@@ -1411,7 +1403,9 @@ void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) { +@@ -1401,7 +1391,9 @@ void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) { // that instead. auto plugin = delegate_->GetPdfElement(frame); if (!plugin.IsNull()) { @@ -346,7 +358,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 return; } print_preview_context_.InitWithFrame(frame); -@@ -1420,10 +1414,11 @@ void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) { +@@ -1410,10 +1402,11 @@ void PrintRenderFrameHelper::OnInitiatePrintPreview(bool has_selection) { : PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME); } @@ -357,9 +369,9 @@ index 86c3b7a291e3..7a645cea6ebe 100644 -#endif +#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) - bool PrintRenderFrameHelper::IsPrintingEnabled() const { - return is_printing_enabled_; -@@ -1445,11 +1440,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { + void PrintRenderFrameHelper::OnPrintFrameContent( + const PrintMsg_PrintFrame_Params& params) { +@@ -1497,11 +1490,9 @@ void PrintRenderFrameHelper::PrintNode(const blink::WebNode& node) { print_node_in_progress_ = true; @@ -372,7 +384,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 } else { #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Make a copy of the node, in case RenderView::OnContextMenuClosed() resets -@@ -1539,7 +1532,6 @@ void PrintRenderFrameHelper::DidFinishPrinting(PrintingResult result) { +@@ -1595,7 +1586,6 @@ void PrintRenderFrameHelper::DidFinishPrinting(PrintingResult result) { } break; @@ -380,7 +392,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 case FAIL_PREVIEW: if (!is_print_ready_metafile_sent_) { if (notify_browser_of_print_failure_) { -@@ -1556,7 +1548,6 @@ void PrintRenderFrameHelper::DidFinishPrinting(PrintingResult result) { +@@ -1612,7 +1602,6 @@ void PrintRenderFrameHelper::DidFinishPrinting(PrintingResult result) { cookie)); print_preview_context_.Failed(false); break; @@ -388,7 +400,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 } prep_frame_view_.reset(); print_pages_params_.reset(); -@@ -1727,7 +1718,6 @@ bool PrintRenderFrameHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, +@@ -1782,7 +1771,6 @@ bool PrintRenderFrameHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame, return true; } @@ -396,7 +408,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 bool PrintRenderFrameHelper::SetOptionsFromPdfDocument( PrintHostMsg_SetOptionsFromDocument_Params* options) { blink::WebLocalFrame* source_frame = print_preview_context_.source_frame(); -@@ -1821,7 +1811,6 @@ bool PrintRenderFrameHelper::UpdatePrintSettings( +@@ -1876,7 +1864,6 @@ bool PrintRenderFrameHelper::UpdatePrintSettings( print_preview_context_.set_error(PREVIEW_ERROR_INVALID_PRINTER_SETTINGS); return false; } @@ -404,7 +416,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 #if BUILDFLAG(ENABLE_BASIC_PRINTING) void PrintRenderFrameHelper::GetPrintSettingsFromUser( -@@ -1977,7 +1966,6 @@ bool PrintRenderFrameHelper::CopyMetafileDataToReadOnlySharedMem( +@@ -2034,7 +2021,6 @@ bool PrintRenderFrameHelper::CopyMetafileDataToReadOnlySharedMem( return true; } @@ -412,7 +424,7 @@ index 86c3b7a291e3..7a645cea6ebe 100644 void PrintRenderFrameHelper::ShowScriptedPrintPreview() { if (is_scripted_preview_delayed_) { is_scripted_preview_delayed_ = false; -@@ -2112,7 +2100,6 @@ bool PrintRenderFrameHelper::PreviewPageRendered(int page_number, +@@ -2157,7 +2143,6 @@ bool PrintRenderFrameHelper::PreviewPageRendered( Send(new PrintHostMsg_DidPreviewPage(routing_id(), preview_page_params)); return true; } @@ -421,10 +433,10 @@ index 86c3b7a291e3..7a645cea6ebe 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 b087b9efe6ca..338710326b17 100644 +index 64a6dd6a1912..8c87d7565eca 100644 --- components/printing/renderer/print_render_frame_helper.h +++ components/printing/renderer/print_render_frame_helper.h -@@ -147,10 +147,8 @@ class PrintRenderFrameHelper +@@ -145,10 +145,8 @@ class PrintRenderFrameHelper OK, FAIL_PRINT_INIT, FAIL_PRINT, @@ -434,7 +446,7 @@ index b087b9efe6ca..338710326b17 100644 -#endif }; - enum PrintPreviewErrorBuckets { + // These values are persisted to logs. Entries should not be renumbered and @@ -186,9 +184,9 @@ class PrintRenderFrameHelper void OnPrintPages(); void OnPrintForSystemDialog(); @@ -445,8 +457,8 @@ index b087b9efe6ca..338710326b17 100644 +#if BUILDFLAG(ENABLE_PRINT_PREVIEW) void OnClosePrintPreviewDialog(); #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) - void OnPrintingDone(bool success); -@@ -203,7 +201,6 @@ class PrintRenderFrameHelper + void OnPrintFrameContent(const PrintMsg_PrintFrame_Params& params); +@@ -204,7 +202,6 @@ class PrintRenderFrameHelper // Update |ignore_css_margins_| based on settings. void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings); @@ -454,7 +466,7 @@ index b087b9efe6ca..338710326b17 100644 // Prepare frame for creating preview document. void PrepareFrameForPreviewDocument(); -@@ -220,7 +217,6 @@ class PrintRenderFrameHelper +@@ -221,7 +218,6 @@ class PrintRenderFrameHelper // Finalize the print ready preview document. bool FinalizePrintReadyDocument(); @@ -462,7 +474,7 @@ index b087b9efe6ca..338710326b17 100644 // Enable/Disable printing. void OnSetPrintingEnabled(bool enabled); -@@ -250,7 +246,6 @@ class PrintRenderFrameHelper +@@ -251,7 +247,6 @@ class PrintRenderFrameHelper const blink::WebNode& node, int* number_of_pages); @@ -470,7 +482,7 @@ index b087b9efe6ca..338710326b17 100644 // Set options for print preset from source PDF document. bool SetOptionsFromPdfDocument( PrintHostMsg_SetOptionsFromDocument_Params* options); -@@ -261,7 +256,6 @@ class PrintRenderFrameHelper +@@ -262,7 +257,6 @@ class PrintRenderFrameHelper bool UpdatePrintSettings(blink::WebLocalFrame* frame, const blink::WebNode& node, const base::DictionaryValue& passed_job_settings); @@ -478,7 +490,7 @@ index b087b9efe6ca..338710326b17 100644 #if BUILDFLAG(ENABLE_BASIC_PRINTING) // Get final print settings from the user. -@@ -347,7 +341,6 @@ class PrintRenderFrameHelper +@@ -348,7 +342,6 @@ class PrintRenderFrameHelper bool IsScriptInitiatedPrintAllowed(blink::WebLocalFrame* frame, bool user_initiated); @@ -486,15 +498,15 @@ index b087b9efe6ca..338710326b17 100644 // Shows scripted print preview when options from plugin are available. void ShowScriptedPrintPreview(); -@@ -365,7 +358,6 @@ class PrintRenderFrameHelper - // |metafile| is the rendered page. Otherwise |metafile| is NULL. +@@ -367,7 +360,6 @@ class PrintRenderFrameHelper // Returns true if print preview should continue, false on failure. - bool PreviewPageRendered(int page_number, PdfMetafileSkia* metafile); + bool PreviewPageRendered(int page_number, + std::unique_ptr metafile); -#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings); -@@ -523,6 +515,7 @@ class PrintRenderFrameHelper +@@ -521,6 +513,7 @@ class PrintRenderFrameHelper ScriptingThrottler scripting_throttler_; bool print_node_in_progress_; @@ -502,23 +514,16 @@ index b087b9efe6ca..338710326b17 100644 PrintPreviewContext print_preview_context_; 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 8cc4806de501..ba3d0dc6e621 100644 ---- components/printing/renderer/print_render_frame_helper_mac.mm -+++ components/printing/renderer/print_render_frame_helper_mac.mm -@@ -18,7 +18,6 @@ +diff --git components/pwg_encoder/BUILD.gn components/pwg_encoder/BUILD.gn +index 452c53bff69f..abb4dc0e6219 100644 +--- components/pwg_encoder/BUILD.gn ++++ components/pwg_encoder/BUILD.gn +@@ -4,8 +4,6 @@ - namespace printing { + import("//printing/features/features.gni") --#if BUILDFLAG(ENABLE_PRINT_PREVIEW) - bool PrintRenderFrameHelper::RenderPreviewPage( - int page_number, - const PrintMsg_Print_Params& print_params) { -@@ -56,7 +55,6 @@ bool PrintRenderFrameHelper::RenderPreviewPage( - } - return PreviewPageRendered(page_number, draft_metafile.get()); - } --#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) - - void PrintRenderFrameHelper::PrintPageInternal( - const PrintMsg_Print_Params& params, +-assert(enable_print_preview) +- + static_library("pwg_encoder") { + sources = [ + "bitmap_image.cc", diff --git a/patch/patches/printing_context_2196.patch b/patch/patches/printing_context_2196.patch index 3a08d9ffa..fe146006f 100644 --- a/patch/patches/printing_context_2196.patch +++ b/patch/patches/printing_context_2196.patch @@ -1,8 +1,8 @@ diff --git chrome/browser/printing/print_job_worker.cc chrome/browser/printing/print_job_worker.cc -index 4f093cb61d69..60bb7a4f40ea 100644 +index ba99093fc98e..5e1da4621361 100644 --- chrome/browser/printing/print_job_worker.cc +++ chrome/browser/printing/print_job_worker.cc -@@ -140,6 +140,7 @@ PrintJobWorker::PrintJobWorker(int render_process_id, +@@ -142,6 +142,7 @@ PrintJobWorker::PrintJobWorker(int render_process_id, weak_factory_(this) { // The object is created in the IO thread. DCHECK(owner_->RunsTasksInCurrentSequence()); @@ -11,10 +11,10 @@ index 4f093cb61d69..60bb7a4f40ea 100644 PrintJobWorker::~PrintJobWorker() { diff --git printing/printing_context.h printing/printing_context.h -index 96934fb0d0c8..39d0019a9826 100644 +index 885937908414..03f0f0837f80 100644 --- printing/printing_context.h +++ printing/printing_context.h -@@ -127,6 +127,13 @@ class PRINTING_EXPORT PrintingContext { +@@ -133,6 +133,13 @@ class PRINTING_EXPORT PrintingContext { int job_id() const { return job_id_; } @@ -28,7 +28,7 @@ index 96934fb0d0c8..39d0019a9826 100644 protected: explicit PrintingContext(Delegate* delegate); -@@ -151,6 +158,10 @@ class PRINTING_EXPORT PrintingContext { +@@ -157,6 +164,10 @@ class PRINTING_EXPORT PrintingContext { // The job id for the current job. The value is 0 if no jobs are active. int job_id_; diff --git a/patch/patches/rwh_background_color_1984.patch b/patch/patches/rwh_background_color_1984.patch index 49528f28c..567894e23 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 5bebf776d70d..7e7eba1be689 100644 +index 087bc630062a..bd6ae8b47a1b 100644 --- content/browser/renderer_host/render_widget_host_view_aura.cc +++ content/browser/renderer_host/render_widget_host_view_aura.cc -@@ -434,13 +434,6 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura( +@@ -433,13 +433,6 @@ RenderWidgetHostViewAura::RenderWidgetHostViewAura( selection_controller_client_.reset( new TouchSelectionControllerClientAura(this)); CreateSelectionController(); @@ -16,7 +16,7 @@ index 5bebf776d70d..7e7eba1be689 100644 } //////////////////////////////////////////////////////////////////////////////// -@@ -780,8 +773,10 @@ void RenderWidgetHostViewAura::UpdateBackgroundColorFromRenderer( +@@ -789,8 +782,10 @@ void RenderWidgetHostViewAura::UpdateBackgroundColorFromRenderer( background_color_ = color; bool opaque = SkColorGetA(color) == SK_AlphaOPAQUE; @@ -29,9 +29,9 @@ index 5bebf776d70d..7e7eba1be689 100644 } bool RenderWidgetHostViewAura::IsMouseLocked() { -@@ -1937,6 +1932,15 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) { - window_->Init(ui::LAYER_SOLID_COLOR); - window_->layer()->SetColor(background_color_); +@@ -1922,6 +1917,15 @@ void RenderWidgetHostViewAura::CreateAuraWindow(aura::client::WindowType type) { + if (frame_sink_id_.is_valid()) + window_->SetEmbedFrameSinkId(frame_sink_id_); + // Do this after |window_| is created to avoid crashes on Win10. + // See https://crbug.com/761389. @@ -42,6 +42,6 @@ index 5bebf776d70d..7e7eba1be689 100644 + ignore_result(rvh->GetWebkitPreferences()); + } + - if (!IsUsingMus()) + if (!features::IsMusEnabled()) return; diff --git a/patch/patches/service_factory_1680.patch b/patch/patches/service_factory_1680.patch index 57b5e9fcd..2dffca4fe 100644 --- a/patch/patches/service_factory_1680.patch +++ b/patch/patches/service_factory_1680.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/spellchecker/spellcheck_factory.cc chrome/browser/spellchecker/spellcheck_factory.cc -index f02ff11f8500..640ada6c2ce1 100644 +index 20054d12bc55..106c18216e57 100644 --- chrome/browser/spellchecker/spellcheck_factory.cc +++ chrome/browser/spellchecker/spellcheck_factory.cc @@ -18,6 +18,13 @@ diff --git a/patch/patches/service_manager_654986.patch b/patch/patches/service_manager_654986.patch index 7a4c31d5b..6407bf452 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 08ea94a11772..873726c6ea19 100644 +index ed36168629af..20be6bed9f79 100644 --- services/service_manager/embedder/main.cc +++ services/service_manager/embedder/main.cc -@@ -304,13 +304,30 @@ int RunService(MainDelegate* delegate) { +@@ -301,13 +301,30 @@ int RunService(MainDelegate* delegate) { return exit_code; } @@ -34,7 +34,7 @@ index 08ea94a11772..873726c6ea19 100644 MainDelegate* delegate = params.delegate; DCHECK(delegate); -@@ -378,30 +395,14 @@ int Main(const MainParams& params) { +@@ -375,30 +392,14 @@ int Main(const MainParams& params) { MainDelegate::InitializeParams init_params; #if defined(OS_MACOSX) @@ -69,7 +69,7 @@ index 08ea94a11772..873726c6ea19 100644 mojo_config.max_message_num_bytes = kMaximumMojoMessageSize; delegate->OverrideMojoConfiguration(&mojo_config); mojo::edk::Init(mojo_config); -@@ -436,6 +437,16 @@ int Main(const MainParams& params) { +@@ -433,6 +434,16 @@ int Main(const MainParams& params) { trace_config, base::trace_event::TraceLog::RECORDING_MODE); } @@ -86,7 +86,7 @@ index 08ea94a11772..873726c6ea19 100644 switch (process_type) { case ProcessType::kDefault: NOTREACHED(); -@@ -457,6 +468,8 @@ int Main(const MainParams& params) { +@@ -454,6 +465,8 @@ int Main(const MainParams& params) { break; } @@ -95,7 +95,7 @@ index 08ea94a11772..873726c6ea19 100644 if (tracker) { if (exit_code == 0) { tracker->SetProcessPhaseIfEnabled( -@@ -468,13 +481,38 @@ int Main(const MainParams& params) { +@@ -465,13 +478,38 @@ int Main(const MainParams& params) { } } diff --git a/patch/patches/storage_partition_1973.patch b/patch/patches/storage_partition_1973.patch index b7456b910..cbfe193dc 100644 --- a/patch/patches/storage_partition_1973.patch +++ b/patch/patches/storage_partition_1973.patch @@ -1,8 +1,8 @@ diff --git content/browser/appcache/appcache_internals_ui.cc content/browser/appcache/appcache_internals_ui.cc -index 71bf90c54ae5..d3308da307d7 100644 +index b5f06abaeb8a..dd0fac00e45e 100644 --- content/browser/appcache/appcache_internals_ui.cc +++ content/browser/appcache/appcache_internals_ui.cc -@@ -372,8 +372,8 @@ void AppCacheInternalsUI::CreateProxyForPartition( +@@ -371,8 +371,8 @@ void AppCacheInternalsUI::CreateProxyForPartition( StoragePartition* storage_partition) { scoped_refptr proxy = new Proxy(weak_ptr_factory_.GetWeakPtr(), storage_partition->GetPath()); @@ -28,10 +28,10 @@ index be53f5115d3d..92f09f04f3a1 100644 origin, std::move(request))); } diff --git content/browser/blob_storage/chrome_blob_storage_context.cc content/browser/blob_storage/chrome_blob_storage_context.cc -index 0478c2f4dccf..4faa6c1d4b46 100644 +index 05e3cc192262..3775eab5323b 100644 --- content/browser/blob_storage/chrome_blob_storage_context.cc +++ content/browser/blob_storage/chrome_blob_storage_context.cc -@@ -76,6 +76,11 @@ class BlobHandleImpl : public BlobHandle { +@@ -85,6 +85,11 @@ class BlobHandleImpl : public BlobHandle { ChromeBlobStorageContext::ChromeBlobStorageContext() {} @@ -73,10 +73,10 @@ index e5c7291dcc8f..0eec8a11db35 100644 partition->GetBluetoothAllowedDevicesMap(); return allowed_devices_map->GetOrCreateAllowedDevices(GetOrigin()); diff --git content/browser/browser_context.cc content/browser/browser_context.cc -index 125078b9cb44..b24609a807ba 100644 +index 0cf6cde723e6..ae04e57bfcbb 100644 --- content/browser/browser_context.cc +++ content/browser/browser_context.cc -@@ -127,11 +127,18 @@ StoragePartition* GetStoragePartitionFromConfig( +@@ -132,11 +132,18 @@ StoragePartition* GetStoragePartitionFromConfig( StoragePartitionImplMap* partition_map = GetStoragePartitionMap(browser_context); @@ -98,7 +98,7 @@ index 125078b9cb44..b24609a807ba 100644 } void SaveSessionStateOnIOThread( -@@ -553,6 +560,11 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor( +@@ -579,6 +586,11 @@ ServiceManagerConnection* BrowserContext::GetServiceManagerConnectionFor( BrowserContext::BrowserContext() : media_device_id_salt_(CreateRandomMediaDeviceIDSalt()) {} @@ -111,24 +111,46 @@ index 125078b9cb44..b24609a807ba 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 64dff1f030bb..244f62ec40dc 100644 +index 5501f6ad645d..7ecacac8c92d 100644 --- content/browser/devtools/protocol/service_worker_handler.cc +++ content/browser/devtools/protocol/service_worker_handler.cc -@@ -337,8 +337,7 @@ Response ServiceWorkerHandler::DispatchSyncEvent( - if (!base::StringToInt64(registration_id, &id)) - return CreateInvalidVersionIdErrorResponse(); +@@ -170,8 +170,7 @@ void ServiceWorkerHandler::SetRenderer(int process_host_id, + return; + } -- StoragePartitionImpl* partition = -- static_cast(process_->GetStoragePartition()); -+ StoragePartition* partition = process_->GetStoragePartition(); - BackgroundSyncContext* sync_context = partition->GetBackgroundSyncContext(); +- storage_partition_ = +- static_cast(process_host->GetStoragePartition()); ++ storage_partition_ = process_host->GetStoragePartition(); + DCHECK(storage_partition_); + context_ = static_cast( + storage_partition_->GetServiceWorkerContext()); +diff --git content/browser/devtools/protocol/service_worker_handler.h content/browser/devtools/protocol/service_worker_handler.h +index ec9ab86d0ca6..0fe5219f1e84 100644 +--- content/browser/devtools/protocol/service_worker_handler.h ++++ content/browser/devtools/protocol/service_worker_handler.h +@@ -24,7 +24,7 @@ class BrowserContext; + class RenderFrameHostImpl; + class ServiceWorkerContextWatcher; + class ServiceWorkerContextWrapper; +-class StoragePartitionImpl; ++class StoragePartition; + + namespace protocol { + +@@ -74,7 +74,7 @@ class ServiceWorkerHandler : public DevToolsDomainHandler, + bool enabled_; + scoped_refptr context_watcher_; + BrowserContext* browser_context_; +- StoragePartitionImpl* storage_partition_; ++ StoragePartition* storage_partition_; + + base::WeakPtrFactory weak_factory_; - BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, diff --git content/browser/download/download_manager_impl.cc content/browser/download/download_manager_impl.cc -index 11eb1d3b732a..52962a868999 100644 +index 02470e87915b..38caa4e8a936 100644 --- content/browser/download/download_manager_impl.cc +++ content/browser/download/download_manager_impl.cc -@@ -73,9 +73,9 @@ +@@ -78,9 +78,9 @@ namespace content { namespace { @@ -141,7 +163,7 @@ index 11eb1d3b732a..52962a868999 100644 DCHECK_CURRENTLY_ON(BrowserThread::UI); SiteInstance* site_instance = nullptr; -@@ -85,8 +85,7 @@ StoragePartitionImpl* GetStoragePartition(BrowserContext* context, +@@ -90,8 +90,7 @@ StoragePartitionImpl* GetStoragePartition(BrowserContext* context, if (render_frame_host_) site_instance = render_frame_host_->GetSiteInstance(); } @@ -151,8 +173,8 @@ index 11eb1d3b732a..52962a868999 100644 } bool CanRequestURLFromRenderer(int render_process_id, GURL url) { -@@ -1069,7 +1068,7 @@ void DownloadManagerImpl::BeginDownloadInternal( - if (base::FeatureList::IsEnabled(features::kNetworkService)) { +@@ -1161,7 +1160,7 @@ void DownloadManagerImpl::BeginDownloadInternal( + if (base::FeatureList::IsEnabled(network::features::kNetworkService)) { std::unique_ptr request = CreateResourceRequest(params.get()); - StoragePartitionImpl* storage_partition = @@ -160,22 +182,36 @@ index 11eb1d3b732a..52962a868999 100644 GetStoragePartition(browser_context_, params->render_process_host_id(), params->render_frame_host_routing_id()); -@@ -1090,7 +1089,8 @@ void DownloadManagerImpl::BeginDownloadInternal( +@@ -1182,7 +1181,8 @@ void DownloadManagerImpl::BeginDownloadInternal( BrowserThread::IO, FROM_HERE, - base::BindOnce( - &BeginResourceDownload, std::move(params), std::move(request), -- storage_partition->url_loader_factory_getter(), -+ base::WrapRefCounted( -+ storage_partition->url_loader_factory_getter()), - base::WrapRefCounted(storage_partition->GetFileSystemContext()), id, - weak_factory_.GetWeakPtr(), site_url, tab_url, tab_referrer_url), + base::BindOnce(&BeginResourceDownload, std::move(params), + std::move(request), std::move(blob_data_handle), +- storage_partition->url_loader_factory_getter(), id, ++ base::WrapRefCounted( ++ storage_partition->url_loader_factory_getter()), id, + weak_factory_.GetWeakPtr(), site_url, tab_url, + tab_referrer_url), base::BindOnce(&DownloadManagerImpl::AddUrlDownloadHandler, +diff --git content/browser/download/parallel_download_job.cc content/browser/download/parallel_download_job.cc +index de25ae93f74d..73f490f783c9 100644 +--- content/browser/download/parallel_download_job.cc ++++ content/browser/download/parallel_download_job.cc +@@ -304,8 +304,7 @@ void ParallelDownloadJob::CreateRequest(int64_t offset, int64_t length) { + + // Send the request. + worker->SendRequest(std::move(download_params), +- static_cast(storage_partition) +- ->url_loader_factory_getter()); ++ storage_partition->url_loader_factory_getter()); + DCHECK(workers_.find(offset) == workers_.end()); + workers_[offset] = std::move(worker); + } diff --git content/browser/loader/navigation_url_loader_network_service.cc content/browser/loader/navigation_url_loader_network_service.cc -index d9297fa8365e..38a3fb629a7a 100644 +index 8e4c4a42b0a0..f78f3d3817ae 100644 --- content/browser/loader/navigation_url_loader_network_service.cc +++ content/browser/loader/navigation_url_loader_network_service.cc -@@ -868,11 +868,12 @@ NavigationURLLoaderNetworkService::NavigationURLLoaderNetworkService( - .PassInterface(); +@@ -1020,11 +1020,12 @@ NavigationURLLoaderNetworkService::NavigationURLLoaderNetworkService( + } } - auto* partition = static_cast(storage_partition); @@ -187,13 +223,29 @@ index d9297fa8365e..38a3fb629a7a 100644 + base::WrapRefCounted(partition->url_loader_factory_getter()), + request_info->common_params.url, request_info->begin_params->initiator_origin, - request_info->begin_params->suggested_filename, - weak_factory_.GetWeakPtr()); + request_info->common_params.suggested_filename, + std::move(proxied_factory_request), std::move(proxied_factory_info), +diff --git content/browser/payments/payment_app_installer.cc content/browser/payments/payment_app_installer.cc +index d01fb931d358..962d10d44141 100644 +--- content/browser/payments/payment_app_installer.cc ++++ content/browser/payments/payment_app_installer.cc +@@ -125,9 +125,9 @@ class SelfDeleteInstaller + void SetPaymentAppIntoDatabase() { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + +- StoragePartitionImpl* partition = static_cast( ++ StoragePartition* partition = + BrowserContext::GetDefaultStoragePartition( +- web_contents()->GetBrowserContext())); ++ web_contents()->GetBrowserContext()); + scoped_refptr payment_app_context = + partition->GetPaymentAppContext(); + diff --git content/browser/payments/payment_app_provider_impl.cc content/browser/payments/payment_app_provider_impl.cc -index b9d2670514c0..004939aa055a 100644 +index d899d32fd383..7e62c70fc70a 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); @@ -208,7 +260,7 @@ index b9d2670514c0..004939aa055a 100644 BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, -@@ -357,8 +358,8 @@ void PaymentAppProviderImpl::GetAllPaymentApps( +@@ -373,8 +374,8 @@ void PaymentAppProviderImpl::GetAllPaymentApps( GetAllPaymentAppsCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -220,10 +272,10 @@ index b9d2670514c0..004939aa055a 100644 partition->GetPaymentAppContext(); diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc -index 22c72f3ac929..c12815670521 100644 +index 8c34d8e7af5e..55c0060a6c81 100644 --- content/browser/renderer_host/render_process_host_impl.cc +++ content/browser/renderer_host/render_process_host_impl.cc -@@ -497,9 +497,8 @@ class SpareRenderProcessHostManager : public RenderProcessHostObserver { +@@ -500,9 +500,8 @@ class SpareRenderProcessHostManager : public RenderProcessHostObserver { SpareRenderProcessHostManager() {} void WarmupSpareRenderProcessHost(BrowserContext* browser_context) { @@ -235,7 +287,7 @@ index 22c72f3ac929..c12815670521 100644 if (spare_render_process_host_ && matching_browser_context_ == browser_context && -@@ -638,11 +637,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) { @@ -251,7 +303,7 @@ index 22c72f3ac929..c12815670521 100644 // Is this the default storage partition? If it isn't, then just give it its // own non-shared process. -@@ -1237,7 +1235,7 @@ void RenderProcessHost::SetMaxRendererProcessCount(size_t count) { +@@ -1240,7 +1238,7 @@ void RenderProcessHost::SetMaxRendererProcessCount(size_t count) { // static RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost( BrowserContext* browser_context, @@ -260,7 +312,7 @@ index 22c72f3ac929..c12815670521 100644 SiteInstance* site_instance, bool is_for_guests_only) { if (g_render_process_host_factory_) { -@@ -1246,8 +1244,8 @@ RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost( +@@ -1249,8 +1247,8 @@ RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost( } if (!storage_partition_impl) { @@ -271,7 +323,7 @@ index 22c72f3ac929..c12815670521 100644 } // If we've made a StoragePartition for guests (e.g., for the tag), // stash the Site URL on it. This way, when we start a service worker inside -@@ -1269,7 +1267,7 @@ RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost( +@@ -1272,7 +1270,7 @@ RenderProcessHost* RenderProcessHostImpl::CreateRenderProcessHost( // static RenderProcessHost* RenderProcessHostImpl::CreateOrUseSpareRenderProcessHost( BrowserContext* browser_context, @@ -280,7 +332,7 @@ index 22c72f3ac929..c12815670521 100644 SiteInstance* site_instance, bool is_for_guests_only) { RenderProcessHost* render_process_host = -@@ -1289,7 +1287,7 @@ RenderProcessHost* RenderProcessHostImpl::CreateOrUseSpareRenderProcessHost( +@@ -1292,7 +1290,7 @@ RenderProcessHost* RenderProcessHostImpl::CreateOrUseSpareRenderProcessHost( RenderProcessHostImpl::RenderProcessHostImpl( BrowserContext* browser_context, @@ -289,7 +341,7 @@ index 22c72f3ac929..c12815670521 100644 bool is_for_guests_only) : fast_shutdown_started_(false), deleting_soon_(false), -@@ -1322,7 +1320,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( +@@ -1325,7 +1323,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( indexed_db_factory_(new IndexedDBDispatcherHost( id_, storage_partition_impl_->GetURLRequestContext(), @@ -299,7 +351,7 @@ index 22c72f3ac929..c12815670521 100644 ChromeBlobStorageContext::GetFor(browser_context_))), channel_connected_(false), sent_render_process_ready_(false), -@@ -1356,7 +1355,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( +@@ -1359,7 +1358,8 @@ RenderProcessHostImpl::RenderProcessHostImpl( } push_messaging_manager_.reset(new PushMessagingManager( @@ -309,7 +361,7 @@ index 22c72f3ac929..c12815670521 100644 AddObserver(indexed_db_factory_.get()); -@@ -1671,6 +1671,20 @@ void RenderProcessHostImpl::ResetChannelProxy() { +@@ -1680,6 +1680,20 @@ void RenderProcessHostImpl::ResetChannelProxy() { void RenderProcessHostImpl::CreateMessageFilters() { DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -330,7 +382,7 @@ index 22c72f3ac929..c12815670521 100644 AddFilter(new ResourceSchedulerFilter(GetID())); MediaInternals* media_internals = MediaInternals::GetInstance(); // Add BrowserPluginMessageFilter to ensure it gets the first stab at messages -@@ -1685,8 +1699,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1694,8 +1708,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { new RenderMessageFilter( GetID(), GetBrowserContext(), request_context.get(), widget_helper_.get(), media_internals, @@ -341,7 +393,7 @@ index 22c72f3ac929..c12815670521 100644 AddFilter(render_message_filter.get()); render_frame_message_filter_ = new RenderFrameMessageFilter( -@@ -1715,10 +1729,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1724,10 +1738,10 @@ void RenderProcessHostImpl::CreateMessageFilters() { ChromeBlobStorageContext::GetFor(browser_context); resource_message_filter_ = new ResourceMessageFilter( @@ -349,12 +401,12 @@ index 22c72f3ac929..c12815670521 100644 + GetID(), app_cache_service, blob_storage_context.get(), storage_partition_impl_->GetFileSystemContext(), -- storage_partition_impl_->GetServiceWorkerContext(), get_contexts_callback, -+ service_worker_context, get_contexts_callback, +- storage_partition_impl_->GetServiceWorkerContext(), ++ service_worker_context, + storage_partition_impl_->GetPrefetchURLLoaderService(), + get_contexts_callback, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); - - AddFilter(resource_message_filter_.get()); -@@ -1743,8 +1757,7 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1754,8 +1768,7 @@ void RenderProcessHostImpl::CreateMessageFilters() { } AddFilter( new MidiHost(GetID(), BrowserMainLoop::GetInstance()->midi_service())); @@ -364,7 +416,7 @@ index 22c72f3ac929..c12815670521 100644 #if BUILDFLAG(ENABLE_WEBRTC) peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID()); -@@ -1767,13 +1780,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1778,13 +1791,12 @@ void RenderProcessHostImpl::CreateMessageFilters() { scoped_refptr cache_storage_filter = new CacheStorageDispatcherHost(); @@ -380,7 +432,7 @@ index 22c72f3ac929..c12815670521 100644 AddFilter(service_worker_filter.get()); #if BUILDFLAG(ENABLE_WEBRTC) -@@ -1785,11 +1797,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { +@@ -1796,11 +1808,8 @@ void RenderProcessHostImpl::CreateMessageFilters() { AddFilter(new TraceMessageFilter(GetID())); AddFilter(new ResolveProxyMsgHelper(request_context.get())); @@ -393,7 +445,7 @@ index 22c72f3ac929..c12815670521 100644 resource_context, service_worker_context, browser_context); AddFilter(notification_message_filter_.get()); -@@ -1931,7 +1940,8 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { +@@ -1934,7 +1943,8 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { registry->AddInterface(base::BindRepeating( &AppCacheDispatcherHost::Create, @@ -404,7 +456,7 @@ index 22c72f3ac929..c12815670521 100644 AddUIThreadInterface(registry.get(), base::Bind(&FieldTrialRecorder::Create)); diff --git content/browser/renderer_host/render_process_host_impl.h content/browser/renderer_host/render_process_host_impl.h -index f81189990b1f..39afa6c9ecfd 100644 +index 51c2ff46b9ad..5e830df5d433 100644 --- content/browser/renderer_host/render_process_host_impl.h +++ content/browser/renderer_host/render_process_host_impl.h @@ -83,7 +83,6 @@ class ResourceMessageFilter; @@ -414,8 +466,8 @@ index f81189990b1f..39afa6c9ecfd 100644 -class StoragePartitionImpl; #if BUILDFLAG(ENABLE_WEBRTC) - class MediaStreamDispatcherHost; -@@ -127,7 +126,7 @@ class CONTENT_EXPORT RenderProcessHostImpl + class P2PSocketDispatcherHost; +@@ -126,7 +125,7 @@ class CONTENT_EXPORT RenderProcessHostImpl // legal). static RenderProcessHost* CreateOrUseSpareRenderProcessHost( BrowserContext* browser_context, @@ -424,7 +476,7 @@ index f81189990b1f..39afa6c9ecfd 100644 SiteInstance* site_instance, bool is_for_guests_only); -@@ -139,7 +138,7 @@ class CONTENT_EXPORT RenderProcessHostImpl +@@ -138,7 +137,7 @@ class CONTENT_EXPORT RenderProcessHostImpl // null. static RenderProcessHost* CreateRenderProcessHost( BrowserContext* browser_context, @@ -433,7 +485,7 @@ index f81189990b1f..39afa6c9ecfd 100644 SiteInstance* site_instance, bool is_for_guests_only); -@@ -420,7 +419,7 @@ class CONTENT_EXPORT RenderProcessHostImpl +@@ -419,7 +418,7 @@ class CONTENT_EXPORT RenderProcessHostImpl // Use CreateRenderProcessHost() instead of calling this constructor // directly. RenderProcessHostImpl(BrowserContext* browser_context, @@ -442,7 +494,7 @@ index f81189990b1f..39afa6c9ecfd 100644 bool is_for_guests_only); // Initializes a new IPC::ChannelProxy in |channel_|, which will be connected -@@ -656,10 +655,10 @@ class CONTENT_EXPORT RenderProcessHostImpl +@@ -655,10 +654,10 @@ class CONTENT_EXPORT RenderProcessHostImpl // called. int instance_id_ = 1; @@ -456,10 +508,10 @@ index f81189990b1f..39afa6c9ecfd 100644 // The observers watching our lifetime. base::ObserverList observers_; diff --git content/browser/renderer_interface_binders.cc content/browser/renderer_interface_binders.cc -index 01ba96322f69..6dde251b3d1b 100644 +index 9b1c71bdb19c..891969b30d79 100644 --- content/browser/renderer_interface_binders.cc +++ content/browser/renderer_interface_binders.cc -@@ -133,7 +133,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { +@@ -134,7 +134,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { parameterized_binder_registry_.AddInterface( base::Bind([](payments::mojom::PaymentManagerRequest request, RenderProcessHost* host, const url::Origin& origin) { @@ -468,7 +520,7 @@ index 01ba96322f69..6dde251b3d1b 100644 ->GetPaymentAppContext() ->CreatePaymentManager(std::move(request)); })); -@@ -147,7 +147,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { +@@ -148,7 +148,7 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { parameterized_binder_registry_.AddInterface(base::BindRepeating( [](blink::mojom::LockManagerRequest request, RenderProcessHost* host, const url::Origin& origin) { @@ -477,7 +529,7 @@ index 01ba96322f69..6dde251b3d1b 100644 ->GetLockManager() ->CreateService(std::move(request), origin); })); -@@ -156,9 +156,10 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { +@@ -157,9 +157,10 @@ void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { parameterized_binder_registry_.AddInterface( base::Bind([](blink::mojom::NotificationServiceRequest request, RenderProcessHost* host, const url::Origin& origin) { @@ -492,28 +544,25 @@ index 01ba96322f69..6dde251b3d1b 100644 parameterized_binder_registry_.AddInterface( base::BindRepeating(&BackgroundFetchServiceImpl::Create)); diff --git content/browser/shared_worker/shared_worker_connector_impl.cc content/browser/shared_worker/shared_worker_connector_impl.cc -index 1e95910e7168..45adb88b1e96 100644 +index 11b579bdeca4..8dcbe5ff390e 100644 --- content/browser/shared_worker/shared_worker_connector_impl.cc +++ content/browser/shared_worker/shared_worker_connector_impl.cc -@@ -34,10 +34,9 @@ void SharedWorkerConnectorImpl::Connect( - mojom::SharedWorkerClientPtr client, - blink::mojom::SharedWorkerCreationContextType creation_context_type, - mojo::ScopedMessagePipeHandle message_port) { -- SharedWorkerServiceImpl* service = -- static_cast( -- RenderProcessHost::FromID(process_id_)->GetStoragePartition()) +@@ -41,8 +41,8 @@ void SharedWorkerConnectorImpl::Connect( + return; + } + SharedWorkerServiceImpl* service = +- static_cast(host->GetStoragePartition()) - ->GetSharedWorkerService(); -+ SharedWorkerServiceImpl* service = static_cast( -+ RenderProcessHost::FromID(process_id_)->GetStoragePartition() ++ static_cast(host->GetStoragePartition() + ->GetSharedWorkerService()); service->ConnectToWorker(process_id_, frame_id_, std::move(info), std::move(client), creation_context_type, blink::MessagePortChannel(std::move(message_port))); diff --git content/browser/storage_partition_impl.h content/browser/storage_partition_impl.h -index 4fb38a200f04..182f14ead806 100644 +index 580d2e0d78d9..0309f5c1df48 100644 --- content/browser/storage_partition_impl.h +++ content/browser/storage_partition_impl.h -@@ -87,7 +87,7 @@ class CONTENT_EXPORT StoragePartitionImpl +@@ -99,7 +99,7 @@ class CONTENT_EXPORT StoragePartitionImpl storage::FileSystemContext* GetFileSystemContext() override; storage::DatabaseTracker* GetDatabaseTracker() override; DOMStorageContextWrapper* GetDOMStorageContext() override; @@ -522,9 +571,9 @@ index 4fb38a200f04..182f14ead806 100644 IndexedDBContextImpl* GetIndexedDBContext() override; CacheStorageContextImpl* GetCacheStorageContext() override; ServiceWorkerContextWrapper* GetServiceWorkerContext() override; -@@ -124,13 +124,13 @@ class CONTENT_EXPORT StoragePartitionImpl - void ClearBluetoothAllowedDevicesMapForTesting() override; +@@ -137,14 +137,14 @@ class CONTENT_EXPORT StoragePartitionImpl void FlushNetworkInterfaceForTesting() override; + void WaitForDeletionTasksForTesting() override; - BackgroundFetchContext* GetBackgroundFetchContext(); - BackgroundSyncContext* GetBackgroundSyncContext(); @@ -533,6 +582,7 @@ index 4fb38a200f04..182f14ead806 100644 - BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap(); - BlobURLLoaderFactory* GetBlobURLLoaderFactory(); - BlobRegistryWrapper* GetBlobRegistry(); +- PrefetchURLLoaderService* GetPrefetchURLLoaderService(); + BackgroundFetchContext* GetBackgroundFetchContext() override; + BackgroundSyncContext* GetBackgroundSyncContext() override; + PaymentAppContextImpl* GetPaymentAppContext() override; @@ -540,12 +590,13 @@ index 4fb38a200f04..182f14ead806 100644 + BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override; + BlobURLLoaderFactory* GetBlobURLLoaderFactory() override; + BlobRegistryWrapper* GetBlobRegistry() override; ++ PrefetchURLLoaderService* GetPrefetchURLLoaderService() override; // mojom::StoragePartitionService interface. - void OpenLocalStorage( -@@ -141,18 +141,18 @@ class CONTENT_EXPORT StoragePartitionImpl - const url::Origin& origin, - mojo::InterfaceRequest request) override; + void OpenLocalStorage(const url::Origin& origin, +@@ -153,18 +153,18 @@ class CONTENT_EXPORT StoragePartitionImpl + const std::string& namespace_id, + mojom::SessionStorageNamespaceRequest request) override; - scoped_refptr url_loader_factory_getter() { - return url_loader_factory_getter_; @@ -566,7 +617,7 @@ index 4fb38a200f04..182f14ead806 100644 auto& bindings_for_testing() { return bindings_; } -@@ -163,10 +163,11 @@ class CONTENT_EXPORT StoragePartitionImpl +@@ -175,10 +175,11 @@ class CONTENT_EXPORT StoragePartitionImpl // one must use the "chrome-guest://blahblah" site URL to ensure that the // service worker stays in this StoragePartition. This is an empty GURL if // this StoragePartition is not for guests. @@ -609,7 +660,7 @@ 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 53845bd346ed..e2c023cd688e 100644 +index 32457c8510f9..27f3012f76f5 100644 --- content/browser/webui/web_ui_url_loader_factory.cc +++ content/browser/webui/web_ui_url_loader_factory.cc @@ -20,13 +20,13 @@ @@ -627,7 +678,7 @@ index 53845bd346ed..e2c023cd688e 100644 #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/common/url_constants.h" -@@ -302,9 +302,8 @@ class WebUIURLLoaderFactory : public network::mojom::URLLoaderFactory, +@@ -296,9 +296,8 @@ class WebUIURLLoaderFactory : public network::mojom::URLLoaderFactory, const std::string& scheme() const { return scheme_; } private: @@ -640,10 +691,10 @@ index 53845bd346ed..e2c023cd688e 100644 RenderFrameHost* render_frame_host_; diff --git content/public/browser/browser_context.h content/public/browser/browser_context.h -index f75be61ccdef..84f1063fb081 100644 +index 9edd7b1d9123..c61b034c68cc 100644 --- content/public/browser/browser_context.h +++ content/public/browser/browser_context.h -@@ -200,6 +200,8 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { +@@ -207,6 +207,8 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { BrowserContext(); @@ -652,7 +703,7 @@ index f75be61ccdef..84f1063fb081 100644 ~BrowserContext() override; // Shuts down the storage partitions associated to this browser context. -@@ -288,6 +290,14 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { +@@ -295,6 +297,14 @@ class CONTENT_EXPORT BrowserContext : public base::SupportsUserData { const base::FilePath& partition_path, bool in_memory) = 0; @@ -668,18 +719,18 @@ index f75be61ccdef..84f1063fb081 100644 std::map; diff --git content/public/browser/storage_partition.h content/public/browser/storage_partition.h -index 9bf0a872f380..73ede1ccdedf 100644 +index 55c298e02b57..b277e50ab372 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/shared_url_loader_factory.h" +#include "mojo/public/cpp/bindings/binding_set.h" #include "net/cookies/cookie_store.h" class GURL; -@@ -49,13 +50,22 @@ class DatabaseTracker; +@@ -49,13 +50,23 @@ class DatabaseTracker; namespace content { class AppCacheService; @@ -696,13 +747,14 @@ index 9bf0a872f380..73ede1ccdedf 100644 +class LockManager; +class PaymentAppContextImpl; class PlatformNotificationContext; ++class PrefetchURLLoaderService; class ServiceWorkerContext; class SharedWorkerService; +class URLLoaderFactoryGetter; #if !defined(OS_ANDROID) class HostZoomLevelContext; -@@ -63,6 +73,10 @@ class HostZoomMap; +@@ -63,6 +74,10 @@ class HostZoomMap; class ZoomLevelDelegate; #endif // !defined(OS_ANDROID) @@ -713,7 +765,7 @@ index 9bf0a872f380..73ede1ccdedf 100644 // Defines what persistent state a child process can access. // // The StoragePartition defines the view each child process has of the -@@ -88,6 +102,7 @@ class CONTENT_EXPORT StoragePartition { +@@ -90,6 +105,7 @@ class CONTENT_EXPORT StoragePartition { virtual storage::FileSystemContext* GetFileSystemContext() = 0; virtual storage::DatabaseTracker* GetDatabaseTracker() = 0; virtual DOMStorageContext* GetDOMStorageContext() = 0; @@ -721,9 +773,9 @@ index 9bf0a872f380..73ede1ccdedf 100644 virtual IndexedDBContext* GetIndexedDBContext() = 0; virtual ServiceWorkerContext* GetServiceWorkerContext() = 0; virtual SharedWorkerService* GetSharedWorkerService() = 0; -@@ -204,6 +219,25 @@ class CONTENT_EXPORT StoragePartition { - // use only. - virtual void FlushNetworkInterfaceForTesting() = 0; +@@ -209,6 +225,26 @@ class CONTENT_EXPORT StoragePartition { + // Wait until all deletions tasks are finished. For test use only. + virtual void WaitForDeletionTasksForTesting() = 0; + virtual BackgroundFetchContext* GetBackgroundFetchContext() = 0; + virtual BackgroundSyncContext* GetBackgroundSyncContext() = 0; @@ -732,6 +784,7 @@ index 9bf0a872f380..73ede1ccdedf 100644 + virtual BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() = 0; + virtual BlobURLLoaderFactory* GetBlobURLLoaderFactory() = 0; + virtual BlobRegistryWrapper* GetBlobRegistry() = 0; ++ virtual PrefetchURLLoaderService* GetPrefetchURLLoaderService() = 0; + + virtual URLLoaderFactoryGetter* url_loader_factory_getter() = 0; + virtual BrowserContext* browser_context() const = 0; @@ -748,10 +801,10 @@ index 9bf0a872f380..73ede1ccdedf 100644 virtual ~StoragePartition() {} }; diff --git storage/browser/database/database_tracker.cc storage/browser/database/database_tracker.cc -index e1e508e205be..10432c7d833e 100644 +index f6986c4babc4..1a467451e351 100644 --- storage/browser/database/database_tracker.cc +++ storage/browser/database/database_tracker.cc -@@ -491,7 +491,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 07090452e..e8139d355 100644 --- a/patch/patches/views_1749_2102.patch +++ b/patch/patches/views_1749_2102.patch @@ -1,5 +1,5 @@ diff --git ui/base/models/menu_model.h ui/base/models/menu_model.h -index 0755f2752f1d..0322b8c638e7 100644 +index 605dc1b17e43..24c385a53289 100644 --- ui/base/models/menu_model.h +++ ui/base/models/menu_model.h @@ -15,6 +15,7 @@ @@ -7,10 +7,10 @@ index 0755f2752f1d..0322b8c638e7 100644 class FontList; class Image; +class Point; + struct VectorIcon; } - namespace ui { -@@ -115,6 +116,27 @@ class UI_BASE_EXPORT MenuModel { +@@ -120,6 +121,27 @@ class UI_BASE_EXPORT MenuModel { // |event_flags| is a bit mask of ui::EventFlags. virtual void ActivatedAt(int index, int event_flags); @@ -39,10 +39,10 @@ index 0755f2752f1d..0322b8c638e7 100644 virtual void MenuWillShow() {} diff --git ui/gfx/render_text.cc ui/gfx/render_text.cc -index b5f58764ecb9..37359d823c57 100644 +index 3d706df56ee6..f10d816a3f05 100644 --- ui/gfx/render_text.cc +++ ui/gfx/render_text.cc -@@ -513,6 +513,14 @@ void RenderText::SetElideBehavior(ElideBehavior elide_behavior) { +@@ -518,6 +518,14 @@ void RenderText::SetElideBehavior(ElideBehavior elide_behavior) { } } @@ -78,10 +78,10 @@ index b5f58764ecb9..37359d823c57 100644 } diff --git ui/gfx/render_text.h ui/gfx/render_text.h -index 0b8b82a2bc80..f0eba4248c56 100644 +index 47fa4c605ce1..f5587fac6b5d 100644 --- ui/gfx/render_text.h +++ ui/gfx/render_text.h -@@ -293,6 +293,10 @@ class GFX_EXPORT RenderText { +@@ -295,6 +295,10 @@ class GFX_EXPORT RenderText { void SetElideBehavior(ElideBehavior elide_behavior); ElideBehavior elide_behavior() const { return elide_behavior_; } @@ -92,7 +92,7 @@ index 0b8b82a2bc80..f0eba4248c56 100644 const Rect& display_rect() const { return display_rect_; } void SetDisplayRect(const Rect& r); -@@ -850,6 +854,8 @@ class GFX_EXPORT RenderText { +@@ -858,6 +862,8 @@ class GFX_EXPORT RenderText { // Extra spacing placed between glyphs; used for obscured text styling. int glyph_spacing_ = 0; @@ -102,7 +102,7 @@ index 0b8b82a2bc80..f0eba4248c56 100644 }; diff --git ui/views/animation/ink_drop_host_view.h ui/views/animation/ink_drop_host_view.h -index 8ac475fa752c..ec58c2b28441 100644 +index 34ea050d06a8..7bdd050802a0 100644 --- ui/views/animation/ink_drop_host_view.h +++ ui/views/animation/ink_drop_host_view.h @@ -67,6 +67,8 @@ class VIEWS_EXPORT InkDropHostView : public View, public InkDropHost { @@ -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 6fc12bbc6f9b..a82c282a7c31 100644 +index 7cf98686b710..9c18255901bb 100644 --- ui/views/controls/button/label_button.cc +++ ui/views/controls/button/label_button.cc @@ -188,6 +188,7 @@ gfx::Size LabelButton::CalculatePreferredSize() const { @@ -126,7 +126,7 @@ index 6fc12bbc6f9b..a82c282a7c31 100644 if (style_ == STYLE_BUTTON) { // Some text appears wider when rendered normally than when rendered bold. -@@ -398,6 +399,12 @@ std::unique_ptr LabelButton::CreateInkDropHighlight() +@@ -406,6 +407,12 @@ std::unique_ptr LabelButton::CreateInkDropHighlight() gfx::RectF(image()->GetMirroredBounds()).CenterPoint()); } @@ -154,7 +154,7 @@ index b2323dae3d9e..4b9546ca1a61 100644 ImageView* image() const { return image_; } Label* label() const; diff --git ui/views/controls/button/menu_button.cc ui/views/controls/button/menu_button.cc -index 536fd0159e28..4c6402a29596 100644 +index b6996aab742c..ef7ac692a21d 100644 --- ui/views/controls/button/menu_button.cc +++ ui/views/controls/button/menu_button.cc @@ -178,7 +178,7 @@ bool MenuButton::IsTriggerableEventType(const ui::Event& event) { @@ -166,7 +166,7 @@ index 536fd0159e28..4c6402a29596 100644 kMenuMarkerPaddingRight, 0); } -@@ -311,7 +311,7 @@ gfx::Rect MenuButton::GetChildAreaBounds() { +@@ -310,7 +310,7 @@ gfx::Rect MenuButton::GetChildAreaBounds() { gfx::Size s = size(); if (show_menu_marker_) { @@ -175,7 +175,7 @@ index 536fd0159e28..4c6402a29596 100644 kMenuMarkerPaddingRight); } -@@ -408,4 +408,10 @@ int MenuButton::GetMaximumScreenXCoordinate() { +@@ -407,4 +407,10 @@ int MenuButton::GetMaximumScreenXCoordinate() { return monitor_bounds.right() - 1; } @@ -211,18 +211,10 @@ index 8fb11e1cf9cb..bd2951bd948b 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 5fb2a8667c81..f725a0209267 100644 +index 6b6d5f02b8ab..0dc4d1f0f389 100644 --- ui/views/controls/label.cc +++ ui/views/controls/label.cc -@@ -25,6 +25,7 @@ - #include "ui/gfx/color_utils.h" - #include "ui/gfx/geometry/insets.h" - #include "ui/gfx/text_elider.h" -+#include "ui/gfx/text_utils.h" - #include "ui/native_theme/native_theme.h" - #include "ui/strings/grit/ui_strings.h" - #include "ui/views/background.h" -@@ -41,6 +42,20 @@ namespace { +@@ -42,6 +42,20 @@ namespace { gfx::Insets NonBorderInsets(const Label& label) { return label.GetInsets() - label.View::GetInsets(); } @@ -243,14 +235,13 @@ index 5fb2a8667c81..f725a0209267 100644 } // namespace const char Label::kViewClassName[] = "Label"; -@@ -223,6 +238,15 @@ void Label::SetElideBehavior(gfx::ElideBehavior elide_behavior) { +@@ -203,6 +217,14 @@ void Label::SetElideBehavior(gfx::ElideBehavior elide_behavior) { ResetLayout(); } +void Label::SetDrawStringsFlags(int flags) { + if (draw_strings_flags_ == flags) + return; -+ is_first_paint_text_ = true; + draw_strings_flags_ = flags; + full_text_->SetDrawStringsFlags(draw_strings_flags_); + ResetLayout(); @@ -259,7 +250,7 @@ index 5fb2a8667c81..f725a0209267 100644 void Label::SetTooltipText(const base::string16& tooltip_text) { DCHECK(handles_tooltips_); tooltip_text_ = tooltip_text; -@@ -447,7 +471,19 @@ std::unique_ptr Label::CreateRenderText() const { +@@ -431,7 +453,19 @@ std::unique_ptr Label::CreateRenderText() const { render_text->SetFontList(font_list()); render_text->set_shadows(shadows()); render_text->SetCursorEnabled(false); @@ -281,10 +272,10 @@ index 5fb2a8667c81..f725a0209267 100644 render_text->SetMaxLines(multi_line() ? max_lines() : 0); render_text->SetWordWrapBehavior(full_text_->word_wrap_behavior()); diff --git ui/views/controls/label.h ui/views/controls/label.h -index 1cee72792720..c212350b706f 100644 +index 635025a82505..58899c5ec0aa 100644 --- ui/views/controls/label.h +++ ui/views/controls/label.h -@@ -151,6 +151,10 @@ class VIEWS_EXPORT Label : public View, +@@ -153,6 +153,10 @@ class VIEWS_EXPORT Label : public View, void SetElideBehavior(gfx::ElideBehavior elide_behavior); gfx::ElideBehavior elide_behavior() const { return elide_behavior_; } @@ -295,16 +286,16 @@ index 1cee72792720..c212350b706f 100644 // Sets the tooltip text. Default behavior for a label (single-line) is to // show the full text if it is wider than its bounds. Calling this overrides // the default behavior and lets you set a custom tooltip. To revert to -@@ -365,6 +369,7 @@ class VIEWS_EXPORT Label : public View, +@@ -367,6 +371,7 @@ class VIEWS_EXPORT Label : public View, bool collapse_when_hidden_; int fixed_width_; int max_width_; + int draw_strings_flags_ = 0; - // TODO(ckocagil): Remove is_first_paint_text_ before crbug.com/441028 is - // closed. + std::unique_ptr selection_controller_; + diff --git ui/views/controls/menu/menu_controller.cc ui/views/controls/menu/menu_controller.cc -index 9389f25f034d..60f546b55951 100644 +index 4feb2cd4b2e7..c7590702bf95 100644 --- ui/views/controls/menu/menu_controller.cc +++ ui/views/controls/menu/menu_controller.cc @@ -2261,8 +2261,13 @@ MenuItemView* MenuController::FindNextSelectableMenuItem( @@ -382,10 +373,10 @@ index 4dea63f9f286..ef50b710c5af 100644 virtual int GetMaxWidthForMenu(MenuItemView* menu); diff --git ui/views/controls/menu/menu_item_view.cc ui/views/controls/menu/menu_item_view.cc -index d90a8ec45fcf..0a7b0a9d2ea5 100644 +index 4cf7d61f7efe..d6f00c797979 100644 --- ui/views/controls/menu/menu_item_view.cc +++ ui/views/controls/menu/menu_item_view.cc -@@ -811,7 +811,12 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { +@@ -823,7 +823,12 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { // only need the background when we want it to look different, as when we're // selected. ui::NativeTheme* native_theme = GetNativeTheme(); @@ -399,7 +390,7 @@ index d90a8ec45fcf..0a7b0a9d2ea5 100644 gfx::Rect item_bounds(0, 0, width(), height()); AdjustBoundsForRTLUI(&item_bounds); -@@ -900,6 +905,13 @@ void MenuItemView::PaintMinorText(gfx::Canvas* canvas, SkColor color) { +@@ -933,6 +938,13 @@ void MenuItemView::PaintMinorIconAndText(gfx::Canvas* canvas, SkColor color) { SkColor MenuItemView::GetTextColor(bool minor, bool render_selection, bool emphasized) const { @@ -414,7 +405,7 @@ index d90a8ec45fcf..0a7b0a9d2ea5 100644 minor ? ui::NativeTheme::kColorId_MenuItemSubtitleColor : ui::NativeTheme::kColorId_EnabledMenuItemForegroundColor; diff --git ui/views/controls/menu/menu_model_adapter.cc ui/views/controls/menu/menu_model_adapter.cc -index 06a9d3cfda9b..c602a13efd6a 100644 +index 2a540157090f..23aa93f96d76 100644 --- ui/views/controls/menu/menu_model_adapter.cc +++ ui/views/controls/menu/menu_model_adapter.cc @@ -245,6 +245,77 @@ void MenuModelAdapter::SelectionChanged(MenuItemView* menu) { @@ -521,7 +512,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 fc9e3426f7c6..d0513a05eff1 100644 +index 01069fe8680b..928ee7cb4d90 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) @@ -552,18 +543,18 @@ index 875ac82283b3..44424b2ce138 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 f3075731dd61..5cb0d7211560 100644 +index 8b874876b89f..1fe8a762b6c8 100644 --- ui/views/view.h +++ ui/views/view.h -@@ -18,6 +18,7 @@ +@@ -19,6 +19,7 @@ #include "base/i18n/rtl.h" #include "base/logging.h" #include "base/macros.h" +#include "base/supports_user_data.h" #include "build/build_config.h" - #include "ui/accessibility/ax_enums.h" + #include "ui/accessibility/ax_enums.mojom.h" #include "ui/base/accelerators/accelerator.h" -@@ -118,7 +119,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, +@@ -119,7 +120,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate, public ui::AcceleratorTarget, public ui::EventTarget, public ui::EventHandler, 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 3769545e2..371105777 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 6dc8047e8a51..dfe15c9500d5 100644 +index 151c87cd72e3..593a79904382 100644 --- content/browser/renderer_host/render_widget_host_view_base.cc +++ content/browser/renderer_host/render_widget_host_view_base.cc -@@ -326,6 +326,14 @@ void RenderWidgetHostViewBase::GetScreenInfo(ScreenInfo* screen_info) { - host->delegate()->GetScreenInfo(screen_info); +@@ -312,6 +312,14 @@ float RenderWidgetHostViewBase::GetDeviceScaleFactor() const { + return screen_info.device_scale_factor; } +void RenderWidgetHostViewBase::SetHasExternalParent(bool val) { @@ -18,10 +18,10 @@ index 6dc8047e8a51..dfe15c9500d5 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 1115afb8a798..905572d2b8f1 100644 +index 06f2793aa2d7..06244d674026 100644 --- content/browser/renderer_host/render_widget_host_view_base.h +++ content/browser/renderer_host/render_widget_host_view_base.h -@@ -83,6 +83,7 @@ class BrowserAccessibilityManager; +@@ -79,6 +79,7 @@ class BrowserAccessibilityManager; class CursorManager; class RenderWidgetHostImpl; class RenderWidgetHostViewBaseObserver; @@ -29,7 +29,7 @@ index 1115afb8a798..905572d2b8f1 100644 class SyntheticGestureTarget; class TextInputManager; class TouchSelectionControllerClientManager; -@@ -99,6 +100,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -98,6 +99,9 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, float current_device_scale_factor() const { return current_device_scale_factor_; } @@ -39,16 +39,16 @@ index 1115afb8a798..905572d2b8f1 100644 // Returns the focused RenderWidgetHost inside this |view|'s RWH. RenderWidgetHostImpl* GetFocusedWidget() const; -@@ -129,6 +133,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, - void FocusedNodeTouched(const gfx::Point& location_dips_screen, +@@ -122,6 +126,8 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, bool editable) override; - void GetScreenInfo(ScreenInfo* screen_info) override; + void GetScreenInfo(ScreenInfo* screen_info) const override; + float GetDeviceScaleFactor() const final; + void SetHasExternalParent(bool val) override; + bool HasExternalParent() const override; TouchSelectionControllerClientManager* GetTouchSelectionControllerClientManager() override; -@@ -409,6 +415,12 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -412,6 +418,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 1115afb8a798..905572d2b8f1 100644 // Sets the cursor for this view to the one associated with the specified // cursor_type. virtual void UpdateCursor(const WebCursor& cursor) = 0; -@@ -554,6 +566,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, +@@ -559,6 +571,10 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, WebContentsAccessibility* web_contents_accessibility_; @@ -73,7 +73,7 @@ index 1115afb8a798..905572d2b8f1 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 5a751783f1af..7e71a7227e5f 100644 +index 8318ed172a75..0d6023427bf4 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 @@ @@ -103,12 +103,12 @@ index 5a751783f1af..7e71a7227e5f 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 70e4636903f2..3ada5a504fdb 100644 +index e967efe6ad9b..3c49ea9ac980 100644 --- content/public/browser/render_widget_host_view.h +++ content/public/browser/render_widget_host_view.h -@@ -251,6 +251,14 @@ class CONTENT_EXPORT RenderWidgetHostView { - // This method returns the ScreenInfo used by the view to render. - virtual void GetScreenInfo(ScreenInfo* screen_info) = 0; +@@ -213,6 +213,14 @@ class CONTENT_EXPORT RenderWidgetHostView { + // This must always return the same device scale factor as GetScreenInfo. + virtual float GetDeviceScaleFactor() const = 0; + // Set whether the widget has a external parent view/window outside of the + // Chromium-controlled view/window hierarchy. @@ -135,10 +135,10 @@ 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 1bf5a5e2ca59..f29f473ceca2 100644 +index 19f103c0385e..737125f8f601 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( +@@ -86,6 +86,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin( should_animate_window_close_(false), pending_close_(false), has_non_client_view_(false), @@ -146,7 +146,7 @@ index 1bf5a5e2ca59..f29f473ceca2 100644 tooltip_(NULL) { } -@@ -122,8 +123,12 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window, +@@ -124,8 +125,12 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window, native_widget_delegate_); HWND parent_hwnd = NULL; @@ -160,7 +160,7 @@ index 1bf5a5e2ca59..f29f473ceca2 100644 remove_standard_frame_ = params.remove_standard_frame; has_non_client_view_ = Widget::RequiresNonClientView(params.type); -@@ -834,11 +839,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() { +@@ -849,11 +854,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() { } void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) { @@ -179,10 +179,10 @@ index 1bf5a5e2ca59..f29f473ceca2 100644 bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) { diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -index db66147f0e9c..2b9bdfa2ec53 100644 +index 732f492c102f..a7007468c3b7 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h -@@ -271,6 +271,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin +@@ -277,6 +277,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin // True if the window should have the frame removed. bool remove_standard_frame_; @@ -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 deaf9cbc13cc..57f8c4f44a29 100644 +index f8550833ee6f..117a47a7aacd 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc -@@ -143,6 +143,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( +@@ -145,6 +145,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( use_native_frame_(false), should_maximize_after_map_(false), use_argb_visual_(false), @@ -205,7 +205,7 @@ index deaf9cbc13cc..57f8c4f44a29 100644 drag_drop_client_(NULL), native_widget_delegate_(native_widget_delegate), desktop_native_widget_aura_(desktop_native_widget_aura), -@@ -156,6 +157,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( +@@ -158,6 +159,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11( has_window_focus_(false), has_pointer_focus_(false), modal_dialog_counter_(0), @@ -213,7 +213,7 @@ index deaf9cbc13cc..57f8c4f44a29 100644 close_widget_factory_(this), weak_factory_(this) {} -@@ -191,6 +193,8 @@ std::vector DesktopWindowTreeHostX11::GetAllOpenWindows() { +@@ -193,6 +195,8 @@ std::vector DesktopWindowTreeHostX11::GetAllOpenWindows() { } gfx::Rect DesktopWindowTreeHostX11::GetX11RootWindowBounds() const { @@ -222,7 +222,7 @@ index deaf9cbc13cc..57f8c4f44a29 100644 return bounds_in_pixels_; } -@@ -502,7 +506,8 @@ void DesktopWindowTreeHostX11::CloseNow() { +@@ -505,7 +509,8 @@ void DesktopWindowTreeHostX11::CloseNow() { // Actually free our native resources. if (ui::PlatformEventSource::GetInstance()) ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); @@ -232,7 +232,7 @@ index deaf9cbc13cc..57f8c4f44a29 100644 xwindow_ = x11::None; desktop_native_widget_aura_->OnHostClosed(); -@@ -643,6 +648,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( +@@ -646,6 +651,8 @@ void DesktopWindowTreeHostX11::GetWindowPlacement( } gfx::Rect DesktopWindowTreeHostX11::GetWindowBoundsInScreen() const { @@ -241,7 +241,7 @@ index deaf9cbc13cc..57f8c4f44a29 100644 return ToDIPRect(bounds_in_pixels_); } -@@ -1250,6 +1257,8 @@ void DesktopWindowTreeHostX11::SetBoundsInPixels( +@@ -1253,6 +1260,8 @@ void DesktopWindowTreeHostX11::SetBoundsInPixels( } gfx::Point DesktopWindowTreeHostX11::GetLocationOnScreenInPixels() const { @@ -250,7 +250,7 @@ index deaf9cbc13cc..57f8c4f44a29 100644 return bounds_in_pixels_.origin(); } -@@ -1344,7 +1353,6 @@ void DesktopWindowTreeHostX11::InitX11Window( +@@ -1364,7 +1373,6 @@ void DesktopWindowTreeHostX11::InitX11Window( ::Atom window_type; switch (params.type) { case Widget::InitParams::TYPE_MENU: @@ -258,7 +258,7 @@ index deaf9cbc13cc..57f8c4f44a29 100644 window_type = gfx::GetAtom("_NET_WM_WINDOW_TYPE_MENU"); break; case Widget::InitParams::TYPE_TOOLTIP: -@@ -1400,9 +1408,15 @@ void DesktopWindowTreeHostX11::InitX11Window( +@@ -1420,9 +1428,15 @@ void DesktopWindowTreeHostX11::InitX11Window( attribute_mask |= CWBorderPixel; swa.border_pixel = 0; @@ -275,7 +275,7 @@ index deaf9cbc13cc..57f8c4f44a29 100644 bounds_in_pixels_.y(), bounds_in_pixels_.width(), bounds_in_pixels_.height(), 0, // border width -@@ -2006,6 +2020,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( +@@ -2020,6 +2034,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent( } break; } @@ -283,14 +283,14 @@ index deaf9cbc13cc..57f8c4f44a29 100644 + xwindow_destroyed_ = true; + CloseNow(); + break; - case FocusIn: - case FocusOut: - OnFocusEvent(xev->type == FocusIn, event->xfocus.mode, + case x11::FocusIn: + case x11::FocusOut: + OnFocusEvent(xev->type == x11::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 674951e1c90e..bc74be16e94d 100644 +index 021a1d9ad2b1..7f8ccfb73acd 100644 --- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h +++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h -@@ -85,6 +85,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -86,6 +86,12 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // Disables event listening to make |dialog| modal. std::unique_ptr DisableEventListening(); @@ -303,7 +303,7 @@ index 674951e1c90e..bc74be16e94d 100644 protected: // Overridden from DesktopWindowTreeHost: void Init(aura::Window* content_window, -@@ -303,6 +309,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -302,6 +308,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // The bounds of |xwindow_|. gfx::Rect bounds_in_pixels_; @@ -313,7 +313,7 @@ index 674951e1c90e..bc74be16e94d 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 -@@ -342,6 +351,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -341,6 +350,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 // Whether we used an ARGB visual for our window. bool use_argb_visual_; @@ -324,7 +324,7 @@ index 674951e1c90e..bc74be16e94d 100644 DesktopDragDropClientAuraX11* drag_drop_client_; std::unique_ptr x11_non_client_event_filter_; -@@ -429,6 +442,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 +@@ -431,6 +444,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 uint32_t modal_dialog_counter_; @@ -335,7 +335,7 @@ index 674951e1c90e..bc74be16e94d 100644 base::WeakPtrFactory weak_factory_; diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc -index d685bf4f40e3..2e22ba96827e 100644 +index 926519dfa332..e06be5a1b0eb 100644 --- ui/views/widget/widget.cc +++ ui/views/widget/widget.cc @@ -130,6 +130,7 @@ Widget::InitParams::InitParams(Type type) @@ -369,7 +369,7 @@ index d685bf4f40e3..2e22ba96827e 100644 } // This must come after SetContentsView() or it might not be able to find // the correct NativeTheme (on Linux). See http://crbug.com/384492 -@@ -1096,10 +1102,16 @@ void Widget::OnNativeWidgetDestroyed() { +@@ -1098,10 +1104,16 @@ void Widget::OnNativeWidgetDestroyed() { } gfx::Size Widget::GetMinimumSize() const { @@ -387,10 +387,10 @@ index d685bf4f40e3..2e22ba96827e 100644 } diff --git ui/views/widget/widget.h ui/views/widget/widget.h -index 242c9496b29a..05a21aeb9035 100644 +index 6c0c60807a2b..87ed97b90ab5 100644 --- ui/views/widget/widget.h +++ ui/views/widget/widget.h -@@ -254,6 +254,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, +@@ -252,6 +252,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate, // Whether the widget should be maximized or minimized. ui::WindowShowState show_state; gfx::NativeView parent; @@ -399,10 +399,10 @@ index 242c9496b29a..05a21aeb9035 100644 // the NativeWidget may specify a default size. If the parent is specified, // |bounds| is in the parent's coordinate system. If the parent is not diff --git ui/views/widget/widget_delegate.h ui/views/widget/widget_delegate.h -index bd4d8a7a1de2..998cfa05ea51 100644 +index 8ae821974838..c73b20dcb9b0 100644 --- ui/views/widget/widget_delegate.h +++ ui/views/widget/widget_delegate.h -@@ -187,6 +187,10 @@ class VIEWS_EXPORT WidgetDelegate { +@@ -183,6 +183,10 @@ class VIEWS_EXPORT WidgetDelegate { // be cycled through with keyboard focus. virtual void GetAccessiblePanes(std::vector* panes) {} @@ -414,7 +414,7 @@ index bd4d8a7a1de2..998cfa05ea51 100644 virtual ~WidgetDelegate() {} diff --git ui/views/widget/widget_hwnd_utils.cc ui/views/widget/widget_hwnd_utils.cc -index 163e4b54b033..58f594db5019 100644 +index c7296fed234d..244d0034a1c4 100644 --- ui/views/widget/widget_hwnd_utils.cc +++ ui/views/widget/widget_hwnd_utils.cc @@ -73,7 +73,7 @@ void CalculateWindowStylesFromInitParams( @@ -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 5906900d721c..9dd0514b8cec 100644 +index c8fb7eecb9c8..49c0bc6c5f60 100644 --- ui/views/win/hwnd_message_handler.cc +++ ui/views/win/hwnd_message_handler.cc -@@ -2665,8 +2665,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message, +@@ -2687,8 +2687,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 7ec43eb36..98a15195d 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 3484edd85788..42d731e0882e 100644 +index ca66c499f1e8..9208b43f669a 100644 --- content/browser/web_contents/web_contents_impl.cc +++ content/browser/web_contents/web_contents_impl.cc -@@ -1759,21 +1759,30 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { +@@ -1733,21 +1733,30 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { std::string unique_name; frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name); @@ -45,7 +45,7 @@ index 3484edd85788..42d731e0882e 100644 CHECK(render_view_host_delegate_view_); CHECK(view_.get()); -@@ -2325,6 +2334,15 @@ void WebContentsImpl::CreateNewWindow( +@@ -2298,6 +2307,15 @@ void WebContentsImpl::CreateNewWindow( create_params.renderer_initiated_creation = main_frame_route_id != MSG_ROUTING_NONE; @@ -61,7 +61,7 @@ index 3484edd85788..42d731e0882e 100644 WebContentsImpl* new_contents = nullptr; if (!is_guest) { create_params.context = view_->GetNativeView(); -@@ -2354,7 +2372,7 @@ void WebContentsImpl::CreateNewWindow( +@@ -2327,7 +2345,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( @@ -70,7 +70,7 @@ index 3484edd85788..42d731e0882e 100644 } // Save the created window associated with the route so we can show it // later. -@@ -5531,7 +5549,7 @@ InterstitialPageImpl* WebContentsImpl::GetInterstitialForRenderManager() { +@@ -5573,7 +5591,7 @@ InterstitialPageImpl* WebContentsImpl::GetInterstitialForRenderManager() { void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager( RenderViewHost* render_view_host) { RenderWidgetHostViewBase* rwh_view = @@ -95,10 +95,10 @@ index 53d56abb35a3..d7b955f42ca5 100644 WebContents::CreateParams::CreateParams(const CreateParams& other) = default; diff --git content/public/browser/web_contents.h content/public/browser/web_contents.h -index 6e628faf106c..3855673d976b 100644 +index 2dfd24904480..c254945f1621 100644 --- content/public/browser/web_contents.h +++ content/public/browser/web_contents.h -@@ -68,9 +68,11 @@ class BrowserPluginGuestDelegate; +@@ -69,9 +69,11 @@ class BrowserPluginGuestDelegate; class InterstitialPage; class RenderFrameHost; class RenderViewHost; @@ -110,7 +110,7 @@ index 6e628faf106c..3855673d976b 100644 struct CustomContextMenuContext; struct DropData; struct Manifest; -@@ -173,6 +175,10 @@ class WebContents : public PageNavigator, +@@ -174,6 +176,10 @@ class WebContents : public PageNavigator, // Sandboxing flags set on the new WebContents. blink::WebSandboxFlags starting_sandbox_flags; @@ -122,13 +122,13 @@ index 6e628faf106c..3855673d976b 100644 // Creates a new WebContents. diff --git content/public/browser/web_contents_delegate.h content/public/browser/web_contents_delegate.h -index 0ad2e1d835a2..5e3f49cda5fa 100644 +index 6f0c02b02dc7..705795a4a5f5 100644 --- content/public/browser/web_contents_delegate.h +++ content/public/browser/web_contents_delegate.h -@@ -44,11 +44,13 @@ namespace content { - class ColorChooser; +@@ -45,11 +45,13 @@ class ColorChooser; class JavaScriptDialogManager; class RenderFrameHost; + class RenderProcessHost; +class RenderViewHostDelegateView; class RenderWidgetHost; class SessionStorageNamespace; @@ -139,7 +139,7 @@ index 0ad2e1d835a2..5e3f49cda5fa 100644 struct ContextMenuParams; struct DropData; struct FileChooserParams; -@@ -307,6 +309,14 @@ class CONTENT_EXPORT WebContentsDelegate { +@@ -312,6 +314,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 6ea9b3c89..017b41be0 100644 --- a/patch/patches/webkit_plugin_info_2015.patch +++ b/patch/patches/webkit_plugin_info_2015.patch @@ -17,30 +17,31 @@ index 8088169f0434..47cf612db044 100644 .Top() .GetSecurityContext() diff --git third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp -index 0fa2449c7f1c..8adf2d575e66 100644 +index 647da1f97f5c..4ef9014aecd9 100644 --- third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp +++ third_party/WebKit/Source/core/exported/WebDevToolsAgentImpl.cpp -@@ -329,6 +329,7 @@ WebDevToolsAgentImpl::Session::Session( - host_ptr_.Bind(std::move(host_ptr_info)); - host_ptr_.set_connection_error_handler(WTF::Bind( +@@ -322,6 +322,8 @@ WebDevToolsAgentImpl::Session::Session( &WebDevToolsAgentImpl::Session::Detach, WrapWeakPersistent(this))); + + InitializeInspectorSession(reattach_state); ++ + Platform::Current()->DevToolsAgentAttached(); } - void WebDevToolsAgentImpl::Session::Trace(blink::Visitor* visitor) { -@@ -347,6 +348,7 @@ void WebDevToolsAgentImpl::Session::Detach() { + WebDevToolsAgentImpl::Session::~Session() { +@@ -347,6 +349,7 @@ void WebDevToolsAgentImpl::Session::Detach() { io_session_->DeleteSoon(); io_session_ = nullptr; inspector_session_->Dispose(); + Platform::Current()->DevToolsAgentDetached(); } - void WebDevToolsAgentImpl::Session::DispatchProtocolMessage( + void WebDevToolsAgentImpl::Session::SendProtocolResponse(int session_id, diff --git third_party/WebKit/Source/core/frame/LocalFrame.cpp third_party/WebKit/Source/core/frame/LocalFrame.cpp -index b76797e978da..a784ce63c21d 100644 +index d300bba78132..48ca90b83fd6 100644 --- third_party/WebKit/Source/core/frame/LocalFrame.cpp +++ third_party/WebKit/Source/core/frame/LocalFrame.cpp -@@ -1084,7 +1084,7 @@ FrameResourceCoordinator* LocalFrame::GetFrameResourceCoordinator() { +@@ -1132,7 +1132,7 @@ FrameResourceCoordinator* LocalFrame::GetFrameResourceCoordinator() { PluginData* LocalFrame::GetPluginData() const { if (!Loader().AllowPlugins(kNotAboutToInstantiatePlugin)) return nullptr; @@ -50,7 +51,7 @@ index b76797e978da..a784ce63c21d 100644 } diff --git third_party/WebKit/Source/core/page/Page.cpp third_party/WebKit/Source/core/page/Page.cpp -index b864a731dc65..7fc8a6c023f1 100644 +index 2cedf7285afd..f3690511ceda 100644 --- third_party/WebKit/Source/core/page/Page.cpp +++ third_party/WebKit/Source/core/page/Page.cpp @@ -148,7 +148,8 @@ Page::Page(PageClients& page_clients) @@ -188,10 +189,10 @@ index bdd586bd9621..13efebb33a49 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 cc2a721a6ea3..2a843527f9d7 100644 +index d6ce9d31e241..93d4c32b656a 100644 --- third_party/WebKit/public/platform/Platform.h +++ third_party/WebKit/public/platform/Platform.h -@@ -376,6 +376,7 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -383,6 +383,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, @@ -199,7 +200,7 @@ index cc2a721a6ea3..2a843527f9d7 100644 const WebSecurityOrigin& main_frame_origin, WebPluginListBuilder*) {} -@@ -748,6 +749,11 @@ class BLINK_PLATFORM_EXPORT Platform { +@@ -746,6 +747,11 @@ class BLINK_PLATFORM_EXPORT Platform { // runs during Chromium's build step). virtual bool IsTakingV8ContextSnapshot() { return false; } diff --git a/patch/patches/webkit_pointer_event_781966.patch b/patch/patches/webkit_pointer_event_781966.patch index bcbb5ae80..ac181ca6b 100644 --- a/patch/patches/webkit_pointer_event_781966.patch +++ b/patch/patches/webkit_pointer_event_781966.patch @@ -1,8 +1,8 @@ diff --git third_party/WebKit/Source/core/input/PointerEventManager.cpp third_party/WebKit/Source/core/input/PointerEventManager.cpp -index 6e0a75cf93c3..403b019db4ee 100644 +index ce07c49a4777..ed1ef44ac2de 100644 --- third_party/WebKit/Source/core/input/PointerEventManager.cpp +++ third_party/WebKit/Source/core/input/PointerEventManager.cpp -@@ -269,7 +269,7 @@ void PointerEventManager::HandlePointerInterruption( +@@ -270,7 +270,7 @@ void PointerEventManager::HandlePointerInterruption( for (auto pointer_event : canceled_pointer_events) { // If we are sending a pointercancel we have sent the pointerevent to some // target before. diff --git a/patch/patches/webkit_popups.patch b/patch/patches/webkit_popups.patch index 23f008f1d..13f78fe10 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 d0c5134a2ad6..1434134d4212 100644 +index 494a9bc0f294..a766c5d047b0 100644 --- third_party/WebKit/Source/core/exported/WebViewImpl.cpp +++ third_party/WebKit/Source/core/exported/WebViewImpl.cpp -@@ -258,8 +258,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { +@@ -253,8 +253,13 @@ void WebView::SetUseExternalPopupMenus(bool use_external_popup_menus) { g_should_use_external_popup_menus = use_external_popup_menus; } @@ -18,7 +18,7 @@ index d0c5134a2ad6..1434134d4212 100644 } namespace { -@@ -350,6 +355,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client, +@@ -345,6 +350,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,11 +27,11 @@ index d0c5134a2ad6..1434134d4212 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 79a702679fec..babc626a91bf 100644 +index 4e820e7746b7..52c6eaaf2f89 100644 --- third_party/WebKit/Source/core/exported/WebViewImpl.h +++ third_party/WebKit/Source/core/exported/WebViewImpl.h -@@ -107,7 +107,8 @@ class CORE_EXPORT WebViewImpl final - static const WebInputEvent* CurrentInputEvent(); +@@ -106,7 +106,8 @@ class CORE_EXPORT WebViewImpl final + static HashSet& AllInstances(); // Returns true if popup menus should be rendered by the browser, false if // they should be rendered by WebKit (which is the default). - static bool UseExternalPopupMenus(); @@ -49,7 +49,7 @@ index 79a702679fec..babc626a91bf 100644 void SetBaseBackgroundColorOverride(WebColor); void ClearBaseBackgroundColorOverride(); void SetBackgroundColorOverride(WebColor); -@@ -608,6 +609,8 @@ class CORE_EXPORT WebViewImpl final +@@ -602,6 +603,8 @@ class CORE_EXPORT WebViewImpl final float fake_page_scale_animation_page_scale_factor_; bool fake_page_scale_animation_use_anchor_; @@ -59,10 +59,10 @@ index 79a702679fec..babc626a91bf 100644 TransformationMatrix device_emulation_transform_; diff --git third_party/WebKit/Source/core/page/ChromeClientImpl.cpp third_party/WebKit/Source/core/page/ChromeClientImpl.cpp -index 98618289cfab..ec154753a350 100644 +index fd6ddf8f6c82..c953adec0b27 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, +@@ -779,7 +779,7 @@ PopupMenu* ChromeClientImpl::OpenPopupMenu(LocalFrame& frame, return nullptr; NotifyPopupOpeningObservers(); @@ -72,10 +72,10 @@ index 98618289cfab..ec154753a350 100644 DCHECK(RuntimeEnabledFeatures::PagePopupEnabled()); diff --git third_party/WebKit/public/web/WebView.h third_party/WebKit/public/web/WebView.h -index 8f30d3c30bac..062ae5e643bb 100644 +index 8fc376c9973c..4f2ee40e800c 100644 --- third_party/WebKit/public/web/WebView.h +++ third_party/WebKit/public/web/WebView.h -@@ -360,6 +360,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); @@ -83,7 +83,7 @@ index 8f30d3c30bac..062ae5e643bb 100644 // Hides any popup (suggestions, selects...) that might be showing. virtual void HidePopups() = 0; -@@ -390,6 +391,8 @@ class WebView : protected WebWidget { +@@ -391,6 +392,8 @@ class WebView : protected WebWidget { unsigned inactive_background_color, unsigned inactive_foreground_color) = 0; diff --git a/patch/patches/webui_2037.patch b/patch/patches/webui_2037.patch index 09d9ce73c..0ce84c4e5 100644 --- a/patch/patches/webui_2037.patch +++ b/patch/patches/webui_2037.patch @@ -14,10 +14,10 @@ index e3a222a90f33..24298a7423f1 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 158173bac8eb..26af7ef2e14b 100644 +index 302df0f9a2cf..f6714b63a9f2 100644 --- chrome/browser/ui/webui/net_internals/net_internals_ui.cc +++ chrome/browser/ui/webui/net_internals/net_internals_ui.cc -@@ -552,41 +552,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 158173bac8eb..26af7ef2e14b 100644 } //////////////////////////////////////////////////////////////////////////////// -@@ -666,9 +656,17 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( +@@ -667,9 +657,17 @@ void NetInternalsMessageHandler::IOThreadImpl::OnRendererReady( PrePopulateEventList(); diff --git a/patch/patches/webview_plugin_2020.patch b/patch/patches/webview_plugin_2020.patch index 47b8f1277..cbf412036 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 094021d39f7e..43182c57d589 100644 +index 6cd05c6fcd2a..eedc0295d8b8 100644 --- chrome/app/generated_resources.grd +++ chrome/app/generated_resources.grd -@@ -4921,7 +4921,7 @@ Keep your key file in a safe place. You will need it to create new versions of y +@@ -4830,7 +4830,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 6568712b2..0276b6495 100644 --- a/patch/patches/win_rt_2274.patch +++ b/patch/patches/win_rt_2274.patch @@ -1,8 +1,8 @@ diff --git services/service_manager/sandbox/win/sandbox_win.cc services/service_manager/sandbox/win/sandbox_win.cc -index 132a3e4dfd6c..568c0ef70065 100644 +index 6c7356eacc42..4804ce497e1b 100644 --- services/service_manager/sandbox/win/sandbox_win.cc +++ services/service_manager/sandbox/win/sandbox_win.cc -@@ -758,8 +758,11 @@ sandbox::ResultCode SandboxWin::StartSandboxedProcess( +@@ -865,8 +865,11 @@ sandbox::ResultCode SandboxWin::StartSandboxedProcess( #endif // Post-startup mitigations. diff --git a/patch/patches/win_strcat_817738.patch b/patch/patches/win_strcat_817738.patch new file mode 100644 index 000000000..3027e38cd --- /dev/null +++ b/patch/patches/win_strcat_817738.patch @@ -0,0 +1,28 @@ +diff --git base/strings/strcat.h base/strings/strcat.h +index b249d49..44c6211 100644 +--- base/strings/strcat.h ++++ base/strings/strcat.h +@@ -11,6 +11,12 @@ + #include "base/compiler_specific.h" + #include "base/containers/span.h" + #include "base/strings/string_piece.h" ++#include "build/build_config.h" ++ ++#if defined(OS_WIN) ++// To resolve a conflict with Win32 API StrCat macro. ++#include "base/win/windows_types.h" ++#endif + + namespace base { + +diff --git base/win/windows_types.h base/win/windows_types.h +index 8060f03..2a86195 100644 +--- base/win/windows_types.h ++++ base/win/windows_types.h +@@ -248,5 +248,6 @@ + #define SendMessageCallback SendMessageCallbackW + #define SetCurrentDirectory SetCurrentDirectoryW + #define StartService StartServiceW ++#define StrCat StrCatW + + #endif // BASE_WIN_WINDOWS_TYPES_H diff --git a/tests/ceftests/cookie_unittest.cc b/tests/ceftests/cookie_unittest.cc index 9787b5586..62622bdb8 100644 --- a/tests/ceftests/cookie_unittest.cc +++ b/tests/ceftests/cookie_unittest.cc @@ -86,9 +86,12 @@ class TestVisitor : public CefCookieVisitor { public: TestVisitor(CookieVector* cookies, bool deleteCookies, - CefRefPtr event) - : cookies_(cookies), delete_cookies_(deleteCookies), event_(event) {} - ~TestVisitor() override { event_->Signal(); } + const base::Closure& callback) + : cookies_(cookies), delete_cookies_(deleteCookies), callback_(callback) { + EXPECT_TRUE(cookies_); + EXPECT_FALSE(callback_.is_null()); + } + ~TestVisitor() override { callback_.Run(); } bool Visit(const CefCookie& cookie, int count, @@ -100,9 +103,10 @@ class TestVisitor : public CefCookieVisitor { return true; } + private: CookieVector* cookies_; bool delete_cookies_; - CefRefPtr event_; + base::Closure callback_; IMPLEMENT_REFCOUNTING(TestVisitor); }; @@ -159,6 +163,49 @@ void CreateCookie(CefRefPtr manager, SetCookies(manager, kTestUrl, cookies, true, event); } +// Visit URL cookies. Execute |callback| on completion. +void VisitUrlCookies(CefRefPtr manager, + const CefString& url, + bool includeHttpOnly, + CookieVector& cookies, + bool deleteCookies, + const base::Closure& callback) { + EXPECT_TRUE(manager->VisitUrlCookies( + url, includeHttpOnly, + new TestVisitor(&cookies, deleteCookies, callback))); +} + +// Visit URL cookies. Block on |event|. +void VisitUrlCookies(CefRefPtr manager, + const CefString& url, + bool includeHttpOnly, + CookieVector& cookies, + bool deleteCookies, + CefRefPtr event) { + VisitUrlCookies(manager, url, includeHttpOnly, cookies, deleteCookies, + base::Bind(&CefWaitableEvent::Signal, event)); + event->Wait(); +} + +// Visit all cookies. Execute |callback| on completion. +void VisitAllCookies(CefRefPtr manager, + CookieVector& cookies, + bool deleteCookies, + const base::Closure& callback) { + EXPECT_TRUE(manager->VisitAllCookies( + new TestVisitor(&cookies, deleteCookies, callback))); +} + +// Visit all cookies. Block on |event|. +void VisitAllCookies(CefRefPtr manager, + CookieVector& cookies, + bool deleteCookies, + CefRefPtr event) { + VisitAllCookies(manager, cookies, deleteCookies, + base::Bind(&CefWaitableEvent::Signal, event)); + event->Wait(); +} + // Retrieve the test cookie. If |withDomain| is true check that the cookie // is a domain cookie, otherwise a host cookie. if |deleteCookies| is true // the cookie will be deleted when it's retrieved. @@ -170,9 +217,7 @@ void GetCookie(CefRefPtr manager, CookieVector cookies; // Get the cookie and delete it. - EXPECT_TRUE(manager->VisitUrlCookies( - kTestUrl, false, new TestVisitor(&cookies, deleteCookies, event))); - event->Wait(); + VisitUrlCookies(manager, kTestUrl, false, cookies, deleteCookies, event); EXPECT_EQ(1U, cookies.size()); if (cookies.size() != 1U) @@ -197,28 +242,6 @@ void GetCookie(CefRefPtr manager, EXPECT_EQ(cookie.expires.millisecond, cookie_read.expires.millisecond); } -// Visit URL cookies. -void VisitUrlCookies(CefRefPtr manager, - const CefString& url, - bool includeHttpOnly, - CookieVector& cookies, - bool deleteCookies, - CefRefPtr event) { - EXPECT_TRUE(manager->VisitUrlCookies( - url, includeHttpOnly, new TestVisitor(&cookies, deleteCookies, event))); - event->Wait(); -} - -// Visit all cookies. -void VisitAllCookies(CefRefPtr manager, - CookieVector& cookies, - bool deleteCookies, - CefRefPtr event) { - EXPECT_TRUE(manager->VisitAllCookies( - new TestVisitor(&cookies, deleteCookies, event))); - event->Wait(); -} - // Verify that no cookies exist. If |withUrl| is true it will only check for // cookies matching the URL. void VerifyNoCookies(CefRefPtr manager, @@ -228,13 +251,10 @@ void VerifyNoCookies(CefRefPtr manager, // Verify that the cookie has been deleted. if (withUrl) { - EXPECT_TRUE(manager->VisitUrlCookies( - kTestUrl, false, new TestVisitor(&cookies, false, event))); + VisitUrlCookies(manager, kTestUrl, false, cookies, false, event); } else { - EXPECT_TRUE( - manager->VisitAllCookies(new TestVisitor(&cookies, false, event))); + VisitAllCookies(manager, cookies, false, event); } - event->Wait(); EXPECT_EQ(0U, cookies.size()); } @@ -543,10 +563,10 @@ TEST(CookieTest, DomainCookieOnDisk) { TestDomainCookie(manager, event); - // The backing store will be closed on the DB thread after the CookieManager + // The backing store will be closed on the FILE thread after the CookieManager // is destroyed. manager = NULL; - WaitForDBThreadWithDelay(kCacheDeleteDelay); + WaitForFILEThreadWithDelay(kCacheDeleteDelay); } // Test creation of a host cookie. @@ -592,10 +612,10 @@ TEST(CookieTest, HostCookieOnDisk) { TestHostCookie(manager, event); - // The backing store will be closed on the DB thread after the CookieManager + // The backing store will be closed on the FILE thread after the CookieManager // is destroyed. manager = NULL; - WaitForDBThreadWithDelay(kCacheDeleteDelay); + WaitForFILEThreadWithDelay(kCacheDeleteDelay); } // Test creation of multiple cookies. @@ -641,10 +661,10 @@ TEST(CookieTest, MultipleCookiesOnDisk) { TestMultipleCookies(manager, event); - // The backing store will be closed on the DB thread after the CookieManager + // The backing store will be closed on the FILE thread after the CookieManager // is destroyed. manager = NULL; - WaitForDBThreadWithDelay(kCacheDeleteDelay); + WaitForFILEThreadWithDelay(kCacheDeleteDelay); } TEST(CookieTest, AllCookiesGlobal) { @@ -687,10 +707,10 @@ TEST(CookieTest, AllCookiesOnDisk) { TestAllCookies(manager, event); - // The backing store will be closed on the DB thread after the CookieManager + // The backing store will be closed on the FILE thread after the CookieManager // is destroyed. manager = NULL; - WaitForDBThreadWithDelay(kCacheDeleteDelay); + WaitForFILEThreadWithDelay(kCacheDeleteDelay); } TEST(CookieTest, ChangeDirectoryGlobal) { @@ -914,26 +934,23 @@ class CookieTestJSHandler : public TestHandler { const std::string& value, TrackCallback* callback, const base::Closure& continue_callback) { - if (!CefCurrentlyOn(TID_FILE)) { - CefPostTask(TID_FILE, - base::Bind(&CookieTestJSHandler::VerifyCookie, this, manager, - url, name, value, base::Unretained(callback), - continue_callback)); - return; - } - - CefRefPtr event = - CefWaitableEvent::CreateWaitableEvent(true, false); - CookieVector cookies; - // Get the cookie. - VisitUrlCookies(manager, url, false, cookies, false, event); + EXPECT_TRUE(cookies_.empty()); + VisitUrlCookies(manager, url, false, cookies_, false, + base::Bind(&CookieTestJSHandler::VerifyCookieComplete, this, + name, value, callback, continue_callback)); + } - if (cookies.size() == 1U && CefString(&cookies[0].name) == name && - CefString(&cookies[0].value) == value) { + void VerifyCookieComplete(const std::string& name, + const std::string& value, + TrackCallback* callback, + const base::Closure& continue_callback) { + if (cookies_.size() == 1U && CefString(&cookies_[0].name) == name && + CefString(&cookies_[0].value) == value) { callback->yes(); } + cookies_.clear(); continue_callback.Run(); } @@ -942,6 +959,8 @@ class CookieTestJSHandler : public TestHandler { CefRefPtr manager1_; CefRefPtr manager2_; + CookieVector cookies_; + TrackCallback got_cookie_manager1_; TrackCallback got_cookie_manager2_; TrackCallback got_load_end1_; @@ -1212,26 +1231,23 @@ class CookieTestSchemeHandler : public TestHandler { const std::string& value, TrackCallback* callback, const base::Closure& continue_callback) { - if (!CefCurrentlyOn(TID_FILE)) { - CefPostTask(TID_FILE, - base::Bind(&CookieTestSchemeHandler::VerifyCookie, this, - manager, url, name, value, - base::Unretained(callback), continue_callback)); - return; - } - - CefRefPtr event = - CefWaitableEvent::CreateWaitableEvent(true, false); - CookieVector cookies; - // Get the cookie. - VisitUrlCookies(manager, url, false, cookies, false, event); + EXPECT_TRUE(cookies_.empty()); + VisitUrlCookies(manager, url, false, cookies_, false, + base::Bind(&CookieTestSchemeHandler::VerifyCookieComplete, + this, name, value, callback, continue_callback)); + } - if (cookies.size() == 1U && CefString(&cookies[0].name) == name && - CefString(&cookies[0].value) == value) { + void VerifyCookieComplete(const std::string& name, + const std::string& value, + TrackCallback* callback, + const base::Closure& continue_callback) { + if (cookies_.size() == 1U && CefString(&cookies_[0].name) == name && + CefString(&cookies_[0].value) == value) { callback->yes(); } + cookies_.clear(); continue_callback.Run(); } @@ -1245,6 +1261,8 @@ class CookieTestSchemeHandler : public TestHandler { CefRefPtr manager1_; CefRefPtr manager2_; + CookieVector cookies_; + TrackCallback got_process_request1_; TrackCallback got_process_request2_; TrackCallback got_process_request3_; diff --git a/tests/ceftests/display_unittest.cc b/tests/ceftests/display_unittest.cc index 4887e8ff2..b5ab624d4 100644 --- a/tests/ceftests/display_unittest.cc +++ b/tests/ceftests/display_unittest.cc @@ -176,14 +176,9 @@ class AutoResizeTestHandler : public RoutingTestHandler { bool OnAutoResize(CefRefPtr browser, const CefSize& new_size) override { -#if !defined(OS_MACOSX) - if (!got_auto_resize0_) { - got_auto_resize0_.yes(); - EXPECT_EQ(16, new_size.width); - EXPECT_EQ(10, new_size.height); - } else -#endif - if (!got_auto_resize1_) { + if (new_size.width == 16 && new_size.height == 10) { + // Ignore this initial resize that may or may not occur. + } else if (!got_auto_resize1_) { got_auto_resize1_.yes(); EXPECT_EQ(50, new_size.width); EXPECT_EQ(18, new_size.height); @@ -227,9 +222,6 @@ class AutoResizeTestHandler : public RoutingTestHandler { } void DestroyTest() override { -#if !defined(OS_MACOSX) - EXPECT_TRUE(got_auto_resize0_); -#endif EXPECT_TRUE(got_auto_resize1_); EXPECT_TRUE(got_auto_resize2_); EXPECT_TRUE(got_done_message_); @@ -237,7 +229,6 @@ class AutoResizeTestHandler : public RoutingTestHandler { } private: - TrackCallback got_auto_resize0_; TrackCallback got_auto_resize1_; TrackCallback got_auto_resize2_; TrackCallback got_done_message_; diff --git a/tests/ceftests/os_rendering_unittest.cc b/tests/ceftests/os_rendering_unittest.cc index 9819ed584..9885d0e60 100644 --- a/tests/ceftests/os_rendering_unittest.cc +++ b/tests/ceftests/os_rendering_unittest.cc @@ -82,7 +82,7 @@ const CefRect kNavigateButtonRect(375, 275, 130, 20); const CefRect kSelectRect(461, 21, 87, 26); const CefRect kExpandedSelectRect(463, 42, 75, 286); const CefRect kDropDivRect(9, 330, 52, 52); -const CefRect kDragDivRect(60, 330, 52, 52); +const CefRect kDragDivRect(60, 330, 30, 30); #elif defined(OS_LINUX) const CefRect kEditBoxRect(434, 246, 60, 20); const CefRect kNavigateButtonRect(380, 271, 140, 22); @@ -1019,15 +1019,9 @@ class OSRTestHandler : public RoutingTestHandler, if (image.get()) { // Drag image height seems to always be + 1px greater than the drag rect // on Linux. Therefore allow it to be +/- 1px. -#if defined(OS_MACOSX) - EXPECT_NEAR(static_cast(image->GetWidth()), GetScaledInt(15), 1); - EXPECT_NEAR(static_cast(image->GetHeight()), GetScaledInt(15), 1); -#else - EXPECT_NEAR(static_cast(image->GetWidth()), - GetScaledInt(kDragDivRect.width), 1); - EXPECT_NEAR(static_cast(image->GetHeight()), - GetScaledInt(kDragDivRect.height), 1); -#endif + EXPECT_NEAR(static_cast(image->GetWidth()), kDragDivRect.width, 1); + EXPECT_NEAR(static_cast(image->GetHeight()), kDragDivRect.height, + 1); } // During testing hotspot (x, y) was (15, 23) at 1x scale and (15, 18) at // 2x scale. Since the mechanism for determining this position is unclear diff --git a/tests/ceftests/task_unittest.cc b/tests/ceftests/task_unittest.cc index d4f7cdd6e..24a39cb73 100644 --- a/tests/ceftests/task_unittest.cc +++ b/tests/ceftests/task_unittest.cc @@ -3,6 +3,7 @@ // can be found in the LICENSE file. #include "include/base/cef_bind.h" +#include "include/cef_command_line.h" #include "include/cef_task.h" #include "include/wrapper/cef_closure_task.h" #include "tests/ceftests/test_handler.h" @@ -10,13 +11,22 @@ namespace { -void GetForCurrentThread(bool* ran_test) { +void WaitForEvent(CefRefPtr event) { + if (CefCommandLine::GetGlobalCommandLine()->HasSwitch( + "disable-test-timeout")) { + event->Wait(); + } else { + EXPECT_TRUE(event->TimedWait(1000)); + } +} + +void GetForCurrentThread(bool* ran_test, CefRefPtr event) { // Currently on the FILE thread. CefRefPtr runner = CefTaskRunner::GetForCurrentThread(); EXPECT_TRUE(runner.get()); EXPECT_TRUE(runner->BelongsToCurrentThread()); EXPECT_TRUE(runner->BelongsToThread(TID_FILE)); - EXPECT_FALSE(runner->BelongsToThread(TID_DB)); + EXPECT_FALSE(runner->BelongsToThread(TID_IO)); EXPECT_TRUE(runner->IsSame(runner)); CefRefPtr runner2 = CefTaskRunner::GetForCurrentThread(); @@ -24,25 +34,26 @@ void GetForCurrentThread(bool* ran_test) { EXPECT_TRUE(runner->IsSame(runner2)); EXPECT_TRUE(runner2->IsSame(runner)); - // Not on the DB thread. - CefRefPtr runner3 = CefTaskRunner::GetForThread(TID_DB); + // Not on the IO thread. + CefRefPtr runner3 = CefTaskRunner::GetForThread(TID_IO); EXPECT_TRUE(runner3.get()); EXPECT_FALSE(runner->IsSame(runner3)); EXPECT_FALSE(runner3->IsSame(runner)); *ran_test = true; + event->Signal(); } -void GetForThread(bool* ran_test) { +void GetForThread(bool* ran_test, CefRefPtr event) { // Currently on the FILE thread. - CefRefPtr runner = CefTaskRunner::GetForThread(TID_DB); + CefRefPtr runner = CefTaskRunner::GetForThread(TID_IO); EXPECT_TRUE(runner.get()); EXPECT_FALSE(runner->BelongsToCurrentThread()); - EXPECT_TRUE(runner->BelongsToThread(TID_DB)); + EXPECT_TRUE(runner->BelongsToThread(TID_IO)); EXPECT_FALSE(runner->BelongsToThread(TID_FILE)); EXPECT_TRUE(runner->IsSame(runner)); - CefRefPtr runner2 = CefTaskRunner::GetForThread(TID_DB); + CefRefPtr runner2 = CefTaskRunner::GetForThread(TID_IO); EXPECT_TRUE(runner2.get()); EXPECT_TRUE(runner->IsSame(runner2)); EXPECT_TRUE(runner2->IsSame(runner)); @@ -53,28 +64,31 @@ void GetForThread(bool* ran_test) { EXPECT_FALSE(runner3->IsSame(runner)); *ran_test = true; + event->Signal(); } -void PostTaskEvent1(bool* got_it, CefRefPtr runner) { - // Currently on the DB thread. +void PostTaskEvent1(bool* ran_test, + CefRefPtr event, + CefRefPtr runner) { + // Currently on the IO thread. EXPECT_TRUE(runner->BelongsToCurrentThread()); - EXPECT_TRUE(runner->BelongsToThread(TID_DB)); + EXPECT_TRUE(runner->BelongsToThread(TID_IO)); EXPECT_FALSE(runner->BelongsToThread(TID_FILE)); - // Current thread should be the DB thread. + // Current thread should be the IO thread. CefRefPtr runner2 = CefTaskRunner::GetForCurrentThread(); EXPECT_TRUE(runner2.get()); EXPECT_TRUE(runner2->BelongsToCurrentThread()); - EXPECT_TRUE(runner2->BelongsToThread(TID_DB)); + EXPECT_TRUE(runner2->BelongsToThread(TID_IO)); EXPECT_FALSE(runner2->BelongsToThread(TID_FILE)); EXPECT_TRUE(runner->IsSame(runner2)); EXPECT_TRUE(runner2->IsSame(runner)); - // Current thread should be the DB thread. - CefRefPtr runner3 = CefTaskRunner::GetForThread(TID_DB); + // Current thread should be the IO thread. + CefRefPtr runner3 = CefTaskRunner::GetForThread(TID_IO); EXPECT_TRUE(runner3.get()); EXPECT_TRUE(runner3->BelongsToCurrentThread()); - EXPECT_TRUE(runner3->BelongsToThread(TID_DB)); + EXPECT_TRUE(runner3->BelongsToThread(TID_IO)); EXPECT_FALSE(runner3->BelongsToThread(TID_FILE)); EXPECT_TRUE(runner->IsSame(runner3)); EXPECT_TRUE(runner3->IsSame(runner)); @@ -83,129 +97,121 @@ void PostTaskEvent1(bool* got_it, CefRefPtr runner) { CefRefPtr runner4 = CefTaskRunner::GetForThread(TID_FILE); EXPECT_TRUE(runner4.get()); EXPECT_FALSE(runner4->BelongsToCurrentThread()); - EXPECT_FALSE(runner4->BelongsToThread(TID_DB)); + EXPECT_FALSE(runner4->BelongsToThread(TID_IO)); EXPECT_TRUE(runner4->BelongsToThread(TID_FILE)); EXPECT_FALSE(runner->IsSame(runner4)); EXPECT_FALSE(runner4->IsSame(runner)); - *got_it = true; + *ran_test = true; + event->Signal(); } -void PostTask1(bool* ran_test) { +void PostTask1(bool* ran_test, CefRefPtr event) { // Currently on the FILE thread. - CefRefPtr runner = CefTaskRunner::GetForThread(TID_DB); + CefRefPtr runner = CefTaskRunner::GetForThread(TID_IO); EXPECT_TRUE(runner.get()); EXPECT_FALSE(runner->BelongsToCurrentThread()); - EXPECT_TRUE(runner->BelongsToThread(TID_DB)); + EXPECT_TRUE(runner->BelongsToThread(TID_IO)); - bool got_it = false; - runner->PostTask( - CefCreateClosureTask(base::Bind(&PostTaskEvent1, &got_it, runner))); - - WaitForThread(runner); - EXPECT_TRUE(got_it); - - *ran_test = true; + runner->PostTask(CefCreateClosureTask( + base::Bind(&PostTaskEvent1, ran_test, event, runner))); } -void PostDelayedTask1(bool* ran_test) { +void PostDelayedTask1(bool* ran_test, CefRefPtr event) { // Currently on the FILE thread. - CefRefPtr runner = CefTaskRunner::GetForThread(TID_DB); + CefRefPtr runner = CefTaskRunner::GetForThread(TID_IO); EXPECT_TRUE(runner.get()); EXPECT_FALSE(runner->BelongsToCurrentThread()); - EXPECT_TRUE(runner->BelongsToThread(TID_DB)); + EXPECT_TRUE(runner->BelongsToThread(TID_IO)); - bool got_it = false; - runner->PostDelayedTask( - CefCreateClosureTask(base::Bind(&PostTaskEvent1, &got_it, runner)), 0); - - WaitForThread(runner); - EXPECT_TRUE(got_it); - - *ran_test = true; + runner->PostDelayedTask(CefCreateClosureTask(base::Bind( + &PostTaskEvent1, ran_test, event, runner)), + 0); } -void PostTaskEvent2(bool* got_it) { - EXPECT_TRUE(CefCurrentlyOn(TID_DB)); +void PostTaskEvent2(bool* ran_test, CefRefPtr event) { + EXPECT_TRUE(CefCurrentlyOn(TID_IO)); EXPECT_FALSE(CefCurrentlyOn(TID_FILE)); - *got_it = true; -} - -void PostTask2(bool* ran_test) { - // Currently on the FILE thread. - EXPECT_FALSE(CefCurrentlyOn(TID_DB)); - - bool got_it = false; - CefPostTask(TID_DB, - CefCreateClosureTask(base::Bind(&PostTaskEvent2, &got_it))); - - WaitForThread(TID_DB); - EXPECT_TRUE(got_it); - *ran_test = true; + event->Signal(); } -void PostDelayedTask2(bool* ran_test) { +void PostTask2(bool* ran_test, CefRefPtr event) { // Currently on the FILE thread. - EXPECT_FALSE(CefCurrentlyOn(TID_DB)); + EXPECT_FALSE(CefCurrentlyOn(TID_IO)); + + CefPostTask(TID_IO, CefCreateClosureTask( + base::Bind(&PostTaskEvent2, ran_test, event))); +} + +void PostDelayedTask2(bool* ran_test, CefRefPtr event) { + // Currently on the FILE thread. + EXPECT_FALSE(CefCurrentlyOn(TID_IO)); - bool got_it = false; CefPostDelayedTask( - TID_DB, CefCreateClosureTask(base::Bind(&PostTaskEvent2, &got_it)), 0); - - WaitForThread(TID_DB); - EXPECT_TRUE(got_it); - - *ran_test = true; + TID_IO, + CefCreateClosureTask(base::Bind(&PostTaskEvent2, ran_test, event)), 0); } } // namespace TEST(TaskTest, GetForCurrentThread) { bool ran_test = false; - CefPostTask(TID_FILE, CefCreateClosureTask( - base::Bind(&GetForCurrentThread, &ran_test))); - WaitForThread(TID_FILE); + CefRefPtr event = + CefWaitableEvent::CreateWaitableEvent(true, false); + CefPostTask(TID_FILE, CefCreateClosureTask(base::Bind(&GetForCurrentThread, + &ran_test, event))); + WaitForEvent(event); EXPECT_TRUE(ran_test); } TEST(TaskTest, GetForThread) { bool ran_test = false; - CefPostTask(TID_FILE, - CefCreateClosureTask(base::Bind(&GetForThread, &ran_test))); - WaitForThread(TID_FILE); + CefRefPtr event = + CefWaitableEvent::CreateWaitableEvent(true, false); + CefPostTask(TID_FILE, CefCreateClosureTask( + base::Bind(&GetForThread, &ran_test, event))); + WaitForEvent(event); EXPECT_TRUE(ran_test); } TEST(TaskTest, PostTask1) { bool ran_test = false; + CefRefPtr event = + CefWaitableEvent::CreateWaitableEvent(true, false); CefPostTask(TID_FILE, - CefCreateClosureTask(base::Bind(&PostTask1, &ran_test))); - WaitForThread(TID_FILE); + CefCreateClosureTask(base::Bind(&PostTask1, &ran_test, event))); + WaitForEvent(event); EXPECT_TRUE(ran_test); } TEST(TaskTest, PostDelayedTask1) { bool ran_test = false; - CefPostTask(TID_FILE, - CefCreateClosureTask(base::Bind(&PostDelayedTask1, &ran_test))); - WaitForThread(TID_FILE); + CefRefPtr event = + CefWaitableEvent::CreateWaitableEvent(true, false); + CefPostTask(TID_FILE, CefCreateClosureTask( + base::Bind(&PostDelayedTask1, &ran_test, event))); + WaitForEvent(event); EXPECT_TRUE(ran_test); } TEST(TaskTest, PostTask2) { bool ran_test = false; + CefRefPtr event = + CefWaitableEvent::CreateWaitableEvent(true, false); CefPostTask(TID_FILE, - CefCreateClosureTask(base::Bind(&PostTask2, &ran_test))); - WaitForThread(TID_FILE); + CefCreateClosureTask(base::Bind(&PostTask2, &ran_test, event))); + WaitForEvent(event); EXPECT_TRUE(ran_test); } TEST(TaskTest, PostDelayedTask2) { bool ran_test = false; - CefPostTask(TID_FILE, - CefCreateClosureTask(base::Bind(&PostDelayedTask2, &ran_test))); - WaitForThread(TID_FILE); + CefRefPtr event = + CefWaitableEvent::CreateWaitableEvent(true, false); + CefPostTask(TID_FILE, CefCreateClosureTask( + base::Bind(&PostDelayedTask2, &ran_test, event))); + WaitForEvent(event); EXPECT_TRUE(ran_test); } diff --git a/tests/ceftests/thread_helper.h b/tests/ceftests/thread_helper.h index 3c586fc22..abc332b3a 100644 --- a/tests/ceftests/thread_helper.h +++ b/tests/ceftests/thread_helper.h @@ -20,10 +20,10 @@ void WaitForThread(CefRefPtr task_runner, int64 delay_ms = 0); #define WaitForIOThread() WaitForThread(TID_IO) #define WaitForUIThread() WaitForThread(TID_UI) -#define WaitForDBThread() WaitForThread(TID_DB) +#define WaitForFILEThread() WaitForThread(TID_FILE) #define WaitForIOThreadWithDelay(delay_ms) WaitForThread(TID_IO, delay_ms) #define WaitForUIThreadWithDelay(delay_ms) WaitForThread(TID_UI, delay_ms) -#define WaitForDBThreadWithDelay(delay_ms) WaitForThread(TID_DB, delay_ms) +#define WaitForFILEThreadWithDelay(delay_ms) WaitForThread(TID_FILE, delay_ms) // Assert that execution is occuring on the named thread. #define EXPECT_UI_THREAD() EXPECT_TRUE(CefCurrentlyOn(TID_UI)); diff --git a/tests/ceftests/tracing_unittest.cc b/tests/ceftests/tracing_unittest.cc index d060b7054..c19e6495d 100644 --- a/tests/ceftests/tracing_unittest.cc +++ b/tests/ceftests/tracing_unittest.cc @@ -290,6 +290,7 @@ class TracingTestHandler : public CefEndTracingCallback, case TT_TRACE_EVENT_ASYNC_END2: TRACE_EVENT_ASYNC_END2(kTraceTestCategory, "TT_TRACE_EVENT_ASYNC_END2", 100, "arg1", 1, "arg2", 2); + break; case TT_TRACE_EVENT_COPY_ASYNC_END0: TRACE_EVENT_COPY_ASYNC_END0(kTraceTestCategory, "TT_TRACE_EVENT_COPY_ASYNC_END0", 100); diff --git a/tests/ceftests/urlrequest_unittest.cc b/tests/ceftests/urlrequest_unittest.cc index b04476a9e..73903866f 100644 --- a/tests/ceftests/urlrequest_unittest.cc +++ b/tests/ceftests/urlrequest_unittest.cc @@ -313,30 +313,26 @@ void GetUploadData(CefRefPtr request, std::string& data) { // Set a cookie so that we can test if it's sent with the request. void SetTestCookie(CefRefPtr request_context, - bool server_backend) { - EXPECT_TRUE(CefCurrentlyOn(TID_FILE)); - + bool server_backend, + const base::Closure& callback) { class Callback : public CefSetCookieCallback { public: - explicit Callback(CefRefPtr event) : event_(event) { - EXPECT_TRUE(event_); + explicit Callback(const base::Closure& callback) : callback_(callback) { + EXPECT_FALSE(callback_.is_null()); } void OnComplete(bool success) override { EXPECT_TRUE(success); - event_->Signal(); - event_ = nullptr; + callback_.Run(); + callback_.Reset(); } private: - CefRefPtr event_; + base::Closure callback_; IMPLEMENT_REFCOUNTING(Callback); }; - CefRefPtr event = - CefWaitableEvent::CreateWaitableEvent(false, false); - CefCookie cookie; CefString(&cookie.name) = kRequestSendCookieName; CefString(&cookie.value) = "send-cookie-value"; @@ -344,27 +340,23 @@ void SetTestCookie(CefRefPtr request_context, CefString(&cookie.path) = "/"; cookie.has_expires = false; EXPECT_TRUE(request_context->GetDefaultCookieManager(NULL)->SetCookie( - GetRequestOrigin(server_backend), cookie, new Callback(event))); - - // Wait for the Callback. - event->TimedWait(2000); - EXPECT_TRUE(event->IsSignaled()); + GetRequestOrigin(server_backend), cookie, new Callback(callback))); } +typedef base::Callback GetTestCookieCallback; + // Tests if the save cookie has been set. If set, it will be deleted at the same // time. void GetTestCookie(CefRefPtr request_context, - bool* cookie_exists, - bool server_backend) { - EXPECT_TRUE(CefCurrentlyOn(TID_FILE)); - + bool server_backend, + const GetTestCookieCallback& callback) { class Visitor : public CefCookieVisitor { public: - Visitor(CefRefPtr event, bool* cookie_exists) - : event_(event), cookie_exists_(cookie_exists) { - EXPECT_TRUE(event_); + explicit Visitor(const GetTestCookieCallback& callback) + : callback_(callback), cookie_exists_(false) { + EXPECT_FALSE(callback_.is_null()); } - ~Visitor() override { event_->Signal(); } + ~Visitor() override { callback_.Run(cookie_exists_); } bool Visit(const CefCookie& cookie, int count, @@ -372,7 +364,7 @@ void GetTestCookie(CefRefPtr request_context, bool& deleteCookie) override { std::string cookie_name = CefString(&cookie.name); if (cookie_name == kRequestSaveCookieName) { - *cookie_exists_ = true; + cookie_exists_ = true; deleteCookie = true; return false; } @@ -380,23 +372,16 @@ void GetTestCookie(CefRefPtr request_context, } private: - CefRefPtr event_; - bool* cookie_exists_; + GetTestCookieCallback callback_; + bool cookie_exists_; IMPLEMENT_REFCOUNTING(Visitor); }; - CefRefPtr event = - CefWaitableEvent::CreateWaitableEvent(false, false); - CefRefPtr cookie_manager = request_context->GetDefaultCookieManager(NULL); cookie_manager->VisitUrlCookies(GetRequestOrigin(server_backend), true, - new Visitor(event, cookie_exists)); - - // Wait for the Visitor. - event->TimedWait(2000); - EXPECT_TRUE(event->IsSignaled()); + new Visitor(callback)); } std::string GetHeaderValue(const CefRequest::HeaderMap& header_map, @@ -1996,22 +1981,16 @@ class RequestTestHandler : public TestHandler { // Browser process setup is complete. void OnSetupComplete() { // Start post-setup actions. - CefPostTask(TID_FILE, - base::Bind(&RequestTestHandler::PostSetupFileTasks, this)); - } - - void PostSetupFileTasks() { - EXPECT_TRUE(CefCurrentlyOn(TID_FILE)); - - // Don't use WaitableEvent on the UI thread. - SetTestCookie(test_runner_->GetRequestContext(), test_server_backend_); - - CefPostTask(TID_UI, - base::Bind(&RequestTestHandler::PostSetupComplete, this)); + SetTestCookie(test_runner_->GetRequestContext(), test_server_backend_, + base::Bind(&RequestTestHandler::PostSetupComplete, this)); } void PostSetupComplete() { - EXPECT_TRUE(CefCurrentlyOn(TID_UI)); + if (!CefCurrentlyOn(TID_UI)) { + CefPostTask(TID_UI, + base::Bind(&RequestTestHandler::PostSetupComplete, this)); + return; + } if (test_in_browser_) { // Run the test now. @@ -2064,25 +2043,19 @@ class RequestTestHandler : public TestHandler { // Test run is complete. It ran in either the browser or render process. void OnRunComplete() { - CefPostTask(TID_FILE, - base::Bind(&RequestTestHandler::PostRunFileTasks, this)); + GetTestCookie(test_runner_->GetRequestContext(), test_server_backend_, + base::Bind(&RequestTestHandler::PostRunComplete, this)); } - void PostRunFileTasks() { - EXPECT_TRUE(CefCurrentlyOn(TID_FILE)); + void PostRunComplete(bool has_save_cookie) { + if (!CefCurrentlyOn(TID_UI)) { + CefPostTask(TID_UI, base::Bind(&RequestTestHandler::PostRunComplete, this, + has_save_cookie)); + return; + } - // Don't use WaitableEvent on the UI thread. - bool has_save_cookie = false; - GetTestCookie(test_runner_->GetRequestContext(), &has_save_cookie, - test_server_backend_); EXPECT_EQ(test_runner_->settings_.expect_save_cookie, has_save_cookie); - CefPostTask(TID_UI, base::Bind(&RequestTestHandler::PostRunComplete, this)); - } - - void PostRunComplete() { - EXPECT_TRUE(CefCurrentlyOn(TID_UI)); - // Shut down the browser side of the test. test_runner_->ShutdownTest( base::Bind(&RequestTestHandler::DestroyTest, this)); diff --git a/tests/ceftests/webui_unittest.cc b/tests/ceftests/webui_unittest.cc index ea4977a39..a0fb3337a 100644 --- a/tests/ceftests/webui_unittest.cc +++ b/tests/ceftests/webui_unittest.cc @@ -60,14 +60,8 @@ class WebUITestHandler : public TestHandler { bool canGoBack, bool canGoForward) override { if (!isLoading) { - // Verify that we navigated to the expected URL. - std::string expected_url = expected_url_; - if (expected_url.empty()) - expected_url = url_list_[url_index_]; - EXPECT_STREQ(expected_url.c_str(), - browser->GetMainFrame()->GetURL().ToString().c_str()); - - NextNav(); + got_loading_state_done_.yes(); + NextNavIfDone(browser->GetMainFrame()->GetURL()); } } @@ -79,9 +73,11 @@ class WebUITestHandler : public TestHandler { got_load_error_.yes(); EXPECT_EQ(expected_error_code_, errorCode) << "failedUrl = " << failedUrl.ToString(); + NextNavIfDone(failedUrl); } void DestroyTest() override { + EXPECT_TRUE(got_loading_state_done_); if (expected_error_code_ == ERR_NONE) EXPECT_FALSE(got_load_error_); else @@ -90,12 +86,34 @@ class WebUITestHandler : public TestHandler { TestHandler::DestroyTest(); } + private: + void NextNavIfDone(const std::string& url) { + bool done = false; + if (expected_error_code_ == ERR_NONE) { + if (got_loading_state_done_) + done = true; + } else if (got_load_error_ && got_loading_state_done_) { + done = true; + } + + if (done) { + // Verify that we navigated to the expected URL. + std::string expected_url = expected_url_; + if (expected_url.empty()) + expected_url = url_list_[url_index_]; + EXPECT_STREQ(expected_url.c_str(), url.c_str()); + + NextNav(); + } + } + UrlList url_list_; size_t url_index_; std::string expected_url_; int expected_error_code_; + TrackCallback got_loading_state_done_; TrackCallback got_load_error_; IMPLEMENT_REFCOUNTING(WebUITestHandler); @@ -131,7 +149,6 @@ TEST(WebUITest, network_error) { // -310 is ERR_TOO_MANY_REDIRECTS url_list.push_back("chrome://network-error/-310"); CefRefPtr handler = new WebUITestHandler(url_list); - handler->set_expected_url("chrome-error://chromewebdata/"); handler->set_expected_error_code(ERR_TOO_MANY_REDIRECTS); handler->ExecuteTest(); ReleaseAndWaitForDestructor(handler); @@ -178,7 +195,6 @@ WEBUI_TEST(serviceworker_internals); WEBUI_TEST(system); WEBUI_TEST(tracing); WEBUI_TEST(version); -WEBUI_TEST(view_http_cache); WEBUI_TEST(webrtc_internals); WEBUI_TEST(webui_hosts);