Remove compile-time checks for toolkit_views

The toolkit_views=true setting is supported (and now required) on all platforms.
This commit is contained in:
Marshall Greenblatt
2022-04-11 18:50:05 -04:00
parent a0a7a35fe2
commit 17cb26b8b9
15 changed files with 170 additions and 471 deletions

224
BUILD.gn
View File

@@ -257,6 +257,9 @@ assert(enable_print_preview)
# Enable support for Widevine CDM. # Enable support for Widevine CDM.
assert(enable_widevine) assert(enable_widevine)
# Enable Views UI framework.
assert(toolkit_views)
if (is_clang) { if (is_clang) {
# Don't use the chrome style plugin. # Don't use the chrome style plugin.
assert(!clang_use_chrome_plugins) assert(!clang_use_chrome_plugins)
@@ -469,6 +472,22 @@ static_library("libcef_static") {
"libcef/browser/chrome_crash_reporter_client_stub.cc", "libcef/browser/chrome_crash_reporter_client_stub.cc",
"libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.cc", "libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.cc",
"libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.h", "libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.h",
"libcef/browser/chrome/views/browser_platform_delegate_chrome_child_window.cc",
"libcef/browser/chrome/views/browser_platform_delegate_chrome_child_window.h",
"libcef/browser/chrome/views/browser_platform_delegate_chrome_views.cc",
"libcef/browser/chrome/views/browser_platform_delegate_chrome_views.h",
"libcef/browser/chrome/views/chrome_browser_frame.cc",
"libcef/browser/chrome/views/chrome_browser_frame.h",
"libcef/browser/chrome/views/chrome_browser_view.cc",
"libcef/browser/chrome/views/chrome_browser_view.h",
"libcef/browser/chrome/views/chrome_child_window.cc",
"libcef/browser/chrome/views/chrome_child_window.h",
"libcef/browser/chrome/views/chrome_views_util.cc",
"libcef/browser/chrome/views/chrome_views_util.h",
"libcef/browser/chrome/views/toolbar_view_impl.cc",
"libcef/browser/chrome/views/toolbar_view_impl.h",
"libcef/browser/chrome/views/toolbar_view_view.cc",
"libcef/browser/chrome/views/toolbar_view_view.h",
"libcef/browser/context.cc", "libcef/browser/context.cc",
"libcef/browser/context.h", "libcef/browser/context.h",
"libcef/browser/context_menu_params_impl.cc", "libcef/browser/context_menu_params_impl.cc",
@@ -567,6 +586,8 @@ static_library("libcef_static") {
"libcef/browser/native/browser_platform_delegate_native.h", "libcef/browser/native/browser_platform_delegate_native.h",
"libcef/browser/native/cursor_util.h", "libcef/browser/native/cursor_util.h",
"libcef/browser/native/cursor_util.cc", "libcef/browser/native/cursor_util.cc",
"libcef/browser/native/window_delegate_view.cc",
"libcef/browser/native/window_delegate_view.h",
"libcef/browser/navigation_entry_impl.cc", "libcef/browser/navigation_entry_impl.cc",
"libcef/browser/navigation_entry_impl.h", "libcef/browser/navigation_entry_impl.h",
"libcef/browser/net/chrome_scheme_handler.cc", "libcef/browser/net/chrome_scheme_handler.cc",
@@ -657,6 +678,63 @@ static_library("libcef_static") {
"libcef/browser/trace_subscriber.cc", "libcef/browser/trace_subscriber.cc",
"libcef/browser/trace_subscriber.h", "libcef/browser/trace_subscriber.h",
"libcef/browser/thread_util.h", "libcef/browser/thread_util.h",
"libcef/browser/views/basic_label_button_impl.cc",
"libcef/browser/views/basic_label_button_impl.h",
"libcef/browser/views/basic_label_button_view.cc",
"libcef/browser/views/basic_label_button_view.h",
"libcef/browser/views/basic_panel_impl.cc",
"libcef/browser/views/basic_panel_impl.h",
"libcef/browser/views/basic_panel_view.cc",
"libcef/browser/views/basic_panel_view.h",
"libcef/browser/views/box_layout_impl.cc",
"libcef/browser/views/box_layout_impl.h",
"libcef/browser/views/browser_platform_delegate_views.cc",
"libcef/browser/views/browser_platform_delegate_views.h",
"libcef/browser/views/browser_view_impl.cc",
"libcef/browser/views/browser_view_impl.h",
"libcef/browser/views/browser_view_view.cc",
"libcef/browser/views/browser_view_view.h",
"libcef/browser/views/button_impl.h",
"libcef/browser/views/button_view.h",
"libcef/browser/views/display_impl.cc",
"libcef/browser/views/display_impl.h",
"libcef/browser/views/fill_layout_impl.cc",
"libcef/browser/views/fill_layout_impl.h",
"libcef/browser/views/label_button_impl.h",
"libcef/browser/views/label_button_view.h",
"libcef/browser/views/layout_impl.h",
"libcef/browser/views/layout_adapter.cc",
"libcef/browser/views/layout_adapter.h",
"libcef/browser/views/layout_util.cc",
"libcef/browser/views/layout_util.h",
"libcef/browser/views/menu_button_impl.cc",
"libcef/browser/views/menu_button_impl.h",
"libcef/browser/views/menu_button_view.cc",
"libcef/browser/views/menu_button_view.h",
"libcef/browser/views/menu_runner_views.cc",
"libcef/browser/views/menu_runner_views.h",
"libcef/browser/views/overlay_view_host.cc",
"libcef/browser/views/overlay_view_host.h",
"libcef/browser/views/panel_impl.h",
"libcef/browser/views/panel_view.h",
"libcef/browser/views/scroll_view_impl.cc",
"libcef/browser/views/scroll_view_impl.h",
"libcef/browser/views/scroll_view_view.cc",
"libcef/browser/views/scroll_view_view.h",
"libcef/browser/views/textfield_impl.cc",
"libcef/browser/views/textfield_impl.h",
"libcef/browser/views/textfield_view.cc",
"libcef/browser/views/textfield_view.h",
"libcef/browser/views/view_adapter.cc",
"libcef/browser/views/view_adapter.h",
"libcef/browser/views/view_impl.h",
"libcef/browser/views/view_util.cc",
"libcef/browser/views/view_util.h",
"libcef/browser/views/view_view.h",
"libcef/browser/views/window_impl.cc",
"libcef/browser/views/window_impl.h",
"libcef/browser/views/window_view.cc",
"libcef/browser/views/window_view.h",
"libcef/browser/web_contents_dialog_helper.cc", "libcef/browser/web_contents_dialog_helper.cc",
"libcef/browser/web_contents_dialog_helper.h", "libcef/browser/web_contents_dialog_helper.h",
"libcef/browser/x509_certificate_impl.cc", "libcef/browser/x509_certificate_impl.cc",
@@ -796,6 +874,14 @@ static_library("libcef_static") {
# For Chrome runtime support. # For Chrome runtime support.
"//chrome/app/chrome_main_delegate.cc", "//chrome/app/chrome_main_delegate.cc",
"//chrome/app/chrome_main_delegate.h", "//chrome/app/chrome_main_delegate.h",
# Part of //ui/views:test_support which is testingonly.
"//ui/views/test/desktop_test_views_delegate.h",
"//ui/views/test/test_views_delegate.h",
# Support for UI input events.
# Part of //ui/base:test_support which is testingonly.
"//ui/base/test/ui_controls.h",
] ]
configs += [ configs += [
@@ -912,6 +998,7 @@ static_library("libcef_static") {
"//third_party/zlib:minizip", "//third_party/zlib:minizip",
"//ui/base", "//ui/base",
"//ui/base/ime", "//ui/base/ime",
"//ui/events",
"//ui/events:events_base", "//ui/events:events_base",
"//ui/gfx", "//ui/gfx",
"//ui/gfx/geometry", "//ui/gfx/geometry",
@@ -919,6 +1006,9 @@ static_library("libcef_static") {
"//ui/gfx/ipc/geometry", "//ui/gfx/ipc/geometry",
"//ui/gfx/ipc/skia", "//ui/gfx/ipc/skia",
"//ui/gl", "//ui/gl",
"//ui/strings",
"//ui/views",
"//ui/views/controls/webview",
"//url", "//url",
"//v8", "//v8",
] ]
@@ -1010,12 +1100,23 @@ static_library("libcef_static") {
"libcef/browser/native/menu_runner_mac.mm", "libcef/browser/native/menu_runner_mac.mm",
"libcef/browser/osr/browser_platform_delegate_osr_mac.h", "libcef/browser/osr/browser_platform_delegate_osr_mac.h",
"libcef/browser/osr/browser_platform_delegate_osr_mac.mm", "libcef/browser/osr/browser_platform_delegate_osr_mac.mm",
"libcef/browser/views/view_util_mac.mm",
"libcef/common/util_mac.h", "libcef/common/util_mac.h",
"libcef/common/util_mac.mm", "libcef/common/util_mac.mm",
# For Chrome runtime support. # For Chrome runtime support.
"//chrome/app/chrome_main_mac.h", "//chrome/app/chrome_main_mac.h",
"//chrome/app/chrome_main_mac.mm", "//chrome/app/chrome_main_mac.mm",
# Part of //ui/views:test_support which is testingonly.
"//ui/views/test/desktop_test_views_delegate_mac.mm",
"//ui/views/test/test_views_delegate_mac.mm",
# Support for UI input events.
# Part of //ui/base:test_support which is testingonly.
"//ui/base/test/ui_controls_mac.mm",
# Part of //ui//events:test_support which is testingonly.
"//ui/events/test/cocoa_test_event_utils.mm",
] ]
} }
@@ -1027,100 +1128,6 @@ static_library("libcef_static") {
deps += [ "//tools/v8_context_snapshot" ] deps += [ "//tools/v8_context_snapshot" ]
} }
if (toolkit_views) {
sources += [
"libcef/browser/chrome/views/browser_platform_delegate_chrome_child_window.cc",
"libcef/browser/chrome/views/browser_platform_delegate_chrome_child_window.h",
"libcef/browser/chrome/views/browser_platform_delegate_chrome_views.cc",
"libcef/browser/chrome/views/browser_platform_delegate_chrome_views.h",
"libcef/browser/chrome/views/chrome_browser_frame.cc",
"libcef/browser/chrome/views/chrome_browser_frame.h",
"libcef/browser/chrome/views/chrome_browser_view.cc",
"libcef/browser/chrome/views/chrome_browser_view.h",
"libcef/browser/chrome/views/chrome_child_window.cc",
"libcef/browser/chrome/views/chrome_child_window.h",
"libcef/browser/chrome/views/chrome_views_util.cc",
"libcef/browser/chrome/views/chrome_views_util.h",
"libcef/browser/chrome/views/toolbar_view_impl.cc",
"libcef/browser/chrome/views/toolbar_view_impl.h",
"libcef/browser/chrome/views/toolbar_view_view.cc",
"libcef/browser/chrome/views/toolbar_view_view.h",
"libcef/browser/native/window_delegate_view.cc",
"libcef/browser/native/window_delegate_view.h",
"libcef/browser/views/basic_label_button_impl.cc",
"libcef/browser/views/basic_label_button_impl.h",
"libcef/browser/views/basic_label_button_view.cc",
"libcef/browser/views/basic_label_button_view.h",
"libcef/browser/views/basic_panel_impl.cc",
"libcef/browser/views/basic_panel_impl.h",
"libcef/browser/views/basic_panel_view.cc",
"libcef/browser/views/basic_panel_view.h",
"libcef/browser/views/box_layout_impl.cc",
"libcef/browser/views/box_layout_impl.h",
"libcef/browser/views/browser_platform_delegate_views.cc",
"libcef/browser/views/browser_platform_delegate_views.h",
"libcef/browser/views/browser_view_impl.cc",
"libcef/browser/views/browser_view_impl.h",
"libcef/browser/views/browser_view_view.cc",
"libcef/browser/views/browser_view_view.h",
"libcef/browser/views/button_impl.h",
"libcef/browser/views/button_view.h",
"libcef/browser/views/display_impl.cc",
"libcef/browser/views/display_impl.h",
"libcef/browser/views/fill_layout_impl.cc",
"libcef/browser/views/fill_layout_impl.h",
"libcef/browser/views/label_button_impl.h",
"libcef/browser/views/label_button_view.h",
"libcef/browser/views/layout_impl.h",
"libcef/browser/views/layout_adapter.cc",
"libcef/browser/views/layout_adapter.h",
"libcef/browser/views/layout_util.cc",
"libcef/browser/views/layout_util.h",
"libcef/browser/views/menu_button_impl.cc",
"libcef/browser/views/menu_button_impl.h",
"libcef/browser/views/menu_button_view.cc",
"libcef/browser/views/menu_button_view.h",
"libcef/browser/views/menu_runner_views.cc",
"libcef/browser/views/menu_runner_views.h",
"libcef/browser/views/overlay_view_host.cc",
"libcef/browser/views/overlay_view_host.h",
"libcef/browser/views/panel_impl.h",
"libcef/browser/views/panel_view.h",
"libcef/browser/views/scroll_view_impl.cc",
"libcef/browser/views/scroll_view_impl.h",
"libcef/browser/views/scroll_view_view.cc",
"libcef/browser/views/scroll_view_view.h",
"libcef/browser/views/textfield_impl.cc",
"libcef/browser/views/textfield_impl.h",
"libcef/browser/views/textfield_view.cc",
"libcef/browser/views/textfield_view.h",
"libcef/browser/views/view_adapter.cc",
"libcef/browser/views/view_adapter.h",
"libcef/browser/views/view_impl.h",
"libcef/browser/views/view_util.cc",
"libcef/browser/views/view_util.h",
"libcef/browser/views/view_view.h",
"libcef/browser/views/window_impl.cc",
"libcef/browser/views/window_impl.h",
"libcef/browser/views/window_view.cc",
"libcef/browser/views/window_view.h",
# Part of //ui/views:test_support which is testingonly.
"//ui/views/test/desktop_test_views_delegate.h",
"//ui/views/test/test_views_delegate.h",
# Support for UI input events.
# Part of //ui/base:test_support which is testingonly.
"//ui/base/test/ui_controls.h",
]
deps += [
"//ui/events",
"//ui/strings",
"//ui/views",
"//ui/views/controls/webview",
]
if (use_aura) { if (use_aura) {
sources += [ sources += [
"libcef/browser/native/browser_platform_delegate_native_aura.cc", "libcef/browser/native/browser_platform_delegate_native_aura.cc",
@@ -1208,28 +1215,6 @@ static_library("libcef_static") {
} }
} }
} }
if (is_mac) {
sources += [
"libcef/browser/views/view_util_mac.mm",
# Part of //ui/views:test_support which is testingonly.
"//ui/views/test/desktop_test_views_delegate_mac.mm",
"//ui/views/test/test_views_delegate_mac.mm",
# Support for UI input events.
# Part of //ui/base:test_support which is testingonly.
"//ui/base/test/ui_controls_mac.mm",
# Part of //ui//events:test_support which is testingonly.
"//ui/events/test/cocoa_test_event_utils.mm",
]
}
} else {
sources += [
# Provides stub implementations for the views static methods.
"libcef_dll/views_stub.cc",
]
}
} }
@@ -1387,6 +1372,7 @@ make_pack_header("resources") {
"$root_gen_dir/ui/resources/grit/ui_resources.h", "$root_gen_dir/ui/resources/grit/ui_resources.h",
"$root_gen_dir/ui/resources/grit/webui_generated_resources.h", "$root_gen_dir/ui/resources/grit/webui_generated_resources.h",
"$root_gen_dir/ui/resources/grit/webui_resources.h", "$root_gen_dir/ui/resources/grit/webui_resources.h",
"$root_gen_dir/ui/views/resources/grit/views_resources.h",
] ]
deps = [ deps = [
@@ -1414,12 +1400,8 @@ make_pack_header("resources") {
"//ui/resources:ui_resources_grd", "//ui/resources:ui_resources_grd",
"//ui/resources:webui_generated_resources_grd", "//ui/resources:webui_generated_resources_grd",
"//ui/resources:webui_resources_grd", "//ui/resources:webui_resources_grd",
"//ui/views/resources:resources_grd",
] ]
if (toolkit_views) {
inputs += [ "$root_gen_dir/ui/views/resources/grit/views_resources.h" ]
deps += [ "//ui/views/resources:resources_grd" ]
}
} }
# Generate cef_pack_strings.h. # Generate cef_pack_strings.h.

