Compare commits

..

21 Commits
7103 ... 6943

Author SHA1 Message Date
Marshall Greenblatt
e3b12aa905 Pin depot_tools version for out-of-support branch 2025-03-10 15:43:39 -04:00
Marshall Greenblatt
99a2ab18d7 Fix Chrome toolbar initialization (fixes #3898)
Change BrowserWindowFeatures initialization to consider CEF browsers
with TYPE_POPUP as normal.
2025-03-07 14:59:53 -05:00
Marshall Greenblatt
cb88687701 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 12:22:18 -05:00
Jacobo Aragunde Pérez
b6461275c5 tools: Add non-zero exit code for single patch failure (fixes #3903) 2025-03-07 12:22:11 -05:00
Marshall Greenblatt
db28106e3b tools: Also check for CEF_NEXT in .cc files (see #3836) 2025-02-28 18:29:29 -05:00
Marshall Greenblatt
5c7368ef04 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:29:19 -05:00
Marshall Greenblatt
4b02b2a912 tools: Fix get_all_versions for newly added class (see #3836) 2025-02-28 18:29:08 -05:00
Marshall Greenblatt
7e26b63680 cefclient: Add global option to https://tests/preferences (see #3892) 2025-02-28 18:29:03 -05:00
Marshall Greenblatt
02b8366c2e Update to Chromium version 133.0.6943.142 2025-02-26 16:13:43 +00:00
Nik Pavlov
760a2c4a9e 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:42 -05:00
Marshall Greenblatt
0852ba6743 cmake: win: Set LPAC ACLs required for sandbox support (fixes #3791) 2025-02-19 13:40:53 -05:00
Marshall Greenblatt
6949ecc7e6 Update to Chromium version 133.0.6943.127 2025-02-19 17:21:14 +00:00
Marshall Greenblatt
68ed3f4047 Minor types cleanup for API gen (see #3836) 2025-02-19 12:18:06 -05:00
Marshall Greenblatt
adab98e7ce tools: win: Fix grep usage with system Git (see #3836) 2025-02-19 12:17:50 -05:00
Marshall Greenblatt
1a19a56541 tools: Add null check for struct ptrs in CToCpp wrapper (see #3836) 2025-02-19 12:17:36 -05:00
Peng Zhou
24b5131bc8 mac: Add -isysroot flag to clang command (see #3836) 2025-02-14 15:08:03 -05:00
Marshall Greenblatt
0363068c41 Update to Chromium version 133.0.6943.99 2025-02-13 14:34:32 +00:00
Marshall Greenblatt
8055abc92d Update to Chromium version 133.0.6943.60 2025-02-12 14:59:24 +00:00
Marshall Greenblatt
ff061be9ae Update to Chromium version 133.0.6943.35 2025-02-03 04:46:06 +00:00
Marshall Greenblatt
c1ff8b0438 Update to Chromium version 133.0.6943.16 2025-01-16 14:37:49 +00:00
Marshall Greenblatt
b158ecb5d3 Update to Chromium version 133.0.6943.6 2025-01-15 11:44:45 -05:00
216 changed files with 1720 additions and 4756 deletions

View File

@@ -340,7 +340,7 @@ if (is_win) {
# to maintain.
"//chrome/common/crash_keys.cc",
"//chrome/common/chrome_switches.cc",
"//components/webui/flags/flags_ui_switches.cc",
"//components/flags_ui/flags_ui_switches.cc",
"//content/public/common/content_switches.cc",
]
@@ -677,8 +677,6 @@ 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",
@@ -839,7 +837,6 @@ 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",
@@ -1287,6 +1284,7 @@ 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",
@@ -1314,6 +1312,7 @@ 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,6 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/136.0.7103.114',
'depot_tools_checkout': 'c9fe205c66'
'chromium_checkout': 'refs/tags/133.0.6943.142',
'depot_tools_checkout': '9dc0551d52'
}

View File

@@ -29,38 +29,8 @@
"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": "13601",
"last": "13304",
"min": "13300"
}

View File

@@ -247,8 +247,6 @@
'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',
@@ -326,7 +324,6 @@
'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

@@ -313,30 +313,6 @@
#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,46 +47,30 @@
#define CEF_INCLUDE_BASE_CEF_DUMP_WITHOUT_CRASHING_H_
#pragma once
#include "include/cef_api_hash.h"
constexpr long long kOneDayInMilliseconds = 86400000;
///
/// This function allows for generating of crash dumps with a throttling
/// CefDumpWithoutCrashing allows for generating 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
/// of time from the same location. The |function_name|, |file_name|, and
/// |line_number| determine the 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)
///
/// This function allows for generating of crash dumps without any throttling
/// constraints. If should also only be called after CefInitialize has been
/// successfully called.
/// CefDumpWithoutCrashingUnthrottled allows for immediate crash dumping without
/// any throttling constraints.
///
/// 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

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

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(optional_param=path)--*/
/*--cef()--*/
virtual void OnPdfPrintFinished(const CefString& path, bool ok) = 0;
};

View File

@@ -41,7 +41,6 @@
#include <vector>
#include "include/cef_base.h"
#include "include/cef_registration.h"
#include "include/cef_values.h"
///
@@ -66,24 +65,6 @@ 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
@@ -92,36 +73,6 @@ class CefPreferenceObserver : public virtual CefBaseRefCounted {
/*--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.
///
@@ -178,21 +129,6 @@ 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,7 +44,6 @@
#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;
@@ -67,27 +66,6 @@ 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
@@ -314,17 +292,6 @@ 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

@@ -42,37 +42,22 @@ extern "C" {
// See include/base/cef_dump_without_crashing.h for intended usage.
///
/// 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_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.
///
CEF_EXPORT int cef_dump_without_crashing(long long mseconds_between_dumps,
const char* function_name,
const char* file_name,
int line_number);
///
/// 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_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.
///
CEF_EXPORT int cef_dump_without_crashing_unthrottled();

View File

@@ -1271,11 +1271,7 @@ 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;
///
@@ -3625,9 +3621,6 @@ 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;
@@ -3638,13 +3631,8 @@ 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;
@@ -3797,9 +3785,6 @@ 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,8 +31,6 @@
#define CEF_INCLUDE_INTERNAL_CEF_TYPES_CONTENT_SETTINGS_H_
#pragma once
#include "include/cef_api_hash.h"
#ifdef __cplusplus
extern "C" {
#endif
@@ -387,11 +385,7 @@ 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.
@@ -490,27 +484,6 @@ 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

@@ -38,7 +38,6 @@
#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"
@@ -130,18 +129,6 @@ 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,7 +117,8 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
scoped_refptr<CefBrowserInfo> info =
CefBrowserInfoManager::GetInstance()->CreateBrowserInfo(
/*is_devtools_popup=*/false, platform_delegate->GetBrowserConfig(),
/*is_devtools_popup=*/false, platform_delegate->IsWindowless(),
platform_delegate->IsPrintPreviewSupported(),
create_params.extra_info);
bool own_web_contents = false;
@@ -131,7 +132,8 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
CefRefPtr<AlloyBrowserHostImpl> browser =
CreateInternal(create_params.settings, create_params.client, web_contents,
own_web_contents, info, /*opener=*/nullptr,
own_web_contents, info,
/*opener=*/nullptr, /*is_devtools_popup=*/false,
request_context_impl, std::move(platform_delegate));
if (!browser) {
return nullptr;
@@ -158,6 +160,7 @@ 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();
@@ -182,7 +185,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
// new browser's platform delegate.
opener->platform_delegate_->PopupWebContentsCreated(
settings, client, web_contents, platform_delegate.get(),
/*is_devtools=*/false);
is_devtools_popup);
}
// Take ownership of |web_contents| if |own_web_contents| is true.
@@ -205,7 +208,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=*/false);
browser->platform_delegate(), browser.get(), is_devtools_popup);
}
// 2. Notify the browser's LifeSpanHandler. This must always be the first
@@ -898,6 +901,29 @@ 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.
// -----------------------------------------------------------------------------
@@ -1031,7 +1057,14 @@ void AlloyBrowserHostImpl::BeforeUnloadFired(content::WebContents* source,
bool AlloyBrowserHostImpl::TakeFocus(content::WebContents* source,
bool reverse) {
return contents_delegate_.TakeFocus(source, reverse);
if (client_.get()) {
CefRefPtr<CefFocusHandler> handler = client_->GetFocusHandler();
if (handler.get()) {
handler->OnTakeFocus(this, !reverse);
}
}
return false;
}
void AlloyBrowserHostImpl::CanDownload(
@@ -1118,7 +1151,8 @@ void AlloyBrowserHostImpl::WebContentsCreated(
scoped_refptr<CefBrowserInfo> info =
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
new_contents, platform_delegate->GetBrowserConfig(), extra_info);
new_contents, platform_delegate->IsWindowless(),
platform_delegate->IsPrintPreviewSupported(), extra_info);
CHECK(info.get());
CHECK(info->is_popup());
@@ -1136,7 +1170,8 @@ 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,
request_context, std::move(platform_delegate));
/*is_devtools_popup=*/false, request_context,
std::move(platform_delegate));
}
void AlloyBrowserHostImpl::RendererUnresponsive(

View File

@@ -115,6 +115,8 @@ 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;
@@ -298,6 +300,7 @@ 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_ = base::MakeRefCounted<media::AudioInputDevice>(
audio_input_device_ = new 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,17 +629,6 @@ 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,7 +144,6 @@ 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,8 +246,7 @@ void CefBrowserContext::RemoveCefRequestContext(
Shutdown();
// Allow the current call stack to unwind before deleting |this|.
content::BrowserThread::GetTaskRunnerForThread(CEF_UIT)->DeleteSoon(
FROM_HERE, this);
content::BrowserThread::DeleteSoon(CEF_UIT, FROM_HERE, this);
}
}

View File

@@ -783,28 +783,6 @@ 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()) {
@@ -1420,19 +1398,6 @@ 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,8 +262,6 @@ 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;
@@ -392,8 +390,9 @@ class CefBrowserHostBase : public CefBrowserHost,
RenderViewContextMenuObserver* context_menu_observer() const {
return context_menu_observer_;
}
void set_context_menu_observer(RenderViewContextMenuObserver* observer);
void clear_context_menu_observer(RenderViewContextMenuObserver* observer);
void set_context_menu_observer(RenderViewContextMenuObserver* observer) {
context_menu_observer_ = observer;
}
// Returns the Widget owner for the browser window. Only used with windowed
// browsers.

View File

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

View File

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

View File

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

View File

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

View File

@@ -567,15 +567,6 @@ 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,7 +15,6 @@
#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"
@@ -371,12 +370,6 @@ 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_DEPRECATED,
kSendTabToSelf_DEPRECATED,
kDownload,
kSendTabToSelf,
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, platform_delegate->GetBrowserConfig(),
create_params_.extra_info);
is_devtools_popup, /*is_windowless=*/false,
platform_delegate->IsPrintPreviewSupported(), create_params_.extra_info);
auto request_context_impl =
CefRequestContextImpl::GetOrCreateForRequestContext(
@@ -476,14 +476,6 @@ 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.
@@ -759,7 +751,8 @@ ChromeBrowserDelegate::CreateBrowserHostForPopup(
auto browser_info =
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
web_contents, platform_delegate->GetBrowserConfig(), extra_info);
web_contents, /*is_windowless=*/false,
platform_delegate->IsPrintPreviewSupported(), extra_info);
CHECK(browser_info->is_popup());
// Popups must share the same RequestContext as the parent.

