mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
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]`
65 lines
2.4 KiB
C++
65 lines
2.4 KiB
C++
// Copyright 2024 The Chromium Embedded Framework Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be found
|
|
// in the LICENSE file.
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_VIEWS_WIDGET_H_
|
|
#define CEF_LIBCEF_BROWSER_VIEWS_WIDGET_H_
|
|
#pragma once
|
|
|
|
class CefWindowView;
|
|
class Profile;
|
|
|
|
namespace views {
|
|
class Widget;
|
|
}
|
|
|
|
// Interface that provides access to common CEF-specific Widget functionality.
|
|
// Alloy and Chrome runtimes use different views::Widget inheritance so we can't
|
|
// cast types directly. Implemented by CefWidgetImpl for the Alloy runtime and
|
|
// ChromeBrowserFrame for the Chrome runtime.
|
|
class CefWidget {
|
|
public:
|
|
// Called from CefWindowView::CreateWidget.
|
|
static CefWidget* Create(CefWindowView* window_view);
|
|
|
|
// Returns the CefWidget for |widget|, which must be Views-hosted.
|
|
static CefWidget* GetForWidget(views::Widget* widget);
|
|
|
|
// Returns the Widget runtime style.
|
|
virtual bool IsAlloyStyle() const = 0;
|
|
bool IsChromeStyle() const { return !IsAlloyStyle(); }
|
|
|
|
// Returns the Widget associated with this object.
|
|
virtual views::Widget* GetWidget() = 0;
|
|
virtual const views::Widget* GetWidget() const = 0;
|
|
|
|
// Called from CefWindowView::CreateWidget after Widget::Init. There will be
|
|
// no theme-related callbacks prior to this method being called.
|
|
virtual void Initialized() = 0;
|
|
|
|
// Returns true if Initialize() has been called.
|
|
virtual bool IsInitialized() const = 0;
|
|
|
|
// Track all Profiles associated with this Widget. Called from
|
|
// CefBrowserViewImpl::AddedToWidget and DisassociateFromWidget.
|
|
// |profile| is only used with the Alloy runtime.
|
|
virtual void AddAssociatedProfile(Profile* profile) = 0;
|
|
virtual void RemoveAssociatedProfile(Profile* profile) = 0;
|
|
|
|
// Returns the Profile that will be used for Chrome theme purposes. Chrome
|
|
// runtime supports a single BrowserView in a single Widget. Alloy runtime
|
|
// supports multiple BrowserViews in a single Widget, and those BrowserViews
|
|
// may have different Profiles. If there are multiple Profiles we return an
|
|
// arbitrary one. The returned Profile will remain consistent until the set of
|
|
// associated Profiles changes.
|
|
virtual Profile* GetThemeProfile() const = 0;
|
|
|
|
// Optional special handling to toggle full-screen mode.
|
|
virtual bool ToggleFullscreenMode() { return false; }
|
|
|
|
protected:
|
|
virtual ~CefWidget() = default;
|
|
};
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_VIEWS_WIDGET_H_
|