chrome: Support frameless document PiP window with draggable regions (fixes #3566)

This commit is contained in:
Marshall Greenblatt
2023-09-07 13:28:27 -04:00
parent b064ba08f3
commit ef6ae3071d
21 changed files with 581 additions and 128 deletions

View File

@@ -165,7 +165,7 @@ CefRefPtr<CefBrowser> CefBrowserViewImpl::GetBrowser() {
CefRefPtr<CefView> CefBrowserViewImpl::GetChromeToolbar() {
CEF_REQUIRE_VALID_RETURN(nullptr);
if (cef::IsChromeRuntimeEnabled()) {
return static_cast<ChromeBrowserView*>(root_view())->cef_toolbar();
return chrome_browser_view()->cef_toolbar();
}
return nullptr;
@@ -288,7 +288,7 @@ void CefBrowserViewImpl::SetDefaults(const CefBrowserSettings& settings) {
views::View* CefBrowserViewImpl::CreateRootView() {
if (cef::IsChromeRuntimeEnabled()) {
return new ChromeBrowserView(delegate(), this);
return new ChromeBrowserView(this);
}
return new CefBrowserViewView(delegate(), this);
@@ -296,7 +296,7 @@ views::View* CefBrowserViewImpl::CreateRootView() {
void CefBrowserViewImpl::InitializeRootView() {
if (cef::IsChromeRuntimeEnabled()) {
static_cast<ChromeBrowserView*>(root_view())->Initialize();
chrome_browser_view()->Initialize();
} else {
static_cast<CefBrowserViewView*>(root_view())->Initialize();
}
@@ -308,12 +308,17 @@ views::WebView* CefBrowserViewImpl::web_view() const {
}
if (cef::IsChromeRuntimeEnabled()) {
return static_cast<ChromeBrowserView*>(root_view())->contents_web_view();
return chrome_browser_view()->contents_web_view();
}
return static_cast<CefBrowserViewView*>(root_view());
}
ChromeBrowserView* CefBrowserViewImpl::chrome_browser_view() const {
CHECK(cef::IsChromeRuntimeEnabled());
return static_cast<ChromeBrowserView*>(root_view());
}
bool CefBrowserViewImpl::HandleAccelerator(
const content::NativeWebKeyboardEvent& event,
views::FocusManager* focus_manager) {

View File

@@ -18,6 +18,7 @@
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
class CefBrowserHostBase;
class ChromeBrowserView;
class CefBrowserViewImpl
: public CefViewImpl<views::View, CefBrowserView, CefBrowserViewDelegate>,
@@ -79,6 +80,9 @@ class CefBrowserViewImpl
// Return the WebView representation of this object.
views::WebView* web_view() const;
// Return the CEF specialization of BrowserView.
ChromeBrowserView* chrome_browser_view() const;
private:
// Create a new implementation object.
// Always call Initialize() after creation.