View File

@@ -58,14 +58,12 @@
#endif #endif
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
#if defined(TOOLKIT_VIEWS)
#if BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_MAC)
#include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_views_delegate.h" #include "chrome/browser/ui/views/chrome_views_delegate.h"
#else #else
#include "ui/views/test/desktop_test_views_delegate.h" #include "ui/views/test/desktop_test_views_delegate.h"
#endif #endif
#endif // defined(TOOLKIT_VIEWS)
#if defined(USE_AURA) && BUILDFLAG(IS_LINUX) #if defined(USE_AURA) && BUILDFLAG(IS_LINUX)
#include "ui/base/ime/init/input_method_initializer.h" #include "ui/base/ime/init/input_method_initializer.h"
@@ -118,14 +116,12 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
wm_state_.reset(new wm::WMState); wm_state_.reset(new wm::WMState);
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
#if defined(TOOLKIT_VIEWS)
#if BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_MAC)
views_delegate_ = std::make_unique<ChromeViewsDelegate>(); views_delegate_ = std::make_unique<ChromeViewsDelegate>();
layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider(); layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider();
#else #else
views_delegate_ = std::make_unique<views::DesktopTestViewsDelegate>(); views_delegate_ = std::make_unique<views::DesktopTestViewsDelegate>();
#endif #endif
#endif // defined(TOOLKIT_VIEWS)
} }
void AlloyBrowserMainParts::PreCreateMainMessageLoop() { void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
@@ -277,10 +273,8 @@ void AlloyBrowserMainParts::PostMainMessageLoopRun() {
} }
void AlloyBrowserMainParts::PostDestroyThreads() { void AlloyBrowserMainParts::PostDestroyThreads() {
#if defined(TOOLKIT_VIEWS)
views_delegate_.reset(); views_delegate_.reset();
#if BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_MAC)
layout_provider_.reset(); layout_provider_.reset();
#endif #endif
#endif // defined(TOOLKIT_VIEWS)
} }

