Compare commits

...

50 Commits
6943 ... 7103

Author SHA1 Message Date
Marshall Greenblatt
15882fefc4 Pin depot_tools version for out-of-support branch 2025-05-29 13:47:45 -04:00
Marshall Greenblatt
1ac1b149e5 Update to Chromium version 136.0.7103.114 2025-05-15 13:05:35 +00:00
Marshall Greenblatt
723b52b57d win: Fix crash loading chrome://sandbox when sandbox is disabled 2025-05-13 18:01:36 -04:00
Marshall Greenblatt
89c0a8c39a Update to Chromium version 136.0.7103.93 2025-05-07 14:29:49 +00:00
Marshall Greenblatt
6b7eacfcc7 Update to Chromium version 136.0.7103.59 2025-05-06 21:13:13 +00:00
Marshall Greenblatt
4ff4593bfc Update to Chromium version 136.0.7103.49 2025-05-05 12:10:53 -04:00
Marshall Greenblatt
4dec9aa6f2 Update to Chromium version 136.0.7103.33 2025-04-22 13:01:20 -04:00
Marshall Greenblatt
1390ca425c Tag 13601 API version 2025-04-22 10:37:36 -04:00
Marshall Greenblatt
928a900850 Fix enum value typos 2025-04-22 10:37:35 -04:00
Marshall Greenblatt
8f7877b8b0 Add callback to allow Document PiP moveTo/By() (fixes #3714)
Allow Document picture-in-picture moveTo/By() and resizeTo/By()
(without user gesture) if the new
CefBrowserViewDelegate::AllowMoveForPictureInPicture callback
returns true.
2025-04-22 10:37:35 -04:00
Marshall Greenblatt
2cad7c4842 Update to Chromium version 136.0.7103.17 2025-04-09 16:24:41 +00:00
Marshall Greenblatt
ecce29f1ee Update to Chromium version 136.0.7103.17 2025-04-07 17:54:10 -04:00
Marshall Greenblatt
d746017d7c Tag 13600 API version 2025-04-07 17:42:26 -04:00
Marshall Greenblatt
06288b535e osr: Avoid crash in WebContentsImpl::GetSize/Resize 2025-04-07 17:11:48 -04:00
Marshall Greenblatt
c0df792f3b vscode: Fix error running build tasks
Running tasks without explicit "cwd" broke in VSCode 1.99.0.
2025-04-07 15:38:21 -04:00
Marshall Greenblatt
68b0feea6d Fix dangling menu observer on browser destruction 2025-04-07 15:38:21 -04:00
Marshall Greenblatt
e7320793b6 Update to Chromium version 136.0.7103.0 (#1440670)
- Win: Update to VS 2022 17.13.4 and WinSDK 10.0.26100.3323
2025-04-07 15:38:21 -04:00
Marshall Greenblatt
ef82e430b4 alloy: Fix display of modal JS dialogs (fixes #3818) 2025-04-02 14:25:45 -04:00
Marshall Greenblatt
70ea6f589f Fix allow_os_execution=true (fixes #2715, fixes #3851, fixes #3889)
When setting allow_os_execution=true in OnProtocolExecution the
confirmation dialog should display consistently, the load should
be canceled with ERR_ABORTED, and no interstitial error page
should be displayed.
2025-04-01 18:08:25 -04:00
Marshall Greenblatt
5b18ca7d3f linux: Fix stack-related sub-process shutdown crashes (fixes #3912)
On Linux systems the stack frame reference canary will be purposely
changed when forking sub-processes (see https://crbug.com/40181003).
To avoid sub-process shutdown crashes the NO_STACK_PROTECTOR
annotation must be added to all functions in the call stack leading to
CefExecuteProcess(). Applications that cannot add this annotation must
instead pass the `--change-stack-guard-on-fork=disable` command-line
flag.
2025-03-31 14:13:24 -04:00
Marshall Greenblatt
b2f5ab6cd2 Fix crash on invalid chromeMediaSourceId (fixes #3911) 2025-03-31 12:11:33 -04:00
Marshall Greenblatt
0bf995ae26 win: alloy: Fix potential crash if browser creation is aborted (fixes #3862) 2025-03-21 14:31:02 -04:00
Marshall Greenblatt
49ac6882ec chrome: Implement CefBrowserHost::SetAudioMuted/IsAudioMuted (fixes #3893) 2025-03-21 13:17:33 -04:00
Marshall Greenblatt
8cf30843f9 chrome: Implement CefFocusHandler::OnTakeFocus callback (fixes #3897) 2025-03-21 13:03:53 -04:00
Marshall Greenblatt
e88e98f061 tools: Add VSCode setup (fixes #3906)
Add tooling to set up a Visual Studio Code development environment
for CEF. See script output for usage.

Run: python3 tools/setup_vscode.py
2025-03-20 13:53:33 -04:00
Marshall Greenblatt
8fa5244adb distrib: Include CREDITS.html with third-party licenses
This is the same content currently available via about:credits.
2025-03-19 13:57:51 -04:00
Michael Bragg
aa4734b714 alloy: win: Add spelling suggestions in context menu (fixes #3055) 2025-03-18 12:08:47 -04:00
David Cernoch
f72afb713a Make PrintToPDF path parameter optional (fixes #3879) 2025-03-18 15:44:00 +00:00
Marshall Greenblatt
8db54e92c2 Tag 13500 API version 2025-03-12 14:37:45 -04:00
Marshall Greenblatt
00b4581c9b tests: Destroy |scheme_factory_| on IO thread
This avoids a thread race between ShutdownSchemeHandler and
GetResourceHandler when running `CookieTest.AccessResource*` tests.
2025-03-12 13:40:39 -04:00
Marshall Greenblatt
ff5210f825 Update to Chromium version 135.0.7049.0 (#1427262) 2025-03-12 13:05:48 -04:00
Marshall Greenblatt
cda47aaff4 Tag 13401 API version 2025-03-10 11:53:36 -04:00
Marshall Greenblatt
549e8fe05c Add visualization for Chrome configuration changes (fixes #3892)
- Add new API to retrieve/observe configuration values.
- cefclient: Add https://tests/config to inspect configuration
  values in real time.
2025-03-10 15:50:46 +00:00
Marshall Greenblatt
ec31b2b505 Fix Chrome toolbar initialization (fixes #3898)
Change BrowserWindowFeatures initialization to consider CEF browsers
with TYPE_POPUP as normal.
2025-03-07 14:56:20 -05:00
Marshall Greenblatt
40fef43488 tools: Fix assert when all file contents are excluded (see #3836)
The full contents of a file may be excluded at certain API versions.
2025-03-07 11:59:43 -05:00
Jacobo Aragunde Pérez
e44a93551f tools: Add non-zero exit code for single patch failure (fixes #3903) 2025-03-07 15:46:05 +00:00
Marshall Greenblatt
18b65ced23 tools: Also check for CEF_NEXT in .cc files (see #3836) 2025-02-28 18:22:33 -05:00
Marshall Greenblatt
9c7b6e77a5 tools: Use short copyright for capi_versions.h headers (see #3836)
These files are not distributed and therefore don't require the
full copyright header.
2025-02-28 18:22:33 -05:00
Marshall Greenblatt
781d2b5996 tools: Fix get_all_versions for newly added class (see #3836) 2025-02-28 18:22:33 -05:00
Marshall Greenblatt
0573906f6d cefclient: Add global option to https://tests/preferences (see #3892) 2025-02-28 18:21:55 -05:00
Nik Pavlov
fdd36e8461 Support API versioning in platform-specific headers (see #3836)
- Exclude platform-specific includes (anything in < >) from the
  clang preprocessor by using `!defined(GENERATING_CEF_API_HASH)`
  in CEF header files.
- Define "target platforms" by passing platform- and architecture-
  specific ifdefs to the clang preprocessor. Grep for `defined(OS_`
  to identify headers that require target platform processing, and
  then process for each target as the platform-specific API hash
  contribution.
- Delete the univeral hash which is no longer a useful concept.
2025-02-25 12:36:00 -05:00
Marshall Greenblatt
8ddb1bffbb cmake: win: Set LPAC ACLs required for sandbox support (fixes #3791) 2025-02-19 13:38:22 -05:00
Marshall Greenblatt
bfd1110145 tools: win: Use system installed Git version
Chromium has stopped bundling Git with depot_tools on Windows.
See https://groups.google.com/a/chromium.org/g/chromium-dev/c/e4ftLlQ5GpE/m/ye0ezOLaAAAJ
2025-02-19 12:27:47 -05:00
Marshall Greenblatt
81d54830e9 Tag 13400 API version 2025-02-19 12:06:11 -05:00
Marshall Greenblatt
0c25276083 tools: win: Fix grep usage with system Git (see #3836) 2025-02-19 12:05:35 -05:00
Marshall Greenblatt
64bb2aadd5 tools: Add null check for struct ptrs in CToCpp wrapper (see #3836) 2025-02-19 11:11:51 -05:00
Marshall Greenblatt
4261816c34 views: Always remove Toolbar before BrowserView destruction 2025-02-19 11:11:51 -05:00
Marshall Greenblatt
c7c6a109c9 Update to Chromium version 134.0.6998.0 (#1415337) 2025-02-19 11:11:51 -05:00
Marshall Greenblatt
c8be96d15c Minor types cleanup for API gen (see #3836) 2025-02-19 11:11:51 -05:00
Peng Zhou
e902b1f226 mac: Add -isysroot flag to clang command (see #3836) 2025-02-14 19:57:05 +00:00
245 changed files with 5836 additions and 2277 deletions

View File

@@ -340,7 +340,7 @@ if (is_win) {
# to maintain.
"//chrome/common/crash_keys.cc",
"//chrome/common/chrome_switches.cc",
"//components/flags_ui/flags_ui_switches.cc",
"//components/webui/flags/flags_ui_switches.cc",
"//content/public/common/content_switches.cc",
]
@@ -677,6 +677,8 @@ source_set("libcef_static") {
"libcef/browser/scheme_impl.cc",
"libcef/browser/server_impl.cc",
"libcef/browser/server_impl.h",
"libcef/browser/setting_helper.cc",
"libcef/browser/setting_helper.h",
"libcef/browser/simple_menu_model_impl.cc",
"libcef/browser/simple_menu_model_impl.h",
"libcef/browser/ssl_info_impl.cc",
@@ -837,6 +839,7 @@ source_set("libcef_static") {
"libcef/common/values_impl.h",
"libcef/common/waitable_event_impl.cc",
"libcef/common/waitable_event_impl.h",
"libcef/renderer/browser_config.h",
"libcef/renderer/browser_impl.cc",
"libcef/renderer/browser_impl.h",
"libcef/renderer/chrome/chrome_content_renderer_client_cef.cc",
@@ -1284,7 +1287,6 @@ make_pack_header("resources") {
"$root_gen_dir/chrome/grit/browser_resources.h",
"$root_gen_dir/chrome/grit/common_resources.h",
"$root_gen_dir/chrome/grit/component_extension_resources.h",
"$root_gen_dir/chrome/grit/dev_ui_browser_resources.h",
"$root_gen_dir/chrome/grit/pdf_resources.h",
"$root_gen_dir/chrome/grit/renderer_resources.h",
"$root_gen_dir/components/grit/components_resources.h",
@@ -1312,7 +1314,6 @@ make_pack_header("resources") {
deps = [
":cef_resources",
"//base/tracing/protos:chrome_track_event_resources",
"//chrome/browser:dev_ui_browser_resources",
"//chrome/browser:resources",
"//chrome/browser/resources:component_extension_resources",
"//chrome/browser/resources/pdf:resources",

View File

@@ -7,5 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/133.0.6943.0'
'chromium_checkout': 'refs/tags/136.0.7103.114',
'depot_tools_checkout': 'c9fe205c66'
}

View File

@@ -1,41 +1,66 @@
{
"hashes": {
"13300": {
"comment": "Added January 13, 2025.",
"linux": "b622b5e8d42567bd96b6c530c3bf39b42d94c97a",
"mac": "10daecda70220382f54f8b1fc3b2d1df7da3088c",
"universal": "a5c9449c676e3d151ac2d141bd3907dcd1fec3d4",
"windows": "854c5a8fc37bb040ad0ad8e4680f62b07ec217c0"
"comment": "Added February 21, 2025.",
"linux": "2508f3f0b0e5dfa191036fa6c04f8dcfa18c94b9",
"mac": "80c0b59ba9dd783aa71fae0aa5f7dad64620e8c9",
"windows": "45d39c3669ba75467e3e609f626c31506c0eae22"
},
"13301": {
"comment": "Added January 13, 2025.",
"linux": "0ec77d8bc98964aaf2c4ac037dbbe47f59863902",
"mac": "65b51b1dfde1ab0af99d98e1e8b6aadf5bc28707",
"universal": "e343550e4371b76f59813dac2742a9d3206cb98f",
"windows": "34b14819172ed39721a3fe298cf73dec7b6e7df2"
"comment": "Added February 21, 2025.",
"linux": "aa073dd1c586812503ca293c718358460d8c2dd6",
"mac": "fda40a5df44628cac50a589ff979c0746011591e",
"windows": "7109702038d51512d35dd2ed77231f9100e38214"
},
"13302": {
"comment": "Added January 13, 2025.",
"linux": "e98affe8187daaa1ee02b01677208ff0a54af74c",
"mac": "45a0649980f85c53a6156627f0af6368ccfc5554",
"universal": "b8423655541f6f2a1a9b6f5252f03e59842dc31a",
"windows": "b04c40f0d79e2ea6f6a4d508843b9eaafb102c1e"
"comment": "Added February 21, 2025.",
"linux": "d5597ebfa30081953425e897209a8387b9584205",
"mac": "4aa24470ba3a4bd9c06bc0e4a201b896394a86b5",
"windows": "18799961f4461a9cbae2aed89ac04b73ab7c37f3"
},
"13303": {
"comment": "Added January 13, 2025.",
"linux": "1b2584e9f06dc0cb59ccceee89857fc164d4db52",
"mac": "82d74e5024ed80b43d49d7e83b0e8a3a42a0b319",
"universal": "a0905ba86f2c4964857f6c9c0706ab3e1050a8cd",
"windows": "bc115a66808672931cf676ce31d58ded946f680e"
"comment": "Added February 21, 2025.",
"linux": "f3a696ee30ce1e00490a58df017393c126c89709",
"mac": "f2cdce2b9a4b635c28b5b92c42c35625a937380c",
"windows": "20016fd6a9b87ef4c539cd1f42bf1ca09b6903ca"
},
"13304": {
"comment": "Added January 13, 2025.",
"linux": "199fe896c737a07dcf1506e0c86688363df7e8b6",
"mac": "405810f1f8b146678867b6a91cbe8c4670febbbf",
"universal": "be55f7cf1813ae098d4f68b2a2c9ca85784fc3ee",
"windows": "73bb28a92f4be742e3fc80057a80797e3bf23063"
"comment": "Added February 21, 2025.",
"linux": "f1ababb4ff51ecbf77c481cee3721ef0eca9c8ca",
"mac": "98964c37b8917d83da4b173e22905503d38ad08f",
"windows": "19c014af0082aa901398e006381b6980e4f806e9"
},
"13400": {
"comment": "Added February 21, 2025.",
"linux": "ea2106b5bc012c25d735521e0c7fb719d433ea4a",
"mac": "ba5ab71db4f9447f19eb7b1943024981c88064dd",
"windows": "6ab74b90e88b7397aab9911baac5484f12466eef"
},
"13401": {
"comment": "Added March 10, 2025.",
"linux": "b14bee2c0fd250da67faea421f620b58e5dea9a2",
"mac": "b54732b528bc2669481ec0cf17c7b97b033720b9",
"windows": "751255204f006b8b883a8baf552a2da792f8aa44"
},
"13500": {
"comment": "Added March 12, 2025.",
"linux": "5b7c2284ed2542cf6212981d62ca9122fb2a4e88",
"mac": "9862177631e8059a497d6086058168dd47477ab7",
"windows": "3e78b6fe5fd31d69049499450849ada17a720a53"
},
"13600": {
"comment": "Added April 07, 2025.",
"linux": "eb353ba7b8b9bcbef890217971cd8ec41efeaa75",
"mac": "22c77d1f2305de8a6147f14e52f074b4a4e5222c",
"windows": "a8832519b4eb058567d68b65be1e1c9e80aae566"
},
"13601": {
"comment": "Added April 22, 2025.",
"linux": "40b224f295a20694241c5db49721bc90a3796f30",
"mac": "ff885fe921f9eae1a5ce6a71b30b0c37b306bf56",
"windows": "116a4153047ee1ee67f17fc938f084ee72b24e54"
}
},
"last": "13304",
"last": "13601",
"min": "13300"
}

View File

@@ -247,6 +247,8 @@
'tests/cefclient/browser/client_prefs.cc',
'tests/cefclient/browser/client_prefs.h',
'tests/cefclient/browser/client_types.h',
'tests/cefclient/browser/config_test.cc',
'tests/cefclient/browser/config_test.h',
'tests/cefclient/browser/default_client_handler.cc',
'tests/cefclient/browser/default_client_handler.h',
'tests/cefclient/browser/dialog_test.cc',
@@ -324,6 +326,7 @@
'cefclient_sources_resources': [
'tests/cefclient/resources/binary_transfer.html',
'tests/cefclient/resources/binding.html',
'tests/cefclient/resources/config.html',
'tests/cefclient/resources/dialogs.html',
'tests/cefclient/resources/draggable.html',
'tests/cefclient/resources/hang.html',

View File

@@ -271,6 +271,17 @@ macro(ADD_WINDOWS_MANIFEST manifest_path target extension)
)
endmacro()
# Set LPAC ACLs required for Windows sandbox support.
# See https://github.com/chromiumembedded/cef/issues/3791#issuecomment-2664128961
macro(SET_LPAC_ACLS target)
add_custom_command(
TARGET ${target}
POST_BUILD
COMMAND "icacls" "${CEF_TARGET_OUT_DIR}" "/grant" "*S-1-15-2-2:(OI)(CI)(RX)"
COMMENT "Setting LPAC ACLs..."
)
endmacro()
endif(OS_WINDOWS)

View File

@@ -313,6 +313,30 @@
#define STACK_UNINITIALIZED
#endif
// Attribute "no_stack_protector" disables -fstack-protector for the specified
// function.
//
// "stack_protector" is enabled on most POSIX builds. The flag adds a canary
// to each stack frame, which on function return is checked against a reference
// canary. If the canaries do not match, it's likely that a stack buffer
// overflow has occurred, so immediately crashing will prevent exploitation in
// many cases.
//
// In some cases it's desirable to remove this, e.g. on hot functions, or if
// we have purposely changed the reference canary.
//
// On Linux systems the reference canary will be purposely changed when forking
// sub-processes (see https://crbug.com/40181003). To avoid sub-process shutdown
// crashes the NO_STACK_PROTECTOR annotation must be added to all functions in
// the call stack leading to CefExecuteProcess(). Applications that cannot add
// this annotation must instead pass the `--change-stack-guard-on-fork=disable`
// command-line flag.
#if defined(COMPILER_GCC) || defined(__clang__)
#define NO_STACK_PROTECTOR __attribute__((no_stack_protector))
#else
#define NO_STACK_PROTECTOR
#endif
// The ANALYZER_ASSUME_TRUE(bool arg) macro adds compiler-specific hints
// to Clang which control what code paths are statically analyzed,
// and is meant to be used in conjunction with assert & assert-like functions.

View File

@@ -47,30 +47,46 @@
#define CEF_INCLUDE_BASE_CEF_DUMP_WITHOUT_CRASHING_H_
#pragma once
#include "include/cef_api_hash.h"
constexpr long long kOneDayInMilliseconds = 86400000;
///
/// CefDumpWithoutCrashing allows for generating crash dumps with a throttling
/// This function allows for generating of crash dumps with a throttling
/// mechanism, preventing frequent dumps from being generated in a short period
/// of time from the same location. The |function_name|, |file_name|, and
/// |line_number| determine the location of the dump. The
/// of time from the same location. If should only be called after CefInitialize
/// has been successfully called. The |function_name|, |file_name|, and
/// |line_number| parameters specify the origin location of the dump. The
/// |mseconds_between_dumps| is an interval between consecutive dumps in
/// milliseconds from the same location.
///
/// Returns true if the dump was successfully generated, false otherwise.
///
/// For detailed behavior, usage instructions, and considerations, refer to the
/// documentation of DumpWithoutCrashing in base/debug/dump_without_crashing.h.
///
bool CefDumpWithoutCrashing(
long long mseconds_between_dumps = kOneDayInMilliseconds,
const char* function_name = __builtin_FUNCTION(),
const char* file_name = __builtin_FILE(),
int line_number = __builtin_LINE());
#if CEF_API_REMOVED(13500)
///
/// CefDumpWithoutCrashingUnthrottled allows for immediate crash dumping without
/// any throttling constraints.
/// This function allows for generating of crash dumps without any throttling
/// constraints. If should also only be called after CefInitialize has been
/// successfully called.
///
/// Returns true if the dump was successfully generated, false otherwise.
///
/// For detailed behavior, usage instructions, and considerations, refer to the
/// documentation of DumpWithoutCrashingUnthrottled in
/// base/debug/dump_without_crashing.h.
///
/// This function is removed in API version 13500. Use CefDumpWithoutCrashing()
/// instead.
///
bool CefDumpWithoutCrashingUnthrottled();
#endif
#endif // CEF_INCLUDE_BASE_CEF_DUMP_WITHOUT_CRASHING_H_

View File

@@ -77,19 +77,15 @@
#endif
#endif
#define _CEF_AH_PASTE(a, b, c) a##_##b##_##c
#define _CEF_AH_EVAL(a, b, c) _CEF_AH_PASTE(a, b, c)
#define _CEF_AH_DECLARE(version, suffix) \
_CEF_AH_EVAL(CEF_API_HASH, version, suffix)
#define _CEF_AH_PASTE(a, b) a##_##b
#define _CEF_AH_EVAL(a, b) _CEF_AH_PASTE(a, b)
#define _CEF_AH_DECLARE(version) _CEF_AH_EVAL(CEF_API_HASH, version)
// API hashes for the selected CEF_API_VERSION. API hashes are created for
// each version by analyzing CEF header files for C API type definitions. The
// hash value will change when header files are modified in a 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 _CEF_AH_DECLARE(CEF_API_VERSION, UNIVERSAL)
#define CEF_API_HASH_PLATFORM _CEF_AH_DECLARE(CEF_API_VERSION, PLATFORM)
// cause binary incompatibility with other builds.
#define CEF_API_HASH_PLATFORM _CEF_AH_DECLARE(CEF_API_VERSION)
#if defined(BUILDING_CEF_SHARED)
@@ -132,7 +128,7 @@ extern "C" {
/// parameter describes which hash value will be returned:
///
/// 0 - CEF_API_HASH_PLATFORM
/// 1 - CEF_API_HASH_UNIVERSAL
/// 1 - CEF_API_HASH_UNIVERSAL (deprecated, same as CEF_API_HASH_PLATFORM)
/// 2 - CEF_COMMIT_HASH (from cef_version.h)
///
CEF_EXPORT const char* cef_api_hash(int version, int entry);

View File

@@ -59,7 +59,7 @@ class CefApp;
/// |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,
/*--cef(api_hash_check,no_stack_protector,optional_param=application,
optional_param=windows_sandbox_info)--*/
int CefExecuteProcess(const CefMainArgs& args,
CefRefPtr<CefApp> application,

View File

@@ -31,8 +31,11 @@
#define CEF_INCLUDE_CEF_BASE_H_
#pragma once
#include "include/base/cef_atomic_ref_count.h"
#if !defined(GENERATING_CEF_API_HASH)
#include "include/base/cef_build.h"
#endif
#include "include/base/cef_atomic_ref_count.h"
#include "include/base/cef_macros.h"
// Bring in common C++ type definitions used by CEF consumers.

View File

@@ -249,7 +249,7 @@ class CefPdfPrintCallback : public virtual CefBaseRefCounted {
/// is the output path. |ok| will be true if the printing completed
/// successfully or false otherwise.
///
/*--cef()--*/
/*--cef(optional_param=path)--*/
virtual void OnPdfPrintFinished(const CefString& path, bool ok) = 0;
};

View File

@@ -41,6 +41,7 @@
#include <vector>
#include "include/cef_base.h"
#include "include/cef_registration.h"
#include "include/cef_values.h"
///
@@ -65,6 +66,24 @@ class CefPreferenceRegistrar : public CefBaseScoped {
CefRefPtr<CefValue> default_value) = 0;
};
#if CEF_API_ADDED(13401)
///
/// Implemented by the client to observe preference changes and registered via
/// CefPreferenceManager::AddPreferenceObserver. The methods of this class will
/// be called on the browser process UI thread.
///
/*--cef(source=client,added=13401)--*/
class CefPreferenceObserver : public virtual CefBaseRefCounted {
public:
///
/// Called when a preference has changed. The new value can be retrieved using
/// CefPreferenceManager::GetPreference.
///
/*--cef()--*/
virtual void OnPreferenceChanged(const CefString& name) = 0;
};
#endif
///
/// Manage access to preferences. Many built-in preferences are registered by
/// Chromium. Custom preferences can be registered in
@@ -73,6 +92,36 @@ class CefPreferenceRegistrar : public CefBaseScoped {
/*--cef(source=library,no_debugct_check)--*/
class CefPreferenceManager : public virtual CefBaseRefCounted {
public:
#if CEF_API_ADDED(13401)
///
/// Returns the current Chrome Variations configuration (combination of field
/// trials and chrome://flags) as equivalent command-line switches
/// (`--[enable|disable]-features=XXXX`, etc). These switches can be used to
/// apply the same configuration when launching a CEF-based application. See
/// https://developer.chrome.com/docs/web-platform/chrome-variations for
/// background and details. Note that field trial tests are disabled by
/// default in Official CEF builds (via the
/// `disable_fieldtrial_testing_config=true` GN flag). This method must be
/// called on the browser process UI thread.
///
/*--cef(added=13401)--*/
static void GetChromeVariationsAsSwitches(std::vector<CefString>& switches);
///
/// Returns the current Chrome Variations configuration (combination of field
/// trials and chrome://flags) as human-readable strings. This is the
/// human-readable equivalent of the "Active Variations" section of
/// chrome://version. See
/// https://developer.chrome.com/docs/web-platform/chrome-variations for
/// background and details. Note that field trial tests are disabled by
/// default in Official CEF builds (via the
/// `disable_fieldtrial_testing_config=true` GN flag). This method must be
/// called on the browser process UI thread.
///
/*--cef(added=13401)--*/
static void GetChromeVariationsAsStrings(std::vector<CefString>& strings);
#endif
///
/// Returns the global preference manager object.
///
@@ -129,6 +178,21 @@ class CefPreferenceManager : public virtual CefBaseRefCounted {
virtual bool SetPreference(const CefString& name,
CefRefPtr<CefValue> value,
CefString& error) = 0;
#if CEF_API_ADDED(13401)
///
/// Add an observer for preference changes. |name| is the name of the
/// preference to observe. If |name| is empty then all preferences will
/// be observed. Observing all preferences has performance consequences and
/// is not recommended outside of testing scenarios. The observer will remain
/// registered until the returned Registration object is destroyed. This
/// method must be called on the browser process UI thread.
///
/*--cef(optional_param=name,added=13401)--*/
virtual CefRefPtr<CefRegistration> AddPreferenceObserver(
const CefString& name,
CefRefPtr<CefPreferenceObserver> observer) = 0;
#endif
};
#endif // CEF_INCLUDE_CEF_PREFERENCE_H_

View File

@@ -44,6 +44,7 @@
#include "include/cef_cookie.h"
#include "include/cef_media_router.h"
#include "include/cef_preference.h"
#include "include/cef_registration.h"
#include "include/cef_values.h"
class CefRequestContextHandler;
@@ -66,6 +67,27 @@ class CefResolveCallback : public virtual CefBaseRefCounted {
const std::vector<CefString>& resolved_ips) = 0;
};
#if CEF_API_ADDED(13401)
///
/// Implemented by the client to observe content and website setting changes and
/// registered via CefRequestContext::AddSettingObserver. The methods of this
/// class will be called on the browser process UI thread.
///
/*--cef(source=client,added=13401)--*/
class CefSettingObserver : public virtual CefBaseRefCounted {
public:
///
/// Called when a content or website setting has changed. The new value can be
/// retrieved using CefRequestContext::GetContentSetting or
/// CefRequestContext::GetWebsiteSetting.
///
/*--cef(optional_param=requesting_url,optional_param=top_level_url)--*/
virtual void OnSettingChanged(const CefString& requesting_url,
const CefString& top_level_url,
cef_content_setting_types_t content_type) = 0;
};
#endif
///
/// A request context provides request handling for a set of related browser
/// or URL request objects. A request context can be specified when creating a
@@ -292,6 +314,17 @@ class CefRequestContext : public CefPreferenceManager {
cef_content_setting_types_t content_type,
cef_content_setting_values_t value) = 0;
#if CEF_API_ADDED(13401)
///
/// Add an observer for content and website setting changes. The observer will
/// remain registered until the returned Registration object is destroyed.
/// This method must be called on the browser process UI thread.
///
/*--cef(added=13401)--*/
virtual CefRefPtr<CefRegistration> AddSettingObserver(
CefRefPtr<CefSettingObserver> observer) = 0;
#endif
///
/// Sets the Chrome color scheme for all browsers that share this request
/// context. |variant| values of SYSTEM, LIGHT and DARK change the underlying

View File

@@ -31,7 +31,10 @@
#define CEF_INCLUDE_CEF_SANDBOX_MAC_H_
#pragma once
#if !defined(GENERATING_CEF_API_HASH)
#include "include/base/cef_build.h"
#endif
#include "include/internal/cef_export.h"
#if defined(OS_MAC)

View File

@@ -31,7 +31,9 @@
#define CEF_INCLUDE_CEF_SANDBOX_WIN_H_
#pragma once
#if !defined(GENERATING_CEF_API_HASH)
#include "include/base/cef_build.h"
#endif
#if defined(OS_WIN)

View File

@@ -31,7 +31,9 @@
#define CEF_INCLUDE_INTERNAL_CEF_APP_WIN_H_
#pragma once
#if !defined(GENERATING_CEF_API_HASH)
#include "include/base/cef_build.h"
#endif
#if defined(OS_WIN)

View File

@@ -42,22 +42,37 @@ extern "C" {
// See include/base/cef_dump_without_crashing.h for intended usage.
///
/// cef_dump_without_crashing allows for capturing crash dumps in a throttled
/// manner. This function should only be called after CefInitialize has been
/// successfully called. For detailed behavior, usage instructions, and
/// considerations, refer to the documentation of DumpWithoutCrashing in
/// base/debug/dump_without_crashing.h.
/// This function allows for generating of crash dumps with a throttling
/// mechanism, preventing frequent dumps from being generated in a short period
/// of time from the same location. If should only be called after CefInitialize
/// has been successfully called. The |function_name|, |file_name|, and
/// |line_number| parameters specify the origin location of the dump. The
/// |mseconds_between_dumps| is an interval between consecutive dumps in
/// milliseconds from the same location.
///
/// Returns true (1) if the dump was successfully generated, false otherwise.
///
/// For detailed behavior, usage instructions, and considerations, refer to the
/// documentation of DumpWithoutCrashing in base/debug/dump_without_crashing.h.
///
CEF_EXPORT int cef_dump_without_crashing(long long mseconds_between_dumps,
const char* function_name,
const char* file_name,
int line_number);
///
/// cef_dump_without_crashing_unthrottled allows for capturing crash dumps
/// without any throttling constraints. This function should also only be called
/// after CefInitialize has been successfully called. For detailed behavior,
/// usage instructions, and considerations, refer to the documentation of
/// DumpWithoutCrashingUnthrottled in base/debug/dump_without_crashing.h.
/// This function allows for generating of crash dumps without any throttling
/// constraints. If should also only be called after CefInitialize has been
/// successfully called.
///
/// Returns true (1) if the dump was successfully generated, false otherwise.
///
/// For detailed behavior, usage instructions, and considerations, refer to the
/// documentation of DumpWithoutCrashingUnthrottled in
/// base/debug/dump_without_crashing.h.
///
/// This function is removed in API version 13500. Use
/// cef_dump_without_crashing() instead.
///
CEF_EXPORT int cef_dump_without_crashing_unthrottled();

View File

@@ -32,7 +32,9 @@
#define CEF_INCLUDE_INTERNAL_CEF_EXPORT_H_
#pragma once
#if !defined(GENERATING_CEF_API_HASH)
#include "include/base/cef_build.h"
#endif
#if defined(COMPILER_MSVC)

View File

@@ -31,12 +31,14 @@
#define CEF_INCLUDE_INTERNAL_CEF_THREAD_INTERNAL_H_
#pragma once
#if !defined(GENERATING_CEF_API_HASH)
#if defined(OS_WIN)
#include <windows.h>
#elif defined(OS_POSIX)
#include <pthread.h>
#include <unistd.h>
#endif
#endif
#include "include/internal/cef_export.h"

View File

@@ -35,8 +35,11 @@
extern "C" {
#endif
#include <stdint.h>
#if !defined(GENERATING_CEF_API_HASH)
#include <time.h>
#endif
#include <stdint.h>
#include "include/internal/cef_export.h"

View File

@@ -993,9 +993,11 @@ typedef enum {
// No error.
ERR_NONE = 0,
#if !defined(GENERATING_CEF_API_HASH)
#define NET_ERROR(label, value) ERR_##label = value,
#include "include/base/internal/cef_net_error_list.h"
#undef NET_ERROR
#endif
} cef_errorcode_t;
@@ -1269,7 +1271,11 @@ typedef enum {
PDE_TYPE_BYTES,
PDE_TYPE_FILE,
#if CEF_API_ADDED(13601)
PDE_TYPE_NUM_VALUES,
#else
PDF_TYPE_NUM_VALUES,
#endif
} cef_postdataelement_type_t;
///
@@ -3619,6 +3625,9 @@ typedef enum {
CEF_CPAIT_OPTIMIZATION_GUIDE,
#if CEF_API_ADDED(13304)
CEF_CPAIT_COLLABORATION_MESSAGING,
#endif
#if CEF_API_ADDED(13400)
CEF_CPAIT_CHANGE_PASSWORD,
#endif
CEF_CPAIT_NUM_VALUES,
} cef_chrome_page_action_icon_type_t;
@@ -3629,8 +3638,13 @@ typedef enum {
///
typedef enum {
CEF_CTBT_CAST,
#if CEF_API_REMOVED(13600)
CEF_CTBT_DOWNLOAD,
CEF_CTBT_SEND_TAB_TO_SELF,
#else
CEF_CTBT_DOWNLOAD_DEPRECATED,
CEF_CTBT_SEND_TAB_TO_SELF_DEPRECATED,
#endif
CEF_CTBT_SIDE_PANEL,
CEF_CTBT_NUM_VALUES,
} cef_chrome_toolbar_button_type_t;
@@ -3783,6 +3797,9 @@ typedef enum {
CEF_PERMISSION_TYPE_WEB_APP_INSTALLATION = 1 << 22,
CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 << 23,
CEF_PERMISSION_TYPE_FILE_SYSTEM_ACCESS = 1 << 24,
#if CEF_API_ADDED(13600)
CEF_PERMISSION_TYPE_LOCAL_NETWORK_ACCESS = 1 << 25,
#endif
} cef_permission_request_types_t;
///

View File

@@ -31,6 +31,8 @@
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_CONTENT_SETTINGS_H_
#pragma once
#include "include/cef_api_hash.h"
#ifdef __cplusplus
extern "C" {
#endif
@@ -385,7 +387,11 @@ typedef enum {
/// ALLOW (default): no effect (e.g. third-party cookies allowed, if not
/// blocked otherwise).
/// BLOCK: third-party cookies blocked, but 3PCD mitigations enabled.
#if CEF_API_ADDED(13601)
CEF_CONTENT_SETTING_TYPE_TOP_LEVEL_TPCD_ORIGIN_TRIAL,
#else
CEF_CONTENT_SETTING_TOP_LEVEL_TPCD_ORIGIN_TRIAL,
#endif
/// Content setting used to indicate whether entering picture-in-picture
/// automatically should be enabled.
@@ -484,6 +490,27 @@ typedef enum {
/// or legacy behavior.
CEF_CONTENT_SETTING_TYPE_LEGACY_COOKIE_SCOPE,
#if CEF_API_ADDED(13400)
/// Website setting to indicate whether the user has allowlisted suspicious
/// notifications for the origin.
CEF_CONTENT_SETTING_TYPE_ARE_SUSPICIOUS_NOTIFICATIONS_ALLOWLISTED_BY_USER,
/// Content settings for access to the Controlled Frame API.
CEF_CONTENT_SETTING_TYPE_CONTROLLED_FRAME,
#endif
#if CEF_API_ADDED(13500)
/// Website setting which is used for UnusedSitePermissionsService to
/// store revoked notification permissions of disruptive sites.
CEF_CONTENT_SETTING_TYPE_REVOKED_DISRUPTIVE_NOTIFICATION_PERMISSIONS,
#endif
#if CEF_API_ADDED(13600)
/// Content setting for whether the site is allowed to make local network
/// requests.
CEF_CONTENT_SETTING_TYPE_LOCAL_NETWORK_ACCESS,
#endif
CEF_CONTENT_SETTING_TYPE_NUM_VALUES,
} cef_content_setting_types_t;

View File

@@ -31,15 +31,12 @@
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_LINUX_H_
#pragma once
#if !defined(GENERATING_CEF_API_HASH)
#include "include/base/cef_build.h"
#endif
#if defined(OS_LINUX)
#if defined(CEF_X11)
typedef union _XEvent XEvent;
typedef struct _XDisplay XDisplay;
#endif
#include "include/internal/cef_export.h"
#include "include/internal/cef_string.h"
#include "include/internal/cef_types_color.h"
@@ -47,17 +44,6 @@ typedef struct _XDisplay XDisplay;
#include "include/internal/cef_types_osr.h"
#include "include/internal/cef_types_runtime.h"
// Handle types.
#if defined(CEF_X11)
#define cef_cursor_handle_t unsigned long
#define cef_event_handle_t XEvent*
#else
#define cef_cursor_handle_t void*
#define cef_event_handle_t void*
#endif
#define cef_window_handle_t unsigned long
#define kNullCursorHandle 0
#define kNullEventHandle NULL
#define kNullWindowHandle 0
@@ -66,6 +52,20 @@ typedef struct _XDisplay XDisplay;
extern "C" {
#endif
#if defined(CEF_X11)
typedef union _XEvent XEvent;
typedef struct _XDisplay XDisplay;
// Handle types.
typedef unsigned long cef_cursor_handle_t;
typedef XEvent* cef_event_handle_t;
#else
typedef void* cef_cursor_handle_t;
typedef void* cef_event_handle_t;
#endif
typedef unsigned long cef_window_handle_t;
///
/// Return the singleton X11 display shared with Chromium. The display is not
/// thread-safe and must only be accessed on the browser process UI thread.

View File

@@ -31,7 +31,9 @@
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_MAC_H_
#pragma once
#if !defined(GENERATING_CEF_API_HASH)
#include "include/base/cef_build.h"
#endif
#if defined(OS_MAC)
#include "include/internal/cef_string.h"
@@ -40,16 +42,6 @@
#include "include/internal/cef_types_osr.h"
#include "include/internal/cef_types_runtime.h"
// Handle types.
// Actually NSCursor*
#define cef_cursor_handle_t void*
// Acutally NSEvent*
#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
#define kNullWindowHandle NULL
@@ -78,6 +70,16 @@
extern "C" {
#endif
// Handle types.
// Actually NSCursor*
typedef void* cef_cursor_handle_t;
// Actually NSEvent*
typedef void* cef_event_handle_t;
// Actually NSView*
typedef void* cef_window_handle_t;
// Actually IOSurface*
typedef void* cef_shared_texture_handle_t;
///
/// Structure representing CefExecuteProcess arguments.
///

View File

@@ -31,8 +31,15 @@
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_OSR_H_
#pragma once
#include <stddef.h>
#include <stdint.h>
#include "include/internal/cef_types_geometry.h"
#ifdef __cplusplus
extern "C" {
#endif
///
/// Structure containing shared texture common metadata.
/// For documentation on each field, please refer to
@@ -107,4 +114,8 @@ typedef struct _cef_accelerated_paint_info_common_t {
} cef_accelerated_paint_info_common_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_OSR_H_

View File

@@ -31,10 +31,15 @@
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_WIN_H_
#pragma once
#if !defined(GENERATING_CEF_API_HASH)
#include "include/base/cef_build.h"
#endif
#if defined(OS_WIN)
#if !defined(GENERATING_CEF_API_HASH)
#include <windows.h>
#endif
#include "include/internal/cef_string.h"
#include "include/internal/cef_types_color.h"
@@ -42,12 +47,6 @@
#include "include/internal/cef_types_osr.h"
#include "include/internal/cef_types_runtime.h"
// Handle types.
#define cef_cursor_handle_t HCURSOR
#define cef_event_handle_t MSG*
#define cef_window_handle_t HWND
#define cef_shared_texture_handle_t HANDLE
#define kNullCursorHandle NULL
#define kNullEventHandle NULL
#define kNullWindowHandle NULL
@@ -56,6 +55,12 @@
extern "C" {
#endif
// Handle types.
typedef HCURSOR cef_cursor_handle_t;
typedef MSG* cef_event_handle_t;
typedef HWND cef_window_handle_t;
typedef HANDLE cef_shared_texture_handle_t;
///
/// Structure representing CefExecuteProcess arguments.
///

View File

@@ -38,6 +38,7 @@
#define CEF_INCLUDE_VIEWS_CEF_BROWSER_VIEW_DELEGATE_H_
#pragma once
#include "include/cef_api_hash.h"
#include "include/cef_client.h"
#include "include/views/cef_view_delegate.h"
@@ -129,6 +130,18 @@ class CefBrowserViewDelegate : public CefViewDelegate {
return false;
}
#if CEF_API_ADDED(13601)
///
/// Return true to allow the use of JavaScript moveTo/By() and resizeTo/By()
/// (without user activation) with Document picture-in-picture popups.
///
/*--cef(added=13601)--*/
virtual bool AllowMoveForPictureInPicture(
CefRefPtr<CefBrowserView> browser_view) {
return false;
}
#endif
///
/// Called when |browser_view| receives a gesture command. Return true to
/// handle (or disable) a |gesture_command| or false to propagate the gesture

View File

@@ -117,8 +117,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
scoped_refptr<CefBrowserInfo> info =
CefBrowserInfoManager::GetInstance()->CreateBrowserInfo(
/*is_devtools_popup=*/false, platform_delegate->IsWindowless(),
platform_delegate->IsPrintPreviewSupported(),
/*is_devtools_popup=*/false, platform_delegate->GetBrowserConfig(),
create_params.extra_info);
bool own_web_contents = false;
@@ -132,8 +131,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
CefRefPtr<AlloyBrowserHostImpl> browser =
CreateInternal(create_params.settings, create_params.client, web_contents,
own_web_contents, info,
/*opener=*/nullptr, /*is_devtools_popup=*/false,
own_web_contents, info, /*opener=*/nullptr,
request_context_impl, std::move(platform_delegate));
if (!browser) {
return nullptr;
@@ -160,7 +158,6 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
bool own_web_contents,
scoped_refptr<CefBrowserInfo> browser_info,
CefRefPtr<AlloyBrowserHostImpl> opener,
bool is_devtools_popup,
CefRefPtr<CefRequestContextImpl> request_context,
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate) {
CEF_REQUIRE_UIT();
@@ -185,7 +182,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
// new browser's platform delegate.
opener->platform_delegate_->PopupWebContentsCreated(
settings, client, web_contents, platform_delegate.get(),
is_devtools_popup);
/*is_devtools=*/false);
}
// Take ownership of |web_contents| if |own_web_contents| is true.
@@ -208,7 +205,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
// result in a call to CefBrowserViewDelegate::OnPopupBrowserViewCreated().
// Do this first for consistency with Chrome style.
opener->platform_delegate_->PopupBrowserCreated(
browser->platform_delegate(), browser.get(), is_devtools_popup);
browser->platform_delegate(), browser.get(), /*is_devtools=*/false);
}
// 2. Notify the browser's LifeSpanHandler. This must always be the first
@@ -901,29 +898,6 @@ void AlloyBrowserHostImpl::DragSourceEndedAt(
}
}
void AlloyBrowserHostImpl::SetAudioMuted(bool mute) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SetAudioMuted,
this, mute));
return;
}
if (!web_contents()) {
return;
}
web_contents()->SetAudioMuted(mute);
}
bool AlloyBrowserHostImpl::IsAudioMuted() {
if (!CEF_CURRENTLY_ON_UIT()) {
DCHECK(false) << "called on invalid thread";
return false;
}
if (!web_contents()) {
return false;
}
return web_contents()->IsAudioMuted();
}
// content::WebContentsDelegate methods.
// -----------------------------------------------------------------------------
@@ -1057,14 +1031,7 @@ void AlloyBrowserHostImpl::BeforeUnloadFired(content::WebContents* source,
bool AlloyBrowserHostImpl::TakeFocus(content::WebContents* source,
bool reverse) {
if (client_.get()) {
CefRefPtr<CefFocusHandler> handler = client_->GetFocusHandler();
if (handler.get()) {
handler->OnTakeFocus(this, !reverse);
}
}
return false;
return contents_delegate_.TakeFocus(source, reverse);
}
void AlloyBrowserHostImpl::CanDownload(
@@ -1151,8 +1118,7 @@ void AlloyBrowserHostImpl::WebContentsCreated(
scoped_refptr<CefBrowserInfo> info =
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
new_contents, platform_delegate->IsWindowless(),
platform_delegate->IsPrintPreviewSupported(), extra_info);
new_contents, platform_delegate->GetBrowserConfig(), extra_info);
CHECK(info.get());
CHECK(info->is_popup());
@@ -1170,8 +1136,7 @@ void AlloyBrowserHostImpl::WebContentsCreated(
// However, we need to install observers/delegates here.
CefRefPtr<AlloyBrowserHostImpl> browser = CreateInternal(
settings, client, new_contents, /*own_web_contents=*/false, info, opener,
/*is_devtools_popup=*/false, request_context,
std::move(platform_delegate));
request_context, std::move(platform_delegate));
}
void AlloyBrowserHostImpl::RendererUnresponsive(

View File

@@ -115,8 +115,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
void DragTargetDrop(const CefMouseEvent& event) override;
void DragSourceSystemDragEnded() override;
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
void SetAudioMuted(bool mute) override;
bool IsAudioMuted() override;
void SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) override;
@@ -300,7 +298,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
bool own_web_contents,
scoped_refptr<CefBrowserInfo> browser_info,
CefRefPtr<AlloyBrowserHostImpl> opener,
bool is_devtools_popup,
CefRefPtr<CefRequestContextImpl> request_context,
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate);

View File

@@ -74,7 +74,7 @@ CefAudioCapturer::CefAudioCapturer(const CefAudioParameters& params,
DCHECK(browser_->web_contents());
channels_ = audio_params.channels();
audio_input_device_ = new media::AudioInputDevice(
audio_input_device_ = base::MakeRefCounted<media::AudioInputDevice>(
std::make_unique<mirroring::CapturedAudioInput>(
base::BindRepeating(&StreamCreatorHelper,
base::Unretained(browser_->web_contents()),

View File

@@ -378,11 +378,11 @@ 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),
static_cast<int>(CHROME_RESULT_CODE_CHROME_START),
"CEF_RESULT_CODE_CHROME_FIRST must match "
"chrome::RESULT_CODE_CHROME_START");
static_assert(static_cast<int>(CEF_RESULT_CODE_CHROME_LAST) ==
static_cast<int>(chrome::RESULT_CODE_CHROME_LAST_CODE),
static_cast<int>(CHROME_RESULT_CODE_CHROME_LAST_CODE),
"CEF_RESULT_CODE_CHROME_LAST must match "
"chrome::RESULT_CODE_CHROME_LAST_CODE");
@@ -629,6 +629,17 @@ void CefBrowserContentsDelegate::OnFocusChangedInPage(
details->is_editable_node;
}
bool CefBrowserContentsDelegate::TakeFocus(content::WebContents* source,
bool reverse) {
if (auto c = client()) {
if (auto handler = c->GetFocusHandler()) {
handler->OnTakeFocus(browser(), !reverse);
}
}
return false;
}
void CefBrowserContentsDelegate::WebContentsDestroyed() {
auto wc = web_contents();
ObserveWebContents(nullptr);

View File

@@ -144,6 +144,7 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
void OnWebContentsFocused(
content::RenderWidgetHost* render_widget_host) override;
void OnFocusChangedInPage(content::FocusedNodeDetails* details) override;
bool TakeFocus(content::WebContents* source, bool reverse) override;
void WebContentsDestroyed() override;
// Accessors for state information. Changes will be signaled to

View File

@@ -246,7 +246,8 @@ void CefBrowserContext::RemoveCefRequestContext(
Shutdown();
// Allow the current call stack to unwind before deleting |this|.
content::BrowserThread::DeleteSoon(CEF_UIT, FROM_HERE, this);
content::BrowserThread::GetTaskRunnerForThread(CEF_UIT)->DeleteSoon(
FROM_HERE, this);
}
}

View File

@@ -783,6 +783,28 @@ CefRefPtr<CefNavigationEntry> CefBrowserHostBase::GetVisibleNavigationEntry() {
return new CefNavigationEntryImpl(entry);
}
void CefBrowserHostBase::SetAudioMuted(bool mute) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostBase::SetAudioMuted,
this, mute));
return;
}
if (auto web_contents = GetWebContents()) {
web_contents->SetAudioMuted(mute);
}
}
bool CefBrowserHostBase::IsAudioMuted() {
if (!CEF_CURRENTLY_ON_UIT()) {
DCHECK(false) << "called on invalid thread";
return false;
}
if (auto web_contents = GetWebContents()) {
return web_contents->IsAudioMuted();
}
return false;
}
void CefBrowserHostBase::NotifyMoveOrResizeStarted() {
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
if (!CEF_CURRENTLY_ON_UIT()) {
@@ -1398,6 +1420,19 @@ CefDevToolsWindowRunner* CefBrowserHostBase::GetDevToolsWindowRunner() {
return devtools_window_runner_.get();
}
void CefBrowserHostBase::set_context_menu_observer(
RenderViewContextMenuObserver* observer) {
context_menu_observer_ = observer;
}
void CefBrowserHostBase::clear_context_menu_observer(
RenderViewContextMenuObserver* observer) {
// Don't clear if a new Observer has already been assigned.
if (context_menu_observer_ == observer) {
context_menu_observer_ = nullptr;
}
}
views::Widget* CefBrowserHostBase::GetWindowWidget() const {
CEF_REQUIRE_UIT();
if (!platform_delegate_) {

View File

@@ -262,6 +262,8 @@ class CefBrowserHostBase : public CefBrowserHost,
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
bool current_only) override;
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
void SetAudioMuted(bool mute) override;
bool IsAudioMuted() override;
void NotifyMoveOrResizeStarted() override;
bool IsFullscreen() override;
void ExitFullscreen(bool will_cause_resize) override;
@@ -390,9 +392,8 @@ class CefBrowserHostBase : public CefBrowserHost,
RenderViewContextMenuObserver* context_menu_observer() const {
return context_menu_observer_;
}
void set_context_menu_observer(RenderViewContextMenuObserver* observer) {
context_menu_observer_ = observer;
}
void set_context_menu_observer(RenderViewContextMenuObserver* observer);
void clear_context_menu_observer(RenderViewContextMenuObserver* observer);
// Returns the Widget owner for the browser window. Only used with windowed
// browsers.

View File

@@ -28,13 +28,11 @@ CefBrowserInfo::FrameInfo::~FrameInfo() {
CefBrowserInfo::CefBrowserInfo(int browser_id,
bool is_popup,
bool is_windowless,
bool print_preview_enabled,
const cef::BrowserConfig& config,
CefRefPtr<CefDictionaryValue> extra_info)
: browser_id_(browser_id),
is_popup_(is_popup),
is_windowless_(is_windowless),
print_preview_enabled_(print_preview_enabled),
config_(config),
extra_info_(extra_info) {
DCHECK_GT(browser_id, 0);

View File

@@ -19,6 +19,7 @@
#include "base/values.h"
#include "cef/include/internal/cef_ptr.h"
#include "cef/libcef/common/values_impl.h"
#include "cef/libcef/renderer/browser_config.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/render_frame_host.h"
@@ -36,8 +37,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
public:
CefBrowserInfo(int browser_id,
bool is_popup,
bool is_windowless,
bool print_preview_enabled,
const cef::BrowserConfig& config,
CefRefPtr<CefDictionaryValue> extra_info);
CefBrowserInfo(const CefBrowserInfo&) = delete;
@@ -45,8 +45,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
int browser_id() const { return browser_id_; }
bool is_popup() const { return is_popup_; }
bool is_windowless() const { return is_windowless_; }
bool print_preview_enabled() const { return print_preview_enabled_; }
const cef::BrowserConfig& config() const { return config_; }
CefRefPtr<CefDictionaryValue> extra_info() const { return extra_info_; }
// May return nullptr if the browser has not yet been created (before
@@ -202,8 +201,7 @@ class CefBrowserInfo : public base::RefCountedThreadSafe<CefBrowserInfo> {
const int browser_id_;
const bool is_popup_;
const bool is_windowless_;
const bool print_preview_enabled_;
const cef::BrowserConfig config_;
CefRefPtr<CefDictionaryValue> extra_info_;
// Navigation will be blocked while |navigation_lock_| exists.

View File

@@ -69,15 +69,13 @@ CefBrowserInfoManager* CefBrowserInfoManager::GetInstance() {
}
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreateBrowserInfo(
bool is_popup,
bool is_windowless,
bool print_preview_enabled,
bool is_devtools_popup,
const cef::BrowserConfig& config,
CefRefPtr<CefDictionaryValue> extra_info) {
base::AutoLock lock_scope(browser_info_lock_);
scoped_refptr<CefBrowserInfo> browser_info =
new CefBrowserInfo(++next_browser_id_, is_popup, is_windowless,
print_preview_enabled, extra_info);
scoped_refptr<CefBrowserInfo> browser_info = new CefBrowserInfo(
++next_browser_id_, is_devtools_popup, config, extra_info);
browser_info_list_.push_back(browser_info);
return browser_info;
@@ -85,8 +83,7 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreateBrowserInfo(
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
content::WebContents* new_contents,
bool is_windowless,
bool print_preview_enabled,
const cef::BrowserConfig& config,
CefRefPtr<CefDictionaryValue> extra_info) {
CEF_REQUIRE_UIT();
@@ -95,8 +92,8 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
scoped_refptr<CefBrowserInfo> browser_info;
{
base::AutoLock lock_scope(browser_info_lock_);
browser_info = new CefBrowserInfo(++next_browser_id_, true, is_windowless,
print_preview_enabled, extra_info);
browser_info =
new CefBrowserInfo(++next_browser_id_, true, config, extra_info);
browser_info_list_.push_back(browser_info);
}
@@ -777,9 +774,14 @@ void CefBrowserInfoManager::SendNewBrowserInfoResponse(
if (browser_info) {
params->browser_id = browser_info->browser_id();
params->is_windowless = browser_info->is_windowless();
params->is_popup = browser_info->is_popup();
params->print_preview_enabled = browser_info->print_preview_enabled();
auto config = cef::mojom::NewBrowserConfig::New();
config->is_popup = browser_info->is_popup();
config->is_windowless = browser_info->config().is_windowless;
config->print_preview_enabled =
browser_info->config().print_preview_enabled;
config->move_pip_enabled = browser_info->config().move_pip_enabled;
params->config = std::move(config);
auto extra_info = browser_info->extra_info();
if (extra_info) {

View File

@@ -53,11 +53,10 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
static CefBrowserInfoManager* GetInstance();
// Called immediately before a new CefBrowserHost implementation is created
// directly. In this case |is_popup| will be true only for DevTools browsers.
// directly.
scoped_refptr<CefBrowserInfo> CreateBrowserInfo(
bool is_popup,
bool is_windowless,
bool print_preview_enabled,
bool is_devtools_popup,
const cef::BrowserConfig& config,
CefRefPtr<CefDictionaryValue> extra_info);
// Called from WebContentsDelegate::WebContentsCreated when a new browser is
@@ -66,8 +65,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// response will be sent when this method is called.
scoped_refptr<CefBrowserInfo> CreatePopupBrowserInfo(
content::WebContents* new_contents,
bool is_windowless,
bool print_preview_enabled,
const cef::BrowserConfig& config,
CefRefPtr<CefDictionaryValue> extra_info);
// Called from ContentBrowserClient::CanCreateWindow. See comments on

View File

@@ -567,6 +567,15 @@ bool CefBrowserPlatformDelegate::IsPrintPreviewSupported() const {
return true;
}
bool CefBrowserPlatformDelegate::IsMovePictureInPictureEnabled() const {
return false;
}
cef::BrowserConfig CefBrowserPlatformDelegate::GetBrowserConfig() const {
return {IsWindowless(), IsPrintPreviewSupported(),
IsMovePictureInPictureEnabled()};
}
void CefBrowserPlatformDelegate::Find(const CefString& searchText,
bool forward,
bool matchCase,

View File

@@ -15,6 +15,7 @@
#include "cef/include/cef_drag_data.h"
#include "cef/include/internal/cef_types.h"
#include "cef/include/views/cef_browser_view.h"
#include "cef/libcef/renderer/browser_config.h"
#include "third_party/blink/public/common/page/drag_operation.h"
#include "third_party/blink/public/mojom/drag/drag.mojom-forward.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -370,6 +371,12 @@ class CefBrowserPlatformDelegate {
bool findNext);
virtual void StopFinding(bool clearSelection);
virtual bool IsMovePictureInPictureEnabled() const;
// CefBrowser configuration determined prior to CefBrowserHost creation and
// passed to the renderer process via the GetNewBrowserInfo Mojo request.
cef::BrowserConfig GetBrowserConfig() const;
protected:
// Allow deletion via std::unique_ptr only.
friend std::default_delete<CefBrowserPlatformDelegate>;

View File

@@ -99,8 +99,8 @@ class BrowserDelegate : public content::WebContentsDelegate {
enum class ToolbarButtonType {
kCast = 0,
kDownload,
kSendTabToSelf,
kDownload_DEPRECATED,
kSendTabToSelf_DEPRECATED,
kSidePanel,
kMaxValue = kSidePanel,
};

View File

@@ -260,8 +260,8 @@ void ChromeBrowserDelegate::SetAsDelegate(content::WebContents* web_contents,
CHECK(platform_delegate->IsChromeStyle());
auto browser_info = CefBrowserInfoManager::GetInstance()->CreateBrowserInfo(
is_devtools_popup, /*is_windowless=*/false,
platform_delegate->IsPrintPreviewSupported(), create_params_.extra_info);
is_devtools_popup, platform_delegate->GetBrowserConfig(),
create_params_.extra_info);
auto request_context_impl =
CefRequestContextImpl::GetOrCreateForRequestContext(
@@ -476,6 +476,14 @@ void ChromeBrowserDelegate::DraggableRegionsChanged(
}
}
bool ChromeBrowserDelegate::TakeFocus(content::WebContents* source,
bool reverse) {
if (auto delegate = GetDelegateForWebContents(source)) {
return delegate->TakeFocus(source, reverse);
}
return false;
}
void ChromeBrowserDelegate::WindowFullscreenStateChanged() {
// Use a synchronous callback for notification on Windows/Linux. MacOS gets
// notified asynchronously via CefNativeWidgetMac callbacks.
@@ -751,8 +759,7 @@ ChromeBrowserDelegate::CreateBrowserHostForPopup(
auto browser_info =
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
web_contents, /*is_windowless=*/false,
platform_delegate->IsPrintPreviewSupported(), extra_info);
web_contents, platform_delegate->GetBrowserConfig(), extra_info);
CHECK(browser_info->is_popup());
// Popups must share the same RequestContext as the parent.

View File

@@ -127,6 +127,7 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
void DraggableRegionsChanged(
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
content::WebContents* contents) override;
bool TakeFocus(content::WebContents* source, bool reverse) override;
Browser* browser() const { return browser_; }

View File

@@ -327,15 +327,6 @@ void ChromeBrowserHostImpl::DragSourceEndedAt(int x,
NOTIMPLEMENTED();
}
void ChromeBrowserHostImpl::SetAudioMuted(bool mute) {
NOTIMPLEMENTED();
}
bool ChromeBrowserHostImpl::IsAudioMuted() {
NOTIMPLEMENTED();
return false;
}
void ChromeBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) {
@@ -509,8 +500,7 @@ void ChromeBrowserHostImpl::Attach(content::WebContents* web_contents,
is_devtools_popup);
}
platform_delegate_->WebContentsCreated(web_contents,
/*own_web_contents=*/false);
platform_delegate_->WebContentsCreated(web_contents, /*owned=*/false);
contents_delegate_.ObserveWebContents(web_contents);
// Associate the platform delegate with this browser.

View File

@@ -109,8 +109,6 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
void DragTargetDrop(const CefMouseEvent& event) override;
void DragSourceSystemDragEnded() override;
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
void SetAudioMuted(bool mute) override;
bool IsAudioMuted() override;
void SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) override;

View File

@@ -132,7 +132,7 @@ void HandleExternalProtocolHelper(
ChromeContentBrowserClientCef* self,
content::WebContents::Getter web_contents_getter,
content::FrameTreeNodeId frame_tree_node_id,
content::NavigationUIData* navigation_data,
std::unique_ptr<content::NavigationUIData> navigation_data,
bool is_primary_main_frame,
bool is_in_fenced_frame_tree,
network::mojom::WebSandboxFlags sandbox_flags,
@@ -153,7 +153,7 @@ void HandleExternalProtocolHelper(
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
self->HandleExternalProtocol(
resource_request.url, web_contents_getter, frame_tree_node_id,
navigation_data, is_primary_main_frame, is_in_fenced_frame_tree,
navigation_data.get(), is_primary_main_frame, is_in_fenced_frame_tree,
sandbox_flags,
static_cast<ui::PageTransition>(resource_request.transition_type),
resource_request.has_user_gesture, initiating_origin, initiator_rfh,
@@ -375,12 +375,14 @@ void ChromeContentBrowserClientCef::CreateWindowResult(
CefBrowserInfoManager::GetInstance()->CreateWindowResult(opener, success);
}
void ChromeContentBrowserClientCef::OverrideWebkitPrefs(
void ChromeContentBrowserClientCef::OverrideWebPreferences(
content::WebContents* web_contents,
content::SiteInstance& main_frame_site,
blink::web_pref::WebPreferences* prefs) {
renderer_prefs::SetDefaultPrefs(*prefs);
ChromeContentBrowserClient::OverrideWebkitPrefs(web_contents, prefs);
ChromeContentBrowserClient::OverrideWebPreferences(web_contents,
main_frame_site, prefs);
SkColor base_background_color;
auto browser = CefBrowserHostBase::GetBrowserForContents(web_contents);
@@ -542,10 +544,10 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
web_contents_getter, frame_tree_node_id, request,
base::BindRepeating(HandleExternalProtocolHelper, base::Unretained(this),
web_contents_getter, frame_tree_node_id,
navigation_data, is_primary_main_frame,
is_in_fenced_frame_tree, sandbox_flags, request,
initiating_origin, std::move(weak_initiator_document),
isolation_info));
base::Passed(navigation_data->Clone()),
is_primary_main_frame, is_in_fenced_frame_tree,
sandbox_flags, request, initiating_origin,
std::move(weak_initiator_document), isolation_info));
net_service::ProxyURLLoaderFactory::CreateProxy(
web_contents_getter, std::move(receiver), std::move(request_handler));
@@ -600,7 +602,7 @@ ChromeContentBrowserClientCef::CreateLoginDelegate(
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
content::GuestPageHolder* guest,
LoginAuthRequiredCallback auth_required_callback) {
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
// |web_contents| is nullptr for CefURLRequests without an associated frame.
if (!web_contents || base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableChromeLoginPrompt)) {

View File

@@ -65,8 +65,9 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
bool* no_javascript_access) override;
void CreateWindowResult(content::RenderFrameHost* opener,
bool success) override;
void OverrideWebkitPrefs(content::WebContents* web_contents,
blink::web_pref::WebPreferences* prefs) override;
void OverrideWebPreferences(content::WebContents* web_contents,
content::SiteInstance& main_frame_site,
blink::web_pref::WebPreferences* prefs) override;
void WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
@@ -133,7 +134,8 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
content::GuestPageHolder* guest,
LoginAuthRequiredCallback auth_required_callback) override;
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback)
override;
void ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry,
blink::AssociatedInterfaceRegistry* associated_registry,

View File

@@ -82,7 +82,8 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
CefRefPtr<CefBrowserHostBase> browser,
CefRefPtr<CefContextMenuHandler> handler)
: context_menu_(context_menu), browser_(browser), handler_(handler) {
// This remains valid until the next time a context menu is created.
// Association remains valid until the next time a context menu is created,
// or this Observer is destroyed.
browser_->set_context_menu_observer(this);
}
@@ -163,6 +164,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
// Clear stored state because this object won't be deleted until a new
// context menu is created or the associated browser is destroyed.
browser_->clear_context_menu_observer(this);
browser_ = nullptr;
handler_ = nullptr;
params_ = nullptr;

View File

@@ -130,6 +130,16 @@ bool CefBrowserPlatformDelegateChromeViews::IsViewsHosted() const {
return true;
}
bool CefBrowserPlatformDelegateChromeViews::IsMovePictureInPictureEnabled()
const {
if (browser_view_) {
if (auto* delegate = browser_view_->delegate()) {
return delegate->AllowMoveForPictureInPicture(browser_view_.get());
}
}
return false;
}
CefWindowImpl* CefBrowserPlatformDelegateChromeViews::GetWindowImpl() const {
if (auto* widget = GetWindowWidget()) {
CefRefPtr<CefWindow> window = view_util::GetWindowFor(widget);

View File

@@ -34,6 +34,7 @@ class CefBrowserPlatformDelegateChromeViews
void SetBrowserView(CefRefPtr<CefBrowserView> browser_view) override;
void SetFocus(bool setFocus) override;
bool IsViewsHosted() const override;
bool IsMovePictureInPictureEnabled() const override;
CefBrowserViewImpl* browser_view() const { return browser_view_.get(); }

View File

@@ -12,10 +12,12 @@
#include "base/task/current_thread.h"
#include "base/threading/thread_restrictions.h"
#include "cef/libcef/browser/browser_info_manager.h"
#include "cef/libcef/browser/prefs/pref_helper.h"
#include "cef/libcef/browser/request_context_impl.h"
#include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/browser/trace_subscriber.h"
#include "cef/libcef/common/cef_switches.h"
#include "chrome/browser/browser_process_impl.h"
#include "components/network_session_configurator/common/network_switches.h"
#include "ui/base/ui_base_switches.h"
@@ -289,6 +291,7 @@ int RunMainWithPreferredStackSize(FiberState& fiber_state) {
} // namespace
NO_STACK_PROTECTOR
int CefExecuteProcess(const CefMainArgs& args,
CefRefPtr<CefApp> application,
void* windows_sandbox_info) {
@@ -570,12 +573,24 @@ CefTraceSubscriber* CefContext::GetTraceSubscriber() {
if (shutting_down_) {
return nullptr;
}
if (!trace_subscriber_.get()) {
if (!trace_subscriber_) {
trace_subscriber_ = std::make_unique<CefTraceSubscriber>();
}
return trace_subscriber_.get();
}
pref_helper::Registrar* CefContext::GetPrefRegistrar() {
CEF_REQUIRE_UIT();
if (shutting_down_) {
return nullptr;
}
if (!pref_registrar_) {
pref_registrar_ = std::make_unique<pref_helper::Registrar>();
pref_registrar_->Init(g_browser_process->local_state());
}
return pref_registrar_.get();
}
void CefContext::PopulateGlobalRequestContextSettings(
CefRequestContextSettings* settings) {
CefRefPtr<CefCommandLine> command_line =
@@ -645,12 +660,15 @@ void CefContext::ShutdownOnUIThread() {
observer.OnContextDestroyed();
}
if (trace_subscriber_.get()) {
trace_subscriber_.reset(nullptr);
if (trace_subscriber_) {
trace_subscriber_.reset();
}
if (pref_registrar_) {
pref_registrar_.reset();
}
}
void CefContext::FinalizeShutdown() {
browser_info_manager_.reset(nullptr);
browser_info_manager_.reset();
application_ = nullptr;
}

View File

@@ -16,6 +16,10 @@
#include "cef/libcef/browser/main_runner.h"
#include "third_party/skia/include/core/SkColor.h"
namespace pref_helper {
class Registrar;
}
class CefBrowserInfoManager;
class CefTraceSubscriber;
@@ -73,6 +77,7 @@ class CefContext {
cef_state_t windowless_state) const;
CefTraceSubscriber* GetTraceSubscriber();
pref_helper::Registrar* GetPrefRegistrar();
// Populate request context settings for the global system context based on
// CefSettings and command-line flags.
@@ -105,13 +110,14 @@ class CefContext {
int exit_code_ = -1;
// The thread on which the context was initialized.
base::PlatformThreadId init_thread_id_ = 0;
base::PlatformThreadId init_thread_id_;
CefSettings settings_;
CefRefPtr<CefApp> application_;
std::unique_ptr<CefMainRunner> main_runner_;
std::unique_ptr<CefTraceSubscriber> trace_subscriber_;
std::unique_ptr<pref_helper::Registrar> pref_registrar_;
std::unique_ptr<CefBrowserInfoManager> browser_info_manager_;
// Observers that want to be notified of changes to this object.

View File

@@ -128,7 +128,7 @@ class CefSelectFileDialog final : public ui::SelectFileDialog {
}
private:
gfx::NativeWindow owning_window_ = nullptr;
gfx::NativeWindow owning_window_ = gfx::NativeWindow();
bool has_multiple_file_choices_ = false;
CefRefPtr<CefBrowserHostBase> browser_;

View File

@@ -4,10 +4,28 @@
#include "cef/libcef/browser/global_preference_manager_impl.h"
#include "base/metrics/field_trial_list_including_low_anonymity.h"
#include "base/strings/string_util.h"
#include "cef/libcef/browser/context.h"
#include "cef/libcef/browser/prefs/pref_helper.h"
#include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/common/api_version_util.h"
#include "chrome/browser/about_flags.h"
#include "chrome/browser/browser_process.h"
#include "components/variations/synthetic_trials_active_group_id_provider.h"
#include "components/webui/flags/pref_service_flags_storage.h"
namespace {
std::string GetActiveGroupNameAsString(
const base::FieldTrial::ActiveGroup& group) {
constexpr std::string_view kNonBreakingHyphenUTF8 = "\xE2\x80\x91";
std::string result = group.trial_name + ":" + group.group_name;
base::ReplaceChars(result, "-", kNonBreakingHyphenUTF8, &result);
return result;
}
} // namespace
bool CefGlobalPreferenceManagerImpl::HasPreference(const CefString& name) {
CEF_REQUIRE_UIT_RETURN(false);
@@ -40,6 +58,77 @@ bool CefGlobalPreferenceManagerImpl::SetPreference(const CefString& name,
value, error);
}
CefRefPtr<CefRegistration>
CefGlobalPreferenceManagerImpl::AddPreferenceObserver(
const CefString& name,
CefRefPtr<CefPreferenceObserver> observer) {
CEF_API_REQUIRE_ADDED(13401);
CEF_REQUIRE_UIT_RETURN(nullptr);
return CefContext::Get()->GetPrefRegistrar()->AddObserver(name, observer);
}
// static
void CefPreferenceManager::GetChromeVariationsAsSwitches(
std::vector<CefString>& switches) {
CEF_API_REQUIRE_ADDED(13401);
// Verify that the context is in a valid state.
if (!CONTEXT_STATE_VALID()) {
DCHECK(false) << "context not valid";
return;
}
switches.clear();
// Based on ChromeFeatureListCreator::ConvertFlagsToSwitches().
flags_ui::PrefServiceFlagsStorage flags_storage(
g_browser_process->local_state());
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
about_flags::ConvertFlagsToSwitches(&flags_storage, &command_line,
flags_ui::kNoSentinels);
for (const auto& arg : command_line.argv()) {
if (!arg.empty()) {
switches.push_back(arg);
}
}
}
// static
void CefPreferenceManager::GetChromeVariationsAsStrings(
std::vector<CefString>& strings) {
CEF_API_REQUIRE_ADDED(13401);
// Verify that the context is in a valid state.
if (!CONTEXT_STATE_VALID()) {
DCHECK(false) << "context not valid";
return;
}
strings.clear();
// Based on components/webui/version/version_handler_helper.cc
// GetVariationsList().
base::FieldTrial::ActiveGroups active_groups;
// Include low anonymity trial groups in the version string, as it is only
// displayed locally (and is useful for diagnostics purposes).
base::FieldTrialListIncludingLowAnonymity::
GetActiveFieldTrialGroupsForTesting(&active_groups);
for (const auto& group : active_groups) {
strings.push_back(GetActiveGroupNameAsString(group));
}
// Synthetic field trials.
for (const auto& group :
variations::SyntheticTrialsActiveGroupIdProvider::GetInstance()
->GetGroups()) {
strings.push_back(GetActiveGroupNameAsString(group.active_group()));
}
}
// static
CefRefPtr<CefPreferenceManager>
CefPreferenceManager::GetGlobalPreferenceManager() {

View File

@@ -27,6 +27,9 @@ class CefGlobalPreferenceManagerImpl : public CefPreferenceManager {
bool SetPreference(const CefString& name,
CefRefPtr<CefValue> value,
CefString& error) override;
CefRefPtr<CefRegistration> AddPreferenceObserver(
const CefString& name,
CefRefPtr<CefPreferenceObserver> observer) override;
private:
IMPLEMENT_REFCOUNTING(CefGlobalPreferenceManagerImpl);

View File

@@ -117,8 +117,7 @@ bool CefMainRunner::Initialize(CefSettings* settings,
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_))) {
if (!IsNormalResultCode(static_cast<ResultCode>(exit_code_))) {
LOG(ERROR) << "ContentMainRun failed with exit code " << exit_code_;
}
return false;
@@ -207,6 +206,7 @@ void CefMainRunner::QuitMessageLoop() {
}
// static
NO_STACK_PROTECTOR
int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
CefRefPtr<CefApp> application,
void* windows_sandbox_info) {
@@ -460,7 +460,7 @@ void CefMainRunner::FinishShutdownOnUIThread() {
ChromeProcessSingleton::DeleteInstance();
}
static_cast<content::ContentMainRunnerImpl*>(main_runner_.get())
static_cast<content::ContentMainRunnerImpl*>(main_runner_.get())
->ShutdownOnUIThread();
}

View File

@@ -215,8 +215,10 @@ class CefMediaAccessQuery {
content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
-1 /* webrtc::kFullDesktopScreenId */);
}
video_devices.emplace_back(request_.video_type, media_id.ToString(),
"Screen");
if (media_id.type != content::DesktopMediaID::TYPE_NONE) {
video_devices.emplace_back(request_.video_type, media_id.ToString(),
"Screen");
}
}
blink::mojom::StreamDevicesSetPtr stream_devices_set =

View File

@@ -20,6 +20,12 @@
#include "content/public/browser/render_widget_host_view.h"
#include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h"
#if BUILDFLAG(IS_WIN)
#include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/spellchecker/spellcheck_service.h"
#include "components/spellcheck/browser/spellcheck_platform.h"
#endif
namespace {
CefString GetLabel(int message_id) {
@@ -120,8 +126,8 @@ bool CefMenuManager::IsShowingContextMenu() {
return web_contents()->IsShowingContextMenu();
}
bool CefMenuManager::CreateContextMenu(
const content::ContextMenuParams& params) {
bool CefMenuManager::CreateContextMenu(const content::ContextMenuParams& params,
bool query_spellcheck) {
// The renderer may send the "show context menu" message multiple times, one
// for each right click mouse event it receives. Normally, this doesn't happen
// because mouse events are not forwarded once the context menu is showing.
@@ -134,6 +140,24 @@ bool CefMenuManager::CreateContextMenu(
}
params_ = params;
#if BUILDFLAG(IS_WIN)
// System spellcheck suggestions need to be queried asynchronously.
if (query_spellcheck && !params_.misspelled_word.empty() &&
params_.dictionary_suggestions.empty()) {
SpellcheckService* spellcheck_service =
SpellcheckServiceFactory::GetForContext(
browser_->web_contents()->GetBrowserContext());
if (spellcheck_service) {
spellcheck_platform::GetPerLanguageSuggestions(
spellcheck_service->platform_spell_checker(), params_.misspelled_word,
base::BindOnce(&CefMenuManager::OnGetPlatformSuggestionsComplete,
weak_ptr_factory_.GetWeakPtr()));
}
return true;
}
#endif
model_->Clear();
// Create the default menu model.
@@ -511,3 +535,18 @@ bool CefMenuManager::IsCustomContextMenuCommand(int command_id) {
}
return false;
}
#if BUILDFLAG(IS_WIN)
void CefMenuManager::OnGetPlatformSuggestionsComplete(
const spellcheck::PerLanguageSuggestions&
platform_per_language_suggestions) {
std::vector<std::u16string> combined_suggestions;
spellcheck::FillSuggestions(platform_per_language_suggestions,
&combined_suggestions);
params_.dictionary_suggestions = combined_suggestions;
// Now that we have spelling suggestions, call CreateContextMenu again.
CreateContextMenu(params_, /*query_spellcheck=*/false);
}
#endif

View File

@@ -13,6 +13,10 @@
#include "content/public/browser/context_menu_params.h"
#include "content/public/browser/web_contents_observer.h"
#if BUILDFLAG(IS_WIN)
#include "components/spellcheck/common/spellcheck_common.h"
#endif
namespace content {
class RenderFrameHost;
class WebContents;
@@ -39,7 +43,8 @@ class CefMenuManager : public CefMenuModelImpl::Delegate,
bool IsShowingContextMenu();
// Create the context menu.
bool CreateContextMenu(const content::ContextMenuParams& params);
bool CreateContextMenu(const content::ContextMenuParams& params,
bool query_spellcheck = true);
void CancelContextMenu();
private:
@@ -62,6 +67,12 @@ class CefMenuManager : public CefMenuModelImpl::Delegate,
// Returns true if the specified id is a custom context menu command.
bool IsCustomContextMenuCommand(int command_id);
#if BUILDFLAG(IS_WIN)
void OnGetPlatformSuggestionsComplete(
const spellcheck::PerLanguageSuggestions&
platform_per_language_suggestions);
#endif
// AlloyBrowserHostImpl pointer is guaranteed to outlive this object.
raw_ptr<AlloyBrowserHostImpl> browser_;

View File

@@ -173,10 +173,11 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
window_info_.parent_window, window_info_.menu,
::GetModuleHandle(nullptr), this);
// It's possible for CreateWindowEx to fail if the parent window was
// destroyed between the call to CreateBrowser and the above one.
DCHECK(window_info_.window);
if (!window_info_.window) {
// It's possible for CreateWindowEx to fail if the parent window was destroyed
// between the call to CreateBrowser and the above one. It's also possible
// that |browser_| will be nullptr if BrowserDestroyed() was called during
// this time.
if (!window_info_.window || !browser_) {
return false;
}
@@ -569,10 +570,14 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
// Clear the user data pointer.
gfx::SetWindowUserData(hwnd, nullptr);
// Force the browser to be destroyed. This will result in a call to
// BrowserDestroyed() that will release the reference added in
// CreateHostWindow().
AlloyBrowserHostImpl::FromBaseChecked(browser)->WindowDestroyed();
// |browser| may be nullptr if the window was destroyed during browser
// creation (e.g. CreateHostWindow() returned false).
if (browser) {
// Force the browser to be destroyed. This will result in a call to
// BrowserDestroyed() that will release the reference added in
// CreateHostWindow().
AlloyBrowserHostImpl::FromBaseChecked(browser)->WindowDestroyed();
}
}
break;

View File

@@ -21,8 +21,7 @@ bool CefMenuRunnerMac::RunContextMenu(
// Create a menu controller based on the model.
MenuControllerCocoa* menu_controller =
[[MenuControllerCocoa alloc] initWithModel:model->model()
delegate:nil
useWithPopUpButtonCell:NO];
delegate:nil];
menu_controller_ = menu_controller;

View File

@@ -18,8 +18,13 @@ namespace throttle {
namespace {
bool NavigationOnUIThread(content::NavigationHandle* navigation_handle) {
void NavigationOnUIThread(
content::NavigationHandle* navigation_handle,
bool should_run_async,
navigation_interception::InterceptNavigationThrottle::ResultCallback
result_callback) {
CEF_REQUIRE_UIT();
CHECK(!should_run_async);
const bool is_main_frame = navigation_handle->IsInMainFrame();
const auto global_id = frame_util::GetGlobalId(navigation_handle);
@@ -45,7 +50,8 @@ bool NavigationOnUIThread(content::NavigationHandle* navigation_handle) {
navigation_handle->GetWebContents()->GetPrimaryMainFrame(),
open_params, browser)) {
// Cancel the navigation.
return true;
std::move(result_callback).Run(true);
return;
}
bool ignore_navigation = false;
@@ -81,7 +87,7 @@ bool NavigationOnUIThread(content::NavigationHandle* navigation_handle) {
}
}
return ignore_navigation;
std::move(result_callback).Run(ignore_navigation);
}
} // namespace
@@ -95,7 +101,7 @@ void CreateThrottlesForNavigation(content::NavigationHandle* navigation_handle,
std::unique_ptr<content::NavigationThrottle> throttle =
std::make_unique<navigation_interception::InterceptNavigationThrottle>(
navigation_handle, base::BindRepeating(&NavigationOnUIThread),
navigation_interception::SynchronyMode::kSync);
navigation_interception::SynchronyMode::kSync, std::nullopt);
// Always execute our throttle first.
throttles.emplace(throttles.begin(), std::move(throttle));

View File

@@ -202,7 +202,8 @@ void SaveCookiesOnUIThread(
}
net::CookieInclusionStatus status;
status.AddExclusionReason(net::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR);
status.AddExclusionReason(
net::CookieInclusionStatus::ExclusionReason::EXCLUDE_UNKNOWN_ERROR);
SetCanonicalCookieCallback(progress, net::CanonicalCookie(),
net::CookieAccessResult(std::move(status)));
}

View File

@@ -307,7 +307,7 @@ bool CefCookieManagerImpl::SetCookieInternal(
if (!canonical_cookie) {
net::CookieInclusionStatus status;
status.AddExclusionReason(
net::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR);
net::CookieInclusionStatus::ExclusionReason::EXCLUDE_UNKNOWN_ERROR);
SetCookieCallbackImpl(callback, net::CookieAccessResult(std::move(status)));
return true;
}

View File

@@ -111,11 +111,12 @@ void RunCallbackOnIOThread(
}
} // namespace
LoginDelegate::LoginDelegate(const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
const content::GlobalRequestID& request_id,
const GURL& origin_url,
LoginAuthRequiredCallback callback)
LoginDelegate::LoginDelegate(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
const content::GlobalRequestID& request_id,
const GURL& origin_url,
content::LoginDelegate::LoginAuthRequiredCallback callback)
: callback_(std::move(callback)), weak_ptr_factory_(this) {
CEF_REQUIRE_UIT();

View File

@@ -29,7 +29,7 @@ class LoginDelegate : public content::LoginDelegate {
content::WebContents* web_contents,
const content::GlobalRequestID& request_id,
const GURL& origin_url,
LoginAuthRequiredCallback callback);
content::LoginDelegate::LoginAuthRequiredCallback callback);
void Continue(const CefString& username, const CefString& password);
void Cancel();
@@ -40,7 +40,7 @@ class LoginDelegate : public content::LoginDelegate {
const content::GlobalRequestID& request_id,
const GURL& origin_url);
LoginAuthRequiredCallback callback_;
content::LoginDelegate::LoginAuthRequiredCallback callback_;
base::WeakPtrFactory<LoginDelegate> weak_ptr_factory_;
};

View File

@@ -103,8 +103,8 @@ class ResourceContextData : public base::SupportsUserData::Data {
// Maybe the browser was destroyed while AddProxyOnUIThread was pending.
if (!web_contents) {
// Delete on the IO thread as expected by mojo bindings.
content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE,
proxy);
content::BrowserThread::GetTaskRunnerForThread(CEF_IOT)->DeleteSoon(
FROM_HERE, proxy);
return;
}
@@ -263,8 +263,6 @@ class InterceptedRequest : public network::mojom::URLLoader,
const std::optional<GURL>& new_url) override;
void SetPriority(net::RequestPriority priority,
int32_t intra_priority_value) override;
void PauseReadingBodyFromNet() override;
void ResumeReadingBodyFromNet() override;
int32_t id() const { return id_; }
@@ -343,6 +341,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
network::URLLoaderCompletionStatus status_;
bool got_loader_error_ = false;
bool completed_ = false;
// Used for rate limiting OnUploadProgress callbacks.
bool waiting_for_upload_progress_ack_ = false;
@@ -764,18 +763,6 @@ void InterceptedRequest::SetPriority(net::RequestPriority priority,
}
}
void InterceptedRequest::PauseReadingBodyFromNet() {
if (target_loader_) {
target_loader_->PauseReadingBodyFromNet();
}
}
void InterceptedRequest::ResumeReadingBodyFromNet() {
if (target_loader_) {
target_loader_->ResumeReadingBodyFromNet();
}
}
// Helper methods.
void InterceptedRequest::BeforeRequestReceived(const GURL& original_url,
@@ -1155,7 +1142,17 @@ void InterceptedRequest::OnDestroy() {
// We don't want any callbacks after this point.
weak_factory_.InvalidateWeakPtrs();
factory_->request_handler_->OnRequestComplete(id_, request_, status_);
bool handled_externally = false;
factory_->request_handler_->OnRequestComplete(id_, request_, status_,
handled_externally);
// Don't call OnComplete() if an unhandled request might be handled
// externally. The request will instead be canceled implicitly with
// ERR_ABORTED.
if (!handled_externally && target_client_ && !completed_) {
target_client_->OnComplete(status_);
completed_ = true;
}
// Destroys |this|.
factory_->RemoveRequest(this);
@@ -1207,6 +1204,7 @@ void InterceptedRequest::CallOnComplete(
if (target_client_) {
target_client_->OnComplete(status);
completed_ = true;
}
if (proxied_loader_receiver_.is_bound() &&
@@ -1241,7 +1239,6 @@ void InterceptedRequest::SendErrorStatusAndCompleteImmediately(
const network::URLLoaderCompletionStatus& status) {
status_ = status;
SendErrorCallback(status_.error_code, false);
target_client_->OnComplete(status_);
OnDestroy();
}

View File

@@ -121,7 +121,8 @@ class InterceptedRequestHandler {
virtual void OnRequestComplete(
int32_t request_id,
const network::ResourceRequest& request,
const network::URLLoaderCompletionStatus& status) {}
const network::URLLoaderCompletionStatus& status,
bool& handled_externally) {}
// Called on error.
virtual void OnRequestError(int32_t request_id,

View File

@@ -1069,10 +1069,10 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
}
}
void OnRequestComplete(
int32_t request_id,
const network::ResourceRequest& request,
const network::URLLoaderCompletionStatus& status) override {
void OnRequestComplete(int32_t request_id,
const network::ResourceRequest& request,
const network::URLLoaderCompletionStatus& status,
bool& handled_externally) override {
CEF_REQUIRE_IOT();
RequestState* state = GetState(request_id);
@@ -1116,6 +1116,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
init_state_->browser_, init_state_->frame_,
state->pending_request_.get(), allow_os_execution);
if (allow_os_execution && init_state_->unhandled_request_callback_) {
handled_externally = true;
CEF_POST_TASK(TID_UI, init_state_->unhandled_request_callback_);
}
}

View File

@@ -584,10 +584,6 @@ void StreamReaderURLLoader::FollowRedirect(
void StreamReaderURLLoader::SetPriority(net::RequestPriority priority,
int intra_priority_value) {}
void StreamReaderURLLoader::PauseReadingBodyFromNet() {}
void StreamReaderURLLoader::ResumeReadingBodyFromNet() {}
void StreamReaderURLLoader::OnInputStreamOpened(
std::unique_ptr<StreamReaderURLLoader::Delegate> returned_delegate,
std::unique_ptr<InputStream> input_stream) {

View File

@@ -137,8 +137,6 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
const std::optional<GURL>& new_url) override;
void SetPriority(net::RequestPriority priority,
int intra_priority_value) override;
void PauseReadingBodyFromNet() override;
void ResumeReadingBodyFromNet() override;
private:
void ContinueWithRequestHeaders(

View File

@@ -197,7 +197,7 @@ struct PopulateAxNodeAttributes {
case ax::mojom::IntAttribute::kAriaNotificationPriorityDeprecated: {
auto state =
static_cast<ax::mojom::AriaNotificationPriority>(attr.second);
if (ax::mojom::AriaNotificationPriority::kNone != state) {
if (ax::mojom::AriaNotificationPriority::kNormal != state) {
attributes->SetString(ToString(attr.first), ToString(state));
}
} break;

View File

@@ -238,8 +238,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
root_layer_ = std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR);
bool opaque = SkColorGetA(background_color_) == SK_AlphaOPAQUE;
GetRootLayer()->SetFillsBoundsOpaquely(opaque);
// Opacity of SOLID_COLOR layer is determined by the color's alpha channel.
GetRootLayer()->SetColor(background_color_);
external_begin_frame_enabled_ = use_external_begin_frame;
@@ -502,7 +501,11 @@ CefRenderWidgetHostViewOSR::GetDisplayFeature() {
return std::nullopt;
}
void CefRenderWidgetHostViewOSR::SetDisplayFeatureForTesting(
void CefRenderWidgetHostViewOSR::DisableDisplayFeatureOverrideForEmulation() {
DCHECK(false);
}
void CefRenderWidgetHostViewOSR::OverrideDisplayFeatureForEmulation(
const content::DisplayFeature* display_feature) {
DCHECK(false);
}
@@ -1865,8 +1868,7 @@ void CefRenderWidgetHostViewOSR::RequestImeCompositionUpdate(
void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged(
const gfx::Range& range,
const std::optional<std::vector<gfx::Rect>>& character_bounds,
const std::optional<std::vector<gfx::Rect>>& line_bounds) {
const std::optional<std::vector<gfx::Rect>>& character_bounds) {
if (browser_impl_.get()) {
CefRange cef_range(range.start(), range.end());
CefRenderHandler::RectList rcList;

View File

@@ -132,7 +132,8 @@ class CefRenderWidgetHostViewOSR
std::optional<SkColor> GetBackgroundColor() override;
void UpdateBackgroundColor() override;
std::optional<content::DisplayFeature> GetDisplayFeature() override;
void SetDisplayFeatureForTesting(
void DisableDisplayFeatureOverrideForEmulation() override;
void OverrideDisplayFeatureForEmulation(
const content::DisplayFeature* display_feature) override;
blink::mojom::PointerLockResult LockPointer(
bool request_unadjusted_movement) override;
@@ -185,8 +186,7 @@ class CefRenderWidgetHostViewOSR
viz::SurfaceId GetCurrentSurfaceId() const override;
void ImeCompositionRangeChanged(
const gfx::Range& range,
const std::optional<std::vector<gfx::Rect>>& character_bounds,
const std::optional<std::vector<gfx::Rect>>& line_bounds) override;
const std::optional<std::vector<gfx::Rect>>& character_bounds) override;
std::unique_ptr<content::SyntheticGestureTarget>
CreateSyntheticGestureTarget() override;
bool TransformPointToCoordSpaceForView(

View File

@@ -92,7 +92,7 @@ void SoftwareOutputDeviceProxy::Resize(const gfx::Size& viewport_pixel_size,
canvas_ = skia::CreatePlatformCanvasWithPixels(
viewport_pixel_size_.width(), viewport_pixel_size_.height(), false,
static_cast<uint8_t*>(shm_.memory()), skia::CRASH_ON_FAILURE);
static_cast<uint8_t*>(shm_.memory()), 0U, skia::CRASH_ON_FAILURE);
#else
canvas_ = skia::CreatePlatformCanvasWithSharedSection(
viewport_pixel_size_.width(), viewport_pixel_size_.height(), false,

View File

@@ -175,7 +175,7 @@ void CefVideoConsumerOSR::OnFrameCaptured(
auto& gmb_handle = data->get_gpu_memory_buffer_handle();
cef_accelerated_paint_info_t paint_info;
paint_info.extra = extra;
paint_info.shared_texture_handle = gmb_handle.dxgi_handle.Get();
paint_info.shared_texture_handle = gmb_handle.dxgi_handle().buffer_handle();
paint_info.format = pixel_format;
view_->OnAcceleratedPaint(damage_rect, info->coded_size, paint_info);
#elif BUILDFLAG(IS_APPLE)

View File

@@ -245,6 +245,8 @@ cef_permission_request_types_t GetCefRequestType(
return CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT;
case permissions::RequestType::kFileSystemAccess:
return CEF_PERMISSION_TYPE_FILE_SYSTEM_ACCESS;
case permissions::RequestType::kLocalNetworkAccess:
return CEF_PERMISSION_TYPE_LOCAL_NETWORK_ACCESS;
}
DCHECK(false);

View File

@@ -6,6 +6,7 @@
#include "base/notreached.h"
#include "base/strings/stringprintf.h"
#include "cef/include/cef_preference.h"
#include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/common/values_impl.h"
#include "components/prefs/pref_service.h"
@@ -118,4 +119,145 @@ bool SetPreference(PrefService* pref_service,
return true;
}
class RegistrationImpl final : public Registration, public CefRegistration {
public:
RegistrationImpl(Registrar* registrar,
const CefString& name,
CefRefPtr<CefPreferenceObserver> observer)
: registrar_(registrar), name_(name), observer_(observer) {
DCHECK(registrar_);
DCHECK(observer_);
}
RegistrationImpl(const RegistrationImpl&) = delete;
RegistrationImpl& operator=(const RegistrationImpl&) = delete;
~RegistrationImpl() override {
CEF_REQUIRE_UIT();
if (registrar_) {
registrar_->RemoveObserver(name_.ToString(), this);
}
}
void Detach() override {
registrar_ = nullptr;
observer_ = nullptr;
}
void RunCallback() const override { RunCallback(name_); }
void RunCallback(const CefString& name) const override {
observer_->OnPreferenceChanged(name);
}
private:
raw_ptr<Registrar> registrar_;
CefString name_;
CefRefPtr<CefPreferenceObserver> observer_;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(RegistrationImpl);
};
Registrar::~Registrar() {
RemoveAll();
}
void Registrar::Init(PrefService* service) {
DCHECK(service);
DCHECK(IsEmpty() || service_ == service);
service_ = service;
}
void Registrar::Reset() {
RemoveAll();
service_ = nullptr;
}
void Registrar::RemoveAll() {
if (!name_observers_.empty()) {
for (auto& [name, registrations] : name_observers_) {
service_->RemovePrefObserver(name, this);
for (auto& registration : registrations) {
registration.Detach();
}
}
name_observers_.clear();
}
if (!all_observers_.empty()) {
service_->RemovePrefObserverAllPrefs(this);
for (auto& registration : all_observers_) {
registration.Detach();
}
all_observers_.Clear();
}
}
bool Registrar::IsEmpty() const {
return name_observers_.empty() && all_observers_.empty();
}
CefRefPtr<CefRegistration> Registrar::AddObserver(
const CefString& name,
CefRefPtr<CefPreferenceObserver> observer) {
CHECK(service_);
RegistrationImpl* impl = new RegistrationImpl(this, name, observer);
if (name.empty()) {
if (all_observers_.empty()) {
service_->AddPrefObserverAllPrefs(this);
}
all_observers_.AddObserver(impl);
} else {
const std::string& name_str = name.ToString();
if (!name_observers_.contains(name_str)) {
service_->AddPrefObserver(name_str, this);
}
name_observers_[name_str].AddObserver(impl);
}
return impl;
}
void Registrar::RemoveObserver(std::string_view name,
Registration* registration) {
CHECK(service_);
if (name.empty()) {
all_observers_.RemoveObserver(registration);
if (all_observers_.empty()) {
service_->RemovePrefObserverAllPrefs(this);
}
} else {
auto it = name_observers_.find(std::string(name));
DCHECK(it != name_observers_.end());
it->second.RemoveObserver(registration);
if (it->second.empty()) {
name_observers_.erase(it);
service_->RemovePrefObserver(name, this);
}
}
}
void Registrar::OnPreferenceChanged(PrefService* service,
std::string_view pref_name) {
std::string pref_name_str(pref_name);
if (!name_observers_.empty()) {
auto it = name_observers_.find(pref_name_str);
if (it != name_observers_.end()) {
for (Registration& registration : it->second) {
registration.RunCallback();
}
}
}
if (!all_observers_.empty()) {
CefString name_str(pref_name_str);
for (Registration& registration : all_observers_) {
registration.RunCallback(name_str);
}
}
}
} // namespace pref_helper

View File

@@ -5,8 +5,16 @@
#ifndef CEF_LIBCEF_BROWSER_PREFS_PREF_HELPER_H_
#define CEF_LIBCEF_BROWSER_PREFS_PREF_HELPER_H_
#include "cef/include/cef_values.h"
#include <unordered_map>
#include "base/memory/raw_ptr.h"
#include "base/observer_list.h"
#include "cef/include/cef_registration.h"
#include "cef/include/cef_values.h"
#include "components/prefs/pref_observer.h"
class CefPreferenceObserver;
class CefRegistration;
class PrefService;
namespace pref_helper {
@@ -28,6 +36,69 @@ bool SetPreference(PrefService* pref_service,
CefRefPtr<CefValue> value,
CefString& error);
class Registration : public base::CheckedObserver {
public:
virtual void Detach() = 0;
virtual void RunCallback() const = 0;
virtual void RunCallback(const CefString& name) const = 0;
};
class RegistrationImpl;
// Automatically manages the registration of one or more CefPreferenceObserver
// objects with a PrefService. When the Registrar is destroyed, all registered
// observers are automatically unregistered with the PrefService. Loosely based
// on PrefChangeRegistrar.
class Registrar final : public PrefObserver {
public:
Registrar() = default;
Registrar(const Registrar&) = delete;
Registrar& operator=(const Registrar&) = delete;
~Registrar();
// Must be called before adding or removing observers. Can be called more
// than once as long as the value of |service| doesn't change.
void Init(PrefService* service);
// Removes all observers and clears the reference to the PrefService.
// `Init` must be called before adding or removing any observers.
void Reset();
// Removes all observers that have been previously added with a call to Add.
void RemoveAll();
// Returns true if no observers are registered.
bool IsEmpty() const;
// Adds a pref |observer| for the specified pref |name|. All registered
// observers will be automatically unregistered and detached when the
// Registrar's destructor is called.
CefRefPtr<CefRegistration> AddObserver(
const CefString& name,
CefRefPtr<CefPreferenceObserver> observer);
private:
friend class RegistrationImpl;
void RemoveObserver(std::string_view name, Registration* registration);
// PrefObserver:
void OnPreferenceChanged(PrefService* service,
std::string_view pref_name) override;
raw_ptr<PrefService, AcrossTasksDanglingUntriaged> service_ = nullptr;
// Observers registered for a preference by name.
using ObserverMap =
std::unordered_map<std::string, base::ObserverList<Registration>>;
ObserverMap name_observers_;
// Observers registered for all preferences.
base::ObserverList<Registration> all_observers_;
};
} // namespace pref_helper
#endif // CEF_LIBCEF_BROWSER_PREFS_PREF_HELPER_H_

View File

@@ -107,7 +107,7 @@ void PrintToPDF(content::WebContents* web_contents,
}
}
absl::variant<printing::mojom::PrintPagesParamsPtr, std::string>
std::variant<printing::mojom::PrintPagesParamsPtr, std::string>
print_pages_params = print_to_pdf::GetPrintPagesParams(
web_contents->GetPrimaryMainFrame()->GetLastCommittedURL(),
!!settings.landscape, display_header_footer,
@@ -117,14 +117,14 @@ void PrintToPDF(content::WebContents* web_contents,
CefString(&settings.footer_template), !!settings.prefer_css_page_size,
!!settings.generate_tagged_pdf, !!settings.generate_document_outline);
if (absl::holds_alternative<std::string>(print_pages_params)) {
if (std::holds_alternative<std::string>(print_pages_params)) {
LOG(ERROR) << "PrintToPDF failed with error: "
<< absl::get<std::string>(print_pages_params);
<< std::get<std::string>(print_pages_params);
callback->OnPdfPrintFinished(CefString(), false);
return;
}
DCHECK(absl::holds_alternative<printing::mojom::PrintPagesParamsPtr>(
DCHECK(std::holds_alternative<printing::mojom::PrintPagesParamsPtr>(
print_pages_params));
if (auto* print_manager =

View File

@@ -10,7 +10,9 @@
#include "cef/libcef/browser/browser_context.h"
#include "cef/libcef/browser/context.h"
#include "cef/libcef/browser/prefs/pref_helper.h"
#include "cef/libcef/browser/setting_helper.h"
#include "cef/libcef/browser/thread_util.h"
#include "cef/libcef/common/api_version_util.h"
#include "cef/libcef/common/app_manager.h"
#include "cef/libcef/common/task_runner_impl.h"
#include "cef/libcef/common/values_impl.h"
@@ -459,6 +461,22 @@ bool CefRequestContextImpl::SetPreference(const CefString& name,
return pref_helper::SetPreference(pref_service, name, value, error);
}
CefRefPtr<CefRegistration> CefRequestContextImpl::AddPreferenceObserver(
const CefString& name,
CefRefPtr<CefPreferenceObserver> observer) {
CEF_API_REQUIRE_ADDED(13401);
if (!VerifyBrowserContext()) {
return nullptr;
}
if (!pref_registrar_) {
pref_registrar_ = std::make_unique<pref_helper::Registrar>();
pref_registrar_->Init(browser_context()->AsProfile()->GetPrefs());
}
return pref_registrar_->AddObserver(name, observer);
}
void CefRequestContextImpl::ClearCertificateExceptions(
CefRefPtr<CefCompletionCallback> callback) {
GetBrowserContext(
@@ -588,6 +606,26 @@ void CefRequestContextImpl::SetContentSetting(
requesting_url, top_level_url, content_type, value));
}
CefRefPtr<CefRegistration> CefRequestContextImpl::AddSettingObserver(
CefRefPtr<CefSettingObserver> observer) {
CEF_API_REQUIRE_ADDED(13401);
if (!VerifyBrowserContext()) {
return nullptr;
}
if (!setting_registrar_) {
auto* settings_map = HostContentSettingsMapFactory::GetForProfile(
browser_context()->AsProfile());
if (!settings_map) {
return nullptr;
}
setting_registrar_ = std::make_unique<setting_helper::Registrar>();
setting_registrar_->Init(settings_map);
}
return setting_registrar_->AddObserver(observer);
}
void CefRequestContextImpl::SetChromeColorScheme(cef_color_variant_t variant,
cef_color_t user_color) {
GetBrowserContext(

View File

@@ -17,6 +17,14 @@ namespace content {
struct GlobalRenderFrameHostId;
}
namespace pref_helper {
class Registrar;
}
namespace setting_helper {
class Registrar;
}
class CefBrowserContext;
// Implementation of the CefRequestContext interface. All methods are thread-
@@ -80,6 +88,20 @@ class CefRequestContextImpl : public CefRequestContext {
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
BrowserContextCallback callback);
// CefPreferenceManager methods.
bool HasPreference(const CefString& name) override;
CefRefPtr<CefValue> GetPreference(const CefString& name) override;
CefRefPtr<CefDictionaryValue> GetAllPreferences(
bool include_defaults) override;
bool CanSetPreference(const CefString& name) override;
bool SetPreference(const CefString& name,
CefRefPtr<CefValue> value,
CefString& error) override;
CefRefPtr<CefRegistration> AddPreferenceObserver(
const CefString& name,
CefRefPtr<CefPreferenceObserver> observer) override;
// CefRequestContext methods.
bool IsSame(CefRefPtr<CefRequestContext> other) override;
bool IsSharingWith(CefRefPtr<CefRequestContext> other) override;
bool IsGlobal() override;
@@ -92,14 +114,6 @@ class CefRequestContextImpl : public CefRequestContext {
const CefString& domain_name,
CefRefPtr<CefSchemeHandlerFactory> factory) override;
bool ClearSchemeHandlerFactories() override;
bool HasPreference(const CefString& name) override;
CefRefPtr<CefValue> GetPreference(const CefString& name) override;
CefRefPtr<CefDictionaryValue> GetAllPreferences(
bool include_defaults) override;
bool CanSetPreference(const CefString& name) override;
bool SetPreference(const CefString& name,
CefRefPtr<CefValue> value,
CefString& error) override;
void ClearCertificateExceptions(
CefRefPtr<CefCompletionCallback> callback) override;
void ClearHttpAuthCredentials(
@@ -125,6 +139,8 @@ class CefRequestContextImpl : public CefRequestContext {
const CefString& top_level_url,
cef_content_setting_types_t content_type,
cef_content_setting_values_t value) override;
CefRefPtr<CefRegistration> AddSettingObserver(
CefRefPtr<CefSettingObserver> observer) override;
void SetChromeColorScheme(cef_color_variant_t variant,
cef_color_t user_color) override;
cef_color_variant_t GetChromeColorSchemeMode() override;
@@ -218,6 +234,9 @@ class CefRequestContextImpl : public CefRequestContext {
Config config_;
std::unique_ptr<pref_helper::Registrar> pref_registrar_;
std::unique_ptr<setting_helper::Registrar> setting_registrar_;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefRequestContextImpl);
};

View File

@@ -0,0 +1,118 @@
// Copyright (c) 2025 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 "cef/libcef/browser/setting_helper.h"
#include "cef/include/cef_request_context.h"
#include "cef/libcef/browser/thread_util.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "url/gurl.h"
namespace setting_helper {
class RegistrationImpl final : public Registration, public CefRegistration {
public:
RegistrationImpl(Registrar* registrar, CefRefPtr<CefSettingObserver> observer)
: registrar_(registrar), observer_(observer) {
DCHECK(registrar_);
DCHECK(observer_);
}
RegistrationImpl(const RegistrationImpl&) = delete;
RegistrationImpl& operator=(const RegistrationImpl&) = delete;
~RegistrationImpl() override {
CEF_REQUIRE_UIT();
if (registrar_) {
registrar_->RemoveObserver(this);
}
}
void Detach() override {
registrar_ = nullptr;
observer_ = nullptr;
}
void RunCallback(const CefString& requesting_url,
const CefString& top_level_url,
cef_content_setting_types_t content_type) const override {
observer_->OnSettingChanged(requesting_url, top_level_url, content_type);
}
private:
raw_ptr<Registrar> registrar_;
CefRefPtr<CefSettingObserver> observer_;
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(RegistrationImpl);
};
Registrar::~Registrar() {
RemoveAll();
}
void Registrar::Init(HostContentSettingsMap* settings) {
DCHECK(settings);
DCHECK(IsEmpty() || settings_ == settings);
settings_ = settings;
}
void Registrar::Reset() {
RemoveAll();
settings_ = nullptr;
}
void Registrar::RemoveAll() {
if (!observers_.empty()) {
settings_->RemoveObserver(this);
for (auto& registration : observers_) {
registration.Detach();
}
observers_.Clear();
}
}
bool Registrar::IsEmpty() const {
return observers_.empty();
}
CefRefPtr<CefRegistration> Registrar::AddObserver(
CefRefPtr<CefSettingObserver> observer) {
CHECK(settings_);
RegistrationImpl* impl = new RegistrationImpl(this, observer);
if (observers_.empty()) {
settings_->AddObserver(this);
}
observers_.AddObserver(impl);
return impl;
}
void Registrar::RemoveObserver(Registration* registration) {
CHECK(settings_);
observers_.RemoveObserver(registration);
if (observers_.empty()) {
settings_->RemoveObserver(this);
}
}
void Registrar::OnContentSettingChanged(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsTypeSet content_type_set) {
DCHECK(!IsEmpty());
const CefString requesting_url(primary_pattern.ToRepresentativeUrl().spec());
const CefString top_level_url(secondary_pattern.ToRepresentativeUrl().spec());
const auto content_type =
static_cast<cef_content_setting_types_t>(content_type_set.GetType());
for (Registration& registration : observers_) {
registration.RunCallback(requesting_url, top_level_url, content_type);
}
}
} // namespace setting_helper

View File

@@ -0,0 +1,81 @@
// Copyright (c) 2025 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_SETTING_HELPER_H_
#define CEF_LIBCEF_BROWSER_SETTING_HELPER_H_
#include "base/memory/raw_ptr.h"
#include "base/observer_list.h"
#include "cef/include/cef_registration.h"
#include "components/content_settings/core/browser/content_settings_observer.h"
class CefSettingObserver;
class CefRegistration;
class HostContentSettingsMap;
namespace setting_helper {
class Registration : public base::CheckedObserver {
public:
virtual void Detach() = 0;
virtual void RunCallback(const CefString& requesting_url,
const CefString& top_level_url,
cef_content_setting_types_t content_type) const = 0;
};
class RegistrationImpl;
// Automatically manages the registration of one or more CefSettingObserver
// objects with a HostContentSettingsMap. When the Registrar is destroyed, all
// registered observers are automatically unregistered with the
// HostContentSettingsMap. Loosely based on PrefChangeRegistrar.
class Registrar final : public content_settings::Observer {
public:
Registrar() = default;
Registrar(const Registrar&) = delete;
Registrar& operator=(const Registrar&) = delete;
~Registrar();
// Must be called before adding or removing observers. Can be called more
// than once as long as the value of |settings| doesn't change.
void Init(HostContentSettingsMap* settings);
// Removes all observers and clears the reference to the
// HostContentSettingsMap. `Init` must be called before adding or removing any
// observers.
void Reset();
// Removes all observers that have been previously added with a call to Add.
void RemoveAll();
// Returns true if no observers are registered.
bool IsEmpty() const;
// Adds a setting observer. All registered observers will be automatically
// unregistered and detached when the Registrar's destructor is called.
CefRefPtr<CefRegistration> AddObserver(
CefRefPtr<CefSettingObserver> observer);
private:
friend class RegistrationImpl;
void RemoveObserver(Registration* registration);
// content_settings::Observer:
void OnContentSettingChanged(
const ContentSettingsPattern& primary_pattern,
const ContentSettingsPattern& secondary_pattern,
ContentSettingsTypeSet content_type_set) override;
raw_ptr<HostContentSettingsMap, AcrossTasksDanglingUntriaged> settings_ =
nullptr;
base::ObserverList<Registration> observers_;
};
} // namespace setting_helper
#endif // CEF_LIBCEF_BROWSER_SETTING_HELPER_H_

View File

@@ -4,8 +4,9 @@
#include "cef/libcef/browser/task_manager_impl.h"
#include <ranges>
#include "base/check.h"
#include "base/ranges/algorithm.h"
#include "base/system/sys_info.h"
#include "cef/libcef/browser/browser_host_base.h"
#include "cef/libcef/browser/context.h"
@@ -27,7 +28,6 @@ CefTaskManager::TaskType toCefTaskType(task_manager::Task::Type type) {
case task_manager::Task::CROSTINI:
case task_manager::Task::PLUGIN_VM:
case task_manager::Task::NACL:
case task_manager::Task::LACROS:
return CEF_TASK_TYPE_UNKNOWN;
case task_manager::Task::BROWSER:
return CEF_TASK_TYPE_BROWSER;
@@ -85,7 +85,7 @@ void CefTaskManagerImpl::OnTaskAdded(int64_t id) {
}
void CefTaskManagerImpl::OnTaskToBeRemoved(int64_t id) {
auto index = base::ranges::find(tasks_, id);
auto index = std::ranges::find(tasks_, id);
if (index != tasks_.end()) {
tasks_.erase(index);
}
@@ -166,7 +166,7 @@ int64_t CefTaskManagerImpl::GetTaskIdForBrowserId(int browser_id) {
}
bool CefTaskManagerImpl::IsValidTaskId(int64_t task_id) const {
return base::ranges::find(tasks_, task_id) != tasks_.end();
return std::ranges::find(tasks_, task_id) != tasks_.end();
}
CefRefPtr<CefTaskManager> CefTaskManager::GetTaskManager() {

View File

@@ -62,12 +62,12 @@ CEF_LABEL_BUTTON_IMPL_T class CefLabelButtonImpl : public CEF_BUTTON_IMPL_D {
CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetText(
const CefString& text) {
CEF_REQUIRE_VALID_RETURN_VOID();
ParentClass::root_view()->SetText(text);
ParentClass::root_view()->SetText(text.ToString16());
}
CEF_LABEL_BUTTON_IMPL_T CefString CEF_LABEL_BUTTON_IMPL_D::GetText() {
CEF_REQUIRE_VALID_RETURN(CefString());
return ParentClass::root_view()->GetText();
return std::u16string(ParentClass::root_view()->GetText());
}
CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetImage(

View File

@@ -190,7 +190,9 @@ void CefOverlayViewHost::Init(views::View* host_view,
// Initialize the Widget. |widget_| will be deleted by the NativeWidget or
// when WidgetDelegate::DeleteDelegate() deletes |this|.
widget_ = std::make_unique<ThemeCopyingWidget>(window_view_->GetWidget());
views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
views::Widget::InitParams params(
views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET,
views::Widget::InitParams::TYPE_CONTROL);
params.delegate = this;
params.name = "CefOverlayViewHost";
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;

View File

@@ -77,12 +77,12 @@ bool CefTextfieldImpl::IsReadOnly() {
CefString CefTextfieldImpl::GetText() {
CEF_REQUIRE_VALID_RETURN(CefString());
return root_view()->GetText();
return std::u16string(root_view()->GetText());
}
void CefTextfieldImpl::SetText(const CefString& text) {
CEF_REQUIRE_VALID_RETURN_VOID();
root_view()->SetText(text);
root_view()->SetText(text.ToString16());
}
void CefTextfieldImpl::AppendText(const CefString& text) {
@@ -102,7 +102,7 @@ bool CefTextfieldImpl::HasSelection() {
CefString CefTextfieldImpl::GetSelectedText() {
CEF_REQUIRE_VALID_RETURN(CefString());
return root_view()->GetSelectedText();
return std::u16string(root_view()->GetSelectedText());
}
void CefTextfieldImpl::SelectAll(bool reversed) {
@@ -208,12 +208,12 @@ void CefTextfieldImpl::ClearEditHistory() {
void CefTextfieldImpl::SetPlaceholderText(const CefString& text) {
CEF_REQUIRE_VALID_RETURN_VOID();
root_view()->SetPlaceholderText(text);
root_view()->SetPlaceholderText(text.ToString16());
}
CefString CefTextfieldImpl::GetPlaceholderText() {
CEF_REQUIRE_VALID_RETURN(CefString());
return root_view()->GetPlaceholderText();
return std::u16string(root_view()->GetPlaceholderText());
}
void CefTextfieldImpl::SetPlaceholderTextColor(cef_color_t color) {

View File

@@ -377,7 +377,7 @@ std::optional<SkColor> GetBackgroundColor(const views::View* view,
bool allow_transparent) {
// Return the configured background color, if any.
if (view->background()) {
return view->background()->get_color();
return view->background()->color().GetSkColor();
}
// If the containing Widget is an overlay then it has a transparent background

View File

@@ -5,6 +5,7 @@
#include "cef/libcef/browser/views/window_view.h"
#include <memory>
#include <ranges>
#include "base/memory/raw_ptr.h"
@@ -16,7 +17,6 @@
#endif
#endif
#include "base/ranges/algorithm.h"
#include "cef/libcef/browser/geometry_util.h"
#include "cef/libcef/browser/image_impl.h"
#include "cef/libcef/browser/views/widget.h"
@@ -887,7 +887,7 @@ void CefWindowView::RemoveOverlayView(CefOverlayViewHost* host,
DCHECK_EQ(host_view->parent(), this);
RemoveChildView(host_view);
const auto it = base::ranges::find_if(
const auto it = std::ranges::find_if(
overlay_hosts_,
[host](CefOverlayViewHost* current) { return current == host; });
DCHECK(it != overlay_hosts_.end());

View File

@@ -11,6 +11,7 @@
#include "cef/include/internal/cef_logging_internal.h"
#include "cef/include/internal/cef_thread_internal.h"
#include "cef/include/internal/cef_trace_event_internal.h"
#include "cef/libcef/common/api_version_util.h"
namespace {
@@ -218,13 +219,13 @@ CEF_EXPORT void cef_log(const char* file,
}
CEF_EXPORT cef_platform_thread_id_t cef_get_current_platform_thread_id() {
return base::PlatformThread::CurrentId();
return base::PlatformThread::CurrentId().raw();
}
CEF_EXPORT cef_platform_thread_handle_t
cef_get_current_platform_thread_handle() {
#if BUILDFLAG(IS_WIN)
return base::PlatformThread::CurrentId();
return base::PlatformThread::CurrentId().raw();
#else
return base::PlatformThread::CurrentHandle().platform_handle();
#endif
@@ -240,5 +241,7 @@ CEF_EXPORT int cef_dump_without_crashing(long long mseconds_between_dumps,
}
CEF_EXPORT int cef_dump_without_crashing_unthrottled() {
return base::debug::DumpWithoutCrashingUnthrottled();
CEF_API_REQUIRE_REMOVED(13500);
NOTIMPLEMENTED();
return 0;
}

View File

@@ -463,7 +463,7 @@ std::optional<int> ChromeMainDelegateCef::PostEarlyInitialization(
const auto result = ChromeMainDelegate::PostEarlyInitialization(invoked_in);
if (!result) {
const auto* invoked_in_browser =
absl::get_if<InvokedInBrowserProcess>(&invoked_in);
std::get_if<InvokedInBrowserProcess>(&invoked_in);
if (invoked_in_browser) {
// At this point local_state has been created but ownership has not yet
// been passed to BrowserProcessImpl (g_browser_process is nullptr).
@@ -479,7 +479,7 @@ std::optional<int> ChromeMainDelegateCef::PostEarlyInitialization(
return result;
}
absl::variant<int, content::MainFunctionParams>
std::variant<int, content::MainFunctionParams>
ChromeMainDelegateCef::RunProcess(
const std::string& process_type,
content::MainFunctionParams main_function_params) {

View File

@@ -43,7 +43,7 @@ class ChromeMainDelegateCef : public ChromeMainDelegate,
void SandboxInitialized(const std::string& process_type) override;
std::optional<int> PreBrowserMain() override;
std::optional<int> PostEarlyInitialization(InvokedIn invoked_in) override;
absl::variant<int, content::MainFunctionParams> RunProcess(
std::variant<int, content::MainFunctionParams> RunProcess(
const std::string& process_type,
content::MainFunctionParams main_function_params) override;
#if BUILDFLAG(IS_LINUX)

View File

@@ -62,7 +62,7 @@ bool CefCreateTempDirectoryInDirectory(const CefString& base_dir,
base::FilePath result;
base::FilePath::StringType prefix_str = prefix;
if (base::CreateTemporaryDirInDir(
base_dir, base::FilePath::StringPieceType(prefix_str), &result)) {
base_dir, base::FilePath::StringViewType(prefix_str), &result)) {
new_dir = result.value();
return true;
}

View File

@@ -111,12 +111,19 @@ struct NewRenderThreadInfo {
array<CrossOriginWhiteListEntry>? cross_origin_whitelist_entries;
};
struct NewBrowserConfig {
bool is_popup;
// Values from cef::BrowserConfig.
bool is_windowless;
bool print_preview_enabled;
bool move_pip_enabled;
};
struct NewBrowserInfo {
int32 browser_id;
bool? is_popup;
bool? is_windowless;
bool? print_preview_enabled;
bool is_excluded;
NewBrowserConfig? config;
mojo_base.mojom.DictionaryValue? extra_info;
};

View File

@@ -37,8 +37,13 @@ bool GetCookieDomain(const GURL& url,
domain_string = pc.Domain();
}
net::CookieInclusionStatus status;
return net::cookie_util::GetCookieDomainWithString(url, domain_string, status,
result);
const auto& retval =
net::cookie_util::GetCookieDomainWithString(url, domain_string, status);
if (retval.has_value()) {
*result = *retval;
return true;
}
return false;
}
cef_cookie_same_site_t MakeCefCookieSameSite(net::CookieSameSite value) {

View File

@@ -114,7 +114,7 @@ bool CefThreadImpl::Create(const CefString& display_name,
}
thread_task_runner_ = new CefTaskRunnerImpl(thread_->task_runner());
thread_id_ = thread_->GetThreadId();
thread_id_ = thread_->GetThreadId().raw();
return true;
}

View File

@@ -159,7 +159,7 @@ class CefValueControllerThreadSafe : public CefValueController {
locked_thread_id_ = base::PlatformThread::CurrentId();
}
void unlock() override NO_THREAD_SAFETY_ANALYSIS {
locked_thread_id_ = 0;
locked_thread_id_ = base::PlatformThreadId();
lock_.Release();
}
bool locked() override {
@@ -169,7 +169,7 @@ class CefValueControllerThreadSafe : public CefValueController {
private:
base::Lock lock_;
base::PlatformThreadId locked_thread_id_ = 0;
base::PlatformThreadId locked_thread_id_;
};
// Non-thread-safe access control implementation.

View File

@@ -0,0 +1,22 @@
// Copyright 2025 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_RENDERER_BROWSER_CONFIG_H_
#define CEF_LIBCEF_RENDERER_BROWSER_CONFIG_H_
#pragma once
namespace cef {
// CefBrowser configuration determined prior to CefBrowserHost creation (in
// CefBrowserPlatformDelegate::GetBrowserConfig) and passed to the renderer
// process via the GetNewBrowserInfo Mojo request.
struct BrowserConfig {
bool is_windowless;
bool print_preview_enabled;
bool move_pip_enabled;
};
} // namespace cef
#endif // CEF_LIBCEF_RENDERER_BROWSER_CONFIG_H_

Some files were not shown because too many files have changed in this diff Show More