mirror of
				https://bitbucket.org/chromiumembedded/cef
				synced 2025-06-05 21:39:12 +02:00 
			
		
		
		
	Set enable_alloy_bootstrap=false to build with Alloy bootstrap code removed. Extension API is documented as deprecated in comments but not compiled out with this arg.
This commit is contained in:
		
							
								
								
									
										230
									
								
								BUILD.gn
									
									
									
									
									
								
							
							
						
						
									
										230
									
								
								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. | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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); | ||||
|  | ||||
|   /// | ||||
|   | ||||
| @@ -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. | ||||
|   | ||||
| @@ -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. | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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<CefExtension> 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; | ||||
|  | ||||
|   | ||||
| @@ -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: | ||||
|   | ||||
| @@ -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: | ||||
|   | ||||
| @@ -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<CefDictionaryValue> 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<CefString>& 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<CefExtension> GetExtension( | ||||
|       const CefString& extension_id) = 0; | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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> 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<CefBrowserInfo> info = | ||||
|       CefBrowserInfoManager::GetInstance()->CreateBrowserInfo( | ||||
| @@ -92,6 +99,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create( | ||||
|   auto request_context_impl = | ||||
|       static_cast<CefRequestContextImpl*>(create_params.request_context.get()); | ||||
|  | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|   CefRefPtr<CefExtension> cef_extension; | ||||
|   if (create_params.extension) { | ||||
|     auto cef_browser_context = request_context_impl->GetBrowserContext(); | ||||
| @@ -99,24 +107,39 @@ CefRefPtr<AlloyBrowserHostImpl> 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<AlloyBrowserHostImpl> 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> AlloyBrowserHostImpl::CreateInternal( | ||||
|     CefRefPtr<AlloyBrowserHostImpl> opener, | ||||
|     bool is_devtools_popup, | ||||
|     CefRefPtr<CefRequestContextImpl> request_context, | ||||
|     std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate, | ||||
|     CefRefPtr<CefExtension> extension) { | ||||
|     std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|     , | ||||
|     CefRefPtr<CefExtension> extension | ||||
| #endif | ||||
| ) { | ||||
|   CEF_REQUIRE_UIT(); | ||||
|   DCHECK(web_contents); | ||||
|   DCHECK(browser_info); | ||||
| @@ -169,7 +196,12 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal( | ||||
|  | ||||
|   CefRefPtr<AlloyBrowserHostImpl> 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<CefExtension> AlloyBrowserHostImpl::GetExtension() { | ||||
|   return extension_; | ||||
| } | ||||
| @@ -359,6 +392,7 @@ CefRefPtr<CefExtension> 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<AlloyBrowserHostImpl> 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<AlloyBrowserHostImpl> 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<CefBrowserInfo> browser_info, | ||||
|     CefRefPtr<AlloyBrowserHostImpl> opener, | ||||
|     CefRefPtr<CefRequestContextImpl> request_context, | ||||
|     std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate, | ||||
|     CefRefPtr<CefExtension> extension) | ||||
|     std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|     , | ||||
|     CefRefPtr<CefExtension> 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_) { | ||||
|   | ||||
| @@ -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<CefExtension> 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<void(content::NavigationHandle&)> | ||||
|           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<content::WebContents> 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<AlloyBrowserHostImpl> opener, | ||||
|       bool is_devtools_popup, | ||||
|       CefRefPtr<CefRequestContextImpl> request_context, | ||||
|       std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate, | ||||
|       CefRefPtr<CefExtension> extension); | ||||
|       std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|       , | ||||
|       CefRefPtr<CefExtension> extension | ||||
| #endif | ||||
|   ); | ||||
|  | ||||
|   AlloyBrowserHostImpl( | ||||
|       const CefBrowserSettings& settings, | ||||
| @@ -319,8 +336,12 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase, | ||||
|       scoped_refptr<CefBrowserInfo> browser_info, | ||||
|       CefRefPtr<AlloyBrowserHostImpl> opener, | ||||
|       CefRefPtr<CefRequestContextImpl> request_context, | ||||
|       std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate, | ||||
|       CefRefPtr<CefExtension> extension); | ||||
|       std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|       , | ||||
|       CefRefPtr<CefExtension> 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<CefExtension> extension_; | ||||
|   bool is_background_host_ = false; | ||||
| #endif | ||||
|  | ||||
|   // Represents the current browser destruction state. Only accessed on the UI | ||||
|   // thread. | ||||
|   | ||||
| @@ -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 { | ||||
|   | ||||
| @@ -7,37 +7,55 @@ | ||||
| #include <memory> | ||||
|  | ||||
| #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<content::SiteInstance> 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<AlloyWebContentsDialogHelper>(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<base::SupportsUserData::Data>()); | ||||
|  | ||||
| #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 | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -366,6 +366,7 @@ void CefBrowserContext::ClearSchemeHandlerFactories() { | ||||
|                                iothread_state_)); | ||||
| } | ||||
|  | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
| void CefBrowserContext::LoadExtension( | ||||
|     const CefString& root_directory, | ||||
|     CefRefPtr<CefDictionaryValue> 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(); | ||||
|   | ||||
| @@ -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<CefSchemeHandlerFactory> 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<CefDictionaryValue> manifest, | ||||
|                              CefRefPtr<CefExtensionHandler> 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. | ||||
|   | ||||
| @@ -731,6 +731,15 @@ void CefBrowserHostBase::NotifyMoveOrResizeStarted() { | ||||
| #endif | ||||
| } | ||||
|  | ||||
| CefRefPtr<CefExtension> CefBrowserHostBase::GetExtension() { | ||||
|   NOTIMPLEMENTED(); | ||||
|   return nullptr; | ||||
| } | ||||
|  | ||||
| bool CefBrowserHostBase::IsBackgroundHost() { | ||||
|   return false; | ||||
| } | ||||
|  | ||||
| bool CefBrowserHostBase::IsFullscreen() { | ||||
|   if (!CEF_CURRENTLY_ON_UIT()) { | ||||
|     DCHECK(false) << "called on invalid thread"; | ||||
|   | ||||
| @@ -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<CefBrowserHostBase> 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<CefDictionaryValue> 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<CefNavigationEntry> GetVisibleNavigationEntry() override; | ||||
|   void NotifyMoveOrResizeStarted() override; | ||||
|   CefRefPtr<CefExtension> GetExtension() override; | ||||
|   bool IsBackgroundHost() override; | ||||
|   bool IsFullscreen() override; | ||||
|   void ExitFullscreen(bool will_cause_resize) override; | ||||
|   bool IsRenderProcessUnresponsive() override; | ||||
|   | ||||
| @@ -154,9 +154,11 @@ CefRefPtr<CefBrowser> 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<CefWindowInfo>(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) { | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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) { | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
| @@ -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<CefBrowserPlatformDelegateNative> CreateNativeDelegate( | ||||
| @@ -109,6 +112,7 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create( | ||||
|     return std::make_unique<CefBrowserPlatformDelegateViews>( | ||||
|         std::move(native_delegate), | ||||
|         static_cast<CefBrowserViewImpl*>(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> CefBrowserPlatformDelegate::Create( | ||||
|         CreateNativeDelegate(CefWindowInfo(), background_color); | ||||
|     return std::make_unique<CefBrowserPlatformDelegateBackground>( | ||||
|         std::move(native_delegate)); | ||||
| #endif | ||||
|   } else if (create_params.window_info) { | ||||
|     std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate = | ||||
|         CreateNativeDelegate(*create_params.window_info, background_color); | ||||
|   | ||||
| @@ -780,9 +780,11 @@ std::unique_ptr<BrowserDelegate> BrowserDelegate::Create( | ||||
|     Browser* browser, | ||||
|     scoped_refptr<CreateParams> cef_params, | ||||
|     const Browser* opener) { | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|   if (!cef::IsChromeRuntimeEnabled()) { | ||||
|     return nullptr; | ||||
|   } | ||||
| #endif | ||||
|  | ||||
|   CefBrowserCreateParams create_params; | ||||
|  | ||||
|   | ||||
| @@ -68,35 +68,45 @@ CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::FromBaseChecked( | ||||
| // static | ||||
| CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForHost( | ||||
|     const content::RenderViewHost* host) { | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|   REQUIRE_CHROME_RUNTIME(); | ||||
| #endif | ||||
|   return FromBaseChecked(CefBrowserHostBase::GetBrowserForHost(host)); | ||||
| } | ||||
|  | ||||
| // static | ||||
| CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForHost( | ||||
|     const content::RenderFrameHost* host) { | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|   REQUIRE_CHROME_RUNTIME(); | ||||
| #endif | ||||
|   return FromBaseChecked(CefBrowserHostBase::GetBrowserForHost(host)); | ||||
| } | ||||
|  | ||||
| // static | ||||
| CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForContents( | ||||
|     const content::WebContents* contents) { | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|   REQUIRE_CHROME_RUNTIME(); | ||||
| #endif | ||||
|   return FromBaseChecked(CefBrowserHostBase::GetBrowserForContents(contents)); | ||||
| } | ||||
|  | ||||
| // static | ||||
| CefRefPtr<ChromeBrowserHostImpl> 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> 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<CefExtension> 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()) { | ||||
|   | ||||
| @@ -114,8 +114,6 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase { | ||||
|   void SetAutoResizeEnabled(bool enabled, | ||||
|                             const CefSize& min_size, | ||||
|                             const CefSize& max_size) override; | ||||
|   CefRefPtr<CefExtension> GetExtension() override; | ||||
|   bool IsBackgroundHost() override; | ||||
|   bool CanExecuteChromeCommand(int command_id) override; | ||||
|   void ExecuteChromeCommand(int command_id, | ||||
|                             cef_window_open_disposition_t disposition) override; | ||||
|   | ||||
| @@ -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. | ||||
|   | ||||
| @@ -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> CefDevToolsWindowRunner::Create() { | ||||
|   if (cef::IsChromeRuntimeEnabled()) { | ||||
|     return std::make_unique<ChromeDevToolsWindowRunner>(); | ||||
|   } | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|   if (cef::IsAlloyRuntimeEnabled()) { | ||||
|     return std::make_unique<AlloyDevToolsWindowRunner>(); | ||||
|   } | ||||
| #endif | ||||
|   return std::make_unique<ChromeDevToolsWindowRunner>(); | ||||
| } | ||||
|   | ||||
| @@ -12,7 +12,9 @@ namespace cef { | ||||
| // static | ||||
| std::unique_ptr<cef::DownloadManagerDelegate> DownloadManagerDelegate::Create( | ||||
|     content::DownloadManager* download_manager) { | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|   REQUIRE_CHROME_RUNTIME(); | ||||
| #endif | ||||
|   return std::make_unique<CefDownloadManagerDelegateImpl>( | ||||
|       download_manager, /*alloy_bootstrap=*/false); | ||||
| } | ||||
|   | ||||
| @@ -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<AlloyBrowserHostImpl> 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 | ||||
|   | ||||
| @@ -5,23 +5,12 @@ | ||||
| #ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_ | ||||
| #define CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_EXTENSIONS_UTIL_H_ | ||||
|  | ||||
| #include <vector> | ||||
|  | ||||
| #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<AlloyBrowserHostImpl> 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_ | ||||
|   | ||||
| @@ -6,7 +6,9 @@ | ||||
|  | ||||
| #include <memory> | ||||
|  | ||||
| #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<AlloyBrowserHostImpl> 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( | ||||
|   | ||||
| @@ -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<CefSchemeHandlerFactory> CefIOThreadState::GetSchemeHandlerFactory( | ||||
| @@ -121,9 +129,11 @@ CefRefPtr<CefSchemeHandlerFactory> CefIOThreadState::GetSchemeHandlerFactory( | ||||
|   return nullptr; | ||||
| } | ||||
|  | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
| void CefIOThreadState::InitOnIOThread() { | ||||
|   CEF_REQUIRE_IOT(); | ||||
|  | ||||
|   // Add the default internal handlers. | ||||
|   scheme::RegisterInternalHandlers(this); | ||||
| } | ||||
| #endif | ||||
|   | ||||
| @@ -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_; | ||||
|   | ||||
| @@ -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<CefMainRunnerDelegate> MakeDelegate( | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|     RuntimeType type, | ||||
| #endif | ||||
|     CefMainRunnerHandler* runner, | ||||
|     CefSettings* settings, | ||||
|     CefRefPtr<CefApp> application) { | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|   if (type == RuntimeType::ALLOY) { | ||||
|     g_runtime_type = RuntimeType::ALLOY; | ||||
|     return std::make_unique<AlloyMainRunnerDelegate>(runner, settings, | ||||
|                                                      application); | ||||
|   } else { | ||||
|   } | ||||
| #endif | ||||
|  | ||||
|   g_runtime_type = RuntimeType::CHROME; | ||||
|   return std::make_unique<ChromeMainRunnerDelegate>(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) | ||||
|   auto main_delegate = MakeDelegate( | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|       command_line.HasSwitch(switches::kEnableChromeRuntime) | ||||
|           ? RuntimeType::CHROME | ||||
|                           : RuntimeType::ALLOY; | ||||
|   auto main_delegate = MakeDelegate(runtime_type, /*runner=*/nullptr, | ||||
|                                     /*settings=*/nullptr, application); | ||||
|           : 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; | ||||
|   | ||||
| @@ -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()) { | ||||
|   | ||||
| @@ -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,16 +296,8 @@ class TemplateParser { | ||||
| bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) { | ||||
|   *mime_type = "text/html"; | ||||
|  | ||||
|   if (cef::IsChromeRuntimeEnabled()) { | ||||
|     // Redirect to the Chrome documentation. | ||||
|     *output = | ||||
|         "<html><head>\n" | ||||
|         "<meta http-equiv=\"refresh\" " | ||||
|         "content=\"0;URL='https://developer.chrome.com/docs/extensions/'\"/>\n" | ||||
|         "</head></html>\n"; | ||||
|     return true; | ||||
|   } | ||||
|  | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|   if (cef::IsAlloyRuntimeEnabled()) { | ||||
|     static const char kDevURL[] = "https://developer.chrome.com/extensions/"; | ||||
|  | ||||
|     std::string html = | ||||
| @@ -352,6 +346,16 @@ bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) { | ||||
|  | ||||
|     *output = html; | ||||
|     return true; | ||||
|   } | ||||
| #endif  // BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|  | ||||
|   // Redirect to the Chrome documentation. | ||||
|   *output = | ||||
|       "<html><head>\n" | ||||
|       "<meta http-equiv=\"refresh\" " | ||||
|       "content=\"0;URL='https://developer.chrome.com/docs/extensions/'\"/>\n" | ||||
|       "</head></html>\n"; | ||||
|   return true; | ||||
| } | ||||
|  | ||||
| bool OnLicenseUI(std::string* mime_type, std::string* output) { | ||||
| @@ -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(). | ||||
|   | ||||
| @@ -254,7 +254,11 @@ std::unique_ptr<permissions::PermissionPrompt> 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(); | ||||
|   | ||||
| @@ -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<PrefService> CreatePrefService(Profile* profile, | ||||
|                                                const base::FilePath& cache_path, | ||||
|                                                bool persist_user_preferences) { | ||||
| @@ -349,6 +356,7 @@ std::unique_ptr<PrefService> 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. | ||||
|   | ||||
| @@ -6,30 +6,36 @@ | ||||
| #define CEF_LIBCEF_BROWSER_PREFS_BROWSER_PREFS_H_ | ||||
|  | ||||
| #include <memory> | ||||
| #include <string> | ||||
|  | ||||
| #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<PrefService> 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 | ||||
|   | ||||
| @@ -4,15 +4,18 @@ | ||||
|  | ||||
| #include "libcef/browser/prefs/renderer_prefs.h" | ||||
|  | ||||
| #include <string> | ||||
| #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 | ||||
|   | ||||
| @@ -6,16 +6,21 @@ | ||||
| #define CEF_LIBCEF_BROWSER_PREFS_RENDERER_PREFS_H_ | ||||
| #pragma once | ||||
|  | ||||
| #include <string> | ||||
|  | ||||
| #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 | ||||
|  | ||||
|   | ||||
| @@ -490,6 +490,7 @@ void CefRequestContextImpl::LoadExtension( | ||||
|     const CefString& root_directory, | ||||
|     CefRefPtr<CefDictionaryValue> manifest, | ||||
|     CefRefPtr<CefExtensionHandler> 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<CefRequestContextImpl>(this))); | ||||
| #else | ||||
|   NOTIMPLEMENTED(); | ||||
| #endif | ||||
| } | ||||
|  | ||||
| bool CefRequestContextImpl::DidLoadExtension(const CefString& extension_id) { | ||||
| #if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
|   CefRefPtr<CefExtension> 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<CefString>& 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<CefExtension> 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<CefMediaRouter> CefRequestContextImpl::GetMediaRouter( | ||||
|   | ||||
| @@ -40,12 +40,17 @@ std::optional<cef_gesture_command_t> 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 | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
| } | ||||
|   | ||||
| @@ -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. | ||||
|   | ||||
| @@ -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[]; | ||||
|   | ||||
| @@ -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. | ||||
|   | ||||
| @@ -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[] = { | ||||
|   | ||||
| @@ -9,12 +9,18 @@ | ||||
| #include <string> | ||||
| #include <vector> | ||||
|  | ||||
| #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); | ||||
|   | ||||
| @@ -8,18 +8,24 @@ | ||||
| #include <dlfcn.h> | ||||
| #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; | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
| @@ -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", | ||||
|   ] | ||||
|   | ||||
| @@ -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 | ||||
| } | ||||
| @@ -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 | ||||
|  | ||||
|   | ||||
| @@ -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_ | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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<ui::SelectedFileInfo> 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<ui::SelectFileDialog::FileTypeInfo> | ||||
|  FileSelectHelper::GetFileTypesFromAcceptType( | ||||
| @@ -47,7 +53,7 @@ index 447a91b9ac380..51593091b5fa6 100644 | ||||
|    auto base_file_type = std::make_unique<ui::SelectFileDialog::FileTypeInfo>(); | ||||
|    if (accept_types.empty()) | ||||
|      return base_file_type; | ||||
| @@ -472,17 +487,24 @@ FileSelectHelper::GetFileTypesFromAcceptType( | ||||
| @@ -472,17 +493,24 @@ FileSelectHelper::GetFileTypesFromAcceptType( | ||||
|    std::vector<base::FilePath::StringType>* 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<content::FileSelectListener> 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<FileSelectHelper> 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) { | ||||
|   | ||||
| @@ -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); | ||||
| +  } | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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<ContextualNotificationPermissionUiSelector>()); | ||||
|    selectors.emplace_back(std::make_unique<PrefBasedQuietPermissionUiSelector>( | ||||
|        Profile::FromBrowserContext(browser_context))); | ||||
| +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
| +  if (!cef::IsAlloyRuntimeEnabled()) { | ||||
| +#endif | ||||
|    selectors.emplace_back(std::make_unique<PredictionBasedPermissionUiSelector>( | ||||
|        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<GeolocationPermissionContextDelegate>(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<permissions::GeolocationPermissionContext>( | ||||
| +            browser_context, | ||||
| +            std::move(delegates.geolocation_permission_context_delegate)); | ||||
| +  } else { | ||||
| +#endif | ||||
|    permission_contexts[ContentSettingsType::GEOLOCATION] = | ||||
|        std::make_unique<permissions::GeolocationPermissionContextSystem>( | ||||
|            browser_context, | ||||
|            std::move(delegates.geolocation_permission_context_delegate)); | ||||
| +#if BUILDFLAG(ENABLE_ALLOY_BOOTSTRAP) | ||||
| +  } | ||||
| +#endif | ||||
|  #else | ||||
|    permission_contexts[ContentSettingsType::GEOLOCATION] = | ||||
|        std::make_unique<permissions::GeolocationPermissionContext>( | ||||
|   | ||||
| @@ -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) | ||||
|  } | ||||
|   | ||||
|   | ||||
| @@ -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<ThemeSyncableService>(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 | ||||
|   | ||||
| @@ -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<std::string, std::string> 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); | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
|  } | ||||
|   | ||||
|   | ||||
| @@ -24,7 +24,7 @@ index ecabd51db586d..a7ae5e101ca02 100644 | ||||
|    Microsoft::WRL::ComPtr<ID3D11Texture2D> 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( | ||||
|   | ||||
| @@ -27,7 +27,7 @@ index 5d1658999d5bb..d1b7b7288c946 100644 | ||||
|        $i18n{cancel} | ||||
|      </cr-button> | ||||
| 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) | ||||
|   | ||||
| @@ -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<content::BrowserContext*()> 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<signin::IdentityManager*>( | ||||
|        GetInstance()->GetServiceForBrowserContext(profile, true)); | ||||
|  } | ||||
|   | ||||
| @@ -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()) { | ||||
| +#endif | ||||
| +  // Avoid loading ProfileSyncServiceFactory which depends on a lot of | ||||
| +  // unnecessary Chrome-specific factories. | ||||
| +    PopulateSyncLogs(response.get()); | ||||
|    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<const extensions::Extension>& 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 | ||||
|   | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
| @@ -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<CefFrame> frame, | ||||
| @@ -212,6 +213,7 @@ void LoadErrorPage(CefRefPtr<CefFrame> frame, | ||||
|   ss << "</body></html>"; | ||||
|   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<CefX509Certificate> cert, | ||||
| @@ -1078,11 +1080,13 @@ void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> 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<CefBrowser> 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<CefBrowser> browser, | ||||
|                     GetCertificateInformation(cert, ssl_info->GetCertStatus())); | ||||
|     } | ||||
|   } | ||||
| #endif | ||||
|  | ||||
|   return false;  // Cancel the request. | ||||
| } | ||||
| @@ -1248,12 +1254,14 @@ void ClientHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> 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<CefBrowser> browser, | ||||
|  | ||||
|   CefRefPtr<CefBrowserHost> 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<CefBrowser> 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 | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -76,9 +76,11 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> 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,7 +92,10 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> command_line, | ||||
|   } | ||||
|  | ||||
|   // Whether Alloy style will be used. | ||||
|   use_alloy_style_ = !use_chrome_bootstrap_ || | ||||
|   use_alloy_style_ = | ||||
| #if !defined(DISABLE_ALLOY_BOOTSTRAP) | ||||
|       !use_chrome_bootstrap_ || | ||||
| #endif | ||||
|       command_line_->HasSwitch(switches::kUseAlloyStyle); | ||||
|  | ||||
|   if (use_windowless_rendering_ && !use_alloy_style_) { | ||||
| @@ -100,7 +105,10 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> 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<CefCommandLine> 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<CefCommandLine> 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; | ||||
|   | ||||
| @@ -29,7 +29,9 @@ class MainContextImpl : public MainContext { | ||||
|   std::string GetAppWorkingDirectory() override; | ||||
|   std::string GetMainURL(CefRefPtr<CefCommandLine> 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_; | ||||
|  | ||||
|   | ||||
| @@ -35,6 +35,7 @@ class ClientRequestContextHandler : public CefRequestContextHandler, | ||||
|       CefRefPtr<CefRequestContext> request_context) override { | ||||
|     CEF_REQUIRE_UI_THREAD(); | ||||
|  | ||||
| #if !defined(DISABLE_ALLOY_BOOTSTRAP) | ||||
|     const auto main_context = MainContext::Get(); | ||||
|     CefRefPtr<CefCommandLine> 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<RootWindow> RootWindowManager::CreateRootWindow( | ||||
|   SanityCheckWindowConfig(/*is_devtools=*/false, config->use_views, | ||||
|                           config->use_alloy_style, config->with_osr); | ||||
|  | ||||
|   scoped_refptr<RootWindow> root_window = RootWindow::Create( | ||||
|       config->use_views, config->use_alloy_style); | ||||
|   scoped_refptr<RootWindow> 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<CefRequestContext> 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; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -26,7 +26,10 @@ class CorsBrowserTest : public client::ClientAppBrowser::Delegate { | ||||
|   CorsBrowserTest() = default; | ||||
|  | ||||
|   void OnContextInitialized(CefRefPtr<client::ClientAppBrowser> 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 | ||||
|   | ||||
| @@ -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_); | ||||
|   | ||||
| @@ -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(); | ||||
|  | ||||
|   | ||||
| @@ -233,15 +233,19 @@ int main(int argc, char* argv[]) { | ||||
|   } | ||||
|  | ||||
|   // Log the current configuration. | ||||
|   LOG(WARNING) | ||||
|       << "Using " << (IsChromeBootstrap() ? "Chrome" : "Alloy") | ||||
|       << " bootstrap; " << (UseAlloyStyleBrowserGlobal() ? "Alloy" : "Chrome") | ||||
|   LOG(WARNING) << "Using " | ||||
| #if !defined(DISABLE_ALLOY_BOOTSTRAP) | ||||
|                << (IsChromeBootstrap() ? "Chrome" : "Alloy") << " bootstrap; " | ||||
| #endif | ||||
|                << (UseAlloyStyleBrowserGlobal() ? "Alloy" : "Chrome") | ||||
|                << " style browser; " | ||||
|                << (UseViewsGlobal() | ||||
|               ? (std::string(UseAlloyStyleWindowGlobal() ? "Alloy" : "Chrome") + | ||||
|                        ? (std::string(UseAlloyStyleWindowGlobal() ? "Alloy" | ||||
|                                                                   : "Chrome") + | ||||
|                           " style window; ") | ||||
|                        : "") | ||||
|       << (UseViewsGlobal() ? "Views" : "Native") << "-hosted (not a warning)"; | ||||
|                << (UseViewsGlobal() ? "Views" : "Native") | ||||
|                << "-hosted (not a warning)"; | ||||
|  | ||||
|   std::unique_ptr<client::MainMessageLoop> message_loop; | ||||
|  | ||||
|   | ||||
| @@ -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, | ||||
|   | ||||
| @@ -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_; | ||||
|   | ||||
| @@ -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<CefWindow> window, | ||||
|                                     CefRefPtr<CefBrowserView> 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<int> GetConfiguredTestTimeout(int timeout_ms) { | ||||
| @@ -401,7 +422,11 @@ std::optional<int> 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<CefBrowser> browser, | ||||
|  | ||||
| void GrantPopupPermission(CefRefPtr<CefRequestContext> 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"); | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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"; | ||||
|   | ||||
| @@ -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[]; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user