View File

@@ -127,7 +127,6 @@ 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,6 +327,15 @@ 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) {
@@ -500,7 +509,8 @@ void ChromeBrowserHostImpl::Attach(content::WebContents* web_contents,
is_devtools_popup);
}
platform_delegate_->WebContentsCreated(web_contents, /*owned=*/false);
platform_delegate_->WebContentsCreated(web_contents,
/*own_web_contents=*/false);
contents_delegate_.ObserveWebContents(web_contents);
// Associate the platform delegate with this browser.

View File

@@ -109,6 +109,8 @@ 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,
std::unique_ptr<content::NavigationUIData> navigation_data,
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.get(), is_primary_main_frame, is_in_fenced_frame_tree,
navigation_data, 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,14 +375,12 @@ void ChromeContentBrowserClientCef::CreateWindowResult(
CefBrowserInfoManager::GetInstance()->CreateWindowResult(opener, success);
}
void ChromeContentBrowserClientCef::OverrideWebPreferences(
void ChromeContentBrowserClientCef::OverrideWebkitPrefs(
content::WebContents* web_contents,
content::SiteInstance& main_frame_site,
blink::web_pref::WebPreferences* prefs) {
renderer_prefs::SetDefaultPrefs(*prefs);
ChromeContentBrowserClient::OverrideWebPreferences(web_contents,
main_frame_site, prefs);
ChromeContentBrowserClient::OverrideWebkitPrefs(web_contents, prefs);
SkColor base_background_color;
auto browser = CefBrowserHostBase::GetBrowserForContents(web_contents);
@@ -544,10 +542,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,
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));
navigation_data, 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));
@@ -602,7 +600,7 @@ ChromeContentBrowserClientCef::CreateLoginDelegate(
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
content::GuestPageHolder* guest,
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback) {
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,9 +65,8 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
bool* no_javascript_access) override;
void CreateWindowResult(content::RenderFrameHost* opener,
bool success) override;
void OverrideWebPreferences(content::WebContents* web_contents,
content::SiteInstance& main_frame_site,
blink::web_pref::WebPreferences* prefs) override;
void OverrideWebkitPrefs(content::WebContents* web_contents,
blink::web_pref::WebPreferences* prefs) override;
void WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
@@ -134,8 +133,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
scoped_refptr<net::HttpResponseHeaders> response_headers,
bool first_auth_attempt,
content::GuestPageHolder* guest,
content::LoginDelegate::LoginAuthRequiredCallback auth_required_callback)
override;
LoginAuthRequiredCallback auth_required_callback) override;
void ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry,
blink::AssociatedInterfaceRegistry* associated_registry,

View File

