mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
chrome: Add support for Alloy style browsers and windows (see #3681)
Split the Alloy runtime into bootstrap and style components. Support creation of Alloy style browsers and windows with the Chrome runtime. Chrome runtime (`--enable-chrome-runtime`) + Alloy style (`--use-alloy-style`) supports Views (`--use-views`), native parent (`--use-native`) and windowless rendering (`--off-screen-rendering-enabled`). Print preview is supported in all cases except with windowless rendering on all platforms and native parent on MacOS. It is disabled by default with Alloy style for legacy compatibility. Where supported it can be enabled or disabled globally using `--[enable|disable]-print-preview` or configured on a per-RequestContext basis using the `printing.print_preview_disabled` preference. It also behaves as expected when triggered via the PDF viewer print button. Chrome runtime + Alloy style behavior differs from Alloy runtime in the following significant ways: - Supports Chrome error pages by default. - DevTools popups are Chrome style only (cannot be windowless). - The Alloy extension API will not supported. Chrome runtime + Alloy style passes all expected Alloy ceftests except the following: - `DisplayTest.AutoResize` (Alloy extension API not supported) - `DownloadTest.*` (Download API not yet supported) - `ExtensionTest.*` (Alloy extension API not supported) This change also adds Chrome runtime support for CefContextMenuHandler::RunContextMenu (see #3293). This change also explicitly blocks (and doesn't retry) FrameAttached requests from PDF viewer and print preview excluded frames (see #3664). Known issues specific to Chrome runtime + Alloy style: - DevTools popup with windowless rendering doesn't load successfully. Use windowed rendering or remote debugging as a workaround. - Chrome style Window with Alloy style BrowserView (`--use-alloy-style --use-chrome-style-window`) does not show Chrome theme changes. To test: - Run `ceftests --enable-chrome-runtime --use-alloy-style [--use-chrome-style-window] [--use-views|--use-native] --gtest_filter=...` - Run `cefclient --enable-chrome-runtime --use-alloy-style [--use-chrome-style-window] [--use-views|--use-native|--off-screen-rendering-enabled]` - Run `cefsimple --enable-chrome-runtime --use-alloy-style [--use-views]`
This commit is contained in:
@ -88,7 +88,7 @@ class CefBrowserPlatformDelegate {
|
||||
static std::unique_ptr<CefBrowserPlatformDelegate> Create(
|
||||
const CefBrowserCreateParams& create_params);
|
||||
|
||||
// Called from AlloyBrowserHostImpl::Create.
|
||||
// Called from BrowserHost::Create.
|
||||
// Wait for the call to WebContentsCreated(owned=true) before taking ownership
|
||||
// of the resulting WebContents object.
|
||||
virtual content::WebContents* CreateWebContents(
|
||||
@ -136,12 +136,12 @@ class CefBrowserPlatformDelegate {
|
||||
// See WebContentsObserver documentation.
|
||||
virtual void RenderViewReady();
|
||||
|
||||
// Called after the owning AlloyBrowserHostImpl is created. Will only be
|
||||
// Called after the owning BrowserHost is created. Will only be
|
||||
// called a single time per instance. Do not send any client notifications
|
||||
// from this method.
|
||||
virtual void BrowserCreated(CefBrowserHostBase* browser);
|
||||
|
||||
// Called from AlloyBrowserHostImpl::Create.
|
||||
// Called from BrowserHost::Create.
|
||||
virtual void CreateExtensionHost(const extensions::Extension* extension,
|
||||
const GURL& url,
|
||||
extensions::mojom::ViewType host_type);
|
||||
@ -157,9 +157,9 @@ class CefBrowserPlatformDelegate {
|
||||
// BrowserDestroyed().
|
||||
virtual void NotifyBrowserDestroyed();
|
||||
|
||||
// Called before the owning AlloyBrowserHostImpl is destroyed. Will only be
|
||||
// Called before the owning BrowserHost 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
|
||||
// BrowserHost and WebContents should be cleared when this method is
|
||||
// called. Do not send any client notifications from this method.
|
||||
virtual void BrowserDestroyed(CefBrowserHostBase* browser);
|
||||
|
||||
@ -182,35 +182,48 @@ class CefBrowserPlatformDelegate {
|
||||
// rendering.
|
||||
virtual views::Widget* GetWindowWidget() const;
|
||||
|
||||
// Returns the BrowserView associated with this browser. Only used with views-
|
||||
// Returns the BrowserView associated with this browser. Only used with Views-
|
||||
// based browsers.
|
||||
virtual CefRefPtr<CefBrowserView> GetBrowserView() const;
|
||||
|
||||
// Sets the BrowserView associated with this browser. Only used with
|
||||
// Views-based browsers.
|
||||
virtual void SetBrowserView(CefRefPtr<CefBrowserView> browser_view);
|
||||
|
||||
// Returns the WebContentsModalDialogHost associated with this browser.
|
||||
virtual web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost()
|
||||
const;
|
||||
|
||||
// Called after the WebContents have been created for a new popup browser
|
||||
// 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
|
||||
// parented to this browser but before the BrowserHost 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
|
||||
// |new_platform_delegate|. Does not make the new browser visible in this
|
||||
// callback.
|
||||
virtual void PopupWebContentsCreated(
|
||||
void PopupWebContentsCreated(
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
content::WebContents* new_web_contents,
|
||||
CefBrowserPlatformDelegate* new_platform_delegate,
|
||||
bool is_devtools);
|
||||
|
||||
// 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
|
||||
// Called after the BrowserHost 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(CefBrowserHostBase* new_browser,
|
||||
bool is_devtools);
|
||||
void PopupBrowserCreated(CefBrowserPlatformDelegate* new_platform_delegate,
|
||||
CefBrowserHostBase* new_browser,
|
||||
bool is_devtools);
|
||||
|
||||
// Called from PopupWebContentsCreated/PopupBrowserCreated to retrieve the
|
||||
// default BrowserViewDelegate in cases where this is a new Views-based popup
|
||||
// and the opener is either not Views-based or doesn't implement the
|
||||
// BrowserViewDelegate. Only implemented for specific configurations where
|
||||
// special handling of new popups is required for proper functioning.
|
||||
virtual CefRefPtr<CefBrowserViewDelegate>
|
||||
GetDefaultBrowserViewDelegateForPopupOpener();
|
||||
|
||||
// Returns the background color for the browser. The alpha component will be
|
||||
// either SK_AlphaTRANSPARENT or SK_AlphaOPAQUE (e.g. fully transparent or
|
||||
@ -294,6 +307,11 @@ class CefBrowserPlatformDelegate {
|
||||
// be called on multiple threads.
|
||||
virtual bool IsViewsHosted() const;
|
||||
|
||||
// Returns the runtime style implemented by this delegate. May be called on
|
||||
// multiple threads.
|
||||
virtual bool IsAlloyStyle() const = 0;
|
||||
bool IsChromeStyle() const { return !IsAlloyStyle(); }
|
||||
|
||||
// Returns true if this delegate implements a browser with external
|
||||
// (client-provided) parent window. May be called on multiple threads.
|
||||
virtual bool HasExternalParent() const;
|
||||
|
Reference in New Issue
Block a user