mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add chrome runtime support for more callbacks and ceftests (see issue #2969)
This change adds support for: - Protocol and request handling. - Loading and navigation events. - Display and focus events. - Mouse/keyboard events. - Popup browsers. - Callbacks in the renderer process. - Misc. functionality required for ceftests. This change also adds a new CefBrowserProcessHandler::GetCookieableSchemes callback for configuring global state that will be applied to all CefCookieManagers by default. This global callback is currently required by the chrome runtime because the primary ProfileImpl is created via ChromeBrowserMainParts::PreMainMessageLoopRun (CreatePrimaryProfile) before OnContextCreated can be called. ProfileImpl will use the "C:\Users\[user]\AppData\Local\CEF\User Data\Default" directory by default (on Windows). Cookies may persist in this directory when running ceftests and may need to be manually deleted if those tests fail. Remaining work includes: - Support for client-created request contexts. - Embedding the browser in a Views hierarchy (cefclient support). - TryCloseBrowser and DoClose support. - Most of the CefSettings configuration. - DevTools protocol and window control (ShowDevTools, ExecuteDevToolsMethod). - CEF-specific WebUI pages (about, license, webui-hosts). - Context menu customization (CefContextMenuHandler). - Auto resize (SetAutoResizeEnabled). - Zoom settings (SetZoomLevel). - File dialog runner (RunFileDialog). - File and JS dialog handlers (CefDialogHandler, CefJSDialogHandler). - Extension loading (LoadExtension, etc). - Plugin loading (OnBeforePluginLoad). - Widevine loading (CefRegisterWidevineCdm). - PDF and print preview does not display. - Crash reporting is untested. - Mac: Web content loads but does not display. The following ceftests are now passing when run with the "--enable-chrome-runtime" command-line flag: CorsTest.* DisplayTest.*:-DisplayTest.AutoResize DOMTest.* DraggableRegionsTest.* ImageTest.* MessageRouterTest.* NavigationTest.* ParserTest.* RequestContextTest.*Global* RequestTest.* ResourceManagerTest.* ResourceRequestHandlerTest.* ResponseTest.* SchemeHandlerTest.* ServerTest.* StreamResourceHandlerTest.* StreamTest.* StringTest.* TaskTest.* TestServerTest.* ThreadTest.* URLRequestTest.*Global* V8Test.*:-V8Test.OnUncaughtExceptionDevTools ValuesTest.* WaitableEventTest.* XmlReaderTest.* ZipReaderTest.*
This commit is contained in:
@@ -38,7 +38,6 @@ class Message;
|
||||
}
|
||||
|
||||
class CefBrowserHostBase;
|
||||
class AlloyBrowserHostImpl;
|
||||
class CefBrowserPlatformDelegate;
|
||||
|
||||
// Singleton object for managing BrowserInfo instances.
|
||||
@@ -50,15 +49,14 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// Returns this singleton instance of this class.
|
||||
static CefBrowserInfoManager* GetInstance();
|
||||
|
||||
// Called from AlloyBrowserHostImpl::Create or
|
||||
// ChromeBrowserDelegate::SetAsDelegate when a new browser is being created
|
||||
// Called immediately before a new CefBrowserHost implementation is created
|
||||
// directly. In this case |is_popup| will be true only for DevTools browsers.
|
||||
scoped_refptr<CefBrowserInfo> CreateBrowserInfo(
|
||||
bool is_popup,
|
||||
bool is_windowless,
|
||||
CefRefPtr<CefDictionaryValue> extra_info);
|
||||
|
||||
// Called from AlloyBrowserHostImpl::WebContentsCreated when a new browser is
|
||||
// Called from WebContentsDelegate::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.
|
||||
@@ -67,7 +65,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
bool is_windowless,
|
||||
CefRefPtr<CefDictionaryValue> extra_info);
|
||||
|
||||
// Called from AlloyContentBrowserClient::CanCreateWindow. See comments on
|
||||
// Called from ContentBrowserClient::CanCreateWindow. See comments on
|
||||
// PendingPopup for more information.
|
||||
bool CanCreateWindow(content::RenderFrameHost* opener,
|
||||
const GURL& target_url,
|
||||
@@ -79,8 +77,8 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
bool opener_suppressed,
|
||||
bool* no_javascript_access);
|
||||
|
||||
// Called from AlloyBrowserHostImpl::GetCustomWebContentsView. See comments on
|
||||
// PendingPopup for more information.
|
||||
// Called from WebContentsDelegate::GetCustomWebContentsView (alloy runtime
|
||||
// only). See comments on PendingPopup for more information.
|
||||
void GetCustomWebContentsView(
|
||||
const GURL& target_url,
|
||||
int opener_render_process_id,
|
||||
@@ -88,7 +86,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view);
|
||||
|
||||
// Called from AlloyBrowserHostImpl::WebContentsCreated. See comments on
|
||||
// Called from WebContentsDelegate::WebContentsCreated. See comments on
|
||||
// PendingPopup for more information.
|
||||
void WebContentsCreated(
|
||||
const GURL& target_url,
|
||||
@@ -147,23 +145,24 @@ 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<AlloyBrowserHostImpl>& browser) const;
|
||||
CefRefPtr<CefBrowserHostBase>& browser) const;
|
||||
|
||||
private:
|
||||
// RenderProcessHostObserver methods:
|
||||
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
|
||||
|
||||
// Store state information about pending popups. Call order is:
|
||||
// - AlloyContentBrowserClient::CanCreateWindow (UIT)
|
||||
// - CanCreateWindow (UIT):
|
||||
// Provides an opportunity to cancel the popup (calls OnBeforePopup) and
|
||||
// creates the new platform delegate for the popup. If the popup owner is
|
||||
// an extension guest view then the popup is canceled and
|
||||
// AlloyBrowserHostImpl::OpenURLFromTab is called.
|
||||
// WebContentsDelegate::OpenURLFromTab is called via the
|
||||
// CefBrowserHostBase::MaybeAllowNavigation implementation.
|
||||
// And then the following calls may occur at the same time:
|
||||
// - AlloyBrowserHostImpl::GetCustomWebContentsView (UIT)
|
||||
// - GetCustomWebContentsView (UIT) (alloy runtime only):
|
||||
// Creates the OSR views for windowless popups.
|
||||
// - AlloyBrowserHostImpl::WebContentsCreated (UIT)
|
||||
// Creates the AlloyBrowserHostImpl representation for the popup.
|
||||
// - WebContentsCreated (UIT):
|
||||
// Creates the CefBrowserHost representation for the popup.
|
||||
// - CefBrowserMessageFilter::OnGetNewBrowserInfo (IOT)
|
||||
// Passes information about the popup to the renderer process.
|
||||
struct PendingPopup {
|
||||
|
Reference in New Issue
Block a user