@@ -82,8 +82,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
CefRefPtr<CefBrowserHostBase> browser,
CefRefPtr<CefContextMenuHandler> handler)
: context_menu_(context_menu), browser_(browser), handler_(handler) {
// Association remains valid until the next time a context menu is created,
// or this Observer is destroyed.
// This remains valid until the next time a context menu is created.
browser_->set_context_menu_observer(this);
}
@@ -164,7 +163,6 @@ 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,16 +130,6 @@ 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,7 +34,6 @@ 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,12 +12,10 @@
#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"
@@ -291,7 +289,6 @@ int RunMainWithPreferredStackSize(FiberState& fiber_state) {
} // namespace
NO_STACK_PROTECTOR
int CefExecuteProcess(const CefMainArgs& args,
CefRefPtr<CefApp> application,
void* windows_sandbox_info) {
@@ -573,24 +570,12 @@ CefTraceSubscriber* CefContext::GetTraceSubscriber() {
if (shutting_down_) {
return nullptr;
}
if (!trace_subscriber_) {
if (!trace_subscriber_.get()) {
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 =
@@ -660,15 +645,12 @@ void CefContext::ShutdownOnUIThread() {
observer.OnContextDestroyed();
}
if (trace_subscriber_) {
trace_subscriber_.reset();
}
if (pref_registrar_) {
pref_registrar_.reset();
if (trace_subscriber_.get()) {
trace_subscriber_.reset(nullptr);
}
}
void CefContext::FinalizeShutdown() {
browser_info_manager_.reset();
browser_info_manager_.reset(nullptr);
application_ = nullptr;
}

View File

@@ -16,10 +16,6 @@
#include "cef/libcef/browser/main_runner.h"
#include "third_party/skia/include/core/SkColor.h"
namespace pref_helper {
class Registrar;
}
class CefBrowserInfoManager;
class CefTraceSubscriber;
@@ -77,7 +73,6 @@ 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.
@@ -110,14 +105,13 @@ class CefContext {
int exit_code_ = -1;
// The thread on which the context was initialized.
base::PlatformThreadId init_thread_id_;
base::PlatformThreadId init_thread_id_ = 0;
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_ = gfx::NativeWindow();
gfx::NativeWindow owning_window_ = nullptr;
bool has_multiple_file_choices_ = false;
CefRefPtr<CefBrowserHostBase> browser_;

View File

@@ -4,28 +4,10 @@
#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);
@@ -58,77 +40,6 @@ 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,9 +27,6 @@ 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,7 +117,8 @@ 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 (!IsNormalResultCode(static_cast<ResultCode>(exit_code_))) {
if (!chrome::IsNormalResultCode(
static_cast<chrome::ResultCode>(exit_code_))) {
LOG(ERROR) << "ContentMainRun failed with exit code " << exit_code_;
}
return false;
@@ -206,7 +207,6 @@ 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,10 +215,8 @@ class CefMediaAccessQuery {
content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
-1 /* webrtc::kFullDesktopScreenId */);
}
if (media_id.type != content::DesktopMediaID::TYPE_NONE) {
video_devices.emplace_back(request_.video_type, media_id.ToString(),
"Screen");
}
video_devices.emplace_back(request_.video_type, media_id.ToString(),
"Screen");
}
blink::mojom::StreamDevicesSetPtr stream_devices_set =

View File

@@ -20,12 +20,6 @@
#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) {
@@ -126,8 +120,8 @@ bool CefMenuManager::IsShowingContextMenu() {
return web_contents()->IsShowingContextMenu();
}
bool CefMenuManager::CreateContextMenu(const content::ContextMenuParams& params,
bool query_spellcheck) {
bool CefMenuManager::CreateContextMenu(
const content::ContextMenuParams& params) {
// 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.
@@ -140,24 +134,6 @@ bool CefMenuManager::CreateContextMenu(const content::ContextMenuParams& params,
}
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.
@@ -535,18 +511,3 @@ 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,10 +13,6 @@
#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;
@@ -43,8 +39,7 @@ class CefMenuManager : public CefMenuModelImpl::Delegate,
bool IsShowingContextMenu();
// Create the context menu.
bool CreateContextMenu(const content::ContextMenuParams& params,
bool query_spellcheck = true);
bool CreateContextMenu(const content::ContextMenuParams& params);
void CancelContextMenu();
private:
@@ -67,12 +62,6 @@ 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,11 +173,10 @@ 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. It's also possible
// that |browser_| will be nullptr if BrowserDestroyed() was called during
// this time.
if (!window_info_.window || !browser_) {
// 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) {
return false;
}
@@ -570,14 +569,10 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
// Clear the user data pointer.
gfx::SetWindowUserData(hwnd, nullptr);
// |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();
}
// 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,7 +21,8 @@ bool CefMenuRunnerMac::RunContextMenu(
// Create a menu controller based on the model.
MenuControllerCocoa* menu_controller =
[[MenuControllerCocoa alloc] initWithModel:model->model()
delegate:nil];
delegate:nil
useWithPopUpButtonCell:NO];
menu_controller_ = menu_controller;

View File

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

View File

@@ -202,8 +202,7 @@ void SaveCookiesOnUIThread(
}
net::CookieInclusionStatus status;
status.AddExclusionReason(
net::CookieInclusionStatus::ExclusionReason::EXCLUDE_UNKNOWN_ERROR);
status.AddExclusionReason(net::CookieInclusionStatus::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::ExclusionReason::EXCLUDE_UNKNOWN_ERROR);
net::CookieInclusionStatus::EXCLUDE_UNKNOWN_ERROR);
SetCookieCallbackImpl(callback, net::CookieAccessResult(std::move(status)));
return true;
}

View File

@@ -111,12 +111,11 @@ void RunCallbackOnIOThread(
}
} // namespace
LoginDelegate::LoginDelegate(
const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
const content::GlobalRequestID& request_id,
const GURL& origin_url,
content::LoginDelegate::LoginAuthRequiredCallback callback)
LoginDelegate::LoginDelegate(const net::AuthChallengeInfo& auth_info,
content::WebContents* web_contents,
const content::GlobalRequestID& request_id,
const GURL& origin_url,
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,
content::LoginDelegate::LoginAuthRequiredCallback callback);
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);
content::LoginDelegate::LoginAuthRequiredCallback callback_;
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::GetTaskRunnerForThread(CEF_IOT)->DeleteSoon(
FROM_HERE, proxy);
content::BrowserThread::DeleteSoon(content::BrowserThread::IO, FROM_HERE,
proxy);
return;
}
@@ -263,6 +263,8 @@ 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_; }
@@ -341,7 +343,6 @@ 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;
@@ -763,6 +764,18 @@ 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,
@@ -1142,17 +1155,7 @@ void InterceptedRequest::OnDestroy() {
// We don't want any callbacks after this point.
weak_factory_.InvalidateWeakPtrs();
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;
}
factory_->request_handler_->OnRequestComplete(id_, request_, status_);
// Destroys |this|.
factory_->RemoveRequest(this);
@@ -1204,7 +1207,6 @@ void InterceptedRequest::CallOnComplete(
if (target_client_) {
target_client_->OnComplete(status);
completed_ = true;
}
if (proxied_loader_receiver_.is_bound() &&
@@ -1239,6 +1241,7 @@ void InterceptedRequest::SendErrorStatusAndCompleteImmediately(
const network::URLLoaderCompletionStatus& status) {
status_ = status;
SendErrorCallback(status_.error_code, false);
target_client_->OnComplete(status_);
OnDestroy();
}

View File

@@ -121,8 +121,7 @@ class InterceptedRequestHandler {
virtual void OnRequestComplete(
int32_t request_id,
const network::ResourceRequest& request,
const network::URLLoaderCompletionStatus& status,
bool& handled_externally) {}
const network::URLLoaderCompletionStatus& status) {}
// 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,
bool& handled_externally) override {
void OnRequestComplete(
int32_t request_id,
const network::ResourceRequest& request,
const network::URLLoaderCompletionStatus& status) override {
CEF_REQUIRE_IOT();
RequestState* state = GetState(request_id);
@@ -1116,7 +1116,6 @@ 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,6 +584,10 @@ 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,6 +137,8 @@ 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::kNormal != state) {
if (ax::mojom::AriaNotificationPriority::kNone != state) {
attributes->SetString(ToString(attr.first), ToString(state));
}
} break;

View File

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

View File

@@ -132,8 +132,7 @@ class CefRenderWidgetHostViewOSR
std::optional<SkColor> GetBackgroundColor() override;
void UpdateBackgroundColor() override;
std::optional<content::DisplayFeature> GetDisplayFeature() override;
void DisableDisplayFeatureOverrideForEmulation() override;
void OverrideDisplayFeatureForEmulation(
void SetDisplayFeatureForTesting(
const content::DisplayFeature* display_feature) override;
blink::mojom::PointerLockResult LockPointer(
bool request_unadjusted_movement) override;
@@ -186,7 +185,8 @@ class CefRenderWidgetHostViewOSR
viz::SurfaceId GetCurrentSurfaceId() const override;
void ImeCompositionRangeChanged(
const gfx::Range& range,
const std::optional<std::vector<gfx::Rect>>& character_bounds) override;
const std::optional<std::vector<gfx::Rect>>& character_bounds,
const std::optional<std::vector<gfx::Rect>>& line_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()), 0U, skia::CRASH_ON_FAILURE);
static_cast<uint8_t*>(shm_.memory()), 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().buffer_handle();
paint_info.shared_texture_handle = gmb_handle.dxgi_handle.Get();
paint_info.format = pixel_format;
view_->OnAcceleratedPaint(damage_rect, info->coded_size, paint_info);
#elif BUILDFLAG(IS_APPLE)

View File

@@ -245,8 +245,6 @@ 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,7 +6,6 @@
#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"
@@ -119,145 +118,4 @@ 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,16 +5,8 @@
#ifndef CEF_LIBCEF_BROWSER_PREFS_PREF_HELPER_H_
#define CEF_LIBCEF_BROWSER_PREFS_PREF_HELPER_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 {
@@ -36,69 +28,6 @@ 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,
}
}
std::variant<printing::mojom::PrintPagesParamsPtr, std::string>
absl::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 (std::holds_alternative<std::string>(print_pages_params)) {
if (absl::holds_alternative<std::string>(print_pages_params)) {
LOG(ERROR) << "PrintToPDF failed with error: "
<< std::get<std::string>(print_pages_params);
<< absl::get<std::string>(print_pages_params);
callback->OnPdfPrintFinished(CefString(), false);
return;
}
DCHECK(std::holds_alternative<printing::mojom::PrintPagesParamsPtr>(
DCHECK(absl::holds_alternative<printing::mojom::PrintPagesParamsPtr>(
print_pages_params));
if (auto* print_manager =

View File

@@ -10,9 +10,7 @@
#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"
@@ -461,22 +459,6 @@ 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(
@@ -606,26 +588,6 @@ 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,14 +17,6 @@ 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-
@@ -88,20 +80,6 @@ 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;
@@ -114,6 +92,14 @@ 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(
@@ -139,8 +125,6 @@ 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;
@@ -234,9 +218,6 @@ 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

@@ -1,118 +0,0 @@
// 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

@@ -1,81 +0,0 @@
// 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,9 +4,8 @@
#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"
@@ -28,6 +27,7 @@ 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 = std::ranges::find(tasks_, id);
auto index = base::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 std::ranges::find(tasks_, task_id) != tasks_.end();
return base::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.ToString16());
ParentClass::root_view()->SetText(text);
}
CEF_LABEL_BUTTON_IMPL_T CefString CEF_LABEL_BUTTON_IMPL_D::GetText() {
CEF_REQUIRE_VALID_RETURN(CefString());
return std::u16string(ParentClass::root_view()->GetText());
return ParentClass::root_view()->GetText();
}
CEF_LABEL_BUTTON_IMPL_T void CEF_LABEL_BUTTON_IMPL_D::SetImage(

View File

@@ -190,9 +190,7 @@ 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::NATIVE_WIDGET_OWNS_WIDGET,
views::Widget::InitParams::TYPE_CONTROL);
views::Widget::InitParams params(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 std::u16string(root_view()->GetText());
return root_view()->GetText();
}
void CefTextfieldImpl::SetText(const CefString& text) {
CEF_REQUIRE_VALID_RETURN_VOID();
root_view()->SetText(text.ToString16());
root_view()->SetText(text);
}
void CefTextfieldImpl::AppendText(const CefString& text) {
@@ -102,7 +102,7 @@ bool CefTextfieldImpl::HasSelection() {
CefString CefTextfieldImpl::GetSelectedText() {
CEF_REQUIRE_VALID_RETURN(CefString());
return std::u16string(root_view()->GetSelectedText());
return 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.ToString16());
root_view()->SetPlaceholderText(text);
}
CefString CefTextfieldImpl::GetPlaceholderText() {
CEF_REQUIRE_VALID_RETURN(CefString());
return std::u16string(root_view()->GetPlaceholderText());
return 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()->color().GetSkColor();
return view->background()->get_color();
}
// If the containing Widget is an overlay then it has a transparent background

View File

@@ -5,7 +5,6 @@
#include "cef/libcef/browser/views/window_view.h"
#include <memory>
#include <ranges>
#include "base/memory/raw_ptr.h"
@@ -17,6 +16,7 @@
#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 = std::ranges::find_if(
const auto it = base::ranges::find_if(
overlay_hosts_,
[host](CefOverlayViewHost* current) { return current == host; });
DCHECK(it != overlay_hosts_.end());

View File

@@ -11,7 +11,6 @@
#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 {
@@ -219,13 +218,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().raw();
return base::PlatformThread::CurrentId();
}
CEF_EXPORT cef_platform_thread_handle_t
cef_get_current_platform_thread_handle() {
#if BUILDFLAG(IS_WIN)
return base::PlatformThread::CurrentId().raw();
return base::PlatformThread::CurrentId();
#else
return base::PlatformThread::CurrentHandle().platform_handle();
#endif
@@ -241,7 +240,5 @@ CEF_EXPORT int cef_dump_without_crashing(long long mseconds_between_dumps,
}
CEF_EXPORT int cef_dump_without_crashing_unthrottled() {
CEF_API_REQUIRE_REMOVED(13500);
NOTIMPLEMENTED();
return 0;
return base::debug::DumpWithoutCrashingUnthrottled();
}

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 =
std::get_if<InvokedInBrowserProcess>(&invoked_in);
absl::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;
}
std::variant<int, content::MainFunctionParams>
absl::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;
std::variant<int, content::MainFunctionParams> RunProcess(
absl::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::StringViewType(prefix_str), &result)) {
base_dir, base::FilePath::StringPieceType(prefix_str), &result)) {
new_dir = result.value();
return true;
}

View File

@@ -111,19 +111,12 @@ 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,13 +37,8 @@ bool GetCookieDomain(const GURL& url,
domain_string = pc.Domain();
}
net::CookieInclusionStatus status;
const auto& retval =
net::cookie_util::GetCookieDomainWithString(url, domain_string, status);
if (retval.has_value()) {
*result = *retval;
return true;
}
return false;
return net::cookie_util::GetCookieDomainWithString(url, domain_string, status,
result);
}
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().raw();
thread_id_ = thread_->GetThreadId();
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_ = base::PlatformThreadId();
locked_thread_id_ = 0;
lock_.Release();
}
bool locked() override {
@@ -169,7 +169,7 @@ class CefValueControllerThreadSafe : public CefValueController {
private:
base::Lock lock_;
base::PlatformThreadId locked_thread_id_;
base::PlatformThreadId locked_thread_id_ = 0;
};
// Non-thread-safe access control implementation.

View File

@@ -1,22 +0,0 @@
// 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_

View File

@@ -276,11 +276,13 @@ void CefBrowserImpl::GetFrameNames(std::vector<CefString>& names) {
CefBrowserImpl::CefBrowserImpl(blink::WebView* web_view,
int browser_id,
bool is_popup,
const cef::BrowserConfig& config)
bool is_windowless,
bool print_preview_enabled)
: blink::WebViewObserver(web_view),
browser_id_(browser_id),
is_popup_(is_popup),
config_(config) {}
is_windowless_(is_windowless),
print_preview_enabled_(print_preview_enabled) {}
CefBrowserImpl::~CefBrowserImpl() = default;

View File

@@ -16,7 +16,6 @@
#include "cef/include/cef_browser.h"
#include "cef/include/cef_client.h"
#include "cef/libcef/renderer/browser_config.h"
#include "cef/libcef/renderer/frame_impl.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/web/web_view_observer.h"
@@ -67,7 +66,8 @@ class CefBrowserImpl : public CefBrowser, public blink::WebViewObserver {
CefBrowserImpl(blink::WebView* web_view,
int browser_id,
bool is_popup,
const cef::BrowserConfig& config);
bool is_windowless,
bool print_preview_enabled);
CefBrowserImpl(const CefBrowserImpl&) = delete;
CefBrowserImpl& operator=(const CefBrowserImpl&) = delete;
@@ -80,7 +80,8 @@ class CefBrowserImpl : public CefBrowser, public blink::WebViewObserver {
int browser_id() const { return browser_id_; }
bool is_popup() const { return is_popup_; }
const cef::BrowserConfig& config() const { return config_; }
bool is_windowless() const { return is_windowless_; }
bool print_preview_enabled() const { return print_preview_enabled_; }
// blink::WebViewObserver methods.
void OnDestruct() override;
@@ -95,7 +96,8 @@ class CefBrowserImpl : public CefBrowser, public blink::WebViewObserver {
// same browser ID.
const int browser_id_;
const bool is_popup_;
const cef::BrowserConfig config_;
const bool is_windowless_;
const bool print_preview_enabled_;
// Map of unique frame tokens to CefFrameImpl references.
using FrameMap = std::map<blink::LocalFrameToken, CefRefPtr<CefFrameImpl>>;

View File

@@ -46,19 +46,20 @@ void ChromeContentRendererClientCef::RenderFrameCreated(
new CefRenderFrameObserver(render_frame);
bool browser_created;
std::optional<cef::BrowserConfig> config;
std::optional<bool> is_windowless;
std::optional<bool> print_preview_enabled;
render_manager_->RenderFrameCreated(render_frame, render_frame_observer,
browser_created, config);
browser_created, is_windowless,
print_preview_enabled);
if (browser_created) {
CHECK(config.has_value());
OnBrowserCreated(render_frame->GetWebView(), *config);
OnBrowserCreated(render_frame->GetWebView(), is_windowless);
}
if (config.has_value()) {
// This value will be used when the ChromeContentRendererClient
if (print_preview_enabled.has_value()) {
// This value will be used when the when ChromeContentRendererClient
// creates the new ChromePrintRenderFrameHelperDelegate below.
ChromePrintRenderFrameHelperDelegate::SetNextPrintPreviewEnabled(
(*config).print_preview_enabled);
*print_preview_enabled);
}
ChromeContentRendererClient::RenderFrameCreated(render_frame);
@@ -72,11 +73,12 @@ void ChromeContentRendererClientCef::WebViewCreated(
outermost_origin);
bool browser_created;
std::optional<cef::BrowserConfig> config;
render_manager_->WebViewCreated(web_view, browser_created, config);
std::optional<bool> is_windowless;
std::optional<bool> print_preview_enabled;
render_manager_->WebViewCreated(web_view, browser_created, is_windowless,
print_preview_enabled);
if (browser_created) {
CHECK(config.has_value());
OnBrowserCreated(web_view, *config);
OnBrowserCreated(web_view, is_windowless);
}
}
@@ -115,9 +117,14 @@ void ChromeContentRendererClientCef::ExposeInterfacesToBrowser(
void ChromeContentRendererClientCef::OnBrowserCreated(
blink::WebView* web_view,
const cef::BrowserConfig& config) {
std::optional<bool> is_windowless) {
#if BUILDFLAG(IS_MAC)
web_view->SetUseExternalPopupMenusThisInstance(!config.is_windowless);
const bool windowless = is_windowless.has_value() && *is_windowless;
// FIXME: It would be better if this API would be a callback from the
// WebKit layer, or if it would be exposed as an WebView instance method; the
// current implementation uses a static variable, and WebKit needs to be
// patched in order to make it work for each WebView instance
web_view->SetUseExternalPopupMenusThisInstance(!windowless);
#endif
web_view->SetMovePictureInPictureEnabled(config.move_pip_enabled);
}

View File

@@ -12,10 +12,6 @@
#include "base/task/single_thread_task_runner.h"
#include "chrome/renderer/chrome_content_renderer_client.h"
namespace cef {
struct BrowserConfig;
}
class CefRenderManager;
// CEF override of ChromeContentRendererClient.
@@ -52,7 +48,7 @@ class ChromeContentRendererClientCef : public ChromeContentRendererClient {
private:
void OnBrowserCreated(blink::WebView* web_view,
const cef::BrowserConfig& config);
std::optional<bool> is_windowless);
std::unique_ptr<CefRenderManager> render_manager_;

View File

@@ -373,7 +373,8 @@ void CefFrameImpl::OnDraggableRegionsChanged() {
return;
}
auto webregions = frame_->GetDocument().DraggableRegions();
blink::WebVector<blink::WebDraggableRegion> webregions =
frame_->GetDocument().DraggableRegions();
std::vector<cef::mojom::DraggableRegionEntryPtr> regions;
if (!webregions.empty()) {
auto render_frame = content::RenderFrameImpl::FromWebFrame(frame_);

View File

@@ -56,17 +56,25 @@ class CefExcludedView : public blink::WebViewObserver {
public:
CefExcludedView(CefRenderManager* manager,
blink::WebView* web_view,
const std::optional<cef::BrowserConfig>& config)
: blink::WebViewObserver(web_view), manager_(manager), config_(config) {}
std::optional<bool> is_windowless,
std::optional<bool> print_preview_enabled)
: blink::WebViewObserver(web_view),
manager_(manager),
is_windowless_(is_windowless),
print_preview_enabled_(print_preview_enabled) {}
const std::optional<cef::BrowserConfig>& config() const { return config_; }
std::optional<bool> is_windowless() const { return is_windowless_; }
std::optional<bool> print_preview_enabled() const {
return print_preview_enabled_;
}
private:
// RenderViewObserver methods.
void OnDestruct() override { manager_->OnExcludedViewDestroyed(this); }
CefRenderManager* const manager_;
const std::optional<cef::BrowserConfig> config_;
const std::optional<bool> is_windowless_;
const std::optional<bool> print_preview_enabled_;
};
CefRenderManager::CefRenderManager() {
@@ -102,9 +110,11 @@ void CefRenderManager::RenderFrameCreated(
content::RenderFrame* render_frame,
CefRenderFrameObserver* render_frame_observer,
bool& browser_created,
std::optional<cef::BrowserConfig>& config) {
std::optional<bool>& is_windowless,
std::optional<bool>& print_preview_enabled) {
auto browser = MaybeCreateBrowser(render_frame->GetWebView(), render_frame,
browser_created, config);
&browser_created, &is_windowless,
&print_preview_enabled);
if (browser) {
// Attach the frame to the observer for message routing purposes.
render_frame_observer->AttachFrame(
@@ -120,14 +130,16 @@ void CefRenderManager::RenderFrameCreated(
void CefRenderManager::WebViewCreated(
blink::WebView* web_view,
bool& browser_created,
std::optional<cef::BrowserConfig>& config) {
std::optional<bool>& is_windowless,
std::optional<bool>& print_preview_enabled) {
content::RenderFrame* render_frame = nullptr;
if (web_view->MainFrame()->IsWebLocalFrame()) {
render_frame = content::RenderFrame::FromWebFrame(
web_view->MainFrame()->ToWebLocalFrame());
}
MaybeCreateBrowser(web_view, render_frame, browser_created, config);
MaybeCreateBrowser(web_view, render_frame, &browser_created, &is_windowless,
&print_preview_enabled);
}
void CefRenderManager::DevToolsAgentAttached() {
@@ -282,9 +294,12 @@ void CefRenderManager::WebKitInitialized() {
CefRefPtr<CefBrowserImpl> CefRenderManager::MaybeCreateBrowser(
blink::WebView* web_view,
content::RenderFrame* render_frame,
bool& browser_created,
std::optional<cef::BrowserConfig>& config) {
browser_created = false;
bool* browser_created,
std::optional<bool>* is_windowless,
std::optional<bool>* print_preview_enabled) {
if (browser_created) {
*browser_created = false;
}
if (!web_view || !render_frame) {
return nullptr;
@@ -292,13 +307,25 @@ CefRefPtr<CefBrowserImpl> CefRenderManager::MaybeCreateBrowser(
// Don't create another browser or excluded view object if one already exists
// for the view.
if (auto browser = GetBrowserForView(web_view)) {
config = browser->config();
auto browser = GetBrowserForView(web_view);
if (browser) {
if (is_windowless) {
*is_windowless = browser->is_windowless();
}
if (print_preview_enabled) {
*print_preview_enabled = browser->print_preview_enabled();
}
return browser;
}
if (auto excluded_view = GetExcludedViewForView(web_view)) {
config = excluded_view->config();
auto excluded_view = GetExcludedViewForView(web_view);
if (excluded_view) {
if (is_windowless) {
*is_windowless = excluded_view->is_windowless();
}
if (print_preview_enabled) {
*print_preview_enabled = excluded_view->print_preview_enabled();
}
return nullptr;
}
@@ -311,10 +338,11 @@ CefRefPtr<CefBrowserImpl> CefRenderManager::MaybeCreateBrowser(
return nullptr;
}
if (params->config) {
config = cef::BrowserConfig{params->config->is_windowless,
params->config->print_preview_enabled,
params->config->move_pip_enabled};
if (is_windowless) {
*is_windowless = params->is_windowless;
}
if (print_preview_enabled) {
*print_preview_enabled = params->print_preview_enabled;
}
if (params->is_excluded || params->browser_id < 0) {
@@ -322,13 +350,15 @@ CefRefPtr<CefBrowserImpl> CefRenderManager::MaybeCreateBrowser(
// extension or print preview dialog), or if the new browser info response
// has timed out.
excluded_views_.insert(std::make_pair(
web_view, std::make_unique<CefExcludedView>(this, web_view, config)));
web_view,
std::make_unique<CefExcludedView>(this, web_view, params->is_windowless,
params->print_preview_enabled)));
return nullptr;
}
CHECK(params->config);
CefRefPtr<CefBrowserImpl> browser = new CefBrowserImpl(
web_view, params->browser_id, params->config->is_popup, *config);
browser = new CefBrowserImpl(web_view, params->browser_id, *params->is_popup,
*params->is_windowless,
*params->print_preview_enabled);
browsers_.insert(std::make_pair(web_view, browser));
// Notify the render process handler.
@@ -347,7 +377,9 @@ CefRefPtr<CefBrowserImpl> CefRenderManager::MaybeCreateBrowser(
}
}
browser_created = true;
if (browser_created) {
*browser_created = true;
}
return browser;
}

View File

@@ -12,7 +12,6 @@
#include "cef/include/internal/cef_ptr.h"
#include "cef/libcef/common/mojom/cef.mojom.h"
#include "cef/libcef/renderer/browser_config.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/remote.h"
@@ -53,10 +52,12 @@ class CefRenderManager : public cef::mojom::RenderManager {
void RenderFrameCreated(content::RenderFrame* render_frame,
CefRenderFrameObserver* render_frame_observer,
bool& browser_created,
std::optional<cef::BrowserConfig>& config);
std::optional<bool>& is_windowless,
std::optional<bool>& print_preview_enabled);
void WebViewCreated(blink::WebView* web_view,
bool& browser_created,
std::optional<cef::BrowserConfig>& config);
std::optional<bool>& is_windowless,
std::optional<bool>& print_preview_enabled);
void DevToolsAgentAttached();
void DevToolsAgentDetached();
void ExposeInterfacesToBrowser(mojo::BinderMap* binders);
@@ -93,8 +94,9 @@ class CefRenderManager : public cef::mojom::RenderManager {
CefRefPtr<CefBrowserImpl> MaybeCreateBrowser(
blink::WebView* web_view,
content::RenderFrame* render_frame,
bool& browser_created,
std::optional<cef::BrowserConfig>& config);
bool* browser_created,
std::optional<bool>* is_windowless,
std::optional<bool>* print_preview_enabled);
// Called from CefBrowserImpl::OnDestruct().
void OnBrowserDestroyed(CefBrowserImpl* browser);

View File

@@ -462,12 +462,12 @@ void GetCefString(v8::Isolate* isolate,
#if defined(CEF_STRING_TYPE_WIDE)
// Allocate enough space for a worst-case conversion.
size_t len = str->Utf8LengthV2();
int len = str->Utf8Length();
if (len == 0) {
return;
}
char* buf = new char[len + 1];
str->WriteUtf8V2(isolate, buf, len, v8::String::WriteFlags::kNullTerminate);
str->WriteUtf8(isolate, buf, len + 1);
// Perform conversion to the wide type.
cef_string_t* retws = out.GetWritableStruct();
@@ -481,16 +481,15 @@ void GetCefString(v8::Isolate* isolate,
return;
}
char16_t* buf = new char16_t[len + 1];
str->WriteV2(isolate, 0, len, reinterpret_cast<uint16_t*>(buf),
v8::String::WriteFlags::kNullTerminate);
str->Write(isolate, reinterpret_cast<uint16_t*>(buf), 0, len + 1);
#else
// Allocate enough space for a worst-case conversion.
size_t len = str->Utf8LengthV2();
int len = str->Utf8Length();
if (len == 0) {
return;
}
char* buf = new char[len + 1];
str->WriteUtf8V2(isolate, buf, len, v8::String::WriteFlags::kNullTerminate);
str->WriteUtf8(isolate, buf, len + 1);
#endif
// Don't perform an extra string copy.

View File

@@ -15,8 +15,6 @@ bool CefDumpWithoutCrashing(long long mseconds_between_dumps,
file_name, line_number);
}
#if CEF_API_REMOVED(13500)
bool CefDumpWithoutCrashingUnthrottled() {
return cef_dump_without_crashing_unthrottled();
}
#endif

View File

@@ -68,9 +68,6 @@ patches = [
},
{
# Enable popups in offscreen rendering on MacOS.
#
# Enable moveTo()/moveBy() for Document picture-in-picture popups.
# https://github.com/chromiumembedded/cef/issues/3714
'name': 'webkit_popups',
},
{
@@ -139,8 +136,6 @@ patches = [
#
# Add WebContentsObserver::RenderWidgetCreated.
# https://github.com/chromiumembedded/cef/issues/3308
#
# osr: Avoid crash in WebContentsImpl::GetSize/Resize.
'name': 'web_contents_1257_1565',
},
{
@@ -262,12 +257,6 @@ patches = [
# https://github.com/chromiumembedded/cef/issues/3314
'name': 'chrome_browser_dialogs_native',
},
{
# Fix usage of JavaScript tab modal dialogs with Alloy style browsers.
# Modifies the logic added in https://crrev.com/78ce55cbc0.
# https://github.com/chromiumembedded/cef/issues/3818
'name': 'chrome_browser_dialogs_jsmodal',
},
{
# Support use of chrome Widget dialogs with CEF runtimes.
# - Add gfx::AcceleratedWidget dialog parent argument to
@@ -774,12 +763,10 @@ patches = [
'name': 'mojo_connect_result_3664'
},
{
# Support for configuration accessors/observers.
# - Allow pref_service::Registrar access to
# PrefService::[Add|Remove]PrefObserver.
# - Enable SyntheticTrialsActiveGroupIdProvider::GetGroups in Release
# builds.
# https://github.com/chromiumembedded/cef/issues/3892
'name': 'config_3892'
# Fix error: static assertion failed due to requirement 'sizeof(cc::Layer)
# == sizeof(cc::SameSizeAsLayer)' when building with
# enable_backup_ref_ptr_instance_tracer=true.
# https://issues.chromium.org/issues/387277990
'name': 'cc_layer_387277990'
}
]

View File

@@ -1,8 +1,8 @@
diff --git base/command_line.cc base/command_line.cc
index d4d3bc52426d1..69d48fac6bbf4 100644
index 1f3627a128300..430b05e63b5c7 100644
--- base/command_line.cc
+++ base/command_line.cc
@@ -421,11 +421,10 @@ void CommandLine::AppendSwitchNative(std::string_view switch_string,
@@ -396,11 +396,10 @@ void CommandLine::AppendSwitchNative(std::string_view switch_string,
#if BUILDFLAG(ENABLE_COMMANDLINE_SEQUENCE_CHECKS)
sequence_checker_.Check();
#endif

View File

@@ -1,8 +1,8 @@
diff --git base/BUILD.gn base/BUILD.gn
index 57a6af0061615..d18a8a8a4559d 100644
index e0c6828f0cd7f..40e3d558dfda3 100644
--- base/BUILD.gn
+++ base/BUILD.gn
@@ -41,6 +41,7 @@ import("//build/rust/rust_static_library.gni")
@@ -42,6 +42,7 @@ import("//build/rust/rust_static_library.gni")
import("//build/timestamp.gni")
import("//build/util/process_version.gni")
import("//build_overrides/build.gni")
@@ -10,7 +10,7 @@ index 57a6af0061615..d18a8a8a4559d 100644
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
@@ -1519,7 +1520,13 @@ component("base") {
@@ -1491,7 +1492,13 @@ component("base") {
"hash/md5_constexpr_internal.h",
"hash/sha1.h",
]
@@ -25,7 +25,7 @@ index 57a6af0061615..d18a8a8a4559d 100644
sources += [
"hash/md5_nacl.cc",
"hash/md5_nacl.h",
@@ -1969,6 +1976,12 @@ component("base") {
@@ -1941,6 +1948,12 @@ component("base") {
defines += [ "COM_INIT_CHECK_HOOK_DISABLED" ]
}
@@ -90,7 +90,7 @@ index 2158b648ca58a..8a8cb13b2fd74 100644
#else
#include "base/hash/sha1_boringssl.h"
diff --git base/json/json_reader.cc base/json/json_reader.cc
index 48a9b893d3f9d..a5a2223b2a0fa 100644
index af1d4f46d02c9..953585804c177 100644
--- base/json/json_reader.cc
+++ base/json/json_reader.cc
@@ -12,8 +12,9 @@
@@ -104,7 +104,7 @@ index 48a9b893d3f9d..a5a2223b2a0fa 100644
#include "base/strings/string_view_rust.h"
#include "third_party/rust/serde_json_lenient/v0_2/wrapper/functions.h"
#include "third_party/rust/serde_json_lenient/v0_2/wrapper/lib.rs.h"
@@ -21,7 +22,7 @@
@@ -23,7 +24,7 @@ namespace base {
// TODO(crbug.com/40811643): Move the C++ parser into components/nacl to just
// run in-process there. Don't compile base::JSONReader on NaCL at all.
@@ -112,8 +112,15 @@ index 48a9b893d3f9d..a5a2223b2a0fa 100644
+#if !(BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
namespace {
const char kSecurityJsonParsingTime[] = "Security.JSONParser.ParsingTime";
@@ -138,7 +139,7 @@ namespace base {
using serde_json_lenient::ContextPointer;
@@ -129,16 +130,16 @@ JSONReader::Result DecodeJSONInRust(std::string_view json,
} // anonymous namespace
-#endif // !BUILDFLAG(IS_NACL)
+#endif // !(BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
// static
std::optional<Value> JSONReader::Read(std::string_view json,
int options,
size_t max_depth) {
@@ -121,8 +128,21 @@ index 48a9b893d3f9d..a5a2223b2a0fa 100644
+#if (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
internal::JSONParser parser(options, max_depth);
return parser.Parse(json);
#else // BUILDFLAG(IS_NACL)
@@ -183,7 +184,7 @@ std::optional<Value::List> JSONReader::ReadList(std::string_view json,
-#else // BUILDFLAG(IS_NACL)
+#else // (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
SCOPED_UMA_HISTOGRAM_TIMER_MICROS(kSecurityJsonParsingTime);
if (UsingRust()) {
JSONReader::Result result = DecodeJSONInRust(json, options, max_depth);
@@ -150,7 +151,7 @@ std::optional<Value> JSONReader::Read(std::string_view json,
internal::JSONParser parser(options, max_depth);
return parser.Parse(json);
}
-#endif // BUILDFLAG(IS_NACL)
+#endif // (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
}
// static
@@ -168,7 +169,7 @@ std::optional<Value::Dict> JSONReader::ReadDict(std::string_view json,
JSONReader::Result JSONReader::ReadAndReturnValueWithError(
std::string_view json,
int options) {
@@ -131,7 +151,25 @@ index 48a9b893d3f9d..a5a2223b2a0fa 100644
internal::JSONParser parser(options);
auto value = parser.Parse(json);
if (!value) {
@@ -224,7 +225,7 @@ bool JSONReader::UsingRust() {
@@ -180,7 +181,7 @@ JSONReader::Result JSONReader::ReadAndReturnValueWithError(
}
return std::move(*value);
-#else // BUILDFLAG(IS_NACL)
+#else // (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
SCOPED_UMA_HISTOGRAM_TIMER_MICROS(kSecurityJsonParsingTime);
if (UsingRust()) {
return DecodeJSONInRust(json, options, internal::kAbsoluteMaxDepth);
@@ -197,7 +198,7 @@ JSONReader::Result JSONReader::ReadAndReturnValueWithError(
return std::move(*value);
}
-#endif // BUILDFLAG(IS_NACL)
+#endif // (BUILDFLAG(IS_NACL) || BUILDFLAG(IS_CEF_SANDBOX_BUILD))
}
// static
@@ -208,7 +209,7 @@ bool JSONReader::UsingRust() {
if (!base::FeatureList::GetInstance()) {
return false;
}
@@ -141,18 +179,18 @@ index 48a9b893d3f9d..a5a2223b2a0fa 100644
#else
return base::FeatureList::IsEnabled(base::features::kUseRustJsonParser);
diff --git base/logging.cc base/logging.cc
index 26ba1a286e451..99b2ce6feb274 100644
index b67b6fbf7e4e5..fc23ed1b4477d 100644
--- base/logging.cc
+++ base/logging.cc
@@ -51,6 +51,7 @@
#include "base/trace_event/base_tracing.h"
@@ -60,6 +60,7 @@
#include "base/vlog.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "cef/libcef/features/features.h"
#include "third_party/abseil-cpp/absl/base/internal/raw_logging.h"
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
@@ -530,7 +531,7 @@ bool BaseInitLoggingImpl(const LoggingSettings& settings) {
@@ -538,7 +539,7 @@ bool BaseInitLoggingImpl(const LoggingSettings& settings) {
}
#endif
@@ -209,12 +247,12 @@ index 5d11d4a1560b1..242a93bcca8ed 100644
} // namespace win
#endif
diff --git base/rand_util.h base/rand_util.h
index d650943a7b75a..abd5217f8ceed 100644
index b198a7198aab9..01bc8e9b6ad1f 100644
--- base/rand_util.h
+++ base/rand_util.h
@@ -23,8 +23,9 @@
#include "base/numerics/safe_conversions.h"
#include "base/time/time.h"
@@ -17,8 +17,9 @@
#include "base/containers/span.h"
#include "base/gtest_prod_util.h"
#include "build/build_config.h"
+#include "cef/libcef/features/features.h"
@@ -223,7 +261,7 @@ index d650943a7b75a..abd5217f8ceed 100644
#include "third_party/boringssl/src/include/openssl/rand.h"
#endif
@@ -189,7 +190,7 @@ class RandomBitGenerator {
@@ -117,7 +118,7 @@ class RandomBitGenerator {
~RandomBitGenerator() = default;
};
@@ -306,7 +344,7 @@ index ea33ca66f384c..33f4cc76f76bd 100644
return lhs.token_ == rhs.token_;
#else
diff --git base/win/sid.cc base/win/sid.cc
index 6a91e984f5161..4433591d96c99 100644
index 6b5d9b1e494b7..538c98d6676ad 100644
--- base/win/sid.cc
+++ base/win/sid.cc
@@ -29,12 +29,56 @@

View File

@@ -1,8 +1,8 @@
diff --git base/test/BUILD.gn base/test/BUILD.gn
index 5beef03e5fd94..0b12fd3afc8fc 100644
index 37a7e20c415f7..5eef10ee45573 100644
--- base/test/BUILD.gn
+++ base/test/BUILD.gn
@@ -212,11 +212,6 @@ static_library("test_support") {
@@ -210,11 +210,6 @@ static_library("test_support") {
if (enable_base_tracing) {
public_deps += [ "//third_party/perfetto:perfetto_test_support" ]
@@ -14,7 +14,7 @@ index 5beef03e5fd94..0b12fd3afc8fc 100644
deps += [
":amalgamated_perfetto_sql_stdlib",
":gen_cc_chrome_track_event_descriptor",
@@ -611,7 +606,7 @@ if (enable_base_tracing) {
@@ -609,7 +604,7 @@ if (enable_base_tracing) {
# processor depends on dev_sqlite. The two share the same symbols but have
# different implementations, so we need to hide dev_sqlite in this shared
# library even in non-component builds to prevent duplicate symbols.
@@ -23,7 +23,7 @@ index 5beef03e5fd94..0b12fd3afc8fc 100644
if (is_ios) {
_target_type = "ios_framework_bundle"
}
@@ -620,6 +615,8 @@ if (enable_base_tracing) {
@@ -618,6 +613,8 @@ if (enable_base_tracing) {
defines = [ "TEST_TRACE_PROCESSOR_IMPL" ]
testonly = true
sources = [
@@ -32,7 +32,7 @@ index 5beef03e5fd94..0b12fd3afc8fc 100644
"test_trace_processor_export.h",
"test_trace_processor_impl.cc",
"test_trace_processor_impl.h",
@@ -637,33 +634,6 @@ if (enable_base_tracing) {
@@ -635,33 +632,6 @@ if (enable_base_tracing) {
output_name = "TestTraceProcessor"
bundle_deps_filter = [ "//third_party/icu:icudata" ]
}
@@ -88,10 +88,10 @@ index f5191b804bc07..aadb7d66ba4c3 100644
+
#endif // BASE_TEST_TEST_TRACE_PROCESSOR_EXPORT_H_
diff --git content/shell/BUILD.gn content/shell/BUILD.gn
index f4288459097cd..c48696020414c 100644
index ce28d886a26d2..3d044d223fac5 100644
--- content/shell/BUILD.gn
+++ content/shell/BUILD.gn
@@ -926,7 +926,6 @@ if (is_mac) {
@@ -909,7 +909,6 @@ if (is_mac) {
# Specify a sensible install_name for static builds. The library is
# dlopen()ed so this is not used to resolve the module.
ldflags = [ "-Wl,-install_name,@executable_path/../Frameworks/$output_name.framework/$output_name" ]

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