chrome: Add Views API integration (see issue #2969)

The Chrome browser can now be hosted in a Views-based application on Windows
and Linux.

To launch a fully-featured Chrome window using cefsimple:
$ cefsimple --enable-chrome-runtime

To launch a minimally-styled Views-hosted window using cefsimple:
$ cefsimple --enable-chrome-runtime --use-views

To launch a fully-styled Views-hosted window using cefclient:
$ cefclient --enable-chrome-runtime --use-views

Views unit tests also now pass with the Chrome runtime enabled:
$ ceftests --gtest_filter=Views* --enable-chrome-runtime

Known issues:
- Popup browsers cannot be intercepted and reparented.
This commit is contained in:
Marshall Greenblatt
2021-02-17 20:58:25 -05:00
parent 8f5fdc1f9a
commit 8733cb89c7
31 changed files with 839 additions and 107 deletions

View File

@@ -88,7 +88,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
void SetFocus(bool focus) override;
CefWindowHandle GetWindowHandle() override;
CefWindowHandle GetOpenerWindowHandle() override;
bool HasView() override;
double GetZoomLevel() override;
void SetZoomLevel(double zoomLevel) override;
void RunFileDialog(FileDialogMode mode,
@@ -161,14 +160,11 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
// Returns true if windowless rendering is enabled.
bool IsWindowless() const;
// Returns true if this browser is views-hosted.
bool IsViewsHosted() const;
// Returns true if this browser supports picture-in-picture.
bool IsPictureInPictureSupported() const;
// Called when the OS window hosting the browser is destroyed.
void WindowDestroyed();
void WindowDestroyed() override;
// Destroy the browser members. This method should only be called after the
// native browser window is not longer processing messages.
@@ -177,16 +173,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
// Cancel display of the context menu, if any.
void CancelContextMenu();
#if defined(USE_AURA)
// Returns the Widget owner for the browser window. Only used with windowed
// rendering.
views::Widget* GetWindowWidget() const;
// Returns the BrowserView associated with this browser. Only used with views-
// based browsers.
CefRefPtr<CefBrowserView> GetBrowserView() const;
#endif
bool MaybeAllowNavigation(content::RenderFrameHost* opener,
bool is_guest_view,
const content::OpenURLParams& params) override;
@@ -374,7 +360,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
CefWindowHandle opener_;
const bool is_windowless_;
const bool is_views_hosted_;
CefWindowHandle host_window_handle_ = kNullWindowHandle;
CefRefPtr<CefExtension> extension_;
bool is_background_host_ = false;