diff --git a/BUILD.gn b/BUILD.gn index eaa1e267b..fe7a31a9e 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -409,6 +409,8 @@ static_library("libcef_static") { gypi_paths.autogen_cpp_includes + [ "libcef/browser/alloy/alloy_browser_context.cc", "libcef/browser/alloy/alloy_browser_context.h", + "libcef/browser/alloy/alloy_browser_host_impl.cc", + "libcef/browser/alloy/alloy_browser_host_impl.h", "libcef/browser/alloy/alloy_browser_main.cc", "libcef/browser/alloy/alloy_browser_main.h", "libcef/browser/alloy/browser_platform_delegate_alloy.cc", @@ -432,8 +434,6 @@ static_library("libcef_static") { "libcef/browser/browser_host_base.cc", "libcef/browser/browser_host_base.h", "libcef/browser/browser_host_create.cc", - "libcef/browser/browser_host_impl.cc", - "libcef/browser/browser_host_impl.h", "libcef/browser/browser_info.cc", "libcef/browser/browser_info.h", "libcef/browser/browser_info_manager.cc", diff --git a/libcef/browser/alloy/alloy_browser_context.h b/libcef/browser/alloy/alloy_browser_context.h index b647b1ced..f6438b5e8 100644 --- a/libcef/browser/alloy/alloy_browser_context.h +++ b/libcef/browser/alloy/alloy_browser_context.h @@ -115,8 +115,8 @@ class AlloyBrowserContext : public ChromeProfileAlloy, return extension_system_; } - // Called from CefBrowserHostImpl::DidFinishNavigation to update the table of - // visited links. + // Called from AlloyBrowserHostImpl::DidFinishNavigation to update the table + // of visited links. void AddVisitedURLs(const std::vector& urls); // Called from DownloadPrefs::FromBrowserContext. diff --git a/libcef/browser/browser_host_impl.cc b/libcef/browser/alloy/alloy_browser_host_impl.cc similarity index 75% rename from libcef/browser/browser_host_impl.cc rename to libcef/browser/alloy/alloy_browser_host_impl.cc index 6db0dc6d5..7fe66702b 100644 --- a/libcef/browser/browser_host_impl.cc +++ b/libcef/browser/alloy/alloy_browser_host_impl.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/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include #include @@ -62,7 +62,7 @@ namespace { class ShowDevToolsHelper { public: - ShowDevToolsHelper(CefRefPtr browser, + ShowDevToolsHelper(CefRefPtr browser, const CefWindowInfo& windowInfo, CefRefPtr client, const CefBrowserSettings& settings, @@ -73,7 +73,7 @@ class ShowDevToolsHelper { settings_(settings), inspect_element_at_(inspect_element_at) {} - CefRefPtr browser_; + CefRefPtr browser_; CefWindowInfo window_info_; CefRefPtr client_; CefBrowserSettings settings_; @@ -91,7 +91,7 @@ class CefWidgetHostInterceptor : public blink::mojom::WidgetHostInterceptorForTesting, public content::RenderWidgetHostObserver { public: - CefWidgetHostInterceptor(CefBrowserHostImpl* browser, + CefWidgetHostInterceptor(AlloyBrowserHostImpl* browser, content::RenderViewHost* render_view_host) : browser_(browser), render_widget_host_( @@ -120,7 +120,7 @@ class CefWidgetHostInterceptor } private: - CefBrowserHostImpl* const browser_; + AlloyBrowserHostImpl* const browser_; content::RenderWidgetHostImpl* const render_widget_host_; blink::mojom::WidgetHost* const impl_; @@ -132,11 +132,11 @@ static constexpr base::TimeDelta kRecentlyAudibleTimeout = } // namespace -// CefBrowserHostImpl static methods. +// AlloyBrowserHostImpl static methods. // ----------------------------------------------------------------------------- // static -CefRefPtr CefBrowserHostImpl::Create( +CefRefPtr AlloyBrowserHostImpl::Create( CreateParams& create_params) { std::unique_ptr platform_delegate = CefBrowserPlatformDelegate::Create(create_params); @@ -168,10 +168,10 @@ CefRefPtr CefBrowserHostImpl::Create( auto platform_delegate_ptr = platform_delegate.get(); - CefRefPtr browser = CreateInternal( + CefRefPtr browser = CreateInternal( create_params.settings, create_params.client, web_contents, own_web_contents, info, - static_cast(create_params.devtools_opener.get()), + static_cast(create_params.devtools_opener.get()), is_devtools_popup, request_context_impl, std::move(platform_delegate), cef_extension); if (!browser) @@ -191,13 +191,13 @@ CefRefPtr CefBrowserHostImpl::Create( } // static -CefRefPtr CefBrowserHostImpl::CreateInternal( +CefRefPtr AlloyBrowserHostImpl::CreateInternal( const CefBrowserSettings& settings, CefRefPtr client, content::WebContents* web_contents, bool own_web_contents, scoped_refptr browser_info, - CefRefPtr opener, + CefRefPtr opener, bool is_devtools_popup, CefRefPtr request_context, std::unique_ptr platform_delegate, @@ -229,7 +229,7 @@ CefRefPtr CefBrowserHostImpl::CreateInternal( // Take ownership of |web_contents| if |own_web_contents| is true. platform_delegate->WebContentsCreated(web_contents, own_web_contents); - CefRefPtr browser = new CefBrowserHostImpl( + CefRefPtr browser = new AlloyBrowserHostImpl( settings, client, web_contents, browser_info, opener, request_context, std::move(platform_delegate), extension); browser->InitializeBrowser(); @@ -259,54 +259,54 @@ CefRefPtr CefBrowserHostImpl::CreateInternal( } // static -CefRefPtr CefBrowserHostImpl::GetBrowserForHost( +CefRefPtr AlloyBrowserHostImpl::GetBrowserForHost( const content::RenderViewHost* host) { REQUIRE_ALLOY_RUNTIME(); auto browser = CefBrowserHostBase::GetBrowserForHost(host); - return static_cast(browser.get()); + return static_cast(browser.get()); } // static -CefRefPtr CefBrowserHostImpl::GetBrowserForHost( +CefRefPtr AlloyBrowserHostImpl::GetBrowserForHost( const content::RenderFrameHost* host) { REQUIRE_ALLOY_RUNTIME(); auto browser = CefBrowserHostBase::GetBrowserForHost(host); - return static_cast(browser.get()); + return static_cast(browser.get()); } // static -CefRefPtr CefBrowserHostImpl::GetBrowserForContents( +CefRefPtr AlloyBrowserHostImpl::GetBrowserForContents( const content::WebContents* contents) { REQUIRE_ALLOY_RUNTIME(); auto browser = CefBrowserHostBase::GetBrowserForContents(contents); - return static_cast(browser.get()); + return static_cast(browser.get()); } // static -CefRefPtr CefBrowserHostImpl::GetBrowserForFrameTreeNode( - int frame_tree_node_id) { +CefRefPtr +AlloyBrowserHostImpl::GetBrowserForFrameTreeNode(int frame_tree_node_id) { REQUIRE_ALLOY_RUNTIME(); auto browser = CefBrowserHostBase::GetBrowserForFrameTreeNode(frame_tree_node_id); - return static_cast(browser.get()); + return static_cast(browser.get()); } // static -CefRefPtr CefBrowserHostImpl::GetBrowserForFrameRoute( +CefRefPtr AlloyBrowserHostImpl::GetBrowserForFrameRoute( int render_process_id, int render_routing_id) { REQUIRE_ALLOY_RUNTIME(); auto browser = CefBrowserHostBase::GetBrowserForFrameRoute(render_process_id, render_routing_id); - return static_cast(browser.get()); + return static_cast(browser.get()); } -// CefBrowserHostImpl methods. +// AlloyBrowserHostImpl methods. // ----------------------------------------------------------------------------- -CefBrowserHostImpl::~CefBrowserHostImpl() {} +AlloyBrowserHostImpl::~AlloyBrowserHostImpl() {} -void CefBrowserHostImpl::CloseBrowser(bool force_close) { +void AlloyBrowserHostImpl::CloseBrowser(bool force_close) { if (CEF_CURRENTLY_ON_UIT()) { // Exit early if a close attempt is already pending and this method is // called again from somewhere other than WindowDestroyed(). @@ -333,12 +333,12 @@ void CefBrowserHostImpl::CloseBrowser(bool force_close) { CloseContents(contents); } } else { - CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::CloseBrowser, + CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::CloseBrowser, this, force_close)); } } -bool CefBrowserHostImpl::TryCloseBrowser() { +bool AlloyBrowserHostImpl::TryCloseBrowser() { if (!CEF_CURRENTLY_ON_UIT()) { NOTREACHED() << "called on invalid thread"; return false; @@ -359,10 +359,10 @@ bool CefBrowserHostImpl::TryCloseBrowser() { return true; } -void CefBrowserHostImpl::SetFocus(bool focus) { +void AlloyBrowserHostImpl::SetFocus(bool focus) { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::SetFocus, this, focus)); + base::BindOnce(&AlloyBrowserHostImpl::SetFocus, this, focus)); return; } @@ -372,7 +372,7 @@ void CefBrowserHostImpl::SetFocus(bool focus) { platform_delegate_->SendFocusEvent(false); } -CefWindowHandle CefBrowserHostImpl::GetWindowHandle() { +CefWindowHandle AlloyBrowserHostImpl::GetWindowHandle() { if (IsViewsHosted() && CEF_CURRENTLY_ON_UIT()) { // Always return the most up-to-date window handle for a views-hosted // browser since it may change if the view is re-parented. @@ -382,15 +382,15 @@ CefWindowHandle CefBrowserHostImpl::GetWindowHandle() { return host_window_handle_; } -CefWindowHandle CefBrowserHostImpl::GetOpenerWindowHandle() { +CefWindowHandle AlloyBrowserHostImpl::GetOpenerWindowHandle() { return opener_; } -bool CefBrowserHostImpl::HasView() { +bool AlloyBrowserHostImpl::HasView() { return IsViewsHosted(); } -double CefBrowserHostImpl::GetZoomLevel() { +double AlloyBrowserHostImpl::GetZoomLevel() { // Verify that this method is being called on the UI thread. if (!CEF_CURRENTLY_ON_UIT()) { NOTREACHED() << "called on invalid thread"; @@ -403,17 +403,17 @@ double CefBrowserHostImpl::GetZoomLevel() { return 0; } -void CefBrowserHostImpl::SetZoomLevel(double zoomLevel) { +void AlloyBrowserHostImpl::SetZoomLevel(double zoomLevel) { if (CEF_CURRENTLY_ON_UIT()) { if (web_contents()) content::HostZoomMap::SetZoomLevel(web_contents(), zoomLevel); } else { - CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::SetZoomLevel, + CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SetZoomLevel, this, zoomLevel)); } } -void CefBrowserHostImpl::RunFileDialog( +void AlloyBrowserHostImpl::RunFileDialog( FileDialogMode mode, const CefString& title, const CefString& default_file_path, @@ -422,8 +422,8 @@ void CefBrowserHostImpl::RunFileDialog( CefRefPtr callback) { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::RunFileDialog, this, mode, - title, default_file_path, accept_filters, + base::BindOnce(&AlloyBrowserHostImpl::RunFileDialog, this, + mode, title, default_file_path, accept_filters, selected_accept_filter, callback)); return; } @@ -434,9 +434,9 @@ void CefBrowserHostImpl::RunFileDialog( callback); } -void CefBrowserHostImpl::Print() { +void AlloyBrowserHostImpl::Print() { if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::Print, this)); + CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::Print, this)); return; } @@ -444,12 +444,12 @@ void CefBrowserHostImpl::Print() { platform_delegate_->Print(); } -void CefBrowserHostImpl::PrintToPDF(const CefString& path, - const CefPdfPrintSettings& settings, - CefRefPtr callback) { +void AlloyBrowserHostImpl::PrintToPDF(const CefString& path, + const CefPdfPrintSettings& settings, + CefRefPtr callback) { if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::PrintToPDF, this, - path, settings, callback)); + CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::PrintToPDF, + this, path, settings, callback)); return; } @@ -458,14 +458,14 @@ void CefBrowserHostImpl::PrintToPDF(const CefString& path, } } -void CefBrowserHostImpl::Find(int identifier, - const CefString& searchText, - bool forward, - bool matchCase, - bool findNext) { +void AlloyBrowserHostImpl::Find(int identifier, + const CefString& searchText, + bool forward, + bool matchCase, + bool findNext) { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::Find, this, identifier, + base::BindOnce(&AlloyBrowserHostImpl::Find, this, identifier, searchText, forward, matchCase, findNext)); return; } @@ -476,9 +476,9 @@ void CefBrowserHostImpl::Find(int identifier, } } -void CefBrowserHostImpl::StopFinding(bool clearSelection) { +void AlloyBrowserHostImpl::StopFinding(bool clearSelection) { if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::StopFinding, + CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::StopFinding, this, clearSelection)); return; } @@ -487,10 +487,10 @@ void CefBrowserHostImpl::StopFinding(bool clearSelection) { platform_delegate_->StopFinding(clearSelection); } -void CefBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo, - CefRefPtr client, - const CefBrowserSettings& settings, - const CefPoint& inspect_element_at) { +void AlloyBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo, + CefRefPtr client, + const CefBrowserSettings& settings, + const CefPoint& inspect_element_at) { if (!CEF_CURRENTLY_ON_UIT()) { ShowDevToolsHelper* helper = new ShowDevToolsHelper( this, windowInfo, client, settings, inspect_element_at); @@ -504,10 +504,10 @@ void CefBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo, inspect_element_at); } -void CefBrowserHostImpl::CloseDevTools() { +void AlloyBrowserHostImpl::CloseDevTools() { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::CloseDevTools, this)); + base::BindOnce(&AlloyBrowserHostImpl::CloseDevTools, this)); return; } @@ -516,7 +516,7 @@ void CefBrowserHostImpl::CloseDevTools() { devtools_manager_->CloseDevTools(); } -bool CefBrowserHostImpl::HasDevTools() { +bool AlloyBrowserHostImpl::HasDevTools() { if (!CEF_CURRENTLY_ON_UIT()) { NOTREACHED() << "called on invalid thread"; return false; @@ -527,8 +527,8 @@ bool CefBrowserHostImpl::HasDevTools() { return devtools_manager_->HasDevTools(); } -bool CefBrowserHostImpl::SendDevToolsMessage(const void* message, - size_t message_size) { +bool AlloyBrowserHostImpl::SendDevToolsMessage(const void* message, + size_t message_size) { if (!message || message_size == 0) return false; @@ -537,10 +537,10 @@ bool CefBrowserHostImpl::SendDevToolsMessage(const void* message, CEF_POST_TASK( CEF_UIT, base::BindOnce( - [](CefRefPtr self, std::string message_str) { + [](CefRefPtr self, std::string message_str) { self->SendDevToolsMessage(message_str.data(), message_str.size()); }, - CefRefPtr(this), std::move(message_str))); + CefRefPtr(this), std::move(message_str))); return false; } @@ -549,15 +549,16 @@ bool CefBrowserHostImpl::SendDevToolsMessage(const void* message, return devtools_manager_->SendDevToolsMessage(message, message_size); } -int CefBrowserHostImpl::ExecuteDevToolsMethod( +int AlloyBrowserHostImpl::ExecuteDevToolsMethod( int message_id, const CefString& method, CefRefPtr params) { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK( - CEF_UIT, base::BindOnce(base::IgnoreResult( - &CefBrowserHostImpl::ExecuteDevToolsMethod), - this, message_id, method, params)); + CEF_UIT, + base::BindOnce( + base::IgnoreResult(&AlloyBrowserHostImpl::ExecuteDevToolsMethod), + this, message_id, method, params)); return 0; } @@ -566,7 +567,7 @@ int CefBrowserHostImpl::ExecuteDevToolsMethod( return devtools_manager_->ExecuteDevToolsMethod(message_id, method, params); } -CefRefPtr CefBrowserHostImpl::AddDevToolsMessageObserver( +CefRefPtr AlloyBrowserHostImpl::AddDevToolsMessageObserver( CefRefPtr observer) { if (!observer) return nullptr; @@ -575,7 +576,7 @@ CefRefPtr CefBrowserHostImpl::AddDevToolsMessageObserver( return registration.get(); } -bool CefBrowserHostImpl::EnsureDevToolsManager() { +bool AlloyBrowserHostImpl::EnsureDevToolsManager() { CEF_REQUIRE_UIT(); if (!web_contents()) return false; @@ -586,14 +587,14 @@ bool CefBrowserHostImpl::EnsureDevToolsManager() { return true; } -void CefBrowserHostImpl::InitializeDevToolsRegistrationOnUIThread( +void AlloyBrowserHostImpl::InitializeDevToolsRegistrationOnUIThread( CefRefPtr registration) { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK( CEF_UIT, base::BindOnce( - &CefBrowserHostImpl::InitializeDevToolsRegistrationOnUIThread, this, - registration)); + &AlloyBrowserHostImpl::InitializeDevToolsRegistrationOnUIThread, + this, registration)); return; } @@ -602,11 +603,11 @@ void CefBrowserHostImpl::InitializeDevToolsRegistrationOnUIThread( devtools_manager_->InitializeRegistrationOnUIThread(registration); } -void CefBrowserHostImpl::SetAccessibilityState( +void AlloyBrowserHostImpl::SetAccessibilityState( cef_state_t accessibility_state) { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::SetAccessibilityState, + base::BindOnce(&AlloyBrowserHostImpl::SetAccessibilityState, this, accessibility_state)); return; } @@ -616,13 +617,13 @@ void CefBrowserHostImpl::SetAccessibilityState( } } -void CefBrowserHostImpl::SetAutoResizeEnabled(bool enabled, - const CefSize& min_size, - const CefSize& max_size) { +void AlloyBrowserHostImpl::SetAutoResizeEnabled(bool enabled, + const CefSize& min_size, + const CefSize& max_size) { if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK( - CEF_UIT, base::BindOnce(&CefBrowserHostImpl::SetAutoResizeEnabled, this, - enabled, min_size, max_size)); + CEF_POST_TASK(CEF_UIT, + base::BindOnce(&AlloyBrowserHostImpl::SetAutoResizeEnabled, + this, enabled, min_size, max_size)); return; } @@ -631,34 +632,34 @@ void CefBrowserHostImpl::SetAutoResizeEnabled(bool enabled, } } -CefRefPtr CefBrowserHostImpl::GetExtension() { +CefRefPtr AlloyBrowserHostImpl::GetExtension() { return extension_; } -bool CefBrowserHostImpl::IsBackgroundHost() { +bool AlloyBrowserHostImpl::IsBackgroundHost() { return is_background_host_; } -void CefBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) { +void AlloyBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) { base::AutoLock lock_scope(state_lock_); if (mouse_cursor_change_disabled_ == disabled) return; mouse_cursor_change_disabled_ = disabled; } -bool CefBrowserHostImpl::IsMouseCursorChangeDisabled() { +bool AlloyBrowserHostImpl::IsMouseCursorChangeDisabled() { base::AutoLock lock_scope(state_lock_); return mouse_cursor_change_disabled_; } -bool CefBrowserHostImpl::IsWindowRenderingDisabled() { +bool AlloyBrowserHostImpl::IsWindowRenderingDisabled() { return IsWindowless(); } -void CefBrowserHostImpl::WasResized() { +void AlloyBrowserHostImpl::WasResized() { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::WasResized, this)); + base::BindOnce(&AlloyBrowserHostImpl::WasResized, this)); return; } @@ -666,7 +667,7 @@ void CefBrowserHostImpl::WasResized() { platform_delegate_->WasResized(); } -void CefBrowserHostImpl::WasHidden(bool hidden) { +void AlloyBrowserHostImpl::WasHidden(bool hidden) { if (!IsWindowless()) { NOTREACHED() << "Window rendering is not disabled"; return; @@ -682,7 +683,7 @@ void CefBrowserHostImpl::WasHidden(bool hidden) { platform_delegate_->WasHidden(hidden); } -void CefBrowserHostImpl::NotifyScreenInfoChanged() { +void AlloyBrowserHostImpl::NotifyScreenInfoChanged() { if (!IsWindowless()) { NOTREACHED() << "Window rendering is not disabled"; return; @@ -691,7 +692,7 @@ void CefBrowserHostImpl::NotifyScreenInfoChanged() { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK( CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::NotifyScreenInfoChanged, this)); + base::BindOnce(&AlloyBrowserHostImpl::NotifyScreenInfoChanged, this)); return; } @@ -699,23 +700,7 @@ void CefBrowserHostImpl::NotifyScreenInfoChanged() { platform_delegate_->NotifyScreenInfoChanged(); } -void CefBrowserHostImpl::Invalidate(PaintElementType type) { - if (!IsWindowless()) { - NOTREACHED() << "Window rendering is not disabled"; - return; - } - - if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::Invalidate, this, type)); - return; - } - - if (platform_delegate_) - platform_delegate_->Invalidate(type); -} - -void CefBrowserHostImpl::SendExternalBeginFrame() { +void AlloyBrowserHostImpl::Invalidate(PaintElementType type) { if (!IsWindowless()) { NOTREACHED() << "Window rendering is not disabled"; return; @@ -723,7 +708,24 @@ void CefBrowserHostImpl::SendExternalBeginFrame() { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK( - CEF_UIT, base::Bind(&CefBrowserHostImpl::SendExternalBeginFrame, this)); + CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::Invalidate, this, type)); + return; + } + + if (platform_delegate_) + platform_delegate_->Invalidate(type); +} + +void AlloyBrowserHostImpl::SendExternalBeginFrame() { + if (!IsWindowless()) { + NOTREACHED() << "Window rendering is not disabled"; + return; + } + + if (!CEF_CURRENTLY_ON_UIT()) { + CEF_POST_TASK( + CEF_UIT, + base::Bind(&AlloyBrowserHostImpl::SendExternalBeginFrame, this)); return; } @@ -731,9 +733,9 @@ void CefBrowserHostImpl::SendExternalBeginFrame() { platform_delegate_->SendExternalBeginFrame(); } -void CefBrowserHostImpl::SendKeyEvent(const CefKeyEvent& event) { +void AlloyBrowserHostImpl::SendKeyEvent(const CefKeyEvent& event) { if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::SendKeyEvent, + CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SendKeyEvent, this, event)); return; } @@ -742,14 +744,14 @@ void CefBrowserHostImpl::SendKeyEvent(const CefKeyEvent& event) { platform_delegate_->SendKeyEvent(event); } -void CefBrowserHostImpl::SendMouseClickEvent(const CefMouseEvent& event, - MouseButtonType type, - bool mouseUp, - int clickCount) { +void AlloyBrowserHostImpl::SendMouseClickEvent(const CefMouseEvent& event, + MouseButtonType type, + bool mouseUp, + int clickCount) { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::SendMouseClickEvent, this, - event, type, mouseUp, clickCount)); + base::BindOnce(&AlloyBrowserHostImpl::SendMouseClickEvent, + this, event, type, mouseUp, clickCount)); return; } @@ -758,12 +760,12 @@ void CefBrowserHostImpl::SendMouseClickEvent(const CefMouseEvent& event, } } -void CefBrowserHostImpl::SendMouseMoveEvent(const CefMouseEvent& event, - bool mouseLeave) { +void AlloyBrowserHostImpl::SendMouseMoveEvent(const CefMouseEvent& event, + bool mouseLeave) { if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::SendMouseMoveEvent, this, - event, mouseLeave)); + CEF_POST_TASK( + CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SendMouseMoveEvent, this, + event, mouseLeave)); return; } @@ -772,9 +774,9 @@ void CefBrowserHostImpl::SendMouseMoveEvent(const CefMouseEvent& event, } } -void CefBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event, - int deltaX, - int deltaY) { +void AlloyBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event, + int deltaX, + int deltaY) { if (deltaX == 0 && deltaY == 0) { // Nothing to do. return; @@ -782,8 +784,8 @@ void CefBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event, if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::SendMouseWheelEvent, this, - event, deltaX, deltaY)); + base::BindOnce(&AlloyBrowserHostImpl::SendMouseWheelEvent, + this, event, deltaX, deltaY)); return; } @@ -792,15 +794,15 @@ void CefBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event, } } -void CefBrowserHostImpl::SendTouchEvent(const CefTouchEvent& event) { +void AlloyBrowserHostImpl::SendTouchEvent(const CefTouchEvent& event) { if (!IsWindowless()) { NOTREACHED() << "Window rendering is not disabled"; return; } if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK(CEF_UIT, - base::Bind(&CefBrowserHostImpl::SendTouchEvent, this, event)); + CEF_POST_TASK(CEF_UIT, base::Bind(&AlloyBrowserHostImpl::SendTouchEvent, + this, event)); return; } @@ -808,15 +810,15 @@ void CefBrowserHostImpl::SendTouchEvent(const CefTouchEvent& event) { platform_delegate_->SendTouchEvent(event); } -void CefBrowserHostImpl::SendFocusEvent(bool setFocus) { +void AlloyBrowserHostImpl::SendFocusEvent(bool setFocus) { SetFocus(setFocus); } -void CefBrowserHostImpl::SendCaptureLostEvent() { +void AlloyBrowserHostImpl::SendCaptureLostEvent() { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK( CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::SendCaptureLostEvent, this)); + base::BindOnce(&AlloyBrowserHostImpl::SendCaptureLostEvent, this)); return; } @@ -824,12 +826,12 @@ void CefBrowserHostImpl::SendCaptureLostEvent() { platform_delegate_->SendCaptureLostEvent(); } -void CefBrowserHostImpl::NotifyMoveOrResizeStarted() { +void AlloyBrowserHostImpl::NotifyMoveOrResizeStarted() { #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK( CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::NotifyMoveOrResizeStarted, this)); + base::BindOnce(&AlloyBrowserHostImpl::NotifyMoveOrResizeStarted, this)); return; } @@ -838,7 +840,7 @@ void CefBrowserHostImpl::NotifyMoveOrResizeStarted() { #endif } -int CefBrowserHostImpl::GetWindowlessFrameRate() { +int AlloyBrowserHostImpl::GetWindowlessFrameRate() { // Verify that this method is being called on the UI thread. if (!CEF_CURRENTLY_ON_UIT()) { NOTREACHED() << "called on invalid thread"; @@ -848,10 +850,10 @@ int CefBrowserHostImpl::GetWindowlessFrameRate() { return osr_util::ClampFrameRate(settings_.windowless_frame_rate); } -void CefBrowserHostImpl::SetWindowlessFrameRate(int frame_rate) { +void AlloyBrowserHostImpl::SetWindowlessFrameRate(int frame_rate) { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::SetWindowlessFrameRate, + base::BindOnce(&AlloyBrowserHostImpl::SetWindowlessFrameRate, this, frame_rate)); return; } @@ -865,8 +867,8 @@ void CefBrowserHostImpl::SetWindowlessFrameRate(int frame_rate) { // CefBrowser methods. // ----------------------------------------------------------------------------- -void CefBrowserHostImpl::GoBack() { - auto callback = base::BindOnce(&CefBrowserHostImpl::GoBack, this); +void AlloyBrowserHostImpl::GoBack() { + auto callback = base::BindOnce(&AlloyBrowserHostImpl::GoBack, this); if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, std::move(callback)); } @@ -881,8 +883,8 @@ void CefBrowserHostImpl::GoBack() { } } -void CefBrowserHostImpl::GoForward() { - auto callback = base::BindOnce(&CefBrowserHostImpl::GoForward, this); +void AlloyBrowserHostImpl::GoForward() { + auto callback = base::BindOnce(&AlloyBrowserHostImpl::GoForward, this); if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, std::move(callback)); } @@ -897,8 +899,8 @@ void CefBrowserHostImpl::GoForward() { } } -void CefBrowserHostImpl::Reload() { - auto callback = base::BindOnce(&CefBrowserHostImpl::Reload, this); +void AlloyBrowserHostImpl::Reload() { + auto callback = base::BindOnce(&AlloyBrowserHostImpl::Reload, this); if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, std::move(callback)); } @@ -913,8 +915,9 @@ void CefBrowserHostImpl::Reload() { } } -void CefBrowserHostImpl::ReloadIgnoreCache() { - auto callback = base::BindOnce(&CefBrowserHostImpl::ReloadIgnoreCache, this); +void AlloyBrowserHostImpl::ReloadIgnoreCache() { + auto callback = + base::BindOnce(&AlloyBrowserHostImpl::ReloadIgnoreCache, this); if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, std::move(callback)); } @@ -929,8 +932,8 @@ void CefBrowserHostImpl::ReloadIgnoreCache() { } } -void CefBrowserHostImpl::StopLoad() { - auto callback = base::BindOnce(&CefBrowserHostImpl::StopLoad, this); +void AlloyBrowserHostImpl::StopLoad() { + auto callback = base::BindOnce(&AlloyBrowserHostImpl::StopLoad, this); if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, std::move(callback)); } @@ -945,30 +948,30 @@ void CefBrowserHostImpl::StopLoad() { } } -// CefBrowserHostImpl public methods. +// AlloyBrowserHostImpl public methods. // ----------------------------------------------------------------------------- -bool CefBrowserHostImpl::IsWindowless() const { +bool AlloyBrowserHostImpl::IsWindowless() const { return is_windowless_; } -bool CefBrowserHostImpl::IsViewsHosted() const { +bool AlloyBrowserHostImpl::IsViewsHosted() const { return is_views_hosted_; } -bool CefBrowserHostImpl::IsPictureInPictureSupported() const { +bool AlloyBrowserHostImpl::IsPictureInPictureSupported() const { // Not currently supported with OSR. return !IsWindowless(); } -void CefBrowserHostImpl::WindowDestroyed() { +void AlloyBrowserHostImpl::WindowDestroyed() { CEF_REQUIRE_UIT(); DCHECK(!window_destroyed_); window_destroyed_ = true; CloseBrowser(true); } -void CefBrowserHostImpl::DestroyBrowser() { +void AlloyBrowserHostImpl::DestroyBrowser() { CEF_REQUIRE_UIT(); destruction_state_ = DESTRUCTION_STATE_COMPLETED; @@ -1025,14 +1028,14 @@ void CefBrowserHostImpl::DestroyBrowser() { } #if defined(USE_AURA) -views::Widget* CefBrowserHostImpl::GetWindowWidget() const { +views::Widget* AlloyBrowserHostImpl::GetWindowWidget() const { CEF_REQUIRE_UIT(); if (!platform_delegate_) return nullptr; return platform_delegate_->GetWindowWidget(); } -CefRefPtr CefBrowserHostImpl::GetBrowserView() const { +CefRefPtr AlloyBrowserHostImpl::GetBrowserView() const { CEF_REQUIRE_UIT(); if (IsViewsHosted() && platform_delegate_) return platform_delegate_->GetBrowserView(); @@ -1040,16 +1043,16 @@ CefRefPtr CefBrowserHostImpl::GetBrowserView() const { } #endif -void CefBrowserHostImpl::CancelContextMenu() { +void AlloyBrowserHostImpl::CancelContextMenu() { CEF_REQUIRE_UIT(); if (menu_manager_) menu_manager_->CancelContextMenu(); } -void CefBrowserHostImpl::ViewText(const std::string& text) { +void AlloyBrowserHostImpl::ViewText(const std::string& text) { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::ViewText, this, text)); + base::BindOnce(&AlloyBrowserHostImpl::ViewText, this, text)); return; } @@ -1057,19 +1060,19 @@ void CefBrowserHostImpl::ViewText(const std::string& text) { platform_delegate_->ViewText(text); } -SkColor CefBrowserHostImpl::GetBackgroundColor() const { +SkColor AlloyBrowserHostImpl::GetBackgroundColor() const { // Don't use |platform_delegate_| because it's not thread-safe. return CefContext::Get()->GetBackgroundColor( &settings_, is_windowless_ ? STATE_ENABLED : STATE_DISABLED); } -extensions::ExtensionHost* CefBrowserHostImpl::GetExtensionHost() const { +extensions::ExtensionHost* AlloyBrowserHostImpl::GetExtensionHost() const { CEF_REQUIRE_UIT(); DCHECK(platform_delegate_); return platform_delegate_->GetExtensionHost(); } -void CefBrowserHostImpl::OnSetFocus(cef_focus_source_t source) { +void AlloyBrowserHostImpl::OnSetFocus(cef_focus_source_t source) { if (CEF_CURRENTLY_ON_UIT()) { // SetFocus() might be called while inside the OnSetFocus() callback. If // so, don't re-enter the callback. @@ -1090,54 +1093,54 @@ void CefBrowserHostImpl::OnSetFocus(cef_focus_source_t source) { if (platform_delegate_) platform_delegate_->SendFocusEvent(true); } else { - CEF_POST_TASK( - CEF_UIT, base::BindOnce(&CefBrowserHostImpl::OnSetFocus, this, source)); + CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::OnSetFocus, + this, source)); } } -void CefBrowserHostImpl::RunFileChooser( +void AlloyBrowserHostImpl::RunFileChooser( const CefFileDialogRunner::FileChooserParams& params, CefFileDialogRunner::RunFileChooserCallback callback) { EnsureFileDialogManager(); file_dialog_manager_->RunFileChooser(params, std::move(callback)); } -bool CefBrowserHostImpl::EmbedsFullscreenWidget() { +bool AlloyBrowserHostImpl::EmbedsFullscreenWidget() { // When using windowless rendering do not allow Flash to create its own // full- screen widget. return IsWindowless(); } -void CefBrowserHostImpl::EnterFullscreenModeForTab( +void AlloyBrowserHostImpl::EnterFullscreenModeForTab( content::RenderFrameHost* requesting_frame, const blink::mojom::FullscreenOptions& options) { contents_delegate_->EnterFullscreenModeForTab(requesting_frame, options); WasResized(); } -void CefBrowserHostImpl::ExitFullscreenModeForTab( +void AlloyBrowserHostImpl::ExitFullscreenModeForTab( content::WebContents* web_contents) { contents_delegate_->ExitFullscreenModeForTab(web_contents); WasResized(); } -bool CefBrowserHostImpl::IsFullscreenForTabOrPending( +bool AlloyBrowserHostImpl::IsFullscreenForTabOrPending( const content::WebContents* web_contents) { return is_fullscreen_; } -blink::mojom::DisplayMode CefBrowserHostImpl::GetDisplayMode( +blink::mojom::DisplayMode AlloyBrowserHostImpl::GetDisplayMode( const content::WebContents* web_contents) { return is_fullscreen_ ? blink::mojom::DisplayMode::kFullscreen : blink::mojom::DisplayMode::kBrowser; } -void CefBrowserHostImpl::FindReply(content::WebContents* web_contents, - int request_id, - int number_of_matches, - const gfx::Rect& selection_rect, - int active_match_ordinal, - bool final_update) { +void AlloyBrowserHostImpl::FindReply(content::WebContents* web_contents, + int request_id, + int number_of_matches, + const gfx::Rect& selection_rect, + int active_match_ordinal, + bool final_update) { if (client_.get()) { CefRefPtr handler = client_->GetFindHandler(); if (handler.get()) { @@ -1149,7 +1152,7 @@ void CefBrowserHostImpl::FindReply(content::WebContents* web_contents, } } -void CefBrowserHostImpl::ImeSetComposition( +void AlloyBrowserHostImpl::ImeSetComposition( const CefString& text, const std::vector& underlines, const CefRange& replacement_range, @@ -1162,7 +1165,7 @@ void CefBrowserHostImpl::ImeSetComposition( if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK( CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::ImeSetComposition, this, text, + base::BindOnce(&AlloyBrowserHostImpl::ImeSetComposition, this, text, underlines, replacement_range, selection_range)); return; } @@ -1173,9 +1176,9 @@ void CefBrowserHostImpl::ImeSetComposition( } } -void CefBrowserHostImpl::ImeCommitText(const CefString& text, - const CefRange& replacement_range, - int relative_cursor_pos) { +void AlloyBrowserHostImpl::ImeCommitText(const CefString& text, + const CefRange& replacement_range, + int relative_cursor_pos) { if (!IsWindowless()) { NOTREACHED() << "Window rendering is not disabled"; return; @@ -1183,8 +1186,8 @@ void CefBrowserHostImpl::ImeCommitText(const CefString& text, if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::ImeCommitText, this, text, - replacement_range, relative_cursor_pos)); + base::BindOnce(&AlloyBrowserHostImpl::ImeCommitText, this, + text, replacement_range, relative_cursor_pos)); return; } @@ -1194,7 +1197,7 @@ void CefBrowserHostImpl::ImeCommitText(const CefString& text, } } -void CefBrowserHostImpl::ImeFinishComposingText(bool keep_selection) { +void AlloyBrowserHostImpl::ImeFinishComposingText(bool keep_selection) { if (!IsWindowless()) { NOTREACHED() << "Window rendering is not disabled"; return; @@ -1202,7 +1205,7 @@ void CefBrowserHostImpl::ImeFinishComposingText(bool keep_selection) { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::ImeFinishComposingText, + base::BindOnce(&AlloyBrowserHostImpl::ImeFinishComposingText, this, keep_selection)); return; } @@ -1212,7 +1215,7 @@ void CefBrowserHostImpl::ImeFinishComposingText(bool keep_selection) { } } -void CefBrowserHostImpl::ImeCancelComposition() { +void AlloyBrowserHostImpl::ImeCancelComposition() { if (!IsWindowless()) { NOTREACHED() << "Window rendering is not disabled"; return; @@ -1221,7 +1224,7 @@ void CefBrowserHostImpl::ImeCancelComposition() { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK( CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::ImeCancelComposition, this)); + base::BindOnce(&AlloyBrowserHostImpl::ImeCancelComposition, this)); return; } @@ -1229,7 +1232,7 @@ void CefBrowserHostImpl::ImeCancelComposition() { platform_delegate_->ImeCancelComposition(); } -void CefBrowserHostImpl::DragTargetDragEnter( +void AlloyBrowserHostImpl::DragTargetDragEnter( CefRefPtr drag_data, const CefMouseEvent& event, CefBrowserHost::DragOperationsMask allowed_ops) { @@ -1240,8 +1243,8 @@ void CefBrowserHostImpl::DragTargetDragEnter( if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::DragTargetDragEnter, this, - drag_data, event, allowed_ops)); + base::BindOnce(&AlloyBrowserHostImpl::DragTargetDragEnter, + this, drag_data, event, allowed_ops)); return; } @@ -1255,7 +1258,7 @@ void CefBrowserHostImpl::DragTargetDragEnter( } } -void CefBrowserHostImpl::DragTargetDragOver( +void AlloyBrowserHostImpl::DragTargetDragOver( const CefMouseEvent& event, CefBrowserHost::DragOperationsMask allowed_ops) { if (!IsWindowless()) { @@ -1264,9 +1267,9 @@ void CefBrowserHostImpl::DragTargetDragOver( } if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK(CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::DragTargetDragOver, this, - event, allowed_ops)); + CEF_POST_TASK( + CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::DragTargetDragOver, this, + event, allowed_ops)); return; } @@ -1275,39 +1278,7 @@ void CefBrowserHostImpl::DragTargetDragOver( } } -void CefBrowserHostImpl::DragTargetDragLeave() { - if (!IsWindowless()) { - NOTREACHED() << "Window rendering is not disabled"; - return; - } - - if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK(CEF_UIT, base::BindOnce( - &CefBrowserHostImpl::DragTargetDragLeave, this)); - return; - } - - if (platform_delegate_) - platform_delegate_->DragTargetDragLeave(); -} - -void CefBrowserHostImpl::DragTargetDrop(const CefMouseEvent& event) { - if (!IsWindowless()) { - NOTREACHED() << "Window rendering is not disabled"; - return; - } - - if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::DragTargetDrop, - this, event)); - return; - } - - if (platform_delegate_) - platform_delegate_->DragTargetDrop(event); -} - -void CefBrowserHostImpl::DragSourceSystemDragEnded() { +void AlloyBrowserHostImpl::DragTargetDragLeave() { if (!IsWindowless()) { NOTREACHED() << "Window rendering is not disabled"; return; @@ -1316,7 +1287,40 @@ void CefBrowserHostImpl::DragSourceSystemDragEnded() { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK( CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::DragSourceSystemDragEnded, this)); + base::BindOnce(&AlloyBrowserHostImpl::DragTargetDragLeave, this)); + return; + } + + if (platform_delegate_) + platform_delegate_->DragTargetDragLeave(); +} + +void AlloyBrowserHostImpl::DragTargetDrop(const CefMouseEvent& event) { + if (!IsWindowless()) { + NOTREACHED() << "Window rendering is not disabled"; + return; + } + + if (!CEF_CURRENTLY_ON_UIT()) { + CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::DragTargetDrop, + this, event)); + return; + } + + if (platform_delegate_) + platform_delegate_->DragTargetDrop(event); +} + +void AlloyBrowserHostImpl::DragSourceSystemDragEnded() { + if (!IsWindowless()) { + NOTREACHED() << "Window rendering is not disabled"; + return; + } + + if (!CEF_CURRENTLY_ON_UIT()) { + CEF_POST_TASK( + CEF_UIT, + base::BindOnce(&AlloyBrowserHostImpl::DragSourceSystemDragEnded, this)); return; } @@ -1324,7 +1328,7 @@ void CefBrowserHostImpl::DragSourceSystemDragEnded() { platform_delegate_->DragSourceSystemDragEnded(); } -void CefBrowserHostImpl::DragSourceEndedAt( +void AlloyBrowserHostImpl::DragSourceEndedAt( int x, int y, CefBrowserHost::DragOperationsMask op) { @@ -1334,9 +1338,9 @@ void CefBrowserHostImpl::DragSourceEndedAt( } if (!CEF_CURRENTLY_ON_UIT()) { - CEF_POST_TASK( - CEF_UIT, - base::BindOnce(&CefBrowserHostImpl::DragSourceEndedAt, this, x, y, op)); + CEF_POST_TASK(CEF_UIT, + base::BindOnce(&AlloyBrowserHostImpl::DragSourceEndedAt, this, + x, y, op)); return; } @@ -1344,10 +1348,10 @@ void CefBrowserHostImpl::DragSourceEndedAt( platform_delegate_->DragSourceEndedAt(x, y, op); } -void CefBrowserHostImpl::SetAudioMuted(bool mute) { +void AlloyBrowserHostImpl::SetAudioMuted(bool mute) { if (!CEF_CURRENTLY_ON_UIT()) { CEF_POST_TASK(CEF_UIT, - base::Bind(&CefBrowserHostImpl::SetAudioMuted, this, mute)); + base::Bind(&AlloyBrowserHostImpl::SetAudioMuted, this, mute)); return; } if (!web_contents()) @@ -1355,7 +1359,7 @@ void CefBrowserHostImpl::SetAudioMuted(bool mute) { web_contents()->SetAudioMuted(mute); } -bool CefBrowserHostImpl::IsAudioMuted() { +bool AlloyBrowserHostImpl::IsAudioMuted() { if (!CEF_CURRENTLY_ON_UIT()) { NOTREACHED() << "called on invalid thread"; return false; @@ -1370,7 +1374,7 @@ bool CefBrowserHostImpl::IsAudioMuted() { // |source| may be NULL if the navigation originates from a guest view via // AlloyContentBrowserClient::CanCreateWindow. -content::WebContents* CefBrowserHostImpl::OpenURLFromTab( +content::WebContents* AlloyBrowserHostImpl::OpenURLFromTab( content::WebContents* source, const content::OpenURLParams& params) { bool cancel = false; @@ -1397,12 +1401,12 @@ content::WebContents* CefBrowserHostImpl::OpenURLFromTab( return nullptr; } -bool CefBrowserHostImpl::ShouldTransferNavigation( +bool AlloyBrowserHostImpl::ShouldTransferNavigation( bool is_main_frame_navigation) { return platform_delegate_->ShouldTransferNavigation(is_main_frame_navigation); } -void CefBrowserHostImpl::AddNewContents( +void AlloyBrowserHostImpl::AddNewContents( content::WebContents* source, std::unique_ptr new_contents, const GURL& target_url, @@ -1415,12 +1419,12 @@ void CefBrowserHostImpl::AddNewContents( user_gesture, was_blocked); } -void CefBrowserHostImpl::LoadingStateChanged(content::WebContents* source, - bool to_different_document) { +void AlloyBrowserHostImpl::LoadingStateChanged(content::WebContents* source, + bool to_different_document) { contents_delegate_->LoadingStateChanged(source, to_different_document); } -void CefBrowserHostImpl::CloseContents(content::WebContents* source) { +void AlloyBrowserHostImpl::CloseContents(content::WebContents* source) { CEF_REQUIRE_UIT(); if (destruction_state_ == DESTRUCTION_STATE_COMPLETED) @@ -1449,7 +1453,7 @@ void CefBrowserHostImpl::CloseContents(content::WebContents* source) { } else { // Keep a reference to the browser while it's in the process of being // destroyed. - CefRefPtr browser(this); + CefRefPtr browser(this); // No window exists. Destroy the browser immediately. Don't call other // browser methods after calling DestroyBrowser(). @@ -1460,12 +1464,12 @@ void CefBrowserHostImpl::CloseContents(content::WebContents* source) { } } -void CefBrowserHostImpl::UpdateTargetURL(content::WebContents* source, - const GURL& url) { +void AlloyBrowserHostImpl::UpdateTargetURL(content::WebContents* source, + const GURL& url) { contents_delegate_->UpdateTargetURL(source, url); } -bool CefBrowserHostImpl::DidAddMessageToConsole( +bool AlloyBrowserHostImpl::DidAddMessageToConsole( content::WebContents* source, blink::mojom::ConsoleMessageLevel level, const base::string16& message, @@ -1475,9 +1479,9 @@ bool CefBrowserHostImpl::DidAddMessageToConsole( line_no, source_id); } -void CefBrowserHostImpl::BeforeUnloadFired(content::WebContents* source, - bool proceed, - bool* proceed_to_fire_unload) { +void AlloyBrowserHostImpl::BeforeUnloadFired(content::WebContents* source, + bool proceed, + bool* proceed_to_fire_unload) { if (destruction_state_ == DESTRUCTION_STATE_ACCEPTED || proceed) { *proceed_to_fire_unload = true; } else if (!proceed) { @@ -1486,7 +1490,8 @@ void CefBrowserHostImpl::BeforeUnloadFired(content::WebContents* source, } } -bool CefBrowserHostImpl::TakeFocus(content::WebContents* source, bool reverse) { +bool AlloyBrowserHostImpl::TakeFocus(content::WebContents* source, + bool reverse) { if (client_.get()) { CefRefPtr handler = client_->GetFocusHandler(); if (handler.get()) @@ -1496,13 +1501,13 @@ bool CefBrowserHostImpl::TakeFocus(content::WebContents* source, bool reverse) { return false; } -bool CefBrowserHostImpl::HandleContextMenu( +bool AlloyBrowserHostImpl::HandleContextMenu( content::RenderFrameHost* render_frame_host, const content::ContextMenuParams& params) { return HandleContextMenu(web_contents(), params); } -KeyboardEventProcessingResult CefBrowserHostImpl::PreHandleKeyboardEvent( +KeyboardEventProcessingResult AlloyBrowserHostImpl::PreHandleKeyboardEvent( content::WebContents* source, const content::NativeWebKeyboardEvent& event) { if (platform_delegate_ && client_.get()) { @@ -1527,7 +1532,7 @@ KeyboardEventProcessingResult CefBrowserHostImpl::PreHandleKeyboardEvent( return KeyboardEventProcessingResult::NOT_HANDLED; } -bool CefBrowserHostImpl::HandleKeyboardEvent( +bool AlloyBrowserHostImpl::HandleKeyboardEvent( content::WebContents* source, const content::NativeWebKeyboardEvent& event) { // Check to see if event should be ignored. @@ -1554,15 +1559,15 @@ bool CefBrowserHostImpl::HandleKeyboardEvent( return platform_delegate_->HandleKeyboardEvent(event); } -bool CefBrowserHostImpl::PreHandleGestureEvent( +bool AlloyBrowserHostImpl::PreHandleGestureEvent( content::WebContents* source, const blink::WebGestureEvent& event) { return platform_delegate_->PreHandleGestureEvent(source, event); } -bool CefBrowserHostImpl::CanDragEnter(content::WebContents* source, - const content::DropData& data, - blink::WebDragOperationsMask mask) { +bool AlloyBrowserHostImpl::CanDragEnter(content::WebContents* source, + const content::DropData& data, + blink::WebDragOperationsMask mask) { CefRefPtr handler; if (client_) handler = client_->GetDragHandler(); @@ -1578,7 +1583,7 @@ bool CefBrowserHostImpl::CanDragEnter(content::WebContents* source, return true; } -void CefBrowserHostImpl::GetCustomWebContentsView( +void AlloyBrowserHostImpl::GetCustomWebContentsView( content::WebContents* web_contents, const GURL& target_url, int opener_render_process_id, @@ -1590,7 +1595,7 @@ void CefBrowserHostImpl::GetCustomWebContentsView( delegate_view); } -void CefBrowserHostImpl::WebContentsCreated( +void AlloyBrowserHostImpl::WebContentsCreated( content::WebContents* source_contents, int opener_render_process_id, int opener_render_frame_id, @@ -1612,7 +1617,8 @@ void CefBrowserHostImpl::WebContentsCreated( CHECK(info.get()); CHECK(info->is_popup()); - CefRefPtr opener = GetBrowserForContents(source_contents); + CefRefPtr opener = + GetBrowserForContents(source_contents); if (!opener) return; @@ -1622,19 +1628,19 @@ void CefBrowserHostImpl::WebContentsCreated( // We don't officially own |new_contents| until AddNewContents() is called. // However, we need to install observers/delegates here. - CefRefPtr browser = + CefRefPtr browser = CreateInternal(settings, client, new_contents, /*own_web_contents=*/false, info, opener, /*is_devtools_popup=*/false, request_context, std::move(platform_delegate), /*cef_extension=*/nullptr); } -void CefBrowserHostImpl::DidNavigateMainFramePostCommit( +void AlloyBrowserHostImpl::DidNavigateMainFramePostCommit( content::WebContents* web_contents) { contents_delegate_->DidNavigateMainFramePostCommit(web_contents); } content::JavaScriptDialogManager* -CefBrowserHostImpl::GetJavaScriptDialogManager(content::WebContents* source) { +AlloyBrowserHostImpl::GetJavaScriptDialogManager(content::WebContents* source) { if (!javascript_dialog_manager_.get() && platform_delegate_) { javascript_dialog_manager_.reset(new CefJavaScriptDialogManager( this, platform_delegate_->CreateJavaScriptDialogRunner())); @@ -1642,7 +1648,7 @@ CefBrowserHostImpl::GetJavaScriptDialogManager(content::WebContents* source) { return javascript_dialog_manager_.get(); } -void CefBrowserHostImpl::RunFileChooser( +void AlloyBrowserHostImpl::RunFileChooser( content::RenderFrameHost* render_frame_host, scoped_refptr listener, const blink::mojom::FileChooserParams& params) { @@ -1650,7 +1656,7 @@ void CefBrowserHostImpl::RunFileChooser( file_dialog_manager_->RunFileChooser(listener, params); } -bool CefBrowserHostImpl::HandleContextMenu( +bool AlloyBrowserHostImpl::HandleContextMenu( content::WebContents* web_contents, const content::ContextMenuParams& params) { CEF_REQUIRE_UIT(); @@ -1661,8 +1667,8 @@ bool CefBrowserHostImpl::HandleContextMenu( return menu_manager_->CreateContextMenu(params); } -void CefBrowserHostImpl::UpdatePreferredSize(content::WebContents* source, - const gfx::Size& pref_size) { +void AlloyBrowserHostImpl::UpdatePreferredSize(content::WebContents* source, + const gfx::Size& pref_size) { #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) CEF_REQUIRE_UIT(); if (platform_delegate_) @@ -1670,8 +1676,8 @@ void CefBrowserHostImpl::UpdatePreferredSize(content::WebContents* source, #endif } -void CefBrowserHostImpl::ResizeDueToAutoResize(content::WebContents* source, - const gfx::Size& new_size) { +void AlloyBrowserHostImpl::ResizeDueToAutoResize(content::WebContents* source, + const gfx::Size& new_size) { CEF_REQUIRE_UIT(); if (client_) { @@ -1685,7 +1691,7 @@ void CefBrowserHostImpl::ResizeDueToAutoResize(content::WebContents* source, UpdatePreferredSize(source, new_size); } -void CefBrowserHostImpl::RequestMediaAccessPermission( +void AlloyBrowserHostImpl::RequestMediaAccessPermission( content::WebContents* web_contents, const content::MediaStreamRequest& request, content::MediaResponseCallback callback) { @@ -1743,7 +1749,7 @@ void CefBrowserHostImpl::RequestMediaAccessPermission( std::unique_ptr()); } -bool CefBrowserHostImpl::CheckMediaAccessPermission( +bool AlloyBrowserHostImpl::CheckMediaAccessPermission( content::RenderFrameHost* render_frame_host, const GURL& security_origin, blink::mojom::MediaStreamType type) { @@ -1754,11 +1760,12 @@ bool CefBrowserHostImpl::CheckMediaAccessPermission( return command_line->HasSwitch(switches::kEnableMediaStream); } -bool CefBrowserHostImpl::IsNeverComposited(content::WebContents* web_contents) { +bool AlloyBrowserHostImpl::IsNeverComposited( + content::WebContents* web_contents) { return platform_delegate_->IsNeverComposited(web_contents); } -content::PictureInPictureResult CefBrowserHostImpl::EnterPictureInPicture( +content::PictureInPictureResult AlloyBrowserHostImpl::EnterPictureInPicture( content::WebContents* web_contents, const viz::SurfaceId& surface_id, const gfx::Size& natural_size) { @@ -1770,7 +1777,7 @@ content::PictureInPictureResult CefBrowserHostImpl::EnterPictureInPicture( web_contents, surface_id, natural_size); } -void CefBrowserHostImpl::ExitPictureInPicture() { +void AlloyBrowserHostImpl::ExitPictureInPicture() { DCHECK(IsPictureInPictureSupported()); PictureInPictureWindowManager::GetInstance()->ExitPictureInPicture(); } @@ -1778,7 +1785,7 @@ void CefBrowserHostImpl::ExitPictureInPicture() { // content::WebContentsObserver methods. // ----------------------------------------------------------------------------- -void CefBrowserHostImpl::RenderViewCreated( +void AlloyBrowserHostImpl::RenderViewCreated( content::RenderViewHost* render_view_host) { // May be already registered if the renderer crashed previously. if (!registrar_->IsRegistered( @@ -1793,7 +1800,7 @@ void CefBrowserHostImpl::RenderViewCreated( platform_delegate_->RenderViewCreated(render_view_host); } -void CefBrowserHostImpl::RenderViewDeleted( +void AlloyBrowserHostImpl::RenderViewDeleted( content::RenderViewHost* render_view_host) { if (registrar_->IsRegistered( this, content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, @@ -1804,11 +1811,11 @@ void CefBrowserHostImpl::RenderViewDeleted( } } -void CefBrowserHostImpl::RenderViewReady() { +void AlloyBrowserHostImpl::RenderViewReady() { platform_delegate_->RenderViewReady(); } -void CefBrowserHostImpl::DidFinishNavigation( +void AlloyBrowserHostImpl::DidFinishNavigation( content::NavigationHandle* navigation_handle) { if (web_contents()) { auto cef_browser_context = @@ -1820,7 +1827,7 @@ void CefBrowserHostImpl::DidFinishNavigation( } } -void CefBrowserHostImpl::OnAudioStateChanged(bool audible) { +void AlloyBrowserHostImpl::OnAudioStateChanged(bool audible) { if (audible) { recently_audible_timer_.Stop(); StartAudioCapturer(); @@ -1831,15 +1838,16 @@ void CefBrowserHostImpl::OnAudioStateChanged(bool audible) { // playing. recently_audible_timer_.Start( FROM_HERE, kRecentlyAudibleTimeout, - base::BindOnce(&CefBrowserHostImpl::OnRecentlyAudibleTimerFired, this)); + base::BindOnce(&AlloyBrowserHostImpl::OnRecentlyAudibleTimerFired, + this)); } } -void CefBrowserHostImpl::OnRecentlyAudibleTimerFired() { +void AlloyBrowserHostImpl::OnRecentlyAudibleTimerFired() { audio_capturer_.reset(); } -void CefBrowserHostImpl::AccessibilityEventReceived( +void AlloyBrowserHostImpl::AccessibilityEventReceived( const content::AXEventNotificationDetails& content_event_bundle) { // Only needed in windowless mode. if (IsWindowless()) { @@ -1850,7 +1858,7 @@ void CefBrowserHostImpl::AccessibilityEventReceived( } } -void CefBrowserHostImpl::AccessibilityLocationChangesReceived( +void AlloyBrowserHostImpl::AccessibilityLocationChangesReceived( const std::vector& locData) { // Only needed in windowless mode. if (IsWindowless()) { @@ -1861,14 +1869,14 @@ void CefBrowserHostImpl::AccessibilityLocationChangesReceived( } } -void CefBrowserHostImpl::WebContentsDestroyed() { +void AlloyBrowserHostImpl::WebContentsDestroyed() { auto wc = web_contents(); content::WebContentsObserver::Observe(nullptr); if (platform_delegate_) platform_delegate_->WebContentsDestroyed(wc); } -void CefBrowserHostImpl::StartAudioCapturer() { +void AlloyBrowserHostImpl::StartAudioCapturer() { if (!client_.get() || audio_capturer_) return; @@ -1890,9 +1898,10 @@ void CefBrowserHostImpl::StartAudioCapturer() { // content::NotificationObserver methods. // ----------------------------------------------------------------------------- -void CefBrowserHostImpl::Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { +void AlloyBrowserHostImpl::Observe( + int type, + const content::NotificationSource& source, + const content::NotificationDetails& details) { DCHECK(type == content::NOTIFICATION_LOAD_STOP || type == content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE); @@ -1905,15 +1914,15 @@ void CefBrowserHostImpl::Observe(int type, } } -// CefBrowserHostImpl private methods. +// AlloyBrowserHostImpl private methods. // ----------------------------------------------------------------------------- -CefBrowserHostImpl::CefBrowserHostImpl( +AlloyBrowserHostImpl::AlloyBrowserHostImpl( const CefBrowserSettings& settings, CefRefPtr client, content::WebContents* web_contents, scoped_refptr browser_info, - CefRefPtr opener, + CefRefPtr opener, CefRefPtr request_context, std::unique_ptr platform_delegate, CefRefPtr extension) @@ -1950,7 +1959,7 @@ CefBrowserHostImpl::CefBrowserHostImpl( RenderViewCreated(web_contents->GetRenderViewHost()); } -bool CefBrowserHostImpl::CreateHostWindow() { +bool AlloyBrowserHostImpl::CreateHostWindow() { // |host_window_handle_| will not change after initial host creation for // non-views-hosted browsers. bool success = true; @@ -1961,14 +1970,14 @@ bool CefBrowserHostImpl::CreateHostWindow() { return success; } -gfx::Point CefBrowserHostImpl::GetScreenPoint(const gfx::Point& view) const { +gfx::Point AlloyBrowserHostImpl::GetScreenPoint(const gfx::Point& view) const { CEF_REQUIRE_UIT(); if (platform_delegate_) return platform_delegate_->GetScreenPoint(view); return gfx::Point(); } -void CefBrowserHostImpl::StartDragging( +void AlloyBrowserHostImpl::StartDragging( const content::DropData& drop_data, blink::WebDragOperationsMask allowed_ops, const gfx::ImageSkia& image, @@ -1981,12 +1990,12 @@ void CefBrowserHostImpl::StartDragging( } } -void CefBrowserHostImpl::UpdateDragCursor(blink::WebDragOperation operation) { +void AlloyBrowserHostImpl::UpdateDragCursor(blink::WebDragOperation operation) { if (platform_delegate_) platform_delegate_->UpdateDragCursor(operation); } -void CefBrowserHostImpl::EnsureFileDialogManager() { +void AlloyBrowserHostImpl::EnsureFileDialogManager() { CEF_REQUIRE_UIT(); if (!file_dialog_manager_.get() && platform_delegate_) { file_dialog_manager_.reset(new CefFileDialogManager( diff --git a/libcef/browser/browser_host_impl.h b/libcef/browser/alloy/alloy_browser_host_impl.h similarity index 93% rename from libcef/browser/browser_host_impl.h rename to libcef/browser/alloy/alloy_browser_host_impl.h index 1fa8a1e00..d6f65d1f1 100644 --- a/libcef/browser/browser_host_impl.h +++ b/libcef/browser/alloy/alloy_browser_host_impl.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_BROWSER_BROWSER_HOST_IMPL_H_ -#define CEF_LIBCEF_BROWSER_BROWSER_HOST_IMPL_H_ +#ifndef CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_HOST_IMPL_H_ +#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_HOST_IMPL_H_ #pragma once #include @@ -62,22 +62,22 @@ class SiteInstance; // thread-safe unless otherwise indicated. // // WebContentsDelegate: Interface for handling WebContents delegations. There is -// a one-to-one relationship between CefBrowserHostImpl and WebContents +// a one-to-one relationship between AlloyBrowserHostImpl and WebContents // instances. // // WebContentsObserver: Interface for observing WebContents notifications and // IPC messages. There is a one-to-one relationship between WebContents and // RenderViewHost instances. IPC messages received by the RenderViewHost will be // forwarded to this WebContentsObserver implementation via WebContents. IPC -// messages sent using CefBrowserHostImpl::Send() will be forwarded to the +// messages sent using AlloyBrowserHostImpl::Send() will be forwarded to the // RenderViewHost (after posting to the UI thread if necessary). Use // WebContentsObserver::routing_id() when sending IPC messages. // // NotificationObserver: Interface for observing post-processed notifications. -class CefBrowserHostImpl : public CefBrowserHostBase, - public content::WebContentsDelegate, - public content::WebContentsObserver, - public content::NotificationObserver { +class AlloyBrowserHostImpl : public CefBrowserHostBase, + public content::WebContentsDelegate, + public content::WebContentsObserver, + public content::NotificationObserver { public: // Used for handling the response to command messages. class CommandResponseHandler : public virtual CefBaseRefCounted { @@ -85,25 +85,25 @@ class CefBrowserHostImpl : public CefBrowserHostBase, virtual void OnResponse(const std::string& response) = 0; }; - ~CefBrowserHostImpl() override; + ~AlloyBrowserHostImpl() override; - // Create a new CefBrowserHostImpl instance with owned WebContents. - static CefRefPtr Create(CreateParams& create_params); + // Create a new AlloyBrowserHostImpl instance with owned WebContents. + static CefRefPtr Create(CreateParams& create_params); // Returns the browser associated with the specified RenderViewHost. - static CefRefPtr GetBrowserForHost( + static CefRefPtr GetBrowserForHost( const content::RenderViewHost* host); // Returns the browser associated with the specified RenderFrameHost. - static CefRefPtr GetBrowserForHost( + static CefRefPtr GetBrowserForHost( const content::RenderFrameHost* host); // Returns the browser associated with the specified WebContents. - static CefRefPtr GetBrowserForContents( + static CefRefPtr GetBrowserForContents( const content::WebContents* contents); // Returns the browser associated with the specified FrameTreeNode ID. - static CefRefPtr GetBrowserForFrameTreeNode( + static CefRefPtr GetBrowserForFrameTreeNode( int frame_tree_node_id); // Returns the browser associated with the specified frame routing IDs. - static CefRefPtr GetBrowserForFrameRoute( + static CefRefPtr GetBrowserForFrameRoute( int render_process_id, int render_routing_id); @@ -379,13 +379,13 @@ class CefBrowserHostImpl : public CefBrowserHostBase, private: friend class CefBrowserPlatformDelegateAlloy; - static CefRefPtr CreateInternal( + static CefRefPtr CreateInternal( const CefBrowserSettings& settings, CefRefPtr client, content::WebContents* web_contents, bool own_web_contents, scoped_refptr browser_info, - CefRefPtr opener, + CefRefPtr opener, bool is_devtools_popup, CefRefPtr request_context, std::unique_ptr platform_delegate, @@ -396,12 +396,12 @@ class CefBrowserHostImpl : public CefBrowserHostBase, const content::NotificationSource& source, const content::NotificationDetails& details) override; - CefBrowserHostImpl( + AlloyBrowserHostImpl( const CefBrowserSettings& settings, CefRefPtr client, content::WebContents* web_contents, scoped_refptr browser_info, - CefRefPtr opener, + CefRefPtr opener, CefRefPtr request_context, std::unique_ptr platform_delegate, CefRefPtr extension); @@ -470,4 +470,4 @@ class CefBrowserHostImpl : public CefBrowserHostBase, base::OneShotTimer recently_audible_timer_; }; -#endif // CEF_LIBCEF_BROWSER_BROWSER_HOST_IMPL_H_ +#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_HOST_IMPL_H_ diff --git a/libcef/browser/alloy/alloy_content_browser_client.cc b/libcef/browser/alloy/alloy_content_browser_client.cc index 413ef5331..6943ee2f7 100644 --- a/libcef/browser/alloy/alloy_content_browser_client.cc +++ b/libcef/browser/alloy/alloy_content_browser_client.cc @@ -9,9 +9,9 @@ #include "include/cef_version.h" #include "libcef/browser/alloy/alloy_browser_context.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.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_message_filter.h" @@ -349,9 +349,9 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext { bool handled = false; - CefRefPtr browser = - CefBrowserHostImpl::GetBrowserForFrameRoute(render_process_id, - params.render_frame_id); + CefRefPtr browser = + AlloyBrowserHostImpl::GetBrowserForFrameRoute(render_process_id, + params.render_frame_id); if (browser.get()) { CefRefPtr client = browser->GetClient(); if (client.get()) { @@ -459,7 +459,7 @@ bool NavigationOnUIThread( open_params.user_gesture = params.has_user_gesture(); open_params.initiator_origin = params.initiator_origin(); - CefRefPtr browser; + CefRefPtr browser; if (!CefBrowserInfoManager::GetInstance()->MaybeAllowNavigation( source->GetMainFrame(), open_params, browser)) { // Cancel the navigation. @@ -939,8 +939,8 @@ void AlloyContentBrowserClient::AllowCertificateError( return; } - CefRefPtr browser = - CefBrowserHostImpl::GetBrowserForContents(web_contents); + CefRefPtr browser = + AlloyBrowserHostImpl::GetBrowserForContents(web_contents); if (!browser.get()) return; CefRefPtr client = browser->GetClient(); @@ -975,8 +975,8 @@ base::OnceClosure AlloyContentBrowserClient::SelectClientCertificate( CEF_REQUIRE_UIT(); CefRefPtr handler; - CefRefPtr browser = - CefBrowserHostImpl::GetBrowserForContents(web_contents); + CefRefPtr browser = + AlloyBrowserHostImpl::GetBrowserForContents(web_contents); if (browser.get()) { CefRefPtr client = browser->GetClient(); if (client.get()) diff --git a/libcef/browser/alloy/browser_platform_delegate_alloy.cc b/libcef/browser/alloy/browser_platform_delegate_alloy.cc index 5c7fca508..8e466cebf 100644 --- a/libcef/browser/alloy/browser_platform_delegate_alloy.cc +++ b/libcef/browser/alloy/browser_platform_delegate_alloy.cc @@ -4,7 +4,7 @@ #include "libcef/browser/alloy/browser_platform_delegate_alloy.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/extensions/browser_extensions_util.h" #include "libcef/browser/extensions/extension_background_host.h" #include "libcef/browser/extensions/extension_system.h" @@ -105,8 +105,8 @@ void CefBrowserPlatformDelegateAlloy::AddNewContents( const gfx::Rect& initial_rect, bool user_gesture, bool* was_blocked) { - CefRefPtr owner = - CefBrowserHostImpl::GetBrowserForContents(new_contents.get()); + CefRefPtr owner = + AlloyBrowserHostImpl::GetBrowserForContents(new_contents.get()); if (owner) { // Taking ownership of |new_contents|. static_cast( @@ -143,7 +143,7 @@ void CefBrowserPlatformDelegateAlloy::RenderViewReady() { } void CefBrowserPlatformDelegateAlloy::BrowserCreated( - CefBrowserHostImpl* browser) { + AlloyBrowserHostImpl* browser) { CefBrowserPlatformDelegate::BrowserCreated(browser); web_contents_->SetDelegate(browser); @@ -202,7 +202,7 @@ extensions::ExtensionHost* CefBrowserPlatformDelegateAlloy::GetExtensionHost() } void CefBrowserPlatformDelegateAlloy::BrowserDestroyed( - CefBrowserHostImpl* browser) { + AlloyBrowserHostImpl* browser) { DestroyExtensionHost(); owned_web_contents_.reset(); diff --git a/libcef/browser/alloy/browser_platform_delegate_alloy.h b/libcef/browser/alloy/browser_platform_delegate_alloy.h index b9cc84ae8..8114f99fd 100644 --- a/libcef/browser/alloy/browser_platform_delegate_alloy.h +++ b/libcef/browser/alloy/browser_platform_delegate_alloy.h @@ -29,12 +29,12 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate { bool ShouldTransferNavigation(bool is_main_frame_navigation) override; void RenderViewCreated(content::RenderViewHost* render_view_host) override; void RenderViewReady() override; - void BrowserCreated(CefBrowserHostImpl* browser) override; + void BrowserCreated(AlloyBrowserHostImpl* browser) override; void CreateExtensionHost(const extensions::Extension* extension, const GURL& url, extensions::ViewType host_type) override; extensions::ExtensionHost* GetExtensionHost() const override; - void BrowserDestroyed(CefBrowserHostImpl* browser) override; + void BrowserDestroyed(AlloyBrowserHostImpl* browser) override; void SendCaptureLostEvent() override; #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC)) void NotifyMoveOrResizeStarted() override; diff --git a/libcef/browser/audio_capturer.cc b/libcef/browser/audio_capturer.cc index 578006032..a12a90940 100644 --- a/libcef/browser/audio_capturer.cc +++ b/libcef/browser/audio_capturer.cc @@ -4,7 +4,7 @@ // found in the LICENSE file. #include "libcef/browser/audio_capturer.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "components/mirroring/service/captured_audio_input.h" #include "content/public/browser/audio_loopback_stream_creator.h" @@ -51,7 +51,7 @@ void StreamCreatorHelper( } // namespace CefAudioCapturer::CefAudioCapturer(const CefAudioParameters& params, - CefRefPtr browser, + CefRefPtr browser, CefRefPtr audio_handler) : params_(params), browser_(browser), diff --git a/libcef/browser/audio_capturer.h b/libcef/browser/audio_capturer.h index 98014814a..0ee206dd5 100644 --- a/libcef/browser/audio_capturer.h +++ b/libcef/browser/audio_capturer.h @@ -21,12 +21,12 @@ class AudioInputDevice; } // namespace media class CefAudioHandler; -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class CefAudioCapturer : public media::AudioCapturerSource::CaptureCallback { public: CefAudioCapturer(const CefAudioParameters& params, - CefRefPtr browser, + CefRefPtr browser, CefRefPtr audio_handler); ~CefAudioCapturer() override; @@ -42,7 +42,7 @@ class CefAudioCapturer : public media::AudioCapturerSource::CaptureCallback { void StopStream(); CefAudioParameters params_; - CefRefPtr browser_; + CefRefPtr browser_; CefRefPtr audio_handler_; std::unique_ptr audio_stream_creator_; scoped_refptr audio_input_device_; diff --git a/libcef/browser/browser_context.h b/libcef/browser/browser_context.h index cbe9b2f89..4dd51ae96 100644 --- a/libcef/browser/browser_context.h +++ b/libcef/browser/browser_context.h @@ -27,7 +27,7 @@ // Content API representation of a browser. Created by BHI or the system (for // popups) and owned by BHI. Keeps a pointer to the content::BrowserContext. // -// BHI = CefBrowserHostImpl +// BHI = AlloyBrowserHostImpl // Implements the CefBrowser and CefBrowserHost interfaces which are exposed // to clients. References an RCI instance. Owns a WC. Lifespan is controlled // by client references and CefBrowserInfoManager (until the browser has @@ -62,9 +62,9 @@ // // // How shutdown works: -// 1. CefBrowserHostImpl::DestroyBrowser is called on the UI thread after the +// 1. AlloyBrowserHostImpl::DestroyBrowser is called on the UI thread after the // browser is closed and deletes the WebContents. -// 1. CefBrowserHostImpl is destroyed on any thread when the last reference +// 1. AlloyBrowserHostImpl is destroyed on any thread when the last reference // is released. // 2. CefRequestContextImpl is destroyed (possibly asynchronously) on the UI // thread when the last reference is released. @@ -85,7 +85,7 @@ class Profile; // Main entry point for configuring behavior on a per-RequestContext basis. The // content::BrowserContext represented by this class is passed to -// WebContents::Create in CefBrowserHostImpl::CreateInternal. Only accessed on +// WebContents::Create in AlloyBrowserHostImpl::CreateInternal. Only accessed on // the UI thread unless otherwise indicated. class CefBrowserContext { public: diff --git a/libcef/browser/browser_host_base.cc b/libcef/browser/browser_host_base.cc index 8f35ecf1b..a6ba02d26 100644 --- a/libcef/browser/browser_host_base.cc +++ b/libcef/browser/browser_host_base.cc @@ -558,9 +558,7 @@ void CefBrowserHostBase::LoadMainFrameURL(const std::string& url, } if (!gurl.is_valid()) { - LOG(ERROR) - << "Invalid URL passed to CefBrowserHostImpl::LoadMainFrameURL: " - << url; + LOG(ERROR) << "Invalid URL: " << url; return; } diff --git a/libcef/browser/browser_host_create.cc b/libcef/browser/browser_host_create.cc index 980aa149c..aeb754926 100644 --- a/libcef/browser/browser_host_create.cc +++ b/libcef/browser/browser_host_create.cc @@ -4,7 +4,7 @@ // found in the LICENSE file. #include "include/cef_browser.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/chrome/chrome_browser_host_impl.h" #include "libcef/browser/context.h" #include "libcef/browser/thread_util.h" @@ -139,6 +139,6 @@ CefRefPtr CefBrowserHost::CreateBrowserSync( return browser.get(); } - auto browser = CefBrowserHostImpl::Create(create_params); + auto browser = AlloyBrowserHostImpl::Create(create_params); return browser.get(); } diff --git a/libcef/browser/browser_info.cc b/libcef/browser/browser_info.cc index 8b27d608a..d9237b668 100644 --- a/libcef/browser/browser_info.cc +++ b/libcef/browser/browser_info.cc @@ -4,7 +4,7 @@ #include "libcef/browser/browser_info.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/browser_host_base.h" #include "libcef/browser/thread_util.h" #include "libcef/common/values_impl.h" diff --git a/libcef/browser/browser_info_manager.cc b/libcef/browser/browser_info_manager.cc index 9f3635fc4..7d901bb31 100644 --- a/libcef/browser/browser_info_manager.cc +++ b/libcef/browser/browser_info_manager.cc @@ -6,7 +6,7 @@ #include -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/browser_platform_delegate.h" #include "libcef/browser/extensions/browser_extensions_util.h" #include "libcef/browser/thread_util.h" @@ -124,7 +124,7 @@ bool CefBrowserInfoManager::CanCreateWindow( /*is_renderer_initiated=*/true); params.user_gesture = user_gesture; - CefRefPtr browser; + CefRefPtr browser; if (!MaybeAllowNavigation(opener, params, browser) || !browser) { // Cancel the popup. return false; @@ -365,12 +365,12 @@ CefBrowserInfoManager::GetBrowserInfoForFrameRoute(int render_process_id, bool CefBrowserInfoManager::MaybeAllowNavigation( content::RenderFrameHost* opener, const content::OpenURLParams& params, - CefRefPtr& browser_out) const { + CefRefPtr& browser_out) const { CEF_REQUIRE_UIT(); REQUIRE_ALLOY_RUNTIME(); bool is_guest_view = false; - CefRefPtr browser = static_cast( + CefRefPtr browser = static_cast( extensions::GetOwnerBrowserForHost(opener, &is_guest_view).get()); if (!browser) { // Print preview uses a modal dialog where we don't own the WebContents. @@ -385,7 +385,7 @@ bool CefBrowserInfoManager::MaybeAllowNavigation( // are passed to the owner browser. CEF_POST_TASK( CEF_UIT, - base::Bind(base::IgnoreResult(&CefBrowserHostImpl::OpenURLFromTab), + base::Bind(base::IgnoreResult(&AlloyBrowserHostImpl::OpenURLFromTab), browser.get(), nullptr, params)); return false; diff --git a/libcef/browser/browser_info_manager.h b/libcef/browser/browser_info_manager.h index 5c1ebf970..df56d4a72 100644 --- a/libcef/browser/browser_info_manager.h +++ b/libcef/browser/browser_info_manager.h @@ -38,7 +38,7 @@ class Message; } class CefBrowserHostBase; -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class CefBrowserPlatformDelegate; // Singleton object for managing BrowserInfo instances. @@ -50,7 +50,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { // Returns this singleton instance of this class. static CefBrowserInfoManager* GetInstance(); - // Called from CefBrowserHostImpl::Create or + // Called from AlloyBrowserHostImpl::Create or // ChromeBrowserDelegate::SetAsDelegate when a new browser is being created // directly. In this case |is_popup| will be true only for DevTools browsers. scoped_refptr CreateBrowserInfo( @@ -58,7 +58,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { bool is_windowless, CefRefPtr extra_info); - // Called from CefBrowserHostImpl::WebContentsCreated when a new browser is + // Called from AlloyBrowserHostImpl::WebContentsCreated when a new browser is // being created for a traditional popup (e.g. window.open() or targeted // link). If any OnGetNewBrowserInfo requests are pending for the popup the // response will be sent when this method is called. @@ -79,7 +79,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { bool opener_suppressed, bool* no_javascript_access); - // Called from CefBrowserHostImpl::GetCustomWebContentsView. See comments on + // Called from AlloyBrowserHostImpl::GetCustomWebContentsView. See comments on // PendingPopup for more information. void GetCustomWebContentsView( const GURL& target_url, @@ -88,7 +88,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { content::WebContentsView** view, content::RenderViewHostDelegateView** delegate_view); - // Called from CefBrowserHostImpl::WebContentsCreated. See comments on + // Called from AlloyBrowserHostImpl::WebContentsCreated. See comments on // PendingPopup for more information. void WebContentsCreated( const GURL& target_url, @@ -147,7 +147,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { // |browser| will be set to the target browser if any. bool MaybeAllowNavigation(content::RenderFrameHost* opener, const content::OpenURLParams& params, - CefRefPtr& browser) const; + CefRefPtr& browser) const; private: // RenderProcessHostObserver methods: @@ -158,12 +158,12 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver { // 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 - // CefBrowserHostImpl::OpenURLFromTab is called. + // AlloyBrowserHostImpl::OpenURLFromTab is called. // And then the following calls may occur at the same time: - // - CefBrowserHostImpl::GetCustomWebContentsView (UIT) + // - AlloyBrowserHostImpl::GetCustomWebContentsView (UIT) // Creates the OSR views for windowless popups. - // - CefBrowserHostImpl::WebContentsCreated (UIT) - // Creates the CefBrowserHostImpl representation for the popup. + // - AlloyBrowserHostImpl::WebContentsCreated (UIT) + // Creates the AlloyBrowserHostImpl representation for the popup. // - CefBrowserMessageFilter::OnGetNewBrowserInfo (IOT) // Passes information about the popup to the renderer process. struct PendingPopup { diff --git a/libcef/browser/browser_platform_delegate.cc b/libcef/browser/browser_platform_delegate.cc index bb69c48f3..477135e7c 100644 --- a/libcef/browser/browser_platform_delegate.cc +++ b/libcef/browser/browser_platform_delegate.cc @@ -4,7 +4,7 @@ #include "libcef/browser/browser_platform_delegate.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "base/logging.h" @@ -57,7 +57,7 @@ void CefBrowserPlatformDelegate::RenderViewCreated( void CefBrowserPlatformDelegate::RenderViewReady() {} -void CefBrowserPlatformDelegate::BrowserCreated(CefBrowserHostImpl* browser) { +void CefBrowserPlatformDelegate::BrowserCreated(AlloyBrowserHostImpl* browser) { // We should have an associated WebContents at this point. DCHECK(web_contents_); @@ -83,7 +83,8 @@ void CefBrowserPlatformDelegate::NotifyBrowserCreated() {} void CefBrowserPlatformDelegate::NotifyBrowserDestroyed() {} -void CefBrowserPlatformDelegate::BrowserDestroyed(CefBrowserHostImpl* browser) { +void CefBrowserPlatformDelegate::BrowserDestroyed( + AlloyBrowserHostImpl* browser) { // WebContentsDestroyed should already be called. DCHECK(!web_contents_); @@ -120,7 +121,7 @@ void CefBrowserPlatformDelegate::PopupWebContentsCreated( bool is_devtools) {} void CefBrowserPlatformDelegate::PopupBrowserCreated( - CefBrowserHostImpl* new_browser, + AlloyBrowserHostImpl* new_browser, bool is_devtools) {} void CefBrowserPlatformDelegate::SendCaptureLostEvent() { diff --git a/libcef/browser/browser_platform_delegate.h b/libcef/browser/browser_platform_delegate.h index 801422219..cfb579894 100644 --- a/libcef/browser/browser_platform_delegate.h +++ b/libcef/browser/browser_platform_delegate.h @@ -13,7 +13,7 @@ #include "include/cef_drag_data.h" #include "include/internal/cef_types.h" #include "include/views/cef_browser_view.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "base/callback_forward.h" #include "content/public/browser/web_contents.h" @@ -56,7 +56,7 @@ class CefBrowserPlatformDelegate { static std::unique_ptr Create( CefBrowserHostBase::CreateParams& create_params); - // Called from CefBrowserHostImpl::Create. + // Called from AlloyBrowserHostImpl::Create. // Wait for the call to WebContentsCreated(owned=true) before taking ownership // of the resulting WebContents object. virtual content::WebContents* CreateWebContents( @@ -103,12 +103,12 @@ class CefBrowserPlatformDelegate { // See WebContentsObserver documentation. virtual void RenderViewReady(); - // Called after the owning CefBrowserHostImpl is created. Will only be called - // a single time per instance. Do not send any client notifications from this - // method. - virtual void BrowserCreated(CefBrowserHostImpl* browser); + // Called after the owning AlloyBrowserHostImpl is created. Will only be + // called a single time per instance. Do not send any client notifications + // from this method. + virtual void BrowserCreated(AlloyBrowserHostImpl* browser); - // Called from CefBrowserHostImpl::Create. + // Called from AlloyBrowserHostImpl::Create. virtual void CreateExtensionHost(const extensions::Extension* extension, const GURL& url, extensions::ViewType host_type); @@ -124,11 +124,11 @@ class CefBrowserPlatformDelegate { // BrowserDestroyed(). virtual void NotifyBrowserDestroyed(); - // Called before the owning CefBrowserHostImpl is destroyed. Will only be - // called a single time per instance. All references to the CefBrowserHostImpl - // and WebContents should be cleared when this method is called. Do not send - // any client notifications from this method. - virtual void BrowserDestroyed(CefBrowserHostImpl* browser); + // Called before the owning AlloyBrowserHostImpl is destroyed. Will only be + // called a single time per instance. All references to the + // AlloyBrowserHostImpl and WebContents should be cleared when this method is + // called. Do not send any client notifications from this method. + virtual void BrowserDestroyed(AlloyBrowserHostImpl* browser); // Create the window that hosts the browser. Will only be called a single time // per instance. Only used with windowed rendering. @@ -156,7 +156,7 @@ class CefBrowserPlatformDelegate { #endif // Called after the WebContents have been created for a new popup browser - // parented to this browser but before the CefBrowserHostImpl is created for + // parented to this browser but before the AlloyBrowserHostImpl is created for // the popup. |is_devtools| will be true if the popup will host DevTools. This // method will be called before WebContentsCreated() is called on // |new_platform_delegate|. Do not make the new browser visible in this @@ -168,13 +168,13 @@ class CefBrowserPlatformDelegate { CefBrowserPlatformDelegate* new_platform_delegate, bool is_devtools); - // Called after the CefBrowserHostImpl is created for a new popup browser + // Called after the AlloyBrowserHostImpl is created for a new popup browser // parented to this browser. |is_devtools| will be true if the popup will host // DevTools. This method will be called immediately after // CefLifeSpanHandler::OnAfterCreated() for the popup browser. It is safe to // make the new browser visible in this callback (for example, add the browser // to a window and show it). - virtual void PopupBrowserCreated(CefBrowserHostImpl* new_browser, + virtual void PopupBrowserCreated(AlloyBrowserHostImpl* new_browser, bool is_devtools); // Returns the background color for the browser. The alpha component will be @@ -343,7 +343,7 @@ class CefBrowserPlatformDelegate { // Not owned by this object. content::WebContents* web_contents_ = nullptr; - CefBrowserHostImpl* browser_ = nullptr; + AlloyBrowserHostImpl* browser_ = nullptr; DISALLOW_COPY_AND_ASSIGN(CefBrowserPlatformDelegate); }; diff --git a/libcef/browser/context.h b/libcef/browser/context.h index d9a85d165..40530c016 100644 --- a/libcef/browser/context.h +++ b/libcef/browser/context.h @@ -17,14 +17,11 @@ #include "base/threading/platform_thread.h" #include "third_party/skia/include/core/SkColor.h" -class CefBrowserHostImpl; class CefBrowserInfoManager; class CefTraceSubscriber; class CefContext { public: - typedef std::list> BrowserList; - // Interface to implement for observers that wish to be informed of changes // to the context. All methods will be called on the UI thread. class Observer { diff --git a/libcef/browser/devtools/devtools_file_manager.cc b/libcef/browser/devtools/devtools_file_manager.cc index 420a3cad8..2082c3337 100644 --- a/libcef/browser/devtools/devtools_file_manager.cc +++ b/libcef/browser/devtools/devtools_file_manager.cc @@ -4,7 +4,7 @@ #include "libcef/browser/devtools/devtools_file_manager.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "base/bind.h" #include "base/callback.h" @@ -39,8 +39,9 @@ void AppendToFile(const base::FilePath& path, const std::string& content) { } // namespace -CefDevToolsFileManager::CefDevToolsFileManager(CefBrowserHostImpl* browser_impl, - PrefService* prefs) +CefDevToolsFileManager::CefDevToolsFileManager( + AlloyBrowserHostImpl* browser_impl, + PrefService* prefs) : browser_impl_(browser_impl), prefs_(prefs), file_task_runner_(base::CreateSequencedTaskRunner( diff --git a/libcef/browser/devtools/devtools_file_manager.h b/libcef/browser/devtools/devtools_file_manager.h index 364f26d4c..979a4edcb 100644 --- a/libcef/browser/devtools/devtools_file_manager.h +++ b/libcef/browser/devtools/devtools_file_manager.h @@ -18,7 +18,7 @@ class SequencedTaskRunner; class Value; } // namespace base -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class PrefService; // File management helper for DevTools. @@ -26,7 +26,8 @@ class PrefService; // chrome/browser/devtools/devtools_file_helper.cc. class CefDevToolsFileManager { public: - CefDevToolsFileManager(CefBrowserHostImpl* browser_impl, PrefService* prefs); + CefDevToolsFileManager(AlloyBrowserHostImpl* browser_impl, + PrefService* prefs); void SaveToFile(const std::string& url, const std::string& content, @@ -68,7 +69,7 @@ class CefDevToolsFileManager { const base::Value* arg3); // Guaranteed to outlive this object. - CefBrowserHostImpl* browser_impl_; + AlloyBrowserHostImpl* browser_impl_; PrefService* prefs_; typedef std::map PathsMap; diff --git a/libcef/browser/devtools/devtools_frontend.cc b/libcef/browser/devtools/devtools_frontend.cc index 3398368b8..2ed9f1976 100644 --- a/libcef/browser/devtools/devtools_frontend.cc +++ b/libcef/browser/devtools/devtools_frontend.cc @@ -235,7 +235,7 @@ const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4; // static CefDevToolsFrontend* CefDevToolsFrontend::Show( - CefBrowserHostImpl* inspected_browser, + AlloyBrowserHostImpl* inspected_browser, const CefWindowInfo& windowInfo, CefRefPtr client, const CefBrowserSettings& settings, @@ -258,15 +258,15 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show( create_params.request_context = inspected_browser->GetRequestContext(); create_params.extra_info = inspected_browser->browser_info()->extra_info(); - CefRefPtr frontend_browser = - CefBrowserHostImpl::Create(create_params); + CefRefPtr frontend_browser = + AlloyBrowserHostImpl::Create(create_params); content::WebContents* inspected_contents = inspected_browser->web_contents(); // CefDevToolsFrontend will delete itself when the frontend WebContents is // destroyed. CefDevToolsFrontend* devtools_frontend = new CefDevToolsFrontend( - static_cast(frontend_browser.get()), + static_cast(frontend_browser.get()), inspected_contents, inspect_element_at, std::move(frontend_destroyed_callback)); @@ -293,12 +293,12 @@ void CefDevToolsFrontend::InspectElementAt(int x, int y) { void CefDevToolsFrontend::Close() { base::PostTask(FROM_HERE, {content::BrowserThread::UI}, - base::Bind(&CefBrowserHostImpl::CloseBrowser, + base::Bind(&AlloyBrowserHostImpl::CloseBrowser, frontend_browser_.get(), true)); } CefDevToolsFrontend::CefDevToolsFrontend( - CefBrowserHostImpl* frontend_browser, + AlloyBrowserHostImpl* frontend_browser, content::WebContents* inspected_contents, const CefPoint& inspect_element_at, base::OnceClosure frontend_destroyed_callback) diff --git a/libcef/browser/devtools/devtools_frontend.h b/libcef/browser/devtools/devtools_frontend.h index 90e2defe0..51dffd2ee 100644 --- a/libcef/browser/devtools/devtools_frontend.h +++ b/libcef/browser/devtools/devtools_frontend.h @@ -7,7 +7,7 @@ #include -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/devtools/devtools_file_manager.h" #include "base/compiler_specific.h" @@ -42,7 +42,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver, public content::DevToolsAgentHostClient { public: static CefDevToolsFrontend* Show( - CefBrowserHostImpl* inspected_browser, + AlloyBrowserHostImpl* inspected_browser, const CefWindowInfo& windowInfo, CefRefPtr client, const CefBrowserSettings& settings, @@ -60,7 +60,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver, const base::Value* arg3); private: - CefDevToolsFrontend(CefBrowserHostImpl* frontend_browser, + CefDevToolsFrontend(AlloyBrowserHostImpl* frontend_browser, content::WebContents* inspected_contents, const CefPoint& inspect_element_at, base::OnceClosure destroyed_callback); @@ -87,7 +87,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver, PrefService* GetPrefs() const; - CefRefPtr frontend_browser_; + CefRefPtr frontend_browser_; content::WebContents* inspected_contents_; scoped_refptr agent_host_; CefPoint inspect_element_at_; diff --git a/libcef/browser/devtools/devtools_manager.cc b/libcef/browser/devtools/devtools_manager.cc index c93b274c0..8a07e8f0f 100644 --- a/libcef/browser/devtools/devtools_manager.cc +++ b/libcef/browser/devtools/devtools_manager.cc @@ -31,7 +31,7 @@ class CefDevToolsRegistrationImpl : public CefRegistration, controller_->RemoveObserver(this); } - void Initialize(CefBrowserHostImpl* browser, + void Initialize(AlloyBrowserHostImpl* browser, base::WeakPtr controller) { CEF_REQUIRE_UIT(); DCHECK(browser && controller); @@ -83,7 +83,7 @@ class CefDevToolsRegistrationImpl : public CefRegistration, CefRefPtr observer_; - CefBrowserHostImpl* browser_ = nullptr; + AlloyBrowserHostImpl* browser_ = nullptr; base::WeakPtr controller_; IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefDevToolsRegistrationImpl); @@ -92,7 +92,7 @@ class CefDevToolsRegistrationImpl : public CefRegistration, } // namespace -CefDevToolsManager::CefDevToolsManager(CefBrowserHostImpl* inspected_browser) +CefDevToolsManager::CefDevToolsManager(AlloyBrowserHostImpl* inspected_browser) : inspected_browser_(inspected_browser), weak_ptr_factory_(this) { CEF_REQUIRE_UIT(); } diff --git a/libcef/browser/devtools/devtools_manager.h b/libcef/browser/devtools/devtools_manager.h index ae1d5fe8e..27d6f763b 100644 --- a/libcef/browser/devtools/devtools_manager.h +++ b/libcef/browser/devtools/devtools_manager.h @@ -10,7 +10,7 @@ #include "base/memory/weak_ptr.h" -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class CefDevToolsController; class CefDevToolsFrontend; @@ -23,7 +23,7 @@ class WebContents; class CefDevToolsManager { public: // |inspected_browser| will outlive this object. - explicit CefDevToolsManager(CefBrowserHostImpl* inspected_browser); + explicit CefDevToolsManager(AlloyBrowserHostImpl* inspected_browser); ~CefDevToolsManager(); // See CefBrowserHost methods of the same name for documentation. @@ -52,7 +52,7 @@ class CefDevToolsManager { bool EnsureController(); - CefBrowserHostImpl* const inspected_browser_; + AlloyBrowserHostImpl* const inspected_browser_; // CefDevToolsFrontend will delete itself when the frontend WebContents is // destroyed. diff --git a/libcef/browser/devtools/devtools_manager_delegate.cc b/libcef/browser/devtools/devtools_manager_delegate.cc index ab4abbd00..4ee431e6e 100644 --- a/libcef/browser/devtools/devtools_manager_delegate.cc +++ b/libcef/browser/devtools/devtools_manager_delegate.cc @@ -8,8 +8,6 @@ #include -#include "libcef/browser/browser_host_impl.h" - #include "base/atomicops.h" #include "base/bind.h" #include "base/command_line.h" diff --git a/libcef/browser/download_manager_delegate.cc b/libcef/browser/download_manager_delegate.cc index dc04c05c1..004f469b1 100644 --- a/libcef/browser/download_manager_delegate.cc +++ b/libcef/browser/download_manager_delegate.cc @@ -5,7 +5,7 @@ #include "libcef/browser/download_manager_delegate.h" #include "include/cef_download_handler.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/context.h" #include "libcef/browser/download_item_impl.h" #include "libcef/browser/thread_util.h" @@ -31,7 +31,7 @@ namespace { // Helper function to retrieve the CefDownloadHandler. CefRefPtr GetDownloadHandler( - CefRefPtr browser) { + CefRefPtr browser) { CefRefPtr client = browser->GetClient(); if (client.get()) return client->GetDownloadHandler(); @@ -125,8 +125,8 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback { if (show_dialog) { WebContents* web_contents = content::DownloadItemUtils::GetWebContents(item); - CefRefPtr browser = - CefBrowserHostImpl::GetBrowserForContents(web_contents); + CefRefPtr browser = + AlloyBrowserHostImpl::GetBrowserForContents(web_contents); if (browser.get()) { handled = true; @@ -276,7 +276,7 @@ CefDownloadManagerDelegate::~CefDownloadManagerDelegate() { } void CefDownloadManagerDelegate::OnDownloadUpdated(DownloadItem* download) { - CefRefPtr browser = GetBrowser(download); + CefRefPtr browser = GetBrowser(download); CefRefPtr handler; if (browser.get()) handler = GetDownloadHandler(browser); @@ -296,7 +296,7 @@ void CefDownloadManagerDelegate::OnDownloadUpdated(DownloadItem* download) { void CefDownloadManagerDelegate::OnDownloadDestroyed(DownloadItem* item) { item->RemoveObserver(this); - CefBrowserHostImpl* browser = nullptr; + AlloyBrowserHostImpl* browser = nullptr; ItemBrowserMap::iterator it = item_browser_map_.find(item); DCHECK(it != item_browser_map_.end()); @@ -326,7 +326,7 @@ void CefDownloadManagerDelegate::OnDownloadCreated(DownloadManager* manager, DownloadItem* item) { // This callback may arrive after DetermineDownloadTarget, so we allow // association from either method. - CefRefPtr browser = GetOrAssociateBrowser(item); + CefRefPtr browser = GetOrAssociateBrowser(item); if (!browser) { // If the download is rejected (e.g. ALT+click on an invalid protocol link) // then an "interrupted" download will be started via DownloadManagerImpl:: @@ -365,7 +365,7 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget( // This callback may arrive before OnDownloadCreated, so we allow association // from either method. - CefRefPtr browser = GetOrAssociateBrowser(item); + CefRefPtr browser = GetOrAssociateBrowser(item); CefRefPtr handler; if (browser.get()) handler = GetDownloadHandler(browser); @@ -418,17 +418,17 @@ void CefDownloadManagerDelegate::OnBrowserDestroyed( } } -CefBrowserHostImpl* CefDownloadManagerDelegate::GetOrAssociateBrowser( +AlloyBrowserHostImpl* CefDownloadManagerDelegate::GetOrAssociateBrowser( download::DownloadItem* item) { ItemBrowserMap::const_iterator it = item_browser_map_.find(item); if (it != item_browser_map_.end()) return it->second; - CefBrowserHostImpl* browser = nullptr; + AlloyBrowserHostImpl* browser = nullptr; content::WebContents* contents = content::DownloadItemUtils::GetWebContents(item); if (contents) { - browser = CefBrowserHostImpl::GetBrowserForContents(contents).get(); + browser = AlloyBrowserHostImpl::GetBrowserForContents(contents).get(); DCHECK(browser); } if (!browser) @@ -446,7 +446,8 @@ CefBrowserHostImpl* CefDownloadManagerDelegate::GetOrAssociateBrowser( return browser; } -CefBrowserHostImpl* CefDownloadManagerDelegate::GetBrowser(DownloadItem* item) { +AlloyBrowserHostImpl* CefDownloadManagerDelegate::GetBrowser( + DownloadItem* item) { ItemBrowserMap::const_iterator it = item_browser_map_.find(item); if (it != item_browser_map_.end()) return it->second; diff --git a/libcef/browser/download_manager_delegate.h b/libcef/browser/download_manager_delegate.h index 4f5b3fe93..bf047446b 100644 --- a/libcef/browser/download_manager_delegate.h +++ b/libcef/browser/download_manager_delegate.h @@ -16,7 +16,7 @@ #include "content/public/browser/download_manager.h" #include "content/public/browser/download_manager_delegate.h" -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class CefDownloadManagerDelegate : public download::DownloadItem::Observer, public content::DownloadManager::Observer, @@ -46,16 +46,17 @@ class CefDownloadManagerDelegate : public download::DownloadItem::Observer, // CefBrowserHostBase::Observer methods. void OnBrowserDestroyed(CefBrowserHostBase* browser) override; - CefBrowserHostImpl* GetOrAssociateBrowser(download::DownloadItem* item); - CefBrowserHostImpl* GetBrowser(download::DownloadItem* item); + AlloyBrowserHostImpl* GetOrAssociateBrowser(download::DownloadItem* item); + AlloyBrowserHostImpl* GetBrowser(download::DownloadItem* item); content::DownloadManager* manager_; base::WeakPtrFactory manager_ptr_factory_; - // Map of DownloadItem to originating CefBrowserHostImpl. Maintaining this + // Map of DownloadItem to originating AlloyBrowserHostImpl. Maintaining this // map is necessary because DownloadItem::GetWebContents() may return NULL if // the browser navigates while the download is in progress. - typedef std::map ItemBrowserMap; + typedef std::map + ItemBrowserMap; ItemBrowserMap item_browser_map_; DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate); diff --git a/libcef/browser/extensions/api/tabs/tabs_api.cc b/libcef/browser/extensions/api/tabs/tabs_api.cc index d732ae249..0e9f1728d 100644 --- a/libcef/browser/extensions/api/tabs/tabs_api.cc +++ b/libcef/browser/extensions/api/tabs/tabs_api.cc @@ -119,7 +119,7 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() { // Find a browser that we can access, or fail with error. std::string error; - CefRefPtr browser = + CefRefPtr browser = cef_details_.GetBrowserForTabIdFirstTime(tab_id, &error); if (!browser) return set_init_result_error(error); @@ -133,7 +133,7 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() { bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage(std::string* error) { CHECK_GE(execute_tab_id_, 0); - CefRefPtr browser = + CefRefPtr browser = cef_details_.GetBrowserForTabIdAgain(execute_tab_id_, error); if (!browser) return false; @@ -188,7 +188,7 @@ ScriptExecutor* ExecuteCodeInTabFunction::GetScriptExecutor( std::string* error) { CHECK_GE(execute_tab_id_, 0); - CefRefPtr browser = + CefRefPtr browser = cef_details_.GetBrowserForTabIdAgain(execute_tab_id_, error); if (!browser) return nullptr; @@ -237,7 +237,7 @@ ZoomAPIFunction::ZoomAPIFunction() : cef_details_(this) {} content::WebContents* ZoomAPIFunction::GetWebContents(int tab_id) { // Find a browser that we can access, or set |error_| and return nullptr. - CefRefPtr browser = + CefRefPtr browser = cef_details_.GetBrowserForTabIdFirstTime(tab_id, &error_); if (!browser) return nullptr; diff --git a/libcef/browser/extensions/browser_extensions_util.cc b/libcef/browser/extensions/browser_extensions_util.cc index 02e8c7f6e..57b5b934c 100644 --- a/libcef/browser/extensions/browser_extensions_util.cc +++ b/libcef/browser/extensions/browser_extensions_util.cc @@ -4,9 +4,9 @@ #include "libcef/browser/extensions/browser_extensions_util.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/browser_context.h" #include "libcef/browser/browser_host_base.h" -#include "libcef/browser/browser_host_impl.h" #include "libcef/browser/browser_info_manager.h" #include "libcef/browser/thread_util.h" #include "libcef/common/extensions/extensions_util.h" @@ -146,7 +146,7 @@ CefRefPtr GetOwnerBrowserForHost( return browser; } -CefRefPtr GetBrowserForTabId( +CefRefPtr GetBrowserForTabId( int tab_id, content::BrowserContext* browser_context) { REQUIRE_ALLOY_RUNTIME(); @@ -160,8 +160,8 @@ CefRefPtr GetBrowserForTabId( for (const auto& browser_info : CefBrowserInfoManager::GetInstance()->GetBrowserInfoList()) { - CefRefPtr current_browser = - static_cast(browser_info->browser().get()); + CefRefPtr current_browser = + static_cast(browser_info->browser().get()); if (current_browser && current_browser->GetIdentifier() == tab_id) { // Make sure we're operating in the same CefBrowserContext. if (CefBrowserContext::FromBrowserContext( diff --git a/libcef/browser/extensions/browser_extensions_util.h b/libcef/browser/extensions/browser_extensions_util.h index d62dbb669..585a9e446 100644 --- a/libcef/browser/extensions/browser_extensions_util.h +++ b/libcef/browser/extensions/browser_extensions_util.h @@ -19,7 +19,7 @@ class WebContents; } // namespace content class CefBrowserHostBase; -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; namespace extensions { @@ -60,7 +60,7 @@ CefRefPtr GetOwnerBrowserForHost( // Returns the browser matching |tab_id| and |browser_context|. Returns false if // |tab_id| is < 0 or a matching browser cannot be found within // |browser_context|. Similar in concept to ExtensionTabUtil::GetTabById. -CefRefPtr GetBrowserForTabId( +CefRefPtr GetBrowserForTabId( int tab_id, content::BrowserContext* browser_context); diff --git a/libcef/browser/extensions/browser_platform_delegate_background.cc b/libcef/browser/extensions/browser_platform_delegate_background.cc index ca3d80cae..d3246d751 100644 --- a/libcef/browser/extensions/browser_platform_delegate_background.cc +++ b/libcef/browser/extensions/browser_platform_delegate_background.cc @@ -6,7 +6,7 @@ #include -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/thread_util.h" #include "content/public/browser/render_view_host.h" @@ -27,7 +27,7 @@ void CefBrowserPlatformDelegateBackground::CloseHostWindow() { // No host window, so continue browser destruction now. Do it asynchronously // so the call stack has a chance to unwind. CEF_POST_TASK(CEF_UIT, - base::Bind(&CefBrowserHostImpl::WindowDestroyed, browser_)); + base::Bind(&AlloyBrowserHostImpl::WindowDestroyed, browser_)); } CefWindowHandle CefBrowserPlatformDelegateBackground::GetHostWindowHandle() diff --git a/libcef/browser/extensions/extension_background_host.cc b/libcef/browser/extensions/extension_background_host.cc index d14efe194..ed3f79d15 100644 --- a/libcef/browser/extensions/extension_background_host.cc +++ b/libcef/browser/extensions/extension_background_host.cc @@ -4,7 +4,7 @@ #include "libcef/browser/extensions/extension_background_host.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/extensions/extension_host_delegate.h" #include "base/callback.h" @@ -12,7 +12,7 @@ namespace extensions { CefExtensionBackgroundHost::CefExtensionBackgroundHost( - CefBrowserHostImpl* browser, + AlloyBrowserHostImpl* browser, base::OnceClosure deleted_callback, const Extension* extension, content::WebContents* host_contents, diff --git a/libcef/browser/extensions/extension_background_host.h b/libcef/browser/extensions/extension_background_host.h index 086763ca6..8b62a3744 100644 --- a/libcef/browser/extensions/extension_background_host.h +++ b/libcef/browser/extensions/extension_background_host.h @@ -11,7 +11,7 @@ #include "base/macros.h" #include "extensions/browser/extension_host.h" -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; namespace content { class WebContents; @@ -24,7 +24,7 @@ namespace extensions { // is managed by ProcessManager. class CefExtensionBackgroundHost : public ExtensionHost { public: - CefExtensionBackgroundHost(CefBrowserHostImpl* browser, + CefExtensionBackgroundHost(AlloyBrowserHostImpl* browser, base::OnceClosure deleted_callback, const Extension* extension, content::WebContents* host_contents, diff --git a/libcef/browser/extensions/extension_function_details.cc b/libcef/browser/extensions/extension_function_details.cc index b1824a1ef..b72c89f20 100644 --- a/libcef/browser/extensions/extension_function_details.cc +++ b/libcef/browser/extensions/extension_function_details.cc @@ -143,18 +143,18 @@ Profile* CefExtensionFunctionDetails::GetProfile() const { return Profile::FromBrowserContext(function_->browser_context()); } -CefRefPtr CefExtensionFunctionDetails::GetSenderBrowser() +CefRefPtr CefExtensionFunctionDetails::GetSenderBrowser() const { content::WebContents* web_contents = function_->GetSenderWebContents(); if (web_contents) - return CefBrowserHostImpl::GetBrowserForContents(web_contents); + return AlloyBrowserHostImpl::GetBrowserForContents(web_contents); return nullptr; } -CefRefPtr CefExtensionFunctionDetails::GetCurrentBrowser() +CefRefPtr CefExtensionFunctionDetails::GetCurrentBrowser() const { // Start with the browser hosting the extension. - CefRefPtr browser = GetSenderBrowser(); + CefRefPtr browser = GetSenderBrowser(); if (browser && browser->client()) { CefRefPtr handler = GetCefExtension()->GetHandler(); if (handler) { @@ -163,8 +163,8 @@ CefRefPtr CefExtensionFunctionDetails::GetCurrentBrowser() handler->GetActiveBrowser(GetCefExtension(), browser.get(), function_->include_incognito_information()); if (active_browser && active_browser != browser) { - CefRefPtr active_browser_impl = - static_cast(active_browser.get()); + CefRefPtr active_browser_impl = + static_cast(active_browser.get()); // Make sure we're operating in the same CefBrowserContext. if (CefBrowserContext::FromBrowserContext( @@ -187,11 +187,11 @@ CefRefPtr CefExtensionFunctionDetails::GetCurrentBrowser() } bool CefExtensionFunctionDetails::CanAccessBrowser( - CefRefPtr target) const { + CefRefPtr target) const { DCHECK(target); // Start with the browser hosting the extension. - CefRefPtr browser = GetSenderBrowser(); + CefRefPtr browser = GetSenderBrowser(); if (browser == target) { // A sender can always access itself. return true; @@ -210,14 +210,14 @@ bool CefExtensionFunctionDetails::CanAccessBrowser( return true; } -CefRefPtr +CefRefPtr CefExtensionFunctionDetails::GetBrowserForTabIdFirstTime( int tab_id, std::string* error_message) const { DCHECK(!get_browser_called_first_time_); get_browser_called_first_time_ = true; - CefRefPtr browser; + CefRefPtr browser; if (tab_id >= 0) { // May be an invalid tabId or in the wrong BrowserContext. @@ -243,7 +243,7 @@ CefExtensionFunctionDetails::GetBrowserForTabIdFirstTime( return browser; } -CefRefPtr +CefRefPtr CefExtensionFunctionDetails::GetBrowserForTabIdAgain( int tab_id, std::string* error_message) const { @@ -251,7 +251,7 @@ CefExtensionFunctionDetails::GetBrowserForTabIdAgain( DCHECK(get_browser_called_first_time_); // May return NULL during shutdown. - CefRefPtr browser = + CefRefPtr browser = GetBrowserForTabId(tab_id, function_->browser_context()); if (!browser || !browser->web_contents()) { if (error_message) { @@ -265,7 +265,7 @@ CefExtensionFunctionDetails::GetBrowserForTabIdAgain( bool CefExtensionFunctionDetails::LoadFile(const std::string& file, LoadFileCallback callback) const { // Start with the browser hosting the extension. - CefRefPtr browser = GetSenderBrowser(); + CefRefPtr browser = GetSenderBrowser(); if (browser && browser->client()) { CefRefPtr handler = GetCefExtension()->GetHandler(); if (handler) { @@ -290,7 +290,7 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab( const OpenTabParams& params, bool user_gesture, std::string* error_message) const { - CefRefPtr sender_browser = GetSenderBrowser(); + CefRefPtr sender_browser = GetSenderBrowser(); if (!sender_browser) return nullptr; @@ -301,7 +301,7 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab( // CEF doesn't have the concept of windows containing tab strips so we'll // select an "active browser" for BrowserContext sharing instead. - CefRefPtr active_browser = + CefRefPtr active_browser = GetBrowserForTabIdFirstTime(window_id, error_message); if (!active_browser) return nullptr; @@ -394,8 +394,8 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab( } // Browser creation may fail under certain rare circumstances. - CefRefPtr new_browser = - CefBrowserHostImpl::Create(create_params); + CefRefPtr new_browser = + AlloyBrowserHostImpl::Create(create_params); if (!new_browser) return nullptr; @@ -412,7 +412,7 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab( } std::unique_ptr CefExtensionFunctionDetails::CreateTabObject( - CefRefPtr new_browser, + CefRefPtr new_browser, int opener_browser_id, bool active, int index) const { diff --git a/libcef/browser/extensions/extension_function_details.h b/libcef/browser/extensions/extension_function_details.h index 1ba710230..0ecdfd8ef 100644 --- a/libcef/browser/extensions/extension_function_details.h +++ b/libcef/browser/extensions/extension_function_details.h @@ -5,7 +5,7 @@ #ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DETAILS_H_ #define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_DETAILS_H_ -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "include/cef_extension.h" @@ -36,7 +36,7 @@ class CefExtensionFunctionDetails { // Get the "sender" browser that is hosting the extension. May return NULL // during startup/shutdown. - CefRefPtr GetSenderBrowser() const; + CefRefPtr GetSenderBrowser() const; // Get the "current" browser that will be acted on by this extension function, // if any. When mapping from a tabId use the GetBrowserForTabId* methods @@ -57,12 +57,12 @@ class CefExtensionFunctionDetails { // This method can return NULL if there is no matching browser, which can // happen if only incognito windows are open, or early in startup or shutdown // shutdown when there are no active windows. - CefRefPtr GetCurrentBrowser() const; + CefRefPtr GetCurrentBrowser() const; // Returns true if the sender browser can access |target|. When mapping from a // tabId use the GetBrowserForTabId* methods instead of calling this method // directly. - bool CanAccessBrowser(CefRefPtr target) const; + bool CanAccessBrowser(CefRefPtr target) const; // Returns the browser matching |tab_id| or NULL if the browser cannot be // found or does not have a WebContents. If |tab_id| is < 0 the "current" @@ -70,7 +70,7 @@ class CefExtensionFunctionDetails { // will be set with an appropriate message on error. This method should only // be called one time per extension function and will check all necessary // client permissions. - CefRefPtr GetBrowserForTabIdFirstTime( + CefRefPtr GetBrowserForTabIdFirstTime( int tab_id, std::string* error_message) const; @@ -79,7 +79,7 @@ class CefExtensionFunctionDetails { // |error_message| can optionally be passed in and will be set with an // appropriate message on error. This method should be called only after // GetBrowserForTabIdFirstTime() has succeeded for the same |tab_id|. - CefRefPtr GetBrowserForTabIdAgain( + CefRefPtr GetBrowserForTabIdAgain( int tab_id, std::string* error_message) const; @@ -114,7 +114,7 @@ class CefExtensionFunctionDetails { // permissions of the extension, the object may or may not include sensitive // data such as the tab's URL. std::unique_ptr CreateTabObject( - CefRefPtr new_browser, + CefRefPtr new_browser, int opener_browser_id, bool active, int index) const; diff --git a/libcef/browser/extensions/extension_host_delegate.cc b/libcef/browser/extensions/extension_host_delegate.cc index bd6323025..bb4fa53e8 100644 --- a/libcef/browser/extensions/extension_host_delegate.cc +++ b/libcef/browser/extensions/extension_host_delegate.cc @@ -13,7 +13,7 @@ namespace extensions { CefExtensionHostDelegate::CefExtensionHostDelegate( - CefBrowserHostImpl* browser) {} + AlloyBrowserHostImpl* browser) {} CefExtensionHostDelegate::~CefExtensionHostDelegate() {} @@ -25,7 +25,7 @@ void CefExtensionHostDelegate::OnRenderViewCreatedForBackgroundPage( content::JavaScriptDialogManager* CefExtensionHostDelegate::GetJavaScriptDialogManager() { - // Never routed here from CefBrowserHostImpl. + // Never routed here from AlloyBrowserHostImpl. NOTREACHED(); return nullptr; } @@ -45,7 +45,7 @@ void CefExtensionHostDelegate::ProcessMediaAccessRequest( const content::MediaStreamRequest& request, content::MediaResponseCallback callback, const Extension* extension) { - // Never routed here from CefBrowserHostImpl. + // Never routed here from AlloyBrowserHostImpl. NOTREACHED(); } @@ -54,7 +54,7 @@ bool CefExtensionHostDelegate::CheckMediaAccessPermission( const GURL& security_origin, blink::mojom::MediaStreamType type, const Extension* extension) { - // Never routed here from CefBrowserHostImpl. + // Never routed here from AlloyBrowserHostImpl. NOTREACHED(); return false; } diff --git a/libcef/browser/extensions/extension_host_delegate.h b/libcef/browser/extensions/extension_host_delegate.h index 31e76faaf..bc4352679 100644 --- a/libcef/browser/extensions/extension_host_delegate.h +++ b/libcef/browser/extensions/extension_host_delegate.h @@ -8,13 +8,13 @@ #include "base/macros.h" #include "extensions/browser/extension_host_delegate.h" -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; namespace extensions { class CefExtensionHostDelegate : public ExtensionHostDelegate { public: - explicit CefExtensionHostDelegate(CefBrowserHostImpl* browser); + explicit CefExtensionHostDelegate(AlloyBrowserHostImpl* browser); ~CefExtensionHostDelegate() override; // ExtensionHostDelegate implementation. diff --git a/libcef/browser/extensions/extension_view_host.cc b/libcef/browser/extensions/extension_view_host.cc index eb34ab03d..3eb8ee839 100644 --- a/libcef/browser/extensions/extension_view_host.cc +++ b/libcef/browser/extensions/extension_view_host.cc @@ -21,7 +21,7 @@ using content::WebContentsObserver; namespace extensions { -CefExtensionViewHost::CefExtensionViewHost(CefBrowserHostImpl* browser, +CefExtensionViewHost::CefExtensionViewHost(AlloyBrowserHostImpl* browser, const Extension* extension, content::WebContents* host_contents, const GURL& url, diff --git a/libcef/browser/extensions/extension_view_host.h b/libcef/browser/extensions/extension_view_host.h index fe0d2ea98..9e8b2eb5f 100644 --- a/libcef/browser/extensions/extension_view_host.h +++ b/libcef/browser/extensions/extension_view_host.h @@ -12,7 +12,7 @@ #include "content/public/browser/notification_registrar.h" #include "extensions/browser/extension_host.h" -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; namespace content { class WebContents; @@ -22,12 +22,12 @@ namespace extensions { // The ExtensionHost for an extension that backs a view in the browser UI. For // example, this could be an extension popup or dialog, but not a background -// page. Object lifespan is managed by CefBrowserHostImpl. Based on +// page. Object lifespan is managed by AlloyBrowserHostImpl. Based on // chrome/browser/extensions/extension_view_host.h. class CefExtensionViewHost : public ExtensionHost, public content::NotificationObserver { public: - CefExtensionViewHost(CefBrowserHostImpl* browser, + CefExtensionViewHost(AlloyBrowserHostImpl* browser, const Extension* extension, content::WebContents* host_contents, const GURL& url, diff --git a/libcef/browser/extensions/extensions_browser_client.cc b/libcef/browser/extensions/extensions_browser_client.cc index 9212ce7d0..3d9c7109a 100644 --- a/libcef/browser/extensions/extensions_browser_client.cc +++ b/libcef/browser/extensions/extensions_browser_client.cc @@ -7,8 +7,8 @@ #include +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/browser_context.h" -#include "libcef/browser/browser_host_impl.h" #include "libcef/browser/extensions/component_extension_resource_manager.h" #include "libcef/browser/extensions/extension_system.h" #include "libcef/browser/extensions/extension_system_factory.h" @@ -269,8 +269,8 @@ bool CefExtensionsBrowserClient::CreateBackgroundExtensionHost( // Browser creation may fail under certain rare circumstances. Fail the // background host creation in that case. - CefRefPtr browser = - CefBrowserHostImpl::Create(create_params); + CefRefPtr browser = + AlloyBrowserHostImpl::Create(create_params); if (browser) { *host = browser->GetExtensionHost(); DCHECK(*host); diff --git a/libcef/browser/extensions/mime_handler_view_guest_delegate.cc b/libcef/browser/extensions/mime_handler_view_guest_delegate.cc index a8aedd20e..252a1787a 100644 --- a/libcef/browser/extensions/mime_handler_view_guest_delegate.cc +++ b/libcef/browser/extensions/mime_handler_view_guest_delegate.cc @@ -5,9 +5,9 @@ #include "libcef/browser/extensions/mime_handler_view_guest_delegate.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.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/osr/web_contents_view_osr.h" @@ -27,8 +27,8 @@ void CefMimeHandlerViewGuestDelegate::OverrideWebContentsCreateParams( content::WebContents::CreateParams* params) { DCHECK(params->guest_delegate); - CefRefPtr owner_browser = - CefBrowserHostImpl::GetBrowserForContents(owner_web_contents_); + CefRefPtr owner_browser = + AlloyBrowserHostImpl::GetBrowserForContents(owner_web_contents_); DCHECK(owner_browser); if (owner_browser->IsWindowless()) { @@ -43,8 +43,8 @@ void CefMimeHandlerViewGuestDelegate::OnGuestAttached() { content::WebContents* web_contents = guest_->web_contents(); DCHECK(web_contents); - CefRefPtr owner_browser = - CefBrowserHostImpl::GetBrowserForContents(owner_web_contents_); + CefRefPtr owner_browser = + AlloyBrowserHostImpl::GetBrowserForContents(owner_web_contents_); DCHECK(owner_browser); // Associate guest state information with the owner browser. @@ -56,8 +56,8 @@ void CefMimeHandlerViewGuestDelegate::OnGuestDetached() { content::WebContents* web_contents = guest_->web_contents(); DCHECK(web_contents); - CefRefPtr owner_browser = - CefBrowserHostImpl::GetBrowserForContents(owner_web_contents_); + CefRefPtr owner_browser = + AlloyBrowserHostImpl::GetBrowserForContents(owner_web_contents_); DCHECK(owner_browser); // Disassociate guest state information with the owner browser. @@ -78,8 +78,8 @@ bool CefMimeHandlerViewGuestDelegate::HandleContextMenu( new_params.x += guest_coordinates.x(); new_params.y += guest_coordinates.y(); - CefRefPtr owner_browser = - CefBrowserHostImpl::GetBrowserForContents(owner_web_contents_); + CefRefPtr owner_browser = + AlloyBrowserHostImpl::GetBrowserForContents(owner_web_contents_); DCHECK(owner_browser); return owner_browser->HandleContextMenu(web_contents, new_params); diff --git a/libcef/browser/file_dialog_manager.cc b/libcef/browser/file_dialog_manager.cc index 5f7361b0b..12d476228 100644 --- a/libcef/browser/file_dialog_manager.cc +++ b/libcef/browser/file_dialog_manager.cc @@ -8,7 +8,7 @@ #include #include "include/cef_dialog_handler.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/thread_util.h" #include "content/public/browser/file_select_listener.h" @@ -140,7 +140,7 @@ class UploadFolderHelper } // namespace CefFileDialogManager::CefFileDialogManager( - CefBrowserHostImpl* browser, + AlloyBrowserHostImpl* browser, std::unique_ptr runner) : browser_(browser), runner_(std::move(runner)), diff --git a/libcef/browser/file_dialog_manager.h b/libcef/browser/file_dialog_manager.h index 8bd8bfff8..c285fa933 100644 --- a/libcef/browser/file_dialog_manager.h +++ b/libcef/browser/file_dialog_manager.h @@ -23,19 +23,19 @@ namespace net { class DirectoryLister; } -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class CefFileDialogManager { public: // |runner| may be NULL if the platform doesn't implement dialogs. - CefFileDialogManager(CefBrowserHostImpl* browser, + CefFileDialogManager(AlloyBrowserHostImpl* browser, std::unique_ptr runner); ~CefFileDialogManager(); // Delete the runner to free any platform constructs. void Destroy(); - // Called from CefBrowserHostImpl::RunFileChooser. + // Called from AlloyBrowserHostImpl::RunFileChooser. // See CefBrowserHost::RunFileDialog documentation. void RunFileDialog(cef_file_dialog_mode_t mode, const CefString& title, @@ -44,7 +44,7 @@ class CefFileDialogManager { int selected_accept_filter, CefRefPtr callback); - // Called from CefBrowserHostImpl::RunFileChooser. + // Called from AlloyBrowserHostImpl::RunFileChooser. // See WebContentsDelegate::RunFileChooser documentation. void RunFileChooser(scoped_refptr listener, const blink::mojom::FileChooserParams& params); @@ -86,8 +86,8 @@ class CefFileDialogManager { // Clean up state associated with the last run. void Cleanup(); - // CefBrowserHostImpl pointer is guaranteed to outlive this object. - CefBrowserHostImpl* browser_; + // AlloyBrowserHostImpl pointer is guaranteed to outlive this object. + AlloyBrowserHostImpl* browser_; std::unique_ptr runner_; diff --git a/libcef/browser/file_dialog_runner.h b/libcef/browser/file_dialog_runner.h index 1ad114303..be051fe90 100644 --- a/libcef/browser/file_dialog_runner.h +++ b/libcef/browser/file_dialog_runner.h @@ -13,7 +13,7 @@ #include "base/files/file_path.h" #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h" -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class CefFileDialogRunner { public: @@ -34,7 +34,7 @@ class CefFileDialogRunner { RunFileChooserCallback; // Display the file chooser dialog. Execute |callback| on completion. - virtual void Run(CefBrowserHostImpl* browser, + virtual void Run(AlloyBrowserHostImpl* browser, const FileChooserParams& params, RunFileChooserCallback callback) = 0; diff --git a/libcef/browser/javascript_dialog_manager.cc b/libcef/browser/javascript_dialog_manager.cc index 4e4c791f9..521c293ff 100644 --- a/libcef/browser/javascript_dialog_manager.cc +++ b/libcef/browser/javascript_dialog_manager.cc @@ -7,7 +7,7 @@ #include -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/thread_util.h" #include "base/bind.h" @@ -63,7 +63,7 @@ class CefJSDialogCallbackImpl : public CefJSDialogCallback { } // namespace CefJavaScriptDialogManager::CefJavaScriptDialogManager( - CefBrowserHostImpl* browser, + AlloyBrowserHostImpl* browser, std::unique_ptr runner) : browser_(browser), runner_(std::move(runner)), @@ -144,7 +144,7 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog( bool is_reload, DialogClosedCallback callback) { if (browser_->destruction_state() >= - CefBrowserHostImpl::DESTRUCTION_STATE_ACCEPTED) { + AlloyBrowserHostImpl::DESTRUCTION_STATE_ACCEPTED) { // Currently destroying the browser. Accept the unload without showing // the prompt. std::move(callback).Run(true, base::string16()); diff --git a/libcef/browser/javascript_dialog_manager.h b/libcef/browser/javascript_dialog_manager.h index 227cb5262..6c8db31ff 100644 --- a/libcef/browser/javascript_dialog_manager.h +++ b/libcef/browser/javascript_dialog_manager.h @@ -15,12 +15,12 @@ #include "base/memory/weak_ptr.h" #include "content/public/browser/javascript_dialog_manager.h" -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class CefJavaScriptDialogManager : public content::JavaScriptDialogManager { public: // |runner| may be NULL if the platform doesn't implement dialogs. - CefJavaScriptDialogManager(CefBrowserHostImpl* browser, + CefJavaScriptDialogManager(AlloyBrowserHostImpl* browser, std::unique_ptr runner); ~CefJavaScriptDialogManager() override; @@ -48,8 +48,8 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager { bool success, const base::string16& user_input); - // CefBrowserHostImpl pointer is guaranteed to outlive this object. - CefBrowserHostImpl* browser_; + // AlloyBrowserHostImpl pointer is guaranteed to outlive this object. + AlloyBrowserHostImpl* browser_; std::unique_ptr runner_; diff --git a/libcef/browser/javascript_dialog_runner.h b/libcef/browser/javascript_dialog_runner.h index 8d79320fd..af2aa5072 100644 --- a/libcef/browser/javascript_dialog_runner.h +++ b/libcef/browser/javascript_dialog_runner.h @@ -11,7 +11,7 @@ #include "base/strings/string16.h" #include "content/public/common/javascript_dialog_type.h" -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class CefJavaScriptDialogRunner { public: @@ -20,7 +20,7 @@ class CefJavaScriptDialogRunner { DialogClosedCallback; // Run the dialog. Execute |callback| on completion. - virtual void Run(CefBrowserHostImpl* browser, + virtual void Run(AlloyBrowserHostImpl* browser, content::JavaScriptDialogType message_type, const base::string16& display_url, const base::string16& message_text, diff --git a/libcef/browser/menu_manager.cc b/libcef/browser/menu_manager.cc index 7890d39e5..db4fe2de8 100644 --- a/libcef/browser/menu_manager.cc +++ b/libcef/browser/menu_manager.cc @@ -6,7 +6,7 @@ #include -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/context_menu_params_impl.h" #include "libcef/browser/menu_runner.h" #include "libcef/browser/thread_util.h" @@ -86,7 +86,7 @@ class CefRunContextMenuCallbackImpl : public CefRunContextMenuCallback { } // namespace -CefMenuManager::CefMenuManager(CefBrowserHostImpl* browser, +CefMenuManager::CefMenuManager(AlloyBrowserHostImpl* browser, std::unique_ptr runner) : content::WebContentsObserver(browser->web_contents()), browser_(browser), diff --git a/libcef/browser/menu_manager.h b/libcef/browser/menu_manager.h index 366147930..83fafe263 100644 --- a/libcef/browser/menu_manager.h +++ b/libcef/browser/menu_manager.h @@ -19,13 +19,13 @@ class RenderFrameHost; class WebContents; } // namespace content -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class CefRunContextMenuCallback; class CefMenuManager : public CefMenuModelImpl::Delegate, public content::WebContentsObserver { public: - CefMenuManager(CefBrowserHostImpl* browser, + CefMenuManager(AlloyBrowserHostImpl* browser, std::unique_ptr runner); ~CefMenuManager() override; @@ -59,8 +59,8 @@ class CefMenuManager : public CefMenuModelImpl::Delegate, // Returns true if the specified id is a custom context menu command. bool IsCustomContextMenuCommand(int command_id); - // CefBrowserHostImpl pointer is guaranteed to outlive this object. - CefBrowserHostImpl* browser_; + // AlloyBrowserHostImpl pointer is guaranteed to outlive this object. + AlloyBrowserHostImpl* browser_; std::unique_ptr runner_; diff --git a/libcef/browser/menu_runner.h b/libcef/browser/menu_runner.h index 6bb0e1083..edd058057 100644 --- a/libcef/browser/menu_runner.h +++ b/libcef/browser/menu_runner.h @@ -14,13 +14,13 @@ namespace content { struct ContextMenuParams; } -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class CefMenuModelImpl; // Provides platform-specific menu implementations for CefMenuCreator. class CefMenuRunner { public: - virtual bool RunContextMenu(CefBrowserHostImpl* browser, + virtual bool RunContextMenu(AlloyBrowserHostImpl* browser, CefMenuModelImpl* model, const content::ContextMenuParams& params) = 0; virtual void CancelContextMenu() {} diff --git a/libcef/browser/native/browser_platform_delegate_native.cc b/libcef/browser/native/browser_platform_delegate_native.cc index 0fb83cf01..4fa440eba 100644 --- a/libcef/browser/native/browser_platform_delegate_native.cc +++ b/libcef/browser/native/browser_platform_delegate_native.cc @@ -4,7 +4,7 @@ #include "libcef/browser/native/browser_platform_delegate_native.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/render_widget_host.h" diff --git a/libcef/browser/native/browser_platform_delegate_native_linux.cc b/libcef/browser/native/browser_platform_delegate_native_linux.cc index ee8adad1b..843996fbc 100644 --- a/libcef/browser/native/browser_platform_delegate_native_linux.cc +++ b/libcef/browser/native/browser_platform_delegate_native_linux.cc @@ -6,7 +6,7 @@ #include -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/context.h" #include "libcef/browser/native/menu_runner_linux.h" #include "libcef/browser/native/window_delegate_view.h" @@ -50,7 +50,7 @@ CefBrowserPlatformDelegateNativeLinux::CefBrowserPlatformDelegateNativeLinux( window_widget_(nullptr) {} void CefBrowserPlatformDelegateNativeLinux::BrowserDestroyed( - CefBrowserHostImpl* browser) { + AlloyBrowserHostImpl* browser) { CefBrowserPlatformDelegateNative::BrowserDestroyed(browser); if (host_window_created_) { diff --git a/libcef/browser/native/browser_platform_delegate_native_linux.h b/libcef/browser/native/browser_platform_delegate_native_linux.h index cb8a235c2..b8a2ae5c6 100644 --- a/libcef/browser/native/browser_platform_delegate_native_linux.h +++ b/libcef/browser/native/browser_platform_delegate_native_linux.h @@ -19,7 +19,7 @@ class CefBrowserPlatformDelegateNativeLinux SkColor background_color); // CefBrowserPlatformDelegate methods: - void BrowserDestroyed(CefBrowserHostImpl* browser) override; + void BrowserDestroyed(AlloyBrowserHostImpl* browser) override; bool CreateHostWindow() override; void CloseHostWindow() override; CefWindowHandle GetHostWindowHandle() const override; diff --git a/libcef/browser/native/browser_platform_delegate_native_mac.h b/libcef/browser/native/browser_platform_delegate_native_mac.h index e421a390e..f7a72e818 100644 --- a/libcef/browser/native/browser_platform_delegate_native_mac.h +++ b/libcef/browser/native/browser_platform_delegate_native_mac.h @@ -19,7 +19,7 @@ class CefBrowserPlatformDelegateNativeMac SkColor background_color); // CefBrowserPlatformDelegate methods: - void BrowserDestroyed(CefBrowserHostImpl* browser) override; + void BrowserDestroyed(AlloyBrowserHostImpl* browser) override; bool CreateHostWindow() override; void CloseHostWindow() override; CefWindowHandle GetHostWindowHandle() const override; diff --git a/libcef/browser/native/browser_platform_delegate_native_mac.mm b/libcef/browser/native/browser_platform_delegate_native_mac.mm index ea108142b..d35075524 100644 --- a/libcef/browser/native/browser_platform_delegate_native_mac.mm +++ b/libcef/browser/native/browser_platform_delegate_native_mac.mm @@ -7,7 +7,7 @@ #import #import -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/context.h" #include "libcef/browser/native/file_dialog_runner_mac.h" #include "libcef/browser/native/javascript_dialog_runner_mac.h" @@ -34,10 +34,10 @@ // the view is deleted. @interface CefBrowserHostView : NSView { @private - CefBrowserHostImpl* browser_; // weak + AlloyBrowserHostImpl* browser_; // weak } -@property(nonatomic, assign) CefBrowserHostImpl* browser; +@property(nonatomic, assign) AlloyBrowserHostImpl* browser; @end @@ -60,15 +60,17 @@ // Receives notifications from the browser window. Will delete itself when done. @interface CefWindowDelegate : NSObject { @private - CefBrowserHostImpl* browser_; // weak + AlloyBrowserHostImpl* browser_; // weak NSWindow* window_; } -- (id)initWithWindow:(NSWindow*)window andBrowser:(CefBrowserHostImpl*)browser; +- (id)initWithWindow:(NSWindow*)window + andBrowser:(AlloyBrowserHostImpl*)browser; @end @implementation CefWindowDelegate -- (id)initWithWindow:(NSWindow*)window andBrowser:(CefBrowserHostImpl*)browser { +- (id)initWithWindow:(NSWindow*)window + andBrowser:(AlloyBrowserHostImpl*)browser { if (self = [super init]) { window_ = window; browser_ = browser; @@ -150,7 +152,7 @@ CefBrowserPlatformDelegateNativeMac::CefBrowserPlatformDelegateNativeMac( host_window_created_(false) {} void CefBrowserPlatformDelegateNativeMac::BrowserDestroyed( - CefBrowserHostImpl* browser) { + AlloyBrowserHostImpl* browser) { CefBrowserPlatformDelegateNative::BrowserDestroyed(browser); if (host_window_created_) { diff --git a/libcef/browser/native/browser_platform_delegate_native_win.cc b/libcef/browser/native/browser_platform_delegate_native_win.cc index d240f3bef..04cba517a 100644 --- a/libcef/browser/native/browser_platform_delegate_native_win.cc +++ b/libcef/browser/native/browser_platform_delegate_native_win.cc @@ -8,7 +8,7 @@ #include #include -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/context.h" #include "libcef/browser/native/file_dialog_runner_win.h" #include "libcef/browser/native/javascript_dialog_runner_win.h" @@ -132,7 +132,7 @@ CefBrowserPlatformDelegateNativeWin::CefBrowserPlatformDelegateNativeWin( window_widget_(nullptr) {} void CefBrowserPlatformDelegateNativeWin::BrowserDestroyed( - CefBrowserHostImpl* browser) { + AlloyBrowserHostImpl* browser) { CefBrowserPlatformDelegateNative::BrowserDestroyed(browser); if (host_window_created_) { @@ -530,7 +530,7 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd, WPARAM wParam, LPARAM lParam) { CefBrowserPlatformDelegateNativeWin* platform_delegate = nullptr; - CefBrowserHostImpl* browser = nullptr; + AlloyBrowserHostImpl* browser = nullptr; if (message != WM_NCCREATE) { platform_delegate = static_cast( diff --git a/libcef/browser/native/browser_platform_delegate_native_win.h b/libcef/browser/native/browser_platform_delegate_native_win.h index c2ab6b3cc..9c8e33ffa 100644 --- a/libcef/browser/native/browser_platform_delegate_native_win.h +++ b/libcef/browser/native/browser_platform_delegate_native_win.h @@ -17,7 +17,7 @@ class CefBrowserPlatformDelegateNativeWin SkColor background_color); // CefBrowserPlatformDelegate methods: - void BrowserDestroyed(CefBrowserHostImpl* browser) override; + void BrowserDestroyed(AlloyBrowserHostImpl* browser) override; bool CreateHostWindow() override; void CloseHostWindow() override; CefWindowHandle GetHostWindowHandle() const override; diff --git a/libcef/browser/native/file_dialog_runner_mac.h b/libcef/browser/native/file_dialog_runner_mac.h index 4fa8fdcb6..58c9da60d 100644 --- a/libcef/browser/native/file_dialog_runner_mac.h +++ b/libcef/browser/native/file_dialog_runner_mac.h @@ -18,7 +18,7 @@ class CefFileDialogRunnerMac : public CefFileDialogRunner { CefFileDialogRunnerMac(); // CefFileDialogRunner methods: - void Run(CefBrowserHostImpl* browser, + void Run(AlloyBrowserHostImpl* browser, const FileChooserParams& params, RunFileChooserCallback callback) override; diff --git a/libcef/browser/native/file_dialog_runner_mac.mm b/libcef/browser/native/file_dialog_runner_mac.mm index 25ffa1aaa..f6cbf78f7 100644 --- a/libcef/browser/native/file_dialog_runner_mac.mm +++ b/libcef/browser/native/file_dialog_runner_mac.mm @@ -8,7 +8,7 @@ #import #import -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "base/mac/mac_util.h" #include "base/stl_util.h" @@ -231,7 +231,7 @@ void AddFilters(NSPopUpButton* button, CefFileDialogRunnerMac::CefFileDialogRunnerMac() : weak_ptr_factory_(this) {} -void CefFileDialogRunnerMac::Run(CefBrowserHostImpl* browser, +void CefFileDialogRunnerMac::Run(AlloyBrowserHostImpl* browser, const FileChooserParams& params, RunFileChooserCallback callback) { callback_ = std::move(callback); diff --git a/libcef/browser/native/file_dialog_runner_win.cc b/libcef/browser/native/file_dialog_runner_win.cc index ba98f096d..b36a2c9d9 100644 --- a/libcef/browser/native/file_dialog_runner_win.cc +++ b/libcef/browser/native/file_dialog_runner_win.cc @@ -11,7 +11,7 @@ #include #include -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "base/files/file_util.h" #include "base/stl_util.h" @@ -517,7 +517,7 @@ bool RunSaveFileDialog(const CefFileDialogRunner::FileChooserParams& params, CefFileDialogRunnerWin::CefFileDialogRunnerWin() {} -void CefFileDialogRunnerWin::Run(CefBrowserHostImpl* browser, +void CefFileDialogRunnerWin::Run(AlloyBrowserHostImpl* browser, const FileChooserParams& params, RunFileChooserCallback callback) { int filter_index = params.selected_accept_filter; diff --git a/libcef/browser/native/file_dialog_runner_win.h b/libcef/browser/native/file_dialog_runner_win.h index 78c21c0ff..e05ea6827 100644 --- a/libcef/browser/native/file_dialog_runner_win.h +++ b/libcef/browser/native/file_dialog_runner_win.h @@ -14,7 +14,7 @@ class CefFileDialogRunnerWin : public CefFileDialogRunner { CefFileDialogRunnerWin(); // CefFileDialogRunner methods: - void Run(CefBrowserHostImpl* browser, + void Run(AlloyBrowserHostImpl* browser, const FileChooserParams& params, RunFileChooserCallback callback) override; }; diff --git a/libcef/browser/native/javascript_dialog_runner_mac.h b/libcef/browser/native/javascript_dialog_runner_mac.h index 0cd92ec98..8f93ef497 100644 --- a/libcef/browser/native/javascript_dialog_runner_mac.h +++ b/libcef/browser/native/javascript_dialog_runner_mac.h @@ -24,7 +24,7 @@ class CefJavaScriptDialogRunnerMac : public CefJavaScriptDialogRunner { ~CefJavaScriptDialogRunnerMac() override; // CefJavaScriptDialogRunner methods: - void Run(CefBrowserHostImpl* browser, + void Run(AlloyBrowserHostImpl* browser, content::JavaScriptDialogType message_type, const base::string16& display_url, const base::string16& message_text, diff --git a/libcef/browser/native/javascript_dialog_runner_mac.mm b/libcef/browser/native/javascript_dialog_runner_mac.mm index 289a539fa..bf1948bed 100644 --- a/libcef/browser/native/javascript_dialog_runner_mac.mm +++ b/libcef/browser/native/javascript_dialog_runner_mac.mm @@ -87,7 +87,7 @@ CefJavaScriptDialogRunnerMac::~CefJavaScriptDialogRunnerMac() { } void CefJavaScriptDialogRunnerMac::Run( - CefBrowserHostImpl* browser, + AlloyBrowserHostImpl* browser, content::JavaScriptDialogType message_type, const base::string16& display_url, const base::string16& message_text, diff --git a/libcef/browser/native/javascript_dialog_runner_win.cc b/libcef/browser/native/javascript_dialog_runner_win.cc index 37b52eb2a..49a6af8d9 100644 --- a/libcef/browser/native/javascript_dialog_runner_win.cc +++ b/libcef/browser/native/javascript_dialog_runner_win.cc @@ -5,7 +5,7 @@ #include "libcef/browser/native/javascript_dialog_runner_win.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef_dll/resource.h" #include "base/files/file_path.h" @@ -91,7 +91,7 @@ CefJavaScriptDialogRunnerWin::~CefJavaScriptDialogRunnerWin() { } void CefJavaScriptDialogRunnerWin::Run( - CefBrowserHostImpl* browser, + AlloyBrowserHostImpl* browser, content::JavaScriptDialogType message_type, const base::string16& display_url, const base::string16& message_text, diff --git a/libcef/browser/native/javascript_dialog_runner_win.h b/libcef/browser/native/javascript_dialog_runner_win.h index f8e33d859..94cae6ab7 100644 --- a/libcef/browser/native/javascript_dialog_runner_win.h +++ b/libcef/browser/native/javascript_dialog_runner_win.h @@ -17,7 +17,7 @@ class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner { ~CefJavaScriptDialogRunnerWin() override; // CefJavaScriptDialogRunner methods: - void Run(CefBrowserHostImpl* browser, + void Run(AlloyBrowserHostImpl* browser, content::JavaScriptDialogType message_type, const base::string16& display_url, const base::string16& message_text, diff --git a/libcef/browser/native/menu_runner_linux.cc b/libcef/browser/native/menu_runner_linux.cc index 72e8e4661..2a8ab379f 100644 --- a/libcef/browser/native/menu_runner_linux.cc +++ b/libcef/browser/native/menu_runner_linux.cc @@ -4,7 +4,7 @@ #include "libcef/browser/native/menu_runner_linux.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "base/compiler_specific.h" #include "base/strings/string_util.h" @@ -13,7 +13,7 @@ CefMenuRunnerLinux::CefMenuRunnerLinux() {} bool CefMenuRunnerLinux::RunContextMenu( - CefBrowserHostImpl* browser, + AlloyBrowserHostImpl* browser, CefMenuModelImpl* model, const content::ContextMenuParams& params) { menu_.reset( diff --git a/libcef/browser/native/menu_runner_linux.h b/libcef/browser/native/menu_runner_linux.h index f48fc3596..7ea70aa60 100644 --- a/libcef/browser/native/menu_runner_linux.h +++ b/libcef/browser/native/menu_runner_linux.h @@ -15,7 +15,7 @@ class CefMenuRunnerLinux : public CefMenuRunner { CefMenuRunnerLinux(); // CefMenuRunner methods. - bool RunContextMenu(CefBrowserHostImpl* browser, + bool RunContextMenu(AlloyBrowserHostImpl* browser, CefMenuModelImpl* model, const content::ContextMenuParams& params) override; void CancelContextMenu() override; diff --git a/libcef/browser/native/menu_runner_mac.h b/libcef/browser/native/menu_runner_mac.h index 8cb6a6d7c..44f3ef50b 100644 --- a/libcef/browser/native/menu_runner_mac.h +++ b/libcef/browser/native/menu_runner_mac.h @@ -22,7 +22,7 @@ class CefMenuRunnerMac : public CefMenuRunner { ~CefMenuRunnerMac() override; // CefMenuRunner methods. - bool RunContextMenu(CefBrowserHostImpl* browser, + bool RunContextMenu(AlloyBrowserHostImpl* browser, CefMenuModelImpl* model, const content::ContextMenuParams& params) override; void CancelContextMenu() override; diff --git a/libcef/browser/native/menu_runner_mac.mm b/libcef/browser/native/menu_runner_mac.mm index 2abe1ac7c..f2e98edee 100644 --- a/libcef/browser/native/menu_runner_mac.mm +++ b/libcef/browser/native/menu_runner_mac.mm @@ -4,7 +4,7 @@ #include "libcef/browser/native/menu_runner_mac.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "base/compiler_specific.h" #import "base/mac/scoped_sending_event.h" @@ -17,7 +17,7 @@ CefMenuRunnerMac::CefMenuRunnerMac() {} CefMenuRunnerMac::~CefMenuRunnerMac() {} bool CefMenuRunnerMac::RunContextMenu( - CefBrowserHostImpl* browser, + AlloyBrowserHostImpl* browser, CefMenuModelImpl* model, const content::ContextMenuParams& params) { // Create a menu controller based on the model. diff --git a/libcef/browser/native/menu_runner_win.cc b/libcef/browser/native/menu_runner_win.cc index e18c17ff5..dbc6dc66e 100644 --- a/libcef/browser/native/menu_runner_win.cc +++ b/libcef/browser/native/menu_runner_win.cc @@ -4,7 +4,7 @@ #include "libcef/browser/native/menu_runner_win.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/native/menu_2.h" #include "base/task/current_thread.h" @@ -13,7 +13,7 @@ CefMenuRunnerWin::CefMenuRunnerWin() {} bool CefMenuRunnerWin::RunContextMenu( - CefBrowserHostImpl* browser, + AlloyBrowserHostImpl* browser, CefMenuModelImpl* model, const content::ContextMenuParams& params) { // Create a menu based on the model. diff --git a/libcef/browser/native/menu_runner_win.h b/libcef/browser/native/menu_runner_win.h index 4f807972a..7a098705d 100644 --- a/libcef/browser/native/menu_runner_win.h +++ b/libcef/browser/native/menu_runner_win.h @@ -15,7 +15,7 @@ class CefMenuRunnerWin : public CefMenuRunner { CefMenuRunnerWin(); // CefMenuRunner methods. - bool RunContextMenu(CefBrowserHostImpl* browser, + bool RunContextMenu(AlloyBrowserHostImpl* browser, CefMenuModelImpl* model, const content::ContextMenuParams& params) override; diff --git a/libcef/browser/native/window_delegate_view.cc b/libcef/browser/native/window_delegate_view.cc index 1a408dc38..a591577ee 100644 --- a/libcef/browser/native/window_delegate_view.cc +++ b/libcef/browser/native/window_delegate_view.cc @@ -47,7 +47,7 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget, // Tell Aura not to draw the window frame on resize. params.remove_standard_frame = true; // Cause WidgetDelegate::CanActivate to return true. See comments in - // CefBrowserHostImpl::PlatformSetFocus. + // AlloyBrowserHostImpl::PlatformSetFocus. params.activatable = views::Widget::InitParams::ACTIVATABLE_YES; params.z_order = always_on_top_ ? ui::ZOrderLevel::kFloatingWindow diff --git a/libcef/browser/native/window_x11.cc b/libcef/browser/native/window_x11.cc index f78ef1a55..20e4e176e 100644 --- a/libcef/browser/native/window_x11.cc +++ b/libcef/browser/native/window_x11.cc @@ -92,7 +92,7 @@ CEF_EXPORT XDisplay* cef_get_xdisplay() { return gfx::GetXDisplay(); } -CefWindowX11::CefWindowX11(CefRefPtr browser, +CefWindowX11::CefWindowX11(CefRefPtr browser, ::Window parent_xwindow, const gfx::Rect& bounds, const std::string& title) diff --git a/libcef/browser/native/window_x11.h b/libcef/browser/native/window_x11.h index f551abc2a..668009496 100644 --- a/libcef/browser/native/window_x11.h +++ b/libcef/browser/native/window_x11.h @@ -12,7 +12,7 @@ typedef unsigned long Window; struct _XDisplay; typedef struct _XDisplay Display; -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "base/memory/weak_ptr.h" #include "ui/events/platform/platform_event_dispatcher.h" @@ -29,7 +29,7 @@ class DesktopWindowTreeHostLinux; class CefWindowX11 : public ui::PlatformEventDispatcher, public ui::XEventDispatcher { public: - CefWindowX11(CefRefPtr browser, + CefWindowX11(CefRefPtr browser, ::Window parent_xwindow, const gfx::Rect& bounds, const std::string& title); @@ -69,7 +69,7 @@ class CefWindowX11 : public ui::PlatformEventDispatcher, bool IsTargetedBy(const x11::Event& x11_event) const; void ProcessXEvent(x11::Event* xev); - CefRefPtr browser_; + CefRefPtr browser_; // The display and the native X window hosting the root window. ::Display* xdisplay_; diff --git a/libcef/browser/net_service/login_delegate.cc b/libcef/browser/net_service/login_delegate.cc index ff9ffb190..39e4fad07 100644 --- a/libcef/browser/net_service/login_delegate.cc +++ b/libcef/browser/net_service/login_delegate.cc @@ -4,7 +4,7 @@ #include "libcef/browser/net_service/login_delegate.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/net_service/browser_urlrequest_impl.h" #include "libcef/browser/thread_util.h" @@ -67,7 +67,7 @@ class AuthCallbackImpl : public CefAuthCallback { }; void RunCallbackOnIOThread( - CefRefPtr browser, + CefRefPtr browser, base::Optional url_request_info, const net::AuthChallengeInfo& auth_info, const GURL& origin_url, @@ -119,9 +119,9 @@ LoginDelegate::LoginDelegate(const net::AuthChallengeInfo& auth_info, CEF_REQUIRE_UIT(); // May be nullptr for requests originating from CefURLRequest. - CefRefPtr browser; + CefRefPtr browser; if (web_contents) { - browser = CefBrowserHostImpl::GetBrowserForContents(web_contents); + browser = AlloyBrowserHostImpl::GetBrowserForContents(web_contents); } // |callback| needs to be executed asynchronously. @@ -146,7 +146,7 @@ void LoginDelegate::Cancel() { } } -void LoginDelegate::Start(CefRefPtr browser, +void LoginDelegate::Start(CefRefPtr browser, const net::AuthChallengeInfo& auth_info, const content::GlobalRequestID& request_id, const GURL& origin_url) { diff --git a/libcef/browser/net_service/login_delegate.h b/libcef/browser/net_service/login_delegate.h index 1f831aa15..7c6b70e36 100644 --- a/libcef/browser/net_service/login_delegate.h +++ b/libcef/browser/net_service/login_delegate.h @@ -17,7 +17,7 @@ struct GlobalRequestID; class WebContents; } // namespace content -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class GURL; namespace net_service { @@ -36,7 +36,7 @@ class LoginDelegate : public content::LoginDelegate { void Cancel(); private: - void Start(CefRefPtr browser, + void Start(CefRefPtr browser, const net::AuthChallengeInfo& auth_info, const content::GlobalRequestID& request_id, const GURL& origin_url); diff --git a/libcef/browser/osr/browser_platform_delegate_osr.cc b/libcef/browser/osr/browser_platform_delegate_osr.cc index b9f6a7906..ebe46ba0c 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr.cc +++ b/libcef/browser/osr/browser_platform_delegate_osr.cc @@ -6,7 +6,7 @@ #include -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/image_impl.h" #include "libcef/browser/osr/osr_accessibility_util.h" #include "libcef/browser/osr/render_widget_host_view_osr.h" @@ -60,7 +60,7 @@ void CefBrowserPlatformDelegateOsr::RenderViewCreated( } void CefBrowserPlatformDelegateOsr::BrowserCreated( - CefBrowserHostImpl* browser) { + AlloyBrowserHostImpl* browser) { CefBrowserPlatformDelegateAlloy::BrowserCreated(browser); if (browser->IsPopup()) { @@ -92,7 +92,7 @@ void CefBrowserPlatformDelegateOsr::NotifyBrowserDestroyed() { } void CefBrowserPlatformDelegateOsr::BrowserDestroyed( - CefBrowserHostImpl* browser) { + AlloyBrowserHostImpl* browser) { CefBrowserPlatformDelegateAlloy::BrowserDestroyed(browser); view_osr_ = nullptr; diff --git a/libcef/browser/osr/browser_platform_delegate_osr.h b/libcef/browser/osr/browser_platform_delegate_osr.h index b87ac00b9..2a4d2adae 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr.h +++ b/libcef/browser/osr/browser_platform_delegate_osr.h @@ -27,9 +27,9 @@ class CefBrowserPlatformDelegateOsr void WebContentsCreated(content::WebContents* web_contents, bool owned) override; void RenderViewCreated(content::RenderViewHost* render_view_host) override; - void BrowserCreated(CefBrowserHostImpl* browser) override; + void BrowserCreated(AlloyBrowserHostImpl* browser) override; void NotifyBrowserDestroyed() override; - void BrowserDestroyed(CefBrowserHostImpl* browser) override; + void BrowserDestroyed(AlloyBrowserHostImpl* browser) override; SkColor GetBackgroundColor() const override; void WasResized() override; void SendKeyEvent(const CefKeyEvent& event) override; diff --git a/libcef/browser/osr/browser_platform_delegate_osr_linux.cc b/libcef/browser/osr/browser_platform_delegate_osr_linux.cc index 2f7fef111..0834e6456 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr_linux.cc +++ b/libcef/browser/osr/browser_platform_delegate_osr_linux.cc @@ -6,8 +6,6 @@ #include -#include "libcef/browser/browser_host_impl.h" - CefBrowserPlatformDelegateOsrLinux::CefBrowserPlatformDelegateOsrLinux( std::unique_ptr native_delegate, bool use_external_begin_frame) diff --git a/libcef/browser/osr/browser_platform_delegate_osr_mac.mm b/libcef/browser/osr/browser_platform_delegate_osr_mac.mm index a2fa7b268..d67734ff2 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr_mac.mm +++ b/libcef/browser/osr/browser_platform_delegate_osr_mac.mm @@ -6,9 +6,6 @@ #include -#include "libcef/browser/browser_host_impl.h" -#include "libcef/browser/osr/render_widget_host_view_osr.h" - CefBrowserPlatformDelegateOsrMac::CefBrowserPlatformDelegateOsrMac( std::unique_ptr native_delegate) : CefBrowserPlatformDelegateOsr(std::move(native_delegate), diff --git a/libcef/browser/osr/browser_platform_delegate_osr_win.cc b/libcef/browser/osr/browser_platform_delegate_osr_win.cc index b9f624c31..9307bac57 100644 --- a/libcef/browser/osr/browser_platform_delegate_osr_win.cc +++ b/libcef/browser/osr/browser_platform_delegate_osr_win.cc @@ -6,8 +6,6 @@ #include -#include "libcef/browser/browser_host_impl.h" - CefBrowserPlatformDelegateOsrWin::CefBrowserPlatformDelegateOsrWin( std::unique_ptr native_delegate, bool use_shared_texture, diff --git a/libcef/browser/osr/host_display_client_osr.cc b/libcef/browser/osr/host_display_client_osr.cc index cc4321cac..858f96dde 100644 --- a/libcef/browser/osr/host_display_client_osr.cc +++ b/libcef/browser/osr/host_display_client_osr.cc @@ -6,7 +6,6 @@ #include -#include "libcef/browser/browser_host_impl.h" #include "libcef/browser/osr/render_widget_host_view_osr.h" #include "base/memory/shared_memory_mapping.h" diff --git a/libcef/browser/osr/render_widget_host_view_osr.cc b/libcef/browser/osr/render_widget_host_view_osr.cc index 079393a96..60818319e 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.cc +++ b/libcef/browser/osr/render_widget_host_view_osr.cc @@ -9,7 +9,7 @@ #include -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/osr/osr_util.h" #include "libcef/browser/osr/synthetic_gesture_target_osr.h" #include "libcef/browser/osr/video_consumer_osr.h" @@ -146,7 +146,7 @@ ui::LatencyInfo CreateLatencyInfo(const blink::WebInputEvent& event) { return latency_info; } -gfx::Rect GetViewBounds(CefBrowserHostImpl* browser) { +gfx::Rect GetViewBounds(AlloyBrowserHostImpl* browser) { if (!browser) return gfx::Rect(); @@ -162,7 +162,7 @@ gfx::Rect GetViewBounds(CefBrowserHostImpl* browser) { return gfx::Rect(rc.x, rc.y, rc.width, rc.height); } -float GetDeviceScaleFactor(CefBrowserHostImpl* browser) { +float GetDeviceScaleFactor(AlloyBrowserHostImpl* browser) { if (!browser) return kDefaultScaleFactor; @@ -231,8 +231,8 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR( browser_impl_ = parent_host_view_->browser_impl(); DCHECK(browser_impl_); } else if (content::RenderViewHost::From(render_widget_host_)) { - // CefBrowserHostImpl might not be created at this time for popups. - browser_impl_ = CefBrowserHostImpl::GetBrowserForHost( + // AlloyBrowserHostImpl might not be created at this time for popups. + browser_impl_ = AlloyBrowserHostImpl::GetBrowserForHost( content::RenderViewHost::From(render_widget_host_)); } @@ -1517,7 +1517,7 @@ ui::Layer* CefRenderWidgetHostViewOSR::GetRootLayer() const { } void CefRenderWidgetHostViewOSR::SetFrameRate() { - CefRefPtr browser; + CefRefPtr browser; if (parent_host_view_) { // Use the same frame rate as the embedding browser. browser = parent_host_view_->browser_impl_; diff --git a/libcef/browser/osr/render_widget_host_view_osr.h b/libcef/browser/osr/render_widget_host_view_osr.h index a0300bb76..ac4039378 100644 --- a/libcef/browser/osr/render_widget_host_view_osr.h +++ b/libcef/browser/osr/render_widget_host_view_osr.h @@ -14,7 +14,7 @@ #include "include/cef_base.h" #include "include/cef_browser.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/osr/host_display_client_osr.h" #include "libcef/browser/osr/motion_event_osr.h" @@ -242,8 +242,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, void ImeFinishComposingText(bool keep_selection); void ImeCancelComposition() override; - CefRefPtr browser_impl() const { return browser_impl_; } - void set_browser_impl(CefRefPtr browser) { + CefRefPtr browser_impl() const { return browser_impl_; } + void set_browser_impl(CefRefPtr browser) { browser_impl_ = browser; } @@ -378,7 +378,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, CefRenderWidgetHostViewOSR* child_host_view_ = nullptr; std::set guest_host_views_; - CefRefPtr browser_impl_; + CefRefPtr browser_impl_; bool is_showing_ = false; bool is_destroyed_ = false; 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 3e68e6bbc..2ce0a95e3 100644 --- a/libcef/browser/osr/render_widget_host_view_osr_win.cc +++ b/libcef/browser/osr/render_widget_host_view_osr_win.cc @@ -7,7 +7,6 @@ #include -#include "libcef/browser/browser_host_impl.h" #include "libcef/common/app_manager.h" #include "ui/resources/grit/ui_unscaled_resources.h" diff --git a/libcef/browser/osr/video_consumer_osr.cc b/libcef/browser/osr/video_consumer_osr.cc index 3af1fc8b3..97bfbdb26 100644 --- a/libcef/browser/osr/video_consumer_osr.cc +++ b/libcef/browser/osr/video_consumer_osr.cc @@ -4,7 +4,6 @@ #include "libcef/browser/osr/video_consumer_osr.h" -#include "libcef/browser/browser_host_impl.h" #include "libcef/browser/osr/render_widget_host_view_osr.h" #include "media/base/video_frame_metadata.h" diff --git a/libcef/browser/osr/web_contents_view_osr.cc b/libcef/browser/osr/web_contents_view_osr.cc index 90bb0e00b..b74b7495f 100644 --- a/libcef/browser/osr/web_contents_view_osr.cc +++ b/libcef/browser/osr/web_contents_view_osr.cc @@ -5,7 +5,7 @@ #include "libcef/browser/osr/web_contents_view_osr.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/osr/render_widget_host_view_osr.h" #include "libcef/common/drag_data_impl.h" @@ -151,7 +151,7 @@ void CefWebContentsViewOSR::StartDragging( const gfx::Vector2d& image_offset, const content::DragEventSourceInfo& event_info, content::RenderWidgetHostImpl* source_rwh) { - CefRefPtr browser = GetBrowser(); + CefRefPtr browser = GetBrowser(); if (browser.get()) { browser->StartDragging(drop_data, allowed_ops, image, image_offset, event_info, source_rwh); @@ -163,7 +163,7 @@ void CefWebContentsViewOSR::StartDragging( void CefWebContentsViewOSR::UpdateDragCursor( blink::WebDragOperation operation) { - CefRefPtr browser = GetBrowser(); + CefRefPtr browser = GetBrowser(); if (browser.get()) browser->UpdateDragCursor(operation); } @@ -176,7 +176,7 @@ CefRenderWidgetHostViewOSR* CefWebContentsViewOSR::GetView() const { return nullptr; } -CefBrowserHostImpl* CefWebContentsViewOSR::GetBrowser() const { +AlloyBrowserHostImpl* CefWebContentsViewOSR::GetBrowser() const { CefRenderWidgetHostViewOSR* view = GetView(); if (view) return view->browser_impl().get(); diff --git a/libcef/browser/osr/web_contents_view_osr.h b/libcef/browser/osr/web_contents_view_osr.h index 365446d79..449204e0b 100644 --- a/libcef/browser/osr/web_contents_view_osr.h +++ b/libcef/browser/osr/web_contents_view_osr.h @@ -16,7 +16,7 @@ class WebContents; class WebContentsViewDelegate; } // namespace content -class CefBrowserHostImpl; +class AlloyBrowserHostImpl; class CefRenderWidgetHostViewOSR; // An implementation of WebContentsView for off-screen rendering. @@ -76,7 +76,7 @@ class CefWebContentsViewOSR : public content::WebContentsView, private: CefRenderWidgetHostViewOSR* GetView() const; - CefBrowserHostImpl* GetBrowser() const; + AlloyBrowserHostImpl* GetBrowser() const; const SkColor background_color_; const bool use_shared_texture_; diff --git a/libcef/browser/prefs/renderer_prefs.cc b/libcef/browser/prefs/renderer_prefs.cc index 86c33f531..b0e33a968 100644 --- a/libcef/browser/prefs/renderer_prefs.cc +++ b/libcef/browser/prefs/renderer_prefs.cc @@ -6,7 +6,7 @@ #include -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/context.h" #include "libcef/browser/extensions/browser_extensions_util.h" #include "libcef/common/cef_switches.h" @@ -354,7 +354,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, void PopulateWebPreferences(content::RenderViewHost* rvh, content::WebPreferences& web) { REQUIRE_ALLOY_RUNTIME(); - CefRefPtr browser = static_cast( + CefRefPtr browser = static_cast( extensions::GetOwnerBrowserForHost(rvh, nullptr).get()); // Set defaults for preferences that are not handled by PrefService. diff --git a/libcef/browser/request_context_handler_map.h b/libcef/browser/request_context_handler_map.h index 51487d541..fc541b453 100644 --- a/libcef/browser/request_context_handler_map.h +++ b/libcef/browser/request_context_handler_map.h @@ -20,9 +20,9 @@ class CefRequestContextHandlerMap { ~CefRequestContextHandlerMap(); // Keep track of handlers associated with specific frames. This information - // originates from frame create/delete notifications in CefBrowserHostImpl or - // CefMimeHandlerViewGuestDelegate which are forwarded via - // CefRequestContextImpl and CefBrowserContext. + // originates from frame create/delete notifications in + // CefBrowserContentsDelegate or CefMimeHandlerViewGuestDelegate which are + // forwarded via CefRequestContextImpl and CefBrowserContext. void AddHandler(int render_process_id, int render_frame_id, int frame_tree_node_id, diff --git a/libcef/browser/request_context_impl.h b/libcef/browser/request_context_impl.h index 085fbb971..0144932f5 100644 --- a/libcef/browser/request_context_impl.h +++ b/libcef/browser/request_context_impl.h @@ -81,7 +81,7 @@ class CefRequestContextImpl : public CefRequestContext { const CefRequestContextSettings& settings() const { return config_.settings; } - // Called from CefBrowserHostImpl::RenderFrameCreated or + // Called from CefBrowserContentsDelegate::RenderFrameCreated or // CefMimeHandlerViewGuestDelegate::OnGuestAttached when a render frame is // created. void OnRenderFrameCreated(int render_process_id, @@ -90,7 +90,7 @@ class CefRequestContextImpl : public CefRequestContext { bool is_main_frame, bool is_guest_view); - // Called from CefBrowserHostImpl::FrameDeleted or + // Called from CefBrowserContentsDelegate::RenderFrameDeleted or // CefMimeHandlerViewGuestDelegate::OnGuestDetached when a render frame is // deleted. void OnRenderFrameDeleted(int render_process_id, diff --git a/libcef/browser/views/browser_platform_delegate_views.cc b/libcef/browser/views/browser_platform_delegate_views.cc index 4f8defdb2..9b7d6578c 100644 --- a/libcef/browser/views/browser_platform_delegate_views.cc +++ b/libcef/browser/views/browser_platform_delegate_views.cc @@ -7,7 +7,7 @@ #include #include "include/views/cef_window.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/views/browser_view_impl.h" #include "libcef/browser/views/menu_runner_views.h" @@ -80,7 +80,7 @@ void CefBrowserPlatformDelegateViews::WebContentsDestroyed( } void CefBrowserPlatformDelegateViews::BrowserCreated( - CefBrowserHostImpl* browser) { + AlloyBrowserHostImpl* browser) { CefBrowserPlatformDelegateAlloy::BrowserCreated(browser); native_delegate_->BrowserCreated(browser); @@ -102,7 +102,7 @@ void CefBrowserPlatformDelegateViews::NotifyBrowserDestroyed() { } void CefBrowserPlatformDelegateViews::BrowserDestroyed( - CefBrowserHostImpl* browser) { + AlloyBrowserHostImpl* browser) { CefBrowserPlatformDelegateAlloy::BrowserDestroyed(browser); browser_view_->BrowserDestroyed(browser); @@ -161,7 +161,7 @@ void CefBrowserPlatformDelegateViews::PopupWebContentsCreated( } void CefBrowserPlatformDelegateViews::PopupBrowserCreated( - CefBrowserHostImpl* new_browser, + AlloyBrowserHostImpl* new_browser, bool is_devtools) { CefRefPtr new_browser_view = CefBrowserView::GetForBrowser(new_browser); diff --git a/libcef/browser/views/browser_platform_delegate_views.h b/libcef/browser/views/browser_platform_delegate_views.h index 2a3de031e..49ad5e17c 100644 --- a/libcef/browser/views/browser_platform_delegate_views.h +++ b/libcef/browser/views/browser_platform_delegate_views.h @@ -24,10 +24,10 @@ class CefBrowserPlatformDelegateViews void WebContentsCreated(content::WebContents* web_contents, bool owned) override; void WebContentsDestroyed(content::WebContents* web_contents) override; - void BrowserCreated(CefBrowserHostImpl* browser) override; + void BrowserCreated(AlloyBrowserHostImpl* browser) override; void NotifyBrowserCreated() override; void NotifyBrowserDestroyed() override; - void BrowserDestroyed(CefBrowserHostImpl* browser) override; + void BrowserDestroyed(AlloyBrowserHostImpl* browser) override; bool CreateHostWindow() override; void CloseHostWindow() override; CefWindowHandle GetHostWindowHandle() const override; @@ -39,7 +39,7 @@ class CefBrowserPlatformDelegateViews content::WebContents* new_web_contents, CefBrowserPlatformDelegate* new_platform_delegate, bool is_devtools) override; - void PopupBrowserCreated(CefBrowserHostImpl* new_browser, + void PopupBrowserCreated(AlloyBrowserHostImpl* new_browser, bool is_devtools) override; SkColor GetBackgroundColor() const override; void WasResized() override; diff --git a/libcef/browser/views/browser_view_impl.cc b/libcef/browser/views/browser_view_impl.cc index 84ccf77ad..03135d323 100644 --- a/libcef/browser/views/browser_view_impl.cc +++ b/libcef/browser/views/browser_view_impl.cc @@ -4,7 +4,7 @@ #include "libcef/browser/views/browser_view_impl.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/browser_util.h" #include "libcef/browser/context.h" #include "libcef/browser/thread_util.h" @@ -30,8 +30,8 @@ CefRefPtr CefBrowserView::CreateBrowserView( CefRefPtr CefBrowserView::GetForBrowser( CefRefPtr browser) { CEF_REQUIRE_UIT_RETURN(nullptr); - CefBrowserHostImpl* browser_impl = - static_cast(browser.get()); + AlloyBrowserHostImpl* browser_impl = + static_cast(browser.get()); if (browser_impl && browser_impl->IsViewsHosted()) return browser_impl->GetBrowserView(); return nullptr; @@ -75,13 +75,13 @@ void CefBrowserViewImpl::WebContentsCreated( } void CefBrowserViewImpl::BrowserCreated( - CefBrowserHostImpl* browser, + AlloyBrowserHostImpl* browser, base::RepeatingClosure on_bounds_changed) { browser_ = browser; on_bounds_changed_ = on_bounds_changed; } -void CefBrowserViewImpl::BrowserDestroyed(CefBrowserHostImpl* browser) { +void CefBrowserViewImpl::BrowserDestroyed(AlloyBrowserHostImpl* browser) { DCHECK_EQ(browser, browser_); browser_ = nullptr; @@ -145,7 +145,7 @@ void CefBrowserViewImpl::Detach() { if (browser_) { // |browser_| will disappear when WindowDestroyed() indirectly calls // BrowserDestroyed() so keep a reference. - CefRefPtr browser = browser_; + CefRefPtr browser = browser_; // Force the browser to be destroyed. browser->WindowDestroyed(); @@ -165,7 +165,7 @@ void CefBrowserViewImpl::OnBrowserViewAdded() { // hierarchy. pending_browser_create_params_->browser_view = this; - CefBrowserHostImpl::Create(*pending_browser_create_params_); + AlloyBrowserHostImpl::Create(*pending_browser_create_params_); DCHECK(browser_); pending_browser_create_params_.reset(nullptr); diff --git a/libcef/browser/views/browser_view_impl.h b/libcef/browser/views/browser_view_impl.h index 4b2484867..f379f91b6 100644 --- a/libcef/browser/views/browser_view_impl.h +++ b/libcef/browser/views/browser_view_impl.h @@ -10,7 +10,7 @@ #include "include/views/cef_browser_view.h" #include "include/views/cef_browser_view_delegate.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/views/browser_view_view.h" #include "libcef/browser/views/view_impl.h" @@ -44,9 +44,9 @@ class CefBrowserViewImpl : public CefViewImpl pending_browser_create_params_; - CefRefPtr browser_; + CefRefPtr browser_; views::UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_; bool ignore_next_char_event_ = false; diff --git a/libcef/browser/views/menu_runner_views.cc b/libcef/browser/views/menu_runner_views.cc index b6d976a74..e8dba9a98 100644 --- a/libcef/browser/views/menu_runner_views.cc +++ b/libcef/browser/views/menu_runner_views.cc @@ -4,14 +4,14 @@ #include "libcef/browser/views/menu_runner_views.h" -#include "libcef/browser/browser_host_impl.h" +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/views/browser_view_impl.h" CefMenuRunnerViews::CefMenuRunnerViews(CefBrowserViewImpl* browser_view) : browser_view_(browser_view) {} bool CefMenuRunnerViews::RunContextMenu( - CefBrowserHostImpl* browser, + AlloyBrowserHostImpl* browser, CefMenuModelImpl* model, const content::ContextMenuParams& params) { CefRefPtr window = browser_view_->GetWindow(); diff --git a/libcef/browser/views/menu_runner_views.h b/libcef/browser/views/menu_runner_views.h index 9030dbbff..39d7b1859 100644 --- a/libcef/browser/views/menu_runner_views.h +++ b/libcef/browser/views/menu_runner_views.h @@ -16,7 +16,7 @@ class CefMenuRunnerViews : public CefMenuRunner { explicit CefMenuRunnerViews(CefBrowserViewImpl* browser_view); // CefMenuRunner methods. - bool RunContextMenu(CefBrowserHostImpl* browser, + bool RunContextMenu(AlloyBrowserHostImpl* browser, CefMenuModelImpl* model, const content::ContextMenuParams& params) override; void CancelContextMenu() override; diff --git a/libcef/common/request_impl.h b/libcef/common/request_impl.h index aa6462e55..5b7ab2f18 100644 --- a/libcef/common/request_impl.h +++ b/libcef/common/request_impl.h @@ -114,7 +114,7 @@ class CefRequestImpl : public CefRequest { blink::WebURLRequest& request); // Populate the CefNavigateParams object from this object. - // Called from CefBrowserHostImpl::LoadRequest(). + // Called from CefFrameHostImpl::LoadRequest(). void Get(CefNavigateParams& params) const; void SetReadOnly(bool read_only); diff --git a/patch/patches/chrome_browser_net_export.patch b/patch/patches/chrome_browser_net_export.patch index 70c5bc8c7..f483cef41 100644 --- a/patch/patches/chrome_browser_net_export.patch +++ b/patch/patches/chrome_browser_net_export.patch @@ -47,7 +47,7 @@ index c7bd97a32af1..311f2c52af8d 100644 "views/toolbar/toolbar_account_icon_container_view.h", "views/toolbar/toolbar_action_view.cc", diff --git chrome/browser/ui/webui/net_export_ui.cc chrome/browser/ui/webui/net_export_ui.cc -index f27414c41891..0e6663680e80 100644 +index f27414c41891..5ff3bfa8f724 100644 --- chrome/browser/ui/webui/net_export_ui.cc +++ chrome/browser/ui/webui/net_export_ui.cc @@ -21,6 +21,7 @@ @@ -63,7 +63,7 @@ index f27414c41891..0e6663680e80 100644 #include "ui/shell_dialogs/select_file_dialog.h" +#if BUILDFLAG(ENABLE_CEF) -+#include "cef/libcef/browser/browser_host_impl.h" ++#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h" +#endif + #if defined(OS_ANDROID) @@ -121,8 +121,8 @@ index f27414c41891..0e6663680e80 100644 + +void NetExportMessageHandler::ShowCefSaveAsDialog( + content::WebContents* web_contents) { -+ CefRefPtr cef_browser = -+ CefBrowserHostImpl::GetBrowserForContents(web_contents); ++ CefRefPtr cef_browser = ++ AlloyBrowserHostImpl::GetBrowserForContents(web_contents); + if (!cef_browser) + return; + diff --git a/patch/patches/print_preview_123.patch b/patch/patches/print_preview_123.patch index 0749997bc..b19273cf3 100644 --- a/patch/patches/print_preview_123.patch +++ b/patch/patches/print_preview_123.patch @@ -112,80 +112,77 @@ index b59728f623e3..6fd443962836 100644 ConstrainedWebDialogUI::~ConstrainedWebDialogUI() { diff --git chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc -index bb362bbd321e..ba5a9336ec6a 100644 +index bb362bbd321e..24e94cfd4211 100644 --- chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc +++ chrome/browser/ui/webui/print_preview/pdf_printer_handler.cc -@@ -184,8 +184,10 @@ PdfPrinterHandler::PdfPrinterHandler( - sticky_settings_(sticky_settings) {} +@@ -20,6 +20,7 @@ + #include "base/task/thread_pool.h" + #include "base/values.h" + #include "build/build_config.h" ++#include "cef/libcef/features/runtime.h" + #include "chrome/browser/app_mode/app_mode_utils.h" + #include "chrome/browser/browser_process.h" + #include "chrome/browser/download/download_prefs.h" +@@ -54,6 +55,10 @@ + #include "chrome/browser/chromeos/drive/drive_integration_service.h" + #endif - PdfPrinterHandler::~PdfPrinterHandler() { -+#if !BUILDFLAG(ENABLE_CEF) - if (select_file_dialog_.get()) - select_file_dialog_->ListenerDestroyed(); ++#if BUILDFLAG(ENABLE_CEF) ++#include "cef/libcef/browser/alloy/alloy_browser_host_impl.h" +#endif - } ++ + namespace printing { - void PdfPrinterHandler::Reset() { -@@ -232,12 +234,14 @@ void PdfPrinterHandler::StartPrint( - return; - } - -+#if !BUILDFLAG(ENABLE_CEF) - if (select_file_dialog_ && - select_file_dialog_->IsRunning( - platform_util::GetTopLevel(preview_web_contents_->GetNativeView()))) { - // Dialog is already showing. - return; - } -+#endif - - DCHECK(!print_callback_); - print_callback_ = std::move(callback); -@@ -380,7 +384,11 @@ void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename, + namespace { +@@ -380,10 +385,27 @@ void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename, // If the directory is empty there is no reason to create it or use the // default location. if (path.empty()) { -+#if !BUILDFLAG(ENABLE_CEF) - OnDirectorySelected(default_filename, path); -+#else -+ ShowCefSaveAsDialog(initiator, default_filename, path); ++#if BUILDFLAG(ENABLE_CEF) ++ if (cef::IsAlloyRuntimeEnabled()) { ++ ShowCefSaveAsDialog(initiator, default_filename, path); ++ return; ++ } +#endif + OnDirectorySelected(default_filename, path); return; } -@@ -391,8 +399,14 @@ void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename, ++ auto callback = base::BindOnce(&PdfPrinterHandler::OnDirectorySelected, ++ weak_ptr_factory_.GetWeakPtr(), ++ default_filename); ++#if BUILDFLAG(ENABLE_CEF) ++ if (cef::IsAlloyRuntimeEnabled()) { ++ callback = base::BindOnce(&PdfPrinterHandler::ShowCefSaveAsDialog, ++ weak_ptr_factory_.GetWeakPtr(), initiator, ++ default_filename); ++ } ++#endif ++ + // Get default download directory. This will be used as a fallback if the + // save directory does not exist. + DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext(profile_); +@@ -391,8 +413,7 @@ void PdfPrinterHandler::SelectFile(const base::FilePath& default_filename, base::ThreadPool::PostTaskAndReplyWithResult( FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, base::BindOnce(&SelectSaveDirectory, path, default_path), -+#if !BUILDFLAG(ENABLE_CEF) - base::BindOnce(&PdfPrinterHandler::OnDirectorySelected, - weak_ptr_factory_.GetWeakPtr(), default_filename)); -+#else -+ base::BindOnce(&PdfPrinterHandler::ShowCefSaveAsDialog, -+ weak_ptr_factory_.GetWeakPtr(), initiator, -+ default_filename)); -+#endif +- base::BindOnce(&PdfPrinterHandler::OnDirectorySelected, +- weak_ptr_factory_.GetWeakPtr(), default_filename)); ++ std::move(callback)); } void PdfPrinterHandler::PostPrintToPdfTask() { -@@ -408,6 +422,7 @@ void PdfPrinterHandler::OnGotUniqueFileName(const base::FilePath& path) { - FileSelected(path, 0, nullptr); - } - -+#if !BUILDFLAG(ENABLE_CEF) - void PdfPrinterHandler::OnDirectorySelected(const base::FilePath& filename, - const base::FilePath& directory) { - base::FilePath path = directory.Append(filename); -@@ -432,6 +447,37 @@ void PdfPrinterHandler::OnDirectorySelected(const base::FilePath& filename, - &file_type_info, 0, base::FilePath::StringType(), +@@ -433,6 +454,40 @@ void PdfPrinterHandler::OnDirectorySelected(const base::FilePath& filename, platform_util::GetTopLevel(preview_web_contents_->GetNativeView()), NULL); } -+#else + ++#if BUILDFLAG(ENABLE_CEF) ++ +void PdfPrinterHandler::ShowCefSaveAsDialog(content::WebContents* initiator, + const base::FilePath& filename, + const base::FilePath& directory) { -+ CefRefPtr cef_browser = -+ CefBrowserHostImpl::GetBrowserForContents(initiator); ++ CefRefPtr cef_browser = ++ AlloyBrowserHostImpl::GetBrowserForContents(initiator); + if (!cef_browser) + return; + @@ -210,15 +207,17 @@ index bb362bbd321e..ba5a9336ec6a 100644 + FileSelectionCanceled(nullptr); + } +} -+#endif - ++ ++#endif // BUILDFLAG(ENABLE_CEF) ++ base::FilePath PdfPrinterHandler::GetSaveLocation() const { #if defined(OS_CHROMEOS) + drive::DriveIntegrationService* drive_service = diff --git chrome/browser/ui/webui/print_preview/pdf_printer_handler.h chrome/browser/ui/webui/print_preview/pdf_printer_handler.h -index 26954aeae08f..025ecfa9aceb 100644 +index 26954aeae08f..48afeb608f83 100644 --- chrome/browser/ui/webui/print_preview/pdf_printer_handler.h +++ chrome/browser/ui/webui/print_preview/pdf_printer_handler.h -@@ -11,9 +11,14 @@ +@@ -11,6 +11,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" @@ -226,32 +225,11 @@ index 26954aeae08f..025ecfa9aceb 100644 #include "chrome/browser/ui/webui/print_preview/printer_handler.h" #include "ui/shell_dialogs/select_file_dialog.h" -+#if BUILDFLAG(ENABLE_CEF) -+#include "cef/libcef/browser/browser_host_impl.h" -+#endif -+ - namespace base { - class FilePath; - class RefCountedMemory; -@@ -76,17 +81,28 @@ class PdfPrinterHandler : public PrinterHandler, - // The print preview web contents. Protected so unit tests can access it. - content::WebContents* const preview_web_contents_; - -+#if !BUILDFLAG(ENABLE_CEF) - // The underlying dialog object. Protected so unit tests can access it. - scoped_refptr select_file_dialog_; -+#endif - - private: - void PostPrintToPdfTask(); - void OnGotUniqueFileName(const base::FilePath& path); - -+#if !BUILDFLAG(ENABLE_CEF) - // Prompts the user to save the file. The dialog will default to saving - // the file with name |filename| in |directory|. +@@ -88,6 +89,15 @@ class PdfPrinterHandler : public PrinterHandler, void OnDirectorySelected(const base::FilePath& filename, const base::FilePath& directory); -+#else + ++#if BUILDFLAG(ENABLE_CEF) + void ShowCefSaveAsDialog(content::WebContents* initiator, + const base::FilePath& filename, + const base::FilePath& directory); @@ -259,9 +237,10 @@ index 26954aeae08f..025ecfa9aceb 100644 + void SaveAsDialogDismissed(int selected_accept_filter, + const std::vector& file_paths); +#endif - ++ // Return save location as the Drive mount or fetch from Download Preferences. base::FilePath GetSaveLocation() const; + diff --git chrome/browser/ui/webui/print_preview/print_preview_handler.cc chrome/browser/ui/webui/print_preview/print_preview_handler.cc index ba451b6c854d..0f062e69fd47 100644 --- chrome/browser/ui/webui/print_preview/print_preview_handler.cc