View File

@@ -24,14 +24,12 @@ class WMState;
} }
#endif #endif
#if defined(TOOLKIT_VIEWS)
namespace views { namespace views {
class ViewsDelegate; class ViewsDelegate;
#if BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_MAC)
class LayoutProvider; class LayoutProvider;
#endif #endif
} // namespace views } // namespace views
#endif // defined(TOOLKIT_VIEWS)
class CefDevToolsDelegate; class CefDevToolsDelegate;
@@ -92,12 +90,10 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
std::unique_ptr<wm::WMState> wm_state_; std::unique_ptr<wm::WMState> wm_state_;
#endif #endif
#if defined(TOOLKIT_VIEWS)
std::unique_ptr<views::ViewsDelegate> views_delegate_; std::unique_ptr<views::ViewsDelegate> views_delegate_;
#if BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_MAC)
std::unique_ptr<views::LayoutProvider> layout_provider_; std::unique_ptr<views::LayoutProvider> layout_provider_;
#endif #endif
#endif // defined(TOOLKIT_VIEWS)
}; };
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_ #endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_

View File

@@ -864,7 +864,6 @@ content::BrowserContext* CefBrowserHostBase::GetBrowserContext() const {
return nullptr; return nullptr;
} }
#if defined(TOOLKIT_VIEWS)
views::Widget* CefBrowserHostBase::GetWindowWidget() const { views::Widget* CefBrowserHostBase::GetWindowWidget() const {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (!platform_delegate_) if (!platform_delegate_)
@@ -878,7 +877,6 @@ CefRefPtr<CefBrowserView> CefBrowserHostBase::GetBrowserView() const {
return platform_delegate_->GetBrowserView(); return platform_delegate_->GetBrowserView();
return nullptr; return nullptr;
} }
#endif // defined(TOOLKIT_VIEWS)
bool CefBrowserHostBase::EnsureDevToolsManager() { bool CefBrowserHostBase::EnsureDevToolsManager() {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();

View File

@@ -41,9 +41,7 @@ struct CefBrowserCreateParams {
extra_info = that.extra_info; extra_info = that.extra_info;
if (that.window_info) if (that.window_info)
MaybeSetWindowInfo(*that.window_info); MaybeSetWindowInfo(*that.window_info);
#if defined(TOOLKIT_VIEWS)
browser_view = that.browser_view; browser_view = that.browser_view;
#endif
return *this; return *this;
} }
@@ -54,7 +52,6 @@ struct CefBrowserCreateParams {
// browsers except when using the Chrome runtime with a native parent handle. // browsers except when using the Chrome runtime with a native parent handle.
std::unique_ptr<CefWindowInfo> window_info; std::unique_ptr<CefWindowInfo> window_info;
#if defined(TOOLKIT_VIEWS)
// The BrowserView that will own a Views-hosted browser. Will be nullptr for // The BrowserView that will own a Views-hosted browser. Will be nullptr for
// popup browsers. // popup browsers.
CefRefPtr<CefBrowserView> browser_view; CefRefPtr<CefBrowserView> browser_view;
@@ -63,7 +60,6 @@ struct CefBrowserCreateParams {
// case the BrowserView for this browser will be created later (from // case the BrowserView for this browser will be created later (from
// PopupWebContentsCreated). // PopupWebContentsCreated).
bool popup_with_views_hosted_opener = false; bool popup_with_views_hosted_opener = false;
#endif
// Client implementation. May be nullptr. // Client implementation. May be nullptr.
CefRefPtr<CefClient> client; CefRefPtr<CefClient> client;
@@ -272,7 +268,6 @@ class CefBrowserHostBase : public CefBrowserHost,
return contents_delegate_.get(); return contents_delegate_.get();
} }
#if defined(TOOLKIT_VIEWS)
// Returns the Widget owner for the browser window. Only used with windowed // Returns the Widget owner for the browser window. Only used with windowed
// rendering. // rendering.
views::Widget* GetWindowWidget() const; views::Widget* GetWindowWidget() const;
@@ -280,7 +275,6 @@ class CefBrowserHostBase : public CefBrowserHost,
// Returns the BrowserView associated with this browser. Only used with Views- // Returns the BrowserView associated with this browser. Only used with Views-
// based browsers. // based browsers.
CefRefPtr<CefBrowserView> GetBrowserView() const; CefRefPtr<CefBrowserView> GetBrowserView() const;
#endif
protected: protected:
bool EnsureDevToolsManager(); bool EnsureDevToolsManager();

View File

@@ -6,14 +6,11 @@
#include "include/cef_browser.h" #include "include/cef_browser.h"
#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/chrome/chrome_browser_host_impl.h" #include "libcef/browser/chrome/chrome_browser_host_impl.h"
#include "libcef/browser/chrome/views/chrome_child_window.h"
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
#include "libcef/features/runtime.h" #include "libcef/features/runtime.h"
#if defined(TOOLKIT_VIEWS)
#include "libcef/browser/chrome/views/chrome_child_window.h"
#endif
namespace { namespace {
class CreateBrowserHelper { class CreateBrowserHelper {
@@ -164,12 +161,10 @@ void CefBrowserCreateParams::MaybeSetWindowInfo(
CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::Create( CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::Create(
CefBrowserCreateParams& create_params) { CefBrowserCreateParams& create_params) {
if (cef::IsChromeRuntimeEnabled()) { if (cef::IsChromeRuntimeEnabled()) {
#if defined(TOOLKIT_VIEWS)
if (auto browser = if (auto browser =
chrome_child_window::MaybeCreateChildBrowser(create_params)) { chrome_child_window::MaybeCreateChildBrowser(create_params)) {
return browser.get(); return browser.get();
} }
#endif
auto browser = ChromeBrowserHostImpl::Create(create_params); auto browser = ChromeBrowserHostImpl::Create(create_params);
return browser.get(); return browser.get();
} }

View File

@@ -121,7 +121,6 @@ CefWindowHandle CefBrowserPlatformDelegate::GetHostWindowHandle() const {
return kNullWindowHandle; return kNullWindowHandle;
} }
#if defined(TOOLKIT_VIEWS)
views::Widget* CefBrowserPlatformDelegate::GetWindowWidget() const { views::Widget* CefBrowserPlatformDelegate::GetWindowWidget() const {
NOTREACHED(); NOTREACHED();
return nullptr; return nullptr;
@@ -131,7 +130,6 @@ CefRefPtr<CefBrowserView> CefBrowserPlatformDelegate::GetBrowserView() const {
NOTREACHED(); NOTREACHED();
return nullptr; return nullptr;
} }
#endif // defined(TOOLKIT_VIEWS)
void CefBrowserPlatformDelegate::PopupWebContentsCreated( void CefBrowserPlatformDelegate::PopupWebContentsCreated(
const CefBrowserSettings& settings, const CefBrowserSettings& settings,

View File

@@ -57,11 +57,9 @@ class Size;
class Vector2d; class Vector2d;
} // namespace gfx } // namespace gfx
#if defined(TOOLKIT_VIEWS)
namespace views { namespace views {
class Widget; class Widget;
} }
#endif
struct CefBrowserCreateParams; struct CefBrowserCreateParams;
class CefBrowserHostBase; class CefBrowserHostBase;
@@ -173,7 +171,6 @@ class CefBrowserPlatformDelegate {
// the client, which may be NULL. May be called on multiple threads. // the client, which may be NULL. May be called on multiple threads.
virtual CefWindowHandle GetHostWindowHandle() const; virtual CefWindowHandle GetHostWindowHandle() const;
#if defined(TOOLKIT_VIEWS)
// Returns the Widget owner for the browser window. Only used with windowed // Returns the Widget owner for the browser window. Only used with windowed
// rendering. // rendering.
virtual views::Widget* GetWindowWidget() const; virtual views::Widget* GetWindowWidget() const;
@@ -181,7 +178,6 @@ class CefBrowserPlatformDelegate {
// Returns the BrowserView associated with this browser. Only used with views- // Returns the BrowserView associated with this browser. Only used with views-
// based browsers. // based browsers.
virtual CefRefPtr<CefBrowserView> GetBrowserView() const; virtual CefRefPtr<CefBrowserView> GetBrowserView() const;
#endif
// Called after the WebContents have been created for a new popup browser // Called after the WebContents have been created for a new popup browser
// parented to this browser but before the AlloyBrowserHostImpl is created for // parented to this browser but before the AlloyBrowserHostImpl is created for

View File

@@ -13,7 +13,11 @@
#include "libcef/browser/browser_host_base.h" #include "libcef/browser/browser_host_base.h"
#include "libcef/browser/chrome/browser_platform_delegate_chrome.h" #include "libcef/browser/chrome/browser_platform_delegate_chrome.h"
#include "libcef/browser/chrome/views/browser_platform_delegate_chrome_child_window.h"
#include "libcef/browser/chrome/views/browser_platform_delegate_chrome_views.h"
#include "libcef/browser/chrome/views/chrome_child_window.h"
#include "libcef/browser/extensions/browser_platform_delegate_background.h" #include "libcef/browser/extensions/browser_platform_delegate_background.h"
#include "libcef/browser/views/browser_platform_delegate_views.h"
#include "libcef/features/runtime_checks.h" #include "libcef/features/runtime_checks.h"
#if BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_WIN)
@@ -29,13 +33,6 @@
#error A delegate implementation is not available for your platform. #error A delegate implementation is not available for your platform.
#endif #endif
#if defined(TOOLKIT_VIEWS)
#include "libcef/browser/chrome/views/browser_platform_delegate_chrome_child_window.h"
#include "libcef/browser/chrome/views/browser_platform_delegate_chrome_views.h"
#include "libcef/browser/chrome/views/chrome_child_window.h"
#include "libcef/browser/views/browser_platform_delegate_views.h"
#endif
namespace { namespace {
std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate( std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
@@ -90,7 +87,6 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate = std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
CreateNativeDelegate(window_info, background_color); CreateNativeDelegate(window_info, background_color);
#if defined(TOOLKIT_VIEWS)
if (create_params.window_info) { if (create_params.window_info) {
// CefWindowInfo should only be set if a parent handle was specified. // CefWindowInfo should only be set if a parent handle was specified.
DCHECK(chrome_child_window::HasParentHandle(window_info)); DCHECK(chrome_child_window::HasParentHandle(window_info));
@@ -104,13 +100,11 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
std::move(native_delegate), std::move(native_delegate),
static_cast<CefBrowserViewImpl*>(create_params.browser_view.get())); static_cast<CefBrowserViewImpl*>(create_params.browser_view.get()));
} }
#endif // defined(TOOLKIT_VIEWS)
return std::make_unique<CefBrowserPlatformDelegateChrome>( return std::make_unique<CefBrowserPlatformDelegateChrome>(
std::move(native_delegate)); std::move(native_delegate));
} }
#if defined(TOOLKIT_VIEWS)
if (create_params.browser_view || if (create_params.browser_view ||
create_params.popup_with_views_hosted_opener) { create_params.popup_with_views_hosted_opener) {
// CefWindowInfo is not used in this case. // CefWindowInfo is not used in this case.
@@ -119,10 +113,7 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
return std::make_unique<CefBrowserPlatformDelegateViews>( return std::make_unique<CefBrowserPlatformDelegateViews>(
std::move(native_delegate), std::move(native_delegate),
static_cast<CefBrowserViewImpl*>(create_params.browser_view.get())); static_cast<CefBrowserViewImpl*>(create_params.browser_view.get()));
} } else if (create_params.extension_host_type ==
#endif // defined(TOOLKIT_VIEWS)
if (create_params.extension_host_type ==
extensions::mojom::ViewType::kExtensionBackgroundPage) { extensions::mojom::ViewType::kExtensionBackgroundPage) {
// Creating a background extension host without a window. // Creating a background extension host without a window.
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate = std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =

View File

@@ -342,9 +342,7 @@ std::unique_ptr<BrowserDelegate> BrowserDelegate::Create(
// Clear these values so they're not persisted to additional Browsers. // Clear these values so they're not persisted to additional Browsers.
params->create_params_.window_info.reset(); params->create_params_.window_info.reset();
#if defined(TOOLKIT_VIEWS)
params->create_params_.browser_view = nullptr; params->create_params_.browser_view = nullptr;
#endif
} }
return std::make_unique<ChromeBrowserDelegate>(browser, create_params); return std::make_unique<ChromeBrowserDelegate>(browser, create_params);

View File

@@ -22,11 +22,8 @@
#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#if defined(TOOLKIT_VIEWS)
#include "libcef/browser/chrome/views/chrome_browser_frame.h" #include "libcef/browser/chrome/views/chrome_browser_frame.h"
#include "libcef/browser/chrome/views/chrome_browser_view.h" #include "libcef/browser/chrome/views/chrome_browser_view.h"
#endif
// static // static
CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::Create( CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::Create(
@@ -111,9 +108,7 @@ void ChromeBrowserHostImpl::AddNewContents(
CefBrowserCreateParams params; CefBrowserCreateParams params;
params.request_context = request_context(); params.request_context = request_context();
#if defined(TOOLKIT_VIEWS)
params.browser_view = GetBrowserView(); params.browser_view = GetBrowserView();
#endif
// Create the new Browser representation. // Create the new Browser representation.
auto browser = CreateBrowser(params); auto browser = CreateBrowser(params);
@@ -435,7 +430,6 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
// Pass |params| to cef::BrowserDelegate::Create from the Browser constructor. // Pass |params| to cef::BrowserDelegate::Create from the Browser constructor.
chrome_params.cef_params = base::MakeRefCounted<DelegateCreateParams>(params); chrome_params.cef_params = base::MakeRefCounted<DelegateCreateParams>(params);
#if defined(TOOLKIT_VIEWS)
// Configure Browser creation to use the existing Views-based // Configure Browser creation to use the existing Views-based
// Widget/BrowserFrame (ChromeBrowserFrame) and BrowserView/BrowserWindow // Widget/BrowserFrame (ChromeBrowserFrame) and BrowserView/BrowserWindow
// (ChromeBrowserView). See views/chrome_browser_frame.h for related // (ChromeBrowserView). See views/chrome_browser_frame.h for related
@@ -458,7 +452,6 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
static_cast<ChromeBrowserFrame*>(chrome_browser_view->GetWidget()); static_cast<ChromeBrowserFrame*>(chrome_browser_view->GetWidget());
chrome_browser_view->set_frame(chrome_widget); chrome_browser_view->set_frame(chrome_widget);
} }
#endif // defined(TOOLKIT_VIEWS)
// Create the Browser. This will indirectly create the ChomeBrowserDelegate. // Create the Browser. This will indirectly create the ChomeBrowserDelegate.
// The same params will be used to create a new Browser if the tab is dragged // The same params will be used to create a new Browser if the tab is dragged
@@ -468,7 +461,6 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
bool show_browser = true; bool show_browser = true;
#if defined(TOOLKIT_VIEWS)
if (chrome_browser_view) { if (chrome_browser_view) {
// Initialize the BrowserFrame and BrowserView and create the controls that // Initialize the BrowserFrame and BrowserView and create the controls that
// require access to the Browser. // require access to the Browser.
@@ -478,7 +470,6 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
// Don't show the browser by default. // Don't show the browser by default.
show_browser = false; show_browser = false;
} }
#endif
if (show_browser) { if (show_browser) {
browser->window()->Show(); browser->window()->Show();
@@ -548,13 +539,11 @@ void ChromeBrowserHostImpl::SetBrowser(Browser* browser) {
void ChromeBrowserHostImpl::WindowDestroyed() { void ChromeBrowserHostImpl::WindowDestroyed() {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
#if defined(TOOLKIT_VIEWS)
if (browser_ && is_views_hosted_) { if (browser_ && is_views_hosted_) {
auto chrome_browser_view = auto chrome_browser_view =
static_cast<ChromeBrowserView*>(browser_->window()); static_cast<ChromeBrowserView*>(browser_->window());
chrome_browser_view->Destroyed(); chrome_browser_view->Destroyed();
} }
#endif
platform_delegate_->CloseHostWindow(); platform_delegate_->CloseHostWindow();
} }

View File

@@ -8,10 +8,7 @@
#include "chrome/browser/platform_util.h" #include "chrome/browser/platform_util.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h" #include "components/web_modal/web_contents_modal_dialog_manager.h"
#if defined(TOOLKIT_VIEWS)
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#endif
CefWebContentsDialogHelper::CefWebContentsDialogHelper( CefWebContentsDialogHelper::CefWebContentsDialogHelper(
content::WebContents* web_contents, content::WebContents* web_contents,
@@ -38,12 +35,7 @@ CefWebContentsDialogHelper::GetWebContentsModalDialogHost() {
} }
gfx::NativeView CefWebContentsDialogHelper::GetHostView() const { gfx::NativeView CefWebContentsDialogHelper::GetHostView() const {
#if defined(TOOLKIT_VIEWS)
return browser_delegate_->GetWindowWidget()->GetNativeView(); return browser_delegate_->GetWindowWidget()->GetNativeView();
#else
NOTIMPLEMENTED();
return gfx::NativeView();
#endif
} }
gfx::Point CefWebContentsDialogHelper::GetDialogPosition( gfx::Point CefWebContentsDialogHelper::GetDialogPosition(

View File

@@ -1,121 +0,0 @@
// Copyright (c) 2022 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=892496158fbb51c0534dfbdfd4597daef6b21da7$
//
#include "include/views/cef_browser_view.h"
#include "include/views/cef_display.h"
#include "include/views/cef_label_button.h"
#include "include/views/cef_menu_button.h"
#include "include/views/cef_panel.h"
#include "include/views/cef_scroll_view.h"
#include "include/views/cef_textfield.h"
#include "include/views/cef_window.h"
#include "base/logging.h"
#include "base/notreached.h"
// STATIC STUB METHODS - Do not edit by hand.
NO_SANITIZE("cfi-icall")
CefRefPtr<CefBrowserView> CefBrowserView::CreateBrowserView(
CefRefPtr<CefClient> client,
const CefString& url,
const CefBrowserSettings& settings,
CefRefPtr<CefDictionaryValue> extra_info,
CefRefPtr<CefRequestContext> request_context,
CefRefPtr<CefBrowserViewDelegate> delegate) {
NOTIMPLEMENTED();
return nullptr;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefBrowserView> CefBrowserView::GetForBrowser(
CefRefPtr<CefBrowser> browser) {
NOTIMPLEMENTED();
return nullptr;
}
NO_SANITIZE("cfi-icall") CefRefPtr<CefDisplay> CefDisplay::GetPrimaryDisplay() {
NOTIMPLEMENTED();
return nullptr;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefDisplay> CefDisplay::GetDisplayNearestPoint(
const CefPoint& point,
bool input_pixel_coords) {
NOTIMPLEMENTED();
return nullptr;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefDisplay> CefDisplay::GetDisplayMatchingBounds(
const CefRect& bounds,
bool input_pixel_coords) {
NOTIMPLEMENTED();
return nullptr;
}
NO_SANITIZE("cfi-icall") size_t CefDisplay::GetDisplayCount() {
NOTIMPLEMENTED();
return 0;
}
NO_SANITIZE("cfi-icall")
void CefDisplay::GetAllDisplays(std::vector<CefRefPtr<CefDisplay>>& displays) {
NOTIMPLEMENTED();
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefLabelButton> CefLabelButton::CreateLabelButton(
CefRefPtr<CefButtonDelegate> delegate,
const CefString& text) {
NOTIMPLEMENTED();
return nullptr;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefMenuButton> CefMenuButton::CreateMenuButton(
CefRefPtr<CefMenuButtonDelegate> delegate,
const CefString& text) {
NOTIMPLEMENTED();
return nullptr;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefPanel> CefPanel::CreatePanel(
CefRefPtr<CefPanelDelegate> delegate) {
NOTIMPLEMENTED();
return nullptr;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefScrollView> CefScrollView::CreateScrollView(
CefRefPtr<CefViewDelegate> delegate) {
NOTIMPLEMENTED();
return nullptr;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefTextfield> CefTextfield::CreateTextfield(
CefRefPtr<CefTextfieldDelegate> delegate) {
NOTIMPLEMENTED();
return nullptr;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefWindow> CefWindow::CreateTopLevelWindow(
CefRefPtr<CefWindowDelegate> delegate) {
NOTIMPLEMENTED();
return nullptr;
}

View File

@@ -1,96 +0,0 @@
# Copyright (c) 2016 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.
from __future__ import absolute_import
from cef_parser import *
from make_ctocpp_impl import *
def make_views_function_stub_impl(clsname, func):
name = func.get_name()
# Build the C++ prototype.
parts = func.get_cpp_parts(True)
result = make_ctocpp_impl_proto(clsname, name, func, parts) + ' {'
# Retrieve the function return value.
retval = func.get_retval()
retval_type = retval.get_retval_type()
if retval_type == 'invalid':
notify(name + ' could not be autogenerated')
# Code could not be auto-generated.
result += '\n // COULD NOT IMPLEMENT DUE TO: (return value)'
result += '\n #pragma message("Warning: "__FILE__": ' + name + ' is not implemented")'
retval_default = ''
else:
retval_default = retval.get_retval_default(False)
result += '\n NOTIMPLEMENTED();'
if retval_default != '':
result += '\n return ' + retval_default + ';'
result += '\n}\n\n'
return result
def make_views_class_stub_impl(header, cls):
impl = ''
clsname = cls.get_name()
funcs = cls.get_static_funcs()
for func in funcs:
impl += make_views_function_stub_impl(clsname, func)
return impl
def make_views_stub_impl(header):
includes = ''
impl = ''
allclasses = header.get_classes()
for cls in allclasses:
dir = cls.get_file_directory()
# Only process files in the views/ directory.
if dir != None and dir.find('views') == 0:
cls_impl = make_views_class_stub_impl(header, cls)
if cls_impl != '':
impl += cls_impl
includes += '#include "include/' + cls.get_file_name() + '"\n'
includes += '\n#include "base/logging.h"\n#include "base/notreached.h"\n'
# Build the final output.
result = get_copyright() + includes
result += '\n\n// STATIC STUB METHODS - Do not edit by hand.\n\n'
result += impl
return result
def write_views_stub_impl(header, file):
newcontents = make_views_stub_impl(header)
return (file, newcontents)
# Test the module.
if __name__ == "__main__":
import sys
# Verify that the correct number of command-line arguments are provided.
if len(sys.argv) < 2:
sys.stderr.write('Usage: ' + sys.argv[0] + ' <cpp_header_dir>\n')
sys.exit()
cpp_header_dir = sys.argv[1]
# Create the header object. Should match the logic in translator.py.
header = obj_header()
header.set_root_directory(cpp_header_dir)
excluded_files = ['cef_api_hash.h', 'cef_application_mac.h', 'cef_version.h']
header.add_directory(cpp_header_dir, excluded_files)
header.add_directory(os.path.join(cpp_header_dir, 'views'))
# Dump the result to stdout.
sys.stdout.write(make_views_stub_impl(header))

View File

@@ -16,7 +16,6 @@ from make_ctocpp_header import *
from make_ctocpp_impl import * from make_ctocpp_impl import *
from make_gypi_file import * from make_gypi_file import *
from make_libcef_dll_dylib_impl import * from make_libcef_dll_dylib_impl import *
from make_views_stub_impl import *
from make_wrapper_types_header import * from make_wrapper_types_header import *
from optparse import OptionParser from optparse import OptionParser
@@ -83,7 +82,6 @@ wrapper_types_header = os.path.join(libcef_dll_dir, 'wrapper_types.h')
cpptoc_dir = os.path.join(libcef_dll_dir, 'cpptoc') cpptoc_dir = os.path.join(libcef_dll_dir, 'cpptoc')
ctocpp_dir = os.path.join(libcef_dll_dir, 'ctocpp') ctocpp_dir = os.path.join(libcef_dll_dir, 'ctocpp')
gypi_file = os.path.join(root_dir, 'cef_paths.gypi') gypi_file = os.path.join(root_dir, 'cef_paths.gypi')
views_stub_impl = os.path.join(libcef_dll_dir, 'views_stub.cc')
libcef_dll_dylib_impl = os.path.join(libcef_dll_dir, 'wrapper', libcef_dll_dylib_impl = os.path.join(libcef_dll_dir, 'wrapper',
'libcef_dll_dylib.cc') 'libcef_dll_dylib.cc')
@@ -228,11 +226,6 @@ if not options.quiet:
sys.stdout.write('Generating ' + gypi_file + ' file...\n') sys.stdout.write('Generating ' + gypi_file + ' file...\n')
update_file(*write_gypi_file(header, gypi_file)) update_file(*write_gypi_file(header, gypi_file))
# output the views stub file
if not options.quiet:
sys.stdout.write('Generating ' + views_stub_impl + ' file...\n')
update_file(*write_views_stub_impl(header, views_stub_impl))
# output the libcef dll dylib file # output the libcef dll dylib file
if not options.quiet: if not options.quiet:
sys.stdout.write('Generating ' + libcef_dll_dylib_impl + ' file...\n') sys.stdout.write('Generating ' + libcef_dll_dylib_impl + ' file...\n')