diff --git a/BUILD.gn b/BUILD.gn index 9bdda78bf..63cf58e85 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -407,6 +407,16 @@ test("libcef_static_unittests") { static_library("libcef_static") { sources = includes_common + gypi_paths.autogen_cpp_includes + [ + "libcef/browser/alloy/alloy_browser_main.cc", + "libcef/browser/alloy/alloy_browser_main.h", + "libcef/browser/alloy/chrome_browser_process_alloy.cc", + "libcef/browser/alloy/chrome_browser_process_alloy.h", + "libcef/browser/alloy/chrome_profile_manager_alloy.cc", + "libcef/browser/alloy/chrome_profile_manager_alloy.h", + "libcef/browser/alloy/chrome_profile_alloy.cc", + "libcef/browser/alloy/chrome_profile_alloy.h", + "libcef/browser/alloy/alloy_content_browser_client.cc", + "libcef/browser/alloy/alloy_content_browser_client.h", "libcef/browser/audio_capturer.cc", "libcef/browser/audio_capturer.h", "libcef/browser/browser_context.cc", @@ -419,8 +429,6 @@ static_library("libcef_static") { "libcef/browser/browser_info.h", "libcef/browser/browser_info_manager.cc", "libcef/browser/browser_info_manager.h", - "libcef/browser/browser_main.cc", - "libcef/browser/browser_main.h", "libcef/browser/browser_message_filter.cc", "libcef/browser/browser_message_filter.h", "libcef/browser/browser_message_loop.cc", @@ -434,15 +442,7 @@ static_library("libcef_static") { "libcef/browser/chrome/chrome_browser_main_extra_parts_cef.h", "libcef/browser/chrome/chrome_content_browser_client_cef.cc", "libcef/browser/chrome/chrome_content_browser_client_cef.h", - "libcef/browser/chrome_browser_process_stub.cc", - "libcef/browser/chrome_browser_process_stub.h", "libcef/browser/chrome_crash_reporter_client_stub.cc", - "libcef/browser/chrome_profile_manager_stub.cc", - "libcef/browser/chrome_profile_manager_stub.h", - "libcef/browser/chrome_profile_stub.cc", - "libcef/browser/chrome_profile_stub.h", - "libcef/browser/content_browser_client.cc", - "libcef/browser/content_browser_client.h", "libcef/browser/context.cc", "libcef/browser/context.h", "libcef/browser/context_menu_params_impl.cc", @@ -642,6 +642,12 @@ static_library("libcef_static") { "libcef/browser/xml_reader_impl.h", "libcef/browser/zip_reader_impl.cc", "libcef/browser/zip_reader_impl.h", + "libcef/common/alloy/alloy_content_client.cc", + "libcef/common/alloy/alloy_content_client.h", + "libcef/common/alloy/alloy_main_delegate.cc", + "libcef/common/alloy/alloy_main_delegate.h", + "libcef/common/alloy/alloy_main_runner_delegate.cc", + "libcef/common/alloy/alloy_main_runner_delegate.h", "libcef/common/base_impl.cc", "libcef/common/cef_message_generator.cc", "libcef/common/cef_message_generator.h", @@ -655,8 +661,6 @@ static_library("libcef_static") { "libcef/common/chrome/chrome_main_runner_delegate.h", "libcef/common/command_line_impl.cc", "libcef/common/command_line_impl.h", - "libcef/common/content_client.cc", - "libcef/common/content_client.h", "libcef/common/crash_reporter_client.cc", "libcef/common/crash_reporter_client.h", "libcef/common/crash_reporting.cc", @@ -675,8 +679,6 @@ static_library("libcef_static") { "libcef/common/frame_util.cc", "libcef/common/frame_util.h", "libcef/common/json_impl.cc", - "libcef/common/main_delegate.cc", - "libcef/common/main_delegate.h", "libcef/common/main_runner_delegate.h", "libcef/common/main_runner_handler.h", "libcef/common/net/http_header_utils.cc", @@ -731,11 +733,11 @@ static_library("libcef_static") { "libcef/common/waitable_event_impl.h", "libcef/common/widevine_loader.cc", "libcef/common/widevine_loader.h", - "libcef/features/chrome_cef.h", + "libcef/features/runtime.h", + "libcef/renderer/alloy/alloy_content_renderer_client.cc", + "libcef/renderer/alloy/alloy_content_renderer_client.h", "libcef/renderer/browser_impl.cc", "libcef/renderer/browser_impl.h", - "libcef/renderer/content_renderer_client.cc", - "libcef/renderer/content_renderer_client.h", "libcef/renderer/dom_document_impl.cc", "libcef/renderer/dom_document_impl.h", "libcef/renderer/dom_node_impl.cc", @@ -899,7 +901,7 @@ static_library("libcef_static") { if (is_win) { sources += includes_win + [ - "libcef/browser/browser_main_win.cc", + "libcef/browser/alloy/alloy_browser_main_win.cc", "libcef/browser/native/browser_platform_delegate_native_win.cc", "libcef/browser/native/browser_platform_delegate_native_win.h", "libcef/browser/native/file_dialog_runner_win.cc", diff --git a/libcef/browser/browser_main.cc b/libcef/browser/alloy/alloy_browser_main.cc similarity index 91% rename from libcef/browser/browser_main.cc rename to libcef/browser/alloy/alloy_browser_main.cc index b7567c3a1..aea468c96 100644 --- a/libcef/browser/browser_main.cc +++ b/libcef/browser/alloy/alloy_browser_main.cc @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "libcef/browser/browser_main.h" +#include "libcef/browser/alloy/alloy_browser_main.h" #include #include +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/browser_context.h" #include "libcef/browser/browser_context_keyed_service_factories.h" -#include "libcef/browser/content_browser_client.h" #include "libcef/browser/context.h" #include "libcef/browser/devtools/devtools_manager_delegate.h" #include "libcef/browser/extensions/extension_system_factory.h" @@ -74,15 +74,15 @@ #include "libcef/browser/printing/print_dialog_linux.h" #endif -CefBrowserMainParts::CefBrowserMainParts( +AlloyBrowserMainParts::AlloyBrowserMainParts( const content::MainFunctionParams& parameters) : BrowserMainParts(), devtools_delegate_(nullptr) {} -CefBrowserMainParts::~CefBrowserMainParts() { +AlloyBrowserMainParts::~AlloyBrowserMainParts() { constrained_window::SetConstrainedWindowViewsClient(nullptr); } -int CefBrowserMainParts::PreEarlyInitialization() { +int AlloyBrowserMainParts::PreEarlyInitialization() { #if defined(USE_AURA) && defined(OS_LINUX) // TODO(linux): Consider using a real input method or // views::LinuxUI::SetInstance. @@ -92,7 +92,7 @@ int CefBrowserMainParts::PreEarlyInitialization() { return service_manager::RESULT_CODE_NORMAL_EXIT; } -void CefBrowserMainParts::ToolkitInitialized() { +void AlloyBrowserMainParts::ToolkitInitialized() { SetConstrainedWindowViewsClient(CreateCefConstrainedWindowViewsClient()); #if defined(USE_AURA) CHECK(aura::Env::GetInstance()); @@ -101,7 +101,7 @@ void CefBrowserMainParts::ToolkitInitialized() { #if defined(OS_WIN) ui::CursorLoaderWin::SetCursorResourceModule( - CefContentBrowserClient::Get()->GetResourceDllName()); + AlloyContentBrowserClient::Get()->GetResourceDllName()); #endif #endif // defined(USE_AURA) @@ -115,7 +115,7 @@ void CefBrowserMainParts::ToolkitInitialized() { #endif // defined(TOOLKIT_VIEWS) } -void CefBrowserMainParts::PreMainMessageLoopStart() { +void AlloyBrowserMainParts::PreMainMessageLoopStart() { #if defined(USE_AURA) && defined(USE_X11) ui::TouchFactory::SetTouchDeviceListFromCommandLine(); #endif @@ -133,7 +133,7 @@ void CefBrowserMainParts::PreMainMessageLoopStart() { #endif // defined(OS_WIN) } -void CefBrowserMainParts::PostMainMessageLoopStart() { +void AlloyBrowserMainParts::PostMainMessageLoopStart() { #if defined(OS_LINUX) printing::PrintingContextLinux::SetCreatePrintDialogFunction( &CefPrintDialogLinux::CreatePrintDialog); @@ -142,7 +142,7 @@ void CefBrowserMainParts::PostMainMessageLoopStart() { #endif } -int CefBrowserMainParts::PreCreateThreads() { +int AlloyBrowserMainParts::PreCreateThreads() { #if defined(OS_WIN) PlatformInitialize(); #endif @@ -157,7 +157,7 @@ int CefBrowserMainParts::PreCreateThreads() { return 0; } -void CefBrowserMainParts::PreMainMessageLoopRun() { +void AlloyBrowserMainParts::PreMainMessageLoopRun() { #if defined(USE_AURA) display::Screen::SetScreenInstance(views::CreateDesktopScreen()); #endif @@ -213,7 +213,7 @@ void CefBrowserMainParts::PreMainMessageLoopRun() { scheme::RegisterWebUIControllerFactory(); } -void CefBrowserMainParts::PostMainMessageLoopRun() { +void AlloyBrowserMainParts::PostMainMessageLoopRun() { // NOTE: Destroy objects in reverse order of creation. CefDevToolsManagerDelegate::StopHttpHandler(); @@ -223,7 +223,7 @@ void CefBrowserMainParts::PostMainMessageLoopRun() { global_request_context_ = nullptr; } -void CefBrowserMainParts::PostDestroyThreads() { +void AlloyBrowserMainParts::PostDestroyThreads() { if (extensions::ExtensionsEnabled()) { extensions::ExtensionsBrowserClient::Set(nullptr); extensions_browser_client_.reset(); diff --git a/libcef/browser/browser_main.h b/libcef/browser/alloy/alloy_browser_main.h similarity index 87% rename from libcef/browser/browser_main.h rename to libcef/browser/alloy/alloy_browser_main.h index 582769787..58048a94e 100644 --- a/libcef/browser/browser_main.h +++ b/libcef/browser/alloy/alloy_browser_main.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_ -#define CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_ +#ifndef CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_ +#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_ #pragma once #include "libcef/browser/request_context_impl.h" @@ -35,15 +35,15 @@ class ViewsDelegate; #if defined(OS_MACOSX) class LayoutProvider; #endif -} +} // namespace views #endif // defined(TOOLKIT_VIEWS) class CefDevToolsDelegate; -class CefBrowserMainParts : public content::BrowserMainParts { +class AlloyBrowserMainParts : public content::BrowserMainParts { public: - explicit CefBrowserMainParts(const content::MainFunctionParams& parameters); - ~CefBrowserMainParts() override; + explicit AlloyBrowserMainParts(const content::MainFunctionParams& parameters); + ~AlloyBrowserMainParts() override; int PreEarlyInitialization() override; void ToolkitInitialized() override; @@ -101,7 +101,7 @@ class CefBrowserMainParts : public content::BrowserMainParts { #endif #endif // defined(TOOLKIT_VIEWS) - DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts); + DISALLOW_COPY_AND_ASSIGN(AlloyBrowserMainParts); }; -#endif // CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_ +#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_ diff --git a/libcef/browser/browser_main_win.cc b/libcef/browser/alloy/alloy_browser_main_win.cc similarity index 85% rename from libcef/browser/browser_main_win.cc rename to libcef/browser/alloy/alloy_browser_main_win.cc index 272fcbddc..ac3cbc140 100644 --- a/libcef/browser/browser_main_win.cc +++ b/libcef/browser/alloy/alloy_browser_main_win.cc @@ -6,11 +6,11 @@ #include #include -#include "libcef/browser/browser_main.h" +#include "libcef/browser/alloy/alloy_browser_main.h" #include "base/logging.h" -void CefBrowserMainParts::PlatformInitialize() { +void AlloyBrowserMainParts::PlatformInitialize() { HRESULT res; // Initialize common controls. diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/alloy/alloy_content_browser_client.cc similarity index 91% rename from libcef/browser/content_browser_client.cc rename to libcef/browser/alloy/alloy_content_browser_client.cc index 6591f91a3..b52b4d2c1 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/alloy/alloy_content_browser_client.cc @@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "libcef/browser/content_browser_client.h" +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include #include #include "include/cef_version.h" +#include "libcef/browser/alloy/alloy_browser_main.h" #include "libcef/browser/browser_context.h" #include "libcef/browser/browser_host_impl.h" #include "libcef/browser/browser_info.h" #include "libcef/browser/browser_info_manager.h" -#include "libcef/browser/browser_main.h" #include "libcef/browser/browser_message_filter.h" #include "libcef/browser/browser_platform_delegate.h" #include "libcef/browser/context.h" @@ -31,10 +31,10 @@ #include "libcef/browser/ssl_info_impl.h" #include "libcef/browser/thread_util.h" #include "libcef/browser/x509_certificate_impl.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "libcef/common/cef_messages.h" #include "libcef/common/cef_switches.h" #include "libcef/common/command_line_impl.h" -#include "libcef/common/content_client.h" #include "libcef/common/extensions/extensions_util.h" #include "libcef/common/net/scheme_registration.h" #include "libcef/common/request_impl.h" @@ -386,7 +386,7 @@ breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost( { ANNOTATE_SCOPED_MEMORY_LEAK; // Uploads will only occur if a non-empty crash URL is specified in - // CefMainDelegate::InitCrashReporter. + // AlloyMainDelegate::InitCrashReporter. breakpad::CrashHandlerHostLinux* crash_handler = new breakpad::CrashHandlerHostLinux(process_type, dumps_path, true /* upload */); @@ -533,30 +533,30 @@ void PopulateChromeFrameBinders( } // namespace -CefContentBrowserClient::CefContentBrowserClient() { +AlloyContentBrowserClient::AlloyContentBrowserClient() { plugin_service_filter_.reset(new CefPluginServiceFilter); content::PluginServiceImpl::GetInstance()->SetFilter( plugin_service_filter_.get()); } -CefContentBrowserClient::~CefContentBrowserClient() {} +AlloyContentBrowserClient::~AlloyContentBrowserClient() {} // static -CefContentBrowserClient* CefContentBrowserClient::Get() { - if (!CefContentClient::Get()) +AlloyContentBrowserClient* AlloyContentBrowserClient::Get() { + if (!AlloyContentClient::Get()) return nullptr; - return static_cast( - CefContentClient::Get()->browser()); + return static_cast( + AlloyContentClient::Get()->browser()); } std::unique_ptr -CefContentBrowserClient::CreateBrowserMainParts( +AlloyContentBrowserClient::CreateBrowserMainParts( const content::MainFunctionParams& parameters) { - browser_main_parts_ = new CefBrowserMainParts(parameters); + browser_main_parts_ = new AlloyBrowserMainParts(parameters); return base::WrapUnique(browser_main_parts_); } -void CefContentBrowserClient::RenderProcessWillLaunch( +void AlloyContentBrowserClient::RenderProcessWillLaunch( content::RenderProcessHost* host) { const int id = host->GetID(); Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); @@ -582,7 +582,7 @@ void CefContentBrowserClient::RenderProcessWillLaunch( ->InitializeRenderer(host); } -bool CefContentBrowserClient::ShouldUseProcessPerSite( +bool AlloyContentBrowserClient::ShouldUseProcessPerSite( content::BrowserContext* browser_context, const GURL& effective_url) { if (!extensions::ExtensionsEnabled()) @@ -611,7 +611,7 @@ bool CefContentBrowserClient::ShouldUseProcessPerSite( // Based on // ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess. -bool CefContentBrowserClient::DoesSiteRequireDedicatedProcess( +bool AlloyContentBrowserClient::DoesSiteRequireDedicatedProcess( content::BrowserContext* browser_context, const GURL& effective_site_url) { if (!extensions::ExtensionsEnabled()) @@ -625,7 +625,7 @@ bool CefContentBrowserClient::DoesSiteRequireDedicatedProcess( return extension != nullptr; } -void CefContentBrowserClient::OverrideURLLoaderFactoryParams( +void AlloyContentBrowserClient::OverrideURLLoaderFactoryParams( content::BrowserContext* browser_context, const url::Origin& origin, bool is_for_isolated_world, @@ -636,21 +636,21 @@ void CefContentBrowserClient::OverrideURLLoaderFactoryParams( } } -void CefContentBrowserClient::GetAdditionalWebUISchemes( +void AlloyContentBrowserClient::GetAdditionalWebUISchemes( std::vector* additional_schemes) { // Any schemes listed here are treated as WebUI schemes but do not get WebUI // bindings. Also, view-source is allowed for these schemes. WebUI schemes // will not be passed to HandleExternalProtocol. } -void CefContentBrowserClient::GetAdditionalViewSourceSchemes( +void AlloyContentBrowserClient::GetAdditionalViewSourceSchemes( std::vector* additional_schemes) { GetAdditionalWebUISchemes(additional_schemes); additional_schemes->push_back(extensions::kExtensionScheme); } -void CefContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( +void AlloyContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( std::vector* additional_allowed_schemes) { ContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( additional_allowed_schemes); @@ -658,12 +658,12 @@ void CefContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( additional_allowed_schemes->push_back(content::kChromeUIScheme); } -bool CefContentBrowserClient::IsWebUIAllowedToMakeNetworkRequests( +bool AlloyContentBrowserClient::IsWebUIAllowedToMakeNetworkRequests( const url::Origin& origin) { return scheme::IsWebUIAllowedToMakeNetworkRequests(origin); } -bool CefContentBrowserClient::IsHandledURL(const GURL& url) { +bool AlloyContentBrowserClient::IsHandledURL(const GURL& url) { if (!url.is_valid()) return false; const std::string& scheme = url.scheme(); @@ -672,10 +672,10 @@ bool CefContentBrowserClient::IsHandledURL(const GURL& url) { if (scheme::IsInternalHandledScheme(scheme)) return true; - return CefContentClient::Get()->HasCustomScheme(scheme); + return AlloyContentClient::Get()->HasCustomScheme(scheme); } -void CefContentBrowserClient::SiteInstanceGotProcess( +void AlloyContentBrowserClient::SiteInstanceGotProcess( content::SiteInstance* site_instance) { if (!extensions::ExtensionsEnabled()) return; @@ -699,7 +699,7 @@ void CefContentBrowserClient::SiteInstanceGotProcess( site_instance->GetId())); } -void CefContentBrowserClient::SiteInstanceDeleting( +void AlloyContentBrowserClient::SiteInstanceDeleting( content::SiteInstance* site_instance) { if (!extensions::ExtensionsEnabled()) return; @@ -731,7 +731,7 @@ void CefContentBrowserClient::SiteInstanceDeleting( site_instance->GetId())); } -void CefContentBrowserClient::BindHostReceiverForRenderer( +void AlloyContentBrowserClient::BindHostReceiverForRenderer( content::RenderProcessHost* render_process_host, mojo::GenericPendingReceiver receiver) { if (auto host_receiver = receiver.As()) { @@ -751,7 +751,7 @@ void CefContentBrowserClient::BindHostReceiverForRenderer( } base::Optional -CefContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) { +AlloyContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) { if (name == content::mojom::kBrowserServiceName) { return GetCefContentBrowserOverlayManifest(); } @@ -759,7 +759,7 @@ CefContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) { return base::nullopt; } -void CefContentBrowserClient::AppendExtraCommandLineSwitches( +void AlloyContentBrowserClient::AppendExtraCommandLineSwitches( base::CommandLine* command_line, int child_process_id) { const base::CommandLine* browser_cmd = base::CommandLine::ForCurrentProcess(); @@ -867,7 +867,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches( } #endif // defined(OS_LINUX) - CefRefPtr app = CefContentClient::Get()->application(); + CefRefPtr app = AlloyContentClient::Get()->application(); if (app.get()) { CefRefPtr handler = app->GetBrowserProcessHandler(); @@ -880,12 +880,12 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches( } } -std::string CefContentBrowserClient::GetApplicationLocale() { +std::string AlloyContentBrowserClient::GetApplicationLocale() { return g_browser_process->GetApplicationLocale(); } scoped_refptr -CefContentBrowserClient::GetSystemSharedURLLoaderFactory() { +AlloyContentBrowserClient::GetSystemSharedURLLoaderFactory() { DCHECK( content::BrowserThread::CurrentlyOn(content::BrowserThread::UI) || !content::BrowserThread::IsThreadInitialized(content::BrowserThread::UI)); @@ -898,23 +898,23 @@ CefContentBrowserClient::GetSystemSharedURLLoaderFactory() { } network::mojom::NetworkContext* -CefContentBrowserClient::GetSystemNetworkContext() { +AlloyContentBrowserClient::GetSystemNetworkContext() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); DCHECK(SystemNetworkContextManager::GetInstance()); return SystemNetworkContextManager::GetInstance()->GetContext(); } scoped_refptr -CefContentBrowserClient::CreateQuotaPermissionContext() { +AlloyContentBrowserClient::CreateQuotaPermissionContext() { return new CefQuotaPermissionContext(); } -content::MediaObserver* CefContentBrowserClient::GetMediaObserver() { +content::MediaObserver* AlloyContentBrowserClient::GetMediaObserver() { return CefMediaCaptureDevicesDispatcher::GetInstance(); } content::SpeechRecognitionManagerDelegate* -CefContentBrowserClient::CreateSpeechRecognitionManagerDelegate() { +AlloyContentBrowserClient::CreateSpeechRecognitionManagerDelegate() { const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kEnableSpeechInput)) @@ -924,7 +924,7 @@ CefContentBrowserClient::CreateSpeechRecognitionManagerDelegate() { } content::GeneratedCodeCacheSettings -CefContentBrowserClient::GetGeneratedCodeCacheSettings( +AlloyContentBrowserClient::GetGeneratedCodeCacheSettings( content::BrowserContext* context) { // If we pass 0 for size, disk_cache will pick a default size using the // heuristics based on available disk size. These are implemented in @@ -934,7 +934,7 @@ CefContentBrowserClient::GetGeneratedCodeCacheSettings( 0 /* size */, cache_path); } -void CefContentBrowserClient::AllowCertificateError( +void AlloyContentBrowserClient::AllowCertificateError( content::WebContents* web_contents, int cert_error, const net::SSLInfo& ssl_info, @@ -980,7 +980,7 @@ void CefContentBrowserClient::AllowCertificateError( } } -base::OnceClosure CefContentBrowserClient::SelectClientCertificate( +base::OnceClosure AlloyContentBrowserClient::SelectClientCertificate( content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, net::ClientCertIdentityList client_certs, @@ -1021,7 +1021,7 @@ base::OnceClosure CefContentBrowserClient::SelectClientCertificate( return base::OnceClosure(); } -bool CefContentBrowserClient::CanCreateWindow( +bool AlloyContentBrowserClient::CanCreateWindow( content::RenderFrameHost* opener, const GURL& opener_url, const GURL& opener_top_level_frame_url, @@ -1043,7 +1043,7 @@ bool CefContentBrowserClient::CanCreateWindow( user_gesture, opener_suppressed, no_javascript_access); } -void CefContentBrowserClient::OverrideWebkitPrefs( +void AlloyContentBrowserClient::OverrideWebkitPrefs( content::RenderViewHost* rvh, content::WebPreferences* prefs) { // Using RVH instead of RFH here because rvh->GetMainFrame() may be nullptr @@ -1056,16 +1056,16 @@ void CefContentBrowserClient::OverrideWebkitPrefs( } } -void CefContentBrowserClient::BrowserURLHandlerCreated( +void AlloyContentBrowserClient::BrowserURLHandlerCreated( content::BrowserURLHandler* handler) { scheme::BrowserURLHandlerCreated(handler); } -std::string CefContentBrowserClient::GetDefaultDownloadName() { +std::string AlloyContentBrowserClient::GetDefaultDownloadName() { return "download"; } -void CefContentBrowserClient::DidCreatePpapiPlugin( +void AlloyContentBrowserClient::DidCreatePpapiPlugin( content::BrowserPpapiHost* browser_host) { browser_host->GetPpapiHost()->AddHostFactoryFilter( std::unique_ptr( @@ -1073,12 +1073,12 @@ void CefContentBrowserClient::DidCreatePpapiPlugin( } content::DevToolsManagerDelegate* -CefContentBrowserClient::GetDevToolsManagerDelegate() { +AlloyContentBrowserClient::GetDevToolsManagerDelegate() { return new CefDevToolsManagerDelegate(); } std::vector> -CefContentBrowserClient::CreateThrottlesForNavigation( +AlloyContentBrowserClient::CreateThrottlesForNavigation( content::NavigationHandle* navigation_handle) { CEF_REQUIRE_UIT(); @@ -1111,7 +1111,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation( } std::vector> -CefContentBrowserClient::CreateURLLoaderThrottles( +AlloyContentBrowserClient::CreateURLLoaderThrottles( const network::ResourceRequest& request, content::BrowserContext* browser_context, const base::RepeatingCallback& wc_getter, @@ -1136,7 +1136,7 @@ CefContentBrowserClient::CreateURLLoaderThrottles( } #if defined(OS_LINUX) -void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess( +void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line, int child_process_id, content::PosixFileDescriptorInfo* mappings) { @@ -1148,7 +1148,7 @@ void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess( #endif // defined(OS_LINUX) #if defined(OS_WIN) -const wchar_t* CefContentBrowserClient::GetResourceDllName() { +const wchar_t* AlloyContentBrowserClient::GetResourceDllName() { static wchar_t file_path[MAX_PATH + 1] = {0}; if (file_path[0] == 0) { @@ -1164,13 +1164,13 @@ const wchar_t* CefContentBrowserClient::GetResourceDllName() { return file_path; } -bool CefContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy, - RendererSpawnFlags flags) { +bool AlloyContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy, + RendererSpawnFlags flags) { return true; } #endif // defined(OS_WIN) -void CefContentBrowserClient::ExposeInterfacesToRenderer( +void AlloyContentBrowserClient::ExposeInterfacesToRenderer( service_manager::BinderRegistry* registry, blink::AssociatedInterfaceRegistry* associated_registry, content::RenderProcessHost* host) { @@ -1179,7 +1179,7 @@ void CefContentBrowserClient::ExposeInterfacesToRenderer( } std::unique_ptr -CefContentBrowserClient::CreateClientCertStore( +AlloyContentBrowserClient::CreateClientCertStore( content::BrowserContext* browser_context) { // Match the logic in ProfileNetworkContextService::CreateClientCertStore. #if defined(USE_NSS_CERTS) @@ -1196,7 +1196,7 @@ CefContentBrowserClient::CreateClientCertStore( } std::unique_ptr -CefContentBrowserClient::CreateLoginDelegate( +AlloyContentBrowserClient::CreateLoginDelegate( const net::AuthChallengeInfo& auth_info, content::WebContents* web_contents, const content::GlobalRequestID& request_id, @@ -1210,7 +1210,7 @@ CefContentBrowserClient::CreateLoginDelegate( std::move(auth_required_callback)); } -void CefContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories( +void AlloyContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories( int frame_tree_node_id, NonNetworkURLLoaderFactoryMap* factories) { if (!extensions::ExtensionsEnabled()) @@ -1225,7 +1225,7 @@ void CefContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories( !!extensions::WebViewGuest::FromWebContents(web_contents))); } -void CefContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories( +void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories( int render_process_id, int render_frame_id, NonNetworkURLLoaderFactoryMap* factories) { @@ -1275,7 +1275,7 @@ void CefContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories( } } -bool CefContentBrowserClient::WillCreateURLLoaderFactory( +bool AlloyContentBrowserClient::WillCreateURLLoaderFactory( content::BrowserContext* browser_context, content::RenderFrameHost* frame, int render_process_id, @@ -1299,7 +1299,7 @@ bool CefContentBrowserClient::WillCreateURLLoaderFactory( return true; } -void CefContentBrowserClient::OnNetworkServiceCreated( +void AlloyContentBrowserClient::OnNetworkServiceCreated( network::mojom::NetworkService* network_service) { DCHECK(g_browser_process); PrefService* local_state = g_browser_process->local_state(); @@ -1311,7 +1311,7 @@ void CefContentBrowserClient::OnNetworkServiceCreated( network_service); } -void CefContentBrowserClient::ConfigureNetworkContextParams( +void AlloyContentBrowserClient::ConfigureNetworkContextParams( content::BrowserContext* context, bool in_memory, const base::FilePath& relative_partition_path, @@ -1329,7 +1329,7 @@ void CefContentBrowserClient::ConfigureNetworkContextParams( // The sandbox may block read/write access from the NetworkService to // directories that are not returned by this method. std::vector -CefContentBrowserClient::GetNetworkContextsParentDirectory() { +AlloyContentBrowserClient::GetNetworkContextsParentDirectory() { base::FilePath user_data_path; base::PathService::Get(chrome::DIR_USER_DATA, &user_data_path); DCHECK(!user_data_path.empty()); @@ -1345,7 +1345,7 @@ CefContentBrowserClient::GetNetworkContextsParentDirectory() { return {user_data_path, root_cache_path}; } -bool CefContentBrowserClient::HandleExternalProtocol( +bool AlloyContentBrowserClient::HandleExternalProtocol( const GURL& url, base::OnceCallback web_contents_getter, int child_id, @@ -1359,7 +1359,7 @@ bool CefContentBrowserClient::HandleExternalProtocol( return false; } -bool CefContentBrowserClient::HandleExternalProtocol( +bool AlloyContentBrowserClient::HandleExternalProtocol( content::WebContents::Getter web_contents_getter, int frame_tree_node_id, content::NavigationUIData* navigation_data, @@ -1397,7 +1397,7 @@ bool CefContentBrowserClient::HandleExternalProtocol( } std::unique_ptr -CefContentBrowserClient::CreateWindowForPictureInPicture( +AlloyContentBrowserClient::CreateWindowForPictureInPicture( content::PictureInPictureWindowController* controller) { // Note: content::OverlayWindow::Create() is defined by platform-specific // implementation in chrome/browser/ui/views. This layering hack, which goes @@ -1408,7 +1408,7 @@ CefContentBrowserClient::CreateWindowForPictureInPicture( return content::OverlayWindow::Create(controller); } -void CefContentBrowserClient::RegisterBrowserInterfaceBindersForFrame( +void AlloyContentBrowserClient::RegisterBrowserInterfaceBindersForFrame( content::RenderFrameHost* render_frame_host, mojo::BinderMapWithContext* map) { PopulateChromeFrameBinders(map); @@ -1438,25 +1438,25 @@ void CefContentBrowserClient::RegisterBrowserInterfaceBindersForFrame( } base::FilePath -CefContentBrowserClient::GetSandboxedStorageServiceDataDirectory() { +AlloyContentBrowserClient::GetSandboxedStorageServiceDataDirectory() { return GetRootCachePath(); } -std::string CefContentBrowserClient::GetProduct() { +std::string AlloyContentBrowserClient::GetProduct() { // Match the logic in chrome_content_browser_client.cc GetProduct(). return ::GetProduct(); } -std::string CefContentBrowserClient::GetChromeProduct() { +std::string AlloyContentBrowserClient::GetChromeProduct() { return version_info::GetProductNameAndVersionForUserAgent(); } -std::string CefContentBrowserClient::GetUserAgent() { +std::string AlloyContentBrowserClient::GetUserAgent() { // Match the logic in chrome_content_browser_client.cc GetUserAgent(). return ::GetUserAgent(); } -blink::UserAgentMetadata CefContentBrowserClient::GetUserAgentMetadata() { +blink::UserAgentMetadata AlloyContentBrowserClient::GetUserAgentMetadata() { blink::UserAgentMetadata metadata; metadata.brand_version_list = {blink::UserAgentBrandVersion{ @@ -1472,7 +1472,7 @@ blink::UserAgentMetadata CefContentBrowserClient::GetUserAgentMetadata() { } base::flat_set -CefContentBrowserClient::GetPluginMimeTypesWithExternalHandlers( +AlloyContentBrowserClient::GetPluginMimeTypesWithExternalHandlers( content::BrowserContext* browser_context) { base::flat_set mime_types; auto map = PluginUtils::GetMimeTypeToExtensionIdMap(browser_context); @@ -1481,31 +1481,31 @@ CefContentBrowserClient::GetPluginMimeTypesWithExternalHandlers( return mime_types; } -CefRefPtr CefContentBrowserClient::request_context() +CefRefPtr AlloyContentBrowserClient::request_context() const { return browser_main_parts_->request_context(); } -CefDevToolsDelegate* CefContentBrowserClient::devtools_delegate() const { +CefDevToolsDelegate* AlloyContentBrowserClient::devtools_delegate() const { return browser_main_parts_->devtools_delegate(); } scoped_refptr -CefContentBrowserClient::background_task_runner() const { +AlloyContentBrowserClient::background_task_runner() const { return browser_main_parts_->background_task_runner(); } scoped_refptr -CefContentBrowserClient::user_visible_task_runner() const { +AlloyContentBrowserClient::user_visible_task_runner() const { return browser_main_parts_->user_visible_task_runner(); } scoped_refptr -CefContentBrowserClient::user_blocking_task_runner() const { +AlloyContentBrowserClient::user_blocking_task_runner() const { return browser_main_parts_->user_blocking_task_runner(); } -const extensions::Extension* CefContentBrowserClient::GetExtension( +const extensions::Extension* AlloyContentBrowserClient::GetExtension( content::SiteInstance* site_instance) { extensions::ExtensionRegistry* registry = extensions::ExtensionRegistry::Get(site_instance->GetBrowserContext()); diff --git a/libcef/browser/content_browser_client.h b/libcef/browser/alloy/alloy_content_browser_client.h similarity index 94% rename from libcef/browser/content_browser_client.h rename to libcef/browser/alloy/alloy_content_browser_client.h index 7c6860f25..f3762c2a1 100644 --- a/libcef/browser/content_browser_client.h +++ b/libcef/browser/alloy/alloy_content_browser_client.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CEF_LIBCEF_BROWSER_CONTENT_BROWSER_CLIENT_H_ -#define CEF_LIBCEF_BROWSER_CONTENT_BROWSER_CLIENT_H_ +#ifndef CEF_LIBCEF_BROWSER_ALLOY_ALLOY_CONTENT_BROWSER_CLIENT_H_ +#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_CONTENT_BROWSER_CLIENT_H_ #pragma once #include @@ -18,7 +18,7 @@ #include "content/public/browser/content_browser_client.h" #include "third_party/skia/include/core/SkColor.h" -class CefBrowserMainParts; +class AlloyBrowserMainParts; class CefDevToolsDelegate; namespace content { @@ -30,13 +30,13 @@ namespace extensions { class Extension; } -class CefContentBrowserClient : public content::ContentBrowserClient { +class AlloyContentBrowserClient : public content::ContentBrowserClient { public: - CefContentBrowserClient(); - ~CefContentBrowserClient() override; + AlloyContentBrowserClient(); + ~AlloyContentBrowserClient() override; - // Returns the singleton CefContentBrowserClient instance. - static CefContentBrowserClient* Get(); + // Returns the singleton AlloyContentBrowserClient instance. + static AlloyContentBrowserClient* Get(); // ContentBrowserClient implementation. std::unique_ptr CreateBrowserMainParts( @@ -224,9 +224,9 @@ class CefContentBrowserClient : public content::ContentBrowserClient { const extensions::Extension* GetExtension( content::SiteInstance* site_instance); - CefBrowserMainParts* browser_main_parts_ = nullptr; + AlloyBrowserMainParts* browser_main_parts_ = nullptr; std::unique_ptr plugin_service_filter_; }; -#endif // CEF_LIBCEF_BROWSER_CONTENT_BROWSER_CLIENT_H_ +#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_CONTENT_BROWSER_CLIENT_H_ diff --git a/libcef/browser/chrome_browser_process_stub.cc b/libcef/browser/alloy/chrome_browser_process_alloy.cc similarity index 67% rename from libcef/browser/chrome_browser_process_stub.cc rename to libcef/browser/alloy/chrome_browser_process_alloy.cc index 4559b3604..1e9231a4e 100644 --- a/libcef/browser/chrome_browser_process_stub.cc +++ b/libcef/browser/alloy/chrome_browser_process_alloy.cc @@ -3,10 +3,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "libcef/browser/chrome_browser_process_stub.h" +#include "libcef/browser/alloy/chrome_browser_process_alloy.h" +#include "libcef/browser/alloy/chrome_profile_manager_alloy.h" #include "libcef/browser/browser_context.h" -#include "libcef/browser/chrome_profile_manager_stub.h" #include "libcef/browser/context.h" #include "libcef/browser/prefs/browser_prefs.h" #include "libcef/browser/thread_util.h" @@ -27,17 +27,17 @@ #include "services/network/public/cpp/network_switches.h" #include "services/network/public/cpp/shared_url_loader_factory.h" -ChromeBrowserProcessStub::ChromeBrowserProcessStub() +ChromeBrowserProcessAlloy::ChromeBrowserProcessAlloy() : initialized_(false), context_initialized_(false), shutdown_(false), locale_("en-US") {} -ChromeBrowserProcessStub::~ChromeBrowserProcessStub() { +ChromeBrowserProcessAlloy::~ChromeBrowserProcessAlloy() { DCHECK((!initialized_ && !context_initialized_) || shutdown_); } -void ChromeBrowserProcessStub::Initialize() { +void ChromeBrowserProcessAlloy::Initialize() { DCHECK(!initialized_); DCHECK(!context_initialized_); DCHECK(!shutdown_); @@ -49,7 +49,7 @@ void ChromeBrowserProcessStub::Initialize() { initialized_ = true; } -void ChromeBrowserProcessStub::OnContextInitialized() { +void ChromeBrowserProcessAlloy::OnContextInitialized() { CEF_REQUIRE_UIT(); DCHECK(initialized_); DCHECK(!context_initialized_); @@ -57,12 +57,12 @@ void ChromeBrowserProcessStub::OnContextInitialized() { // Must be created after the NotificationService. print_job_manager_.reset(new printing::PrintJobManager()); - profile_manager_.reset(new ChromeProfileManagerStub()); + profile_manager_.reset(new ChromeProfileManagerAlloy()); event_router_forwarder_ = new extensions::EventRouterForwarder(); context_initialized_ = true; } -void ChromeBrowserProcessStub::CleanupOnUIThread() { +void ChromeBrowserProcessAlloy::CleanupOnUIThread() { CEF_REQUIRE_UIT(); DCHECK(initialized_); DCHECK(context_initialized_); @@ -107,54 +107,54 @@ void ChromeBrowserProcessStub::CleanupOnUIThread() { shutdown_ = true; } -void ChromeBrowserProcessStub::EndSession() { +void ChromeBrowserProcessAlloy::EndSession() { NOTREACHED(); } -void ChromeBrowserProcessStub::FlushLocalStateAndReply( +void ChromeBrowserProcessAlloy::FlushLocalStateAndReply( base::OnceClosure reply) { NOTREACHED(); } metrics_services_manager::MetricsServicesManager* -ChromeBrowserProcessStub::GetMetricsServicesManager() { +ChromeBrowserProcessAlloy::GetMetricsServicesManager() { NOTREACHED(); return nullptr; } -metrics::MetricsService* ChromeBrowserProcessStub::metrics_service() { +metrics::MetricsService* ChromeBrowserProcessAlloy::metrics_service() { NOTREACHED(); return nullptr; } -rappor::RapporServiceImpl* ChromeBrowserProcessStub::rappor_service() { +rappor::RapporServiceImpl* ChromeBrowserProcessAlloy::rappor_service() { // Called from PluginInfoHostImpl::ReportMetrics. return nullptr; } SystemNetworkContextManager* -ChromeBrowserProcessStub::system_network_context_manager() { +ChromeBrowserProcessAlloy::system_network_context_manager() { DCHECK(SystemNetworkContextManager::GetInstance()); return SystemNetworkContextManager::GetInstance(); } network::NetworkQualityTracker* -ChromeBrowserProcessStub::network_quality_tracker() { +ChromeBrowserProcessAlloy::network_quality_tracker() { NOTREACHED(); return nullptr; } -WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() { +WatchDogThread* ChromeBrowserProcessAlloy::watchdog_thread() { NOTREACHED(); return nullptr; } -ProfileManager* ChromeBrowserProcessStub::profile_manager() { +ProfileManager* ChromeBrowserProcessAlloy::profile_manager() { DCHECK(context_initialized_); return profile_manager_.get(); } -PrefService* ChromeBrowserProcessStub::local_state() { +PrefService* ChromeBrowserProcessAlloy::local_state() { DCHECK(initialized_); if (!local_state_) { // Use a location that is shared by all request contexts. @@ -173,40 +173,40 @@ PrefService* ChromeBrowserProcessStub::local_state() { } scoped_refptr -ChromeBrowserProcessStub::shared_url_loader_factory() { +ChromeBrowserProcessAlloy::shared_url_loader_factory() { NOTREACHED(); return nullptr; } -variations::VariationsService* ChromeBrowserProcessStub::variations_service() { +variations::VariationsService* ChromeBrowserProcessAlloy::variations_service() { NOTREACHED(); return nullptr; } -BrowserProcessPlatformPart* ChromeBrowserProcessStub::platform_part() { +BrowserProcessPlatformPart* ChromeBrowserProcessAlloy::platform_part() { NOTREACHED(); return nullptr; } extensions::EventRouterForwarder* -ChromeBrowserProcessStub::extension_event_router_forwarder() { +ChromeBrowserProcessAlloy::extension_event_router_forwarder() { DCHECK(context_initialized_); return event_router_forwarder_.get(); } -NotificationUIManager* ChromeBrowserProcessStub::notification_ui_manager() { +NotificationUIManager* ChromeBrowserProcessAlloy::notification_ui_manager() { NOTREACHED(); return nullptr; } NotificationPlatformBridge* -ChromeBrowserProcessStub::notification_platform_bridge() { +ChromeBrowserProcessAlloy::notification_platform_bridge() { NOTREACHED(); return nullptr; } policy::ChromeBrowserPolicyConnector* -ChromeBrowserProcessStub::browser_policy_connector() { +ChromeBrowserProcessAlloy::browser_policy_connector() { if (!browser_policy_connector_) { browser_policy_connector_ = std::make_unique(); @@ -214,40 +214,40 @@ ChromeBrowserProcessStub::browser_policy_connector() { return browser_policy_connector_.get(); } -policy::PolicyService* ChromeBrowserProcessStub::policy_service() { +policy::PolicyService* ChromeBrowserProcessAlloy::policy_service() { return browser_policy_connector()->GetPolicyService(); } -IconManager* ChromeBrowserProcessStub::icon_manager() { +IconManager* ChromeBrowserProcessAlloy::icon_manager() { NOTREACHED(); return nullptr; } -GpuModeManager* ChromeBrowserProcessStub::gpu_mode_manager() { +GpuModeManager* ChromeBrowserProcessAlloy::gpu_mode_manager() { NOTREACHED(); return nullptr; } -void ChromeBrowserProcessStub::CreateDevToolsProtocolHandler() { +void ChromeBrowserProcessAlloy::CreateDevToolsProtocolHandler() { NOTREACHED(); } -void ChromeBrowserProcessStub::CreateDevToolsAutoOpener() { +void ChromeBrowserProcessAlloy::CreateDevToolsAutoOpener() { NOTREACHED(); } -bool ChromeBrowserProcessStub::IsShuttingDown() { +bool ChromeBrowserProcessAlloy::IsShuttingDown() { NOTREACHED(); return false; } -printing::PrintJobManager* ChromeBrowserProcessStub::print_job_manager() { +printing::PrintJobManager* ChromeBrowserProcessAlloy::print_job_manager() { DCHECK(context_initialized_); return print_job_manager_.get(); } printing::PrintPreviewDialogController* -ChromeBrowserProcessStub::print_preview_dialog_controller() { +ChromeBrowserProcessAlloy::print_preview_dialog_controller() { if (!print_preview_dialog_controller_.get()) { print_preview_dialog_controller_ = new printing::PrintPreviewDialogController(); @@ -256,7 +256,7 @@ ChromeBrowserProcessStub::print_preview_dialog_controller() { } printing::BackgroundPrintingManager* -ChromeBrowserProcessStub::background_printing_manager() { +ChromeBrowserProcessAlloy::background_printing_manager() { if (!background_printing_manager_.get()) { background_printing_manager_.reset( new printing::BackgroundPrintingManager()); @@ -265,113 +265,114 @@ ChromeBrowserProcessStub::background_printing_manager() { } IntranetRedirectDetector* -ChromeBrowserProcessStub::intranet_redirect_detector() { +ChromeBrowserProcessAlloy::intranet_redirect_detector() { NOTREACHED(); return nullptr; } -const std::string& ChromeBrowserProcessStub::GetApplicationLocale() { +const std::string& ChromeBrowserProcessAlloy::GetApplicationLocale() { DCHECK(!locale_.empty()); return locale_; } -void ChromeBrowserProcessStub::SetApplicationLocale(const std::string& locale) { +void ChromeBrowserProcessAlloy::SetApplicationLocale( + const std::string& locale) { locale_ = locale; } -DownloadStatusUpdater* ChromeBrowserProcessStub::download_status_updater() { +DownloadStatusUpdater* ChromeBrowserProcessAlloy::download_status_updater() { NOTREACHED(); return nullptr; } -DownloadRequestLimiter* ChromeBrowserProcessStub::download_request_limiter() { +DownloadRequestLimiter* ChromeBrowserProcessAlloy::download_request_limiter() { NOTREACHED(); return nullptr; } #if BUILDFLAG(ENABLE_BACKGROUND_MODE) -BackgroundModeManager* ChromeBrowserProcessStub::background_mode_manager() { +BackgroundModeManager* ChromeBrowserProcessAlloy::background_mode_manager() { NOTREACHED(); return nullptr; } -void ChromeBrowserProcessStub::set_background_mode_manager_for_test( +void ChromeBrowserProcessAlloy::set_background_mode_manager_for_test( std::unique_ptr manager) { NOTREACHED(); } #endif -StatusTray* ChromeBrowserProcessStub::status_tray() { +StatusTray* ChromeBrowserProcessAlloy::status_tray() { NOTREACHED(); return nullptr; } safe_browsing::SafeBrowsingService* -ChromeBrowserProcessStub::safe_browsing_service() { +ChromeBrowserProcessAlloy::safe_browsing_service() { return nullptr; } subresource_filter::RulesetService* -ChromeBrowserProcessStub::subresource_filter_ruleset_service() { +ChromeBrowserProcessAlloy::subresource_filter_ruleset_service() { NOTREACHED(); return nullptr; } optimization_guide::OptimizationGuideService* -ChromeBrowserProcessStub::optimization_guide_service() { +ChromeBrowserProcessAlloy::optimization_guide_service() { NOTREACHED(); return nullptr; } -StartupData* ChromeBrowserProcessStub::startup_data() { +StartupData* ChromeBrowserProcessAlloy::startup_data() { NOTREACHED(); return nullptr; } #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) -void ChromeBrowserProcessStub::StartAutoupdateTimer() {} +void ChromeBrowserProcessAlloy::StartAutoupdateTimer() {} #endif component_updater::ComponentUpdateService* -ChromeBrowserProcessStub::component_updater() { +ChromeBrowserProcessAlloy::component_updater() { NOTREACHED(); return nullptr; } MediaFileSystemRegistry* -ChromeBrowserProcessStub::media_file_system_registry() { +ChromeBrowserProcessAlloy::media_file_system_registry() { NOTREACHED(); return nullptr; } -WebRtcLogUploader* ChromeBrowserProcessStub::webrtc_log_uploader() { +WebRtcLogUploader* ChromeBrowserProcessAlloy::webrtc_log_uploader() { NOTREACHED(); return nullptr; } network_time::NetworkTimeTracker* -ChromeBrowserProcessStub::network_time_tracker() { +ChromeBrowserProcessAlloy::network_time_tracker() { NOTREACHED(); return nullptr; } -gcm::GCMDriver* ChromeBrowserProcessStub::gcm_driver() { +gcm::GCMDriver* ChromeBrowserProcessAlloy::gcm_driver() { NOTREACHED(); return nullptr; } -resource_coordinator::TabManager* ChromeBrowserProcessStub::GetTabManager() { +resource_coordinator::TabManager* ChromeBrowserProcessAlloy::GetTabManager() { NOTREACHED(); return nullptr; } resource_coordinator::ResourceCoordinatorParts* -ChromeBrowserProcessStub::resource_coordinator_parts() { +ChromeBrowserProcessAlloy::resource_coordinator_parts() { NOTREACHED(); return nullptr; } -BuildState* ChromeBrowserProcessStub::GetBuildState() { +BuildState* ChromeBrowserProcessAlloy::GetBuildState() { NOTREACHED(); return nullptr; } diff --git a/libcef/browser/chrome_browser_process_stub.h b/libcef/browser/alloy/chrome_browser_process_alloy.h similarity index 90% rename from libcef/browser/chrome_browser_process_stub.h rename to libcef/browser/alloy/chrome_browser_process_alloy.h index 45f89afec..138c1b56d 100644 --- a/libcef/browser/chrome_browser_process_stub.h +++ b/libcef/browser/alloy/chrome_browser_process_alloy.h @@ -6,8 +6,8 @@ // This file provides a stub implementation of Chrome's BrowserProcess object // for use as an interop layer between CEF and files that live in chrome/. -#ifndef CEF_LIBCEF_BROWSER_CHROME_BROWSER_PROCESS_STUB_H_ -#define CEF_LIBCEF_BROWSER_CHROME_BROWSER_PROCESS_STUB_H_ +#ifndef CEF_LIBCEF_BROWSER_ALLOY_CHROME_BROWSER_PROCESS_ALLOY_H_ +#define CEF_LIBCEF_BROWSER_ALLOY_CHROME_BROWSER_PROCESS_ALLOY_H_ #include #include @@ -18,7 +18,7 @@ #include "chrome/browser/extensions/event_router_forwarder.h" #include "media/media_buildflags.h" -class ChromeProfileManagerStub; +class ChromeProfileManagerAlloy; class BackgroundModeManager { public: @@ -29,10 +29,10 @@ class BackgroundModeManager { DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); }; -class ChromeBrowserProcessStub : public BrowserProcess { +class ChromeBrowserProcessAlloy : public BrowserProcess { public: - ChromeBrowserProcessStub(); - ~ChromeBrowserProcessStub() override; + ChromeBrowserProcessAlloy(); + ~ChromeBrowserProcessAlloy() override; void Initialize(); void OnContextInitialized(); @@ -107,7 +107,7 @@ class ChromeBrowserProcessStub : public BrowserProcess { std::string locale_; std::unique_ptr print_job_manager_; - std::unique_ptr profile_manager_; + std::unique_ptr profile_manager_; scoped_refptr event_router_forwarder_; scoped_refptr print_preview_dialog_controller_; @@ -119,7 +119,7 @@ class ChromeBrowserProcessStub : public BrowserProcess { browser_policy_connector_; std::unique_ptr field_trial_list_; - DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProcessStub); + DISALLOW_COPY_AND_ASSIGN(ChromeBrowserProcessAlloy); }; -#endif // CEF_LIBCEF_BROWSER_CHROME_BROWSER_PROCESS_STUB_H_ +#endif // CEF_LIBCEF_BROWSER_ALLOY_CHROME_BROWSER_PROCESS_ALLOY_H_ diff --git a/libcef/browser/chrome_profile_stub.cc b/libcef/browser/alloy/chrome_profile_alloy.cc similarity index 55% rename from libcef/browser/chrome_profile_stub.cc rename to libcef/browser/alloy/chrome_profile_alloy.cc index ee7ba2ad1..686435052 100644 --- a/libcef/browser/chrome_profile_stub.cc +++ b/libcef/browser/alloy/chrome_profile_alloy.cc @@ -3,7 +3,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "libcef/browser/chrome_profile_stub.h" +#include "libcef/browser/alloy/chrome_profile_alloy.h" #include "components/variations/variations_client.h" #include "components/variations/variations_http_header_provider.h" @@ -34,144 +34,145 @@ class CefVariationsClient : public variations::VariationsClient { } // namespace -ChromeProfileStub::ChromeProfileStub() {} +ChromeProfileAlloy::ChromeProfileAlloy() {} -ChromeProfileStub::~ChromeProfileStub() {} +ChromeProfileAlloy::~ChromeProfileAlloy() {} -bool ChromeProfileStub::IsOffTheRecord() { +bool ChromeProfileAlloy::IsOffTheRecord() { return false; } -bool ChromeProfileStub::IsOffTheRecord() const { +bool ChromeProfileAlloy::IsOffTheRecord() const { return false; } -const Profile::OTRProfileID& ChromeProfileStub::GetOTRProfileID() const { +const Profile::OTRProfileID& ChromeProfileAlloy::GetOTRProfileID() const { NOTREACHED(); static base::NoDestructor otr_profile_id( "ProfileImp::NoOTRProfileID"); return *otr_profile_id; } -variations::VariationsClient* ChromeProfileStub::GetVariationsClient() { +variations::VariationsClient* ChromeProfileAlloy::GetVariationsClient() { if (!variations_client_) variations_client_ = std::make_unique(this); return variations_client_.get(); } -scoped_refptr ChromeProfileStub::GetIOTaskRunner() { +scoped_refptr ChromeProfileAlloy::GetIOTaskRunner() { NOTREACHED(); return scoped_refptr(); } -std::string ChromeProfileStub::GetProfileUserName() const { +std::string ChromeProfileAlloy::GetProfileUserName() const { NOTREACHED(); return std::string(); } -Profile::ProfileType ChromeProfileStub::GetProfileType() const { +Profile::ProfileType ChromeProfileAlloy::GetProfileType() const { return REGULAR_PROFILE; } -Profile* ChromeProfileStub::GetOffTheRecordProfile( +Profile* ChromeProfileAlloy::GetOffTheRecordProfile( const Profile::OTRProfileID& otr_profile_id) { NOTREACHED(); return nullptr; } -std::vector ChromeProfileStub::GetAllOffTheRecordProfiles() { +std::vector ChromeProfileAlloy::GetAllOffTheRecordProfiles() { NOTREACHED(); return {}; } -void ChromeProfileStub::DestroyOffTheRecordProfile(Profile* otr_profile) { +void ChromeProfileAlloy::DestroyOffTheRecordProfile(Profile* otr_profile) { NOTREACHED(); } -bool ChromeProfileStub::HasOffTheRecordProfile( +bool ChromeProfileAlloy::HasOffTheRecordProfile( const Profile::OTRProfileID& otr_profile_id) { return false; } -bool ChromeProfileStub::HasAnyOffTheRecordProfile() { +bool ChromeProfileAlloy::HasAnyOffTheRecordProfile() { return false; } -Profile* ChromeProfileStub::GetOriginalProfile() { +Profile* ChromeProfileAlloy::GetOriginalProfile() { return this; } -const Profile* ChromeProfileStub::GetOriginalProfile() const { +const Profile* ChromeProfileAlloy::GetOriginalProfile() const { return this; } -bool ChromeProfileStub::IsSupervised() const { +bool ChromeProfileAlloy::IsSupervised() const { return false; } -bool ChromeProfileStub::IsChild() const { +bool ChromeProfileAlloy::IsChild() const { return false; } -bool ChromeProfileStub::IsLegacySupervised() const { +bool ChromeProfileAlloy::IsLegacySupervised() const { return false; } ExtensionSpecialStoragePolicy* -ChromeProfileStub::GetExtensionSpecialStoragePolicy() { +ChromeProfileAlloy::GetExtensionSpecialStoragePolicy() { NOTREACHED(); return nullptr; } -PrefService* ChromeProfileStub::GetOffTheRecordPrefs() { +PrefService* ChromeProfileAlloy::GetOffTheRecordPrefs() { NOTREACHED(); return nullptr; } -bool ChromeProfileStub::IsSameProfile(Profile* profile) { +bool ChromeProfileAlloy::IsSameProfile(Profile* profile) { NOTREACHED(); return false; } -base::Time ChromeProfileStub::GetStartTime() const { +base::Time ChromeProfileAlloy::GetStartTime() const { NOTREACHED(); return base::Time(); } -base::FilePath ChromeProfileStub::last_selected_directory() { +base::FilePath ChromeProfileAlloy::last_selected_directory() { NOTREACHED(); return base::FilePath(); } -void ChromeProfileStub::set_last_selected_directory( +void ChromeProfileAlloy::set_last_selected_directory( const base::FilePath& path) { NOTREACHED(); } -GURL ChromeProfileStub::GetHomePage() { +GURL ChromeProfileAlloy::GetHomePage() { NOTREACHED(); return GURL(); } -bool ChromeProfileStub::WasCreatedByVersionOrLater(const std::string& version) { +bool ChromeProfileAlloy::WasCreatedByVersionOrLater( + const std::string& version) { NOTREACHED(); return false; } -void ChromeProfileStub::SetExitType(ExitType exit_type) { +void ChromeProfileAlloy::SetExitType(ExitType exit_type) { NOTREACHED(); } -Profile::ExitType ChromeProfileStub::GetLastSessionExitType() { +Profile::ExitType ChromeProfileAlloy::GetLastSessionExitType() { NOTREACHED(); return EXIT_NORMAL; } -base::Time ChromeProfileStub::GetCreationTime() const { +base::Time ChromeProfileAlloy::GetCreationTime() const { NOTREACHED(); return base::Time(); } -void ChromeProfileStub::SetCreationTimeForTesting(base::Time creation_time) { +void ChromeProfileAlloy::SetCreationTimeForTesting(base::Time creation_time) { NOTREACHED(); } diff --git a/libcef/browser/chrome_profile_stub.h b/libcef/browser/alloy/chrome_profile_alloy.h similarity index 87% rename from libcef/browser/chrome_profile_stub.h rename to libcef/browser/alloy/chrome_profile_alloy.h index eed6b3758..bb31c051d 100644 --- a/libcef/browser/chrome_profile_stub.h +++ b/libcef/browser/alloy/chrome_profile_alloy.h @@ -5,18 +5,18 @@ // This class gathers state related to a single user profile. -#ifndef CEF_LIBCEF_BROWSER_CHROME_PROFILE_STUB_H_ -#define CEF_LIBCEF_BROWSER_CHROME_PROFILE_STUB_H_ +#ifndef CEF_LIBCEF_BROWSER_ALLOY_CHROME_PROFILE_ALLOY_H_ +#define CEF_LIBCEF_BROWSER_ALLOY_CHROME_PROFILE_ALLOY_H_ #include "chrome/browser/profiles/profile.h" // This file provides a stub implementation of Chrome's Profile object for use // as an interop layer between CEF and files that live in chrome/. -class ChromeProfileStub : public Profile { +class ChromeProfileAlloy : public Profile { public: - ChromeProfileStub(); - ~ChromeProfileStub() override; + ChromeProfileAlloy(); + ~ChromeProfileAlloy() override; protected: // Profile methods. @@ -55,7 +55,7 @@ class ChromeProfileStub : public Profile { private: std::unique_ptr variations_client_; - DISALLOW_COPY_AND_ASSIGN(ChromeProfileStub); + DISALLOW_COPY_AND_ASSIGN(ChromeProfileAlloy); }; -#endif // CEF_LIBCEF_BROWSER_CHROME_PROFILE_STUB_H_ +#endif // CEF_LIBCEF_BROWSER_ALLOY_CHROME_PROFILE_ALLOY_H_ diff --git a/libcef/browser/chrome_profile_manager_stub.cc b/libcef/browser/alloy/chrome_profile_manager_alloy.cc similarity index 80% rename from libcef/browser/chrome_profile_manager_stub.cc rename to libcef/browser/alloy/chrome_profile_manager_alloy.cc index ba3e8cab7..af3427b05 100644 --- a/libcef/browser/chrome_profile_manager_stub.cc +++ b/libcef/browser/alloy/chrome_profile_manager_alloy.cc @@ -3,10 +3,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "libcef/browser/chrome_profile_manager_stub.h" +#include "libcef/browser/alloy/chrome_profile_manager_alloy.h" +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/browser_context.h" -#include "libcef/browser/content_browser_client.h" namespace { @@ -22,17 +22,17 @@ namespace { // determine that. CefBrowserContext* GetActiveBrowserContext() { return static_cast( - CefContentBrowserClient::Get()->request_context()->GetBrowserContext()); + AlloyContentBrowserClient::Get()->request_context()->GetBrowserContext()); } } // namespace -ChromeProfileManagerStub::ChromeProfileManagerStub() +ChromeProfileManagerAlloy::ChromeProfileManagerAlloy() : ProfileManager(base::FilePath()) {} -ChromeProfileManagerStub::~ChromeProfileManagerStub() {} +ChromeProfileManagerAlloy::~ChromeProfileManagerAlloy() {} -Profile* ChromeProfileManagerStub::GetProfile( +Profile* ChromeProfileManagerAlloy::GetProfile( const base::FilePath& profile_dir) { CefBrowserContext* browser_context = CefBrowserContext::GetForCachePath(profile_dir); @@ -48,14 +48,14 @@ Profile* ChromeProfileManagerStub::GetProfile( return browser_context; } -bool ChromeProfileManagerStub::IsValidProfile(const void* profile) { +bool ChromeProfileManagerAlloy::IsValidProfile(const void* profile) { if (!profile) return false; return !!CefBrowserContext::GetForContext( reinterpret_cast(const_cast(profile))); } -Profile* ChromeProfileManagerStub::GetLastUsedProfile( +Profile* ChromeProfileManagerAlloy::GetLastUsedProfile( const base::FilePath& user_data_dir) { // Override this method to avoid having to register prefs::kProfileLastUsed, // usage of which doesn't make sense for CEF. diff --git a/libcef/browser/chrome_profile_manager_stub.h b/libcef/browser/alloy/chrome_profile_manager_alloy.h similarity index 63% rename from libcef/browser/chrome_profile_manager_stub.h rename to libcef/browser/alloy/chrome_profile_manager_alloy.h index 549ff75fb..aa5332997 100644 --- a/libcef/browser/chrome_profile_manager_stub.h +++ b/libcef/browser/alloy/chrome_profile_manager_alloy.h @@ -6,22 +6,22 @@ // This file provides a stub implementation of Chrome's ProfileManager object // for use as an interop layer between CEF and files that live in chrome/. -#ifndef CEF_LIBCEF_BROWSER_CHROME_PROFILE_MANAGER_STUB_H_ -#define CEF_LIBCEF_BROWSER_CHROME_PROFILE_MANAGER_STUB_H_ +#ifndef CEF_LIBCEF_BROWSER_ALLOY_CHROME_PROFILE_MANAGER_ALLOY_H_ +#define CEF_LIBCEF_BROWSER_ALLOY_CHROME_PROFILE_MANAGER_ALLOY_H_ #include "chrome/browser/profiles/profile_manager.h" -class ChromeProfileManagerStub : public ProfileManager { +class ChromeProfileManagerAlloy : public ProfileManager { public: - ChromeProfileManagerStub(); - ~ChromeProfileManagerStub() override; + ChromeProfileManagerAlloy(); + ~ChromeProfileManagerAlloy() override; Profile* GetProfile(const base::FilePath& profile_dir) override; bool IsValidProfile(const void* profile) override; Profile* GetLastUsedProfile(const base::FilePath& user_data_dir) override; private: - DISALLOW_COPY_AND_ASSIGN(ChromeProfileManagerStub); + DISALLOW_COPY_AND_ASSIGN(ChromeProfileManagerAlloy); }; -#endif // CEF_LIBCEF_BROWSER_CHROME_PROFILE_MANAGER_STUB_H_ +#endif // CEF_LIBCEF_BROWSER_ALLOY_CHROME_PROFILE_MANAGER_ALLOY_H_ diff --git a/libcef/browser/browser_context.cc b/libcef/browser/browser_context.cc index eed196782..248777e30 100644 --- a/libcef/browser/browser_context.cc +++ b/libcef/browser/browser_context.cc @@ -7,7 +7,7 @@ #include #include -#include "libcef/browser/content_browser_client.h" +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/download_manager_delegate.h" #include "libcef/browser/extensions/extension_system.h" #include "libcef/browser/media_router/media_router_manager.h" diff --git a/libcef/browser/browser_context.h b/libcef/browser/browser_context.h index 232de1149..0ab08dcda 100644 --- a/libcef/browser/browser_context.h +++ b/libcef/browser/browser_context.h @@ -9,7 +9,7 @@ #include #include "include/cef_request_context_handler.h" -#include "libcef/browser/chrome_profile_stub.h" +#include "libcef/browser/alloy/chrome_profile_alloy.h" #include "libcef/browser/request_context_handler_map.h" #include "libcef/browser/resource_context.h" @@ -36,7 +36,7 @@ // BHI = CefBrowserHostImpl // Implements the CefBrowser and CefBrowserHost interfaces which are exposed // to clients. References an RCI instance. Owns a WC. Life span is controlled -// by client references and CefContentBrowserClient. +// by client references and AlloyContentBrowserClient. // // RCI = CefRequestContextImpl // Implements the CefRequestContext interface which is exposed to clients. @@ -44,7 +44,8 @@ // // BC = CefBrowserContext // Entry point from WC when using an isolated RCI. Owns the RC and creates the -// SPI indirectly. Owned by CefBrowserMainParts for the global context or RCI +// SPI indirectly. Owned by AlloyBrowserMainParts for the global context or +RCI // for non-global contexts. // // SPI = content::StoragePartitionImpl @@ -63,7 +64,7 @@ // own = ownership (std::unique_ptr) // ptr = raw pointer // -// CefBrowserMainParts +// AlloyBrowserMainParts // | // own // v @@ -79,7 +80,7 @@ // thread due to CefBrowserHostImpl destruction, ref release, etc. // 3. CefBrowserContext is destroyed on the UI thread due to // CefRequestContextImpl destruction or deletion in -// CefBrowserMainParts::PostMainMessageLoopRun(). +// AlloyBrowserMainParts::PostMainMessageLoopRun(). // 4. CefResourceContext is destroyed asynchronously on the IO thread due to // CefBrowserContext destruction. This cancels/destroys any pending // network requests. @@ -104,7 +105,7 @@ class VisitedLinkWriter; // Main entry point for configuring behavior on a per-browser basis. An instance // of this class is passed to WebContents::Create in CefBrowserHostImpl:: // CreateInternal. Only accessed on the UI thread unless otherwise indicated. -class CefBrowserContext : public ChromeProfileStub, +class CefBrowserContext : public ChromeProfileAlloy, public visitedlink::VisitedLinkDelegate { public: explicit CefBrowserContext(const CefRequestContextSettings& settings); diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/browser_host_impl.cc index 19d451c0f..0d1a80295 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/browser_host_impl.cc @@ -8,13 +8,13 @@ #include #include +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/audio_capturer.h" #include "libcef/browser/browser_context.h" #include "libcef/browser/browser_info.h" #include "libcef/browser/browser_info_manager.h" #include "libcef/browser/browser_platform_delegate.h" #include "libcef/browser/browser_util.h" -#include "libcef/browser/content_browser_client.h" #include "libcef/browser/context.h" #include "libcef/browser/devtools/devtools_manager.h" #include "libcef/browser/extensions/browser_extensions_util.h" @@ -35,7 +35,6 @@ #include "libcef/common/cef_switches.h" #include "libcef/common/drag_data_impl.h" #include "libcef/common/extensions/extensions_util.h" -#include "libcef/common/main_delegate.h" #include "libcef/common/request_impl.h" #include "libcef/common/values_impl.h" @@ -390,7 +389,7 @@ CefRefPtr CefBrowserHostImpl::Create( // Extension resources will fail to load if we don't use a SiteInstance // associated with the extension. - // (CefContentBrowserClient::SiteInstanceGotProcess won't find the + // (AlloyContentBrowserClient::SiteInstanceGotProcess won't find the // extension to register with InfoMap, and AllowExtensionResourceLoad in // ExtensionProtocolHandler::MaybeCreateJob will return false resulting in // ERR_BLOCKED_BY_CLIENT). @@ -2097,7 +2096,7 @@ bool CefBrowserHostImpl::IsAudioMuted() { // ----------------------------------------------------------------------------- // |source| may be NULL if the navigation originates from a guest view via -// CefContentBrowserClient::CanCreateWindow. +// AlloyContentBrowserClient::CanCreateWindow. content::WebContents* CefBrowserHostImpl::OpenURLFromTab( content::WebContents* source, const content::OpenURLParams& params) { diff --git a/libcef/browser/browser_info_manager.h b/libcef/browser/browser_info_manager.h index 3bdc1c7bc..3ff8fcc1d 100644 --- a/libcef/browser/browser_info_manager.h +++ b/libcef/browser/browser_info_manager.h @@ -63,7 +63,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { bool is_windowless, CefRefPtr extra_info); - // Called from CefContentBrowserClient::CanCreateWindow. See comments on + // Called from AlloyContentBrowserClient::CanCreateWindow. See comments on // PendingPopup for more information. bool CanCreateWindow(content::RenderFrameHost* opener, const GURL& target_url, @@ -143,7 +143,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { void RenderProcessHostDestroyed(content::RenderProcessHost* host) override; // Store state information about pending popups. Call order is: - // - CefContentBrowserClient::CanCreateWindow (UIT) + // - AlloyContentBrowserClient::CanCreateWindow (UIT) // Provides an opportunity to cancel the popup (calls OnBeforePopup) and // creates the new platform delegate for the popup. If the popup owner is // an extension guest view then the popup is canceled and diff --git a/libcef/browser/browser_message_filter.cc b/libcef/browser/browser_message_filter.cc index b673a9f13..1a2519fad 100644 --- a/libcef/browser/browser_message_filter.cc +++ b/libcef/browser/browser_message_filter.cc @@ -7,8 +7,8 @@ #include "libcef/browser/browser_info_manager.h" #include "libcef/browser/origin_whitelist_impl.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "libcef/common/cef_messages.h" -#include "libcef/common/content_client.h" #include "libcef/common/values_impl.h" #include "base/bind.h" @@ -43,7 +43,7 @@ void CefBrowserMessageFilter::OnGetNewRenderThreadInfo( CefProcessHostMsg_GetNewRenderThreadInfo_Params* params) { GetCrossOriginWhitelistEntries(¶ms->cross_origin_whitelist_entries); - CefRefPtr app = CefContentClient::Get()->application(); + CefRefPtr app = AlloyContentClient::Get()->application(); if (app.get()) { CefRefPtr handler = app->GetBrowserProcessHandler(); diff --git a/libcef/browser/browser_message_loop.cc b/libcef/browser/browser_message_loop.cc index 43a968559..8eb3b7120 100644 --- a/libcef/browser/browser_message_loop.cc +++ b/libcef/browser/browser_message_loop.cc @@ -3,7 +3,7 @@ // be found in the LICENSE file. #include "libcef/browser/browser_message_loop.h" -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "base/memory/ptr_util.h" #include "base/message_loop/message_pump.h" @@ -91,7 +91,7 @@ class MessagePumpExternal : public base::MessagePumpForUI { }; CefRefPtr GetBrowserProcessHandler() { - CefRefPtr app = CefContentClient::Get()->application(); + CefRefPtr app = AlloyContentClient::Get()->application(); if (app) return app->GetBrowserProcessHandler(); return nullptr; diff --git a/libcef/browser/devtools/devtools_frontend.cc b/libcef/browser/devtools/devtools_frontend.cc index 5c3b3efb1..aafd3e2d9 100644 --- a/libcef/browser/devtools/devtools_frontend.cc +++ b/libcef/browser/devtools/devtools_frontend.cc @@ -9,8 +9,8 @@ #include #include +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/browser_context.h" -#include "libcef/browser/content_browser_client.h" #include "libcef/browser/devtools/devtools_manager_delegate.h" #include "libcef/browser/net/devtools_scheme_handler.h" #include "libcef/common/cef_switches.h" @@ -606,7 +606,7 @@ void CefDevToolsFrontend::LogProtocolMessage(ProtocolMessageType type, std::string to_log = message.substr(0, kMaxLogLineLength).as_string(); // Execute in an ordered context that allows blocking. - auto task_runner = CefContentBrowserClient::Get()->background_task_runner(); + auto task_runner = AlloyContentBrowserClient::Get()->background_task_runner(); task_runner->PostTask( FROM_HERE, base::BindOnce(::LogProtocolMessage, protocol_log_file_, type, std::move(to_log))); diff --git a/libcef/browser/extensions/browser_extensions_util.h b/libcef/browser/extensions/browser_extensions_util.h index a4de94bc4..9e98431f7 100644 --- a/libcef/browser/extensions/browser_extensions_util.h +++ b/libcef/browser/extensions/browser_extensions_util.h @@ -45,7 +45,7 @@ CefRefPtr GetOwnerBrowserForFrameRoute( // |is_guest_view| will be set to true if the host matches a guest view // associated with the returned browser instead of the browser itself. // TODO(cef): Delete the RVH variant once the remaining use case -// (via CefContentBrowserClient::OverrideWebkitPrefs) has been removed. +// (via AlloyContentBrowserClient::OverrideWebkitPrefs) has been removed. CefRefPtr GetOwnerBrowserForHost( content::RenderViewHost* host, bool* is_guest_view); diff --git a/libcef/browser/extensions/extension_system.cc b/libcef/browser/extensions/extension_system.cc index 1d0cda031..4c6d563c7 100644 --- a/libcef/browser/extensions/extension_system.cc +++ b/libcef/browser/extensions/extension_system.cc @@ -224,7 +224,7 @@ void CefExtensionSystem::Init() { // WebContents routing IDs with the owner CefBrowser. MimeHandlerViewGuest // then loads the extension URL (index.html) in the guest WebContents. // 13.Creation of the RenderFrame in the guest renderer process triggers a - // sync IPC call from CefContentRendererClient::MaybeCreateBrowser to + // sync IPC call from AlloyContentRendererClient::MaybeCreateBrowser to // CefBrowserInfoManager::GetBrowserInfo in the browser process to retrieve // the CefBrowser information, which will be immediately available due to // step 12. @@ -248,7 +248,7 @@ void CefExtensionSystem::Init() { // 17.HTMLPlugInElement::RequestObject is called in the guest renderer process // and determines that the PDF PPAPI plugin should be handled internally // (handled_externally=false). A PluginDocument is created and - // CefContentRendererClient::OverrideCreatePlugin is called to create a + // AlloyContentRendererClient::OverrideCreatePlugin is called to create a // WebPlugin. // 18.The PDF extension and PDF plugin are now loaded. Print commands, if // any, are handled in the guest renderer process by ChromePDFPrintClient diff --git a/libcef/browser/extensions/mime_handler_view_guest_delegate.cc b/libcef/browser/extensions/mime_handler_view_guest_delegate.cc index 32af32c41..a8aedd20e 100644 --- a/libcef/browser/extensions/mime_handler_view_guest_delegate.cc +++ b/libcef/browser/extensions/mime_handler_view_guest_delegate.cc @@ -5,10 +5,10 @@ #include "libcef/browser/extensions/mime_handler_view_guest_delegate.h" +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/browser_context.h" #include "libcef/browser/browser_host_impl.h" #include "libcef/browser/browser_info.h" -#include "libcef/browser/content_browser_client.h" #include "libcef/browser/osr/web_contents_view_osr.h" #include "content/browser/browser_plugin/browser_plugin_guest.h" diff --git a/libcef/browser/main_runner.cc b/libcef/browser/main_runner.cc index 31cc3854b..4954bc83d 100644 --- a/libcef/browser/main_runner.cc +++ b/libcef/browser/main_runner.cc @@ -7,10 +7,10 @@ #include "libcef/browser/browser_message_loop.h" #include "libcef/browser/thread_util.h" +#include "libcef/common/alloy/alloy_main_runner_delegate.h" #include "libcef/common/cef_switches.h" #include "libcef/common/chrome/chrome_main_runner_delegate.h" -#include "libcef/common/main_delegate.h" -#include "libcef/features/chrome_cef.h" +#include "libcef/features/runtime.h" #include "base/at_exit.h" #include "base/base_switches.h" @@ -43,7 +43,7 @@ namespace { enum class RuntimeType { UNINITIALIZED, - CEF, + ALLOY, CHROME, }; RuntimeType g_runtime_type = RuntimeType::UNINITIALIZED; @@ -53,9 +53,10 @@ std::unique_ptr MakeDelegate( CefMainRunnerHandler* runner, CefSettings* settings, CefRefPtr application) { - if (type == RuntimeType::CEF) { - g_runtime_type = RuntimeType::CEF; - return std::make_unique(runner, settings, application); + if (type == RuntimeType::ALLOY) { + g_runtime_type = RuntimeType::ALLOY; + return std::make_unique(runner, settings, + application); } else { g_runtime_type = RuntimeType::CHROME; return std::make_unique(runner); @@ -226,7 +227,7 @@ bool CefMainRunner::Initialize(CefSettings* settings, base::OnceClosure context_initialized) { DCHECK(!main_delegate_); main_delegate_ = MakeDelegate( - settings->chrome_runtime ? RuntimeType::CHROME : RuntimeType::CEF, this, + settings->chrome_runtime ? RuntimeType::CHROME : RuntimeType::ALLOY, this, settings, application); const int exit_code = @@ -315,7 +316,7 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args, auto runtime_type = command_line.HasSwitch(switches::kEnableChromeRuntime) ? RuntimeType::CHROME - : RuntimeType::CEF; + : RuntimeType::ALLOY; auto main_delegate = MakeDelegate(runtime_type, /*runner=*/nullptr, /*settings=*/nullptr, application); main_delegate->BeforeExecuteProcess(args); @@ -441,7 +442,7 @@ int CefMainRunner::RunMainProcess( browser_runner_ = content::BrowserMainRunner::Create(); // Initialize browser process state. Results in a call to - // CefBrowserMain::PreMainMessageLoopStart() which creates the UI message + // AlloyBrowserMain::PreMainMessageLoopStart() which creates the UI message // loop. int exit_code = browser_runner_->Initialize(main_function_params); if (exit_code >= 0) @@ -517,11 +518,11 @@ void CefMainRunner::FinalizeShutdown(base::OnceClosure finalize_shutdown) { g_runtime_type = RuntimeType::UNINITIALIZED; } -// From libcef/features/chrome_cef.h: +// From libcef/features/runtime.h: namespace cef { -bool IsCefRuntimeEnabled() { - return g_runtime_type == RuntimeType::CEF; +bool IsAlloyRuntimeEnabled() { + return g_runtime_type == RuntimeType::ALLOY; } bool IsChromeRuntimeEnabled() { diff --git a/libcef/browser/menu_manager.cc b/libcef/browser/menu_manager.cc index 8599ede75..e541b912b 100644 --- a/libcef/browser/menu_manager.cc +++ b/libcef/browser/menu_manager.cc @@ -10,7 +10,7 @@ #include "libcef/browser/context_menu_params_impl.h" #include "libcef/browser/menu_runner.h" #include "libcef/browser/thread_util.h" -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "base/compiler_specific.h" #include "base/logging.h" @@ -24,7 +24,7 @@ namespace { CefString GetLabel(int message_id) { base::string16 label = - CefContentClient::Get()->GetLocalizedString(message_id); + AlloyContentClient::Get()->GetLocalizedString(message_id); DCHECK(!label.empty()); return label; } diff --git a/libcef/browser/net/chrome_scheme_handler.cc b/libcef/browser/net/chrome_scheme_handler.cc index 4b90f3706..d2c61034f 100644 --- a/libcef/browser/net/chrome_scheme_handler.cc +++ b/libcef/browser/net/chrome_scheme_handler.cc @@ -12,12 +12,12 @@ #include "include/cef_version.h" #include "include/cef_web_plugin.h" -#include "libcef/browser/content_browser_client.h" +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/extensions/chrome_api_registration.h" #include "libcef/browser/frame_host_impl.h" #include "libcef/browser/net/internal_scheme_handler.h" #include "libcef/browser/thread_util.h" -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "base/command_line.h" #include "base/files/file_util.h" @@ -60,7 +60,7 @@ const char kChromeUIWebUIHostsHost[] = "webui-hosts"; // TODO(network): Consider handling content::kChromeDevToolsScheme via WebUI // (DevToolsUI class) with the following changes: // 1. Add an entry for content::kChromeDevToolsScheme in -// CefContentBrowserClient::GetAdditionalWebUISchemes. +// AlloyContentBrowserClient::GetAdditionalWebUISchemes. // 2. Allow the scheme in CefWebUIControllerFactory::AllowWebUIForURL. // 3. Add an entry for chrome::kChromeUIDevToolsHost in kAllowedWebUIHosts and // kUnlistedHosts. @@ -341,7 +341,7 @@ bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) { } bool OnLicenseUI(std::string* mime_type, std::string* output) { - base::StringPiece piece = CefContentClient::Get()->GetDataResource( + base::StringPiece piece = AlloyContentClient::Get()->GetDataResource( IDR_CEF_LICENSE_TXT, ui::SCALE_FACTOR_NONE); if (piece.empty()) { NOTREACHED() << "Failed to load license txt resource."; @@ -358,7 +358,7 @@ bool OnLicenseUI(std::string* mime_type, std::string* output) { bool OnVersionUI(Profile* profile, std::string* mime_type, std::string* output) { - base::StringPiece piece = CefContentClient::Get()->GetDataResource( + base::StringPiece piece = AlloyContentClient::Get()->GetDataResource( IDR_CEF_VERSION_HTML, ui::SCALE_FACTOR_NONE); if (piece.empty()) { NOTREACHED() << "Failed to load version html resource."; @@ -376,7 +376,7 @@ bool OnVersionUI(Profile* profile, parser.Add("WEBKIT", content::GetWebKitVersion()); parser.Add("JAVASCRIPT", v8::V8::GetVersion()); parser.Add("FLASH", std::string()); // Value populated asynchronously. - parser.Add("USERAGENT", CefContentClient::Get()->browser()->GetUserAgent()); + parser.Add("USERAGENT", AlloyContentClient::Get()->browser()->GetUserAgent()); parser.Add("COMMANDLINE", GetCommandLine()); parser.Add("MODULEPATH", GetModulePath()); parser.Add("CACHEPATH", CefString(profile->GetPath().value())); diff --git a/libcef/browser/net/internal_scheme_handler.cc b/libcef/browser/net/internal_scheme_handler.cc index f04b71654..91bffdd5e 100644 --- a/libcef/browser/net/internal_scheme_handler.cc +++ b/libcef/browser/net/internal_scheme_handler.cc @@ -8,7 +8,7 @@ #include #include -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -159,7 +159,7 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory { if (!action.bytes && action.resource_id >= 0) { action.bytes = - CefContentClient::Get()->GetDataResourceBytes(action.resource_id); + AlloyContentClient::Get()->GetDataResourceBytes(action.resource_id); if (!action.bytes) { NOTREACHED() << "Failed to load internal resource for id: " << action.resource_id << " URL: " << url.spec().c_str(); diff --git a/libcef/browser/net_service/cookie_manager_impl.cc b/libcef/browser/net_service/cookie_manager_impl.cc index 5e3891ce8..3db265d98 100644 --- a/libcef/browser/net_service/cookie_manager_impl.cc +++ b/libcef/browser/net_service/cookie_manager_impl.cc @@ -156,7 +156,7 @@ void CefCookieManagerImpl::SetSupportedSchemes( // This will be forwarded to the CookieMonster that lives in the // NetworkService process when the NetworkContext is created via - // CefContentBrowserClient::CreateNetworkContext. + // AlloyContentBrowserClient::CreateNetworkContext. browser_context->set_cookieable_schemes(base::make_optional(all_schemes)); RunAsyncCompletionOnUIThread(callback); } diff --git a/libcef/browser/net_service/resource_request_handler_wrapper.cc b/libcef/browser/net_service/resource_request_handler_wrapper.cc index cb863138a..76f0e5701 100644 --- a/libcef/browser/net_service/resource_request_handler_wrapper.cc +++ b/libcef/browser/net_service/resource_request_handler_wrapper.cc @@ -4,9 +4,9 @@ #include "libcef/browser/net_service/resource_request_handler_wrapper.h" +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/browser_host_impl.h" #include "libcef/browser/browser_platform_delegate.h" -#include "libcef/browser/content_browser_client.h" #include "libcef/browser/context.h" #include "libcef/browser/net_service/cookie_helper.h" #include "libcef/browser/net_service/proxy_url_loader_factory.h" @@ -14,7 +14,7 @@ #include "libcef/browser/net_service/response_filter_wrapper.h" #include "libcef/browser/resource_context.h" #include "libcef/browser/thread_util.h" -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "libcef/common/net/scheme_registration.h" #include "libcef/common/net_service/net_service_util.h" #include "libcef/common/request_impl.h" @@ -290,7 +290,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler { accept_language_ = ComputeAcceptLanguageFromPref( GetAcceptLanguageList(browser_context, browser)); DCHECK(!accept_language_.empty()); - user_agent_ = CefContentClient::Get()->browser()->GetUserAgent(); + user_agent_ = AlloyContentClient::Get()->browser()->GetUserAgent(); DCHECK(!user_agent_.empty()); } diff --git a/libcef/browser/net_service/url_loader_factory_getter.cc b/libcef/browser/net_service/url_loader_factory_getter.cc index c1c370a22..9c6bbcccb 100644 --- a/libcef/browser/net_service/url_loader_factory_getter.cc +++ b/libcef/browser/net_service/url_loader_factory_getter.cc @@ -5,7 +5,7 @@ #include "libcef/browser/net_service/url_loader_factory_getter.h" -#include "libcef/browser/content_browser_client.h" +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/thread_util.h" #include "base/threading/thread_task_runner_handle.h" @@ -59,7 +59,7 @@ scoped_refptr URLLoaderFactoryGetter::Create( } // Allow the Content embedder to inject itself if it wants to. - should_proxy |= CefContentBrowserClient::Get()->WillCreateURLLoaderFactory( + should_proxy |= AlloyContentBrowserClient::Get()->WillCreateURLLoaderFactory( browser_context, render_frame_host, render_process_id, content::ContentBrowserClient::URLLoaderFactoryType::kDocumentSubResource, url::Origin(), base::nullopt /* navigation_id */, diff --git a/libcef/browser/osr/render_widget_host_view_osr_win.cc b/libcef/browser/osr/render_widget_host_view_osr_win.cc index 8af8b78f1..b54f25c71 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_win.cc +++ b/libcef/browser/osr/render_widget_host_view_osr_win.cc @@ -7,8 +7,8 @@ #include +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/browser_host_impl.h" -#include "libcef/browser/content_browser_client.h" #include "ui/resources/grit/ui_unscaled_resources.h" @@ -165,8 +165,8 @@ ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor( HMODULE module_handle = NULL; const wchar_t* cursor_id = ToCursorID(type); if (!IsSystemCursorID(cursor_id)) { - module_handle = - ::GetModuleHandle(CefContentBrowserClient::Get()->GetResourceDllName()); + module_handle = ::GetModuleHandle( + AlloyContentBrowserClient::Get()->GetResourceDllName()); if (!module_handle) module_handle = ::GetModuleHandle(NULL); } diff --git a/libcef/browser/plugins/plugin_service_filter.cc b/libcef/browser/plugins/plugin_service_filter.cc index e1dbdcd4d..f4155a276 100644 --- a/libcef/browser/plugins/plugin_service_filter.cc +++ b/libcef/browser/plugins/plugin_service_filter.cc @@ -8,7 +8,7 @@ #include "libcef/browser/browser_context.h" #include "libcef/browser/thread_util.h" #include "libcef/browser/web_plugin_impl.h" -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "extensions/common/constants.h" @@ -42,11 +42,11 @@ bool CefPluginServiceFilter::IsPluginAvailable( // with an empty origin. If we return false then the plugin will not be listed // in navigator.plugins and navigating to the plugin mime type will trigger // the download code path. If we return true then individual plugin instance - // loads will be evaluated in CefContentRendererClient::OverrideCreatePlugin, - // which will result in a call to CefPluginInfoMessageFilter::PluginsLoaded to - // retrieve the actual load decision with a non-empty origin. That will - // determine whether the plugin load is allowed or the plugin placeholder is - // displayed. + // loads will be evaluated in + // AlloyContentRendererClient::OverrideCreatePlugin, which will result in a + // call to CefPluginInfoMessageFilter::PluginsLoaded to retrieve the actual + // load decision with a non-empty origin. That will determine whether the + // plugin load is allowed or the plugin placeholder is displayed. return IsPluginAvailable(render_process_id, render_frame_id, url, is_main_frame, url::Origin(), plugin, &status); } @@ -72,7 +72,7 @@ bool CefPluginServiceFilter::IsPluginAvailable( return false; } - if (plugin->path == CefString(CefContentClient::kPDFPluginPath)) { + if (plugin->path == CefString(AlloyContentClient::kPDFPluginPath)) { // Always allow the internal PDF plugin to load. *status = chrome::mojom::PluginStatus::kAllowed; return true; diff --git a/libcef/browser/printing/print_dialog_linux.cc b/libcef/browser/printing/print_dialog_linux.cc index 02c51b044..42925388c 100644 --- a/libcef/browser/printing/print_dialog_linux.cc +++ b/libcef/browser/printing/print_dialog_linux.cc @@ -11,7 +11,7 @@ #include "libcef/browser/extensions/browser_extensions_util.h" #include "libcef/browser/print_settings_impl.h" #include "libcef/browser/thread_util.h" -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "base/bind.h" #include "base/files/file_util.h" @@ -105,7 +105,7 @@ gfx::Size CefPrintDialogLinux::GetPdfPaperSize( gfx::Size size; - CefRefPtr app = CefContentClient::Get()->application(); + CefRefPtr app = AlloyContentClient::Get()->application(); if (app.get()) { CefRefPtr browser_handler = app->GetBrowserProcessHandler(); @@ -136,7 +136,7 @@ void CefPrintDialogLinux::OnPrintStart(int render_process_id, return; } - CefRefPtr app = CefContentClient::Get()->application(); + CefRefPtr app = AlloyContentClient::Get()->application(); if (!app.get()) return; @@ -251,7 +251,7 @@ void CefPrintDialogLinux::SetHandler() { if (handler_.get()) return; - CefRefPtr app = CefContentClient::Get()->application(); + CefRefPtr app = AlloyContentClient::Get()->application(); if (app.get()) { CefRefPtr browser_handler = app->GetBrowserProcessHandler(); diff --git a/libcef/browser/request_context_impl.cc b/libcef/browser/request_context_impl.cc index 6ef266357..092caa795 100644 --- a/libcef/browser/request_context_impl.cc +++ b/libcef/browser/request_context_impl.cc @@ -3,8 +3,8 @@ // can be found in the LICENSE file. #include "libcef/browser/request_context_impl.h" +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/browser_context.h" -#include "libcef/browser/content_browser_client.h" #include "libcef/browser/context.h" #include "libcef/browser/extensions/extension_system.h" #include "libcef/browser/thread_util.h" @@ -625,7 +625,7 @@ CefRequestContextImpl::GetOrCreateRequestContext(const Config& config) { if (config.is_global || (config.other && config.other->IsGlobal() && !config.handler)) { // Return the singleton global context. - return CefContentBrowserClient::Get()->request_context(); + return AlloyContentBrowserClient::Get()->request_context(); } // The new context will be initialized later by EnsureBrowserContext(). diff --git a/libcef/browser/request_context_impl.h b/libcef/browser/request_context_impl.h index a802b26b7..085fbb971 100644 --- a/libcef/browser/request_context_impl.h +++ b/libcef/browser/request_context_impl.h @@ -21,7 +21,7 @@ class CefRequestContextImpl : public CefRequestContext { ~CefRequestContextImpl() override; // Creates the singleton global RequestContext. Called from - // CefBrowserMainParts::PreMainMessageLoopRun. + // AlloyBrowserMainParts::PreMainMessageLoopRun. static CefRefPtr CreateGlobalRequestContext( const CefRequestContextSettings& settings); diff --git a/libcef/browser/thread_util.h b/libcef/browser/thread_util.h index c9d718c98..b5e7aab83 100644 --- a/libcef/browser/thread_util.h +++ b/libcef/browser/thread_util.h @@ -53,8 +53,8 @@ // Tasks posted with this method are not guaranteed to run sequentially. Use // base::CreateSequencedTaskRunner instead if sequence is important. // Sequenced runners at various priorities that always execute all pending tasks -// before shutdown are available via CefContentBrowserClient::*_task_runner() -// and exposed by the CEF API. +// before shutdown are available via CefTaskRunnerManager and exposed by the CEF +// API. #define CEF_POST_BLOCKING_TASK(priority, task) \ base::PostTask( \ FROM_HERE, \ diff --git a/libcef/browser/x509_certificate_impl.h b/libcef/browser/x509_certificate_impl.h index 5a5fc37a7..f5c22250f 100644 --- a/libcef/browser/x509_certificate_impl.h +++ b/libcef/browser/x509_certificate_impl.h @@ -17,7 +17,7 @@ class CefX509CertificateImpl : public CefX509Certificate { public: explicit CefX509CertificateImpl(scoped_refptr cert); - // Used with CefContentBrowserClient::SelectClientCertificate only. + // Used with AlloyContentBrowserClient::SelectClientCertificate only. explicit CefX509CertificateImpl( std::unique_ptr identity); diff --git a/libcef/common/content_client.cc b/libcef/common/alloy/alloy_content_client.cc similarity index 90% rename from libcef/common/content_client.cc rename to libcef/common/alloy/alloy_content_client.cc index 6063064f9..f317084b1 100644 --- a/libcef/common/content_client.cc +++ b/libcef/common/alloy/alloy_content_client.cc @@ -3,7 +3,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" #include @@ -44,7 +44,7 @@ namespace { -CefContentClient* g_content_client = nullptr; +AlloyContentClient* g_content_client = nullptr; // The following plugin-related methods are from // chrome/common/chrome_content_client.cc @@ -72,7 +72,7 @@ void ComputeBuiltInPlugins(std::vector* plugins) { pdf_info.name = extensions::pdf_extension_util::kPdfPluginName; pdf_info.description = kPDFPluginDescription; pdf_info.path = - base::FilePath::FromUTF8Unsafe(CefContentClient::kPDFPluginPath); + base::FilePath::FromUTF8Unsafe(AlloyContentClient::kPDFPluginPath); content::WebPluginMimeType pdf_mime_type(kPDFPluginOutOfProcessMimeType, kPDFPluginExtension, kPDFPluginDescription); @@ -182,9 +182,9 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) { } // namespace -const char CefContentClient::kPDFPluginPath[] = "internal-pdf-viewer"; +const char AlloyContentClient::kPDFPluginPath[] = "internal-pdf-viewer"; -CefContentClient::CefContentClient(CefRefPtr application) +AlloyContentClient::AlloyContentClient(CefRefPtr application) : application_(application), pack_loading_disabled_(false), allow_pack_file_load_(false), @@ -194,16 +194,16 @@ CefContentClient::CefContentClient(CefRefPtr application) g_content_client = this; } -CefContentClient::~CefContentClient() { +AlloyContentClient::~AlloyContentClient() { g_content_client = nullptr; } // static -CefContentClient* CefContentClient::Get() { +AlloyContentClient* AlloyContentClient::Get() { return g_content_client; } -void CefContentClient::AddPepperPlugins( +void AlloyContentClient::AddPepperPlugins( std::vector* plugins) { ComputeBuiltInPlugins(plugins); AddPepperFlashFromCommandLine(plugins); @@ -213,7 +213,7 @@ void CefContentClient::AddPepperPlugins( plugins->push_back(plugin); } -void CefContentClient::AddContentDecryptionModules( +void AlloyContentClient::AddContentDecryptionModules( std::vector* cdms, std::vector* cdm_host_file_paths) { #if defined(OS_LINUX) @@ -223,7 +223,7 @@ void CefContentClient::AddContentDecryptionModules( #endif } -void CefContentClient::AddAdditionalSchemes(Schemes* schemes) { +void AlloyContentClient::AddAdditionalSchemes(Schemes* schemes) { DCHECK(!scheme_info_list_locked_); if (application_.get()) { @@ -237,7 +237,7 @@ void CefContentClient::AddAdditionalSchemes(Schemes* schemes) { scheme_info_list_locked_ = true; } -base::string16 CefContentClient::GetLocalizedString(int message_id) { +base::string16 AlloyContentClient::GetLocalizedString(int message_id) { base::string16 value = ui::ResourceBundle::GetSharedInstance().GetLocalizedString(message_id); if (value.empty()) @@ -246,7 +246,7 @@ base::string16 CefContentClient::GetLocalizedString(int message_id) { return value; } -base::string16 CefContentClient::GetLocalizedString( +base::string16 AlloyContentClient::GetLocalizedString( int message_id, const base::string16& replacement) { base::string16 value = l10n_util::GetStringFUTF16(message_id, replacement); @@ -256,7 +256,7 @@ base::string16 CefContentClient::GetLocalizedString( return value; } -base::StringPiece CefContentClient::GetDataResource( +base::StringPiece AlloyContentClient::GetDataResource( int resource_id, ui::ScaleFactor scale_factor) { base::StringPiece value = @@ -268,7 +268,7 @@ base::StringPiece CefContentClient::GetDataResource( return value; } -base::RefCountedMemory* CefContentClient::GetDataResourceBytes( +base::RefCountedMemory* AlloyContentClient::GetDataResourceBytes( int resource_id) { base::RefCountedMemory* value = ui::ResourceBundle::GetSharedInstance().LoadDataResourceBytes( @@ -279,7 +279,7 @@ base::RefCountedMemory* CefContentClient::GetDataResourceBytes( return value; } -gfx::Image& CefContentClient::GetNativeImageNamed(int resource_id) { +gfx::Image& AlloyContentClient::GetNativeImageNamed(int resource_id) { gfx::Image& value = ui::ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); if (value.IsEmpty()) @@ -288,7 +288,7 @@ gfx::Image& CefContentClient::GetNativeImageNamed(int resource_id) { return value; } -void CefContentClient::AddCustomScheme(const SchemeInfo& scheme_info) { +void AlloyContentClient::AddCustomScheme(const SchemeInfo& scheme_info) { DCHECK(!scheme_info_list_locked_); scheme_info_list_.push_back(scheme_info); @@ -304,12 +304,13 @@ void CefContentClient::AddCustomScheme(const SchemeInfo& scheme_info) { } } -const CefContentClient::SchemeInfoList* CefContentClient::GetCustomSchemes() { +const AlloyContentClient::SchemeInfoList* +AlloyContentClient::GetCustomSchemes() { DCHECK(scheme_info_list_locked_); return &scheme_info_list_; } -bool CefContentClient::HasCustomScheme(const std::string& scheme_name) { +bool AlloyContentClient::HasCustomScheme(const std::string& scheme_name) { DCHECK(scheme_info_list_locked_); if (scheme_info_list_.empty()) return false; @@ -324,7 +325,7 @@ bool CefContentClient::HasCustomScheme(const std::string& scheme_name) { } // static -void CefContentClient::SetPDFEntryFunctions( +void AlloyContentClient::SetPDFEntryFunctions( content::PepperPluginInfo::GetInterfaceFunc get_interface, content::PepperPluginInfo::PPP_InitializeModuleFunc initialize_module, content::PepperPluginInfo::PPP_ShutdownModuleFunc shutdown_module) { diff --git a/libcef/common/content_client.h b/libcef/common/alloy/alloy_content_client.h similarity index 88% rename from libcef/common/content_client.h rename to libcef/common/alloy/alloy_content_client.h index 81963e1e9..6bd24d898 100644 --- a/libcef/common/content_client.h +++ b/libcef/common/alloy/alloy_content_client.h @@ -3,8 +3,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CEF_LIBCEF_COMMON_CONTENT_CLIENT_H_ -#define CEF_LIBCEF_COMMON_CONTENT_CLIENT_H_ +#ifndef CEF_LIBCEF_COMMON_ALLOY_ALLOY_CONTENT_CLIENT_H_ +#define CEF_LIBCEF_COMMON_ALLOY_ALLOY_CONTENT_CLIENT_H_ #pragma once #include @@ -19,15 +19,15 @@ #include "content/public/common/pepper_plugin_info.h" #include "url/url_util.h" -class CefContentClient : public content::ContentClient { +class AlloyContentClient : public content::ContentClient { public: static const char kPDFPluginPath[]; - explicit CefContentClient(CefRefPtr application); - ~CefContentClient() override; + explicit AlloyContentClient(CefRefPtr application); + ~AlloyContentClient() override; - // Returns the singleton CefContentClient instance. - static CefContentClient* Get(); + // Returns the singleton AlloyContentClient instance. + static AlloyContentClient* Get(); // content::ContentClient methods. void AddPepperPlugins( @@ -88,9 +88,9 @@ class CefContentClient : public content::ContentClient { typedef std::list SchemeInfoList; // Custom scheme information will be registered first with all processes - // (url/url_util.h) via CefContentClient::AddAdditionalSchemes which calls + // (url/url_util.h) via AlloyContentClient::AddAdditionalSchemes which calls // AddCustomScheme, and second with Blink (SchemeRegistry) via - // CefContentRendererClient::WebKitInitialized which calls GetCustomSchemes. + // AlloyContentRendererClient::WebKitInitialized which calls GetCustomSchemes. void AddCustomScheme(const SchemeInfo& scheme_info); const SchemeInfoList* GetCustomSchemes(); bool HasCustomScheme(const std::string& scheme_name); @@ -123,4 +123,4 @@ class CefContentClient : public content::ContentClient { CefResourceBundleDelegate resource_bundle_delegate_; }; -#endif // CEF_LIBCEF_COMMON_CONTENT_CLIENT_H_ +#endif // CEF_LIBCEF_COMMON_ALLOY_ALLOY_CONTENT_CLIENT_H_ diff --git a/libcef/common/main_delegate.cc b/libcef/common/alloy/alloy_main_delegate.cc similarity index 90% rename from libcef/common/main_delegate.cc rename to libcef/common/alloy/alloy_main_delegate.cc index 8e63d725b..bba4426b3 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/alloy/alloy_main_delegate.cc @@ -2,20 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "libcef/common/main_delegate.h" +#include "libcef/common/alloy/alloy_main_delegate.h" #if defined(OS_LINUX) #include #endif -#include "libcef/browser/chrome_browser_process_stub.h" -#include "libcef/browser/content_browser_client.h" +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/common/cef_switches.h" #include "libcef/common/command_line_impl.h" #include "libcef/common/crash_reporting.h" #include "libcef/common/extensions/extensions_util.h" -#include "libcef/common/widevine_loader.h" -#include "libcef/renderer/content_renderer_client.h" +#include "libcef/renderer/alloy/alloy_content_renderer_client.h" #include "base/base_switches.h" #include "base/command_line.h" @@ -37,7 +35,6 @@ #include "components/content_settings/core/common/content_settings_pattern.h" #include "components/viz/common/features.h" #include "content/browser/browser_process_sub_thread.h" -#include "content/public/browser/render_process_host.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "content/public/common/main_function_params.h" @@ -321,9 +318,9 @@ void OverrideAssetPath() { } // namespace -CefMainDelegate::CefMainDelegate(CefMainRunnerHandler* runner, - CefSettings* settings, - CefRefPtr application) +AlloyMainDelegate::AlloyMainDelegate(CefMainRunnerHandler* runner, + CefSettings* settings, + CefRefPtr application) : runner_(runner), settings_(settings), content_client_(application) { // Necessary so that exported functions from base_impl.cc will be included // in the binary. @@ -335,13 +332,13 @@ CefMainDelegate::CefMainDelegate(CefMainRunnerHandler* runner, #endif } -CefMainDelegate::~CefMainDelegate() {} +AlloyMainDelegate::~AlloyMainDelegate() {} -void CefMainDelegate::PreCreateMainMessageLoop() { +void AlloyMainDelegate::PreCreateMainMessageLoop() { runner_->PreCreateMainMessageLoop(); } -bool CefMainDelegate::BasicStartupComplete(int* exit_code) { +bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); std::string process_type = command_line->GetSwitchValueASCII(switches::kProcessType); @@ -624,7 +621,7 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) { return false; } -void CefMainDelegate::PreSandboxStartup() { +void AlloyMainDelegate::PreSandboxStartup() { const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); const std::string& process_type = @@ -674,13 +671,13 @@ void CefMainDelegate::PreSandboxStartup() { MaybeInitializeGDI(); } -void CefMainDelegate::SandboxInitialized(const std::string& process_type) { - CefContentClient::SetPDFEntryFunctions(chrome_pdf::PPP_GetInterface, - chrome_pdf::PPP_InitializeModule, - chrome_pdf::PPP_ShutdownModule); +void AlloyMainDelegate::SandboxInitialized(const std::string& process_type) { + AlloyContentClient::SetPDFEntryFunctions(chrome_pdf::PPP_GetInterface, + chrome_pdf::PPP_InitializeModule, + chrome_pdf::PPP_ShutdownModule); } -int CefMainDelegate::RunProcess( +int AlloyMainDelegate::RunProcess( const std::string& process_type, const content::MainFunctionParams& main_function_params) { if (process_type.empty()) { @@ -690,12 +687,12 @@ int CefMainDelegate::RunProcess( return -1; } -void CefMainDelegate::ProcessExiting(const std::string& process_type) { +void AlloyMainDelegate::ProcessExiting(const std::string& process_type) { ui::ResourceBundle::CleanupSharedInstance(); } #if defined(OS_LINUX) -void CefMainDelegate::ZygoteForked() { +void AlloyMainDelegate::ZygoteForked() { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); const std::string& process_type = command_line->GetSwitchValueASCII(switches::kProcessType); @@ -704,95 +701,58 @@ void CefMainDelegate::ZygoteForked() { } #endif -content::ContentBrowserClient* CefMainDelegate::CreateContentBrowserClient() { - browser_client_.reset(new CefContentBrowserClient); +content::ContentBrowserClient* AlloyMainDelegate::CreateContentBrowserClient() { + browser_client_.reset(new AlloyContentBrowserClient); return browser_client_.get(); } -content::ContentRendererClient* CefMainDelegate::CreateContentRendererClient() { - renderer_client_.reset(new CefContentRendererClient); +content::ContentRendererClient* +AlloyMainDelegate::CreateContentRendererClient() { + renderer_client_.reset(new AlloyContentRendererClient); return renderer_client_.get(); } -content::ContentUtilityClient* CefMainDelegate::CreateContentUtilityClient() { +content::ContentUtilityClient* AlloyMainDelegate::CreateContentUtilityClient() { utility_client_.reset(new ChromeContentUtilityClient); return utility_client_.get(); } -void CefMainDelegate::BeforeMainThreadInitialize(const CefMainArgs& args) { - g_browser_process = new ChromeBrowserProcessStub(); -} - -void CefMainDelegate::BeforeMainThreadRun() { - static_cast(g_browser_process)->Initialize(); -} - -void CefMainDelegate::AfterUIThreadInitialize() { -#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) - CefWidevineLoader::GetInstance()->OnContextInitialized(); -#endif - - static_cast(g_browser_process) - ->OnContextInitialized(); -} - -void CefMainDelegate::AfterUIThreadShutdown() { - static_cast(g_browser_process) - ->CleanupOnUIThread(); - - ui::ResourceBundle::GetSharedInstance().CleanupOnUIThread(); -} - -void CefMainDelegate::BeforeMainThreadShutdown() { - if (content::RenderProcessHost::run_renderer_in_process()) { - // Blocks until RenderProcess cleanup is complete. - CefContentRendererClient::Get()->RunSingleProcessCleanup(); - } -} - -void CefMainDelegate::AfterMainThreadShutdown() { - if (g_browser_process) { - delete g_browser_process; - g_browser_process = nullptr; - } -} - scoped_refptr -CefMainDelegate::GetBackgroundTaskRunner() { +AlloyMainDelegate::GetBackgroundTaskRunner() { if (browser_client_) return browser_client_->background_task_runner(); return nullptr; } scoped_refptr -CefMainDelegate::GetUserVisibleTaskRunner() { +AlloyMainDelegate::GetUserVisibleTaskRunner() { if (browser_client_) return browser_client_->user_visible_task_runner(); return nullptr; } scoped_refptr -CefMainDelegate::GetUserBlockingTaskRunner() { +AlloyMainDelegate::GetUserBlockingTaskRunner() { if (browser_client_) return browser_client_->user_blocking_task_runner(); return nullptr; } scoped_refptr -CefMainDelegate::GetRenderTaskRunner() { +AlloyMainDelegate::GetRenderTaskRunner() { if (renderer_client_) return renderer_client_->render_task_runner(); return nullptr; } scoped_refptr -CefMainDelegate::GetWebWorkerTaskRunner() { +AlloyMainDelegate::GetWebWorkerTaskRunner() { if (renderer_client_) return renderer_client_->GetCurrentTaskRunner(); return nullptr; } -void CefMainDelegate::InitializeResourceBundle() { +void AlloyMainDelegate::InitializeResourceBundle() { const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); base::FilePath cef_pak_file, cef_100_percent_pak_file, diff --git a/libcef/common/main_delegate.h b/libcef/common/alloy/alloy_main_delegate.h similarity index 59% rename from libcef/common/main_delegate.h rename to libcef/common/alloy/alloy_main_delegate.h index 40ab152f3..9ab9bb084 100644 --- a/libcef/common/main_delegate.h +++ b/libcef/common/alloy/alloy_main_delegate.h @@ -2,15 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CEF_LIBCEF_COMMON_MAIN_DELEGATE_H_ -#define CEF_LIBCEF_COMMON_MAIN_DELEGATE_H_ +#ifndef CEF_LIBCEF_COMMON_ALLOY_ALLOY_MAIN_DELEGATE_H_ +#define CEF_LIBCEF_COMMON_ALLOY_ALLOY_MAIN_DELEGATE_H_ #pragma once #include #include "include/cef_app.h" -#include "libcef/common/content_client.h" -#include "libcef/common/main_runner_delegate.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "libcef/common/main_runner_handler.h" #include "libcef/common/task_runner_manager.h" @@ -21,21 +20,20 @@ namespace base { class CommandLine; } -class CefContentBrowserClient; -class CefContentRendererClient; +class AlloyContentBrowserClient; +class AlloyContentRendererClient; class ChromeContentUtilityClient; // Manages state specific to the CEF runtime. -class CefMainDelegate : public content::ContentMainDelegate, - public CefMainRunnerDelegate, - public CefTaskRunnerManager { +class AlloyMainDelegate : public content::ContentMainDelegate, + public CefTaskRunnerManager { public: // |runner| and |settings| will be non-nullptr for the main process only, // and will outlive this object. - CefMainDelegate(CefMainRunnerHandler* runner, - CefSettings* settings, - CefRefPtr application); - ~CefMainDelegate() override; + AlloyMainDelegate(CefMainRunnerHandler* runner, + CefSettings* settings, + CefRefPtr application); + ~AlloyMainDelegate() override; // content::ContentMainDelegate overrides. void PreCreateMainMessageLoop() override; @@ -53,21 +51,10 @@ class CefMainDelegate : public content::ContentMainDelegate, content::ContentRendererClient* CreateContentRendererClient() override; content::ContentUtilityClient* CreateContentUtilityClient() override; - CefContentBrowserClient* browser_client() { return browser_client_.get(); } - CefContentClient* content_client() { return &content_client_; } + AlloyContentBrowserClient* browser_client() { return browser_client_.get(); } + AlloyContentClient* content_client() { return &content_client_; } protected: - // CefMainRunnerDelegate overrides. - content::ContentMainDelegate* GetContentMainDelegate() override { - return this; - } - void BeforeMainThreadInitialize(const CefMainArgs& args) override; - void BeforeMainThreadRun() override; - void AfterUIThreadInitialize() override; - void AfterUIThreadShutdown() override; - void BeforeMainThreadShutdown() override; - void AfterMainThreadShutdown() override; - // CefTaskRunnerManager overrides. scoped_refptr GetBackgroundTaskRunner() override; @@ -84,12 +71,12 @@ class CefMainDelegate : public content::ContentMainDelegate, CefMainRunnerHandler* const runner_; CefSettings* const settings_; - std::unique_ptr browser_client_; - std::unique_ptr renderer_client_; + std::unique_ptr browser_client_; + std::unique_ptr renderer_client_; std::unique_ptr utility_client_; - CefContentClient content_client_; + AlloyContentClient content_client_; - DISALLOW_COPY_AND_ASSIGN(CefMainDelegate); + DISALLOW_COPY_AND_ASSIGN(AlloyMainDelegate); }; -#endif // CEF_LIBCEF_COMMON_MAIN_DELEGATE_H_ +#endif // CEF_LIBCEF_COMMON_ALLOY_ALLOY_MAIN_DELEGATE_H_ diff --git a/libcef/common/alloy/alloy_main_runner_delegate.cc b/libcef/common/alloy/alloy_main_runner_delegate.cc new file mode 100644 index 000000000..788270fbd --- /dev/null +++ b/libcef/common/alloy/alloy_main_runner_delegate.cc @@ -0,0 +1,68 @@ +// Copyright 2020 The Chromium Embedded Framework Authors. +// Portions copyright 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "libcef/common/alloy/alloy_main_runner_delegate.h" + +#include "libcef/browser/alloy/chrome_browser_process_alloy.h" +#include "libcef/common/alloy/alloy_main_delegate.h" +#include "libcef/common/widevine_loader.h" +#include "libcef/renderer/alloy/alloy_content_renderer_client.h" + +#include "content/public/browser/render_process_host.h" +#include "ui/base/resource/resource_bundle.h" + +AlloyMainRunnerDelegate::AlloyMainRunnerDelegate(CefMainRunnerHandler* runner, + CefSettings* settings, + CefRefPtr application) + : runner_(runner), settings_(settings), application_(application) {} +AlloyMainRunnerDelegate::~AlloyMainRunnerDelegate() = default; + +content::ContentMainDelegate* +AlloyMainRunnerDelegate::GetContentMainDelegate() { + if (!main_delegate_) { + main_delegate_ = + std::make_unique(runner_, settings_, application_); + } + return main_delegate_.get(); +} + +void AlloyMainRunnerDelegate::BeforeMainThreadInitialize( + const CefMainArgs& args) { + g_browser_process = new ChromeBrowserProcessAlloy(); +} + +void AlloyMainRunnerDelegate::BeforeMainThreadRun() { + static_cast(g_browser_process)->Initialize(); +} + +void AlloyMainRunnerDelegate::AfterUIThreadInitialize() { +#if BUILDFLAG(ENABLE_WIDEVINE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) + CefWidevineLoader::GetInstance()->OnContextInitialized(); +#endif + + static_cast(g_browser_process) + ->OnContextInitialized(); +} + +void AlloyMainRunnerDelegate::AfterUIThreadShutdown() { + static_cast(g_browser_process) + ->CleanupOnUIThread(); + + ui::ResourceBundle::GetSharedInstance().CleanupOnUIThread(); +} + +void AlloyMainRunnerDelegate::BeforeMainThreadShutdown() { + if (content::RenderProcessHost::run_renderer_in_process()) { + // Blocks until RenderProcess cleanup is complete. + AlloyContentRendererClient::Get()->RunSingleProcessCleanup(); + } +} + +void AlloyMainRunnerDelegate::AfterMainThreadShutdown() { + if (g_browser_process) { + delete g_browser_process; + g_browser_process = nullptr; + } +} diff --git a/libcef/common/alloy/alloy_main_runner_delegate.h b/libcef/common/alloy/alloy_main_runner_delegate.h new file mode 100644 index 000000000..d78c289b7 --- /dev/null +++ b/libcef/common/alloy/alloy_main_runner_delegate.h @@ -0,0 +1,46 @@ +// Copyright 2020 The Chromium Embedded Framework Authors. +// Portions copyright 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CEF_LIBCEF_COMMON_ALLOY_ALLOY_MAIN_RUNNER_DELEGATE_ +#define CEF_LIBCEF_COMMON_ALLOY_ALLOY_MAIN_RUNNER_DELEGATE_ + +#include + +#include "include/cef_base.h" +#include "libcef/common/main_runner_delegate.h" +#include "libcef/common/main_runner_handler.h" + +class AlloyMainDelegate; + +class AlloyMainRunnerDelegate : public CefMainRunnerDelegate { + public: + // |runner| and |settings| will be non-nullptr for the main process only, and + // will outlive this object. + AlloyMainRunnerDelegate(CefMainRunnerHandler* runner, + CefSettings* settings, + CefRefPtr application); + ~AlloyMainRunnerDelegate() override; + + protected: + // CefMainRunnerDelegate overrides. + content::ContentMainDelegate* GetContentMainDelegate() override; + void BeforeMainThreadInitialize(const CefMainArgs& args) override; + void BeforeMainThreadRun() override; + void AfterUIThreadInitialize() override; + void AfterUIThreadShutdown() override; + void BeforeMainThreadShutdown() override; + void AfterMainThreadShutdown() override; + + private: + std::unique_ptr main_delegate_; + + CefMainRunnerHandler* const runner_; + CefSettings* const settings_; + CefRefPtr application_; + + DISALLOW_COPY_AND_ASSIGN(AlloyMainRunnerDelegate); +}; + +#endif // CEF_LIBCEF_COMMON_ALLOY_ALLOY_MAIN_RUNNER_DELEGATE_ diff --git a/libcef/common/crash_reporting.h b/libcef/common/crash_reporting.h index ab0dad275..6690fe221 100644 --- a/libcef/common/crash_reporting.h +++ b/libcef/common/crash_reporting.h @@ -20,7 +20,7 @@ bool Enabled(); bool SetCrashKeyValue(const base::StringPiece& key, const base::StringPiece& value); -// Functions are called from similarly named methods in CefMainDelegate. +// Functions are called from similarly named methods in AlloyMainDelegate. #if defined(OS_POSIX) void BasicStartupComplete(base::CommandLine* command_line); diff --git a/libcef/common/net/scheme_registration.cc b/libcef/common/net/scheme_registration.cc index ca1de5484..4145c5e16 100644 --- a/libcef/common/net/scheme_registration.cc +++ b/libcef/common/net/scheme_registration.cc @@ -4,7 +4,7 @@ #include "libcef/common/net/scheme_registration.h" -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "content/public/common/url_constants.h" #include "extensions/common/constants.h" @@ -18,8 +18,8 @@ void AddInternalSchemes(content::ContentClient::Schemes* schemes) { // chrome: and chrome-devtools: schemes are registered in // RenderThreadImpl::RegisterSchemes(). // Access restrictions for chrome-extension: and chrome-extension-resource: - // schemes will be applied in CefContentRendererClient::WillSendRequest(). - static CefContentClient::SchemeInfo internal_schemes[] = { + // schemes will be applied in AlloyContentRendererClient::WillSendRequest(). + static AlloyContentClient::SchemeInfo internal_schemes[] = { { extensions::kExtensionScheme, true, /* is_standard */ false, /* is_local */ @@ -32,7 +32,7 @@ void AddInternalSchemes(content::ContentClient::Schemes* schemes) { // The |is_display_isolated| value is excluded here because it's registered // with Blink only. - CefContentClient* client = CefContentClient::Get(); + AlloyContentClient* client = AlloyContentClient::Get(); for (size_t i = 0; i < sizeof(internal_schemes) / sizeof(internal_schemes[0]); ++i) { if (internal_schemes[i].is_standard) diff --git a/libcef/common/resource_bundle_delegate.cc b/libcef/common/resource_bundle_delegate.cc index 6746fd12d..4351f164c 100644 --- a/libcef/common/resource_bundle_delegate.cc +++ b/libcef/common/resource_bundle_delegate.cc @@ -1,6 +1,6 @@ #include "libcef/common/resource_bundle_delegate.h" -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" base::FilePath CefResourceBundleDelegate::GetPathForResourcePack( const base::FilePath& pack_path, diff --git a/libcef/common/resource_bundle_delegate.h b/libcef/common/resource_bundle_delegate.h index ca6d5fd7c..0084dbde1 100644 --- a/libcef/common/resource_bundle_delegate.h +++ b/libcef/common/resource_bundle_delegate.h @@ -9,11 +9,11 @@ #include "ui/base/resource/resource_bundle.h" -class CefContentClient; +class AlloyContentClient; class CefResourceBundleDelegate : public ui::ResourceBundle::Delegate { public: - CefResourceBundleDelegate(CefContentClient* content_client) + CefResourceBundleDelegate(AlloyContentClient* content_client) : content_client_(content_client) {} private: @@ -33,7 +33,7 @@ class CefResourceBundleDelegate : public ui::ResourceBundle::Delegate { bool GetLocalizedString(int message_id, base::string16* value) override; private: - CefContentClient* content_client_; + AlloyContentClient* content_client_; }; #endif // CEF_LIBCEF_COMMON_RESOURCE_BUNDLE_DELEGATE_H_ diff --git a/libcef/common/scheme_registrar_impl.cc b/libcef/common/scheme_registrar_impl.cc index 870d797a9..167e3cf2c 100644 --- a/libcef/common/scheme_registrar_impl.cc +++ b/libcef/common/scheme_registrar_impl.cc @@ -6,7 +6,7 @@ #include -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "libcef/common/net/scheme_registration.h" #include "base/bind.h" @@ -56,10 +56,10 @@ bool CefSchemeRegistrarImpl::AddCustomScheme(const CefString& scheme_name, if (is_csp_bypassing) schemes_.csp_bypassing_schemes.push_back(scheme); - CefContentClient::SchemeInfo scheme_info = { + AlloyContentClient::SchemeInfo scheme_info = { scheme, is_standard, is_local, is_display_isolated, is_secure, is_cors_enabled, is_csp_bypassing, is_fetch_enabled}; - CefContentClient::Get()->AddCustomScheme(scheme_info); + AlloyContentClient::Get()->AddCustomScheme(scheme_info); return true; } diff --git a/libcef/common/urlrequest_impl.cc b/libcef/common/urlrequest_impl.cc index f86b1a66b..643f719ec 100644 --- a/libcef/common/urlrequest_impl.cc +++ b/libcef/common/urlrequest_impl.cc @@ -4,7 +4,7 @@ #include "include/cef_urlrequest.h" #include "libcef/browser/net_service/browser_urlrequest_impl.h" -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "libcef/common/task_runner_impl.h" #include "libcef/renderer/render_urlrequest_impl.h" @@ -27,14 +27,14 @@ CefRefPtr CefURLRequest::Create( return nullptr; } - if (CefContentClient::Get()->browser()) { + if (AlloyContentClient::Get()->browser()) { // In the browser process. CefRefPtr impl = new CefBrowserURLRequest(nullptr, request, client, request_context); if (impl->Start()) return impl.get(); return nullptr; - } else if (CefContentClient::Get()->renderer()) { + } else if (AlloyContentClient::Get()->renderer()) { // In the render process. CefRefPtr impl = new CefRenderURLRequest(nullptr, request, client); diff --git a/libcef/common/widevine_loader.cc b/libcef/common/widevine_loader.cc index f2d9e3068..bad70b4a6 100644 --- a/libcef/common/widevine_loader.cc +++ b/libcef/common/widevine_loader.cc @@ -478,7 +478,7 @@ void CefWidevineLoader::AddContentDecryptionModules( } // The Widevine CDM path is passed to the zygote process via - // CefContentBrowserClient::AppendExtraCommandLineSwitches. + // AlloyContentBrowserClient::AppendExtraCommandLineSwitches. const base::FilePath& base_path = command_line.GetSwitchValuePath(switches::kWidevineCdmPath); if (base_path.empty()) diff --git a/libcef/common/widevine_loader.h b/libcef/common/widevine_loader.h index fef829ee5..706b314b2 100644 --- a/libcef/common/widevine_loader.h +++ b/libcef/common/widevine_loader.h @@ -44,7 +44,7 @@ class CefWidevineLoader { // The zygote process which is used when the sandbox is enabled on Linux // requires early loading of CDM modules. Other processes will receive // load notification in the usual way. - // Called from CefContentClient::AddContentDecryptionModules. + // Called from AlloyContentClient::AddContentDecryptionModules. static void AddContentDecryptionModules( std::vector* cdms, std::vector* cdm_host_file_paths); diff --git a/libcef/features/chrome_cef.h b/libcef/features/runtime.h similarity index 70% rename from libcef/features/chrome_cef.h rename to libcef/features/runtime.h index c93befeb8..b33a9b5c7 100644 --- a/libcef/features/chrome_cef.h +++ b/libcef/features/runtime.h @@ -2,8 +2,8 @@ // reserved. Use of this source code is governed by a BSD-style license that // can be found in the LICENSE file. -#ifndef CEF_LIBCEF_FEATURES_CHROME_CEF_H_ -#define CEF_LIBCEF_FEATURES_CHROME_CEF_H_ +#ifndef CEF_LIBCEF_FEATURES_RUNTIME_H_ +#define CEF_LIBCEF_FEATURES_RUNTIME_H_ #pragma once #include "cef/libcef/features/features.h" @@ -16,8 +16,8 @@ inline bool IsCefBuildEnabled() { return true; } -// True if CEF was initialized with the CEF runtime. -bool IsCefRuntimeEnabled(); +// True if CEF was initialized with the Alloy runtime. +bool IsAlloyRuntimeEnabled(); // True if CEF was initialized with the Chrome runtime. bool IsChromeRuntimeEnabled(); @@ -27,7 +27,7 @@ bool IsChromeRuntimeEnabled(); inline bool IsCefBuildEnabled() { return false; } -inline bool IsCefRuntimeEnabled() { +inline bool IsAlloyRuntimeEnabled() { return false; } inline bool IsChromeRuntimeEnabled() { @@ -38,4 +38,4 @@ inline bool IsChromeRuntimeEnabled() { } // namespace cef -#endif // CEF_LIBCEF_FEATURES_CHROME_CEF_H_ +#endif // CEF_LIBCEF_FEATURES_RUNTIME_H_ diff --git a/libcef/renderer/content_renderer_client.cc b/libcef/renderer/alloy/alloy_content_renderer_client.cc similarity index 88% rename from libcef/renderer/content_renderer_client.cc rename to libcef/renderer/alloy/alloy_content_renderer_client.cc index 8115e07ba..66fdb5aee 100644 --- a/libcef/renderer/content_renderer_client.cc +++ b/libcef/renderer/alloy/alloy_content_renderer_client.cc @@ -3,7 +3,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "libcef/renderer/content_renderer_client.h" +#include "libcef/renderer/alloy/alloy_content_renderer_client.h" #include @@ -20,11 +20,11 @@ #endif #endif -#include "libcef/browser/content_browser_client.h" +#include "libcef/browser/alloy/alloy_content_browser_client.h" #include "libcef/browser/context.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "libcef/common/cef_messages.h" #include "libcef/common/cef_switches.h" -#include "libcef/common/content_client.h" #include "libcef/common/extensions/extensions_client.h" #include "libcef/common/extensions/extensions_util.h" #include "libcef/common/request_impl.h" @@ -154,13 +154,13 @@ class CefGuestView : public content::RenderViewObserver { private: // RenderViewObserver methods. void OnDestruct() override { - CefContentRendererClient::Get()->OnGuestViewDestroyed(this); + AlloyContentRendererClient::Get()->OnGuestViewDestroyed(this); } const bool is_windowless_; }; -CefContentRendererClient::CefContentRendererClient() +AlloyContentRendererClient::AlloyContentRendererClient() : main_entry_time_(base::TimeTicks::Now()), devtools_agent_count_(0), uncaught_exception_stack_size_(0), @@ -175,15 +175,15 @@ CefContentRendererClient::CefContentRendererClient() } } -CefContentRendererClient::~CefContentRendererClient() {} +AlloyContentRendererClient::~AlloyContentRendererClient() {} // static -CefContentRendererClient* CefContentRendererClient::Get() { - return static_cast( - CefContentClient::Get()->renderer()); +AlloyContentRendererClient* AlloyContentRendererClient::Get() { + return static_cast( + AlloyContentClient::Get()->renderer()); } -CefRefPtr CefContentRendererClient::GetBrowserForView( +CefRefPtr AlloyContentRendererClient::GetBrowserForView( content::RenderView* view) { CEF_REQUIRE_RT_RETURN(nullptr); @@ -193,7 +193,7 @@ CefRefPtr CefContentRendererClient::GetBrowserForView( return nullptr; } -CefRefPtr CefContentRendererClient::GetBrowserForMainFrame( +CefRefPtr AlloyContentRendererClient::GetBrowserForMainFrame( blink::WebFrame* frame) { CEF_REQUIRE_RT_RETURN(nullptr); @@ -209,7 +209,7 @@ CefRefPtr CefContentRendererClient::GetBrowserForMainFrame( return nullptr; } -void CefContentRendererClient::OnBrowserDestroyed(CefBrowserImpl* browser) { +void AlloyContentRendererClient::OnBrowserDestroyed(CefBrowserImpl* browser) { BrowserMap::iterator it = browsers_.begin(); for (; it != browsers_.end(); ++it) { if (it->second.get() == browser) { @@ -222,7 +222,7 @@ void CefContentRendererClient::OnBrowserDestroyed(CefBrowserImpl* browser) { NOTREACHED(); } -CefGuestView* CefContentRendererClient::GetGuestViewForView( +CefGuestView* AlloyContentRendererClient::GetGuestViewForView( content::RenderView* view) { CEF_REQUIRE_RT_RETURN(nullptr); @@ -232,7 +232,8 @@ CefGuestView* CefContentRendererClient::GetGuestViewForView( return nullptr; } -void CefContentRendererClient::OnGuestViewDestroyed(CefGuestView* guest_view) { +void AlloyContentRendererClient::OnGuestViewDestroyed( + CefGuestView* guest_view) { GuestViewMap::iterator it = guest_views_.begin(); for (; it != guest_views_.end(); ++it) { if (it->second.get() == guest_view) { @@ -246,7 +247,7 @@ void CefContentRendererClient::OnGuestViewDestroyed(CefGuestView* guest_view) { } blink::WebURLLoaderFactory* -CefContentRendererClient::GetDefaultURLLoaderFactory() { +AlloyContentRendererClient::GetDefaultURLLoaderFactory() { if (!default_url_loader_factory_) { default_url_loader_factory_ = blink::Platform::Current()->CreateDefaultURLLoaderFactory(); @@ -254,7 +255,7 @@ CefContentRendererClient::GetDefaultURLLoaderFactory() { return default_url_loader_factory_.get(); } -void CefContentRendererClient::WebKitInitialized() { +void AlloyContentRendererClient::WebKitInitialized() { const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); @@ -264,14 +265,14 @@ void CefContentRendererClient::WebKitInitialized() { // TODO(cef): Enable these once the implementation supports it. blink::WebRuntimeFeatures::EnableNotifications(false); - const CefContentClient::SchemeInfoList* schemes = - CefContentClient::Get()->GetCustomSchemes(); + const AlloyContentClient::SchemeInfoList* schemes = + AlloyContentClient::Get()->GetCustomSchemes(); if (!schemes->empty()) { // Register the custom schemes. The |is_standard| value is excluded here // because it's not explicitly registered with Blink. - CefContentClient::SchemeInfoList::const_iterator it = schemes->begin(); + AlloyContentClient::SchemeInfoList::const_iterator it = schemes->begin(); for (; it != schemes->end(); ++it) { - const CefContentClient::SchemeInfo& info = *it; + const AlloyContentClient::SchemeInfo& info = *it; const blink::WebString& scheme = blink::WebString::FromUTF8(info.scheme_name); if (info.is_local) @@ -318,7 +319,7 @@ void CefContentRendererClient::WebKitInitialized() { } // Notify the render process handler. - CefRefPtr application = CefContentClient::Get()->application(); + CefRefPtr application = AlloyContentClient::Get()->application(); if (application.get()) { CefRefPtr handler = application->GetRenderProcessHandler(); @@ -328,14 +329,14 @@ void CefContentRendererClient::WebKitInitialized() { } scoped_refptr -CefContentRendererClient::GetCurrentTaskRunner() { +AlloyContentRendererClient::GetCurrentTaskRunner() { // Check if currently on the render thread. if (CEF_CURRENTLY_ON_RT()) return render_task_runner_; return nullptr; } -void CefContentRendererClient::RunSingleProcessCleanup() { +void AlloyContentRendererClient::RunSingleProcessCleanup() { DCHECK(content::RenderProcessHost::run_renderer_in_process()); // Make sure the render thread was actually started. @@ -347,8 +348,9 @@ void CefContentRendererClient::RunSingleProcessCleanup() { } else { base::PostTask( FROM_HERE, {content::BrowserThread::UI}, - base::Bind(&CefContentRendererClient::RunSingleProcessCleanupOnUIThread, - base::Unretained(this))); + base::Bind( + &AlloyContentRendererClient::RunSingleProcessCleanupOnUIThread, + base::Unretained(this))); } // Wait for the render thread cleanup to complete. Spin instead of using @@ -365,7 +367,7 @@ void CefContentRendererClient::RunSingleProcessCleanup() { } while (!complete); } -void CefContentRendererClient::RenderThreadStarted() { +void AlloyContentRendererClient::RenderThreadStarted() { const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); @@ -425,7 +427,7 @@ void CefContentRendererClient::RenderThreadStarted() { extensions_renderer_client_->RenderThreadStarted(); } -void CefContentRendererClient::ExposeInterfacesToBrowser( +void AlloyContentRendererClient::ExposeInterfacesToBrowser( mojo::BinderMap* binders) { auto task_runner = base::SequencedTaskRunnerHandle::Get(); @@ -446,7 +448,7 @@ void CefContentRendererClient::ExposeInterfacesToBrowser( } } -void CefContentRendererClient::RenderThreadConnected() { +void AlloyContentRendererClient::RenderThreadConnected() { content::RenderThread* thread = content::RenderThread::Get(); // Retrieve the new render thread information synchronously. @@ -457,7 +459,7 @@ void CefContentRendererClient::RenderThreadConnected() { cross_origin_whitelist_entries_ = params.cross_origin_whitelist_entries; // Notify the render process handler. - CefRefPtr application = CefContentClient::Get()->application(); + CefRefPtr application = AlloyContentClient::Get()->application(); if (application.get()) { CefRefPtr handler = application->GetRenderProcessHandler(); @@ -475,7 +477,7 @@ void CefContentRendererClient::RenderThreadConnected() { WebKitInitialized(); } -void CefContentRendererClient::RenderFrameCreated( +void AlloyContentRendererClient::RenderFrameCreated( content::RenderFrame* render_frame) { CefRenderFrameObserver* render_frame_observer = new CefRenderFrameObserver(render_frame); @@ -517,14 +519,14 @@ void CefContentRendererClient::RenderFrameCreated( } } -void CefContentRendererClient::RenderViewCreated( +void AlloyContentRendererClient::RenderViewCreated( content::RenderView* render_view) { new CefPrerendererClient(render_view); MaybeCreateBrowser(render_view, render_view->GetMainRenderFrame(), nullptr); } -bool CefContentRendererClient::IsPluginHandledExternally( +bool AlloyContentRendererClient::IsPluginHandledExternally( content::RenderFrame* render_frame, const blink::WebElement& plugin_element, const GURL& original_url, @@ -562,7 +564,7 @@ bool CefContentRendererClient::IsPluginHandledExternally( plugin_info->plugin); } -bool CefContentRendererClient::OverrideCreatePlugin( +bool AlloyContentRendererClient::OverrideCreatePlugin( content::RenderFrame* render_frame, const blink::WebPluginParams& params, blink::WebPlugin** plugin) { @@ -584,7 +586,7 @@ bool CefContentRendererClient::OverrideCreatePlugin( return true; } -void CefContentRendererClient::WillSendRequest( +void AlloyContentRendererClient::WillSendRequest( blink::WebLocalFrame* frame, ui::PageTransition transition_type, const blink::WebURL& url, @@ -601,23 +603,23 @@ void CefContentRendererClient::WillSendRequest( } } -uint64_t CefContentRendererClient::VisitedLinkHash(const char* canonical_url, - size_t length) { +uint64_t AlloyContentRendererClient::VisitedLinkHash(const char* canonical_url, + size_t length) { return visited_link_slave_->ComputeURLFingerprint(canonical_url, length); } -bool CefContentRendererClient::IsLinkVisited(uint64_t link_hash) { +bool AlloyContentRendererClient::IsLinkVisited(uint64_t link_hash) { return visited_link_slave_->IsVisited(link_hash); } -bool CefContentRendererClient::IsOriginIsolatedPepperPlugin( +bool AlloyContentRendererClient::IsOriginIsolatedPepperPlugin( const base::FilePath& plugin_path) { return plugin_path == - base::FilePath::FromUTF8Unsafe(CefContentClient::kPDFPluginPath); + base::FilePath::FromUTF8Unsafe(AlloyContentClient::kPDFPluginPath); } content::BrowserPluginDelegate* -CefContentRendererClient::CreateBrowserPluginDelegate( +AlloyContentRendererClient::CreateBrowserPluginDelegate( content::RenderFrame* render_frame, const content::WebPluginInfo& info, const std::string& mime_type, @@ -627,35 +629,35 @@ CefContentRendererClient::CreateBrowserPluginDelegate( render_frame, info, mime_type, original_url); } -void CefContentRendererClient::AddSupportedKeySystems( +void AlloyContentRendererClient::AddSupportedKeySystems( std::vector>* key_systems) { AddChromeKeySystems(key_systems); } -void CefContentRendererClient::RunScriptsAtDocumentStart( +void AlloyContentRendererClient::RunScriptsAtDocumentStart( content::RenderFrame* render_frame) { if (extensions::ExtensionsEnabled()) extensions_renderer_client_->RunScriptsAtDocumentStart(render_frame); } -void CefContentRendererClient::RunScriptsAtDocumentEnd( +void AlloyContentRendererClient::RunScriptsAtDocumentEnd( content::RenderFrame* render_frame) { if (extensions::ExtensionsEnabled()) extensions_renderer_client_->RunScriptsAtDocumentEnd(render_frame); } -void CefContentRendererClient::RunScriptsAtDocumentIdle( +void AlloyContentRendererClient::RunScriptsAtDocumentIdle( content::RenderFrame* render_frame) { if (extensions::ExtensionsEnabled()) extensions_renderer_client_->RunScriptsAtDocumentIdle(render_frame); } -void CefContentRendererClient::DevToolsAgentAttached() { +void AlloyContentRendererClient::DevToolsAgentAttached() { // WebWorkers may be creating agents on a different thread. if (!render_task_runner_->BelongsToCurrentThread()) { render_task_runner_->PostTask( FROM_HERE, - base::BindOnce(&CefContentRendererClient::DevToolsAgentAttached, + base::BindOnce(&AlloyContentRendererClient::DevToolsAgentAttached, base::Unretained(this))); return; } @@ -663,12 +665,12 @@ void CefContentRendererClient::DevToolsAgentAttached() { ++devtools_agent_count_; } -void CefContentRendererClient::DevToolsAgentDetached() { +void AlloyContentRendererClient::DevToolsAgentDetached() { // WebWorkers may be creating agents on a different thread. if (!render_task_runner_->BelongsToCurrentThread()) { render_task_runner_->PostTask( FROM_HERE, - base::BindOnce(&CefContentRendererClient::DevToolsAgentDetached, + base::BindOnce(&AlloyContentRendererClient::DevToolsAgentDetached, base::Unretained(this))); return; } @@ -682,19 +684,19 @@ void CefContentRendererClient::DevToolsAgentDetached() { } std::unique_ptr -CefContentRendererClient::CreateURLLoaderThrottleProvider( +AlloyContentRendererClient::CreateURLLoaderThrottleProvider( content::URLLoaderThrottleProviderType provider_type) { return std::make_unique(provider_type); } -bool CefContentRendererClient::RequiresWebComponentsV0(const GURL& url) { +bool AlloyContentRendererClient::RequiresWebComponentsV0(const GURL& url) { // TODO(1025782): For now, file:// URLs are allowed to access Web Components // v0 features. This will be removed once origin trials support file:// URLs // for this purpose. return url.SchemeIs(content::kChromeUIScheme) || url.SchemeIs("file"); } -void CefContentRendererClient::GetInterface( +void AlloyContentRendererClient::GetInterface( const std::string& interface_name, mojo::ScopedMessagePipeHandle interface_pipe) { // TODO(crbug.com/977637): Get rid of the use of this implementation of @@ -706,12 +708,12 @@ void CefContentRendererClient::GetInterface( mojo::GenericPendingReceiver(interface_name, std::move(interface_pipe))); } -void CefContentRendererClient::WillDestroyCurrentMessageLoop() { +void AlloyContentRendererClient::WillDestroyCurrentMessageLoop() { base::AutoLock lock_scope(single_process_cleanup_lock_); single_process_cleanup_complete_ = true; } -CefRefPtr CefContentRendererClient::MaybeCreateBrowser( +CefRefPtr AlloyContentRendererClient::MaybeCreateBrowser( content::RenderView* render_view, content::RenderFrame* render_frame, base::Optional* is_windowless) { @@ -776,7 +778,7 @@ CefRefPtr CefContentRendererClient::MaybeCreateBrowser( browsers_.insert(std::make_pair(render_view, browser)); // Notify the render process handler. - CefRefPtr application = CefContentClient::Get()->application(); + CefRefPtr application = AlloyContentClient::Get()->application(); if (application.get()) { CefRefPtr handler = application->GetRenderProcessHandler(); @@ -791,7 +793,7 @@ CefRefPtr CefContentRendererClient::MaybeCreateBrowser( return browser; } -void CefContentRendererClient::RunSingleProcessCleanupOnUIThread() { +void AlloyContentRendererClient::RunSingleProcessCleanupOnUIThread() { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); // Clean up the single existing RenderProcessHost. diff --git a/libcef/renderer/content_renderer_client.h b/libcef/renderer/alloy/alloy_content_renderer_client.h similarity index 94% rename from libcef/renderer/content_renderer_client.h rename to libcef/renderer/alloy/alloy_content_renderer_client.h index 19e83d614..3decbadd1 100644 --- a/libcef/renderer/content_renderer_client.h +++ b/libcef/renderer/alloy/alloy_content_renderer_client.h @@ -3,8 +3,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CEF_LIBCEF_RENDERER_CONTENT_RENDERER_CLIENT_H_ -#define CEF_LIBCEF_RENDERER_CONTENT_RENDERER_CLIENT_H_ +#ifndef CEF_LIBCEF_RENDERER_ALLOY_ALLOY_CONTENT_RENDERER_CLIENT_H_ +#define CEF_LIBCEF_RENDERER_ALLOY_ALLOY_CONTENT_RENDERER_CLIENT_H_ #pragma once #include @@ -53,16 +53,16 @@ struct Cef_CrossOriginWhiteListEntry_Params; class ChromePDFPrintClient; class SpellCheck; -class CefContentRendererClient +class AlloyContentRendererClient : public content::ContentRendererClient, public service_manager::LocalInterfaceProvider, public base::MessageLoopCurrent::DestructionObserver { public: - CefContentRendererClient(); - ~CefContentRendererClient() override; + AlloyContentRendererClient(); + ~AlloyContentRendererClient() override; - // Returns the singleton CefContentRendererClient instance. - static CefContentRendererClient* Get(); + // Returns the singleton AlloyContentRendererClient instance. + static AlloyContentRendererClient* Get(); // Returns the browser associated with the specified RenderView. CefRefPtr GetBrowserForView(content::RenderView* view); @@ -200,7 +200,7 @@ class CefContentRendererClient bool single_process_cleanup_complete_; base::Lock single_process_cleanup_lock_; - DISALLOW_COPY_AND_ASSIGN(CefContentRendererClient); + DISALLOW_COPY_AND_ASSIGN(AlloyContentRendererClient); }; -#endif // CEF_LIBCEF_RENDERER_CONTENT_RENDERER_CLIENT_H_ +#endif // CEF_LIBCEF_RENDERER_ALLOY_ALLOY_CONTENT_RENDERER_CLIENT_H_ diff --git a/libcef/renderer/browser_impl.cc b/libcef/renderer/browser_impl.cc index 0e67ca088..07d3fb51f 100644 --- a/libcef/renderer/browser_impl.cc +++ b/libcef/renderer/browser_impl.cc @@ -8,10 +8,10 @@ #include #include +#include "libcef/common/alloy/alloy_content_client.h" #include "libcef/common/cef_messages.h" -#include "libcef/common/content_client.h" +#include "libcef/renderer/alloy/alloy_content_renderer_client.h" #include "libcef/renderer/blink_glue.h" -#include "libcef/renderer/content_renderer_client.h" #include "libcef/renderer/render_frame_util.h" #include "libcef/renderer/thread_util.h" @@ -38,13 +38,13 @@ // static CefRefPtr CefBrowserImpl::GetBrowserForView( content::RenderView* view) { - return CefContentRendererClient::Get()->GetBrowserForView(view); + return AlloyContentRendererClient::Get()->GetBrowserForView(view); } // static CefRefPtr CefBrowserImpl::GetBrowserForMainFrame( blink::WebFrame* frame) { - return CefContentRendererClient::Get()->GetBrowserForMainFrame(frame); + return AlloyContentRendererClient::Get()->GetBrowserForMainFrame(frame); } // CefBrowser methods. @@ -345,14 +345,14 @@ void CefBrowserImpl::AddFrameObject(int64_t frame_id, void CefBrowserImpl::OnDestruct() { // Notify that the browser window has been destroyed. - CefRefPtr app = CefContentClient::Get()->application(); + CefRefPtr app = AlloyContentClient::Get()->application(); if (app.get()) { CefRefPtr handler = app->GetRenderProcessHandler(); if (handler.get()) handler->OnBrowserDestroyed(this); } - CefContentRendererClient::Get()->OnBrowserDestroyed(this); + AlloyContentRendererClient::Get()->OnBrowserDestroyed(this); } void CefBrowserImpl::FrameDetached(int64_t frame_id) { @@ -373,7 +373,7 @@ void CefBrowserImpl::FrameDetached(int64_t frame_id) { } void CefBrowserImpl::OnLoadingStateChange(bool isLoading) { - CefRefPtr app = CefContentClient::Get()->application(); + CefRefPtr app = AlloyContentClient::Get()->application(); if (app.get()) { CefRefPtr handler = app->GetRenderProcessHandler(); if (handler.get()) { diff --git a/libcef/renderer/extensions/extensions_renderer_client.h b/libcef/renderer/extensions/extensions_renderer_client.h index b82c3a9dc..206af6640 100644 --- a/libcef/renderer/extensions/extensions_renderer_client.h +++ b/libcef/renderer/extensions/extensions_renderer_client.h @@ -59,7 +59,7 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient { const GURL& scope, const GURL& script_url) const override; - // See CefContentRendererClient methods with the same names. + // See AlloyContentRendererClient methods with the same names. void RenderThreadStarted(); void RenderFrameCreated(content::RenderFrame* render_frame, service_manager::BinderRegistry* registry); diff --git a/libcef/renderer/frame_impl.cc b/libcef/renderer/frame_impl.cc index 648721d0f..63c22a16e 100644 --- a/libcef/renderer/frame_impl.cc +++ b/libcef/renderer/frame_impl.cc @@ -17,8 +17,8 @@ #endif #endif +#include "libcef/common/alloy/alloy_content_client.h" #include "libcef/common/cef_messages.h" -#include "libcef/common/content_client.h" #include "libcef/common/net/http_header_utils.h" #include "libcef/common/process_message_impl.h" #include "libcef/common/request_impl.h" @@ -325,7 +325,7 @@ void CefFrameImpl::OnDidFinishLoad() { Send(new CefHostMsg_DidFinishLoad(MSG_ROUTING_NONE, dl->GetUrl(), http_status_code)); - CefRefPtr app = CefContentClient::Get()->application(); + CefRefPtr app = AlloyContentClient::Get()->application(); if (app) { CefRefPtr handler = app->GetRenderProcessHandler(); if (handler) { @@ -417,7 +417,7 @@ void CefFrameImpl::OnRequest(const Cef_Request_Params& params) { if (params.user_initiated) { // Give the user a chance to handle the request. - CefRefPtr app = CefContentClient::Get()->application(); + CefRefPtr app = AlloyContentClient::Get()->application(); if (app.get()) { CefRefPtr handler = app->GetRenderProcessHandler(); diff --git a/libcef/renderer/render_frame_observer.cc b/libcef/renderer/render_frame_observer.cc index f3bf062b1..988d5d5c9 100644 --- a/libcef/renderer/render_frame_observer.cc +++ b/libcef/renderer/render_frame_observer.cc @@ -17,7 +17,7 @@ #include "libcef/renderer/render_frame_observer.h" -#include "libcef/common/content_client.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "libcef/renderer/blink_glue.h" #include "libcef/renderer/browser_impl.h" #include "libcef/renderer/dom_document_impl.h" @@ -96,7 +96,7 @@ void CefRenderFrameObserver::FocusedElementChanged( return; CefRefPtr handler; - CefRefPtr application = CefContentClient::Get()->application(); + CefRefPtr application = AlloyContentClient::Get()->application(); if (application) handler = application->GetRenderProcessHandler(); if (!handler) @@ -138,7 +138,7 @@ void CefRenderFrameObserver::DidCreateScriptContext( return; CefRefPtr handler; - CefRefPtr application = CefContentClient::Get()->application(); + CefRefPtr application = AlloyContentClient::Get()->application(); if (application) handler = application->GetRenderProcessHandler(); if (!handler) @@ -164,7 +164,7 @@ void CefRenderFrameObserver::WillReleaseScriptContext( CefRefPtr browserPtr = CefBrowserImpl::GetBrowserForMainFrame(frame->Top()); if (browserPtr) { - CefRefPtr application = CefContentClient::Get()->application(); + CefRefPtr application = AlloyContentClient::Get()->application(); if (application) { CefRefPtr handler = application->GetRenderProcessHandler(); @@ -210,7 +210,7 @@ void CefRenderFrameObserver::AttachFrame(CefFrameImpl* frame) { } void CefRenderFrameObserver::OnLoadStart() { - CefRefPtr app = CefContentClient::Get()->application(); + CefRefPtr app = AlloyContentClient::Get()->application(); if (app.get()) { CefRefPtr handler = app->GetRenderProcessHandler(); if (handler.get()) { @@ -226,7 +226,7 @@ void CefRenderFrameObserver::OnLoadStart() { } void CefRenderFrameObserver::OnLoadError() { - CefRefPtr app = CefContentClient::Get()->application(); + CefRefPtr app = AlloyContentClient::Get()->application(); if (app.get()) { CefRefPtr handler = app->GetRenderProcessHandler(); if (handler.get()) { diff --git a/libcef/renderer/render_thread_observer.cc b/libcef/renderer/render_thread_observer.cc index e4c3bdf3a..5bd79f67a 100644 --- a/libcef/renderer/render_thread_observer.cc +++ b/libcef/renderer/render_thread_observer.cc @@ -8,7 +8,6 @@ #include "libcef/common/cef_messages.h" #include "libcef/common/net/net_resource_provider.h" #include "libcef/renderer/blink_glue.h" -#include "libcef/renderer/content_renderer_client.h" #include "components/visitedlink/renderer/visitedlink_reader.h" #include "content/public/child/child_thread.h" diff --git a/libcef/renderer/render_urlrequest_impl.cc b/libcef/renderer/render_urlrequest_impl.cc index e1f853a6e..ffa436ecc 100644 --- a/libcef/renderer/render_urlrequest_impl.cc +++ b/libcef/renderer/render_urlrequest_impl.cc @@ -9,8 +9,8 @@ #include "libcef/common/request_impl.h" #include "libcef/common/response_impl.h" #include "libcef/common/task_runner_impl.h" +#include "libcef/renderer/alloy/alloy_content_renderer_client.h" #include "libcef/renderer/blink_glue.h" -#include "libcef/renderer/content_renderer_client.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" @@ -155,7 +155,7 @@ class CefRenderURLRequest::Context } if (!factory) { // This factory only supports unintercepted http(s) and blob requests. - factory = CefContentRendererClient::Get()->GetDefaultURLLoaderFactory(); + factory = AlloyContentRendererClient::Get()->GetDefaultURLLoaderFactory(); } loader_ = factory->CreateURLLoader( diff --git a/libcef/renderer/thread_util.h b/libcef/renderer/thread_util.h index 7087b5e09..7bf73f82f 100644 --- a/libcef/renderer/thread_util.h +++ b/libcef/renderer/thread_util.h @@ -6,7 +6,7 @@ #define CEF_LIBCEF_RENDERER_THREAD_UTIL_H_ #pragma once -#include "libcef/renderer/content_renderer_client.h" +#include "libcef/common/task_runner_manager.h" #include "base/location.h" #include "base/logging.h" @@ -28,12 +28,13 @@ return; \ } -#define CEF_RENDER_LOOP() \ - (CefContentRendererClient::Get()->render_task_runner()) +#define CEF_RENDER_TASK_RUNNER() \ + (CefTaskRunnerManager::Get()->GetRenderTaskRunner()) -#define CEF_POST_TASK_RT(task) CEF_RENDER_LOOP()->PostTask(FROM_HERE, task) +#define CEF_POST_TASK_RT(task) \ + CEF_RENDER_TASK_RUNNER()->PostTask(FROM_HERE, task) #define CEF_POST_DELAYED_TASK_RT(task, delay_ms) \ - CEF_RENDER_LOOP()->PostDelayedTask( \ + CEF_RENDER_TASK_RUNNER()->PostDelayedTask( \ FROM_HERE, task, base::TimeDelta::FromMilliseconds(delay_ms)) // Use this template in conjuction with RefCountedThreadSafe when you want to @@ -44,7 +45,7 @@ struct CefDeleteOnRenderThread { if (CEF_CURRENTLY_ON_RT()) { delete x; } else { - if (!CEF_RENDER_LOOP()->DeleteSoon(FROM_HERE, x)) { + if (!CEF_RENDER_TASK_RUNNER()->DeleteSoon(FROM_HERE, x)) { #if defined(UNIT_TEST) // Only logged under unit testing because leaks at shutdown // are acceptable under normal circumstances. diff --git a/libcef/renderer/v8_impl.cc b/libcef/renderer/v8_impl.cc index 63070b72b..1c3939164 100644 --- a/libcef/renderer/v8_impl.cc +++ b/libcef/renderer/v8_impl.cc @@ -25,8 +25,8 @@ #include "libcef/renderer/v8_impl.h" +#include "libcef/common/alloy/alloy_content_client.h" #include "libcef/common/cef_switches.h" -#include "libcef/common/content_client.h" #include "libcef/common/task_runner_impl.h" #include "libcef/common/tracker.h" #include "libcef/renderer/blink_glue.h" @@ -87,7 +87,7 @@ class CefV8IsolateManager { public: CefV8IsolateManager() : isolate_(v8::Isolate::GetCurrent()), - task_runner_(CefContentRendererClient::Get()->GetCurrentTaskRunner()), + task_runner_(CEF_RENDER_TASK_RUNNER()), message_listener_registered_(false), worker_id_(0) { DCHECK(isolate_); @@ -783,7 +783,7 @@ class CefV8ExceptionImpl : public CefV8Exception { void MessageListenerCallbackImpl(v8::Handle message, v8::Handle data) { - CefRefPtr application = CefContentClient::Get()->application(); + CefRefPtr application = AlloyContentClient::Get()->application(); if (!application.get()) return; diff --git a/patch/patches/chrome_runtime.patch b/patch/patches/chrome_runtime.patch index 2e23fed4d..f5a0d46dd 100644 --- a/patch/patches/chrome_runtime.patch +++ b/patch/patches/chrome_runtime.patch @@ -6,7 +6,7 @@ index c06585b15b8f..b5ed3518c0fd 100644 #include "build/branding_buildflags.h" #include "build/build_config.h" #include "cc/base/switches.h" -+#include "cef/libcef/features/chrome_cef.h" ++#include "cef/libcef/features/runtime.h" #include "chrome/browser/about_flags.h" #include "chrome/browser/active_use_util.h" #include "chrome/browser/after_startup_task_utils.h" diff --git a/patch/patches/services_network_2622.patch b/patch/patches/services_network_2622.patch index 40d52092c..0d13f20da 100644 --- a/patch/patches/services_network_2622.patch +++ b/patch/patches/services_network_2622.patch @@ -6,7 +6,7 @@ index 75a5ee192358..379e0bdd11b1 100644 #include "base/strings/string_split.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h" -+#include "cef/libcef/features/chrome_cef.h" ++#include "cef/libcef/features/runtime.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" @@ -19,7 +19,7 @@ index 75a5ee192358..379e0bdd11b1 100644 // Configure on-disk storage for non-OTR profiles. OTR profiles just use // default behavior (in memory storage, default sizes). - if (!in_memory) { -+ if (!in_memory && cef::IsCefRuntimeEnabled()) { ++ if (!in_memory && cef::IsAlloyRuntimeEnabled()) { + PrefService* prefs = profile_->GetPrefs(); + // Configure the HTTP cache path and size. + const base::FilePath& base_cache_path = @@ -31,7 +31,7 @@ index 75a5ee192358..379e0bdd11b1 100644 + prefs->GetInteger(prefs::kDiskCacheSize); + } + -+ if (!in_memory && !cef::IsCefRuntimeEnabled()) { ++ if (!in_memory && !cef::IsAlloyRuntimeEnabled()) { PrefService* local_state = g_browser_process->local_state(); // Configure the HTTP cache path and size. base::FilePath base_cache_path;