mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
4d3b0b471a | ||
|
9cda95325a | ||
|
5c4a81b6da | ||
|
e7d470d7fa | ||
|
2a5115d714 | ||
|
e881df93e2 | ||
|
1e0a38f97a | ||
|
6992d44e70 | ||
|
82c7c57f46 | ||
|
bbcaed404c | ||
|
016ec9c313 | ||
|
2af7b91155 | ||
|
c6b2e4d3d2 | ||
|
ce31761f51 | ||
|
c4cb1d9fb5 | ||
|
7769a62c96 | ||
|
88ff72fbfe | ||
|
9cfc2240ce | ||
|
db52e363d3 | ||
|
a44b59f98d | ||
|
e2be512668 | ||
|
b98db30da2 | ||
|
fbb8dbbc80 | ||
|
b5d542d38d | ||
|
9ec3172ffa | ||
|
a6c32e1b47 | ||
|
4080d513c3 | ||
|
79f4ad960d | ||
|
fe119b9d65 | ||
|
e696c22afb | ||
|
3837cce584 | ||
|
6d1b699385 | ||
|
33542810c6 | ||
|
092056ce2d | ||
|
2a9696c162 | ||
|
fcbf3c4ec3 | ||
|
033c246f5c | ||
|
2201028eaf | ||
|
7a4b55f970 |
86
BUILD.gn
86
BUILD.gn
@@ -465,22 +465,12 @@ source_set("libcef_static") {
|
||||
"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",
|
||||
@@ -538,14 +528,9 @@ source_set("libcef_static") {
|
||||
"libcef/browser/chrome/chrome_content_browser_client_cef.h",
|
||||
"libcef/browser/chrome/chrome_context_menu_handler.cc",
|
||||
"libcef/browser/chrome/chrome_context_menu_handler.h",
|
||||
"libcef/browser/chrome/chrome_devtools_window_runner.cc",
|
||||
"libcef/browser/chrome/chrome_devtools_window_runner.h",
|
||||
"libcef/browser/chrome/chrome_startup_browser_creator.cc",
|
||||
"libcef/browser/chrome/chrome_startup_browser_creator.h",
|
||||
"libcef/browser/chrome/chrome_web_contents_view_delegate_cef.h",
|
||||
"libcef/browser/chrome_crash_reporter_client_stub.cc",
|
||||
"libcef/browser/chrome/extensions/chrome_extension_util.cc",
|
||||
"libcef/browser/chrome/extensions/chrome_extension_util.h",
|
||||
"libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.cc",
|
||||
"libcef/browser/chrome/extensions/chrome_mime_handler_view_guest_delegate_cef.h",
|
||||
"libcef/browser/chrome/views/browser_platform_delegate_chrome_child_window.cc",
|
||||
@@ -570,16 +555,18 @@ source_set("libcef_static") {
|
||||
"libcef/browser/context_menu_params_impl.h",
|
||||
"libcef/browser/devtools/devtools_controller.cc",
|
||||
"libcef/browser/devtools/devtools_controller.h",
|
||||
"libcef/browser/devtools/devtools_protocol_manager.cc",
|
||||
"libcef/browser/devtools/devtools_protocol_manager.h",
|
||||
"libcef/browser/devtools/devtools_window_runner.h",
|
||||
"libcef/browser/devtools/devtools_window_runner_create.cc",
|
||||
"libcef/browser/devtools/devtools_file_manager.cc",
|
||||
"libcef/browser/devtools/devtools_file_manager.h",
|
||||
"libcef/browser/devtools/devtools_frontend.cc",
|
||||
"libcef/browser/devtools/devtools_frontend.h",
|
||||
"libcef/browser/devtools/devtools_manager.cc",
|
||||
"libcef/browser/devtools/devtools_manager.h",
|
||||
"libcef/browser/devtools/devtools_manager_delegate.cc",
|
||||
"libcef/browser/devtools/devtools_manager_delegate.h",
|
||||
"libcef/browser/download_item_impl.cc",
|
||||
"libcef/browser/download_item_impl.h",
|
||||
"libcef/browser/download_manager_delegate.cc",
|
||||
"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",
|
||||
@@ -633,8 +620,6 @@ source_set("libcef_static") {
|
||||
"libcef/browser/frame_service_base.h",
|
||||
"libcef/browser/global_preference_manager_impl.cc",
|
||||
"libcef/browser/global_preference_manager_impl.h",
|
||||
"libcef/browser/hang_monitor.cc",
|
||||
"libcef/browser/hang_monitor.h",
|
||||
"libcef/browser/image_impl.cc",
|
||||
"libcef/browser/image_impl.h",
|
||||
"libcef/browser/iothread_state.cc",
|
||||
@@ -787,8 +772,6 @@ source_set("libcef_static") {
|
||||
"libcef/browser/views/browser_view_view.h",
|
||||
"libcef/browser/views/button_impl.h",
|
||||
"libcef/browser/views/button_view.h",
|
||||
"libcef/browser/views/color_provider_tracker.cc",
|
||||
"libcef/browser/views/color_provider_tracker.h",
|
||||
"libcef/browser/views/display_impl.cc",
|
||||
"libcef/browser/views/display_impl.h",
|
||||
"libcef/browser/views/fill_layout_impl.cc",
|
||||
@@ -824,11 +807,7 @@ source_set("libcef_static") {
|
||||
"libcef/browser/views/view_util.cc",
|
||||
"libcef/browser/views/view_util.h",
|
||||
"libcef/browser/views/view_view.h",
|
||||
"libcef/browser/views/widget.cc",
|
||||
"libcef/browser/views/widget.h",
|
||||
"libcef/browser/views/widget_destruction_observer.h",
|
||||
"libcef/browser/views/widget_impl.cc",
|
||||
"libcef/browser/views/widget_impl.h",
|
||||
"libcef/browser/views/window_impl.cc",
|
||||
"libcef/browser/views/window_impl.h",
|
||||
"libcef/browser/views/window_view.cc",
|
||||
@@ -936,8 +915,6 @@ source_set("libcef_static") {
|
||||
"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",
|
||||
@@ -950,10 +927,12 @@ source_set("libcef_static") {
|
||||
"libcef/renderer/dom_document_impl.h",
|
||||
"libcef/renderer/dom_node_impl.cc",
|
||||
"libcef/renderer/dom_node_impl.h",
|
||||
"libcef/renderer/extensions/extensions_renderer_api_provider.cc",
|
||||
"libcef/renderer/extensions/extensions_renderer_api_provider.h",
|
||||
"libcef/renderer/extensions/extensions_dispatcher_delegate.cc",
|
||||
"libcef/renderer/extensions/extensions_dispatcher_delegate.h",
|
||||
"libcef/renderer/extensions/extensions_renderer_client.cc",
|
||||
"libcef/renderer/extensions/extensions_renderer_client.h",
|
||||
"libcef/renderer/extensions/print_render_frame_helper_delegate.cc",
|
||||
"libcef/renderer/extensions/print_render_frame_helper_delegate.h",
|
||||
"libcef/renderer/frame_impl.cc",
|
||||
"libcef/renderer/frame_impl.h",
|
||||
"libcef/renderer/render_frame_observer.cc",
|
||||
@@ -1142,30 +1121,27 @@ source_set("libcef_static") {
|
||||
"libcef/common/util_linux.cc",
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//build/config/freetype",
|
||||
"//third_party/fontconfig",
|
||||
]
|
||||
|
||||
if (ozone_platform_x11) {
|
||||
sources += [
|
||||
"libcef/browser/native/window_x11.cc",
|
||||
"libcef/browser/native/window_x11.h",
|
||||
]
|
||||
} else {
|
||||
deps += [ "//third_party/angle:libEGL" ]
|
||||
}
|
||||
|
||||
if (use_dbus) {
|
||||
deps += [ "//dbus" ]
|
||||
defines = [ "USE_DBUS" ]
|
||||
deps += [
|
||||
"//build/config/freetype",
|
||||
"//third_party/fontconfig",
|
||||
]
|
||||
|
||||
if (is_linux && !ozone_platform_x11) {
|
||||
deps += [
|
||||
"//third_party/angle:libEGL",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
sources += includes_mac + [
|
||||
"libcef/browser/chrome/chrome_content_browser_client_cef_mac.mm",
|
||||
"libcef/browser/chrome/chrome_web_contents_view_delegate_cef_mac.mm",
|
||||
"libcef/browser/native/browser_platform_delegate_native_mac.h",
|
||||
"libcef/browser/native/browser_platform_delegate_native_mac.mm",
|
||||
"libcef/browser/native/cursor_util_mac.mm",
|
||||
@@ -1187,10 +1163,6 @@ source_set("libcef_static") {
|
||||
"//chrome/app/chrome_main_mac.h",
|
||||
"//chrome/app/chrome_main_mac.mm",
|
||||
]
|
||||
} else {
|
||||
sources += [
|
||||
"libcef/browser/chrome/chrome_web_contents_view_delegate_cef.cc",
|
||||
]
|
||||
}
|
||||
|
||||
if (ozone_platform_x11) {
|
||||
@@ -1504,20 +1476,6 @@ action("make_config_header") {
|
||||
args = rebase_path(outputs + [ "$root_out_dir/args.gn" ], root_build_dir)
|
||||
}
|
||||
|
||||
# Generate cef_color_ids.h.
|
||||
action("make_colorids_header") {
|
||||
script = "tools/make_colorids_header.py"
|
||||
|
||||
inputs = [
|
||||
"//ui/color/color_id.h",
|
||||
"//components/color/color_id.h",
|
||||
"//chrome/browser/ui/color/chrome_color_id.h",
|
||||
]
|
||||
outputs = [ "$root_out_dir/includes/include/cef_color_ids.h" ]
|
||||
|
||||
args = rebase_path(outputs + inputs, root_build_dir)
|
||||
}
|
||||
|
||||
# Generate pack files and associated CEF header files.
|
||||
group("cef_make_headers") {
|
||||
deps = [
|
||||
@@ -1526,7 +1484,6 @@ group("cef_make_headers") {
|
||||
":make_pack_header_command_ids",
|
||||
":make_api_hash_header",
|
||||
":make_config_header",
|
||||
":make_colorids_header",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2005,7 +1962,6 @@ if (is_mac) {
|
||||
]
|
||||
frameworks = [
|
||||
"AppKit.framework",
|
||||
"IOSurface.framework",
|
||||
"OpenGL.framework",
|
||||
]
|
||||
defines = [
|
||||
|
@@ -7,6 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/125.0.6422.142',
|
||||
'depot_tools_checkout': '3e4ab13934'
|
||||
'chromium_checkout': 'refs/tags/121.0.6167.184',
|
||||
'depot_tools_checkout': '6444de14d1'
|
||||
}
|
||||
|
@@ -38,8 +38,7 @@
|
||||
'chrome/common/extensions/api/*_features.json',
|
||||
'chrome/renderer/chrome_content_renderer_client.*',
|
||||
'chrome/renderer/extensions/chrome_extensions_renderer_client.*',
|
||||
'components/content_settings/core/common/content_settings_types.mojom',
|
||||
'components/permissions/request_type.h',
|
||||
'components/content_settings/core/common/content_settings_types.h',
|
||||
'content/browser/renderer_host/render_widget_host_view_base.*',
|
||||
'content/public/browser/content_browser_client.*',
|
||||
'content/public/browser/render_widget_host_view.h',
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# by hand. See the translator.README.txt file in the tools directory for
|
||||
# more information.
|
||||
#
|
||||
# $hash=3b28f3236c16d2b776a44674ae3bae0a070e9f27$
|
||||
# $hash=25599539f43226aac01bfcb74f19ac74217aee9a$
|
||||
#
|
||||
|
||||
{
|
||||
@@ -85,7 +85,6 @@
|
||||
'include/cef_task.h',
|
||||
'include/cef_thread.h',
|
||||
'include/cef_trace.h',
|
||||
'include/cef_unresponsive_process_callback.h',
|
||||
'include/cef_urlrequest.h',
|
||||
'include/cef_v8.h',
|
||||
'include/cef_values.h',
|
||||
@@ -190,7 +189,6 @@
|
||||
'include/capi/cef_task_capi.h',
|
||||
'include/capi/cef_thread_capi.h',
|
||||
'include/capi/cef_trace_capi.h',
|
||||
'include/capi/cef_unresponsive_process_callback_capi.h',
|
||||
'include/capi/cef_urlrequest_capi.h',
|
||||
'include/capi/cef_v8_capi.h',
|
||||
'include/capi/cef_values_capi.h',
|
||||
@@ -510,8 +508,6 @@
|
||||
'libcef_dll/cpptoc/urlrequest_cpptoc.h',
|
||||
'libcef_dll/ctocpp/urlrequest_client_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/urlrequest_client_ctocpp.h',
|
||||
'libcef_dll/cpptoc/unresponsive_process_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/unresponsive_process_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/v8accessor_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/v8accessor_ctocpp.h',
|
||||
'libcef_dll/ctocpp/v8array_buffer_release_callback_ctocpp.cc',
|
||||
@@ -840,8 +836,6 @@
|
||||
'libcef_dll/ctocpp/urlrequest_ctocpp.h',
|
||||
'libcef_dll/cpptoc/urlrequest_client_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/urlrequest_client_cpptoc.h',
|
||||
'libcef_dll/ctocpp/unresponsive_process_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/unresponsive_process_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/v8accessor_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/v8accessor_cpptoc.h',
|
||||
'libcef_dll/cpptoc/v8array_buffer_release_callback_cpptoc.cc',
|
||||
|
@@ -29,7 +29,6 @@
|
||||
'include/base/cef_weak_ptr.h',
|
||||
'include/base/internal/cef_bind_internal.h',
|
||||
'include/base/internal/cef_callback_internal.h',
|
||||
'include/base/internal/cef_color_id_macros.inc',
|
||||
'include/base/internal/cef_lock_impl.h',
|
||||
'include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h',
|
||||
'include/base/internal/cef_scoped_policy.h',
|
||||
@@ -56,8 +55,6 @@
|
||||
'include/internal/cef_types.h',
|
||||
'include/internal/cef_types_content_settings.h',
|
||||
'include/internal/cef_types_geometry.h',
|
||||
'include/internal/cef_types_runtime.h',
|
||||
'include/internal/cef_types_color.h',
|
||||
],
|
||||
'includes_capi': [
|
||||
'include/capi/cef_base_capi.h',
|
||||
@@ -223,8 +220,6 @@
|
||||
'tests/shared/browser/util_win.h',
|
||||
],
|
||||
'cefclient_sources_browser': [
|
||||
'tests/cefclient/browser/base_client_handler.cc',
|
||||
'tests/cefclient/browser/base_client_handler.h',
|
||||
'tests/cefclient/browser/binary_transfer_test.cc',
|
||||
'tests/cefclient/browser/binary_transfer_test.h',
|
||||
'tests/cefclient/browser/binding_test.cc',
|
||||
@@ -245,11 +240,10 @@
|
||||
'tests/cefclient/browser/client_prefs.cc',
|
||||
'tests/cefclient/browser/client_prefs.h',
|
||||
'tests/cefclient/browser/client_types.h',
|
||||
'tests/cefclient/browser/default_client_handler.cc',
|
||||
'tests/cefclient/browser/default_client_handler.h',
|
||||
'tests/cefclient/browser/dialog_test.cc',
|
||||
'tests/cefclient/browser/dialog_test.h',
|
||||
'tests/cefclient/browser/hang_test.cc',
|
||||
'tests/cefclient/browser/hang_test.h',
|
||||
'tests/cefclient/browser/image_cache.cc',
|
||||
'tests/cefclient/browser/image_cache.h',
|
||||
'tests/cefclient/browser/main_context.cc',
|
||||
@@ -315,12 +309,11 @@
|
||||
'tests/cefclient/renderer/performance_test_tests.cc',
|
||||
],
|
||||
'cefclient_sources_resources': [
|
||||
'tests/cefclient/resources/binary_transfer.html',
|
||||
'tests/cefclient/resources/binding.html',
|
||||
'tests/cefclient/resources/dialogs.html',
|
||||
'tests/cefclient/resources/draggable.html',
|
||||
'tests/cefclient/resources/hang.html',
|
||||
'tests/cefclient/resources/ipc_performance.html',
|
||||
'tests/cefclient/resources/binary_transfer.html',
|
||||
'tests/cefclient/resources/localstorage.html',
|
||||
'tests/cefclient/resources/logo.png',
|
||||
'tests/cefclient/resources/media_router.html',
|
||||
|
@@ -304,9 +304,8 @@ if(OS_MAC)
|
||||
# Standard libraries.
|
||||
set(CEF_STANDARD_LIBS
|
||||
-lpthread
|
||||
"-framework AppKit"
|
||||
"-framework Cocoa"
|
||||
"-framework IOSurface"
|
||||
"-framework AppKit"
|
||||
)
|
||||
|
||||
# Find the newest available base SDK.
|
||||
|
@@ -1,50 +0,0 @@
|
||||
// Copyright 2019 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// The following macros are used to declare both the color id enumerations and
|
||||
// the stringized names of the enumeration elements for use in dump_colors. To
|
||||
// stringize the element names, define STRINGIZE_COLOR_IDS prior to including
|
||||
// this file. This file is intended to be included just before and just after
|
||||
// the enumeration or string array declarations.
|
||||
|
||||
#if !defined(COLOR_ID_MACROS_DEFINED)
|
||||
#define COLOR_ID_MACROS_DEFINED
|
||||
#if defined(STRINGIZE_COLOR_IDS)
|
||||
// Convert first token to string, throw away the rest.
|
||||
#define D1(enum_name) #enum_name
|
||||
#define D2(enum_name, enum_value) #enum_name
|
||||
#else // defined(STRINGIZE_COLOR_IDS)
|
||||
// Declare enum with optional assigned value.
|
||||
#define D1(enum_name) enum_name
|
||||
#define D2(enum_name, enum_value) enum_name = enum_value
|
||||
#endif // defined(STRINGIZE_COLOR_IDS)
|
||||
// Select which token in the declaration is the assigned value.
|
||||
// Use first and optional third token, ignore optional second.
|
||||
#define E1(enum_name) D1(enum_name)
|
||||
#define E2(enum_name, old_enum_name) D1(enum_name)
|
||||
#define E3(enum_name, old_enum_name, enum_value) D2(enum_name, enum_value)
|
||||
#define GET_E(_1, _2, _3, macro_name, ...) macro_name
|
||||
#if defined(COMPILER_MSVC)
|
||||
// Workaround for MSVC not properly expanding __VA_ARGS__.
|
||||
#define EXPAND(x) x
|
||||
#define E_CPONLY(...) EXPAND(E(__VA_ARGS__))
|
||||
#define E(...) EXPAND(GET_E(__VA_ARGS__, E3, E2, E1)(__VA_ARGS__)),
|
||||
#else // !defined(COMPILER_MSVC)
|
||||
#define E_CPONLY(...) E(__VA_ARGS__)
|
||||
#define E(...) GET_E(__VA_ARGS__, E3, E2, E1)(__VA_ARGS__),
|
||||
#endif // !defined(COMPILER_MSVC)
|
||||
#else // !defined(COLOR_ID_MACROS_DEFINED)
|
||||
#undef D1
|
||||
#undef D2
|
||||
#undef E1
|
||||
#undef E2
|
||||
#undef E3
|
||||
#if defined(COMPILER_MSVC)
|
||||
#undef EXPAND
|
||||
#endif
|
||||
#undef E_CPONLY
|
||||
#undef GET_E
|
||||
#undef E
|
||||
#undef COLOR_ID_MACROS_DEFINED
|
||||
#endif // !defined(COLOR_ID_MACROS_DEFINED)
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=dfa0d4d2da319b2fd5e92324fd14301b500ceb5c$
|
||||
// $hash=b9a2bad4a30bcb99384197c9f7409116dc5b376e$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_
|
||||
@@ -137,26 +137,15 @@ CEF_EXPORT int cef_execute_process(const cef_main_args_t* args,
|
||||
/// true (1) if initialization succeeds. Returns false (0) if initialization
|
||||
/// fails or if early exit is desired (for example, due to process singleton
|
||||
/// relaunch behavior). If this function returns false (0) then the application
|
||||
/// should exit immediately without calling any other CEF functions except,
|
||||
/// optionally, CefGetErrorCode. The |windows_sandbox_info| parameter is only
|
||||
/// used on Windows and may be NULL (see cef_sandbox_win.h for details).
|
||||
/// should exit immediately without calling any other CEF functions. The
|
||||
/// |windows_sandbox_info| parameter is only used on Windows and may be NULL
|
||||
/// (see cef_sandbox_win.h for details).
|
||||
///
|
||||
CEF_EXPORT int cef_initialize(const cef_main_args_t* args,
|
||||
const struct _cef_settings_t* settings,
|
||||
cef_app_t* application,
|
||||
void* windows_sandbox_info);
|
||||
|
||||
///
|
||||
/// This function can optionally be called on the main application thread after
|
||||
/// CefInitialize to retrieve the initialization exit code. When CefInitialize
|
||||
/// returns true (1) the exit code will be 0 (CEF_RESULT_CODE_NORMAL_EXIT).
|
||||
/// Otherwise, see cef_resultcode_t for possible exit code values including
|
||||
/// browser process initialization errors and normal early exit conditions (such
|
||||
/// as CEF_RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED for process singleton
|
||||
/// relaunch behavior).
|
||||
///
|
||||
CEF_EXPORT int cef_get_exit_code(void);
|
||||
|
||||
///
|
||||
/// This function should be called on the main application thread to shut down
|
||||
/// the CEF browser process before the application exits. Do not call any other
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=6ee74f31d37a1b5ab3c9c5ccbe2dce9841329b38$
|
||||
// $hash=d23df6f606a96b432905c5c80f29ab72915b8e01$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||
@@ -165,16 +165,15 @@ typedef struct _cef_browser_t {
|
||||
///
|
||||
/// Returns the frame with the specified identifier, or NULL if not found.
|
||||
///
|
||||
struct _cef_frame_t*(CEF_CALLBACK* get_frame_by_identifier)(
|
||||
struct _cef_frame_t*(CEF_CALLBACK* get_frame_byident)(
|
||||
struct _cef_browser_t* self,
|
||||
const cef_string_t* identifier);
|
||||
int64_t identifier);
|
||||
|
||||
///
|
||||
/// Returns the frame with the specified name, or NULL if not found.
|
||||
///
|
||||
struct _cef_frame_t*(CEF_CALLBACK* get_frame_by_name)(
|
||||
struct _cef_browser_t* self,
|
||||
const cef_string_t* name);
|
||||
struct _cef_frame_t*(CEF_CALLBACK* get_frame)(struct _cef_browser_t* self,
|
||||
const cef_string_t* name);
|
||||
|
||||
///
|
||||
/// Returns the number of frames that currently exist.
|
||||
@@ -185,7 +184,8 @@ typedef struct _cef_browser_t {
|
||||
/// Returns the identifiers of all existing frames.
|
||||
///
|
||||
void(CEF_CALLBACK* get_frame_identifiers)(struct _cef_browser_t* self,
|
||||
cef_string_list_t identifiers);
|
||||
size_t* identifiersCount,
|
||||
int64_t* identifiers);
|
||||
|
||||
///
|
||||
/// Returns the names of all existing frames.
|
||||
@@ -911,8 +911,6 @@ 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);
|
||||
|
||||
@@ -921,8 +919,6 @@ 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);
|
||||
|
||||
///
|
||||
@@ -978,24 +974,6 @@ typedef struct _cef_browser_host_t {
|
||||
struct _cef_browser_host_t* self,
|
||||
int command_id,
|
||||
cef_window_open_disposition_t disposition);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the render process associated with this browser is
|
||||
/// currently unresponsive as indicated by a lack of input event processing
|
||||
/// for at least 15 seconds. To receive associated state change notifications
|
||||
/// and optionally handle an unresponsive render process implement
|
||||
/// cef_request_handler_t::OnRenderProcessUnresponsive. This function can only
|
||||
/// be called on the UI thread.
|
||||
///
|
||||
int(CEF_CALLBACK* is_render_process_unresponsive)(
|
||||
struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
/// Returns the runtime style for this browser (ALLOY or CHROME). See
|
||||
/// cef_runtime_style_t documentation for details.
|
||||
///
|
||||
cef_runtime_style_t(CEF_CALLBACK* get_runtime_style)(
|
||||
struct _cef_browser_host_t* self);
|
||||
} cef_browser_host_t;
|
||||
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=d958d5bed7f909f6313facef3440fb8ba07a5c01$
|
||||
// $hash=f844d2a1e39d822129d0733f33c14d27481c36b7$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_
|
||||
@@ -44,7 +44,6 @@
|
||||
#include "include/capi/cef_client_capi.h"
|
||||
#include "include/capi/cef_command_line_capi.h"
|
||||
#include "include/capi/cef_preference_capi.h"
|
||||
#include "include/capi/cef_request_context_handler_capi.h"
|
||||
#include "include/capi/cef_values_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -148,26 +147,14 @@ typedef struct _cef_browser_process_handler_t {
|
||||
int64_t delay_ms);
|
||||
|
||||
///
|
||||
/// Return the default client for use with a newly created browser window
|
||||
/// (cef_browser_t object). If null is returned the cef_browser_t will be
|
||||
/// unmanaged (no callbacks will be executed for that cef_browser_t) and
|
||||
/// application shutdown will be blocked until the browser window is closed
|
||||
/// manually. This function is currently only used with the Chrome runtime
|
||||
/// when creating new browser windows via Chrome UI.
|
||||
/// Return the default client for use with a newly created browser window. If
|
||||
/// null is returned the browser will be unmanaged (no callbacks will be
|
||||
/// executed for that browser) and application shutdown will be blocked until
|
||||
/// the browser window is closed manually. This function is currently only
|
||||
/// used with the chrome runtime.
|
||||
///
|
||||
struct _cef_client_t*(CEF_CALLBACK* get_default_client)(
|
||||
struct _cef_browser_process_handler_t* self);
|
||||
|
||||
///
|
||||
/// Return the default handler for use with a new user or incognito profile
|
||||
/// (cef_request_context_t object). If null is returned the
|
||||
/// cef_request_context_t will be unmanaged (no callbacks will be executed for
|
||||
/// that cef_request_context_t). This function is currently only used with the
|
||||
/// Chrome runtime when creating new browser windows via Chrome UI.
|
||||
///
|
||||
struct _cef_request_context_handler_t*(
|
||||
CEF_CALLBACK* get_default_request_context_handler)(
|
||||
struct _cef_browser_process_handler_t* self);
|
||||
} cef_browser_process_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=76ba2e59636aa71c8c6286093198a1e64d012c62$
|
||||
// $hash=50e59e2d7038a1be0d3a2451c9b7073aee5156ef$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
|
||||
@@ -126,8 +126,8 @@ typedef struct _cef_cookie_manager_t {
|
||||
/// cef_settings_t.cache_path if specified or in memory otherwise. If |callback|
|
||||
/// is non-NULL it will be executed asnychronously on the UI thread after the
|
||||
/// manager's storage has been initialized. Using this function is equivalent to
|
||||
/// calling cef_request_context_t::cef_request_context_get_global_context()-
|
||||
/// >GetDefaultCookieManager().
|
||||
/// calling cef_request_context_t::cef_request_context_get_global_context()->Get
|
||||
/// DefaultCookieManager().
|
||||
///
|
||||
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=7ecfb07a95315ff81937e9f68d419122fc88f1b7$
|
||||
// $hash=60a08a60be70e8fe5df17f18f8e5758e1830d5e1$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DOWNLOAD_HANDLER_CAPI_H_
|
||||
@@ -117,13 +117,12 @@ typedef struct _cef_download_handler_t {
|
||||
|
||||
///
|
||||
/// Called before a download begins. |suggested_name| is the suggested name
|
||||
/// for the download file. Return true (1) and execute |callback| either
|
||||
/// asynchronously or in this function to continue or cancel the download.
|
||||
/// Return false (0) to proceed with default handling (cancel with Alloy
|
||||
/// style, download shelf with Chrome style). Do not keep a reference to
|
||||
/// |download_item| outside of this function.
|
||||
/// for the download file. By default the download will be canceled. Execute
|
||||
/// |callback| either asynchronously or in this function to continue the
|
||||
/// download if desired. Do not keep a reference to |download_item| outside of
|
||||
/// this function.
|
||||
///
|
||||
int(CEF_CALLBACK* on_before_download)(
|
||||
void(CEF_CALLBACK* on_before_download)(
|
||||
struct _cef_download_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_download_item_t* download_item,
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=634054ad25154c30fb4ec630fe7fb79b0cf1f9b3$
|
||||
// $hash=0ca2b788f70f8c9f5b2706d691d8e063be00ed19$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_
|
||||
@@ -54,8 +54,6 @@ 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=ebac34c9b85de780ce7524211c5dd61a80d4576c$
|
||||
// $hash=5cfff4465a586d2b2ea7b54a9549096faec415f6$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_
|
||||
@@ -80,8 +80,6 @@ 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=8f347a95168778ec0e686cdef93be3bc517e2f68$
|
||||
// $hash=7294486141b2377198e994048a768db4a7cb9cd0$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
|
||||
@@ -178,12 +178,10 @@ typedef struct _cef_frame_t {
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_name)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Returns the globally unique identifier for this frame or NULL if the
|
||||
/// Returns the globally unique identifier for this frame or < 0 if the
|
||||
/// underlying frame does not yet exist.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_identifier)(
|
||||
struct _cef_frame_t* self);
|
||||
int64_t(CEF_CALLBACK* get_identifier)(struct _cef_frame_t* self);
|
||||
|
||||
///
|
||||
/// Returns the parent of this frame or NULL if this is the main (top-level)
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=8eec1100e8470cbe3ebc54d5962416d2fa4d57fb$
|
||||
// $hash=62e7e781f3fef0d332b6a921d48a192fd0115295$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||
@@ -114,8 +114,8 @@ typedef struct _cef_media_router_t {
|
||||
/// Returns the MediaRouter object associated with the global request context.
|
||||
/// If |callback| is non-NULL it will be executed asnychronously on the UI
|
||||
/// thread after the manager's storage has been initialized. Equivalent to
|
||||
/// calling cef_request_context_t::cef_request_context_get_global_context()-
|
||||
/// >get_media_router().
|
||||
/// calling cef_request_context_t::cef_request_context_get_global_context()->get
|
||||
/// _media_router().
|
||||
///
|
||||
CEF_EXPORT cef_media_router_t* cef_media_router_get_global(
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=5151b6ea3c06e46a75f2cd7679044a2891063d29$
|
||||
// $hash=5309b2f6da62526ed92c928c0918bc27898cf03b$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
|
||||
@@ -149,27 +149,17 @@ typedef struct _cef_render_handler_t {
|
||||
/// Called when an element has been rendered to the shared texture handle.
|
||||
/// |type| indicates whether the element is the view or the popup widget.
|
||||
/// |dirtyRects| contains the set of rectangles in pixel coordinates that need
|
||||
/// to be repainted. |info| contains the shared handle; on Windows it is a
|
||||
/// HANDLE to a texture that can be opened with D3D11 OpenSharedResource, on
|
||||
/// macOS it is an IOSurface pointer that can be opened with Metal or OpenGL,
|
||||
/// and on Linux it contains several planes, each with an fd to the underlying
|
||||
/// system native buffer.
|
||||
/// to be repainted. |shared_handle| is the handle for a D3D11 Texture2D that
|
||||
/// can be accessed via ID3D11Device using the OpenSharedResource function.
|
||||
/// This function is only called when cef_window_tInfo::shared_texture_enabled
|
||||
/// is set to true (1), and is currently only supported on Windows.
|
||||
///
|
||||
/// The underlying implementation uses a pool to deliver frames. As a result,
|
||||
/// the handle may differ every frame depending on how many frames are in-
|
||||
/// progress. The handle's resource cannot be cached and cannot be accessed
|
||||
/// outside of this callback. It should be reopened each time this callback is
|
||||
/// executed and the contents should be copied to a texture owned by the
|
||||
/// client application. The contents of |info| will be released back to the
|
||||
/// pool after this callback returns.
|
||||
///
|
||||
void(CEF_CALLBACK* on_accelerated_paint)(
|
||||
struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_paint_element_type_t type,
|
||||
size_t dirtyRectsCount,
|
||||
cef_rect_t const* dirtyRects,
|
||||
const cef_accelerated_paint_info_t* info);
|
||||
void(CEF_CALLBACK* on_accelerated_paint)(struct _cef_render_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_paint_element_type_t type,
|
||||
size_t dirtyRectsCount,
|
||||
cef_rect_t const* dirtyRects,
|
||||
void* shared_handle);
|
||||
|
||||
///
|
||||
/// Called to retrieve the size of the touch handle for the specified
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=2c496139ca9a59303b1493ee93d2c3ae96a956c0$
|
||||
// $hash=23302ef6e4458aa3e7065aeaca3421a6f0b58361$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
|
||||
@@ -253,8 +253,6 @@ 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,
|
||||
@@ -266,8 +264,6 @@ 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);
|
||||
|
||||
@@ -277,8 +273,6 @@ 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);
|
||||
|
||||
@@ -288,8 +282,6 @@ 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);
|
||||
|
||||
@@ -298,8 +290,6 @@ 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);
|
||||
@@ -378,39 +368,6 @@ typedef struct _cef_request_context_t {
|
||||
const cef_string_t* top_level_url,
|
||||
cef_content_setting_types_t content_type,
|
||||
cef_content_setting_values_t value);
|
||||
|
||||
///
|
||||
/// Sets the Chrome color scheme for all browsers that share this request
|
||||
/// context. |variant| values of SYSTEM, LIGHT and DARK change the underlying
|
||||
/// color mode (e.g. light vs dark). Other |variant| values determine how
|
||||
/// |user_color| will be applied in the current color mode. If |user_color| is
|
||||
/// transparent (0) the default color will be used.
|
||||
///
|
||||
void(CEF_CALLBACK* set_chrome_color_scheme)(
|
||||
struct _cef_request_context_t* self,
|
||||
cef_color_variant_t variant,
|
||||
cef_color_t user_color);
|
||||
|
||||
///
|
||||
/// Returns the current Chrome color scheme mode (SYSTEM, LIGHT or DARK). Must
|
||||
/// be called on the browser process UI thread.
|
||||
///
|
||||
cef_color_variant_t(CEF_CALLBACK* get_chrome_color_scheme_mode)(
|
||||
struct _cef_request_context_t* self);
|
||||
|
||||
///
|
||||
/// Returns the current Chrome color scheme color, or transparent (0) for the
|
||||
/// default color. Must be called on the browser process UI thread.
|
||||
///
|
||||
cef_color_t(CEF_CALLBACK* get_chrome_color_scheme_color)(
|
||||
struct _cef_request_context_t* self);
|
||||
|
||||
///
|
||||
/// Returns the current Chrome color scheme variant. Must be called on the
|
||||
/// browser process UI thread.
|
||||
///
|
||||
cef_color_variant_t(CEF_CALLBACK* get_chrome_color_scheme_variant)(
|
||||
struct _cef_request_context_t* self);
|
||||
} cef_request_context_t;
|
||||
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=2e8b5c5107f61e3d4c333dc02c76a9f30cd0cf83$
|
||||
// $hash=3b59c0bc014d773dedc24649071141ee2dd2125c$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||
@@ -48,7 +48,6 @@
|
||||
#include "include/capi/cef_request_capi.h"
|
||||
#include "include/capi/cef_resource_request_handler_capi.h"
|
||||
#include "include/capi/cef_ssl_info_capi.h"
|
||||
#include "include/capi/cef_unresponsive_process_callback_capi.h"
|
||||
#include "include/capi/cef_x509_certificate_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -223,53 +222,14 @@ typedef struct _cef_request_handler_t {
|
||||
void(CEF_CALLBACK* on_render_view_ready)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread when the render process is
|
||||
/// unresponsive as indicated by a lack of input event processing for at least
|
||||
/// 15 seconds. Return false (0) for the default behavior which is an
|
||||
/// indefinite wait with the Alloy runtime or display of the "Page
|
||||
/// unresponsive" dialog with the Chrome runtime. Return true (1) and don't
|
||||
/// execute the callback for an indefinite wait without display of the Chrome
|
||||
/// runtime dialog. Return true (1) and call
|
||||
/// cef_unresponsive_process_callback_t::Wait either in this function or at a
|
||||
/// later time to reset the wait timer, potentially triggering another call to
|
||||
/// this function if the process remains unresponsive. Return true (1) and
|
||||
/// call cef_unresponsive_process_callback_t:: Terminate either in this
|
||||
/// function or at a later time to terminate the unresponsive process,
|
||||
/// resulting in a call to OnRenderProcessTerminated.
|
||||
/// OnRenderProcessResponsive will be called if the process becomes responsive
|
||||
/// after this function is called. This functionality depends on the hang
|
||||
/// monitor which can be disabled by passing the `--disable-hang-monitor`
|
||||
/// command-line flag.
|
||||
///
|
||||
int(CEF_CALLBACK* on_render_process_unresponsive)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_unresponsive_process_callback_t* callback);
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread when the render process becomes
|
||||
/// responsive after previously being unresponsive. See documentation on
|
||||
/// OnRenderProcessUnresponsive.
|
||||
///
|
||||
void(CEF_CALLBACK* on_render_process_responsive)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread when the render process terminates
|
||||
/// unexpectedly. |status| indicates how the process terminated. |error_code|
|
||||
/// and |error_string| represent the error that would be displayed in Chrome's
|
||||
/// "Aw, Snap!" view. Possible |error_code| values include cef_resultcode_t
|
||||
/// non-normal exit values and platform-specific crash values (for example, a
|
||||
/// Posix signal or Windows hardware exception).
|
||||
/// unexpectedly. |status| indicates how the process terminated.
|
||||
///
|
||||
void(CEF_CALLBACK* on_render_process_terminated)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_termination_status_t status,
|
||||
int error_code,
|
||||
const cef_string_t* error_string);
|
||||
cef_termination_status_t status);
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread when the window.document object of
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=dd3f6003f9a8f59c2eb4320c382651a441086aee$
|
||||
// $hash=ba8011bd357e466a94acfd86597f44af00f096a3$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_
|
||||
@@ -116,8 +116,8 @@ typedef struct _cef_scheme_handler_factory_t {
|
||||
/// matches the specified |scheme_name| and optional |domain_name|. Returns
|
||||
/// false (0) if an error occurs. This function may be called on any thread in
|
||||
/// the browser process. Using this function is equivalent to calling cef_reques
|
||||
/// t_context_t::cef_request_context_get_global_context()-
|
||||
/// >register_scheme_handler_factory().
|
||||
/// t_context_t::cef_request_context_get_global_context()->register_scheme_handl
|
||||
/// er_factory().
|
||||
///
|
||||
CEF_EXPORT int cef_register_scheme_handler_factory(
|
||||
const cef_string_t* scheme_name,
|
||||
@@ -128,8 +128,8 @@ CEF_EXPORT int cef_register_scheme_handler_factory(
|
||||
/// Clear all scheme handler factories registered with the global request
|
||||
/// context. Returns false (0) on error. This function may be called on any
|
||||
/// thread in the browser process. Using this function is equivalent to calling
|
||||
/// cef_request_context_t::cef_request_context_get_global_context()-
|
||||
/// >clear_scheme_handler_factories().
|
||||
/// cef_request_context_t::cef_request_context_get_global_context()->clear_schem
|
||||
/// e_handler_factories().
|
||||
///
|
||||
CEF_EXPORT int cef_clear_scheme_handler_factories(void);
|
||||
|
||||
|
@@ -1,74 +0,0 @@
|
||||
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool and should not edited
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=9ad38f2709d9e3b1bd0e99c279b0497b8aa4c82a$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_UNRESPONSIVE_PROCESS_CALLBACK_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_UNRESPONSIVE_PROCESS_CALLBACK_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Callback structure for asynchronous handling of an unresponsive process.
|
||||
///
|
||||
typedef struct _cef_unresponsive_process_callback_t {
|
||||
///
|
||||
/// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
/// Reset the timeout for the unresponsive process.
|
||||
///
|
||||
void(CEF_CALLBACK* wait)(struct _cef_unresponsive_process_callback_t* self);
|
||||
|
||||
///
|
||||
/// Terminate the unresponsive process.
|
||||
///
|
||||
void(CEF_CALLBACK* terminate)(
|
||||
struct _cef_unresponsive_process_callback_t* self);
|
||||
} cef_unresponsive_process_callback_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_UNRESPONSIVE_PROCESS_CALLBACK_CAPI_H_
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=1c2fbbffaf51e90a2d55bfa7eb3fa3a4e315f4ac$
|
||||
// $hash=2e5a3b3b1f427a7eb1e6a447fe0d31c5ace49469$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_CAPI_H_
|
||||
@@ -93,13 +93,6 @@ typedef struct _cef_browser_view_t {
|
||||
///
|
||||
void(CEF_CALLBACK* set_prefer_accelerators)(struct _cef_browser_view_t* self,
|
||||
int prefer_accelerators);
|
||||
|
||||
///
|
||||
/// Returns the runtime style for this BrowserView (ALLOY or CHROME). See
|
||||
/// cef_runtime_style_t documentation for details.
|
||||
///
|
||||
cef_runtime_style_t(CEF_CALLBACK* get_runtime_style)(
|
||||
struct _cef_browser_view_t* self);
|
||||
} cef_browser_view_t;
|
||||
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=a0a9f2bfcdf8e05d3d1114fcd8860caaa726ec98$
|
||||
// $hash=1f2a6e206b86945386bef57167b80e2fb6067c59$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_DELEGATE_CAPI_H_
|
||||
@@ -141,13 +141,6 @@ typedef struct _cef_browser_view_delegate_t {
|
||||
struct _cef_browser_view_delegate_t* self,
|
||||
struct _cef_browser_view_t* browser_view,
|
||||
cef_gesture_command_t gesture_command);
|
||||
|
||||
///
|
||||
/// Optionally change the runtime style for this BrowserView. See
|
||||
/// cef_runtime_style_t documentation for details.
|
||||
///
|
||||
cef_runtime_style_t(CEF_CALLBACK* get_browser_runtime_style)(
|
||||
struct _cef_browser_view_delegate_t* self);
|
||||
} cef_browser_view_delegate_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=08f13de764f30261616372dfffb7f97c57957f73$
|
||||
// $hash=48df6ccac2c68f32c7024ae68c8a6b6a5f8ed914$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_
|
||||
@@ -338,30 +338,16 @@ typedef struct _cef_view_t {
|
||||
void(CEF_CALLBACK* request_focus)(struct _cef_view_t* self);
|
||||
|
||||
///
|
||||
/// Sets the background color for this View. The background color will be
|
||||
/// automatically reset when cef_view_delegate_t::OnThemeChanged is called.
|
||||
/// Sets the background color for this View.
|
||||
///
|
||||
void(CEF_CALLBACK* set_background_color)(struct _cef_view_t* self,
|
||||
cef_color_t color);
|
||||
|
||||
///
|
||||
/// Returns the background color for this View. If the background color is
|
||||
/// unset then the current `GetThemeColor(CEF_ColorPrimaryBackground)` value
|
||||
/// will be returned. If this View belongs to an overlay (created with
|
||||
/// cef_window_t::AddOverlayView), and the background color is unset, then a
|
||||
/// value of transparent (0) will be returned.
|
||||
/// Returns the background color for this View.
|
||||
///
|
||||
cef_color_t(CEF_CALLBACK* get_background_color)(struct _cef_view_t* self);
|
||||
|
||||
///
|
||||
/// Returns the current theme color associated with |color_id|, or the
|
||||
/// placeholder color (red) if unset. See cef_color_ids.h for standard ID
|
||||
/// values. Standard colors can be overridden and custom colors can be added
|
||||
/// using cef_window_t::SetThemeColor.
|
||||
///
|
||||
cef_color_t(CEF_CALLBACK* get_theme_color)(struct _cef_view_t* self,
|
||||
int color_id);
|
||||
|
||||
///
|
||||
/// Convert |point| from this View's coordinate system to DIP screen
|
||||
/// coordinates. This View must belong to a Window when calling this function.
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=0f562c026f64ca19a32834dcc1e1cd3a98be2f1f$
|
||||
// $hash=4e421d2d1e24df6e58f7a7c0c074056bc5284df4$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_DELEGATE_CAPI_H_
|
||||
@@ -140,28 +140,6 @@ typedef struct _cef_view_delegate_t {
|
||||
///
|
||||
void(CEF_CALLBACK* on_blur)(struct _cef_view_delegate_t* self,
|
||||
struct _cef_view_t* view);
|
||||
|
||||
///
|
||||
/// Called when the theme for |view| has changed, after the new theme colors
|
||||
/// have already been applied. Views are notified via the component hierarchy
|
||||
/// in depth-first reverse order (children before parents).
|
||||
///
|
||||
/// This will be called in the following cases:
|
||||
///
|
||||
/// 1. When |view|, or a parent of |view|, is added to a Window. 2. When the
|
||||
/// native/OS or Chrome theme changes for the Window that contains
|
||||
/// |view|. See CefWindowDelegate::OnThemeColorsChanged documentation.
|
||||
/// 3. When the client explicitly calls cef_window_t::ThemeChanged on the
|
||||
/// Window
|
||||
/// that contains |view|.
|
||||
///
|
||||
/// Optionally use this callback to override the new per-View theme colors by
|
||||
/// calling cef_view_t::SetBackgroundColor or the appropriate component-
|
||||
/// specific function. See cef_window_t::SetThemeColor documentation for how
|
||||
/// to customize additional Window theme colors.
|
||||
///
|
||||
void(CEF_CALLBACK* on_theme_changed)(struct _cef_view_delegate_t* self,
|
||||
struct _cef_view_t* view);
|
||||
} cef_view_delegate_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=dd32b58ec9aca0e04a1d30ccf94a741995fcc094$
|
||||
// $hash=dbe89dfdd14eb114e3f2d16fbfc55624bb91e7ce$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
|
||||
@@ -364,50 +364,6 @@ typedef struct _cef_window_t {
|
||||
/// Remove all keyboard accelerators.
|
||||
///
|
||||
void(CEF_CALLBACK* remove_all_accelerators)(struct _cef_window_t* self);
|
||||
|
||||
///
|
||||
/// Override a standard theme color or add a custom color associated with
|
||||
/// |color_id|. See cef_color_ids.h for standard ID values. Recommended usage
|
||||
/// is as follows:
|
||||
///
|
||||
/// 1. Customize the default native/OS theme by calling SetThemeColor before
|
||||
/// showing the first Window. When done setting colors call
|
||||
/// CefWindow::ThemeChanged to trigger CefViewDelegate::OnThemeChanged
|
||||
/// notifications.
|
||||
/// 2. Customize the current native/OS or Chrome theme after it changes by
|
||||
/// calling SetThemeColor from the CefWindowDelegate::OnThemeColorsChanged
|
||||
/// callback. CefViewDelegate::OnThemeChanged notifications will then be
|
||||
/// triggered automatically.
|
||||
///
|
||||
/// The configured color will be available immediately via
|
||||
/// cef_view_t::GetThemeColor and will be applied to each View in this
|
||||
/// Window's component hierarchy when cef_view_delegate_t::OnThemeChanged is
|
||||
/// called. See OnThemeColorsChanged documentation for additional details.
|
||||
///
|
||||
/// Clients wishing to add custom colors should use |color_id| values >=
|
||||
/// CEF_ChromeColorsEnd.
|
||||
///
|
||||
void(CEF_CALLBACK* set_theme_color)(struct _cef_window_t* self,
|
||||
int color_id,
|
||||
cef_color_t color);
|
||||
|
||||
///
|
||||
/// Trigger cef_view_delegate_t::OnThemeChanged callbacks for each View in
|
||||
/// this Window's component hierarchy. Unlike a native/OS or Chrome theme
|
||||
/// change this function does not reset theme colors to standard values and
|
||||
/// does not result in a call to cef_window_delegate_t::OnThemeColorsChanged.
|
||||
///
|
||||
/// Do not call this function from cef_window_delegate_t::OnThemeColorsChanged
|
||||
/// or cef_view_delegate_t::OnThemeChanged.
|
||||
///
|
||||
void(CEF_CALLBACK* theme_changed)(struct _cef_window_t* self);
|
||||
|
||||
///
|
||||
/// Returns the runtime style for this Window (ALLOY or CHROME). See
|
||||
/// cef_runtime_style_t documentation for details.
|
||||
///
|
||||
cef_runtime_style_t(CEF_CALLBACK* get_runtime_style)(
|
||||
struct _cef_window_t* self);
|
||||
} cef_window_t;
|
||||
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=e8c9e32caa8d317a7cb6ff2f0ad6be49cf1b7ad1$
|
||||
// $hash=c1c2705cdef7d9189557b57531dc2d53e9f68d0c$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
|
||||
@@ -182,20 +182,6 @@ typedef struct _cef_window_delegate_t {
|
||||
struct _cef_window_t* window,
|
||||
float* titlebar_height);
|
||||
|
||||
///
|
||||
/// Return whether the view should accept the initial mouse-down event,
|
||||
/// allowing it to respond to click-through behavior. If STATE_ENABLED is
|
||||
/// returned, the view will be sent a mouseDown: message for an initial mouse-
|
||||
/// down event, activating the view with one click, instead of clicking first
|
||||
/// to make the window active and then clicking the view.
|
||||
///
|
||||
/// This function is only supported on macOS. For more details, refer to the
|
||||
/// documentation of acceptsFirstMouse.
|
||||
///
|
||||
cef_state_t(CEF_CALLBACK* accepts_first_mouse)(
|
||||
struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window);
|
||||
|
||||
///
|
||||
/// Return true (1) if |window| can be resized.
|
||||
///
|
||||
@@ -238,50 +224,6 @@ typedef struct _cef_window_delegate_t {
|
||||
int(CEF_CALLBACK* on_key_event)(struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window,
|
||||
const cef_key_event_t* event);
|
||||
|
||||
///
|
||||
/// Called after the native/OS or Chrome theme for |window| has changed.
|
||||
/// |chrome_theme| will be true (1) if the notification is for a Chrome theme.
|
||||
///
|
||||
/// Native/OS theme colors are configured globally and do not need to be
|
||||
/// customized for each Window individually. An example of a native/OS theme
|
||||
/// change that triggers this callback is when the user switches between dark
|
||||
/// and light mode during application lifespan. Native/OS theme changes can be
|
||||
/// disabled by passing the `--force-dark-mode` or `--force-light-mode`
|
||||
/// command-line flag.
|
||||
///
|
||||
/// Chrome theme colors will be applied and this callback will be triggered
|
||||
/// if/when a BrowserView is added to the Window's component hierarchy. Chrome
|
||||
/// theme colors can be configured on a per-RequestContext basis using
|
||||
/// cef_request_context_t::SetChromeColorScheme or (Chrome runtime only) by
|
||||
/// visiting chrome://settings/manageProfile. Any theme changes using those
|
||||
/// mechanisms will also trigger this callback. Chrome theme colors will be
|
||||
/// persisted and restored from disk cache with the Chrome runtime, and with
|
||||
/// the Alloy runtime if persist_user_preferences is set to true (1) via
|
||||
/// CefSettings or cef_request_context_tSettings.
|
||||
///
|
||||
/// This callback is not triggered on Window creation so clients that wish to
|
||||
/// customize the initial native/OS theme must call
|
||||
/// cef_window_t::SetThemeColor and cef_window_t::ThemeChanged before showing
|
||||
/// the first Window.
|
||||
///
|
||||
/// Theme colors will be reset to standard values before this callback is
|
||||
/// called for the first affected Window. Call cef_window_t::SetThemeColor
|
||||
/// from inside this callback to override a standard color or add a custom
|
||||
/// color. cef_view_delegate_t::OnThemeChanged will be called after this
|
||||
/// callback for the complete |window| component hierarchy.
|
||||
///
|
||||
void(CEF_CALLBACK* on_theme_colors_changed)(
|
||||
struct _cef_window_delegate_t* self,
|
||||
struct _cef_window_t* window,
|
||||
int chrome_theme);
|
||||
|
||||
///
|
||||
/// Optionally change the runtime style for this Window. See
|
||||
/// cef_runtime_style_t documentation for details.
|
||||
///
|
||||
cef_runtime_style_t(CEF_CALLBACK* get_window_runtime_style)(
|
||||
struct _cef_window_delegate_t* self);
|
||||
} cef_window_delegate_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -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 "b0a002df95199c8a91e5b14159ff2a800c435ed9"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "3a73f4c69062c6f413e00c1821f6e6df91a2a787"
|
||||
#define CEF_API_HASH_PLATFORM "6e111c21cbae8da266044efde3d196dcd84e1d62"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "f5fb92747082f06a9c42724b0b717accc29e3879"
|
||||
#define CEF_API_HASH_PLATFORM "ea607f152a2b887b83e2f860992d1c922524049e"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "8775d620c6b17725bddba2c1c3a21353b4d8acb1"
|
||||
#define CEF_API_HASH_PLATFORM "28cde5b61a2fa3fe1a39923ef750d176ba8f58b3"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -71,9 +71,9 @@ int CefExecuteProcess(const CefMainArgs& args,
|
||||
/// true if initialization succeeds. Returns false if initialization fails or if
|
||||
/// early exit is desired (for example, due to process singleton relaunch
|
||||
/// behavior). If this function returns false then the application should exit
|
||||
/// immediately without calling any other CEF functions except, optionally,
|
||||
/// CefGetErrorCode. The |windows_sandbox_info| parameter is only used on
|
||||
/// Windows and may be NULL (see cef_sandbox_win.h for details).
|
||||
/// immediately without calling any other CEF functions. The
|
||||
/// |windows_sandbox_info| parameter is only used on Windows and may be NULL
|
||||
/// (see cef_sandbox_win.h for details).
|
||||
///
|
||||
/*--cef(api_hash_check,optional_param=application,
|
||||
optional_param=windows_sandbox_info)--*/
|
||||
@@ -82,18 +82,6 @@ bool CefInitialize(const CefMainArgs& args,
|
||||
CefRefPtr<CefApp> application,
|
||||
void* windows_sandbox_info);
|
||||
|
||||
///
|
||||
/// This function can optionally be called on the main application thread after
|
||||
/// CefInitialize to retrieve the initialization exit code. When CefInitialize
|
||||
/// returns true the exit code will be 0 (CEF_RESULT_CODE_NORMAL_EXIT).
|
||||
/// Otherwise, see cef_resultcode_t for possible exit code values including
|
||||
/// browser process initialization errors and normal early exit conditions (such
|
||||
/// as CEF_RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED for process singleton
|
||||
/// relaunch behavior).
|
||||
///
|
||||
/*--cef()--*/
|
||||
int CefGetExitCode();
|
||||
|
||||
///
|
||||
/// This function should be called on the main application thread to shut down
|
||||
/// the CEF browser process before the application exits. Do not call any
|
||||
|
@@ -169,15 +169,14 @@ class CefBrowser : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/// Returns the frame with the specified identifier, or NULL if not found.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefFrame> GetFrameByIdentifier(
|
||||
const CefString& identifier) = 0;
|
||||
/*--cef(capi_name=get_frame_byident)--*/
|
||||
virtual CefRefPtr<CefFrame> GetFrame(int64_t identifier) = 0;
|
||||
|
||||
///
|
||||
/// Returns the frame with the specified name, or NULL if not found.
|
||||
///
|
||||
/*--cef(optional_param=name)--*/
|
||||
virtual CefRefPtr<CefFrame> GetFrameByName(const CefString& name) = 0;
|
||||
virtual CefRefPtr<CefFrame> GetFrame(const CefString& name) = 0;
|
||||
|
||||
///
|
||||
/// Returns the number of frames that currently exist.
|
||||
@@ -189,7 +188,7 @@ class CefBrowser : public virtual CefBaseRefCounted {
|
||||
/// Returns the identifiers of all existing frames.
|
||||
///
|
||||
/*--cef(count_func=identifiers:GetFrameCount)--*/
|
||||
virtual void GetFrameIdentifiers(std::vector<CefString>& identifiers) = 0;
|
||||
virtual void GetFrameIdentifiers(std::vector<int64_t>& identifiers) = 0;
|
||||
|
||||
///
|
||||
/// Returns the names of all existing frames.
|
||||
@@ -942,8 +941,6 @@ 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;
|
||||
|
||||
@@ -952,8 +949,6 @@ 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;
|
||||
|
||||
@@ -1011,24 +1006,6 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
||||
virtual void ExecuteChromeCommand(
|
||||
int command_id,
|
||||
cef_window_open_disposition_t disposition) = 0;
|
||||
|
||||
///
|
||||
/// Returns true if the render process associated with this browser is
|
||||
/// currently unresponsive as indicated by a lack of input event processing
|
||||
/// for at least 15 seconds. To receive associated state change notifications
|
||||
/// and optionally handle an unresponsive render process implement
|
||||
/// CefRequestHandler::OnRenderProcessUnresponsive. This method can only be
|
||||
/// called on the UI thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsRenderProcessUnresponsive() = 0;
|
||||
|
||||
///
|
||||
/// Returns the runtime style for this browser (ALLOY or CHROME). See
|
||||
/// cef_runtime_style_t documentation for details.
|
||||
///
|
||||
/*--cef(default_retval=CEF_RUNTIME_STYLE_DEFAULT)--*/
|
||||
virtual cef_runtime_style_t GetRuntimeStyle() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_BROWSER_H_
|
||||
|
@@ -42,7 +42,6 @@
|
||||
#include "include/cef_client.h"
|
||||
#include "include/cef_command_line.h"
|
||||
#include "include/cef_preference.h"
|
||||
#include "include/cef_request_context_handler.h"
|
||||
#include "include/cef_values.h"
|
||||
|
||||
///
|
||||
@@ -140,28 +139,14 @@ class CefBrowserProcessHandler : public virtual CefBaseRefCounted {
|
||||
virtual void OnScheduleMessagePumpWork(int64_t delay_ms) {}
|
||||
|
||||
///
|
||||
/// Return the default client for use with a newly created browser window
|
||||
/// (CefBrowser object). If null is returned the CefBrowser will be unmanaged
|
||||
/// (no callbacks will be executed for that CefBrowser) and application
|
||||
/// shutdown will be blocked until the browser window is closed manually. This
|
||||
/// method is currently only used with the Chrome runtime when creating new
|
||||
/// browser windows via Chrome UI.
|
||||
/// Return the default client for use with a newly created browser window. If
|
||||
/// null is returned the browser will be unmanaged (no callbacks will be
|
||||
/// executed for that browser) and application shutdown will be blocked until
|
||||
/// the browser window is closed manually. This method is currently only used
|
||||
/// with the chrome runtime.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefClient> GetDefaultClient() { return nullptr; }
|
||||
|
||||
///
|
||||
/// Return the default handler for use with a new user or incognito profile
|
||||
/// (CefRequestContext object). If null is returned the CefRequestContext will
|
||||
/// be unmanaged (no callbacks will be executed for that CefRequestContext).
|
||||
/// This method is currently only used with the Chrome runtime when creating
|
||||
/// new browser windows via Chrome UI.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefRequestContextHandler>
|
||||
GetDefaultRequestContextHandler() {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_BROWSER_PROCESS_HANDLER_H_
|
||||
|
@@ -106,19 +106,17 @@ class CefDownloadHandler : public virtual CefBaseRefCounted {
|
||||
|
||||
///
|
||||
/// Called before a download begins. |suggested_name| is the suggested name
|
||||
/// for the download file. Return true and execute |callback| either
|
||||
/// asynchronously or in this method to continue or cancel the download.
|
||||
/// Return false to proceed with default handling (cancel with Alloy style,
|
||||
/// download shelf with Chrome style). Do not keep a reference to
|
||||
/// |download_item| outside of this method.
|
||||
/// for the download file. By default the download will be canceled. Execute
|
||||
/// |callback| either asynchronously or in this method to continue the
|
||||
/// download if desired. Do not keep a reference to |download_item| outside of
|
||||
/// this method.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnBeforeDownload(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
const CefString& suggested_name,
|
||||
CefRefPtr<CefBeforeDownloadCallback> callback) {
|
||||
return false;
|
||||
}
|
||||
virtual void OnBeforeDownload(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
const CefString& suggested_name,
|
||||
CefRefPtr<CefBeforeDownloadCallback> callback) = 0;
|
||||
|
||||
///
|
||||
/// Called when a download's status or progress information has been updated.
|
||||
|
@@ -48,8 +48,6 @@ 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,8 +70,6 @@ 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:
|
||||
|
@@ -180,11 +180,11 @@ class CefFrame : public virtual CefBaseRefCounted {
|
||||
virtual CefString GetName() = 0;
|
||||
|
||||
///
|
||||
/// Returns the globally unique identifier for this frame or empty if the
|
||||
/// Returns the globally unique identifier for this frame or < 0 if the
|
||||
/// underlying frame does not yet exist.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetIdentifier() = 0;
|
||||
virtual int64_t GetIdentifier() = 0;
|
||||
|
||||
///
|
||||
/// Returns the parent of this frame or NULL if this is the main (top-level)
|
||||
|
@@ -152,25 +152,16 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
|
||||
/// Called when an element has been rendered to the shared texture handle.
|
||||
/// |type| indicates whether the element is the view or the popup widget.
|
||||
/// |dirtyRects| contains the set of rectangles in pixel coordinates that need
|
||||
/// to be repainted. |info| contains the shared handle; on Windows it is a
|
||||
/// HANDLE to a texture that can be opened with D3D11 OpenSharedResource, on
|
||||
/// macOS it is an IOSurface pointer that can be opened with Metal or OpenGL,
|
||||
/// and on Linux it contains several planes, each with an fd to the underlying
|
||||
/// system native buffer.
|
||||
///
|
||||
/// The underlying implementation uses a pool to deliver frames. As a result,
|
||||
/// the handle may differ every frame depending on how many frames are
|
||||
/// in-progress. The handle's resource cannot be cached and cannot be accessed
|
||||
/// outside of this callback. It should be reopened each time this callback is
|
||||
/// executed and the contents should be copied to a texture owned by the
|
||||
/// client application. The contents of |info| will be released back to the
|
||||
/// pool after this callback returns.
|
||||
/// to be repainted. |shared_handle| is the handle for a D3D11 Texture2D that
|
||||
/// can be accessed via ID3D11Device using the OpenSharedResource method. This
|
||||
/// method is only called when CefWindowInfo::shared_texture_enabled is set to
|
||||
/// true, and is currently only supported on Windows.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
|
||||
PaintElementType type,
|
||||
const RectList& dirtyRects,
|
||||
const CefAcceleratedPaintInfo& info) {}
|
||||
void* shared_handle) {}
|
||||
|
||||
///
|
||||
/// Called to retrieve the size of the touch handle for the specified
|
||||
|
@@ -266,8 +266,6 @@ 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,
|
||||
@@ -279,8 +277,6 @@ 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;
|
||||
|
||||
@@ -290,8 +286,6 @@ 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;
|
||||
|
||||
@@ -301,8 +295,6 @@ 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;
|
||||
|
||||
@@ -311,8 +303,6 @@ 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;
|
||||
@@ -391,38 +381,6 @@ class CefRequestContext : public CefPreferenceManager {
|
||||
const CefString& top_level_url,
|
||||
cef_content_setting_types_t content_type,
|
||||
cef_content_setting_values_t value) = 0;
|
||||
|
||||
///
|
||||
/// Sets the Chrome color scheme for all browsers that share this request
|
||||
/// context. |variant| values of SYSTEM, LIGHT and DARK change the underlying
|
||||
/// color mode (e.g. light vs dark). Other |variant| values determine how
|
||||
/// |user_color| will be applied in the current color mode. If |user_color| is
|
||||
/// transparent (0) the default color will be used.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetChromeColorScheme(cef_color_variant_t variant,
|
||||
cef_color_t user_color) = 0;
|
||||
|
||||
///
|
||||
/// Returns the current Chrome color scheme mode (SYSTEM, LIGHT or DARK). Must
|
||||
/// be called on the browser process UI thread.
|
||||
///
|
||||
/*--cef(default_retval=CEF_COLOR_VARIANT_SYSTEM)--*/
|
||||
virtual cef_color_variant_t GetChromeColorSchemeMode() = 0;
|
||||
|
||||
///
|
||||
/// Returns the current Chrome color scheme color, or transparent (0) for the
|
||||
/// default color. Must be called on the browser process UI thread.
|
||||
///
|
||||
/*--cef(default_retval=0)--*/
|
||||
virtual cef_color_t GetChromeColorSchemeColor() = 0;
|
||||
|
||||
///
|
||||
/// Returns the current Chrome color scheme variant. Must be called on the
|
||||
/// browser process UI thread.
|
||||
///
|
||||
/*--cef(default_retval=CEF_COLOR_VARIANT_SYSTEM)--*/
|
||||
virtual cef_color_variant_t GetChromeColorSchemeVariant() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_
|
||||
|
@@ -48,7 +48,6 @@
|
||||
#include "include/cef_request.h"
|
||||
#include "include/cef_resource_request_handler.h"
|
||||
#include "include/cef_ssl_info.h"
|
||||
#include "include/cef_unresponsive_process_callback.h"
|
||||
#include "include/cef_x509_certificate.h"
|
||||
|
||||
///
|
||||
@@ -222,52 +221,14 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual void OnRenderViewReady(CefRefPtr<CefBrowser> browser) {}
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread when the render process is
|
||||
/// unresponsive as indicated by a lack of input event processing for at
|
||||
/// least 15 seconds. Return false for the default behavior which is an
|
||||
/// indefinite wait with the Alloy runtime or display of the "Page
|
||||
/// unresponsive" dialog with the Chrome runtime. Return true and don't
|
||||
/// execute the callback for an indefinite wait without display of the Chrome
|
||||
/// runtime dialog. Return true and call CefUnresponsiveProcessCallback::Wait
|
||||
/// either in this method or at a later time to reset the wait timer,
|
||||
/// potentially triggering another call to this method if the process remains
|
||||
/// unresponsive. Return true and call CefUnresponsiveProcessCallback::
|
||||
/// Terminate either in this method or at a later time to terminate the
|
||||
/// unresponsive process, resulting in a call to OnRenderProcessTerminated.
|
||||
/// OnRenderProcessResponsive will be called if the process becomes responsive
|
||||
/// after this method is called. This functionality depends on the hang
|
||||
/// monitor which can be disabled by passing the `--disable-hang-monitor`
|
||||
/// command-line flag.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnRenderProcessUnresponsive(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefUnresponsiveProcessCallback> callback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread when the render process becomes
|
||||
/// responsive after previously being unresponsive. See documentation on
|
||||
/// OnRenderProcessUnresponsive.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnRenderProcessResponsive(CefRefPtr<CefBrowser> browser) {}
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread when the render process
|
||||
/// terminates unexpectedly. |status| indicates how the process terminated.
|
||||
/// |error_code| and |error_string| represent the error that would be
|
||||
/// displayed in Chrome's "Aw, Snap!" view. Possible |error_code| values
|
||||
/// include cef_resultcode_t non-normal exit values and platform-specific
|
||||
/// crash values (for example, a Posix signal or Windows hardware exception).
|
||||
/// terminates unexpectedly. |status| indicates how the process
|
||||
/// terminated.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status,
|
||||
int error_code,
|
||||
const CefString& error_string) {}
|
||||
TerminationStatus status) {}
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread when the window.document object of
|
||||
|
@@ -1,62 +0,0 @@
|
||||
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// The contents of this file must follow a specific format in order to
|
||||
// support the CEF translator tool. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CEF_UNRESPONSIVE_PROCESS_CALLBACK_H_
|
||||
#define CEF_INCLUDE_CEF_UNRESPONSIVE_PROCESS_CALLBACK_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
///
|
||||
/// Callback interface for asynchronous handling of an unresponsive process.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefUnresponsiveProcessCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
/// Reset the timeout for the unresponsive process.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void Wait() = 0;
|
||||
|
||||
///
|
||||
/// Terminate the unresponsive process.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void Terminate() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_UNRESPONSIVE_PROCESS_CALLBACK_H_
|
@@ -70,7 +70,6 @@ struct CefWindowInfoTraits {
|
||||
target->shared_texture_enabled = src->shared_texture_enabled;
|
||||
target->external_begin_frame_enabled = src->external_begin_frame_enabled;
|
||||
target->window = src->window;
|
||||
target->runtime_style = src->runtime_style;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -111,7 +110,6 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
void SetAsWindowless(CefWindowHandle parent) {
|
||||
windowless_rendering_enabled = true;
|
||||
parent_window = parent;
|
||||
runtime_style = CEF_RUNTIME_STYLE_ALLOY;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -71,7 +71,6 @@ struct CefWindowInfoTraits {
|
||||
target->shared_texture_enabled = src->shared_texture_enabled;
|
||||
target->external_begin_frame_enabled = src->external_begin_frame_enabled;
|
||||
target->view = src->view;
|
||||
target->runtime_style = src->runtime_style;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -113,7 +112,6 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
void SetAsWindowless(CefWindowHandle parent) {
|
||||
windowless_rendering_enabled = true;
|
||||
parent_view = parent;
|
||||
runtime_style = CEF_RUNTIME_STYLE_ALLOY;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -31,7 +31,7 @@
|
||||
#define CEF_INCLUDE_INTERNAL_CEF_STRING_WRAPPERS_H_
|
||||
#pragma once
|
||||
|
||||
#include <cstring>
|
||||
#include <memory.h>
|
||||
#include <string>
|
||||
|
||||
#include "include/internal/cef_string_types.h"
|
||||
|
@@ -433,14 +433,10 @@ typedef struct _cef_settings_t {
|
||||
///
|
||||
/// Set to a value between 1024 and 65535 to enable remote debugging on the
|
||||
/// specified port. Also configurable using the "remote-debugging-port"
|
||||
/// command-line switch. Specifying 0 via the command-line switch will result
|
||||
/// in the selection of an ephemeral port and the port number will be printed
|
||||
/// as part of the WebSocket endpoint URL to stderr. If a cache directory path
|
||||
/// is provided the port will also be written to the
|
||||
/// <cache-dir>/DevToolsActivePort file. Remote debugging can be accessed by
|
||||
/// loading the chrome://inspect page in Google Chrome. Port numbers 9222 and
|
||||
/// 9229 are discoverable by default. Other port numbers may need to be
|
||||
/// configured via "Discover network targets" on the Devices tab.
|
||||
/// command-line switch. Remote debugging can be accessed by loading the
|
||||
/// chrome://inspect page in Google Chrome. Port numbers 9222 and 9229 are
|
||||
/// discoverable by default. Other port numbers may need to be configured via
|
||||
/// "Discover network targets" on the Devices tab.
|
||||
///
|
||||
int remote_debugging_port;
|
||||
|
||||
@@ -917,16 +913,6 @@ typedef enum {
|
||||
/// Out of memory. Some platforms may use TS_PROCESS_CRASHED instead.
|
||||
///
|
||||
TS_PROCESS_OOM,
|
||||
|
||||
///
|
||||
/// Child process never launched.
|
||||
///
|
||||
TS_LAUNCH_FAILED,
|
||||
|
||||
///
|
||||
/// On Windows, the OS terminated the process due to code integrity failure.
|
||||
///
|
||||
TS_INTEGRITY_FAILURE,
|
||||
} cef_termination_status_t;
|
||||
|
||||
///
|
||||
@@ -1037,100 +1023,6 @@ typedef enum {
|
||||
CERT_STATUS_CT_COMPLIANCE_FAILED = 1 << 20,
|
||||
} cef_cert_status_t;
|
||||
|
||||
///
|
||||
/// Process result codes. This is not a comprehensive list, as result codes
|
||||
/// might also include platform-specific crash values (Posix signal or Windows
|
||||
/// hardware exception), or internal-only implementation values.
|
||||
///
|
||||
typedef enum {
|
||||
// The following values should be kept in sync with Chromium's
|
||||
// content::ResultCode type.
|
||||
|
||||
CEF_RESULT_CODE_NORMAL_EXIT,
|
||||
|
||||
/// Process was killed by user or system.
|
||||
CEF_RESULT_CODE_KILLED,
|
||||
|
||||
/// Process hung.
|
||||
CEF_RESULT_CODE_HUNG,
|
||||
|
||||
/// A bad message caused the process termination.
|
||||
CEF_RESULT_CODE_KILLED_BAD_MESSAGE,
|
||||
|
||||
/// The GPU process exited because initialization failed.
|
||||
CEF_RESULT_CODE_GPU_DEAD_ON_ARRIVAL,
|
||||
|
||||
// The following values should be kept in sync with Chromium's
|
||||
// chrome::ResultCode type. Unused chrome values are excluded.
|
||||
|
||||
CEF_RESULT_CODE_CHROME_FIRST,
|
||||
|
||||
/// A critical chrome file is missing.
|
||||
CEF_RESULT_CODE_MISSING_DATA = 7,
|
||||
|
||||
/// Command line parameter is not supported.
|
||||
CEF_RESULT_CODE_UNSUPPORTED_PARAM = 13,
|
||||
|
||||
/// The profile was in use on another host.
|
||||
CEF_RESULT_CODE_PROFILE_IN_USE = 21,
|
||||
|
||||
/// Failed to pack an extension via the command line.
|
||||
CEF_RESULT_CODE_PACK_EXTENSION_ERROR = 22,
|
||||
|
||||
/// The browser process exited early by passing the command line to another
|
||||
/// running browser.
|
||||
CEF_RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED = 24,
|
||||
|
||||
/// A browser process was sandboxed. This should never happen.
|
||||
CEF_RESULT_CODE_INVALID_SANDBOX_STATE = 31,
|
||||
|
||||
/// Cloud policy enrollment failed or was given up by user.
|
||||
CEF_RESULT_CODE_CLOUD_POLICY_ENROLLMENT_FAILED = 32,
|
||||
|
||||
/// The GPU process was terminated due to context lost.
|
||||
CEF_RESULT_CODE_GPU_EXIT_ON_CONTEXT_LOST = 34,
|
||||
|
||||
/// An early startup command was executed and the browser must exit.
|
||||
CEF_RESULT_CODE_NORMAL_EXIT_PACK_EXTENSION_SUCCESS = 36,
|
||||
|
||||
/// The browser process exited because system resources are exhausted. The
|
||||
/// system state can't be recovered and will be unstable.
|
||||
CEF_RESULT_CODE_SYSTEM_RESOURCE_EXHAUSTED = 37,
|
||||
|
||||
CEF_RESULT_CODE_CHROME_LAST = 39,
|
||||
|
||||
// The following values should be kept in sync with Chromium's
|
||||
// sandbox::TerminationCodes type.
|
||||
|
||||
CEF_RESULT_CODE_SANDBOX_FATAL_FIRST = 7006,
|
||||
|
||||
/// Windows sandbox could not set the integrity level.
|
||||
CEF_RESULT_CODE_SANDBOX_FATAL_INTEGRITY = CEF_RESULT_CODE_SANDBOX_FATAL_FIRST,
|
||||
|
||||
/// Windows sandbox could not lower the token.
|
||||
CEF_RESULT_CODE_SANDBOX_FATAL_DROPTOKEN,
|
||||
|
||||
/// Windows sandbox failed to flush registry handles.
|
||||
CEF_RESULT_CODE_SANDBOX_FATAL_FLUSHANDLES,
|
||||
|
||||
/// Windows sandbox failed to forbid HCKU caching.
|
||||
CEF_RESULT_CODE_SANDBOX_FATAL_CACHEDISABLE,
|
||||
|
||||
/// Windows sandbox failed to close pending handles.
|
||||
CEF_RESULT_CODE_SANDBOX_FATAL_CLOSEHANDLES,
|
||||
|
||||
/// Windows sandbox could not set the mitigation policy.
|
||||
CEF_RESULT_CODE_SANDBOX_FATAL_MITIGATION,
|
||||
|
||||
/// Windows sandbox exceeded the job memory limit.
|
||||
CEF_RESULT_CODE_SANDBOX_FATAL_MEMORY_EXCEEDED,
|
||||
|
||||
/// Windows sandbox failed to warmup.
|
||||
CEF_RESULT_CODE_SANDBOX_FATAL_WARMUP,
|
||||
|
||||
CEF_RESULT_CODE_SANDBOX_FATAL_LAST,
|
||||
} cef_resultcode_t;
|
||||
|
||||
///
|
||||
/// The manner in which a link click should be opened. These constants match
|
||||
/// their equivalents in Chromium's window_open_disposition.h and should not be
|
||||
@@ -2440,7 +2332,6 @@ typedef enum {
|
||||
DOM_FORM_CONTROL_TYPE_BUTTON_SUBMIT,
|
||||
DOM_FORM_CONTROL_TYPE_BUTTON_RESET,
|
||||
DOM_FORM_CONTROL_TYPE_BUTTON_SELECT_LIST,
|
||||
DOM_FORM_CONTROL_TYPE_BUTTON_POPOVER,
|
||||
DOM_FORM_CONTROL_TYPE_FIELDSET,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_BUTTON,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_CHECKBOX,
|
||||
@@ -2925,6 +2816,21 @@ typedef enum {
|
||||
RESPONSE_FILTER_ERROR
|
||||
} cef_response_filter_status_t;
|
||||
|
||||
///
|
||||
/// Describes how to interpret the components of a pixel.
|
||||
///
|
||||
typedef enum {
|
||||
///
|
||||
/// RGBA with 8 bits per pixel (32bits total).
|
||||
///
|
||||
CEF_COLOR_TYPE_RGBA_8888,
|
||||
|
||||
///
|
||||
/// BGRA with 8 bits per pixel (32bits total).
|
||||
///
|
||||
CEF_COLOR_TYPE_BGRA_8888,
|
||||
} cef_color_type_t;
|
||||
|
||||
///
|
||||
/// Describes how to interpret the alpha component of a pixel.
|
||||
///
|
||||
@@ -2957,22 +2863,51 @@ typedef enum {
|
||||
} cef_text_style_t;
|
||||
|
||||
///
|
||||
/// Specifies where along the axis the CefBoxLayout child views should be laid
|
||||
/// out. Should be kept in sync with Chromium's views::LayoutAlignment type.
|
||||
/// Specifies where along the main axis the CefBoxLayout child views should be
|
||||
/// laid out.
|
||||
///
|
||||
typedef enum {
|
||||
/// Child views will be left/top-aligned.
|
||||
CEF_AXIS_ALIGNMENT_START,
|
||||
///
|
||||
/// Child views will be left-aligned.
|
||||
///
|
||||
CEF_MAIN_AXIS_ALIGNMENT_START,
|
||||
|
||||
///
|
||||
/// Child views will be center-aligned.
|
||||
CEF_AXIS_ALIGNMENT_CENTER,
|
||||
///
|
||||
CEF_MAIN_AXIS_ALIGNMENT_CENTER,
|
||||
|
||||
/// Child views will be right/bottom-aligned.
|
||||
CEF_AXIS_ALIGNMENT_END,
|
||||
///
|
||||
/// Child views will be right-aligned.
|
||||
///
|
||||
CEF_MAIN_AXIS_ALIGNMENT_END,
|
||||
} cef_main_axis_alignment_t;
|
||||
|
||||
///
|
||||
/// Specifies where along the cross axis the CefBoxLayout child views should be
|
||||
/// laid out.
|
||||
///
|
||||
typedef enum {
|
||||
///
|
||||
/// Child views will be stretched to fit.
|
||||
CEF_AXIS_ALIGNMENT_STRETCH,
|
||||
} cef_axis_alignment_t;
|
||||
///
|
||||
CEF_CROSS_AXIS_ALIGNMENT_STRETCH,
|
||||
|
||||
///
|
||||
/// Child views will be left-aligned.
|
||||
///
|
||||
CEF_CROSS_AXIS_ALIGNMENT_START,
|
||||
|
||||
///
|
||||
/// Child views will be center-aligned.
|
||||
///
|
||||
CEF_CROSS_AXIS_ALIGNMENT_CENTER,
|
||||
|
||||
///
|
||||
/// Child views will be right-aligned.
|
||||
///
|
||||
CEF_CROSS_AXIS_ALIGNMENT_END,
|
||||
} cef_cross_axis_alignment_t;
|
||||
|
||||
///
|
||||
/// Settings used when initializing a CefBoxLayout.
|
||||
@@ -3009,12 +2944,12 @@ typedef struct _cef_box_layout_settings_t {
|
||||
///
|
||||
/// Specifies where along the main axis the child views should be laid out.
|
||||
///
|
||||
cef_axis_alignment_t main_axis_alignment;
|
||||
cef_main_axis_alignment_t main_axis_alignment;
|
||||
|
||||
///
|
||||
/// Specifies where along the cross axis the child views should be laid out.
|
||||
///
|
||||
cef_axis_alignment_t cross_axis_alignment;
|
||||
cef_cross_axis_alignment_t cross_axis_alignment;
|
||||
|
||||
///
|
||||
/// Minimum cross axis size.
|
||||
@@ -3283,65 +3218,64 @@ typedef enum {
|
||||
/// Front L, Front R, Front C, LFE, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_5_1_BACK = 12,
|
||||
|
||||
/// Front L, Front R, Front C, Back L, Back R, Side L, Side R
|
||||
/// Front L, Front R, Front C, Side L, Side R, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_7_0 = 13,
|
||||
|
||||
/// Front L, Front R, Front C, LFE, Back L, Back R, Side L, Side R
|
||||
/// Front L, Front R, Front C, LFE, Side L, Side R, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_7_1 = 14,
|
||||
|
||||
/// Front L, Front R, Front C, LFE, Front LofC, Front RofC, Side L, Side R
|
||||
/// Front L, Front R, Front C, LFE, Side L, Side R, Front LofC, Front RofC
|
||||
CEF_CHANNEL_LAYOUT_7_1_WIDE = 15,
|
||||
|
||||
/// Front L, Front R
|
||||
/// Stereo L, Stereo R
|
||||
CEF_CHANNEL_LAYOUT_STEREO_DOWNMIX = 16,
|
||||
|
||||
/// Front L, Front R, LFE
|
||||
/// Stereo L, Stereo R, LFE
|
||||
CEF_CHANNEL_LAYOUT_2POINT1 = 17,
|
||||
|
||||
/// Front L, Front R, Front C, LFE
|
||||
/// Stereo L, Stereo R, Front C, LFE
|
||||
CEF_CHANNEL_LAYOUT_3_1 = 18,
|
||||
|
||||
/// Front L, Front R, Front C, LFE, Back C
|
||||
/// Stereo L, Stereo R, Front C, Rear C, LFE
|
||||
CEF_CHANNEL_LAYOUT_4_1 = 19,
|
||||
|
||||
/// Front L, Front R, Front C, Back C, Side L, Side R
|
||||
/// Stereo L, Stereo R, Front C, Side L, Side R, Back C
|
||||
CEF_CHANNEL_LAYOUT_6_0 = 20,
|
||||
|
||||
/// Front L, Front R, Front LofC, Front RofC, Side L, Side R
|
||||
/// Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC
|
||||
CEF_CHANNEL_LAYOUT_6_0_FRONT = 21,
|
||||
|
||||
/// Front L, Front R, Front C, Back L, Back R, Back C
|
||||
/// Stereo L, Stereo R, Front C, Rear L, Rear R, Rear C
|
||||
CEF_CHANNEL_LAYOUT_HEXAGONAL = 22,
|
||||
|
||||
/// Front L, Front R, Front C, LFE, Back C, Side L, Side R
|
||||
/// Stereo L, Stereo R, Front C, LFE, Side L, Side R, Rear Center
|
||||
CEF_CHANNEL_LAYOUT_6_1 = 23,
|
||||
|
||||
/// Front L, Front R, Front C, LFE, Back L, Back R, Back C
|
||||
/// Stereo L, Stereo R, Front C, LFE, Back L, Back R, Rear Center
|
||||
CEF_CHANNEL_LAYOUT_6_1_BACK = 24,
|
||||
|
||||
/// Front L, Front R, LFE, Front LofC, Front RofC, Side L, Side R
|
||||
/// Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC, LFE
|
||||
CEF_CHANNEL_LAYOUT_6_1_FRONT = 25,
|
||||
|
||||
/// Front L, Front R, Front C, Front LofC, Front RofC, Side L, Side R
|
||||
/// Front L, Front R, Front C, Side L, Side R, Front LofC, Front RofC
|
||||
CEF_CHANNEL_LAYOUT_7_0_FRONT = 26,
|
||||
|
||||
/// Front L, Front R, Front C, LFE, Back L, Back R, Front LofC, Front RofC
|
||||
CEF_CHANNEL_LAYOUT_7_1_WIDE_BACK = 27,
|
||||
|
||||
/// Front L, Front R, Front C, Back L, Back R, Back C, Side L, Side R
|
||||
/// Front L, Front R, Front C, Side L, Side R, Rear L, Back R, Back C.
|
||||
CEF_CHANNEL_LAYOUT_OCTAGONAL = 28,
|
||||
|
||||
/// Channels are not explicitly mapped to speakers.
|
||||
CEF_CHANNEL_LAYOUT_DISCRETE = 29,
|
||||
|
||||
/// Deprecated, but keeping the enum value for UMA consistency.
|
||||
/// Front L, Front R, Front C. Front C contains the keyboard mic audio. This
|
||||
/// layout is only intended for input for WebRTC. The Front C channel
|
||||
/// is stripped away in the WebRTC audio input pipeline and never seen outside
|
||||
/// of that.
|
||||
CEF_CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC = 30,
|
||||
|
||||
/// Front L, Front R, LFE, Side L, Side R
|
||||
/// Front L, Front R, Side L, Side R, LFE
|
||||
CEF_CHANNEL_LAYOUT_4_1_QUAD_SIDE = 31,
|
||||
|
||||
/// Actual channel layout is specified in the bitstream and the actual channel
|
||||
@@ -3355,14 +3289,8 @@ typedef enum {
|
||||
/// kMaxConcurrentChannels
|
||||
CEF_CHANNEL_LAYOUT_5_1_4_DOWNMIX = 33,
|
||||
|
||||
/// Front C, LFE
|
||||
CEF_CHANNEL_LAYOUT_1_1 = 34,
|
||||
|
||||
/// Front L, Front R, LFE, Back C
|
||||
CEF_CHANNEL_LAYOUT_3_1_BACK = 35,
|
||||
|
||||
/// Max value, must always equal the largest entry ever logged.
|
||||
CEF_CHANNEL_LAYOUT_MAX = CEF_CHANNEL_LAYOUT_3_1_BACK
|
||||
CEF_CHANNEL_LAYOUT_MAX = CEF_CHANNEL_LAYOUT_5_1_4_DOWNMIX
|
||||
} cef_channel_layout_t;
|
||||
|
||||
///
|
||||
@@ -3628,24 +3556,23 @@ typedef enum {
|
||||
CEF_PERMISSION_TYPE_AR_SESSION = 1 << 1,
|
||||
CEF_PERMISSION_TYPE_CAMERA_PAN_TILT_ZOOM = 1 << 2,
|
||||
CEF_PERMISSION_TYPE_CAMERA_STREAM = 1 << 3,
|
||||
CEF_PERMISSION_TYPE_CAPTURED_SURFACE_CONTROL = 1 << 4,
|
||||
CEF_PERMISSION_TYPE_CLIPBOARD = 1 << 5,
|
||||
CEF_PERMISSION_TYPE_TOP_LEVEL_STORAGE_ACCESS = 1 << 6,
|
||||
CEF_PERMISSION_TYPE_DISK_QUOTA = 1 << 7,
|
||||
CEF_PERMISSION_TYPE_LOCAL_FONTS = 1 << 8,
|
||||
CEF_PERMISSION_TYPE_GEOLOCATION = 1 << 9,
|
||||
CEF_PERMISSION_TYPE_IDENTITY_PROVIDER = 1 << 10,
|
||||
CEF_PERMISSION_TYPE_IDLE_DETECTION = 1 << 11,
|
||||
CEF_PERMISSION_TYPE_MIC_STREAM = 1 << 12,
|
||||
CEF_PERMISSION_TYPE_MIDI_SYSEX = 1 << 13,
|
||||
CEF_PERMISSION_TYPE_MULTIPLE_DOWNLOADS = 1 << 14,
|
||||
CEF_PERMISSION_TYPE_NOTIFICATIONS = 1 << 15,
|
||||
CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER = 1 << 16,
|
||||
CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER = 1 << 17,
|
||||
CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 << 18,
|
||||
CEF_PERMISSION_TYPE_VR_SESSION = 1 << 19,
|
||||
CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 << 20,
|
||||
CEF_PERMISSION_TYPE_FILE_SYSTEM_ACCESS = 1 << 21,
|
||||
CEF_PERMISSION_TYPE_CLIPBOARD = 1 << 4,
|
||||
CEF_PERMISSION_TYPE_TOP_LEVEL_STORAGE_ACCESS = 1 << 5,
|
||||
CEF_PERMISSION_TYPE_DISK_QUOTA = 1 << 6,
|
||||
CEF_PERMISSION_TYPE_LOCAL_FONTS = 1 << 7,
|
||||
CEF_PERMISSION_TYPE_GEOLOCATION = 1 << 8,
|
||||
CEF_PERMISSION_TYPE_IDLE_DETECTION = 1 << 9,
|
||||
CEF_PERMISSION_TYPE_MIC_STREAM = 1 << 10,
|
||||
CEF_PERMISSION_TYPE_MIDI = 1 << 11,
|
||||
CEF_PERMISSION_TYPE_MIDI_SYSEX = 1 << 12,
|
||||
CEF_PERMISSION_TYPE_MULTIPLE_DOWNLOADS = 1 << 13,
|
||||
CEF_PERMISSION_TYPE_NOTIFICATIONS = 1 << 14,
|
||||
CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER = 1 << 15,
|
||||
CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER = 1 << 16,
|
||||
CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 << 17,
|
||||
CEF_PERMISSION_TYPE_VR_SESSION = 1 << 18,
|
||||
CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 << 19,
|
||||
CEF_PERMISSION_TYPE_FILE_SYSTEM_ACCESS = 1 << 20,
|
||||
} cef_permission_request_types_t;
|
||||
|
||||
///
|
||||
@@ -3839,20 +3766,6 @@ typedef enum {
|
||||
CEF_ZOOM_COMMAND_IN,
|
||||
} cef_zoom_command_t;
|
||||
|
||||
///
|
||||
/// Specifies the color variants supported by
|
||||
/// CefRequestContext::SetChromeThemeColor.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_COLOR_VARIANT_SYSTEM,
|
||||
CEF_COLOR_VARIANT_LIGHT,
|
||||
CEF_COLOR_VARIANT_DARK,
|
||||
CEF_COLOR_VARIANT_TONAL_SPOT,
|
||||
CEF_COLOR_VARIANT_NEUTRAL,
|
||||
CEF_COLOR_VARIANT_VIBRANT,
|
||||
CEF_COLOR_VARIANT_EXPRESSIVE,
|
||||
} cef_color_variant_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,57 +0,0 @@
|
||||
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_COLOR_H_
|
||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_COLOR_H_
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// Describes how to interpret the components of a pixel.
|
||||
///
|
||||
typedef enum {
|
||||
///
|
||||
/// RGBA with 8 bits per pixel (32bits total).
|
||||
///
|
||||
CEF_COLOR_TYPE_RGBA_8888,
|
||||
|
||||
///
|
||||
/// BGRA with 8 bits per pixel (32bits total).
|
||||
///
|
||||
CEF_COLOR_TYPE_BGRA_8888,
|
||||
} cef_color_type_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_COLOR_H_
|
@@ -362,88 +362,33 @@ typedef enum {
|
||||
/// Stores per origin metadata for cookie controls.
|
||||
CEF_CONTENT_SETTING_TYPE_COOKIE_CONTROLS_METADATA,
|
||||
|
||||
/// Content Setting for temporary 3PC accesses granted by user behavior
|
||||
/// heuristics.
|
||||
CEF_CONTENT_SETTING_TYPE_TPCD_HEURISTICS_GRANTS,
|
||||
/// Content Setting for 3PC accesses granted via 3PC deprecation trial.
|
||||
CEF_CONTENT_SETTING_TYPE_TPCD_SUPPORT,
|
||||
|
||||
/// Content setting used to indicate whether entering picture-in-picture
|
||||
/// automatically should be enabled.
|
||||
CEF_CONTENT_SETTING_TYPE_AUTO_PICTURE_IN_PICTURE,
|
||||
|
||||
/// Content Setting for 3PC accesses granted by metadata delivered via the
|
||||
/// component updater service. This type will only be used when
|
||||
/// `net::features::kTpcdMetadataGrants` is enabled.
|
||||
CEF_CONTENT_SETTING_TYPE_TPCD_METADATA_GRANTS,
|
||||
|
||||
/// Content Setting for 3PC accesses granted via 3PC deprecation trial.
|
||||
CEF_CONTENT_SETTING_TYPE_TPCD_TRIAL,
|
||||
|
||||
/// Content Setting for 3PC accesses granted via top-level 3PC deprecation
|
||||
/// trial. Similar to TPCD_TRIAL, but applicable at the page-level for the
|
||||
/// lifetime of the page that served the token, rather than being specific to
|
||||
/// a requesting-origin/top-level-site combination and persistent.
|
||||
CEF_CONTENT_SETTING_TYPE_TOP_LEVEL_TPCD_TRIAL,
|
||||
|
||||
/// Content Setting for a first-party origin trial that allows websites to
|
||||
/// enable third-party cookie deprecation.
|
||||
/// ALLOW (default): no effect (e.g. third-party cookies allowed, if not
|
||||
/// blocked otherwise).
|
||||
/// BLOCK: third-party cookies blocked, but 3PCD mitigations enabled.
|
||||
CEF_CONTENT_SETTING_TOP_LEVEL_TPCD_ORIGIN_TRIAL,
|
||||
|
||||
/// Content setting used to indicate whether entering picture-in-picture
|
||||
/// automatically should be enabled.
|
||||
CEF_CONTENT_SETTING_TYPE_AUTO_PICTURE_IN_PICTURE,
|
||||
|
||||
/// Whether user has opted into keeping file/directory permissions persistent
|
||||
/// between visits for a given origin. When enabled, permission metadata
|
||||
/// stored under |FILE_SYSTEM_ACCESS_CHOOSER_DATA| can auto-grant incoming
|
||||
/// permission request.
|
||||
CEF_CONTENT_SETTING_TYPE_FILE_SYSTEM_ACCESS_EXTENDED_PERMISSION,
|
||||
|
||||
/// Content Setting for temporary 3PC accesses granted by user behavior
|
||||
/// heuristics.
|
||||
CEF_CONTENT_SETTING_TYPE_TPCD_HEURISTICS_GRANTS,
|
||||
|
||||
/// Whether the FSA Persistent Permissions restore prompt is eligible to be
|
||||
/// shown to the user, for a given origin.
|
||||
CEF_CONTENT_SETTING_TYPE_FILE_SYSTEM_ACCESS_RESTORE_PERMISSION,
|
||||
|
||||
/// Whether an application capturing another tab, may scroll and zoom
|
||||
/// the captured tab.
|
||||
CEF_CONTENT_SETTING_TYPE_CAPTURED_SURFACE_CONTROL,
|
||||
|
||||
/// Content setting for access to smart card readers.
|
||||
/// The "guard" content setting stores whether to allow sites to access the
|
||||
/// Smart Card API.
|
||||
CEF_CONTENT_SETTING_TYPE_SMART_CARD_GUARD,
|
||||
CEF_CONTENT_SETTING_TYPE_SMART_CARD_DATA,
|
||||
|
||||
/// Content settings for access to printers for the Web Printing API.
|
||||
CEF_CONTENT_SETTING_TYPE_WEB_PRINTING,
|
||||
|
||||
/// Content setting used to indicate whether entering HTML Fullscreen
|
||||
/// automatically (i.e. without transient activation) should be enabled.
|
||||
CEF_CONTENT_SETTING_TYPE_AUTOMATIC_FULLSCREEN,
|
||||
|
||||
/// Content settings used to indicate that a web app is allowed to prompt the
|
||||
/// user for the installation of sub apps.
|
||||
CEF_CONTENT_SETTING_TYPE_SUB_APP_INSTALLATION_PROMPTS,
|
||||
|
||||
/// Whether an application can enumerate audio output device.
|
||||
CEF_CONTENT_SETTING_TYPE_SPEAKER_SELECTION,
|
||||
|
||||
/// Content settings for access to the Direct Sockets API.
|
||||
CEF_CONTENT_SETTING_TYPE_DIRECT_SOCKETS,
|
||||
|
||||
/// Keyboard Lock API allows a site to capture keyboard inputs that would
|
||||
/// otherwise be handled by the OS or the browser.
|
||||
CEF_CONTENT_SETTING_TYPE_KEYBOARD_LOCK,
|
||||
|
||||
/// Pointer Lock API allows a site to hide the cursor and have exclusive
|
||||
/// access to mouse inputs.
|
||||
CEF_CONTENT_SETTING_TYPE_POINTER_LOCK,
|
||||
|
||||
/// Website setting which is used for UnusedSitePermissionsService to store
|
||||
/// auto-revoked notification permissions from abusive sites.
|
||||
REVOKED_ABUSIVE_NOTIFICATION_PERMISSIONS,
|
||||
|
||||
/// Content setting that controls tracking protection status per site.
|
||||
/// BLOCK: Protections enabled. This is the default state.
|
||||
/// ALLOW: Protections disabled.
|
||||
TRACKING_PROTECTION,
|
||||
CEF_CONTENT_SETTING_TYPE_NUM_TYPES,
|
||||
} cef_content_setting_types_t;
|
||||
|
||||
///
|
||||
|
@@ -43,9 +43,7 @@ typedef struct _XDisplay XDisplay;
|
||||
|
||||
#include "include/internal/cef_export.h"
|
||||
#include "include/internal/cef_string.h"
|
||||
#include "include/internal/cef_types_color.h"
|
||||
#include "include/internal/cef_types_geometry.h"
|
||||
#include "include/internal/cef_types_runtime.h"
|
||||
|
||||
// Handle types.
|
||||
#if defined(CEF_X11)
|
||||
@@ -137,65 +135,8 @@ typedef struct _cef_window_info_t {
|
||||
/// Pointer for the new browser window. Only used with windowed rendering.
|
||||
///
|
||||
cef_window_handle_t window;
|
||||
|
||||
///
|
||||
/// Optionally change the runtime style. Alloy style will always be used if
|
||||
/// |windowless_rendering_enabled| is true. See cef_runtime_style_t
|
||||
/// documentation for details.
|
||||
///
|
||||
cef_runtime_style_t runtime_style;
|
||||
} cef_window_info_t;
|
||||
|
||||
///
|
||||
/// Structure containing the plane information of the shared texture.
|
||||
/// Sync with native_pixmap_handle.h
|
||||
///
|
||||
typedef struct _cef_accelerated_paint_native_pixmap_plane_info_t {
|
||||
///
|
||||
/// The strides and offsets in bytes to be used when accessing the buffers via
|
||||
/// a memory mapping. One per plane per entry. Size in bytes of the plane is
|
||||
/// necessary to map the buffers.
|
||||
///
|
||||
uint32_t stride;
|
||||
uint64_t offset;
|
||||
uint64_t size;
|
||||
|
||||
///
|
||||
/// File descriptor for the underlying memory object (usually dmabuf).
|
||||
///
|
||||
int fd;
|
||||
} cef_accelerated_paint_native_pixmap_plane_t;
|
||||
|
||||
#define kAcceleratedPaintMaxPlanes 4
|
||||
|
||||
///
|
||||
/// Structure containing shared texture information for the OnAcceleratedPaint
|
||||
/// callback. Resources will be released to the underlying pool for reuse when
|
||||
/// the callback returns from client code.
|
||||
///
|
||||
typedef struct _cef_accelerated_paint_info_t {
|
||||
///
|
||||
/// Planes of the shared texture, usually file descriptors of dmabufs.
|
||||
///
|
||||
cef_accelerated_paint_native_pixmap_plane_t
|
||||
planes[kAcceleratedPaintMaxPlanes];
|
||||
|
||||
///
|
||||
/// Plane count.
|
||||
///
|
||||
int plane_count;
|
||||
|
||||
///
|
||||
/// Modifier could be used with EGL driver.
|
||||
///
|
||||
uint64_t modifier;
|
||||
|
||||
///
|
||||
/// The pixel format of the texture.
|
||||
///
|
||||
cef_color_type_t format;
|
||||
} cef_accelerated_paint_info_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -35,9 +35,7 @@
|
||||
|
||||
#if defined(OS_MAC)
|
||||
#include "include/internal/cef_string.h"
|
||||
#include "include/internal/cef_types_color.h"
|
||||
#include "include/internal/cef_types_geometry.h"
|
||||
#include "include/internal/cef_types_runtime.h"
|
||||
|
||||
// Handle types.
|
||||
// Actually NSCursor*
|
||||
@@ -46,8 +44,6 @@
|
||||
#define cef_event_handle_t void*
|
||||
// Actually NSView*
|
||||
#define cef_window_handle_t void*
|
||||
// Actually IOSurface*
|
||||
#define cef_shared_texture_handle_t void*
|
||||
|
||||
#define kNullCursorHandle NULL
|
||||
#define kNullEventHandle NULL
|
||||
@@ -138,32 +134,8 @@ typedef struct _cef_window_info_t {
|
||||
/// rendering.
|
||||
///
|
||||
cef_window_handle_t view;
|
||||
|
||||
///
|
||||
/// Optionally change the runtime style. Alloy style will always be used if
|
||||
/// |windowless_rendering_enabled| is true or if |parent_view| is provided.
|
||||
/// See cef_runtime_style_t documentation for details.
|
||||
///
|
||||
cef_runtime_style_t runtime_style;
|
||||
} cef_window_info_t;
|
||||
|
||||
///
|
||||
/// Structure containing shared texture information for the OnAcceleratedPaint
|
||||
/// callback. Resources will be released to the underlying pool for reuse when
|
||||
/// the callback returns from client code.
|
||||
///
|
||||
typedef struct _cef_accelerated_paint_info_t {
|
||||
///
|
||||
/// Handle for the shared texture IOSurface.
|
||||
///
|
||||
cef_shared_texture_handle_t shared_texture_io_surface;
|
||||
|
||||
///
|
||||
/// The pixel format of the texture.
|
||||
///
|
||||
cef_color_type_t format;
|
||||
} cef_accelerated_paint_info_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -1,88 +0,0 @@
|
||||
// Copyright (c) 2024 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
#ifndef CEF_INCLUDE_INTERNAL_CEF_TYPES_RUNTIME_H_
|
||||
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_RUNTIME_H_
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
/// CEF supports both a Chrome runtime (based on the Chrome UI layer) and an
|
||||
/// Alloy runtime (based on the Chromium content layer). The Chrome runtime
|
||||
/// provides the full Chrome UI and browser functionality whereas the Alloy
|
||||
/// runtime provides less default browser functionality but adds additional
|
||||
/// client callbacks and support for windowless (off-screen) rendering. For
|
||||
/// additional comparative details on runtime types see
|
||||
/// https://bitbucket.org/chromiumembedded/cef/wiki/Architecture.md#markdown-header-cef3
|
||||
///
|
||||
/// Each runtime is composed of a bootstrap component and a style component. The
|
||||
/// bootstrap component is configured via CefSettings.chrome_runtime and cannot
|
||||
/// be changed after CefInitialize. The style component is individually
|
||||
/// configured for each window/browser at creation time and, in combination with
|
||||
/// the Chrome bootstrap, different styles can be mixed during runtime.
|
||||
///
|
||||
/// Windowless rendering will always use Alloy style. Windowed rendering with a
|
||||
/// default window or client-provided parent window can configure the style via
|
||||
/// CefWindowInfo.runtime_style. Windowed rendering with the Views framework can
|
||||
/// configure the style via CefWindowDelegate::GetWindowRuntimeStyle and
|
||||
/// CefBrowserViewDelegate::GetBrowserRuntimeStyle. Alloy style Windows with the
|
||||
/// Views framework can host only Alloy style BrowserViews but Chrome style
|
||||
/// Windows can host both style BrowserViews. Additionally, a Chrome style
|
||||
/// Window can host at most one Chrome style BrowserView but potentially
|
||||
/// multiple Alloy style BrowserViews. See CefWindowInfo.runtime_style
|
||||
/// documentation for any additional platform-specific limitations.
|
||||
///
|
||||
typedef enum {
|
||||
///
|
||||
/// Use the default runtime style. The default style will match the
|
||||
/// CefSettings.chrome_runtime value in most cases. See above documentation
|
||||
/// for exceptions.
|
||||
///
|
||||
CEF_RUNTIME_STYLE_DEFAULT,
|
||||
|
||||
///
|
||||
/// Use the Chrome runtime style. Only supported with the Chrome runtime.
|
||||
///
|
||||
CEF_RUNTIME_STYLE_CHROME,
|
||||
|
||||
///
|
||||
/// Use the Alloy runtime style. Supported with both the Alloy and Chrome
|
||||
/// runtime.
|
||||
///
|
||||
CEF_RUNTIME_STYLE_ALLOY,
|
||||
} cef_runtime_style_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_RUNTIME_H_
|
@@ -37,15 +37,12 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include "include/internal/cef_string.h"
|
||||
#include "include/internal/cef_types_color.h"
|
||||
#include "include/internal/cef_types_geometry.h"
|
||||
#include "include/internal/cef_types_runtime.h"
|
||||
|
||||
// Handle types.
|
||||
#define cef_cursor_handle_t HCURSOR
|
||||
#define cef_event_handle_t MSG*
|
||||
#define cef_window_handle_t HWND
|
||||
#define cef_shared_texture_handle_t HANDLE
|
||||
|
||||
#define kNullCursorHandle NULL
|
||||
#define kNullEventHandle NULL
|
||||
@@ -105,33 +102,8 @@ typedef struct _cef_window_info_t {
|
||||
/// Handle for the new browser window. Only used with windowed rendering.
|
||||
///
|
||||
cef_window_handle_t window;
|
||||
|
||||
///
|
||||
/// Optionally change the runtime style. Alloy style will always be used if
|
||||
/// |windowless_rendering_enabled| is true. See cef_runtime_style_t
|
||||
/// documentation for details.
|
||||
///
|
||||
cef_runtime_style_t runtime_style;
|
||||
} cef_window_info_t;
|
||||
|
||||
///
|
||||
/// Structure containing shared texture information for the OnAcceleratedPaint
|
||||
/// callback. Resources will be released to the underlying pool for reuse when
|
||||
/// the callback returns from client code.
|
||||
///
|
||||
typedef struct _cef_accelerated_paint_info_t {
|
||||
///
|
||||
/// Handle for the shared texture. The shared texture is instantiated
|
||||
/// without a keyed mutex.
|
||||
///
|
||||
cef_shared_texture_handle_t shared_texture_handle;
|
||||
|
||||
///
|
||||
/// The pixel format of the texture.
|
||||
///
|
||||
cef_color_type_t format;
|
||||
} cef_accelerated_paint_info_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -697,9 +697,7 @@ using CefPdfPrintSettings = CefStructBase<CefPdfPrintSettingsTraits>;
|
||||
///
|
||||
class CefBoxLayoutSettings : public cef_box_layout_settings_t {
|
||||
public:
|
||||
CefBoxLayoutSettings() : cef_box_layout_settings_t{} {
|
||||
cross_axis_alignment = CEF_AXIS_ALIGNMENT_STRETCH;
|
||||
}
|
||||
CefBoxLayoutSettings() : cef_box_layout_settings_t{} {}
|
||||
CefBoxLayoutSettings(const cef_box_layout_settings_t& r)
|
||||
: cef_box_layout_settings_t(r) {}
|
||||
};
|
||||
@@ -750,14 +748,4 @@ struct CefMediaSinkDeviceInfoTraits {
|
||||
///
|
||||
using CefMediaSinkDeviceInfo = CefStructBase<CefMediaSinkDeviceInfoTraits>;
|
||||
|
||||
///
|
||||
/// Class representing accelerated paint info.
|
||||
///
|
||||
class CefAcceleratedPaintInfo : public cef_accelerated_paint_info_t {
|
||||
public:
|
||||
CefAcceleratedPaintInfo() : cef_accelerated_paint_info_t{} {}
|
||||
CefAcceleratedPaintInfo(const cef_accelerated_paint_info_t& r)
|
||||
: cef_accelerated_paint_info_t(r) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_
|
||||
|
@@ -73,7 +73,6 @@ struct CefWindowInfoTraits {
|
||||
target->shared_texture_enabled = src->shared_texture_enabled;
|
||||
target->external_begin_frame_enabled = src->external_begin_frame_enabled;
|
||||
target->window = src->window;
|
||||
target->runtime_style = src->runtime_style;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -131,7 +130,6 @@ class CefWindowInfo : public CefStructBase<CefWindowInfoTraits> {
|
||||
void SetAsWindowless(CefWindowHandle parent) {
|
||||
windowless_rendering_enabled = TRUE;
|
||||
parent_window = parent;
|
||||
runtime_style = CEF_RUNTIME_STYLE_ALLOY;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -107,13 +107,6 @@ class CefBrowserView : public CefView {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetPreferAccelerators(bool prefer_accelerators) = 0;
|
||||
|
||||
///
|
||||
/// Returns the runtime style for this BrowserView (ALLOY or CHROME). See
|
||||
/// cef_runtime_style_t documentation for details.
|
||||
///
|
||||
/*--cef(default_retval=CEF_RUNTIME_STYLE_DEFAULT)--*/
|
||||
virtual cef_runtime_style_t GetRuntimeStyle() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_H_
|
||||
|
@@ -140,15 +140,6 @@ class CefBrowserViewDelegate : public CefViewDelegate {
|
||||
cef_gesture_command_t gesture_command) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Optionally change the runtime style for this BrowserView. See
|
||||
/// cef_runtime_style_t documentation for details.
|
||||
///
|
||||
/*--cef(default_retval=CEF_RUNTIME_STYLE_DEFAULT)--*/
|
||||
virtual cef_runtime_style_t GetBrowserRuntimeStyle() {
|
||||
return CEF_RUNTIME_STYLE_DEFAULT;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_DELEGATE_H_
|
||||
|
@@ -357,31 +357,17 @@ class CefView : public CefBaseRefCounted {
|
||||
virtual void RequestFocus() = 0;
|
||||
|
||||
///
|
||||
/// Sets the background color for this View. The background color will be
|
||||
/// automatically reset when CefViewDelegate::OnThemeChanged is called.
|
||||
/// Sets the background color for this View.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetBackgroundColor(cef_color_t color) = 0;
|
||||
|
||||
///
|
||||
/// Returns the background color for this View. If the background color is
|
||||
/// unset then the current `GetThemeColor(CEF_ColorPrimaryBackground)` value
|
||||
/// will be returned. If this View belongs to an overlay (created with
|
||||
/// CefWindow::AddOverlayView), and the background color is unset, then a
|
||||
/// value of transparent (0) will be returned.
|
||||
/// Returns the background color for this View.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual cef_color_t GetBackgroundColor() = 0;
|
||||
|
||||
///
|
||||
/// Returns the current theme color associated with |color_id|, or the
|
||||
/// placeholder color (red) if unset. See cef_color_ids.h for standard ID
|
||||
/// values. Standard colors can be overridden and custom colors can be added
|
||||
/// using CefWindow::SetThemeColor.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual cef_color_t GetThemeColor(int color_id) = 0;
|
||||
|
||||
///
|
||||
/// Convert |point| from this View's coordinate system to DIP screen
|
||||
/// coordinates. This View must belong to a Window when calling this method.
|
||||
|
@@ -131,27 +131,6 @@ class CefViewDelegate : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnBlur(CefRefPtr<CefView> view) {}
|
||||
|
||||
///
|
||||
/// Called when the theme for |view| has changed, after the new theme colors
|
||||
/// have already been applied. Views are notified via the component hierarchy
|
||||
/// in depth-first reverse order (children before parents).
|
||||
///
|
||||
/// This will be called in the following cases:
|
||||
///
|
||||
/// 1. When |view|, or a parent of |view|, is added to a Window.
|
||||
/// 2. When the native/OS or Chrome theme changes for the Window that contains
|
||||
/// |view|. See CefWindowDelegate::OnThemeColorsChanged documentation.
|
||||
/// 3. When the client explicitly calls CefWindow::ThemeChanged on the Window
|
||||
/// that contains |view|.
|
||||
///
|
||||
/// Optionally use this callback to override the new per-View theme colors by
|
||||
/// calling CefView::SetBackgroundColor or the appropriate component-specific
|
||||
/// method. See CefWindow::SetThemeColor documentation for how to customize
|
||||
/// additional Window theme colors.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnThemeChanged(CefRefPtr<CefView> view) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_
|
||||
|
@@ -377,50 +377,6 @@ class CefWindow : public CefPanel {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void RemoveAllAccelerators() = 0;
|
||||
|
||||
///
|
||||
/// Override a standard theme color or add a custom color associated with
|
||||
/// |color_id|. See cef_color_ids.h for standard ID values. Recommended usage
|
||||
/// is as follows:
|
||||
///
|
||||
/// 1. Customize the default native/OS theme by calling SetThemeColor before
|
||||
/// showing the first Window. When done setting colors call
|
||||
/// CefWindow::ThemeChanged to trigger CefViewDelegate::OnThemeChanged
|
||||
/// notifications.
|
||||
/// 2. Customize the current native/OS or Chrome theme after it changes by
|
||||
/// calling SetThemeColor from the CefWindowDelegate::OnThemeColorsChanged
|
||||
/// callback. CefViewDelegate::OnThemeChanged notifications will then be
|
||||
/// triggered automatically.
|
||||
///
|
||||
/// The configured color will be available immediately via
|
||||
/// CefView::GetThemeColor and will be applied to each View in this Window's
|
||||
/// component hierarchy when CefViewDelegate::OnThemeChanged is called. See
|
||||
/// OnThemeColorsChanged documentation for additional details.
|
||||
///
|
||||
/// Clients wishing to add custom colors should use |color_id| values >=
|
||||
/// CEF_ChromeColorsEnd.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetThemeColor(int color_id, cef_color_t color) = 0;
|
||||
|
||||
///
|
||||
/// Trigger CefViewDelegate::OnThemeChanged callbacks for each View in this
|
||||
/// Window's component hierarchy. Unlike a native/OS or Chrome theme change
|
||||
/// this method does not reset theme colors to standard values and does not
|
||||
/// result in a call to CefWindowDelegate::OnThemeColorsChanged.
|
||||
///
|
||||
/// Do not call this method from CefWindowDelegate::OnThemeColorsChanged or
|
||||
/// CefViewDelegate::OnThemeChanged.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void ThemeChanged() = 0;
|
||||
|
||||
///
|
||||
/// Returns the runtime style for this Window (ALLOY or CHROME). See
|
||||
/// cef_runtime_style_t documentation for details.
|
||||
///
|
||||
/*--cef(default_retval=CEF_RUNTIME_STYLE_DEFAULT)--*/
|
||||
virtual cef_runtime_style_t GetRuntimeStyle() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_H_
|
||||
|
@@ -164,11 +164,12 @@ class CefWindowDelegate : public CefPanelDelegate {
|
||||
}
|
||||
|
||||
///
|
||||
/// Return whether the titlebar height should be overridden, and sets the
|
||||
/// height of the titlebar in |titlebar_height|. On macOS, it can also be used
|
||||
/// to adjust the vertical position of the traffic light buttons in frameless
|
||||
/// windows. The buttons will be positioned halfway down the titlebar at a
|
||||
/// height of |titlebar_height| / 2.
|
||||
/// Return whether the titlebar height should be overridden,
|
||||
/// and sets the height of the titlebar in |titlebar_height|.
|
||||
/// On macOS, it can also be used to adjust the vertical position
|
||||
/// of the traffic light buttons in frameless windows.
|
||||
/// The buttons will be positioned halfway down the titlebar
|
||||
/// at a height of |titlebar_height| / 2.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool GetTitlebarHeight(CefRefPtr<CefWindow> window,
|
||||
@@ -176,21 +177,6 @@ class CefWindowDelegate : public CefPanelDelegate {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Return whether the view should accept the initial mouse-down event,
|
||||
/// allowing it to respond to click-through behavior. If STATE_ENABLED is
|
||||
/// returned, the view will be sent a mouseDown: message for an initial
|
||||
/// mouse-down event, activating the view with one click, instead of clicking
|
||||
/// first to make the window active and then clicking the view.
|
||||
///
|
||||
/// This method is only supported on macOS. For more details, refer to the
|
||||
/// documentation of acceptsFirstMouse.
|
||||
///
|
||||
/*--cef(default_retval=STATE_DEFAULT)--*/
|
||||
virtual cef_state_t AcceptsFirstMouse(CefRefPtr<CefWindow> window) {
|
||||
return STATE_DEFAULT;
|
||||
}
|
||||
|
||||
///
|
||||
/// Return true if |window| can be resized.
|
||||
///
|
||||
@@ -236,50 +222,6 @@ class CefWindowDelegate : public CefPanelDelegate {
|
||||
const CefKeyEvent& event) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Called after the native/OS or Chrome theme for |window| has changed.
|
||||
/// |chrome_theme| will be true if the notification is for a Chrome theme.
|
||||
///
|
||||
/// Native/OS theme colors are configured globally and do not need to be
|
||||
/// customized for each Window individually. An example of a native/OS theme
|
||||
/// change that triggers this callback is when the user switches between dark
|
||||
/// and light mode during application lifespan. Native/OS theme changes can be
|
||||
/// disabled by passing the `--force-dark-mode` or `--force-light-mode`
|
||||
/// command-line flag.
|
||||
///
|
||||
/// Chrome theme colors will be applied and this callback will be triggered
|
||||
/// if/when a BrowserView is added to the Window's component hierarchy. Chrome
|
||||
/// theme colors can be configured on a per-RequestContext basis using
|
||||
/// CefRequestContext::SetChromeColorScheme or (Chrome runtime only) by
|
||||
/// visiting chrome://settings/manageProfile. Any theme changes using those
|
||||
/// mechanisms will also trigger this callback. Chrome theme colors will be
|
||||
/// persisted and restored from disk cache with the Chrome runtime, and with
|
||||
/// the Alloy runtime if persist_user_preferences is set to true via
|
||||
/// CefSettings or CefRequestContextSettings.
|
||||
///
|
||||
/// This callback is not triggered on Window creation so clients that wish to
|
||||
/// customize the initial native/OS theme must call CefWindow::SetThemeColor
|
||||
/// and CefWindow::ThemeChanged before showing the first Window.
|
||||
///
|
||||
/// Theme colors will be reset to standard values before this callback is
|
||||
/// called for the first affected Window. Call CefWindow::SetThemeColor from
|
||||
/// inside this callback to override a standard color or add a custom color.
|
||||
/// CefViewDelegate::OnThemeChanged will be called after this callback for the
|
||||
/// complete |window| component hierarchy.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnThemeColorsChanged(CefRefPtr<CefWindow> window,
|
||||
bool chrome_theme) {}
|
||||
|
||||
///
|
||||
/// Optionally change the runtime style for this Window. See
|
||||
/// cef_runtime_style_t documentation for details.
|
||||
///
|
||||
/*--cef(default_retval=CEF_RUNTIME_STYLE_DEFAULT)--*/
|
||||
virtual cef_runtime_style_t GetWindowRuntimeStyle() {
|
||||
return CEF_RUNTIME_STYLE_DEFAULT;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_
|
||||
|
@@ -60,16 +60,16 @@ class CefByteReadHandler : public CefReadHandler {
|
||||
CefByteReadHandler& operator=(const CefByteReadHandler&) = delete;
|
||||
|
||||
// CefReadHandler methods.
|
||||
size_t Read(void* ptr, size_t size, size_t n) override;
|
||||
int Seek(int64_t offset, int whence) override;
|
||||
int64_t Tell() override;
|
||||
int Eof() override;
|
||||
bool MayBlock() override { return false; }
|
||||
virtual size_t Read(void* ptr, size_t size, size_t n) override;
|
||||
virtual int Seek(int64_t offset, int whence) override;
|
||||
virtual int64_t Tell() override;
|
||||
virtual int Eof() override;
|
||||
virtual bool MayBlock() override { return false; }
|
||||
|
||||
private:
|
||||
const unsigned char* bytes_;
|
||||
int64_t size_;
|
||||
int64_t offset_ = 0;
|
||||
int64_t offset_;
|
||||
CefRefPtr<CefBaseRefCounted> source_;
|
||||
|
||||
base::Lock lock_;
|
||||
|
@@ -144,7 +144,7 @@ class CefScopedArgArray {
|
||||
values_[i] = argv[i];
|
||||
array_[i] = const_cast<char*>(values_[i].c_str());
|
||||
}
|
||||
array_[argc] = nullptr;
|
||||
array_[argc] = NULL;
|
||||
}
|
||||
|
||||
CefScopedArgArray(const CefScopedArgArray&) = delete;
|
||||
|
@@ -347,7 +347,7 @@ class CefMessageRouterBrowserSide
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int64_t query_id) {}
|
||||
|
||||
virtual ~Handler() = default;
|
||||
virtual ~Handler() {}
|
||||
};
|
||||
|
||||
///
|
||||
@@ -435,7 +435,7 @@ class CefMessageRouterBrowserSide
|
||||
protected:
|
||||
// Protect against accidental deletion of this object.
|
||||
friend class base::RefCountedThreadSafe<CefMessageRouterBrowserSide>;
|
||||
virtual ~CefMessageRouterBrowserSide() = default;
|
||||
virtual ~CefMessageRouterBrowserSide() {}
|
||||
};
|
||||
|
||||
///
|
||||
@@ -491,7 +491,7 @@ class CefMessageRouterRendererSide
|
||||
protected:
|
||||
// Protect against accidental deletion of this object.
|
||||
friend class base::RefCountedThreadSafe<CefMessageRouterRendererSide>;
|
||||
virtual ~CefMessageRouterRendererSide() = default;
|
||||
virtual ~CefMessageRouterRendererSide() {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_WRAPPER_CEF_MESSAGE_ROUTER_H_
|
||||
|
@@ -206,7 +206,7 @@ class CefResourceManager
|
||||
///
|
||||
virtual void OnRequestCanceled(scoped_refptr<Request> request) {}
|
||||
|
||||
virtual ~Provider() = default;
|
||||
virtual ~Provider() {}
|
||||
};
|
||||
|
||||
CefResourceManager();
|
||||
|
@@ -184,7 +184,7 @@ class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> {
|
||||
void SetParent(CefXmlObject* parent);
|
||||
|
||||
CefString name_;
|
||||
CefXmlObject* parent_ = nullptr;
|
||||
CefXmlObject* parent_;
|
||||
CefString value_;
|
||||
AttributeMap attributes_;
|
||||
ObjectVector children_;
|
||||
|
@@ -5,10 +5,9 @@
|
||||
#include "libcef/browser/alloy/alloy_browser_context.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/alloy/alloy_download_manager_delegate.h"
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/ssl_host_state_delegate.h"
|
||||
@@ -113,7 +112,12 @@ AlloyBrowserContext::AlloyBrowserContext(
|
||||
const CefRequestContextSettings& settings)
|
||||
: CefBrowserContext(settings) {}
|
||||
|
||||
AlloyBrowserContext::~AlloyBrowserContext() = default;
|
||||
AlloyBrowserContext::~AlloyBrowserContext() {
|
||||
if (resource_context_) {
|
||||
content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE,
|
||||
resource_context_.release());
|
||||
}
|
||||
}
|
||||
|
||||
bool AlloyBrowserContext::IsInitialized() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -163,15 +167,15 @@ void AlloyBrowserContext::Initialize() {
|
||||
visited_link_path = cache_path_.Append(FILE_PATH_LITERAL("Visited Links"));
|
||||
}
|
||||
visitedlink_listener_ = new CefVisitedLinkListener;
|
||||
visitedlink_master_ = std::make_unique<visitedlink::VisitedLinkWriter>(
|
||||
visitedlink_master_.reset(new visitedlink::VisitedLinkWriter(
|
||||
visitedlink_listener_, this, !visited_link_path.empty(), false,
|
||||
visited_link_path, 0);
|
||||
visited_link_path, 0));
|
||||
visitedlink_listener_->CreateListenerForContext(this);
|
||||
visitedlink_master_->Init();
|
||||
|
||||
// Initialize proxy configuration tracker.
|
||||
pref_proxy_config_tracker_ = std::make_unique<PrefProxyConfigTrackerImpl>(
|
||||
GetPrefs(), content::GetIOThreadTaskRunner({}));
|
||||
pref_proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl(
|
||||
GetPrefs(), content::GetIOThreadTaskRunner({})));
|
||||
|
||||
// Spell checking support and possibly other subsystems retrieve the
|
||||
// PrefService associated with a BrowserContext via UserPrefs::Get().
|
||||
@@ -297,6 +301,22 @@ bool AlloyBrowserContext::UnloadExtension(const CefString& extension_id) {
|
||||
return extension_system()->UnloadExtension(extension_id);
|
||||
}
|
||||
|
||||
bool AlloyBrowserContext::IsPrintPreviewSupported() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!extensions::PrintPreviewEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled);
|
||||
}
|
||||
|
||||
content::ResourceContext* AlloyBrowserContext::GetResourceContext() {
|
||||
if (!resource_context_) {
|
||||
resource_context_ = std::make_unique<content::ResourceContext>();
|
||||
}
|
||||
return resource_context_.get();
|
||||
}
|
||||
|
||||
content::ClientHintsControllerDelegate*
|
||||
AlloyBrowserContext::GetClientHintsControllerDelegate() {
|
||||
return nullptr;
|
||||
@@ -335,8 +355,8 @@ AlloyBrowserContext::CreateZoomLevelDelegate(
|
||||
content::DownloadManagerDelegate*
|
||||
AlloyBrowserContext::GetDownloadManagerDelegate() {
|
||||
if (!download_manager_delegate_) {
|
||||
download_manager_delegate_ =
|
||||
std::make_unique<AlloyDownloadManagerDelegate>(GetDownloadManager());
|
||||
download_manager_delegate_.reset(
|
||||
new CefDownloadManagerDelegate(GetDownloadManager()));
|
||||
}
|
||||
return download_manager_delegate_.get();
|
||||
}
|
||||
@@ -368,7 +388,7 @@ AlloyBrowserContext::GetStorageNotificationService() {
|
||||
|
||||
content::SSLHostStateDelegate* AlloyBrowserContext::GetSSLHostStateDelegate() {
|
||||
if (!ssl_host_state_delegate_) {
|
||||
ssl_host_state_delegate_ = std::make_unique<CefSSLHostStateDelegate>();
|
||||
ssl_host_state_delegate_.reset(new CefSSLHostStateDelegate());
|
||||
}
|
||||
return ssl_host_state_delegate_.get();
|
||||
}
|
||||
@@ -452,27 +472,14 @@ void AlloyBrowserContext::RebuildTable(
|
||||
enumerator->OnComplete(true);
|
||||
}
|
||||
|
||||
void AlloyBrowserContext::BuildVisitedLinkTable(
|
||||
const scoped_refptr<VisitedLinkEnumerator>& enumerator) {
|
||||
// Called when visited links will not or cannot be loaded from disk.
|
||||
enumerator->OnVisitedLinkComplete(true);
|
||||
}
|
||||
|
||||
DownloadPrefs* AlloyBrowserContext::GetDownloadPrefs() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!download_prefs_) {
|
||||
download_prefs_ = std::make_unique<DownloadPrefs>(this);
|
||||
download_prefs_.reset(new DownloadPrefs(this));
|
||||
}
|
||||
return download_prefs_.get();
|
||||
}
|
||||
|
||||
void AlloyBrowserContext::AddVisitedURLs(
|
||||
const GURL& url,
|
||||
const std::vector<GURL>& redirect_chain,
|
||||
ui::PageTransition /*transition*/) {
|
||||
if (!redirect_chain.empty()) {
|
||||
visitedlink_master_->AddURLs(redirect_chain);
|
||||
} else {
|
||||
visitedlink_master_->AddURL(url);
|
||||
}
|
||||
void AlloyBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) {
|
||||
visitedlink_master_->AddURLs(urls);
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@
|
||||
#include "components/proxy_config/pref_proxy_config_tracker.h"
|
||||
#include "components/visitedlink/browser/visitedlink_delegate.h"
|
||||
|
||||
class AlloyDownloadManagerDelegate;
|
||||
class CefDownloadManagerDelegate;
|
||||
class CefSSLHostStateDelegate;
|
||||
class CefVisitedLinkListener;
|
||||
class PrefService;
|
||||
@@ -56,11 +56,10 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
bool GetExtensions(std::vector<CefString>& extension_ids) override;
|
||||
CefRefPtr<CefExtension> GetExtension(const CefString& extension_id) override;
|
||||
bool UnloadExtension(const CefString& extension_id) override;
|
||||
void AddVisitedURLs(const GURL& url,
|
||||
const std::vector<GURL>& redirect_chain,
|
||||
ui::PageTransition transition) override;
|
||||
bool IsPrintPreviewSupported() const override;
|
||||
|
||||
// content::BrowserContext overrides.
|
||||
content::ResourceContext* GetResourceContext() override;
|
||||
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
|
||||
override;
|
||||
base::FilePath GetPath() override;
|
||||
@@ -110,16 +109,17 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
|
||||
// visitedlink::VisitedLinkDelegate methods.
|
||||
void RebuildTable(const scoped_refptr<URLEnumerator>& enumerator) override;
|
||||
void BuildVisitedLinkTable(
|
||||
const scoped_refptr<VisitedLinkEnumerator>& enumerator) override;
|
||||
|
||||
// Manages extensions.
|
||||
extensions::CefExtensionSystem* extension_system() const {
|
||||
return extension_system_;
|
||||
}
|
||||
|
||||
// Called from DownloadPrefs::FromBrowserContext via
|
||||
// alloy::GetDownloadPrefsFromBrowserContext.
|
||||
// Called from AlloyBrowserHostImpl::DidFinishNavigation to update the table
|
||||
// of visited links.
|
||||
void AddVisitedURLs(const std::vector<GURL>& urls);
|
||||
|
||||
// Called from DownloadPrefs::FromBrowserContext.
|
||||
DownloadPrefs* GetDownloadPrefs();
|
||||
|
||||
private:
|
||||
@@ -128,7 +128,7 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
std::unique_ptr<PrefService> pref_service_;
|
||||
std::unique_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
|
||||
|
||||
std::unique_ptr<AlloyDownloadManagerDelegate> download_manager_delegate_;
|
||||
std::unique_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
|
||||
std::unique_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_;
|
||||
std::unique_ptr<visitedlink::VisitedLinkWriter> visitedlink_master_;
|
||||
// |visitedlink_listener_| is owned by visitedlink_master_.
|
||||
@@ -142,6 +142,8 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
std::unique_ptr<ProfileKey> key_;
|
||||
|
||||
std::unique_ptr<DownloadPrefs> download_prefs_;
|
||||
|
||||
std::unique_ptr<content::ResourceContext> resource_context_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_CONTEXT_H_
|
||||
|
@@ -5,10 +5,10 @@
|
||||
|
||||
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/alloy/alloy_browser_context.h"
|
||||
#include "libcef/browser/alloy/browser_platform_delegate_alloy.h"
|
||||
#include "libcef/browser/audio_capturer.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
@@ -16,8 +16,7 @@
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "libcef/browser/hang_monitor.h"
|
||||
#include "libcef/browser/devtools/devtools_manager.h"
|
||||
#include "libcef/browser/media_access_query.h"
|
||||
#include "libcef/browser/osr/osr_util.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
@@ -28,7 +27,7 @@
|
||||
#include "libcef/common/net/url_util.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
#include "libcef/features/runtime.h"
|
||||
#include "libcef/features/runtime_checks.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/functional/bind.h"
|
||||
@@ -72,15 +71,11 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
|
||||
CefBrowserPlatformDelegate::Create(create_params);
|
||||
CHECK(platform_delegate);
|
||||
|
||||
// Expect runtime style to match.
|
||||
CHECK(platform_delegate->IsAlloyStyle());
|
||||
|
||||
const bool is_devtools_popup = !!create_params.devtools_opener;
|
||||
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefBrowserInfoManager::GetInstance()->CreateBrowserInfo(
|
||||
is_devtools_popup, platform_delegate->IsWindowless(),
|
||||
platform_delegate->IsPrintPreviewSupported(),
|
||||
create_params.extra_info);
|
||||
|
||||
bool own_web_contents = false;
|
||||
@@ -104,7 +99,8 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
|
||||
|
||||
CefRefPtr<AlloyBrowserHostImpl> browser = CreateInternal(
|
||||
create_params.settings, create_params.client, web_contents,
|
||||
own_web_contents, info, FromBaseChecked(create_params.devtools_opener),
|
||||
own_web_contents, info,
|
||||
static_cast<AlloyBrowserHostImpl*>(create_params.devtools_opener.get()),
|
||||
is_devtools_popup, request_context_impl, std::move(platform_delegate),
|
||||
cef_extension);
|
||||
if (!browser) {
|
||||
@@ -183,8 +179,8 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
|
||||
// 1. Notify the opener browser's platform delegate. With Views this will
|
||||
// result in a call to CefBrowserViewDelegate::OnPopupBrowserViewCreated().
|
||||
// Do this first for consistency with the Chrome runtime.
|
||||
opener->platform_delegate_->PopupBrowserCreated(
|
||||
browser->platform_delegate(), browser.get(), is_devtools_popup);
|
||||
opener->platform_delegate_->PopupBrowserCreated(browser.get(),
|
||||
is_devtools_popup);
|
||||
}
|
||||
|
||||
// 2. Notify the browser's LifeSpanHandler. This must always be the first
|
||||
@@ -202,44 +198,42 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
|
||||
return browser;
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::FromBaseChecked(
|
||||
CefRefPtr<CefBrowserHostBase> host_base) {
|
||||
if (!host_base) {
|
||||
return nullptr;
|
||||
}
|
||||
CHECK(host_base->IsAlloyStyle());
|
||||
return static_cast<AlloyBrowserHostImpl*>(host_base.get());
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForHost(
|
||||
const content::RenderViewHost* host) {
|
||||
return FromBaseChecked(CefBrowserHostBase::GetBrowserForHost(host));
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
auto browser = CefBrowserHostBase::GetBrowserForHost(host);
|
||||
return static_cast<AlloyBrowserHostImpl*>(browser.get());
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForHost(
|
||||
const content::RenderFrameHost* host) {
|
||||
return FromBaseChecked(CefBrowserHostBase::GetBrowserForHost(host));
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
auto browser = CefBrowserHostBase::GetBrowserForHost(host);
|
||||
return static_cast<AlloyBrowserHostImpl*>(browser.get());
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForContents(
|
||||
const content::WebContents* contents) {
|
||||
return FromBaseChecked(CefBrowserHostBase::GetBrowserForContents(contents));
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
auto browser = CefBrowserHostBase::GetBrowserForContents(contents);
|
||||
return static_cast<AlloyBrowserHostImpl*>(browser.get());
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id) {
|
||||
return FromBaseChecked(CefBrowserHostBase::GetBrowserForGlobalId(global_id));
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
auto browser = CefBrowserHostBase::GetBrowserForGlobalId(global_id);
|
||||
return static_cast<AlloyBrowserHostImpl*>(browser.get());
|
||||
}
|
||||
|
||||
// AlloyBrowserHostImpl methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
AlloyBrowserHostImpl::~AlloyBrowserHostImpl() = default;
|
||||
AlloyBrowserHostImpl::~AlloyBrowserHostImpl() {}
|
||||
|
||||
void AlloyBrowserHostImpl::CloseBrowser(bool force_close) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
@@ -337,6 +331,42 @@ void AlloyBrowserHostImpl::StopFinding(bool clearSelection) {
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::ShowDevToolsOnUIThread(
|
||||
std::unique_ptr<CefShowDevToolsParams> params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!EnsureDevToolsManager()) {
|
||||
return;
|
||||
}
|
||||
devtools_manager_->ShowDevTools(params->window_info_, params->client_,
|
||||
params->settings_,
|
||||
params->inspect_element_at_);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::CloseDevTools() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&AlloyBrowserHostImpl::CloseDevTools, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!devtools_manager_) {
|
||||
return;
|
||||
}
|
||||
devtools_manager_->CloseDevTools();
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::HasDevTools() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!devtools_manager_) {
|
||||
return false;
|
||||
}
|
||||
return devtools_manager_->HasDevTools();
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) {
|
||||
@@ -604,9 +634,8 @@ void AlloyBrowserHostImpl::CancelContextMenu() {
|
||||
|
||||
bool AlloyBrowserHostImpl::MaybeAllowNavigation(
|
||||
content::RenderFrameHost* opener,
|
||||
bool is_guest_view,
|
||||
const content::OpenURLParams& params) {
|
||||
const bool is_guest_view = extensions::IsBrowserPluginGuest(
|
||||
content::WebContents::FromRenderFrameHost(opener));
|
||||
if (is_guest_view && !params.is_pdf &&
|
||||
!params.url.SchemeIs(extensions::kExtensionScheme) &&
|
||||
!params.url.SchemeIs(content::kChromeUIScheme)) {
|
||||
@@ -618,7 +647,7 @@ bool AlloyBrowserHostImpl::MaybeAllowNavigation(
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(
|
||||
base::IgnoreResult(&AlloyBrowserHostImpl::OpenURLFromTab),
|
||||
this, nullptr, params, base::NullCallback()));
|
||||
this, nullptr, params));
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -926,11 +955,8 @@ bool AlloyBrowserHostImpl::IsAudioMuted() {
|
||||
|
||||
content::WebContents* AlloyBrowserHostImpl::OpenURLFromTab(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params,
|
||||
base::OnceCallback<void(content::NavigationHandle&)>
|
||||
navigation_handle_callback) {
|
||||
auto target_contents = contents_delegate_->OpenURLFromTabEx(
|
||||
source, params, navigation_handle_callback);
|
||||
const content::OpenURLParams& params) {
|
||||
auto target_contents = contents_delegate_->OpenURLFromTab(source, params);
|
||||
if (target_contents) {
|
||||
// Start a navigation in the current browser that will result in the
|
||||
// creation of a new render process.
|
||||
@@ -1147,8 +1173,7 @@ void AlloyBrowserHostImpl::WebContentsCreated(
|
||||
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
|
||||
new_contents, platform_delegate->IsWindowless(),
|
||||
platform_delegate->IsPrintPreviewSupported(), extra_info);
|
||||
new_contents, platform_delegate->IsWindowless(), extra_info);
|
||||
CHECK(info.get());
|
||||
CHECK(info->is_popup());
|
||||
|
||||
@@ -1167,28 +1192,13 @@ void AlloyBrowserHostImpl::WebContentsCreated(
|
||||
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);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::RendererUnresponsive(
|
||||
content::WebContents* source,
|
||||
content::RenderWidgetHost* render_widget_host,
|
||||
base::RepeatingClosure hang_monitor_restarter) {
|
||||
hang_monitor::RendererUnresponsive(this, render_widget_host,
|
||||
hang_monitor_restarter);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::RendererResponsive(
|
||||
content::WebContents* source,
|
||||
content::RenderWidgetHost* render_widget_host) {
|
||||
hang_monitor::RendererResponsive(this, render_widget_host);
|
||||
std::move(platform_delegate), /*cef_extension=*/nullptr);
|
||||
}
|
||||
|
||||
content::JavaScriptDialogManager*
|
||||
AlloyBrowserHostImpl::GetJavaScriptDialogManager(content::WebContents* source) {
|
||||
if (!javascript_dialog_manager_) {
|
||||
javascript_dialog_manager_ =
|
||||
std::make_unique<CefJavaScriptDialogManager>(this);
|
||||
javascript_dialog_manager_.reset(new CefJavaScriptDialogManager(this));
|
||||
}
|
||||
return javascript_dialog_manager_.get();
|
||||
}
|
||||
@@ -1206,8 +1216,8 @@ bool AlloyBrowserHostImpl::ShowContextMenu(
|
||||
const content::ContextMenuParams& params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!menu_manager_.get() && platform_delegate_) {
|
||||
menu_manager_ = std::make_unique<CefMenuManager>(
|
||||
this, platform_delegate_->CreateMenuRunner());
|
||||
menu_manager_.reset(
|
||||
new CefMenuManager(this, platform_delegate_->CreateMenuRunner()));
|
||||
}
|
||||
return menu_manager_->CreateContextMenu(params);
|
||||
}
|
||||
@@ -1276,8 +1286,8 @@ void AlloyBrowserHostImpl::ExitPictureInPicture() {
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::IsBackForwardCacheSupported() {
|
||||
// Disabled with Alloy bootstrap due to issue #3237.
|
||||
return cef::IsChromeRuntimeEnabled();
|
||||
// Disabled due to issue #3237.
|
||||
return false;
|
||||
}
|
||||
|
||||
content::PreloadingEligibility AlloyBrowserHostImpl::IsPrerender2Supported(
|
||||
@@ -1285,24 +1295,17 @@ content::PreloadingEligibility AlloyBrowserHostImpl::IsPrerender2Supported(
|
||||
return content::PreloadingEligibility::kEligible;
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::DraggableRegionsChanged(
|
||||
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
|
||||
content::WebContents* contents) {
|
||||
contents_delegate_->DraggableRegionsChanged(regions, contents);
|
||||
}
|
||||
|
||||
// content::WebContentsObserver methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
void AlloyBrowserHostImpl::DidFinishNavigation(
|
||||
content::NavigationHandle* navigation_handle) {
|
||||
if (web_contents()) {
|
||||
auto cef_browser_context = CefBrowserContext::FromBrowserContext(
|
||||
web_contents()->GetBrowserContext());
|
||||
auto cef_browser_context =
|
||||
static_cast<AlloyBrowserContext*>(web_contents()->GetBrowserContext());
|
||||
if (cef_browser_context) {
|
||||
cef_browser_context->AddVisitedURLs(
|
||||
navigation_handle->GetURL(), navigation_handle->GetRedirectChain(),
|
||||
navigation_handle->GetPageTransition());
|
||||
navigation_handle->GetRedirectChain());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1385,8 +1388,7 @@ void AlloyBrowserHostImpl::StartAudioCapturer() {
|
||||
return;
|
||||
}
|
||||
|
||||
audio_capturer_ =
|
||||
std::make_unique<CefAudioCapturer>(params, this, audio_handler);
|
||||
audio_capturer_.reset(new CefAudioCapturer(params, this, audio_handler));
|
||||
}
|
||||
|
||||
// AlloyBrowserHostImpl private methods.
|
||||
|
@@ -62,11 +62,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
static CefRefPtr<AlloyBrowserHostImpl> Create(
|
||||
CefBrowserCreateParams& create_params);
|
||||
|
||||
// Safe (checked) conversion from CefBrowserHostBase to AlloyBrowserHostImpl.
|
||||
// Use this method instead of static_cast.
|
||||
static CefRefPtr<AlloyBrowserHostImpl> FromBaseChecked(
|
||||
CefRefPtr<CefBrowserHostBase> host_base);
|
||||
|
||||
// Returns the browser associated with the specified RenderViewHost.
|
||||
static CefRefPtr<AlloyBrowserHostImpl> GetBrowserForHost(
|
||||
const content::RenderViewHost* host);
|
||||
@@ -90,6 +85,8 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
bool matchCase,
|
||||
bool findNext) override;
|
||||
void StopFinding(bool clearSelection) override;
|
||||
void CloseDevTools() override;
|
||||
bool HasDevTools() override;
|
||||
bool IsWindowRenderingDisabled() override;
|
||||
void WasResized() override;
|
||||
void WasHidden(bool hidden) override;
|
||||
@@ -129,9 +126,9 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
void ExecuteChromeCommand(int command_id,
|
||||
cef_window_open_disposition_t disposition) override;
|
||||
|
||||
// CefBrowserHostBase methods:
|
||||
// Returns true if windowless rendering is enabled.
|
||||
bool IsWindowless() const override;
|
||||
bool IsAlloyStyle() const override { return true; }
|
||||
|
||||
bool IsVisible() const override;
|
||||
|
||||
// Returns true if this browser supports picture-in-picture.
|
||||
@@ -150,6 +147,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
void CancelContextMenu();
|
||||
|
||||
bool MaybeAllowNavigation(content::RenderFrameHost* opener,
|
||||
bool is_guest_view,
|
||||
const content::OpenURLParams& params) override;
|
||||
|
||||
// Convert from view DIP coordinates to screen coordinates. If
|
||||
@@ -184,9 +182,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
// content::WebContentsDelegate methods.
|
||||
content::WebContents* OpenURLFromTab(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params,
|
||||
base::OnceCallback<void(content::NavigationHandle&)>
|
||||
navigation_handle_callback) override;
|
||||
const content::OpenURLParams& params) override;
|
||||
bool ShouldAllowRendererInitiatedCrossProcessNavigation(
|
||||
bool is_main_frame_navigation) override;
|
||||
void AddNewContents(content::WebContents* source,
|
||||
@@ -237,13 +233,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
const std::string& frame_name,
|
||||
const GURL& target_url,
|
||||
content::WebContents* new_contents) override;
|
||||
void RendererUnresponsive(
|
||||
content::WebContents* source,
|
||||
content::RenderWidgetHost* render_widget_host,
|
||||
base::RepeatingClosure hang_monitor_restarter) override;
|
||||
void RendererResponsive(
|
||||
content::WebContents* source,
|
||||
content::RenderWidgetHost* render_widget_host) override;
|
||||
content::JavaScriptDialogManager* GetJavaScriptDialogManager(
|
||||
content::WebContents* source) override;
|
||||
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
||||
@@ -281,9 +270,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
bool IsBackForwardCacheSupported() override;
|
||||
content::PreloadingEligibility IsPrerender2Supported(
|
||||
content::WebContents& web_contents) override;
|
||||
void DraggableRegionsChanged(
|
||||
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
|
||||
content::WebContents* contents) override;
|
||||
|
||||
// content::WebContentsObserver methods.
|
||||
using content::WebContentsObserver::BeforeUnloadFired;
|
||||
@@ -297,6 +283,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
override;
|
||||
void WebContentsDestroyed() override;
|
||||
|
||||
protected:
|
||||
void ShowDevToolsOnUIThread(
|
||||
std::unique_ptr<CefShowDevToolsParams> params) override;
|
||||
|
||||
private:
|
||||
friend class CefBrowserPlatformDelegateAlloy;
|
||||
|
||||
|
@@ -6,14 +6,13 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "libcef/browser/alloy/devtools/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/alloy/dialogs/alloy_constrained_window_views_client.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_context_keyed_service_factories.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/extension_system_factory.h"
|
||||
#include "libcef/browser/file_dialog_runner.h"
|
||||
#include "libcef/browser/net/chrome_scheme_handler.h"
|
||||
@@ -37,7 +36,6 @@
|
||||
#include "chrome/browser/ui/ui_features.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "components/color/color_mixers.h"
|
||||
#include "components/constrained_window/constrained_window_views.h"
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
#include "content/public/browser/network_service_instance.h"
|
||||
@@ -51,13 +49,10 @@
|
||||
#include "ui/native_theme/native_theme.h"
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
#include "ui/base/ozone_buildflags.h"
|
||||
#if defined(USE_AURA) && BUILDFLAG(IS_OZONE_X11)
|
||||
#include "ui/ozone/buildflags.h"
|
||||
#if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11)
|
||||
#include "ui/events/devices/x11/touch_factory_x11.h"
|
||||
#endif
|
||||
#if defined(USE_DBUS)
|
||||
#include "chrome/browser/ui/views/dark_mode_manager_linux.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_AURA)
|
||||
@@ -130,10 +125,26 @@ class LinuxUiGetterImpl : public ui::LinuxUiGetter {
|
||||
}
|
||||
};
|
||||
|
||||
ui::LinuxUi* GetLinuxUI() {
|
||||
// We can't use GtkUi in combination with multi-threaded-message-loop because
|
||||
// Chromium's GTK implementation doesn't use GDK threads.
|
||||
if (!!CefContext::Get()->settings().multi_threaded_message_loop) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// If the ozone backend hasn't provided a LinuxUiDelegate, don't try to create
|
||||
// a LinuxUi instance as this may result in a crash in toolkit initialization.
|
||||
if (!ui::LinuxUiDelegate::GetInstance()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return ui::GetDefaultLinuxUi();
|
||||
}
|
||||
|
||||
#endif // BUILDFLAG(IS_LINUX)
|
||||
|
||||
void ProcessSingletonNotificationCallbackImpl(
|
||||
base::CommandLine command_line,
|
||||
const base::CommandLine& command_line,
|
||||
const base::FilePath& current_directory) {
|
||||
// Drop the request if the browser process is already shutting down.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
@@ -160,7 +171,7 @@ void ProcessSingletonNotificationCallbackImpl(
|
||||
|
||||
// Based on ChromeBrowserMainParts::ProcessSingletonNotificationCallback.
|
||||
bool ProcessSingletonNotificationCallback(
|
||||
base::CommandLine command_line,
|
||||
const base::CommandLine& command_line,
|
||||
const base::FilePath& current_directory) {
|
||||
// Drop the request if the browser process is already shutting down.
|
||||
// Note that we're going to post an async task below. Even if the browser
|
||||
@@ -179,7 +190,7 @@ bool ProcessSingletonNotificationCallback(
|
||||
// So, we post a task to asynchronously finish the command line processing.
|
||||
return base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&ProcessSingletonNotificationCallbackImpl,
|
||||
std::move(command_line), current_directory));
|
||||
command_line, current_directory));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -191,12 +202,11 @@ AlloyBrowserMainParts::~AlloyBrowserMainParts() {
|
||||
}
|
||||
|
||||
void AlloyBrowserMainParts::ToolkitInitialized() {
|
||||
SetConstrainedWindowViewsClient(
|
||||
CreateAlloyConstrainedWindowViewsClient(nullptr));
|
||||
SetConstrainedWindowViewsClient(CreateAlloyConstrainedWindowViewsClient());
|
||||
#if defined(USE_AURA)
|
||||
CHECK(aura::Env::GetInstance());
|
||||
|
||||
wm_state_ = std::make_unique<wm::WMState>();
|
||||
wm_state_.reset(new wm::WMState);
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
@@ -208,9 +218,7 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
// Based on chrome_browser_main_extra_parts_views_linux.cc
|
||||
// |linux_ui| will be nullptr with multi-threaded-message-loop. See
|
||||
// CefUiThread::InitializeBrowserRunner.
|
||||
if (auto linux_ui = ui::GetDefaultLinuxUi()) {
|
||||
if (auto linux_ui = GetLinuxUI()) {
|
||||
linux_ui_getter_ = std::make_unique<LinuxUiGetterImpl>();
|
||||
ui::LinuxUi::SetInstance(linux_ui);
|
||||
|
||||
@@ -219,13 +227,6 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
||||
ui::CursorFactory::GetInstance()->ObserveThemeChanges();
|
||||
}
|
||||
|
||||
#if defined(USE_DBUS)
|
||||
if (!ui::NativeTheme::IsForcedDarkMode() &&
|
||||
!ui::NativeTheme::IsForcedLightMode()) {
|
||||
dark_mode_manager_ = std::make_unique<ui::DarkModeManagerLinux>();
|
||||
}
|
||||
#endif
|
||||
|
||||
auto printing_delegate = new CefPrintingContextLinuxDelegate();
|
||||
auto default_delegate =
|
||||
ui::PrintingContextLinuxDelegate::SetInstance(printing_delegate);
|
||||
@@ -244,15 +245,13 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
||||
|
||||
// On GTK that builds the native theme that, in turn, adds the GTK core color
|
||||
// mixer; core mixers should all be added before we add chrome mixers.
|
||||
ui::ColorProviderManager::Get().AppendColorProviderInitializer(
|
||||
base::BindRepeating(color::AddComponentsColorMixers));
|
||||
ui::ColorProviderManager::Get().AppendColorProviderInitializer(
|
||||
base::BindRepeating(AddChromeColorMixers));
|
||||
}
|
||||
|
||||
void AlloyBrowserMainParts::PreCreateMainMessageLoop() {
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
#if defined(USE_AURA) && BUILDFLAG(IS_OZONE_X11)
|
||||
#if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11)
|
||||
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -6,11 +6,10 @@
|
||||
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_MAIN_H_
|
||||
#pragma once
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "content/public/browser/browser_main_parts.h"
|
||||
@@ -32,10 +31,7 @@ class LayoutProvider;
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
namespace ui {
|
||||
class LinuxUiGetter;
|
||||
#if defined(USE_DBUS)
|
||||
class DarkModeManagerLinux;
|
||||
#endif
|
||||
} // namespace ui
|
||||
}
|
||||
#endif
|
||||
|
||||
class CefDevToolsDelegate;
|
||||
@@ -103,9 +99,6 @@ class AlloyBrowserMainParts : public content::BrowserMainParts {
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
std::unique_ptr<ui::LinuxUiGetter> linux_ui_getter_;
|
||||
#if defined(USE_DBUS)
|
||||
std::unique_ptr<ui::DarkModeManagerLinux> dark_mode_manager_;
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@@ -13,7 +13,6 @@
|
||||
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
|
||||
#include "libcef/browser/alloy/alloy_browser_main.h"
|
||||
#include "libcef/browser/alloy/alloy_web_contents_view_delegate.h"
|
||||
#include "libcef/browser/alloy/devtools/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_frame.h"
|
||||
#include "libcef/browser/browser_info.h"
|
||||
@@ -22,6 +21,7 @@
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/certificate_query.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/extensions/extension_web_contents_observer.h"
|
||||
#include "libcef/browser/media_capture_devices_dispatcher.h"
|
||||
@@ -70,7 +70,6 @@
|
||||
#include "chrome/browser/profiles/renderer_updater.h"
|
||||
#include "chrome/browser/profiles/renderer_updater_factory.h"
|
||||
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
|
||||
#include "chrome/browser/spellchecker/spell_check_initialization_host_impl.h"
|
||||
#include "chrome/browser/ui/chrome_select_file_policy.h"
|
||||
#include "chrome/browser/ui/pdf/chrome_pdf_document_helper_client.h"
|
||||
#include "chrome/common/chrome_content_client.h"
|
||||
@@ -91,8 +90,7 @@
|
||||
#include "components/pdf/browser/pdf_document_helper.h"
|
||||
#include "components/pdf/browser/pdf_navigation_throttle.h"
|
||||
#include "components/pdf/browser/pdf_url_loader_request_interceptor.h"
|
||||
#include "components/pdf/common/constants.h"
|
||||
#include "components/pdf/common/pdf_util.h"
|
||||
#include "components/pdf/common/internal_plugin_helpers.h"
|
||||
#include "components/policy/core/common/policy_pref_names.h"
|
||||
#include "components/spellcheck/common/spellcheck.mojom.h"
|
||||
#include "components/version_info/version_info.h"
|
||||
@@ -109,33 +107,24 @@
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "content/public/browser/service_worker_version_base_info.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
#include "content/public/browser/web_ui_url_loader_factory.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "crypto/crypto_buildflags.h"
|
||||
#include "extensions/browser/api/automation_internal/automation_event_router.h"
|
||||
#include "extensions/browser/api/mime_handler_private/mime_handler_private.h"
|
||||
#include "extensions/browser/event_router.h"
|
||||
#include "extensions/browser/extension_message_filter.h"
|
||||
#include "extensions/browser/extension_protocols.h"
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
#include "extensions/browser/extension_web_contents_observer.h"
|
||||
#include "extensions/browser/extensions_browser_client.h"
|
||||
#include "extensions/browser/guest_view/extensions_guest_view.h"
|
||||
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
|
||||
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
|
||||
#include "extensions/browser/process_map.h"
|
||||
#include "extensions/browser/renderer_startup_helper.h"
|
||||
#include "extensions/browser/service_worker/service_worker_host.h"
|
||||
#include "extensions/browser/url_loader_factory_manager.h"
|
||||
#include "extensions/common/api/mime_handler.mojom.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/mojom/automation_registry.mojom.h"
|
||||
#include "extensions/common/mojom/event_router.mojom.h"
|
||||
#include "extensions/common/mojom/guest_view.mojom.h"
|
||||
#include "extensions/common/mojom/renderer_host.mojom.h"
|
||||
#include "extensions/common/switches.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
|
||||
@@ -197,7 +186,7 @@ class CefSelectClientCertificateCallbackImpl
|
||||
CefSelectClientCertificateCallbackImpl& operator=(
|
||||
const CefSelectClientCertificateCallbackImpl&) = delete;
|
||||
|
||||
~CefSelectClientCertificateCallbackImpl() override {
|
||||
~CefSelectClientCertificateCallbackImpl() {
|
||||
// If Select has not been called, call it with NULL to continue without any
|
||||
// client certificate.
|
||||
if (delegate_) {
|
||||
@@ -311,33 +300,6 @@ void BindNetworkHintsHandler(
|
||||
predictors::NetworkHintsHandlerImpl::Create(frame_host, std::move(receiver));
|
||||
}
|
||||
|
||||
// From chrome/browser/chrome_browser_interface_binders.cc
|
||||
void BindMimeHandlerService(
|
||||
content::RenderFrameHost* frame_host,
|
||||
mojo::PendingReceiver<extensions::mime_handler::MimeHandlerService>
|
||||
receiver) {
|
||||
auto* guest_view =
|
||||
extensions::MimeHandlerViewGuest::FromRenderFrameHost(frame_host);
|
||||
if (!guest_view) {
|
||||
return;
|
||||
}
|
||||
extensions::MimeHandlerServiceImpl::Create(guest_view->GetStreamWeakPtr(),
|
||||
std::move(receiver));
|
||||
}
|
||||
|
||||
// From chrome/browser/chrome_browser_interface_binders.cc
|
||||
void BindBeforeUnloadControl(
|
||||
content::RenderFrameHost* frame_host,
|
||||
mojo::PendingReceiver<extensions::mime_handler::BeforeUnloadControl>
|
||||
receiver) {
|
||||
auto* guest_view =
|
||||
extensions::MimeHandlerViewGuest::FromRenderFrameHost(frame_host);
|
||||
if (!guest_view) {
|
||||
return;
|
||||
}
|
||||
guest_view->FuseBeforeUnloadControl(std::move(receiver));
|
||||
}
|
||||
|
||||
base::FilePath GetUserDataPath() {
|
||||
base::FilePath user_data_path;
|
||||
base::PathService::Get(chrome::DIR_USER_DATA, &user_data_path);
|
||||
@@ -397,6 +359,13 @@ void AlloyContentBrowserClient::RenderProcessWillLaunch(
|
||||
content::RenderProcessHost* host) {
|
||||
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS_LEGACY_IPC)
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
host->AddFilter(
|
||||
new extensions::ExtensionMessageFilter(host->GetID(), profile));
|
||||
}
|
||||
#endif
|
||||
|
||||
// If the renderer process crashes then the host may already have
|
||||
// CefBrowserInfoManager as an observer. Try to remove it first before adding
|
||||
// to avoid DCHECKs.
|
||||
@@ -450,7 +419,7 @@ bool AlloyContentBrowserClient::DoesSiteRequireDedicatedProcess(
|
||||
}
|
||||
|
||||
bool AlloyContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
|
||||
std::string_view scheme,
|
||||
base::StringPiece scheme,
|
||||
bool is_embedded_origin_secure) {
|
||||
// This is needed to bypass the normal SameSite rules for any chrome:// page
|
||||
// embedding a secure origin, regardless of the registrable domains of any
|
||||
@@ -471,7 +440,7 @@ bool AlloyContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
|
||||
|
||||
bool AlloyContentBrowserClient::
|
||||
ShouldIgnoreSameSiteCookieRestrictionsWhenTopLevel(
|
||||
std::string_view scheme,
|
||||
base::StringPiece scheme,
|
||||
bool is_embedded_origin_secure) {
|
||||
return is_embedded_origin_secure && scheme == content::kChromeUIScheme;
|
||||
}
|
||||
@@ -535,7 +504,7 @@ bool AlloyContentBrowserClient::IsHandledURL(const GURL& url) {
|
||||
return CefAppManager::Get()->HasCustomScheme(scheme);
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::SiteInstanceGotProcessAndSite(
|
||||
void AlloyContentBrowserClient::SiteInstanceGotProcess(
|
||||
content::SiteInstance* site_instance) {
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return;
|
||||
@@ -564,10 +533,9 @@ void AlloyContentBrowserClient::SiteInstanceGotProcessAndSite(
|
||||
void AlloyContentBrowserClient::BindHostReceiverForRenderer(
|
||||
content::RenderProcessHost* render_process_host,
|
||||
mojo::GenericPendingReceiver receiver) {
|
||||
if (auto host_receiver =
|
||||
receiver.As<spellcheck::mojom::SpellCheckInitializationHost>()) {
|
||||
SpellCheckInitializationHostImpl::Create(render_process_host->GetID(),
|
||||
std::move(host_receiver));
|
||||
if (auto host_receiver = receiver.As<spellcheck::mojom::SpellCheckHost>()) {
|
||||
SpellCheckHostChromeImpl::Create(render_process_host->GetID(),
|
||||
std::move(host_receiver));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -626,6 +594,10 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
process ? CefBrowserContext::FromBrowserContext(browser_context)
|
||||
: nullptr;
|
||||
if (cef_browser_context) {
|
||||
if (cef_browser_context->IsPrintPreviewSupported()) {
|
||||
command_line->AppendSwitch(switches::kEnablePrintPreview);
|
||||
}
|
||||
|
||||
// Based on ChromeContentBrowserClientExtensionsPart::
|
||||
// AppendExtraRendererCommandLineSwitches
|
||||
if (extensions::ProcessMap::Get(browser_context)
|
||||
@@ -783,8 +755,9 @@ base::OnceClosure AlloyContentBrowserClient::SelectClientCertificate(
|
||||
}
|
||||
|
||||
CefRequestHandler::X509CertificateList certs;
|
||||
for (auto& client_cert : client_certs) {
|
||||
certs.push_back(new CefX509CertificateImpl(std::move(client_cert)));
|
||||
for (net::ClientCertIdentityList::iterator iter = client_certs.begin();
|
||||
iter != client_certs.end(); iter++) {
|
||||
certs.push_back(new CefX509CertificateImpl(std::move(*iter)));
|
||||
}
|
||||
|
||||
CefRefPtr<CefSelectClientCertificateCallbackImpl> callbackImpl(
|
||||
@@ -857,49 +830,6 @@ AlloyContentBrowserClient::CreateDevToolsManagerDelegate() {
|
||||
return std::make_unique<CefDevToolsManagerDelegate>();
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* render_process_host) {
|
||||
CefBrowserManager::ExposeInterfacesToRenderer(registry, associated_registry,
|
||||
render_process_host);
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
// From ChromeContentBrowserClientExtensionsPart::
|
||||
// ExposeInterfacesToRenderer
|
||||
associated_registry->AddInterface<extensions::mojom::RendererHost>(
|
||||
base::BindRepeating(&extensions::RendererStartupHelper::BindForRenderer,
|
||||
render_process_host->GetID()));
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::
|
||||
RegisterAssociatedInterfaceBindersForServiceWorker(
|
||||
const content::ServiceWorkerVersionBaseInfo&
|
||||
service_worker_version_info,
|
||||
blink::AssociatedInterfaceRegistry& associated_registry) {
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
// From ChromeContentBrowserClientExtensionsPart::
|
||||
// ExposeInterfacesToRendererForServiceWorker
|
||||
CHECK(service_worker_version_info.process_id !=
|
||||
content::ChildProcessHost::kInvalidUniqueID);
|
||||
associated_registry.AddInterface<extensions::mojom::RendererHost>(
|
||||
base::BindRepeating(&extensions::RendererStartupHelper::BindForRenderer,
|
||||
service_worker_version_info.process_id));
|
||||
associated_registry.AddInterface<extensions::mojom::ServiceWorkerHost>(
|
||||
base::BindRepeating(&extensions::ServiceWorkerHost::BindReceiver,
|
||||
service_worker_version_info.process_id));
|
||||
associated_registry
|
||||
.AddInterface<extensions::mojom::RendererAutomationRegistry>(
|
||||
base::BindRepeating(
|
||||
&extensions::AutomationEventRouter::BindForRenderer,
|
||||
service_worker_version_info.process_id));
|
||||
associated_registry.AddInterface<extensions::mojom::EventRouter>(
|
||||
base::BindRepeating(&extensions::EventRouter::BindForRenderer,
|
||||
service_worker_version_info.process_id));
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::
|
||||
RegisterAssociatedInterfaceBindersForRenderFrameHost(
|
||||
content::RenderFrameHost& render_frame_host,
|
||||
@@ -914,10 +844,10 @@ void AlloyContentBrowserClient::
|
||||
},
|
||||
&render_frame_host));
|
||||
|
||||
associated_registry.AddInterface<pdf::mojom::PdfHost>(base::BindRepeating(
|
||||
associated_registry.AddInterface<pdf::mojom::PdfService>(base::BindRepeating(
|
||||
[](content::RenderFrameHost* render_frame_host,
|
||||
mojo::PendingAssociatedReceiver<pdf::mojom::PdfHost> receiver) {
|
||||
pdf::PDFDocumentHelper::BindPdfHost(
|
||||
mojo::PendingAssociatedReceiver<pdf::mojom::PdfService> receiver) {
|
||||
pdf::PDFDocumentHelper::BindPdfService(
|
||||
std::move(receiver), render_frame_host,
|
||||
std::make_unique<ChromePDFDocumentHelperClient>());
|
||||
},
|
||||
@@ -928,31 +858,13 @@ void AlloyContentBrowserClient::
|
||||
render_frame_host.GetProcess()->GetID()));
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
// From ChromeContentBrowserClientExtensionsPart::
|
||||
// ExposeInterfacesToRendererForRenderFrameHost
|
||||
int render_process_id = render_frame_host.GetProcess()->GetID();
|
||||
associated_registry.AddInterface<extensions::mojom::RendererHost>(
|
||||
base::BindRepeating(&extensions::RendererStartupHelper::BindForRenderer,
|
||||
render_process_id));
|
||||
associated_registry
|
||||
.AddInterface<extensions::mojom::RendererAutomationRegistry>(
|
||||
base::BindRepeating(
|
||||
&extensions::AutomationEventRouter::BindForRenderer,
|
||||
render_process_id));
|
||||
associated_registry.AddInterface<extensions::mojom::EventRouter>(
|
||||
base::BindRepeating(&extensions::EventRouter::BindForRenderer,
|
||||
render_process_id));
|
||||
associated_registry.AddInterface<guest_view::mojom::GuestViewHost>(
|
||||
base::BindRepeating(
|
||||
&extensions::ExtensionsGuestView::CreateForComponents,
|
||||
render_frame_host.GetGlobalId()));
|
||||
associated_registry.AddInterface<extensions::mojom::GuestView>(
|
||||
base::BindRepeating(
|
||||
&extensions::ExtensionsGuestView::CreateForExtensions,
|
||||
render_frame_host.GetGlobalId()));
|
||||
|
||||
// From ChromeContentBrowserClient::
|
||||
// RegisterAssociatedInterfaceBindersForRenderFrameHost
|
||||
associated_registry.AddInterface<extensions::mojom::RendererHost>(
|
||||
base::BindRepeating(&extensions::RendererStartupHelper::BindForRenderer,
|
||||
render_process_id));
|
||||
associated_registry.AddInterface<extensions::mojom::LocalFrameHost>(
|
||||
base::BindRepeating(
|
||||
[](content::RenderFrameHost* render_frame_host,
|
||||
@@ -962,6 +874,14 @@ void AlloyContentBrowserClient::
|
||||
std::move(receiver), render_frame_host);
|
||||
},
|
||||
&render_frame_host));
|
||||
associated_registry.AddInterface<guest_view::mojom::GuestViewHost>(
|
||||
base::BindRepeating(
|
||||
&extensions::ExtensionsGuestView::CreateForComponents,
|
||||
render_frame_host.GetGlobalId()));
|
||||
associated_registry.AddInterface<extensions::mojom::GuestView>(
|
||||
base::BindRepeating(
|
||||
&extensions::ExtensionsGuestView::CreateForExtensions,
|
||||
render_frame_host.GetGlobalId()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -977,8 +897,11 @@ AlloyContentBrowserClient::CreateThrottlesForNavigation(
|
||||
throttles.push_back(std::move(pdf_iframe_throttle));
|
||||
}
|
||||
|
||||
throttles.push_back(std::make_unique<pdf::PdfNavigationThrottle>(
|
||||
navigation_handle, std::make_unique<ChromePdfStreamDelegate>()));
|
||||
auto pdf_throttle = pdf::PdfNavigationThrottle::MaybeCreateThrottleFor(
|
||||
navigation_handle, std::make_unique<ChromePdfStreamDelegate>());
|
||||
if (pdf_throttle) {
|
||||
throttles.push_back(std::move(pdf_throttle));
|
||||
}
|
||||
}
|
||||
|
||||
throttle::CreateThrottlesForNavigation(navigation_handle, throttles);
|
||||
@@ -992,8 +915,7 @@ AlloyContentBrowserClient::CreateURLLoaderThrottles(
|
||||
content::BrowserContext* browser_context,
|
||||
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
|
||||
content::NavigationUIData* navigation_ui_data,
|
||||
int frame_tree_node_id,
|
||||
std::optional<int64_t> navigation_id) {
|
||||
int frame_tree_node_id) {
|
||||
std::vector<std::unique_ptr<blink::URLLoaderThrottle>> result;
|
||||
|
||||
// Used to substitute View ID for PDF contents when using the PDF plugin.
|
||||
@@ -1061,6 +983,14 @@ void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
||||
}
|
||||
#endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
|
||||
void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* host) {
|
||||
CefBrowserManager::ExposeInterfacesToRenderer(registry, associated_registry,
|
||||
host);
|
||||
}
|
||||
|
||||
std::unique_ptr<net::ClientCertStore>
|
||||
AlloyContentBrowserClient::CreateClientCertStore(
|
||||
content::BrowserContext* browser_context) {
|
||||
@@ -1082,7 +1012,6 @@ std::unique_ptr<content::LoginDelegate>
|
||||
AlloyContentBrowserClient::CreateLoginDelegate(
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
content::WebContents* web_contents,
|
||||
content::BrowserContext* browser_context,
|
||||
const content::GlobalRequestID& request_id,
|
||||
bool is_request_for_main_frame,
|
||||
const GURL& url,
|
||||
@@ -1094,33 +1023,26 @@ AlloyContentBrowserClient::CreateLoginDelegate(
|
||||
std::move(auth_required_callback));
|
||||
}
|
||||
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>
|
||||
AlloyContentBrowserClient::CreateNonNetworkNavigationURLLoaderFactory(
|
||||
const std::string& scheme,
|
||||
int frame_tree_node_id) {
|
||||
void AlloyContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
|
||||
int frame_tree_node_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) {
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return {};
|
||||
return;
|
||||
}
|
||||
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
|
||||
content::BrowserContext* browser_context = web_contents->GetBrowserContext();
|
||||
|
||||
if (scheme == extensions::kExtensionScheme &&
|
||||
!extensions::ChromeContentBrowserClientExtensionsPart::
|
||||
AreExtensionsDisabledForProfile(browser_context)) {
|
||||
return extensions::CreateExtensionNavigationURLLoaderFactory(
|
||||
browser_context,
|
||||
!!extensions::WebViewGuest::FromWebContents(web_contents));
|
||||
}
|
||||
|
||||
return {};
|
||||
factories->emplace(
|
||||
extensions::kExtensionScheme,
|
||||
extensions::CreateExtensionNavigationURLLoaderFactory(
|
||||
web_contents->GetBrowserContext(),
|
||||
!!extensions::WebViewGuest::FromWebContents(web_contents)));
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
const std::optional<url::Origin>& request_initiator_origin,
|
||||
const absl::optional<url::Origin>& request_initiator_origin,
|
||||
NonNetworkURLLoaderFactoryMap* factories) {
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return;
|
||||
@@ -1174,16 +1096,15 @@ void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
bool AlloyContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
int render_process_id,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
const net::IsolationInfo& isolation_info,
|
||||
std::optional<int64_t> navigation_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
network::URLLoaderFactoryBuilder& factory_builder,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
bool* bypass_redirect_checks,
|
||||
@@ -1196,8 +1117,9 @@ void AlloyContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
type == URLLoaderFactoryType::kDownload, request_initiator);
|
||||
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
browser_context, factory_builder, header_client,
|
||||
browser_context, factory_receiver, header_client,
|
||||
std::move(request_handler));
|
||||
return true;
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::OnNetworkServiceCreated(
|
||||
@@ -1328,22 +1250,10 @@ void AlloyContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
map->Add<network_hints::mojom::NetworkHintsHandler>(
|
||||
base::BindRepeating(&BindNetworkHintsHandler));
|
||||
|
||||
map->Add<spellcheck::mojom::SpellCheckHost>(base::BindRepeating(
|
||||
[](content::RenderFrameHost* frame_host,
|
||||
mojo::PendingReceiver<spellcheck::mojom::SpellCheckHost> receiver) {
|
||||
SpellCheckHostChromeImpl::Create(frame_host->GetProcess()->GetID(),
|
||||
std::move(receiver));
|
||||
}));
|
||||
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
map->Add<extensions::mime_handler::MimeHandlerService>(
|
||||
base::BindRepeating(&BindMimeHandlerService));
|
||||
map->Add<extensions::mime_handler::BeforeUnloadControl>(
|
||||
base::BindRepeating(&BindBeforeUnloadControl));
|
||||
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(render_frame_host);
|
||||
if (!web_contents) {
|
||||
|
@@ -15,7 +15,6 @@
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "build/build_config.h"
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
|
||||
class AlloyBrowserMainParts;
|
||||
@@ -45,10 +44,10 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context,
|
||||
const GURL& effective_site_url) override;
|
||||
bool ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
|
||||
std::string_view scheme,
|
||||
base::StringPiece scheme,
|
||||
bool is_embedded_origin_secure) override;
|
||||
bool ShouldIgnoreSameSiteCookieRestrictionsWhenTopLevel(
|
||||
std::string_view scheme,
|
||||
base::StringPiece scheme,
|
||||
bool is_embedded_origin_secure) override;
|
||||
void OverrideURLLoaderFactoryParams(
|
||||
content::BrowserContext* browser_context,
|
||||
@@ -65,8 +64,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
std::vector<std::string>* additional_allowed_schemes) override;
|
||||
bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) override;
|
||||
bool IsHandledURL(const GURL& url) override;
|
||||
void SiteInstanceGotProcessAndSite(
|
||||
content::SiteInstance* site_instance) override;
|
||||
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
|
||||
void BindHostReceiverForRenderer(
|
||||
content::RenderProcessHost* render_process_host,
|
||||
mojo::GenericPendingReceiver receiver) override;
|
||||
@@ -118,13 +116,6 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
std::string GetDefaultDownloadName() override;
|
||||
std::unique_ptr<content::DevToolsManagerDelegate>
|
||||
CreateDevToolsManagerDelegate() override;
|
||||
void ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* render_process_host) override;
|
||||
void RegisterAssociatedInterfaceBindersForServiceWorker(
|
||||
const content::ServiceWorkerVersionBaseInfo& service_worker_version_info,
|
||||
blink::AssociatedInterfaceRegistry& associated_registry) override;
|
||||
void RegisterAssociatedInterfaceBindersForRenderFrameHost(
|
||||
content::RenderFrameHost& render_frame_host,
|
||||
blink::AssociatedInterfaceRegistry& associated_registry) override;
|
||||
@@ -137,8 +128,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
content::BrowserContext* browser_context,
|
||||
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
|
||||
content::NavigationUIData* navigation_ui_data,
|
||||
int frame_tree_node_id,
|
||||
std::optional<int64_t> navigation_id) override;
|
||||
int frame_tree_node_id) override;
|
||||
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
|
||||
CreateURLLoaderThrottlesForKeepAlive(
|
||||
const network::ResourceRequest& request,
|
||||
@@ -160,36 +150,38 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
content::PosixFileDescriptorInfo* mappings) override;
|
||||
#endif
|
||||
|
||||
void ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* render_process_host) override;
|
||||
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
|
||||
content::BrowserContext* browser_context) override;
|
||||
std::unique_ptr<content::LoginDelegate> CreateLoginDelegate(
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
content::WebContents* web_contents,
|
||||
content::BrowserContext* browser_context,
|
||||
const content::GlobalRequestID& request_id,
|
||||
bool is_request_for_main_frame,
|
||||
const GURL& url,
|
||||
scoped_refptr<net::HttpResponseHeaders> response_headers,
|
||||
bool first_auth_attempt,
|
||||
LoginAuthRequiredCallback auth_required_callback) override;
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>
|
||||
CreateNonNetworkNavigationURLLoaderFactory(const std::string& scheme,
|
||||
int frame_tree_node_id) override;
|
||||
void RegisterNonNetworkNavigationURLLoaderFactories(
|
||||
int frame_tree_node_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) override;
|
||||
void RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
const std::optional<url::Origin>& request_initiator_origin,
|
||||
const absl::optional<url::Origin>& request_initiator_origin,
|
||||
NonNetworkURLLoaderFactoryMap* factories) override;
|
||||
void WillCreateURLLoaderFactory(
|
||||
bool WillCreateURLLoaderFactory(
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
int render_process_id,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
const net::IsolationInfo& isolation_info,
|
||||
std::optional<int64_t> navigation_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
network::URLLoaderFactoryBuilder& factory_builder,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
bool* bypass_redirect_checks,
|
||||
|
@@ -1,22 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/alloy/alloy_download_manager_delegate.h"
|
||||
|
||||
#include "chrome/common/chrome_constants.h"
|
||||
#include "components/download/public/common/download_item.h"
|
||||
|
||||
AlloyDownloadManagerDelegate::AlloyDownloadManagerDelegate(
|
||||
content::DownloadManager* manager)
|
||||
: CefDownloadManagerDelegateImpl(manager, /*alloy_bootstrap=*/true) {}
|
||||
|
||||
void AlloyDownloadManagerDelegate::GetNextId(
|
||||
content::DownloadIdCallback callback) {
|
||||
static uint32_t next_id = download::DownloadItem::kInvalidId + 1;
|
||||
std::move(callback).Run(next_id++);
|
||||
}
|
||||
|
||||
std::string AlloyDownloadManagerDelegate::ApplicationClientIdForFileScanning() {
|
||||
return std::string(chrome::kApplicationClientIDStringForAVScanning);
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DOWNLOAD_MANAGER_DELEGATE_H_
|
||||
#define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DOWNLOAD_MANAGER_DELEGATE_H_
|
||||
#pragma once
|
||||
|
||||
#include "libcef/browser/download_manager_delegate_impl.h"
|
||||
|
||||
// Specialization for the Alloy bootstrap.
|
||||
class AlloyDownloadManagerDelegate : public CefDownloadManagerDelegateImpl {
|
||||
public:
|
||||
explicit AlloyDownloadManagerDelegate(content::DownloadManager* manager);
|
||||
|
||||
AlloyDownloadManagerDelegate(const AlloyDownloadManagerDelegate&) = delete;
|
||||
AlloyDownloadManagerDelegate& operator=(const AlloyDownloadManagerDelegate&) =
|
||||
delete;
|
||||
|
||||
private:
|
||||
// DownloadManagerDelegate methods.
|
||||
void GetNextId(content::DownloadIdCallback callback) override;
|
||||
std::string ApplicationClientIdForFileScanning() override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DOWNLOAD_MANAGER_DELEGATE_H_
|
@@ -10,8 +10,6 @@ namespace alloy {
|
||||
|
||||
DownloadPrefs* GetDownloadPrefsFromBrowserContext(
|
||||
content::BrowserContext* context) {
|
||||
// This function is only called with Alloy bootstrap, so the static_cast is
|
||||
// safe.
|
||||
return static_cast<AlloyBrowserContext*>(context)->GetDownloadPrefs();
|
||||
}
|
||||
|
||||
|
@@ -4,8 +4,6 @@
|
||||
|
||||
#include "libcef/browser/alloy/browser_platform_delegate_alloy.h"
|
||||
|
||||
#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"
|
||||
@@ -18,14 +16,11 @@
|
||||
#include "libcef/features/runtime_checks.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "chrome/browser/printing/printing_init.h"
|
||||
#include "chrome/browser/task_manager/web_contents_tags.h"
|
||||
#include "chrome/browser/printing/print_view_manager.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"
|
||||
@@ -34,18 +29,13 @@
|
||||
#include "pdf/pdf_features.h"
|
||||
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const char kAttachedHelpersUserDataKey[] = "CefAttachedHelpers";
|
||||
|
||||
} // namespace
|
||||
|
||||
CefBrowserPlatformDelegateAlloy::CefBrowserPlatformDelegateAlloy()
|
||||
: weak_ptr_factory_(this) {}
|
||||
|
||||
content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
|
||||
CefBrowserCreateParams& create_params,
|
||||
bool& own_web_contents) {
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
DCHECK(primary_);
|
||||
|
||||
if (!create_params.request_context) {
|
||||
@@ -76,10 +66,10 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
|
||||
|
||||
// Extension resources will fail to load if we don't use a SiteInstance
|
||||
// associated with the extension.
|
||||
// (AlloyContentBrowserClient::SiteInstanceGotProcessAndSite won't find
|
||||
// the extension to register with InfoMap, and AllowExtensionResourceLoad
|
||||
// in ExtensionProtocolHandler::MaybeCreateJob will return false resulting
|
||||
// in ERR_BLOCKED_BY_CLIENT).
|
||||
// (AlloyContentBrowserClient::SiteInstanceGotProcess won't find the
|
||||
// extension to register with InfoMap, and AllowExtensionResourceLoad in
|
||||
// ExtensionProtocolHandler::MaybeCreateJob will return false resulting in
|
||||
// ERR_BLOCKED_BY_CLIENT).
|
||||
site_instance = extensions::ProcessManager::Get(browser_context)
|
||||
->GetSiteInstanceForURL(gurl);
|
||||
DCHECK(site_instance);
|
||||
@@ -108,7 +98,7 @@ void CefBrowserPlatformDelegateAlloy::WebContentsCreated(
|
||||
CefBrowserPlatformDelegate::WebContentsCreated(web_contents, owned);
|
||||
|
||||
if (primary_) {
|
||||
AttachHelpers(web_contents);
|
||||
find_in_page::FindTabHelper::CreateForWebContents(web_contents);
|
||||
|
||||
if (owned) {
|
||||
SetOwnedWebContents(web_contents);
|
||||
@@ -126,6 +116,7 @@ void CefBrowserPlatformDelegateAlloy::AddNewContents(
|
||||
const blink::mojom::WindowFeatures& window_features,
|
||||
bool user_gesture,
|
||||
bool* was_blocked) {
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
DCHECK(primary_);
|
||||
|
||||
CefRefPtr<AlloyBrowserHostImpl> owner =
|
||||
@@ -169,14 +160,20 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
|
||||
}
|
||||
|
||||
DCHECK(!web_contents_->GetDelegate());
|
||||
web_contents_->SetDelegate(
|
||||
AlloyBrowserHostImpl::FromBaseChecked(browser).get());
|
||||
web_contents_->SetDelegate(static_cast<AlloyBrowserHostImpl*>(browser));
|
||||
|
||||
AttachHelpers(web_contents_);
|
||||
permissions::PermissionRequestManager::CreateForWebContents(web_contents_);
|
||||
PrefsTabHelper::CreateForWebContents(web_contents_);
|
||||
printing::PrintViewManager::CreateForWebContents(web_contents_);
|
||||
zoom::ZoomController::CreateForWebContents(web_contents_);
|
||||
|
||||
javascript_dialogs::TabModalDialogManager::CreateForWebContents(
|
||||
web_contents_,
|
||||
CreateAlloyJavaScriptTabModalDialogManagerDelegateDesktop(web_contents_));
|
||||
|
||||
// Used for print preview and JavaScript dialogs.
|
||||
web_contents_dialog_helper_ =
|
||||
std::make_unique<AlloyWebContentsDialogHelper>(web_contents_, this);
|
||||
web_contents_dialog_helper_.reset(
|
||||
new AlloyWebContentsDialogHelper(web_contents_, this));
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
||||
@@ -191,12 +188,12 @@ void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
||||
DCHECK(browser_);
|
||||
DCHECK(!extension_host_);
|
||||
|
||||
auto alloy_browser = AlloyBrowserHostImpl::FromBaseChecked(browser_);
|
||||
auto alloy_browser = static_cast<AlloyBrowserHostImpl*>(browser_);
|
||||
|
||||
if (host_type == extensions::mojom::ViewType::kExtensionPopup) {
|
||||
// Create an extension host that we own.
|
||||
extension_host_ = new extensions::CefExtensionViewHost(
|
||||
alloy_browser.get(), extension, web_contents_, url, host_type);
|
||||
alloy_browser, extension, web_contents_, url, host_type);
|
||||
// Trigger load of the extension URL.
|
||||
extension_host_->CreateRendererSoon();
|
||||
} else if (host_type ==
|
||||
@@ -205,7 +202,7 @@ void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
||||
alloy_browser->is_background_host_ = true;
|
||||
// Create an extension host that will be owned by ProcessManager.
|
||||
extension_host_ = new extensions::CefExtensionBackgroundHost(
|
||||
alloy_browser.get(),
|
||||
alloy_browser,
|
||||
base::BindOnce(&CefBrowserPlatformDelegateAlloy::OnExtensionHostDeleted,
|
||||
weak_ptr_factory_.GetWeakPtr()),
|
||||
extension, web_contents_, url, host_type);
|
||||
@@ -313,6 +310,19 @@ void CefBrowserPlatformDelegateAlloy::ConfigureAutoResize() {
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateAlloy::IsPrintPreviewSupported() const {
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
|
||||
// Print preview is not currently supported with OSR.
|
||||
if (IsWindowless()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto cef_browser_context =
|
||||
CefBrowserContext::FromBrowserContext(web_contents_->GetBrowserContext());
|
||||
return cef_browser_context->IsPrintPreviewSupported();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::Find(const CefString& searchText,
|
||||
bool forward,
|
||||
bool matchCase,
|
||||
@@ -402,47 +412,3 @@ void CefBrowserPlatformDelegateAlloy::OnExtensionHostDeleted() {
|
||||
DCHECK(extension_host_);
|
||||
extension_host_ = nullptr;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::AttachHelpers(
|
||||
content::WebContents* web_contents) {
|
||||
// If already attached, nothing to be done.
|
||||
base::SupportsUserData::Data* attached_tag =
|
||||
web_contents->GetUserData(&kAttachedHelpersUserDataKey);
|
||||
if (attached_tag) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Mark as attached.
|
||||
web_contents->SetUserData(&kAttachedHelpersUserDataKey,
|
||||
std::make_unique<base::SupportsUserData::Data>());
|
||||
|
||||
// Create all the helpers.
|
||||
if (cef::IsAlloyRuntimeEnabled()) {
|
||||
find_in_page::FindTabHelper::CreateForWebContents(web_contents);
|
||||
permissions::PermissionRequestManager::CreateForWebContents(web_contents);
|
||||
PrefsTabHelper::CreateForWebContents(web_contents);
|
||||
printing::InitializePrintingForWebContents(web_contents);
|
||||
zoom::ZoomController::CreateForWebContents(web_contents);
|
||||
|
||||
javascript_dialogs::TabModalDialogManager::CreateForWebContents(
|
||||
web_contents, CreateAlloyJavaScriptTabModalDialogManagerDelegateDesktop(
|
||||
web_contents));
|
||||
} else {
|
||||
if (IsWindowless()) {
|
||||
// Logic from ChromeContentBrowserClientCef::GetWebContentsViewDelegate
|
||||
// which is not called for windowless browsers. Needs to be done before
|
||||
// calling AttachTabHelpers.
|
||||
if (auto* registry =
|
||||
performance_manager::PerformanceManagerRegistry::GetInstance()) {
|
||||
registry->MaybeCreatePageNodeForWebContents(web_contents);
|
||||
}
|
||||
}
|
||||
|
||||
// Adopt the WebContents now, so all observers are in place, as the network
|
||||
// requests for its initial navigation will start immediately
|
||||
TabHelpers::AttachTabHelpers(web_contents);
|
||||
|
||||
// Make the tab show up in the task manager.
|
||||
task_manager::WebContentsTags::CreateForTabContents(web_contents);
|
||||
}
|
||||
}
|
||||
|
@@ -51,10 +51,10 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
||||
bool PreHandleGestureEvent(content::WebContents* source,
|
||||
const blink::WebGestureEvent& event) override;
|
||||
bool IsNeverComposited(content::WebContents* web_contents) override;
|
||||
bool IsAlloyStyle() const override { return true; }
|
||||
void SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) override;
|
||||
bool IsPrintPreviewSupported() const override;
|
||||
void Find(const CefString& searchText,
|
||||
bool forward,
|
||||
bool matchCase,
|
||||
@@ -88,10 +88,6 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
|
||||
|
||||
void ConfigureAutoResize();
|
||||
|
||||
// Attach all the associated helpers that are needed for the WebContents. It
|
||||
// is safe to call this on a WebContents that was already attached.
|
||||
void AttachHelpers(content::WebContents* web_contents);
|
||||
|
||||
// Non-nullptr if this object owns the WebContents. Will be nullptr for popup
|
||||
// browsers between the calls to WebContentsCreated() and AddNewContents(),
|
||||
// and may never be set if the parent browser is destroyed during popup
|
||||
|
@@ -5,8 +5,6 @@
|
||||
|
||||
#include "libcef/browser/alloy/chrome_browser_process_alloy.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "libcef/browser/alloy/chrome_profile_manager_alloy.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/context.h"
|
||||
@@ -19,7 +17,6 @@
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/path_service.h"
|
||||
#include "chrome/browser/browser_features.h"
|
||||
#include "chrome/browser/component_updater/chrome_component_updater_configurator.h"
|
||||
#include "chrome/browser/net/system_network_context_manager.h"
|
||||
#include "chrome/browser/permissions/chrome_permissions_client.h"
|
||||
@@ -32,7 +29,6 @@
|
||||
#include "components/component_updater/component_updater_service.h"
|
||||
#include "components/component_updater/timer_update_scheduler.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
#include "components/os_crypt/async/browser/os_crypt_async.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "content/browser/startup_helper.h"
|
||||
#include "content/public/browser/network_service_instance.h"
|
||||
@@ -41,11 +37,11 @@
|
||||
#include "services/network/public/cpp/network_switches.h"
|
||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "components/os_crypt/async/browser/dpapi_key_provider.h"
|
||||
#endif
|
||||
|
||||
ChromeBrowserProcessAlloy::ChromeBrowserProcessAlloy() : locale_("en-US") {}
|
||||
ChromeBrowserProcessAlloy::ChromeBrowserProcessAlloy()
|
||||
: initialized_(false),
|
||||
context_initialized_(false),
|
||||
shutdown_(false),
|
||||
locale_("en-US") {}
|
||||
|
||||
ChromeBrowserProcessAlloy::~ChromeBrowserProcessAlloy() {
|
||||
DCHECK((!initialized_ && !context_initialized_) || shutdown_);
|
||||
@@ -68,10 +64,10 @@ void ChromeBrowserProcessAlloy::Initialize() {
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
// Initialize extension global objects before creating the global
|
||||
// BrowserContext.
|
||||
extensions_client_ = std::make_unique<extensions::CefExtensionsClient>();
|
||||
extensions_client_.reset(new extensions::CefExtensionsClient());
|
||||
extensions::ExtensionsClient::Set(extensions_client_.get());
|
||||
extensions_browser_client_ =
|
||||
std::make_unique<extensions::CefExtensionsBrowserClient>();
|
||||
extensions_browser_client_.reset(
|
||||
new extensions::CefExtensionsBrowserClient);
|
||||
extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
|
||||
}
|
||||
|
||||
@@ -87,33 +83,9 @@ void ChromeBrowserProcessAlloy::OnContextInitialized() {
|
||||
DCHECK(!context_initialized_);
|
||||
DCHECK(!shutdown_);
|
||||
|
||||
// OSCryptAsync provider configuration. If empty, this delegates all
|
||||
// encryption operations to OSCrypt.
|
||||
std::vector<std::pair<size_t, std::unique_ptr<os_crypt_async::KeyProvider>>>
|
||||
providers;
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// TODO(crbug.com/1373092): For Windows, continue to add providers behind
|
||||
// features, as support for them is added.
|
||||
if (base::FeatureList::IsEnabled(features::kEnableDPAPIEncryptionProvider)) {
|
||||
// The DPAPI key provider requires OSCrypt::Init to have already been called
|
||||
// to initialize the key storage. This happens in
|
||||
// AlloyBrowserMainParts::PreCreateMainMessageLoop.
|
||||
providers.emplace_back(std::make_pair(
|
||||
/*precedence=*/10u,
|
||||
std::make_unique<os_crypt_async::DPAPIKeyProvider>(local_state())));
|
||||
}
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
os_crypt_async_ =
|
||||
std::make_unique<os_crypt_async::OSCryptAsync>(std::move(providers));
|
||||
|
||||
// Trigger async initialization of OSCrypt key providers.
|
||||
std::ignore = os_crypt_async_->GetInstance(base::DoNothing());
|
||||
|
||||
// Must be created after the NotificationService.
|
||||
print_job_manager_ = std::make_unique<printing::PrintJobManager>();
|
||||
profile_manager_ = std::make_unique<ChromeProfileManagerAlloy>();
|
||||
print_job_manager_.reset(new printing::PrintJobManager());
|
||||
profile_manager_.reset(new ChromeProfileManagerAlloy());
|
||||
event_router_forwarder_ = new extensions::EventRouterForwarder();
|
||||
context_initialized_ = true;
|
||||
}
|
||||
@@ -300,9 +272,9 @@ printing::PrintJobManager* ChromeBrowserProcessAlloy::print_job_manager() {
|
||||
|
||||
printing::PrintPreviewDialogController*
|
||||
ChromeBrowserProcessAlloy::print_preview_dialog_controller() {
|
||||
if (!print_preview_dialog_controller_) {
|
||||
if (!print_preview_dialog_controller_.get()) {
|
||||
print_preview_dialog_controller_ =
|
||||
std::make_unique<printing::PrintPreviewDialogController>();
|
||||
new printing::PrintPreviewDialogController();
|
||||
}
|
||||
return print_preview_dialog_controller_.get();
|
||||
}
|
||||
@@ -310,8 +282,8 @@ ChromeBrowserProcessAlloy::print_preview_dialog_controller() {
|
||||
printing::BackgroundPrintingManager*
|
||||
ChromeBrowserProcessAlloy::background_printing_manager() {
|
||||
if (!background_printing_manager_.get()) {
|
||||
background_printing_manager_ =
|
||||
std::make_unique<printing::BackgroundPrintingManager>();
|
||||
background_printing_manager_.reset(
|
||||
new printing::BackgroundPrintingManager());
|
||||
}
|
||||
return background_printing_manager_.get();
|
||||
}
|
||||
@@ -370,12 +342,6 @@ ChromeBrowserProcessAlloy::subresource_filter_ruleset_service() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
subresource_filter::RulesetService*
|
||||
ChromeBrowserProcessAlloy::fingerprinting_protection_ruleset_service() {
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
StartupData* ChromeBrowserProcessAlloy::startup_data() {
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
@@ -441,8 +407,8 @@ ChromeBrowserProcessAlloy::resource_coordinator_parts() {
|
||||
}
|
||||
|
||||
os_crypt_async::OSCryptAsync* ChromeBrowserProcessAlloy::os_crypt_async() {
|
||||
DCHECK(os_crypt_async_);
|
||||
return os_crypt_async_.get();
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BuildState* ChromeBrowserProcessAlloy::GetBuildState() {
|
||||
|
@@ -92,8 +92,6 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
|
||||
safe_browsing::SafeBrowsingService* safe_browsing_service() override;
|
||||
subresource_filter::RulesetService* subresource_filter_ruleset_service()
|
||||
override;
|
||||
subresource_filter::RulesetService*
|
||||
fingerprinting_protection_ruleset_service() override;
|
||||
StartupData* startup_data() override;
|
||||
|
||||
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
|
||||
@@ -115,9 +113,9 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
|
||||
UsbSystemTrayIcon* usb_system_tray_icon() override;
|
||||
|
||||
private:
|
||||
bool initialized_ = false;
|
||||
bool context_initialized_ = false;
|
||||
bool shutdown_ = false;
|
||||
bool initialized_;
|
||||
bool context_initialized_;
|
||||
bool shutdown_;
|
||||
|
||||
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
|
||||
std::unique_ptr<extensions::ExtensionsBrowserClient>
|
||||
@@ -127,7 +125,7 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
|
||||
std::unique_ptr<printing::PrintJobManager> print_job_manager_;
|
||||
std::unique_ptr<ChromeProfileManagerAlloy> profile_manager_;
|
||||
scoped_refptr<extensions::EventRouterForwarder> event_router_forwarder_;
|
||||
std::unique_ptr<printing::PrintPreviewDialogController>
|
||||
scoped_refptr<printing::PrintPreviewDialogController>
|
||||
print_preview_dialog_controller_;
|
||||
std::unique_ptr<printing::BackgroundPrintingManager>
|
||||
background_printing_manager_;
|
||||
@@ -139,8 +137,6 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
|
||||
std::unique_ptr<base::FieldTrialList> field_trial_list_;
|
||||
|
||||
std::unique_ptr<component_updater::ComponentUpdateService> component_updater_;
|
||||
|
||||
std::unique_ptr<os_crypt_async::OSCryptAsync> os_crypt_async_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_ALLOY_CHROME_BROWSER_PROCESS_ALLOY_H_
|
||||
|
@@ -41,7 +41,7 @@ ChromeProfileAlloy::ChromeProfileAlloy() {
|
||||
this, profile_metrics::BrowserProfileType::kRegular);
|
||||
}
|
||||
|
||||
ChromeProfileAlloy::~ChromeProfileAlloy() = default;
|
||||
ChromeProfileAlloy::~ChromeProfileAlloy() {}
|
||||
|
||||
bool ChromeProfileAlloy::IsOffTheRecord() {
|
||||
return false;
|
||||
|
@@ -32,7 +32,7 @@ CefBrowserContext* GetActiveBrowserContext() {
|
||||
ChromeProfileManagerAlloy::ChromeProfileManagerAlloy()
|
||||
: ProfileManager(base::FilePath()) {}
|
||||
|
||||
ChromeProfileManagerAlloy::~ChromeProfileManagerAlloy() = default;
|
||||
ChromeProfileManagerAlloy::~ChromeProfileManagerAlloy() {}
|
||||
|
||||
Profile* ChromeProfileManagerAlloy::GetProfile(
|
||||
const base::FilePath& profile_dir) {
|
||||
|
@@ -1,46 +0,0 @@
|
||||
// Copyright 2024 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/alloy/devtools/alloy_devtools_window_runner.h"
|
||||
|
||||
#include "libcef/browser/alloy/devtools/devtools_frontend.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
void AlloyDevToolsWindowRunner::ShowDevTools(
|
||||
CefBrowserHostBase* opener,
|
||||
std::unique_ptr<CefShowDevToolsParams> params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (devtools_frontend_) {
|
||||
if (!params->inspect_element_at_.IsEmpty()) {
|
||||
devtools_frontend_->InspectElementAt(params->inspect_element_at_.x,
|
||||
params->inspect_element_at_.y);
|
||||
}
|
||||
devtools_frontend_->Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
auto alloy_browser = AlloyBrowserHostImpl::FromBaseChecked(opener);
|
||||
devtools_frontend_ = CefDevToolsFrontend::Show(
|
||||
alloy_browser.get(), params->window_info_, params->client_,
|
||||
params->settings_, params->inspect_element_at_,
|
||||
base::BindOnce(&AlloyDevToolsWindowRunner::OnFrontEndDestroyed,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
void AlloyDevToolsWindowRunner::CloseDevTools() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (devtools_frontend_) {
|
||||
devtools_frontend_->Close();
|
||||
}
|
||||
}
|
||||
|
||||
bool AlloyDevToolsWindowRunner::HasDevTools() {
|
||||
CEF_REQUIRE_UIT();
|
||||
return !!devtools_frontend_;
|
||||
}
|
||||
|
||||
void AlloyDevToolsWindowRunner::OnFrontEndDestroyed() {
|
||||
CEF_REQUIRE_UIT();
|
||||
devtools_frontend_ = nullptr;
|
||||
}
|
@@ -1,40 +0,0 @@
|
||||
// Copyright 2024 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_ALLOY_DEVTOOLS_WINDOW_RUNNER_H_
|
||||
#define CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_ALLOY_DEVTOOLS_WINDOW_RUNNER_H_
|
||||
#pragma once
|
||||
|
||||
#include "libcef/browser/devtools/devtools_window_runner.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
|
||||
class CefDevToolsFrontend;
|
||||
|
||||
// Creates and runs a DevTools window instance. Only accessed on the UI thread.
|
||||
class AlloyDevToolsWindowRunner : public CefDevToolsWindowRunner {
|
||||
public:
|
||||
AlloyDevToolsWindowRunner() = default;
|
||||
|
||||
AlloyDevToolsWindowRunner(const AlloyDevToolsWindowRunner&) = delete;
|
||||
AlloyDevToolsWindowRunner& operator=(const AlloyDevToolsWindowRunner&) =
|
||||
delete;
|
||||
|
||||
// CefDevToolsWindowRunner methods:
|
||||
void ShowDevTools(CefBrowserHostBase* opener,
|
||||
std::unique_ptr<CefShowDevToolsParams> params) override;
|
||||
void CloseDevTools() override;
|
||||
bool HasDevTools() override;
|
||||
|
||||
private:
|
||||
void OnFrontEndDestroyed();
|
||||
|
||||
// CefDevToolsFrontend will delete itself when the frontend WebContents is
|
||||
// destroyed.
|
||||
CefDevToolsFrontend* devtools_frontend_ = nullptr;
|
||||
|
||||
base::WeakPtrFactory<AlloyDevToolsWindowRunner> weak_ptr_factory_{this};
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_ALLOY_DEVTOOLS_ALLOY_DEVTOOLS_WINDOW_RUNNER_H_
|
@@ -15,10 +15,7 @@ namespace {
|
||||
class AlloyConstrainedWindowViewsClient
|
||||
: public constrained_window::ConstrainedWindowViewsClient {
|
||||
public:
|
||||
explicit AlloyConstrainedWindowViewsClient(
|
||||
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
|
||||
chrome_client)
|
||||
: chrome_client_(std::move(chrome_client)) {}
|
||||
AlloyConstrainedWindowViewsClient() = default;
|
||||
|
||||
AlloyConstrainedWindowViewsClient(const AlloyConstrainedWindowViewsClient&) =
|
||||
delete;
|
||||
@@ -29,12 +26,6 @@ class AlloyConstrainedWindowViewsClient
|
||||
// ConstrainedWindowViewsClient methods:
|
||||
web_modal::ModalDialogHost* GetModalDialogHost(
|
||||
gfx::NativeWindow parent) override {
|
||||
if (chrome_client_) {
|
||||
if (auto dialog_host = chrome_client_->GetModalDialogHost(parent)) {
|
||||
return dialog_host;
|
||||
}
|
||||
}
|
||||
|
||||
if (auto browser = GetPreferredBrowser(parent)) {
|
||||
return browser->platform_delegate()->GetWebContentsModalDialogHost();
|
||||
}
|
||||
@@ -43,12 +34,6 @@ class AlloyConstrainedWindowViewsClient
|
||||
}
|
||||
|
||||
gfx::NativeView GetDialogHostView(gfx::NativeWindow parent) override {
|
||||
if (chrome_client_) {
|
||||
if (auto host_view = chrome_client_->GetDialogHostView(parent)) {
|
||||
return host_view;
|
||||
}
|
||||
}
|
||||
|
||||
if (auto dialog_host = GetModalDialogHost(parent)) {
|
||||
return dialog_host->GetHostView();
|
||||
}
|
||||
@@ -81,17 +66,11 @@ class AlloyConstrainedWindowViewsClient
|
||||
|
||||
return browser;
|
||||
}
|
||||
|
||||
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
|
||||
chrome_client_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
|
||||
CreateAlloyConstrainedWindowViewsClient(
|
||||
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
|
||||
chrome_client) {
|
||||
return std::make_unique<AlloyConstrainedWindowViewsClient>(
|
||||
std::move(chrome_client));
|
||||
CreateAlloyConstrainedWindowViewsClient() {
|
||||
return std::make_unique<AlloyConstrainedWindowViewsClient>();
|
||||
}
|
||||
|
@@ -12,8 +12,6 @@
|
||||
|
||||
// Creates a ConstrainedWindowViewsClient for the Chrome environment.
|
||||
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
|
||||
CreateAlloyConstrainedWindowViewsClient(
|
||||
std::unique_ptr<constrained_window::ConstrainedWindowViewsClient>
|
||||
chrome_client);
|
||||
CreateAlloyConstrainedWindowViewsClient();
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_ALLOY_DIALOGS_ALLOY_CONSTRAINED_WINDOW_VIEWS_CLIENT_H_
|
@@ -44,20 +44,14 @@ AlloyWebContentsDialogHelper::GetWebContentsModalDialogHost() {
|
||||
|
||||
gfx::NativeView AlloyWebContentsDialogHelper::GetHostView() const {
|
||||
// Windowless rendering uses GetAcceleratedWidget() instead.
|
||||
if (!browser_delegate_->IsWindowless()) {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
// This is supported with all configurations except MacOS with external
|
||||
// parent because we can't provide a gfx::NativeView or a
|
||||
// gfx::AcceleratedWidget on that platform (it's an arbitrary internal
|
||||
// Chromium type). This code should not be reached in that case because
|
||||
// print preview is disabled.
|
||||
DCHECK(!browser_delegate_->HasExternalParent());
|
||||
#endif
|
||||
if (auto widget = browser_delegate_->GetWindowWidget()) {
|
||||
return widget->GetNativeView();
|
||||
}
|
||||
if (browser_delegate_->IsWindowless()) {
|
||||
return gfx::NativeView();
|
||||
}
|
||||
NOTIMPLEMENTED();
|
||||
|
||||
if (auto widget = browser_delegate_->GetWindowWidget()) {
|
||||
return widget->GetNativeView();
|
||||
}
|
||||
DCHECK(false);
|
||||
return gfx::NativeView();
|
||||
}
|
||||
|
||||
@@ -65,13 +59,15 @@ gfx::AcceleratedWidget AlloyWebContentsDialogHelper::GetAcceleratedWidget()
|
||||
const {
|
||||
#if defined(USE_AURA)
|
||||
// Windowed rendering uses GetHostView() instead.
|
||||
if (browser_delegate_->IsWindowless()) {
|
||||
if (auto parent_widget = browser_delegate_->GetHostWindowHandle()) {
|
||||
return parent_widget;
|
||||
}
|
||||
if (!browser_delegate_->IsWindowless()) {
|
||||
return gfx::kNullAcceleratedWidget;
|
||||
}
|
||||
|
||||
if (auto parent_widget = browser_delegate_->GetHostWindowHandle()) {
|
||||
return parent_widget;
|
||||
}
|
||||
#endif // defined(USE_AURA)
|
||||
NOTIMPLEMENTED();
|
||||
DCHECK(false);
|
||||
return gfx::kNullAcceleratedWidget;
|
||||
}
|
||||
|
||||
|
@@ -98,7 +98,6 @@ void CefAudioCapturer::OnCaptureStarted() {
|
||||
|
||||
void CefAudioCapturer::Capture(const media::AudioBus* source,
|
||||
base::TimeTicks audio_capture_time,
|
||||
const media::AudioGlitchInfo& /*glitch_info*/,
|
||||
double /*volume*/,
|
||||
bool /*key_pressed*/) {
|
||||
const int channels = source->channels();
|
||||
@@ -117,10 +116,7 @@ void CefAudioCapturer::OnCaptureError(
|
||||
media::AudioCapturerSource::ErrorCode code,
|
||||
const std::string& message) {
|
||||
audio_handler_->OnAudioStreamError(browser_, message);
|
||||
|
||||
if (code != media::AudioCapturerSource::ErrorCode::kSocketError) {
|
||||
StopStream();
|
||||
}
|
||||
StopStream();
|
||||
}
|
||||
|
||||
void CefAudioCapturer::StopStream() {
|
||||
|
@@ -31,7 +31,6 @@ class CefAudioCapturer : public media::AudioCapturerSource::CaptureCallback {
|
||||
void OnCaptureStarted() override;
|
||||
void Capture(const media::AudioBus* audio_source,
|
||||
base::TimeTicks audio_capture_time,
|
||||
const media::AudioGlitchInfo& glitch_info,
|
||||
double volume,
|
||||
bool key_pressed) override;
|
||||
void OnCaptureError(media::AudioCapturerSource::ErrorCode code,
|
||||
|
@@ -39,7 +39,7 @@ class StreamCreatedCallbackAdapter final
|
||||
StreamCreatedCallbackAdapter& operator=(const StreamCreatedCallbackAdapter&) =
|
||||
delete;
|
||||
|
||||
~StreamCreatedCallbackAdapter() override = default;
|
||||
~StreamCreatedCallbackAdapter() override {}
|
||||
|
||||
// blink::mojom::RendererAudioInputStreamFactoryClient implementation.
|
||||
void StreamCreated(
|
||||
@@ -48,7 +48,7 @@ class StreamCreatedCallbackAdapter final
|
||||
client_receiver,
|
||||
media::mojom::ReadOnlyAudioDataPipePtr data_pipe,
|
||||
bool initially_muted,
|
||||
const std::optional<base::UnguessableToken>& stream_id) override {
|
||||
const absl::optional<base::UnguessableToken>& stream_id) override {
|
||||
DCHECK(!initially_muted); // Loopback streams shouldn't be started muted.
|
||||
callback_.Run(std::move(stream), std::move(client_receiver),
|
||||
std::move(data_pipe));
|
||||
|
@@ -10,8 +10,6 @@
|
||||
#include "libcef/browser/native/cursor_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
|
||||
#include "chrome/browser/ui/views/sad_tab_view.h"
|
||||
#include "chrome/common/chrome_result_codes.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/public/browser/focused_node_details.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
@@ -25,13 +23,8 @@
|
||||
#include "services/network/public/mojom/url_response_head.mojom.h"
|
||||
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
|
||||
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
|
||||
#include "third_party/blink/public/mojom/page/draggable_region.mojom.h"
|
||||
#include "third_party/blink/public/mojom/widget/platform_widget.mojom-test-utils.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "sandbox/win/src/sandbox_types.h"
|
||||
#endif
|
||||
|
||||
using content::KeyboardEventProcessingResult;
|
||||
|
||||
namespace {
|
||||
@@ -94,7 +87,8 @@ void CefBrowserContentsDelegate::ObserveWebContents(
|
||||
// Make sure MaybeCreateFrame is called at least one time.
|
||||
// Create the frame representation before OnAfterCreated is called for a new
|
||||
// browser.
|
||||
browser_info_->MaybeCreateFrame(new_contents->GetPrimaryMainFrame());
|
||||
browser_info_->MaybeCreateFrame(new_contents->GetPrimaryMainFrame(),
|
||||
false /* is_guest_view */);
|
||||
|
||||
// Make sure RenderWidgetCreated is called at least one time. This Observer
|
||||
// is registered too late to catch the initial creation.
|
||||
@@ -112,19 +106,15 @@ void CefBrowserContentsDelegate::RemoveObserver(Observer* observer) {
|
||||
|
||||
// |source| may be NULL for navigations in the current tab, or if the
|
||||
// navigation originates from a guest view via MaybeAllowNavigation.
|
||||
content::WebContents* CefBrowserContentsDelegate::OpenURLFromTabEx(
|
||||
content::WebContents* CefBrowserContentsDelegate::OpenURLFromTab(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params,
|
||||
base::OnceCallback<void(content::NavigationHandle&)>&
|
||||
navigation_handle_callback) {
|
||||
const content::OpenURLParams& params) {
|
||||
bool cancel = false;
|
||||
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetRequestHandler()) {
|
||||
// May return nullptr for omnibox navigations.
|
||||
auto frame = browser_info_->browser()->GetFrameForHost(
|
||||
content::RenderFrameHost::FromID(params.source_render_process_id,
|
||||
params.source_render_frame_id));
|
||||
auto frame = browser()->GetFrame(params.frame_tree_node_id);
|
||||
if (!frame) {
|
||||
frame = browser()->GetMainFrame();
|
||||
}
|
||||
@@ -135,13 +125,8 @@ content::WebContents* CefBrowserContentsDelegate::OpenURLFromTabEx(
|
||||
}
|
||||
}
|
||||
|
||||
if (!cancel) {
|
||||
// TODO: Do something with |navigation_handle_callback|.
|
||||
return web_contents();
|
||||
}
|
||||
|
||||
// Returning nullptr will cancel the navigation.
|
||||
return nullptr;
|
||||
return cancel ? nullptr : web_contents();
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::LoadingStateChanged(
|
||||
@@ -235,9 +220,11 @@ void CefBrowserContentsDelegate::CanDownload(
|
||||
base::OnceCallback<void(bool)> callback) {
|
||||
bool allow = true;
|
||||
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetDownloadHandler()) {
|
||||
allow = handler->CanDownload(browser(), url.spec(), request_method);
|
||||
if (auto delegate = platform_delegate()) {
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetDownloadHandler()) {
|
||||
allow = handler->CanDownload(browser(), url.spec(), request_method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,26 +286,9 @@ bool CefBrowserContentsDelegate::HandleKeyboardEvent(
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::DraggableRegionsChanged(
|
||||
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
|
||||
content::WebContents* contents) {
|
||||
// Already converted to window bounds in WebViewImpl::DraggableRegionsChanged.
|
||||
std::vector<cef::mojom::DraggableRegionEntryPtr> cef_regions;
|
||||
if (!regions.empty()) {
|
||||
cef_regions.reserve(regions.size());
|
||||
for (const auto& region : regions) {
|
||||
auto cef_region = cef::mojom::DraggableRegionEntry::New(
|
||||
region->bounds, region->draggable);
|
||||
cef_regions.emplace_back(std::move(cef_region));
|
||||
}
|
||||
}
|
||||
|
||||
browser_info_->GetMainFrame()->UpdateDraggableRegions(std::move(cef_regions));
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::RenderFrameCreated(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
browser_info_->MaybeCreateFrame(render_frame_host);
|
||||
browser_info_->MaybeCreateFrame(render_frame_host, false /* is_guest_view */);
|
||||
if (render_frame_host->GetParent() == nullptr) {
|
||||
auto render_view_host = render_frame_host->GetRenderViewHost();
|
||||
auto base_background_color = platform_delegate()->GetBackgroundColor();
|
||||
@@ -354,9 +324,11 @@ void CefBrowserContentsDelegate::RenderFrameHostStateChanged(
|
||||
|
||||
void CefBrowserContentsDelegate::RenderFrameDeleted(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
const auto frame_id =
|
||||
frame_util::MakeFrameId(render_frame_host->GetGlobalId());
|
||||
browser_info_->RemoveFrame(render_frame_host);
|
||||
|
||||
if (focused_frame_ && focused_frame_->IsSameFrame(render_frame_host)) {
|
||||
if (focused_frame_ && focused_frame_->GetIdentifier() == frame_id) {
|
||||
focused_frame_ = nullptr;
|
||||
OnStateChanged(State::kFocusedFrame);
|
||||
}
|
||||
@@ -379,22 +351,6 @@ void CefBrowserContentsDelegate::RenderViewReady() {
|
||||
|
||||
void CefBrowserContentsDelegate::PrimaryMainFrameRenderProcessGone(
|
||||
base::TerminationStatus status) {
|
||||
static_assert(static_cast<int>(CEF_RESULT_CODE_CHROME_FIRST) ==
|
||||
static_cast<int>(chrome::RESULT_CODE_CHROME_START),
|
||||
"enum mismatch");
|
||||
static_assert(static_cast<int>(CEF_RESULT_CODE_CHROME_LAST) ==
|
||||
static_cast<int>(chrome::RESULT_CODE_CHROME_LAST_CODE),
|
||||
"enum mismatch");
|
||||
|
||||
#if defined(OS_WIN)
|
||||
static_assert(static_cast<int>(CEF_RESULT_CODE_SANDBOX_FATAL_FIRST) ==
|
||||
static_cast<int>(sandbox::SBOX_FATAL_INTEGRITY),
|
||||
"enum mismatch");
|
||||
static_assert(static_cast<int>(CEF_RESULT_CODE_SANDBOX_FATAL_LAST) ==
|
||||
static_cast<int>(sandbox::SBOX_FATAL_LAST),
|
||||
"enum mismatch");
|
||||
#endif
|
||||
|
||||
cef_termination_status_t ts = TS_ABNORMAL_TERMINATION;
|
||||
if (status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) {
|
||||
ts = TS_PROCESS_WAS_KILLED;
|
||||
@@ -402,22 +358,14 @@ void CefBrowserContentsDelegate::PrimaryMainFrameRenderProcessGone(
|
||||
ts = TS_PROCESS_CRASHED;
|
||||
} else if (status == base::TERMINATION_STATUS_OOM) {
|
||||
ts = TS_PROCESS_OOM;
|
||||
} else if (status == base::TERMINATION_STATUS_LAUNCH_FAILED) {
|
||||
ts = TS_LAUNCH_FAILED;
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
} else if (status == base::TERMINATION_STATUS_INTEGRITY_FAILURE) {
|
||||
ts = TS_INTEGRITY_FAILURE;
|
||||
#endif
|
||||
} else if (status != base::TERMINATION_STATUS_ABNORMAL_TERMINATION) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetRequestHandler()) {
|
||||
int error_code = web_contents()->GetCrashedErrorCode();
|
||||
auto navigation_lock = browser_info_->CreateNavigationLock();
|
||||
handler->OnRenderProcessTerminated(browser(), ts, error_code,
|
||||
SadTabView::ErrorToString(error_code));
|
||||
handler->OnRenderProcessTerminated(browser(), ts);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -568,10 +516,6 @@ void CefBrowserContentsDelegate::DidFinishLoad(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url) {
|
||||
auto frame = browser_info_->GetFrameForHost(render_frame_host);
|
||||
if (!frame) {
|
||||
return;
|
||||
}
|
||||
|
||||
frame->RefreshAttributes();
|
||||
|
||||
int http_status_code = 0;
|
||||
|
@@ -63,7 +63,7 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||
virtual void OnWebContentsDestroyed(content::WebContents* web_contents) = 0;
|
||||
|
||||
protected:
|
||||
~Observer() override = default;
|
||||
~Observer() override {}
|
||||
};
|
||||
|
||||
explicit CefBrowserContentsDelegate(
|
||||
@@ -80,15 +80,10 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||
void AddObserver(Observer* observer);
|
||||
void RemoveObserver(Observer* observer);
|
||||
|
||||
// Same as OpenURLFromTab but only taking |navigation_handle_callback|
|
||||
// if the return value is non-nullptr.
|
||||
content::WebContents* OpenURLFromTabEx(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params,
|
||||
base::OnceCallback<void(content::NavigationHandle&)>&
|
||||
navigation_handle_callback);
|
||||
|
||||
// WebContentsDelegate methods:
|
||||
content::WebContents* OpenURLFromTab(
|
||||
content::WebContents* source,
|
||||
const content::OpenURLParams& params) override;
|
||||
void LoadingStateChanged(content::WebContents* source,
|
||||
bool should_show_loading_ui) override;
|
||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||
@@ -110,9 +105,6 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||
bool HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
void DraggableRegionsChanged(
|
||||
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
|
||||
content::WebContents* contents) override;
|
||||
|
||||
// WebContentsObserver methods:
|
||||
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
|
||||
|
@@ -5,7 +5,6 @@
|
||||
#include "libcef/browser/browser_context.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/context.h"
|
||||
@@ -14,6 +13,7 @@
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/features/runtime.h"
|
||||
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/lazy_instance.h"
|
||||
@@ -36,7 +36,7 @@ class ImplManager {
|
||||
public:
|
||||
using Vector = std::vector<CefBrowserContext*>;
|
||||
|
||||
ImplManager() = default;
|
||||
ImplManager() {}
|
||||
|
||||
ImplManager(const ImplManager&) = delete;
|
||||
ImplManager& operator=(const ImplManager&) = delete;
|
||||
@@ -157,7 +157,7 @@ CefBrowserContext::CookieableSchemes MakeSupportedSchemes(
|
||||
bool include_defaults) {
|
||||
if (schemes_list.empty() && include_defaults) {
|
||||
// No explicit registration of schemes.
|
||||
return std::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
std::vector<std::string> all_schemes;
|
||||
@@ -176,7 +176,7 @@ CefBrowserContext::CookieableSchemes MakeSupportedSchemes(
|
||||
all_schemes.push_back("wss");
|
||||
}
|
||||
|
||||
return std::make_optional(all_schemes);
|
||||
return absl::make_optional(all_schemes);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -272,7 +272,22 @@ CefBrowserContext* CefBrowserContext::FromBrowserContext(
|
||||
|
||||
// static
|
||||
CefBrowserContext* CefBrowserContext::FromProfile(const Profile* profile) {
|
||||
return FromBrowserContext(profile);
|
||||
auto* cef_context = FromBrowserContext(profile);
|
||||
if (cef_context) {
|
||||
return cef_context;
|
||||
}
|
||||
|
||||
if (cef::IsChromeRuntimeEnabled()) {
|
||||
auto* original_profile = profile->GetOriginalProfile();
|
||||
if (original_profile != profile) {
|
||||
// With the Chrome runtime if the user launches an incognito window via
|
||||
// the UI we might be associated with the original Profile instead of the
|
||||
// (current) incognito profile.
|
||||
return FromBrowserContext(original_profile);
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -283,7 +298,8 @@ std::vector<CefBrowserContext*> CefBrowserContext::GetAll() {
|
||||
void CefBrowserContext::OnRenderFrameCreated(
|
||||
CefRequestContextImpl* request_context,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_main_frame) {
|
||||
bool is_main_frame,
|
||||
bool is_guest_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(frame_util::IsValidGlobalId(global_id));
|
||||
|
||||
@@ -301,7 +317,8 @@ void CefBrowserContext::OnRenderFrameCreated(
|
||||
void CefBrowserContext::OnRenderFrameDeleted(
|
||||
CefRequestContextImpl* request_context,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_main_frame) {
|
||||
bool is_main_frame,
|
||||
bool is_guest_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(frame_util::IsValidGlobalId(global_id));
|
||||
|
||||
@@ -393,6 +410,10 @@ bool CefBrowserContext::UnloadExtension(const CefString& extension_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CefBrowserContext::IsPrintPreviewSupported() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
network::mojom::NetworkContext* CefBrowserContext::GetNetworkContext() {
|
||||
CEF_REQUIRE_UIT();
|
||||
auto browser_context = AsBrowserContext();
|
||||
@@ -402,30 +423,11 @@ network::mojom::NetworkContext* CefBrowserContext::GetNetworkContext() {
|
||||
CefMediaRouterManager* CefBrowserContext::GetMediaRouterManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!media_router_manager_) {
|
||||
media_router_manager_ =
|
||||
std::make_unique<CefMediaRouterManager>(AsBrowserContext());
|
||||
media_router_manager_.reset(new CefMediaRouterManager(AsBrowserContext()));
|
||||
}
|
||||
return media_router_manager_.get();
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextImpl> CefBrowserContext::GetAnyRequestContext(
|
||||
bool prefer_no_handler) const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (request_context_set_.empty()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (prefer_no_handler) {
|
||||
for (const auto& request_context : request_context_set_) {
|
||||
if (!request_context->GetHandler()) {
|
||||
return request_context;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return *request_context_set_.begin();
|
||||
}
|
||||
|
||||
CefBrowserContext::CookieableSchemes CefBrowserContext::GetCookieableSchemes()
|
||||
const {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
@@ -20,7 +19,7 @@
|
||||
#include "base/task/sequenced_task_runner_helpers.h"
|
||||
#include "chrome/common/plugin.mojom.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "ui/base/page_transition_types.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
/*
|
||||
@@ -105,7 +104,7 @@ class CefBrowserContext {
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool require_frame_match);
|
||||
|
||||
// Returns the underlying CefBrowserContext, if any.
|
||||
// Returns the underlying CefBrowserContext if any.
|
||||
static CefBrowserContext* FromBrowserContext(
|
||||
const content::BrowserContext* context);
|
||||
static CefBrowserContext* FromProfile(const Profile* profile);
|
||||
@@ -132,12 +131,14 @@ class CefBrowserContext {
|
||||
// Called from CefRequestContextImpl::OnRenderFrameCreated.
|
||||
void OnRenderFrameCreated(CefRequestContextImpl* request_context,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_main_frame);
|
||||
bool is_main_frame,
|
||||
bool is_guest_view);
|
||||
|
||||
// Called from CefRequestContextImpl::OnRenderFrameDeleted.
|
||||
void OnRenderFrameDeleted(CefRequestContextImpl* request_context,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool is_main_frame);
|
||||
bool is_main_frame,
|
||||
bool is_guest_view);
|
||||
|
||||
// Returns the handler that matches the specified IDs. Pass -1 for unknown
|
||||
// values. If |require_frame_match| is true only exact matches will be
|
||||
@@ -171,25 +172,14 @@ class CefBrowserContext {
|
||||
// Called from CefExtensionImpl::Unload().
|
||||
virtual bool UnloadExtension(const CefString& extension_id);
|
||||
|
||||
// Called from AlloyBrowserHostImpl::DidFinishNavigation to update the table
|
||||
// of visited links.
|
||||
virtual void AddVisitedURLs(const GURL& url,
|
||||
const std::vector<GURL>& redirect_chain,
|
||||
ui::PageTransition transition) = 0;
|
||||
// Returns true if this context supports print preview.
|
||||
virtual bool IsPrintPreviewSupported() const;
|
||||
|
||||
network::mojom::NetworkContext* GetNetworkContext();
|
||||
|
||||
CefMediaRouterManager* GetMediaRouterManager();
|
||||
|
||||
// Returns any CefRequestContext associated with this object, or nullptr if
|
||||
// none exist. If |prefer_no_handler| is true this method will try to return a
|
||||
// context without an associated CefRequestContextHandler. Use
|
||||
// CefRequestContextImpl::GetOrCreateForBrowserContext() instead of calling
|
||||
// this method directly.
|
||||
CefRefPtr<CefRequestContextImpl> GetAnyRequestContext(
|
||||
bool prefer_no_handler) const;
|
||||
|
||||
using CookieableSchemes = std::optional<std::vector<std::string>>;
|
||||
using CookieableSchemes = absl::optional<std::vector<std::string>>;
|
||||
|
||||
// Returns the schemes associated with this context specifically, or the
|
||||
// global configuration if unset.
|
||||
|
@@ -5,9 +5,7 @@
|
||||
#include "libcef/browser/browser_frame.h"
|
||||
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
@@ -59,31 +57,26 @@ void CefBrowserFrame::FrameAttached(
|
||||
bool reattached) {
|
||||
// Always send to the newly created RFH, which may be speculative when
|
||||
// navigating cross-origin.
|
||||
bool is_excluded;
|
||||
if (auto host = GetFrameHost(/*prefer_speculative=*/true, &is_excluded)) {
|
||||
if (auto host = GetFrameHost(/*prefer_speculative=*/true)) {
|
||||
host->FrameAttached(std::move(render_frame), reattached);
|
||||
} else if (is_excluded) {
|
||||
VLOG(1) << "frame "
|
||||
<< frame_util::GetFrameDebugString(
|
||||
render_frame_host()->GetGlobalFrameToken())
|
||||
<< " attach denied";
|
||||
mojo::Remote<cef::mojom::RenderFrame> render_frame_remote;
|
||||
render_frame_remote.Bind(std::move(render_frame));
|
||||
render_frame_remote->FrameAttachedAck(/*allow=*/false);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserFrame::UpdateDraggableRegions(
|
||||
std::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions) {
|
||||
if (auto host = GetFrameHost(/*prefer_speculative=*/false)) {
|
||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions) {
|
||||
if (auto host = GetFrameHost()) {
|
||||
host->UpdateDraggableRegions(std::move(regions));
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserFrame::GetFrameHost(
|
||||
bool prefer_speculative,
|
||||
bool* is_excluded) const {
|
||||
return CefBrowserInfoManager::GetFrameHost(
|
||||
render_frame_host(), prefer_speculative,
|
||||
/*browser_info=*/nullptr, is_excluded);
|
||||
bool prefer_speculative) const {
|
||||
CEF_REQUIRE_UIT();
|
||||
auto rfh = render_frame_host();
|
||||
if (auto browser = CefBrowserHostBase::GetBrowserForHost(rfh)) {
|
||||
return browser->browser_info()->GetFrameForHost(rfh, nullptr,
|
||||
prefer_speculative);
|
||||
}
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -42,14 +42,14 @@ class CefBrowserFrame
|
||||
void FrameAttached(mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,
|
||||
bool reattached) override;
|
||||
void UpdateDraggableRegions(
|
||||
std::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
|
||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
|
||||
override;
|
||||
|
||||
// FrameServiceBase methods:
|
||||
bool ShouldCloseOnFinishNavigation() const override { return false; }
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameHost(bool prefer_speculative,
|
||||
bool* is_excluded = nullptr) const;
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameHost(
|
||||
bool prefer_speculative = false) const;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_FRAME_H_
|
||||
|
@@ -9,8 +9,6 @@
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "libcef/browser/hang_monitor.h"
|
||||
#include "libcef/browser/image_impl.h"
|
||||
#include "libcef/browser/navigation_entry_impl.h"
|
||||
#include "libcef/browser/printing/print_util.h"
|
||||
@@ -33,8 +31,6 @@
|
||||
#include "content/public/browser/download_request_utils.h"
|
||||
#include "content/public/browser/file_select_listener.h"
|
||||
#include "content/public/browser/navigation_entry.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "ui/base/resource/resource_scale_factor.h"
|
||||
#include "ui/gfx/image/image_skia.h"
|
||||
#include "ui/shell_dialogs/select_file_policy.h"
|
||||
@@ -65,7 +61,7 @@ class WebContentsUserDataAdapter : public base::SupportsUserData::Data {
|
||||
}
|
||||
|
||||
private:
|
||||
explicit WebContentsUserDataAdapter(CefRefPtr<CefBrowserHostBase> browser)
|
||||
WebContentsUserDataAdapter(CefRefPtr<CefBrowserHostBase> browser)
|
||||
: browser_(browser) {
|
||||
auto web_contents = browser->GetWebContents();
|
||||
DCHECK(web_contents);
|
||||
@@ -84,12 +80,6 @@ class WebContentsUserDataAdapter : public base::SupportsUserData::Data {
|
||||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::FromBrowser(
|
||||
CefRefPtr<CefBrowser> browser) {
|
||||
return static_cast<CefBrowserHostBase*>(browser.get());
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::GetBrowserForHost(
|
||||
const content::RenderViewHost* host) {
|
||||
@@ -122,18 +112,7 @@ CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::GetBrowserForContents(
|
||||
const content::WebContents* contents) {
|
||||
DCHECK(contents);
|
||||
CEF_REQUIRE_UIT();
|
||||
if (auto browser = WebContentsUserDataAdapter::Get(contents)) {
|
||||
return browser;
|
||||
}
|
||||
|
||||
// Try the owner WebContents if |contents| originates from an excluded view
|
||||
// such as the PDF viewer or Print Preview. This is safe to call even if Alloy
|
||||
// extensions are disabled.
|
||||
if (auto* owner_contents = extensions::GetOwnerForGuestContents(contents)) {
|
||||
return WebContentsUserDataAdapter::Get(owner_contents);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
return WebContentsUserDataAdapter::Get(contents);
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -153,8 +132,10 @@ CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::GetBrowserForGlobalId(
|
||||
return GetBrowserForHost(render_frame_host);
|
||||
} else {
|
||||
// Use the thread-safe approach.
|
||||
auto info = CefBrowserInfoManager::GetInstance()->GetBrowserInfo(global_id);
|
||||
if (info) {
|
||||
bool is_guest_view = false;
|
||||
auto info = CefBrowserInfoManager::GetInstance()->GetBrowserInfo(
|
||||
global_id, &is_guest_view);
|
||||
if (info && !is_guest_view) {
|
||||
auto browser = info->browser();
|
||||
if (!browser) {
|
||||
LOG(WARNING) << "Found browser id " << info->browser_id()
|
||||
@@ -167,38 +148,6 @@ CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::GetBrowserForGlobalId(
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::GetBrowserForGlobalToken(
|
||||
const content::GlobalRenderFrameHostToken& global_token) {
|
||||
if (!frame_util::IsValidGlobalToken(global_token)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
// Use the non-thread-safe but potentially faster approach.
|
||||
content::RenderFrameHost* render_frame_host =
|
||||
content::RenderFrameHost::FromFrameToken(global_token);
|
||||
if (!render_frame_host) {
|
||||
return nullptr;
|
||||
}
|
||||
return GetBrowserForHost(render_frame_host);
|
||||
} else {
|
||||
// Use the thread-safe approach.
|
||||
auto info =
|
||||
CefBrowserInfoManager::GetInstance()->GetBrowserInfo(global_token);
|
||||
if (info) {
|
||||
auto browser = info->browser();
|
||||
if (!browser) {
|
||||
LOG(WARNING) << "Found browser id " << info->browser_id()
|
||||
<< " but no browser object matching frame "
|
||||
<< frame_util::GetFrameDebugString(global_token);
|
||||
}
|
||||
return browser;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefBrowserHostBase>
|
||||
CefBrowserHostBase::GetBrowserForTopLevelNativeWindow(
|
||||
@@ -266,8 +215,7 @@ void CefBrowserHostBase::InitializeBrowser() {
|
||||
void CefBrowserHostBase::DestroyBrowser() {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
devtools_protocol_manager_.reset();
|
||||
devtools_window_runner_.reset();
|
||||
devtools_manager_.reset();
|
||||
media_stream_registrar_.reset();
|
||||
|
||||
platform_delegate_.reset();
|
||||
@@ -275,11 +223,6 @@ void CefBrowserHostBase::DestroyBrowser() {
|
||||
contents_delegate_->RemoveObserver(this);
|
||||
contents_delegate_->ObserveWebContents(nullptr);
|
||||
|
||||
if (unresponsive_process_callback_) {
|
||||
hang_monitor::Detach(unresponsive_process_callback_);
|
||||
unresponsive_process_callback_.reset();
|
||||
}
|
||||
|
||||
CefBrowserInfoManager::GetInstance()->RemoveBrowserInfo(browser_info_);
|
||||
browser_info_->SetBrowser(nullptr);
|
||||
}
|
||||
@@ -578,30 +521,6 @@ void CefBrowserHostBase::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::CloseDevTools() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostBase::CloseDevTools, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (devtools_window_runner_) {
|
||||
devtools_window_runner_->CloseDevTools();
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::HasDevTools() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (devtools_window_runner_) {
|
||||
return devtools_window_runner_->HasDevTools();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::SendDevToolsMessage(const void* message,
|
||||
size_t message_size) {
|
||||
if (!message || message_size == 0) {
|
||||
@@ -620,10 +539,10 @@ bool CefBrowserHostBase::SendDevToolsMessage(const void* message,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsProtocolManager()) {
|
||||
if (!EnsureDevToolsManager()) {
|
||||
return false;
|
||||
}
|
||||
return devtools_protocol_manager_->SendDevToolsMessage(message, message_size);
|
||||
return devtools_manager_->SendDevToolsMessage(message, message_size);
|
||||
}
|
||||
|
||||
int CefBrowserHostBase::ExecuteDevToolsMethod(
|
||||
@@ -638,11 +557,10 @@ int CefBrowserHostBase::ExecuteDevToolsMethod(
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsProtocolManager()) {
|
||||
if (!EnsureDevToolsManager()) {
|
||||
return 0;
|
||||
}
|
||||
return devtools_protocol_manager_->ExecuteDevToolsMethod(message_id, method,
|
||||
params);
|
||||
return devtools_manager_->ExecuteDevToolsMethod(message_id, method, params);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRegistration> CefBrowserHostBase::AddDevToolsMessageObserver(
|
||||
@@ -650,7 +568,7 @@ CefRefPtr<CefRegistration> CefBrowserHostBase::AddDevToolsMessageObserver(
|
||||
if (!observer) {
|
||||
return nullptr;
|
||||
}
|
||||
auto registration = CefDevToolsProtocolManager::CreateRegistration(observer);
|
||||
auto registration = CefDevToolsManager::CreateRegistration(observer);
|
||||
InitializeDevToolsRegistrationOnUIThread(registration);
|
||||
return registration.get();
|
||||
}
|
||||
@@ -756,26 +674,6 @@ void CefBrowserHostBase::ExitFullscreen(bool will_cause_resize) {
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::IsRenderProcessUnresponsive() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (auto* web_contents = GetWebContents()) {
|
||||
if (auto* rvh = web_contents->GetRenderViewHost()) {
|
||||
if (auto* rwh = rvh->GetWidget()) {
|
||||
return rwh->IsCurrentlyUnresponsive();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
cef_runtime_style_t CefBrowserHostBase::GetRuntimeStyle() {
|
||||
return IsAlloyStyle() ? CEF_RUNTIME_STYLE_ALLOY : CEF_RUNTIME_STYLE_CHROME;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::ReplaceMisspelling(const CefString& word) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
@@ -993,8 +891,8 @@ int CefBrowserHostBase::GetIdentifier() {
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::IsSame(CefRefPtr<CefBrowser> that) {
|
||||
auto impl = FromBrowser(that);
|
||||
return (impl.get() == this);
|
||||
auto impl = static_cast<CefBrowserHostBase*>(that.get());
|
||||
return (impl == this);
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::HasDocument() {
|
||||
@@ -1007,32 +905,32 @@ bool CefBrowserHostBase::IsPopup() {
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetMainFrame() {
|
||||
return browser_info_->GetMainFrame();
|
||||
return GetFrame(CefFrameHostImpl::kMainFrameId);
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFocusedFrame() {
|
||||
{
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
if (focused_frame_) {
|
||||
return focused_frame_;
|
||||
}
|
||||
}
|
||||
|
||||
// The main frame is focused by default.
|
||||
return browser_info_->GetMainFrame();
|
||||
return GetFrame(CefFrameHostImpl::kFocusedFrameId);
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrameByIdentifier(
|
||||
const CefString& identifier) {
|
||||
const auto& global_token = frame_util::ParseFrameIdentifier(identifier);
|
||||
if (!global_token) {
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrame(int64_t identifier) {
|
||||
if (identifier == CefFrameHostImpl::kInvalidFrameId) {
|
||||
return nullptr;
|
||||
} else if (identifier == CefFrameHostImpl::kMainFrameId) {
|
||||
return browser_info_->GetMainFrame();
|
||||
} else if (identifier == CefFrameHostImpl::kFocusedFrameId) {
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
if (!focused_frame_) {
|
||||
// The main frame is focused by default.
|
||||
return browser_info_->GetMainFrame();
|
||||
}
|
||||
return focused_frame_;
|
||||
}
|
||||
|
||||
return browser_info_->GetFrameForGlobalToken(*global_token);
|
||||
return browser_info_->GetFrameForGlobalId(
|
||||
frame_util::MakeGlobalId(identifier));
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrameByName(const CefString& name) {
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrame(const CefString& name) {
|
||||
for (const auto& frame : browser_info_->GetAllFrames()) {
|
||||
if (frame->GetName() == name) {
|
||||
return frame;
|
||||
@@ -1046,7 +944,7 @@ size_t CefBrowserHostBase::GetFrameCount() {
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::GetFrameIdentifiers(
|
||||
std::vector<CefString>& identifiers) {
|
||||
std::vector<int64_t>& identifiers) {
|
||||
if (identifiers.size() > 0) {
|
||||
identifiers.clear();
|
||||
}
|
||||
@@ -1131,12 +1029,7 @@ CefRefPtr<CefFrame> CefBrowserHostBase::GetFrameForHost(
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrameForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id) {
|
||||
return browser_info_->GetFrameForGlobalId(global_id);
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrameForGlobalToken(
|
||||
const content::GlobalRenderFrameHostToken& global_token) {
|
||||
return browser_info_->GetFrameForGlobalToken(global_token);
|
||||
return browser_info_->GetFrameForGlobalId(global_id, nullptr);
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::AddObserver(Observer* observer) {
|
||||
@@ -1188,12 +1081,6 @@ bool CefBrowserHostBase::Navigate(const content::OpenURLParams& params) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::ShowDevToolsOnUIThread(
|
||||
std::unique_ptr<CefShowDevToolsParams> params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
GetDevToolsWindowRunner()->ShowDevTools(this, std::move(params));
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::ViewText(const std::string& text) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
@@ -1247,6 +1134,7 @@ void CefBrowserHostBase::SelectFileListenerDestroyed(
|
||||
|
||||
bool CefBrowserHostBase::MaybeAllowNavigation(
|
||||
content::RenderFrameHost* opener,
|
||||
bool is_guest_view,
|
||||
const content::OpenURLParams& params) {
|
||||
return true;
|
||||
}
|
||||
@@ -1294,6 +1182,10 @@ SkColor CefBrowserHostBase::GetBackgroundColor() const {
|
||||
&settings_, IsWindowless() ? STATE_ENABLED : STATE_DISABLED);
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::IsWindowless() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
content::WebContents* CefBrowserHostBase::GetWebContents() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
return contents_delegate_->web_contents();
|
||||
@@ -1316,13 +1208,6 @@ CefMediaStreamRegistrar* CefBrowserHostBase::GetMediaStreamRegistrar() {
|
||||
return media_stream_registrar_.get();
|
||||
}
|
||||
|
||||
CefDevToolsWindowRunner* CefBrowserHostBase::GetDevToolsWindowRunner() {
|
||||
if (!devtools_window_runner_) {
|
||||
devtools_window_runner_ = CefDevToolsWindowRunner::Create();
|
||||
}
|
||||
return devtools_window_runner_.get();
|
||||
}
|
||||
|
||||
views::Widget* CefBrowserHostBase::GetWindowWidget() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!platform_delegate_) {
|
||||
@@ -1374,15 +1259,14 @@ bool CefBrowserHostBase::IsVisible() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::EnsureDevToolsProtocolManager() {
|
||||
bool CefBrowserHostBase::EnsureDevToolsManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!contents_delegate_->web_contents()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!devtools_protocol_manager_) {
|
||||
devtools_protocol_manager_ =
|
||||
std::make_unique<CefDevToolsProtocolManager>(this);
|
||||
if (!devtools_manager_) {
|
||||
devtools_manager_ = std::make_unique<CefDevToolsManager>(this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1398,10 +1282,10 @@ void CefBrowserHostBase::InitializeDevToolsRegistrationOnUIThread(
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsProtocolManager()) {
|
||||
if (!EnsureDevToolsManager()) {
|
||||
return;
|
||||
}
|
||||
devtools_protocol_manager_->InitializeRegistrationOnUIThread(registration);
|
||||
devtools_manager_->InitializeRegistrationOnUIThread(registration);
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::EnsureFileDialogManager() {
|
||||
|
@@ -8,13 +8,11 @@
|
||||
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_client.h"
|
||||
#include "include/cef_unresponsive_process_callback.h"
|
||||
#include "include/views/cef_browser_view.h"
|
||||
#include "libcef/browser/browser_contents_delegate.h"
|
||||
#include "libcef/browser/browser_info.h"
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/devtools/devtools_protocol_manager.h"
|
||||
#include "libcef/browser/devtools/devtools_window_runner.h"
|
||||
#include "libcef/browser/devtools/devtools_manager.h"
|
||||
#include "libcef/browser/file_dialog_manager.h"
|
||||
#include "libcef/browser/frame_host_impl.h"
|
||||
#include "libcef/browser/media_stream_registrar.h"
|
||||
@@ -28,19 +26,15 @@ namespace extensions {
|
||||
class Extension;
|
||||
}
|
||||
|
||||
class RenderViewContextMenuObserver;
|
||||
|
||||
// Parameters that are passed to the runtime-specific Create methods.
|
||||
struct CefBrowserCreateParams {
|
||||
CefBrowserCreateParams() = default;
|
||||
CefBrowserCreateParams() {}
|
||||
|
||||
// Copy constructor used with Chrome style only.
|
||||
// Copy constructor used with the chrome runtime only.
|
||||
CefBrowserCreateParams(const CefBrowserCreateParams& that) {
|
||||
operator=(that);
|
||||
}
|
||||
CefBrowserCreateParams& operator=(const CefBrowserCreateParams& that) {
|
||||
DCHECK(that.IsChromeStyle());
|
||||
|
||||
// Not all parameters can be copied.
|
||||
client = that.client;
|
||||
url = that.url;
|
||||
@@ -48,29 +42,14 @@ struct CefBrowserCreateParams {
|
||||
request_context = that.request_context;
|
||||
extra_info = that.extra_info;
|
||||
if (that.window_info) {
|
||||
MaybeSetWindowInfo(*that.window_info, /*allow_alloy_style=*/false,
|
||||
/*allow_chrome_style=*/true);
|
||||
MaybeSetWindowInfo(*that.window_info);
|
||||
}
|
||||
browser_view = that.browser_view;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Initialize |window_info| with expected defaults before passing to a client
|
||||
// callback. |opener| will be non-nullptr for popups, DevTools windows, etc.
|
||||
static void InitWindowInfo(CefWindowInfo* window_info,
|
||||
CefBrowserHostBase* opener);
|
||||
|
||||
// Set |window_info| if appropriate (see below).
|
||||
void MaybeSetWindowInfo(const CefWindowInfo& window_info,
|
||||
bool allow_alloy_style,
|
||||
bool allow_chrome_style);
|
||||
|
||||
// Returns true if |window_info| indicates creation of a Chrome style window.
|
||||
static bool IsChromeStyle(const CefWindowInfo* window_info);
|
||||
bool IsChromeStyle() const;
|
||||
|
||||
// Returns true if parameters indicate windowless (off-screen) rendering.
|
||||
bool IsWindowless() const;
|
||||
void MaybeSetWindowInfo(const CefWindowInfo& window_info);
|
||||
|
||||
// Platform-specific window creation info. Will be nullptr for Views-hosted
|
||||
// browsers except when using the Chrome runtime with a native parent handle.
|
||||
@@ -85,10 +64,6 @@ struct CefBrowserCreateParams {
|
||||
// PopupWebContentsCreated).
|
||||
bool popup_with_views_hosted_opener = false;
|
||||
|
||||
// True if this browser is a popup and has an Alloy style opener. Only used
|
||||
// with the Chrome runtime.
|
||||
bool popup_with_alloy_style_opener = false;
|
||||
|
||||
// Client implementation. May be nullptr.
|
||||
CefRefPtr<CefClient> client;
|
||||
|
||||
@@ -119,6 +94,23 @@ struct CefBrowserCreateParams {
|
||||
extensions::mojom::ViewType::kInvalid;
|
||||
};
|
||||
|
||||
// Parameters passed to ShowDevToolsOnUIThread().
|
||||
struct CefShowDevToolsParams {
|
||||
CefShowDevToolsParams(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at)
|
||||
: window_info_(windowInfo),
|
||||
client_(client),
|
||||
settings_(settings),
|
||||
inspect_element_at_(inspect_element_at) {}
|
||||
|
||||
CefWindowInfo window_info_;
|
||||
CefRefPtr<CefClient> client_;
|
||||
CefBrowserSettings settings_;
|
||||
CefPoint inspect_element_at_;
|
||||
};
|
||||
|
||||
// Base class for CefBrowserHost implementations. Includes functionality that is
|
||||
// shared by the alloy and chrome runtimes. All methods are thread-safe unless
|
||||
// otherwise indicated.
|
||||
@@ -135,7 +127,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
virtual void OnBrowserDestroyed(CefBrowserHostBase* browser) = 0;
|
||||
|
||||
protected:
|
||||
~Observer() override = default;
|
||||
virtual ~Observer() {}
|
||||
};
|
||||
|
||||
// Create a new CefBrowserHost instance of the current runtime type with
|
||||
@@ -143,11 +135,6 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
static CefRefPtr<CefBrowserHostBase> Create(
|
||||
CefBrowserCreateParams& create_params);
|
||||
|
||||
// Safe conversion from CefBrowserHostBase to CefBrowserHostBase.
|
||||
// Use this method instead of static_cast.
|
||||
static CefRefPtr<CefBrowserHostBase> FromBrowser(
|
||||
CefRefPtr<CefBrowser> browser);
|
||||
|
||||
// Returns the browser associated with the specified RenderViewHost.
|
||||
static CefRefPtr<CefBrowserHostBase> GetBrowserForHost(
|
||||
const content::RenderViewHost* host);
|
||||
@@ -160,9 +147,6 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
// Returns the browser associated with the specified global ID.
|
||||
static CefRefPtr<CefBrowserHostBase> GetBrowserForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id);
|
||||
// Returns the browser associated with the specified global token.
|
||||
static CefRefPtr<CefBrowserHostBase> GetBrowserForGlobalToken(
|
||||
const content::GlobalRenderFrameHostToken& global_token);
|
||||
// Returns the browser associated with the specified top-level window.
|
||||
static CefRefPtr<CefBrowserHostBase> GetBrowserForTopLevelNativeWindow(
|
||||
gfx::NativeWindow owning_window);
|
||||
@@ -228,8 +212,6 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) override;
|
||||
void CloseDevTools() override;
|
||||
bool HasDevTools() override;
|
||||
void ReplaceMisspelling(const CefString& word) override;
|
||||
void AddWordToDictionary(const CefString& word) override;
|
||||
void SendKeyEvent(const CefKeyEvent& event) override;
|
||||
@@ -253,8 +235,6 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
bool IsFullscreen() override;
|
||||
void ExitFullscreen(bool will_cause_resize) override;
|
||||
bool IsRenderProcessUnresponsive() override;
|
||||
cef_runtime_style_t GetRuntimeStyle() override;
|
||||
|
||||
// CefBrowser methods:
|
||||
bool IsValid() override;
|
||||
@@ -273,11 +253,10 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
bool IsPopup() override;
|
||||
CefRefPtr<CefFrame> GetMainFrame() override;
|
||||
CefRefPtr<CefFrame> GetFocusedFrame() override;
|
||||
CefRefPtr<CefFrame> GetFrameByIdentifier(
|
||||
const CefString& identifier) override;
|
||||
CefRefPtr<CefFrame> GetFrameByName(const CefString& name) override;
|
||||
CefRefPtr<CefFrame> GetFrame(int64_t identifier) override;
|
||||
CefRefPtr<CefFrame> GetFrame(const CefString& name) override;
|
||||
size_t GetFrameCount() override;
|
||||
void GetFrameIdentifiers(std::vector<CefString>& identifiers) override;
|
||||
void GetFrameIdentifiers(std::vector<int64_t>& identifiers) override;
|
||||
void GetFrameNames(std::vector<CefString>& names) override;
|
||||
void SetAccessibilityState(cef_state_t accessibility_state) override;
|
||||
|
||||
@@ -285,17 +264,14 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
void OnStateChanged(CefBrowserContentsState state_changed) override;
|
||||
void OnWebContentsDestroyed(content::WebContents* web_contents) override;
|
||||
|
||||
// Returns the frame object matching the specified |host| or nullptr if no
|
||||
// match is found. Must be called on the UI thread.
|
||||
// Returns the frame associated with the specified RenderFrameHost.
|
||||
CefRefPtr<CefFrame> GetFrameForHost(const content::RenderFrameHost* host);
|
||||
|
||||
// Returns the frame associated with the specified global ID/token. See
|
||||
// documentation on RenderFrameHost::GetFrameTreeNodeId/Token() for why the
|
||||
// global ID/token is preferred.
|
||||
// Returns the frame associated with the specified global ID. See
|
||||
// documentation on RenderFrameHost::GetFrameTreeNodeId() for why the global
|
||||
// ID is preferred.
|
||||
CefRefPtr<CefFrame> GetFrameForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id);
|
||||
CefRefPtr<CefFrame> GetFrameForGlobalToken(
|
||||
const content::GlobalRenderFrameHostToken& global_token);
|
||||
|
||||
// Manage observer objects. The observer must either outlive this object or
|
||||
// be removed before destruction. Must be called on the UI thread.
|
||||
@@ -326,6 +302,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
|
||||
// Called from CefBrowserInfoManager::MaybeAllowNavigation.
|
||||
virtual bool MaybeAllowNavigation(content::RenderFrameHost* opener,
|
||||
bool is_guest_view,
|
||||
const content::OpenURLParams& params);
|
||||
|
||||
// Helpers for executing client callbacks. Must be called on the UI thread.
|
||||
@@ -345,11 +322,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
SkColor GetBackgroundColor() const;
|
||||
|
||||
// Returns true if windowless rendering is enabled.
|
||||
virtual bool IsWindowless() const = 0;
|
||||
|
||||
// Returns the runtime style of this browser.
|
||||
virtual bool IsAlloyStyle() const = 0;
|
||||
bool IsChromeStyle() const { return !IsAlloyStyle(); }
|
||||
virtual bool IsWindowless() const;
|
||||
|
||||
// Accessors that must be called on the UI thread.
|
||||
content::WebContents* GetWebContents() const;
|
||||
@@ -361,23 +334,6 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
return contents_delegate_.get();
|
||||
}
|
||||
CefMediaStreamRegistrar* GetMediaStreamRegistrar();
|
||||
CefDevToolsWindowRunner* GetDevToolsWindowRunner();
|
||||
|
||||
CefRefPtr<CefUnresponsiveProcessCallback> unresponsive_process_callback()
|
||||
const {
|
||||
return unresponsive_process_callback_;
|
||||
}
|
||||
void set_unresponsive_process_callback(
|
||||
CefRefPtr<CefUnresponsiveProcessCallback> callback) {
|
||||
unresponsive_process_callback_ = callback;
|
||||
}
|
||||
|
||||
RenderViewContextMenuObserver* context_menu_observer() const {
|
||||
return context_menu_observer_;
|
||||
}
|
||||
void set_context_menu_observer(RenderViewContextMenuObserver* observer) {
|
||||
context_menu_observer_ = observer;
|
||||
}
|
||||
|
||||
// Returns the Widget owner for the browser window. Only used with windowed
|
||||
// browsers.
|
||||
@@ -405,7 +361,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
virtual bool IsVisible() const;
|
||||
|
||||
protected:
|
||||
bool EnsureDevToolsProtocolManager();
|
||||
bool EnsureDevToolsManager();
|
||||
void InitializeDevToolsRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration);
|
||||
|
||||
@@ -413,7 +369,8 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
virtual bool Navigate(const content::OpenURLParams& params);
|
||||
|
||||
// Called from ShowDevTools to perform the actual show.
|
||||
void ShowDevToolsOnUIThread(std::unique_ptr<CefShowDevToolsParams> params);
|
||||
virtual void ShowDevToolsOnUIThread(
|
||||
std::unique_ptr<CefShowDevToolsParams> params) = 0;
|
||||
|
||||
// Create the CefFileDialogManager if it doesn't already exist.
|
||||
bool EnsureFileDialogManager();
|
||||
@@ -428,8 +385,6 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
|
||||
// Only accessed on the UI thread.
|
||||
std::unique_ptr<CefBrowserContentsDelegate> contents_delegate_;
|
||||
CefRefPtr<CefUnresponsiveProcessCallback> unresponsive_process_callback_;
|
||||
RenderViewContextMenuObserver* context_menu_observer_ = nullptr;
|
||||
|
||||
// Observers that want to be notified of changes to this object.
|
||||
// Only accessed on the UI thread.
|
||||
@@ -448,11 +403,8 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
bool is_fullscreen_ = false;
|
||||
CefRefPtr<CefFrameHostImpl> focused_frame_;
|
||||
|
||||
// Used for managing DevTools instances without a frontend.
|
||||
std::unique_ptr<CefDevToolsProtocolManager> devtools_protocol_manager_;
|
||||
|
||||
// Used for creating and running the DevTools window frontend.
|
||||
std::unique_ptr<CefDevToolsWindowRunner> devtools_window_runner_;
|
||||
// Used for creating and managing DevTools instances.
|
||||
std::unique_ptr<CefDevToolsManager> devtools_manager_;
|
||||
|
||||
std::unique_ptr<CefMediaStreamRegistrar> media_stream_registrar_;
|
||||
|
||||
|
@@ -65,9 +65,8 @@ bool CefBrowserHost::CreateBrowser(
|
||||
|
||||
// Verify windowless rendering requirements.
|
||||
if (windowInfo.windowless_rendering_enabled &&
|
||||
(!client || !client->GetRenderHandler().get())) {
|
||||
LOG(ERROR)
|
||||
<< "Windowless rendering requires a CefRenderHandler implementation";
|
||||
!client->GetRenderHandler().get()) {
|
||||
DCHECK(false) << "CefRenderHandler implementation is required";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -134,15 +133,13 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
|
||||
|
||||
// Verify windowless rendering requirements.
|
||||
if (windowInfo.windowless_rendering_enabled &&
|
||||
(!client || !client->GetRenderHandler().get())) {
|
||||
LOG(ERROR)
|
||||
<< "Windowless rendering requires a CefRenderHandler implementation";
|
||||
!client->GetRenderHandler().get()) {
|
||||
DCHECK(false) << "CefRenderHandler implementation is required";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefBrowserCreateParams create_params;
|
||||
create_params.MaybeSetWindowInfo(windowInfo, /*allow_alloy_style=*/true,
|
||||
/*allow_chrome_style=*/true);
|
||||
create_params.MaybeSetWindowInfo(windowInfo);
|
||||
create_params.client = client;
|
||||
create_params.url = url;
|
||||
create_params.settings = settings;
|
||||
@@ -152,121 +149,18 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
|
||||
return CefBrowserHostBase::Create(create_params);
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefBrowserCreateParams::IsChromeStyle(const CefWindowInfo* window_info) {
|
||||
if (!cef::IsChromeRuntimeEnabled()) {
|
||||
return false;
|
||||
}
|
||||
if (!window_info) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Both CHROME and DEFAULT indicate Chrome style with Chrome bootstrap.
|
||||
return window_info->runtime_style == CEF_RUNTIME_STYLE_CHROME ||
|
||||
window_info->runtime_style == CEF_RUNTIME_STYLE_DEFAULT;
|
||||
}
|
||||
|
||||
bool CefBrowserCreateParams::IsChromeStyle() const {
|
||||
if (!cef::IsChromeRuntimeEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const bool chrome_style_via_window_info = IsChromeStyle(window_info.get());
|
||||
|
||||
if (popup_with_alloy_style_opener) {
|
||||
// Creating a popup where the opener is Alloy style.
|
||||
if (chrome_style_via_window_info &&
|
||||
window_info->runtime_style == CEF_RUNTIME_STYLE_CHROME) {
|
||||
// Only use Chrome style for the popup if the client explicitly sets
|
||||
// CHROME (and not DEFAULT) via CefWindowInfo.runtime_style.
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (browser_view) {
|
||||
// Must match the BrowserView style. GetRuntimeStyle() will not return
|
||||
// DEFAULT.
|
||||
return browser_view->GetRuntimeStyle() == CEF_RUNTIME_STYLE_CHROME;
|
||||
}
|
||||
|
||||
// Chrome style does not support windowless rendering.
|
||||
return chrome_style_via_window_info && !IsWindowless();
|
||||
}
|
||||
|
||||
bool CefBrowserCreateParams::IsWindowless() const {
|
||||
return window_info && window_info->windowless_rendering_enabled && client &&
|
||||
client->GetRenderHandler().get();
|
||||
}
|
||||
|
||||
// static
|
||||
void CefBrowserCreateParams::InitWindowInfo(CefWindowInfo* window_info,
|
||||
CefBrowserHostBase* opener) {
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
window_info->SetAsPopup(nullptr, CefString());
|
||||
#endif
|
||||
|
||||
if (cef::IsChromeRuntimeEnabled() && opener->IsAlloyStyle()) {
|
||||
// Give the popup the same runtime style as the opener.
|
||||
window_info->runtime_style = CEF_RUNTIME_STYLE_ALLOY;
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserCreateParams::MaybeSetWindowInfo(
|
||||
const CefWindowInfo& new_window_info,
|
||||
bool allow_alloy_style,
|
||||
bool allow_chrome_style) {
|
||||
if (!cef::IsChromeRuntimeEnabled()) {
|
||||
// Chrome style is not supported wih the Alloy bootstrap.
|
||||
allow_chrome_style = false;
|
||||
}
|
||||
|
||||
if (allow_chrome_style && new_window_info.windowless_rendering_enabled) {
|
||||
// Chrome style is not supported with windowles rendering.
|
||||
allow_chrome_style = false;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
if (allow_chrome_style &&
|
||||
chrome_child_window::HasParentHandle(new_window_info)) {
|
||||
// Chrome style is not supported with native parent on MacOS. See issue
|
||||
// #3294.
|
||||
allow_chrome_style = false;
|
||||
}
|
||||
#endif
|
||||
|
||||
DCHECK(allow_alloy_style || allow_chrome_style);
|
||||
|
||||
bool reset_style = false;
|
||||
if (new_window_info.runtime_style == CEF_RUNTIME_STYLE_ALLOY &&
|
||||
!allow_alloy_style) {
|
||||
LOG(ERROR) << "Alloy style is not supported for this browser";
|
||||
reset_style = true;
|
||||
} else if (new_window_info.runtime_style == CEF_RUNTIME_STYLE_CHROME &&
|
||||
!allow_chrome_style) {
|
||||
LOG(ERROR) << "Chrome style is not supported for this browser";
|
||||
reset_style = true;
|
||||
}
|
||||
|
||||
const bool is_chrome_style =
|
||||
allow_chrome_style && IsChromeStyle(&new_window_info);
|
||||
if (!is_chrome_style ||
|
||||
const CefWindowInfo& new_window_info) {
|
||||
if (!cef::IsChromeRuntimeEnabled() ||
|
||||
chrome_child_window::HasParentHandle(new_window_info)) {
|
||||
window_info = std::make_unique<CefWindowInfo>(new_window_info);
|
||||
if (cef::IsChromeRuntimeEnabled() && !allow_chrome_style) {
|
||||
// Only Alloy style is allowed.
|
||||
window_info->runtime_style = CEF_RUNTIME_STYLE_ALLOY;
|
||||
} else if (reset_style) {
|
||||
// Use the default style.
|
||||
window_info->runtime_style = CEF_RUNTIME_STYLE_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefBrowserHostBase> CefBrowserHostBase::Create(
|
||||
CefBrowserCreateParams& create_params) {
|
||||
if (create_params.IsChromeStyle()) {
|
||||
if (cef::IsChromeRuntimeEnabled()) {
|
||||
if (auto browser =
|
||||
chrome_child_window::MaybeCreateChildBrowser(create_params)) {
|
||||
return browser.get();
|
||||
|
@@ -4,10 +4,7 @@
|
||||
|
||||
#include "libcef/browser/browser_info.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
@@ -22,7 +19,7 @@ CefBrowserInfo::FrameInfo::~FrameInfo() {
|
||||
#if DCHECK_IS_ON()
|
||||
if (frame_ && !IsCurrentMainFrame()) {
|
||||
// Should already be Detached.
|
||||
DCHECK(frame_->IsDetached());
|
||||
DCHECK(!frame_->GetRenderFrameHost());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -30,12 +27,10 @@ CefBrowserInfo::FrameInfo::~FrameInfo() {
|
||||
CefBrowserInfo::CefBrowserInfo(int browser_id,
|
||||
bool is_popup,
|
||||
bool is_windowless,
|
||||
bool print_preview_enabled,
|
||||
CefRefPtr<CefDictionaryValue> extra_info)
|
||||
: browser_id_(browser_id),
|
||||
is_popup_(is_popup),
|
||||
is_windowless_(is_windowless),
|
||||
print_preview_enabled_(print_preview_enabled),
|
||||
extra_info_(extra_info) {
|
||||
DCHECK_GT(browser_id, 0);
|
||||
|
||||
@@ -95,14 +90,10 @@ void CefBrowserInfo::SetClosing() {
|
||||
is_closing_ = true;
|
||||
}
|
||||
|
||||
void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host) {
|
||||
void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
||||
bool is_guest_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (CefBrowserInfoManager::IsExcludedFrameHost(host)) {
|
||||
// Don't create a FrameHost for an excluded type.
|
||||
return;
|
||||
}
|
||||
|
||||
const auto global_id = host->GetGlobalId();
|
||||
const bool is_main_frame = (host->GetParent() == nullptr);
|
||||
|
||||
@@ -128,10 +119,11 @@ void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host) {
|
||||
#if DCHECK_IS_ON()
|
||||
// Check that the frame info hasn't changed unexpectedly.
|
||||
DCHECK_EQ(info->global_id_, global_id);
|
||||
DCHECK_EQ(info->is_guest_view_, is_guest_view);
|
||||
DCHECK_EQ(info->is_main_frame_, is_main_frame);
|
||||
#endif
|
||||
|
||||
if (info->is_speculative_ && !is_speculative) {
|
||||
if (!info->is_guest_view_ && info->is_speculative_ && !is_speculative) {
|
||||
// Upgrade the frame info from speculative to non-speculative.
|
||||
if (info->is_main_frame_) {
|
||||
// Set the main frame object.
|
||||
@@ -145,28 +137,32 @@ void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host) {
|
||||
auto frame_info = new FrameInfo;
|
||||
frame_info->host_ = host;
|
||||
frame_info->global_id_ = global_id;
|
||||
frame_info->is_guest_view_ = is_guest_view;
|
||||
frame_info->is_main_frame_ = is_main_frame;
|
||||
frame_info->is_speculative_ = is_speculative;
|
||||
|
||||
// Create a new frame object.
|
||||
frame_info->frame_ = new CefFrameHostImpl(this, host);
|
||||
MaybeNotifyFrameCreated(frame_info->frame_);
|
||||
if (is_main_frame && !is_speculative) {
|
||||
SetMainFrame(browser_, frame_info->frame_);
|
||||
}
|
||||
// Guest views don't get their own CefBrowser or CefFrame objects.
|
||||
if (!is_guest_view) {
|
||||
// Create a new frame object.
|
||||
frame_info->frame_ = new CefFrameHostImpl(this, host);
|
||||
MaybeNotifyFrameCreated(frame_info->frame_);
|
||||
if (is_main_frame && !is_speculative) {
|
||||
SetMainFrame(browser_, frame_info->frame_);
|
||||
}
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
// Check that the frame info hasn't changed unexpectedly.
|
||||
DCHECK(host->GetGlobalFrameToken() == *frame_info->frame_->frame_token());
|
||||
DCHECK_EQ(frame_info->is_main_frame_, frame_info->frame_->IsMain());
|
||||
// Check that the frame info hasn't changed unexpectedly.
|
||||
DCHECK_EQ(frame_util::MakeFrameId(global_id),
|
||||
frame_info->frame_->GetIdentifier());
|
||||
DCHECK_EQ(frame_info->is_main_frame_, frame_info->frame_->IsMain());
|
||||
#endif
|
||||
}
|
||||
|
||||
browser_->request_context()->OnRenderFrameCreated(global_id, is_main_frame);
|
||||
browser_->request_context()->OnRenderFrameCreated(global_id, is_main_frame,
|
||||
is_guest_view);
|
||||
|
||||
// Populate the lookup maps.
|
||||
frame_id_map_.insert(std::make_pair(global_id, frame_info));
|
||||
frame_token_to_id_map_.insert(
|
||||
std::make_pair(host->GetGlobalFrameToken(), global_id));
|
||||
|
||||
// And finally set the ownership.
|
||||
frame_info_set_.insert(base::WrapUnique(frame_info));
|
||||
@@ -211,11 +207,10 @@ void CefBrowserInfo::FrameHostStateChanged(
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
auto it = frame_id_map_.find(host->GetGlobalId());
|
||||
if (it != frame_id_map_.end()) {
|
||||
DCHECK((!it->second->is_in_bfcache_ && added_to_bfcache) ||
|
||||
(it->second->is_in_bfcache_ && removed_from_bfcache));
|
||||
it->second->is_in_bfcache_ = added_to_bfcache;
|
||||
}
|
||||
DCHECK(it != frame_id_map_.end());
|
||||
DCHECK((!it->second->is_in_bfcache_ && added_to_bfcache) ||
|
||||
(it->second->is_in_bfcache_ && removed_from_bfcache));
|
||||
it->second->is_in_bfcache_ = added_to_bfcache;
|
||||
}
|
||||
|
||||
void CefBrowserInfo::RemoveFrame(content::RenderFrameHost* host) {
|
||||
@@ -225,24 +220,16 @@ void CefBrowserInfo::RemoveFrame(content::RenderFrameHost* host) {
|
||||
|
||||
const auto global_id = host->GetGlobalId();
|
||||
auto it = frame_id_map_.find(global_id);
|
||||
if (it == frame_id_map_.end()) {
|
||||
return;
|
||||
}
|
||||
DCHECK(it != frame_id_map_.end());
|
||||
|
||||
auto frame_info = it->second;
|
||||
|
||||
browser_->request_context()->OnRenderFrameDeleted(global_id,
|
||||
frame_info->is_main_frame_);
|
||||
browser_->request_context()->OnRenderFrameDeleted(
|
||||
global_id, frame_info->is_main_frame_, frame_info->is_guest_view_);
|
||||
|
||||
// Remove from the lookup maps.
|
||||
frame_id_map_.erase(it);
|
||||
|
||||
{
|
||||
auto it2 = frame_token_to_id_map_.find(host->GetGlobalFrameToken());
|
||||
DCHECK(it2 != frame_token_to_id_map_.end());
|
||||
frame_token_to_id_map_.erase(it2);
|
||||
}
|
||||
|
||||
// And finally delete the frame info.
|
||||
{
|
||||
auto it2 = frame_info_set_.find(frame_info);
|
||||
@@ -278,24 +265,34 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::CreateTempSubFrame(
|
||||
parent = GetMainFrame();
|
||||
}
|
||||
// Intentionally not notifying for temporary frames.
|
||||
return new CefFrameHostImpl(this, parent->frame_token());
|
||||
return new CefFrameHostImpl(this, parent->GetIdentifier());
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForHost(
|
||||
const content::RenderFrameHost* host,
|
||||
bool* is_guest_view,
|
||||
bool prefer_speculative) const {
|
||||
if (is_guest_view) {
|
||||
*is_guest_view = false;
|
||||
}
|
||||
|
||||
if (!host) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return GetFrameForGlobalId(
|
||||
const_cast<content::RenderFrameHost*>(host)->GetGlobalId(),
|
||||
const_cast<content::RenderFrameHost*>(host)->GetGlobalId(), is_guest_view,
|
||||
prefer_speculative);
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view,
|
||||
bool prefer_speculative) const {
|
||||
if (is_guest_view) {
|
||||
*is_guest_view = false;
|
||||
}
|
||||
|
||||
if (!frame_util::IsValidGlobalId(global_id)) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -306,6 +303,13 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForGlobalId(
|
||||
if (it != frame_id_map_.end()) {
|
||||
const auto info = it->second;
|
||||
|
||||
if (info->is_guest_view_) {
|
||||
if (is_guest_view) {
|
||||
*is_guest_view = true;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (info->is_speculative_ && !prefer_speculative) {
|
||||
if (info->is_main_frame_ && main_frame_) {
|
||||
// Always prefer the non-speculative main frame.
|
||||
@@ -323,27 +327,6 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForGlobalId(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForGlobalToken(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
bool prefer_speculative) const {
|
||||
if (!frame_util::IsValidGlobalToken(global_token)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::GlobalRenderFrameHostId global_id;
|
||||
|
||||
{
|
||||
base::AutoLock lock_scope(lock_);
|
||||
const auto it = frame_token_to_id_map_.find(global_token);
|
||||
if (it == frame_token_to_id_map_.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
global_id = it->second;
|
||||
}
|
||||
|
||||
return GetFrameForGlobalId(global_id, prefer_speculative);
|
||||
}
|
||||
|
||||
CefBrowserInfo::FrameHostList CefBrowserInfo::GetAllFrames() const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
FrameHostList frames;
|
||||
@@ -525,7 +508,6 @@ void CefBrowserInfo::RemoveAllFrames(
|
||||
|
||||
// Clear the lookup maps.
|
||||
frame_id_map_.clear();
|
||||
frame_token_to_id_map_.clear();
|
||||
|
||||
// Explicitly Detach everything but the current main frame.
|
||||
for (auto& info : frame_info_set_) {
|
||||
@@ -560,8 +542,7 @@ CefBrowserInfo::NotificationStateLock::NotificationStateLock(
|
||||
}
|
||||
|
||||
// Take the browser info state lock.
|
||||
browser_info_lock_scope_ =
|
||||
std::make_unique<base::AutoLock>(browser_info_->lock_);
|
||||
browser_info_lock_scope_.reset(new base::AutoLock(browser_info_->lock_));
|
||||
}
|
||||
|
||||
CefBrowserInfo::NotificationStateLock::~NotificationStateLock() {
|
||||
|
@@ -37,7 +37,6 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
CefBrowserInfo(int browser_id,
|
||||
bool is_popup,
|
||||
bool is_windowless,
|
||||
bool print_preview_enabled,
|
||||
CefRefPtr<CefDictionaryValue> extra_info);
|
||||
|
||||
CefBrowserInfo(const CefBrowserInfo&) = delete;
|
||||
@@ -46,7 +45,6 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
int browser_id() const { return browser_id_; }
|
||||
bool is_popup() const { return is_popup_; }
|
||||
bool is_windowless() const { return is_windowless_; }
|
||||
bool print_preview_enabled() const { return print_preview_enabled_; }
|
||||
CefRefPtr<CefDictionaryValue> extra_info() const { return extra_info_; }
|
||||
|
||||
// May return NULL if the browser has not yet been created or if the browser
|
||||
@@ -67,8 +65,10 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
// Ensure that a frame record exists for |host|. Called for the main frame
|
||||
// when the RenderView is created, or for a sub-frame when the associated
|
||||
// RenderFrame is created in the renderer process.
|
||||
// Called from CefBrowserContentsDelegate::RenderFrameCreated.
|
||||
void MaybeCreateFrame(content::RenderFrameHost* host);
|
||||
// Called from CefBrowserContentsDelegate::RenderFrameCreated (is_guest_view =
|
||||
// false) or CefMimeHandlerViewGuestDelegate::OnGuestAttached (is_guest_view =
|
||||
// true).
|
||||
void MaybeCreateFrame(content::RenderFrameHost* host, bool is_guest_view);
|
||||
|
||||
// Used to track state changes such as entering/exiting the BackForwardCache.
|
||||
// Called from CefBrowserContentsDelegate::RenderFrameHostStateChanged.
|
||||
@@ -100,22 +100,28 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
const content::GlobalRenderFrameHostId& parent_global_id);
|
||||
|
||||
// Returns the frame object matching the specified host or nullptr if no match
|
||||
// is found. Must be called on the UI thread.
|
||||
// is found. Nullptr will also be returned if a guest view match is found
|
||||
// because we don't create frame objects for guest views. If |is_guest_view|
|
||||
// is non-nullptr it will be set to true in this case. Must be called on the
|
||||
// UI thread.
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForHost(
|
||||
const content::RenderFrameHost* host,
|
||||
bool* is_guest_view = nullptr,
|
||||
bool prefer_speculative = false) const;
|
||||
|
||||
// Returns the frame object matching the specified ID/token or nullptr if no
|
||||
// match is found. Safe to call from any thread.
|
||||
// Returns the frame object matching the specified ID or nullptr if no match
|
||||
// is found. Nullptr will also be returned if a guest view match is found
|
||||
// because we don't create frame objects for guest views. If |is_guest_view|
|
||||
// is non-nullptr it will be set to true in this case. Safe to call from any
|
||||
// thread.
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForGlobalId(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool prefer_speculative = false) const;
|
||||
CefRefPtr<CefFrameHostImpl> GetFrameForGlobalToken(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
bool* is_guest_view = nullptr,
|
||||
bool prefer_speculative = false) const;
|
||||
|
||||
// Returns all non-speculative frame objects that currently exist. Safe to
|
||||
// call from any thread.
|
||||
// Returns all non-speculative frame objects that currently exist. Guest views
|
||||
// will be excluded because they don't have a frame object. Safe to call from
|
||||
// any thread.
|
||||
using FrameHostList = std::set<CefRefPtr<CefFrameHostImpl>>;
|
||||
FrameHostList GetAllFrames() const;
|
||||
|
||||
@@ -124,9 +130,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
friend class CefBrowserInfo;
|
||||
friend class base::RefCounted<NavigationLock>;
|
||||
|
||||
// All usage is via friend declaration. NOLINTNEXTLINE
|
||||
NavigationLock();
|
||||
// All usage is via friend declaration. NOLINTNEXTLINE
|
||||
~NavigationLock();
|
||||
|
||||
base::OnceClosure pending_action_;
|
||||
@@ -172,6 +176,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
|
||||
content::RenderFrameHost* host_;
|
||||
content::GlobalRenderFrameHostId global_id_;
|
||||
bool is_guest_view_;
|
||||
bool is_main_frame_;
|
||||
bool is_speculative_;
|
||||
bool is_in_bfcache_ = false;
|
||||
@@ -190,10 +195,9 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
|
||||
void RemoveAllFrames(CefRefPtr<CefBrowserHostBase> old_browser);
|
||||
|
||||
const int browser_id_;
|
||||
const bool is_popup_;
|
||||
const bool is_windowless_;
|
||||
const bool print_preview_enabled_;
|
||||
int browser_id_;
|
||||
bool is_popup_;
|
||||
bool is_windowless_;
|
||||
CefRefPtr<CefDictionaryValue> extra_info_;
|
||||
|
||||
// Navigation will be blocked while |navigation_lock_| exists.
|
||||
@@ -242,11 +246,6 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
content::GlobalRenderFrameHostIdHasher>;
|
||||
FrameIDMap frame_id_map_;
|
||||
|
||||
// Map of global token to global ID.
|
||||
using FrameTokenToIdMap = std::map<content::GlobalRenderFrameHostToken,
|
||||
content::GlobalRenderFrameHostId>;
|
||||
FrameTokenToIdMap frame_token_to_id_map_;
|
||||
|
||||
// The current main frame.
|
||||
CefRefPtr<CefFrameHostImpl> main_frame_;
|
||||
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
#include "libcef/features/runtime.h"
|
||||
#include "libcef/features/runtime_checks.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/logging.h"
|
||||
@@ -66,13 +66,11 @@ CefBrowserInfoManager* CefBrowserInfoManager::GetInstance() {
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreateBrowserInfo(
|
||||
bool is_popup,
|
||||
bool is_windowless,
|
||||
bool print_preview_enabled,
|
||||
CefRefPtr<CefDictionaryValue> extra_info) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
scoped_refptr<CefBrowserInfo> browser_info =
|
||||
new CefBrowserInfo(++next_browser_id_, is_popup, is_windowless,
|
||||
print_preview_enabled, extra_info);
|
||||
scoped_refptr<CefBrowserInfo> browser_info = new CefBrowserInfo(
|
||||
++next_browser_id_, is_popup, is_windowless, extra_info);
|
||||
browser_info_list_.push_back(browser_info);
|
||||
|
||||
return browser_info;
|
||||
@@ -81,23 +79,23 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreateBrowserInfo(
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
|
||||
content::WebContents* new_contents,
|
||||
bool is_windowless,
|
||||
bool print_preview_enabled,
|
||||
CefRefPtr<CefDictionaryValue> extra_info) {
|
||||
CEF_REQUIRE_UIT();
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
auto frame_host = new_contents->GetPrimaryMainFrame();
|
||||
|
||||
scoped_refptr<CefBrowserInfo> browser_info;
|
||||
{
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
browser_info = new CefBrowserInfo(++next_browser_id_, true, is_windowless,
|
||||
print_preview_enabled, extra_info);
|
||||
browser_info_list_.push_back(browser_info);
|
||||
}
|
||||
scoped_refptr<CefBrowserInfo> browser_info =
|
||||
new CefBrowserInfo(++next_browser_id_, true, is_windowless, extra_info);
|
||||
browser_info_list_.push_back(browser_info);
|
||||
|
||||
// Continue any pending NewBrowserInfo request.
|
||||
ContinueNewBrowserInfo(frame_host->GetGlobalFrameToken(), browser_info,
|
||||
/*is_excluded=*/false);
|
||||
auto it = pending_new_browser_info_map_.find(frame_host->GetGlobalId());
|
||||
if (it != pending_new_browser_info_map_.end()) {
|
||||
SendNewBrowserInfoResponse(browser_info, /*is_guest_view=*/false,
|
||||
std::move(it->second->callback),
|
||||
it->second->callback_runner);
|
||||
pending_new_browser_info_map_.erase(it);
|
||||
}
|
||||
|
||||
return browser_info;
|
||||
}
|
||||
@@ -130,7 +128,10 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
bool handled = false;
|
||||
|
||||
CefWindowInfo window_info;
|
||||
CefBrowserCreateParams::InitWindowInfo(&window_info, browser.get());
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
window_info.SetAsPopup(nullptr, CefString());
|
||||
#endif
|
||||
|
||||
auto pending_popup = std::make_unique<CefBrowserInfoManager::PendingPopup>();
|
||||
pending_popup->step = PendingPopup::CAN_CREATE_WINDOW;
|
||||
@@ -183,12 +184,10 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
|
||||
if (allow) {
|
||||
CefBrowserCreateParams create_params;
|
||||
create_params.MaybeSetWindowInfo(window_info, /*allow_alloy_style=*/true,
|
||||
/*allow_chrome_style=*/true);
|
||||
create_params.MaybeSetWindowInfo(window_info);
|
||||
|
||||
if (!handled) {
|
||||
// Use default Browser creation with Chrome style if OnBeforePopup was
|
||||
// unhandled.
|
||||
// Use default Browser creation if OnBeforePopup was unhandled.
|
||||
// TODO(chrome): Expose a mechanism for the client to choose default
|
||||
// creation.
|
||||
pending_popup->use_default_browser_creation = true;
|
||||
@@ -196,10 +195,6 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
|
||||
create_params.popup_with_views_hosted_opener = ShouldCreateViewsHostedPopup(
|
||||
browser, pending_popup->use_default_browser_creation);
|
||||
|
||||
// Potentially use Alloy style with the Chrome runtime.
|
||||
create_params.popup_with_alloy_style_opener = browser->IsAlloyStyle();
|
||||
|
||||
create_params.settings = pending_popup->settings;
|
||||
create_params.client = pending_popup->client;
|
||||
create_params.extra_info = pending_popup->extra_info;
|
||||
@@ -208,11 +203,6 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
CefBrowserPlatformDelegate::Create(create_params);
|
||||
CHECK(pending_popup->platform_delegate.get());
|
||||
|
||||
// Expect runtime style to match.
|
||||
pending_popup->alloy_style = !create_params.IsChromeStyle();
|
||||
CHECK_EQ(pending_popup->alloy_style,
|
||||
pending_popup->platform_delegate->IsAlloyStyle());
|
||||
|
||||
// Between the calls to CanCreateWindow and GetCustomWebContentsView
|
||||
// RenderViewHostImpl::CreateNewWindow() will call
|
||||
// RenderProcessHostImpl::FilterURL() which, in the case of "javascript:"
|
||||
@@ -232,9 +222,9 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
|
||||
content::WebContentsView** view,
|
||||
content::RenderViewHostDelegateView** delegate_view) {
|
||||
CEF_REQUIRE_UIT();
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
|
||||
auto pending_popup = PopPendingPopup(PendingPopup::CAN_CREATE_WINDOW,
|
||||
PendingPopup::CAN_CREATE_WINDOW,
|
||||
opener_global_id, target_url);
|
||||
DCHECK(pending_popup.get());
|
||||
DCHECK(pending_popup->platform_delegate.get());
|
||||
@@ -258,10 +248,13 @@ void CefBrowserInfoManager::WebContentsCreated(
|
||||
content::WebContents* new_contents) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// GET_CUSTOM_WEB_CONTENTS_VIEW is only used with Alloy style.
|
||||
auto pending_popup = PopPendingPopup(
|
||||
PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW,
|
||||
PendingPopup::CAN_CREATE_WINDOW, opener_global_id, target_url);
|
||||
// GET_CUSTOM_WEB_CONTENTS_VIEW is only used with the alloy runtime.
|
||||
const auto previous_step = cef::IsAlloyRuntimeEnabled()
|
||||
? PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW
|
||||
: PendingPopup::CAN_CREATE_WINDOW;
|
||||
|
||||
auto pending_popup =
|
||||
PopPendingPopup(previous_step, opener_global_id, target_url);
|
||||
DCHECK(pending_popup.get());
|
||||
DCHECK(pending_popup->platform_delegate.get());
|
||||
|
||||
@@ -270,8 +263,8 @@ void CefBrowserInfoManager::WebContentsCreated(
|
||||
platform_delegate = std::move(pending_popup->platform_delegate);
|
||||
extra_info = pending_popup->extra_info;
|
||||
|
||||
// AddWebContents (the next step) is only used with Chrome style.
|
||||
if (!pending_popup->alloy_style) {
|
||||
// AddWebContents (the next step) is only used with the Chrome runtime.
|
||||
if (cef::IsChromeRuntimeEnabled()) {
|
||||
pending_popup->step = PendingPopup::WEB_CONTENTS_CREATED;
|
||||
pending_popup->new_contents = new_contents;
|
||||
PushPendingPopup(std::move(pending_popup));
|
||||
@@ -286,10 +279,8 @@ bool CefBrowserInfoManager::AddWebContents(content::WebContents* new_contents) {
|
||||
// chrome::AddWebContents is called directly from the Chrome UI (profile
|
||||
// settings, etc).
|
||||
auto pending_popup =
|
||||
PopPendingPopup(PendingPopup::WEB_CONTENTS_CREATED,
|
||||
PendingPopup::WEB_CONTENTS_CREATED, new_contents);
|
||||
PopPendingPopup(PendingPopup::WEB_CONTENTS_CREATED, new_contents);
|
||||
if (pending_popup) {
|
||||
DCHECK(!pending_popup->alloy_style);
|
||||
return !pending_popup->use_default_browser_creation;
|
||||
}
|
||||
|
||||
@@ -298,39 +289,41 @@ bool CefBrowserInfoManager::AddWebContents(content::WebContents* new_contents) {
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback) {
|
||||
DCHECK(frame_util::IsValidGlobalToken(global_token));
|
||||
DCHECK(frame_util::IsValidGlobalId(global_id));
|
||||
DCHECK(callback);
|
||||
|
||||
auto callback_runner = base::SequencedTaskRunner::GetCurrentDefault();
|
||||
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
bool is_guest_view = false;
|
||||
|
||||
scoped_refptr<CefBrowserInfo> browser_info =
|
||||
GetBrowserInfoInternal(global_token);
|
||||
GetBrowserInfoInternal(global_id, &is_guest_view);
|
||||
|
||||
if (browser_info) {
|
||||
// Send the response immediately.
|
||||
SendNewBrowserInfoResponse(browser_info, /*is_excluded=*/false,
|
||||
std::move(callback), callback_runner);
|
||||
SendNewBrowserInfoResponse(browser_info, is_guest_view, std::move(callback),
|
||||
callback_runner);
|
||||
return;
|
||||
}
|
||||
|
||||
// Verify that no request for the same route is currently queued.
|
||||
DCHECK(pending_new_browser_info_map_.find(global_token) ==
|
||||
DCHECK(pending_new_browser_info_map_.find(global_id) ==
|
||||
pending_new_browser_info_map_.end());
|
||||
|
||||
const int timeout_id = ++next_timeout_id_;
|
||||
|
||||
// Queue the request.
|
||||
std::unique_ptr<PendingNewBrowserInfo> pending(new PendingNewBrowserInfo());
|
||||
pending->global_token = global_token;
|
||||
pending->global_id = global_id;
|
||||
pending->timeout_id = timeout_id;
|
||||
pending->callback = std::move(callback);
|
||||
pending->callback_runner = callback_runner;
|
||||
pending_new_browser_info_map_.insert(
|
||||
std::make_pair(global_token, std::move(pending)));
|
||||
std::make_pair(global_id, std::move(pending)));
|
||||
|
||||
// Register a timeout for the pending response so that the renderer process
|
||||
// doesn't hang forever. With the Chrome runtime, timeouts may occur in cases
|
||||
@@ -341,57 +334,9 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
||||
CEF_POST_DELAYED_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBrowserInfoManager::TimeoutNewBrowserInfoResponse,
|
||||
global_token, timeout_id),
|
||||
global_id, timeout_id),
|
||||
kNewBrowserInfoResponseTimeoutMs);
|
||||
}
|
||||
|
||||
// Check for excluded content (PDF viewer or print preview).
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(
|
||||
&CefBrowserInfoManager::CheckExcludedNewBrowserInfoOnUIThread,
|
||||
global_token));
|
||||
}
|
||||
|
||||
// static
|
||||
void CefBrowserInfoManager::CheckExcludedNewBrowserInfoOnUIThread(
|
||||
const content::GlobalRenderFrameHostToken& global_token) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!g_info_manager) {
|
||||
return;
|
||||
}
|
||||
|
||||
// May return nullptr for PDF renderer process.
|
||||
auto* rfh = content::RenderFrameHost::FromFrameToken(global_token);
|
||||
if (!rfh) {
|
||||
return;
|
||||
}
|
||||
|
||||
// PDF viewer and print preview create multiple renderer processes. These
|
||||
// excluded processes are not tracked by CefBrowserInfo.
|
||||
CefBrowserInfo* browser_info;
|
||||
bool is_excluded;
|
||||
GetFrameHost(rfh, /*prefer_speculative=*/true, &browser_info, &is_excluded);
|
||||
if (browser_info && is_excluded) {
|
||||
g_info_manager->ContinueNewBrowserInfo(global_token, browser_info,
|
||||
/*is_excluded=*/true);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::ContinueNewBrowserInfo(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
bool is_excluded) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
||||
// Continue any pending NewBrowserInfo request.
|
||||
auto it = pending_new_browser_info_map_.find(global_token);
|
||||
if (it != pending_new_browser_info_map_.end()) {
|
||||
SendNewBrowserInfoResponse(browser_info, is_excluded,
|
||||
std::move(it->second->callback),
|
||||
it->second->callback_runner);
|
||||
pending_new_browser_info_map_.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::RemoveBrowserInfo(
|
||||
@@ -440,15 +385,10 @@ void CefBrowserInfoManager::DestroyAllBrowsers() {
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo(
|
||||
const content::GlobalRenderFrameHostId& global_id) {
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
return GetBrowserInfoInternal(global_id);
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo(
|
||||
const content::GlobalRenderFrameHostToken& global_token) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
return GetBrowserInfoInternal(global_token);
|
||||
return GetBrowserInfoInternal(global_id, is_guest_view);
|
||||
}
|
||||
|
||||
bool CefBrowserInfoManager::MaybeAllowNavigation(
|
||||
@@ -457,14 +397,15 @@ bool CefBrowserInfoManager::MaybeAllowNavigation(
|
||||
CefRefPtr<CefBrowserHostBase>& browser_out) const {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
auto browser = CefBrowserHostBase::GetBrowserForHost(opener);
|
||||
bool is_guest_view = false;
|
||||
auto browser = extensions::GetOwnerBrowserForHost(opener, &is_guest_view);
|
||||
if (!browser) {
|
||||
// Print preview uses a modal dialog where we don't own the WebContents.
|
||||
// Allow that navigation to proceed.
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!browser->MaybeAllowNavigation(opener, params)) {
|
||||
if (!browser->MaybeAllowNavigation(opener, is_guest_view, params)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -485,83 +426,6 @@ bool CefBrowserInfoManager::ShouldCreateViewsHostedPopup(
|
||||
!use_default_browser_creation;
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfoManager::GetFrameHost(
|
||||
content::RenderFrameHost* rfh,
|
||||
bool prefer_speculative,
|
||||
CefBrowserInfo** browser_info,
|
||||
bool* is_excluded) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(rfh);
|
||||
|
||||
const bool is_pdf_process = rfh->GetProcess()->IsPdf();
|
||||
auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
|
||||
const bool is_browser_process_guest =
|
||||
extensions::IsBrowserPluginGuest(web_contents);
|
||||
const bool is_print_preview_dialog =
|
||||
extensions::IsPrintPreviewDialog(web_contents);
|
||||
|
||||
bool excluded =
|
||||
is_pdf_process || is_browser_process_guest || is_print_preview_dialog;
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> frame;
|
||||
|
||||
// A BrowserHost may match an excluded RFH type. Some associations are
|
||||
// registered directly via CefBrowserInfo::MaybeCreateFrame and some are
|
||||
// discovered indirectly via extensions::GetOwnerForGuestContents.
|
||||
auto browser = CefBrowserHostBase::GetBrowserForHost(rfh);
|
||||
if (browser && !excluded) {
|
||||
frame = browser->browser_info()->GetFrameForHost(rfh, prefer_speculative);
|
||||
}
|
||||
|
||||
if (browser_info) {
|
||||
*browser_info = browser ? browser->browser_info().get() : nullptr;
|
||||
}
|
||||
|
||||
if (is_excluded) {
|
||||
*is_excluded = excluded;
|
||||
}
|
||||
|
||||
if (VLOG_IS_ON(1)) {
|
||||
const std::string& debug_string =
|
||||
frame_util::GetFrameDebugString(rfh->GetGlobalFrameToken());
|
||||
const bool is_main = rfh->GetParent() == nullptr;
|
||||
|
||||
VLOG(1) << "frame " << debug_string << ", pdf_process=" << is_pdf_process
|
||||
<< ", browser_process_guest=" << is_browser_process_guest
|
||||
<< ", print_preview_dialog=" << is_print_preview_dialog
|
||||
<< ", main=" << is_main << (browser ? "" : ", has no BrowserHost")
|
||||
<< (frame ? "" : ", has no FrameHost");
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefBrowserInfoManager::IsExcludedFrameHost(content::RenderFrameHost* rfh) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(rfh);
|
||||
|
||||
const bool is_pdf_process = rfh->GetProcess()->IsPdf();
|
||||
if (is_pdf_process) {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto* web_contents = content::WebContents::FromRenderFrameHost(rfh);
|
||||
const bool is_browser_process_guest =
|
||||
extensions::IsBrowserPluginGuest(web_contents);
|
||||
if (is_browser_process_guest) {
|
||||
return true;
|
||||
}
|
||||
const bool is_print_preview_dialog =
|
||||
extensions::IsPrintPreviewDialog(web_contents);
|
||||
if (is_print_preview_dialog) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CefBrowserInfoManager::BrowserInfoList
|
||||
CefBrowserInfoManager::GetBrowserInfoList() {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
@@ -587,7 +451,7 @@ void CefBrowserInfoManager::RenderProcessHostDestroyed(
|
||||
pending_new_browser_info_map_.begin();
|
||||
while (it != pending_new_browser_info_map_.end()) {
|
||||
const auto& info = it->second;
|
||||
if (info->global_token.child_id == render_process_id) {
|
||||
if (info->global_id.child_id == render_process_id) {
|
||||
CancelNewBrowserInfoResponse(info.get());
|
||||
it = pending_new_browser_info_map_.erase(it);
|
||||
} else {
|
||||
@@ -618,21 +482,16 @@ void CefBrowserInfoManager::PushPendingPopup(
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup>
|
||||
CefBrowserInfoManager::PopPendingPopup(
|
||||
PendingPopup::Step previous_step_alloy,
|
||||
PendingPopup::Step previous_step_chrome,
|
||||
PendingPopup::Step previous_step,
|
||||
const content::GlobalRenderFrameHostId& opener_global_id,
|
||||
const GURL& target_url) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(frame_util::IsValidGlobalId(opener_global_id));
|
||||
DCHECK_LE(previous_step_alloy, PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW);
|
||||
DCHECK_LE(previous_step_chrome, PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW);
|
||||
DCHECK_LE(previous_step, PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW);
|
||||
|
||||
PendingPopupList::iterator it = pending_popup_list_.begin();
|
||||
for (; it != pending_popup_list_.end(); ++it) {
|
||||
PendingPopup* popup = it->get();
|
||||
const auto previous_step =
|
||||
popup->alloy_style ? previous_step_alloy : previous_step_chrome;
|
||||
|
||||
if (popup->step == previous_step &&
|
||||
popup->opener_global_id == opener_global_id &&
|
||||
popup->target_url == target_url) {
|
||||
@@ -647,19 +506,14 @@ CefBrowserInfoManager::PopPendingPopup(
|
||||
}
|
||||
|
||||
std::unique_ptr<CefBrowserInfoManager::PendingPopup>
|
||||
CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step previous_step_alloy,
|
||||
PendingPopup::Step previous_step_chrome,
|
||||
CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step previous_step,
|
||||
content::WebContents* new_contents) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK_GE(previous_step_alloy, PendingPopup::WEB_CONTENTS_CREATED);
|
||||
DCHECK_GE(previous_step_chrome, PendingPopup::WEB_CONTENTS_CREATED);
|
||||
DCHECK_GE(previous_step, PendingPopup::WEB_CONTENTS_CREATED);
|
||||
|
||||
PendingPopupList::iterator it = pending_popup_list_.begin();
|
||||
for (; it != pending_popup_list_.end(); ++it) {
|
||||
PendingPopup* popup = it->get();
|
||||
const auto previous_step =
|
||||
popup->alloy_style ? previous_step_alloy : previous_step_chrome;
|
||||
|
||||
if (popup->step == previous_step && popup->new_contents == new_contents) {
|
||||
// Transfer ownership of the pointer.
|
||||
it->release();
|
||||
@@ -672,34 +526,26 @@ CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step previous_step_alloy,
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfoInternal(
|
||||
const content::GlobalRenderFrameHostId& global_id) {
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view) {
|
||||
browser_info_lock_.AssertAcquired();
|
||||
|
||||
if (is_guest_view) {
|
||||
*is_guest_view = false;
|
||||
}
|
||||
|
||||
if (!frame_util::IsValidGlobalId(global_id)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (const auto& browser_info : browser_info_list_) {
|
||||
auto frame = browser_info->GetFrameForGlobalId(global_id);
|
||||
if (frame) {
|
||||
return browser_info;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfoInternal(
|
||||
const content::GlobalRenderFrameHostToken& global_token) {
|
||||
browser_info_lock_.AssertAcquired();
|
||||
|
||||
if (!frame_util::IsValidGlobalToken(global_token)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (const auto& browser_info : browser_info_list_) {
|
||||
auto frame = browser_info->GetFrameForGlobalToken(global_token);
|
||||
if (frame) {
|
||||
bool is_guest_view_tmp;
|
||||
auto frame =
|
||||
browser_info->GetFrameForGlobalId(global_id, &is_guest_view_tmp);
|
||||
if (frame || is_guest_view_tmp) {
|
||||
if (is_guest_view) {
|
||||
*is_guest_view = is_guest_view_tmp;
|
||||
}
|
||||
return browser_info;
|
||||
}
|
||||
}
|
||||
@@ -710,26 +556,25 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfoInternal(
|
||||
// static
|
||||
void CefBrowserInfoManager::SendNewBrowserInfoResponse(
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
bool is_excluded,
|
||||
bool is_guest_view,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback,
|
||||
scoped_refptr<base::SequencedTaskRunner> callback_runner) {
|
||||
if (!callback_runner->RunsTasksInCurrentSequence()) {
|
||||
callback_runner->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(&CefBrowserInfoManager::SendNewBrowserInfoResponse,
|
||||
browser_info, is_excluded, std::move(callback),
|
||||
browser_info, is_guest_view, std::move(callback),
|
||||
callback_runner));
|
||||
return;
|
||||
}
|
||||
|
||||
auto params = cef::mojom::NewBrowserInfo::New();
|
||||
params->is_excluded = is_excluded;
|
||||
params->is_guest_view = is_guest_view;
|
||||
|
||||
if (browser_info) {
|
||||
params->browser_id = browser_info->browser_id();
|
||||
params->is_windowless = browser_info->is_windowless();
|
||||
params->is_popup = browser_info->is_popup();
|
||||
params->print_preview_enabled = browser_info->print_preview_enabled();
|
||||
|
||||
auto extra_info = browser_info->extra_info();
|
||||
if (extra_info) {
|
||||
@@ -749,14 +594,14 @@ void CefBrowserInfoManager::SendNewBrowserInfoResponse(
|
||||
// static
|
||||
void CefBrowserInfoManager::CancelNewBrowserInfoResponse(
|
||||
PendingNewBrowserInfo* pending_info) {
|
||||
SendNewBrowserInfoResponse(/*browser_info=*/nullptr, /*is_excluded=*/false,
|
||||
SendNewBrowserInfoResponse(/*browser_info=*/nullptr, /*is_guest_view=*/false,
|
||||
std::move(pending_info->callback),
|
||||
pending_info->callback_runner);
|
||||
}
|
||||
|
||||
// static
|
||||
void CefBrowserInfoManager::TimeoutNewBrowserInfoResponse(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
int timeout_id) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!g_info_manager) {
|
||||
@@ -766,7 +611,7 @@ void CefBrowserInfoManager::TimeoutNewBrowserInfoResponse(
|
||||
base::AutoLock lock_scope(g_info_manager->browser_info_lock_);
|
||||
|
||||
// Continue the NewBrowserInfo request if it's still pending.
|
||||
auto it = g_info_manager->pending_new_browser_info_map_.find(global_token);
|
||||
auto it = g_info_manager->pending_new_browser_info_map_.find(global_id);
|
||||
if (it != g_info_manager->pending_new_browser_info_map_.end()) {
|
||||
const auto& pending_info = it->second;
|
||||
// Don't accidentally timeout a new request for the same frame.
|
||||
@@ -774,21 +619,15 @@ void CefBrowserInfoManager::TimeoutNewBrowserInfoResponse(
|
||||
return;
|
||||
}
|
||||
|
||||
// Cases where we expect to time out are:
|
||||
// - With the Chrome runtime when chrome::AddWebContents or
|
||||
// WebContents::Create are called directly from the Chrome UI (profile
|
||||
// settings, etc). A RFH will exist without a matching CefBrowserHost.
|
||||
// - When the PDF renderer is loaded in the print preview dialog. There will
|
||||
// be no RFH in this case.
|
||||
// Any additional cases should be debugged and, if possible,
|
||||
// extensions::GetOwnerForGuestContents should be improved to find the
|
||||
// associated CefBrowserHost.
|
||||
const bool has_rfh =
|
||||
!!content::RenderFrameHost::FromFrameToken(global_token);
|
||||
#if DCHECK_IS_ON()
|
||||
// This method should never be called for a PDF renderer.
|
||||
content::RenderProcessHost* process =
|
||||
content::RenderProcessHost::FromID(global_id.child_id);
|
||||
DCHECK(!process || !process->IsPdf());
|
||||
#endif
|
||||
|
||||
LOG(ERROR) << "Timeout of new browser info response for frame "
|
||||
<< frame_util::GetFrameDebugString(global_token)
|
||||
<< " (has_rfh=" << has_rfh << ")";
|
||||
<< frame_util::GetFrameDebugString(global_id);
|
||||
|
||||
CancelNewBrowserInfoResponse(pending_info.get());
|
||||
g_info_manager->pending_new_browser_info_map_.erase(it);
|
||||
|
@@ -58,7 +58,6 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
scoped_refptr<CefBrowserInfo> CreateBrowserInfo(
|
||||
bool is_popup,
|
||||
bool is_windowless,
|
||||
bool print_preview_enabled,
|
||||
CefRefPtr<CefDictionaryValue> extra_info);
|
||||
|
||||
// Called from WebContentsDelegate::WebContentsCreated when a new browser is
|
||||
@@ -68,7 +67,6 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
scoped_refptr<CefBrowserInfo> CreatePopupBrowserInfo(
|
||||
content::WebContents* new_contents,
|
||||
bool is_windowless,
|
||||
bool print_preview_enabled,
|
||||
CefRefPtr<CefDictionaryValue> extra_info);
|
||||
|
||||
// Called from ContentBrowserClient::CanCreateWindow. See comments on
|
||||
@@ -110,11 +108,11 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// browser info to the renderer process. If the browser info already exists
|
||||
// the response will be sent immediately. Otherwise, the response will be sent
|
||||
// when CreatePopupBrowserInfo creates the browser info. The info will already
|
||||
// exist for explicitly created browsers. It may sometimes already exist for
|
||||
// traditional popup browsers depending on timing. See comments on
|
||||
// PendingPopup for more information.
|
||||
// exist for explicitly created browsers and guest views. It may sometimes
|
||||
// already exist for traditional popup browsers depending on timing. See
|
||||
// comments on PendingPopup for more information.
|
||||
void OnGetNewBrowserInfo(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback);
|
||||
|
||||
// Called from CefBrowserHostBase::DestroyBrowser() when a browser is
|
||||
@@ -124,13 +122,15 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// Called from CefContext::FinishShutdownOnUIThread() to destroy all browsers.
|
||||
void DestroyAllBrowsers();
|
||||
|
||||
// Returns the CefBrowserInfo matching the specified ID/token or nullptr if no
|
||||
// Returns the CefBrowserInfo matching the specified ID or nullptr if no
|
||||
// match is found. It is allowed to add new callers of this method but
|
||||
// consider using CefBrowserHostBase::GetBrowserForGlobalId/Token() instead.
|
||||
// consider using CefBrowserHostBase::GetBrowserForGlobalId() or
|
||||
// extensions::GetOwnerBrowserForGlobalId() instead. If |is_guest_view| is
|
||||
// non-nullptr it will be set to true if the ID matches a guest view
|
||||
// associated with the returned browser info instead of the browser itself.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfo(
|
||||
const content::GlobalRenderFrameHostId& global_id);
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfo(
|
||||
const content::GlobalRenderFrameHostToken& global_token);
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view = nullptr);
|
||||
|
||||
// Returns all existing CefBrowserInfo objects.
|
||||
using BrowserInfoList = std::list<scoped_refptr<CefBrowserInfo>>;
|
||||
@@ -146,18 +146,6 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
static bool ShouldCreateViewsHostedPopup(CefRefPtr<CefBrowserHostBase> opener,
|
||||
bool use_default_browser_creation);
|
||||
|
||||
// Returns the FrameHost associated with |rfh|, if any. |browser_info| and
|
||||
// |is_excluded| will be populated if non-nullptr. An excluded type will not
|
||||
// have a FrameHost but |browser_info| may still be populated if the
|
||||
// association is known.
|
||||
static CefRefPtr<CefFrameHostImpl> GetFrameHost(content::RenderFrameHost* rfh,
|
||||
bool prefer_speculative,
|
||||
CefBrowserInfo** browser_info,
|
||||
bool* is_excluded);
|
||||
|
||||
// Returns true if |rfh| should be excluded (no FrameHost created).
|
||||
static bool IsExcludedFrameHost(content::RenderFrameHost* rfh);
|
||||
|
||||
private:
|
||||
// RenderProcessHostObserver methods:
|
||||
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
|
||||
@@ -166,7 +154,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// - CanCreateWindow (UIT):
|
||||
// Provides an opportunity to cancel the popup (calls OnBeforePopup) and
|
||||
// creates the new platform delegate for the popup. If the popup owner is
|
||||
// an extension guest view (PDF viewer) then the popup is canceled and
|
||||
// an extension guest view then the popup is canceled and
|
||||
// WebContentsDelegate::OpenURLFromTab is called via the
|
||||
// CefBrowserHostBase::MaybeAllowNavigation implementation.
|
||||
// And then the following calls may occur at the same time:
|
||||
@@ -188,9 +176,6 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
WEB_CONTENTS_CREATED,
|
||||
} step;
|
||||
|
||||
// True if this popup is Alloy style, otherwise Chrome style.
|
||||
bool alloy_style;
|
||||
|
||||
// Initial state from ViewHostMsg_CreateWindow.
|
||||
// |target_url| will be empty if a popup is created via window.open() and
|
||||
// never navigated. For example: javascript:window.open();
|
||||
@@ -207,7 +192,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate;
|
||||
|
||||
// True if default Browser or tab creation should proceed from
|
||||
// AddWebContents (Chrome style only).
|
||||
// AddWebContents (chrome runtime only).
|
||||
bool use_default_browser_creation = false;
|
||||
|
||||
// The newly created WebContents (set in WebContentsCreated).
|
||||
@@ -219,42 +204,30 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
|
||||
// Used after CanCreateWindow is called.
|
||||
std::unique_ptr<PendingPopup> PopPendingPopup(
|
||||
PendingPopup::Step previous_step_alloy,
|
||||
PendingPopup::Step previous_step_chrome,
|
||||
PendingPopup::Step previous_step,
|
||||
const content::GlobalRenderFrameHostId& opener_global_id,
|
||||
const GURL& target_url);
|
||||
|
||||
// Used after WebContentsCreated is called.
|
||||
std::unique_ptr<PendingPopup> PopPendingPopup(
|
||||
PendingPopup::Step previous_step_alloy,
|
||||
PendingPopup::Step previous_step_chrome,
|
||||
PendingPopup::Step previous_step,
|
||||
content::WebContents* new_contents);
|
||||
|
||||
// Retrieves the BrowserInfo matching the specified ID/token.
|
||||
// Retrieves the BrowserInfo matching the specified ID.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoInternal(
|
||||
const content::GlobalRenderFrameHostId& global_id);
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoInternal(
|
||||
const content::GlobalRenderFrameHostToken& global_token);
|
||||
|
||||
// Check for excluded frames that can be responded to immediately.
|
||||
static void CheckExcludedNewBrowserInfoOnUIThread(
|
||||
const content::GlobalRenderFrameHostToken& global_token);
|
||||
|
||||
void ContinueNewBrowserInfo(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
bool is_excluded);
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view);
|
||||
|
||||
// Send the response for a pending OnGetNewBrowserInfo request.
|
||||
static void SendNewBrowserInfoResponse(
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
bool is_excluded,
|
||||
bool is_guest_view,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback,
|
||||
scoped_refptr<base::SequencedTaskRunner> callback_runner);
|
||||
|
||||
// Pending request for OnGetNewBrowserInfo.
|
||||
struct PendingNewBrowserInfo {
|
||||
content::GlobalRenderFrameHostToken global_token;
|
||||
content::GlobalRenderFrameHostId global_id;
|
||||
int timeout_id;
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback;
|
||||
scoped_refptr<base::SequencedTaskRunner> callback_runner;
|
||||
@@ -265,7 +238,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
|
||||
// Time out a response if it's still pending.
|
||||
static void TimeoutNewBrowserInfoResponse(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
int timeout_id);
|
||||
|
||||
mutable base::Lock browser_info_lock_;
|
||||
@@ -279,7 +252,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// identify a RFH for its complete lifespan. See documentation on
|
||||
// RenderFrameHost::GetFrameTreeNodeId() for background.
|
||||
using PendingNewBrowserInfoMap =
|
||||
std::map<content::GlobalRenderFrameHostToken,
|
||||
std::map<content::GlobalRenderFrameHostId,
|
||||
std::unique_ptr<PendingNewBrowserInfo>>;
|
||||
PendingNewBrowserInfoMap pending_new_browser_info_map_;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user