diff --git a/BUILD.gn b/BUILD.gn index 8e7ed4c38..eda75b11a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -99,6 +99,7 @@ import("//build/config/locales.gni") import("//build/config/ozone.gni") import("//build/config/sanitizers/sanitizers.gni") import("//build/config/ui.gni") +import("//cef/libcef/features/features.gni") import("//chrome/common/features.gni") import("//content/public/app/mac_helpers.gni") import("//extensions/buildflags/buildflags.gni") @@ -457,42 +458,14 @@ source_set("libcef_test_support") { source_set("libcef_static") { sources = includes_common + gypi_paths.autogen_cpp_includes + [ - "libcef/browser/alloy/alloy_browser_context.cc", - "libcef/browser/alloy/alloy_browser_context.h", "libcef/browser/alloy/alloy_browser_host_impl.cc", "libcef/browser/alloy/alloy_browser_host_impl.h", - "libcef/browser/alloy/alloy_browser_main.cc", - "libcef/browser/alloy/alloy_browser_main.h", - "libcef/browser/alloy/alloy_content_browser_client.cc", - "libcef/browser/alloy/alloy_content_browser_client.h", - "libcef/browser/alloy/alloy_download_manager_delegate.cc", - "libcef/browser/alloy/alloy_download_manager_delegate.h", - "libcef/browser/alloy/alloy_download_util.cc", - "libcef/browser/alloy/alloy_download_util.h", - "libcef/browser/alloy/alloy_web_contents_view_delegate.cc", - "libcef/browser/alloy/alloy_web_contents_view_delegate.h", "libcef/browser/alloy/browser_platform_delegate_alloy.cc", "libcef/browser/alloy/browser_platform_delegate_alloy.h", - "libcef/browser/alloy/devtools/alloy_devtools_window_runner.cc", - "libcef/browser/alloy/devtools/alloy_devtools_window_runner.h", - "libcef/browser/alloy/devtools/devtools_file_manager.cc", - "libcef/browser/alloy/devtools/devtools_file_manager.h", - "libcef/browser/alloy/devtools/devtools_frontend.cc", - "libcef/browser/alloy/devtools/devtools_frontend.h", - "libcef/browser/alloy/devtools/devtools_manager_delegate.cc", - "libcef/browser/alloy/devtools/devtools_manager_delegate.h", "libcef/browser/alloy/dialogs/alloy_constrained_window_views_client.cc", "libcef/browser/alloy/dialogs/alloy_constrained_window_views_client.h", - "libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.cc", - "libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h", "libcef/browser/alloy/dialogs/alloy_web_contents_dialog_helper.cc", "libcef/browser/alloy/dialogs/alloy_web_contents_dialog_helper.h", - "libcef/browser/alloy/chrome_browser_process_alloy.cc", - "libcef/browser/alloy/chrome_browser_process_alloy.h", - "libcef/browser/alloy/chrome_profile_manager_alloy.cc", - "libcef/browser/alloy/chrome_profile_manager_alloy.h", - "libcef/browser/alloy/chrome_profile_alloy.cc", - "libcef/browser/alloy/chrome_profile_alloy.h", "libcef/browser/audio_capturer.cc", "libcef/browser/audio_capturer.h", "libcef/browser/audio_loopback_stream_creator.cc", @@ -501,8 +474,6 @@ source_set("libcef_static") { "libcef/browser/browser_contents_delegate.h", "libcef/browser/browser_context.cc", "libcef/browser/browser_context.h", - "libcef/browser/browser_context_keyed_service_factories.cc", - "libcef/browser/browser_context_keyed_service_factories.h", "libcef/browser/browser_frame.cc", "libcef/browser/browser_frame.h", "libcef/browser/browser_host_base.cc", @@ -580,50 +551,8 @@ source_set("libcef_static") { "libcef/browser/download_manager_delegate.h", "libcef/browser/download_manager_delegate_impl.cc", "libcef/browser/download_manager_delegate_impl.h", - "libcef/browser/extension_impl.cc", - "libcef/browser/extension_impl.h", - "libcef/browser/extensions/api/file_system/cef_file_system_delegate.cc", - "libcef/browser/extensions/api/file_system/cef_file_system_delegate.h", - "libcef/browser/extensions/api/storage/sync_value_store_cache.cc", - "libcef/browser/extensions/api/storage/sync_value_store_cache.h", - "libcef/browser/extensions/api/tabs/tabs_api.cc", - "libcef/browser/extensions/api/tabs/tabs_api.h", - "libcef/browser/extensions/alloy_extensions_util.cc", - "libcef/browser/extensions/alloy_extensions_util.h", "libcef/browser/extensions/browser_extensions_util.cc", "libcef/browser/extensions/browser_extensions_util.h", - "libcef/browser/extensions/browser_platform_delegate_background.cc", - "libcef/browser/extensions/browser_platform_delegate_background.h", - "libcef/browser/extensions/chrome_api_registration.cc", - "libcef/browser/extensions/chrome_api_registration.h", - "libcef/browser/extensions/component_extension_resource_manager.cc", - "libcef/browser/extensions/component_extension_resource_manager.h", - "libcef/browser/extensions/extensions_api_client.cc", - "libcef/browser/extensions/extensions_api_client.h", - "libcef/browser/extensions/extensions_browser_api_provider.cc", - "libcef/browser/extensions/extensions_browser_api_provider.h", - "libcef/browser/extensions/extensions_browser_client.cc", - "libcef/browser/extensions/extensions_browser_client.h", - "libcef/browser/extensions/extension_background_host.cc", - "libcef/browser/extensions/extension_background_host.h", - "libcef/browser/extensions/extension_function_details.cc", - "libcef/browser/extensions/extension_function_details.h", - "libcef/browser/extensions/extension_host_delegate.cc", - "libcef/browser/extensions/extension_host_delegate.h", - "libcef/browser/extensions/extension_system.cc", - "libcef/browser/extensions/extension_system.h", - "libcef/browser/extensions/extension_system_factory.cc", - "libcef/browser/extensions/extension_system_factory.h", - "libcef/browser/extensions/extension_view_host.cc", - "libcef/browser/extensions/extension_view_host.h", - "libcef/browser/extensions/extension_web_contents_observer.cc", - "libcef/browser/extensions/extension_web_contents_observer.h", - "libcef/browser/extensions/mime_handler_view_guest_delegate.cc", - "libcef/browser/extensions/mime_handler_view_guest_delegate.h", - "libcef/browser/extensions/value_store/cef_value_store.cc", - "libcef/browser/extensions/value_store/cef_value_store.h", - "libcef/browser/extensions/value_store/cef_value_store_factory.cc", - "libcef/browser/extensions/value_store/cef_value_store_factory.h", "libcef/browser/file_dialog_manager.cc", "libcef/browser/file_dialog_manager.h", "libcef/browser/file_dialog_runner.cc", @@ -646,8 +575,6 @@ source_set("libcef_static") { "libcef/browser/main_runner.h", "libcef/browser/media_access_query.cc", "libcef/browser/media_access_query.h", - "libcef/browser/media_capture_devices_dispatcher.cc", - "libcef/browser/media_capture_devices_dispatcher.h", "libcef/browser/media_router/media_route_impl.cc", "libcef/browser/media_router/media_route_impl.h", "libcef/browser/media_router/media_router_impl.cc", @@ -676,12 +603,6 @@ source_set("libcef_static") { "libcef/browser/net/chrome_scheme_handler.cc", "libcef/browser/net/chrome_scheme_handler.h", "libcef/browser/net/crlset_file_util_impl.cc", - "libcef/browser/net/devtools_scheme_handler.cc", - "libcef/browser/net/devtools_scheme_handler.h", - "libcef/browser/net/internal_scheme_handler.cc", - "libcef/browser/net/internal_scheme_handler.h", - "libcef/browser/net/scheme_handler.cc", - "libcef/browser/net/scheme_handler.h", "libcef/browser/net/throttle_handler.cc", "libcef/browser/net/throttle_handler.h", "libcef/browser/net_service/browser_urlrequest_impl.cc", @@ -737,8 +658,6 @@ source_set("libcef_static") { "libcef/browser/prefs/pref_helper.h", "libcef/browser/prefs/pref_registrar.cc", "libcef/browser/prefs/pref_registrar.h", - "libcef/browser/prefs/pref_store.cc", - "libcef/browser/prefs/pref_store.h", "libcef/browser/prefs/renderer_prefs.cc", "libcef/browser/prefs/renderer_prefs.h", "libcef/browser/print_settings_impl.cc", @@ -755,10 +674,6 @@ source_set("libcef_static") { "libcef/browser/server_impl.h", "libcef/browser/simple_menu_model_impl.cc", "libcef/browser/simple_menu_model_impl.h", - "libcef/browser/speech_recognition_manager_delegate.cc", - "libcef/browser/speech_recognition_manager_delegate.h", - "libcef/browser/ssl_host_state_delegate.cc", - "libcef/browser/ssl_host_state_delegate.h", "libcef/browser/ssl_info_impl.cc", "libcef/browser/ssl_info_impl.h", "libcef/browser/ssl_status_impl.cc", @@ -841,12 +756,6 @@ source_set("libcef_static") { "libcef/browser/xml_reader_impl.h", "libcef/browser/zip_reader_impl.cc", "libcef/browser/zip_reader_impl.h", - "libcef/common/alloy/alloy_content_client.cc", - "libcef/common/alloy/alloy_content_client.h", - "libcef/common/alloy/alloy_main_delegate.cc", - "libcef/common/alloy/alloy_main_delegate.h", - "libcef/common/alloy/alloy_main_runner_delegate.cc", - "libcef/common/alloy/alloy_main_runner_delegate.h", "libcef/common/app_manager.cc", "libcef/common/app_manager.h", "libcef/common/base_impl.cc", @@ -866,14 +775,6 @@ source_set("libcef_static") { "libcef/common/crash_reporting.h", "libcef/common/drag_data_impl.cc", "libcef/common/drag_data_impl.h", - "libcef/common/extensions/chrome_generated_schemas.cc", - "libcef/common/extensions/chrome_generated_schemas.h", - "libcef/common/extensions/extensions_api_provider.cc", - "libcef/common/extensions/extensions_api_provider.h", - "libcef/common/extensions/extensions_client.cc", - "libcef/common/extensions/extensions_client.h", - "libcef/common/extensions/extensions_util.cc", - "libcef/common/extensions/extensions_util.h", "libcef/common/file_util_impl.cc", "libcef/common/frame_util.cc", "libcef/common/frame_util.h", @@ -883,8 +784,6 @@ source_set("libcef_static") { "libcef/common/main_runner_handler.h", "libcef/common/net/http_header_utils.cc", "libcef/common/net/http_header_utils.h", - "libcef/common/net/net_resource_provider.cc", - "libcef/common/net/net_resource_provider.h", "libcef/common/net/scheme_registration.cc", "libcef/common/net/scheme_registration.h", "libcef/common/net/url_util.cc", @@ -934,14 +833,6 @@ source_set("libcef_static") { "libcef/common/waitable_event_impl.h", "libcef/features/runtime.h", "libcef/features/runtime_checks.h", - "libcef/renderer/alloy/alloy_content_renderer_client.cc", - "libcef/renderer/alloy/alloy_content_renderer_client.h", - "libcef/renderer/alloy/alloy_render_frame_observer.cc", - "libcef/renderer/alloy/alloy_render_frame_observer.h", - "libcef/renderer/alloy/alloy_render_thread_observer.cc", - "libcef/renderer/alloy/alloy_render_thread_observer.h", - "libcef/renderer/alloy/url_loader_throttle_provider_impl.cc", - "libcef/renderer/alloy/url_loader_throttle_provider_impl.h", "libcef/renderer/browser_impl.cc", "libcef/renderer/browser_impl.h", "libcef/renderer/chrome/chrome_content_renderer_client_cef.cc", @@ -971,6 +862,121 @@ source_set("libcef_static") { "//chrome/app/chrome_main_delegate.h", ] + if (enable_alloy_bootstrap) { + sources += [ + "libcef/browser/alloy/alloy_browser_context.cc", + "libcef/browser/alloy/alloy_browser_context.h", + "libcef/browser/alloy/alloy_browser_main.cc", + "libcef/browser/alloy/alloy_browser_main.h", + "libcef/browser/alloy/alloy_content_browser_client.cc", + "libcef/browser/alloy/alloy_content_browser_client.h", + "libcef/browser/alloy/alloy_download_manager_delegate.cc", + "libcef/browser/alloy/alloy_download_manager_delegate.h", + "libcef/browser/alloy/alloy_download_util.cc", + "libcef/browser/alloy/alloy_download_util.h", + "libcef/browser/alloy/alloy_web_contents_view_delegate.cc", + "libcef/browser/alloy/alloy_web_contents_view_delegate.h", + "libcef/browser/alloy/devtools/alloy_devtools_window_runner.cc", + "libcef/browser/alloy/devtools/alloy_devtools_window_runner.h", + "libcef/browser/alloy/devtools/devtools_file_manager.cc", + "libcef/browser/alloy/devtools/devtools_file_manager.h", + "libcef/browser/alloy/devtools/devtools_frontend.cc", + "libcef/browser/alloy/devtools/devtools_frontend.h", + "libcef/browser/alloy/devtools/devtools_manager_delegate.cc", + "libcef/browser/alloy/devtools/devtools_manager_delegate.h", + "libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.cc", + "libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h", + "libcef/browser/alloy/chrome_browser_process_alloy.cc", + "libcef/browser/alloy/chrome_browser_process_alloy.h", + "libcef/browser/alloy/chrome_profile_manager_alloy.cc", + "libcef/browser/alloy/chrome_profile_manager_alloy.h", + "libcef/browser/alloy/chrome_profile_alloy.cc", + "libcef/browser/alloy/chrome_profile_alloy.h", + "libcef/browser/browser_context_keyed_service_factories.cc", + "libcef/browser/browser_context_keyed_service_factories.h", + "libcef/browser/extension_impl.cc", + "libcef/browser/extension_impl.h", + "libcef/browser/extensions/api/file_system/cef_file_system_delegate.cc", + "libcef/browser/extensions/api/file_system/cef_file_system_delegate.h", + "libcef/browser/extensions/api/storage/sync_value_store_cache.cc", + "libcef/browser/extensions/api/storage/sync_value_store_cache.h", + "libcef/browser/extensions/api/tabs/tabs_api.cc", + "libcef/browser/extensions/api/tabs/tabs_api.h", + "libcef/browser/extensions/alloy_extensions_util.cc", + "libcef/browser/extensions/alloy_extensions_util.h", + "libcef/browser/extensions/browser_platform_delegate_background.cc", + "libcef/browser/extensions/browser_platform_delegate_background.h", + "libcef/browser/extensions/chrome_api_registration.cc", + "libcef/browser/extensions/chrome_api_registration.h", + "libcef/browser/extensions/component_extension_resource_manager.cc", + "libcef/browser/extensions/component_extension_resource_manager.h", + "libcef/browser/extensions/extensions_api_client.cc", + "libcef/browser/extensions/extensions_api_client.h", + "libcef/browser/extensions/extensions_browser_api_provider.cc", + "libcef/browser/extensions/extensions_browser_api_provider.h", + "libcef/browser/extensions/extensions_browser_client.cc", + "libcef/browser/extensions/extensions_browser_client.h", + "libcef/browser/extensions/extension_background_host.cc", + "libcef/browser/extensions/extension_background_host.h", + "libcef/browser/extensions/extension_function_details.cc", + "libcef/browser/extensions/extension_function_details.h", + "libcef/browser/extensions/extension_host_delegate.cc", + "libcef/browser/extensions/extension_host_delegate.h", + "libcef/browser/extensions/extension_system.cc", + "libcef/browser/extensions/extension_system.h", + "libcef/browser/extensions/extension_system_factory.cc", + "libcef/browser/extensions/extension_system_factory.h", + "libcef/browser/extensions/extension_view_host.cc", + "libcef/browser/extensions/extension_view_host.h", + "libcef/browser/extensions/extension_web_contents_observer.cc", + "libcef/browser/extensions/extension_web_contents_observer.h", + "libcef/browser/extensions/mime_handler_view_guest_delegate.cc", + "libcef/browser/extensions/mime_handler_view_guest_delegate.h", + "libcef/browser/extensions/value_store/cef_value_store.cc", + "libcef/browser/extensions/value_store/cef_value_store.h", + "libcef/browser/extensions/value_store/cef_value_store_factory.cc", + "libcef/browser/extensions/value_store/cef_value_store_factory.h", + "libcef/browser/media_capture_devices_dispatcher.cc", + "libcef/browser/media_capture_devices_dispatcher.h", + "libcef/browser/net/devtools_scheme_handler.cc", + "libcef/browser/net/devtools_scheme_handler.h", + "libcef/browser/net/internal_scheme_handler.cc", + "libcef/browser/net/internal_scheme_handler.h", + "libcef/browser/net/scheme_handler.cc", + "libcef/browser/net/scheme_handler.h", + "libcef/browser/prefs/pref_store.cc", + "libcef/browser/prefs/pref_store.h", + "libcef/browser/speech_recognition_manager_delegate.cc", + "libcef/browser/speech_recognition_manager_delegate.h", + "libcef/browser/ssl_host_state_delegate.cc", + "libcef/browser/ssl_host_state_delegate.h", + "libcef/common/alloy/alloy_content_client.cc", + "libcef/common/alloy/alloy_content_client.h", + "libcef/common/alloy/alloy_main_delegate.cc", + "libcef/common/alloy/alloy_main_delegate.h", + "libcef/common/alloy/alloy_main_runner_delegate.cc", + "libcef/common/alloy/alloy_main_runner_delegate.h", + "libcef/common/extensions/chrome_generated_schemas.cc", + "libcef/common/extensions/chrome_generated_schemas.h", + "libcef/common/extensions/extensions_api_provider.cc", + "libcef/common/extensions/extensions_api_provider.h", + "libcef/common/extensions/extensions_client.cc", + "libcef/common/extensions/extensions_client.h", + "libcef/common/extensions/extensions_util.cc", + "libcef/common/extensions/extensions_util.h", + "libcef/common/net/net_resource_provider.cc", + "libcef/common/net/net_resource_provider.h", + "libcef/renderer/alloy/alloy_content_renderer_client.cc", + "libcef/renderer/alloy/alloy_content_renderer_client.h", + "libcef/renderer/alloy/alloy_render_frame_observer.cc", + "libcef/renderer/alloy/alloy_render_frame_observer.h", + "libcef/renderer/alloy/alloy_render_thread_observer.cc", + "libcef/renderer/alloy/alloy_render_thread_observer.h", + "libcef/renderer/alloy/url_loader_throttle_provider_impl.cc", + "libcef/renderer/alloy/url_loader_throttle_provider_impl.h", + ] + } + configs += [ "libcef/features:config", "//build/config:precompiled_headers", @@ -1268,6 +1274,10 @@ config("libcef_dll_wrapper_config") { ldflags = [ "/STACK:0x800000" ] } } + + if (!enable_alloy_bootstrap) { + defines = [ "DISABLE_ALLOY_BOOTSTRAP" ] + } } # libcef_dll_wrapper target. diff --git a/include/base/cef_build.h b/include/base/cef_build.h index 717f05df1..c696f7536 100644 --- a/include/base/cef_build.h +++ b/include/base/cef_build.h @@ -69,6 +69,13 @@ #if defined(USING_CHROMIUM_INCLUDES) // When building CEF include the Chromium header directly. #include "build/build_config.h" + +#include "cef/libcef/features/features.h" + +#if !BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#define DISABLE_ALLOY_BOOTSTRAP 1 +#endif + #else // !USING_CHROMIUM_INCLUDES // The following is substantially similar to the Chromium implementation. // If the Chromium implementation diverges the below implementation should be diff --git a/include/capi/cef_browser_capi.h b/include/capi/cef_browser_capi.h index 45089a447..e692e7bc2 100644 --- a/include/capi/cef_browser_capi.h +++ b/include/capi/cef_browser_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=7733ed87ade32dfd311c24c51263d20b9b469868$ +// $hash=6ee74f31d37a1b5ab3c9c5ccbe2dce9841329b38$ // #ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_ @@ -911,6 +911,8 @@ typedef struct _cef_browser_host_t { /// Returns the extension hosted in this browser or NULL if no extension is /// hosted. See cef_request_context_t::LoadExtension for details. /// + /// WARNING: This function is deprecated and will be removed in ~M127. + /// struct _cef_extension_t*(CEF_CALLBACK* get_extension)( struct _cef_browser_host_t* self); @@ -919,6 +921,8 @@ typedef struct _cef_browser_host_t { /// script. Background hosts do not have a window and are not displayable. See /// cef_request_context_t::LoadExtension for details. /// + /// WARNING: This function is deprecated and will be removed in ~M127. + /// int(CEF_CALLBACK* is_background_host)(struct _cef_browser_host_t* self); /// diff --git a/include/capi/cef_extension_capi.h b/include/capi/cef_extension_capi.h index cedb0206c..116e5ff6c 100644 --- a/include/capi/cef_extension_capi.h +++ b/include/capi/cef_extension_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=0ca2b788f70f8c9f5b2706d691d8e063be00ed19$ +// $hash=634054ad25154c30fb4ec630fe7fb79b0cf1f9b3$ // #ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_ @@ -54,6 +54,8 @@ struct _cef_request_context_t; /// Object representing an extension. Methods may be called on any thread unless /// otherwise indicated. /// +/// WARNING: This API is deprecated and will be removed in ~M127. +/// typedef struct _cef_extension_t { /// /// Base structure. diff --git a/include/capi/cef_extension_handler_capi.h b/include/capi/cef_extension_handler_capi.h index 533cc1910..be6261fe8 100644 --- a/include/capi/cef_extension_handler_capi.h +++ b/include/capi/cef_extension_handler_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=5cfff4465a586d2b2ea7b54a9549096faec415f6$ +// $hash=ebac34c9b85de780ce7524211c5dd61a80d4576c$ // #ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_ @@ -80,6 +80,8 @@ typedef struct _cef_get_extension_resource_callback_t { /// cef_request_context_t::LoadExtension for information about extension /// loading. /// +/// WARNING: This API is deprecated and will be removed in ~M127. +/// typedef struct _cef_extension_handler_t { /// /// Base structure. diff --git a/include/capi/cef_request_context_capi.h b/include/capi/cef_request_context_capi.h index 8f31267ef..0ac2fe531 100644 --- a/include/capi/cef_request_context_capi.h +++ b/include/capi/cef_request_context_capi.h @@ -33,7 +33,7 @@ // by hand. See the translator.README.txt file in the tools directory for // more information. // -// $hash=7df03921b2ee743fb059f13e545ccf89904eb060$ +// $hash=2c496139ca9a59303b1493ee93d2c3ae96a956c0$ // #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_ @@ -253,6 +253,8 @@ typedef struct _cef_request_context_t { /// See https://developer.chrome.com/extensions for extension implementation /// and usage documentation. /// + /// WARNING: This function is deprecated and will be removed in ~M127. + /// void(CEF_CALLBACK* load_extension)(struct _cef_request_context_t* self, const cef_string_t* root_directory, struct _cef_dictionary_value_t* manifest, @@ -264,6 +266,8 @@ typedef struct _cef_request_context_t { /// access to the extension (see HasExtension). This function must be called /// on the browser process UI thread. /// + /// WARNING: This function is deprecated and will be removed in ~M127. + /// int(CEF_CALLBACK* did_load_extension)(struct _cef_request_context_t* self, const cef_string_t* extension_id); @@ -273,6 +277,8 @@ typedef struct _cef_request_context_t { /// extension (see DidLoadExtension). This function must be called on the /// browser process UI thread. /// + /// WARNING: This function is deprecated and will be removed in ~M127. + /// int(CEF_CALLBACK* has_extension)(struct _cef_request_context_t* self, const cef_string_t* extension_id); @@ -282,6 +288,8 @@ typedef struct _cef_request_context_t { /// extension ID values. Returns true (1) on success. This function must be /// called on the browser process UI thread. /// + /// WARNING: This function is deprecated and will be removed in ~M127. + /// int(CEF_CALLBACK* get_extensions)(struct _cef_request_context_t* self, cef_string_list_t extension_ids); @@ -290,6 +298,8 @@ typedef struct _cef_request_context_t { /// extension is accessible in this context (see HasExtension). This function /// must be called on the browser process UI thread. /// + /// WARNING: This function is deprecated and will be removed in ~M127. + /// struct _cef_extension_t*(CEF_CALLBACK* get_extension)( struct _cef_request_context_t* self, const cef_string_t* extension_id); diff --git a/include/cef_api_hash.h b/include/cef_api_hash.h index d731c22d8..0ae044585 100644 --- a/include/cef_api_hash.h +++ b/include/cef_api_hash.h @@ -42,13 +42,13 @@ // way that may cause binary incompatibility with other builds. The universal // hash value will change if any platform is affected whereas the platform hash // values will change only if that particular platform is affected. -#define CEF_API_HASH_UNIVERSAL "73e8743408bfeba0df3b567bfd04b2eb642df11d" +#define CEF_API_HASH_UNIVERSAL "c9171db05e2e3ad611ea09d9457edaaa336bd4d6" #if defined(OS_WIN) -#define CEF_API_HASH_PLATFORM "3a73f4c69062c6f413e00c1821f6e6df91a2a787" +#define CEF_API_HASH_PLATFORM "d65aa12068be307fd8e6642024cb67d82643d412" #elif defined(OS_MAC) -#define CEF_API_HASH_PLATFORM "f5fb92747082f06a9c42724b0b717accc29e3879" +#define CEF_API_HASH_PLATFORM "41e80b4bf45ce56cea0e87e825f9e6b58977a1da" #elif defined(OS_LINUX) -#define CEF_API_HASH_PLATFORM "8775d620c6b17725bddba2c1c3a21353b4d8acb1" +#define CEF_API_HASH_PLATFORM "1ed8d88d0d7d9d8a3b0296e9f84fea7752fdff2e" #endif #ifdef __cplusplus diff --git a/include/cef_browser.h b/include/cef_browser.h index 70f291225..ee7492e32 100644 --- a/include/cef_browser.h +++ b/include/cef_browser.h @@ -942,6 +942,8 @@ class CefBrowserHost : public virtual CefBaseRefCounted { /// Returns the extension hosted in this browser or NULL if no extension is /// hosted. See CefRequestContext::LoadExtension for details. /// + /// WARNING: This method is deprecated and will be removed in ~M127. + /// /*--cef()--*/ virtual CefRefPtr GetExtension() = 0; @@ -950,6 +952,8 @@ class CefBrowserHost : public virtual CefBaseRefCounted { /// Background hosts do not have a window and are not displayable. See /// CefRequestContext::LoadExtension for details. /// + /// WARNING: This method is deprecated and will be removed in ~M127. + /// /*--cef()--*/ virtual bool IsBackgroundHost() = 0; diff --git a/include/cef_extension.h b/include/cef_extension.h index 5d94192f5..5f78d8158 100644 --- a/include/cef_extension.h +++ b/include/cef_extension.h @@ -48,6 +48,8 @@ class CefRequestContext; /// Object representing an extension. Methods may be called on any thread unless /// otherwise indicated. /// +/// WARNING: This API is deprecated and will be removed in ~M127. +/// /*--cef(source=library)--*/ class CefExtension : public CefBaseRefCounted { public: diff --git a/include/cef_extension_handler.h b/include/cef_extension_handler.h index 4b34fbc02..e95916891 100644 --- a/include/cef_extension_handler.h +++ b/include/cef_extension_handler.h @@ -70,6 +70,8 @@ class CefGetExtensionResourceCallback : public CefBaseRefCounted { /// The methods of this class will be called on the UI thread. See /// CefRequestContext::LoadExtension for information about extension loading. /// +/// WARNING: This API is deprecated and will be removed in ~M127. +/// /*--cef(source=client)--*/ class CefExtensionHandler : public virtual CefBaseRefCounted { public: diff --git a/include/cef_request_context.h b/include/cef_request_context.h index e977ea3eb..21b2698ac 100644 --- a/include/cef_request_context.h +++ b/include/cef_request_context.h @@ -266,6 +266,8 @@ class CefRequestContext : public CefPreferenceManager { /// See https://developer.chrome.com/extensions for extension implementation /// and usage documentation. /// + /// WARNING: This method is deprecated and will be removed in ~M127. + /// /*--cef(optional_param=manifest,optional_param=handler)--*/ virtual void LoadExtension(const CefString& root_directory, CefRefPtr manifest, @@ -277,6 +279,8 @@ class CefRequestContext : public CefPreferenceManager { /// access to the extension (see HasExtension). This method must be called on /// the browser process UI thread. /// + /// WARNING: This method is deprecated and will be removed in ~M127. + /// /*--cef()--*/ virtual bool DidLoadExtension(const CefString& extension_id) = 0; @@ -286,6 +290,8 @@ class CefRequestContext : public CefPreferenceManager { /// extension (see DidLoadExtension). This method must be called on the /// browser process UI thread. /// + /// WARNING: This method is deprecated and will be removed in ~M127. + /// /*--cef()--*/ virtual bool HasExtension(const CefString& extension_id) = 0; @@ -295,6 +301,8 @@ class CefRequestContext : public CefPreferenceManager { /// extension ID values. Returns true on success. This method must be called /// on the browser process UI thread. /// + /// WARNING: This method is deprecated and will be removed in ~M127. + /// /*--cef()--*/ virtual bool GetExtensions(std::vector& extension_ids) = 0; @@ -303,6 +311,8 @@ class CefRequestContext : public CefPreferenceManager { /// extension is accessible in this context (see HasExtension). This method /// must be called on the browser process UI thread. /// + /// WARNING: This method is deprecated and will be removed in ~M127. + /// /*--cef()--*/ virtual CefRefPtr GetExtension( const CefString& extension_id) = 0; diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h index 6f8ed6817..2f0dccbc8 100644 --- a/include/internal/cef_types.h +++ b/include/internal/cef_types.h @@ -235,12 +235,14 @@ typedef struct _cef_settings_t { /// cef_string_t main_bundle_path; +#if !defined(DISABLE_ALLOY_BOOTSTRAP) /// /// Set to true (1) to enable use of the Chrome runtime in CEF. This feature /// is considered experimental and is not recommended for most users at this /// time. See issue #2969 for details. /// int chrome_runtime; +#endif /// /// Set to true (1) to have the browser process message loop run in a separate diff --git a/include/internal/cef_types_wrappers.h b/include/internal/cef_types_wrappers.h index 56b838fa0..9cc58f6c4 100644 --- a/include/internal/cef_types_wrappers.h +++ b/include/internal/cef_types_wrappers.h @@ -387,7 +387,9 @@ struct CefSettingsTraits { &target->framework_dir_path, copy); cef_string_set(src->main_bundle_path.str, src->main_bundle_path.length, &target->main_bundle_path, copy); +#if !defined(DISABLE_ALLOY_BOOTSTRAP) target->chrome_runtime = src->chrome_runtime; +#endif target->multi_threaded_message_loop = src->multi_threaded_message_loop; target->external_message_pump = src->external_message_pump; target->windowless_rendering_enabled = src->windowless_rendering_enabled; diff --git a/libcef/browser/alloy/alloy_browser_host_impl.cc b/libcef/browser/alloy/alloy_browser_host_impl.cc index c7a864ce5..a22a79eac 100644 --- a/libcef/browser/alloy/alloy_browser_host_impl.cc +++ b/libcef/browser/alloy/alloy_browser_host_impl.cc @@ -50,10 +50,13 @@ #include "content/public/common/input/native_web_keyboard_event.h" #include "content/public/common/url_constants.h" #include "extensions/common/constants.h" -#include "extensions/common/extension.h" #include "net/base/net_errors.h" #include "ui/events/base_event_utils.h" +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "extensions/common/extension.h" +#endif + using content::KeyboardEventProcessingResult; namespace { @@ -75,7 +78,11 @@ CefRefPtr AlloyBrowserHostImpl::Create( // Expect runtime style to match. CHECK(platform_delegate->IsAlloyStyle()); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) const bool is_devtools_popup = !!create_params.devtools_opener; +#else + const bool is_devtools_popup = false; +#endif scoped_refptr info = CefBrowserInfoManager::GetInstance()->CreateBrowserInfo( @@ -92,6 +99,7 @@ CefRefPtr AlloyBrowserHostImpl::Create( auto request_context_impl = static_cast(create_params.request_context.get()); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) CefRefPtr cef_extension; if (create_params.extension) { auto cef_browser_context = request_context_impl->GetBrowserContext(); @@ -99,24 +107,39 @@ CefRefPtr AlloyBrowserHostImpl::Create( cef_browser_context->GetExtension(create_params.extension->id()); CHECK(cef_extension); } +#endif +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) auto platform_delegate_ptr = platform_delegate.get(); +#endif CefRefPtr browser = CreateInternal( create_params.settings, create_params.client, web_contents, - own_web_contents, info, FromBaseChecked(create_params.devtools_opener), - is_devtools_popup, request_context_impl, std::move(platform_delegate), - cef_extension); + own_web_contents, info, +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + FromBaseChecked(create_params.devtools_opener), +#else + /*opener=*/nullptr, +#endif + is_devtools_popup, request_context_impl, std::move(platform_delegate) +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + , + cef_extension +#endif + ); if (!browser) { return nullptr; } GURL url = url_util::MakeGURL(create_params.url, /*fixup=*/true); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) if (create_params.extension) { platform_delegate_ptr->CreateExtensionHost( create_params.extension, url, create_params.extension_host_type); - } else if (!url.is_empty()) { + } else +#endif + if (!url.is_empty()) { content::OpenURLParams params(url, content::Referrer(), WindowOpenDisposition::CURRENT_TAB, CefFrameHostImpl::kPageTransitionExplicit, @@ -137,8 +160,12 @@ CefRefPtr AlloyBrowserHostImpl::CreateInternal( CefRefPtr opener, bool is_devtools_popup, CefRefPtr request_context, - std::unique_ptr platform_delegate, - CefRefPtr extension) { + std::unique_ptr platform_delegate +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + , + CefRefPtr extension +#endif +) { CEF_REQUIRE_UIT(); DCHECK(web_contents); DCHECK(browser_info); @@ -169,7 +196,12 @@ CefRefPtr AlloyBrowserHostImpl::CreateInternal( CefRefPtr browser = new AlloyBrowserHostImpl( settings, client, web_contents, browser_info, opener, request_context, - std::move(platform_delegate), extension); + std::move(platform_delegate) +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + , + extension +#endif + ); browser->InitializeBrowser(); if (!browser->CreateHostWindow()) { @@ -352,6 +384,7 @@ void AlloyBrowserHostImpl::SetAutoResizeEnabled(bool enabled, } } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) CefRefPtr AlloyBrowserHostImpl::GetExtension() { return extension_; } @@ -359,6 +392,7 @@ CefRefPtr AlloyBrowserHostImpl::GetExtension() { bool AlloyBrowserHostImpl::IsBackgroundHost() { return is_background_host_; } +#endif bool AlloyBrowserHostImpl::CanExecuteChromeCommand(int command_id) { return false; @@ -626,11 +660,13 @@ bool AlloyBrowserHostImpl::MaybeAllowNavigation( return true; } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) extensions::ExtensionHost* AlloyBrowserHostImpl::GetExtensionHost() const { CEF_REQUIRE_UIT(); DCHECK(platform_delegate_); return platform_delegate_->GetExtensionHost(); } +#endif void AlloyBrowserHostImpl::OnSetFocus(cef_focus_source_t source) { if (!CEF_CURRENTLY_ON_UIT()) { @@ -942,11 +978,13 @@ content::WebContents* AlloyBrowserHostImpl::OpenURLFromTab( return nullptr; } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool AlloyBrowserHostImpl::ShouldAllowRendererInitiatedCrossProcessNavigation( bool is_main_frame_navigation) { return platform_delegate_->ShouldAllowRendererInitiatedCrossProcessNavigation( is_main_frame_navigation); } +#endif void AlloyBrowserHostImpl::AddNewContents( content::WebContents* source, @@ -1088,11 +1126,13 @@ bool AlloyBrowserHostImpl::HandleKeyboardEvent( return false; } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool AlloyBrowserHostImpl::PreHandleGestureEvent( content::WebContents* source, const blink::WebGestureEvent& event) { return platform_delegate_->PreHandleGestureEvent(source, event); } +#endif bool AlloyBrowserHostImpl::CanDragEnter(content::WebContents* source, const content::DropData& data, @@ -1164,10 +1204,14 @@ void AlloyBrowserHostImpl::WebContentsCreated( // We don't officially own |new_contents| until AddNewContents() is called. // However, we need to install observers/delegates here. - CefRefPtr browser = - CreateInternal(settings, client, new_contents, /*own_web_contents=*/false, - info, opener, /*is_devtools_popup=*/false, request_context, - std::move(platform_delegate), /*extension=*/nullptr); + CefRefPtr browser = CreateInternal( + settings, client, new_contents, /*own_web_contents=*/false, info, opener, + /*is_devtools_popup=*/false, request_context, std::move(platform_delegate) +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + , + /*extension=*/nullptr +#endif + ); } void AlloyBrowserHostImpl::RendererUnresponsive( @@ -1255,10 +1299,12 @@ bool AlloyBrowserHostImpl::CheckMediaAccessPermission( security_origin, type); } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool AlloyBrowserHostImpl::IsNeverComposited( content::WebContents* web_contents) { return platform_delegate_->IsNeverComposited(web_contents); } +#endif content::PictureInPictureResult AlloyBrowserHostImpl::EnterPictureInPicture( content::WebContents* web_contents) { @@ -1276,8 +1322,12 @@ void AlloyBrowserHostImpl::ExitPictureInPicture() { } bool AlloyBrowserHostImpl::IsBackForwardCacheSupported() { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + return true; +#else // Disabled with Alloy bootstrap due to issue #3237. return cef::IsChromeRuntimeEnabled(); +#endif } content::PreloadingEligibility AlloyBrowserHostImpl::IsPrerender2Supported( @@ -1399,8 +1449,12 @@ AlloyBrowserHostImpl::AlloyBrowserHostImpl( scoped_refptr browser_info, CefRefPtr opener, CefRefPtr request_context, - std::unique_ptr platform_delegate, - CefRefPtr extension) + std::unique_ptr platform_delegate +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + , + CefRefPtr extension +#endif + ) : CefBrowserHostBase(settings, client, std::move(platform_delegate), @@ -1408,8 +1462,12 @@ AlloyBrowserHostImpl::AlloyBrowserHostImpl( request_context), content::WebContentsObserver(web_contents), opener_(kNullWindowHandle), - is_windowless_(platform_delegate_->IsWindowless()), - extension_(extension) { + is_windowless_(platform_delegate_->IsWindowless()) +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + , + extension_(extension) +#endif +{ contents_delegate_->ObserveWebContents(web_contents); if (opener.get() && !is_views_hosted_) { diff --git a/libcef/browser/alloy/alloy_browser_host_impl.h b/libcef/browser/alloy/alloy_browser_host_impl.h index e5e03e67e..5535490ca 100644 --- a/libcef/browser/alloy/alloy_browser_host_impl.h +++ b/libcef/browser/alloy/alloy_browser_host_impl.h @@ -25,7 +25,10 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_delegate.h" #include "content/public/browser/web_contents_observer.h" + +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) #include "extensions/common/mojom/view_type.mojom-forward.h" +#endif class CefAudioCapturer; class CefBrowserInfo; @@ -123,8 +126,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase, void SetAutoResizeEnabled(bool enabled, const CefSize& min_size, const CefSize& max_size) override; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) CefRefPtr GetExtension() override; bool IsBackgroundHost() override; +#endif bool CanExecuteChromeCommand(int command_id) override; void ExecuteChromeCommand(int command_id, cef_window_open_disposition_t disposition) override; @@ -166,8 +171,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase, void UpdateDragOperation(ui::mojom::DragOperation operation, bool document_is_handling_drag); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Accessors that must be called on the UI thread. extensions::ExtensionHost* GetExtensionHost() const; +#endif void OnSetFocus(cef_focus_source_t source) override; @@ -187,8 +194,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase, const content::OpenURLParams& params, base::OnceCallback navigation_handle_callback) override; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool ShouldAllowRendererInitiatedCrossProcessNavigation( bool is_main_frame_navigation) override; +#endif void AddNewContents(content::WebContents* source, std::unique_ptr new_contents, const GURL& target_url, @@ -219,8 +228,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase, bool HandleKeyboardEvent( content::WebContents* source, const content::NativeWebKeyboardEvent& event) override; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool PreHandleGestureEvent(content::WebContents* source, const blink::WebGestureEvent& event) override; +#endif bool CanDragEnter(content::WebContents* source, const content::DropData& data, blink::DragOperationsMask operations_allowed) override; @@ -274,7 +285,9 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase, bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host, const url::Origin& security_origin, blink::mojom::MediaStreamType type) override; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool IsNeverComposited(content::WebContents* web_contents) override; +#endif content::PictureInPictureResult EnterPictureInPicture( content::WebContents* web_contents) override; void ExitPictureInPicture() override; @@ -309,8 +322,12 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase, CefRefPtr opener, bool is_devtools_popup, CefRefPtr request_context, - std::unique_ptr platform_delegate, - CefRefPtr extension); + std::unique_ptr platform_delegate +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + , + CefRefPtr extension +#endif + ); AlloyBrowserHostImpl( const CefBrowserSettings& settings, @@ -319,8 +336,12 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase, scoped_refptr browser_info, CefRefPtr opener, CefRefPtr request_context, - std::unique_ptr platform_delegate, - CefRefPtr extension); + std::unique_ptr platform_delegate +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + , + CefRefPtr extension +#endif + ); // Give the platform delegate an opportunity to create the host window. bool CreateHostWindow(); @@ -331,8 +352,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase, CefWindowHandle opener_; const bool is_windowless_; CefWindowHandle host_window_handle_ = kNullWindowHandle; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) CefRefPtr extension_; bool is_background_host_ = false; +#endif // Represents the current browser destruction state. Only accessed on the UI // thread. diff --git a/libcef/browser/alloy/alloy_download_util.h b/libcef/browser/alloy/alloy_download_util.h index 51c2e285e..d81c818c2 100644 --- a/libcef/browser/alloy/alloy_download_util.h +++ b/libcef/browser/alloy/alloy_download_util.h @@ -6,6 +6,8 @@ #define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DOWNLOAD_UTIL_H_ #pragma once +#include "cef/libcef/features/features.h" + class DownloadPrefs; namespace content { diff --git a/libcef/browser/alloy/browser_platform_delegate_alloy.cc b/libcef/browser/alloy/browser_platform_delegate_alloy.cc index 28d48eefc..18a0b50d9 100644 --- a/libcef/browser/alloy/browser_platform_delegate_alloy.cc +++ b/libcef/browser/alloy/browser_platform_delegate_alloy.cc @@ -7,37 +7,55 @@ #include #include "libcef/browser/alloy/alloy_browser_host_impl.h" -#include "libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h" -#include "libcef/browser/extensions/browser_extensions_util.h" #include "libcef/browser/extensions/extension_background_host.h" #include "libcef/browser/extensions/extension_system.h" #include "libcef/browser/extensions/extension_view_host.h" #include "libcef/browser/extensions/extension_web_contents_observer.h" #include "libcef/common/extensions/extensions_util.h" #include "libcef/common/net/url_util.h" -#include "libcef/features/runtime_checks.h" #include "base/logging.h" -#include "chrome/browser/printing/printing_init.h" +#include "cef/libcef/features/features.h" #include "chrome/browser/task_manager/web_contents_tags.h" -#include "chrome/browser/ui/prefs/prefs_tab_helper.h" #include "chrome/browser/ui/tab_helpers.h" #include "components/find_in_page/find_tab_helper.h" #include "components/find_in_page/find_types.h" -#include "components/javascript_dialogs/tab_modal_dialog_manager.h" #include "components/performance_manager/embedder/performance_manager_registry.h" -#include "components/permissions/permission_request_manager.h" -#include "components/zoom/zoom_controller.h" #include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/public/browser/render_view_host.h" #include "extensions/browser/process_manager.h" #include "pdf/pdf_features.h" #include "third_party/blink/public/mojom/frame/find_in_page.mojom.h" +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h" +#include "libcef/features/runtime_checks.h" + +#include "chrome/browser/printing/printing_init.h" +#include "chrome/browser/ui/prefs/prefs_tab_helper.h" +#include "components/javascript_dialogs/tab_modal_dialog_manager.h" +#include "components/permissions/permission_request_manager.h" +#include "components/zoom/zoom_controller.h" +#include "extensions/browser/extension_registry.h" +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + namespace { const char kAttachedHelpersUserDataKey[] = "CefAttachedHelpers"; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +const extensions::Extension* GetExtensionForUrl( + content::BrowserContext* browser_context, + const GURL& url) { + auto* registry = extensions::ExtensionRegistry::Get(browser_context); + if (!registry) { + return nullptr; + } + std::string extension_id = url.host(); + return registry->enabled_extensions().GetByID(extension_id); +} +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } // namespace CefBrowserPlatformDelegateAlloy::CefBrowserPlatformDelegateAlloy() @@ -58,13 +76,13 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents( CHECK(browser_context); scoped_refptr site_instance; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) if (extensions::ExtensionsEnabled() && !create_params.url.empty()) { GURL gurl = url_util::MakeGURL(create_params.url, /*fixup=*/true); if (!create_params.extension) { // We might be loading an extension app view where the extension URL is // provided by the client. - create_params.extension = - extensions::GetExtensionForUrl(browser_context, gurl); + create_params.extension = GetExtensionForUrl(browser_context, gurl); } if (create_params.extension) { if (create_params.extension_host_type == @@ -85,6 +103,7 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents( DCHECK(site_instance); } } +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) content::WebContents::CreateParams wc_create_params(browser_context, site_instance); @@ -138,13 +157,16 @@ void CefBrowserPlatformDelegateAlloy::AddNewContents( return; } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) if (extension_host_) { extension_host_->AddNewContents(source, std::move(new_contents), target_url, disposition, window_features, user_gesture, was_blocked); } +#endif } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool CefBrowserPlatformDelegateAlloy:: ShouldAllowRendererInitiatedCrossProcessNavigation( bool is_main_frame_navigation) { @@ -154,6 +176,7 @@ bool CefBrowserPlatformDelegateAlloy:: } return true; } +#endif void CefBrowserPlatformDelegateAlloy::RenderViewReady() { ConfigureAutoResize(); @@ -179,6 +202,7 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated( std::make_unique(web_contents_, this); } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) void CefBrowserPlatformDelegateAlloy::CreateExtensionHost( const extensions::Extension* extension, const GURL& url, @@ -219,11 +243,14 @@ extensions::ExtensionHost* CefBrowserPlatformDelegateAlloy::GetExtensionHost() const { return extension_host_; } +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) void CefBrowserPlatformDelegateAlloy::BrowserDestroyed( CefBrowserHostBase* browser) { if (primary_) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) DestroyExtensionHost(); +#endif owned_web_contents_.reset(); } @@ -265,6 +292,7 @@ void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() { } #endif +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool CefBrowserPlatformDelegateAlloy::PreHandleGestureEvent( content::WebContents* source, const blink::WebGestureEvent& event) { @@ -281,6 +309,7 @@ bool CefBrowserPlatformDelegateAlloy::IsNeverComposited( } return false; } +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) void CefBrowserPlatformDelegateAlloy::SetAutoResizeEnabled( bool enabled, @@ -377,6 +406,7 @@ void CefBrowserPlatformDelegateAlloy::SetOwnedWebContents( owned_web_contents_.reset(owned_contents); } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) void CefBrowserPlatformDelegateAlloy::DestroyExtensionHost() { if (!extension_host_) { return; @@ -402,6 +432,7 @@ void CefBrowserPlatformDelegateAlloy::OnExtensionHostDeleted() { DCHECK(extension_host_); extension_host_ = nullptr; } +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) void CefBrowserPlatformDelegateAlloy::AttachHelpers( content::WebContents* web_contents) { @@ -416,6 +447,7 @@ void CefBrowserPlatformDelegateAlloy::AttachHelpers( web_contents->SetUserData(&kAttachedHelpersUserDataKey, std::make_unique()); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Create all the helpers. if (cef::IsAlloyRuntimeEnabled()) { find_in_page::FindTabHelper::CreateForWebContents(web_contents); @@ -427,7 +459,9 @@ void CefBrowserPlatformDelegateAlloy::AttachHelpers( javascript_dialogs::TabModalDialogManager::CreateForWebContents( web_contents, CreateAlloyJavaScriptTabModalDialogManagerDelegateDesktop( web_contents)); - } else { + } else +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + { if (IsWindowless()) { // Logic from ChromeContentBrowserClientCef::GetWebContentsViewDelegate // which is not called for windowless browsers. Needs to be done before diff --git a/libcef/browser/alloy/browser_platform_delegate_alloy.h b/libcef/browser/alloy/browser_platform_delegate_alloy.h index 9e9028929..8bb9704b2 100644 --- a/libcef/browser/alloy/browser_platform_delegate_alloy.h +++ b/libcef/browser/alloy/browser_platform_delegate_alloy.h @@ -33,14 +33,18 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate { const blink::mojom::WindowFeatures& window_features, bool user_gesture, bool* was_blocked) override; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool ShouldAllowRendererInitiatedCrossProcessNavigation( bool is_main_frame_navigation) override; +#endif void RenderViewReady() override; void BrowserCreated(CefBrowserHostBase* browser) override; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) void CreateExtensionHost(const extensions::Extension* extension, const GURL& url, extensions::mojom::ViewType host_type) override; extensions::ExtensionHost* GetExtensionHost() const override; +#endif void BrowserDestroyed(CefBrowserHostBase* browser) override; web_modal::WebContentsModalDialogHost* GetWebContentsModalDialogHost() const override; @@ -48,9 +52,11 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate { #if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)) void NotifyMoveOrResizeStarted() override; #endif +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool PreHandleGestureEvent(content::WebContents* source, const blink::WebGestureEvent& event) override; bool IsNeverComposited(content::WebContents* web_contents) override; +#endif bool IsAlloyStyle() const override { return true; } void SetAutoResizeEnabled(bool enabled, const CefSize& min_size, @@ -83,8 +89,10 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate { private: void SetOwnedWebContents(content::WebContents* owned_contents); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) void DestroyExtensionHost(); void OnExtensionHostDeleted(); +#endif void ConfigureAutoResize(); @@ -105,9 +113,11 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate { // matches, the find selection rectangle, etc. find_in_page::FindNotificationDetails last_search_result_; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Used when the browser is hosting an extension. extensions::ExtensionHost* extension_host_ = nullptr; bool is_background_host_ = false; +#endif // Used with auto-resize. bool auto_resize_enabled_ = false; diff --git a/libcef/browser/browser_context.cc b/libcef/browser/browser_context.cc index 29ea61c8e..b99cd08df 100644 --- a/libcef/browser/browser_context.cc +++ b/libcef/browser/browser_context.cc @@ -366,6 +366,7 @@ void CefBrowserContext::ClearSchemeHandlerFactories() { iothread_state_)); } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) void CefBrowserContext::LoadExtension( const CefString& root_directory, CefRefPtr manifest, @@ -392,6 +393,7 @@ bool CefBrowserContext::UnloadExtension(const CefString& extension_id) { NOTIMPLEMENTED(); return false; } +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) network::mojom::NetworkContext* CefBrowserContext::GetNetworkContext() { CEF_REQUIRE_UIT(); diff --git a/libcef/browser/browser_context.h b/libcef/browser/browser_context.h index 7158c9f46..34350b55f 100644 --- a/libcef/browser/browser_context.h +++ b/libcef/browser/browser_context.h @@ -18,6 +18,7 @@ #include "base/functional/callback.h" #include "base/memory/weak_ptr.h" #include "base/task/sequenced_task_runner_helpers.h" +#include "cef/libcef/features/features.h" #include "chrome/common/plugin.mojom.h" #include "services/network/public/mojom/network_context.mojom.h" #include "ui/base/page_transition_types.h" @@ -160,7 +161,8 @@ class CefBrowserContext { const CefString& domain_name, CefRefPtr factory); void ClearSchemeHandlerFactories(); - // TODO(chrome-runtime): Make these extension methods pure virtual. + +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) virtual void LoadExtension(const CefString& root_directory, CefRefPtr manifest, CefRefPtr handler, @@ -170,6 +172,7 @@ class CefBrowserContext { // Called from CefExtensionImpl::Unload(). virtual bool UnloadExtension(const CefString& extension_id); +#endif // Called from AlloyBrowserHostImpl::DidFinishNavigation to update the table // of visited links. diff --git a/libcef/browser/browser_host_base.cc b/libcef/browser/browser_host_base.cc index d3fa4f83f..d2898988b 100644 --- a/libcef/browser/browser_host_base.cc +++ b/libcef/browser/browser_host_base.cc @@ -731,6 +731,15 @@ void CefBrowserHostBase::NotifyMoveOrResizeStarted() { #endif } +CefRefPtr CefBrowserHostBase::GetExtension() { + NOTIMPLEMENTED(); + return nullptr; +} + +bool CefBrowserHostBase::IsBackgroundHost() { + return false; +} + bool CefBrowserHostBase::IsFullscreen() { if (!CEF_CURRENTLY_ON_UIT()) { DCHECK(false) << "called on invalid thread"; diff --git a/libcef/browser/browser_host_base.h b/libcef/browser/browser_host_base.h index 39ef0cf29..62e4370e7 100644 --- a/libcef/browser/browser_host_base.h +++ b/libcef/browser/browser_host_base.h @@ -22,7 +22,11 @@ #include "base/observer_list.h" #include "base/synchronization/lock.h" +#include "cef/libcef/features/features.h" + +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) #include "extensions/common/mojom/view_type.mojom.h" +#endif namespace extensions { class Extension; @@ -99,9 +103,11 @@ struct CefBrowserCreateParams { // Browser settings. CefBrowserSettings settings; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Other browser that opened this DevTools browser. Will be nullptr for non- // DevTools browsers. Currently used with the alloy runtime only. CefRefPtr devtools_opener; +#endif // Request context to use when creating the browser. If nullptr the global // request context will be used. @@ -111,12 +117,14 @@ struct CefBrowserCreateParams { // CefRenderProcessHandler::OnBrowserCreated. CefRefPtr extra_info; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Used when explicitly creating the browser as an extension host via // ProcessManager::CreateBackgroundHost. Currently used with the alloy // runtime only. const extensions::Extension* extension = nullptr; extensions::mojom::ViewType extension_host_type = extensions::mojom::ViewType::kInvalid; +#endif }; // Base class for CefBrowserHost implementations. Includes functionality that is @@ -251,6 +259,8 @@ class CefBrowserHostBase : public CefBrowserHost, bool current_only) override; CefRefPtr GetVisibleNavigationEntry() override; void NotifyMoveOrResizeStarted() override; + CefRefPtr GetExtension() override; + bool IsBackgroundHost() override; bool IsFullscreen() override; void ExitFullscreen(bool will_cause_resize) override; bool IsRenderProcessUnresponsive() override; diff --git a/libcef/browser/browser_host_create.cc b/libcef/browser/browser_host_create.cc index e249bcf60..9db3fa3ee 100644 --- a/libcef/browser/browser_host_create.cc +++ b/libcef/browser/browser_host_create.cc @@ -154,9 +154,11 @@ CefRefPtr CefBrowserHost::CreateBrowserSync( // static bool CefBrowserCreateParams::IsChromeStyle(const CefWindowInfo* window_info) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) if (!cef::IsChromeRuntimeEnabled()) { return false; } +#endif if (!window_info) { return true; } @@ -167,9 +169,11 @@ bool CefBrowserCreateParams::IsChromeStyle(const CefWindowInfo* window_info) { } bool CefBrowserCreateParams::IsChromeStyle() const { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) if (!cef::IsChromeRuntimeEnabled()) { return false; } +#endif const bool chrome_style_via_window_info = IsChromeStyle(window_info.get()); @@ -206,7 +210,11 @@ void CefBrowserCreateParams::InitWindowInfo(CefWindowInfo* window_info, window_info->SetAsPopup(nullptr, CefString()); #endif - if (cef::IsChromeRuntimeEnabled() && opener->IsAlloyStyle()) { + if ( +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + cef::IsChromeRuntimeEnabled() && +#endif + opener->IsAlloyStyle()) { // Give the popup the same runtime style as the opener. window_info->runtime_style = CEF_RUNTIME_STYLE_ALLOY; } @@ -216,10 +224,12 @@ void CefBrowserCreateParams::MaybeSetWindowInfo( const CefWindowInfo& new_window_info, bool allow_alloy_style, bool allow_chrome_style) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) if (!cef::IsChromeRuntimeEnabled()) { // Chrome style is not supported wih the Alloy bootstrap. allow_chrome_style = false; } +#endif if (allow_chrome_style && new_window_info.windowless_rendering_enabled) { // Chrome style is not supported with windowles rendering. @@ -253,7 +263,11 @@ void CefBrowserCreateParams::MaybeSetWindowInfo( if (!is_chrome_style || chrome_child_window::HasParentHandle(new_window_info)) { window_info = std::make_unique(new_window_info); - if (cef::IsChromeRuntimeEnabled() && !allow_chrome_style) { + if ( +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + cef::IsChromeRuntimeEnabled() && +#endif + !allow_chrome_style) { // Only Alloy style is allowed. window_info->runtime_style = CEF_RUNTIME_STYLE_ALLOY; } else if (reset_style) { diff --git a/libcef/browser/browser_info_manager.cc b/libcef/browser/browser_info_manager.cc index 20f169523..9d4fb07e4 100644 --- a/libcef/browser/browser_info_manager.cc +++ b/libcef/browser/browser_info_manager.cc @@ -280,7 +280,9 @@ void CefBrowserInfoManager::WebContentsCreated( bool CefBrowserInfoManager::AddWebContents(content::WebContents* new_contents) { CEF_REQUIRE_UIT(); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) DCHECK(cef::IsChromeRuntimeEnabled()); +#endif // Pending popup information may be missing in cases where // chrome::AddWebContents is called directly from the Chrome UI (profile diff --git a/libcef/browser/browser_platform_delegate.cc b/libcef/browser/browser_platform_delegate.cc index b0619e464..684e22428 100644 --- a/libcef/browser/browser_platform_delegate.cc +++ b/libcef/browser/browser_platform_delegate.cc @@ -118,11 +118,13 @@ void CefBrowserPlatformDelegate::WebContentsDestroyed( web_contents_ = nullptr; } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool CefBrowserPlatformDelegate:: ShouldAllowRendererInitiatedCrossProcessNavigation( bool is_main_frame_navigation) { return true; } +#endif void CefBrowserPlatformDelegate::RenderViewCreated( content::RenderViewHost* render_view_host) { @@ -144,6 +146,7 @@ void CefBrowserPlatformDelegate::BrowserCreated(CefBrowserHostBase* browser) { browser_ = browser; } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) void CefBrowserPlatformDelegate::CreateExtensionHost( const extensions::Extension* extension, const GURL& url, @@ -156,6 +159,7 @@ extensions::ExtensionHost* CefBrowserPlatformDelegate::GetExtensionHost() DCHECK(false); return nullptr; } +#endif void CefBrowserPlatformDelegate::NotifyBrowserCreated() {} @@ -347,6 +351,7 @@ bool CefBrowserPlatformDelegate::HandleKeyboardEvent( return false; } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool CefBrowserPlatformDelegate::PreHandleGestureEvent( content::WebContents* source, const blink::WebGestureEvent& event) { @@ -357,6 +362,7 @@ bool CefBrowserPlatformDelegate::IsNeverComposited( content::WebContents* web_contents) { return false; } +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // static void CefBrowserPlatformDelegate::HandleExternalProtocol(const GURL& url) { diff --git a/libcef/browser/browser_platform_delegate.h b/libcef/browser/browser_platform_delegate.h index 41b9c46e0..fb3b42745 100644 --- a/libcef/browser/browser_platform_delegate.h +++ b/libcef/browser/browser_platform_delegate.h @@ -15,13 +15,17 @@ #include "include/views/cef_browser_view.h" #include "base/functional/callback_forward.h" -#include "extensions/common/mojom/view_type.mojom-forward.h" +#include "cef/libcef/features/features.h" #include "third_party/blink/public/common/page/drag_operation.h" #include "third_party/blink/public/mojom/drag/drag.mojom-forward.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h" #include "ui/base/window_open_disposition.h" +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "extensions/common/mojom/view_type.mojom-forward.h" +#endif + class GURL; namespace blink { @@ -48,10 +52,12 @@ class WebContents; class WebContentsView; } // namespace content +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) namespace extensions { class Extension; class ExtensionHost; } // namespace extensions +#endif namespace gfx { class ImageSkia; @@ -126,9 +132,11 @@ class CefBrowserPlatformDelegate { // BrowserDestroyed(). Will only be called a single time per instance. virtual void WebContentsDestroyed(content::WebContents* web_contents); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // See WebContentsDelegate documentation. virtual bool ShouldAllowRendererInitiatedCrossProcessNavigation( bool is_main_frame_navigation); +#endif // Called after the RenderViewHost is created. virtual void RenderViewCreated(content::RenderViewHost* render_view_host); @@ -141,6 +149,7 @@ class CefBrowserPlatformDelegate { // from this method. virtual void BrowserCreated(CefBrowserHostBase* browser); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Called from BrowserHost::Create. virtual void CreateExtensionHost(const extensions::Extension* extension, const GURL& url, @@ -148,6 +157,7 @@ class CefBrowserPlatformDelegate { // Returns the current extension host. virtual extensions::ExtensionHost* GetExtensionHost() const; +#endif // Send any notifications related to browser creation. Called after // BrowserCreated(). @@ -278,12 +288,14 @@ class CefBrowserPlatformDelegate { virtual bool HandleKeyboardEvent( const content::NativeWebKeyboardEvent& event); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // See WebContentsDelegate documentation. virtual bool PreHandleGestureEvent(content::WebContents* source, const blink::WebGestureEvent& event); // See WebContentsDelegate documentation. virtual bool IsNeverComposited(content::WebContents* web_contents); +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Invoke platform specific handling for the external protocol. static void HandleExternalProtocol(const GURL& url); diff --git a/libcef/browser/browser_platform_delegate_create.cc b/libcef/browser/browser_platform_delegate_create.cc index 218845cef..3edb4cf28 100644 --- a/libcef/browser/browser_platform_delegate_create.cc +++ b/libcef/browser/browser_platform_delegate_create.cc @@ -16,7 +16,6 @@ #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" #if BUILDFLAG(IS_WIN) @@ -32,6 +31,10 @@ #error A delegate implementation is not available for your platform. #endif +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "libcef/browser/extensions/browser_platform_delegate_background.h" +#endif + namespace { std::unique_ptr CreateNativeDelegate( @@ -109,6 +112,7 @@ std::unique_ptr CefBrowserPlatformDelegate::Create( return std::make_unique( std::move(native_delegate), static_cast(create_params.browser_view.get())); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) } else if (create_params.extension_host_type == extensions::mojom::ViewType::kExtensionBackgroundPage) { // Creating a background extension host without a window. @@ -116,6 +120,7 @@ std::unique_ptr CefBrowserPlatformDelegate::Create( CreateNativeDelegate(CefWindowInfo(), background_color); return std::make_unique( std::move(native_delegate)); +#endif } else if (create_params.window_info) { std::unique_ptr native_delegate = CreateNativeDelegate(*create_params.window_info, background_color); diff --git a/libcef/browser/chrome/chrome_browser_delegate.cc b/libcef/browser/chrome/chrome_browser_delegate.cc index c7d159430..f97c0d4f6 100644 --- a/libcef/browser/chrome/chrome_browser_delegate.cc +++ b/libcef/browser/chrome/chrome_browser_delegate.cc @@ -780,9 +780,11 @@ std::unique_ptr BrowserDelegate::Create( Browser* browser, scoped_refptr cef_params, const Browser* opener) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) if (!cef::IsChromeRuntimeEnabled()) { return nullptr; } +#endif CefBrowserCreateParams create_params; diff --git a/libcef/browser/chrome/chrome_browser_host_impl.cc b/libcef/browser/chrome/chrome_browser_host_impl.cc index e0aaee8e7..f0c875f7f 100644 --- a/libcef/browser/chrome/chrome_browser_host_impl.cc +++ b/libcef/browser/chrome/chrome_browser_host_impl.cc @@ -68,35 +68,45 @@ CefRefPtr ChromeBrowserHostImpl::FromBaseChecked( // static CefRefPtr ChromeBrowserHostImpl::GetBrowserForHost( const content::RenderViewHost* host) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) REQUIRE_CHROME_RUNTIME(); +#endif return FromBaseChecked(CefBrowserHostBase::GetBrowserForHost(host)); } // static CefRefPtr ChromeBrowserHostImpl::GetBrowserForHost( const content::RenderFrameHost* host) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) REQUIRE_CHROME_RUNTIME(); +#endif return FromBaseChecked(CefBrowserHostBase::GetBrowserForHost(host)); } // static CefRefPtr ChromeBrowserHostImpl::GetBrowserForContents( const content::WebContents* contents) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) REQUIRE_CHROME_RUNTIME(); +#endif return FromBaseChecked(CefBrowserHostBase::GetBrowserForContents(contents)); } // static CefRefPtr ChromeBrowserHostImpl::GetBrowserForGlobalId( const content::GlobalRenderFrameHostId& global_id) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) REQUIRE_CHROME_RUNTIME(); +#endif return FromBaseChecked(CefBrowserHostBase::GetBrowserForGlobalId(global_id)); } // static CefRefPtr ChromeBrowserHostImpl::GetBrowserForBrowser( const Browser* browser) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) REQUIRE_CHROME_RUNTIME(); +#endif // Return the ChromeBrowserHostImpl that is currently active. // Views-hosted Browsers will contain a single ChromeBrowserHostImpl. // Otherwise, there will be a ChromeBrowserHostImpl per Tab/WebContents. @@ -317,14 +327,6 @@ void ChromeBrowserHostImpl::SetAutoResizeEnabled(bool enabled, NOTIMPLEMENTED(); } -CefRefPtr ChromeBrowserHostImpl::GetExtension() { - return nullptr; -} - -bool ChromeBrowserHostImpl::IsBackgroundHost() { - return false; -} - bool ChromeBrowserHostImpl::CanExecuteChromeCommand(int command_id) { // Verify that this method is being called on the UI thread. if (!CEF_CURRENTLY_ON_UIT()) { diff --git a/libcef/browser/chrome/chrome_browser_host_impl.h b/libcef/browser/chrome/chrome_browser_host_impl.h index 74500187b..0bc329e63 100644 --- a/libcef/browser/chrome/chrome_browser_host_impl.h +++ b/libcef/browser/chrome/chrome_browser_host_impl.h @@ -114,8 +114,6 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase { void SetAutoResizeEnabled(bool enabled, const CefSize& min_size, const CefSize& max_size) override; - CefRefPtr GetExtension() override; - bool IsBackgroundHost() override; bool CanExecuteChromeCommand(int command_id) override; void ExecuteChromeCommand(int command_id, cef_window_open_disposition_t disposition) override; diff --git a/libcef/browser/chrome/chrome_content_browser_client_cef.cc b/libcef/browser/chrome/chrome_content_browser_client_cef.cc index 4d35ee158..6710b2c04 100644 --- a/libcef/browser/chrome/chrome_content_browser_client_cef.cc +++ b/libcef/browser/chrome/chrome_content_browser_client_cef.cc @@ -28,6 +28,7 @@ #include "base/command_line.h" #include "base/path_service.h" +#include "cef/libcef/features/features.h" #include "chrome/browser/chrome_browser_main.h" #include "chrome/browser/net/system_network_context_manager.h" #include "chrome/browser/profiles/profile.h" @@ -102,8 +103,10 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches( ChromeContentBrowserClient::AppendExtraCommandLineSwitches(command_line, child_process_id); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Necessary to launch sub-processes in the correct mode. command_line->AppendSwitch(switches::kEnableChromeRuntime); +#endif // Necessary to populate DIR_USER_DATA in sub-processes. // See resource_util.cc GetUserDataPath. diff --git a/libcef/browser/devtools/devtools_window_runner_create.cc b/libcef/browser/devtools/devtools_window_runner_create.cc index b6658cb8a..8fb6f3455 100644 --- a/libcef/browser/devtools/devtools_window_runner_create.cc +++ b/libcef/browser/devtools/devtools_window_runner_create.cc @@ -4,14 +4,19 @@ #include "libcef/browser/devtools/devtools_window_runner.h" -#include "libcef/browser/alloy/devtools/alloy_devtools_window_runner.h" #include "libcef/browser/chrome/chrome_devtools_window_runner.h" #include "libcef/features/runtime.h" +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "libcef/browser/alloy/devtools/alloy_devtools_window_runner.h" +#endif + // static std::unique_ptr CefDevToolsWindowRunner::Create() { - if (cef::IsChromeRuntimeEnabled()) { - return std::make_unique(); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (cef::IsAlloyRuntimeEnabled()) { + return std::make_unique(); } - return std::make_unique(); +#endif + return std::make_unique(); } diff --git a/libcef/browser/download_manager_delegate.cc b/libcef/browser/download_manager_delegate.cc index 6801ba8f5..f69086d49 100644 --- a/libcef/browser/download_manager_delegate.cc +++ b/libcef/browser/download_manager_delegate.cc @@ -12,7 +12,9 @@ namespace cef { // static std::unique_ptr DownloadManagerDelegate::Create( content::DownloadManager* download_manager) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) REQUIRE_CHROME_RUNTIME(); +#endif return std::make_unique( download_manager, /*alloy_bootstrap=*/false); } diff --git a/libcef/browser/extensions/browser_extensions_util.cc b/libcef/browser/extensions/browser_extensions_util.cc index 661fb9153..32c43295e 100644 --- a/libcef/browser/extensions/browser_extensions_util.cc +++ b/libcef/browser/extensions/browser_extensions_util.cc @@ -4,20 +4,10 @@ #include "libcef/browser/extensions/browser_extensions_util.h" -#include "libcef/browser/alloy/alloy_browser_host_impl.h" -#include "libcef/browser/browser_context.h" -#include "libcef/browser/browser_info_manager.h" -#include "libcef/browser/thread_util.h" -#include "libcef/common/extensions/extensions_util.h" -#include "libcef/features/runtime_checks.h" - #include "chrome/browser/browser_process.h" #include "chrome/browser/printing/print_preview_dialog_controller.h" #include "content/browser/browser_plugin/browser_plugin_guest.h" #include "content/browser/web_contents/web_contents_impl.h" -#include "content/public/browser/browser_context.h" -#include "content/public/browser/browser_plugin_guest_manager.h" -#include "extensions/browser/extension_registry.h" namespace extensions { @@ -73,48 +63,4 @@ bool IsPrintPreviewDialog(const content::WebContents* web_contents) { return !!GetInitiatorForPrintPreviewDialog(web_contents); } -CefRefPtr GetBrowserForTabId( - int tab_id, - content::BrowserContext* browser_context) { - REQUIRE_ALLOY_RUNTIME(); - CEF_REQUIRE_UIT(); - DCHECK(browser_context); - if (tab_id < 0 || !browser_context) { - return nullptr; - } - - auto cef_browser_context = - CefBrowserContext::FromBrowserContext(browser_context); - - for (const auto& browser_info : - CefBrowserInfoManager::GetInstance()->GetBrowserInfoList()) { - auto current_browser = - AlloyBrowserHostImpl::FromBaseChecked(browser_info->browser()); - if (current_browser && current_browser->GetIdentifier() == tab_id) { - // Make sure we're operating in the same CefBrowserContext. - if (CefBrowserContext::FromBrowserContext( - current_browser->GetBrowserContext()) == cef_browser_context) { - return current_browser; - } else { - LOG(WARNING) << "Browser with tabId " << tab_id - << " cannot be accessed because is uses a different " - "CefRequestContext"; - break; - } - } - } - - return nullptr; -} - -const Extension* GetExtensionForUrl(content::BrowserContext* browser_context, - const GURL& url) { - ExtensionRegistry* registry = ExtensionRegistry::Get(browser_context); - if (!registry) { - return nullptr; - } - std::string extension_id = url.host(); - return registry->enabled_extensions().GetByID(extension_id); -} - } // namespace extensions diff --git a/libcef/browser/extensions/browser_extensions_util.h b/libcef/browser/extensions/browser_extensions_util.h index eeb2abf51..693766d48 100644 --- a/libcef/browser/extensions/browser_extensions_util.h +++ b/libcef/browser/extensions/browser_extensions_util.h @@ -5,23 +5,12 @@ #ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_ #define CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_ -#include - -#include "include/internal/cef_ptr.h" - -#include "url/gurl.h" - namespace content { -class BrowserContext; class WebContents; } // namespace content -class AlloyBrowserHostImpl; - namespace extensions { -class Extension; - // Returns the WebContents that owns the specified |guest|, if any. content::WebContents* GetOwnerForGuestContents( const content::WebContents* guest); @@ -30,18 +19,6 @@ content::WebContents* GetOwnerForGuestContents( bool IsBrowserPluginGuest(const content::WebContents* web_contents); bool IsPrintPreviewDialog(const content::WebContents* web_contents); -// Returns the browser matching |tab_id| and |browser_context|. Returns false if -// |tab_id| is < 0 or a matching browser cannot be found within -// |browser_context|. Similar in concept to ExtensionTabUtil::GetTabById. -CefRefPtr GetBrowserForTabId( - int tab_id, - content::BrowserContext* browser_context); - -// Returns the extension associated with |url| in |profile|. Returns nullptr -// if the extension does not exist. -const Extension* GetExtensionForUrl(content::BrowserContext* browser_context, - const GURL& url); - } // namespace extensions #endif // CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_ diff --git a/libcef/browser/extensions/extension_function_details.cc b/libcef/browser/extensions/extension_function_details.cc index 302acb524..caba29878 100644 --- a/libcef/browser/extensions/extension_function_details.cc +++ b/libcef/browser/extensions/extension_function_details.cc @@ -6,7 +6,9 @@ #include +#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/browser_context.h" +#include "libcef/browser/browser_info_manager.h" #include "libcef/browser/extensions/browser_extensions_util.h" #include "libcef/browser/extensions/extension_system.h" #include "libcef/browser/thread_util.h" @@ -135,6 +137,39 @@ class CefGetExtensionLoadFileCallbackImpl IMPLEMENT_REFCOUNTING(CefGetExtensionLoadFileCallbackImpl); }; +CefRefPtr GetBrowserForTabId( + int tab_id, + content::BrowserContext* browser_context) { + CEF_REQUIRE_UIT(); + DCHECK(browser_context); + if (tab_id < 0 || !browser_context) { + return nullptr; + } + + auto cef_browser_context = + CefBrowserContext::FromBrowserContext(browser_context); + + for (const auto& browser_info : + CefBrowserInfoManager::GetInstance()->GetBrowserInfoList()) { + auto current_browser = + AlloyBrowserHostImpl::FromBaseChecked(browser_info->browser()); + if (current_browser && current_browser->GetIdentifier() == tab_id) { + // Make sure we're operating in the same CefBrowserContext. + if (CefBrowserContext::FromBrowserContext( + current_browser->GetBrowserContext()) == cef_browser_context) { + return current_browser; + } else { + LOG(WARNING) << "Browser with tabId " << tab_id + << " cannot be accessed because is uses a different " + "CefRequestContext"; + break; + } + } + } + + return nullptr; +} + } // namespace CefExtensionFunctionDetails::CefExtensionFunctionDetails( diff --git a/libcef/browser/iothread_state.cc b/libcef/browser/iothread_state.cc index 4b4d3b169..2b39b24a0 100644 --- a/libcef/browser/iothread_state.cc +++ b/libcef/browser/iothread_state.cc @@ -4,7 +4,6 @@ #include "libcef/browser/iothread_state.h" -#include "libcef/browser/net/scheme_handler.h" #include "libcef/browser/thread_util.h" #include "libcef/common/net/scheme_registration.h" @@ -15,13 +14,20 @@ #include "content/browser/resource_context_impl.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/global_routing_id.h" +#include "url/gurl.h" + +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "libcef/browser/net/scheme_handler.h" +#endif CefIOThreadState::CefIOThreadState() { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Using base::Unretained() is safe because both this callback and possible // deletion of |this| will execute on the IO thread, and this callback will // be executed first. CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefIOThreadState::InitOnIOThread, base::Unretained(this))); +#endif } CefIOThreadState::~CefIOThreadState() { @@ -83,8 +89,10 @@ void CefIOThreadState::ClearSchemeHandlerFactories() { scheme_handler_factory_map_.clear(); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Restore the default internal handlers. scheme::RegisterInternalHandlers(this); +#endif } CefRefPtr CefIOThreadState::GetSchemeHandlerFactory( @@ -121,9 +129,11 @@ CefRefPtr CefIOThreadState::GetSchemeHandlerFactory( return nullptr; } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) void CefIOThreadState::InitOnIOThread() { CEF_REQUIRE_IOT(); // Add the default internal handlers. scheme::RegisterInternalHandlers(this); } +#endif diff --git a/libcef/browser/iothread_state.h b/libcef/browser/iothread_state.h index 71457fd5d..a9ee0bea0 100644 --- a/libcef/browser/iothread_state.h +++ b/libcef/browser/iothread_state.h @@ -9,9 +9,9 @@ #include "include/cef_request_context.h" #include "include/cef_request_context_handler.h" #include "include/cef_scheme.h" - #include "libcef/browser/request_context_handler_map.h" +#include "cef/libcef/features/features.h" #include "content/public/browser/browser_thread.h" namespace content { @@ -54,7 +54,9 @@ class CefIOThreadState : public base::RefCountedThreadSafe< ~CefIOThreadState(); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) void InitOnIOThread(); +#endif // Map IDs to CefRequestContextHandler objects. CefRequestContextHandlerMap handler_map_; diff --git a/libcef/browser/main_runner.cc b/libcef/browser/main_runner.cc index a30a26a99..8d8f68953 100644 --- a/libcef/browser/main_runner.cc +++ b/libcef/browser/main_runner.cc @@ -7,7 +7,6 @@ #include "libcef/browser/browser_message_loop.h" #include "libcef/browser/thread_util.h" -#include "libcef/common/alloy/alloy_main_runner_delegate.h" #include "libcef/common/cef_switches.h" #include "libcef/common/chrome/chrome_main_runner_delegate.h" #include "libcef/features/runtime.h" @@ -47,29 +46,39 @@ #include "sandbox/win/src/sandbox_types.h" #endif +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "libcef/common/alloy/alloy_main_runner_delegate.h" +#endif + namespace { enum class RuntimeType { UNINITIALIZED, +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) ALLOY, +#endif CHROME, }; RuntimeType g_runtime_type = RuntimeType::UNINITIALIZED; std::unique_ptr MakeDelegate( +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) RuntimeType type, +#endif CefMainRunnerHandler* runner, CefSettings* settings, CefRefPtr application) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) if (type == RuntimeType::ALLOY) { g_runtime_type = RuntimeType::ALLOY; return std::make_unique(runner, settings, application); - } else { - g_runtime_type = RuntimeType::CHROME; - return std::make_unique(runner, settings, - application); } +#endif + + g_runtime_type = RuntimeType::CHROME; + return std::make_unique(runner, settings, + application); } // Based on components/crash/core/app/run_as_crashpad_handler_win.cc @@ -258,10 +267,18 @@ bool CefMainRunner::Initialize(CefSettings* settings, void* windows_sandbox_info, bool* initialized, base::OnceClosure context_initialized) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + LOG_IF(WARNING, !settings->chrome_runtime) + << "Alloy bootstrap is deprecated and will be removed in ~M127. See " + "https://github.com/chromiumembedded/cef/issues/3685"; +#endif + DCHECK(!main_delegate_); main_delegate_ = MakeDelegate( - settings->chrome_runtime ? RuntimeType::CHROME : RuntimeType::ALLOY, this, - settings, application); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + settings->chrome_runtime ? RuntimeType::CHROME : RuntimeType::ALLOY, +#endif + this, settings, application); exit_code_ = ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox); @@ -373,11 +390,13 @@ int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args, return -1; } - auto runtime_type = command_line.HasSwitch(switches::kEnableChromeRuntime) - ? RuntimeType::CHROME - : RuntimeType::ALLOY; - auto main_delegate = MakeDelegate(runtime_type, /*runner=*/nullptr, - /*settings=*/nullptr, application); + auto main_delegate = MakeDelegate( +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + command_line.HasSwitch(switches::kEnableChromeRuntime) + ? RuntimeType::CHROME + : RuntimeType::ALLOY, +#endif + /*runner=*/nullptr, /*settings=*/nullptr, application); main_delegate->BeforeExecuteProcess(args); int result; @@ -584,9 +603,11 @@ void CefMainRunner::FinishShutdownOnUIThread() { // From libcef/features/runtime.h: namespace cef { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool IsAlloyRuntimeEnabled() { return g_runtime_type == RuntimeType::ALLOY; } +#endif bool IsChromeRuntimeEnabled() { return g_runtime_type == RuntimeType::CHROME; diff --git a/libcef/browser/media_access_query.cc b/libcef/browser/media_access_query.cc index b0c84894d..ea656978a 100644 --- a/libcef/browser/media_access_query.cc +++ b/libcef/browser/media_access_query.cc @@ -6,18 +6,89 @@ #include "include/cef_permission_handler.h" #include "libcef/browser/browser_host_base.h" -#include "libcef/browser/media_capture_devices_dispatcher.h" #include "libcef/browser/media_stream_registrar.h" +#include "libcef/browser/thread_util.h" #include "libcef/common/cef_switches.h" +#include "libcef/features/runtime.h" #include "base/command_line.h" #include "base/functional/callback_helpers.h" +#include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" #include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h" +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "libcef/browser/media_capture_devices_dispatcher.h" +#endif + namespace media_access_query { namespace { +const blink::MediaStreamDevice* FindDefaultDeviceWithId( + const blink::MediaStreamDevices& devices, + const std::string& device_id) { + if (devices.empty()) { + return nullptr; + } + + blink::MediaStreamDevices::const_iterator iter = devices.begin(); + for (; iter != devices.end(); ++iter) { + if (iter->id == device_id) { + return &(*iter); + } + } + + return &(*devices.begin()); +} + +void GetRequestedDeviceChrome(const std::string& requested_device_id, + bool audio, + bool video, + blink::MediaStreamDevices* devices) { + CEF_REQUIRE_UIT(); + DCHECK(audio || video); + + auto* dispatcher = MediaCaptureDevicesDispatcher::GetInstance(); + + if (audio) { + const blink::MediaStreamDevices& audio_devices = + dispatcher->GetAudioCaptureDevices(); + const blink::MediaStreamDevice* const device = + FindDefaultDeviceWithId(audio_devices, requested_device_id); + if (device) { + devices->push_back(*device); + } + } + if (video) { + const blink::MediaStreamDevices& video_devices = + dispatcher->GetVideoCaptureDevices(); + const blink::MediaStreamDevice* const device = + FindDefaultDeviceWithId(video_devices, requested_device_id); + if (device) { + devices->push_back(*device); + } + } +} + +// Helper for picking the device that was requested for an OpenDevice request. +// If the device requested is not available it will revert to using the first +// available one instead or will return an empty list if no devices of the +// requested kind are present. Called on the UI thread. +void GetRequestedDevice(const std::string& requested_device_id, + bool audio, + bool video, + blink::MediaStreamDevices* devices) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (cef::IsAlloyRuntimeEnabled()) { + CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice( + requested_device_id, audio, video, devices); + return; + } +#endif + + GetRequestedDeviceChrome(requested_device_id, audio, video, devices); +} + class CefMediaAccessQuery { public: using CallbackType = content::MediaResponseCallback; @@ -136,9 +207,8 @@ class CefMediaAccessQuery { !request_.requested_audio_device_ids.front().empty()) { // Pick the desired device or fall back to the first available of the // given type. - CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice( - request_.requested_audio_device_ids.front(), true, false, - &audio_devices); + GetRequestedDevice(request_.requested_audio_device_ids.front(), true, + false, &audio_devices); } if (device_video_requested() && @@ -146,9 +216,8 @@ class CefMediaAccessQuery { !request_.requested_video_device_ids.front().empty()) { // Pick the desired device or fall back to the first available of the // given type. - CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice( - request_.requested_video_device_ids.front(), false, true, - &video_devices); + GetRequestedDevice(request_.requested_video_device_ids.front(), false, + true, &video_devices); } if (desktop_audio_requested()) { diff --git a/libcef/browser/net/chrome_scheme_handler.cc b/libcef/browser/net/chrome_scheme_handler.cc index facd69fe1..95644a8d4 100644 --- a/libcef/browser/net/chrome_scheme_handler.cc +++ b/libcef/browser/net/chrome_scheme_handler.cc @@ -13,7 +13,6 @@ #include "include/cef_version.h" #include "libcef/browser/extensions/chrome_api_registration.h" #include "libcef/browser/frame_host_impl.h" -#include "libcef/browser/net/internal_scheme_handler.h" #include "libcef/browser/thread_util.h" #include "libcef/common/app_manager.h" #include "libcef/features/runtime.h" @@ -23,6 +22,7 @@ #include "base/lazy_instance.h" #include "base/logging.h" #include "base/memory/ptr_util.h" +#include "base/memory/ref_counted_memory.h" #include "base/path_service.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" @@ -163,6 +163,7 @@ bool IsUnlistedHost(const std::string& host) { return false; } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Returns true if a host is WebUI and should be allowed to load. bool IsAllowedWebUIHost(const std::string& host) { // Chrome runtime allows all WebUI hosts. @@ -179,6 +180,7 @@ bool IsAllowedWebUIHost(const std::string& host) { return false; } +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Additional debug URLs that are not included in chrome::kChromeDebugURLs. const char* kAllowedDebugURLs[] = { @@ -294,63 +296,65 @@ class TemplateParser { bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) { *mime_type = "text/html"; - if (cef::IsChromeRuntimeEnabled()) { - // Redirect to the Chrome documentation. - *output = - "\n" - "\n" - "\n"; - return true; - } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (cef::IsAlloyRuntimeEnabled()) { + static const char kDevURL[] = "https://developer.chrome.com/extensions/"; - static const char kDevURL[] = "https://developer.chrome.com/extensions/"; + std::string html = + "\nExtensions Support\n" + "

Supported Chrome Extensions " + "APIs

\nFollow issue #1947 for development progress.\n
    \n"; - std::string html = - "\nExtensions Support\n" - "

    Supported Chrome Extensions " - "APIs

    \nFollow issue #1947 for development progress.\n
      \n"; - - bool has_top_level_name = false; - for (size_t i = 0; kSupportedAPIs[i] != nullptr; ++i) { - const std::string& api_name = kSupportedAPIs[i]; - if (api_name.find("Private") != std::string::npos) { - // Don't list private APIs. - continue; - } - - const size_t dot_pos = api_name.find('.'); - if (dot_pos == std::string::npos) { - if (has_top_level_name) { - // End the previous top-level API entry. - html += "
    \n"; - } else { - has_top_level_name = true; + bool has_top_level_name = false; + for (size_t i = 0; kSupportedAPIs[i] != nullptr; ++i) { + const std::string& api_name = kSupportedAPIs[i]; + if (api_name.find("Private") != std::string::npos) { + // Don't list private APIs. + continue; } - // Start a new top-level API entry. - html += "
  • " + api_name + "
      \n"; - } else { - // Function name. - const std::string& group_name = api_name.substr(0, dot_pos); - const std::string& function_name = api_name.substr(dot_pos + 1); - html += "\t
    • " + api_name + - "
    • \n"; + const size_t dot_pos = api_name.find('.'); + if (dot_pos == std::string::npos) { + if (has_top_level_name) { + // End the previous top-level API entry. + html += "
  • \n"; + } else { + has_top_level_name = true; + } + + // Start a new top-level API entry. + html += "
  • " + api_name + "
      \n"; + } else { + // Function name. + const std::string& group_name = api_name.substr(0, dot_pos); + const std::string& function_name = api_name.substr(dot_pos + 1); + html += "\t
    • " + api_name + + "
    • \n"; + } } + + if (has_top_level_name) { + // End the last top-level API entry. + html += "
  • \n"; + } + + html += "
\n\n"; + + *output = html; + return true; } +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) - if (has_top_level_name) { - // End the last top-level API entry. - html += "\n"; - } - - html += "\n\n"; - - *output = html; + // Redirect to the Chrome documentation. + *output = + "\n" + "\n" + "\n"; return true; } @@ -534,6 +538,7 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory { // Returns true if WebUI is allowed to handle the specified |url|. static bool AllowWebUIForURL(const GURL& url) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) if (cef::IsChromeRuntimeEnabled() && url.SchemeIs(content::kChromeDevToolsScheme)) { return DevToolsUIBindings::IsValidFrontendURL(url); @@ -549,6 +554,18 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory { } return false; +#else // !BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (url.SchemeIs(content::kChromeDevToolsScheme)) { + return DevToolsUIBindings::IsValidFrontendURL(url); + } + + if (!url.SchemeIs(content::kChromeUIScheme) && + !url.SchemeIs(content::kChromeUIUntrustedScheme)) { + return false; + } + + return true; +#endif // ! BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) } // Returns true if WebUI is allowed to make network requests. @@ -650,6 +667,7 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory { } static void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // For Chrome runtime this is registered in // ChromeContentBrowserClient::BrowserURLHandlerCreated(). if (cef::IsAlloyRuntimeEnabled()) { @@ -657,6 +675,7 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory { handler->AddHandlerPair(&HandleChromeAboutAndChromeSyncRewrite, content::BrowserURLHandler::null_handler()); } +#endif // chrome: & friends. For Chrome runtime the default registration is // disabled is ChromeContentBrowserClient::BrowserURLHandlerCreated(). diff --git a/libcef/browser/permission_prompt.cc b/libcef/browser/permission_prompt.cc index e9af2e862..c2dbdbea9 100644 --- a/libcef/browser/permission_prompt.cc +++ b/libcef/browser/permission_prompt.cc @@ -254,7 +254,11 @@ std::unique_ptr CreatePermissionPromptImpl( bool* default_handling) { CEF_REQUIRE_UIT(); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool is_alloy_style = cef::IsAlloyRuntimeEnabled(); +#else + bool is_alloy_style = false; +#endif if (auto browser = CefBrowserHostBase::GetBrowserForContents(web_contents)) { is_alloy_style = browser->IsAlloyStyle(); diff --git a/libcef/browser/prefs/browser_prefs.cc b/libcef/browser/prefs/browser_prefs.cc index 45034ce66..7589a990c 100644 --- a/libcef/browser/prefs/browser_prefs.cc +++ b/libcef/browser/prefs/browser_prefs.cc @@ -6,8 +6,15 @@ #include "libcef/browser/browser_context.h" #include "libcef/browser/context.h" -#include "libcef/browser/media_capture_devices_dispatcher.h" #include "libcef/browser/prefs/pref_registrar.h" + +#include "chrome/browser/profiles/profile.h" +#include "components/language/core/browser/pref_names.h" +#include "components/prefs/pref_registry_simple.h" +#include "components/prefs/pref_service.h" + +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "libcef/browser/media_capture_devices_dispatcher.h" #include "libcef/browser/prefs/pref_store.h" #include "libcef/browser/prefs/renderer_prefs.h" #include "libcef/common/cef_switches.h" @@ -26,7 +33,6 @@ #include "chrome/browser/prefs/chrome_command_line_pref_store.h" #include "chrome/browser/preloading/preloading_prefs.h" #include "chrome/browser/printing/print_preview_sticky_settings.h" -#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_key.h" #include "chrome/browser/ssl/ssl_config_service_manager.h" #include "chrome/browser/supervised_user/supervised_user_settings_service_factory.h" @@ -47,7 +53,6 @@ #include "components/flags_ui/pref_service_flags_storage.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/language/core/browser/language_prefs.h" -#include "components/language/core/browser/pref_names.h" #include "components/media_device_salt/media_device_id_salt.h" #include "components/permissions/permission_actions_history.h" #include "components/permissions/permission_hats_trigger_helper.h" @@ -55,8 +60,6 @@ #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/json_pref_store.h" #include "components/prefs/pref_filter.h" -#include "components/prefs/pref_registry_simple.h" -#include "components/prefs/pref_service.h" #include "components/privacy_sandbox/privacy_sandbox_prefs.h" #include "components/proxy_config/pref_proxy_config_tracker_impl.h" #include "components/proxy_config/proxy_config_dictionary.h" @@ -79,6 +82,7 @@ #if BUILDFLAG(IS_WIN) #include "components/os_crypt/sync/os_crypt.h" #endif +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) namespace browser_prefs { @@ -108,10 +112,12 @@ std::string GetAcceptLanguageListSetting(Profile* profile) { return std::string(); } -} // namespace +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +constexpr char kUserPrefsFileName[] = "UserPrefs.json"; +constexpr char kLocalPrefsFileName[] = "LocalPrefs.json"; +#endif -const char kUserPrefsFileName[] = "UserPrefs.json"; -const char kLocalPrefsFileName[] = "LocalPrefs.json"; +} // namespace void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { pref_registrar::RegisterCustomPrefs(CEF_PREFERENCES_TYPE_GLOBAL, registry); @@ -122,6 +128,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { registry); } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) std::unique_ptr CreatePrefService(Profile* profile, const base::FilePath& cache_path, bool persist_user_preferences) { @@ -349,6 +356,7 @@ std::unique_ptr CreatePrefService(Profile* profile, // Build the PrefService that manages the PrefRegistry and PrefStores. return factory.CreateSyncable(registry.get()); } +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) std::string GetAcceptLanguageList(Profile* profile) { // Always prefer to the CEF settings configuration, if specified. diff --git a/libcef/browser/prefs/browser_prefs.h b/libcef/browser/prefs/browser_prefs.h index baad58794..00df88b05 100644 --- a/libcef/browser/prefs/browser_prefs.h +++ b/libcef/browser/prefs/browser_prefs.h @@ -6,30 +6,36 @@ #define CEF_LIBCEF_BROWSER_PREFS_BROWSER_PREFS_H_ #include +#include +#include "cef/libcef/features/features.h" + +class PrefRegistrySimple; +class Profile; + +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) namespace base { class FilePath; } -class PrefRegistrySimple; class PrefService; -class Profile; +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) namespace browser_prefs { -// Name for the user prefs JSON file. -extern const char kUserPrefsFileName[]; - // Register preferences specific to CEF. +// Called from chrome/browser/prefs/browser_prefs.cc void RegisterLocalStatePrefs(PrefRegistrySimple* registry); void RegisterProfilePrefs(PrefRegistrySimple* registry); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Create the PrefService used to manage pref registration and storage. // |profile| will be nullptr for the system-level PrefService. Used with the // Alloy runtime only. std::unique_ptr CreatePrefService(Profile* profile, const base::FilePath& cache_path, bool persist_user_preferences); +#endif // Returns the value for populating the accept-language HTTP request header. // |browser_context| and/or |browser| may be nullptr. If |expand| is true then diff --git a/libcef/browser/prefs/renderer_prefs.cc b/libcef/browser/prefs/renderer_prefs.cc index c675e49e6..65d86c270 100644 --- a/libcef/browser/prefs/renderer_prefs.cc +++ b/libcef/browser/prefs/renderer_prefs.cc @@ -4,15 +4,18 @@ #include "libcef/browser/prefs/renderer_prefs.h" -#include +#include "libcef/common/cef_switches.h" +#include "base/command_line.h" +#include "content/public/common/content_switches.h" +#include "third_party/blink/public/common/web_preferences/web_preferences.h" + +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) #include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/context.h" -#include "libcef/common/cef_switches.h" #include "libcef/common/extensions/extensions_util.h" #include "libcef/features/runtime_checks.h" -#include "base/command_line.h" #include "base/i18n/character_encoding.h" #include "base/memory/ptr_util.h" #include "base/values.h" @@ -41,12 +44,14 @@ #include "extensions/common/constants.h" #include "media/media_buildflags.h" #include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h" -#include "third_party/blink/public/common/web_preferences/web_preferences.h" #include "ui/color/color_provider_key.h" #include "ui/native_theme/native_theme.h" +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) namespace renderer_prefs { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + namespace { // Chrome preferences. @@ -266,6 +271,8 @@ void SetCommandLinePrefDefaults(CommandLinePrefStore* prefs) { } } +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + void SetDefaultPrefs(blink::web_pref::WebPreferences& web) { const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); @@ -358,6 +365,8 @@ void SetCefPrefs(const CefBrowserSettings& cef, } } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, const std::string& locale) { PrefsTabHelper::RegisterProfilePrefs(registry, locale); @@ -457,4 +466,6 @@ bool PopulateWebPreferencesAfterNavigation( web_contents, native_theme); } +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } // namespace renderer_prefs diff --git a/libcef/browser/prefs/renderer_prefs.h b/libcef/browser/prefs/renderer_prefs.h index 096aff9ca..d07d6e583 100644 --- a/libcef/browser/prefs/renderer_prefs.h +++ b/libcef/browser/prefs/renderer_prefs.h @@ -6,16 +6,21 @@ #define CEF_LIBCEF_BROWSER_PREFS_RENDERER_PREFS_H_ #pragma once +#include + #include "include/internal/cef_types_wrappers.h" -#include "third_party/skia/include/core/SkColor.h" +#include "cef/libcef/features/features.h" -class CommandLinePrefStore; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "third_party/skia/include/core/SkColor.h" +#endif namespace blink::web_pref { struct WebPreferences; } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) namespace content { class RenderViewHost; class WebContents; @@ -25,8 +30,12 @@ namespace user_prefs { class PrefRegistrySyncable; } +class CommandLinePrefStore; +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + namespace renderer_prefs { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Register additional renderer-related preferences. void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, const std::string& locale); @@ -35,6 +44,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, // available via the PrefService. Chromium command-line flags should not exist // for these preferences. void SetCommandLinePrefDefaults(CommandLinePrefStore* prefs); +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Set default values based on CEF command-line flags for preferences that are // not available via the PrefService. Chromium command-line flags should not @@ -45,6 +55,7 @@ void SetDefaultPrefs(blink::web_pref::WebPreferences& web); void SetCefPrefs(const CefBrowserSettings& cef, blink::web_pref::WebPreferences& web); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Populate WebPreferences based on a combination of command-line values, // PrefService and CefBrowserSettings. void PopulateWebPreferences(content::RenderViewHost* rvh, @@ -53,6 +64,7 @@ void PopulateWebPreferences(content::RenderViewHost* rvh, bool PopulateWebPreferencesAfterNavigation( content::WebContents* web_contents, blink::web_pref::WebPreferences& web); +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) } // namespace renderer_prefs diff --git a/libcef/browser/request_context_impl.cc b/libcef/browser/request_context_impl.cc index 15cdc5b7a..7726d6d95 100644 --- a/libcef/browser/request_context_impl.cc +++ b/libcef/browser/request_context_impl.cc @@ -490,6 +490,7 @@ void CefRequestContextImpl::LoadExtension( const CefString& root_directory, CefRefPtr manifest, CefRefPtr handler) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) GetBrowserContext(content::GetUIThreadTaskRunner({}), base::BindOnce( [](const CefString& root_directory, @@ -505,20 +506,34 @@ void CefRequestContextImpl::LoadExtension( }, root_directory, manifest, handler, CefRefPtr(this))); +#else + NOTIMPLEMENTED(); +#endif } bool CefRequestContextImpl::DidLoadExtension(const CefString& extension_id) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) CefRefPtr extension = GetExtension(extension_id); // GetLoaderContext() will return NULL for internal extensions. return extension && IsSame(extension->GetLoaderContext()); +#else + NOTIMPLEMENTED(); + return false; +#endif } bool CefRequestContextImpl::HasExtension(const CefString& extension_id) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) return !!GetExtension(extension_id); +#else + NOTIMPLEMENTED(); + return false; +#endif } bool CefRequestContextImpl::GetExtensions( std::vector& extension_ids) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) extension_ids.clear(); if (!VerifyBrowserContext()) { @@ -526,15 +541,24 @@ bool CefRequestContextImpl::GetExtensions( } return browser_context()->GetExtensions(extension_ids); +#else + NOTIMPLEMENTED(); + return false; +#endif } CefRefPtr CefRequestContextImpl::GetExtension( const CefString& extension_id) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) if (!VerifyBrowserContext()) { return nullptr; } return browser_context()->GetExtension(extension_id); +#else + NOTIMPLEMENTED(); + return nullptr; +#endif } CefRefPtr CefRequestContextImpl::GetMediaRouter( diff --git a/libcef/browser/views/browser_view_impl.cc b/libcef/browser/views/browser_view_impl.cc index 70f545687..3b960e555 100644 --- a/libcef/browser/views/browser_view_impl.cc +++ b/libcef/browser/views/browser_view_impl.cc @@ -40,12 +40,17 @@ std::optional GetGestureCommand( bool ComputeAlloyStyle(CefBrowserViewDelegate* cef_delegate, bool is_devtools_popup) { // Alloy style is not supported with Chrome DevTools popups. +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) const bool supports_alloy_style = cef::IsAlloyRuntimeEnabled() || !is_devtools_popup; const bool supports_chrome_style = cef::IsChromeRuntimeEnabled(); const auto default_style = cef::IsAlloyRuntimeEnabled() ? CEF_RUNTIME_STYLE_ALLOY : CEF_RUNTIME_STYLE_CHROME; +#else + const bool supports_alloy_style = !is_devtools_popup; + const auto default_style = CEF_RUNTIME_STYLE_CHROME; +#endif auto result_style = default_style; @@ -59,12 +64,17 @@ bool ComputeAlloyStyle(CefBrowserViewDelegate* cef_delegate, "Chrome style is supported"; } } else if (requested_style == CEF_RUNTIME_STYLE_CHROME) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) if (supports_chrome_style) { result_style = requested_style; } else { LOG(ERROR) << "GetBrowserRuntimeStyle() requested Chrome style; only " "Alloy style is supported"; } +#else + // Chrome style is always supported. + result_style = requested_style; +#endif } } diff --git a/libcef/browser/views/window_view.cc b/libcef/browser/views/window_view.cc index e01e2bcea..c01e102f9 100644 --- a/libcef/browser/views/window_view.cc +++ b/libcef/browser/views/window_view.cc @@ -356,15 +356,20 @@ void UpdateModalDialogPosition(views::Widget* widget, } bool ComputeAlloyStyle(CefWindowDelegate* cef_delegate) { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) const bool supports_chrome_style = cef::IsChromeRuntimeEnabled(); const auto default_style = cef::IsAlloyRuntimeEnabled() ? CEF_RUNTIME_STYLE_ALLOY : CEF_RUNTIME_STYLE_CHROME; +#else + const auto default_style = CEF_RUNTIME_STYLE_CHROME; +#endif auto result_style = default_style; if (cef_delegate) { auto requested_style = cef_delegate->GetWindowRuntimeStyle(); +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) if (requested_style == CEF_RUNTIME_STYLE_ALLOY) { // Alloy style is always supported. result_style = requested_style; @@ -376,6 +381,11 @@ bool ComputeAlloyStyle(CefWindowDelegate* cef_delegate) { "Alloy style is supported"; } } +#else + if (requested_style != CEF_RUNTIME_STYLE_DEFAULT) { + result_style = requested_style; + } +#endif } return result_style == CEF_RUNTIME_STYLE_ALLOY; diff --git a/libcef/common/app_manager.cc b/libcef/common/app_manager.cc index 0eadb2443..df013427b 100644 --- a/libcef/common/app_manager.cc +++ b/libcef/common/app_manager.cc @@ -5,7 +5,6 @@ #include "libcef/common/app_manager.h" #include "libcef/common/net/scheme_info.h" -#include "libcef/common/net/scheme_registration.h" #include "libcef/common/scheme_registrar_impl.h" #include "base/command_line.h" @@ -18,6 +17,10 @@ #include "base/path_service.h" #endif +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "libcef/common/net/scheme_registration.h" +#endif + namespace { CefAppManager* g_manager = nullptr; @@ -88,7 +91,9 @@ void CefAppManager::AddAdditionalSchemes( schemeRegistrar.GetSchemes(schemes); } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) scheme::AddInternalSchemes(schemes); +#endif scheme_info_list_locked_ = true; } diff --git a/libcef/common/cef_switches.cc b/libcef/common/cef_switches.cc index b1c5a97ea..d0223692f 100644 --- a/libcef/common/cef_switches.cc +++ b/libcef/common/cef_switches.cc @@ -108,8 +108,10 @@ const char kDisableNewBrowserInfoTimeout[] = "disable-new-browser-info-timeout"; // File used for logging DevTools protocol messages. const char kDevToolsProtocolLogFile[] = "devtools-protocol-log-file"; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Enable use of the Chrome runtime in CEF. See issue #2969 for details. const char kEnableChromeRuntime[] = "enable-chrome-runtime"; +#endif // Delegate all login requests to the client GetAuthCredentials callback when // using the Chrome runtime. diff --git a/libcef/common/cef_switches.h b/libcef/common/cef_switches.h index ecc1a1b9e..19b8ef08c 100644 --- a/libcef/common/cef_switches.h +++ b/libcef/common/cef_switches.h @@ -9,6 +9,7 @@ #pragma once #include "build/build_config.h" +#include "cef/libcef/features/features.h" namespace switches { @@ -52,7 +53,9 @@ extern const char kDisablePdfExtension[]; extern const char kEnablePrintPreview[]; extern const char kDisableNewBrowserInfoTimeout[]; extern const char kDevToolsProtocolLogFile[]; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) extern const char kEnableChromeRuntime[]; +#endif extern const char kDisableChromeLoginPrompt[]; extern const char kUserAgentProductAndVersion[]; extern const char kDisableRequestHandlingForTesting[]; diff --git a/libcef/common/extensions/extensions_util.h b/libcef/common/extensions/extensions_util.h index c9eb8d675..3aef61bd8 100644 --- a/libcef/common/extensions/extensions_util.h +++ b/libcef/common/extensions/extensions_util.h @@ -5,6 +5,8 @@ #ifndef CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_UTIL_H_ #define CEF_LIBCEF_COMMON_EXTENSIONS_EXTENSIONS_UTIL_H_ +#include "cef/libcef/features/runtime.h" + namespace extensions { // Returns true if extensions have not been disabled via the command-line. diff --git a/libcef/common/net/scheme_registration.cc b/libcef/common/net/scheme_registration.cc index f923acf5f..9cf426d33 100644 --- a/libcef/common/net/scheme_registration.cc +++ b/libcef/common/net/scheme_registration.cc @@ -4,8 +4,6 @@ #include "libcef/common/net/scheme_registration.h" -#include "libcef/common/app_manager.h" -#include "libcef/common/net/scheme_info.h" #include "libcef/features/runtime.h" #include "base/containers/contains.h" @@ -14,8 +12,14 @@ #include "url/url_constants.h" #include "url/url_util.h" +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "libcef/common/app_manager.h" +#include "libcef/common/net/scheme_info.h" +#endif + namespace scheme { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) void AddInternalSchemes(content::ContentClient::Schemes* schemes) { if (!cef::IsAlloyRuntimeEnabled()) { return; @@ -60,6 +64,7 @@ void AddInternalSchemes(content::ContentClient::Schemes* schemes) { CefAppManager::Get()->AddCustomScheme(&scheme); } } +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) bool IsInternalHandledScheme(const std::string& scheme) { static const char* schemes[] = { diff --git a/libcef/common/net/scheme_registration.h b/libcef/common/net/scheme_registration.h index dcbdbb671..383f6a86f 100644 --- a/libcef/common/net/scheme_registration.h +++ b/libcef/common/net/scheme_registration.h @@ -9,12 +9,18 @@ #include #include +#include "cef/libcef/features/features.h" + +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) #include "content/public/common/content_client.h" +#endif namespace scheme { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Add internal schemes. void AddInternalSchemes(content::ContentClient::Schemes* schemes); +#endif // Returns true if the specified |scheme| is handled internally. bool IsInternalHandledScheme(const std::string& scheme); diff --git a/libcef/common/resource_util.cc b/libcef/common/resource_util.cc index b8cba46bd..a7a5f007c 100644 --- a/libcef/common/resource_util.cc +++ b/libcef/common/resource_util.cc @@ -8,18 +8,24 @@ #include #endif -#include "libcef/features/runtime.h" - +#include "base/base_paths.h" #include "base/command_line.h" #include "base/files/file_path.h" -#include "base/files/file_util.h" #include "base/logging.h" -#include "base/notreached.h" #include "base/path_service.h" -#include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_paths.h" -#include "chrome/common/chrome_paths_internal.h" #include "chrome/common/chrome_switches.h" + +#if BUILDFLAG(IS_LINUX) +#include "base/environment.h" +#include "base/nix/xdg_util.h" +#endif + +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "base/files/file_util.h" +#include "base/notreached.h" +#include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_paths_internal.h" #include "ui/base/layout.h" #if BUILDFLAG(IS_MAC) @@ -27,14 +33,10 @@ #include "libcef/common/util_mac.h" #endif -#if BUILDFLAG(IS_LINUX) -#include "base/environment.h" -#include "base/nix/xdg_util.h" -#endif - #if BUILDFLAG(IS_WIN) #include "base/win/registry.h" #endif +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) namespace resource_util { @@ -116,6 +118,12 @@ base::FilePath GetUserDataPath(CefSettings* settings, return result; } +} // namespace + +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + +namespace { + // Consider downloads 'dangerous' if they go to the home directory on Linux and // to the desktop on any platform. // From chrome/browser/download/download_prefs.cc. @@ -206,6 +214,16 @@ void OverrideDefaultDownloadDir() { } } +// Same as ui::ResourceBundle::IsScaleFactorSupported. +bool IsScaleFactorSupported(ui::ResourceScaleFactor scale_factor) { + const auto& supported_scale_factors = ui::GetSupportedResourceScaleFactors(); + return std::find(supported_scale_factors.begin(), + supported_scale_factors.end(), + scale_factor) != supported_scale_factors.end(); +} + +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + void OverrideUserDataDir(CefSettings* settings, const base::CommandLine* command_line) { const base::FilePath& user_data_path = @@ -223,14 +241,6 @@ void OverrideUserDataDir(CefSettings* settings, true); // Create if necessary. } -// Same as ui::ResourceBundle::IsScaleFactorSupported. -bool IsScaleFactorSupported(ui::ResourceScaleFactor scale_factor) { - const auto& supported_scale_factors = ui::GetSupportedResourceScaleFactors(); - return std::find(supported_scale_factors.begin(), - supported_scale_factors.end(), - scale_factor) != supported_scale_factors.end(); -} - #if BUILDFLAG(IS_LINUX) void OverrideAssetPath() { Dl_info dl_info; diff --git a/libcef/common/resource_util.h b/libcef/common/resource_util.h index a23912e7e..3c08d9a52 100644 --- a/libcef/common/resource_util.h +++ b/libcef/common/resource_util.h @@ -8,15 +8,22 @@ #include "include/cef_base.h" +#include "cef/libcef/features/features.h" + +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) #include "ui/base/resource/resource_scale_factor.h" +#endif namespace base { class CommandLine; +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) class FilePath; +#endif } // namespace base namespace resource_util { +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Returns the directory that contains resource files (*.bin, *.dat, *.pak, // etc). base::FilePath GetResourcesDir(); @@ -26,11 +33,13 @@ base::FilePath GetDefaultLogFilePath(); // Called from MainDelegate::PreSandboxStartup. void OverrideDefaultDownloadDir(); -void OverrideUserDataDir(CefSettings* settings, - const base::CommandLine* command_line); // Returns true if |scale_factor| is supported by this platform. bool IsScaleFactorSupported(ui::ResourceScaleFactor scale_factor); +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + +void OverrideUserDataDir(CefSettings* settings, + const base::CommandLine* command_line); #if BUILDFLAG(IS_LINUX) // Look for binary files (*.bin, *.dat, *.pak, chrome-sandbox, libGLESv2.so, diff --git a/libcef/features/BUILD.gn b/libcef/features/BUILD.gn index 79684293e..f917b9870 100644 --- a/libcef/features/BUILD.gn +++ b/libcef/features/BUILD.gn @@ -80,6 +80,7 @@ buildflag_header("features") { header = "features.h" flags = [ + "ENABLE_ALLOY_BOOTSTRAP=$enable_alloy_bootstrap", "ENABLE_CEF=$enable_cef", "IS_CEF_SANDBOX_BUILD=$is_cef_sandbox_build", ] diff --git a/libcef/features/features.gni b/libcef/features/features.gni index 7d7ae4971..0d26ac5e9 100644 --- a/libcef/features/features.gni +++ b/libcef/features/features.gni @@ -12,3 +12,9 @@ declare_args() { # PERFORMANCE AND/OR SECURITY IMPLICATIONS. is_cef_sandbox_build = false } + +declare_args() { + # Enables the Alloy bootstrap. This will be disabled and removed in ~M127. + # See issue #3685. + enable_alloy_bootstrap = enable_cef +} \ No newline at end of file diff --git a/libcef/features/runtime.h b/libcef/features/runtime.h index f010d6723..0e792e472 100644 --- a/libcef/features/runtime.h +++ b/libcef/features/runtime.h @@ -16,8 +16,10 @@ inline bool IsCefBuildEnabled() { return true; } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // True if CEF was initialized with the Alloy runtime. bool IsAlloyRuntimeEnabled(); +#endif // True if CEF was initialized with the Chrome runtime. bool IsChromeRuntimeEnabled(); @@ -25,14 +27,16 @@ bool IsChromeRuntimeEnabled(); // True if CEF crash reporting is enabled. bool IsCrashReportingEnabled(); -#else +#else // !BUILDFLAG(ENABLE_CEF) inline bool IsCefBuildEnabled() { return false; } +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) inline bool IsAlloyRuntimeEnabled() { return false; } +#endif inline bool IsChromeRuntimeEnabled() { return false; } @@ -40,7 +44,7 @@ inline bool IsCrashReportingEnabled() { return false; } -#endif +#endif // !BUILDFLAG(ENABLE_CEF) } // namespace cef diff --git a/libcef/features/runtime_checks.h b/libcef/features/runtime_checks.h index 23f5c5e45..5eeb2ae41 100644 --- a/libcef/features/runtime_checks.h +++ b/libcef/features/runtime_checks.h @@ -6,13 +6,18 @@ #define CEF_LIBCEF_FEATURES_RUNTIME_CHECKS_H_ #pragma once -#include "base/logging.h" #include "cef/libcef/features/runtime.h" +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + +#include "base/logging.h" + #define REQUIRE_ALLOY_RUNTIME() \ CHECK(cef::IsAlloyRuntimeEnabled()) << "Alloy runtime is required" #define REQUIRE_CHROME_RUNTIME() \ CHECK(cef::IsChromeRuntimeEnabled()) << "Chrome runtime is required" +#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + #endif // CEF_LIBCEF_FEATURES_RUNTIME_CHECKS_H_ diff --git a/patch/patches/chrome_browser_content_settings.patch b/patch/patches/chrome_browser_content_settings.patch index 072bc1bd6..a5532f31c 100644 --- a/patch/patches/chrome_browser_content_settings.patch +++ b/patch/patches/chrome_browser_content_settings.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/content_settings/host_content_settings_map_factory.cc chrome/browser/content_settings/host_content_settings_map_factory.cc -index 9356bf044a318..2499576dea7f0 100644 +index 9356bf044a318..883c322eef5bb 100644 --- chrome/browser/content_settings/host_content_settings_map_factory.cc +++ chrome/browser/content_settings/host_content_settings_map_factory.cc @@ -9,6 +9,7 @@ @@ -14,7 +14,7 @@ index 9356bf044a318..2499576dea7f0 100644 #include "extensions/buildflags/buildflags.h" #include "ui/webui/webui_allowlist_provider.h" -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "cef/libcef/common/extensions/extensions_util.h" +#endif + @@ -25,11 +25,11 @@ index 9356bf044a318..2499576dea7f0 100644 #endif DependsOn(OneTimePermissionsTrackerFactory::GetInstance()); #if BUILDFLAG(ENABLE_EXTENSIONS) -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled() || extensions::ExtensionsEnabled()) { +#endif DependsOn(extensions::ContentSettingsService::GetFactoryInstance()); -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } +#endif #endif @@ -39,7 +39,7 @@ index 9356bf044a318..2499576dea7f0 100644 std::move(allowlist_provider)); #if BUILDFLAG(ENABLE_EXTENSIONS) -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled() || extensions::ExtensionsEnabled()) { +#endif // These must be registered before before the HostSettings are passed over to @@ -49,7 +49,7 @@ index 9356bf044a318..2499576dea7f0 100644 // the case where profile->IsOffTheRecord() is true? And what is the // interaction with profile->IsGuestSession()? false)); -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } +#endif #endif // BUILDFLAG(ENABLE_EXTENSIONS) diff --git a/patch/patches/chrome_browser_dialogs_native.patch b/patch/patches/chrome_browser_dialogs_native.patch index 6d0718062..b70711f3f 100644 --- a/patch/patches/chrome_browser_dialogs_native.patch +++ b/patch/patches/chrome_browser_dialogs_native.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/file_select_helper.cc chrome/browser/file_select_helper.cc -index 447a91b9ac380..51593091b5fa6 100644 +index 447a91b9ac380..cf5ad1b907977 100644 --- chrome/browser/file_select_helper.cc +++ chrome/browser/file_select_helper.cc @@ -20,6 +20,7 @@ @@ -10,11 +10,15 @@ index 447a91b9ac380..51593091b5fa6 100644 #include "chrome/browser/browser_process.h" #include "chrome/browser/enterprise/connectors/common.h" #include "chrome/browser/platform_util.h" -@@ -245,6 +246,13 @@ void FileSelectHelper::OnListFile( +@@ -245,6 +246,17 @@ void FileSelectHelper::OnListFile( void FileSelectHelper::LaunchConfirmationDialog( const base::FilePath& path, std::vector selected_files) { -+ if (cef::IsAlloyRuntimeEnabled() || run_from_cef_) { ++ if ( ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) ++ cef::IsAlloyRuntimeEnabled() || ++#endif ++ run_from_cef_) { + // Don't show the upload confirmation dialog with the Alloy runtime, or + // when triggered via CEF (initially or recursively). + ConvertToFileChooserFileInfoList(selected_files); @@ -24,20 +28,22 @@ index 447a91b9ac380..51593091b5fa6 100644 ShowFolderUploadConfirmationDialog( path, base::BindOnce(&FileSelectHelper::ConvertToFileChooserFileInfoList, this), -@@ -329,6 +337,12 @@ void FileSelectHelper::PerformContentAnalysisIfNeeded( +@@ -329,6 +341,14 @@ void FileSelectHelper::PerformContentAnalysisIfNeeded( if (AbortIfWebContentsDestroyed()) return; ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + // Don't trigger creation of a AccountConsistencyModeManager (see issue #3401) + if (cef::IsAlloyRuntimeEnabled()) { + NotifyListenerAndEnd(std::move(list)); + return; + } ++#endif + #if BUILDFLAG(ENTERPRISE_CLOUD_CONTENT_ANALYSIS) enterprise_connectors::ContentAnalysisDelegate::Data data; if (enterprise_connectors::ContentAnalysisDelegate::IsEnabled( -@@ -459,7 +473,8 @@ void FileSelectHelper::DontAbortOnMissingWebContentsForTesting() { +@@ -459,7 +479,8 @@ void FileSelectHelper::DontAbortOnMissingWebContentsForTesting() { std::unique_ptr FileSelectHelper::GetFileTypesFromAcceptType( @@ -47,7 +53,7 @@ index 447a91b9ac380..51593091b5fa6 100644 auto base_file_type = std::make_unique(); if (accept_types.empty()) return base_file_type; -@@ -472,17 +487,24 @@ FileSelectHelper::GetFileTypesFromAcceptType( +@@ -472,17 +493,24 @@ FileSelectHelper::GetFileTypesFromAcceptType( std::vector* extensions = &file_type->extensions.back(); @@ -73,7 +79,7 @@ index 447a91b9ac380..51593091b5fa6 100644 } else { if (!base::IsStringASCII(accept_type)) continue; -@@ -493,10 +515,18 @@ FileSelectHelper::GetFileTypesFromAcceptType( +@@ -493,10 +521,18 @@ FileSelectHelper::GetFileTypesFromAcceptType( description_id = IDS_AUDIO_FILES; else if (ascii_type == "video/*") description_id = IDS_VIDEO_FILES; @@ -94,7 +100,7 @@ index 447a91b9ac380..51593091b5fa6 100644 if (extensions->size() > old_extension_size) valid_type_count++; } -@@ -521,6 +551,15 @@ FileSelectHelper::GetFileTypesFromAcceptType( +@@ -521,6 +557,15 @@ FileSelectHelper::GetFileTypesFromAcceptType( l10n_util::GetStringUTF16(description_id)); } @@ -110,7 +116,7 @@ index 447a91b9ac380..51593091b5fa6 100644 return file_type; } -@@ -528,7 +567,8 @@ FileSelectHelper::GetFileTypesFromAcceptType( +@@ -528,7 +573,8 @@ FileSelectHelper::GetFileTypesFromAcceptType( void FileSelectHelper::RunFileChooser( content::RenderFrameHost* render_frame_host, scoped_refptr listener, @@ -120,7 +126,7 @@ index 447a91b9ac380..51593091b5fa6 100644 Profile* profile = Profile::FromBrowserContext( render_frame_host->GetProcess()->GetBrowserContext()); -@@ -547,6 +587,7 @@ void FileSelectHelper::RunFileChooser( +@@ -547,6 +593,7 @@ void FileSelectHelper::RunFileChooser( // message. scoped_refptr file_select_helper( new FileSelectHelper(profile)); @@ -128,7 +134,7 @@ index 447a91b9ac380..51593091b5fa6 100644 file_select_helper->RunFileChooser(render_frame_host, std::move(listener), params.Clone()); } -@@ -598,7 +639,8 @@ void FileSelectHelper::RunFileChooser( +@@ -598,7 +645,8 @@ void FileSelectHelper::RunFileChooser( } void FileSelectHelper::GetFileTypesInThreadPool(FileChooserParamsPtr params) { diff --git a/patch/patches/chrome_browser_download.patch b/patch/patches/chrome_browser_download.patch index 8b815c702..a1c7b36b3 100644 --- a/patch/patches/chrome_browser_download.patch +++ b/patch/patches/chrome_browser_download.patch @@ -85,7 +85,7 @@ index e2cf12d2c8fee..376818e28798c 100644 }; diff --git chrome/browser/download/download_prefs.cc chrome/browser/download/download_prefs.cc -index 773f72da82f90..6d0307988406f 100644 +index 773f72da82f90..0043dd530934d 100644 --- chrome/browser/download/download_prefs.cc +++ chrome/browser/download/download_prefs.cc @@ -23,6 +23,7 @@ @@ -100,7 +100,7 @@ index 773f72da82f90..6d0307988406f 100644 #include "chrome/browser/flags/android/chrome_feature_list.h" #endif -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "cef/libcef/browser/alloy/alloy_download_util.h" +#endif + @@ -111,7 +111,7 @@ index 773f72da82f90..6d0307988406f 100644 // static DownloadPrefs* DownloadPrefs::FromBrowserContext( content::BrowserContext* context) { -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (cef::IsAlloyRuntimeEnabled()) { + return alloy::GetDownloadPrefsFromBrowserContext(context); + } diff --git a/patch/patches/chrome_browser_net_proxy.patch b/patch/patches/chrome_browser_net_proxy.patch index 2534b11e0..e57ba2296 100644 --- a/patch/patches/chrome_browser_net_proxy.patch +++ b/patch/patches/chrome_browser_net_proxy.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/net/proxy_config_monitor.cc chrome/browser/net/proxy_config_monitor.cc -index c9281f7abfbde..a1b7c77475b54 100644 +index c9281f7abfbde..670872e610d88 100644 --- chrome/browser/net/proxy_config_monitor.cc +++ chrome/browser/net/proxy_config_monitor.cc @@ -9,6 +9,7 @@ @@ -14,7 +14,7 @@ index c9281f7abfbde..a1b7c77475b54 100644 #include "chrome/browser/ash/profiles/profile_helper.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "cef/libcef/common/extensions/extensions_util.h" +#endif + @@ -25,7 +25,7 @@ index c9281f7abfbde..a1b7c77475b54 100644 } #if BUILDFLAG(ENABLE_EXTENSIONS) -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled() || extensions::ExtensionsEnabled()) +#endif error_receiver_set_.Add(this, network_context_params->proxy_error_client diff --git a/patch/patches/chrome_browser_permission_prompt.patch b/patch/patches/chrome_browser_permission_prompt.patch index 0ace30a5f..b07228b89 100644 --- a/patch/patches/chrome_browser_permission_prompt.patch +++ b/patch/patches/chrome_browser_permission_prompt.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/background_fetch/background_fetch_permission_context.cc chrome/browser/background_fetch/background_fetch_permission_context.cc -index 429739d7b8dfe..0f4bff365f62b 100644 +index 429739d7b8dfe..726cc7d9e9ced 100644 --- chrome/browser/background_fetch/background_fetch_permission_context.cc +++ chrome/browser/background_fetch/background_fetch_permission_context.cc @@ -4,6 +4,7 @@ @@ -10,18 +10,21 @@ index 429739d7b8dfe..0f4bff365f62b 100644 #include "chrome/browser/browser_process.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/download/download_request_limiter.h" -@@ -25,7 +26,8 @@ ContentSetting BackgroundFetchPermissionContext::GetPermissionStatusInternal( +@@ -25,7 +26,11 @@ ContentSetting BackgroundFetchPermissionContext::GetPermissionStatusInternal( const GURL& embedding_origin) const { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - if (render_frame_host && !render_frame_host->GetParent()) { -+ if (!cef::IsAlloyRuntimeEnabled() && ++ if ( ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) ++ !cef::IsAlloyRuntimeEnabled() && ++#endif + render_frame_host && !render_frame_host->GetParent()) { DownloadRequestLimiter* limiter = g_browser_process->download_request_limiter(); DCHECK(limiter); diff --git chrome/browser/background_sync/periodic_background_sync_permission_context.cc chrome/browser/background_sync/periodic_background_sync_permission_context.cc -index d63a055919747..8d13959217751 100644 +index d63a055919747..49adba291f1bb 100644 --- chrome/browser/background_sync/periodic_background_sync_permission_context.cc +++ chrome/browser/background_sync/periodic_background_sync_permission_context.cc @@ -6,6 +6,7 @@ @@ -32,19 +35,21 @@ index d63a055919747..8d13959217751 100644 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url_service_factory.h" -@@ -89,6 +90,10 @@ PeriodicBackgroundSyncPermissionContext::GetPermissionStatusInternal( +@@ -89,6 +90,12 @@ PeriodicBackgroundSyncPermissionContext::GetPermissionStatusInternal( return CONTENT_SETTING_ALLOW; #endif ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (cef::IsAlloyRuntimeEnabled()) { + return CONTENT_SETTING_BLOCK; + } ++#endif + bool can_bypass_install_requirement = base::FeatureList::IsEnabled( features::kPeriodicSyncPermissionForDefaultSearchEngine) && diff --git chrome/browser/permissions/chrome_permissions_client.cc chrome/browser/permissions/chrome_permissions_client.cc -index 7f14b48feedf6..cfcf4554c1d4d 100644 +index 7f14b48feedf6..9679552640788 100644 --- chrome/browser/permissions/chrome_permissions_client.cc +++ chrome/browser/permissions/chrome_permissions_client.cc @@ -14,6 +14,7 @@ @@ -55,29 +60,35 @@ index 7f14b48feedf6..cfcf4554c1d4d 100644 #include "chrome/browser/ash/shimless_rma/chrome_shimless_rma_delegate.h" #include "chrome/browser/bluetooth/bluetooth_chooser_context_factory.h" #include "chrome/browser/browser_process.h" -@@ -190,6 +191,9 @@ ChromePermissionsClient::GetPermissionDecisionAutoBlocker( +@@ -190,6 +191,11 @@ ChromePermissionsClient::GetPermissionDecisionAutoBlocker( double ChromePermissionsClient::GetSiteEngagementScore( content::BrowserContext* browser_context, const GURL& origin) { ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + // No SiteEngagementService with the Alloy runtime. + if (cef::IsAlloyRuntimeEnabled()) + return 0.0; ++#endif return site_engagement::SiteEngagementService::Get( Profile::FromBrowserContext(browser_context)) ->GetScore(origin); -@@ -360,8 +364,10 @@ ChromePermissionsClient::CreatePermissionUiSelectors( +@@ -360,8 +366,14 @@ ChromePermissionsClient::CreatePermissionUiSelectors( std::make_unique()); selectors.emplace_back(std::make_unique( Profile::FromBrowserContext(browser_context))); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled()) { ++#endif selectors.emplace_back(std::make_unique( Profile::FromBrowserContext(browser_context))); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } ++#endif return selectors; } diff --git chrome/browser/permissions/permission_manager_factory.cc chrome/browser/permissions/permission_manager_factory.cc -index 1ad4009827a9d..ca054482954f9 100644 +index 1ad4009827a9d..6aba08191cf35 100644 --- chrome/browser/permissions/permission_manager_factory.cc +++ chrome/browser/permissions/permission_manager_factory.cc @@ -6,6 +6,7 @@ @@ -88,20 +99,24 @@ index 1ad4009827a9d..ca054482954f9 100644 #include "chrome/browser/background_fetch/background_fetch_permission_context.h" #include "chrome/browser/background_sync/periodic_background_sync_permission_context.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" -@@ -64,9 +65,11 @@ permissions::PermissionManager::PermissionContextMap CreatePermissionContexts( +@@ -64,9 +65,15 @@ permissions::PermissionManager::PermissionContextMap CreatePermissionContexts( std::make_unique(profile); #endif // BUILDFLAG(IS_ANDROID) #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled()) { ++#endif delegates.geolocation_system_permission_manager = device::GeolocationSystemPermissionManager::GetInstance(); DCHECK(delegates.geolocation_system_permission_manager); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } ++#endif #endif delegates.media_stream_device_enumerator = MediaCaptureDevicesDispatcher::GetInstance(); diff --git chrome/browser/storage/durable_storage_permission_context.cc chrome/browser/storage/durable_storage_permission_context.cc -index 9934727f31a59..765b822241e4d 100644 +index 9934727f31a59..9ab13938d39c2 100644 --- chrome/browser/storage/durable_storage_permission_context.cc +++ chrome/browser/storage/durable_storage_permission_context.cc @@ -8,6 +8,7 @@ @@ -112,14 +127,17 @@ index 9934727f31a59..765b822241e4d 100644 #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" -@@ -56,7 +57,10 @@ void DurableStoragePermissionContext::DecidePermission( +@@ -56,7 +57,13 @@ void DurableStoragePermissionContext::DecidePermission( // Durable is only allowed to be granted to the top-level origin. Embedding // origin is the last committed navigation origin to the web contents. - if (request_data.requesting_origin != request_data.embedding_origin) { + // Permission depends on PWA and site engagement subsystems which are not + // supported by the Alloy runtime (see issue #3379). -+ if (cef::IsAlloyRuntimeEnabled() || ++ if ( ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) ++ cef::IsAlloyRuntimeEnabled() || ++#endif + request_data.requesting_origin != request_data.embedding_origin) { NotifyPermissionSet(request_data.id, request_data.requesting_origin, request_data.embedding_origin, std::move(callback), @@ -176,7 +194,7 @@ index 613500ba8c3d3..36c9aa0d2ea71 100644 if (!browser) { DLOG(WARNING) << "Permission prompt suppressed because the WebContents is " diff --git components/embedder_support/permission_context_utils.cc components/embedder_support/permission_context_utils.cc -index 9c0ec651d494f..e5c6126adeea7 100644 +index 9c0ec651d494f..8ba6512557edc 100644 --- components/embedder_support/permission_context_utils.cc +++ components/embedder_support/permission_context_utils.cc @@ -5,6 +5,7 @@ @@ -187,21 +205,25 @@ index 9c0ec651d494f..e5c6126adeea7 100644 #include "components/background_sync/background_sync_permission_context.h" #include "components/permissions/contexts/accessibility_permission_context.h" #include "components/permissions/contexts/camera_pan_tilt_zoom_permission_context.h" -@@ -79,10 +80,17 @@ CreateDefaultPermissionContexts(content::BrowserContext* browser_context, +@@ -79,10 +80,21 @@ CreateDefaultPermissionContexts(content::BrowserContext* browser_context, std::move(delegates.geolocation_permission_context_delegate), is_regular_profile); #elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (cef::IsAlloyRuntimeEnabled()) { + permission_contexts[ContentSettingsType::GEOLOCATION] = + std::make_unique( + browser_context, + std::move(delegates.geolocation_permission_context_delegate)); + } else { ++#endif permission_contexts[ContentSettingsType::GEOLOCATION] = std::make_unique( browser_context, std::move(delegates.geolocation_permission_context_delegate)); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } ++#endif #else permission_contexts[ContentSettingsType::GEOLOCATION] = std::make_unique( diff --git a/patch/patches/chrome_browser_profiles.patch b/patch/patches/chrome_browser_profiles.patch index 43899890c..467d164ea 100644 --- a/patch/patches/chrome_browser_profiles.patch +++ b/patch/patches/chrome_browser_profiles.patch @@ -134,7 +134,7 @@ index 3d5fd0d5ca858..965ab69b3fe8f 100644 // Returns the directory where the first created profile is stored, // relative to the user data directory currently in use. diff --git chrome/browser/profiles/renderer_updater.cc chrome/browser/profiles/renderer_updater.cc -index 0d1d2e3661ff1..a97322b1d991d 100644 +index 0d1d2e3661ff1..ba4b8cb233102 100644 --- chrome/browser/profiles/renderer_updater.cc +++ chrome/browser/profiles/renderer_updater.cc @@ -9,6 +9,7 @@ @@ -145,16 +145,18 @@ index 0d1d2e3661ff1..a97322b1d991d 100644 #include "chrome/browser/content_settings/content_settings_manager_delegate.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/profiles/profile.h" -@@ -45,6 +46,7 @@ RendererUpdater::RendererUpdater(Profile* profile) +@@ -45,6 +46,9 @@ RendererUpdater::RendererUpdater(Profile* profile) #if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS) , bound_session_cookie_refresh_service_( ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + cef::IsAlloyRuntimeEnabled() ? nullptr : ++#endif BoundSessionCookieRefreshServiceFactory::GetForProfile(profile)) #endif { diff --git chrome/browser/profiles/renderer_updater_factory.cc chrome/browser/profiles/renderer_updater_factory.cc -index ed5b366aa47ab..58ebe795e4636 100644 +index ed5b366aa47ab..794cf8b3bbec1 100644 --- chrome/browser/profiles/renderer_updater_factory.cc +++ chrome/browser/profiles/renderer_updater_factory.cc @@ -4,6 +4,7 @@ @@ -165,13 +167,17 @@ index ed5b366aa47ab..58ebe795e4636 100644 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/renderer_updater.h" -@@ -25,7 +26,9 @@ RendererUpdaterFactory::RendererUpdaterFactory() +@@ -25,7 +26,13 @@ RendererUpdaterFactory::RendererUpdaterFactory() DependsOn(IdentityManagerFactory::GetInstance()); DependsOn(HostContentSettingsMapFactory::GetInstance()); #if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled()) { ++#endif DependsOn(BoundSessionCookieRefreshServiceFactory::GetInstance()); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } ++#endif #endif // BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS) } diff --git a/patch/patches/chrome_browser_themes.patch b/patch/patches/chrome_browser_themes.patch index 8ecddae74..42ed86cfd 100644 --- a/patch/patches/chrome_browser_themes.patch +++ b/patch/patches/chrome_browser_themes.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/themes/theme_service.cc chrome/browser/themes/theme_service.cc -index 0b39e73c2a394..23b0bdcb7b7db 100644 +index 0b39e73c2a394..1c42fe06479ab 100644 --- chrome/browser/themes/theme_service.cc +++ chrome/browser/themes/theme_service.cc @@ -30,6 +30,7 @@ @@ -25,7 +25,7 @@ index 0b39e73c2a394..23b0bdcb7b7db 100644 // OnExtensionServiceReady. Otherwise, the ThemeObserver won't be // constructed in time to observe the corresponding events. #if BUILDFLAG(ENABLE_EXTENSIONS) -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + const bool extensions_disabled = cef::IsAlloyRuntimeEnabled() && + !extensions::ExtensionsEnabled(); +#else @@ -42,7 +42,7 @@ index 0b39e73c2a394..23b0bdcb7b7db 100644 theme_syncable_service_ = std::make_unique(profile_, this); diff --git chrome/browser/themes/theme_service_factory.cc chrome/browser/themes/theme_service_factory.cc -index 879bbeef4037b..e6cc36f388197 100644 +index 879bbeef4037b..c52b9144cf966 100644 --- chrome/browser/themes/theme_service_factory.cc +++ chrome/browser/themes/theme_service_factory.cc @@ -9,6 +9,7 @@ @@ -68,7 +68,7 @@ index 879bbeef4037b..e6cc36f388197 100644 .Build()) { DependsOn(extensions::ExtensionRegistryFactory::GetInstance()); DependsOn(extensions::ExtensionPrefsFactory::GetInstance()); -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + const bool extensions_disabled = cef::IsAlloyRuntimeEnabled() && + !extensions::ExtensionsEnabled(); +#else diff --git a/patch/patches/chrome_plugins.patch b/patch/patches/chrome_plugins.patch index b726648db..14713a984 100644 --- a/patch/patches/chrome_plugins.patch +++ b/patch/patches/chrome_plugins.patch @@ -1,43 +1,65 @@ diff --git chrome/browser/plugins/plugin_info_host_impl.cc chrome/browser/plugins/plugin_info_host_impl.cc -index 2bb525046619c..611fa1fb57369 100644 +index 2bb525046619c..200fc9c1f0067 100644 --- chrome/browser/plugins/plugin_info_host_impl.cc +++ chrome/browser/plugins/plugin_info_host_impl.cc -@@ -140,6 +140,10 @@ bool IsPluginLoadingAccessibleResourceInWebView( +@@ -16,6 +16,7 @@ + #include "base/memory/singleton.h" + #include "build/branding_buildflags.h" + #include "build/build_config.h" ++#include "cef/libcef/features/features.h" + #include "chrome/browser/browser_process.h" + #include "chrome/browser/content_settings/host_content_settings_map_factory.h" + #include "chrome/browser/plugins/chrome_plugin_service_filter.h" +@@ -140,6 +141,12 @@ bool IsPluginLoadingAccessibleResourceInWebView( extensions::ExtensionRegistry* extension_registry, int process_id, const GURL& resource) { ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + // May be nullptr if using CEF Alloy with extensions disabled. + if (!extension_registry) + return false; ++#endif + extensions::WebViewRendererState* renderer_state = extensions::WebViewRendererState::GetInstance(); std::string partition_id; diff --git chrome/browser/plugins/plugin_utils.cc chrome/browser/plugins/plugin_utils.cc -index 438276b719c2f..69635e429be78 100644 +index 438276b719c2f..e97fa0eaf2d7a 100644 --- chrome/browser/plugins/plugin_utils.cc +++ chrome/browser/plugins/plugin_utils.cc -@@ -68,6 +68,13 @@ PluginUtils::GetMimeTypeToExtensionIdMap( +@@ -5,6 +5,7 @@ + #include "chrome/browser/plugins/plugin_utils.h" + + #include "base/values.h" ++#include "cef/libcef/features/features.h" + #include "chrome/browser/profiles/profile.h" + #include "components/content_settings/core/browser/host_content_settings_map.h" + #include "components/content_settings/core/common/content_settings_types.h" +@@ -68,6 +69,15 @@ PluginUtils::GetMimeTypeToExtensionIdMap( content::BrowserContext* browser_context) { base::flat_map mime_type_to_extension_id_map; #if BUILDFLAG(ENABLE_EXTENSIONS) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + // May be nullptr if using CEF Alloy with extensions disabled. + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(browser_context); + if (!registry) { + return mime_type_to_extension_id_map; + } ++#endif + Profile* profile = Profile::FromBrowserContext(browser_context); if (extensions::ChromeContentBrowserClientExtensionsPart:: AreExtensionsDisabledForProfile(profile)) { -@@ -78,9 +85,6 @@ PluginUtils::GetMimeTypeToExtensionIdMap( +@@ -78,9 +88,11 @@ PluginUtils::GetMimeTypeToExtensionIdMap( MimeTypesHandler::GetMIMETypeAllowlist(); // Go through the allowed extensions and try to use them to intercept // the URL request. -- extensions::ExtensionRegistry* registry = -- extensions::ExtensionRegistry::Get(browser_context); -- DCHECK(registry); ++#if !BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + extensions::ExtensionRegistry* registry = + extensions::ExtensionRegistry::Get(browser_context); + DCHECK(registry); ++#endif for (const std::string& extension_id : allowlist) { const extensions::Extension* extension = registry->enabled_extensions().GetByID(extension_id); diff --git a/patch/patches/chrome_utility_client.patch b/patch/patches/chrome_utility_client.patch index 94aaa2131..f3a3cd783 100644 --- a/patch/patches/chrome_utility_client.patch +++ b/patch/patches/chrome_utility_client.patch @@ -1,5 +1,5 @@ diff --git chrome/utility/chrome_content_utility_client.cc chrome/utility/chrome_content_utility_client.cc -index c15d1fa6d6e25..b89a663d2664f 100644 +index c15d1fa6d6e25..f7356f7c1ef64 100644 --- chrome/utility/chrome_content_utility_client.cc +++ chrome/utility/chrome_content_utility_client.cc @@ -13,6 +13,7 @@ @@ -10,13 +10,16 @@ index c15d1fa6d6e25..b89a663d2664f 100644 #include "chrome/common/chrome_paths.h" #include "chrome/common/profiler/thread_profiler.h" #include "chrome/common/profiler/thread_profiler_configuration.h" -@@ -54,7 +55,8 @@ void ChromeContentUtilityClient::UtilityThreadStarted() { +@@ -54,7 +55,11 @@ void ChromeContentUtilityClient::UtilityThreadStarted() { command_line->GetSwitchValueASCII(switches::kProcessType); // An in-process utility thread may run in other processes, only set up // collector in a utility process. - if (process_type == switches::kUtilityProcess) { -+ if (process_type == switches::kUtilityProcess && -+ !cef::IsAlloyRuntimeEnabled()) { ++ if (process_type == switches::kUtilityProcess ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) ++ && !cef::IsAlloyRuntimeEnabled() ++#endif ++ ) { // The HeapProfilerController should have been created in // ChromeMainDelegate::PostEarlyInitialization. using HeapProfilerController = heap_profiling::HeapProfilerController; diff --git a/patch/patches/extensions_1947.patch b/patch/patches/extensions_1947.patch index 07213d0f5..5ba39a662 100644 --- a/patch/patches/extensions_1947.patch +++ b/patch/patches/extensions_1947.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/extensions/api/streams_private/streams_private_api.cc chrome/browser/extensions/api/streams_private/streams_private_api.cc -index 96a290eef86ca..6513a365cddf0 100644 +index 96a290eef86ca..bee0f9eaad71e 100644 --- chrome/browser/extensions/api/streams_private/streams_private_api.cc +++ chrome/browser/extensions/api/streams_private/streams_private_api.cc @@ -6,6 +6,7 @@ @@ -14,30 +14,34 @@ index 96a290eef86ca..6513a365cddf0 100644 #include "pdf/pdf_features.h" #endif // BUILDFLAG(ENABLE_PDF) -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) +#include "cef/libcef/browser/extensions/alloy_extensions_util.h" +#endif + namespace extensions { void StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent( -@@ -44,6 +49,7 @@ void StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent( +@@ -44,6 +49,9 @@ void StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent( if (!web_contents) return; ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled()) { ++#endif // If the request was for NoStatePrefetch, abort the prefetcher and do not // continue. This is because plugins cancel NoStatePrefetch, see // http://crbug.com/343590. -@@ -54,6 +60,7 @@ void StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent( +@@ -54,6 +62,9 @@ void StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent( no_state_prefetch_contents->Destroy(prerender::FINAL_STATUS_DOWNLOAD); return; } ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } ++#endif auto* browser_context = web_contents->GetBrowserContext(); -@@ -80,9 +87,18 @@ void StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent( +@@ -80,9 +91,18 @@ void StreamsPrivateAPI::SendExecuteMimeTypeHandlerEvent( // forms of zooming won't work). // TODO(crbug.com/40114809): Present a coherent representation of a tab id for // portal contents. @@ -48,11 +52,11 @@ index 96a290eef86ca..6513a365cddf0 100644 + if (web_contents->GetOuterWebContents()) { + tab_id = SessionID::InvalidValue().id(); + } else -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (cef::IsAlloyRuntimeEnabled()) { + tab_id = alloy::GetTabIdForWebContents(web_contents); + } else -+#endif // BUILDFLAG(ENABLE_CEF) ++#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + { + tab_id = ExtensionTabUtil::GetTabId(web_contents); + } @@ -168,7 +172,7 @@ index 28ba09319b047..2a097a5ae4c16 100644 // A pointer to the current or speculative main frame in `host_contents_`. We // can't access this frame through the `host_contents_` directly as it does diff --git extensions/browser/extension_registry.cc extensions/browser/extension_registry.cc -index c3197eb4790fa..1e7ae767b0582 100644 +index c3197eb4790fa..f558ff72bdbac 100644 --- extensions/browser/extension_registry.cc +++ extensions/browser/extension_registry.cc @@ -6,9 +6,14 @@ @@ -190,7 +194,7 @@ index c3197eb4790fa..1e7ae767b0582 100644 // static ExtensionRegistry* ExtensionRegistry::Get(content::BrowserContext* context) { -+#if BUILDFLAG(ENABLE_CEF) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (cef::IsAlloyRuntimeEnabled() && !extensions::ExtensionsEnabled()) { + return nullptr; + } @@ -257,15 +261,25 @@ index b86a71429eb33..9f7d190975605 100644 base::BindOnce(&ProcessManager::HandleCloseExtensionHost, weak_ptr_factory_.GetWeakPtr())); diff --git extensions/common/extensions_client.cc extensions/common/extensions_client.cc -index 5142f341b8392..d3242aae96ece 100644 +index 5142f341b8392..0589a1f1466f5 100644 --- extensions/common/extensions_client.cc +++ extensions/common/extensions_client.cc -@@ -25,7 +25,7 @@ ExtensionsClient* g_client = nullptr; +@@ -8,6 +8,7 @@ + + #include "base/check.h" + #include "base/notreached.h" ++#include "cef/libcef/features/features.h" + #include "extensions/common/extension_icon_set.h" + #include "extensions/common/extensions_api_provider.h" + #include "extensions/common/features/feature_provider.h" +@@ -25,7 +26,10 @@ ExtensionsClient* g_client = nullptr; } // namespace ExtensionsClient* ExtensionsClient::Get() { -- DCHECK(g_client); ++#if !BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + // May be nullptr if using CEF Alloy with extensions disabled. + DCHECK(g_client); ++#endif return g_client; } diff --git a/patch/patches/osr_win_remove_keyed_mutex_2575.patch b/patch/patches/osr_win_remove_keyed_mutex_2575.patch index 95c6f8bd3..d4eff9825 100644 --- a/patch/patches/osr_win_remove_keyed_mutex_2575.patch +++ b/patch/patches/osr_win_remove_keyed_mutex_2575.patch @@ -24,7 +24,7 @@ index ecabd51db586d..a7ae5e101ca02 100644 Microsoft::WRL::ComPtr d3d11_texture; diff --git media/video/renderable_gpu_memory_buffer_video_frame_pool.cc media/video/renderable_gpu_memory_buffer_video_frame_pool.cc -index a7ac0f10f11e5..bb1d7dc6e9168 100644 +index a7ac0f10f11e5..bbbfefd486660 100644 --- media/video/renderable_gpu_memory_buffer_video_frame_pool.cc +++ media/video/renderable_gpu_memory_buffer_video_frame_pool.cc @@ -198,7 +198,7 @@ gfx::Size GetBufferSizeInPixelsForVideoPixelFormat( diff --git a/patch/patches/print_preview_123.patch b/patch/patches/print_preview_123.patch index 64cb84216..72f581f67 100644 --- a/patch/patches/print_preview_123.patch +++ b/patch/patches/print_preview_123.patch @@ -27,7 +27,7 @@ index 5d1658999d5bb..d1b7b7288c946 100644 $i18n{cancel} diff --git chrome/browser/ui/webui/constrained_web_dialog_ui.cc chrome/browser/ui/webui/constrained_web_dialog_ui.cc -index c85248ab0d0a0..05b3454c0356d 100644 +index c85248ab0d0a0..1595d2aa62bce 100644 --- chrome/browser/ui/webui/constrained_web_dialog_ui.cc +++ chrome/browser/ui/webui/constrained_web_dialog_ui.cc @@ -13,6 +13,7 @@ @@ -38,18 +38,22 @@ index c85248ab0d0a0..05b3454c0356d 100644 #include "content/public/browser/render_frame_host.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" -@@ -56,7 +57,9 @@ class ConstrainedWebDialogDelegateUserData +@@ -56,7 +57,13 @@ class ConstrainedWebDialogDelegateUserData ConstrainedWebDialogUI::ConstrainedWebDialogUI(content::WebUI* web_ui) : WebUIController(web_ui) { #if BUILDFLAG(ENABLE_EXTENSIONS) ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled()) { ++#endif extensions::TabHelper::CreateForWebContents(web_ui->GetWebContents()); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } ++#endif #endif } diff --git chrome/browser/ui/webui/print_preview/print_preview_ui.cc chrome/browser/ui/webui/print_preview/print_preview_ui.cc -index 449f6f2db551e..677eecde93352 100644 +index 449f6f2db551e..96cc73b2ca43b 100644 --- chrome/browser/ui/webui/print_preview/print_preview_ui.cc +++ chrome/browser/ui/webui/print_preview/print_preview_ui.cc @@ -25,6 +25,7 @@ @@ -60,21 +64,23 @@ index 449f6f2db551e..677eecde93352 100644 #include "chrome/browser/browser_process.h" #include "chrome/browser/enterprise/browser_management/management_service_factory.h" #include "chrome/browser/pdf/pdf_extension_util.h" -@@ -109,6 +110,13 @@ const char16_t kBasicPrintShortcut[] = u"(\u2325\u2318P)"; +@@ -109,6 +110,15 @@ const char16_t kBasicPrintShortcut[] = u"(\u2325\u2318P)"; const char16_t kBasicPrintShortcut[] = u"(Ctrl+Shift+P)"; #endif +const char16_t* GetBasicPrintShortcut() { ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (cef::IsAlloyRuntimeEnabled()) { + return u""; + } ++#endif + return kBasicPrintShortcut; +} + constexpr char kInvalidArgsForDidStartPreview[] = "Invalid arguments for DidStartPreview"; constexpr char kInvalidPageIndexForDidPreviewPage[] = -@@ -310,7 +318,7 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) { +@@ -310,7 +320,7 @@ void AddPrintPreviewStrings(content::WebUIDataSource* source) { source->AddLocalizedStrings(kLocalizedStrings); #if !BUILDFLAG(IS_CHROMEOS) diff --git a/patch/patches/services_network_2622.patch b/patch/patches/services_network_2622.patch index 89421da75..eb224b2ea 100644 --- a/patch/patches/services_network_2622.patch +++ b/patch/patches/services_network_2622.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc -index 3a8e63a3bcbdd..69954e151f04e 100644 +index 3a8e63a3bcbdd..3fded53efc474 100644 --- chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc +++ chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc @@ -23,6 +23,7 @@ @@ -10,12 +10,14 @@ index 3a8e63a3bcbdd..69954e151f04e 100644 #include "chrome/browser/browser_process.h" #include "chrome/browser/enterprise/connectors/analysis/analysis_settings.h" #include "chrome/browser/enterprise/connectors/analysis/content_analysis_dialog.h" -@@ -357,6 +358,9 @@ bool ContentAnalysisDelegate::IsEnabled(Profile* profile, +@@ -357,6 +358,11 @@ bool ContentAnalysisDelegate::IsEnabled(Profile* profile, GURL url, Data* data, AnalysisConnector connector) { ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (cef::IsAlloyRuntimeEnabled()) + return false; ++#endif + auto* service = ConnectorsServiceFactory::GetForBrowserContext(profile); // If the corresponding Connector policy isn't set, don't perform scans. @@ -38,7 +40,7 @@ index e6d8a41c10f3a..18df8a6311d0a 100644 base::RepeatingCallback browser_context_getter = base::BindRepeating( diff --git chrome/browser/net/profile_network_context_service.cc chrome/browser/net/profile_network_context_service.cc -index 77d18bd28eeaf..9eab054ea3416 100644 +index 77d18bd28eeaf..395c62cc348df 100644 --- chrome/browser/net/profile_network_context_service.cc +++ chrome/browser/net/profile_network_context_service.cc @@ -25,6 +25,7 @@ @@ -49,7 +51,7 @@ index 77d18bd28eeaf..9eab054ea3416 100644 #include "chrome/browser/browser_features.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/content_settings/cookie_settings_factory.h" -@@ -266,9 +267,12 @@ void UpdateCookieSettings(Profile* profile, ContentSettingsType type) { +@@ -266,9 +267,16 @@ void UpdateCookieSettings(Profile* profile, ContentSettingsType type) { // occurs in this class is unsynchronized, so it would be racy to rely on // this update finishing before calling the context's callback.) This // unfortunately triggers a double-update here. @@ -57,28 +59,36 @@ index 77d18bd28eeaf..9eab054ea3416 100644 - FederatedIdentityPermissionContextFactory::GetForProfile(profile); - fedcm_context) { + FederatedIdentityPermissionContext* fedcm_context = nullptr; ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled()) { ++ #endif + fedcm_context = + FederatedIdentityPermissionContextFactory::GetForProfile(profile); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } ++#endif + if (fedcm_context) { settings = fedcm_context->GetSharingPermissionGrantsAsContentSettings(); } } else { -@@ -323,8 +327,10 @@ ProfileNetworkContextService::ProfileNetworkContextService(Profile* profile) +@@ -323,8 +331,14 @@ ProfileNetworkContextService::ProfileNetworkContextService(Profile* profile) base::Unretained(this))); cookie_settings_ = CookieSettingsFactory::GetForProfile(profile); cookie_settings_observation_.Observe(cookie_settings_.get()); - privacy_sandbox_settings_observer_.Observe( - PrivacySandboxSettingsFactory::GetForProfile(profile)); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled()) { ++#endif + privacy_sandbox_settings_observer_.Observe( + PrivacySandboxSettingsFactory::GetForProfile(profile)); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } ++#endif DisableQuicIfNotAllowed(); -@@ -826,9 +832,12 @@ ProfileNetworkContextService::CreateCookieManagerParams( +@@ -826,9 +840,16 @@ ProfileNetworkContextService::CreateCookieManagerParams( continue; } if (type == ContentSettingsType::FEDERATED_IDENTITY_SHARING) { @@ -86,15 +96,19 @@ index 77d18bd28eeaf..9eab054ea3416 100644 - FederatedIdentityPermissionContextFactory::GetForProfile(profile); - fedcm_context) { + FederatedIdentityPermissionContext* fedcm_context = nullptr; ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled()) { ++#endif + fedcm_context = + FederatedIdentityPermissionContextFactory::GetForProfile(profile); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } ++#endif + if (fedcm_context) { out->content_settings[type] = fedcm_context->GetSharingPermissionGrantsAsContentSettings(); } else { -@@ -1082,9 +1091,26 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal( +@@ -1082,9 +1103,32 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal( network_context_params->cookie_manager_params = CreateCookieManagerParams(profile_, *cookie_settings_); @@ -103,6 +117,7 @@ index 77d18bd28eeaf..9eab054ea3416 100644 + ::network::mojom::NetworkContextFilePaths::New(); + } + ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) // Configure on-disk storage for non-OTR profiles. OTR profiles just use // default behavior (in memory storage, default sizes). - if (!in_memory) { @@ -117,12 +132,17 @@ index 77d18bd28eeaf..9eab054ea3416 100644 + network_context_params->http_cache_max_size = + prefs->GetInteger(prefs::kDiskCacheSize); + } ++#endif // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + -+ if (!in_memory && !cef::IsAlloyRuntimeEnabled()) { ++ if (!in_memory ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) ++ && !cef::IsAlloyRuntimeEnabled() ++#endif ++ ) { PrefService* local_state = g_browser_process->local_state(); // Configure the HTTP cache path and size. base::FilePath base_cache_path; -@@ -1093,15 +1119,14 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal( +@@ -1093,15 +1137,14 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal( local_state->GetFilePath(prefs::kDiskCacheDir); if (!disk_cache_dir.empty()) base_cache_path = disk_cache_dir.Append(base_cache_path.BaseName()); @@ -142,16 +162,18 @@ index 77d18bd28eeaf..9eab054ea3416 100644 network_context_params->file_paths->data_directory = path.Append(chrome::kNetworkDataDirname); network_context_params->file_paths->unsandboxed_data_path = path; -@@ -1276,6 +1301,7 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal( +@@ -1276,6 +1319,9 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal( network_context_params->first_party_sets_access_delegate_params = network::mojom::FirstPartySetsAccessDelegateParams::New(); network_context_params->first_party_sets_access_delegate_params->enabled = ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + cef::IsAlloyRuntimeEnabled() ? false : ++#endif PrivacySandboxSettingsFactory::GetForProfile(profile_) ->AreRelatedWebsiteSetsEnabled(); diff --git chrome/browser/net/profile_network_context_service_factory.cc chrome/browser/net/profile_network_context_service_factory.cc -index 14ac2ce8b90c5..66431eface762 100644 +index 14ac2ce8b90c5..c22f8a7a57c69 100644 --- chrome/browser/net/profile_network_context_service_factory.cc +++ chrome/browser/net/profile_network_context_service_factory.cc @@ -6,6 +6,7 @@ @@ -162,18 +184,23 @@ index 14ac2ce8b90c5..66431eface762 100644 #include "chrome/browser/first_party_sets/first_party_sets_policy_service_factory.h" #include "chrome/browser/net/profile_network_context_service.h" #include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h" -@@ -53,7 +54,9 @@ ProfileNetworkContextServiceFactory::ProfileNetworkContextServiceFactory() +@@ -52,8 +53,14 @@ ProfileNetworkContextServiceFactory::ProfileNetworkContextServiceFactory() + #endif #if BUILDFLAG(IS_CHROMEOS_ASH) DependsOn(chromeos::CertificateProviderServiceFactory::GetInstance()); - #endif ++#endif ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled()) { + #endif DependsOn(PrivacySandboxSettingsFactory::GetInstance()); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } ++#endif DependsOn( first_party_sets::FirstPartySetsPolicyServiceFactory::GetInstance()); } diff --git chrome/browser/signin/identity_manager_factory.cc chrome/browser/signin/identity_manager_factory.cc -index a635c32482ce0..77a3503cea229 100644 +index a635c32482ce0..e478ee670c239 100644 --- chrome/browser/signin/identity_manager_factory.cc +++ chrome/browser/signin/identity_manager_factory.cc @@ -11,6 +11,7 @@ @@ -184,11 +211,13 @@ index a635c32482ce0..77a3503cea229 100644 #include "chrome/browser/browser_process.h" #include "chrome/browser/image_fetcher/image_decoder_impl.h" #include "chrome/browser/profiles/profile.h" -@@ -97,6 +98,7 @@ IdentityManagerFactory::~IdentityManagerFactory() { +@@ -97,6 +98,9 @@ IdentityManagerFactory::~IdentityManagerFactory() { // static signin::IdentityManager* IdentityManagerFactory::GetForProfile( Profile* profile) { ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + DCHECK(!cef::IsAlloyRuntimeEnabled()); ++#endif return static_cast( GetInstance()->GetServiceForBrowserContext(profile, true)); } diff --git a/patch/patches/webui_2037.patch b/patch/patches/webui_2037.patch index 1c022dfef..258554c88 100644 --- a/patch/patches/webui_2037.patch +++ b/patch/patches/webui_2037.patch @@ -1,5 +1,5 @@ diff --git chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc -index 16c370e6d9759..1460a9c0d1f49 100644 +index 16c370e6d9759..7fc6d74075dd4 100644 --- chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc +++ chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc @@ -20,10 +20,12 @@ @@ -15,33 +15,38 @@ index 16c370e6d9759..1460a9c0d1f49 100644 #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/chrome_content_browser_client_extensions_part.h" #include "chrome/browser/google/google_brand.h" -@@ -422,7 +424,11 @@ void ChromeInternalLogSource::Fetch(SysLogsSourceCallback callback) { +@@ -422,7 +424,15 @@ void ChromeInternalLogSource::Fetch(SysLogsSourceCallback callback) { response->emplace(kOsVersionTag, os_version); #endif -- PopulateSyncLogs(response.get()); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!cef::IsAlloyRuntimeEnabled()) { -+ // Avoid loading ProfileSyncServiceFactory which depends on a lot of -+ // unnecessary Chrome-specific factories. -+ PopulateSyncLogs(response.get()); ++#endif ++ // Avoid loading ProfileSyncServiceFactory which depends on a lot of ++ // unnecessary Chrome-specific factories. + PopulateSyncLogs(response.get()); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } ++#endif PopulateExtensionInfoLogs(response.get()); PopulatePowerApiLogs(response.get()); #if BUILDFLAG(IS_WIN) -@@ -510,8 +516,12 @@ void ChromeInternalLogSource::PopulateExtensionInfoLogs( +@@ -510,8 +520,14 @@ void ChromeInternalLogSource::PopulateExtensionInfoLogs( if (!profile) return; + // May be nullptr if using CEF Alloy with extensions disabled. extensions::ExtensionRegistry* extension_registry = extensions::ExtensionRegistry::Get(profile); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (!extension_registry) + return; ++#endif + std::string extensions_list; for (const scoped_refptr& extension : extension_registry->enabled_extensions()) { -@@ -612,6 +622,8 @@ void ChromeInternalLogSource::PopulateOnboardingTime( +@@ -612,6 +628,8 @@ void ChromeInternalLogSource::PopulateOnboardingTime( #if BUILDFLAG(IS_WIN) void ChromeInternalLogSource::PopulateUsbKeyboardDetected( SystemLogsResponse* response) { @@ -51,10 +56,18 @@ index 16c370e6d9759..1460a9c0d1f49 100644 bool result = base::win::IsKeyboardPresentOnSlate(ui::GetHiddenWindow(), &reason); diff --git chrome/browser/memory_details.cc chrome/browser/memory_details.cc -index 58fe3bd8f62ae..41b5e35b09a80 100644 +index 58fe3bd8f62ae..f8a2f456bded6 100644 --- chrome/browser/memory_details.cc +++ chrome/browser/memory_details.cc -@@ -298,9 +298,11 @@ void MemoryDetails::CollectChildInfoOnUIThread() { +@@ -17,6 +17,7 @@ + #include "base/strings/utf_string_conversions.h" + #include "base/task/thread_pool.h" + #include "build/build_config.h" ++#include "cef/libcef/features/features.h" + #include "chrome/browser/profiles/profile.h" + #include "components/nacl/common/nacl_process_type.h" + #include "components/strings/grit/components_strings.h" +@@ -298,9 +299,15 @@ void MemoryDetails::CollectChildInfoOnUIThread() { render_process_host->GetBrowserContext())) { content::BrowserContext* context = render_process_host->GetBrowserContext(); @@ -62,16 +75,21 @@ index 58fe3bd8f62ae..41b5e35b09a80 100644 + // May be nullptr if using CEF Alloy with extensions disabled. extensions::ExtensionRegistry* extension_registry = extensions::ExtensionRegistry::Get(context); -- DCHECK(extension_registry); ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + if (extension_registry) { ++#else + DCHECK(extension_registry); ++#endif extension_set = &extension_registry->enabled_extensions(); extensions::ProcessMap* process_map = extensions::ProcessMap::Get(context); -@@ -317,6 +319,7 @@ void MemoryDetails::CollectChildInfoOnUIThread() { +@@ -317,6 +324,9 @@ void MemoryDetails::CollectChildInfoOnUIThread() { break; } } ++#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) + } ++#endif } #endif diff --git a/tests/cefclient/browser/client_browser.cc b/tests/cefclient/browser/client_browser.cc index c3b08f374..8ffcc5f31 100644 --- a/tests/cefclient/browser/client_browser.cc +++ b/tests/cefclient/browser/client_browser.cc @@ -69,7 +69,9 @@ class ClientBrowserDelegate : public ClientAppBrowser::Delegate { const CefString& current_directory) override { // Add logging for some common switches that the user may attempt to use. static const char* kIgnoredSwitches[] = { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) switches::kEnableChromeRuntime, +#endif switches::kMultiThreadedMessageLoop, switches::kOffScreenRenderingEnabled, switches::kUseViews, diff --git a/tests/cefclient/browser/client_handler.cc b/tests/cefclient/browser/client_handler.cc index 965c3883d..e28f92745 100644 --- a/tests/cefclient/browser/client_handler.cc +++ b/tests/cefclient/browser/client_handler.cc @@ -187,6 +187,7 @@ std::string GetContentStatusString(cef_ssl_content_status_t status) { return result; } +#if !defined(DISABLE_ALLOY_BOOTSTRAP) // Load a data: URI containing the error message. // Only used with Alloy style. void LoadErrorPage(CefRefPtr frame, @@ -212,6 +213,7 @@ void LoadErrorPage(CefRefPtr frame, ss << ""; frame->LoadURL(test_runner::GetDataURI(ss.str(), "text/html")); } +#endif // !defined(DISABLE_ALLOY_BOOTSTRAP) // Return HTML string with information about a certificate. std::string GetCertificateInformation(CefRefPtr cert, @@ -1078,11 +1080,13 @@ void ClientHandler::OnLoadError(CefRefPtr browser, } } +#if !defined(DISABLE_ALLOY_BOOTSTRAP) if (use_alloy_style_) { // Load the error page. LoadErrorPage(frame, "Page failed to load", failedUrl, test_runner::GetErrorString(errorCode), errorText); } +#endif } bool ClientHandler::OnRequestMediaAccessPermission( @@ -1172,6 +1176,7 @@ bool ClientHandler::OnCertificateError(CefRefPtr browser, return true; } +#if !defined(DISABLE_ALLOY_BOOTSTRAP) if (use_alloy_style_) { if (auto cert = ssl_info->GetX509Certificate()) { // Load the error page. @@ -1180,6 +1185,7 @@ bool ClientHandler::OnCertificateError(CefRefPtr browser, GetCertificateInformation(cert, ssl_info->GetCertStatus())); } } +#endif return false; // Cancel the request. } @@ -1248,12 +1254,14 @@ void ClientHandler::OnRenderProcessTerminated(CefRefPtr browser, // Don't reload the URL that just resulted in termination. if (url.find(start_url) == 0) { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) if (use_alloy_style_) { LoadErrorPage(frame, "Render process terminated", frame->GetURL(), test_runner::GetErrorString(status) + " (" + error_string.ToString() + ")", std::string()); } +#endif return; } @@ -1300,6 +1308,7 @@ void ClientHandler::ShowDevTools(CefRefPtr browser, CefRefPtr host = browser->GetHost(); +#if !defined(DISABLE_ALLOY_BOOTSTRAP) // Test if the DevTools browser already exists. if (use_alloy_style_ && !host->HasDevTools() && !MainContext::Get()->UseChromeBootstrap()) { @@ -1309,6 +1318,7 @@ void ClientHandler::ShowDevTools(CefRefPtr browser, CreatePopupWindow(browser, /*is_devtools=*/true, CefPopupFeatures(), windowInfo, client, settings); } +#endif // Create the DevTools browser if it doesn't already exist. // Otherwise, focus the existing DevTools browser and inspect the element diff --git a/tests/cefclient/browser/main_context.h b/tests/cefclient/browser/main_context.h index bc4210530..79f52501b 100644 --- a/tests/cefclient/browser/main_context.h +++ b/tests/cefclient/browser/main_context.h @@ -43,8 +43,10 @@ class MainContext { // Returns the background color. virtual cef_color_t GetBackgroundColor() = 0; +#if !defined(DISABLE_ALLOY_BOOTSTRAP) // Returns true if the Chrome runtime bootstrap will be used. virtual bool UseChromeBootstrap() = 0; +#endif // Returns true if the Views framework will be used as the global default. virtual bool UseViewsGlobal() = 0; diff --git a/tests/cefclient/browser/main_context_impl.cc b/tests/cefclient/browser/main_context_impl.cc index c8be84bdb..7d014ad90 100644 --- a/tests/cefclient/browser/main_context_impl.cc +++ b/tests/cefclient/browser/main_context_impl.cc @@ -76,9 +76,11 @@ MainContextImpl::MainContextImpl(CefRefPtr command_line, windowless_frame_rate_ = shared_texture_enabled_ ? 60 : 30; } +#if !defined(DISABLE_ALLOY_BOOTSTRAP) // Enable Chrome runtime bootstrap. See issue #2969 for details. use_chrome_bootstrap_ = command_line_->HasSwitch(switches::kEnableChromeRuntime); +#endif // Whether the Views framework will be used. use_views_ = command_line_->HasSwitch(switches::kUseViews); @@ -90,8 +92,11 @@ MainContextImpl::MainContextImpl(CefRefPtr command_line, } // Whether Alloy style will be used. - use_alloy_style_ = !use_chrome_bootstrap_ || - command_line_->HasSwitch(switches::kUseAlloyStyle); + use_alloy_style_ = +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + !use_chrome_bootstrap_ || +#endif + command_line_->HasSwitch(switches::kUseAlloyStyle); if (use_windowless_rendering_ && !use_alloy_style_) { LOG(WARNING) << "Windowless rendering requires Alloy style."; @@ -100,7 +105,10 @@ MainContextImpl::MainContextImpl(CefRefPtr command_line, // Whether to use a native parent window with Chrome runtime. const bool use_chrome_native_parent = - use_chrome_bootstrap_ && command_line->HasSwitch(switches::kUseNative); +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + use_chrome_bootstrap_ && +#endif + command_line->HasSwitch(switches::kUseNative); #if defined(OS_MAC) if (use_chrome_native_parent && !use_alloy_style_) { @@ -110,8 +118,11 @@ MainContextImpl::MainContextImpl(CefRefPtr command_line, } #endif - if (use_chrome_bootstrap_ && !use_views_ && !use_chrome_native_parent && - !use_windowless_rendering_) { + if ( +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + use_chrome_bootstrap_ && +#endif + !use_views_ && !use_chrome_native_parent && !use_windowless_rendering_) { LOG(WARNING) << "Chrome runtime defaults to the Views framework."; use_views_ = true; } @@ -133,10 +144,12 @@ MainContextImpl::MainContextImpl(CefRefPtr command_line, } // Log the current configuration. - LOG(WARNING) << "Using " << (use_chrome_bootstrap_ ? "Chrome" : "Alloy") - << " bootstrap; " << (use_alloy_style_ ? "Alloy" : "Chrome") - << " style; " << (use_views_ ? "Views" : "Native") - << "-hosted window; " + LOG(WARNING) << "Using " +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + << (use_chrome_bootstrap_ ? "Chrome" : "Alloy") << " bootstrap; " +#endif + << (use_alloy_style_ ? "Alloy" : "Chrome") << " style; " + << (use_views_ ? "Views" : "Native") << "-hosted window; " << (use_windowless_rendering_ ? "Windowless" : "Windowed") << " rendering (not a warning)"; } @@ -175,9 +188,11 @@ cef_color_t MainContextImpl::GetBackgroundColor() { return background_color_; } +#if !defined(DISABLE_ALLOY_BOOTSTRAP) bool MainContextImpl::UseChromeBootstrap() { return use_chrome_bootstrap_; } +#endif bool MainContextImpl::UseViewsGlobal() { return use_views_; @@ -199,9 +214,11 @@ bool MainContextImpl::UseDefaultPopup() { void MainContextImpl::PopulateSettings(CefSettings* settings) { client::ClientAppBrowser::PopulateSettings(command_line_, *settings); +#if !defined(DISABLE_ALLOY_BOOTSTRAP) if (use_chrome_bootstrap_) { settings->chrome_runtime = true; } +#endif CefString(&settings->cache_path) = command_line_->GetSwitchValue(switches::kCachePath); @@ -245,7 +262,10 @@ void MainContextImpl::PopulateBrowserSettings(CefBrowserSettings* settings) { settings->background_color = browser_background_color_; } - if (use_chrome_bootstrap_ && + if ( +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + use_chrome_bootstrap_ && +#endif command_line_->HasSwitch(switches::kHideChromeBubbles)) { settings->chrome_status_bubble = STATE_DISABLED; settings->chrome_zoom_bubble = STATE_DISABLED; diff --git a/tests/cefclient/browser/main_context_impl.h b/tests/cefclient/browser/main_context_impl.h index ee31b828e..c0371a067 100644 --- a/tests/cefclient/browser/main_context_impl.h +++ b/tests/cefclient/browser/main_context_impl.h @@ -29,7 +29,9 @@ class MainContextImpl : public MainContext { std::string GetAppWorkingDirectory() override; std::string GetMainURL(CefRefPtr command_line) override; cef_color_t GetBackgroundColor() override; +#if !defined(DISABLE_ALLOY_BOOTSTRAP) bool UseChromeBootstrap() override; +#endif bool UseViewsGlobal() override; bool UseAlloyStyleGlobal() override; bool TouchEventsEnabled() override; @@ -73,7 +75,9 @@ class MainContextImpl : public MainContext { cef_color_t browser_background_color_ = 0; bool use_windowless_rendering_; int windowless_frame_rate_ = 0; +#if !defined(DISABLE_ALLOY_BOOTSTRAP) bool use_chrome_bootstrap_; +#endif bool use_views_; bool use_alloy_style_; diff --git a/tests/cefclient/browser/root_window_manager.cc b/tests/cefclient/browser/root_window_manager.cc index 50847582a..108b3616c 100644 --- a/tests/cefclient/browser/root_window_manager.cc +++ b/tests/cefclient/browser/root_window_manager.cc @@ -35,6 +35,7 @@ class ClientRequestContextHandler : public CefRequestContextHandler, CefRefPtr request_context) override { CEF_REQUIRE_UI_THREAD(); +#if !defined(DISABLE_ALLOY_BOOTSTRAP) const auto main_context = MainContext::Get(); CefRefPtr command_line = CefCommandLine::GetGlobalCommandLine(); @@ -64,6 +65,7 @@ class ClientRequestContextHandler : public CefRequestContextHandler, } } } +#endif // !defined(DISABLE_ALLOY_BOOTSTRAP) // Allow the startup URL to create popups that bypass the popup blocker. // For example, via Tests > New Popup from the top menu. This applies for @@ -118,7 +120,10 @@ void SanityCheckWindowConfig(const bool is_devtools, bool& use_views, bool& use_alloy_style, bool& with_osr) { - if (MainContext::Get()->UseChromeBootstrap()) { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + if (MainContext::Get()->UseChromeBootstrap()) +#endif + { if (is_devtools && use_alloy_style) { LOG(WARNING) << "Alloy style is not supported with Chrome runtime DevTools;" @@ -173,8 +178,8 @@ scoped_refptr RootWindowManager::CreateRootWindow( SanityCheckWindowConfig(/*is_devtools=*/false, config->use_views, config->use_alloy_style, config->with_osr); - scoped_refptr root_window = RootWindow::Create( - config->use_views, config->use_alloy_style); + scoped_refptr root_window = + RootWindow::Create(config->use_views, config->use_alloy_style); root_window->Init(this, std::move(config), settings); // Store a reference to the root window on the main thread. @@ -400,7 +405,11 @@ CefRefPtr RootWindowManager::CreateRequestContext( if (request_context_per_browser_) { // Synchronous use of non-global request contexts is not safe with the // Chrome runtime. - CHECK(!callback.is_null() || !MainContext::Get()->UseChromeBootstrap()); + CHECK(!callback.is_null() +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + || !MainContext::Get()->UseChromeBootstrap() +#endif + ); // Create a new request context for each browser. CefRequestContextSettings settings; diff --git a/tests/cefclient/browser/views_window.cc b/tests/cefclient/browser/views_window.cc index 367d6f8bd..0cbc13416 100644 --- a/tests/cefclient/browser/views_window.cc +++ b/tests/cefclient/browser/views_window.cc @@ -1132,14 +1132,17 @@ ViewsWindow::ViewsWindow(WindowType type, SetBrowserView(browser_view); } - if (MainContext::Get()->UseChromeBootstrap()) { - use_alloy_style_window_ = - use_alloy_style_ && - !command_line_->HasSwitch(switches::kUseChromeStyleWindow); - } else { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + if (!MainContext::Get()->UseChromeBootstrap()) { // Alloy bootstrap requires Alloy style. DCHECK(use_alloy_style_); use_alloy_style_window_ = true; + } else +#endif + { + use_alloy_style_window_ = + use_alloy_style_ && + !command_line_->HasSwitch(switches::kUseChromeStyleWindow); } const bool is_normal_type = type_ == WindowType::NORMAL; diff --git a/tests/cefsimple/cefsimple_linux.cc b/tests/cefsimple/cefsimple_linux.cc index ca09f25e2..dd4622d03 100644 --- a/tests/cefsimple/cefsimple_linux.cc +++ b/tests/cefsimple/cefsimple_linux.cc @@ -58,6 +58,7 @@ int main(int argc, char* argv[]) { // Specify CEF global settings here. CefSettings settings; +#if !defined(DISABLE_ALLOY_BOOTSTRAP) // Use the CEF Chrome runtime if "--enable-chrome-runtime" is specified via // the command-line. Otherwise, use the CEF Alloy runtime. For more // information about CEF runtimes see @@ -65,6 +66,7 @@ int main(int argc, char* argv[]) { if (command_line->HasSwitch("enable-chrome-runtime")) { settings.chrome_runtime = true; } +#endif // When generating projects with CMake the CEF_USE_SANDBOX value will be defined // automatically. Pass -DUSE_SANDBOX=OFF to the CMake command-line to disable diff --git a/tests/cefsimple/cefsimple_mac.mm b/tests/cefsimple/cefsimple_mac.mm index 4f2233e1c..0156968ce 100644 --- a/tests/cefsimple/cefsimple_mac.mm +++ b/tests/cefsimple/cefsimple_mac.mm @@ -150,6 +150,7 @@ int main(int argc, char* argv[]) { // Specify CEF global settings here. CefSettings settings; +#if !defined(DISABLE_ALLOY_BOOTSTRAP) // Use the CEF Chrome runtime if "--enable-chrome-runtime" is specified via // the command-line. Otherwise, use the CEF Alloy runtime. For more // information about CEF runtimes see @@ -157,6 +158,7 @@ int main(int argc, char* argv[]) { if (command_line->HasSwitch("enable-chrome-runtime")) { settings.chrome_runtime = true; } +#endif // When generating projects with CMake the CEF_USE_SANDBOX value will be // defined automatically. Pass -DUSE_SANDBOX=OFF to the CMake command-line diff --git a/tests/cefsimple/cefsimple_win.cc b/tests/cefsimple/cefsimple_win.cc index f036626e3..857186289 100644 --- a/tests/cefsimple/cefsimple_win.cc +++ b/tests/cefsimple/cefsimple_win.cc @@ -74,6 +74,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, // Specify CEF global settings here. CefSettings settings; +#if !defined(DISABLE_ALLOY_BOOTSTRAP) // Use the CEF Chrome runtime if "--enable-chrome-runtime" is specified via // the command-line. Otherwise, use the CEF Alloy runtime. For more // information about CEF runtimes see @@ -81,6 +82,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, if (command_line->HasSwitch("enable-chrome-runtime")) { settings.chrome_runtime = true; } +#endif #if !defined(CEF_USE_SANDBOX) settings.no_sandbox = true; diff --git a/tests/cefsimple/simple_app.cc b/tests/cefsimple/simple_app.cc index d7a608380..ede209ae8 100644 --- a/tests/cefsimple/simple_app.cc +++ b/tests/cefsimple/simple_app.cc @@ -117,7 +117,10 @@ void SimpleApp::OnContextInitialized() { // Alloy runtime bootstrap and optional with the Chrome runtime bootstrap. bool use_alloy_style = true; cef_runtime_style_t runtime_style = CEF_RUNTIME_STYLE_DEFAULT; - if (command_line->HasSwitch("enable-chrome-runtime")) { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + if (command_line->HasSwitch("enable-chrome-runtime")) +#endif + { use_alloy_style = command_line->HasSwitch("use-alloy-style"); if (use_alloy_style) { runtime_style = CEF_RUNTIME_STYLE_ALLOY; diff --git a/tests/ceftests/cors_unittest.cc b/tests/ceftests/cors_unittest.cc index 52861473f..c8ced1487 100644 --- a/tests/ceftests/cors_unittest.cc +++ b/tests/ceftests/cors_unittest.cc @@ -26,7 +26,10 @@ class CorsBrowserTest : public client::ClientAppBrowser::Delegate { CorsBrowserTest() = default; void OnContextInitialized(CefRefPtr app) override { - if (IsChromeBootstrap()) { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + if (IsChromeBootstrap()) +#endif + { // Disable InsecureFormNavigationThrottle which blocks 307 redirect of // POST requests from HTTPS to custom non-standard scheme causing the // CorsTest.RedirectPost307HttpSchemeToCustomNonStandardScheme test to diff --git a/tests/ceftests/download_unittest.cc b/tests/ceftests/download_unittest.cc index f9e8bf646..c689e8728 100644 --- a/tests/ceftests/download_unittest.cc +++ b/tests/ceftests/download_unittest.cc @@ -279,7 +279,11 @@ class DownloadTestHandler : public TestHandler { SendClick(browser, test_mode_ == CLICKED_INVALID ? EVENTFLAG_ALT_DOWN : 0); - if (IsChromeBootstrap() && is_clicked_invalid()) { + if ( +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + IsChromeBootstrap() && +#endif + is_clicked_invalid()) { // Destroy the test after a bit because there will be no further // callbacks. CefPostDelayedTask( @@ -513,11 +517,14 @@ class DownloadTestHandler : public TestHandler { } if (is_clicked_invalid()) { - if (IsChromeBootstrap()) { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + if (!IsChromeBootstrap()) { + EXPECT_TRUE(got_can_download_); + } else +#endif + { // No CanDownload for invalid protocol links. EXPECT_FALSE(got_can_download_); - } else { - EXPECT_TRUE(got_can_download_); } } else if (is_clicked()) { EXPECT_TRUE(got_can_download_); diff --git a/tests/ceftests/preference_unittest.cc b/tests/ceftests/preference_unittest.cc index 67c45485f..84c44cd67 100644 --- a/tests/ceftests/preference_unittest.cc +++ b/tests/ceftests/preference_unittest.cc @@ -533,15 +533,18 @@ TEST(PreferenceTest, RequestContextGlobalSetGetShared) { // Get the values from the 4th context. *PendingAction() = "Get the values from the 4th context."; - if (IsChromeBootstrap()) { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + if (!IsChromeBootstrap()) { + // They should be at the default. + ValidateDefaults(context4, false, event); + } else +#endif + { // With the Chrome runtime, prefs set via an incognito profile will become // an overlay on top of the global (parent) profile. The incognito profile // shares the prefs in this case because they were set via the global // profile. ValidateGet(context4, event); - } else { - // They should be at the default. - ValidateDefaults(context4, false, event); } event->Wait(); diff --git a/tests/ceftests/run_all_unittests.cc b/tests/ceftests/run_all_unittests.cc index b4db2a013..53ee48b20 100644 --- a/tests/ceftests/run_all_unittests.cc +++ b/tests/ceftests/run_all_unittests.cc @@ -233,15 +233,19 @@ int main(int argc, char* argv[]) { } // Log the current configuration. - LOG(WARNING) - << "Using " << (IsChromeBootstrap() ? "Chrome" : "Alloy") - << " bootstrap; " << (UseAlloyStyleBrowserGlobal() ? "Alloy" : "Chrome") - << " style browser; " - << (UseViewsGlobal() - ? (std::string(UseAlloyStyleWindowGlobal() ? "Alloy" : "Chrome") + - " style window; ") - : "") - << (UseViewsGlobal() ? "Views" : "Native") << "-hosted (not a warning)"; + LOG(WARNING) << "Using " +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + << (IsChromeBootstrap() ? "Chrome" : "Alloy") << " bootstrap; " +#endif + << (UseAlloyStyleBrowserGlobal() ? "Alloy" : "Chrome") + << " style browser; " + << (UseViewsGlobal() + ? (std::string(UseAlloyStyleWindowGlobal() ? "Alloy" + : "Chrome") + + " style window; ") + : "") + << (UseViewsGlobal() ? "Views" : "Native") + << "-hosted (not a warning)"; std::unique_ptr message_loop; diff --git a/tests/ceftests/test_handler.cc b/tests/ceftests/test_handler.cc index 7d09d862a..51326fab2 100644 --- a/tests/ceftests/test_handler.cc +++ b/tests/ceftests/test_handler.cc @@ -26,10 +26,12 @@ namespace { cef_runtime_style_t GetExpectedRuntimeStyle(TestHandler* handler, bool is_devtools_popup, bool is_window) { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) if (!IsChromeBootstrap()) { // Alloy runtime always uses Alloy style. return CEF_RUNTIME_STYLE_ALLOY; } +#endif const bool alloy_requested = is_window ? handler->use_alloy_style_window() : handler->use_alloy_style_browser(); @@ -690,10 +692,12 @@ void TestHandler::SetUseViews(bool use_views) { void TestHandler::SetUseAlloyStyle(bool use_alloy_style_browser, bool use_alloy_style_window) { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) if (!IsChromeBootstrap()) { LOG(WARNING) << "SetUseAlloyStyle is ignored with the Alloy runtime"; return; } +#endif if (!CefCurrentlyOn(TID_UI)) { CefPostTask(TID_UI, base::BindOnce(&TestHandler::SetUseAlloyStyle, this, diff --git a/tests/ceftests/test_suite.cc b/tests/ceftests/test_suite.cc index e698c1895..cb18051a4 100644 --- a/tests/ceftests/test_suite.cc +++ b/tests/ceftests/test_suite.cc @@ -144,9 +144,11 @@ int CefTestSuite::Run() { } void CefTestSuite::GetSettings(CefSettings& settings) const { - // Enable the experimental Chrome runtime. See issue #2969 for details. +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + // Enable the Chrome runtime. See issue #2969 for details. settings.chrome_runtime = command_line_->HasSwitch(client::switches::kEnableChromeRuntime); +#endif CefString(&settings.cache_path) = root_cache_path_; CefString(&settings.root_cache_path) = root_cache_path_; diff --git a/tests/ceftests/test_util.cc b/tests/ceftests/test_util.cc index 4d1d2f875..50b1513d5 100644 --- a/tests/ceftests/test_util.cc +++ b/tests/ceftests/test_util.cc @@ -291,6 +291,7 @@ bool TestOldResourceAPI() { return state; } +#if !defined(DISABLE_ALLOY_BOOTSTRAP) bool IsChromeBootstrap() { static bool state = []() { return CefCommandLine::GetGlobalCommandLine()->HasSwitch( @@ -298,6 +299,7 @@ bool IsChromeBootstrap() { }(); return state; } +#endif bool UseViewsGlobal() { static bool use_views = []() { @@ -309,10 +311,12 @@ bool UseViewsGlobal() { bool UseAlloyStyleBrowserGlobal() { static bool use_alloy_style = []() { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) if (!IsChromeBootstrap()) { // Alloy runtime always uses Alloy style. return true; } +#endif return CefCommandLine::GetGlobalCommandLine()->HasSwitch( client::switches::kUseAlloyStyle); }(); @@ -321,10 +325,12 @@ bool UseAlloyStyleBrowserGlobal() { bool UseAlloyStyleWindowGlobal() { static bool use_alloy_style = []() { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) if (!IsChromeBootstrap()) { // Alloy runtime always uses Alloy style. return true; } +#endif auto command_line = CefCommandLine::GetGlobalCommandLine(); return command_line->HasSwitch(client::switches::kUseAlloyStyle) && !command_line->HasSwitch(client::switches::kUseChromeStyleWindow); @@ -335,39 +341,50 @@ bool UseAlloyStyleWindowGlobal() { std::string ComputeViewsWindowTitle(CefRefPtr window, CefRefPtr browser_view) { std::string title = "CefTest - Views - "; - if (IsChromeBootstrap()) { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + if (!IsChromeBootstrap()) { + title += "Alloy"; + } else +#endif + { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + title += "Chrome - "; +#endif std::string window_style = window->GetRuntimeStyle() == CEF_RUNTIME_STYLE_CHROME ? "Chrome" : "Alloy"; - title += "Chrome - " + window_style + " Window"; + title += window_style + " Window"; if (browser_view) { std::string browser_style = browser_view->GetRuntimeStyle() == CEF_RUNTIME_STYLE_CHROME ? "Chrome" : "Alloy"; title += " - " + browser_style + " BrowserView"; } - } else { - title += "Alloy"; } return title; } std::string ComputeNativeWindowTitle(bool use_alloy_style) { std::string title = "CefTest - Native - "; - if (IsChromeBootstrap()) { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + if (!IsChromeBootstrap()) { + title += "Alloy"; + } else +#endif + { title += "Chrome - "; title += use_alloy_style ? "Alloy Browser" : "Chrome Browser"; - } else { - title += "Alloy"; } return title; } bool IsBFCacheEnabled() { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) // Supported by the Chrome runtime only, see issue #3237. if (!IsChromeBootstrap()) { return false; } +#endif static bool state = []() { const std::string& value = @@ -379,13 +396,17 @@ bool IsBFCacheEnabled() { } bool IsSameSiteBFCacheEnabled() { - // Same-site BFCache is enabled by default starting in M101 and does not have - // a separate configuration flag. + // Same-site BFCache is enabled by default starting in M101 and does not + // have a separate configuration flag. return IsBFCacheEnabled(); } bool IgnoreURL(const std::string& url) { - return IsChromeBootstrap() && url.find("/favicon.ico") != std::string::npos; + return +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + IsChromeBootstrap() && +#endif + url.find("/favicon.ico") != std::string::npos; } std::optional GetConfiguredTestTimeout(int timeout_ms) { @@ -401,7 +422,11 @@ std::optional GetConfiguredTestTimeout(int timeout_ms) { return dval; } } +#if !defined(DISABLE_ALLOY_BOOTSTRAP) return IsChromeBootstrap() ? 2.0 : 1.0; +#else + return 2.0; +#endif }(); if (!multiplier) { @@ -429,7 +454,10 @@ void SendMouseClickEvent(CefRefPtr browser, void GrantPopupPermission(CefRefPtr request_context, const std::string& parent_url) { - if (IsChromeBootstrap()) { +#if !defined(DISABLE_ALLOY_BOOTSTRAP) + if (IsChromeBootstrap()) +#endif + { static bool test_website_setting = []() { return CefCommandLine::GetGlobalCommandLine()->HasSwitch( "test-website-setting"); diff --git a/tests/ceftests/test_util.h b/tests/ceftests/test_util.h index 21c9c0fae..635e7a532 100644 --- a/tests/ceftests/test_util.h +++ b/tests/ceftests/test_util.h @@ -87,8 +87,10 @@ inline bool IsTestRequestContextModeCustom(TestRequestContextMode mode) { // Returns true if the old CefResourceHandler API should be tested. bool TestOldResourceAPI(); +#if !defined(DISABLE_ALLOY_BOOTSTRAP) // Returns true if the Chrome runtime is enabled. bool IsChromeBootstrap(); +#endif // Returns true if Views should be used as a the global default. bool UseViewsGlobal(); diff --git a/tests/shared/common/client_switches.cc b/tests/shared/common/client_switches.cc index 06edc0554..cfddbe173 100644 --- a/tests/shared/common/client_switches.cc +++ b/tests/shared/common/client_switches.cc @@ -43,9 +43,13 @@ const char kAlwaysOnTop[] = "always-on-top"; const char kHideTopMenu[] = "hide-top-menu"; const char kSslClientCertificate[] = "ssl-client-certificate"; const char kCRLSetsPath[] = "crl-sets-path"; +#if !defined(DISABLE_ALLOY_BOOTSTRAP) const char kLoadExtension[] = "load-extension"; +#endif const char kNoActivate[] = "no-activate"; +#if !defined(DISABLE_ALLOY_BOOTSTRAP) const char kEnableChromeRuntime[] = "enable-chrome-runtime"; +#endif const char kShowChromeToolbar[] = "show-chrome-toolbar"; const char kInitialShowState[] = "initial-show-state"; const char kUseDefaultPopup[] = "use-default-popup"; diff --git a/tests/shared/common/client_switches.h b/tests/shared/common/client_switches.h index df4e34e57..055bf1e99 100644 --- a/tests/shared/common/client_switches.h +++ b/tests/shared/common/client_switches.h @@ -37,9 +37,13 @@ extern const char kAlwaysOnTop[]; extern const char kHideTopMenu[]; extern const char kSslClientCertificate[]; extern const char kCRLSetsPath[]; +#if !defined(DISABLE_ALLOY_BOOTSTRAP) extern const char kLoadExtension[]; +#endif extern const char kNoActivate[]; +#if !defined(DISABLE_ALLOY_BOOTSTRAP) extern const char kEnableChromeRuntime[]; +#endif extern const char kShowChromeToolbar[]; extern const char kInitialShowState[]; extern const char kUseDefaultPopup[];