mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
80 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9bd638fc40 | ||
|
c712fb473a | ||
|
091246b436 | ||
|
30772e7742 | ||
|
ff7dcd851e | ||
|
a6e684abf1 | ||
|
fe315c5108 | ||
|
b6e819b329 | ||
|
6d871a1a27 | ||
|
77c1e82898 | ||
|
ccc63c9e55 | ||
|
e461d8f247 | ||
|
1482ffe749 | ||
|
c45f88643a | ||
|
e5bd17cd14 | ||
|
e011687449 | ||
|
6fafa6521f | ||
|
99cbd3571f | ||
|
326524d83f | ||
|
41036f7624 | ||
|
759cdc7584 | ||
|
8a9a766d6d | ||
|
7dbc1daaef | ||
|
e683ed880c | ||
|
54a9c26b92 | ||
|
6253e69b70 | ||
|
8ba22e9e11 | ||
|
19ba8b2b8d | ||
|
a13b6dc7f6 | ||
|
52dac91167 | ||
|
526e934a12 | ||
|
b8f91c5431 | ||
|
5e616b2df0 | ||
|
9b06b028dc | ||
|
d4cf19db29 | ||
|
2c5dd120c7 | ||
|
ffea0d9c4a | ||
|
8db08e657d | ||
|
706193f3d9 | ||
|
bfed26c5fc | ||
|
71c8b4b2bb | ||
|
ec122a9148 | ||
|
90775f149f | ||
|
f071a4a988 | ||
|
cc3d77eec5 | ||
|
a79981bf7f | ||
|
70471059cf | ||
|
5dc3cc13e7 | ||
|
da3899d142 | ||
|
69fd43f789 | ||
|
d3a483ef59 | ||
|
bdb070c85c | ||
|
57bad703ee | ||
|
47fe9f834a | ||
|
2f1e782f62 | ||
|
2a86a02bdd | ||
|
132ac7a180 | ||
|
a0446a3c8a | ||
|
a02d2ab3e6 | ||
|
4ea1b6f293 | ||
|
befa827da1 | ||
|
0a64bb6f9b | ||
|
9fd312ce04 | ||
|
468e55e553 | ||
|
f1fe098e09 | ||
|
5af6227a6f | ||
|
0d50d5a8c6 | ||
|
a097b62b6e | ||
|
ffc703276a | ||
|
3592d36808 | ||
|
deb4664038 | ||
|
9f6995f839 | ||
|
784302280b | ||
|
7c2bd75f7a | ||
|
3507249202 | ||
|
5a9b8e2bc4 | ||
|
9a45102db0 | ||
|
1f55d2e12f | ||
|
9dc7653ddc | ||
|
e4acacee18 |
49
BUILD.gn
49
BUILD.gn
@@ -620,6 +620,8 @@ 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",
|
||||
@@ -772,6 +774,8 @@ 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",
|
||||
@@ -807,7 +811,11 @@ 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",
|
||||
@@ -927,8 +935,8 @@ 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_dispatcher_delegate.cc",
|
||||
"libcef/renderer/extensions/extensions_dispatcher_delegate.h",
|
||||
"libcef/renderer/extensions/extensions_renderer_api_provider.cc",
|
||||
"libcef/renderer/extensions/extensions_renderer_api_provider.h",
|
||||
"libcef/renderer/extensions/extensions_renderer_client.cc",
|
||||
"libcef/renderer/extensions/extensions_renderer_client.h",
|
||||
"libcef/renderer/extensions/print_render_frame_helper_delegate.cc",
|
||||
@@ -1121,22 +1129,23 @@ source_set("libcef_static") {
|
||||
"libcef/common/util_linux.cc",
|
||||
]
|
||||
|
||||
if (ozone_platform_x11) {
|
||||
sources += [
|
||||
"libcef/browser/native/window_x11.cc",
|
||||
"libcef/browser/native/window_x11.h",
|
||||
]
|
||||
}
|
||||
|
||||
deps += [
|
||||
"//build/config/freetype",
|
||||
"//third_party/fontconfig",
|
||||
]
|
||||
|
||||
if (is_linux && !ozone_platform_x11) {
|
||||
deps += [
|
||||
"//third_party/angle:libEGL",
|
||||
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" ]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1476,6 +1485,20 @@ 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 = [
|
||||
@@ -1484,6 +1507,7 @@ group("cef_make_headers") {
|
||||
":make_pack_header_command_ids",
|
||||
":make_api_hash_header",
|
||||
":make_config_header",
|
||||
":make_colorids_header",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1962,6 +1986,7 @@ 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/121.0.6167.184',
|
||||
'depot_tools_checkout': '6444de14d1'
|
||||
'chromium_checkout': 'refs/tags/124.0.6367.207',
|
||||
'depot_tools_checkout': '19199514e8'
|
||||
}
|
||||
|
@@ -38,7 +38,8 @@
|
||||
'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.h',
|
||||
'components/content_settings/core/common/content_settings_types.mojom',
|
||||
'components/permissions/request_type.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=25599539f43226aac01bfcb74f19ac74217aee9a$
|
||||
# $hash=3b28f3236c16d2b776a44674ae3bae0a070e9f27$
|
||||
#
|
||||
|
||||
{
|
||||
@@ -85,6 +85,7 @@
|
||||
'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',
|
||||
@@ -189,6 +190,7 @@
|
||||
'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',
|
||||
@@ -508,6 +510,8 @@
|
||||
'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',
|
||||
@@ -836,6 +840,8 @@
|
||||
'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,6 +29,7 @@
|
||||
'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',
|
||||
@@ -53,6 +54,7 @@
|
||||
'include/internal/cef_time.h',
|
||||
'include/internal/cef_trace_event_internal.h',
|
||||
'include/internal/cef_types.h',
|
||||
'include/internal/cef_types_color.h',
|
||||
'include/internal/cef_types_content_settings.h',
|
||||
'include/internal/cef_types_geometry.h',
|
||||
],
|
||||
@@ -220,6 +222,8 @@
|
||||
'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',
|
||||
@@ -240,10 +244,11 @@
|
||||
'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',
|
||||
@@ -309,11 +314,12 @@
|
||||
'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,8 +304,9 @@ if(OS_MAC)
|
||||
# Standard libraries.
|
||||
set(CEF_STANDARD_LIBS
|
||||
-lpthread
|
||||
"-framework Cocoa"
|
||||
"-framework AppKit"
|
||||
"-framework Cocoa"
|
||||
"-framework IOSurface"
|
||||
)
|
||||
|
||||
# Find the newest available base SDK.
|
||||
|
50
include/base/internal/cef_color_id_macros.inc
Normal file
50
include/base/internal/cef_color_id_macros.inc
Normal file
@@ -0,0 +1,50 @@
|
||||
// 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=b9a2bad4a30bcb99384197c9f7409116dc5b376e$
|
||||
// $hash=dfa0d4d2da319b2fd5e92324fd14301b500ceb5c$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_APP_CAPI_H_
|
||||
@@ -137,15 +137,26 @@ 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. 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 except,
|
||||
/// optionally, CefGetErrorCode. 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=d23df6f606a96b432905c5c80f29ab72915b8e01$
|
||||
// $hash=abcb584dbf5965834f415a0f2daeda3e361696b2$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||
@@ -165,15 +165,16 @@ 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_byident)(
|
||||
struct _cef_frame_t*(CEF_CALLBACK* get_frame_by_identifier)(
|
||||
struct _cef_browser_t* self,
|
||||
int64_t identifier);
|
||||
const cef_string_t* identifier);
|
||||
|
||||
///
|
||||
/// Returns the frame with the specified name, or NULL if not found.
|
||||
///
|
||||
struct _cef_frame_t*(CEF_CALLBACK* get_frame)(struct _cef_browser_t* self,
|
||||
const cef_string_t* name);
|
||||
struct _cef_frame_t*(CEF_CALLBACK* get_frame_by_name)(
|
||||
struct _cef_browser_t* self,
|
||||
const cef_string_t* name);
|
||||
|
||||
///
|
||||
/// Returns the number of frames that currently exist.
|
||||
@@ -184,8 +185,7 @@ typedef struct _cef_browser_t {
|
||||
/// Returns the identifiers of all existing frames.
|
||||
///
|
||||
void(CEF_CALLBACK* get_frame_identifiers)(struct _cef_browser_t* self,
|
||||
size_t* identifiersCount,
|
||||
int64_t* identifiers);
|
||||
cef_string_list_t identifiers);
|
||||
|
||||
///
|
||||
/// Returns the names of all existing frames.
|
||||
@@ -974,6 +974,17 @@ 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);
|
||||
} cef_browser_host_t;
|
||||
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=f844d2a1e39d822129d0733f33c14d27481c36b7$
|
||||
// $hash=d958d5bed7f909f6313facef3440fb8ba07a5c01$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_
|
||||
@@ -44,6 +44,7 @@
|
||||
#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
|
||||
@@ -147,14 +148,26 @@ typedef struct _cef_browser_process_handler_t {
|
||||
int64_t delay_ms);
|
||||
|
||||
///
|
||||
/// 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.
|
||||
/// 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.
|
||||
///
|
||||
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=50e59e2d7038a1be0d3a2451c9b7073aee5156ef$
|
||||
// $hash=76ba2e59636aa71c8c6286093198a1e64d012c62$
|
||||
//
|
||||
|
||||
#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()->Get
|
||||
/// DefaultCookieManager().
|
||||
/// calling cef_request_context_t::cef_request_context_get_global_context()-
|
||||
/// >GetDefaultCookieManager().
|
||||
///
|
||||
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=7294486141b2377198e994048a768db4a7cb9cd0$
|
||||
// $hash=8f347a95168778ec0e686cdef93be3bc517e2f68$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
|
||||
@@ -178,10 +178,12 @@ 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 < 0 if the
|
||||
/// Returns the globally unique identifier for this frame or NULL if the
|
||||
/// underlying frame does not yet exist.
|
||||
///
|
||||
int64_t(CEF_CALLBACK* get_identifier)(struct _cef_frame_t* self);
|
||||
// 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);
|
||||
|
||||
///
|
||||
/// 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=62e7e781f3fef0d332b6a921d48a192fd0115295$
|
||||
// $hash=8eec1100e8470cbe3ebc54d5962416d2fa4d57fb$
|
||||
//
|
||||
|
||||
#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=5309b2f6da62526ed92c928c0918bc27898cf03b$
|
||||
// $hash=5151b6ea3c06e46a75f2cd7679044a2891063d29$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
|
||||
@@ -149,17 +149,27 @@ 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. |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.
|
||||
/// 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.
|
||||
///
|
||||
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);
|
||||
/// 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);
|
||||
|
||||
///
|
||||
/// 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=23302ef6e4458aa3e7065aeaca3421a6f0b58361$
|
||||
// $hash=7df03921b2ee743fb059f13e545ccf89904eb060$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
|
||||
@@ -368,6 +368,39 @@ 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=3b59c0bc014d773dedc24649071141ee2dd2125c$
|
||||
// $hash=2e8b5c5107f61e3d4c333dc02c76a9f30cd0cf83$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||
@@ -48,6 +48,7 @@
|
||||
#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
|
||||
@@ -222,14 +223,53 @@ 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.
|
||||
/// 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).
|
||||
///
|
||||
void(CEF_CALLBACK* on_render_process_terminated)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_termination_status_t status);
|
||||
cef_termination_status_t status,
|
||||
int error_code,
|
||||
const cef_string_t* error_string);
|
||||
|
||||
///
|
||||
/// 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=ba8011bd357e466a94acfd86597f44af00f096a3$
|
||||
// $hash=dd3f6003f9a8f59c2eb4320c382651a441086aee$
|
||||
//
|
||||
|
||||
#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_handl
|
||||
/// er_factory().
|
||||
/// t_context_t::cef_request_context_get_global_context()-
|
||||
/// >register_scheme_handler_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_schem
|
||||
/// e_handler_factories().
|
||||
/// cef_request_context_t::cef_request_context_get_global_context()-
|
||||
/// >clear_scheme_handler_factories().
|
||||
///
|
||||
CEF_EXPORT int cef_clear_scheme_handler_factories(void);
|
||||
|
||||
|
74
include/capi/cef_unresponsive_process_callback_capi.h
Normal file
74
include/capi/cef_unresponsive_process_callback_capi.h
Normal file
@@ -0,0 +1,74 @@
|
||||
// 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=48df6ccac2c68f32c7024ae68c8a6b6a5f8ed914$
|
||||
// $hash=08f13de764f30261616372dfffb7f97c57957f73$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_CAPI_H_
|
||||
@@ -338,16 +338,30 @@ typedef struct _cef_view_t {
|
||||
void(CEF_CALLBACK* request_focus)(struct _cef_view_t* self);
|
||||
|
||||
///
|
||||
/// Sets the background color for this View.
|
||||
/// Sets the background color for this View. The background color will be
|
||||
/// automatically reset when cef_view_delegate_t::OnThemeChanged is called.
|
||||
///
|
||||
void(CEF_CALLBACK* set_background_color)(struct _cef_view_t* self,
|
||||
cef_color_t color);
|
||||
|
||||
///
|
||||
/// Returns the background color for this View.
|
||||
/// 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.
|
||||
///
|
||||
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=4e421d2d1e24df6e58f7a7c0c074056bc5284df4$
|
||||
// $hash=0f562c026f64ca19a32834dcc1e1cd3a98be2f1f$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_DELEGATE_CAPI_H_
|
||||
@@ -140,6 +140,28 @@ 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=dbe89dfdd14eb114e3f2d16fbfc55624bb91e7ce$
|
||||
// $hash=2abb3759a22a95ffc0207f0538c645a74a5030c6$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
|
||||
@@ -364,6 +364,43 @@ 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);
|
||||
} cef_window_t;
|
||||
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=c1c2705cdef7d9189557b57531dc2d53e9f68d0c$
|
||||
// $hash=e6bbc33db1b5ed3832982f8799e14557204f4028$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
|
||||
@@ -182,6 +182,20 @@ 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.
|
||||
///
|
||||
@@ -224,6 +238,43 @@ 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);
|
||||
} 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 "b0a002df95199c8a91e5b14159ff2a800c435ed9"
|
||||
#define CEF_API_HASH_UNIVERSAL "35035b76d79ba0c7144aedb63d72b7988d372706"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "6e111c21cbae8da266044efde3d196dcd84e1d62"
|
||||
#define CEF_API_HASH_PLATFORM "9227cf2e0abf4f378e31e6095d503a91b2da59af"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "ea607f152a2b887b83e2f860992d1c922524049e"
|
||||
#define CEF_API_HASH_PLATFORM "fe0bdc49d209ee3cf108bdb72faec21316f9d0e0"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "28cde5b61a2fa3fe1a39923ef750d176ba8f58b3"
|
||||
#define CEF_API_HASH_PLATFORM "df471096e6600c025ac0655b5eaa9818f075b8ba"
|
||||
#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. 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 except, optionally,
|
||||
/// CefGetErrorCode. 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,6 +82,18 @@ 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,14 +169,15 @@ class CefBrowser : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/// Returns the frame with the specified identifier, or NULL if not found.
|
||||
///
|
||||
/*--cef(capi_name=get_frame_byident)--*/
|
||||
virtual CefRefPtr<CefFrame> GetFrame(int64_t identifier) = 0;
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefFrame> GetFrameByIdentifier(
|
||||
const CefString& identifier) = 0;
|
||||
|
||||
///
|
||||
/// Returns the frame with the specified name, or NULL if not found.
|
||||
///
|
||||
/*--cef(optional_param=name)--*/
|
||||
virtual CefRefPtr<CefFrame> GetFrame(const CefString& name) = 0;
|
||||
virtual CefRefPtr<CefFrame> GetFrameByName(const CefString& name) = 0;
|
||||
|
||||
///
|
||||
/// Returns the number of frames that currently exist.
|
||||
@@ -188,7 +189,7 @@ class CefBrowser : public virtual CefBaseRefCounted {
|
||||
/// Returns the identifiers of all existing frames.
|
||||
///
|
||||
/*--cef(count_func=identifiers:GetFrameCount)--*/
|
||||
virtual void GetFrameIdentifiers(std::vector<int64_t>& identifiers) = 0;
|
||||
virtual void GetFrameIdentifiers(std::vector<CefString>& identifiers) = 0;
|
||||
|
||||
///
|
||||
/// Returns the names of all existing frames.
|
||||
@@ -1006,6 +1007,17 @@ 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;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_BROWSER_H_
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#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"
|
||||
|
||||
///
|
||||
@@ -139,14 +140,28 @@ class CefBrowserProcessHandler : public virtual CefBaseRefCounted {
|
||||
virtual void OnScheduleMessagePumpWork(int64_t delay_ms) {}
|
||||
|
||||
///
|
||||
/// 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.
|
||||
/// 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.
|
||||
///
|
||||
/*--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_
|
||||
|
@@ -180,11 +180,11 @@ class CefFrame : public virtual CefBaseRefCounted {
|
||||
virtual CefString GetName() = 0;
|
||||
|
||||
///
|
||||
/// Returns the globally unique identifier for this frame or < 0 if the
|
||||
/// Returns the globally unique identifier for this frame or empty if the
|
||||
/// underlying frame does not yet exist.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual int64_t GetIdentifier() = 0;
|
||||
virtual CefString GetIdentifier() = 0;
|
||||
|
||||
///
|
||||
/// Returns the parent of this frame or NULL if this is the main (top-level)
|
||||
|
@@ -152,16 +152,25 @@ 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. |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.
|
||||
/// 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.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
|
||||
PaintElementType type,
|
||||
const RectList& dirtyRects,
|
||||
void* shared_handle) {}
|
||||
const CefAcceleratedPaintInfo& info) {}
|
||||
|
||||
///
|
||||
/// Called to retrieve the size of the touch handle for the specified
|
||||
|
@@ -381,6 +381,38 @@ 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,6 +48,7 @@
|
||||
#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"
|
||||
|
||||
///
|
||||
@@ -221,14 +222,52 @@ 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.
|
||||
/// 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).
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) {}
|
||||
TerminationStatus status,
|
||||
int error_code,
|
||||
const CefString& error_string) {}
|
||||
|
||||
///
|
||||
/// Called on the browser process UI thread when the window.document object of
|
||||
|
62
include/cef_unresponsive_process_callback.h
Normal file
62
include/cef_unresponsive_process_callback.h
Normal file
@@ -0,0 +1,62 @@
|
||||
// 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_
|
@@ -31,7 +31,7 @@
|
||||
#define CEF_INCLUDE_INTERNAL_CEF_STRING_WRAPPERS_H_
|
||||
#pragma once
|
||||
|
||||
#include <memory.h>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
#include "include/internal/cef_string_types.h"
|
||||
|
@@ -433,10 +433,14 @@ 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. 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. 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.
|
||||
///
|
||||
int remote_debugging_port;
|
||||
|
||||
@@ -913,6 +917,16 @@ 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;
|
||||
|
||||
///
|
||||
@@ -1023,6 +1037,100 @@ 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
|
||||
@@ -2332,6 +2440,7 @@ 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,
|
||||
@@ -2816,21 +2925,6 @@ 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.
|
||||
///
|
||||
@@ -2863,51 +2957,22 @@ typedef enum {
|
||||
} cef_text_style_t;
|
||||
|
||||
///
|
||||
/// Specifies where along the main axis the CefBoxLayout child views should be
|
||||
/// laid out.
|
||||
/// Specifies where along the axis the CefBoxLayout child views should be laid
|
||||
/// out. Should be kept in sync with Chromium's views::LayoutAlignment type.
|
||||
///
|
||||
typedef enum {
|
||||
///
|
||||
/// Child views will be left-aligned.
|
||||
///
|
||||
CEF_MAIN_AXIS_ALIGNMENT_START,
|
||||
/// Child views will be left/top-aligned.
|
||||
CEF_AXIS_ALIGNMENT_START,
|
||||
|
||||
///
|
||||
/// Child views will be center-aligned.
|
||||
///
|
||||
CEF_MAIN_AXIS_ALIGNMENT_CENTER,
|
||||
CEF_AXIS_ALIGNMENT_CENTER,
|
||||
|
||||
///
|
||||
/// Child views will be right-aligned.
|
||||
///
|
||||
CEF_MAIN_AXIS_ALIGNMENT_END,
|
||||
} cef_main_axis_alignment_t;
|
||||
/// Child views will be right/bottom-aligned.
|
||||
CEF_AXIS_ALIGNMENT_END,
|
||||
|
||||
///
|
||||
/// Specifies where along the cross axis the CefBoxLayout child views should be
|
||||
/// laid out.
|
||||
///
|
||||
typedef enum {
|
||||
///
|
||||
/// Child views will be stretched to fit.
|
||||
///
|
||||
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;
|
||||
CEF_AXIS_ALIGNMENT_STRETCH,
|
||||
} cef_axis_alignment_t;
|
||||
|
||||
///
|
||||
/// Settings used when initializing a CefBoxLayout.
|
||||
@@ -2944,12 +3009,12 @@ typedef struct _cef_box_layout_settings_t {
|
||||
///
|
||||
/// Specifies where along the main axis the child views should be laid out.
|
||||
///
|
||||
cef_main_axis_alignment_t main_axis_alignment;
|
||||
cef_axis_alignment_t main_axis_alignment;
|
||||
|
||||
///
|
||||
/// Specifies where along the cross axis the child views should be laid out.
|
||||
///
|
||||
cef_cross_axis_alignment_t cross_axis_alignment;
|
||||
cef_axis_alignment_t cross_axis_alignment;
|
||||
|
||||
///
|
||||
/// Minimum cross axis size.
|
||||
@@ -3218,64 +3283,65 @@ 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, Side L, Side R, Back L, Back R
|
||||
/// Front L, Front R, Front C, Back L, Back R, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_7_0 = 13,
|
||||
|
||||
/// Front L, Front R, Front C, LFE, Side L, Side R, Back L, Back R
|
||||
/// Front L, Front R, Front C, LFE, Back L, Back R, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_7_1 = 14,
|
||||
|
||||
/// Front L, Front R, Front C, LFE, Side L, Side R, Front LofC, Front RofC
|
||||
/// Front L, Front R, Front C, LFE, Front LofC, Front RofC, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_7_1_WIDE = 15,
|
||||
|
||||
/// Stereo L, Stereo R
|
||||
/// Front L, Front R
|
||||
CEF_CHANNEL_LAYOUT_STEREO_DOWNMIX = 16,
|
||||
|
||||
/// Stereo L, Stereo R, LFE
|
||||
/// Front L, Front R, LFE
|
||||
CEF_CHANNEL_LAYOUT_2POINT1 = 17,
|
||||
|
||||
/// Stereo L, Stereo R, Front C, LFE
|
||||
/// Front L, Front R, Front C, LFE
|
||||
CEF_CHANNEL_LAYOUT_3_1 = 18,
|
||||
|
||||
/// Stereo L, Stereo R, Front C, Rear C, LFE
|
||||
/// Front L, Front R, Front C, LFE, Back C
|
||||
CEF_CHANNEL_LAYOUT_4_1 = 19,
|
||||
|
||||
/// Stereo L, Stereo R, Front C, Side L, Side R, Back C
|
||||
/// Front L, Front R, Front C, Back C, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_6_0 = 20,
|
||||
|
||||
/// Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC
|
||||
/// Front L, Front R, Front LofC, Front RofC, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_6_0_FRONT = 21,
|
||||
|
||||
/// Stereo L, Stereo R, Front C, Rear L, Rear R, Rear C
|
||||
/// Front L, Front R, Front C, Back L, Back R, Back C
|
||||
CEF_CHANNEL_LAYOUT_HEXAGONAL = 22,
|
||||
|
||||
/// Stereo L, Stereo R, Front C, LFE, Side L, Side R, Rear Center
|
||||
/// Front L, Front R, Front C, LFE, Back C, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_6_1 = 23,
|
||||
|
||||
/// Stereo L, Stereo R, Front C, LFE, Back L, Back R, Rear Center
|
||||
/// Front L, Front R, Front C, LFE, Back L, Back R, Back C
|
||||
CEF_CHANNEL_LAYOUT_6_1_BACK = 24,
|
||||
|
||||
/// Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC, LFE
|
||||
/// Front L, Front R, LFE, Front LofC, Front RofC, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_6_1_FRONT = 25,
|
||||
|
||||
/// Front L, Front R, Front C, Side L, Side R, Front LofC, Front RofC
|
||||
/// Front L, Front R, Front C, Front LofC, Front RofC, Side L, Side R
|
||||
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, Side L, Side R, Rear L, Back R, Back C.
|
||||
/// Front L, Front R, Front C, Back L, Back R, Back C, Side L, Side R
|
||||
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, Side L, Side R, LFE
|
||||
/// Front L, Front R, LFE, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_4_1_QUAD_SIDE = 31,
|
||||
|
||||
/// Actual channel layout is specified in the bitstream and the actual channel
|
||||
@@ -3289,8 +3355,14 @@ 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_5_1_4_DOWNMIX
|
||||
CEF_CHANNEL_LAYOUT_MAX = CEF_CHANNEL_LAYOUT_3_1_BACK
|
||||
} cef_channel_layout_t;
|
||||
|
||||
///
|
||||
@@ -3556,23 +3628,24 @@ 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_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_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_request_types_t;
|
||||
|
||||
///
|
||||
@@ -3766,6 +3839,20 @@ 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
|
||||
|
57
include/internal/cef_types_color.h
Normal file
57
include/internal/cef_types_color.h
Normal file
@@ -0,0 +1,57 @@
|
||||
// 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,33 +362,72 @@ typedef enum {
|
||||
/// Stores per origin metadata for cookie controls.
|
||||
CEF_CONTENT_SETTING_TYPE_COOKIE_CONTROLS_METADATA,
|
||||
|
||||
/// 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 temporary 3PC accesses granted by user behavior
|
||||
/// heuristics.
|
||||
CEF_CONTENT_SETTING_TYPE_TPCD_HEURISTICS_GRANTS,
|
||||
|
||||
/// 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 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,
|
||||
|
||||
CEF_CONTENT_SETTING_TYPE_NUM_TYPES,
|
||||
/// 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,
|
||||
} cef_content_setting_types_t;
|
||||
|
||||
///
|
||||
|
@@ -43,6 +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"
|
||||
|
||||
// Handle types.
|
||||
@@ -137,6 +138,56 @@ typedef struct _cef_window_info_t {
|
||||
cef_window_handle_t window;
|
||||
} 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,6 +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"
|
||||
|
||||
// Handle types.
|
||||
@@ -44,6 +45,8 @@
|
||||
#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
|
||||
@@ -136,6 +139,23 @@ typedef struct _cef_window_info_t {
|
||||
cef_window_handle_t view;
|
||||
} 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
|
||||
|
@@ -37,12 +37,14 @@
|
||||
#include <windows.h>
|
||||
|
||||
#include "include/internal/cef_string.h"
|
||||
#include "include/internal/cef_types_color.h"
|
||||
#include "include/internal/cef_types_geometry.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
|
||||
@@ -104,6 +106,24 @@ typedef struct _cef_window_info_t {
|
||||
cef_window_handle_t window;
|
||||
} 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,7 +697,9 @@ using CefPdfPrintSettings = CefStructBase<CefPdfPrintSettingsTraits>;
|
||||
///
|
||||
class CefBoxLayoutSettings : public cef_box_layout_settings_t {
|
||||
public:
|
||||
CefBoxLayoutSettings() : cef_box_layout_settings_t{} {}
|
||||
CefBoxLayoutSettings() : cef_box_layout_settings_t{} {
|
||||
cross_axis_alignment = CEF_AXIS_ALIGNMENT_STRETCH;
|
||||
}
|
||||
CefBoxLayoutSettings(const cef_box_layout_settings_t& r)
|
||||
: cef_box_layout_settings_t(r) {}
|
||||
};
|
||||
@@ -748,4 +750,14 @@ 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_
|
||||
|
@@ -357,17 +357,31 @@ class CefView : public CefBaseRefCounted {
|
||||
virtual void RequestFocus() = 0;
|
||||
|
||||
///
|
||||
/// Sets the background color for this View.
|
||||
/// Sets the background color for this View. The background color will be
|
||||
/// automatically reset when CefViewDelegate::OnThemeChanged is called.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetBackgroundColor(cef_color_t color) = 0;
|
||||
|
||||
///
|
||||
/// Returns the background color for this View.
|
||||
/// 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.
|
||||
///
|
||||
/*--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,6 +131,27 @@ 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,6 +377,43 @@ 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;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_H_
|
||||
|
@@ -164,12 +164,11 @@ 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,
|
||||
@@ -177,6 +176,21 @@ 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.
|
||||
///
|
||||
@@ -222,6 +236,41 @@ 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) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_
|
||||
|
@@ -60,16 +60,16 @@ class CefByteReadHandler : public CefReadHandler {
|
||||
CefByteReadHandler& operator=(const CefByteReadHandler&) = delete;
|
||||
|
||||
// CefReadHandler methods.
|
||||
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; }
|
||||
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; }
|
||||
|
||||
private:
|
||||
const unsigned char* bytes_;
|
||||
int64_t size_;
|
||||
int64_t offset_;
|
||||
int64_t offset_ = 0;
|
||||
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] = NULL;
|
||||
array_[argc] = nullptr;
|
||||
}
|
||||
|
||||
CefScopedArgArray(const CefScopedArgArray&) = delete;
|
||||
|
@@ -347,7 +347,7 @@ class CefMessageRouterBrowserSide
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int64_t query_id) {}
|
||||
|
||||
virtual ~Handler() {}
|
||||
virtual ~Handler() = default;
|
||||
};
|
||||
|
||||
///
|
||||
@@ -435,7 +435,7 @@ class CefMessageRouterBrowserSide
|
||||
protected:
|
||||
// Protect against accidental deletion of this object.
|
||||
friend class base::RefCountedThreadSafe<CefMessageRouterBrowserSide>;
|
||||
virtual ~CefMessageRouterBrowserSide() {}
|
||||
virtual ~CefMessageRouterBrowserSide() = default;
|
||||
};
|
||||
|
||||
///
|
||||
@@ -491,7 +491,7 @@ class CefMessageRouterRendererSide
|
||||
protected:
|
||||
// Protect against accidental deletion of this object.
|
||||
friend class base::RefCountedThreadSafe<CefMessageRouterRendererSide>;
|
||||
virtual ~CefMessageRouterRendererSide() {}
|
||||
virtual ~CefMessageRouterRendererSide() = default;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_WRAPPER_CEF_MESSAGE_ROUTER_H_
|
||||
|
@@ -206,7 +206,7 @@ class CefResourceManager
|
||||
///
|
||||
virtual void OnRequestCanceled(scoped_refptr<Request> request) {}
|
||||
|
||||
virtual ~Provider() {}
|
||||
virtual ~Provider() = default;
|
||||
};
|
||||
|
||||
CefResourceManager();
|
||||
|
@@ -184,7 +184,7 @@ class CefXmlObject : public base::RefCountedThreadSafe<CefXmlObject> {
|
||||
void SetParent(CefXmlObject* parent);
|
||||
|
||||
CefString name_;
|
||||
CefXmlObject* parent_;
|
||||
CefXmlObject* parent_ = nullptr;
|
||||
CefString value_;
|
||||
AttributeMap attributes_;
|
||||
ObjectVector children_;
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include "libcef/browser/alloy/alloy_browser_context.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
@@ -112,12 +113,7 @@ AlloyBrowserContext::AlloyBrowserContext(
|
||||
const CefRequestContextSettings& settings)
|
||||
: CefBrowserContext(settings) {}
|
||||
|
||||
AlloyBrowserContext::~AlloyBrowserContext() {
|
||||
if (resource_context_) {
|
||||
content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE,
|
||||
resource_context_.release());
|
||||
}
|
||||
}
|
||||
AlloyBrowserContext::~AlloyBrowserContext() = default;
|
||||
|
||||
bool AlloyBrowserContext::IsInitialized() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -167,15 +163,15 @@ void AlloyBrowserContext::Initialize() {
|
||||
visited_link_path = cache_path_.Append(FILE_PATH_LITERAL("Visited Links"));
|
||||
}
|
||||
visitedlink_listener_ = new CefVisitedLinkListener;
|
||||
visitedlink_master_.reset(new visitedlink::VisitedLinkWriter(
|
||||
visitedlink_master_ = std::make_unique<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_.reset(new PrefProxyConfigTrackerImpl(
|
||||
GetPrefs(), content::GetIOThreadTaskRunner({})));
|
||||
pref_proxy_config_tracker_ = std::make_unique<PrefProxyConfigTrackerImpl>(
|
||||
GetPrefs(), content::GetIOThreadTaskRunner({}));
|
||||
|
||||
// Spell checking support and possibly other subsystems retrieve the
|
||||
// PrefService associated with a BrowserContext via UserPrefs::Get().
|
||||
@@ -310,13 +306,6 @@ bool AlloyBrowserContext::IsPrintPreviewSupported() const {
|
||||
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;
|
||||
@@ -355,8 +344,8 @@ AlloyBrowserContext::CreateZoomLevelDelegate(
|
||||
content::DownloadManagerDelegate*
|
||||
AlloyBrowserContext::GetDownloadManagerDelegate() {
|
||||
if (!download_manager_delegate_) {
|
||||
download_manager_delegate_.reset(
|
||||
new CefDownloadManagerDelegate(GetDownloadManager()));
|
||||
download_manager_delegate_ =
|
||||
std::make_unique<CefDownloadManagerDelegate>(GetDownloadManager());
|
||||
}
|
||||
return download_manager_delegate_.get();
|
||||
}
|
||||
@@ -388,7 +377,7 @@ AlloyBrowserContext::GetStorageNotificationService() {
|
||||
|
||||
content::SSLHostStateDelegate* AlloyBrowserContext::GetSSLHostStateDelegate() {
|
||||
if (!ssl_host_state_delegate_) {
|
||||
ssl_host_state_delegate_.reset(new CefSSLHostStateDelegate());
|
||||
ssl_host_state_delegate_ = std::make_unique<CefSSLHostStateDelegate>();
|
||||
}
|
||||
return ssl_host_state_delegate_.get();
|
||||
}
|
||||
@@ -475,7 +464,7 @@ void AlloyBrowserContext::RebuildTable(
|
||||
DownloadPrefs* AlloyBrowserContext::GetDownloadPrefs() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!download_prefs_) {
|
||||
download_prefs_.reset(new DownloadPrefs(this));
|
||||
download_prefs_ = std::make_unique<DownloadPrefs>(this);
|
||||
}
|
||||
return download_prefs_.get();
|
||||
}
|
||||
|
@@ -59,7 +59,6 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
|
||||
bool IsPrintPreviewSupported() const override;
|
||||
|
||||
// content::BrowserContext overrides.
|
||||
content::ResourceContext* GetResourceContext() override;
|
||||
content::ClientHintsControllerDelegate* GetClientHintsControllerDelegate()
|
||||
override;
|
||||
base::FilePath GetPath() override;
|
||||
@@ -142,8 +141,6 @@ 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,6 +5,7 @@
|
||||
|
||||
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
@@ -17,6 +18,7 @@
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools/devtools_manager.h"
|
||||
#include "libcef/browser/hang_monitor.h"
|
||||
#include "libcef/browser/media_access_query.h"
|
||||
#include "libcef/browser/osr/osr_util.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
@@ -233,7 +235,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForGlobalId(
|
||||
// AlloyBrowserHostImpl methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
AlloyBrowserHostImpl::~AlloyBrowserHostImpl() {}
|
||||
AlloyBrowserHostImpl::~AlloyBrowserHostImpl() = default;
|
||||
|
||||
void AlloyBrowserHostImpl::CloseBrowser(bool force_close) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
@@ -1192,13 +1194,28 @@ 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), /*cef_extension=*/nullptr);
|
||||
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);
|
||||
}
|
||||
|
||||
content::JavaScriptDialogManager*
|
||||
AlloyBrowserHostImpl::GetJavaScriptDialogManager(content::WebContents* source) {
|
||||
if (!javascript_dialog_manager_) {
|
||||
javascript_dialog_manager_.reset(new CefJavaScriptDialogManager(this));
|
||||
javascript_dialog_manager_ =
|
||||
std::make_unique<CefJavaScriptDialogManager>(this);
|
||||
}
|
||||
return javascript_dialog_manager_.get();
|
||||
}
|
||||
@@ -1216,8 +1233,8 @@ bool AlloyBrowserHostImpl::ShowContextMenu(
|
||||
const content::ContextMenuParams& params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!menu_manager_.get() && platform_delegate_) {
|
||||
menu_manager_.reset(
|
||||
new CefMenuManager(this, platform_delegate_->CreateMenuRunner()));
|
||||
menu_manager_ = std::make_unique<CefMenuManager>(
|
||||
this, platform_delegate_->CreateMenuRunner());
|
||||
}
|
||||
return menu_manager_->CreateContextMenu(params);
|
||||
}
|
||||
@@ -1388,7 +1405,8 @@ void AlloyBrowserHostImpl::StartAudioCapturer() {
|
||||
return;
|
||||
}
|
||||
|
||||
audio_capturer_.reset(new CefAudioCapturer(params, this, audio_handler));
|
||||
audio_capturer_ =
|
||||
std::make_unique<CefAudioCapturer>(params, this, audio_handler);
|
||||
}
|
||||
|
||||
// AlloyBrowserHostImpl private methods.
|
||||
|
@@ -233,6 +233,13 @@ 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,
|
||||
|
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "libcef/browser/alloy/dialogs/alloy_constrained_window_views_client.h"
|
||||
@@ -36,6 +37,7 @@
|
||||
#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"
|
||||
@@ -49,10 +51,13 @@
|
||||
#include "ui/native_theme/native_theme.h"
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
#include "ui/ozone/buildflags.h"
|
||||
#if defined(USE_AURA) && BUILDFLAG(OZONE_PLATFORM_X11)
|
||||
#include "ui/base/ozone_buildflags.h"
|
||||
#if defined(USE_AURA) && BUILDFLAG(IS_OZONE_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)
|
||||
@@ -125,26 +130,10 @@ 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(
|
||||
const base::CommandLine& command_line,
|
||||
base::CommandLine command_line,
|
||||
const base::FilePath& current_directory) {
|
||||
// Drop the request if the browser process is already shutting down.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
@@ -171,7 +160,7 @@ void ProcessSingletonNotificationCallbackImpl(
|
||||
|
||||
// Based on ChromeBrowserMainParts::ProcessSingletonNotificationCallback.
|
||||
bool ProcessSingletonNotificationCallback(
|
||||
const base::CommandLine& command_line,
|
||||
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
|
||||
@@ -190,7 +179,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,
|
||||
command_line, current_directory));
|
||||
std::move(command_line), current_directory));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -206,7 +195,7 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
||||
#if defined(USE_AURA)
|
||||
CHECK(aura::Env::GetInstance());
|
||||
|
||||
wm_state_.reset(new wm::WMState);
|
||||
wm_state_ = std::make_unique<wm::WMState>();
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
@@ -218,7 +207,9 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
// Based on chrome_browser_main_extra_parts_views_linux.cc
|
||||
if (auto linux_ui = GetLinuxUI()) {
|
||||
// |linux_ui| will be nullptr with multi-threaded-message-loop. See
|
||||
// CefUiThread::InitializeBrowserRunner.
|
||||
if (auto linux_ui = ui::GetDefaultLinuxUi()) {
|
||||
linux_ui_getter_ = std::make_unique<LinuxUiGetterImpl>();
|
||||
ui::LinuxUi::SetInstance(linux_ui);
|
||||
|
||||
@@ -227,6 +218,13 @@ 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);
|
||||
@@ -245,13 +243,15 @@ 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(OZONE_PLATFORM_X11)
|
||||
#if defined(USE_AURA) && BUILDFLAG(IS_OZONE_X11)
|
||||
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -31,7 +31,10 @@ class LayoutProvider;
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
namespace ui {
|
||||
class LinuxUiGetter;
|
||||
}
|
||||
#if defined(USE_DBUS)
|
||||
class DarkModeManagerLinux;
|
||||
#endif
|
||||
} // namespace ui
|
||||
#endif
|
||||
|
||||
class CefDevToolsDelegate;
|
||||
@@ -99,6 +102,9 @@ 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
|
||||
};
|
||||
|
||||
|
@@ -70,6 +70,7 @@
|
||||
#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"
|
||||
@@ -90,7 +91,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/internal_plugin_helpers.h"
|
||||
#include "components/pdf/common/constants.h"
|
||||
#include "components/policy/core/common/policy_pref_names.h"
|
||||
#include "components/spellcheck/common/spellcheck.mojom.h"
|
||||
#include "components/version_info/version_info.h"
|
||||
@@ -107,24 +108,33 @@
|
||||
#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"
|
||||
@@ -186,7 +196,7 @@ class CefSelectClientCertificateCallbackImpl
|
||||
CefSelectClientCertificateCallbackImpl& operator=(
|
||||
const CefSelectClientCertificateCallbackImpl&) = delete;
|
||||
|
||||
~CefSelectClientCertificateCallbackImpl() {
|
||||
~CefSelectClientCertificateCallbackImpl() override {
|
||||
// If Select has not been called, call it with NULL to continue without any
|
||||
// client certificate.
|
||||
if (delegate_) {
|
||||
@@ -300,6 +310,33 @@ 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);
|
||||
@@ -359,13 +396,6 @@ 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.
|
||||
@@ -504,7 +534,7 @@ bool AlloyContentBrowserClient::IsHandledURL(const GURL& url) {
|
||||
return CefAppManager::Get()->HasCustomScheme(scheme);
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::SiteInstanceGotProcess(
|
||||
void AlloyContentBrowserClient::SiteInstanceGotProcessAndSite(
|
||||
content::SiteInstance* site_instance) {
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return;
|
||||
@@ -533,9 +563,10 @@ void AlloyContentBrowserClient::SiteInstanceGotProcess(
|
||||
void AlloyContentBrowserClient::BindHostReceiverForRenderer(
|
||||
content::RenderProcessHost* render_process_host,
|
||||
mojo::GenericPendingReceiver receiver) {
|
||||
if (auto host_receiver = receiver.As<spellcheck::mojom::SpellCheckHost>()) {
|
||||
SpellCheckHostChromeImpl::Create(render_process_host->GetID(),
|
||||
std::move(host_receiver));
|
||||
if (auto host_receiver =
|
||||
receiver.As<spellcheck::mojom::SpellCheckInitializationHost>()) {
|
||||
SpellCheckInitializationHostImpl::Create(render_process_host->GetID(),
|
||||
std::move(host_receiver));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -755,9 +786,8 @@ base::OnceClosure AlloyContentBrowserClient::SelectClientCertificate(
|
||||
}
|
||||
|
||||
CefRequestHandler::X509CertificateList certs;
|
||||
for (net::ClientCertIdentityList::iterator iter = client_certs.begin();
|
||||
iter != client_certs.end(); iter++) {
|
||||
certs.push_back(new CefX509CertificateImpl(std::move(*iter)));
|
||||
for (auto& client_cert : client_certs) {
|
||||
certs.push_back(new CefX509CertificateImpl(std::move(client_cert)));
|
||||
}
|
||||
|
||||
CefRefPtr<CefSelectClientCertificateCallbackImpl> callbackImpl(
|
||||
@@ -830,6 +860,49 @@ 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,
|
||||
@@ -858,13 +931,31 @@ 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::EventRouter>(
|
||||
base::BindRepeating(&extensions::EventRouter::BindForRenderer,
|
||||
render_process_id));
|
||||
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::LocalFrameHost>(
|
||||
base::BindRepeating(
|
||||
[](content::RenderFrameHost* render_frame_host,
|
||||
@@ -874,14 +965,6 @@ 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()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -897,11 +980,8 @@ AlloyContentBrowserClient::CreateThrottlesForNavigation(
|
||||
throttles.push_back(std::move(pdf_iframe_throttle));
|
||||
}
|
||||
|
||||
auto pdf_throttle = pdf::PdfNavigationThrottle::MaybeCreateThrottleFor(
|
||||
navigation_handle, std::make_unique<ChromePdfStreamDelegate>());
|
||||
if (pdf_throttle) {
|
||||
throttles.push_back(std::move(pdf_throttle));
|
||||
}
|
||||
throttles.push_back(std::make_unique<pdf::PdfNavigationThrottle>(
|
||||
navigation_handle, std::make_unique<ChromePdfStreamDelegate>()));
|
||||
}
|
||||
|
||||
throttle::CreateThrottlesForNavigation(navigation_handle, throttles);
|
||||
@@ -915,7 +995,8 @@ AlloyContentBrowserClient::CreateURLLoaderThrottles(
|
||||
content::BrowserContext* browser_context,
|
||||
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
|
||||
content::NavigationUIData* navigation_ui_data,
|
||||
int frame_tree_node_id) {
|
||||
int frame_tree_node_id,
|
||||
std::optional<int64_t> navigation_id) {
|
||||
std::vector<std::unique_ptr<blink::URLLoaderThrottle>> result;
|
||||
|
||||
// Used to substitute View ID for PDF contents when using the PDF plugin.
|
||||
@@ -983,14 +1064,6 @@ 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) {
|
||||
@@ -1012,6 +1085,7 @@ 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,
|
||||
@@ -1023,26 +1097,33 @@ AlloyContentBrowserClient::CreateLoginDelegate(
|
||||
std::move(auth_required_callback));
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
|
||||
int frame_tree_node_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) {
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>
|
||||
AlloyContentBrowserClient::CreateNonNetworkNavigationURLLoaderFactory(
|
||||
const std::string& scheme,
|
||||
int frame_tree_node_id) {
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return;
|
||||
return {};
|
||||
}
|
||||
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
|
||||
factories->emplace(
|
||||
extensions::kExtensionScheme,
|
||||
extensions::CreateExtensionNavigationURLLoaderFactory(
|
||||
web_contents->GetBrowserContext(),
|
||||
!!extensions::WebViewGuest::FromWebContents(web_contents)));
|
||||
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 {};
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
const absl::optional<url::Origin>& request_initiator_origin,
|
||||
const std::optional<url::Origin>& request_initiator_origin,
|
||||
NonNetworkURLLoaderFactoryMap* factories) {
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return;
|
||||
@@ -1096,7 +1177,7 @@ void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
}
|
||||
}
|
||||
|
||||
bool AlloyContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
void AlloyContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
int render_process_id,
|
||||
@@ -1104,7 +1185,7 @@ bool AlloyContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
const url::Origin& request_initiator,
|
||||
std::optional<int64_t> navigation_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
network::URLLoaderFactoryBuilder& factory_builder,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
bool* bypass_redirect_checks,
|
||||
@@ -1117,9 +1198,8 @@ bool AlloyContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
type == URLLoaderFactoryType::kDownload, request_initiator);
|
||||
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
browser_context, factory_receiver, header_client,
|
||||
browser_context, factory_builder, header_client,
|
||||
std::move(request_handler));
|
||||
return true;
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::OnNetworkServiceCreated(
|
||||
@@ -1250,10 +1330,22 @@ 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,6 +15,7 @@
|
||||
#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;
|
||||
@@ -64,7 +65,8 @@ 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 SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
|
||||
void SiteInstanceGotProcessAndSite(
|
||||
content::SiteInstance* site_instance) override;
|
||||
void BindHostReceiverForRenderer(
|
||||
content::RenderProcessHost* render_process_host,
|
||||
mojo::GenericPendingReceiver receiver) override;
|
||||
@@ -116,6 +118,13 @@ 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;
|
||||
@@ -128,7 +137,8 @@ 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) override;
|
||||
int frame_tree_node_id,
|
||||
std::optional<int64_t> navigation_id) override;
|
||||
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
|
||||
CreateURLLoaderThrottlesForKeepAlive(
|
||||
const network::ResourceRequest& request,
|
||||
@@ -150,30 +160,27 @@ 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;
|
||||
void RegisterNonNetworkNavigationURLLoaderFactories(
|
||||
int frame_tree_node_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) override;
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>
|
||||
CreateNonNetworkNavigationURLLoaderFactory(const std::string& scheme,
|
||||
int frame_tree_node_id) override;
|
||||
void RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
const absl::optional<url::Origin>& request_initiator_origin,
|
||||
const std::optional<url::Origin>& request_initiator_origin,
|
||||
NonNetworkURLLoaderFactoryMap* factories) override;
|
||||
bool WillCreateURLLoaderFactory(
|
||||
void WillCreateURLLoaderFactory(
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
int render_process_id,
|
||||
@@ -181,7 +188,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
const url::Origin& request_initiator,
|
||||
std::optional<int64_t> navigation_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
network::URLLoaderFactoryBuilder& factory_builder,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
bool* bypass_redirect_checks,
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
#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"
|
||||
@@ -66,10 +68,10 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
|
||||
|
||||
// Extension resources will fail to load if we don't use a SiteInstance
|
||||
// associated with the extension.
|
||||
// (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).
|
||||
// (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).
|
||||
site_instance = extensions::ProcessManager::Get(browser_context)
|
||||
->GetSiteInstanceForURL(gurl);
|
||||
DCHECK(site_instance);
|
||||
@@ -172,8 +174,8 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
|
||||
CreateAlloyJavaScriptTabModalDialogManagerDelegateDesktop(web_contents_));
|
||||
|
||||
// Used for print preview and JavaScript dialogs.
|
||||
web_contents_dialog_helper_.reset(
|
||||
new AlloyWebContentsDialogHelper(web_contents_, this));
|
||||
web_contents_dialog_helper_ =
|
||||
std::make_unique<AlloyWebContentsDialogHelper>(web_contents_, this);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(
|
||||
|
@@ -5,6 +5,8 @@
|
||||
|
||||
#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"
|
||||
@@ -17,6 +19,7 @@
|
||||
|
||||
#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"
|
||||
@@ -29,6 +32,7 @@
|
||||
#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"
|
||||
@@ -37,11 +41,11 @@
|
||||
#include "services/network/public/cpp/network_switches.h"
|
||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||
|
||||
ChromeBrowserProcessAlloy::ChromeBrowserProcessAlloy()
|
||||
: initialized_(false),
|
||||
context_initialized_(false),
|
||||
shutdown_(false),
|
||||
locale_("en-US") {}
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "components/os_crypt/async/browser/dpapi_key_provider.h"
|
||||
#endif
|
||||
|
||||
ChromeBrowserProcessAlloy::ChromeBrowserProcessAlloy() : locale_("en-US") {}
|
||||
|
||||
ChromeBrowserProcessAlloy::~ChromeBrowserProcessAlloy() {
|
||||
DCHECK((!initialized_ && !context_initialized_) || shutdown_);
|
||||
@@ -64,10 +68,10 @@ void ChromeBrowserProcessAlloy::Initialize() {
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
// Initialize extension global objects before creating the global
|
||||
// BrowserContext.
|
||||
extensions_client_.reset(new extensions::CefExtensionsClient());
|
||||
extensions_client_ = std::make_unique<extensions::CefExtensionsClient>();
|
||||
extensions::ExtensionsClient::Set(extensions_client_.get());
|
||||
extensions_browser_client_.reset(
|
||||
new extensions::CefExtensionsBrowserClient);
|
||||
extensions_browser_client_ =
|
||||
std::make_unique<extensions::CefExtensionsBrowserClient>();
|
||||
extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
|
||||
}
|
||||
|
||||
@@ -83,9 +87,33 @@ 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_.reset(new printing::PrintJobManager());
|
||||
profile_manager_.reset(new ChromeProfileManagerAlloy());
|
||||
print_job_manager_ = std::make_unique<printing::PrintJobManager>();
|
||||
profile_manager_ = std::make_unique<ChromeProfileManagerAlloy>();
|
||||
event_router_forwarder_ = new extensions::EventRouterForwarder();
|
||||
context_initialized_ = true;
|
||||
}
|
||||
@@ -272,9 +300,9 @@ printing::PrintJobManager* ChromeBrowserProcessAlloy::print_job_manager() {
|
||||
|
||||
printing::PrintPreviewDialogController*
|
||||
ChromeBrowserProcessAlloy::print_preview_dialog_controller() {
|
||||
if (!print_preview_dialog_controller_.get()) {
|
||||
if (!print_preview_dialog_controller_) {
|
||||
print_preview_dialog_controller_ =
|
||||
new printing::PrintPreviewDialogController();
|
||||
std::make_unique<printing::PrintPreviewDialogController>();
|
||||
}
|
||||
return print_preview_dialog_controller_.get();
|
||||
}
|
||||
@@ -282,8 +310,8 @@ ChromeBrowserProcessAlloy::print_preview_dialog_controller() {
|
||||
printing::BackgroundPrintingManager*
|
||||
ChromeBrowserProcessAlloy::background_printing_manager() {
|
||||
if (!background_printing_manager_.get()) {
|
||||
background_printing_manager_.reset(
|
||||
new printing::BackgroundPrintingManager());
|
||||
background_printing_manager_ =
|
||||
std::make_unique<printing::BackgroundPrintingManager>();
|
||||
}
|
||||
return background_printing_manager_.get();
|
||||
}
|
||||
@@ -407,8 +435,8 @@ ChromeBrowserProcessAlloy::resource_coordinator_parts() {
|
||||
}
|
||||
|
||||
os_crypt_async::OSCryptAsync* ChromeBrowserProcessAlloy::os_crypt_async() {
|
||||
DCHECK(false);
|
||||
return nullptr;
|
||||
DCHECK(os_crypt_async_);
|
||||
return os_crypt_async_.get();
|
||||
}
|
||||
|
||||
BuildState* ChromeBrowserProcessAlloy::GetBuildState() {
|
||||
|
@@ -113,9 +113,9 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
|
||||
UsbSystemTrayIcon* usb_system_tray_icon() override;
|
||||
|
||||
private:
|
||||
bool initialized_;
|
||||
bool context_initialized_;
|
||||
bool shutdown_;
|
||||
bool initialized_ = false;
|
||||
bool context_initialized_ = false;
|
||||
bool shutdown_ = false;
|
||||
|
||||
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
|
||||
std::unique_ptr<extensions::ExtensionsBrowserClient>
|
||||
@@ -125,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_;
|
||||
scoped_refptr<printing::PrintPreviewDialogController>
|
||||
std::unique_ptr<printing::PrintPreviewDialogController>
|
||||
print_preview_dialog_controller_;
|
||||
std::unique_ptr<printing::BackgroundPrintingManager>
|
||||
background_printing_manager_;
|
||||
@@ -137,6 +137,8 @@ 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() {}
|
||||
ChromeProfileAlloy::~ChromeProfileAlloy() = default;
|
||||
|
||||
bool ChromeProfileAlloy::IsOffTheRecord() {
|
||||
return false;
|
||||
|
@@ -32,7 +32,7 @@ CefBrowserContext* GetActiveBrowserContext() {
|
||||
ChromeProfileManagerAlloy::ChromeProfileManagerAlloy()
|
||||
: ProfileManager(base::FilePath()) {}
|
||||
|
||||
ChromeProfileManagerAlloy::~ChromeProfileManagerAlloy() {}
|
||||
ChromeProfileManagerAlloy::~ChromeProfileManagerAlloy() = default;
|
||||
|
||||
Profile* ChromeProfileManagerAlloy::GetProfile(
|
||||
const base::FilePath& profile_dir) {
|
||||
|
@@ -98,6 +98,7 @@ 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();
|
||||
@@ -116,7 +117,10 @@ void CefAudioCapturer::OnCaptureError(
|
||||
media::AudioCapturerSource::ErrorCode code,
|
||||
const std::string& message) {
|
||||
audio_handler_->OnAudioStreamError(browser_, message);
|
||||
StopStream();
|
||||
|
||||
if (code != media::AudioCapturerSource::ErrorCode::kSocketError) {
|
||||
StopStream();
|
||||
}
|
||||
}
|
||||
|
||||
void CefAudioCapturer::StopStream() {
|
||||
@@ -129,4 +133,4 @@ void CefAudioCapturer::StopStream() {
|
||||
|
||||
audio_input_device_ = nullptr;
|
||||
capturing_ = false;
|
||||
}
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@ 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,
|
||||
@@ -48,4 +49,4 @@ class CefAudioCapturer : public media::AudioCapturerSource::CaptureCallback {
|
||||
int channels_ = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_AUDIO_CAPTURER_H_
|
||||
#endif // CEF_LIBCEF_BROWSER_AUDIO_CAPTURER_H_
|
||||
|
@@ -39,7 +39,7 @@ class StreamCreatedCallbackAdapter final
|
||||
StreamCreatedCallbackAdapter& operator=(const StreamCreatedCallbackAdapter&) =
|
||||
delete;
|
||||
|
||||
~StreamCreatedCallbackAdapter() override {}
|
||||
~StreamCreatedCallbackAdapter() override = default;
|
||||
|
||||
// blink::mojom::RendererAudioInputStreamFactoryClient implementation.
|
||||
void StreamCreated(
|
||||
@@ -48,7 +48,7 @@ class StreamCreatedCallbackAdapter final
|
||||
client_receiver,
|
||||
media::mojom::ReadOnlyAudioDataPipePtr data_pipe,
|
||||
bool initially_muted,
|
||||
const absl::optional<base::UnguessableToken>& stream_id) override {
|
||||
const std::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,6 +10,8 @@
|
||||
#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,6 +27,10 @@
|
||||
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.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 {
|
||||
@@ -114,7 +120,9 @@ content::WebContents* CefBrowserContentsDelegate::OpenURLFromTab(
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetRequestHandler()) {
|
||||
// May return nullptr for omnibox navigations.
|
||||
auto frame = browser()->GetFrame(params.frame_tree_node_id);
|
||||
auto frame = browser_info_->browser()->GetFrameForHost(
|
||||
content::RenderFrameHost::FromID(params.source_render_process_id,
|
||||
params.source_render_frame_id));
|
||||
if (!frame) {
|
||||
frame = browser()->GetMainFrame();
|
||||
}
|
||||
@@ -324,11 +332,9 @@ 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_->GetIdentifier() == frame_id) {
|
||||
if (focused_frame_ && focused_frame_->IsSameFrame(render_frame_host)) {
|
||||
focused_frame_ = nullptr;
|
||||
OnStateChanged(State::kFocusedFrame);
|
||||
}
|
||||
@@ -351,6 +357,22 @@ 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;
|
||||
@@ -358,14 +380,22 @@ 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);
|
||||
handler->OnRenderProcessTerminated(browser(), ts, error_code,
|
||||
SadTabView::ErrorToString(error_code));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -63,7 +63,7 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||
virtual void OnWebContentsDestroyed(content::WebContents* web_contents) = 0;
|
||||
|
||||
protected:
|
||||
~Observer() override {}
|
||||
~Observer() override = default;
|
||||
};
|
||||
|
||||
explicit CefBrowserContentsDelegate(
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include "libcef/browser/browser_context.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/context.h"
|
||||
@@ -36,7 +37,7 @@ class ImplManager {
|
||||
public:
|
||||
using Vector = std::vector<CefBrowserContext*>;
|
||||
|
||||
ImplManager() {}
|
||||
ImplManager() = default;
|
||||
|
||||
ImplManager(const ImplManager&) = delete;
|
||||
ImplManager& operator=(const ImplManager&) = delete;
|
||||
@@ -157,7 +158,7 @@ CefBrowserContext::CookieableSchemes MakeSupportedSchemes(
|
||||
bool include_defaults) {
|
||||
if (schemes_list.empty() && include_defaults) {
|
||||
// No explicit registration of schemes.
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
std::vector<std::string> all_schemes;
|
||||
@@ -176,7 +177,7 @@ CefBrowserContext::CookieableSchemes MakeSupportedSchemes(
|
||||
all_schemes.push_back("wss");
|
||||
}
|
||||
|
||||
return absl::make_optional(all_schemes);
|
||||
return std::make_optional(all_schemes);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@@ -272,22 +273,7 @@ CefBrowserContext* CefBrowserContext::FromBrowserContext(
|
||||
|
||||
// static
|
||||
CefBrowserContext* CefBrowserContext::FromProfile(const Profile* 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;
|
||||
return FromBrowserContext(profile);
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -423,11 +409,30 @@ network::mojom::NetworkContext* CefBrowserContext::GetNetworkContext() {
|
||||
CefMediaRouterManager* CefBrowserContext::GetMediaRouterManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!media_router_manager_) {
|
||||
media_router_manager_.reset(new CefMediaRouterManager(AsBrowserContext()));
|
||||
media_router_manager_ =
|
||||
std::make_unique<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,6 +6,7 @@
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
@@ -19,7 +20,6 @@
|
||||
#include "base/task/sequenced_task_runner_helpers.h"
|
||||
#include "chrome/common/plugin.mojom.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
/*
|
||||
@@ -104,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);
|
||||
@@ -179,7 +179,15 @@ class CefBrowserContext {
|
||||
|
||||
CefMediaRouterManager* GetMediaRouterManager();
|
||||
|
||||
using CookieableSchemes = absl::optional<std::vector<std::string>>;
|
||||
// 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>>;
|
||||
|
||||
// Returns the schemes associated with this context specifically, or the
|
||||
// global configuration if unset.
|
||||
|
@@ -63,7 +63,7 @@ void CefBrowserFrame::FrameAttached(
|
||||
}
|
||||
|
||||
void CefBrowserFrame::UpdateDraggableRegions(
|
||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions) {
|
||||
std::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions) {
|
||||
if (auto host = GetFrameHost()) {
|
||||
host->UpdateDraggableRegions(std::move(regions));
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ class CefBrowserFrame
|
||||
void FrameAttached(mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,
|
||||
bool reattached) override;
|
||||
void UpdateDraggableRegions(
|
||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
|
||||
std::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
|
||||
override;
|
||||
|
||||
// FrameServiceBase methods:
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/context.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"
|
||||
@@ -31,6 +32,8 @@
|
||||
#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"
|
||||
@@ -61,7 +64,7 @@ class WebContentsUserDataAdapter : public base::SupportsUserData::Data {
|
||||
}
|
||||
|
||||
private:
|
||||
WebContentsUserDataAdapter(CefRefPtr<CefBrowserHostBase> browser)
|
||||
explicit WebContentsUserDataAdapter(CefRefPtr<CefBrowserHostBase> browser)
|
||||
: browser_(browser) {
|
||||
auto web_contents = browser->GetWebContents();
|
||||
DCHECK(web_contents);
|
||||
@@ -148,6 +151,39 @@ 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.
|
||||
bool is_guest_view = false;
|
||||
auto info = CefBrowserInfoManager::GetInstance()->GetBrowserInfo(
|
||||
global_token, &is_guest_view);
|
||||
if (info && !is_guest_view) {
|
||||
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(
|
||||
@@ -223,6 +259,11 @@ 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);
|
||||
}
|
||||
@@ -674,6 +715,22 @@ 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;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::ReplaceMisspelling(const CefString& word) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
@@ -905,32 +962,32 @@ bool CefBrowserHostBase::IsPopup() {
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetMainFrame() {
|
||||
return GetFrame(CefFrameHostImpl::kMainFrameId);
|
||||
return browser_info_->GetMainFrame();
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFocusedFrame() {
|
||||
return GetFrame(CefFrameHostImpl::kFocusedFrameId);
|
||||
}
|
||||
|
||||
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();
|
||||
if (focused_frame_) {
|
||||
return focused_frame_;
|
||||
}
|
||||
return focused_frame_;
|
||||
}
|
||||
|
||||
return browser_info_->GetFrameForGlobalId(
|
||||
frame_util::MakeGlobalId(identifier));
|
||||
// The main frame is focused by default.
|
||||
return browser_info_->GetMainFrame();
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrame(const CefString& name) {
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrameByIdentifier(
|
||||
const CefString& identifier) {
|
||||
const auto& global_token = frame_util::ParseFrameIdentifier(identifier);
|
||||
if (!global_token) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return browser_info_->GetFrameForGlobalToken(*global_token);
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrameByName(const CefString& name) {
|
||||
for (const auto& frame : browser_info_->GetAllFrames()) {
|
||||
if (frame->GetName() == name) {
|
||||
return frame;
|
||||
@@ -944,7 +1001,7 @@ size_t CefBrowserHostBase::GetFrameCount() {
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::GetFrameIdentifiers(
|
||||
std::vector<int64_t>& identifiers) {
|
||||
std::vector<CefString>& identifiers) {
|
||||
if (identifiers.size() > 0) {
|
||||
identifiers.clear();
|
||||
}
|
||||
@@ -1032,6 +1089,11 @@ CefRefPtr<CefFrame> CefBrowserHostBase::GetFrameForGlobalId(
|
||||
return browser_info_->GetFrameForGlobalId(global_id, nullptr);
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostBase::GetFrameForGlobalToken(
|
||||
const content::GlobalRenderFrameHostToken& global_token) {
|
||||
return browser_info_->GetFrameForGlobalToken(global_token, nullptr);
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::AddObserver(Observer* observer) {
|
||||
CEF_REQUIRE_UIT();
|
||||
observers_.AddObserver(observer);
|
||||
|
@@ -8,6 +8,7 @@
|
||||
|
||||
#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"
|
||||
@@ -28,7 +29,7 @@ class Extension;
|
||||
|
||||
// Parameters that are passed to the runtime-specific Create methods.
|
||||
struct CefBrowserCreateParams {
|
||||
CefBrowserCreateParams() {}
|
||||
CefBrowserCreateParams() = default;
|
||||
|
||||
// Copy constructor used with the chrome runtime only.
|
||||
CefBrowserCreateParams(const CefBrowserCreateParams& that) {
|
||||
@@ -127,7 +128,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
virtual void OnBrowserDestroyed(CefBrowserHostBase* browser) = 0;
|
||||
|
||||
protected:
|
||||
virtual ~Observer() {}
|
||||
~Observer() override = default;
|
||||
};
|
||||
|
||||
// Create a new CefBrowserHost instance of the current runtime type with
|
||||
@@ -147,6 +148,9 @@ 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);
|
||||
@@ -235,6 +239,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
bool IsFullscreen() override;
|
||||
void ExitFullscreen(bool will_cause_resize) override;
|
||||
bool IsRenderProcessUnresponsive() override;
|
||||
|
||||
// CefBrowser methods:
|
||||
bool IsValid() override;
|
||||
@@ -253,10 +258,11 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
bool IsPopup() override;
|
||||
CefRefPtr<CefFrame> GetMainFrame() override;
|
||||
CefRefPtr<CefFrame> GetFocusedFrame() override;
|
||||
CefRefPtr<CefFrame> GetFrame(int64_t identifier) override;
|
||||
CefRefPtr<CefFrame> GetFrame(const CefString& name) override;
|
||||
CefRefPtr<CefFrame> GetFrameByIdentifier(
|
||||
const CefString& identifier) override;
|
||||
CefRefPtr<CefFrame> GetFrameByName(const CefString& name) override;
|
||||
size_t GetFrameCount() override;
|
||||
void GetFrameIdentifiers(std::vector<int64_t>& identifiers) override;
|
||||
void GetFrameIdentifiers(std::vector<CefString>& identifiers) override;
|
||||
void GetFrameNames(std::vector<CefString>& names) override;
|
||||
void SetAccessibilityState(cef_state_t accessibility_state) override;
|
||||
|
||||
@@ -267,11 +273,13 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
// Returns the frame associated with the specified RenderFrameHost.
|
||||
CefRefPtr<CefFrame> GetFrameForHost(const content::RenderFrameHost* host);
|
||||
|
||||
// Returns the frame associated with the specified global ID. See
|
||||
// documentation on RenderFrameHost::GetFrameTreeNodeId() for why the global
|
||||
// ID is preferred.
|
||||
// Returns the frame associated with the specified global ID/token. See
|
||||
// documentation on RenderFrameHost::GetFrameTreeNodeId/Token() for why the
|
||||
// global ID/token 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.
|
||||
@@ -335,6 +343,15 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
}
|
||||
CefMediaStreamRegistrar* GetMediaStreamRegistrar();
|
||||
|
||||
CefRefPtr<CefUnresponsiveProcessCallback> unresponsive_process_callback()
|
||||
const {
|
||||
return unresponsive_process_callback_;
|
||||
}
|
||||
void set_unresponsive_process_callback(
|
||||
CefRefPtr<CefUnresponsiveProcessCallback> callback) {
|
||||
unresponsive_process_callback_ = callback;
|
||||
}
|
||||
|
||||
// Returns the Widget owner for the browser window. Only used with windowed
|
||||
// browsers.
|
||||
views::Widget* GetWindowWidget() const;
|
||||
@@ -385,6 +402,7 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
|
||||
// Only accessed on the UI thread.
|
||||
std::unique_ptr<CefBrowserContentsDelegate> contents_delegate_;
|
||||
CefRefPtr<CefUnresponsiveProcessCallback> unresponsive_process_callback_;
|
||||
|
||||
// Observers that want to be notified of changes to this object.
|
||||
// Only accessed on the UI thread.
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "libcef/browser/browser_info.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/frame_util.h"
|
||||
@@ -19,7 +21,7 @@ CefBrowserInfo::FrameInfo::~FrameInfo() {
|
||||
#if DCHECK_IS_ON()
|
||||
if (frame_ && !IsCurrentMainFrame()) {
|
||||
// Should already be Detached.
|
||||
DCHECK(!frame_->GetRenderFrameHost());
|
||||
DCHECK(frame_->IsDetached());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -152,8 +154,7 @@ void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
// Check that the frame info hasn't changed unexpectedly.
|
||||
DCHECK_EQ(frame_util::MakeFrameId(global_id),
|
||||
frame_info->frame_->GetIdentifier());
|
||||
DCHECK(host->GetGlobalFrameToken() == *frame_info->frame_->frame_token());
|
||||
DCHECK_EQ(frame_info->is_main_frame_, frame_info->frame_->IsMain());
|
||||
#endif
|
||||
}
|
||||
@@ -163,6 +164,8 @@ void CefBrowserInfo::MaybeCreateFrame(content::RenderFrameHost* host,
|
||||
|
||||
// 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));
|
||||
@@ -230,6 +233,12 @@ void CefBrowserInfo::RemoveFrame(content::RenderFrameHost* host) {
|
||||
// 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);
|
||||
@@ -265,7 +274,7 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::CreateTempSubFrame(
|
||||
parent = GetMainFrame();
|
||||
}
|
||||
// Intentionally not notifying for temporary frames.
|
||||
return new CefFrameHostImpl(this, parent->GetIdentifier());
|
||||
return new CefFrameHostImpl(this, parent->frame_token());
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForHost(
|
||||
@@ -327,6 +336,32 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForGlobalId(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForGlobalToken(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
bool* is_guest_view,
|
||||
bool prefer_speculative) const {
|
||||
if (is_guest_view) {
|
||||
*is_guest_view = false;
|
||||
}
|
||||
|
||||
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, is_guest_view, prefer_speculative);
|
||||
}
|
||||
|
||||
CefBrowserInfo::FrameHostList CefBrowserInfo::GetAllFrames() const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
FrameHostList frames;
|
||||
@@ -508,6 +543,7 @@ 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_) {
|
||||
@@ -542,7 +578,8 @@ CefBrowserInfo::NotificationStateLock::NotificationStateLock(
|
||||
}
|
||||
|
||||
// Take the browser info state lock.
|
||||
browser_info_lock_scope_.reset(new base::AutoLock(browser_info_->lock_));
|
||||
browser_info_lock_scope_ =
|
||||
std::make_unique<base::AutoLock>(browser_info_->lock_);
|
||||
}
|
||||
|
||||
CefBrowserInfo::NotificationStateLock::~NotificationStateLock() {
|
||||
|
@@ -109,15 +109,19 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
|
||||
bool* is_guest_view = nullptr,
|
||||
bool prefer_speculative = false) const;
|
||||
|
||||
// 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.
|
||||
// Returns the frame object matching the specified ID/token 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* is_guest_view = nullptr,
|
||||
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. Guest views
|
||||
// will be excluded because they don't have a frame object. Safe to call from
|
||||
@@ -130,7 +134,9 @@ 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_;
|
||||
@@ -246,6 +252,11 @@ 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_;
|
||||
|
||||
|
@@ -89,7 +89,8 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
|
||||
browser_info_list_.push_back(browser_info);
|
||||
|
||||
// Continue any pending NewBrowserInfo request.
|
||||
auto it = pending_new_browser_info_map_.find(frame_host->GetGlobalId());
|
||||
auto it =
|
||||
pending_new_browser_info_map_.find(frame_host->GetGlobalFrameToken());
|
||||
if (it != pending_new_browser_info_map_.end()) {
|
||||
SendNewBrowserInfoResponse(browser_info, /*is_guest_view=*/false,
|
||||
std::move(it->second->callback),
|
||||
@@ -289,9 +290,9 @@ bool CefBrowserInfoManager::AddWebContents(content::WebContents* new_contents) {
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback) {
|
||||
DCHECK(frame_util::IsValidGlobalId(global_id));
|
||||
DCHECK(frame_util::IsValidGlobalToken(global_token));
|
||||
DCHECK(callback);
|
||||
|
||||
auto callback_runner = base::SequencedTaskRunner::GetCurrentDefault();
|
||||
@@ -301,7 +302,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
||||
bool is_guest_view = false;
|
||||
|
||||
scoped_refptr<CefBrowserInfo> browser_info =
|
||||
GetBrowserInfoInternal(global_id, &is_guest_view);
|
||||
GetBrowserInfoInternal(global_token, &is_guest_view);
|
||||
|
||||
if (browser_info) {
|
||||
// Send the response immediately.
|
||||
@@ -311,19 +312,19 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
||||
}
|
||||
|
||||
// Verify that no request for the same route is currently queued.
|
||||
DCHECK(pending_new_browser_info_map_.find(global_id) ==
|
||||
DCHECK(pending_new_browser_info_map_.find(global_token) ==
|
||||
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_id = global_id;
|
||||
pending->global_token = global_token;
|
||||
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_id, std::move(pending)));
|
||||
std::make_pair(global_token, 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
|
||||
@@ -334,7 +335,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
|
||||
CEF_POST_DELAYED_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBrowserInfoManager::TimeoutNewBrowserInfoResponse,
|
||||
global_id, timeout_id),
|
||||
global_token, timeout_id),
|
||||
kNewBrowserInfoResponseTimeoutMs);
|
||||
}
|
||||
}
|
||||
@@ -391,6 +392,13 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo(
|
||||
return GetBrowserInfoInternal(global_id, is_guest_view);
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfo(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
bool* is_guest_view) {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
return GetBrowserInfoInternal(global_token, is_guest_view);
|
||||
}
|
||||
|
||||
bool CefBrowserInfoManager::MaybeAllowNavigation(
|
||||
content::RenderFrameHost* opener,
|
||||
const content::OpenURLParams& params,
|
||||
@@ -451,7 +459,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_id.child_id == render_process_id) {
|
||||
if (info->global_token.child_id == render_process_id) {
|
||||
CancelNewBrowserInfoResponse(info.get());
|
||||
it = pending_new_browser_info_map_.erase(it);
|
||||
} else {
|
||||
@@ -553,6 +561,34 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfoInternal(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfoInternal(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
bool* is_guest_view) {
|
||||
browser_info_lock_.AssertAcquired();
|
||||
|
||||
if (is_guest_view) {
|
||||
*is_guest_view = false;
|
||||
}
|
||||
|
||||
if (!frame_util::IsValidGlobalToken(global_token)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (const auto& browser_info : browser_info_list_) {
|
||||
bool is_guest_view_tmp;
|
||||
auto frame =
|
||||
browser_info->GetFrameForGlobalToken(global_token, &is_guest_view_tmp);
|
||||
if (frame || is_guest_view_tmp) {
|
||||
if (is_guest_view) {
|
||||
*is_guest_view = is_guest_view_tmp;
|
||||
}
|
||||
return browser_info;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
void CefBrowserInfoManager::SendNewBrowserInfoResponse(
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
@@ -601,7 +637,7 @@ void CefBrowserInfoManager::CancelNewBrowserInfoResponse(
|
||||
|
||||
// static
|
||||
void CefBrowserInfoManager::TimeoutNewBrowserInfoResponse(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
int timeout_id) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!g_info_manager) {
|
||||
@@ -611,7 +647,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_id);
|
||||
auto it = g_info_manager->pending_new_browser_info_map_.find(global_token);
|
||||
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.
|
||||
@@ -622,12 +658,12 @@ void CefBrowserInfoManager::TimeoutNewBrowserInfoResponse(
|
||||
#if DCHECK_IS_ON()
|
||||
// This method should never be called for a PDF renderer.
|
||||
content::RenderProcessHost* process =
|
||||
content::RenderProcessHost::FromID(global_id.child_id);
|
||||
content::RenderProcessHost::FromID(global_token.child_id);
|
||||
DCHECK(!process || !process->IsPdf());
|
||||
#endif
|
||||
|
||||
LOG(ERROR) << "Timeout of new browser info response for frame "
|
||||
<< frame_util::GetFrameDebugString(global_id);
|
||||
<< frame_util::GetFrameDebugString(global_token);
|
||||
|
||||
CancelNewBrowserInfoResponse(pending_info.get());
|
||||
g_info_manager->pending_new_browser_info_map_.erase(it);
|
||||
|
@@ -112,7 +112,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// already exist for traditional popup browsers depending on timing. See
|
||||
// comments on PendingPopup for more information.
|
||||
void OnGetNewBrowserInfo(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback);
|
||||
|
||||
// Called from CefBrowserHostBase::DestroyBrowser() when a browser is
|
||||
@@ -122,15 +122,18 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// Called from CefContext::FinishShutdownOnUIThread() to destroy all browsers.
|
||||
void DestroyAllBrowsers();
|
||||
|
||||
// Returns the CefBrowserInfo matching the specified ID or nullptr if no
|
||||
// Returns the CefBrowserInfo matching the specified ID/token or nullptr if no
|
||||
// match is found. It is allowed to add new callers of this method but
|
||||
// consider using CefBrowserHostBase::GetBrowserForGlobalId() or
|
||||
// consider using CefBrowserHostBase::GetBrowserForGlobalId/Token() or
|
||||
// extensions::GetOwnerBrowserForGlobalId() instead. If |is_guest_view| is
|
||||
// non-nullptr it will be set to true if the ID matches a guest view
|
||||
// non-nullptr it will be set to true if the ID/token matches a guest view
|
||||
// associated with the returned browser info instead of the browser itself.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfo(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view = nullptr);
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfo(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
bool* is_guest_view = nullptr);
|
||||
|
||||
// Returns all existing CefBrowserInfo objects.
|
||||
using BrowserInfoList = std::list<scoped_refptr<CefBrowserInfo>>;
|
||||
@@ -213,10 +216,13 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
PendingPopup::Step previous_step,
|
||||
content::WebContents* new_contents);
|
||||
|
||||
// Retrieves the BrowserInfo matching the specified ID.
|
||||
// Retrieves the BrowserInfo matching the specified ID/token.
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoInternal(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
bool* is_guest_view);
|
||||
scoped_refptr<CefBrowserInfo> GetBrowserInfoInternal(
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
bool* is_guest_view);
|
||||
|
||||
// Send the response for a pending OnGetNewBrowserInfo request.
|
||||
static void SendNewBrowserInfoResponse(
|
||||
@@ -227,7 +233,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
|
||||
// Pending request for OnGetNewBrowserInfo.
|
||||
struct PendingNewBrowserInfo {
|
||||
content::GlobalRenderFrameHostId global_id;
|
||||
content::GlobalRenderFrameHostToken global_token;
|
||||
int timeout_id;
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback;
|
||||
scoped_refptr<base::SequencedTaskRunner> callback_runner;
|
||||
@@ -238,7 +244,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
|
||||
// Time out a response if it's still pending.
|
||||
static void TimeoutNewBrowserInfoResponse(
|
||||
const content::GlobalRenderFrameHostId& global_id,
|
||||
const content::GlobalRenderFrameHostToken& global_token,
|
||||
int timeout_id);
|
||||
|
||||
mutable base::Lock browser_info_lock_;
|
||||
@@ -252,7 +258,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::GlobalRenderFrameHostId,
|
||||
std::map<content::GlobalRenderFrameHostToken,
|
||||
std::unique_ptr<PendingNewBrowserInfo>>;
|
||||
PendingNewBrowserInfoMap pending_new_browser_info_map_;
|
||||
|
||||
|
@@ -50,9 +50,10 @@ void CefBrowserManager::GetNewRenderThreadInfo(
|
||||
}
|
||||
|
||||
void CefBrowserManager::GetNewBrowserInfo(
|
||||
int32_t render_frame_routing_id,
|
||||
const blink::LocalFrameToken& render_frame_token,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback) {
|
||||
CefBrowserInfoManager::GetInstance()->OnGetNewBrowserInfo(
|
||||
frame_util::MakeGlobalId(render_process_id_, render_frame_routing_id),
|
||||
content::GlobalRenderFrameHostToken(render_process_id_,
|
||||
render_frame_token),
|
||||
std::move(callback));
|
||||
}
|
||||
|
@@ -46,7 +46,7 @@ class CefBrowserManager : public cef::mojom::BrowserManager {
|
||||
cef::mojom::BrowserManager::GetNewRenderThreadInfoCallback callback)
|
||||
override;
|
||||
void GetNewBrowserInfo(
|
||||
int32_t render_frame_routing_id,
|
||||
const blink::LocalFrameToken& render_frame_token,
|
||||
cef::mojom::BrowserManager::GetNewBrowserInfoCallback callback) override;
|
||||
|
||||
// The process ID of the renderer.
|
||||
|
@@ -59,10 +59,10 @@ std::unique_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate(
|
||||
std::move(native_delegate), use_shared_texture, use_external_begin_frame);
|
||||
#elif BUILDFLAG(IS_MAC)
|
||||
return std::make_unique<CefBrowserPlatformDelegateOsrMac>(
|
||||
std::move(native_delegate));
|
||||
std::move(native_delegate), use_shared_texture, use_external_begin_frame);
|
||||
#elif BUILDFLAG(IS_LINUX)
|
||||
return std::make_unique<CefBrowserPlatformDelegateOsrLinux>(
|
||||
std::move(native_delegate), use_external_begin_frame);
|
||||
std::move(native_delegate), use_shared_texture, use_external_begin_frame);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ class CefAllowCertificateErrorCallbackImpl : public CefCallback {
|
||||
CefAllowCertificateErrorCallbackImpl& operator=(
|
||||
const CefAllowCertificateErrorCallbackImpl&) = delete;
|
||||
|
||||
~CefAllowCertificateErrorCallbackImpl() {
|
||||
~CefAllowCertificateErrorCallbackImpl() override {
|
||||
if (!callback_.is_null()) {
|
||||
// The callback is still pending. Cancel it now.
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
|
@@ -30,7 +30,7 @@ class BrowserDelegate : public content::WebContentsDelegate {
|
||||
// instances.
|
||||
class CreateParams : public base::RefCounted<CreateParams> {
|
||||
public:
|
||||
virtual ~CreateParams() {}
|
||||
virtual ~CreateParams() = default;
|
||||
};
|
||||
|
||||
// Called from the Browser constructor to create a new delegate.
|
||||
@@ -39,7 +39,7 @@ class BrowserDelegate : public content::WebContentsDelegate {
|
||||
scoped_refptr<CreateParams> cef_params,
|
||||
const Browser* opener);
|
||||
|
||||
~BrowserDelegate() override {}
|
||||
~BrowserDelegate() override = default;
|
||||
|
||||
// Optionally override Browser creation in
|
||||
// DevToolsWindow::CreateDevToolsBrowser. The returned Browser, if any, will
|
||||
@@ -119,6 +119,21 @@ class BrowserDelegate : public content::WebContentsDelegate {
|
||||
return callback;
|
||||
}
|
||||
|
||||
// Same as RendererUnresponsive but returning false if unhandled.
|
||||
virtual bool RendererUnresponsiveEx(
|
||||
content::WebContents* source,
|
||||
content::RenderWidgetHost* render_widget_host,
|
||||
base::RepeatingClosure hang_monitor_restarter) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Same as RendererResponsive but returning false if unhandled.
|
||||
virtual bool RendererResponsiveEx(
|
||||
content::WebContents* source,
|
||||
content::RenderWidgetHost* render_widget_host) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Optionally override support for the specified window feature of type
|
||||
// Browser::WindowFeature.
|
||||
virtual std::optional<bool> SupportsWindowFeature(int feature) const {
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "libcef/browser/chrome/chrome_browser_context.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
@@ -36,6 +38,27 @@ ChromeBrowserContext::ChromeBrowserContext(
|
||||
|
||||
ChromeBrowserContext::~ChromeBrowserContext() = default;
|
||||
|
||||
// static
|
||||
ChromeBrowserContext* ChromeBrowserContext::GetOrCreateForProfile(
|
||||
Profile* profile) {
|
||||
DCHECK(profile);
|
||||
|
||||
if (auto existing_context = FromProfile(profile)) {
|
||||
return static_cast<ChromeBrowserContext*>(existing_context);
|
||||
}
|
||||
|
||||
CefRequestContextSettings settings;
|
||||
if (!profile->IsOffTheRecord()) {
|
||||
// Become the primary context associated with |cache_path|.
|
||||
CefString(&settings.cache_path) = profile->GetPath().value();
|
||||
}
|
||||
|
||||
auto* new_context = new ChromeBrowserContext(settings);
|
||||
new_context->Initialize();
|
||||
new_context->ProfileCreated(CreateStatus::kInitialized, profile);
|
||||
return new_context;
|
||||
}
|
||||
|
||||
content::BrowserContext* ChromeBrowserContext::AsBrowserContext() {
|
||||
CHECK(!destroyed_);
|
||||
return profile_;
|
||||
@@ -74,7 +97,7 @@ void ChromeBrowserContext::InitializeAsync(base::OnceClosure initialized_cb) {
|
||||
if (cache_path_ == user_data_dir) {
|
||||
// Use the default disk-based profile.
|
||||
auto profile = GetPrimaryUserProfile();
|
||||
ProfileCreated(Profile::CreateStatus::CREATE_STATUS_INITIALIZED, profile);
|
||||
ProfileCreated(CreateStatus::kInitialized, profile);
|
||||
return;
|
||||
} else if (cache_path_.DirName() == user_data_dir) {
|
||||
// Create or load a specific disk-based profile. May continue
|
||||
@@ -83,10 +106,10 @@ void ChromeBrowserContext::InitializeAsync(base::OnceClosure initialized_cb) {
|
||||
cache_path_,
|
||||
base::BindOnce(&ChromeBrowserContext::ProfileCreated,
|
||||
weak_ptr_factory_.GetWeakPtr(),
|
||||
Profile::CreateStatus::CREATE_STATUS_INITIALIZED),
|
||||
CreateStatus::kInitialized),
|
||||
base::BindOnce(&ChromeBrowserContext::ProfileCreated,
|
||||
weak_ptr_factory_.GetWeakPtr(),
|
||||
Profile::CreateStatus::CREATE_STATUS_CREATED));
|
||||
CreateStatus::kCreated));
|
||||
return;
|
||||
} else {
|
||||
// All profile directories must be relative to |user_data_dir|.
|
||||
@@ -96,7 +119,7 @@ void ChromeBrowserContext::InitializeAsync(base::OnceClosure initialized_cb) {
|
||||
}
|
||||
|
||||
// Default to creating a new/unique OffTheRecord profile.
|
||||
ProfileCreated(Profile::CreateStatus::CREATE_STATUS_LOCAL_FAIL, nullptr);
|
||||
ProfileCreated(CreateStatus::kDefault, nullptr);
|
||||
}
|
||||
|
||||
void ChromeBrowserContext::Shutdown() {
|
||||
@@ -116,13 +139,13 @@ void ChromeBrowserContext::Shutdown() {
|
||||
}
|
||||
}
|
||||
|
||||
void ChromeBrowserContext::ProfileCreated(Profile::CreateStatus status,
|
||||
void ChromeBrowserContext::ProfileCreated(CreateStatus status,
|
||||
Profile* profile) {
|
||||
Profile* parent_profile = nullptr;
|
||||
OffTheRecordProfileImpl* otr_profile = nullptr;
|
||||
|
||||
if (status != Profile::CreateStatus::CREATE_STATUS_CREATED &&
|
||||
status != Profile::CreateStatus::CREATE_STATUS_INITIALIZED) {
|
||||
if (status != CreateStatus::kCreated &&
|
||||
status != CreateStatus::kInitialized) {
|
||||
CHECK(!profile);
|
||||
CHECK(!profile_);
|
||||
|
||||
@@ -136,7 +159,7 @@ void ChromeBrowserContext::ProfileCreated(Profile::CreateStatus status,
|
||||
profile_ = parent_profile->GetOffTheRecordProfile(
|
||||
profile_id, /*create_if_needed=*/true);
|
||||
otr_profile = static_cast<OffTheRecordProfileImpl*>(profile_);
|
||||
status = Profile::CreateStatus::CREATE_STATUS_INITIALIZED;
|
||||
status = CreateStatus::kInitialized;
|
||||
should_destroy_ = true;
|
||||
} else if (profile && !profile_) {
|
||||
// May be CREATE_STATUS_CREATED or CREATE_STATUS_INITIALIZED since
|
||||
@@ -144,11 +167,13 @@ void ChromeBrowserContext::ProfileCreated(Profile::CreateStatus status,
|
||||
// exists.
|
||||
profile_ = profile;
|
||||
profile_->AddObserver(this);
|
||||
profile_keep_alive_.reset(new ScopedProfileKeepAlive(
|
||||
profile_, ProfileKeepAliveOrigin::kAppWindow));
|
||||
if (!profile_->IsOffTheRecord()) {
|
||||
profile_keep_alive_ = std::make_unique<ScopedProfileKeepAlive>(
|
||||
profile_, ProfileKeepAliveOrigin::kAppWindow);
|
||||
}
|
||||
}
|
||||
|
||||
if (status == Profile::CreateStatus::CREATE_STATUS_INITIALIZED) {
|
||||
if (status == CreateStatus::kInitialized) {
|
||||
CHECK(profile_);
|
||||
|
||||
// Must set |profile_| before Init() calls
|
||||
|
@@ -23,6 +23,9 @@ class ChromeBrowserContext : public CefBrowserContext, public ProfileObserver {
|
||||
ChromeBrowserContext(const ChromeBrowserContext&) = delete;
|
||||
ChromeBrowserContext& operator=(const ChromeBrowserContext&) = delete;
|
||||
|
||||
// Returns a ChromeBrowserContext for the specified |profile|.
|
||||
static ChromeBrowserContext* GetOrCreateForProfile(Profile* profile);
|
||||
|
||||
void InitializeAsync(base::OnceClosure initialized_cb);
|
||||
|
||||
// CefBrowserContext overrides.
|
||||
@@ -38,7 +41,16 @@ class ChromeBrowserContext : public CefBrowserContext, public ProfileObserver {
|
||||
private:
|
||||
~ChromeBrowserContext() override;
|
||||
|
||||
void ProfileCreated(Profile::CreateStatus status, Profile* profile);
|
||||
enum class CreateStatus {
|
||||
// Default to creating a new/unique OffTheRecord profile.
|
||||
kDefault,
|
||||
// Profile created but before initializing extensions and promo resources.
|
||||
kCreated,
|
||||
// Profile is created, extensions and promo resources are initialized.
|
||||
kInitialized,
|
||||
};
|
||||
|
||||
void ProfileCreated(CreateStatus status, Profile* profile);
|
||||
|
||||
base::OnceClosure initialized_cb_;
|
||||
Profile* profile_ = nullptr;
|
||||
|
@@ -10,9 +10,11 @@
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/chrome/chrome_browser_context.h"
|
||||
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
|
||||
#include "libcef/browser/chrome/views/chrome_browser_view.h"
|
||||
#include "libcef/browser/chrome/views/chrome_child_window.h"
|
||||
#include "libcef/browser/hang_monitor.h"
|
||||
#include "libcef/browser/media_access_query.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/views/browser_view_impl.h"
|
||||
@@ -67,9 +69,7 @@ Browser* ChromeBrowserDelegate::CreateDevToolsBrowser(
|
||||
}
|
||||
|
||||
// We expect openers and popups to have the same Profile.
|
||||
CHECK_EQ(
|
||||
CefRequestContextImpl::GetProfile(opener_browser_host->request_context()),
|
||||
profile);
|
||||
CHECK_EQ(opener->profile(), profile);
|
||||
|
||||
//
|
||||
// 1. Get configuration settings from the user and create the new platform
|
||||
@@ -362,6 +362,26 @@ ChromeBrowserDelegate::RequestMediaAccessPermissionEx(
|
||||
return callback;
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::RendererUnresponsiveEx(
|
||||
content::WebContents* source,
|
||||
content::RenderWidgetHost* render_widget_host,
|
||||
base::RepeatingClosure hang_monitor_restarter) {
|
||||
if (auto browser = ChromeBrowserHostImpl::GetBrowserForBrowser(browser_)) {
|
||||
return hang_monitor::RendererUnresponsive(browser.get(), render_widget_host,
|
||||
hang_monitor_restarter);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::RendererResponsiveEx(
|
||||
content::WebContents* source,
|
||||
content::RenderWidgetHost* render_widget_host) {
|
||||
if (auto browser = ChromeBrowserHostImpl::GetBrowserForBrowser(browser_)) {
|
||||
return hang_monitor::RendererResponsive(browser.get(), render_widget_host);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::SupportsFramelessPictureInPicture() const {
|
||||
if (!browser_->is_type_picture_in_picture()) {
|
||||
return false;
|
||||
@@ -608,12 +628,25 @@ CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserDelegate::CreateBrowserHost(
|
||||
LOG(WARNING) << "Creating a chrome browser without a client";
|
||||
}
|
||||
|
||||
// Check if chrome and CEF are using the same browser context.
|
||||
// TODO(chrome-runtime): Verify if/when this might occur.
|
||||
// Get or create a ChromeBrowserContext for the browser Profile. Creation may
|
||||
// be necessary when selecting a new or incognito Profile for the first time
|
||||
// via the Chrome UI.
|
||||
auto chrome_browser_context =
|
||||
CefBrowserContext::FromBrowserContext(browser_->create_params().profile);
|
||||
ChromeBrowserContext::GetOrCreateForProfile(browser_->profile());
|
||||
|
||||
// If the provided CefRequestContext matches the ChromeBrowserContext then use
|
||||
// the provided one, as it will have the preferred CefRequestContextHandler.
|
||||
// Otherwise, get or create a CefRequestContext that matches.
|
||||
if (chrome_browser_context != request_context_impl->GetBrowserContext()) {
|
||||
LOG(WARNING) << "Creating a chrome browser with mismatched context";
|
||||
CefRefPtr<CefRequestContextHandler> handler;
|
||||
if (auto app = CefAppManager::Get()->GetApplication()) {
|
||||
if (auto bph = app->GetBrowserProcessHandler()) {
|
||||
handler = bph->GetDefaultRequestContextHandler();
|
||||
}
|
||||
}
|
||||
|
||||
request_context_impl = CefRequestContextImpl::GetOrCreateForBrowserContext(
|
||||
chrome_browser_context, handler);
|
||||
}
|
||||
|
||||
// Remains alive until the associated WebContents is destroyed.
|
||||
|
@@ -7,13 +7,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/browser_info.h"
|
||||
#include "libcef/browser/chrome/browser_delegate.h"
|
||||
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
class CefBrowserContentsDelegate;
|
||||
class CefRequestContextImpl;
|
||||
class CefWindowImpl;
|
||||
@@ -76,6 +75,13 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest& request,
|
||||
content::MediaResponseCallback callback) override;
|
||||
bool RendererUnresponsiveEx(
|
||||
content::WebContents* source,
|
||||
content::RenderWidgetHost* render_widget_host,
|
||||
base::RepeatingClosure hang_monitor_restarter) override;
|
||||
bool RendererResponsiveEx(
|
||||
content::WebContents* source,
|
||||
content::RenderWidgetHost* render_widget_host) override;
|
||||
std::optional<bool> SupportsWindowFeature(int feature) const override;
|
||||
bool SupportsDraggableRegion() const override;
|
||||
const std::optional<SkRegion> GetDraggableRegion() const override;
|
||||
|
@@ -596,6 +596,10 @@ void ChromeBrowserHostImpl::SetBrowser(Browser* browser) {
|
||||
static_cast<CefBrowserPlatformDelegateChrome*>(platform_delegate_.get())
|
||||
->set_chrome_browser(browser);
|
||||
if (browser_) {
|
||||
// We expect the Browser and CefRequestContext to have the same Profile.
|
||||
CHECK_EQ(browser_->profile(),
|
||||
request_context()->GetBrowserContext()->AsProfile());
|
||||
|
||||
host_window_handle_ = platform_delegate_->GetHostWindowHandle();
|
||||
} else {
|
||||
host_window_handle_ = kNullWindowHandle;
|
||||
|
@@ -27,7 +27,7 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
// possibly shared by multiple Browser instances.
|
||||
class DelegateCreateParams : public cef::BrowserDelegate::CreateParams {
|
||||
public:
|
||||
DelegateCreateParams(const CefBrowserCreateParams& create_params)
|
||||
explicit DelegateCreateParams(const CefBrowserCreateParams& create_params)
|
||||
: create_params_(create_params) {}
|
||||
|
||||
CefBrowserCreateParams create_params_;
|
||||
|
@@ -54,7 +54,7 @@ void HandleExternalProtocolHelper(
|
||||
bool is_in_fenced_frame_tree,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
const network::ResourceRequest& resource_request,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
const std::optional<url::Origin>& initiating_origin,
|
||||
content::WeakDocumentPtr initiator_document) {
|
||||
// May return nullptr if frame has been deleted or a cross-document navigation
|
||||
// has committed in the same RenderFrameHost.
|
||||
@@ -226,15 +226,15 @@ void ChromeContentBrowserClientCef::OverrideWebkitPrefs(
|
||||
web_contents->SetPageBaseBackgroundColor(base_background_color);
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
||||
void ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
int render_process_id,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
absl::optional<int64_t> navigation_id,
|
||||
std::optional<int64_t> navigation_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
network::URLLoaderFactoryBuilder& factory_builder,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
bool* bypass_redirect_checks,
|
||||
@@ -246,15 +246,16 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
||||
// profiles::CreateSystemProfileForUserManager.
|
||||
auto profile = Profile::FromBrowserContext(browser_context);
|
||||
if (!CefBrowserContext::FromProfile(profile)) {
|
||||
return ChromeContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
ChromeContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
browser_context, frame, render_process_id, type, request_initiator,
|
||||
navigation_id, ukm_source_id, factory_receiver, header_client,
|
||||
navigation_id, ukm_source_id, factory_builder, header_client,
|
||||
bypass_redirect_checks, disable_secure_dns, factory_override,
|
||||
navigation_response_task_runner);
|
||||
return;
|
||||
}
|
||||
|
||||
// Based on content/browser/devtools/devtools_instrumentation.cc
|
||||
// WillCreateURLLoaderFactoryInternal.
|
||||
// WillCreateURLLoaderFactoryParams::Run.
|
||||
network::mojom::URLLoaderFactoryOverridePtr cef_override(
|
||||
network::mojom::URLLoaderFactoryOverride::New());
|
||||
// If caller passed some existing overrides, use those.
|
||||
@@ -276,32 +277,31 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
||||
}
|
||||
|
||||
// TODO(chrome): Is it necessary to proxy |header_client| callbacks?
|
||||
bool use_proxy = ChromeContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
ChromeContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
browser_context, frame, render_process_id, type, request_initiator,
|
||||
navigation_id, ukm_source_id,
|
||||
&(intercepting_factory->overridden_factory_receiver),
|
||||
navigation_id, ukm_source_id, factory_builder,
|
||||
/*header_client=*/nullptr, bypass_redirect_checks, disable_secure_dns,
|
||||
handler_override, navigation_response_task_runner);
|
||||
|
||||
if (use_proxy) {
|
||||
DCHECK(intercepting_factory->overriding_factory);
|
||||
DCHECK(intercepting_factory->overridden_factory_receiver);
|
||||
if (!factory_override) {
|
||||
// Not a subresource navigation, so just override the target receiver.
|
||||
mojo::FusePipes(std::move(*factory_receiver),
|
||||
std::move(cef_override->overriding_factory));
|
||||
*factory_receiver = std::move(cef_override->overridden_factory_receiver);
|
||||
} else if (!*factory_override) {
|
||||
// No other overrides, so just returns ours as is.
|
||||
*factory_override = network::mojom::URLLoaderFactoryOverride::New(
|
||||
std::move(cef_override->overriding_factory),
|
||||
std::move(cef_override->overridden_factory_receiver), false);
|
||||
}
|
||||
// ... else things are already taken care of, as handler_override was
|
||||
// pointing to factory override and we've done all magic in-place.
|
||||
DCHECK(!cef_override->overriding_factory);
|
||||
DCHECK(!cef_override->overridden_factory_receiver);
|
||||
DCHECK(intercepting_factory->overriding_factory);
|
||||
DCHECK(intercepting_factory->overridden_factory_receiver);
|
||||
if (!factory_override) {
|
||||
// Not a subresource navigation, so just override the target receiver.
|
||||
auto [receiver, remote] = factory_builder.Append();
|
||||
mojo::FusePipes(std::move(receiver),
|
||||
std::move(cef_override->overriding_factory));
|
||||
mojo::FusePipes(std::move(cef_override->overridden_factory_receiver),
|
||||
std::move(remote));
|
||||
} else if (!*factory_override) {
|
||||
// No other overrides, so just returns ours as is.
|
||||
*factory_override = network::mojom::URLLoaderFactoryOverride::New(
|
||||
std::move(cef_override->overriding_factory),
|
||||
std::move(cef_override->overridden_factory_receiver), false);
|
||||
}
|
||||
// ... else things are already taken care of, as handler_override was
|
||||
// pointing to factory override and we've done all magic in-place.
|
||||
DCHECK(!cef_override->overriding_factory);
|
||||
DCHECK(!cef_override->overridden_factory_receiver);
|
||||
|
||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||
browser_context, frame, render_process_id,
|
||||
@@ -309,10 +309,8 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
||||
type == URLLoaderFactoryType::kDownload, request_initiator);
|
||||
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
browser_context, factory_receiver, header_client,
|
||||
browser_context, factory_builder, header_client,
|
||||
std::move(request_handler));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||
@@ -325,7 +323,7 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
const std::optional<url::Origin>& initiating_origin,
|
||||
content::RenderFrameHost* initiator_document,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
||||
// |out_factory| will be non-nullptr when this method is initially called
|
||||
@@ -353,7 +351,7 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||
bool is_in_fenced_frame_tree,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
const network::ResourceRequest& resource_request,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
const std::optional<url::Origin>& initiating_origin,
|
||||
content::RenderFrameHost* initiator_document,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver =
|
||||
@@ -418,6 +416,7 @@ std::unique_ptr<content::LoginDelegate>
|
||||
ChromeContentBrowserClientCef::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,
|
||||
@@ -434,8 +433,9 @@ ChromeContentBrowserClientCef::CreateLoginDelegate(
|
||||
}
|
||||
|
||||
return ChromeContentBrowserClient::CreateLoginDelegate(
|
||||
auth_info, web_contents, request_id, is_request_for_main_frame, url,
|
||||
response_headers, first_auth_attempt, std::move(auth_required_callback));
|
||||
auth_info, web_contents, browser_context, request_id,
|
||||
is_request_for_main_frame, url, response_headers, first_auth_attempt,
|
||||
std::move(auth_required_callback));
|
||||
}
|
||||
|
||||
void ChromeContentBrowserClientCef::BrowserURLHandlerCreated(
|
||||
|
@@ -55,15 +55,15 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
bool* no_javascript_access) override;
|
||||
void OverrideWebkitPrefs(content::WebContents* web_contents,
|
||||
blink::web_pref::WebPreferences* prefs) override;
|
||||
bool WillCreateURLLoaderFactory(
|
||||
void WillCreateURLLoaderFactory(
|
||||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
int render_process_id,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
absl::optional<int64_t> navigation_id,
|
||||
std::optional<int64_t> navigation_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
network::URLLoaderFactoryBuilder& factory_builder,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
bool* bypass_redirect_checks,
|
||||
@@ -81,7 +81,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
const std::optional<url::Origin>& initiating_origin,
|
||||
content::RenderFrameHost* initiator_document,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||
override;
|
||||
@@ -93,7 +93,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
bool is_in_fenced_frame_tree,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
const network::ResourceRequest& request,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
const std::optional<url::Origin>& initiating_origin,
|
||||
content::RenderFrameHost* initiator_document,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||
override;
|
||||
@@ -110,6 +110,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
||||
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,
|
||||
|
@@ -33,7 +33,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
const_cast<content::ContextMenuParams*>(&context_menu_->params()));
|
||||
model_ = new CefSimpleMenuModelImpl(
|
||||
const_cast<ui::SimpleMenuModel*>(&context_menu_->menu_model()),
|
||||
context_menu_, this, /*is_owned=*/false, /*is_popup=*/false);
|
||||
context_menu_, this, /*is_owned=*/false, /*is_submenu=*/false);
|
||||
|
||||
handler_->OnBeforeContextMenu(browser_, GetFrame(), params_, model_);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
}
|
||||
|
||||
void SetAccelerator(int command_id,
|
||||
absl::optional<ui::Accelerator> accel) override {
|
||||
std::optional<ui::Accelerator> accel) override {
|
||||
// No-op if already at the default state.
|
||||
if (!accel && !GetItemInfo(command_id)) {
|
||||
return;
|
||||
@@ -132,10 +132,10 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
|
||||
private:
|
||||
struct ItemInfo {
|
||||
ItemInfo() {}
|
||||
ItemInfo() = default;
|
||||
|
||||
bool checked = false;
|
||||
absl::optional<ui::Accelerator> accel;
|
||||
std::optional<ui::Accelerator> accel;
|
||||
};
|
||||
|
||||
ItemInfo* GetItemInfo(int command_id) {
|
||||
|
@@ -72,6 +72,12 @@ void CefBrowserPlatformDelegateChromeViews::WebContentsCreated(
|
||||
browser_view_->WebContentsCreated(web_contents);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::WebContentsDestroyed(
|
||||
content::WebContents* web_contents) {
|
||||
CefBrowserPlatformDelegateChrome::WebContentsDestroyed(web_contents);
|
||||
browser_view_->WebContentsDestroyed(web_contents);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::BrowserCreated(
|
||||
CefBrowserHostBase* browser) {
|
||||
CefBrowserPlatformDelegateChrome::BrowserCreated(browser);
|
||||
|
@@ -21,6 +21,7 @@ class CefBrowserPlatformDelegateChromeViews
|
||||
// CefBrowserPlatformDelegate overrides.
|
||||
void WebContentsCreated(content::WebContents* web_contents,
|
||||
bool owned) override;
|
||||
void WebContentsDestroyed(content::WebContents* web_contents) override;
|
||||
void BrowserCreated(CefBrowserHostBase* browser) override;
|
||||
void NotifyBrowserCreated() override;
|
||||
void NotifyBrowserDestroyed() override;
|
||||
|
@@ -5,6 +5,8 @@
|
||||
#include "libcef/browser/chrome/views/chrome_browser_frame.h"
|
||||
|
||||
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/views/window_view.h"
|
||||
|
||||
#include "chrome/browser/themes/theme_service.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
@@ -17,6 +19,9 @@
|
||||
#include "ui/views/widget/native_widget_private.h"
|
||||
#endif
|
||||
|
||||
ChromeBrowserFrame::ChromeBrowserFrame(CefWindowView* window_view)
|
||||
: window_view_(window_view) {}
|
||||
|
||||
void ChromeBrowserFrame::Init(BrowserView* browser_view,
|
||||
std::unique_ptr<Browser> browser) {
|
||||
DCHECK(browser_view);
|
||||
@@ -45,8 +50,51 @@ void ChromeBrowserFrame::Init(BrowserView* browser_view,
|
||||
#endif // BUILDFLAG(IS_MAC)
|
||||
}
|
||||
|
||||
void ChromeBrowserFrame::ToggleFullscreenMode() {
|
||||
chrome::ToggleFullscreenMode(browser_view_->browser());
|
||||
void ChromeBrowserFrame::Initialized() {
|
||||
initialized_ = true;
|
||||
|
||||
// Based on BrowserFrame::InitBrowserFrame.
|
||||
// This is the first call that will trigger theme-related client callbacks.
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
// Calls ThemeChanged() or OnNativeThemeUpdated().
|
||||
SelectNativeTheme();
|
||||
#else
|
||||
// Calls ThemeChanged().
|
||||
SetNativeTheme(ui::NativeTheme::GetInstanceForNativeUi());
|
||||
#endif
|
||||
}
|
||||
|
||||
void ChromeBrowserFrame::AddAssociatedProfile(Profile* /*profile*/) {
|
||||
// Calls ThemeChanged().
|
||||
UserChangedTheme(BrowserThemeChangeType::kBrowserTheme);
|
||||
}
|
||||
|
||||
void ChromeBrowserFrame::RemoveAssociatedProfile(Profile* /*profile*/) {}
|
||||
|
||||
Profile* ChromeBrowserFrame::GetThemeProfile() const {
|
||||
if (browser_view_) {
|
||||
return browser_view_->GetProfile();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ChromeBrowserFrame::ToggleFullscreenMode() {
|
||||
if (browser_view_) {
|
||||
// Toggle fullscreen mode via the Chrome command for consistent behavior.
|
||||
chrome::ToggleFullscreenMode(browser_view_->browser());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChromeBrowserFrame::UserChangedTheme(
|
||||
BrowserThemeChangeType theme_change_type) {
|
||||
// Callback from Browser::OnThemeChanged() and OnNativeThemeUpdated().
|
||||
|
||||
// Calls ThemeChanged() and possibly SelectNativeTheme().
|
||||
BrowserFrame::UserChangedTheme(theme_change_type);
|
||||
|
||||
NotifyThemeColorsChanged(/*chrome_theme=*/!native_theme_change_);
|
||||
}
|
||||
|
||||
views::internal::RootView* ChromeBrowserFrame::CreateRootView() {
|
||||
@@ -80,3 +128,41 @@ void ChromeBrowserFrame::Activate() {
|
||||
// Proceed with default handling.
|
||||
BrowserFrame::Activate();
|
||||
}
|
||||
|
||||
void ChromeBrowserFrame::OnNativeWidgetDestroyed() {
|
||||
window_view_ = nullptr;
|
||||
BrowserFrame::OnNativeWidgetDestroyed();
|
||||
}
|
||||
|
||||
void ChromeBrowserFrame::OnNativeThemeUpdated(ui::NativeTheme* observed_theme) {
|
||||
// TODO: Reduce the frequency of this callback on Windows/Linux.
|
||||
// See https://issues.chromium.org/issues/40280130#comment7
|
||||
|
||||
color_provider_tracker_.OnNativeThemeUpdated();
|
||||
|
||||
native_theme_change_ = true;
|
||||
|
||||
// Calls UserChangedTheme().
|
||||
BrowserFrame::OnNativeThemeUpdated(observed_theme);
|
||||
|
||||
native_theme_change_ = false;
|
||||
}
|
||||
|
||||
void ChromeBrowserFrame::OnColorProviderCacheResetMissed() {
|
||||
// Ignore calls during Widget::Init().
|
||||
if (!initialized_) {
|
||||
return;
|
||||
}
|
||||
|
||||
NotifyThemeColorsChanged(/*chrome_theme=*/false);
|
||||
}
|
||||
|
||||
void ChromeBrowserFrame::NotifyThemeColorsChanged(bool chrome_theme) {
|
||||
if (window_view_) {
|
||||
window_view_->OnThemeColorsChanged(chrome_theme);
|
||||
|
||||
// Call ThemeChanged() asynchronously to avoid possible reentrancy.
|
||||
CEF_POST_TASK(TID_UI, base::BindOnce(&ChromeBrowserFrame::ThemeChanged,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
}
|
||||
|
@@ -6,6 +6,10 @@
|
||||
#define CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_FRAME_H_
|
||||
#pragma once
|
||||
|
||||
#include "libcef/browser/views/color_provider_tracker.h"
|
||||
#include "libcef/browser/views/widget.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/views/frame/browser_frame.h"
|
||||
|
||||
@@ -86,18 +90,34 @@
|
||||
// modifications.
|
||||
|
||||
class BrowserView;
|
||||
class CefWindowView;
|
||||
|
||||
// Widget for a Views-hosted Chrome browser. Created in
|
||||
// CefWindowView::CreateWidget() when the Chrome runtime is enabled.
|
||||
class ChromeBrowserFrame : public BrowserFrame {
|
||||
class ChromeBrowserFrame : public BrowserFrame,
|
||||
public CefWidget,
|
||||
public CefColorProviderTracker::Observer {
|
||||
public:
|
||||
ChromeBrowserFrame() {}
|
||||
explicit ChromeBrowserFrame(CefWindowView* window_view);
|
||||
|
||||
ChromeBrowserFrame(const ChromeBrowserFrame&) = delete;
|
||||
ChromeBrowserFrame& operator=(const ChromeBrowserFrame&) = delete;
|
||||
|
||||
// Called from ChromeBrowserView::InitBrowser after |browser| creation.
|
||||
void Init(BrowserView* browser_view, std::unique_ptr<Browser> browser);
|
||||
|
||||
void ToggleFullscreenMode();
|
||||
// CefWidget methods:
|
||||
views::Widget* GetWidget() override { return this; }
|
||||
const views::Widget* GetWidget() const override { return this; }
|
||||
void Initialized() override;
|
||||
bool IsInitialized() const override { return initialized_; }
|
||||
void AddAssociatedProfile(Profile* profile) override;
|
||||
void RemoveAssociatedProfile(Profile* profile) override;
|
||||
Profile* GetThemeProfile() const override;
|
||||
bool ToggleFullscreenMode() override;
|
||||
|
||||
// BrowserFrame methods:
|
||||
void UserChangedTheme(BrowserThemeChangeType theme_change_type) override;
|
||||
|
||||
// views::Widget methods:
|
||||
views::internal::RootView* CreateRootView() override;
|
||||
@@ -105,10 +125,29 @@ class ChromeBrowserFrame : public BrowserFrame {
|
||||
override;
|
||||
void Activate() override;
|
||||
|
||||
// NativeWidgetDelegate methods:
|
||||
void OnNativeWidgetDestroyed() override;
|
||||
|
||||
// ui::NativeThemeObserver methods:
|
||||
void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override;
|
||||
|
||||
BrowserView* browser_view() const { return browser_view_; }
|
||||
|
||||
private:
|
||||
// CefColorProviderTracker::Observer methods:
|
||||
void OnColorProviderCacheResetMissed() override;
|
||||
|
||||
void NotifyThemeColorsChanged(bool chrome_theme);
|
||||
|
||||
CefWindowView* window_view_;
|
||||
BrowserView* browser_view_ = nullptr;
|
||||
|
||||
bool initialized_ = false;
|
||||
bool native_theme_change_ = false;
|
||||
|
||||
CefColorProviderTracker color_provider_tracker_{this};
|
||||
|
||||
base::WeakPtrFactory<ChromeBrowserFrame> weak_ptr_factory_{this};
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_FRAME_H_
|
||||
|
@@ -52,8 +52,17 @@ void ChromeBrowserView::ViewHierarchyChanged(
|
||||
}
|
||||
|
||||
void ChromeBrowserView::AddedToWidget() {
|
||||
// Create the Browser and ChromeBrowserHostImpl.
|
||||
// Results in a call to InitBrowser which calls ParentClass::AddedToWidget.
|
||||
cef_browser_view_->OnBrowserViewAdded();
|
||||
|
||||
// Call after ChromeBrowserHostImpl creation.
|
||||
cef_browser_view_->AddedToWidget();
|
||||
}
|
||||
|
||||
void ChromeBrowserView::RemovedFromWidget() {
|
||||
ParentClass::RemovedFromWidget();
|
||||
cef_browser_view_->RemovedFromWidget();
|
||||
}
|
||||
|
||||
void ChromeBrowserView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
|
||||
@@ -71,7 +80,7 @@ void ChromeBrowserView::OnGestureEvent(ui::GestureEvent* event) {
|
||||
ToolbarView* ChromeBrowserView::OverrideCreateToolbar() {
|
||||
if (cef_delegate()) {
|
||||
auto toolbar_type = cef_delegate()->GetChromeToolbarType(cef_browser_view_);
|
||||
absl::optional<ToolbarView::DisplayMode> display_mode;
|
||||
std::optional<ToolbarView::DisplayMode> display_mode;
|
||||
switch (toolbar_type) {
|
||||
case CEF_CTT_NORMAL:
|
||||
display_mode = ToolbarView::DisplayMode::NORMAL;
|
||||
|
@@ -42,6 +42,7 @@ class ChromeBrowserView
|
||||
void ViewHierarchyChanged(
|
||||
const views::ViewHierarchyChangedDetails& details) override;
|
||||
void AddedToWidget() override;
|
||||
void RemovedFromWidget() override;
|
||||
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
|
||||
void OnGestureEvent(ui::GestureEvent* event) override;
|
||||
|
||||
|
@@ -9,7 +9,7 @@ CefRefPtr<CefToolbarViewImpl> CefToolbarViewImpl::Create(
|
||||
CefRefPtr<CefViewDelegate> delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
absl::optional<ToolbarView::DisplayMode> display_mode) {
|
||||
std::optional<ToolbarView::DisplayMode> display_mode) {
|
||||
CEF_REQUIRE_UIT_RETURN(nullptr);
|
||||
CefRefPtr<CefToolbarViewImpl> view =
|
||||
new CefToolbarViewImpl(delegate, browser, browser_view, display_mode);
|
||||
@@ -24,7 +24,7 @@ CefToolbarViewImpl::CefToolbarViewImpl(
|
||||
CefRefPtr<CefViewDelegate> delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
absl::optional<ToolbarView::DisplayMode> display_mode)
|
||||
std::optional<ToolbarView::DisplayMode> display_mode)
|
||||
: ParentClass(delegate),
|
||||
browser_(browser),
|
||||
browser_view_(browser_view),
|
||||
|
@@ -27,7 +27,7 @@ class CefToolbarViewImpl
|
||||
CefRefPtr<CefViewDelegate> delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
absl::optional<ToolbarView::DisplayMode> display_mode);
|
||||
std::optional<ToolbarView::DisplayMode> display_mode);
|
||||
|
||||
static const char* const kTypeString;
|
||||
|
||||
@@ -41,7 +41,7 @@ class CefToolbarViewImpl
|
||||
CefToolbarViewImpl(CefRefPtr<CefViewDelegate> delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
absl::optional<ToolbarView::DisplayMode> display_mode);
|
||||
std::optional<ToolbarView::DisplayMode> display_mode);
|
||||
|
||||
// CefViewImpl methods:
|
||||
CefToolbarViewView* CreateRootView() override;
|
||||
@@ -49,7 +49,7 @@ class CefToolbarViewImpl
|
||||
|
||||
Browser* const browser_;
|
||||
BrowserView* const browser_view_;
|
||||
absl::optional<ToolbarView::DisplayMode> const display_mode_;
|
||||
std::optional<ToolbarView::DisplayMode> const display_mode_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefToolbarViewImpl);
|
||||
};
|
||||
|
@@ -7,5 +7,5 @@
|
||||
CefToolbarViewView::CefToolbarViewView(CefViewDelegate* cef_delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
absl::optional<DisplayMode> display_mode)
|
||||
std::optional<DisplayMode> display_mode)
|
||||
: ParentClass(cef_delegate, browser, browser_view, display_mode) {}
|
||||
|
@@ -18,7 +18,7 @@ class CefToolbarViewView : public CefViewView<ToolbarView, CefViewDelegate> {
|
||||
explicit CefToolbarViewView(CefViewDelegate* cef_delegate,
|
||||
Browser* browser,
|
||||
BrowserView* browser_view,
|
||||
absl::optional<DisplayMode> display_mode);
|
||||
std::optional<DisplayMode> display_mode);
|
||||
|
||||
CefToolbarViewView(const CefToolbarViewView&) = delete;
|
||||
CefToolbarViewView& operator=(const CefToolbarViewView&) = delete;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user