mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
34 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 |
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/123.0.6312.124',
|
||||
'depot_tools_checkout': 'cb43b5d82d'
|
||||
'chromium_checkout': 'refs/tags/124.0.6367.207',
|
||||
'depot_tools_checkout': '19199514e8'
|
||||
}
|
||||
|
@@ -39,6 +39,7 @@
|
||||
'chrome/renderer/chrome_content_renderer_client.*',
|
||||
'chrome/renderer/extensions/chrome_extensions_renderer_client.*',
|
||||
'components/content_settings/core/common/content_settings_types.mojom',
|
||||
'components/permissions/request_type.h',
|
||||
'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=e7f9480661f77931890085d6c5bf23d9842212e2$
|
||||
// $hash=abcb584dbf5965834f415a0f2daeda3e361696b2$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||
@@ -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=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
|
||||
|
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 "93050a5111ee3131f5589bd7d3be5376539a64c2"
|
||||
#define CEF_API_HASH_UNIVERSAL "35035b76d79ba0c7144aedb63d72b7988d372706"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "ebcca93f53d935802a4cd02606864ff1eb1a1baa"
|
||||
#define CEF_API_HASH_PLATFORM "9227cf2e0abf4f378e31e6095d503a91b2da59af"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "a2c1ee5ae59a181773019412084903e4824aa300"
|
||||
#define CEF_API_HASH_PLATFORM "fe0bdc49d209ee3cf108bdb72faec21316f9d0e0"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "915ea22829d9814cb6481891de4619f0aafda72f"
|
||||
#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
|
||||
|
@@ -1007,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_
|
||||
|
@@ -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_
|
@@ -917,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;
|
||||
|
||||
///
|
||||
@@ -1027,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
|
||||
@@ -2821,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.
|
||||
///
|
||||
@@ -2868,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.
|
||||
@@ -2949,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.
|
||||
@@ -3223,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
|
||||
@@ -3294,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;
|
||||
|
||||
///
|
||||
@@ -3567,9 +3634,9 @@ typedef enum {
|
||||
CEF_PERMISSION_TYPE_DISK_QUOTA = 1 << 7,
|
||||
CEF_PERMISSION_TYPE_LOCAL_FONTS = 1 << 8,
|
||||
CEF_PERMISSION_TYPE_GEOLOCATION = 1 << 9,
|
||||
CEF_PERMISSION_TYPE_IDLE_DETECTION = 1 << 10,
|
||||
CEF_PERMISSION_TYPE_MIC_STREAM = 1 << 11,
|
||||
CEF_PERMISSION_TYPE_MIDI = 1 << 12,
|
||||
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,
|
||||
@@ -3772,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_
|
@@ -418,7 +418,16 @@ typedef enum {
|
||||
/// Whether an application can enumerate audio output device.
|
||||
CEF_CONTENT_SETTING_TYPE_SPEAKER_SELECTION,
|
||||
|
||||
CEF_CONTENT_SETTING_TYPE_NUM_TYPES,
|
||||
/// 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_
|
||||
|
@@ -18,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"
|
||||
@@ -1196,6 +1197,20 @@ void AlloyBrowserHostImpl::WebContentsCreated(
|
||||
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_) {
|
||||
|
@@ -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,
|
||||
|
@@ -37,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"
|
||||
@@ -54,6 +55,9 @@
|
||||
#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)
|
||||
@@ -126,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()) {
|
||||
@@ -172,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
|
||||
@@ -191,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
|
||||
@@ -219,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);
|
||||
|
||||
@@ -228,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);
|
||||
@@ -246,6 +243,8 @@ 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));
|
||||
}
|
||||
|
@@ -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
|
||||
};
|
||||
|
||||
|
@@ -980,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);
|
||||
@@ -999,7 +996,7 @@ AlloyContentBrowserClient::CreateURLLoaderThrottles(
|
||||
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
|
||||
content::NavigationUIData* navigation_ui_data,
|
||||
int frame_tree_node_id,
|
||||
absl::optional<int64_t> navigation_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.
|
||||
@@ -1100,20 +1097,27 @@ 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(
|
||||
|
@@ -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;
|
||||
@@ -137,7 +138,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
|
||||
content::NavigationUIData* navigation_ui_data,
|
||||
int frame_tree_node_id,
|
||||
absl::optional<int64_t> navigation_id) override;
|
||||
std::optional<int64_t> navigation_id) override;
|
||||
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
|
||||
CreateURLLoaderThrottlesForKeepAlive(
|
||||
const network::ResourceRequest& request,
|
||||
@@ -171,9 +172,9 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
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,
|
||||
|
@@ -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_
|
||||
|
@@ -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 {
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -158,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;
|
||||
@@ -177,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>
|
||||
|
@@ -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"
|
||||
|
||||
/*
|
||||
@@ -187,7 +187,7 @@ class CefBrowserContext {
|
||||
CefRefPtr<CefRequestContextImpl> GetAnyRequestContext(
|
||||
bool prefer_no_handler) const;
|
||||
|
||||
using CookieableSchemes = absl::optional<std::vector<std::string>>;
|
||||
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"
|
||||
@@ -256,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);
|
||||
}
|
||||
@@ -707,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(
|
||||
|
@@ -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"
|
||||
@@ -238,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;
|
||||
@@ -341,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;
|
||||
@@ -391,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.
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -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 {
|
||||
|
@@ -55,8 +55,7 @@ ChromeBrowserContext* ChromeBrowserContext::GetOrCreateForProfile(
|
||||
|
||||
auto* new_context = new ChromeBrowserContext(settings);
|
||||
new_context->Initialize();
|
||||
new_context->ProfileCreated(Profile::CreateStatus::CREATE_STATUS_INITIALIZED,
|
||||
profile);
|
||||
new_context->ProfileCreated(CreateStatus::kInitialized, profile);
|
||||
return new_context;
|
||||
}
|
||||
|
||||
@@ -98,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
|
||||
@@ -107,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|.
|
||||
@@ -120,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() {
|
||||
@@ -140,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_);
|
||||
|
||||
@@ -160,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
|
||||
@@ -174,7 +173,7 @@ void ChromeBrowserContext::ProfileCreated(Profile::CreateStatus status,
|
||||
}
|
||||
}
|
||||
|
||||
if (status == Profile::CreateStatus::CREATE_STATUS_INITIALIZED) {
|
||||
if (status == CreateStatus::kInitialized) {
|
||||
CHECK(profile_);
|
||||
|
||||
// Must set |profile_| before Init() calls
|
||||
|
@@ -41,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;
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#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"
|
||||
@@ -361,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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
@@ -135,7 +135,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
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() = default;
|
||||
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;
|
||||
|
@@ -34,6 +34,9 @@ namespace {
|
||||
|
||||
CefContext* g_context = nullptr;
|
||||
|
||||
// Invalid value before CefInitialize is called.
|
||||
int g_exit_code = -1;
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
// When the process terminates check if CefShutdown() has been called.
|
||||
class CefShutdownChecker {
|
||||
@@ -309,8 +312,11 @@ bool CefInitialize(const CefMainArgs& args,
|
||||
g_context = new CefContext();
|
||||
|
||||
// Initialize the global context.
|
||||
if (!g_context->Initialize(args, settings, application,
|
||||
windows_sandbox_info)) {
|
||||
const bool initialized =
|
||||
g_context->Initialize(args, settings, application, windows_sandbox_info);
|
||||
g_exit_code = g_context->exit_code();
|
||||
|
||||
if (!initialized) {
|
||||
// Initialization failed. Delete the global context object.
|
||||
delete g_context;
|
||||
g_context = nullptr;
|
||||
@@ -320,6 +326,11 @@ bool CefInitialize(const CefMainArgs& args,
|
||||
return true;
|
||||
}
|
||||
|
||||
int CefGetExitCode() {
|
||||
DCHECK_NE(g_exit_code, -1) << "invalid call to CefGetExitCode";
|
||||
return g_exit_code;
|
||||
}
|
||||
|
||||
void CefShutdown() {
|
||||
// Verify that the context is in a valid state.
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
@@ -477,10 +488,14 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
|
||||
main_runner_ = std::make_unique<CefMainRunner>(
|
||||
settings_.multi_threaded_message_loop, settings_.external_message_pump);
|
||||
if (!main_runner_->Initialize(
|
||||
&settings_, application, args, windows_sandbox_info, &initialized_,
|
||||
base::BindOnce(&CefContext::OnContextInitialized,
|
||||
base::Unretained(this)))) {
|
||||
|
||||
const bool initialized = main_runner_->Initialize(
|
||||
&settings_, application, args, windows_sandbox_info, &initialized_,
|
||||
base::BindOnce(&CefContext::OnContextInitialized,
|
||||
base::Unretained(this)));
|
||||
exit_code_ = main_runner_->exit_code();
|
||||
|
||||
if (!initialized) {
|
||||
shutting_down_ = true;
|
||||
FinalizeShutdown();
|
||||
return false;
|
||||
|
@@ -52,10 +52,13 @@ class CefContext {
|
||||
bool OnInitThread();
|
||||
|
||||
// Returns true if the context is initialized.
|
||||
bool initialized() { return initialized_; }
|
||||
bool initialized() const { return initialized_; }
|
||||
|
||||
// Returns true if the context is shutting down.
|
||||
bool shutting_down() { return shutting_down_; }
|
||||
bool shutting_down() const { return shutting_down_; }
|
||||
|
||||
// Only valid after Initialize is called.
|
||||
int exit_code() const { return exit_code_; }
|
||||
|
||||
const CefSettings& settings() const { return settings_; }
|
||||
|
||||
@@ -100,6 +103,7 @@ class CefContext {
|
||||
// Track context state.
|
||||
bool initialized_ = false;
|
||||
bool shutting_down_ = false;
|
||||
int exit_code_ = -1;
|
||||
|
||||
// The thread on which the context was initialized.
|
||||
base::PlatformThreadId init_thread_id_ = 0;
|
||||
|
@@ -82,7 +82,7 @@ void CefDevToolsFileManager::Save(const std::string& url,
|
||||
base::FilePath initial_path;
|
||||
|
||||
if (const base::Value* path_value = file_map.Find(base::MD5String(url))) {
|
||||
absl::optional<base::FilePath> path = base::ValueToFilePath(*path_value);
|
||||
std::optional<base::FilePath> path = base::ValueToFilePath(*path_value);
|
||||
if (path) {
|
||||
initial_path = std::move(*path);
|
||||
}
|
||||
|
@@ -414,7 +414,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
// TODO(pfeldman): handle some of the embedder messages in content.
|
||||
const std::string* url = params[0].GetIfString();
|
||||
const std::string* headers = params[1].GetIfString();
|
||||
absl::optional<const int> stream_id = params[2].GetIfInt();
|
||||
std::optional<const int> stream_id = params[2].GetIfInt();
|
||||
if (!url || !headers || !stream_id.has_value()) {
|
||||
return;
|
||||
}
|
||||
@@ -540,7 +540,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
}
|
||||
const std::string* url = params[0].GetIfString();
|
||||
const std::string* content = params[1].GetIfString();
|
||||
absl::optional<bool> save_as = params[2].GetIfBool();
|
||||
std::optional<bool> save_as = params[2].GetIfBool();
|
||||
if (!url || !content || !save_as.has_value()) {
|
||||
return;
|
||||
}
|
||||
|
@@ -68,7 +68,7 @@ ExtensionFunction::ResponseAction TabsGetFunction::Run() {
|
||||
TabsCreateFunction::TabsCreateFunction() : cef_details_(this) {}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsCreateFunction::Run() {
|
||||
absl::optional<tabs::Create::Params> params =
|
||||
std::optional<tabs::Create::Params> params =
|
||||
tabs::Create::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
@@ -108,7 +108,7 @@ content::WebContents* BaseAPIFunction::GetWebContents(int tab_id) {
|
||||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsUpdateFunction::Run() {
|
||||
absl::optional<tabs::Update::Params> params =
|
||||
std::optional<tabs::Update::Params> params =
|
||||
tabs::Update::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
@@ -391,7 +391,7 @@ void ExecuteCodeInTabFunction::LoadFileComplete(
|
||||
const std::string& file,
|
||||
std::unique_ptr<std::string> data) {
|
||||
std::vector<std::unique_ptr<std::string>> data_list;
|
||||
absl::optional<std::string> error;
|
||||
std::optional<std::string> error;
|
||||
const bool success = !!data.get();
|
||||
if (success) {
|
||||
DCHECK(data);
|
||||
@@ -411,7 +411,7 @@ bool TabsRemoveCSSFunction::ShouldRemoveCSS() const {
|
||||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
||||
absl::optional<tabs::SetZoom::Params> params =
|
||||
std::optional<tabs::SetZoom::Params> params =
|
||||
tabs::SetZoom::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
@@ -443,7 +443,7 @@ ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
||||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
||||
absl::optional<tabs::GetZoom::Params> params =
|
||||
std::optional<tabs::GetZoom::Params> params =
|
||||
tabs::GetZoom::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
@@ -463,7 +463,7 @@ ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
||||
ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
||||
using tabs::ZoomSettings;
|
||||
|
||||
absl::optional<tabs::SetZoomSettings::Params> params =
|
||||
std::optional<tabs::SetZoomSettings::Params> params =
|
||||
tabs::SetZoomSettings::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
@@ -514,7 +514,7 @@ ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
||||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
|
||||
absl::optional<tabs::GetZoomSettings::Params> params =
|
||||
std::optional<tabs::GetZoomSettings::Params> params =
|
||||
tabs::GetZoomSettings::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
@@ -99,13 +99,13 @@ class CefExtensionFunctionDetails {
|
||||
~OpenTabParams();
|
||||
|
||||
bool create_browser_if_needed = false;
|
||||
absl::optional<int> window_id;
|
||||
absl::optional<int> opener_tab_id;
|
||||
absl::optional<std::string> url;
|
||||
absl::optional<bool> active;
|
||||
absl::optional<bool> pinned;
|
||||
absl::optional<int> index;
|
||||
absl::optional<int> bookmark_id;
|
||||
std::optional<int> window_id;
|
||||
std::optional<int> opener_tab_id;
|
||||
std::optional<std::string> url;
|
||||
std::optional<bool> active;
|
||||
std::optional<bool> pinned;
|
||||
std::optional<int> index;
|
||||
std::optional<int> bookmark_id;
|
||||
};
|
||||
|
||||
// Opens a new tab given creation parameters |params|. Returns a Tab object
|
||||
|
@@ -58,7 +58,7 @@ namespace extensions {
|
||||
namespace {
|
||||
|
||||
// Implementation based on ComponentLoader::ParseManifest.
|
||||
absl::optional<base::Value::Dict> ParseManifest(
|
||||
std::optional<base::Value::Dict> ParseManifest(
|
||||
base::StringPiece manifest_contents) {
|
||||
JSONStringValueDeserializer deserializer(manifest_contents);
|
||||
std::unique_ptr<base::Value> manifest =
|
||||
@@ -66,7 +66,7 @@ absl::optional<base::Value::Dict> ParseManifest(
|
||||
|
||||
if (!manifest.get() || !manifest->is_dict()) {
|
||||
LOG(ERROR) << "Failed to parse extension manifest.";
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return std::move(*manifest).TakeDict();
|
||||
|
@@ -100,8 +100,8 @@ ValueStore::WriteResult CefValueStore::Set(WriteOptions options,
|
||||
if (!old_value || *old_value != value) {
|
||||
changes.emplace_back(key,
|
||||
old_value
|
||||
? absl::optional<base::Value>(old_value->Clone())
|
||||
: absl::nullopt,
|
||||
? std::optional<base::Value>(old_value->Clone())
|
||||
: std::nullopt,
|
||||
value.Clone());
|
||||
storage_.Set(key, value.Clone());
|
||||
}
|
||||
@@ -122,9 +122,9 @@ ValueStore::WriteResult CefValueStore::Remove(
|
||||
|
||||
ValueStoreChangeList changes;
|
||||
for (auto const& key : keys) {
|
||||
absl::optional<base::Value> old_value = storage_.Extract(key);
|
||||
std::optional<base::Value> old_value = storage_.Extract(key);
|
||||
if (old_value.has_value()) {
|
||||
changes.emplace_back(key, std::move(*old_value), absl::nullopt);
|
||||
changes.emplace_back(key, std::move(*old_value), std::nullopt);
|
||||
}
|
||||
}
|
||||
return WriteResult(std::move(changes), CreateStatusCopy(status_));
|
||||
|
@@ -118,7 +118,7 @@ FileChooserParams SelectFileToFileChooserParams(
|
||||
const ui::SelectFileDialog::FileTypeInfo* file_types) {
|
||||
FileChooserParams params;
|
||||
|
||||
absl::optional<FileChooserParams::Mode> mode;
|
||||
std::optional<FileChooserParams::Mode> mode;
|
||||
switch (type) {
|
||||
case ui::SelectFileDialog::Type::SELECT_UPLOAD_FOLDER:
|
||||
mode = FileChooserParams::Mode::kUploadFolder;
|
||||
|
@@ -692,7 +692,7 @@ void CefFrameHostImpl::FrameAttached(
|
||||
}
|
||||
|
||||
void CefFrameHostImpl::UpdateDraggableRegions(
|
||||
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions) {
|
||||
std::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions) {
|
||||
auto browser = GetBrowserHostBase();
|
||||
if (!browser) {
|
||||
return;
|
||||
|
@@ -154,7 +154,7 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
|
||||
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;
|
||||
|
||||
bool is_temporary() const { return !frame_token_.has_value(); }
|
||||
|
167
libcef/browser/hang_monitor.cc
Normal file
167
libcef/browser/hang_monitor.cc
Normal file
@@ -0,0 +1,167 @@
|
||||
// Copyright 2024 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/hang_monitor.h"
|
||||
|
||||
#include "include/cef_client.h"
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/hang_monitor/hang_crash_dump.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/common/result_codes.h"
|
||||
|
||||
namespace hang_monitor {
|
||||
|
||||
namespace {
|
||||
|
||||
// Based on HungRendererDialogView::ForceCrashHungRenderer.
|
||||
void ForceCrashHungRenderer(content::RenderWidgetHost* render_widget_host) {
|
||||
content::RenderProcessHost* rph = render_widget_host->GetProcess();
|
||||
if (rph) {
|
||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
// A generic |CrashDumpHungChildProcess()| is not implemented for Linux.
|
||||
// Instead we send an explicit IPC to crash on the renderer's IO thread.
|
||||
rph->ForceCrash();
|
||||
#else
|
||||
// Try to generate a crash report for the hung process.
|
||||
CrashDumpHungChildProcess(rph->GetProcess().Handle());
|
||||
rph->Shutdown(content::RESULT_CODE_HUNG);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
class CefUnresponsiveProcessCallbackImpl
|
||||
: public CefUnresponsiveProcessCallback {
|
||||
public:
|
||||
CefUnresponsiveProcessCallbackImpl(
|
||||
content::RenderWidgetHost* render_widget_host,
|
||||
base::RepeatingClosure hang_monitor_restarter)
|
||||
: render_widget_host_(render_widget_host),
|
||||
hang_monitor_restarter_(hang_monitor_restarter) {}
|
||||
|
||||
CefUnresponsiveProcessCallbackImpl(
|
||||
const CefUnresponsiveProcessCallbackImpl&) = delete;
|
||||
CefUnresponsiveProcessCallbackImpl& operator=(
|
||||
const CefUnresponsiveProcessCallbackImpl&) = delete;
|
||||
|
||||
~CefUnresponsiveProcessCallbackImpl() override {
|
||||
// Do nothing on destruction.
|
||||
}
|
||||
|
||||
void Wait() override { ContinueNow(true); }
|
||||
|
||||
void Terminate() override { ContinueNow(false); }
|
||||
|
||||
void Detach() {
|
||||
render_widget_host_ = nullptr;
|
||||
hang_monitor_restarter_.Reset();
|
||||
}
|
||||
|
||||
bool IsDetached() const { return !render_widget_host_; }
|
||||
|
||||
private:
|
||||
void ContinueNow(bool wait) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!IsDetached()) {
|
||||
RunNow(render_widget_host_, hang_monitor_restarter_, wait);
|
||||
Detach();
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefUnresponsiveProcessCallbackImpl::ContinueNow, this,
|
||||
wait));
|
||||
}
|
||||
}
|
||||
|
||||
static void RunNow(content::RenderWidgetHost* render_widget_host,
|
||||
base::RepeatingClosure hang_monitor_restarter,
|
||||
bool wait) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (wait) {
|
||||
hang_monitor_restarter.Run();
|
||||
} else {
|
||||
ForceCrashHungRenderer(render_widget_host);
|
||||
}
|
||||
}
|
||||
|
||||
content::RenderWidgetHost* render_widget_host_;
|
||||
base::RepeatingClosure hang_monitor_restarter_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefUnresponsiveProcessCallbackImpl);
|
||||
};
|
||||
|
||||
bool ResetRendererCallback(CefBrowserHostBase* browser) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (auto callback = browser->unresponsive_process_callback()) {
|
||||
Detach(callback);
|
||||
browser->set_unresponsive_process_callback(nullptr);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestHandler> GetRequestHandler(CefBrowserHostBase* browser) {
|
||||
if (auto client = browser->GetClient()) {
|
||||
return client->GetRequestHandler();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool RendererUnresponsive(CefBrowserHostBase* browser,
|
||||
content::RenderWidgetHost* render_widget_host,
|
||||
base::RepeatingClosure hang_monitor_restarter) {
|
||||
// There should be no callback currently.
|
||||
DCHECK(!browser->unresponsive_process_callback());
|
||||
|
||||
if (auto handler = GetRequestHandler(browser)) {
|
||||
CefRefPtr<CefUnresponsiveProcessCallbackImpl> callbackImpl(
|
||||
new CefUnresponsiveProcessCallbackImpl(render_widget_host,
|
||||
hang_monitor_restarter));
|
||||
if (!handler->OnRenderProcessUnresponsive(browser, callbackImpl.get())) {
|
||||
if (!callbackImpl->IsDetached()) {
|
||||
// Proceed with default handling.
|
||||
callbackImpl->Detach();
|
||||
return false;
|
||||
} else {
|
||||
LOG(ERROR) << "Should return true from OnRenderProcessUnresponsive "
|
||||
"when executing the callback";
|
||||
}
|
||||
}
|
||||
|
||||
// Proceed with client handling. The callback may already be executed, but
|
||||
// we still want to wait for RendererResponsive.
|
||||
browser->set_unresponsive_process_callback(callbackImpl.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
// Proceed with default handling.
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RendererResponsive(CefBrowserHostBase* browser,
|
||||
content::RenderWidgetHost* render_widget_host) {
|
||||
// |handled| will be true if the client handled OnRenderProcessUnresponsive.
|
||||
bool handled = ResetRendererCallback(browser);
|
||||
|
||||
// Always execute the client callback.
|
||||
if (auto handler = GetRequestHandler(browser)) {
|
||||
handler->OnRenderProcessResponsive(browser);
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
void Detach(CefRefPtr<CefUnresponsiveProcessCallback> callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
auto* callback_impl =
|
||||
static_cast<CefUnresponsiveProcessCallbackImpl*>(callback.get());
|
||||
callback_impl->Detach();
|
||||
}
|
||||
|
||||
} // namespace hang_monitor
|
37
libcef/browser/hang_monitor.h
Normal file
37
libcef/browser/hang_monitor.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// Copyright 2024 The Chromium Embedded Framework Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_HANG_MONITOR_H_
|
||||
#define CEF_LIBCEF_BROWSER_HANG_MONITOR_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_unresponsive_process_callback.h"
|
||||
|
||||
#include "base/functional/callback.h"
|
||||
|
||||
namespace content {
|
||||
class RenderWidgetHost;
|
||||
}
|
||||
|
||||
class CefBrowserHostBase;
|
||||
|
||||
namespace hang_monitor {
|
||||
|
||||
// Called from WebContentsDelegate::RendererUnresponsive.
|
||||
// Returns false for default handling.
|
||||
bool RendererUnresponsive(CefBrowserHostBase* browser,
|
||||
content::RenderWidgetHost* render_widget_host,
|
||||
base::RepeatingClosure hang_monitor_restarter);
|
||||
|
||||
// Called from WebContentsDelegate::RendererResponsive.
|
||||
// Returns false for default handling.
|
||||
bool RendererResponsive(CefBrowserHostBase* browser,
|
||||
content::RenderWidgetHost* render_widget_host);
|
||||
|
||||
// Detach an existing callback object.
|
||||
void Detach(CefRefPtr<CefUnresponsiveProcessCallback> callback);
|
||||
|
||||
} // namespace hang_monitor
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_HANG_MONITOR_H_
|
@@ -31,6 +31,13 @@
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "third_party/crashpad/crashpad/handler/handler_main.h"
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
#include "ui/base/ozone_buildflags.h"
|
||||
#if BUILDFLAG(IS_OZONE_X11)
|
||||
#include "ui/ozone/platform/x11/ozone_platform_x11.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include <Objbase.h>
|
||||
#include <windows.h>
|
||||
@@ -155,6 +162,17 @@ class CefUIThread : public base::PlatformThread::Delegate {
|
||||
|
||||
void InitializeBrowserRunner(
|
||||
content::MainFunctionParams main_function_params) {
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
#if BUILDFLAG(IS_OZONE_X11)
|
||||
// Disable creation of GtkUi (interface to GTK desktop features) and cause
|
||||
// ui::GetDefaultLinuxUi() (and related functions) to return nullptr. We
|
||||
// can't use GtkUi in combination with multi-threaded-message-loop because
|
||||
// Chromium's GTK implementation doesn't use GDK threads. Light/dark theme
|
||||
// changes will still be detected via DarkModeManagerLinux.
|
||||
ui::SetMultiThreadedMessageLoopX11();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Use our own browser process runner.
|
||||
browser_runner_ = content::BrowserMainRunner::Create();
|
||||
|
||||
@@ -245,20 +263,20 @@ bool CefMainRunner::Initialize(CefSettings* settings,
|
||||
settings->chrome_runtime ? RuntimeType::CHROME : RuntimeType::ALLOY, this,
|
||||
settings, application);
|
||||
|
||||
int exit_code =
|
||||
exit_code_ =
|
||||
ContentMainInitialize(args, windows_sandbox_info, &settings->no_sandbox);
|
||||
if (exit_code >= 0) {
|
||||
LOG(ERROR) << "ContentMainInitialize failed with exit code " << exit_code;
|
||||
if (exit_code_ >= 0) {
|
||||
LOG(ERROR) << "ContentMainInitialize failed with exit code " << exit_code_;
|
||||
return false;
|
||||
}
|
||||
|
||||
exit_code = ContentMainRun(initialized, std::move(context_initialized));
|
||||
if (exit_code != content::RESULT_CODE_NORMAL_EXIT) {
|
||||
exit_code_ = ContentMainRun(initialized, std::move(context_initialized));
|
||||
if (exit_code_ != content::RESULT_CODE_NORMAL_EXIT) {
|
||||
// Some exit codes are used to exit early, but are otherwise a normal
|
||||
// result. Don't log for those codes.
|
||||
if (!chrome::IsNormalResultCode(
|
||||
static_cast<chrome::ResultCode>(exit_code))) {
|
||||
LOG(ERROR) << "ContentMainRun failed with exit code " << exit_code;
|
||||
static_cast<chrome::ResultCode>(exit_code_))) {
|
||||
LOG(ERROR) << "ContentMainRun failed with exit code " << exit_code_;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@@ -42,6 +42,9 @@ class CefMainRunner : public CefMainRunnerHandler {
|
||||
bool* initialized,
|
||||
base::OnceClosure context_initialized);
|
||||
|
||||
// Only valid after Initialize is called.
|
||||
int exit_code() const { return exit_code_; }
|
||||
|
||||
// Called from CefContext::Shutdown.
|
||||
void Shutdown(base::OnceClosure shutdown_on_ui_thread,
|
||||
base::OnceClosure finalize_shutdown);
|
||||
@@ -90,6 +93,8 @@ class CefMainRunner : public CefMainRunnerHandler {
|
||||
|
||||
// Used to quit the current base::RunLoop.
|
||||
base::OnceClosure quit_callback_;
|
||||
|
||||
int exit_code_ = -1;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_MAIN_RUNNER_H_
|
||||
|
@@ -45,9 +45,9 @@ CefMediaCaptureDevicesDispatcher::~CefMediaCaptureDevicesDispatcher() = default;
|
||||
|
||||
void CefMediaCaptureDevicesDispatcher::RegisterPrefs(
|
||||
PrefRegistrySimple* registry) {
|
||||
registry->RegisterStringPref(prefs::kDefaultAudioCaptureDevice,
|
||||
registry->RegisterStringPref(prefs::kDefaultAudioCaptureDeviceDeprecated,
|
||||
std::string());
|
||||
registry->RegisterStringPref(prefs::kDefaultVideoCaptureDevice,
|
||||
registry->RegisterStringPref(prefs::kDefaultVideoCaptureDeviceDeprecated,
|
||||
std::string());
|
||||
}
|
||||
|
||||
@@ -61,12 +61,14 @@ void CefMediaCaptureDevicesDispatcher::GetDefaultDevices(
|
||||
|
||||
std::string default_device;
|
||||
if (audio) {
|
||||
default_device = prefs->GetString(prefs::kDefaultAudioCaptureDevice);
|
||||
default_device =
|
||||
prefs->GetString(prefs::kDefaultAudioCaptureDeviceDeprecated);
|
||||
GetRequestedDevice(default_device, true, false, devices);
|
||||
}
|
||||
|
||||
if (video) {
|
||||
default_device = prefs->GetString(prefs::kDefaultVideoCaptureDevice);
|
||||
default_device =
|
||||
prefs->GetString(prefs::kDefaultVideoCaptureDeviceDeprecated);
|
||||
GetRequestedDevice(default_device, false, true, devices);
|
||||
}
|
||||
}
|
||||
|
@@ -88,9 +88,9 @@ class RequestManager {
|
||||
map_.erase(it);
|
||||
}
|
||||
|
||||
absl::optional<CefBrowserURLRequest::RequestInfo> Get(int32_t request_id) {
|
||||
std::optional<CefBrowserURLRequest::RequestInfo> Get(int32_t request_id) {
|
||||
if (request_id > kInitialRequestID) {
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
base::AutoLock lock_scope(lock_);
|
||||
@@ -98,7 +98,7 @@ class RequestManager {
|
||||
if (it != map_.end()) {
|
||||
return it->second;
|
||||
}
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -608,16 +608,16 @@ class CefBrowserURLRequest::Context
|
||||
// CefBrowserURLRequest -------------------------------------------------------
|
||||
|
||||
// static
|
||||
absl::optional<CefBrowserURLRequest::RequestInfo>
|
||||
std::optional<CefBrowserURLRequest::RequestInfo>
|
||||
CefBrowserURLRequest::FromRequestID(int32_t request_id) {
|
||||
if (IsValidRequestID(request_id)) {
|
||||
return g_manager.Get().Get(request_id);
|
||||
}
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// static
|
||||
absl::optional<CefBrowserURLRequest::RequestInfo>
|
||||
std::optional<CefBrowserURLRequest::RequestInfo>
|
||||
CefBrowserURLRequest::FromRequestID(
|
||||
const content::GlobalRequestID& request_id) {
|
||||
return FromRequestID(request_id.request_id);
|
||||
|
@@ -6,11 +6,10 @@
|
||||
#define CEF_LIBCEF_BROWSER_NET_SERVICE_BROWSER_URLREQUEST_IMPL_H_
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
#include "include/cef_urlrequest.h"
|
||||
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace content {
|
||||
struct GlobalRequestID;
|
||||
}
|
||||
@@ -27,8 +26,8 @@ class CefBrowserURLRequest : public CefURLRequest {
|
||||
CefRefPtr<CefURLRequestClient>>;
|
||||
|
||||
// Retrieve the request objects, if any, associated with |request_id|.
|
||||
static absl::optional<RequestInfo> FromRequestID(int32_t request_id);
|
||||
static absl::optional<RequestInfo> FromRequestID(
|
||||
static std::optional<RequestInfo> FromRequestID(int32_t request_id);
|
||||
static std::optional<RequestInfo> FromRequestID(
|
||||
const content::GlobalRequestID& request_id);
|
||||
|
||||
// If |frame| is nullptr requests can still be intercepted but no
|
||||
|
@@ -212,7 +212,7 @@ void SaveCookiesOnUIThread(
|
||||
|
||||
bool IsCookieableScheme(
|
||||
const GURL& url,
|
||||
const absl::optional<std::vector<std::string>>& cookieable_schemes) {
|
||||
const std::optional<std::vector<std::string>>& cookieable_schemes) {
|
||||
if (!url.has_scheme()) {
|
||||
return false;
|
||||
}
|
||||
@@ -298,8 +298,8 @@ void SaveCookies(const CefBrowserContext::Getter& browser_context_getter,
|
||||
net::CookieInclusionStatus returned_status;
|
||||
std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create(
|
||||
request.url, cookie_string, base::Time::Now(),
|
||||
absl::make_optional(response_date),
|
||||
/*cookie_partition_key=*/absl::nullopt,
|
||||
std::make_optional(response_date),
|
||||
/*cookie_partition_key=*/std::nullopt,
|
||||
/*block_truncated=*/true, &returned_status);
|
||||
if (!returned_status.IsInclude()) {
|
||||
continue;
|
||||
|
@@ -25,7 +25,7 @@ namespace net_service::cookie_helper {
|
||||
// cookieable, which may intentionally exclude standard schemes.
|
||||
bool IsCookieableScheme(
|
||||
const GURL& url,
|
||||
const absl::optional<std::vector<std::string>>& cookieable_schemes);
|
||||
const std::optional<std::vector<std::string>>& cookieable_schemes);
|
||||
|
||||
using AllowCookieCallback =
|
||||
base::RepeatingCallback<void(const net::CanonicalCookie&,
|
||||
|
@@ -303,7 +303,7 @@ bool CefCookieManagerImpl::SetCookieInternal(
|
||||
/*creation_time=*/base::Time(), expiration_time,
|
||||
/*last_access_time=*/base::Time(), cookie.secure ? true : false,
|
||||
cookie.httponly ? true : false, same_site, priority,
|
||||
/*partition_key=*/absl::nullopt);
|
||||
/*partition_key=*/std::nullopt);
|
||||
|
||||
if (!canonical_cookie) {
|
||||
SetCookieCallbackImpl(
|
||||
|
@@ -70,7 +70,7 @@ class AuthCallbackImpl : public CefAuthCallback {
|
||||
|
||||
void RunCallbackOnIOThread(
|
||||
CefRefPtr<CefBrowserHostBase> browser,
|
||||
absl::optional<CefBrowserURLRequest::RequestInfo> url_request_info,
|
||||
std::optional<CefBrowserURLRequest::RequestInfo> url_request_info,
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
const GURL& origin_url,
|
||||
CefRefPtr<AuthCallbackImpl> callback_impl) {
|
||||
@@ -144,7 +144,7 @@ void LoginDelegate::Continue(const CefString& username,
|
||||
void LoginDelegate::Cancel() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!callback_.is_null()) {
|
||||
std::move(callback_).Run(absl::nullopt);
|
||||
std::move(callback_).Run(std::nullopt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,4 +171,4 @@ void LoginDelegate::Start(CefRefPtr<CefBrowserHostBase> browser,
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace net_service
|
||||
} // namespace net_service
|
||||
|
@@ -40,12 +40,12 @@ namespace {
|
||||
// User data key for ResourceContextData.
|
||||
const void* const kResourceContextUserDataKey = &kResourceContextUserDataKey;
|
||||
|
||||
absl::optional<std::string> GetHeaderString(
|
||||
std::optional<std::string> GetHeaderString(
|
||||
const net::HttpResponseHeaders* headers,
|
||||
const std::string& header_name) {
|
||||
std::string header_value;
|
||||
if (!headers || !headers->GetNormalizedHeader(header_name, &header_value)) {
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
return header_value;
|
||||
}
|
||||
@@ -247,7 +247,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||
void OnReceiveResponse(
|
||||
network::mojom::URLResponseHeadPtr head,
|
||||
mojo::ScopedDataPipeConsumerHandle body,
|
||||
absl::optional<mojo_base::BigBuffer> cached_metadata) override;
|
||||
std::optional<mojo_base::BigBuffer> cached_metadata) override;
|
||||
void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
|
||||
network::mojom::URLResponseHeadPtr head) override;
|
||||
void OnUploadProgress(int64_t current_position,
|
||||
@@ -261,7 +261,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const absl::optional<GURL>& new_url) override;
|
||||
const std::optional<GURL>& new_url) override;
|
||||
void SetPriority(net::RequestPriority priority,
|
||||
int32_t intra_priority_value) override;
|
||||
void PauseReadingBodyFromNet() override;
|
||||
@@ -282,7 +282,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||
|
||||
// Helpers for optionally overriding headers.
|
||||
void HandleResponseOrRedirectHeaders(
|
||||
absl::optional<net::RedirectInfo> redirect_info,
|
||||
std::optional<net::RedirectInfo> redirect_info,
|
||||
net::CompletionOnceCallback continuation);
|
||||
void ContinueResponseOrRedirect(
|
||||
net::CompletionOnceCallback continuation,
|
||||
@@ -352,13 +352,14 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||
network::ResourceRequest request_;
|
||||
network::mojom::URLResponseHeadPtr current_response_;
|
||||
mojo::ScopedDataPipeConsumerHandle current_body_;
|
||||
absl::optional<mojo_base::BigBuffer> current_cached_metadata_;
|
||||
std::optional<mojo_base::BigBuffer> current_cached_metadata_;
|
||||
scoped_refptr<net::HttpResponseHeaders> current_headers_;
|
||||
scoped_refptr<net::HttpResponseHeaders> override_headers_;
|
||||
GURL original_url_;
|
||||
GURL redirect_url_;
|
||||
GURL header_client_redirect_url_;
|
||||
const net::MutableNetworkTrafficAnnotationTag traffic_annotation_;
|
||||
std::optional<network::mojom::CredentialsMode> original_crendentials_mode_;
|
||||
|
||||
mojo::Receiver<network::mojom::URLLoader> proxied_loader_receiver_;
|
||||
mojo::Remote<network::mojom::URLLoaderClient> target_client_;
|
||||
@@ -450,7 +451,7 @@ InterceptedRequest::~InterceptedRequest() {
|
||||
}
|
||||
if (on_headers_received_callback_) {
|
||||
std::move(on_headers_received_callback_)
|
||||
.Run(net::ERR_ABORTED, absl::nullopt, GURL());
|
||||
.Run(net::ERR_ABORTED, std::nullopt, GURL());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,6 +508,7 @@ void InterceptedRequest::Restart() {
|
||||
// Match logic in CorsURLLoader::StartNetworkRequest.
|
||||
const auto response_tainting = CalculateResponseTainting(
|
||||
should_check_cors, request_.mode, tainted_origin);
|
||||
original_crendentials_mode_ = request_.credentials_mode;
|
||||
request_.credentials_mode =
|
||||
network::cors::CalculateCredentialsFlag(request_.credentials_mode,
|
||||
response_tainting)
|
||||
@@ -579,12 +581,12 @@ void InterceptedRequest::OnBeforeSendHeaders(
|
||||
const net::HttpRequestHeaders& headers,
|
||||
OnBeforeSendHeadersCallback callback) {
|
||||
if (!current_request_uses_header_client_) {
|
||||
std::move(callback).Run(net::OK, absl::nullopt);
|
||||
std::move(callback).Run(net::OK, std::nullopt);
|
||||
return;
|
||||
}
|
||||
|
||||
request_.headers = headers;
|
||||
std::move(callback).Run(net::OK, absl::nullopt);
|
||||
std::move(callback).Run(net::OK, std::nullopt);
|
||||
|
||||
// Resume handling of client messages after continuing from an async callback.
|
||||
if (proxied_client_receiver_.is_bound()) {
|
||||
@@ -597,14 +599,14 @@ void InterceptedRequest::OnHeadersReceived(
|
||||
const net::IPEndPoint& remote_endpoint,
|
||||
OnHeadersReceivedCallback callback) {
|
||||
if (!current_request_uses_header_client_) {
|
||||
std::move(callback).Run(net::OK, absl::nullopt, GURL());
|
||||
std::move(callback).Run(net::OK, std::nullopt, GURL());
|
||||
return;
|
||||
}
|
||||
|
||||
current_headers_ = base::MakeRefCounted<net::HttpResponseHeaders>(headers);
|
||||
on_headers_received_callback_ = std::move(callback);
|
||||
|
||||
absl::optional<net::RedirectInfo> redirect_info;
|
||||
std::optional<net::RedirectInfo> redirect_info;
|
||||
std::string location;
|
||||
if (current_headers_->IsRedirect(&location)) {
|
||||
const GURL new_url = request_.url.Resolve(location);
|
||||
@@ -628,7 +630,7 @@ void InterceptedRequest::OnReceiveEarlyHints(
|
||||
void InterceptedRequest::OnReceiveResponse(
|
||||
network::mojom::URLResponseHeadPtr head,
|
||||
mojo::ScopedDataPipeConsumerHandle body,
|
||||
absl::optional<mojo_base::BigBuffer> cached_metadata) {
|
||||
std::optional<mojo_base::BigBuffer> cached_metadata) {
|
||||
current_response_ = std::move(head);
|
||||
current_body_ = std::move(body);
|
||||
current_cached_metadata_ = std::move(cached_metadata);
|
||||
@@ -643,7 +645,7 @@ void InterceptedRequest::OnReceiveResponse(
|
||||
ContinueToResponseStarted(net::OK);
|
||||
} else {
|
||||
HandleResponseOrRedirectHeaders(
|
||||
absl::nullopt,
|
||||
std::nullopt,
|
||||
base::BindOnce(&InterceptedRequest::ContinueToResponseStarted,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
}
|
||||
@@ -743,7 +745,7 @@ void InterceptedRequest::FollowRedirect(
|
||||
const std::vector<std::string>& removed_headers_ext,
|
||||
const net::HttpRequestHeaders& modified_headers_ext,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const absl::optional<GURL>& new_url) {
|
||||
const std::optional<GURL>& new_url) {
|
||||
std::vector<std::string> removed_headers = removed_headers_ext;
|
||||
net::HttpRequestHeaders modified_headers = modified_headers_ext;
|
||||
OnProcessRequestHeaders(new_url.value_or(GURL()), &modified_headers,
|
||||
@@ -875,6 +877,14 @@ void InterceptedRequest::ContinueAfterIntercept() {
|
||||
target_loader_.BindNewPipeAndPassReceiver(), id_, options, request_,
|
||||
proxied_client_receiver_.BindNewPipeAndPassRemote(),
|
||||
traffic_annotation_);
|
||||
if (original_crendentials_mode_) {
|
||||
// Restore the original |credentials_mode| value after calling
|
||||
// CreateLoaderAndStart. This matches the logic in CorsURLLoader::
|
||||
// StartNetworkRequest and allows InterceptedRequest::Restart to compute
|
||||
// the correct |credentials_mode| during a fetch request redirect.
|
||||
request_.credentials_mode = *original_crendentials_mode_;
|
||||
original_crendentials_mode_.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -894,7 +904,7 @@ void InterceptedRequest::ContinueAfterInterceptWithOverride(
|
||||
}
|
||||
|
||||
void InterceptedRequest::HandleResponseOrRedirectHeaders(
|
||||
absl::optional<net::RedirectInfo> redirect_info,
|
||||
std::optional<net::RedirectInfo> redirect_info,
|
||||
net::CompletionOnceCallback continuation) {
|
||||
override_headers_ = nullptr;
|
||||
redirect_url_ = redirect_info.has_value() ? redirect_info->new_url : GURL();
|
||||
@@ -957,7 +967,7 @@ void InterceptedRequest::ContinueToHandleOverrideHeaders(int error_code) {
|
||||
}
|
||||
|
||||
DCHECK(on_headers_received_callback_);
|
||||
absl::optional<std::string> headers;
|
||||
std::optional<std::string> headers;
|
||||
if (override_headers_) {
|
||||
headers = override_headers_->raw_headers();
|
||||
}
|
||||
@@ -1056,8 +1066,8 @@ void InterceptedRequest::ContinueToBeforeRedirect(
|
||||
bool should_clear_upload;
|
||||
net::RedirectUtil::UpdateHttpRequest(original_url, original_method,
|
||||
new_redirect_info,
|
||||
absl::make_optional(remove_headers),
|
||||
/*modified_headers=*/absl::nullopt,
|
||||
std::make_optional(remove_headers),
|
||||
/*modified_headers=*/std::nullopt,
|
||||
&request_.headers, &should_clear_upload);
|
||||
|
||||
if (should_clear_upload) {
|
||||
@@ -1275,7 +1285,7 @@ void InterceptedRequestHandler::OnRequestResponse(
|
||||
int32_t request_id,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
absl::optional<net::RedirectInfo> redirect_info,
|
||||
std::optional<net::RedirectInfo> redirect_info,
|
||||
OnRequestResponseResultCallback callback) {
|
||||
std::move(callback).Run(
|
||||
ResponseMode::CONTINUE, nullptr,
|
||||
|
@@ -8,6 +8,8 @@
|
||||
|
||||
#include "libcef/browser/net_service/stream_reader_url_loader.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "base/containers/unique_ptr_adapters.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/hash/hash.h"
|
||||
@@ -19,7 +21,6 @@
|
||||
#include "services/network/public/cpp/url_loader_factory_builder.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace content {
|
||||
class ResourceContext;
|
||||
@@ -105,12 +106,11 @@ class InterceptedRequestHandler {
|
||||
ResponseMode /* response_mode */,
|
||||
scoped_refptr<net::HttpResponseHeaders> /* override_headers */,
|
||||
const GURL& /* redirect_url */)>;
|
||||
virtual void OnRequestResponse(
|
||||
int32_t request_id,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
absl::optional<net::RedirectInfo> redirect_info,
|
||||
OnRequestResponseResultCallback callback);
|
||||
virtual void OnRequestResponse(int32_t request_id,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
std::optional<net::RedirectInfo> redirect_info,
|
||||
OnRequestResponseResultCallback callback);
|
||||
|
||||
// Called to optionally filter the response body.
|
||||
virtual mojo::ScopedDataPipeConsumerHandle OnFilterResponseBody(
|
||||
|
@@ -841,7 +841,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
void OnRequestResponse(int32_t request_id,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
absl::optional<net::RedirectInfo> redirect_info,
|
||||
std::optional<net::RedirectInfo> redirect_info,
|
||||
OnRequestResponseResultCallback callback) override {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
|
@@ -475,7 +475,7 @@ StreamReaderURLLoader::StreamReaderURLLoader(
|
||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||
mojo::PendingRemote<network::mojom::TrustedHeaderClient> header_client,
|
||||
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
||||
absl::optional<mojo_base::BigBuffer> cached_metadata,
|
||||
std::optional<mojo_base::BigBuffer> cached_metadata,
|
||||
std::unique_ptr<Delegate> response_delegate)
|
||||
: request_id_(request_id),
|
||||
request_(request),
|
||||
@@ -520,13 +520,13 @@ void StreamReaderURLLoader::Start() {
|
||||
base::BindOnce(&StreamReaderURLLoader::ContinueWithRequestHeaders,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
} else {
|
||||
ContinueWithRequestHeaders(net::OK, absl::nullopt);
|
||||
ContinueWithRequestHeaders(net::OK, std::nullopt);
|
||||
}
|
||||
}
|
||||
|
||||
void StreamReaderURLLoader::ContinueWithRequestHeaders(
|
||||
int32_t result,
|
||||
const absl::optional<net::HttpRequestHeaders>& headers) {
|
||||
const std::optional<net::HttpRequestHeaders>& headers) {
|
||||
if (result != net::OK) {
|
||||
RequestComplete(result);
|
||||
return;
|
||||
@@ -552,7 +552,7 @@ void StreamReaderURLLoader::FollowRedirect(
|
||||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const absl::optional<GURL>& new_url) {
|
||||
const std::optional<GURL>& new_url) {
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
@@ -665,15 +665,15 @@ void StreamReaderURLLoader::HeadersComplete(int orig_status_code,
|
||||
std::move(pending_response)));
|
||||
} else {
|
||||
ContinueWithResponseHeaders(std::move(pending_response), net::OK,
|
||||
absl::nullopt, absl::nullopt);
|
||||
std::nullopt, std::nullopt);
|
||||
}
|
||||
}
|
||||
|
||||
void StreamReaderURLLoader::ContinueWithResponseHeaders(
|
||||
network::mojom::URLResponseHeadPtr pending_response,
|
||||
int32_t result,
|
||||
const absl::optional<std::string>& headers,
|
||||
const absl::optional<GURL>& redirect_url) {
|
||||
const std::optional<std::string>& headers,
|
||||
const std::optional<GURL>& redirect_url) {
|
||||
if (result != net::OK) {
|
||||
RequestComplete(result);
|
||||
return;
|
||||
|
@@ -117,7 +117,7 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
|
||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||
mojo::PendingRemote<network::mojom::TrustedHeaderClient> header_client,
|
||||
const net::MutableNetworkTrafficAnnotationTag& traffic_annotation,
|
||||
absl::optional<mojo_base::BigBuffer> cached_metadata,
|
||||
std::optional<mojo_base::BigBuffer> cached_metadata,
|
||||
std::unique_ptr<Delegate> response_delegate);
|
||||
|
||||
StreamReaderURLLoader(const StreamReaderURLLoader&) = delete;
|
||||
@@ -132,7 +132,7 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
|
||||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const absl::optional<GURL>& new_url) override;
|
||||
const std::optional<GURL>& new_url) override;
|
||||
void SetPriority(net::RequestPriority priority,
|
||||
int intra_priority_value) override;
|
||||
void PauseReadingBodyFromNet() override;
|
||||
@@ -141,7 +141,7 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
|
||||
private:
|
||||
void ContinueWithRequestHeaders(
|
||||
int32_t result,
|
||||
const absl::optional<net::HttpRequestHeaders>& headers);
|
||||
const std::optional<net::HttpRequestHeaders>& headers);
|
||||
void OnInputStreamOpened(std::unique_ptr<Delegate> returned_delegate,
|
||||
std::unique_ptr<InputStream> input_stream);
|
||||
|
||||
@@ -150,8 +150,8 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
|
||||
void ContinueWithResponseHeaders(
|
||||
network::mojom::URLResponseHeadPtr pending_response,
|
||||
int32_t result,
|
||||
const absl::optional<std::string>& headers,
|
||||
const absl::optional<GURL>& redirect_url);
|
||||
const std::optional<std::string>& headers,
|
||||
const std::optional<GURL>& redirect_url);
|
||||
|
||||
void ReadMore();
|
||||
void OnDataPipeWritable(MojoResult result);
|
||||
@@ -173,7 +173,7 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
|
||||
mojo::Remote<network::mojom::URLLoaderClient> client_;
|
||||
mojo::Remote<network::mojom::TrustedHeaderClient> header_client_;
|
||||
const net::MutableNetworkTrafficAnnotationTag traffic_annotation_;
|
||||
absl::optional<mojo_base::BigBuffer> cached_metadata_;
|
||||
std::optional<mojo_base::BigBuffer> cached_metadata_;
|
||||
std::unique_ptr<Delegate> response_delegate_;
|
||||
scoped_refptr<InputStreamReader> input_stream_reader_;
|
||||
|
||||
|
@@ -55,7 +55,7 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
|
||||
browser_client->WillCreateURLLoaderFactory(
|
||||
browser_context, render_frame_host, render_process_id,
|
||||
content::ContentBrowserClient::URLLoaderFactoryType::kDocumentSubResource,
|
||||
url::Origin(), absl::nullopt /* navigation_id */, ukm::SourceIdObj(),
|
||||
url::Origin(), std::nullopt /* navigation_id */, ukm::SourceIdObj(),
|
||||
factory_builder, nullptr /* header_client */,
|
||||
nullptr /* bypass_redirect_checks */, nullptr /* disable_secure_dns */,
|
||||
nullptr /* factory_override */,
|
||||
|
@@ -107,7 +107,7 @@ class CefOriginWhitelistManager {
|
||||
}
|
||||
|
||||
void GetCrossOriginWhitelistEntries(
|
||||
absl::optional<CrossOriginWhiteList>* entries) const {
|
||||
std::optional<CrossOriginWhiteList>* entries) const {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
|
||||
if (!origin_list_.empty()) {
|
||||
@@ -289,7 +289,7 @@ bool CefClearCrossOriginWhitelist() {
|
||||
}
|
||||
|
||||
void GetCrossOriginWhitelistEntries(
|
||||
absl::optional<CrossOriginWhiteList>* entries) {
|
||||
std::optional<CrossOriginWhiteList>* entries) {
|
||||
CefOriginWhitelistManager::GetInstance()->GetCrossOriginWhitelistEntries(
|
||||
entries);
|
||||
}
|
||||
|
@@ -5,10 +5,9 @@
|
||||
#ifndef CEF_LIBCEF_BROWSER_ORIGIN_WHITELIST_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_ORIGIN_WHITELIST_IMPL_H_
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
#include "cef/libcef/common/mojom/cef.mojom-forward.h"
|
||||
|
||||
namespace content {
|
||||
@@ -25,7 +24,7 @@ using CrossOriginWhiteList =
|
||||
// Called to retrieve the current list of cross-origin white list entries. This
|
||||
// method is thread safe.
|
||||
void GetCrossOriginWhitelistEntries(
|
||||
absl::optional<CrossOriginWhiteList>* entries);
|
||||
std::optional<CrossOriginWhiteList>* entries);
|
||||
|
||||
// Returns true if |source| can access |target| based on the cross-origin white
|
||||
// list settings.
|
||||
|
@@ -8,9 +8,10 @@
|
||||
|
||||
CefBrowserPlatformDelegateOsrLinux::CefBrowserPlatformDelegateOsrLinux(
|
||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate,
|
||||
bool use_shared_texture,
|
||||
bool use_external_begin_frame)
|
||||
: CefBrowserPlatformDelegateOsr(std::move(native_delegate),
|
||||
/*use_shared_texture=*/false,
|
||||
use_shared_texture,
|
||||
use_external_begin_frame) {}
|
||||
|
||||
CefWindowHandle CefBrowserPlatformDelegateOsrLinux::GetHostWindowHandle()
|
||||
|
@@ -13,6 +13,7 @@ class CefBrowserPlatformDelegateOsrLinux
|
||||
public:
|
||||
CefBrowserPlatformDelegateOsrLinux(
|
||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate,
|
||||
bool use_shared_texture,
|
||||
bool use_external_begin_frame);
|
||||
|
||||
// CefBrowserPlatformDelegate methods:
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user