From 17cb26b8b955677905d8053535b68dad2ae2208d Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 11 Apr 2022 18:50:05 -0400 Subject: [PATCH] Remove compile-time checks for toolkit_views The toolkit_views=true setting is supported (and now required) on all platforms. --- BUILD.gn | 344 +++++++++--------- libcef/browser/alloy/alloy_browser_main.cc | 6 - libcef/browser/alloy/alloy_browser_main.h | 4 - libcef/browser/browser_host_base.cc | 2 - libcef/browser/browser_host_base.h | 6 - libcef/browser/browser_host_create.cc | 7 +- libcef/browser/browser_platform_delegate.cc | 2 - libcef/browser/browser_platform_delegate.h | 4 - .../browser_platform_delegate_create.cc | 21 +- .../browser/chrome/chrome_browser_delegate.cc | 2 - .../chrome/chrome_browser_host_impl.cc | 11 - libcef/browser/web_contents_dialog_helper.cc | 8 - libcef_dll/views_stub.cc | 121 ------ tools/make_views_stub_impl.py | 96 ----- tools/translator.py | 7 - 15 files changed, 170 insertions(+), 471 deletions(-) delete mode 100644 libcef_dll/views_stub.cc delete mode 100644 tools/make_views_stub_impl.py diff --git a/BUILD.gn b/BUILD.gn index 99b76354f..7b0e2c53c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -257,6 +257,9 @@ assert(enable_print_preview) # Enable support for Widevine CDM. assert(enable_widevine) +# Enable Views UI framework. +assert(toolkit_views) + if (is_clang) { # Don't use the chrome style plugin. assert(!clang_use_chrome_plugins) @@ -469,6 +472,22 @@ static_library("libcef_static") { "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.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.h", "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/cursor_util.h", "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.h", "libcef/browser/net/chrome_scheme_handler.cc", @@ -657,6 +678,63 @@ static_library("libcef_static") { "libcef/browser/trace_subscriber.cc", "libcef/browser/trace_subscriber.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.h", "libcef/browser/x509_certificate_impl.cc", @@ -796,6 +874,14 @@ static_library("libcef_static") { # For Chrome runtime support. "//chrome/app/chrome_main_delegate.cc", "//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 += [ @@ -912,6 +998,7 @@ static_library("libcef_static") { "//third_party/zlib:minizip", "//ui/base", "//ui/base/ime", + "//ui/events", "//ui/events:events_base", "//ui/gfx", "//ui/gfx/geometry", @@ -919,6 +1006,9 @@ static_library("libcef_static") { "//ui/gfx/ipc/geometry", "//ui/gfx/ipc/skia", "//ui/gl", + "//ui/strings", + "//ui/views", + "//ui/views/controls/webview", "//url", "//v8", ] @@ -1010,12 +1100,23 @@ static_library("libcef_static") { "libcef/browser/native/menu_runner_mac.mm", "libcef/browser/osr/browser_platform_delegate_osr_mac.h", "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.mm", # For Chrome runtime support. "//chrome/app/chrome_main_mac.h", "//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,208 +1128,92 @@ static_library("libcef_static") { deps += [ "//tools/v8_context_snapshot" ] } - if (toolkit_views) { + if (use_aura) { 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", + "libcef/browser/native/browser_platform_delegate_native_aura.cc", + "libcef/browser/native/browser_platform_delegate_native_aura.h", + "libcef/browser/views/view_util_aura.cc", # Part of //ui/views:test_support which is testingonly. - "//ui/views/test/desktop_test_views_delegate.h", - "//ui/views/test/test_views_delegate.h", + "//ui/views/test/desktop_test_views_delegate_aura.cc", + "//ui/views/test/test_views_delegate_aura.cc", # Support for UI input events. # Part of //ui/base:test_support which is testingonly. - "//ui/base/test/ui_controls.h", + "//ui/base/test/ui_controls_aura.cc", + "//ui/aura/test/ui_controls_factory_aura.h", ] deps += [ - "//ui/events", - "//ui/strings", - "//ui/views", - "//ui/views/controls/webview", + "//ui/aura", + "//ui/wm", + "//ui/wm/public", ] - if (use_aura) { + if (is_win) { sources += [ - "libcef/browser/native/browser_platform_delegate_native_aura.cc", - "libcef/browser/native/browser_platform_delegate_native_aura.h", - "libcef/browser/views/view_util_aura.cc", - - # Part of //ui/views:test_support which is testingonly. - "//ui/views/test/desktop_test_views_delegate_aura.cc", - "//ui/views/test/test_views_delegate_aura.cc", - # Support for UI input events. + # Part of //base/test:test_config which is testingonly. + "//base/test/test_switches.cc", + "//base/test/test_switches.h", + "//base/test/test_timeouts.cc", + "//base/test/test_timeouts.h", + # Part of //ui/aura:test_support which is testingonly. + "//ui/aura/test/ui_controls_factory_aurawin.cc", # Part of //ui/base:test_support which is testingonly. - "//ui/base/test/ui_controls_aura.cc", - "//ui/aura/test/ui_controls_factory_aura.h", + "//ui/base/test/ui_controls_internal_win.cc", + "//ui/base/test/ui_controls_internal_win.h", + ] + } + + if (is_linux) { + sources += [ + # Support for UI input events. + # Part of //ui/aura:test_support which is testingonly. + "//ui/aura/test/aura_test_utils.cc", + "//ui/aura/test/aura_test_utils.h", + # Part of //ui/events:test_support which is testingonly. + "//ui/events/test/x11_event_waiter.cc", + "//ui/events/test/x11_event_waiter.h", + # Part of //ui/ozone::ui_test_support which is testingonly. + "//ui/ozone/common/test/stub_ozone_ui_controls_test_helper.cc", + "//ui/ozone/common/test/stub_ozone_ui_controls_test_helper.h", + "//ui/ozone/public/ozone_ui_controls_test_helper.cc", + "//ui/ozone/public/ozone_ui_controls_test_helper.h", + "$root_gen_dir/ui/ozone/test_constructor_list.cc", + # Part of //ui/views:test_support which is testingonly. + "//ui/views/test/test_desktop_screen_ozone.cc", + "//ui/views/test/test_desktop_screen_ozone.h", + "//ui/views/test/ui_controls_factory_desktop_aura_ozone.cc", + "//ui/views/test/ui_controls_factory_desktop_aura_ozone.h", ] deps += [ - "//ui/aura", - "//ui/wm", - "//ui/wm/public", + "//ui/ozone:generate_test_support_constructor_list", ] - if (is_win) { + if (ozone_platform_x11) { sources += [ # Support for UI input events. - # Part of //base/test:test_config which is testingonly. - "//base/test/test_switches.cc", - "//base/test/test_switches.h", - "//base/test/test_timeouts.cc", - "//base/test/test_timeouts.h", + # Part of //ui/base/x:test_support which is testingonly. + "//ui/base/x/test/x11_ui_controls_test_helper.cc", + "//ui/base/x/test/x11_ui_controls_test_helper.h", # Part of //ui/aura:test_support which is testingonly. - "//ui/aura/test/ui_controls_factory_aurawin.cc", + "//ui/aura/test/x11_event_sender.h", + # Part of //ui/ozone/platform/x11:test_support which is testingonly. + "//ui/ozone/platform/x11/x11_ozone_ui_controls_test_helper.cc", + "//ui/ozone/platform/x11/x11_ozone_ui_controls_test_helper.h", + ] + } else { + sources += [ + # Support for UI input events. # Part of //ui/base:test_support which is testingonly. - "//ui/base/test/ui_controls_internal_win.cc", - "//ui/base/test/ui_controls_internal_win.h", + "//ui/aura/test/ui_controls_factory_ozone.cc", + # Part of //ui//events:test_support which is testingonly. + "//ui/events/test/events_test_utils.cc" ] } - - if (is_linux) { - sources += [ - # Support for UI input events. - # Part of //ui/aura:test_support which is testingonly. - "//ui/aura/test/aura_test_utils.cc", - "//ui/aura/test/aura_test_utils.h", - # Part of //ui/events:test_support which is testingonly. - "//ui/events/test/x11_event_waiter.cc", - "//ui/events/test/x11_event_waiter.h", - # Part of //ui/ozone::ui_test_support which is testingonly. - "//ui/ozone/common/test/stub_ozone_ui_controls_test_helper.cc", - "//ui/ozone/common/test/stub_ozone_ui_controls_test_helper.h", - "//ui/ozone/public/ozone_ui_controls_test_helper.cc", - "//ui/ozone/public/ozone_ui_controls_test_helper.h", - "$root_gen_dir/ui/ozone/test_constructor_list.cc", - # Part of //ui/views:test_support which is testingonly. - "//ui/views/test/test_desktop_screen_ozone.cc", - "//ui/views/test/test_desktop_screen_ozone.h", - "//ui/views/test/ui_controls_factory_desktop_aura_ozone.cc", - "//ui/views/test/ui_controls_factory_desktop_aura_ozone.h", - ] - - deps += [ - "//ui/ozone:generate_test_support_constructor_list", - ] - - if (ozone_platform_x11) { - sources += [ - # Support for UI input events. - # Part of //ui/base/x:test_support which is testingonly. - "//ui/base/x/test/x11_ui_controls_test_helper.cc", - "//ui/base/x/test/x11_ui_controls_test_helper.h", - # Part of //ui/aura:test_support which is testingonly. - "//ui/aura/test/x11_event_sender.h", - # Part of //ui/ozone/platform/x11:test_support which is testingonly. - "//ui/ozone/platform/x11/x11_ozone_ui_controls_test_helper.cc", - "//ui/ozone/platform/x11/x11_ozone_ui_controls_test_helper.h", - ] - } else { - sources += [ - # Support for UI input events. - # Part of //ui/base:test_support which is testingonly. - "//ui/aura/test/ui_controls_factory_ozone.cc", - # Part of //ui//events:test_support which is testingonly. - "//ui/events/test/events_test_utils.cc" - ] - } - } } - - 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/webui_generated_resources.h", "$root_gen_dir/ui/resources/grit/webui_resources.h", + "$root_gen_dir/ui/views/resources/grit/views_resources.h", ] deps = [ @@ -1414,12 +1400,8 @@ make_pack_header("resources") { "//ui/resources:ui_resources_grd", "//ui/resources:webui_generated_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. diff --git a/libcef/browser/alloy/alloy_browser_main.cc b/libcef/browser/alloy/alloy_browser_main.cc index 9143509ae..7c933e610 100644 --- a/libcef/browser/alloy/alloy_browser_main.cc +++ b/libcef/browser/alloy/alloy_browser_main.cc @@ -58,14 +58,12 @@ #endif #endif // defined(USE_AURA) -#if defined(TOOLKIT_VIEWS) #if BUILDFLAG(IS_MAC) #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_views_delegate.h" #else #include "ui/views/test/desktop_test_views_delegate.h" #endif -#endif // defined(TOOLKIT_VIEWS) #if defined(USE_AURA) && BUILDFLAG(IS_LINUX) #include "ui/base/ime/init/input_method_initializer.h" @@ -118,14 +116,12 @@ void AlloyBrowserMainParts::ToolkitInitialized() { wm_state_.reset(new wm::WMState); #endif // defined(USE_AURA) -#if defined(TOOLKIT_VIEWS) #if BUILDFLAG(IS_MAC) views_delegate_ = std::make_unique(); layout_provider_ = ChromeLayoutProvider::CreateLayoutProvider(); #else views_delegate_ = std::make_unique(); #endif -#endif // defined(TOOLKIT_VIEWS) } void AlloyBrowserMainParts::PreCreateMainMessageLoop() { @@ -277,10 +273,8 @@ void AlloyBrowserMainParts::PostMainMessageLoopRun() { } void AlloyBrowserMainParts::PostDestroyThreads() { -#if defined(TOOLKIT_VIEWS) views_delegate_.reset(); #if BUILDFLAG(IS_MAC) layout_provider_.reset(); #endif -#endif // defined(TOOLKIT_VIEWS) } diff --git a/libcef/browser/alloy/alloy_browser_main.h b/libcef/browser/alloy/alloy_browser_main.h index fc7fa8dcb..130fa92c7 100644 --- a/libcef/browser/alloy/alloy_browser_main.h +++ b/libcef/browser/alloy/alloy_browser_main.h @@ -24,14 +24,12 @@ class WMState; } #endif -#if defined(TOOLKIT_VIEWS) namespace views { class ViewsDelegate; #if BUILDFLAG(IS_MAC) class LayoutProvider; #endif } // namespace views -#endif // defined(TOOLKIT_VIEWS) class CefDevToolsDelegate; @@ -92,12 +90,10 @@ class AlloyBrowserMainParts : public content::BrowserMainParts { std::unique_ptr wm_state_; #endif -#if defined(TOOLKIT_VIEWS) std::unique_ptr views_delegate_; #if BUILDFLAG(IS_MAC) std::unique_ptr layout_provider_; #endif -#endif // defined(TOOLKIT_VIEWS) }; #endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_ diff --git a/libcef/browser/browser_host_base.cc b/libcef/browser/browser_host_base.cc index 7f88714bf..2510a67e6 100644 --- a/libcef/browser/browser_host_base.cc +++ b/libcef/browser/browser_host_base.cc @@ -864,7 +864,6 @@ content::BrowserContext* CefBrowserHostBase::GetBrowserContext() const { return nullptr; } -#if defined(TOOLKIT_VIEWS) views::Widget* CefBrowserHostBase::GetWindowWidget() const { CEF_REQUIRE_UIT(); if (!platform_delegate_) @@ -878,7 +877,6 @@ CefRefPtr CefBrowserHostBase::GetBrowserView() const { return platform_delegate_->GetBrowserView(); return nullptr; } -#endif // defined(TOOLKIT_VIEWS) bool CefBrowserHostBase::EnsureDevToolsManager() { CEF_REQUIRE_UIT(); diff --git a/libcef/browser/browser_host_base.h b/libcef/browser/browser_host_base.h index 8dc2bbd40..3aa5821c2 100644 --- a/libcef/browser/browser_host_base.h +++ b/libcef/browser/browser_host_base.h @@ -41,9 +41,7 @@ struct CefBrowserCreateParams { extra_info = that.extra_info; if (that.window_info) MaybeSetWindowInfo(*that.window_info); -#if defined(TOOLKIT_VIEWS) browser_view = that.browser_view; -#endif return *this; } @@ -54,7 +52,6 @@ struct CefBrowserCreateParams { // browsers except when using the Chrome runtime with a native parent handle. std::unique_ptr window_info; -#if defined(TOOLKIT_VIEWS) // The BrowserView that will own a Views-hosted browser. Will be nullptr for // popup browsers. CefRefPtr browser_view; @@ -63,7 +60,6 @@ struct CefBrowserCreateParams { // case the BrowserView for this browser will be created later (from // PopupWebContentsCreated). bool popup_with_views_hosted_opener = false; -#endif // Client implementation. May be nullptr. CefRefPtr client; @@ -272,7 +268,6 @@ class CefBrowserHostBase : public CefBrowserHost, return contents_delegate_.get(); } -#if defined(TOOLKIT_VIEWS) // Returns the Widget owner for the browser window. Only used with windowed // rendering. views::Widget* GetWindowWidget() const; @@ -280,7 +275,6 @@ class CefBrowserHostBase : public CefBrowserHost, // Returns the BrowserView associated with this browser. Only used with Views- // based browsers. CefRefPtr GetBrowserView() const; -#endif protected: bool EnsureDevToolsManager(); diff --git a/libcef/browser/browser_host_create.cc b/libcef/browser/browser_host_create.cc index 8563dfd3f..ac09edfab 100644 --- a/libcef/browser/browser_host_create.cc +++ b/libcef/browser/browser_host_create.cc @@ -6,14 +6,11 @@ #include "include/cef_browser.h" #include "libcef/browser/alloy/alloy_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/thread_util.h" #include "libcef/features/runtime.h" -#if defined(TOOLKIT_VIEWS) -#include "libcef/browser/chrome/views/chrome_child_window.h" -#endif - namespace { class CreateBrowserHelper { @@ -164,12 +161,10 @@ void CefBrowserCreateParams::MaybeSetWindowInfo( CefRefPtr CefBrowserHostBase::Create( CefBrowserCreateParams& create_params) { if (cef::IsChromeRuntimeEnabled()) { -#if defined(TOOLKIT_VIEWS) if (auto browser = chrome_child_window::MaybeCreateChildBrowser(create_params)) { return browser.get(); } -#endif auto browser = ChromeBrowserHostImpl::Create(create_params); return browser.get(); } diff --git a/libcef/browser/browser_platform_delegate.cc b/libcef/browser/browser_platform_delegate.cc index dd4834473..6338312c6 100644 --- a/libcef/browser/browser_platform_delegate.cc +++ b/libcef/browser/browser_platform_delegate.cc @@ -121,7 +121,6 @@ CefWindowHandle CefBrowserPlatformDelegate::GetHostWindowHandle() const { return kNullWindowHandle; } -#if defined(TOOLKIT_VIEWS) views::Widget* CefBrowserPlatformDelegate::GetWindowWidget() const { NOTREACHED(); return nullptr; @@ -131,7 +130,6 @@ CefRefPtr CefBrowserPlatformDelegate::GetBrowserView() const { NOTREACHED(); return nullptr; } -#endif // defined(TOOLKIT_VIEWS) void CefBrowserPlatformDelegate::PopupWebContentsCreated( const CefBrowserSettings& settings, diff --git a/libcef/browser/browser_platform_delegate.h b/libcef/browser/browser_platform_delegate.h index 086bde56b..a72707987 100644 --- a/libcef/browser/browser_platform_delegate.h +++ b/libcef/browser/browser_platform_delegate.h @@ -57,11 +57,9 @@ class Size; class Vector2d; } // namespace gfx -#if defined(TOOLKIT_VIEWS) namespace views { class Widget; } -#endif struct CefBrowserCreateParams; class CefBrowserHostBase; @@ -173,7 +171,6 @@ class CefBrowserPlatformDelegate { // the client, which may be NULL. May be called on multiple threads. virtual CefWindowHandle GetHostWindowHandle() const; -#if defined(TOOLKIT_VIEWS) // Returns the Widget owner for the browser window. Only used with windowed // rendering. virtual views::Widget* GetWindowWidget() const; @@ -181,7 +178,6 @@ class CefBrowserPlatformDelegate { // Returns the BrowserView associated with this browser. Only used with views- // based browsers. virtual CefRefPtr GetBrowserView() const; -#endif // Called after the WebContents have been created for a new popup browser // parented to this browser but before the AlloyBrowserHostImpl is created for diff --git a/libcef/browser/browser_platform_delegate_create.cc b/libcef/browser/browser_platform_delegate_create.cc index 94fd61e84..291b1563a 100644 --- a/libcef/browser/browser_platform_delegate_create.cc +++ b/libcef/browser/browser_platform_delegate_create.cc @@ -13,7 +13,11 @@ #include "libcef/browser/browser_host_base.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/views/browser_platform_delegate_views.h" #include "libcef/features/runtime_checks.h" #if BUILDFLAG(IS_WIN) @@ -29,13 +33,6 @@ #error A delegate implementation is not available for your platform. #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 { std::unique_ptr CreateNativeDelegate( @@ -90,7 +87,6 @@ std::unique_ptr CefBrowserPlatformDelegate::Create( std::unique_ptr native_delegate = CreateNativeDelegate(window_info, background_color); -#if defined(TOOLKIT_VIEWS) if (create_params.window_info) { // CefWindowInfo should only be set if a parent handle was specified. DCHECK(chrome_child_window::HasParentHandle(window_info)); @@ -104,13 +100,11 @@ std::unique_ptr CefBrowserPlatformDelegate::Create( std::move(native_delegate), static_cast(create_params.browser_view.get())); } -#endif // defined(TOOLKIT_VIEWS) return std::make_unique( std::move(native_delegate)); } -#if defined(TOOLKIT_VIEWS) if (create_params.browser_view || create_params.popup_with_views_hosted_opener) { // CefWindowInfo is not used in this case. @@ -119,11 +113,8 @@ std::unique_ptr CefBrowserPlatformDelegate::Create( return std::make_unique( std::move(native_delegate), static_cast(create_params.browser_view.get())); - } -#endif // defined(TOOLKIT_VIEWS) - - if (create_params.extension_host_type == - extensions::mojom::ViewType::kExtensionBackgroundPage) { + } else if (create_params.extension_host_type == + extensions::mojom::ViewType::kExtensionBackgroundPage) { // Creating a background extension host without a window. std::unique_ptr native_delegate = CreateNativeDelegate(CefWindowInfo(), background_color); diff --git a/libcef/browser/chrome/chrome_browser_delegate.cc b/libcef/browser/chrome/chrome_browser_delegate.cc index 8c92ae7fd..298e6c9c3 100644 --- a/libcef/browser/chrome/chrome_browser_delegate.cc +++ b/libcef/browser/chrome/chrome_browser_delegate.cc @@ -342,9 +342,7 @@ std::unique_ptr BrowserDelegate::Create( // Clear these values so they're not persisted to additional Browsers. params->create_params_.window_info.reset(); -#if defined(TOOLKIT_VIEWS) params->create_params_.browser_view = nullptr; -#endif } return std::make_unique(browser, create_params); diff --git a/libcef/browser/chrome/chrome_browser_host_impl.cc b/libcef/browser/chrome/chrome_browser_host_impl.cc index 0e2791d28..4e5607083 100644 --- a/libcef/browser/chrome/chrome_browser_host_impl.cc +++ b/libcef/browser/chrome/chrome_browser_host_impl.cc @@ -22,11 +22,8 @@ #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/tabs/tab_strip_model.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_view.h" -#endif // static CefRefPtr ChromeBrowserHostImpl::Create( @@ -111,9 +108,7 @@ void ChromeBrowserHostImpl::AddNewContents( CefBrowserCreateParams params; params.request_context = request_context(); -#if defined(TOOLKIT_VIEWS) params.browser_view = GetBrowserView(); -#endif // Create the new Browser representation. auto browser = CreateBrowser(params); @@ -435,7 +430,6 @@ Browser* ChromeBrowserHostImpl::CreateBrowser( // Pass |params| to cef::BrowserDelegate::Create from the Browser constructor. chrome_params.cef_params = base::MakeRefCounted(params); -#if defined(TOOLKIT_VIEWS) // Configure Browser creation to use the existing Views-based // Widget/BrowserFrame (ChromeBrowserFrame) and BrowserView/BrowserWindow // (ChromeBrowserView). See views/chrome_browser_frame.h for related @@ -458,7 +452,6 @@ Browser* ChromeBrowserHostImpl::CreateBrowser( static_cast(chrome_browser_view->GetWidget()); chrome_browser_view->set_frame(chrome_widget); } -#endif // defined(TOOLKIT_VIEWS) // 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 @@ -468,7 +461,6 @@ Browser* ChromeBrowserHostImpl::CreateBrowser( bool show_browser = true; -#if defined(TOOLKIT_VIEWS) if (chrome_browser_view) { // Initialize the BrowserFrame and BrowserView and create the controls that // require access to the Browser. @@ -478,7 +470,6 @@ Browser* ChromeBrowserHostImpl::CreateBrowser( // Don't show the browser by default. show_browser = false; } -#endif if (show_browser) { browser->window()->Show(); @@ -548,13 +539,11 @@ void ChromeBrowserHostImpl::SetBrowser(Browser* browser) { void ChromeBrowserHostImpl::WindowDestroyed() { CEF_REQUIRE_UIT(); -#if defined(TOOLKIT_VIEWS) if (browser_ && is_views_hosted_) { auto chrome_browser_view = static_cast(browser_->window()); chrome_browser_view->Destroyed(); } -#endif platform_delegate_->CloseHostWindow(); } diff --git a/libcef/browser/web_contents_dialog_helper.cc b/libcef/browser/web_contents_dialog_helper.cc index 199276b2f..0d11842b4 100644 --- a/libcef/browser/web_contents_dialog_helper.cc +++ b/libcef/browser/web_contents_dialog_helper.cc @@ -8,10 +8,7 @@ #include "chrome/browser/platform_util.h" #include "components/web_modal/web_contents_modal_dialog_manager.h" - -#if defined(TOOLKIT_VIEWS) #include "ui/views/widget/widget.h" -#endif CefWebContentsDialogHelper::CefWebContentsDialogHelper( content::WebContents* web_contents, @@ -38,12 +35,7 @@ CefWebContentsDialogHelper::GetWebContentsModalDialogHost() { } gfx::NativeView CefWebContentsDialogHelper::GetHostView() const { -#if defined(TOOLKIT_VIEWS) return browser_delegate_->GetWindowWidget()->GetNativeView(); -#else - NOTIMPLEMENTED(); - return gfx::NativeView(); -#endif } gfx::Point CefWebContentsDialogHelper::GetDialogPosition( diff --git a/libcef_dll/views_stub.cc b/libcef_dll/views_stub.cc deleted file mode 100644 index 5ebce3215..000000000 --- a/libcef_dll/views_stub.cc +++ /dev/null @@ -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::CreateBrowserView( - CefRefPtr client, - const CefString& url, - const CefBrowserSettings& settings, - CefRefPtr extra_info, - CefRefPtr request_context, - CefRefPtr delegate) { - NOTIMPLEMENTED(); - return nullptr; -} - -NO_SANITIZE("cfi-icall") -CefRefPtr CefBrowserView::GetForBrowser( - CefRefPtr browser) { - NOTIMPLEMENTED(); - return nullptr; -} - -NO_SANITIZE("cfi-icall") CefRefPtr CefDisplay::GetPrimaryDisplay() { - NOTIMPLEMENTED(); - return nullptr; -} - -NO_SANITIZE("cfi-icall") -CefRefPtr CefDisplay::GetDisplayNearestPoint( - const CefPoint& point, - bool input_pixel_coords) { - NOTIMPLEMENTED(); - return nullptr; -} - -NO_SANITIZE("cfi-icall") -CefRefPtr 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>& displays) { - NOTIMPLEMENTED(); -} - -NO_SANITIZE("cfi-icall") -CefRefPtr CefLabelButton::CreateLabelButton( - CefRefPtr delegate, - const CefString& text) { - NOTIMPLEMENTED(); - return nullptr; -} - -NO_SANITIZE("cfi-icall") -CefRefPtr CefMenuButton::CreateMenuButton( - CefRefPtr delegate, - const CefString& text) { - NOTIMPLEMENTED(); - return nullptr; -} - -NO_SANITIZE("cfi-icall") -CefRefPtr CefPanel::CreatePanel( - CefRefPtr delegate) { - NOTIMPLEMENTED(); - return nullptr; -} - -NO_SANITIZE("cfi-icall") -CefRefPtr CefScrollView::CreateScrollView( - CefRefPtr delegate) { - NOTIMPLEMENTED(); - return nullptr; -} - -NO_SANITIZE("cfi-icall") -CefRefPtr CefTextfield::CreateTextfield( - CefRefPtr delegate) { - NOTIMPLEMENTED(); - return nullptr; -} - -NO_SANITIZE("cfi-icall") -CefRefPtr CefWindow::CreateTopLevelWindow( - CefRefPtr delegate) { - NOTIMPLEMENTED(); - return nullptr; -} diff --git a/tools/make_views_stub_impl.py b/tools/make_views_stub_impl.py deleted file mode 100644 index 21db8bb91..000000000 --- a/tools/make_views_stub_impl.py +++ /dev/null @@ -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] + ' \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)) diff --git a/tools/translator.py b/tools/translator.py index a2bfd89ac..1d8552ce7 100644 --- a/tools/translator.py +++ b/tools/translator.py @@ -16,7 +16,6 @@ from make_ctocpp_header import * from make_ctocpp_impl import * from make_gypi_file import * from make_libcef_dll_dylib_impl import * -from make_views_stub_impl import * from make_wrapper_types_header import * 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') ctocpp_dir = os.path.join(libcef_dll_dir, 'ctocpp') 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.cc') @@ -228,11 +226,6 @@ if not options.quiet: sys.stdout.write('Generating ' + gypi_file + ' file...\n') 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 if not options.quiet: sys.stdout.write('Generating ' + libcef_dll_dylib_impl + ' file...\n')