Compare commits

..

48 Commits
5481 ... 5563

Author SHA1 Message Date
Marshall Greenblatt
ebf5d6ab43 Update to Chromium version 111.0.5563.148 2023-03-30 14:17:12 +00:00
Nik Pavlov
491d2383ef views: mac: Support dynamic resize of title bar height (see #3189)
This is intended for usage with frameless windows that show the standard window
buttons, where resizing the title bar height changes the button offset. Returning a
different value from CefWindowDelegate::GetTitlebarHeight and forcing a resize of
the NSWindow's theme frame (see ViewsWindow::NudgeWindow) will update the
title bar height.

To test:
1. Run `cefclient --use-views --hide-frame --show-window-buttons --url=http://tests/window`
2. Enter a new value for title bar height and click the "Set Titlebar Height" button
2023-03-16 13:23:55 -04:00
Nik Pavlov
4eb0508671 views: mac: Enable WindowTestRunnerViews 2023-03-16 13:23:49 -04:00
Marshall Greenblatt
49cae3707a chrome: Move ThreadProfiler initialization to the UI thread (fixes #3465)
ThreadProfiler::CreateAndStartOnMainThread and SetMainThreadTaskRunnerImpl
should be called on the same thread.
2023-03-14 15:12:06 -04:00
Marshall Greenblatt
3215aaebef Rewrite issue links to GitHub (see #3464) 2023-03-13 13:55:43 -04:00
Marshall Greenblatt
1b83ff6471 Update to Chromium version 111.0.5563.65 2023-03-09 14:44:44 +00:00
Nik Pavlov
870da3087f views: mac: Show standard window buttons with frame by default (see issue #3189)
This restores the previous default behavior for framed windows.
2023-03-08 12:57:04 -05:00
Nik Pavlov
f6de0344cb views: mac: Fix frameless window behavior (fixes issue #3189)
Frameless windows now display as expected. Default traffic light buttons can
optionally be shown at configurable vertical position. Layout respects text
direction.
2023-03-08 12:56:45 -05:00
Marshall Greenblatt
6926287894 Update to Chromium version 111.0.5563.64 2023-03-07 14:33:24 +00:00
Marshall Greenblatt
0d4c466645 chrome: Don't show gray background during browser load (fixes issue #3459) 2023-03-06 15:42:12 -05:00
Marshall Greenblatt
1b930decca Update API hash for commit 80b61f0417 2023-03-06 15:41:39 -05:00
Sergey Markelov
80b61f0417 Fix compile error: this function declaration is not a prototype
`cef_basetime_now()` failed to compile if `-Wstrict-prototypes` is set in clang
or gcc.
2023-03-06 11:53:07 -05:00
梅迎朝
a7a5eee369 cefclient: Fix incorrect logic in PassThruResponseFilter 2023-03-06 11:53:07 -05:00
Marshall Greenblatt
e9397c53ff tools: mac: Add missing README.sandbox.txt (fixes issue #3453) 2023-03-06 11:53:07 -05:00
Marshall Greenblatt
eb023d18e0 Update to Chromium version 111.0.5563.50 2023-03-02 14:36:13 +00:00
Marshall Greenblatt
f98481d327 Update to Chromium version 111.0.5563.41 2023-02-24 16:14:25 +00:00
Marshall Greenblatt
0d82c3ffc0 alloy: Fix theme configuration on startup (fixes issue #3449) 2023-02-22 17:13:37 -05:00
Marshall Greenblatt
fb44f128e9 Update to Chromium version 111.0.5563.33 2023-02-18 17:08:43 +00:00
Marshall Greenblatt
565ad7bb99 chrome: cefclient: Add default handler for request tests (see issue #3444)
Support loading of request tests (e.g. http://tests/other_tests) inside default
browsers created via "New window" and "New incognito window" commands.
2023-02-17 16:04:44 -05:00
Marshall Greenblatt
d4c8104ca8 chrome: Fix request interception with active extension (fixes issue #3444)
Support chaining of proxies in WillCreateURLLoaderFactory.
2023-02-17 16:04:35 -05:00
Marshall Greenblatt
b7ba0b9a66 chrome: Make primary user profile the default global context (see issue #3444)
Chrome is always loading the primary user profile by default, so with this
change the CEF behavior more accurately reflects reality. Incognito contexts
can still be created explicitly via CefRequestContext::CreateContext.

Prior to this change, the default for the global context was an Incognito
profile based on the primary user profile. That caused request interception
to be bypassed in WillCreateURLLoaderFactory for profiles associated with
the "New window" and "New incognito window" commands. Those profiles, while
also being (or based on) the primary user profile, did not match the specific
Incognito profile assigned to the default global context.

After this change, the "New window" and "New incognito window" commands will
match the default global context when executed on a browser that was created
using the primary user profile.
2023-02-17 16:04:28 -05:00
Marshall Greenblatt
719fe7691b chrome: Fix crash on display of browser via "New window" command 2023-02-17 16:04:20 -05:00
Marshall Greenblatt
82dc13a870 chrome: Use default Browser creation for picture-in-picture popups (see issue #3448) 2023-02-10 14:35:18 -05:00
Marshall Greenblatt
371f7f3409 Update to Chromium version 111.0.5563.19 2023-02-10 16:26:06 +00:00
Marshall Greenblatt
01fe00c6fd Update to Chromium version 111.0.5563.12 2023-02-07 10:46:41 -05:00
Marshall Greenblatt
f34406c57d Fix potential UAF of CefBPDNativeAura::window_widget_ 2023-02-07 10:45:57 -05:00
Marshall Greenblatt
adfa59f690 ceftests: Fix OSRTest flakyness 2023-02-06 17:45:35 -05:00
Marshall Greenblatt
baf98ee6e9 ceftests: Fix MediaAccessTest.Desktop failures
Fixes InvalidStateError: Failed to execute 'getDisplayMedia' on 'MediaDevices':
getDisplayMedia() requires transient activation (user gesture).
2023-02-03 13:00:26 -05:00
Marshall Greenblatt
dc2231cdfb Update to Chromium version 111.0.5563.0 (#1097615) 2023-02-03 13:00:26 -05:00
Marshall Greenblatt
4c41f14360 Remove deprecated base::[Dictionary|List]Value API usage 2023-01-30 21:32:19 -05:00
Marshall Greenblatt
36ee304ed4 Use default cookie scheme settings for non-global request contexts
The CefSettings cookie scheme configuration will now only impact the global
request context. Custom behavior for other request contexts must now be
configured via CefRequestContextSettings.
2023-01-26 14:37:05 -05:00
Marshall Greenblatt
c3c5d6ff37 chrome: Allow WebUI handling of DevTools scheme (fixes issue #3421) 2023-01-23 14:20:11 -05:00
Marshall Greenblatt
47d2651ea4 Fix patched chrome build with enable_cef=false 2023-01-23 14:20:11 -05:00
Marshall Greenblatt
5c4ac32bb9 tools: Return non-zero exit code from automate-git.py on error 2023-01-19 16:42:55 -05:00
Marshall Greenblatt
8b447e3a6f chrome: Don't show the profile picker on startup (fixes issue #3440) 2023-01-19 16:21:21 -05:00
Marshall Greenblatt
b065ca8cf4 ceftests: Add support for scaling default test timeout values 2023-01-13 14:01:29 -05:00
Marshall Greenblatt
2b906c31b5 cmake: Set PROJECT_ARCH to the host architecture by default 2023-01-12 16:46:46 -05:00
e.jorge
b65d59f27e Fix edit command execution on pdf frames (fixes issue #3429) 2023-01-12 21:45:43 +00:00
Marshall Greenblatt
606e5dddf3 Fix crash calling GetUserData on a non-user V8 object (fixes issue #3438) 2023-01-12 15:56:12 -05:00
Sergey Markelov
4f336c110b Fix the comments to CefCommandLine::AppendSwitch methods 2023-01-12 11:51:25 -05:00
e.jorge
aae420aa8b linux: Fix component build errors (fixes issue #3424) 2023-01-12 16:49:21 +00:00
Vladimir Kharitonov
b1a530c76a mac: Fix OSR scaling behavior when switching displays (fixes issue #3423) 2023-01-12 16:47:19 +00:00
Enrique Turegano Pedruelo
f6d626d979 Linux: Fix build without X11 (fixes issue #3431) 2023-01-10 21:30:47 +00:00
Marshall Greenblatt
2b2c6aa143 win: osr: Fix context menu popup placement (fixes issue 3433) 2023-01-06 15:51:22 -05:00
Marshall Greenblatt
b66c2d1bea Revert "Fix dismissal of select popups on NotifyMoveOrResizeStarted (see issue #3294)"
This reverts commit 5f4bccd672.

Reason for revert: This change causes a native parented browser to lose focus
on move (fixes issue #3426).
2023-01-06 13:48:29 -05:00
Marshall Greenblatt
e65da8fab8 alloy: Avoid initialization of privacy sandbox and identity manager (fixes issue #3434, fixes issue #3401) 2023-01-06 12:12:19 -05:00
Marshall Greenblatt
aef474b909 alloy: Fix crashes when extensions are disabled (fixes issue #3430) 2023-01-05 14:00:22 -05:00
Marshall Greenblatt
8a07a836e1 cmake: Set build target to Windows 10 2023-01-05 12:47:15 -05:00
271 changed files with 2705 additions and 1716 deletions

View File

@@ -1079,7 +1079,6 @@ source_set("libcef_static") {
"libcef/browser/alloy/alloy_browser_main_win.cc",
"libcef/browser/native/browser_platform_delegate_native_win.cc",
"libcef/browser/native/browser_platform_delegate_native_win.h",
"libcef/browser/native/cursor_util_win.cc",
"libcef/browser/osr/browser_platform_delegate_osr_win.cc",
"libcef/browser/osr/browser_platform_delegate_osr_win.h",
]
@@ -1108,7 +1107,6 @@ source_set("libcef_static") {
sources += includes_linux + [
"libcef/browser/native/browser_platform_delegate_native_linux.cc",
"libcef/browser/native/browser_platform_delegate_native_linux.h",
"libcef/browser/native/cursor_util_linux.cc",
"libcef/browser/osr/browser_platform_delegate_osr_linux.cc",
"libcef/browser/osr/browser_platform_delegate_osr_linux.h",
"libcef/browser/printing/print_dialog_linux.cc",
@@ -1140,12 +1138,17 @@ source_set("libcef_static") {
sources += includes_mac + [
"libcef/browser/native/browser_platform_delegate_native_mac.h",
"libcef/browser/native/browser_platform_delegate_native_mac.mm",
"libcef/browser/native/cursor_util_mac.mm",
"libcef/browser/native/javascript_dialog_runner_mac.h",
"libcef/browser/native/javascript_dialog_runner_mac.mm",
"libcef/browser/native/menu_runner_mac.h",
"libcef/browser/native/menu_runner_mac.mm",
"libcef/browser/osr/browser_platform_delegate_osr_mac.h",
"libcef/browser/osr/browser_platform_delegate_osr_mac.mm",
"libcef/browser/views/native_widget_mac.h",
"libcef/browser/views/native_widget_mac.mm",
"libcef/browser/views/ns_window.h",
"libcef/browser/views/ns_window.mm",
"libcef/browser/views/view_util_mac.mm",
"libcef/common/util_mac.h",
"libcef/common/util_mac.mm",
@@ -1168,6 +1171,7 @@ source_set("libcef_static") {
sources += [
"libcef/browser/native/browser_platform_delegate_native_aura.cc",
"libcef/browser/native/browser_platform_delegate_native_aura.h",
"libcef/browser/native/cursor_util_aura.cc",
"libcef/browser/native/menu_runner_views_aura.cc",
"libcef/browser/native/menu_runner_views_aura.h",
"libcef/browser/views/view_util_aura.cc",
@@ -1356,7 +1360,7 @@ make_pack_header("resources") {
"$root_gen_dir/net/grit/net_resources.h",
"$root_gen_dir/third_party/blink/public/resources/grit/blink_resources.h",
"$root_gen_dir/ui/resources/grit/ui_resources.h",
"$root_gen_dir/ui/resources/grit/webui_generated_resources.h",
"$root_gen_dir/ui/resources/grit/webui_resources.h",
"$root_gen_dir/ui/views/resources/grit/views_resources.h",
]
@@ -1383,7 +1387,7 @@ make_pack_header("resources") {
"//net:net_resources",
"//third_party/blink/public:resources",
"//ui/resources:ui_resources_grd",
"//ui/resources:webui_generated_resources_grd",
"//ui/resources:webui_resources_grd",
"//ui/views/resources:resources_grd",
]
}

View File

@@ -7,6 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/110.0.5481.180',
'depot_tools_checkout': '252b19866a'
'chromium_checkout': 'refs/tags/111.0.5563.148',
'depot_tools_checkout': '963e01c76c'
}

View File

@@ -9,6 +9,7 @@ The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromi
* Branches and Building - https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
* Announcements - https://groups.google.com/forum/#!forum/cef-announce
* Support Forum - http://www.magpcss.org/ceforum/
* Issue Tracker - https://github.com/chromiumembedded/cef/issues
* C++ API Docs - [Stable release docs](https://cef-builds.spotifycdn.com/docs/stable.html) / [Beta release docs](https://cef-builds.spotifycdn.com/docs/beta.html)
* Downloads - https://cef-builds.spotifycdn.com/index.html
* Donations - http://www.magpcss.org/ceforum/donate.php
@@ -57,7 +58,7 @@ If you're the maintainer of a project not listed above and would like your proje
CEF is still very much a work in progress. Some ways that you can help out:
\- Vote for issues in the [CEF issue tracker](https://bitbucket.org/chromiumembedded/cef/issues?status=new&status=open) that are important to you. This helps with development prioritization.
\- Vote for issues in the [CEF issue tracker](https://github.com/chromiumembedded/cef/issues) that are important to you. This helps with development prioritization.
\- Report any bugs that you find or feature requests that are important to you. Make sure to first search for existing issues before creating new ones. Please use the [CEF Forum](http://magpcss.org/ceforum) and not the issue tracker for usage questions. Each CEF issue should:
@@ -68,7 +69,7 @@ CEF is still very much a work in progress. Some ways that you can help out:
\- Write unit tests for new or existing functionality.
\- Pull requests and patches are welcome. View open issues in the [CEF issue tracker](https://bitbucket.org/chromiumembedded/cef/issues?status=new&status=open) or search for TODO(cef) in the source code for ideas.
\- Pull requests and patches are welcome. View open issues in the [CEF issue tracker](https://github.com/chromiumembedded/cef/issues) or search for TODO(cef) in the source code for ideas.
If you would like to contribute source code changes to CEF please follow the below guidelines:

View File

@@ -237,6 +237,8 @@
'tests/cefclient/browser/client_prefs.cc',
'tests/cefclient/browser/client_prefs.h',
'tests/cefclient/browser/client_types.h',
'tests/cefclient/browser/default_client_handler.cc',
'tests/cefclient/browser/default_client_handler.h',
'tests/cefclient/browser/dialog_test.cc',
'tests/cefclient/browser/dialog_test.h',
'tests/cefclient/browser/image_cache.cc',
@@ -391,6 +393,7 @@
'tests/cefclient/browser/temp_window_mac.mm',
'tests/cefclient/browser/text_input_client_osr_mac.h',
'tests/cefclient/browser/text_input_client_osr_mac.mm',
'tests/cefclient/browser/views_window_mac.mm',
'tests/cefclient/browser/window_test_runner_mac.h',
'tests/cefclient/browser/window_test_runner_mac.mm',
'tests/cefclient/cefclient_mac.mm',

View File

@@ -531,6 +531,7 @@ if(OS_WINDOWS)
Advapi32.lib
dbghelp.lib
Delayimp.lib
ntdll.lib
OleAut32.lib
PowrProf.lib
Propsys.lib

View File

@@ -71,7 +71,7 @@
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/bind.h"
#include "base/functional/bind.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be

View File

@@ -67,7 +67,7 @@
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/callback.h"
#include "base/functional/callback.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be

View File

@@ -34,7 +34,7 @@
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/callback_forward.h"
#include "base/functional/callback_forward.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be

View File

@@ -39,7 +39,7 @@
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/callback_helpers.h"
#include "base/functional/callback_helpers.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be

View File

@@ -86,7 +86,7 @@
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/callback_list.h"
#include "base/functional/callback_list.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=1d0a15624fec8ca8bd1a5cdf7195b9b553dde44f$
// $hash=ac8fd3a7da20cff1fe2f20a75b045bf27c0312f2$
//
#ifndef CEF_INCLUDE_CAPI_CEF_COMMAND_LINE_CAPI_H_
@@ -159,14 +159,14 @@ typedef struct _cef_command_line_t {
cef_string_map_t switches);
///
/// Add a switch to the end of the command line. If the switch has no value
/// pass an NULL value string.
/// Add a switch to the end of the command line.
///
void(CEF_CALLBACK* append_switch)(struct _cef_command_line_t* self,
const cef_string_t* name);
///
/// Add a switch with the specified value to the end of the command line.
/// Add a switch with the specified value to the end of the command line. If
/// the switch has no value pass an NULL value string.
///
void(CEF_CALLBACK* append_switch_with_value)(struct _cef_command_line_t* self,
const cef_string_t* name,

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=333350f8141cc925d16df2edc8c21a720a1008f0$
// $hash=de4a9b856c6951231f446991a9b1efb89096ad3b$
//
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
@@ -257,13 +257,6 @@ typedef struct _cef_media_sink_t {
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_name)(struct _cef_media_sink_t* self);
///
/// Returns the description of this sink.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_description)(
struct _cef_media_sink_t* self);
///
/// Returns the icon type for this sink.
///

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=019abf16be4e151d31181a6bdcb1ad8dfef03d00$
// $hash=9f0389a439e6787282880d53375369829adb6a3d$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
@@ -137,6 +137,25 @@ typedef struct _cef_window_delegate_t {
int(CEF_CALLBACK* is_frameless)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window);
///
/// Return true (1) if |window| should be created with standard window buttons
/// like close, minimize and zoom.
///
int(CEF_CALLBACK* with_standard_window_buttons)(
struct _cef_window_delegate_t* self,
struct _cef_window_t* window);
///
/// Return whether the titlebar height should be overridden, and sets the
/// height of the titlebar in |titlebar_height|. On macOS, it can also be used
/// to adjust the vertical position of the traffic light buttons in frameless
/// windows. The buttons will be positioned halfway down the titlebar at a
/// height of |titlebar_height| / 2.
///
int(CEF_CALLBACK* get_titlebar_height)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window,
float* titlebar_height);
///
/// Return true (1) if |window| can be resized.
///

View File

@@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "fc4393fe8a78980a4d8689ff8b13094fae3c3e50"
#define CEF_API_HASH_UNIVERSAL "1d8347d8e06dc0dd17f882ca253e1c7bf43d5863"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "c41fbde76401eaecb7bdf4851d162e1416285ac1"
#define CEF_API_HASH_PLATFORM "b6865f1992a10dcefc0bbc450cf296b648003271"
#elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "031d539913b42e85711402dd5f17fa9aada7ebab"
#define CEF_API_HASH_PLATFORM "d04c2a5ab471493c185eb7c7aa894bc4a79d5a7c"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "ceef4f8220761b7bd5bb9959bacd3d55a2dcc484"
#define CEF_API_HASH_PLATFORM "d7d4cbffa4a798fea97e7b9f3610b5cb803d949e"
#endif
#ifdef __cplusplus

View File

@@ -168,14 +168,14 @@ class CefCommandLine : public virtual CefBaseRefCounted {
virtual void GetSwitches(SwitchMap& switches) = 0;
///
/// Add a switch to the end of the command line. If the switch has no value
/// pass an empty value string.
/// Add a switch to the end of the command line.
///
/*--cef()--*/
virtual void AppendSwitch(const CefString& name) = 0;
///
/// Add a switch with the specified value to the end of the command line.
/// Add a switch with the specified value to the end of the command line. If
/// the switch has no value pass an empty value string.
///
/*--cef()--*/
virtual void AppendSwitchWithValue(const CefString& name,

View File

@@ -239,12 +239,6 @@ class CefMediaSink : public virtual CefBaseRefCounted {
/*--cef()--*/
virtual CefString GetName() = 0;
///
/// Returns the description of this sink.
///
/*--cef()--*/
virtual CefString GetDescription() = 0;
///
/// Returns the icon type for this sink.
///

View File

@@ -122,7 +122,7 @@ CEF_EXPORT int cef_time_now(cef_time_t* cef_time);
///
/// Retrieve the current system time.
///
CEF_EXPORT cef_basetime_t cef_basetime_now();
CEF_EXPORT cef_basetime_t cef_basetime_now(void);
///
/// Retrieve the delta in milliseconds between two time values. Returns true (1)

View File

@@ -3368,21 +3368,22 @@ typedef enum {
CEF_PERMISSION_TYPE_CAMERA_PAN_TILT_ZOOM = 1 << 2,
CEF_PERMISSION_TYPE_CAMERA_STREAM = 1 << 3,
CEF_PERMISSION_TYPE_CLIPBOARD = 1 << 4,
CEF_PERMISSION_TYPE_DISK_QUOTA = 1 << 5,
CEF_PERMISSION_TYPE_LOCAL_FONTS = 1 << 6,
CEF_PERMISSION_TYPE_GEOLOCATION = 1 << 7,
CEF_PERMISSION_TYPE_IDLE_DETECTION = 1 << 8,
CEF_PERMISSION_TYPE_MIC_STREAM = 1 << 9,
CEF_PERMISSION_TYPE_MIDI_SYSEX = 1 << 10,
CEF_PERMISSION_TYPE_MULTIPLE_DOWNLOADS = 1 << 11,
CEF_PERMISSION_TYPE_NOTIFICATIONS = 1 << 12,
CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER = 1 << 13,
CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER = 1 << 14,
CEF_PERMISSION_TYPE_SECURITY_ATTESTATION = 1 << 15,
CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 << 16,
CEF_PERMISSION_TYPE_U2F_API_REQUEST = 1 << 17,
CEF_PERMISSION_TYPE_VR_SESSION = 1 << 18,
CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 << 19,
CEF_PERMISSION_TYPE_TOP_LEVEL_STORAGE_ACCESS = 1 << 5,
CEF_PERMISSION_TYPE_DISK_QUOTA = 1 << 6,
CEF_PERMISSION_TYPE_LOCAL_FONTS = 1 << 7,
CEF_PERMISSION_TYPE_GEOLOCATION = 1 << 8,
CEF_PERMISSION_TYPE_IDLE_DETECTION = 1 << 9,
CEF_PERMISSION_TYPE_MIC_STREAM = 1 << 10,
CEF_PERMISSION_TYPE_MIDI_SYSEX = 1 << 11,
CEF_PERMISSION_TYPE_MULTIPLE_DOWNLOADS = 1 << 12,
CEF_PERMISSION_TYPE_NOTIFICATIONS = 1 << 13,
CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER = 1 << 14,
CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER = 1 << 15,
CEF_PERMISSION_TYPE_SECURITY_ATTESTATION = 1 << 16,
CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 << 17,
CEF_PERMISSION_TYPE_U2F_API_REQUEST = 1 << 18,
CEF_PERMISSION_TYPE_VR_SESSION = 1 << 19,
CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 << 20,
} cef_permission_request_types_t;
///

View File

@@ -81,7 +81,7 @@ class CefBrowserViewDelegate : public CefViewDelegate {
/// popup will be a DevTools browser. Return the delegate that will be used
/// for the new popup BrowserView.
///
/*--cef()--*/
/*--cef(optional_param=client)--*/
virtual CefRefPtr<CefBrowserViewDelegate> GetDelegateForPopupBrowserView(
CefRefPtr<CefBrowserView> browser_view,
const CefBrowserSettings& settings,

View File

@@ -128,6 +128,29 @@ class CefWindowDelegate : public CefPanelDelegate {
/*--cef()--*/
virtual bool IsFrameless(CefRefPtr<CefWindow> window) { return false; }
///
/// Return true if |window| should be created with standard window buttons
/// like close, minimize and zoom.
///
/*--cef()--*/
virtual bool WithStandardWindowButtons(CefRefPtr<CefWindow> window) {
return !IsFrameless(window);
}
///
/// Return whether the titlebar height should be overridden,
/// and sets the height of the titlebar in |titlebar_height|.
/// On macOS, it can also be used to adjust the vertical position
/// of the traffic light buttons in frameless windows.
/// The buttons will be positioned halfway down the titlebar
/// at a height of |titlebar_height| / 2.
///
/*--cef()--*/
virtual bool GetTitlebarHeight(CefRefPtr<CefWindow> window,
float* titlebar_height) {
return false;
}
///
/// Return true if |window| can be resized.
///

View File

@@ -264,8 +264,8 @@ void AlloyBrowserContext::LoadExtension(
if (manifest && manifest->GetSize() > 0) {
CefDictionaryValueImpl* value_impl =
static_cast<CefDictionaryValueImpl*>(manifest.get());
std::unique_ptr<base::DictionaryValue> value_copy(value_impl->CopyValue());
extension_system()->LoadExtension(std::move(*value_copy).TakeDict(),
auto value = value_impl->CopyValue();
extension_system()->LoadExtension(std::move(value.GetDict()),
root_directory, false /* builtin */,
loader_context, handler);
} else {

View File

@@ -29,9 +29,9 @@
#include "libcef/common/values_impl.h"
#include "libcef/features/runtime_checks.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "chrome/browser/file_select_helper.h"
#include "chrome/browser/picture_in_picture/picture_in_picture_window_manager.h"
#include "content/browser/gpu/compositor_util.h"
@@ -1227,7 +1227,7 @@ void AlloyBrowserHostImpl::WebContentsCreated(
target_url,
frame_util::MakeGlobalId(opener_render_process_id,
opener_render_frame_id),
settings, client, platform_delegate, extra_info);
settings, client, platform_delegate, extra_info, new_contents);
scoped_refptr<CefBrowserInfo> info =
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
@@ -1253,11 +1253,6 @@ void AlloyBrowserHostImpl::WebContentsCreated(
std::move(platform_delegate), /*cef_extension=*/nullptr);
}
void AlloyBrowserHostImpl::DidNavigatePrimaryMainFramePostCommit(
content::WebContents* web_contents) {
contents_delegate_->DidNavigatePrimaryMainFramePostCommit(web_contents);
}
content::JavaScriptDialogManager*
AlloyBrowserHostImpl::GetJavaScriptDialogManager(content::WebContents* source) {
if (!javascript_dialog_manager_) {
@@ -1353,9 +1348,9 @@ bool AlloyBrowserHostImpl::IsBackForwardCacheSupported() {
return false;
}
bool AlloyBrowserHostImpl::IsPrerender2Supported(
content::PreloadingEligibility AlloyBrowserHostImpl::IsPrerender2Supported(
content::WebContents& web_contents) {
return true;
return content::PreloadingEligibility::kEligible;
}
// content::WebContentsObserver methods.

View File

@@ -235,8 +235,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
const std::string& frame_name,
const GURL& target_url,
content::WebContents* new_contents) override;
void DidNavigatePrimaryMainFramePostCommit(
content::WebContents* web_contents) override;
content::JavaScriptDialogManager* GetJavaScriptDialogManager(
content::WebContents* source) override;
void RunFileChooser(content::RenderFrameHost* render_frame_host,
@@ -272,7 +270,8 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
content::WebContents* web_contents) override;
void ExitPictureInPicture() override;
bool IsBackForwardCacheSupported() override;
bool IsPrerender2Supported(content::WebContents& web_contents) override;
content::PreloadingEligibility IsPrerender2Supported(
content::WebContents& web_contents) override;
// content::WebContentsObserver methods.
using content::WebContentsObserver::BeforeUnloadFired;

View File

@@ -22,8 +22,8 @@
#include "libcef/common/extensions/extensions_util.h"
#include "libcef/common/net/net_resource_provider.h"
#include "base/bind.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/browser_process.h"
@@ -174,7 +174,7 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
auto printing_delegate = new CefPrintingContextLinuxDelegate();
auto default_delegate =
printing::PrintingContextLinuxDelegate::SetInstance(printing_delegate);
ui::PrintingContextLinuxDelegate::SetInstance(printing_delegate);
printing_delegate->SetDefaultDelegate(default_delegate);
#endif // BUILDFLAG(IS_LINUX)

View File

@@ -121,6 +121,7 @@
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/info_map.h"
#include "extensions/browser/process_map.h"
#include "extensions/browser/renderer_startup_helper.h"
#include "extensions/browser/url_loader_factory_manager.h"
#include "extensions/common/constants.h"
#include "extensions/common/switches.h"
@@ -976,6 +977,9 @@ void AlloyContentBrowserClient::ExposeInterfacesToRenderer(
base::BindRepeating(
&extensions::ExtensionsGuestView::CreateForExtensions,
host->GetID()));
associated_registry->AddInterface<extensions::mojom::RendererHost>(
base::BindRepeating(&extensions::RendererStartupHelper::BindForRenderer,
host->GetID()));
}
CefBrowserManager::ExposeInterfacesToRenderer(registry, associated_registry,
@@ -1356,6 +1360,7 @@ bool AlloyContentBrowserClient::ArePersistentMediaDeviceIDsAllowed(
Profile::FromBrowserContext(browser_context))
->IsFullCookieAccessAllowed(
url, site_for_cookies, top_frame_origin,
net::CookieSettingOverrides(),
content_settings::CookieSettings::QueryReason::kSiteStorage);
}

View File

@@ -6,7 +6,7 @@
#define CEF_LIBCEF_BROWSER_ALLOY_DIALOGS_ALLOY_WEB_CONTENTS_DIALOG_HELPER_H_
#pragma once
#include "base/callback_forward.h"
#include "base/functional/callback_forward.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "components/web_modal/modal_dialog_host.h"

View File

@@ -7,8 +7,8 @@
#include <memory>
#include <utility>
#include "base/bind.h"
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/location.h"
#include "content/browser/browser_main_loop.h"
#include "content/browser/web_contents/web_contents_impl.h"

View File

@@ -5,7 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_AUDIO_LOOPBACK_STREAM_CREATOR_H_
#define CEF_LIBCEF_BROWSER_AUDIO_LOOPBACK_STREAM_CREATOR_H_
#include "base/callback.h"
#include "base/functional/callback.h"
#include "content/browser/media/forwarding_audio_stream_factory.h"
#include "content/common/content_export.h"
#include "media/mojo/mojom/audio_data_pipe.mojom.h"

View File

@@ -218,12 +218,6 @@ bool CefBrowserContentsDelegate::DidAddMessageToConsole(
return false;
}
void CefBrowserContentsDelegate::DidNavigatePrimaryMainFramePostCommit(
content::WebContents* web_contents) {
has_document_ = false;
OnStateChanged(State::kDocument);
}
void CefBrowserContentsDelegate::EnterFullscreenModeForTab(
content::RenderFrameHost* requesting_frame,
const blink::mojom::FullscreenOptions& options) {
@@ -319,8 +313,11 @@ void CefBrowserContentsDelegate::RenderFrameCreated(
web_contents()->SetPageBaseBackgroundColor(SkColor());
web_contents()->SetPageBaseBackgroundColor(base_background_color);
}
render_view_host->GetWidget()->GetView()->SetBackgroundColor(
base_background_color);
if (render_view_host->GetWidget() &&
render_view_host->GetWidget()->GetView()) {
render_view_host->GetWidget()->GetView()->SetBackgroundColor(
base_background_color);
}
platform_delegate()->RenderViewCreated(render_view_host);
}
@@ -458,6 +455,13 @@ void CefBrowserContentsDelegate::DidFinishNavigation(
return;
}
if (navigation_handle->IsInPrimaryMainFrame() &&
navigation_handle->HasCommitted()) {
// A primary main frame navigation has occured.
has_document_ = false;
OnStateChanged(State::kDocument);
}
const bool is_main_frame = navigation_handle->IsInMainFrame();
const auto global_id = frame_util::GetGlobalId(navigation_handle);
const GURL& url =

View File

@@ -95,8 +95,6 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
const std::u16string& message,
int32_t line_no,
const std::u16string& source_id) override;
void DidNavigatePrimaryMainFramePostCommit(
content::WebContents* web_contents) override;
void EnterFullscreenModeForTab(
content::RenderFrameHost* requesting_frame,
const blink::mojom::FullscreenOptions& options) override;

View File

@@ -13,8 +13,8 @@
#include "libcef/browser/iothread_state.h"
#include "libcef/browser/request_context_handler_map.h"
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/functional/callback.h"
#include "base/memory/weak_ptr.h"
#include "base/task/sequenced_task_runner_helpers.h"
#include "chrome/common/plugin.mojom.h"

View File

@@ -34,7 +34,7 @@ void CefBrowserFrame::RegisterBrowserInterfaceBindersForFrame(
}
void CefBrowserFrame::SendMessage(const std::string& name,
base::Value arguments) {
base::Value::List arguments) {
// Always send to the newly created RFH, which may be speculative when
// navigating cross-origin.
if (auto host = GetFrameHost(/*prefer_speculative=*/true)) {

View File

@@ -35,7 +35,8 @@ class CefBrowserFrame
private:
// cef::mojom::BrowserFrame methods:
void SendMessage(const std::string& name, base::Value arguments) override;
void SendMessage(const std::string& name,
base::Value::List arguments) override;
void SendSharedMemoryRegion(const std::string& name,
base::ReadOnlySharedMemoryRegion region) override;
void FrameAttached(mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,

View File

@@ -13,8 +13,8 @@
#include "include/internal/cef_ptr.h"
#include "libcef/common/values_impl.h"
#include "base/callback.h"
#include "base/containers/unique_ptr_adapters.h"
#include "base/functional/callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/synchronization/lock.h"

View File

@@ -18,11 +18,11 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/task/sequenced_task_runner.h"
#include "content/public/browser/child_process_host.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/child_process_host.h"
#include "content/public/common/url_constants.h"
namespace {
@@ -125,6 +125,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
CefRefPtr<CefClient> client = browser->GetClient();
bool allow = true;
bool handled = false;
CefWindowInfo window_info;
@@ -133,7 +134,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
#endif
auto pending_popup = std::make_unique<CefBrowserInfoManager::PendingPopup>();
pending_popup->step = CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW;
pending_popup->step = PendingPopup::CAN_CREATE_WINDOW;
pending_popup->opener_global_id = opener->GetGlobalId();
pending_popup->target_url = target_url;
pending_popup->target_frame_name = frame_name;
@@ -142,6 +143,11 @@ bool CefBrowserInfoManager::CanCreateWindow(
pending_popup->client = client;
pending_popup->settings = browser->settings();
// With the Chrome runtime, we want to use default popup Browser creation
// for document picture-in-picture.
pending_popup->use_default_browser_creation =
disposition == WindowOpenDisposition::NEW_PICTURE_IN_PICTURE;
if (client.get()) {
CefRefPtr<CefLifeSpanHandler> handler = client->GetLifeSpanHandler();
if (handler.get()) {
@@ -172,6 +178,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
cef_features, window_info, pending_popup->client,
pending_popup->settings, pending_popup->extra_info,
no_javascript_access);
handled = true;
}
}
@@ -179,14 +186,21 @@ bool CefBrowserInfoManager::CanCreateWindow(
CefBrowserCreateParams create_params;
create_params.MaybeSetWindowInfo(window_info);
if (!handled) {
// Use default Browser creation if OnBeforePopup was unhandled.
// TODO(chrome): Expose a mechanism for the client to choose default
// creation.
pending_popup->use_default_browser_creation = true;
}
// In most cases, Views-hosted browsers should create Views-hosted popups
// and native browsers should use default popup handling. The one exception
// is with the Chrome runtime where a Views-hosted browser may have an
// external parent. In that case we want to use default popup handling even
// though the parent is (technically) Views-hosted.
// and native browsers should use default popup handling. With the Chrome
// runtime, we should additionally use default handling (a) when using an
// external parent and (b) when using default Browser creation.
create_params.popup_with_views_hosted_opener =
browser->HasView() &&
!browser->platform_delegate()->HasExternalParent();
!browser->platform_delegate()->HasExternalParent() &&
!pending_popup->use_default_browser_creation;
create_params.settings = pending_popup->settings;
create_params.client = pending_popup->client;
@@ -217,9 +231,8 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
CEF_REQUIRE_UIT();
REQUIRE_ALLOY_RUNTIME();
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
PopPendingPopup(CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW,
opener_global_id, target_url);
auto pending_popup = PopPendingPopup(PendingPopup::CAN_CREATE_WINDOW,
opener_global_id, target_url);
DCHECK(pending_popup.get());
DCHECK(pending_popup->platform_delegate.get());
@@ -228,8 +241,7 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
delegate_view);
}
pending_popup->step =
CefBrowserInfoManager::PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW;
pending_popup->step = PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW;
PushPendingPopup(std::move(pending_popup));
}
@@ -239,16 +251,16 @@ void CefBrowserInfoManager::WebContentsCreated(
CefBrowserSettings& settings,
CefRefPtr<CefClient>& client,
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate,
CefRefPtr<CefDictionaryValue>& extra_info) {
CefRefPtr<CefDictionaryValue>& extra_info,
content::WebContents* new_contents) {
CEF_REQUIRE_UIT();
// GET_CUSTOM_WEB_CONTENTS_VIEW is only used with the alloy runtime.
const auto previous_step =
cef::IsAlloyRuntimeEnabled()
? CefBrowserInfoManager::PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW
: CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW;
const auto previous_step = cef::IsAlloyRuntimeEnabled()
? PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW
: PendingPopup::CAN_CREATE_WINDOW;
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
auto pending_popup =
PopPendingPopup(previous_step, opener_global_id, target_url);
DCHECK(pending_popup.get());
DCHECK(pending_popup->platform_delegate.get());
@@ -257,6 +269,30 @@ void CefBrowserInfoManager::WebContentsCreated(
client = pending_popup->client;
platform_delegate = std::move(pending_popup->platform_delegate);
extra_info = pending_popup->extra_info;
// AddWebContents (the next step) is only used with the Chrome runtime.
if (cef::IsChromeRuntimeEnabled()) {
pending_popup->step = PendingPopup::WEB_CONTENTS_CREATED;
pending_popup->new_contents = new_contents;
PushPendingPopup(std::move(pending_popup));
}
}
bool CefBrowserInfoManager::AddWebContents(content::WebContents* new_contents) {
CEF_REQUIRE_UIT();
DCHECK(cef::IsChromeRuntimeEnabled());
// Pending popup information may be missing in cases where
// chrome::AddWebContents is called directly from the Chrome UI (profile
// settings, etc).
auto pending_popup =
PopPendingPopup(PendingPopup::WEB_CONTENTS_CREATED, new_contents);
if (pending_popup) {
return !pending_popup->use_default_browser_creation;
}
// Proceed with default handling.
return false;
}
void CefBrowserInfoManager::OnGetNewBrowserInfo(
@@ -265,7 +301,7 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
DCHECK(frame_util::IsValidGlobalId(global_id));
DCHECK(callback);
auto callback_runner = base::SequencedTaskRunnerHandle::Get();
auto callback_runner = base::SequencedTaskRunner::GetCurrentDefault();
base::AutoLock lock_scope(browser_info_lock_);
@@ -297,7 +333,9 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
std::make_pair(global_id, std::move(pending)));
// Register a timeout for the pending response so that the renderer process
// doesn't hang forever.
// doesn't hang forever. With the Chrome runtime, timeouts may occur in cases
// where chrome::AddWebContents or WebContents::Create are called directly
// from the Chrome UI (profile settings, etc).
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableNewBrowserInfoTimeout)) {
CEF_POST_DELAYED_TASK(
@@ -438,16 +476,18 @@ void CefBrowserInfoManager::PushPendingPopup(
std::unique_ptr<CefBrowserInfoManager::PendingPopup>
CefBrowserInfoManager::PopPendingPopup(
PendingPopup::Step step,
PendingPopup::Step previous_step,
const content::GlobalRenderFrameHostId& opener_global_id,
const GURL& target_url) {
CEF_REQUIRE_UIT();
DCHECK(frame_util::IsValidGlobalId(opener_global_id));
DCHECK_LE(previous_step, PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW);
PendingPopupList::iterator it = pending_popup_list_.begin();
for (; it != pending_popup_list_.end(); ++it) {
PendingPopup* popup = it->get();
if (popup->step == step && popup->opener_global_id == opener_global_id &&
if (popup->step == previous_step &&
popup->opener_global_id == opener_global_id &&
popup->target_url == target_url) {
// Transfer ownership of the pointer.
it->release();
@@ -459,6 +499,26 @@ CefBrowserInfoManager::PopPendingPopup(
return nullptr;
}
std::unique_ptr<CefBrowserInfoManager::PendingPopup>
CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step previous_step,
content::WebContents* new_contents) {
CEF_REQUIRE_UIT();
DCHECK_GE(previous_step, PendingPopup::WEB_CONTENTS_CREATED);
PendingPopupList::iterator it = pending_popup_list_.begin();
for (; it != pending_popup_list_.end(); ++it) {
PendingPopup* popup = it->get();
if (popup->step == previous_step && popup->new_contents == new_contents) {
// Transfer ownership of the pointer.
it->release();
pending_popup_list_.erase(it);
return base::WrapUnique(popup);
}
}
return nullptr;
}
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfoInternal(
const content::GlobalRenderFrameHostId& global_id,
bool* is_guest_view) {
@@ -514,8 +574,8 @@ void CefBrowserInfoManager::SendNewBrowserInfoResponse(
if (extra_info) {
auto extra_info_impl =
static_cast<CefDictionaryValueImpl*>(extra_info.get());
auto extra_info_value = base::WrapUnique(extra_info_impl->CopyValue());
params->extra_info = std::move(*extra_info_value);
auto extra_info_value = extra_info_impl->CopyValue();
params->extra_info = std::move(extra_info_value.GetDict());
}
} else {
// The new browser info response has timed out.

View File

@@ -97,7 +97,12 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
CefBrowserSettings& settings,
CefRefPtr<CefClient>& client,
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate,
CefRefPtr<CefDictionaryValue>& extra_info);
CefRefPtr<CefDictionaryValue>& extra_info,
content::WebContents* new_contents);
// Called from ChromeBrowserDelegate::AddWebContents. See comments on
// PendingPopup for more information. Returns true for custom handling.
bool AddWebContents(content::WebContents* source_contents);
// Called from CefBrowserManager::GetNewBrowserInfo for delivering
// browser info to the renderer process. If the browser info already exists
@@ -154,6 +159,8 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// Creates the OSR views for windowless popups.
// - WebContentsCreated (UIT):
// Creates the CefBrowserHost representation for the popup.
// - AddWebContents (UIT) (chrome runtime only):
// Creates the Browser or tab representation for the popup.
// - CefBrowserManager::GetNewBrowserInfo (IOT)
// Passes information about the popup to the renderer process.
struct PendingPopup {
@@ -163,6 +170,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
enum Step {
CAN_CREATE_WINDOW,
GET_CUSTOM_WEB_CONTENTS_VIEW,
WEB_CONTENTS_CREATED,
} step;
// Initial state from ViewHostMsg_CreateWindow.
@@ -179,15 +187,29 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// Platform delegate specific to the new popup.
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate;
// True if default Browser or tab creation should proceed from
// AddWebContents (chrome runtime only).
bool use_default_browser_creation = false;
// The newly created WebContents (set in WebContentsCreated).
content::WebContents* new_contents = nullptr;
};
// Manage pending popups. Only called on the UI thread.
void PushPendingPopup(std::unique_ptr<PendingPopup> popup);
// Used after CanCreateWindow is called.
std::unique_ptr<PendingPopup> PopPendingPopup(
PendingPopup::Step step,
PendingPopup::Step previous_step,
const content::GlobalRenderFrameHostId& opener_global_id,
const GURL& target_url);
// Used after WebContentsCreated is called.
std::unique_ptr<PendingPopup> PopPendingPopup(
PendingPopup::Step previous_step,
content::WebContents* new_contents);
// Retrieves the BrowserInfo matching the specified ID.
scoped_refptr<CefBrowserInfo> GetBrowserInfoInternal(
const content::GlobalRenderFrameHostId& global_id,

View File

@@ -14,7 +14,7 @@
#include "include/internal/cef_types.h"
#include "include/views/cef_browser_view.h"
#include "base/callback_forward.h"
#include "base/functional/callback_forward.h"
#include "extensions/common/mojom/view_type.mojom-forward.h"
#include "third_party/blink/public/common/page/drag_operation.h"
#include "third_party/blink/public/mojom/drag/drag.mojom-forward.h"

View File

@@ -9,8 +9,8 @@
#include "libcef/browser/ssl_info_impl.h"
#include "libcef/browser/thread_util.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "content/public/browser/web_contents.h"
#include "net/ssl/ssl_info.h"

View File

@@ -6,7 +6,7 @@
#define CEF_LIBCEF_BROWSER_CERTIFICATE_QUERY_H_
#pragma once
#include "base/callback_forward.h"
#include "base/functional/callback_forward.h"
#include "content/public/browser/certificate_request_result_type.h"
namespace content {

View File

@@ -36,7 +36,16 @@ class BrowserDelegate : public content::WebContentsDelegate {
~BrowserDelegate() override {}
// Called immediately after |new_contents| is created.
// Optionally override chrome::AddWebContents behavior. This is most often
// called via Browser::AddNewContents for new popup browsers and provides an
// opportunity for CEF to create a new Browser instead of proceeding with
// default Browser or tab creation.
virtual std::unique_ptr<content::WebContents> AddWebContents(
std::unique_ptr<content::WebContents> new_contents) = 0;
// Called immediately after |new_contents| is created via chrome::Navigate.
// This is most often called for navigations targeting a new tab without a
// pre-existing WebContents.
virtual void OnWebContentsCreated(content::WebContents* new_contents) = 0;
// Add or remove ownership of the WebContents.

View File

@@ -34,6 +34,25 @@ ChromeBrowserDelegate::ChromeBrowserDelegate(
ChromeBrowserDelegate::~ChromeBrowserDelegate() = default;
std::unique_ptr<content::WebContents> ChromeBrowserDelegate::AddWebContents(
std::unique_ptr<content::WebContents> new_contents) {
if (CefBrowserInfoManager::GetInstance()->AddWebContents(
new_contents.get())) {
// The browser host should have been created in WebContentsCreated().
auto new_browser =
ChromeBrowserHostImpl::GetBrowserForContents(new_contents.get());
if (new_browser) {
// Create a new Browser and give it ownership of the new WebContents.
new_browser->AddNewContents(std::move(new_contents));
} else {
LOG(ERROR) << "No host found for chrome popup browser";
}
}
// Proceed with default chrome::AddWebContents behavior.
return new_contents;
}
void ChromeBrowserDelegate::OnWebContentsCreated(
content::WebContents* new_contents) {
// Necessary to receive LoadingStateChanged calls during initial navigation.
@@ -132,7 +151,7 @@ void ChromeBrowserDelegate::WebContentsCreated(
target_url,
frame_util::MakeGlobalId(opener_render_process_id,
opener_render_frame_id),
settings, client, platform_delegate, extra_info);
settings, client, platform_delegate, extra_info, new_contents);
auto opener = ChromeBrowserHostImpl::GetBrowserForContents(source_contents);
if (!opener) {
@@ -155,27 +174,6 @@ void ChromeBrowserDelegate::WebContentsCreated(
browser_info, opener, request_context_impl);
}
void ChromeBrowserDelegate::AddNewContents(
content::WebContents* source_contents,
std::unique_ptr<content::WebContents> new_contents,
const GURL& target_url,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& window_features,
bool user_gesture,
bool* was_blocked) {
auto new_browser =
ChromeBrowserHostImpl::GetBrowserForContents(new_contents.get());
if (new_browser) {
// Create a new Browser and give it ownership of the WebContents.
new_browser->AddNewContents(std::move(new_contents));
return;
}
// Fall back to default behavior from Browser::AddNewContents.
chrome::AddWebContents(browser_, source_contents, std::move(new_contents),
target_url, disposition, window_features);
}
content::WebContents* ChromeBrowserDelegate::OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) {
@@ -222,13 +220,6 @@ bool ChromeBrowserDelegate::DidAddMessageToConsole(
return false;
}
void ChromeBrowserDelegate::DidNavigatePrimaryMainFramePostCommit(
content::WebContents* web_contents) {
if (auto delegate = GetDelegateForWebContents(web_contents)) {
delegate->DidNavigatePrimaryMainFramePostCommit(web_contents);
}
}
void ChromeBrowserDelegate::EnterFullscreenModeForTab(
content::RenderFrameHost* requesting_frame,
const blink::mojom::FullscreenOptions& options) {

View File

@@ -48,6 +48,8 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
~ChromeBrowserDelegate() override;
// cef::BrowserDelegate methods:
std::unique_ptr<content::WebContents> AddWebContents(
std::unique_ptr<content::WebContents> new_contents) override;
void OnWebContentsCreated(content::WebContents* new_contents) override;
void SetAsDelegate(content::WebContents* web_contents,
bool set_delegate) override;
@@ -66,13 +68,6 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
const std::string& frame_name,
const GURL& target_url,
content::WebContents* new_contents) override;
void AddNewContents(content::WebContents* source_contents,
std::unique_ptr<content::WebContents> new_contents,
const GURL& target_url,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& window_features,
bool user_gesture,
bool* was_blocked) override;
content::WebContents* OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) override;
@@ -84,8 +79,6 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
const std::u16string& message,
int32_t line_no,
const std::u16string& source_id) override;
void DidNavigatePrimaryMainFramePostCommit(
content::WebContents* web_contents) override;
void EnterFullscreenModeForTab(
content::RenderFrameHost* requesting_frame,
const blink::mojom::FullscreenOptions& options) override;

View File

@@ -20,6 +20,7 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/frame/contents_web_view.h"
#include "chrome/common/pref_names.h"
#include "libcef/browser/chrome/views/chrome_browser_frame.h"
#include "libcef/browser/chrome/views/chrome_browser_view.h"
@@ -435,6 +436,9 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
chrome_browser_view->InitBrowser(base::WrapUnique(browser),
params.browser_view);
// Don't set theme colors in ContentsWebView::UpdateBackgroundColor.
chrome_browser_view->contents_web_view()->SetBackgroundVisible(false);
// Don't show the browser by default.
show_browser = false;
}

View File

@@ -11,6 +11,7 @@
#include "libcef/browser/permission_prompt.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/profiles/profile.h"
ChromeBrowserMainExtraPartsCef::ChromeBrowserMainExtraPartsCef() = default;
@@ -25,6 +26,9 @@ void ChromeBrowserMainExtraPartsCef::PostProfileInit(Profile* profile,
CefRequestContextSettings settings;
CefContext::Get()->PopulateGlobalRequestContextSettings(&settings);
// Use the existing path for the initial profile.
CefString(&settings.cache_path) = profile->GetPath().value();
// Create the global RequestContext.
global_request_context_ =
CefRequestContextImpl::CreateGlobalRequestContext(settings);

View File

@@ -241,21 +241,65 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
bool* bypass_redirect_checks,
bool* disable_secure_dns,
network::mojom::URLLoaderFactoryOverridePtr* factory_override) {
bool use_proxy = ChromeContentBrowserClient::WillCreateURLLoaderFactory(
browser_context, frame, render_process_id, type, request_initiator,
navigation_id, ukm_source_id, factory_receiver, header_client,
bypass_redirect_checks, disable_secure_dns, factory_override);
if (use_proxy) {
// The chrome layer will handle the request.
return use_proxy;
}
// Don't intercept requests for Profiles that were not created by CEF.
// For example, the User Manager profile created via
// profiles::CreateSystemProfileForUserManager.
auto profile = Profile::FromBrowserContext(browser_context);
if (!CefBrowserContext::FromProfile(profile)) {
return false;
return ChromeContentBrowserClient::WillCreateURLLoaderFactory(
browser_context, frame, render_process_id, type, request_initiator,
navigation_id, ukm_source_id, factory_receiver, header_client,
bypass_redirect_checks, disable_secure_dns, factory_override);
}
// Based on content/browser/devtools/devtools_instrumentation.cc
// WillCreateURLLoaderFactoryInternal.
network::mojom::URLLoaderFactoryOverridePtr cef_override(
network::mojom::URLLoaderFactoryOverride::New());
// If caller passed some existing overrides, use those.
// Otherwise, use our local var, then if handlers actually
// decide to intercept, move it to |factory_override|.
network::mojom::URLLoaderFactoryOverridePtr* handler_override =
factory_override && *factory_override ? factory_override : &cef_override;
network::mojom::URLLoaderFactoryOverride* intercepting_factory =
handler_override->get();
// If we're the first interceptor to install an override, make a
// remote/receiver pair, then handle this similarly to appending
// a proxy to existing override.
if (!intercepting_factory->overriding_factory) {
DCHECK(!intercepting_factory->overridden_factory_receiver);
intercepting_factory->overridden_factory_receiver =
intercepting_factory->overriding_factory
.InitWithNewPipeAndPassReceiver();
}
// TODO(chrome): Is it necessary to proxy |header_client| callbacks?
bool use_proxy = ChromeContentBrowserClient::WillCreateURLLoaderFactory(
browser_context, frame, render_process_id, type, request_initiator,
navigation_id, ukm_source_id,
&(intercepting_factory->overridden_factory_receiver),
/*header_client=*/nullptr, bypass_redirect_checks, disable_secure_dns,
handler_override);
if (use_proxy) {
DCHECK(intercepting_factory->overriding_factory);
DCHECK(intercepting_factory->overridden_factory_receiver);
if (!factory_override) {
// Not a subresource navigation, so just override the target receiver.
mojo::FusePipes(std::move(*factory_receiver),
std::move(cef_override->overriding_factory));
*factory_receiver = std::move(cef_override->overridden_factory_receiver);
} else if (!*factory_override) {
// No other overrides, so just returns ours as is.
*factory_override = network::mojom::URLLoaderFactoryOverride::New(
std::move(cef_override->overriding_factory),
std::move(cef_override->overridden_factory_receiver), false);
}
// ... else things are already taken care of, as handler_override was
// pointing to factory override and we've done all magic in-place.
DCHECK(!cef_override->overriding_factory);
DCHECK(!cef_override->overridden_factory_receiver);
}
auto request_handler = net_service::CreateInterceptedRequestHandler(
@@ -266,6 +310,7 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
net_service::ProxyURLLoaderFactory::CreateProxy(
browser_context, factory_receiver, header_client,
std::move(request_handler));
return true;
}

View File

@@ -10,8 +10,8 @@
#include "libcef/browser/trace_subscriber.h"
#include "libcef/common/cef_switches.h"
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/task/current_thread.h"
#include "base/threading/thread_restrictions.h"

View File

@@ -43,7 +43,7 @@ bool CefDevToolsController::SendDevToolsMessage(
int CefDevToolsController::ExecuteDevToolsMethod(
int suggested_message_id,
const std::string& method,
const base::DictionaryValue* params) {
const base::Value::Dict* params) {
CEF_REQUIRE_UIT();
if (!EnsureAgentHost()) {
return 0;
@@ -57,11 +57,11 @@ int CefDevToolsController::ExecuteDevToolsMethod(
next_message_id_ = message_id + 1;
}
base::DictionaryValue message;
message.SetIntKey("id", message_id);
message.SetStringKey("method", method);
base::Value::Dict message;
message.Set("id", message_id);
message.Set("method", method);
if (params) {
message.SetKey("params", params->Clone());
message.Set("params", params->Clone());
}
std::string protocol_message;

View File

@@ -51,7 +51,7 @@ class CefDevToolsController : public content::DevToolsAgentHostClient {
bool SendDevToolsMessage(const base::StringPiece& message);
int ExecuteDevToolsMethod(int message_id,
const std::string& method,
const base::DictionaryValue* params);
const base::Value::Dict* params);
// |observer| must outlive this object or be removed.
void AddObserver(Observer* observer);

View File

@@ -6,17 +6,17 @@
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/json/json_writer.h"
#include "base/json/values_util.h"
#include "base/lazy_instance.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/values.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/scoped_user_pref_update.h"
@@ -142,9 +142,8 @@ void CefDevToolsFileManager::SaveAsFileSelected(const std::string& url,
*g_last_save_path.Pointer() = path;
saved_files_[url] = path;
DictionaryPrefUpdate update(prefs_, prefs::kDevToolsEditedFiles);
base::Value* files_map = update.Get();
files_map->SetKey(base::MD5String(url), base::FilePathToValue(path));
ScopedDictPrefUpdate update(prefs_, prefs::kDevToolsEditedFiles);
update->Set(base::MD5String(url), base::FilePathToValue(path));
std::string file_system_path = path.AsUTF8Unsafe();
std::move(callback).Run(file_system_path);
file_task_runner_->PostTask(FROM_HERE,

View File

@@ -5,7 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FILE_MANAGER_H_
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_FILE_MANAGER_H_
#include "base/callback_forward.h"
#include "base/functional/callback_forward.h"
#include "base/memory/weak_ptr.h"
#include <map>

View File

@@ -77,10 +77,10 @@ static std::string GetFrontendURL() {
scheme::kChromeDevToolsHost);
}
base::DictionaryValue BuildObjectForResponse(const net::HttpResponseHeaders* rh,
bool success,
int net_error) {
base::DictionaryValue response;
base::Value::Dict BuildObjectForResponse(const net::HttpResponseHeaders* rh,
bool success,
int net_error) {
base::Value::Dict response;
int responseCode = 200;
if (rh) {
responseCode = rh->response_code();
@@ -88,18 +88,18 @@ base::DictionaryValue BuildObjectForResponse(const net::HttpResponseHeaders* rh,
// In case of no headers, assume file:// URL and failed to load
responseCode = 404;
}
response.SetInteger("statusCode", responseCode);
response.SetInteger("netError", net_error);
response.SetString("netErrorName", net::ErrorToString(net_error));
response.Set("statusCode", responseCode);
response.Set("netError", net_error);
response.Set("netErrorName", net::ErrorToString(net_error));
auto headers = std::make_unique<base::DictionaryValue>();
base::Value::Dict headers;
size_t iterator = 0;
std::string name;
std::string value;
// TODO(caseq): this probably needs to handle duplicate header names
// correctly by folding them.
while (rh && rh->EnumerateHeaderLines(&iterator, &name, &value)) {
headers->SetString(name, value);
headers.Set(name, value);
}
response.Set("headers", std::move(headers));
@@ -424,7 +424,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
base::Value::Dict response;
response.Set("statusCode", 404);
response.Set("urlValid", false);
SendMessageAck(request_id, base::Value(std::move(response)));
SendMessageAck(request_id, std::move(response));
return;
}
@@ -473,8 +473,8 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
std::make_unique<network::WrapperPendingSharedURLLoaderFactory>(
std::move(pending_remote)));
} else if (content::HasWebUIScheme(gurl)) {
base::DictionaryValue response;
response.SetInteger("statusCode", 403);
base::Value::Dict response;
response.Set("statusCode", 403);
SendMessageAck(request_id, std::move(response));
return;
} else {
@@ -491,9 +491,8 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
loaders_.insert(std::move(resource_loader));
return;
} else if (*method == "getPreferences") {
SendMessageAck(
request_id,
base::Value(GetPrefs()->GetDict(prefs::kDevToolsPreferences).Clone()));
SendMessageAck(request_id,
GetPrefs()->GetDict(prefs::kDevToolsPreferences).Clone());
return;
} else if (*method == "setPreference") {
if (params.size() < 2) {
@@ -507,15 +506,15 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
return;
}
DictionaryPrefUpdate update(GetPrefs(), prefs::kDevToolsPreferences);
update.Get()->SetKey(*name, std::move(params[1]));
ScopedDictPrefUpdate update(GetPrefs(), prefs::kDevToolsPreferences);
update->Set(*name, std::move(params[1]));
} else if (*method == "removePreference") {
const std::string* name = params[0].GetIfString();
if (!name) {
return;
}
DictionaryPrefUpdate update(GetPrefs(), prefs::kDevToolsPreferences);
update.Get()->RemoveKey(*name);
ScopedDictPrefUpdate update(GetPrefs(), prefs::kDevToolsPreferences);
update->Remove(*name);
} else if (*method == "requestFileSystems") {
web_contents()->GetPrimaryMainFrame()->ExecuteJavaScriptForTests(
u"DevToolsAPI.fileSystemsLoaded([]);", base::NullCallback());
@@ -561,7 +560,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
}
if (request_id) {
SendMessageAck(request_id, base::Value());
SendMessageAck(request_id, base::Value::Dict());
}
}
@@ -628,9 +627,10 @@ void CefDevToolsFrontend::CallClientFunction(
std::move(arguments), std::move(cb));
}
void CefDevToolsFrontend::SendMessageAck(int request_id, base::Value arg) {
void CefDevToolsFrontend::SendMessageAck(int request_id,
base::Value::Dict arg) {
CallClientFunction("DevToolsAPI", "embedderMessageAck",
base::Value(request_id), std::move(arg));
base::Value(request_id), base::Value(std::move(arg)));
}
bool CefDevToolsFrontend::ProtocolLoggingEnabled() const {

View File

@@ -83,7 +83,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
void PrimaryMainDocumentElementAvailable() override;
void WebContentsDestroyed() override;
void SendMessageAck(int request_id, base::Value arg);
void SendMessageAck(int request_id, base::Value::Dict arg);
bool ProtocolLoggingEnabled() const;
void LogProtocolMessage(ProtocolMessageType type,

View File

@@ -176,8 +176,8 @@ int CefDevToolsManager::ExecuteDevToolsMethod(
CefDictionaryValueImpl* impl =
static_cast<CefDictionaryValueImpl*>(params.get());
CefValueController::AutoLock lock_scope(impl->controller());
return devtools_controller_->ExecuteDevToolsMethod(message_id, method,
impl->GetValueUnsafe());
return devtools_controller_->ExecuteDevToolsMethod(
message_id, method, impl->GetValueUnsafe()->GetIfDict());
} else {
return devtools_controller_->ExecuteDevToolsMethod(message_id, method,
nullptr);

View File

@@ -9,9 +9,9 @@
#include <vector>
#include "base/atomicops.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
@@ -128,7 +128,7 @@ CefDevToolsManagerDelegate::CefDevToolsManagerDelegate() {}
CefDevToolsManagerDelegate::~CefDevToolsManagerDelegate() {}
scoped_refptr<content::DevToolsAgentHost>
CefDevToolsManagerDelegate::CreateNewTarget(const GURL& url) {
CefDevToolsManagerDelegate::CreateNewTarget(const GURL& url, bool for_tab) {
// This is reached when the user selects "Open link in new tab" from the
// DevTools interface.
// TODO(cef): Consider exposing new API to support this.

View File

@@ -26,7 +26,8 @@ class CefDevToolsManagerDelegate : public content::DevToolsManagerDelegate {
// DevToolsManagerDelegate implementation.
scoped_refptr<content::DevToolsAgentHost> CreateNewTarget(
const GURL& url) override;
const GURL& url,
bool for_tab) override;
std::string GetDiscoveryPageHTML() override;
bool HasBundledFrontendResources() override;
};

View File

@@ -12,8 +12,8 @@
#include "libcef/browser/download_item_impl.h"
#include "libcef/browser/thread_util.h"
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"

View File

@@ -15,11 +15,9 @@ CefExtensionImpl::CefExtensionImpl(const extensions::Extension* extension,
CefRefPtr<CefExtensionHandler> handler)
: id_(extension->id()),
path_(extension->path().value()),
manifest_(new CefDictionaryValueImpl(
static_cast<base::DictionaryValue*>(
new base::Value(extension->manifest()->value()->Clone())),
true,
true)),
manifest_(
new CefDictionaryValueImpl(extension->manifest()->value()->Clone(),
/*read_only=*/true)),
loader_context_(loader_context),
handler_(handler) {}

View File

@@ -5,8 +5,8 @@
#include "libcef/browser/extensions/api/file_system/cef_file_system_delegate.h"
#include "apps/saved_files_service.h"
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/functional/callback.h"
#include "chrome/browser/extensions/api/file_system/file_entry_picker.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_contents.h"

View File

@@ -7,8 +7,8 @@
#include <memory>
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/functional/callback.h"
#include "base/memory/ref_counted.h"
#include "extensions/browser/api/execute_code_function.h"
#include "extensions/browser/api/file_system/file_system_delegate.h"

View File

@@ -12,6 +12,7 @@
#include "libcef/browser/extensions/api/tabs/tabs_api.h"
#include "chrome/browser/extensions/api/content_settings/content_settings_api.h"
#include "chrome/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.h"
#include "chrome/browser/extensions/api/resources_private/resources_private_api.h"
#include "extensions/browser/api/alarms/alarms_api.h"
#include "extensions/browser/api/storage/storage_api.h"
@@ -28,8 +29,6 @@ namespace cefimpl = extensions::cef;
// Maintain the same order as https://developer.chrome.com/extensions/api_index
// so chrome://extensions-support looks nice.
const char* const kSupportedAPIs[] = {
"resourcesPrivate",
EXTENSION_FUNCTION_NAME(ResourcesPrivateGetStringsFunction),
"alarms",
EXTENSION_FUNCTION_NAME(AlarmsCreateFunction),
EXTENSION_FUNCTION_NAME(AlarmsGetFunction),
@@ -42,6 +41,10 @@ const char* const kSupportedAPIs[] = {
EXTENSION_FUNCTION_NAME(ContentSettingsContentSettingSetFunction),
EXTENSION_FUNCTION_NAME(
ContentSettingsContentSettingGetResourceIdentifiersFunction),
"pdfViewerPrivate",
EXTENSION_FUNCTION_NAME(PdfViewerPrivateIsAllowedLocalFileAccessFunction),
"resourcesPrivate",
EXTENSION_FUNCTION_NAME(ResourcesPrivateGetStringsFunction),
"storage",
EXTENSION_FUNCTION_NAME(StorageStorageAreaGetFunction),
EXTENSION_FUNCTION_NAME(StorageStorageAreaSetFunction),
@@ -76,7 +79,6 @@ bool ChromeFunctionRegistry::IsSupported(const std::string& name) {
// Only add APIs to this list that have been tested in CEF.
// static
void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
registry->RegisterFunction<ResourcesPrivateGetStringsFunction>();
registry->RegisterFunction<AlarmsCreateFunction>();
registry->RegisterFunction<AlarmsGetFunction>();
registry->RegisterFunction<AlarmsGetAllFunction>();
@@ -87,6 +89,9 @@ void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
registry->RegisterFunction<ContentSettingsContentSettingSetFunction>();
registry->RegisterFunction<
ContentSettingsContentSettingGetResourceIdentifiersFunction>();
registry
->RegisterFunction<PdfViewerPrivateIsAllowedLocalFileAccessFunction>();
registry->RegisterFunction<ResourcesPrivateGetStringsFunction>();
registry->RegisterFunction<StorageStorageAreaGetFunction>();
registry->RegisterFunction<StorageStorageAreaSetFunction>();
registry->RegisterFunction<StorageStorageAreaRemoveFunction>();

View File

@@ -24,7 +24,8 @@ CefComponentExtensionResourceManager::CefComponentExtensionResourceManager() {
base::Value::Dict dict;
pdf_extension_util::AddStrings(
pdf_extension_util::PdfViewerContext::kPdfViewer, &dict);
pdf_extension_util::AddAdditionalData(/*enable_annotations=*/true, &dict);
pdf_extension_util::AddAdditionalData(/*enable_printing=*/true,
/*enable_annotations=*/true, &dict);
ui::TemplateReplacements pdf_viewer_replacements;
ui::TemplateReplacementsFromDictionaryValue(dict, &pdf_viewer_replacements);

View File

@@ -7,7 +7,7 @@
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/extensions/extension_host_delegate.h"
#include "base/callback.h"
#include "base/functional/callback.h"
namespace extensions {

View File

@@ -7,7 +7,7 @@
#include <memory>
#include "base/callback_forward.h"
#include "base/functional/callback_forward.h"
#include "extensions/browser/extension_host.h"
class AlloyBrowserHostImpl;

View File

@@ -9,7 +9,7 @@
#include "include/cef_extension.h"
#include "base/callback_forward.h"
#include "base/functional/callback_forward.h"
#include "chrome/common/extensions/api/tabs.h"
#include "ui/gfx/native_widget_types.h"

View File

@@ -12,10 +12,10 @@
#include "libcef/browser/thread_util.h"
#include "libcef/common/extensions/extensions_util.h"
#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/json/json_string_value_serializer.h"
#include "base/path_service.h"
#include "base/strings/string_tokenizer.h"

View File

@@ -275,11 +275,10 @@ void CefFrameHostImpl::SendProcessMessage(
// Invalidate the message object immediately by taking the argument list.
auto argument_list =
static_cast<CefProcessMessageImpl*>(message.get())->TakeArgumentList();
SendToRenderFrame(
__FUNCTION__,
base::BindOnce(
[](const CefString& name, base::ListValue argument_list,
[](const CefString& name, base::Value::List argument_list,
const RenderFrameType& render_frame) {
render_frame->SendMessage(name, std::move(argument_list));
},
@@ -631,13 +630,12 @@ void CefFrameHostImpl::OnRenderFrameDisconnect() {
}
void CefFrameHostImpl::SendMessage(const std::string& name,
base::Value arguments) {
base::Value::List arguments) {
if (auto browser = GetBrowserHostBase()) {
if (auto client = browser->GetClient()) {
auto& list_value = base::Value::AsListValue(arguments);
CefRefPtr<CefProcessMessageImpl> message(new CefProcessMessageImpl(
name, std::move(const_cast<base::ListValue&>(list_value)),
/*read_only=*/true));
CefRefPtr<CefProcessMessageImpl> message(
new CefProcessMessageImpl(name, std::move(arguments),
/*read_only=*/true));
browser->GetClient()->OnProcessMessageReceived(
browser.get(), this, PID_RENDERER, message.get());
}

View File

@@ -135,7 +135,8 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
content::RenderFrameHost* render_frame_host);
// cef::mojom::BrowserFrame methods forwarded from CefBrowserFrame.
void SendMessage(const std::string& name, base::Value arguments) override;
void SendMessage(const std::string& name,
base::Value::List arguments) override;
void SendSharedMemoryRegion(const std::string& name,
base::ReadOnlySharedMemoryRegion region) override;
void FrameAttached(mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,

View File

@@ -7,7 +7,7 @@
#include <utility>
#include "base/bind.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/threading/thread_checker.h"
#include "content/public/browser/navigation_handle.h"

View File

@@ -10,8 +10,8 @@
#include "libcef/browser/browser_host_base.h"
#include "libcef/browser/thread_util.h"
#include "base/bind.h"
#include "base/callback_helpers.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "components/javascript_dialogs/tab_modal_dialog_manager.h"

View File

@@ -394,6 +394,7 @@ bool CefMainRunner::ContentMainRun(bool* initialized,
if (!CreateUIThread(base::BindOnce(
[](CefMainRunner* runner, base::WaitableEvent* event) {
runner->main_delegate_->BeforeUIThreadInitialize();
content::ContentMainRun(runner->main_runner_.get());
event->Signal();
},
@@ -408,6 +409,7 @@ bool CefMainRunner::ContentMainRun(bool* initialized,
uithread_startup_event.Wait();
} else {
*initialized = true;
main_delegate_->BeforeUIThreadInitialize();
content::ContentMainRun(main_runner_.get());
}

View File

@@ -11,7 +11,7 @@
#include "libcef/common/main_runner_delegate.h"
#include "libcef/common/main_runner_handler.h"
#include "base/callback.h"
#include "base/functional/callback.h"
#include "content/public/browser/browser_main_runner.h"
namespace base {

View File

@@ -10,8 +10,8 @@
#include "libcef/browser/media_stream_registrar.h"
#include "libcef/common/cef_switches.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/functional/callback_helpers.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"
namespace media_access_query {

View File

@@ -5,7 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_
#define CEF_LIBCEF_BROWSER_MEDIA_CAPTURE_DEVICES_DISPATCHER_H_
#include "base/callback.h"
#include "base/functional/callback.h"
#include "base/memory/singleton.h"
#include "base/observer_list.h"
#include "content/public/browser/media_observer.h"

View File

@@ -104,10 +104,6 @@ CefString CefMediaSinkImpl::GetName() {
return sink_.name();
}
CefString CefMediaSinkImpl::GetDescription() {
return sink_.description().value_or("");
}
CefMediaSink::IconType CefMediaSinkImpl::GetIconType() {
// Verify that our enum matches Chromium's values.
static_assert(static_cast<int>(CEF_MSIT_TOTAL_COUNT) ==

View File

@@ -24,7 +24,6 @@ class CefMediaSinkImpl : public CefMediaSink {
// CefMediaSink methods.
CefString GetId() override;
CefString GetName() override;
CefString GetDescription() override;
IconType GetIconType() override;
void GetDeviceInfo(
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) override;

View File

@@ -10,7 +10,7 @@
#include "libcef/browser/thread_util.h"
#include "libcef/common/task_runner_impl.h"
#include "base/bind.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h"
#include "ui/base/accelerators/accelerator.h"

View File

@@ -4,72 +4,12 @@
#include "libcef/browser/native/cursor_util.h"
#include "libcef/browser/browser_host_base.h"
#include "include/cef_client.h"
#include "content/common/cursors/webcursor.h"
#include "content/public/browser/render_widget_host_view.h"
#include "ui/base/cursor/cursor_factory.h"
#include "ui/base/cursor/mojom/cursor_type.mojom.h"
#if defined(USE_AURA)
#include "ui/display/display_util.h"
#include "ui/wm/core/cursor_loader.h"
#endif
namespace cursor_util {
namespace {
#if defined(USE_AURA)
display::ScreenInfo GetScreenInfo(CefRefPtr<CefBrowser> browser) {
display::ScreenInfo screen_info;
bool screen_info_set = false;
if (auto web_contents =
static_cast<CefBrowserHostBase*>(browser.get())->GetWebContents()) {
if (auto view = web_contents->GetRenderWidgetHostView()) {
const auto screen_infos = view->GetScreenInfos();
if (!screen_infos.screen_infos.empty()) {
screen_info = screen_infos.current();
screen_info_set = true;
}
}
}
if (!screen_info_set) {
display::DisplayUtil::GetDefaultScreenInfo(&screen_info);
}
return screen_info;
}
display::Display::Rotation OrientationAngleToRotation(
uint16_t orientation_angle) {
// The Display rotation and the ScreenInfo orientation are not the same
// angle. The former is the physical display rotation while the later is the
// rotation required by the content to be shown properly on the screen, in
// other words, relative to the physical display.
if (orientation_angle == 0) {
return display::Display::ROTATE_0;
}
if (orientation_angle == 90) {
return display::Display::ROTATE_270;
}
if (orientation_angle == 180) {
return display::Display::ROTATE_180;
}
if (orientation_angle == 270) {
return display::Display::ROTATE_90;
}
NOTREACHED();
return display::Display::ROTATE_0;
}
#endif // defined(USE_AURA)
} // namespace
bool OnCursorChange(CefRefPtr<CefBrowser> browser,
const ui::Cursor& ui_cursor) {
auto client = browser->GetHost()->GetClient();
@@ -93,47 +33,10 @@ bool OnCursorChange(CefRefPtr<CefBrowser> browser,
custom_cursor_info.size.height = ui_cursor.custom_bitmap().height();
}
bool handled = false;
#if defined(USE_AURA)
wm::CursorLoader cursor_loader;
scoped_refptr<ui::PlatformCursor> platform_cursor;
CefCursorHandle native_cursor = kNullCursorHandle;
ui::Cursor loaded_cursor = ui_cursor;
if (ui_cursor.type() == ui::mojom::CursorType::kCustom) {
platform_cursor = ui::CursorFactory::GetInstance()->CreateImageCursor(
ui::mojom::CursorType::kCustom, ui_cursor.custom_bitmap(),
ui_cursor.custom_hotspot());
} else {
const auto& screen_info = GetScreenInfo(browser);
cursor_loader.SetDisplayData(
OrientationAngleToRotation(screen_info.orientation_angle),
screen_info.device_scale_factor);
// Attempts to load the cursor via the platform or from pak resources.
cursor_loader.SetPlatformCursor(&loaded_cursor);
platform_cursor = loaded_cursor.platform();
}
if (platform_cursor) {
native_cursor = cursor_util::ToCursorHandle(platform_cursor);
}
handled = handler->OnCursorChange(browser, native_cursor, cursor_type,
custom_cursor_info);
#elif BUILDFLAG(IS_MAC)
// |web_cursor| owns the resulting |native_cursor|.
content::WebCursor web_cursor(ui_cursor);
CefCursorHandle native_cursor = web_cursor.GetNativeCursor();
handled = handler->OnCursorChange(browser, native_cursor, cursor_type,
custom_cursor_info);
#else
NOTIMPLEMENTED();
#endif
return handled;
auto scoped_cursor_handle(ScopedCursorHandle::Create(browser, ui_cursor));
return handler->OnCursorChange(browser,
scoped_cursor_handle->GetCursorHandle(),
cursor_type, custom_cursor_info);
}
} // namespace cursor_util

View File

@@ -7,6 +7,8 @@
#include "include/cef_browser.h"
#include <memory>
#include "ui/base/cursor/cursor.h"
#include "ui/base/cursor/mojom/cursor_type.mojom-forward.h"
@@ -16,9 +18,17 @@
namespace cursor_util {
#if defined(USE_AURA)
cef_cursor_handle_t ToCursorHandle(scoped_refptr<ui::PlatformCursor> cursor);
#endif // defined(USE_AURA)
// Scoped ownership of a native cursor handle.
class ScopedCursorHandle {
public:
virtual ~ScopedCursorHandle() = default;
static std::unique_ptr<ScopedCursorHandle> Create(
CefRefPtr<CefBrowser> browser,
const ui::Cursor& ui_cursor);
virtual cef_cursor_handle_t GetCursorHandle() = 0;
};
// Returns true if the client handled the cursor change.
bool OnCursorChange(CefRefPtr<CefBrowser> browser, const ui::Cursor& ui_cursor);

View File

@@ -0,0 +1,153 @@
// Copyright 2023 The Chromium Embedded Framework Authors. Portions copyright
// 2012 The Chromium Authors. All rights reserved. Use of this source code is
// governed by a BSD-style license that can be found in the LICENSE file.
#include "libcef/browser/native/cursor_util.h"
#include "libcef/browser/browser_host_base.h"
#include "content/common/cursors/webcursor.h"
#include "content/public/browser/render_widget_host_view.h"
#include "ui/base/cursor/cursor_factory.h"
#include "ui/base/cursor/mojom/cursor_type.mojom.h"
#include "ui/display/display_util.h"
#include "ui/wm/core/cursor_loader.h"
#if BUILDFLAG(IS_LINUX)
#include "ui/ozone/buildflags.h"
#if BUILDFLAG(OZONE_PLATFORM_X11)
#include "ui/base/x/x11_cursor.h"
#elif BUILDFLAG(IS_OZONE)
#include "ui/ozone/common/bitmap_cursor.h"
#endif
#endif // BUILDFLAG(IS_LINUX)
#if BUILDFLAG(IS_WIN)
#include "ui/base/win/win_cursor.h"
#endif
namespace cursor_util {
namespace {
display::ScreenInfo GetScreenInfo(CefRefPtr<CefBrowser> browser) {
display::ScreenInfo screen_info;
bool screen_info_set = false;
if (auto web_contents =
static_cast<CefBrowserHostBase*>(browser.get())->GetWebContents()) {
if (auto view = web_contents->GetRenderWidgetHostView()) {
const auto screen_infos = view->GetScreenInfos();
if (!screen_infos.screen_infos.empty()) {
screen_info = screen_infos.current();
screen_info_set = true;
}
}
}
if (!screen_info_set) {
display::DisplayUtil::GetDefaultScreenInfo(&screen_info);
}
return screen_info;
}
display::Display::Rotation OrientationAngleToRotation(
uint16_t orientation_angle) {
// The Display rotation and the ScreenInfo orientation are not the same
// angle. The former is the physical display rotation while the later is the
// rotation required by the content to be shown properly on the screen, in
// other words, relative to the physical display.
if (orientation_angle == 0) {
return display::Display::ROTATE_0;
}
if (orientation_angle == 90) {
return display::Display::ROTATE_270;
}
if (orientation_angle == 180) {
return display::Display::ROTATE_180;
}
if (orientation_angle == 270) {
return display::Display::ROTATE_90;
}
NOTREACHED();
return display::Display::ROTATE_0;
}
scoped_refptr<ui::PlatformCursor> ToPlatformCursor(
CefRefPtr<CefBrowser> browser,
const ui::Cursor& ui_cursor) {
wm::CursorLoader cursor_loader;
scoped_refptr<ui::PlatformCursor> platform_cursor;
ui::Cursor loaded_cursor = ui_cursor;
if (ui_cursor.type() == ui::mojom::CursorType::kCustom) {
platform_cursor = ui::CursorFactory::GetInstance()->CreateImageCursor(
ui::mojom::CursorType::kCustom, ui_cursor.custom_bitmap(),
ui_cursor.custom_hotspot());
} else {
const auto& screen_info = GetScreenInfo(browser);
cursor_loader.SetDisplayData(
OrientationAngleToRotation(screen_info.orientation_angle),
screen_info.device_scale_factor);
// Attempts to load the cursor via the platform or from pak resources.
cursor_loader.SetPlatformCursor(&loaded_cursor);
platform_cursor = loaded_cursor.platform();
}
return platform_cursor;
}
#if BUILDFLAG(IS_WIN)
using CursorType = ui::WinCursor;
inline cef_cursor_handle_t GetCursorHandleImpl(CursorType* cursor) {
return cursor->hcursor();
}
#elif BUILDFLAG(OZONE_PLATFORM_X11)
// See https://crbug.com/1029142 for background.
using CursorType = ui::X11Cursor;
inline cef_cursor_handle_t GetCursorHandleImpl(CursorType* cursor) {
return static_cast<cef_cursor_handle_t>(cursor->xcursor());
}
#elif BUILDFLAG(IS_OZONE)
using CursorType = ui::BitmapCursor;
inline cef_cursor_handle_t GetCursorHandleImpl(CursorType* cursor) {
return static_cast<cef_cursor_handle_t>(cursor->platform_data());
}
#else
#error Unsupported platform
#endif
class ScopedCursorHandleImpl : public ScopedCursorHandle {
public:
explicit ScopedCursorHandleImpl(
scoped_refptr<ui::PlatformCursor> platform_cursor) {
if (platform_cursor) {
cursor_ = CursorType::FromPlatformCursor(platform_cursor);
}
}
cef_cursor_handle_t GetCursorHandle() override {
if (cursor_) {
return GetCursorHandleImpl(cursor_.get());
}
return kNullCursorHandle;
}
private:
scoped_refptr<CursorType> cursor_;
};
} // namespace
// static
std::unique_ptr<ScopedCursorHandle> ScopedCursorHandle::Create(
CefRefPtr<CefBrowser> browser,
const ui::Cursor& ui_cursor) {
return std::make_unique<ScopedCursorHandleImpl>(
ToPlatformCursor(browser, ui_cursor));
}
} // namespace cursor_util

View File

@@ -1,30 +0,0 @@
// Copyright 2020 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/native/cursor_util.h"
#include "ui/ozone/buildflags.h"
#if BUILDFLAG(OZONE_PLATFORM_X11)
#include "ui/base/x/x11_cursor.h"
#elif BUILDFLAG(IS_OZONE)
#include "ui/ozone/common/bitmap_cursor.h"
#endif
namespace cursor_util {
cef_cursor_handle_t ToCursorHandle(scoped_refptr<ui::PlatformCursor> cursor) {
#if BUILDFLAG(OZONE_PLATFORM_X11)
// See https://crbug.com/1029142 for background.
return static_cast<cef_cursor_handle_t>(
ui::X11Cursor::FromPlatformCursor(cursor)->xcursor());
#elif BUILDFLAG(IS_OZONE)
return static_cast<cef_cursor_handle_t>(
ui::BitmapCursor::FromPlatformCursor(cursor)->platform_data());
#else
return 0;
#endif
}
} // namespace cursor_util

View File

@@ -0,0 +1,38 @@
// Copyright 2023 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/native/cursor_util.h"
#import "base/mac/scoped_nsobject.h"
#import "ui/base/cocoa/cursor_utils.h"
namespace cursor_util {
namespace {
class ScopedCursorHandleImpl : public ScopedCursorHandle {
public:
explicit ScopedCursorHandleImpl(NSCursor* native_cursor) {
if (native_cursor) {
cursor_.reset([native_cursor retain]);
}
}
cef_cursor_handle_t GetCursorHandle() override { return cursor_.get(); }
private:
base::scoped_nsobject<NSCursor> cursor_;
};
} // namespace
// static
std::unique_ptr<ScopedCursorHandle> ScopedCursorHandle::Create(
CefRefPtr<CefBrowser> /*browser*/,
const ui::Cursor& ui_cursor) {
return std::make_unique<ScopedCursorHandleImpl>(
ui::GetNativeCursor(ui_cursor));
}
} // namespace cursor_util

View File

@@ -1,15 +0,0 @@
// Copyright 2020 The Chromium Embedded Framework Authors. Portions copyright
// 2012 The Chromium Authors. All rights reserved. Use of this source code is
// governed by a BSD-style license that can be found in the LICENSE file.
#include "libcef/browser/native/cursor_util.h"
#include "ui/base/win/win_cursor.h"
namespace cursor_util {
cef_cursor_handle_t ToCursorHandle(scoped_refptr<ui::PlatformCursor> cursor) {
return ui::WinCursor::FromPlatformCursor(cursor)->hcursor();
}
} // namespace cursor_util

View File

@@ -9,7 +9,7 @@
#include "libcef/browser/javascript_dialog_runner.h"
#include "base/callback.h"
#include "base/functional/callback.h"
#include "base/mac/scoped_nsobject.h"
#include "base/memory/weak_ptr.h"

View File

@@ -7,7 +7,7 @@
#import <Cocoa/Cocoa.h>
#include "base/bind.h"
#include "base/functional/bind.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "components/url_formatter/elide_url.h"

View File

@@ -314,7 +314,7 @@ bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) {
"<html>\n<head><title>Extensions Support</title></head>\n"
"<body bgcolor=\"white\"><h3>Supported Chrome Extensions "
"APIs</h3>\nFollow <a "
"href=\"https://bitbucket.org/chromiumembedded/cef/issues/1947\" "
"href=\"https://github.com/chromiumembedded/cef/issues/1947\" "
"target=\"new\">issue #1947</a> for development progress.\n<ul>\n";
bool has_top_level_name = false;

View File

@@ -7,7 +7,7 @@
#include "libcef/browser/thread_util.h"
#include "libcef/common/net_service/net_service_util.h"
#include "base/bind.h"
#include "base/functional/bind.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/url_constants.h"

View File

@@ -7,7 +7,7 @@
#include "libcef/browser/browser_context.h"
#include "base/callback_forward.h"
#include "base/functional/callback_forward.h"
#include "net/cookies/canonical_cookie.h"
namespace net {

View File

@@ -7,7 +7,7 @@
#include "libcef/common/net_service/net_service_util.h"
#include "libcef/common/time_util.h"
#include "base/bind.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"

View File

@@ -9,7 +9,7 @@
#include "libcef/browser/thread_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/task/sequenced_task_runner.h"
#include "content/public/browser/global_request_id.h"
#include "content/public/browser/web_contents.h"
@@ -21,7 +21,7 @@ class AuthCallbackImpl : public CefAuthCallback {
public:
explicit AuthCallbackImpl(base::WeakPtr<LoginDelegate> delegate)
: delegate_(delegate),
task_runner_(base::SequencedTaskRunnerHandle::Get()) {}
task_runner_(base::SequencedTaskRunner::GetCurrentDefault()) {}
AuthCallbackImpl(const AuthCallbackImpl&) = delete;
AuthCallbackImpl& operator=(const AuthCallbackImpl&) = delete;

View File

@@ -760,8 +760,8 @@ void InterceptedRequest::InterceptResponseReceived(
current_response_->headers = headers;
current_response_->encoded_data_length = headers->raw_headers().length();
current_response_->content_length = current_response_->encoded_body_length =
0;
current_response_->content_length = 0;
current_response_->encoded_body_length = 0;
std::string origin;
if (request_.headers.GetHeader(net::HttpRequestHeaders::kOrigin, &origin) &&
@@ -917,8 +917,8 @@ net::RedirectInfo InterceptedRequest::MakeRedirectResponseAndInfo(
net::HttpRequestHeaders::kContentType);
// Clear the Content-Length values.
current_response_->content_length = current_response_->encoded_body_length =
0;
current_response_->content_length = 0;
current_response_->encoded_body_length = 0;
current_response_->headers->RemoveHeader(
net::HttpRequestHeaders::kContentLength);

View File

@@ -8,8 +8,8 @@
#include "libcef/browser/net_service/stream_reader_url_loader.h"
#include "base/callback.h"
#include "base/containers/unique_ptr_adapters.h"
#include "base/functional/callback.h"
#include "base/hash/hash.h"
#include "base/strings/string_piece.h"
#include "content/public/browser/content_browser_client.h"

View File

@@ -20,7 +20,8 @@ class SkipCallbackWrapper : public CefResourceSkipCallback {
public:
explicit SkipCallbackWrapper(InputStream::SkipCallback callback)
: callback_(std::move(callback)),
work_thread_task_runner_(base::SequencedTaskRunnerHandle::Get()) {}
work_thread_task_runner_(
base::SequencedTaskRunner::GetCurrentDefault()) {}
SkipCallbackWrapper(const SkipCallbackWrapper&) = delete;
SkipCallbackWrapper& operator=(const SkipCallbackWrapper&) = delete;
@@ -59,7 +60,8 @@ class ReadCallbackWrapper : public CefResourceReadCallback {
public:
explicit ReadCallbackWrapper(InputStream::ReadCallback callback)
: callback_(std::move(callback)),
work_thread_task_runner_(base::SequencedTaskRunnerHandle::Get()) {}
work_thread_task_runner_(
base::SequencedTaskRunner::GetCurrentDefault()) {}
ReadCallbackWrapper(const ReadCallbackWrapper&) = delete;
ReadCallbackWrapper& operator=(const ReadCallbackWrapper&) = delete;
@@ -314,7 +316,8 @@ class OpenCallbackWrapper : public CefCallback {
std::unique_ptr<InputStreamWrapper> stream)
: callback_(std::move(callback)),
stream_(std::move(stream)),
work_thread_task_runner_(base::SequencedTaskRunnerHandle::Get()) {}
work_thread_task_runner_(
base::SequencedTaskRunner::GetCurrentDefault()) {}
OpenCallbackWrapper(const OpenCallbackWrapper&) = delete;
OpenCallbackWrapper& operator=(const OpenCallbackWrapper&) = delete;

View File

@@ -48,7 +48,8 @@ class RequestCallbackWrapper : public CefCallback {
using Callback = base::OnceCallback<void(bool /* allow */)>;
explicit RequestCallbackWrapper(Callback callback)
: callback_(std::move(callback)),
work_thread_task_runner_(base::SequencedTaskRunnerHandle::Get()) {}
work_thread_task_runner_(
base::SequencedTaskRunner::GetCurrentDefault()) {}
RequestCallbackWrapper(const RequestCallbackWrapper&) = delete;
RequestCallbackWrapper& operator=(const RequestCallbackWrapper&) = delete;

View File

@@ -5,7 +5,7 @@
#ifndef CEF_LIBCEF_BROWSER_NET_SERVICE_RESOURCE_REQUEST_HANDLER_WRAPPER_H_
#define CEF_LIBCEF_BROWSER_NET_SERVICE_RESOURCE_REQUEST_HANDLER_WRAPPER_H_
#include "base/callback_forward.h"
#include "base/functional/callback_forward.h"
#include "content/public/browser/web_contents.h"
namespace content {

View File

@@ -7,7 +7,7 @@
#include "include/cef_response_filter.h"
#include "base/callback_forward.h"
#include "base/functional/callback_forward.h"
#include "mojo/public/cpp/system/data_pipe.h"
namespace net_service {

View File

@@ -8,14 +8,14 @@
#include "libcef/browser/thread_util.h"
#include "libcef/common/net_service/net_service_util.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/threading/thread.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/io_buffer.h"
#include "net/http/http_status_code.h"
@@ -45,7 +45,7 @@ class OpenInputStreamWrapper
OnInputStreamOpenedCallback callback) {
scoped_refptr<OpenInputStreamWrapper> wrapper = new OpenInputStreamWrapper(
std::move(delegate), work_thread_task_runner,
base::ThreadTaskRunnerHandle::Get(), std::move(callback));
base::SingleThreadTaskRunner::GetCurrentDefault(), std::move(callback));
wrapper->Start(request_id, request);
return wrapper->GetCancelCallback();
@@ -242,7 +242,8 @@ InputStreamReader::InputStreamReader(
scoped_refptr<base::SequencedTaskRunner> work_thread_task_runner)
: stream_(std::move(stream)),
work_thread_task_runner_(work_thread_task_runner),
job_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()) {
job_thread_task_runner_(
base::SingleThreadTaskRunner::GetCurrentDefault()) {
CEF_REQUIRE_IOT();
DCHECK(stream_);
DCHECK(work_thread_task_runner_);
@@ -485,7 +486,7 @@ StreamReaderURLLoader::StreamReaderURLLoader(
response_delegate_(std::move(response_delegate)),
writable_handle_watcher_(FROM_HERE,
mojo::SimpleWatcher::ArmingPolicy::MANUAL,
base::SequencedTaskRunnerHandle::Get()),
base::SequencedTaskRunner::GetCurrentDefault()),
weak_factory_(this) {
DCHECK(response_delegate_);
// If there is a client error, clean up the request.
@@ -696,8 +697,8 @@ void StreamReaderURLLoader::ContinueWithResponseHeaders(
const auto has_redirect_url = redirect_url && !redirect_url->is_empty();
if (has_redirect_url || pending_headers->IsRedirect(&location)) {
pending_response->encoded_data_length = header_length_;
pending_response->content_length = pending_response->encoded_body_length =
0;
pending_response->content_length = 0;
pending_response->encoded_body_length = 0;
const GURL new_location =
has_redirect_url ? *redirect_url : request_.url.Resolve(location);
client_->OnReceiveRedirect(
@@ -794,7 +795,7 @@ void StreamReaderURLLoader::OnReaderReadCompleted(int bytes_read) {
client_->OnTransferSizeUpdated(bytes_read);
total_bytes_read_ += bytes_read;
base::ThreadTaskRunnerHandle::Get()->PostTask(
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE, base::BindOnce(&StreamReaderURLLoader::ReadMore,
weak_factory_.GetWeakPtr()));
}

View File

@@ -8,7 +8,7 @@
#include <map>
#include "base/callback.h"
#include "base/functional/callback.h"
#include "base/threading/thread_checker.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/simple_watcher.h"

View File

@@ -8,7 +8,7 @@
#include "libcef/browser/thread_util.h"
#include "libcef/common/app_manager.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/task/single_thread_task_runner.h"
#include "content/browser/devtools/devtools_instrumentation.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/public/browser/browser_context.h"
@@ -90,7 +90,7 @@ scoped_refptr<network::SharedURLLoaderFactory>
URLLoaderFactoryGetter::GetURLLoaderFactory() {
// On first call we associate with the current thread.
if (!task_runner_) {
task_runner_ = base::ThreadTaskRunnerHandle::Get();
task_runner_ = base::SingleThreadTaskRunner::GetCurrentDefault();
} else {
DCHECK(task_runner_->RunsTasksInCurrentSequence());
}

View File

@@ -12,7 +12,7 @@
#include "libcef/browser/context.h"
#include "libcef/browser/thread_util.h"
#include "base/bind.h"
#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/synchronization/lock.h"
#include "cef/libcef/common/mojom/cef.mojom.h"

View File

@@ -7,7 +7,7 @@
#include <memory>
#include "base/callback.h"
#include "base/functional/callback.h"
#include "base/memory/shared_memory_mapping.h"
#include "components/viz/host/host_display_client.h"
#include "ui/gfx/native_widget_types.h"

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