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:
@@ -10,13 +10,14 @@
|
||||
#include "libcef/browser/web_contents_dialog_helper.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
|
||||
// Implementation of Alloy-based browser functionality.
|
||||
class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
||||
public:
|
||||
content::WebContents* CreateWebContents(
|
||||
CefBrowserHostBase::CreateParams& create_params,
|
||||
bool& own_web_contents) override;
|
||||
content::WebContents* CreateWebContents(CefBrowserCreateParams& create_params,
|
||||
bool& own_web_contents) override;
|
||||
void WebContentsCreated(content::WebContents* web_contents,
|
||||
bool owned) override;
|
||||
void AddNewContents(content::WebContents* source,
|
||||
@@ -29,12 +30,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(AlloyBrowserHostImpl* browser) override;
|
||||
void BrowserCreated(CefBrowserHostBase* browser) override;
|
||||
void CreateExtensionHost(const extensions::Extension* extension,
|
||||
const GURL& url,
|
||||
extensions::ViewType host_type) override;
|
||||
extensions::ExtensionHost* GetExtensionHost() const override;
|
||||
void BrowserDestroyed(AlloyBrowserHostImpl* browser) override;
|
||||
void BrowserDestroyed(CefBrowserHostBase* browser) override;
|
||||
void SendCaptureLostEvent() override;
|
||||
#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MAC))
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
@@ -69,6 +70,9 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
||||
// Otherwise, the browser's WebContents will be returned.
|
||||
content::WebContents* GetActionableWebContents() const;
|
||||
|
||||
// Called from BrowserPlatformDelegateNative::set_windowless_handler().
|
||||
void set_as_secondary() { primary_ = false; }
|
||||
|
||||
private:
|
||||
void SetOwnedWebContents(content::WebContents* owned_contents);
|
||||
|
||||
@@ -98,6 +102,10 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
||||
gfx::Size auto_resize_min_;
|
||||
gfx::Size auto_resize_max_;
|
||||
|
||||
// True if this is the primary platform delegate, in which case it will
|
||||
// register WebContents delegate/observers.
|
||||
bool primary_ = true;
|
||||
|
||||
base::WeakPtrFactory<CefBrowserPlatformDelegateAlloy> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserPlatformDelegateAlloy);
|
||||
|
Reference in New Issue
Block a user