Compare commits

..

64 Commits
5790 ... 5993

Author SHA1 Message Date
Marshall Greenblatt
99817d2d3e Add workaround for https://crbug.com/1500371 (see #3597) 2023-11-07 18:18:18 -05:00
Marshall Greenblatt
9d1cdd020f mac: Update CSS on fullscreen window exit (fixes #3597) 2023-11-07 18:18:07 -05:00
Marshall Greenblatt
38848f1780 chrome: Hit-test PiP draggable regions before resize border (see #3566) 2023-11-06 16:26:26 -05:00
Marshall Greenblatt
7e736457a0 Update to Chromium version 118.0.5993.119 2023-10-27 17:20:56 +00:00
Marshall Greenblatt
e44bee14d7 Update to Chromium version 118.0.5993.117 2023-10-25 14:25:21 +00:00
Marshall Greenblatt
7b7a3d79cb ceftests: More cleanup of TestHandler::OnTestTimeout 2023-10-23 15:44:29 -04:00
Marshall Greenblatt
3cffa57544 Update to Chromium version 118.0.5993.96 2023-10-20 16:16:04 +00:00
Marshall Greenblatt
3edd46ec8c ceftests: Simplify completion for tests that don't just create browsers
Some test cases don't create browsers at all, or require additional signals
such as request context destruction.

To test: Run `ceftests --gtest_filter=URLRequestTest.*`
2023-10-18 15:44:38 -04:00
Marshall Greenblatt
4d25f5dc55 ceftests: Fix flaky URLRequestTest due to server response timing
In some cases the browser may be closed before the server response is sent.
2023-10-18 15:44:29 -04:00
Nik Pavlov
8121d5ce4a Update ipc_performance_test to compare similar transfers (see #3502) 2023-10-18 15:44:22 -04:00
Marshall Greenblatt
781b53f5d6 chrome: views: Fix close of popup windows when parent is destroyed
When running ceftests with Views enabled always close the CefWindow
when the browser is destroyed and wait for both CefBrowser and
CefWindow destruction before signaling test completion.

To test:
Run `ceftests --enable-chrome-runtime --use-views
     --gtest_filter=FrameHandlerTest.OrderMainPopup*:RequestContextTest.PopupNavDestroyParent*`
2023-10-17 11:51:36 -04:00
Marshall Greenblatt
acc7a9429e ceftests: Change CreateTestRequestContext to async usage
With Chrome runtime, custom request contexts may be initialized asynchronously.
Wait for that initialization before using the request context.

This also removes TEST_RC_MODE_CUSTOM (uses TEST_RC_MODE_CUSTOM_WITH_HANDLER
instead) since we always need a handler to get the initialization callback.
2023-10-17 11:51:26 -04:00
Marshall Greenblatt
3280fe289b chrome: Support configuration of Chrome policy management (fixes #3581)
Disable Chrome policy management by default. Add CefSettings.chrome_policy_id
which, when configured, enables Chrome policy management. See
https://support.google.com/chrome/a/answer/9037717 for background.

To test:
- Start with a machine where Google Chrome is managed.
- Run `cefclient --enable-chrome-runtime --url=chrome://policy/`
  There should be no configured policies.
- Run `cefclient --enable-chrome-runtime --url=chrome://policy/
       --enable-chrome-policy`
  Configured Platform properties should match Google Chrome.
- Run `cefclient --enable-chrome-runtime --url=chrome://policy/
       --enable-chrome-policy --enable-chrome-browser-cloud-management`
  Configured Platform and Cloud properties should match Google Chrome.
2023-10-17 11:51:19 -04:00
Nik Pavlov
e798bbfe5d Replace ReadOnlySharedMemoryRegion with WritableSharedMemoryRegion (see #3502)
Write access to the shared memory region is required because JavaScript lacks
the capability to create read-only ArrayBuffers. When a user attempts to modify
an ArrayBuffer that utilizes a ReadOnlySharedMemoryRegion as its BackingStore
it triggers an access violation.

Note that this pull request may be reverted in the future if JavaScript adds
read-only ArrayBuffer support.
2023-10-17 11:51:10 -04:00
Marshall Greenblatt
3dd6078497 Fix incorrect includes (see #3284) 2023-10-09 13:17:22 -04:00
Marshall Greenblatt
17a5eaab75 Remove CefBrowserSettings.accept_language_list (fixes #3555)
Chromium does not support configuration of this value on a per-Browser basis.
2023-10-05 18:44:17 -04:00
Marshall Greenblatt
4ae2ce0a99 chrome: Set prefs for accept_language_list on Profile init (fixes #3579) 2023-10-05 18:44:09 -04:00
Marshall Greenblatt
721b365c10 Add new CanZoom/Zoom API (fixes #3284)
Add a simpler CanZoom/Zoom API as an alternative to the more error-prone
SetZoomLevel/GetZoomLevel API. Both APIs are now implemented for both runtimes.
With the Chrome runtime a zoom notification bubble will be displayed unless
CefBrowserSettings.chrome_zoom_bubble is set to STATE_DISABLED.

To test:
- Run cefclient and select zoom entries from the Tests menu.
- chrome: Run cefclient with `--hide-chrome-bubbles` command-line flag to hide
  the zoom notification bubble.
2023-10-05 13:33:49 -04:00
Nik Pavlov
238aa32bc2 Remove unnecessary copy during CefBinaryValue creation (see #3502) 2023-10-05 13:33:42 -04:00
Nik Pavlov
afab3ea942 Avoid signed integer overflow UB in IdGenerator 2023-10-05 13:33:35 -04:00
Cristian Amarie
adbbeab600 Add CefDragData::GetFilePaths to return file paths (fixes #3568)
GetFileNames now returns just the display names with a fallback to
path.BaseName() if the display name is empty.
2023-10-05 13:33:28 -04:00
Marshall Greenblatt
240f1b5b46 Update to Chromium version 118.0.5993.54 2023-10-05 13:36:41 +00:00
Marshall Greenblatt
d6ce292260 Add missing media router prefs registration (fixes #3570) 2023-09-29 16:02:29 -04:00
Marshall Greenblatt
7a4669ad49 chrome: Standardize fullscreen transition behavor/callbacks (fixes #3571)
Use the same code path for all fullscreen transitions so that Chrome UI updates
correctly. All user-initiated fullscreen transitions now result in
CefWindowDelegate::OnWindowFullscreenTransition callbacks.
2023-09-29 16:00:29 -04:00
Marshall Greenblatt
4ac1d370e1 cefclient: Use HTTPS for test URLs
Some features that we wish to test require HTTPS. Also, Chrome runtime is
redirecting HTTP URLs to HTTPS due to HSTS.
2023-09-29 16:00:23 -04:00
Marshall Greenblatt
13557bb259 Update to Chromium version 118.0.5993.32 2023-09-29 16:00:37 +00:00
Marshall Greenblatt
81813f3a21 Update to Chromium version 118.0.5993.22 2023-09-21 14:11:46 -04:00
Marshall Greenblatt
27c6a4eabc Update to Chromium version 118.0.5993.0 (#1192594) 2023-09-20 12:07:47 -04:00
Marshall Greenblatt
4df2933516 alloy: Disable DocumentPictureInPictureAPI feature (see #3448)
This feature is default-enabled in M116+ but is not supported by the
Alloy runtime.
2023-09-20 12:07:46 -04:00
Marshall Greenblatt
57d7d89b53 Remove cef_template_util.h (see #3362)
This file is no longer required after cherry-picking C++17 migration
changes from https://crbug.com/1320019.

This also fixes compile errors with Xcode 15:
__has_trivial_destructor is deprecated; use __is_trivially_destructible instead
2023-09-20 12:07:46 -04:00
Marshall Greenblatt
cab404578d Add new Go project to README.md 2023-09-18 19:48:27 +00:00
Marshall Greenblatt
ef6ae3071d chrome: Support frameless document PiP window with draggable regions (fixes #3566) 2023-09-14 12:41:24 -04:00
Nik Pavlov
b064ba08f3 Use python3.bat in cef_create_projects.bat 2023-09-11 15:15:26 +00:00
Marshall Greenblatt
f808926fbd chrome: Add support for CefBrowserViewDelegate::OnGestureCommand 2023-08-31 13:28:27 -04:00
Marshall Greenblatt
f4ecc23213 Disable Chromium field trials in official builds (fixes #3560) 2023-08-30 13:21:06 -04:00
Marshall Greenblatt
0a633e361b win: Fix stickyness of force-[light|dark]-mode on theme change (see #3534) 2023-08-29 15:24:49 -04:00
Marshall Greenblatt
2133d8f5b3 mac: Add support for force-[light|dark]-mode flags (see #3534) 2023-08-29 14:38:18 -04:00
Marshall Greenblatt
445da33efe win: Enable Rust dependencies for x86 builds (see #3553) 2023-08-16 19:09:46 -04:00
Marshall Greenblatt
a4b27a7248 Update to Chromium version 117.0.5938.0 (#1181205) 2023-08-15 12:07:58 -04:00
Marshall Greenblatt
52cb08b973 win: Reduce length of command line for combine_libs.py
This fixes "command line is too long" error when running make_distrib.py.
2023-08-15 12:07:57 -04:00
Marshall Greenblatt
52a9794659 win: Add delayloads to libcef.dll and exe targets
Delay-load as many DLLs as possible for sandbox and startup perf
improvements.
2023-08-15 12:07:57 -04:00
Marshall Greenblatt
605c2bac86 win: Add support for --force-light-mode command-line flag (fixes #3534)
Like the existing --force-dark-mode flag.
2023-08-09 15:16:11 -04:00
Julien Bouix
01e1a0f44d alloy: Add setting to customize log items 2023-08-07 13:40:40 -04:00
Marshall Greenblatt
52b4d7ba5a Fix content_shell build with CEF enabled 2023-07-28 11:54:50 -04:00
Marshall Greenblatt
94d51ffe20 win: Fix implicit conversion changes signedness error 2023-07-25 15:08:42 -04:00
Marshall Greenblatt
4fc5fb8690 mac: tests: Fix NOTREACHED with ViewsTextfieldTest.TextfieldKeyEvent 2023-07-24 16:03:39 -04:00
Marshall Greenblatt
b07a9e1843 mac: cefclient: Fix deprecation warnings 2023-07-24 12:57:37 -04:00
Marshall Greenblatt
8b46735b79 Update to Chromium version 117.0.5895.0 (#1171312) 2023-07-20 18:11:34 -04:00
Marshall Greenblatt
1353677a98 Don't run UI thread tasks after calling CefQuitMessageLoop
This avoids a situation where misbehaving clients may cause the
application to continue running indefinitely by posting new UI
thread tasks after calling CefQuitMessageLoop.
2023-07-11 15:59:52 +03:00
Marshall Greenblatt
a576150ab5 cefclient: mac: Fix type conversion error with Xcode 2023-07-06 13:19:51 +03:00
Marshall Greenblatt
7a033d7585 chrome: linux: Fix NativeWidgetType for bubble popups 2023-07-04 16:38:44 +03:00
Marshall Greenblatt
1f11ce8700 chrome: mac: Keep bubble popups on-screen 2023-07-04 16:38:44 +03:00
Marshall Greenblatt
59bfb32221 cefclient: views: Add option for bottom controls placement
Run with the `--use-bottom-controls` command-line flag to place all controls
at the bottom of the window instead of the top.
2023-07-04 16:38:44 +03:00
Marshall Greenblatt
04c042d9d1 linux: Fix invalid argument type in CHECK 2023-06-28 11:46:38 +03:00
Marshall Greenblatt
8603545aef tests: Fix timing issue with DownloadTest.ClickedInvalid 2023-06-28 11:43:11 +03:00
Marshall Greenblatt
650755a092 Update to Chromium version 116.0.5845.0 (#1160321) 2023-06-28 11:43:11 +03:00
Marshall Greenblatt
71c588c16a alloy: mac/linux: Support OS execution via OnProtocolExecution (fixes #1340) 2023-06-26 13:08:04 +03:00
Marshall Greenblatt
0b99f92e97 views: Add support for modal browser dialogs
A modal dialog is a child CefWindow that implements some special behaviors
relative to a parent CefWindow. Like any CefWindow it can be framed with
titlebar or frameless, and optionally contain draggable regions (subject to
platform limitations described below). Modal dialogs are shown centered on
the parent window (inside a single display) and always stay on top of the
parent window in z-order. Sizing behavior and available window buttons are
controlled via the usual CefWindowDelegate callbacks. For example, the dialog
can have a preferred size with resize, minimize and maximize disabled (via
GetPreferredSize, CanResize, CanMinimize and CanMaximize respectively).

This change adds support for two modality modes. With window modality all
controls in the parent window are disabled. With browser modality only the
browser view in the parent window is disabled.

Both modality modes require that a valid parent window be returned via
GetParentWindow. For window modality return true from IsWindowModalDialog
and call CefWindow::Show. For browser modality return false from
IsWindowModalDialog (the default value) and call
CefWindow::ShowAsBrowserModalDialog with a reference to the parent window's
browser view.

Window modal dialog behavior depends on the platform. On Windows and
Linux these dialogs have a titlebar and can be moved independent of the
parent window. On macOS these dialogs do not have a titlebar, move with
the parent window, and do not support draggable regions (because they are
implemented using sheets). On Linux disabling the parent window controls
requires a window manager the supports _NET_WM_STATE_MODAL.

Browser modal dialog behavior is similar on all platforms. The dialog will
be automatically sized and positioned relative to the parent window's
browser view. Closing the parent window or navigating the parent browser
view will dismiss the dialog. The dialog can also be moved independent of
the parent window though it will be recentered when the parent window
itself is resized or redisplayed. On MacOS the dialog will move along with
the parent window while on Windows and Linux the parent window can be moved
independently.

To test: Use the Tests > Dialog Window menu option in cefclient with Views
enabled (`--use-views` or `--enable-chrome-runtime` command-line flag).
Browser modal dialog is the default behavior. For window modal dialog add
the `--use-window-modal-dialog` command-line flag.
2023-06-21 11:18:24 +03:00
Marshall Greenblatt
05930b7bc9 views: win: Use black title bar with dark mode 2023-06-21 11:18:16 +03:00
Marshall Greenblatt
12d0bccbd4 mac: Fix char16_t declaration error with Xcode 14.2 (fixes #3526) 2023-06-07 13:25:23 +03:00
Marshall Greenblatt
b5386249bd alloy: Remove CefSettings.user_data_path (fixes #3511)
This change replaces existing CefSettings.user_data_path usage with
CefSettings.root_cache_path for better alignment with the Chrome runtime.
All files should now be written inside the root_cache_path directory.
2023-06-06 17:41:57 +03:00
Chris Frank
36a645ffd8 linux: alloy: Fix window resize after context menu dismissal (fixes #3466) 2023-06-06 12:33:52 +00:00
Marshall Greenblatt
3bd2cd78c7 mac: Fix <uchar.h> not available with Xcode < 14.3 (fixes #3526) 2023-06-06 14:43:20 +03:00
Marshall Greenblatt
cbdda6b03b mac: chrome: Fix crash in BrowserView::ShouldHideUIForFullscreen (fixes #3527) 2023-06-06 12:05:02 +03:00
271 changed files with 4796 additions and 2571 deletions

View File

@@ -1157,8 +1157,6 @@ source_set("libcef_static") {
"//chrome/app/chrome_main_mac.h",
"//chrome/app/chrome_main_mac.mm",
]
configs += [ "//build/config/compiler:enable_arc" ]
}
if (ozone_platform_x11) {
@@ -1607,7 +1605,6 @@ if (is_mac) {
configs += [
":libcef_autogen_config",
"//build/config/compiler:enable_arc",
]
# We don't link the framework so just use the path from the main executable.
@@ -1674,6 +1671,10 @@ if (is_mac) {
# ResourceBundle. See crbug.com/147663.
"//ui/resources:ui_unscaled_resources_grd",
]
# Delay-load as many DLLs as possible for sandbox and startup perf
# improvements.
configs += [ "//build/config/win:delayloads" ]
}
if (is_linux && !is_debug && !use_partition_alloc_as_malloc) {
@@ -2176,6 +2177,10 @@ if (is_mac) {
configs -= [ "//build/config/win:console" ]
configs += [ "//build/config/win:windowed" ]
# Delay-load as many DLLs as possible for sandbox and startup perf
# improvements.
configs += [ "//build/config/win:delayloads" ]
defines += [
"CEF_USE_ATL",
]
@@ -2264,6 +2269,10 @@ if (is_mac) {
configs -= [ "//build/config/win:console" ]
configs += [ "//build/config/win:windowed" ]
# Delay-load as many DLLs as possible for sandbox and startup perf
# improvements.
configs += [ "//build/config/win:delayloads" ]
deps += [
":cef_sandbox",
"//build/win:default_exe_manifest",
@@ -2331,6 +2340,10 @@ if (is_mac) {
sources += gypi_paths2.shared_sources_win +
gypi_paths2.ceftests_sources_win
# Delay-load as many DLLs as possible for sandbox and startup perf
# improvements.
configs += [ "//build/config/win:delayloads" ]
deps += [
":cef_sandbox",
"//build/win:default_exe_manifest",

View File

@@ -7,6 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/115.0.5790.173',
'depot_tools_checkout': '6d0c235dae'
'chromium_checkout': 'refs/tags/118.0.5993.119',
'depot_tools_checkout': 'a45d2d4c90'
}

View File

@@ -49,6 +49,7 @@ The base CEF framework includes support for the C and C++ programming languages.
* Delphi - https://github.com/hgourvest/dcef3
* Delphi - https://github.com/salvadordf/CEF4Delphi
* Go - https://github.com/CzarekTomczak/cef2go
* Go - https://github.com/energye/energy
* Java - https://bitbucket.org/chromiumembedded/java-cef
* Python - http://code.google.com/p/cefpython/

View File

@@ -1,2 +1,2 @@
@echo off
python.bat tools\gclient_hook.py
python3.bat tools\gclient_hook.py

View File

@@ -23,7 +23,6 @@
'include/base/cef_ptr_util.h',
'include/base/cef_ref_counted.h',
'include/base/cef_scoped_refptr.h',
'include/base/cef_template_util.h',
'include/base/cef_thread_checker.h',
'include/base/cef_trace_event.h',
'include/base/cef_tuple.h',

View File

@@ -436,6 +436,56 @@ if(OS_WINDOWS)
list(APPEND CEF_EXE_LINKER_FLAGS
/MANIFEST:NO # No default manifest (see ADD_WINDOWS_MANIFEST macro usage)
/LARGEADDRESSAWARE # Allow 32-bit processes to access 3GB of RAM
# Delayload most libraries as the dlls are simply not required at startup (or
# at all, depending on the process type). Some dlls open handles when they are
# loaded, and we may not want them to be loaded in renderers or other sandboxed
# processes. Conversely, some dlls must be loaded before sandbox lockdown. In
# unsandboxed processes they will load when first needed. The linker will
# automatically ignore anything which is not linked to the binary at all (it is
# harmless to have an unmatched /delayload). This list should be kept in sync
# with Chromium's "delayloads" target from the //build/config/win/BUILD.gn file.
/DELAYLOAD:api-ms-win-core-winrt-error-l1-1-0.dll
/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll
/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll
/DELAYLOAD:advapi32.dll
/DELAYLOAD:comctl32.dll
/DELAYLOAD:comdlg32.dll
/DELAYLOAD:credui.dll
/DELAYLOAD:cryptui.dll
/DELAYLOAD:d3d11.dll
/DELAYLOAD:d3d9.dll
/DELAYLOAD:dwmapi.dll
/DELAYLOAD:dxgi.dll
/DELAYLOAD:dxva2.dll
/DELAYLOAD:esent.dll
/DELAYLOAD:gdi32.dll
/DELAYLOAD:hid.dll
/DELAYLOAD:imagehlp.dll
/DELAYLOAD:imm32.dll
/DELAYLOAD:msi.dll
/DELAYLOAD:netapi32.dll
/DELAYLOAD:ncrypt.dll
/DELAYLOAD:ole32.dll
/DELAYLOAD:oleacc.dll
/DELAYLOAD:propsys.dll
/DELAYLOAD:psapi.dll
/DELAYLOAD:rpcrt4.dll
/DELAYLOAD:rstrtmgr.dll
/DELAYLOAD:setupapi.dll
/DELAYLOAD:shell32.dll
/DELAYLOAD:shlwapi.dll
/DELAYLOAD:uiautomationcore.dll
/DELAYLOAD:urlmon.dll
/DELAYLOAD:user32.dll
/DELAYLOAD:usp10.dll
/DELAYLOAD:uxtheme.dll
/DELAYLOAD:wer.dll
/DELAYLOAD:wevtapi.dll
/DELAYLOAD:wininet.dll
/DELAYLOAD:winusb.dll
/DELAYLOAD:wsock32.dll
/DELAYLOAD:wtsapi32.dll
)
list(APPEND CEF_COMPILER_DEFINES
WIN32 _WIN32 _WINDOWS # Windows platform

View File

@@ -84,7 +84,6 @@
#include "include/base/cef_build.h"
#include "include/base/cef_compiler_specific.h"
#include "include/base/cef_template_util.h"
#include "include/base/internal/cef_bind_internal.h"
#if defined(OS_APPLE) && !HAS_FEATURE(objc_arc)
@@ -105,7 +104,7 @@ BindOnce(Functor&& functor, Args&&... args) {
"BindOnce requires non-const rvalue for OnceCallback binding."
" I.e.: base::BindOnce(std::move(callback)).");
static_assert(
conjunction<cef_internal::AssertBindArgIsNotBasePassed<
std::conjunction<cef_internal::AssertBindArgIsNotBasePassed<
std::decay_t<Args>>...>::value,
"Use std::move() instead of base::Passed() with base::BindOnce()");

View File

@@ -50,7 +50,6 @@
#include "include/base/cef_compiler_specific.h"
#include "include/base/cef_logging.h"
#include "include/base/cef_scoped_refptr.h"
#include "include/base/cef_template_util.h"
#include "include/base/cef_thread_checker.h"
namespace base {
@@ -485,7 +484,7 @@ class RefCountedData
RefCountedData(const T& in_value) : data(in_value) {}
RefCountedData(T&& in_value) : data(std::move(in_value)) {}
template <typename... Args>
explicit RefCountedData(in_place_t, Args&&... args)
explicit RefCountedData(std::in_place_t, Args&&... args)
: data(std::forward<Args>(args)...) {}
T data;

View File

@@ -1,417 +0,0 @@
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2011
// Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_
#define CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_
#pragma once
#if defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/template_util.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
// updated to match.
#include <stddef.h>
#include <iosfwd>
#include <iterator>
#include <type_traits>
#include <utility>
#include <vector>
#include "include/base/cef_build.h"
// Some versions of libstdc++ have partial support for type_traits, but misses
// a smaller subset while removing some of the older non-standard stuff. Assume
// that all versions below 5.0 fall in this category, along with one 5.0
// experimental release. Test for this by consulting compiler major version,
// the only reliable option available, so theoretically this could fail should
// you attempt to mix an earlier version of libstdc++ with >= GCC5. But
// that's unlikely to work out, especially as GCC5 changed ABI.
#define CR_GLIBCXX_5_0_0 20150123
#if (defined(__GNUC__) && __GNUC__ < 5) || \
(defined(__GLIBCXX__) && __GLIBCXX__ == CR_GLIBCXX_5_0_0)
#define CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
#endif
// This hacks around using gcc with libc++ which has some incompatibilies.
// - is_trivially_* doesn't work: https://llvm.org/bugs/show_bug.cgi?id=27538
// TODO(danakj): Remove this when android builders are all using a newer version
// of gcc, or the android ndk is updated to a newer libc++ that works with older
// gcc versions.
#if !defined(__clang__) && defined(_LIBCPP_VERSION)
#define CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
#endif
namespace base {
template <class T>
struct is_non_const_reference : std::false_type {};
template <class T>
struct is_non_const_reference<T&> : std::true_type {};
template <class T>
struct is_non_const_reference<const T&> : std::false_type {};
namespace internal {
// Implementation detail of base::void_t below.
template <typename...>
struct make_void {
using type = void;
};
} // namespace internal
// base::void_t is an implementation of std::void_t from C++17.
//
// We use |base::internal::make_void| as a helper struct to avoid a C++14
// defect:
// http://en.cppreference.com/w/cpp/types/void_t
// http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#1558
template <typename... Ts>
using void_t = typename ::base::internal::make_void<Ts...>::type;
namespace internal {
// Uses expression SFINAE to detect whether using operator<< would work.
template <typename T, typename = void>
struct SupportsOstreamOperator : std::false_type {};
template <typename T>
struct SupportsOstreamOperator<T,
decltype(void(std::declval<std::ostream&>()
<< std::declval<T>()))>
: std::true_type {};
template <typename T, typename = void>
struct SupportsToString : std::false_type {};
template <typename T>
struct SupportsToString<T, decltype(void(std::declval<T>().ToString()))>
: std::true_type {};
// Used to detect whether the given type is an iterator. This is normally used
// with std::enable_if to provide disambiguation for functions that take
// templatzed iterators as input.
template <typename T, typename = void>
struct is_iterator : std::false_type {};
template <typename T>
struct is_iterator<T,
void_t<typename std::iterator_traits<T>::iterator_category>>
: std::true_type {};
// Helper to express preferences in an overload set. If more than one overload
// are available for a given set of parameters the overload with the higher
// priority will be chosen.
template <size_t I>
struct priority_tag : priority_tag<I - 1> {};
template <>
struct priority_tag<0> {};
} // namespace internal
// is_trivially_copyable is especially hard to get right.
// - Older versions of libstdc++ will fail to have it like they do for other
// type traits. This has become a subset of the second point, but used to be
// handled independently.
// - An experimental release of gcc includes most of type_traits but misses
// is_trivially_copyable, so we still have to avoid using libstdc++ in this
// case, which is covered by CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX.
// - When compiling libc++ from before r239653, with a gcc compiler, the
// std::is_trivially_copyable can fail. So we need to work around that by not
// using the one in libc++ in this case. This is covered by the
// CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX define, and is discussed in
// https://llvm.org/bugs/show_bug.cgi?id=27538#c1 where they point out that
// in libc++'s commit r239653 this is fixed by libc++ checking for gcc 5.1.
// - In both of the above cases we are using the gcc compiler. When defining
// this ourselves on compiler intrinsics, the __is_trivially_copyable()
// intrinsic is not available on gcc before version 5.1 (see the discussion in
// https://llvm.org/bugs/show_bug.cgi?id=27538#c1 again), so we must check for
// that version.
// - When __is_trivially_copyable() is not available because we are on gcc older
// than 5.1, we need to fall back to something, so we use __has_trivial_copy()
// instead based on what was done one-off in bit_cast() previously.
// TODO(crbug.com/554293): Remove this when all platforms have this in the std
// namespace and it works with gcc as needed.
#if defined(CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX) || \
defined(CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX)
template <typename T>
struct is_trivially_copyable {
// TODO(danakj): Remove this when android builders are all using a newer version
// of gcc, or the android ndk is updated to a newer libc++ that does this for
// us.
#if _GNUC_VER >= 501
static constexpr bool value = __is_trivially_copyable(T);
#else
static constexpr bool value =
__has_trivial_copy(T) && __has_trivial_destructor(T);
#endif
};
#else
template <class T>
using is_trivially_copyable = std::is_trivially_copyable<T>;
#endif
#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 7
// Workaround for g++7 and earlier family.
// Due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654, without this
// Optional<std::vector<T>> where T is non-copyable causes a compile error.
// As we know it is not trivially copy constructible, explicitly declare so.
template <typename T>
struct is_trivially_copy_constructible
: std::is_trivially_copy_constructible<T> {};
template <typename... T>
struct is_trivially_copy_constructible<std::vector<T...>> : std::false_type {};
#else
// Otherwise use std::is_trivially_copy_constructible as is.
template <typename T>
using is_trivially_copy_constructible = std::is_trivially_copy_constructible<T>;
#endif
// base::in_place_t is an implementation of std::in_place_t from
// C++17. A tag type used to request in-place construction in template vararg
// constructors.
// Specification:
// https://en.cppreference.com/w/cpp/utility/in_place
struct in_place_t {};
constexpr in_place_t in_place = {};
// base::in_place_type_t is an implementation of std::in_place_type_t from
// C++17. A tag type used for in-place construction when the type to construct
// needs to be specified, such as with base::unique_any, designed to be a
// drop-in replacement.
// Specification:
// http://en.cppreference.com/w/cpp/utility/in_place
template <typename T>
struct in_place_type_t {};
template <typename T>
struct is_in_place_type_t {
static constexpr bool value = false;
};
template <typename... Ts>
struct is_in_place_type_t<in_place_type_t<Ts...>> {
static constexpr bool value = true;
};
// C++14 implementation of C++17's std::bool_constant.
//
// Reference: https://en.cppreference.com/w/cpp/types/integral_constant
// Specification: https://wg21.link/meta.type.synop
template <bool B>
using bool_constant = std::integral_constant<bool, B>;
// C++14 implementation of C++17's std::conjunction.
//
// Reference: https://en.cppreference.com/w/cpp/types/conjunction
// Specification: https://wg21.link/meta.logical#1.itemdecl:1
template <typename...>
struct conjunction : std::true_type {};
template <typename B1>
struct conjunction<B1> : B1 {};
template <typename B1, typename... Bn>
struct conjunction<B1, Bn...>
: std::conditional_t<static_cast<bool>(B1::value), conjunction<Bn...>, B1> {
};
// C++14 implementation of C++17's std::disjunction.
//
// Reference: https://en.cppreference.com/w/cpp/types/disjunction
// Specification: https://wg21.link/meta.logical#itemdecl:2
template <typename...>
struct disjunction : std::false_type {};
template <typename B1>
struct disjunction<B1> : B1 {};
template <typename B1, typename... Bn>
struct disjunction<B1, Bn...>
: std::conditional_t<static_cast<bool>(B1::value), B1, disjunction<Bn...>> {
};
// C++14 implementation of C++17's std::negation.
//
// Reference: https://en.cppreference.com/w/cpp/types/negation
// Specification: https://wg21.link/meta.logical#itemdecl:3
template <typename B>
struct negation : bool_constant<!static_cast<bool>(B::value)> {};
// Implementation of C++17's invoke_result.
//
// This implementation adds references to `Functor` and `Args` to work around
// some quirks of std::result_of. See the #Notes section of [1] for details.
//
// References:
// [1] https://en.cppreference.com/w/cpp/types/result_of
// [2] https://wg21.link/meta.trans.other#lib:invoke_result
#if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
template <typename Functor, typename... Args>
using invoke_result = std::invoke_result<Functor, Args...>;
#else
template <typename Functor, typename... Args>
using invoke_result = std::result_of<Functor && (Args && ...)>;
#endif
// Implementation of C++17's std::invoke_result_t.
//
// Reference: https://wg21.link/meta.type.synop#lib:invoke_result_t
template <typename Functor, typename... Args>
using invoke_result_t = typename invoke_result<Functor, Args...>::type;
namespace internal {
// Base case, `InvokeResult` does not have a nested type member. This means `F`
// could not be invoked with `Args...` and thus is not invocable.
template <typename InvokeResult, typename R, typename = void>
struct IsInvocableImpl : std::false_type {};
// Happy case, `InvokeResult` does have a nested type member. Now check whether
// `InvokeResult::type` is convertible to `R`. Short circuit in case
// `std::is_void<R>`.
template <typename InvokeResult, typename R>
struct IsInvocableImpl<InvokeResult, R, void_t<typename InvokeResult::type>>
: disjunction<std::is_void<R>,
std::is_convertible<typename InvokeResult::type, R>> {};
} // namespace internal
// Implementation of C++17's std::is_invocable_r.
//
// Returns whether `F` can be invoked with `Args...` and the result is
// convertible to `R`.
//
// Reference: https://wg21.link/meta.rel#lib:is_invocable_r
template <typename R, typename F, typename... Args>
struct is_invocable_r
: internal::IsInvocableImpl<invoke_result<F, Args...>, R> {};
// Implementation of C++17's std::is_invocable.
//
// Returns whether `F` can be invoked with `Args...`.
//
// Reference: https://wg21.link/meta.rel#lib:is_invocable
template <typename F, typename... Args>
struct is_invocable : is_invocable_r<void, F, Args...> {};
namespace internal {
// The indirection with std::is_enum<T> is required, because instantiating
// std::underlying_type_t<T> when T is not an enum is UB prior to C++20.
template <typename T, bool = std::is_enum<T>::value>
struct IsScopedEnumImpl : std::false_type {};
template <typename T>
struct IsScopedEnumImpl<T, /*std::is_enum<T>::value=*/true>
: negation<std::is_convertible<T, std::underlying_type_t<T>>> {};
} // namespace internal
// Implementation of C++23's std::is_scoped_enum
//
// Reference: https://en.cppreference.com/w/cpp/types/is_scoped_enum
template <typename T>
struct is_scoped_enum : internal::IsScopedEnumImpl<T> {};
// Implementation of C++20's std::remove_cvref.
//
// References:
// - https://en.cppreference.com/w/cpp/types/remove_cvref
// - https://wg21.link/meta.trans.other#lib:remove_cvref
template <typename T>
struct remove_cvref {
using type = std::remove_cv_t<std::remove_reference_t<T>>;
};
// Implementation of C++20's std::remove_cvref_t.
//
// References:
// - https://en.cppreference.com/w/cpp/types/remove_cvref
// - https://wg21.link/meta.type.synop#lib:remove_cvref_t
template <typename T>
using remove_cvref_t = typename remove_cvref<T>::type;
// Simplified implementation of C++20's std::iter_value_t.
// As opposed to std::iter_value_t, this implementation does not restrict
// the type of `Iter` and does not consider specializations of
// `indirectly_readable_traits`.
//
// Reference: https://wg21.link/readable.traits#2
template <typename Iter>
using iter_value_t =
typename std::iterator_traits<remove_cvref_t<Iter>>::value_type;
// Simplified implementation of C++20's std::iter_reference_t.
// As opposed to std::iter_reference_t, this implementation does not restrict
// the type of `Iter`.
//
// Reference: https://wg21.link/iterator.synopsis#:~:text=iter_reference_t
template <typename Iter>
using iter_reference_t = decltype(*std::declval<Iter&>());
// Simplified implementation of C++20's std::indirect_result_t. As opposed to
// std::indirect_result_t, this implementation does not restrict the type of
// `Func` and `Iters`.
//
// Reference: https://wg21.link/iterator.synopsis#:~:text=indirect_result_t
template <typename Func, typename... Iters>
using indirect_result_t = invoke_result_t<Func, iter_reference_t<Iters>...>;
// Simplified implementation of C++20's std::projected. As opposed to
// std::projected, this implementation does not explicitly restrict the type of
// `Iter` and `Proj`, but rather does so implicitly by requiring
// `indirect_result_t<Proj, Iter>` is a valid type. This is required for SFINAE
// friendliness.
//
// Reference: https://wg21.link/projected
template <typename Iter,
typename Proj,
typename IndirectResultT = indirect_result_t<Proj, Iter>>
struct projected {
using value_type = remove_cvref_t<IndirectResultT>;
IndirectResultT operator*() const; // not defined
};
} // namespace base
#undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
#undef CR_USE_FALLBACKS_FOR_OLD_EXPERIMENTAL_GLIBCXX
#endif // !USING_CHROMIUM_INCLUDES
#endif // CEF_INCLUDE_BASE_CEF_TEMPLATE_UTIL_H_

View File

@@ -68,7 +68,6 @@
#include "include/base/cef_build.h"
#include "include/base/cef_compiler_specific.h"
#include "include/base/cef_logging.h"
#include "include/base/cef_template_util.h"
#include "include/base/cef_weak_ptr.h"
#include "include/base/internal/cef_callback_internal.h"
#include "include/base/internal/cef_raw_scoped_refptr_mismatch_checker.h"
@@ -356,14 +355,14 @@ template <typename Functor, typename SFINAE = void>
struct IsCallableObject : std::false_type {};
template <typename Callable>
struct IsCallableObject<Callable, void_t<decltype(&Callable::operator())>>
struct IsCallableObject<Callable, std::void_t<decltype(&Callable::operator())>>
: std::true_type {};
// HasRefCountedTypeAsRawPtr inherits from true_type when any of the |Args| is a
// raw pointer to a RefCounted type.
template <typename... Ts>
struct HasRefCountedTypeAsRawPtr
: disjunction<NeedsScopedRefptrButGetsRawPtr<Ts>...> {};
: std::disjunction<NeedsScopedRefptrButGetsRawPtr<Ts>...> {};
// ForceVoidReturn<>
//
@@ -878,7 +877,7 @@ BanUnconstructedRefCountedReceiver(const Receiver& receiver, Unused&&...) {
// This stores all the state passed into Bind().
template <typename Functor, typename... BoundArgs>
struct BindState final : BindStateBase {
using IsCancellable = bool_constant<
using IsCancellable = std::bool_constant<
CallbackCancellationTraits<Functor,
std::tuple<BoundArgs...>>::is_cancellable>;
template <typename ForwardFunctor, typename... ForwardBoundArgs>
@@ -1252,7 +1251,7 @@ decltype(auto) BindImpl(Functor&& functor, Args&&... args) {
// PolymorphicInvoke, to which CallbackType will cast back.
using PolymorphicInvoke = typename CallbackType::PolymorphicInvoke;
PolymorphicInvoke invoke_func =
GetInvokeFunc<Invoker>(bool_constant<kIsOnce>());
GetInvokeFunc<Invoker>(std::bool_constant<kIsOnce>());
using InvokeFuncStorage = BindStateBase::InvokeFuncStorage;
return CallbackType(BindState::Create(

View File

@@ -34,8 +34,6 @@
#include <type_traits>
#include "include/base/cef_template_util.h"
// It is dangerous to post a task with a T* argument where T is a subtype of
// RefCounted(Base|ThreadSafeBase), since by the time the parameter is used, the
// object may already have been deleted since it was not held with a
@@ -54,16 +52,16 @@ struct IsRefCountedType : std::false_type {};
template <typename T>
struct IsRefCountedType<T,
void_t<decltype(std::declval<T*>()->AddRef()),
decltype(std::declval<T*>()->Release())>>
std::void_t<decltype(std::declval<T*>()->AddRef()),
decltype(std::declval<T*>()->Release())>>
: std::true_type {};
// Human readable translation: you needed to be a scoped_refptr if you are a raw
// pointer type and are convertible to a RefCounted(Base|ThreadSafeBase) type.
template <typename T>
struct NeedsScopedRefptrButGetsRawPtr
: conjunction<std::is_pointer<T>,
IsRefCountedType<std::remove_pointer_t<T>>> {
: std::conjunction<std::is_pointer<T>,
IsRefCountedType<std::remove_pointer_t<T>>> {
static_assert(!std::is_reference<T>::value,
"NeedsScopedRefptrButGetsRawPtr requires non-reference type.");
};

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=683d7bff8da04826eee83c7e23cf9c5a701ae265$
// $hash=13ba2d807f2c1ac3adfc65f2bdb269baecba57ec$
//
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
@@ -365,16 +365,39 @@ typedef struct _cef_browser_host_t {
struct _cef_browser_host_t* self);
///
/// Get the current zoom level. The default zoom level is 0.0. This function
/// can only be called on the UI thread.
/// Returns true (1) if this browser can execute the specified zoom command.
/// This function can only be called on the UI thread.
///
int(CEF_CALLBACK* can_zoom)(struct _cef_browser_host_t* self,
cef_zoom_command_t command);
///
/// Execute a zoom command in this browser. If called on the UI thread the
/// change will be applied immediately. Otherwise, the change will be applied
/// asynchronously on the UI thread.
///
void(CEF_CALLBACK* zoom)(struct _cef_browser_host_t* self,
cef_zoom_command_t command);
///
/// Get the default zoom level. This value will be 0.0 by default but can be
/// configured with the Chrome runtime. This function can only be called on
/// the UI thread.
///
double(CEF_CALLBACK* get_default_zoom_level)(
struct _cef_browser_host_t* self);
///
/// Get the current zoom level. This function can only be called on the UI
/// thread.
///
double(CEF_CALLBACK* get_zoom_level)(struct _cef_browser_host_t* self);
///
/// Change the zoom level to the specified value. Specify 0.0 to reset the
/// zoom level. If called on the UI thread the change will be applied
/// immediately. Otherwise, the change will be applied asynchronously on the
/// UI thread.
/// zoom level to the default. If called on the UI thread the change will be
/// applied immediately. Otherwise, the change will be applied asynchronously
/// on the UI thread.
///
void(CEF_CALLBACK* set_zoom_level)(struct _cef_browser_host_t* self,
double zoomLevel);
@@ -909,6 +932,29 @@ typedef struct _cef_browser_host_t {
/// be called on the UI thread.
///
int(CEF_CALLBACK* is_audio_muted)(struct _cef_browser_host_t* self);
///
/// Returns true (1) if the renderer is currently in browser fullscreen. This
/// differs from window fullscreen in that browser fullscreen is entered using
/// the JavaScript Fullscreen API and modifies CSS attributes such as the
/// ::backdrop pseudo-element and :fullscreen pseudo-structure. This function
/// can only be called on the UI thread.
///
int(CEF_CALLBACK* is_fullscreen)(struct _cef_browser_host_t* self);
///
/// Requests the renderer to exit browser fullscreen. In most cases exiting
/// window fullscreen should also exit browser fullscreen. With the Alloy
/// runtime this function should be called in response to a user action such
/// as clicking the green traffic light button on MacOS
/// (cef_window_delegate_t::OnWindowFullscreenTransition callback) or pressing
/// the "ESC" key (cef_keyboard_handler_t::OnPreKeyEvent callback). With the
/// Chrome runtime these standard exit actions are handled internally but
/// new/additional user actions can use this function. Set |will_cause_resize|
/// to true (1) if exiting browser fullscreen will cause a view resize.
///
void(CEF_CALLBACK* exit_fullscreen)(struct _cef_browser_host_t* self,
int will_cause_resize);
} cef_browser_host_t;
///

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=1de3354bd0a042cc28199f1f56753b1df9e279a2$
// $hash=5374127458a7cac3ee9b4d2b4ad8a6f5ca81ec52$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_
@@ -84,8 +84,13 @@ typedef struct _cef_display_handler_t {
/// Called when web content in the page has toggled fullscreen mode. If
/// |fullscreen| is true (1) the content will automatically be sized to fill
/// the browser content area. If |fullscreen| is false (0) the content will
/// automatically return to its original size and position. The client is
/// responsible for resizing the browser if desired.
/// automatically return to its original size and position. With the Alloy
/// runtime the client is responsible for triggering the fullscreen transition
/// (for example, by calling cef_window_t::SetFullscreen when using Views).
/// With the Chrome runtime the fullscreen transition will be triggered
/// automatically. The cef_window_delegate_t::OnWindowFullscreenTransition
/// function will be called during the fullscreen transition for notification
/// purposes.
///
void(CEF_CALLBACK* on_fullscreen_mode_change)(
struct _cef_display_handler_t* self,

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=a1ce746f0dd97d21973d4c80d8ef46391c0fd463$
// $hash=8d00465ba004758f464cdb8b1fbd02cd26323ace$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_
@@ -149,6 +149,13 @@ typedef struct _cef_drag_data_t {
int(CEF_CALLBACK* get_file_names)(struct _cef_drag_data_t* self,
cef_string_list_t names);
///
/// Retrieve the list of file paths that are being dragged into the browser
/// window.
///
int(CEF_CALLBACK* get_file_paths)(struct _cef_drag_data_t* self,
cef_string_list_t paths);
///
/// Set the link URL that is being dragged.
///

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=08f64795d78bdad29a45222a7263e795ce77a52d$
// $hash=dfa2f2d57339e05592d7ee5f4c4c54dd0932cd94$
//
#ifndef CEF_INCLUDE_CAPI_CEF_SHARED_MEMORY_REGION_CAPI_H_
@@ -69,7 +69,7 @@ typedef struct _cef_shared_memory_region_t {
/// Returns the pointer to the memory. Returns nullptr for invalid instances.
/// The returned pointer is only valid for the life span of this object.
///
const void*(CEF_CALLBACK* memory)(struct _cef_shared_memory_region_t* self);
void*(CEF_CALLBACK* memory)(struct _cef_shared_memory_region_t* self);
} cef_shared_memory_region_t;
#ifdef __cplusplus

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=94e93810316b74e54eb315d97c6fc6f1cc0c9cc5$
// $hash=9e8dd2187d592f7556cbee0db3ceab851f9aae13$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_DELEGATE_CAPI_H_
@@ -119,14 +119,23 @@ typedef struct _cef_browser_view_delegate_t {
/// documentation.
///
cef_chrome_toolbar_type_t(CEF_CALLBACK* get_chrome_toolbar_type)(
struct _cef_browser_view_delegate_t* self);
struct _cef_browser_view_delegate_t* self,
struct _cef_browser_view_t* browser_view);
///
/// Return true (1) to create frameless windows for Document picture-in-
/// picture popups. Content in frameless windows should specify draggable
/// regions using "-webkit-app-region: drag" CSS.
///
int(CEF_CALLBACK* use_frameless_window_for_picture_in_picture)(
struct _cef_browser_view_delegate_t* self,
struct _cef_browser_view_t* browser_view);
///
/// Called when |browser_view| receives a gesture command. Return true (1) to
/// handle (or disable) a |gesture_command| or false (0) to propagate the
/// gesture to the browser for default handling. This function will only be
/// called with the Alloy runtime. To handle these commands with the Chrome
/// runtime implement cef_command_handler_t::OnChromeCommand instead.
/// gesture to the browser for default handling. With the Chrome runtime these
/// commands can also be handled via cef_command_handler_t::OnChromeCommand.
///
int(CEF_CALLBACK* on_gesture_command)(
struct _cef_browser_view_delegate_t* self,

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=d53c4a0a7e731a56a0edcb9d705c76b0a2770155$
// $hash=4b43fe0b493d860e8b28d7a6d892db49d1135b34$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
@@ -155,7 +155,9 @@ typedef struct _cef_window_t {
void(CEF_CALLBACK* restore)(struct _cef_window_t* self);
///
/// Set fullscreen Window state.
/// Set fullscreen Window state. The
/// cef_window_delegate_t::OnWindowFullscreenTransition function will be
/// called during the fullscreen transition for notification purposes.
///
void(CEF_CALLBACK* set_fullscreen)(struct _cef_window_t* self,
int fullscreen);

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=61099a1ba8b16a5e46f5a80d326d1f9bfc99317d$
// $hash=456f00f7afbac910cf36feecd38399a2fb16960d$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
@@ -96,6 +96,20 @@ typedef struct _cef_window_delegate_t {
struct _cef_window_t* window,
const cef_rect_t* new_bounds);
///
/// Called when |window| is transitioning to or from fullscreen mode. On MacOS
/// the transition occurs asynchronously with |is_competed| set to false (0)
/// when the transition starts and true (1) after the transition completes. On
/// other platforms the transition occurs synchronously with |is_completed|
/// set to true (1) after the transition completes. With the Alloy runtime you
/// must also implement cef_display_handler_t::OnFullscreenModeChange to
/// handle fullscreen transitions initiated by browser content.
///
void(CEF_CALLBACK* on_window_fullscreen_transition)(
struct _cef_window_delegate_t* self,
struct _cef_window_t* window,
int is_completed);
///
/// Return the parent for |window| or NULL if the |window| does not have a
/// parent. Windows with parents will not get a taskbar button. Set |is_menu|
@@ -210,17 +224,6 @@ typedef struct _cef_window_delegate_t {
int(CEF_CALLBACK* on_key_event)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window,
const cef_key_event_t* event);
///
/// Called when the |window| is transitioning to or from fullscreen mode. The
/// transition occurs in two stages, with |is_competed| set to false (0) when
/// the transition starts and true (1) when the transition completes. This
/// function is only supported on macOS.
///
void(CEF_CALLBACK* on_window_fullscreen_transition)(
struct _cef_window_delegate_t* self,
struct _cef_window_t* window,
int is_completed);
} cef_window_delegate_t;
#ifdef __cplusplus

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 "9c9fbc9d59a544c8e0c2f0cbed4b6622f2786f1c"
#define CEF_API_HASH_UNIVERSAL "87db318fb26ee0debfcb686433bd334ea7b9923d"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "240e06747f2ea2d7d4a3071042d45cf80d170420"
#define CEF_API_HASH_PLATFORM "aee3b3f687dce72a3370f98309bb43f722596b83"
#elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "cd4a815153a919ad30b95c659688b564823d92fc"
#define CEF_API_HASH_PLATFORM "1cc534c1000bf82e8db52b8635272bb18daec4c2"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "4c372cb13e3446b2a54aaaea51b0d47ba7766152"
#define CEF_API_HASH_PLATFORM "47f4af678148110cb790fb48a957fb522446ecf2"
#endif
#ifdef __cplusplus

View File

@@ -396,17 +396,40 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
virtual CefRefPtr<CefRequestContext> GetRequestContext() = 0;
///
/// Get the current zoom level. The default zoom level is 0.0. This method can
/// only be called on the UI thread.
/// Returns true if this browser can execute the specified zoom command. This
/// method can only be called on the UI thread.
///
/*--cef()--*/
virtual bool CanZoom(cef_zoom_command_t command) = 0;
///
/// Execute a zoom command in this browser. If called on the UI thread the
/// change will be applied immediately. Otherwise, the change will be applied
/// asynchronously on the UI thread.
///
/*--cef()--*/
virtual void Zoom(cef_zoom_command_t command) = 0;
///
/// Get the default zoom level. This value will be 0.0 by default but can be
/// configured with the Chrome runtime. This method can only be called on the
/// UI thread.
///
/*--cef()--*/
virtual double GetDefaultZoomLevel() = 0;
///
/// Get the current zoom level. This method can only be called on the UI
/// thread.
///
/*--cef()--*/
virtual double GetZoomLevel() = 0;
///
/// Change the zoom level to the specified value. Specify 0.0 to reset the
/// zoom level. If called on the UI thread the change will be applied
/// immediately. Otherwise, the change will be applied asynchronously on the
/// UI thread.
/// zoom level to the default. If called on the UI thread the change will be
/// applied immediately. Otherwise, the change will be applied asynchronously
/// on the UI thread.
///
/*--cef()--*/
virtual void SetZoomLevel(double zoomLevel) = 0;
@@ -941,6 +964,30 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
///
/*--cef()--*/
virtual bool IsAudioMuted() = 0;
///
/// Returns true if the renderer is currently in browser fullscreen. This
/// differs from window fullscreen in that browser fullscreen is entered using
/// the JavaScript Fullscreen API and modifies CSS attributes such as the
/// ::backdrop pseudo-element and :fullscreen pseudo-class. This method can
/// only be called on the UI thread.
///
/*--cef()--*/
virtual bool IsFullscreen() = 0;
///
/// Requests the renderer to exit browser fullscreen. In most cases exiting
/// window fullscreen should also exit browser fullscreen. With the Alloy
/// runtime this method should be called in response to a user action such as
/// clicking the green traffic light button on MacOS
/// (CefWindowDelegate::OnWindowFullscreenTransition callback) or pressing the
/// "ESC" key (CefKeyboardHandler::OnPreKeyEvent callback). With the Chrome
/// runtime these standard exit actions are handled internally but
/// new/additional user actions can use this method. Set |will_cause_resize|
/// to true if exiting browser fullscreen will cause a view resize.
///
/*--cef()--*/
virtual void ExitFullscreen(bool will_cause_resize) = 0;
};
#endif // CEF_INCLUDE_CEF_BROWSER_H_

View File

@@ -75,8 +75,12 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
/// Called when web content in the page has toggled fullscreen mode. If
/// |fullscreen| is true the content will automatically be sized to fill the
/// browser content area. If |fullscreen| is false the content will
/// automatically return to its original size and position. The client is
/// responsible for resizing the browser if desired.
/// automatically return to its original size and position. With the Alloy
/// runtime the client is responsible for triggering the fullscreen transition
/// (for example, by calling CefWindow::SetFullscreen when using Views). With
/// the Chrome runtime the fullscreen transition will be triggered
/// automatically. The CefWindowDelegate::OnWindowFullscreenTransition method
/// will be called during the fullscreen transition for notification purposes.
///
/*--cef()--*/
virtual void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser,

View File

@@ -145,6 +145,13 @@ class CefDragData : public virtual CefBaseRefCounted {
/*--cef()--*/
virtual bool GetFileNames(std::vector<CefString>& names) = 0;
///
/// Retrieve the list of file paths that are being dragged into the browser
/// window.
///
/*--cef()--*/
virtual bool GetFilePaths(std::vector<CefString>& paths) = 0;
///
/// Set the link URL that is being dragged.
///

View File

@@ -63,7 +63,7 @@ class CefSharedMemoryRegion : public virtual CefBaseRefCounted {
/// The returned pointer is only valid for the life span of this object.
///
/*--cef()--*/
virtual const void* Memory() = 0;
virtual void* Memory() = 0;
};
#endif // CEF_INCLUDE_CEF_SHARED_MEMORY_REGION_H_

View File

@@ -132,6 +132,42 @@ typedef enum {
LOGSEVERITY_DISABLE = 99
} cef_log_severity_t;
///
/// Log items prepended to each log line.
///
typedef enum {
///
/// Prepend the default list of items.
///
LOG_ITEMS_DEFAULT = 0,
///
/// Prepend no items.
///
LOG_ITEMS_NONE = 1,
///
/// Prepend the process ID.
///
LOG_ITEMS_FLAG_PROCESS_ID = 1 << 1,
///
/// Prepend the thread ID.
///
LOG_ITEMS_FLAG_THREAD_ID = 1 << 2,
///
/// Prepend the timestamp.
///
LOG_ITEMS_FLAG_TIME_STAMP = 1 << 3,
///
/// Prepend the tickcount.
///
LOG_ITEMS_FLAG_TICK_COUNT = 1 << 4,
} cef_log_items_t;
///
/// Represents the state of a setting.
///
@@ -336,6 +372,14 @@ typedef struct _cef_settings_t {
///
cef_log_severity_t log_severity;
///
/// The log items prepended to each log line. If not set the default log items
/// will be used. Also configurable using the "log-items" command-line switch
/// with a value of "none" for no log items, or a comma-delimited list of
/// values "pid", "tid", "timestamp" or "tickcount" for custom log items.
///
cef_log_items_t log_items;
///
/// Custom flags that will be used when initializing the V8 JavaScript engine.
/// The consequences of using custom flags may not be well tested. Also
@@ -405,10 +449,9 @@ typedef struct _cef_settings_t {
///
/// Comma delimited ordered list of language codes without any whitespace that
/// will be used in the "Accept-Language" HTTP header. May be overridden on a
/// per-browser basis using the CefBrowserSettings.accept_language_list value.
/// If both values are empty then "en-US,en" will be used. Can be overridden
/// for individual CefRequestContext instances via the
/// will be used in the "Accept-Language" HTTP request header and
/// "navigator.language" JS attribute. Can be overridden for individual
/// CefRequestContext instances via the
/// CefRequestContextSettings.accept_language_list value.
///
cef_string_t accept_language_list;
@@ -426,6 +469,21 @@ typedef struct _cef_settings_t {
///
cef_string_t cookieable_schemes_list;
int cookieable_schemes_exclude_defaults;
///
/// Specify an ID to enable Chrome policy management via Platform and OS-user
/// policies. On Windows, this is a registry key like
/// "SOFTWARE\\Policies\\Google\\Chrome". On MacOS, this is a bundle ID like
/// "com.google.Chrome". On Linux, this is an absolute directory path like
/// "/etc/opt/chrome/policies". Only supported with the Chrome runtime. See
/// https://support.google.com/chrome/a/answer/9037717 for details.
///
/// Chrome Browser Cloud Management integration, when enabled via the
/// "enable-chrome-browser-cloud-management" command-line flag, will also use
/// the specified ID. See https://support.google.com/chrome/a/answer/9116814
/// for details.
///
cef_string_t chrome_policy_id;
} cef_settings_t;
///
@@ -471,11 +529,11 @@ typedef struct _cef_request_context_settings_t {
///
/// Comma delimited ordered list of language codes without any whitespace that
/// will be used in the "Accept-Language" HTTP header. Can be set globally
/// using the CefSettings.accept_language_list value or overridden on a per-
/// browser basis using the CefBrowserSettings.accept_language_list value. If
/// all values are empty then "en-US,en" will be used. This value will be
/// ignored if |cache_path| matches the CefSettings.cache_path value.
/// will be used in the "Accept-Language" HTTP request header and
/// "navigator.language" JS attribute. Can be set globally using the
/// CefSettings.accept_language_list value. If all values are empty then
/// "en-US,en" will be used. This value will be ignored if |cache_path|
/// matches the CefSettings.cache_path value.
///
cef_string_t accept_language_list;
@@ -629,20 +687,18 @@ typedef struct _cef_browser_settings_t {
///
cef_color_t background_color;
///
/// Comma delimited ordered list of language codes without any whitespace that
/// will be used in the "Accept-Language" HTTP header. May be set globally
/// using the CefSettings.accept_language_list value. If both values are
/// empty then "en-US,en" will be used.
///
cef_string_t accept_language_list;
///
/// Controls whether the Chrome status bubble will be used. Only supported
/// with the Chrome runtime. For details about the status bubble see
/// https://www.chromium.org/user-experience/status-bubble/
///
cef_state_t chrome_status_bubble;
///
/// Controls whether the Chrome zoom bubble will be shown when zooming. Only
/// supported with the Chrome runtime.
///
cef_state_t chrome_zoom_bubble;
} cef_browser_settings_t;
///
@@ -2580,6 +2636,11 @@ typedef struct _cef_pdf_print_settings_t {
/// |header_template|.
///
cef_string_t footer_template;
///
/// Set to true (1) to generate tagged (accessible) PDF.
///
int generate_tagged_pdf;
} cef_pdf_print_settings_t;
///
@@ -3287,7 +3348,8 @@ typedef enum {
CEF_CPAIT_ZOOM,
CEF_CPAIT_SAVE_IBAN,
CEF_CPAIT_MANDATORY_REAUTH,
CEF_CPAIT_MAX_VALUE = CEF_CPAIT_MANDATORY_REAUTH,
CEF_CPAIT_PRICE_INSIGHTS,
CEF_CPAIT_MAX_VALUE = CEF_CPAIT_PRICE_INSIGHTS,
} cef_chrome_page_action_icon_type_t;
///
@@ -3417,16 +3479,15 @@ typedef enum {
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_MIDI = 1 << 11,
CEF_PERMISSION_TYPE_MIDI_SYSEX = 1 << 12,
CEF_PERMISSION_TYPE_MULTIPLE_DOWNLOADS = 1 << 13,
CEF_PERMISSION_TYPE_NOTIFICATIONS = 1 << 14,
CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER = 1 << 15,
CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER = 1 << 16,
CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 << 17,
CEF_PERMISSION_TYPE_U2F_API_REQUEST = 1 << 18,
CEF_PERMISSION_TYPE_VR_SESSION = 1 << 19,
CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 << 20,
CEF_PERMISSION_TYPE_VR_SESSION = 1 << 18,
CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT = 1 << 19,
} cef_permission_request_types_t;
///
@@ -3611,6 +3672,15 @@ typedef enum {
CEF_GESTURE_COMMAND_FORWARD,
} cef_gesture_command_t;
///
/// Specifies the zoom commands supported by CefBrowserHost::Zoom.
///
typedef enum {
CEF_ZOOM_COMMAND_OUT,
CEF_ZOOM_COMMAND_RESET,
CEF_ZOOM_COMMAND_IN,
} cef_zoom_command_t;
#ifdef __cplusplus
}
#endif

View File

@@ -41,6 +41,10 @@ extern "C" {
/// ContentSettingsType type.
///
typedef enum {
// This setting governs whether cookies are enabled by the user in the
/// provided context. However, it may be overridden by other settings. This
/// enum should NOT be read directly to determine whether cookies are enabled;
/// the client should instead rely on the CookieSettings API.
CEF_CONTENT_SETTING_TYPE_COOKIES = 0,
CEF_CONTENT_SETTING_TYPE_IMAGES,
CEF_CONTENT_SETTING_TYPE_JAVASCRIPT,
@@ -58,7 +62,12 @@ typedef enum {
CEF_CONTENT_SETTING_TYPE_PROTOCOL_HANDLERS,
CEF_CONTENT_SETTING_TYPE_DEPRECATED_PPAPI_BROKER,
CEF_CONTENT_SETTING_TYPE_AUTOMATIC_DOWNLOADS,
/// Advanced device-specific functions on MIDI devices. MIDI-SysEx
/// communications can be used for changing the MIDI device's persistent state
/// such as firmware.
CEF_CONTENT_SETTING_TYPE_MIDI_SYSEX,
CEF_CONTENT_SETTING_TYPE_SSL_CERT_DECISIONS,
CEF_CONTENT_SETTING_TYPE_PROTECTED_MEDIA_IDENTIFIER,
CEF_CONTENT_SETTING_TYPE_APP_BANNER,
@@ -76,8 +85,9 @@ typedef enum {
/// decisions for whether or not to show the UI.
CEF_CONTENT_SETTING_TYPE_ADS_DATA,
/// This is special-cased in the permissions layer to always allow, and as
/// such doesn't have associated prefs data.
/// MIDI stands for Musical Instrument Digital Interface. It is a standard
/// that allows electronic musical instruments, computers, and other devices
/// to communicate with each other.
CEF_CONTENT_SETTING_TYPE_MIDI,
/// This content setting type is for caching password protection service's
@@ -132,9 +142,6 @@ typedef enum {
/// Used to store whether to allow a website to detect user active/idle state.
CEF_CONTENT_SETTING_TYPE_IDLE_DETECTION,
/// Setting for enabling auto-select of all screens for getDisplayMediaSet.
CEF_CONTENT_SETTING_TYPE_GET_DISPLAY_MEDIA_SET_SELECT_ALL_SCREENS,
/// Content settings for access to serial ports. The "guard" content setting
/// stores whether to allow sites to ask for permission to access a port. The
/// permissions granted to access particular ports are stored in the "chooser
@@ -226,10 +233,11 @@ typedef enum {
/// screens. See also: https://w3c.github.io/window-placement
CEF_CONTENT_SETTING_TYPE_WINDOW_MANAGEMENT,
/// Stores whether to allow insecure websites to make local network requests.
/// See also: https://wicg.github.io/local-network-access
/// Stores whether to allow insecure websites to make private network
/// requests.
/// See also: https://wicg.github.io/cors-rfc1918
/// Set through enterprise policies only.
CEF_CONTENT_SETTING_TYPE_INSECURE_LOCAL_NETWORK,
CEF_CONTENT_SETTING_TYPE_INSECURE_PRIVATE_NETWORK,
/// Content setting which stores whether or not a site can access low-level
/// locally installed font data using the Local Fonts Access API.
@@ -343,6 +351,25 @@ typedef enum {
/// Used to indicate whether HTTPS-First Mode is enabled on the hostname.
CEF_CONTENT_SETTING_TYPE_HTTPS_ENFORCED,
/// Setting for enabling the `getAllScreensMedia` API. Spec link:
/// https://github.com/screen-share/capture-all-screens
CEF_CONTENT_SETTING_TYPE_ALL_SCREEN_CAPTURE,
/// Stores per origin metadata for cookie controls.
CEF_CONTENT_SETTING_TYPE_COOKIE_CONTROLS_METADATA,
/// Content Setting for 3PC accesses granted via 3PC deprecation trial.
CEF_CONTENT_SETTING_TYPE_TPCD_SUPPORT,
/// Content setting used to indicate whether entering picture-in-picture
/// automatically should be enabled.
CEF_CONTENT_SETTING_TYPE_AUTO_PICTURE_IN_PICTURE,
/// Content Setting for 3PC accesses granted by metadata delivered via the
/// component updater service. This type will only be used when
/// `net::features::kTpcdMetadataGrants` is enabled.
CEF_CONTENT_SETTING_TYPE_TPCD_METADATA_GRANTS,
CEF_CONTENT_SETTING_TYPE_NUM_TYPES,
} cef_content_setting_types_t;

View File

@@ -373,6 +373,7 @@ struct CefSettingsTraits {
cef_string_clear(&s->locales_dir_path);
cef_string_clear(&s->accept_language_list);
cef_string_clear(&s->cookieable_schemes_list);
cef_string_clear(&s->chrome_policy_id);
}
static inline void set(const struct_type* src,
@@ -408,6 +409,7 @@ struct CefSettingsTraits {
cef_string_set(src->log_file.str, src->log_file.length, &target->log_file,
copy);
target->log_severity = src->log_severity;
target->log_items = src->log_items;
cef_string_set(src->javascript_flags.str, src->javascript_flags.length,
&target->javascript_flags, copy);
@@ -429,6 +431,9 @@ struct CefSettingsTraits {
&target->cookieable_schemes_list, copy);
target->cookieable_schemes_exclude_defaults =
src->cookieable_schemes_exclude_defaults;
cef_string_set(src->chrome_policy_id.str, src->chrome_policy_id.length,
&target->chrome_policy_id, copy);
}
};
@@ -486,7 +491,6 @@ struct CefBrowserSettingsTraits {
cef_string_clear(&s->cursive_font_family);
cef_string_clear(&s->fantasy_font_family);
cef_string_clear(&s->default_encoding);
cef_string_clear(&s->accept_language_list);
}
static inline void set(const struct_type* src,
@@ -535,11 +539,8 @@ struct CefBrowserSettingsTraits {
target->background_color = src->background_color;
cef_string_set(src->accept_language_list.str,
src->accept_language_list.length,
&target->accept_language_list, copy);
target->chrome_status_bubble = src->chrome_status_bubble;
target->chrome_zoom_bubble = src->chrome_zoom_bubble;
}
};
@@ -679,6 +680,8 @@ struct CefPdfPrintSettingsTraits {
&target->header_template, copy);
cef_string_set(src->footer_template.str, src->footer_template.length,
&target->footer_template, copy);
target->generate_tagged_pdf = src->generate_tagged_pdf;
}
};

View File

@@ -113,14 +113,27 @@ class CefBrowserViewDelegate : public CefViewDelegate {
/// documentation.
///
/*--cef(default_retval=CEF_CTT_NONE)--*/
virtual ChromeToolbarType GetChromeToolbarType() { return CEF_CTT_NONE; }
virtual ChromeToolbarType GetChromeToolbarType(
CefRefPtr<CefBrowserView> browser_view) {
return CEF_CTT_NONE;
}
///
/// Return true to create frameless windows for Document picture-in-picture
/// popups. Content in frameless windows should specify draggable regions
/// using "-webkit-app-region: drag" CSS.
///
/*--cef()--*/
virtual bool UseFramelessWindowForPictureInPicture(
CefRefPtr<CefBrowserView> browser_view) {
return false;
}
///
/// Called when |browser_view| receives a gesture command. Return true to
/// handle (or disable) a |gesture_command| or false to propagate the gesture
/// to the browser for default handling. This method will only be called with
/// the Alloy runtime. To handle these commands with the Chrome runtime
/// implement CefCommandHandler::OnChromeCommand instead.
/// to the browser for default handling. With the Chrome runtime these
/// commands can also be handled via CefCommandHandler::OnChromeCommand.
///
/*--cef()--*/
virtual bool OnGestureCommand(CefRefPtr<CefBrowserView> browser_view,

View File

@@ -165,7 +165,9 @@ class CefWindow : public CefPanel {
virtual void Restore() = 0;
///
/// Set fullscreen Window state.
/// Set fullscreen Window state. The
/// CefWindowDelegate::OnWindowFullscreenTransition method will be called
/// during the fullscreen transition for notification purposes.
///
/*--cef()--*/
virtual void SetFullscreen(bool fullscreen) = 0;

View File

@@ -84,6 +84,19 @@ class CefWindowDelegate : public CefPanelDelegate {
virtual void OnWindowBoundsChanged(CefRefPtr<CefWindow> window,
const CefRect& new_bounds) {}
///
/// Called when |window| is transitioning to or from fullscreen mode. On MacOS
/// the transition occurs asynchronously with |is_competed| set to false when
/// the transition starts and true after the transition completes. On other
/// platforms the transition occurs synchronously with |is_completed| set to
/// true after the transition completes. With the Alloy runtime you must also
/// implement CefDisplayHandler::OnFullscreenModeChange to handle fullscreen
/// transitions initiated by browser content.
///
/*--cef()--*/
virtual void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
bool is_completed) {}
///
/// Return the parent for |window| or NULL if the |window| does not have a
/// parent. Windows with parents will not get a taskbar button. Set |is_menu|
@@ -209,16 +222,6 @@ class CefWindowDelegate : public CefPanelDelegate {
const CefKeyEvent& event) {
return false;
}
///
/// Called when the |window| is transitioning to or from fullscreen mode. The
/// transition occurs in two stages, with |is_competed| set to false when the
/// transition starts and true when the transition completes.
/// This method is only supported on macOS.
///
/*--cef()--*/
virtual void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
bool is_completed) {}
};
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_

View File

@@ -21,7 +21,6 @@
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "chrome/browser/font_family_cache.h"
#include "chrome/browser/media/media_device_id_salt.h"
#include "chrome/browser/permissions/permission_manager_factory.h"
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
#include "chrome/browser/profiles/profile_key.h"
@@ -190,8 +189,6 @@ void AlloyBrowserContext::Initialize() {
}
ChromePluginServiceFilter::GetInstance()->RegisterProfile(this);
media_device_id_salt_ = new MediaDeviceIDSalt(pref_service);
}
void AlloyBrowserContext::Shutdown() {
@@ -421,10 +418,6 @@ AlloyBrowserContext::GetReduceAcceptLanguageControllerDelegate() {
return ReduceAcceptLanguageFactory::GetForProfile(this);
}
std::string AlloyBrowserContext::GetMediaDeviceIDSalt() {
return media_device_id_salt_->GetSalt();
}
PrefService* AlloyBrowserContext::GetPrefs() {
return pref_service_.get();
}

View File

@@ -18,7 +18,6 @@
class CefDownloadManagerDelegate;
class CefSSLHostStateDelegate;
class CefVisitedLinkListener;
class MediaDeviceIDSalt;
class PrefService;
namespace extensions {
@@ -83,7 +82,6 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
override;
content::ReduceAcceptLanguageControllerDelegate*
GetReduceAcceptLanguageControllerDelegate() override;
std::string GetMediaDeviceIDSalt() override;
// Profile overrides.
ChromeZoomLevelPrefs* GetZoomLevelPrefs() override;
@@ -146,8 +144,6 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
std::unique_ptr<DownloadPrefs> download_prefs_;
std::unique_ptr<content::ResourceContext> resource_context_;
scoped_refptr<MediaDeviceIDSalt> media_device_id_salt_;
};
#endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_BROWSER_CONTEXT_H_

View File

@@ -34,12 +34,11 @@
#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 "components/zoom/page_zoom.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/public/browser/desktop_media_id.h"
#include "content/public/browser/file_select_listener.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/keyboard_event_processing_result.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
@@ -47,6 +46,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/input/native_web_keyboard_event.h"
#include "content/public/common/url_constants.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
@@ -330,31 +330,6 @@ CefWindowHandle AlloyBrowserHostImpl::GetOpenerWindowHandle() {
return opener_;
}
double AlloyBrowserHostImpl::GetZoomLevel() {
// Verify that this method is being called on the UI thread.
if (!CEF_CURRENTLY_ON_UIT()) {
DCHECK(false) << "called on invalid thread";
return 0;
}
if (web_contents()) {
return content::HostZoomMap::GetZoomLevel(web_contents());
}
return 0;
}
void AlloyBrowserHostImpl::SetZoomLevel(double zoomLevel) {
if (CEF_CURRENTLY_ON_UIT()) {
if (web_contents()) {
content::HostZoomMap::SetZoomLevel(web_contents(), zoomLevel);
}
} else {
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SetZoomLevel,
this, zoomLevel));
}
}
void AlloyBrowserHostImpl::Find(const CefString& searchText,
bool forward,
bool matchCase,
@@ -1118,6 +1093,11 @@ bool AlloyBrowserHostImpl::DidAddMessageToConsole(
line_no, source_id);
}
void AlloyBrowserHostImpl::ContentsZoomChange(bool zoom_in) {
zoom::PageZoom::Zoom(
web_contents(), zoom_in ? content::PAGE_ZOOM_IN : content::PAGE_ZOOM_OUT);
}
void AlloyBrowserHostImpl::BeforeUnloadFired(content::WebContents* source,
bool proceed,
bool* proceed_to_fire_unload) {
@@ -1158,7 +1138,7 @@ bool AlloyBrowserHostImpl::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
// Check to see if event should be ignored.
if (event.skip_in_browser) {
if (event.skip_if_unhandled) {
return false;
}

View File

@@ -80,8 +80,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
bool TryCloseBrowser() override;
CefWindowHandle GetWindowHandle() override;
CefWindowHandle GetOpenerWindowHandle() override;
double GetZoomLevel() override;
void SetZoomLevel(double zoomLevel) override;
void Find(const CefString& searchText,
bool forward,
bool matchCase,
@@ -204,6 +202,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
const std::u16string& message,
int32_t line_no,
const std::u16string& source_id) override;
void ContentsZoomChange(bool zoom_in) override;
void BeforeUnloadFired(content::WebContents* source,
bool proceed,
bool* proceed_to_fire_unload) override;

View File

@@ -43,6 +43,7 @@
#include "net/base/net_module.h"
#include "third_party/widevine/cdm/buildflags.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/color/color_provider_manager.h"
#include "ui/native_theme/native_theme.h"
#if BUILDFLAG(IS_LINUX)
@@ -233,8 +234,6 @@ void AlloyBrowserMainParts::PostCreateMainMessageLoop() {
config->store = command_line->GetSwitchValueASCII(switches::kPasswordStore);
// Forward the product name (defaults to "Chromium").
config->product_name = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME);
// OSCrypt may target keyring, which requires calls from the main thread.
config->main_thread_runner = content::GetUIThreadTaskRunner({});
// OSCrypt can be disabled in a special settings file.
config->should_use_preference =
command_line->HasSwitch(switches::kEnableEncryptionSelection);

View File

@@ -55,6 +55,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/extensions/chrome_content_browser_client_extensions_part.h"
#include "chrome/browser/media/webrtc/media_device_salt_service_factory.h"
#include "chrome/browser/net/profile_network_context_service.h"
#include "chrome/browser/net/profile_network_context_service_factory.h"
#include "chrome/browser/net/system_network_context_manager.h"
@@ -71,6 +72,7 @@
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
#include "chrome/browser/ui/pdf/chrome_pdf_document_helper_client.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -85,9 +87,10 @@
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/embedder_support/switches.h"
#include "components/embedder_support/user_agent_utils.h"
#include "components/media_device_salt/media_device_salt_service.h"
#include "components/pdf/browser/pdf_document_helper.h"
#include "components/pdf/browser/pdf_navigation_throttle.h"
#include "components/pdf/browser/pdf_url_loader_request_interceptor.h"
#include "components/pdf/browser/pdf_web_contents_helper.h"
#include "components/pdf/common/internal_plugin_helpers.h"
#include "components/policy/core/common/policy_pref_names.h"
#include "components/spellcheck/common/spellcheck.mojom.h"
@@ -322,6 +325,25 @@ const extensions::Extension* GetEnabledExtensionFromSiteURL(
return registry->enabled_extensions().GetByID(site_url.host());
}
std::unique_ptr<blink::URLLoaderThrottle> CreateGoogleURLLoaderThrottle(
Profile* profile) {
chrome::mojom::DynamicParamsPtr dynamic_params =
chrome::mojom::DynamicParams::New(
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
/*bound_session_params=*/nullptr,
#endif
profile->GetPrefs()->GetBoolean(
policy::policy_prefs::kForceGoogleSafeSearch),
profile->GetPrefs()->GetInteger(
policy::policy_prefs::kForceYouTubeRestrict),
profile->GetPrefs()->GetString(prefs::kAllowedDomainsForApps));
return std::make_unique<GoogleURLLoaderThrottle>(
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
/*bound_session_request_throttled_listener=*/nullptr,
#endif
std::move(dynamic_params));
}
} // namespace
AlloyContentBrowserClient::AlloyContentBrowserClient() = default;
@@ -543,13 +565,13 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kMainBundlePath,
#endif
switches::kLocalesDirPath,
switches::kLogItems,
switches::kLogSeverity,
switches::kResourcesDirPath,
embedder_support::kUserAgent,
switches::kUserAgentProductAndVersion,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
std::size(kSwitchNames));
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames);
}
const std::string& process_type =
@@ -567,8 +589,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kUncaughtExceptionStackSize,
network::switches::kUnsafelyTreatInsecureOriginAsSecure,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
std::size(kSwitchNames));
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames);
if (extensions::ExtensionsEnabled()) {
content::RenderProcessHost* process =
@@ -596,8 +617,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
static const char* const kSwitchNames[] = {
switches::kLang,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
std::size(kSwitchNames));
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames);
}
// Necessary to populate DIR_USER_DATA in sub-processes.
@@ -623,8 +643,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
static const char* const kSwitchNames[] = {
switches::kLogFile,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
std::size(kSwitchNames));
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames);
}
if (crash_reporting::Enabled()) {
@@ -718,6 +737,7 @@ void AlloyContentBrowserClient::AllowCertificateError(
}
base::OnceClosure AlloyContentBrowserClient::SelectClientCertificate(
content::BrowserContext* browser_context,
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
net::ClientCertIdentityList client_certs,
@@ -849,8 +869,9 @@ void AlloyContentBrowserClient::
associated_registry.AddInterface<pdf::mojom::PdfService>(base::BindRepeating(
[](content::RenderFrameHost* render_frame_host,
mojo::PendingAssociatedReceiver<pdf::mojom::PdfService> receiver) {
pdf::PDFWebContentsHelper::BindPdfService(std::move(receiver),
render_frame_host);
pdf::PDFDocumentHelper::BindPdfService(
std::move(receiver), render_frame_host,
std::make_unique<ChromePDFDocumentHelperClient>());
},
&render_frame_host));
}
@@ -894,21 +915,28 @@ AlloyContentBrowserClient::CreateURLLoaderThrottles(
Profile* profile = Profile::FromBrowserContext(browser_context);
chrome::mojom::DynamicParamsPtr dynamic_params =
chrome::mojom::DynamicParams::New(
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
/*bound_session_params=*/nullptr,
#endif
profile->GetPrefs()->GetBoolean(
policy::policy_prefs::kForceGoogleSafeSearch),
profile->GetPrefs()->GetInteger(
policy::policy_prefs::kForceYouTubeRestrict),
profile->GetPrefs()->GetString(prefs::kAllowedDomainsForApps));
result.push_back(std::make_unique<GoogleURLLoaderThrottle>(
#if BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
/*bound_session_request_throttled_listener=*/nullptr,
#endif
std::move(dynamic_params)));
if (auto google_throttle = CreateGoogleURLLoaderThrottle(profile)) {
result.push_back(std::move(google_throttle));
}
return result;
}
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
AlloyContentBrowserClient::CreateURLLoaderThrottlesForKeepAlive(
const network::ResourceRequest& request,
content::BrowserContext* browser_context,
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
int frame_tree_node_id) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
std::vector<std::unique_ptr<blink::URLLoaderThrottle>> result;
Profile* profile = Profile::FromBrowserContext(browser_context);
if (auto google_throttle = CreateGoogleURLLoaderThrottle(profile)) {
result.push_back(std::move(google_throttle));
}
return result;
}
@@ -916,7 +944,9 @@ AlloyContentBrowserClient::CreateURLLoaderThrottles(
std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>>
AlloyContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
content::NavigationUIData* navigation_ui_data,
int frame_tree_node_id) {
int frame_tree_node_id,
int64_t navigation_id,
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner) {
std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>>
interceptors;
@@ -1091,7 +1121,8 @@ bool AlloyContentBrowserClient::WillCreateURLLoaderFactory(
header_client,
bool* bypass_redirect_checks,
bool* disable_secure_dns,
network::mojom::URLLoaderFactoryOverridePtr* factory_override) {
network::mojom::URLLoaderFactoryOverridePtr* factory_override,
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner) {
auto request_handler = net_service::CreateInterceptedRequestHandler(
browser_context, frame, render_process_id,
type == URLLoaderFactoryType::kNavigation,
@@ -1285,14 +1316,6 @@ std::string AlloyContentBrowserClient::GetUserAgent() {
return embedder_support::GetUserAgent();
}
std::string AlloyContentBrowserClient::GetFullUserAgent() {
return embedder_support::GetFullUserAgent();
}
std::string AlloyContentBrowserClient::GetReducedUserAgent() {
return embedder_support::GetReducedUserAgent();
}
std::unique_ptr<content::WebContentsViewDelegate>
AlloyContentBrowserClient::GetWebContentsViewDelegate(
content::WebContents* web_contents) {
@@ -1316,16 +1339,32 @@ AlloyContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
return mime_types;
}
bool AlloyContentBrowserClient::ArePersistentMediaDeviceIDsAllowed(
content::BrowserContext* browser_context,
const GURL& url,
void AlloyContentBrowserClient::GetMediaDeviceIDSalt(
content::RenderFrameHost* rfh,
const net::SiteForCookies& site_for_cookies,
const absl::optional<url::Origin>& top_frame_origin) {
const blink::StorageKey& storage_key,
base::OnceCallback<void(bool, const std::string&)> callback) {
GURL url = rfh->GetLastCommittedURL();
url::Origin top_frame_origin = rfh->GetMainFrame()->GetLastCommittedOrigin();
content::BrowserContext* browser_context = rfh->GetBrowserContext();
// Persistent MediaDevice IDs are allowed if cookies are allowed.
return CookieSettingsFactory::GetForProfile(
Profile::FromBrowserContext(browser_context))
->IsFullCookieAccessAllowed(url, site_for_cookies, top_frame_origin,
net::CookieSettingOverrides());
scoped_refptr<content_settings::CookieSettings> cookie_settings =
CookieSettingsFactory::GetForProfile(
Profile::FromBrowserContext(browser_context));
bool allowed = cookie_settings->IsFullCookieAccessAllowed(
url, site_for_cookies, top_frame_origin,
cookie_settings->SettingOverridesForStorage());
media_device_salt::MediaDeviceSaltService* salt_service =
MediaDeviceSaltServiceFactory::GetInstance()->GetForBrowserContext(
browser_context);
if (!salt_service) {
std::move(callback).Run(allowed, browser_context->UniqueId());
return;
}
salt_service->GetSalt(rfh->GetStorageKey(),
base::BindOnce(std::move(callback), allowed));
}
void AlloyContentBrowserClient::OnWebContentsCreated(

View File

@@ -89,6 +89,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
base::OnceCallback<void(content::CertificateRequestResultType)> callback)
override;
base::OnceClosure SelectClientCertificate(
content::BrowserContext* browser_context,
content::WebContents* web_contents,
net::SSLCertRequestInfo* cert_request_info,
net::ClientCertIdentityList client_certs,
@@ -129,10 +130,19 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
content::NavigationUIData* navigation_ui_data,
int frame_tree_node_id) override;
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
CreateURLLoaderThrottlesForKeepAlive(
const network::ResourceRequest& request,
content::BrowserContext* browser_context,
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
int frame_tree_node_id) override;
std::vector<std::unique_ptr<content::URLLoaderRequestInterceptor>>
WillCreateURLLoaderRequestInterceptors(
content::NavigationUIData* navigation_ui_data,
int frame_tree_node_id) override;
int frame_tree_node_id,
int64_t navigation_id,
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner)
override;
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
void GetAdditionalMappedFilesForChildProcess(
@@ -178,7 +188,9 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
header_client,
bool* bypass_redirect_checks,
bool* disable_secure_dns,
network::mojom::URLLoaderFactoryOverridePtr* factory_override) override;
network::mojom::URLLoaderFactoryOverridePtr* factory_override,
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner)
override;
void OnNetworkServiceCreated(
network::mojom::NetworkService* network_service) override;
bool ConfigureNetworkContextParams(
@@ -230,18 +242,16 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
std::string GetProduct() override;
std::string GetChromeProduct() override;
std::string GetUserAgent() override;
std::string GetFullUserAgent() override;
std::string GetReducedUserAgent() override;
std::unique_ptr<content::WebContentsViewDelegate> GetWebContentsViewDelegate(
content::WebContents* web_contents) override;
blink::UserAgentMetadata GetUserAgentMetadata() override;
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(
content::BrowserContext* browser_context) override;
bool ArePersistentMediaDeviceIDsAllowed(
content::BrowserContext* browser_context,
const GURL& scope,
void GetMediaDeviceIDSalt(
content::RenderFrameHost* rfh,
const net::SiteForCookies& site_for_cookies,
const absl::optional<url::Origin>& top_frame_origin) override;
const blink::StorageKey& storage_key,
base::OnceCallback<void(bool, const std::string&)> callback) override;
void OnWebContentsCreated(content::WebContents* web_contents) override;
bool IsFindInPageDisabledForOrigin(const url::Origin& origin) override;

View File

@@ -171,11 +171,7 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
permissions::PermissionRequestManager::CreateForWebContents(web_contents_);
PrefsTabHelper::CreateForWebContents(web_contents_);
printing::PrintViewManager::CreateForWebContents(web_contents_);
if (extensions::ExtensionsEnabled()) {
// Used by the tabs extension API.
zoom::ZoomController::CreateForWebContents(web_contents_);
}
zoom::ZoomController::CreateForWebContents(web_contents_);
javascript_dialogs::TabModalDialogManager::CreateForWebContents(
web_contents_,

View File

@@ -34,7 +34,6 @@
#include "content/public/browser/network_service_instance.h"
#include "content/public/common/content_switches.h"
#include "net/log/net_log_capture_mode.h"
#include "services/device/public/cpp/geolocation/geolocation_manager.h"
#include "services/network/public/cpp/network_switches.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
@@ -146,11 +145,6 @@ void ChromeBrowserProcessAlloy::FlushLocalStateAndReply(
DCHECK(false);
}
device::GeolocationManager* ChromeBrowserProcessAlloy::geolocation_manager() {
DCHECK(false);
return nullptr;
}
metrics_services_manager::MetricsServicesManager*
ChromeBrowserProcessAlloy::GetMetricsServicesManager() {
DCHECK(false);
@@ -235,11 +229,6 @@ ChromeBrowserProcessAlloy::notification_platform_bridge() {
return nullptr;
}
void ChromeBrowserProcessAlloy::SetGeolocationManager(
std::unique_ptr<device::GeolocationManager> geolocation_manager) {
DCHECK(false);
}
policy::ChromeBrowserPolicyConnector*
ChromeBrowserProcessAlloy::browser_policy_connector() {
if (!browser_policy_connector_) {
@@ -428,13 +417,12 @@ ChromeBrowserProcessAlloy::serial_policy_allowed_ports() {
return nullptr;
}
HidPolicyAllowedDevices*
ChromeBrowserProcessAlloy::hid_policy_allowed_devices() {
DCHECK(false);
return nullptr;
}
HidSystemTrayIcon* ChromeBrowserProcessAlloy::hid_system_tray_icon() {
DCHECK(false);
return nullptr;
}
UsbSystemTrayIcon* ChromeBrowserProcessAlloy::usb_system_tray_icon() {
DCHECK(false);
return nullptr;
}

View File

@@ -51,7 +51,6 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
// BrowserProcess implementation.
void EndSession() override;
void FlushLocalStateAndReply(base::OnceClosure reply) override;
device::GeolocationManager* geolocation_manager() override;
metrics_services_manager::MetricsServicesManager* GetMetricsServicesManager()
override;
metrics::MetricsService* metrics_service() override;
@@ -68,8 +67,6 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
extensions::EventRouterForwarder* extension_event_router_forwarder() override;
NotificationUIManager* notification_ui_manager() override;
NotificationPlatformBridge* notification_platform_bridge() override;
void SetGeolocationManager(
std::unique_ptr<device::GeolocationManager> geolocation_manager) override;
policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
policy::PolicyService* policy_service() override;
IconManager* icon_manager() override;
@@ -111,8 +108,8 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
override;
BuildState* GetBuildState() override;
SerialPolicyAllowedPorts* serial_policy_allowed_ports() override;
HidPolicyAllowedDevices* hid_policy_allowed_devices() override;
HidSystemTrayIcon* hid_system_tray_icon() override;
UsbSystemTrayIcon* usb_system_tray_icon() override;
private:
bool initialized_;

View File

@@ -43,7 +43,7 @@ AlloyWebContentsDialogHelper::GetWebContentsModalDialogHost() {
}
gfx::NativeView AlloyWebContentsDialogHelper::GetHostView() const {
// Windowless rendering uses GetHostWidget() instead.
// Windowless rendering uses GetAcceleratedWidget() instead.
if (browser_delegate_->IsWindowless()) {
return gfx::NativeView();
}
@@ -55,7 +55,8 @@ gfx::NativeView AlloyWebContentsDialogHelper::GetHostView() const {
return gfx::NativeView();
}
gfx::AcceleratedWidget AlloyWebContentsDialogHelper::GetHostWidget() const {
gfx::AcceleratedWidget AlloyWebContentsDialogHelper::GetAcceleratedWidget()
const {
#if defined(USE_AURA)
// Windowed rendering uses GetHostView() instead.
if (!browser_delegate_->IsWindowless()) {

View File

@@ -31,7 +31,7 @@ class AlloyWebContentsDialogHelper
// web_modal::WebContentsModalDialogHost methods:
gfx::NativeView GetHostView() const override;
gfx::AcceleratedWidget GetHostWidget() const override;
gfx::AcceleratedWidget GetAcceleratedWidget() const override;
gfx::Point GetDialogPosition(const gfx::Size& size) override;
gfx::Size GetMaximumDialogSize() override;
void AddObserver(web_modal::ModalDialogHostObserver* observer) override;

View File

@@ -13,7 +13,6 @@
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/public/browser/focused_node_details.h"
#include "content/public/browser/keyboard_event_processing_result.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/notification_details.h"
@@ -23,6 +22,7 @@
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_observer.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/common/input/native_web_keyboard_event.h"
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
#include "third_party/blink/public/mojom/widget/platform_widget.mojom-test-utils.h"
@@ -278,7 +278,7 @@ bool CefBrowserContentsDelegate::HandleKeyboardEvent(
content::WebContents* source,
const content::NativeWebKeyboardEvent& event) {
// Check to see if event should be ignored.
if (event.skip_in_browser) {
if (event.skip_if_unhandled) {
return false;
}

View File

@@ -8,6 +8,7 @@
#include "base/feature_list.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/media/router/chrome_media_router_factory.h"
#include "chrome/browser/media/webrtc/media_device_salt_service_factory.h"
#include "chrome/browser/plugins/plugin_prefs_factory.h"
#include "chrome/browser/profiles/renderer_updater_factory.h"
#include "chrome/browser/reduce_accept_language/reduce_accept_language_factory.h"
@@ -24,6 +25,7 @@ namespace cef {
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
CookieSettingsFactory::GetInstance();
MediaDeviceSaltServiceFactory::GetInstance();
media_router::ChromeMediaRouterFactory::GetInstance();
PluginPrefsFactory::GetInstance();
PrefsTabHelper::GetServiceInstance();

View File

@@ -44,7 +44,7 @@ void CefBrowserFrame::SendMessage(const std::string& name,
void CefBrowserFrame::SendSharedMemoryRegion(
const std::string& name,
base::ReadOnlySharedMemoryRegion region) {
base::WritableSharedMemoryRegion region) {
// Always send to the newly created RFH, which may be speculative when
// navigating cross-origin.
if (auto host = GetFrameHost(/*prefer_speculative=*/true)) {

View File

@@ -38,7 +38,7 @@ class CefBrowserFrame
void SendMessage(const std::string& name,
base::Value::List arguments) override;
void SendSharedMemoryRegion(const std::string& name,
base::ReadOnlySharedMemoryRegion region) override;
base::WritableSharedMemoryRegion region) override;
void FrameAttached(mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,
bool reattached) override;
void UpdateDraggableRegions(

View File

@@ -20,8 +20,11 @@
#include "chrome/browser/platform_util.h"
#include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/spellchecker/spellcheck_service.h"
#include "chrome/browser/ui/browser_commands.h"
#include "components/favicon/core/favicon_url.h"
#include "components/spellcheck/common/spellcheck_features.h"
#include "components/zoom/page_zoom.h"
#include "components/zoom/zoom_controller.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/download_manager.h"
@@ -236,6 +239,109 @@ CefRefPtr<CefRequestContext> CefBrowserHostBase::GetRequestContext() {
return request_context_;
}
bool CefBrowserHostBase::CanZoom(cef_zoom_command_t command) {
// Verify that this method is being called on the UI thread.
if (!CEF_CURRENTLY_ON_UIT()) {
DCHECK(false) << "called on invalid thread";
return false;
}
if (auto web_contents = GetWebContents()) {
switch (command) {
case CEF_ZOOM_COMMAND_OUT:
return chrome::CanZoomOut(web_contents);
case CEF_ZOOM_COMMAND_RESET:
return chrome::CanResetZoom(web_contents);
case CEF_ZOOM_COMMAND_IN:
return chrome::CanZoomIn(web_contents);
}
}
return false;
}
void CefBrowserHostBase::Zoom(cef_zoom_command_t command) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostBase::Zoom, this, command));
return;
}
if (auto web_contents = GetWebContents()) {
const content::PageZoom page_zoom = [command]() {
switch (command) {
case CEF_ZOOM_COMMAND_OUT:
return content::PAGE_ZOOM_OUT;
case CEF_ZOOM_COMMAND_RESET:
return content::PAGE_ZOOM_RESET;
case CEF_ZOOM_COMMAND_IN:
return content::PAGE_ZOOM_IN;
}
}();
// Same implementation as chrome::Zoom(), but explicitly specifying the
// WebContents.
zoom::PageZoom::Zoom(web_contents, page_zoom);
}
}
double CefBrowserHostBase::GetDefaultZoomLevel() {
// Verify that this method is being called on the UI thread.
if (!CEF_CURRENTLY_ON_UIT()) {
DCHECK(false) << "called on invalid thread";
return 0.0;
}
if (auto web_contents = GetWebContents()) {
zoom::ZoomController* zoom_controller =
zoom::ZoomController::FromWebContents(web_contents);
if (zoom_controller) {
return zoom_controller->GetDefaultZoomLevel();
}
}
return 0.0;
}
double CefBrowserHostBase::GetZoomLevel() {
// Verify that this method is being called on the UI thread.
if (!CEF_CURRENTLY_ON_UIT()) {
DCHECK(false) << "called on invalid thread";
return 0.0;
}
if (auto web_contents = GetWebContents()) {
zoom::ZoomController* zoom_controller =
zoom::ZoomController::FromWebContents(web_contents);
if (zoom_controller) {
return zoom_controller->GetZoomLevel();
}
}
return 0.0;
}
void CefBrowserHostBase::SetZoomLevel(double zoomLevel) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostBase::SetZoomLevel,
this, zoomLevel));
return;
}
if (auto web_contents = GetWebContents()) {
zoom::ZoomController* zoom_controller =
zoom::ZoomController::FromWebContents(web_contents);
if (zoom_controller) {
if (zoomLevel == 0.0) {
// Same logic as PageZoom::Zoom(PAGE_ZOOM_RESET).
zoomLevel = zoom_controller->GetDefaultZoomLevel();
web_contents->SetPageScale(1.f);
}
zoom_controller->SetZoomLevel(zoomLevel);
}
}
}
bool CefBrowserHostBase::HasView() {
return is_views_hosted_;
}
@@ -527,6 +633,31 @@ void CefBrowserHostBase::NotifyMoveOrResizeStarted() {
#endif
}
bool CefBrowserHostBase::IsFullscreen() {
if (!CEF_CURRENTLY_ON_UIT()) {
DCHECK(false) << "called on invalid thread";
return false;
}
if (auto web_contents = GetWebContents()) {
return web_contents->IsFullscreen();
}
return false;
}
void CefBrowserHostBase::ExitFullscreen(bool will_cause_resize) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostBase::ExitFullscreen,
this, will_cause_resize));
return;
}
auto web_contents = GetWebContents();
if (web_contents && web_contents->IsFullscreen()) {
web_contents->ExitFullscreen(will_cause_resize);
}
}
void CefBrowserHostBase::ReplaceMisspelling(const CefString& word) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(

View File

@@ -169,6 +169,11 @@ class CefBrowserHostBase : public CefBrowserHost,
CefRefPtr<CefBrowser> GetBrowser() override;
CefRefPtr<CefClient> GetClient() override;
CefRefPtr<CefRequestContext> GetRequestContext() override;
bool CanZoom(cef_zoom_command_t command) override;
void Zoom(cef_zoom_command_t command) override;
double GetDefaultZoomLevel() override;
double GetZoomLevel() override;
void SetZoomLevel(double zoomLevel) override;
bool HasView() override;
void SetFocus(bool focus) override;
void RunFileDialog(FileDialogMode mode,
@@ -207,6 +212,8 @@ class CefBrowserHostBase : public CefBrowserHost,
bool current_only) override;
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
void NotifyMoveOrResizeStarted() override;
bool IsFullscreen() override;
void ExitFullscreen(bool will_cause_resize) override;
// CefBrowser methods:
bool IsValid() override;

View File

@@ -10,8 +10,8 @@
#include "base/message_loop/message_pump_for_ui.h"
#if BUILDFLAG(IS_MAC)
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/message_loop/message_pump_mac.h"
#include "base/apple/scoped_nsautorelease_pool.h"
#include "base/message_loop/message_pump_apple.h"
#endif
#include "content/public/browser/browser_thread.h"
@@ -30,7 +30,7 @@ class MessagePumpExternal : public base::MessagePumpForUI {
base::TimeTicks start = base::TimeTicks::Now();
while (true) {
#if BUILDFLAG(IS_MAC)
base::mac::ScopedNSAutoreleasePool autorelease_pool;
base::apple::ScopedNSAutoreleasePool autorelease_pool;
#endif
base::TimeTicks next_run_time; // is_null()
@@ -115,7 +115,7 @@ std::unique_ptr<base::MessagePump> MessagePumpFactoryForUI() {
}
#if BUILDFLAG(IS_MAC)
return base::MessagePumpMac::Create();
return base::message_pump_apple::Create();
#else
return std::make_unique<base::MessagePumpForUI>();
#endif

View File

@@ -5,12 +5,30 @@
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/thread_util.h"
#include "base/logging.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/shell_integration.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
namespace {
void ExecuteExternalProtocol(const GURL& url) {
CEF_REQUIRE_BLOCKING();
// Check that an application is associated with the scheme.
if (shell_integration::GetApplicationNameForScheme(url).empty()) {
return;
}
CEF_POST_TASK(TID_UI, base::BindOnce(&platform_util::OpenExternal, url));
}
} // namespace
CefBrowserPlatformDelegate::CefBrowserPlatformDelegate() = default;
CefBrowserPlatformDelegate::~CefBrowserPlatformDelegate() {
@@ -225,6 +243,11 @@ bool CefBrowserPlatformDelegate::IsNeverComposited(
return false;
}
// static
void CefBrowserPlatformDelegate::HandleExternalProtocol(const GURL& url) {
CEF_POST_USER_VISIBLE_TASK(base::BindOnce(ExecuteExternalProtocol, url));
}
CefEventHandle CefBrowserPlatformDelegate::GetEventHandle(
const content::NativeWebKeyboardEvent& event) const {
DCHECK(false);

View File

@@ -4,7 +4,7 @@
#include "libcef/browser/browser_util.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/common/input/native_web_keyboard_event.h"
namespace browser_util {

View File

@@ -11,6 +11,8 @@
#include "base/memory/scoped_refptr.h"
#include "chrome/browser/ui/page_action/page_action_icon_type.h"
#include "content/public/browser/web_contents_delegate.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/base/window_open_disposition.h"
class Browser;
@@ -33,7 +35,8 @@ class BrowserDelegate : public content::WebContentsDelegate {
// Called from the Browser constructor to create a new delegate.
static std::unique_ptr<BrowserDelegate> Create(
Browser* browser,
scoped_refptr<CreateParams> cef_params);
scoped_refptr<CreateParams> cef_params,
const Browser* opener);
~BrowserDelegate() override {}
@@ -103,6 +106,29 @@ class BrowserDelegate : public content::WebContentsDelegate {
content::MediaResponseCallback callback) {
return callback;
}
// Optionally override support for the specified window feature of type
// Browser::WindowFeature.
virtual absl::optional<bool> SupportsWindowFeature(int feature) const {
return absl::nullopt;
}
// Returns true if draggable regions are supported.
virtual bool SupportsDraggableRegion() const { return false; }
// Returns the draggable region, if any, relative to the web contents.
// Called from PictureInPictureBrowserFrameView::NonClientHitTest and
// BrowserView::ShouldDescendIntoChildForEventHandling.
virtual const absl::optional<SkRegion> GetDraggableRegion() const {
return absl::nullopt;
}
// Set the draggable region relative to web contents.
// Called from DraggableRegionsHostImpl::UpdateDraggableRegions.
virtual void UpdateDraggableRegion(const SkRegion& region) {}
// Called at the end of a fullscreen transition.
virtual void WindowFullscreenStateChanged() {}
};
} // namespace cef

View File

@@ -4,6 +4,7 @@
#include "libcef/browser/chrome/chrome_browser_context.h"
#include "libcef/browser/prefs/browser_prefs.h"
#include "libcef/browser/thread_util.h"
#include "base/threading/thread_restrictions.h"
@@ -167,6 +168,8 @@ void ChromeBrowserContext::ProfileCreated(Profile::CreateStatus status,
: SessionStartupPref::kPrefValueNewTab);
}
browser_prefs::SetInitialProfilePrefs(profile_);
if (!init_callbacks_.empty()) {
for (auto& callback : init_callbacks_) {
std::move(callback).Run();

View File

@@ -11,8 +11,11 @@
#include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
#include "libcef/browser/chrome/views/chrome_browser_view.h"
#include "libcef/browser/media_access_query.h"
#include "libcef/browser/request_context_impl.h"
#include "libcef/browser/views/browser_view_impl.h"
#include "libcef/browser/views/window_impl.h"
#include "libcef/common/app_manager.h"
#include "libcef/common/frame_util.h"
@@ -21,15 +24,27 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/keyboard_event_processing_result.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/common/input/native_web_keyboard_event.h"
using content::KeyboardEventProcessingResult;
ChromeBrowserDelegate::ChromeBrowserDelegate(
Browser* browser,
const CefBrowserCreateParams& create_params)
const CefBrowserCreateParams& create_params,
const Browser* opener)
: browser_(browser), create_params_(create_params) {
DCHECK(browser_);
if (opener) {
DCHECK(browser->is_type_picture_in_picture());
auto opener_host = ChromeBrowserHostImpl::GetBrowserForBrowser(opener);
DCHECK(opener_host);
if (opener_host) {
opener_host_ = opener_host->GetWeakPtr();
}
}
}
ChromeBrowserDelegate::~ChromeBrowserDelegate() = default;
@@ -195,6 +210,73 @@ ChromeBrowserDelegate::RequestMediaAccessPermissionEx(
return callback;
}
bool ChromeBrowserDelegate::SupportsFramelessPictureInPicture() const {
if (!browser_->is_type_picture_in_picture()) {
return false;
}
if (frameless_pip_.has_value()) {
return *frameless_pip_;
}
frameless_pip_ = false;
if (opener_host_) {
if (auto chrome_browser_view = opener_host_->chrome_browser_view()) {
if (auto cef_delegate = chrome_browser_view->cef_delegate()) {
frameless_pip_ = cef_delegate->UseFramelessWindowForPictureInPicture(
chrome_browser_view->cef_browser_view());
}
}
}
return *frameless_pip_;
}
absl::optional<bool> ChromeBrowserDelegate::SupportsWindowFeature(
int feature) const {
// Override the default value from
// Browser::PictureInPictureBrowserSupportsWindowFeature.
if (feature == Browser::FEATURE_TITLEBAR &&
browser_->is_type_picture_in_picture()) {
// Return false to hide titlebar and enable draggable regions.
return !SupportsFramelessPictureInPicture();
}
return absl::nullopt;
}
bool ChromeBrowserDelegate::SupportsDraggableRegion() const {
return SupportsFramelessPictureInPicture();
}
const absl::optional<SkRegion> ChromeBrowserDelegate::GetDraggableRegion()
const {
DCHECK(SupportsDraggableRegion());
return draggable_region_;
}
void ChromeBrowserDelegate::UpdateDraggableRegion(const SkRegion& region) {
DCHECK(SupportsDraggableRegion());
draggable_region_ = region;
}
void ChromeBrowserDelegate::WindowFullscreenStateChanged() {
// Use a synchronous callback for notification on Windows/Linux. MacOS gets
// notified asynchronously via CefNativeWidgetMac callbacks.
#if !BUILDFLAG(IS_MAC)
if (auto browser = ChromeBrowserHostImpl::GetBrowserForBrowser(browser_)) {
if (auto chrome_browser_view = browser->chrome_browser_view()) {
auto* cef_window = chrome_browser_view->cef_browser_view()->cef_window();
if (auto* delegate = cef_window->delegate()) {
// Give the CefWindowDelegate a chance to handle the event.
delegate->OnWindowFullscreenTransition(cef_window,
/*is_completed=*/true);
}
}
}
#endif
}
void ChromeBrowserDelegate::WebContentsCreated(
content::WebContents* source_contents,
int opener_render_process_id,
@@ -299,6 +381,14 @@ void ChromeBrowserDelegate::ExitFullscreenModeForTab(
if (auto delegate = GetDelegateForWebContents(web_contents)) {
delegate->ExitFullscreenModeForTab(web_contents);
}
// Workaround for https://crbug.com/1500371. Ensure WebContents exits
// fullscreen state by explicitly sending a resize message.
if (auto* rwhv = web_contents->GetRenderWidgetHostView()) {
if (auto* render_widget_host = rwhv->GetRenderWidgetHost()) {
render_widget_host->SynchronizeVisualProperties();
}
}
}
void ChromeBrowserDelegate::CanDownload(
@@ -397,7 +487,12 @@ namespace cef {
// static
std::unique_ptr<BrowserDelegate> BrowserDelegate::Create(
Browser* browser,
scoped_refptr<CreateParams> cef_params) {
scoped_refptr<CreateParams> cef_params,
const Browser* opener) {
if (!cef::IsChromeRuntimeEnabled()) {
return nullptr;
}
CefBrowserCreateParams create_params;
// Parameters from ChromeBrowserHostImpl::Create, or nullptr if the Browser
@@ -412,7 +507,8 @@ std::unique_ptr<BrowserDelegate> BrowserDelegate::Create(
params->create_params_.browser_view = nullptr;
}
return std::make_unique<ChromeBrowserDelegate>(browser, create_params);
return std::make_unique<ChromeBrowserDelegate>(browser, create_params,
opener);
}
} // namespace cef

View File

@@ -40,7 +40,8 @@ class ChromeBrowserHostImpl;
class ChromeBrowserDelegate : public cef::BrowserDelegate {
public:
ChromeBrowserDelegate(Browser* browser,
const CefBrowserCreateParams& create_params);
const CefBrowserCreateParams& create_params,
const Browser* opener);
ChromeBrowserDelegate(const ChromeBrowserDelegate&) = delete;
ChromeBrowserDelegate& operator=(const ChromeBrowserDelegate&) = delete;
@@ -65,6 +66,11 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) override;
absl::optional<bool> SupportsWindowFeature(int feature) const override;
bool SupportsDraggableRegion() const override;
const absl::optional<SkRegion> GetDraggableRegion() const override;
void UpdateDraggableRegion(const SkRegion& region) override;
void WindowFullscreenStateChanged() override;
// WebContentsDelegate methods:
void WebContentsCreated(content::WebContents* source_contents,
@@ -113,12 +119,17 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
CefBrowserContentsDelegate* GetDelegateForWebContents(
content::WebContents* web_contents);
bool SupportsFramelessPictureInPicture() const;
Browser* const browser_;
base::WeakPtr<ChromeBrowserHostImpl> opener_host_;
// Used when creating a new browser host.
const CefBrowserCreateParams create_params_;
absl::optional<bool> show_status_bubble_;
absl::optional<SkRegion> draggable_region_;
mutable absl::optional<bool> frameless_pip_;
};
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_DELEGATE_H_

View File

@@ -124,8 +124,17 @@ void ChromeBrowserHostImpl::AddNewContents(
void ChromeBrowserHostImpl::OnWebContentsDestroyed(
content::WebContents* web_contents) {
platform_delegate_->WebContentsDestroyed(web_contents);
DestroyBrowser();
// GetWebContents() should return nullptr at this point.
DCHECK(!GetWebContents());
// In most cases WebContents destruction will trigger browser destruction.
// The exception is if the browser still exists at CefShutdown, in which
// case DestroyBrowser() will be called first via
// CefBrowserInfoManager::DestroyAllBrowsers().
if (platform_delegate_) {
platform_delegate_->WebContentsDestroyed(web_contents);
DestroyBrowser();
}
}
void ChromeBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
@@ -179,15 +188,6 @@ CefWindowHandle ChromeBrowserHostImpl::GetOpenerWindowHandle() {
return kNullWindowHandle;
}
double ChromeBrowserHostImpl::GetZoomLevel() {
NOTIMPLEMENTED();
return 0.0;
}
void ChromeBrowserHostImpl::SetZoomLevel(double zoomLevel) {
NOTIMPLEMENTED();
}
void ChromeBrowserHostImpl::Find(const CefString& searchText,
bool forward,
bool matchCase,
@@ -332,6 +332,13 @@ bool ChromeBrowserHostImpl::IsBackgroundHost() {
return false;
}
ChromeBrowserView* ChromeBrowserHostImpl::chrome_browser_view() const {
if (browser_ && is_views_hosted_) {
return static_cast<ChromeBrowserView*>(browser_->window());
}
return nullptr;
}
bool ChromeBrowserHostImpl::Navigate(const content::OpenURLParams& params) {
CEF_REQUIRE_UIT();
if (GetCurrentTabIndex() == TabStripModel::kNoTab) {
@@ -413,8 +420,7 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
auto view_impl =
static_cast<CefBrowserViewImpl*>(params.browser_view.get());
chrome_browser_view =
static_cast<ChromeBrowserView*>(view_impl->root_view());
chrome_browser_view = view_impl->chrome_browser_view();
chrome_params.window = chrome_browser_view;
auto chrome_widget =
@@ -433,8 +439,7 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
if (chrome_browser_view) {
// Initialize the BrowserFrame and BrowserView and create the controls that
// require access to the Browser.
chrome_browser_view->InitBrowser(base::WrapUnique(browser),
params.browser_view);
chrome_browser_view->InitBrowser(base::WrapUnique(browser));
// Don't set theme colors in ContentsWebView::UpdateBackgroundColor.
chrome_browser_view->contents_web_view()->SetBackgroundVisible(false);
@@ -514,10 +519,8 @@ void ChromeBrowserHostImpl::SetBrowser(Browser* browser) {
void ChromeBrowserHostImpl::WindowDestroyed() {
CEF_REQUIRE_UIT();
if (browser_ && is_views_hosted_) {
auto chrome_browser_view =
static_cast<ChromeBrowserView*>(browser_->window());
chrome_browser_view->Destroyed();
if (auto view = chrome_browser_view()) {
view->Destroyed();
}
platform_delegate_->CloseHostWindow();
@@ -531,14 +534,34 @@ bool ChromeBrowserHostImpl::WillBeDestroyed() const {
void ChromeBrowserHostImpl::DestroyBrowser() {
CEF_REQUIRE_UIT();
browser_ = nullptr;
// Notify that this browser has been destroyed. These must be delivered in
// the expected order.
// 1. Notify the platform delegate. With Views this will result in a call to
// CefBrowserViewDelegate::OnBrowserDestroyed().
platform_delegate_->NotifyBrowserDestroyed();
// 2. Notify the browser's LifeSpanHandler. This must always be the last
// notification for this browser.
OnBeforeClose();
// Notify any observers that may have state associated with this browser.
OnBrowserDestroyed();
// If the WebContents still exists at this point, signal destruction before
// browser destruction.
if (auto web_contents = GetWebContents()) {
platform_delegate_->WebContentsDestroyed(web_contents);
}
// Disassociate the platform delegate from this browser.
platform_delegate_->BrowserDestroyed(this);
// Clean up UI thread state.
browser_ = nullptr;
weak_ptr_factory_.InvalidateWeakPtrs();
CefBrowserHostBase::DestroyBrowser();
}

View File

@@ -11,8 +11,11 @@
#include "libcef/browser/browser_host_base.h"
#include "libcef/browser/chrome/browser_delegate.h"
#include "base/memory/weak_ptr.h"
class Browser;
class ChromeBrowserDelegate;
class ChromeBrowserView;
// CefBrowser implementation for the chrome runtime. Method calls are delegated
// to the chrome Browser object or the WebContents as appropriate. See the
@@ -64,8 +67,6 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
bool TryCloseBrowser() override;
CefWindowHandle GetWindowHandle() override;
CefWindowHandle GetOpenerWindowHandle() override;
double GetZoomLevel() override;
void SetZoomLevel(double zoomLevel) override;
void Find(const CefString& searchText,
bool forward,
bool matchCase,
@@ -114,6 +115,15 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
CefRefPtr<CefExtension> GetExtension() override;
bool IsBackgroundHost() override;
Browser* browser() const { return browser_; }
// Return the CEF specialization of BrowserView.
ChromeBrowserView* chrome_browser_view() const;
base::WeakPtr<ChromeBrowserHostImpl> GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}
protected:
bool Navigate(const content::OpenURLParams& params) override;
@@ -157,6 +167,8 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
Browser* browser_ = nullptr;
CefWindowHandle host_window_handle_ = kNullWindowHandle;
base::WeakPtrFactory<ChromeBrowserHostImpl> weak_ptr_factory_{this};
};
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_HOST_IMPL_H_

View File

@@ -115,8 +115,7 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
static const char* const kSwitchNames[] = {
switches::kUserAgentProductAndVersion,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
std::size(kSwitchNames));
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames);
}
const std::string& process_type =
@@ -127,8 +126,7 @@ void ChromeContentBrowserClientCef::AppendExtraCommandLineSwitches(
static const char* const kSwitchNames[] = {
switches::kUncaughtExceptionStackSize,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
std::size(kSwitchNames));
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames);
}
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
@@ -241,7 +239,8 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
header_client,
bool* bypass_redirect_checks,
bool* disable_secure_dns,
network::mojom::URLLoaderFactoryOverridePtr* factory_override) {
network::mojom::URLLoaderFactoryOverridePtr* factory_override,
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner) {
// Don't intercept requests for Profiles that were not created by CEF.
// For example, the User Manager profile created via
// profiles::CreateSystemProfileForUserManager.
@@ -250,7 +249,8 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
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);
bypass_redirect_checks, disable_secure_dns, factory_override,
navigation_response_task_runner);
}
// Based on content/browser/devtools/devtools_instrumentation.cc
@@ -281,7 +281,7 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
navigation_id, ukm_source_id,
&(intercepting_factory->overridden_factory_receiver),
/*header_client=*/nullptr, bypass_redirect_checks, disable_secure_dns,
handler_override);
handler_override, navigation_response_task_runner);
if (use_proxy) {
DCHECK(intercepting_factory->overriding_factory);
@@ -411,17 +411,6 @@ bool ChromeContentBrowserClientCef::ConfigureNetworkContextParams(
cef_context ? cef_context->GetCookieableSchemes()
: CefBrowserContext::GetGlobalCookieableSchemes();
// Prefer the CEF settings configuration, if specified, instead of the
// kAcceptLanguages preference which is controlled by the
// chrome://settings/languages configuration.
const std::string& accept_language_list =
browser_prefs::GetAcceptLanguageList(cef_context, /*browser=*/nullptr,
/*expand=*/true);
if (!accept_language_list.empty() &&
accept_language_list != network_context_params->accept_language) {
network_context_params->accept_language = accept_language_list;
}
return true;
}

View File

@@ -68,7 +68,9 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
header_client,
bool* bypass_redirect_checks,
bool* disable_secure_dns,
network::mojom::URLLoaderFactoryOverridePtr* factory_override) override;
network::mojom::URLLoaderFactoryOverridePtr* factory_override,
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner)
override;
bool HandleExternalProtocol(
const GURL& url,
content::WebContents::Getter web_contents_getter,

View File

@@ -7,7 +7,9 @@
#include "include/views/cef_window.h"
#include "libcef/browser/views/window_impl.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "chrome/browser/ui/browser.h"
#include "components/zoom/zoom_controller.h"
#include "ui/views/widget/widget.h"
namespace {
@@ -77,8 +79,30 @@ void CefBrowserPlatformDelegateChromeViews::BrowserCreated(
}
void CefBrowserPlatformDelegateChromeViews::NotifyBrowserCreated() {
if (browser_view_->delegate()) {
browser_view_->delegate()->OnBrowserCreated(browser_view_, browser_);
if (auto delegate = browser_view_->delegate()) {
delegate->OnBrowserCreated(browser_view_, browser_);
// DevTools windows hide the notification bubble by default. However, we
// don't currently have the ability to intercept WebContents creation via
// DevToolsWindow::Create(), so |show_by_default| will always be true here.
const bool show_by_default =
!DevToolsWindow::IsDevToolsWindow(web_contents_);
bool show_zoom_bubble = show_by_default;
const auto& state = browser_->settings().chrome_zoom_bubble;
if (show_by_default && state == STATE_DISABLED) {
show_zoom_bubble = false;
} else if (!show_by_default && state == STATE_ENABLED) {
show_zoom_bubble = true;
}
if (show_zoom_bubble != show_by_default) {
// We may be called before TabHelpers::AttachTabHelpers(), so create
// the ZoomController if necessary.
zoom::ZoomController::CreateForWebContents(web_contents_);
zoom::ZoomController::FromWebContents(web_contents_)
->SetShowsNotificationBubble(show_zoom_bubble);
}
}
}

View File

@@ -6,6 +6,7 @@
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#if BUILDFLAG(IS_MAC)
@@ -17,10 +18,10 @@
void ChromeBrowserFrame::Init(BrowserView* browser_view,
std::unique_ptr<Browser> browser) {
DCHECK(browser_view);
DCHECK(browser);
DCHECK(!browser_);
browser_ = browser.get();
DCHECK(browser_);
DCHECK(!browser_view_);
browser_view_ = browser_view;
// Initialize BrowserFrame state.
InitBrowserView(browser_view);
@@ -42,6 +43,10 @@ void ChromeBrowserFrame::Init(BrowserView* browser_view,
#endif // BUILDFLAG(IS_MAC)
}
void ChromeBrowserFrame::ToggleFullscreenMode() {
chrome::ToggleFullscreenMode(browser_view_->browser());
}
views::internal::RootView* ChromeBrowserFrame::CreateRootView() {
// Bypass the BrowserFrame implementation.
return views::Widget::CreateRootView();

View File

@@ -97,13 +97,17 @@ class ChromeBrowserFrame : public BrowserFrame {
void Init(BrowserView* browser_view, std::unique_ptr<Browser> browser);
void ToggleFullscreenMode();
// views::Widget methods:
views::internal::RootView* CreateRootView() override;
std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView()
override;
BrowserView* browser_view() const { return browser_view_; }
private:
Browser* browser_ = nullptr;
BrowserView* browser_view_ = nullptr;
};
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_FRAME_H_

View File

@@ -7,27 +7,19 @@
#include "libcef/browser/chrome/views/chrome_browser_frame.h"
#include "libcef/browser/views/browser_view_impl.h"
ChromeBrowserView::ChromeBrowserView(CefBrowserViewDelegate* cef_delegate,
Delegate* browser_view_delegate)
: ParentClass(cef_delegate), browser_view_delegate_(browser_view_delegate) {
DCHECK(browser_view_delegate_);
}
ChromeBrowserView::ChromeBrowserView(CefBrowserViewImpl* cef_browser_view)
: ParentClass(cef_browser_view->delegate()),
cef_browser_view_(cef_browser_view) {}
void ChromeBrowserView::InitBrowser(std::unique_ptr<Browser> browser,
CefRefPtr<CefBrowserView> browser_view) {
DCHECK(!browser_);
void ChromeBrowserView::InitBrowser(std::unique_ptr<Browser> browser) {
DCHECK(!web_view_);
browser_ = browser.get();
DCHECK(browser_);
// Initialize the BrowserFrame and BrowserView.
auto chrome_widget = static_cast<ChromeBrowserFrame*>(GetWidget());
chrome_widget->Init(this, std::move(browser));
// Retrieve the views::WebView that was created by the above initializations.
auto view_impl = static_cast<CefBrowserViewImpl*>(browser_view.get());
web_view_ = view_impl->web_view();
web_view_ = cef_browser_view_->web_view();
DCHECK(web_view_);
ParentClass::AddedToWidget();
@@ -36,7 +28,6 @@ void ChromeBrowserView::InitBrowser(std::unique_ptr<Browser> browser,
void ChromeBrowserView::Destroyed() {
DCHECK(!destroyed_);
destroyed_ = true;
browser_ = nullptr;
web_view_ = nullptr;
}
@@ -62,19 +53,24 @@ void ChromeBrowserView::ViewHierarchyChanged(
void ChromeBrowserView::AddedToWidget() {
// Results in a call to InitBrowser which calls ParentClass::AddedToWidget.
browser_view_delegate_->OnBrowserViewAdded();
cef_browser_view_->OnBrowserViewAdded();
}
void ChromeBrowserView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
ParentClass::OnBoundsChanged(previous_bounds);
browser_view_delegate_->OnBoundsChanged();
cef_browser_view_->OnBoundsChanged();
}
ToolbarView* ChromeBrowserView::OverrideCreateToolbar(
Browser* browser,
BrowserView* browser_view) {
void ChromeBrowserView::OnGestureEvent(ui::GestureEvent* event) {
if (cef_browser_view_->OnGestureEvent(event)) {
return;
}
ParentClass::OnGestureEvent(event);
}
ToolbarView* ChromeBrowserView::OverrideCreateToolbar() {
if (cef_delegate()) {
auto toolbar_type = cef_delegate()->GetChromeToolbarType();
auto toolbar_type = cef_delegate()->GetChromeToolbarType(cef_browser_view_);
absl::optional<ToolbarView::DisplayMode> display_mode;
switch (toolbar_type) {
case CEF_CTT_NORMAL:
@@ -87,8 +83,8 @@ ToolbarView* ChromeBrowserView::OverrideCreateToolbar(
break;
}
if (display_mode) {
cef_toolbar_ = CefToolbarViewImpl::Create(nullptr, browser, browser_view,
display_mode);
cef_toolbar_ =
CefToolbarViewImpl::Create(nullptr, browser(), this, display_mode);
// Ownership will be taken by BrowserView.
view_util::PassOwnership(cef_toolbar_).release();
return cef_toolbar_->root_view();

View File

@@ -19,25 +19,23 @@ namespace views {
class WebView;
} // namespace views
class CefBrowserViewImpl;
// A variant of CefBrowserViewView that extends BrowserView instead of
// views::WebView. See chrome_browser_frame.h for related documentation.
class ChromeBrowserView
: public CefViewView<BrowserView, CefBrowserViewDelegate> {
public:
using ParentClass = CefViewView<BrowserView, CefBrowserViewDelegate>;
using Delegate = CefBrowserViewView::Delegate;
// |cef_delegate| may be nullptr.
// |browser_view_delegate| must be non-nullptr.
ChromeBrowserView(CefBrowserViewDelegate* cef_delegate,
Delegate* browser_view_delegate);
// |cef_browser_view| is non-nullptr and will outlive this object.
explicit ChromeBrowserView(CefBrowserViewImpl* cef_browser_view);
ChromeBrowserView(const ChromeBrowserView&) = delete;
ChromeBrowserView& operator=(const ChromeBrowserView&) = delete;
// Called by ChromeBrowserHostImpl.
void InitBrowser(std::unique_ptr<Browser> browser,
CefRefPtr<CefBrowserView> browser_view);
void InitBrowser(std::unique_ptr<Browser> browser);
void Destroyed();
// View methods:
@@ -45,18 +43,17 @@ class ChromeBrowserView
const views::ViewHierarchyChangedDetails& details) override;
void AddedToWidget() override;
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
void OnGestureEvent(ui::GestureEvent* event) override;
// BrowserView methods:
ToolbarView* OverrideCreateToolbar(Browser* browser,
BrowserView* browser_view) override;
ToolbarView* OverrideCreateToolbar() override;
CefRefPtr<CefToolbarViewImpl> cef_toolbar() const { return cef_toolbar_; }
CefBrowserViewImpl* cef_browser_view() const { return cef_browser_view_; }
private:
// Not owned by this object.
Delegate* browser_view_delegate_;
CefBrowserViewImpl* const cef_browser_view_;
Browser* browser_ = nullptr;
views::WebView* web_view_ = nullptr;
bool destroyed_ = false;

View File

@@ -19,7 +19,6 @@
#include "base/base64.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/guid.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/json/string_escape.h"
@@ -28,6 +27,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/uuid.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
@@ -341,8 +341,9 @@ void CefDevToolsFrontend::ReadyToCommitNavigation(
if (it == extensions_api_.end()) {
return;
}
std::string script = base::StringPrintf("%s(\"%s\")", it->second.c_str(),
base::GenerateGUID().c_str());
std::string script = base::StringPrintf(
"%s(\"%s\")", it->second.c_str(),
base::Uuid::GenerateRandomV4().AsLowercaseString().c_str());
content::DevToolsFrontendHost::SetupExtensionsAPI(frame, script);
}

View File

@@ -128,7 +128,9 @@ CefDevToolsManagerDelegate::CefDevToolsManagerDelegate() {}
CefDevToolsManagerDelegate::~CefDevToolsManagerDelegate() {}
scoped_refptr<content::DevToolsAgentHost>
CefDevToolsManagerDelegate::CreateNewTarget(const GURL& url, bool for_tab) {
CefDevToolsManagerDelegate::CreateNewTarget(
const GURL& url,
content::DevToolsManagerDelegate::TargetType target_type) {
// 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

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

View File

@@ -205,13 +205,6 @@ bool TabsUpdateFunction::UpdateURL(const std::string& url_string,
return false;
}
const bool is_javascript_scheme = url.SchemeIs(url::kJavaScriptScheme);
// JavaScript URLs are forbidden in chrome.tabs.update().
if (is_javascript_scheme) {
*error = tabs_constants::kJavaScriptUrlsNotAllowedInTabsUpdate;
return false;
}
content::NavigationController::LoadURLParams load_params(url);
// Treat extension-initiated navigations as renderer-initiated so that the URL

View File

@@ -36,7 +36,6 @@
#include "extensions/browser/api/app_runtime/app_runtime_api.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/notification_types.h"
#include "extensions/browser/null_app_sorting.h"
#include "extensions/browser/quota_service.h"
#include "extensions/browser/renderer_startup_helper.h"

View File

@@ -37,9 +37,10 @@ CefExtensionSystemFactory::CefExtensionSystemFactory()
CefExtensionSystemFactory::~CefExtensionSystemFactory() {}
KeyedService* CefExtensionSystemFactory::BuildServiceInstanceFor(
std::unique_ptr<KeyedService>
CefExtensionSystemFactory::BuildServiceInstanceForBrowserContext(
BrowserContext* context) const {
return new CefExtensionSystem(context);
return std::make_unique<CefExtensionSystem>(context);
}
BrowserContext* CefExtensionSystemFactory::GetBrowserContextToUse(

View File

@@ -30,7 +30,7 @@ class CefExtensionSystemFactory : public ExtensionSystemProvider {
~CefExtensionSystemFactory() override;
// BrowserContextKeyedServiceFactory implementation:
KeyedService* BuildServiceInstanceFor(
std::unique_ptr<KeyedService> BuildServiceInstanceForBrowserContext(
content::BrowserContext* context) const override;
content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const override;

View File

@@ -14,9 +14,7 @@
#include "base/memory/ptr_util.h"
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
#include "components/pdf/browser/pdf_web_contents_helper.h"
#include "components/zoom/zoom_controller.h"
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
#include "printing/mojom/print.mojom.h"
@@ -33,13 +31,11 @@ AppViewGuestDelegate* CefExtensionsAPIClient::CreateAppViewGuestDelegate()
}
std::unique_ptr<guest_view::GuestViewManagerDelegate>
CefExtensionsAPIClient::CreateGuestViewManagerDelegate(
content::BrowserContext* context) const {
CefExtensionsAPIClient::CreateGuestViewManagerDelegate() const {
// The GuestViewManager instance associated with the returned Delegate, which
// will be retrieved in the future via GuestViewManager::FromBrowserContext,
// will be associated with the CefBrowserContext.
return base::WrapUnique(
new extensions::ExtensionsGuestViewManagerDelegate(context));
return base::WrapUnique(new extensions::ExtensionsGuestViewManagerDelegate());
}
std::unique_ptr<MimeHandlerViewGuestDelegate>
@@ -53,11 +49,6 @@ void CefExtensionsAPIClient::AttachWebContentsHelpers(
PrefsTabHelper::CreateForWebContents(web_contents);
printing::PrintViewManager::CreateForWebContents(web_contents);
// Used by the PDF extension.
pdf::PDFWebContentsHelper::CreateForWebContentsWithClient(
web_contents, std::unique_ptr<pdf::PDFWebContentsHelperClient>(
new ChromePDFWebContentsHelperClient()));
// Used by the tabs extension API.
zoom::ZoomController::CreateForWebContents(web_contents);
}

View File

@@ -18,8 +18,7 @@ class CefExtensionsAPIClient : public ExtensionsAPIClient {
// ExtensionsAPIClient implementation.
AppViewGuestDelegate* CreateAppViewGuestDelegate() const override;
std::unique_ptr<guest_view::GuestViewManagerDelegate>
CreateGuestViewManagerDelegate(
content::BrowserContext* context) const override;
CreateGuestViewManagerDelegate() const override;
std::unique_ptr<MimeHandlerViewGuestDelegate>
CreateMimeHandlerViewGuestDelegate(
MimeHandlerViewGuest* guest) const override;

View File

@@ -20,6 +20,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/chrome_url_request_util.h"
#include "chrome/browser/extensions/event_router_forwarder.h"
#include "chrome/browser/media/webrtc/media_device_salt_service_factory.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
@@ -117,8 +118,8 @@ bool CefExtensionsBrowserClient::AreExtensionsDisabled(
return false;
}
bool CefExtensionsBrowserClient::IsValidContext(BrowserContext* context) {
return GetOriginalContext(context) != nullptr;
bool CefExtensionsBrowserClient::IsValidContext(void* context) {
return GetOriginalContext(static_cast<BrowserContext*>(context)) != nullptr;
}
bool CefExtensionsBrowserClient::IsSameContext(BrowserContext* first,
@@ -149,28 +150,29 @@ BrowserContext* CefExtensionsBrowserClient::GetOriginalContext(
}
content::BrowserContext*
CefExtensionsBrowserClient::GetRedirectedContextInIncognito(
CefExtensionsBrowserClient::GetContextRedirectedToOriginal(
content::BrowserContext* context,
bool force_guest_profile,
bool force_system_profile) {
bool force_guest_profile) {
return context;
}
content::BrowserContext*
CefExtensionsBrowserClient::GetContextForRegularAndIncognito(
content::BrowserContext* CefExtensionsBrowserClient::GetContextOwnInstance(
content::BrowserContext* context,
bool force_guest_profile,
bool force_system_profile) {
bool force_guest_profile) {
return context;
}
content::BrowserContext* CefExtensionsBrowserClient::GetRegularProfile(
content::BrowserContext* CefExtensionsBrowserClient::GetContextForOriginalOnly(
content::BrowserContext* context,
bool force_guest_profile,
bool force_system_profile) {
bool force_guest_profile) {
return context;
}
bool CefExtensionsBrowserClient::AreExtensionsDisabledForContext(
content::BrowserContext* context) {
return false;
}
bool CefExtensionsBrowserClient::IsGuestSession(BrowserContext* context) const {
return false;
}
@@ -413,4 +415,11 @@ std::string CefExtensionsBrowserClient::GetApplicationLocale() {
return g_browser_process->GetApplicationLocale();
}
media_device_salt::MediaDeviceSaltService*
CefExtensionsBrowserClient::GetMediaDeviceSaltService(
content::BrowserContext* context) {
return MediaDeviceSaltServiceFactory::GetInstance()->GetForBrowserContext(
context);
}
} // namespace extensions

View File

@@ -31,7 +31,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
bool IsShuttingDown() override;
bool AreExtensionsDisabled(const base::CommandLine& command_line,
content::BrowserContext* context) override;
bool IsValidContext(content::BrowserContext* context) override;
bool IsValidContext(void* context) override;
bool IsSameContext(content::BrowserContext* first,
content::BrowserContext* second) override;
bool HasOffTheRecordContext(content::BrowserContext* context) override;
@@ -39,18 +39,17 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
content::BrowserContext* context) override;
content::BrowserContext* GetOriginalContext(
content::BrowserContext* context) override;
content::BrowserContext* GetRedirectedContextInIncognito(
content::BrowserContext* GetContextRedirectedToOriginal(
content::BrowserContext* context,
bool force_guest_profile,
bool force_system_profile) override;
content::BrowserContext* GetContextForRegularAndIncognito(
bool force_guest_profile) override;
content::BrowserContext* GetContextOwnInstance(
content::BrowserContext* context,
bool force_guest_profile,
bool force_system_profile) override;
content::BrowserContext* GetRegularProfile(
bool force_guest_profile) override;
content::BrowserContext* GetContextForOriginalOnly(
content::BrowserContext* context,
bool force_guest_profile,
bool force_system_profile) override;
bool force_guest_profile) override;
bool AreExtensionsDisabledForContext(
content::BrowserContext* context) override;
bool IsGuestSession(content::BrowserContext* context) const override;
bool IsExtensionIncognitoEnabled(
const std::string& extension_id,
@@ -118,6 +117,8 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
KioskDelegate* GetKioskDelegate() override;
bool IsLockScreenContext(content::BrowserContext* context) override;
std::string GetApplicationLocale() override;
media_device_salt::MediaDeviceSaltService* GetMediaDeviceSaltService(
content::BrowserContext* context) override;
private:
// Support for extension APIs.

View File

@@ -8,7 +8,6 @@
#include "libcef/browser/browser_host_base.h"
#include "libcef/browser/extensions/browser_extensions_util.h"
#include "base/memory/singleton.h"
#include "chrome/browser/file_select_helper.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
#include "ui/shell_dialogs/select_file_dialog_factory.h"
@@ -26,27 +25,17 @@ namespace {
// |run_from_cef=false| to trigger creation of the default platform dialog.
class CefSelectFileDialogFactory final : public ui::SelectFileDialogFactory {
public:
CefSelectFileDialogFactory() = default;
CefSelectFileDialogFactory(const CefSelectFileDialogFactory&) = delete;
CefSelectFileDialogFactory& operator=(const CefSelectFileDialogFactory&) =
delete;
static CefSelectFileDialogFactory* GetInstance() {
// Leaky because there is no useful cleanup to do.
return base::Singleton<
CefSelectFileDialogFactory,
base::LeakySingletonTraits<CefSelectFileDialogFactory>>::get();
}
ui::SelectFileDialog* Create(
ui::SelectFileDialog::Listener* listener,
std::unique_ptr<ui::SelectFilePolicy> policy) override;
bool IsCefFactory() const override { return true; }
private:
friend struct base::DefaultSingletonTraits<CefSelectFileDialogFactory>;
CefSelectFileDialogFactory() { ui::SelectFileDialog::SetFactory(this); }
};
// Delegates the running of the dialog to CefFileDialogManager.
@@ -158,8 +147,8 @@ ui::SelectFileDialog* CefSelectFileDialogFactory::Create(
namespace file_dialog_runner {
void RegisterFactory() {
// Implicitly registers on creation.
CefSelectFileDialogFactory::GetInstance();
ui::SelectFileDialog::SetFactory(
std::make_unique<CefSelectFileDialogFactory>());
}
} // namespace file_dialog_runner

View File

@@ -289,7 +289,7 @@ void CefFrameHostImpl::SendProcessMessage(
SendToRenderFrame(
__FUNCTION__,
base::BindOnce(
[](const CefString& name, base::ReadOnlySharedMemoryRegion region,
[](const CefString& name, base::WritableSharedMemoryRegion region,
const RenderFrameType& render_frame) {
render_frame->SendSharedMemoryRegion(name, std::move(region));
},
@@ -644,7 +644,7 @@ void CefFrameHostImpl::SendMessage(const std::string& name,
void CefFrameHostImpl::SendSharedMemoryRegion(
const std::string& name,
base::ReadOnlySharedMemoryRegion region) {
base::WritableSharedMemoryRegion region) {
if (auto browser = GetBrowserHostBase()) {
if (auto client = browser->GetClient()) {
CefRefPtr<CefProcessMessage> message(

View File

@@ -138,7 +138,7 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
void SendMessage(const std::string& name,
base::Value::List arguments) override;
void SendSharedMemoryRegion(const std::string& name,
base::ReadOnlySharedMemoryRegion region) override;
base::WritableSharedMemoryRegion region) override;
void FrameAttached(mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,
bool reattached) override;
void UpdateDraggableRegions(

View File

@@ -37,8 +37,6 @@ class CefSimpleMenuModel : public ui::MenuModel {
CefSimpleMenuModel& operator=(const CefSimpleMenuModel&) = delete;
// MenuModel methods.
bool HasIcons() const override { return false; }
size_t GetItemCount() const override { return impl_->GetCount(); }
ItemType GetTypeAt(size_t index) const override {

View File

@@ -11,8 +11,8 @@
#include "base/no_destructor.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/common/input/native_web_keyboard_event.h"
#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
#include "ui/events/keycodes/dom/dom_key.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
@@ -233,9 +233,6 @@ bool CefBrowserPlatformDelegateNativeLinux::HandleKeyboardEvent(
return false;
}
// static
void CefBrowserPlatformDelegate::HandleExternalProtocol(const GURL& url) {}
CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle(
const content::NativeWebKeyboardEvent& event) const {
// TODO(cef): We need to return an XEvent* from this method, but
@@ -263,7 +260,8 @@ ui::KeyEvent CefBrowserPlatformDelegateNativeLinux::TranslateUiKeyEvent(
base::TimeTicks time_stamp = GetEventTimeStamp();
if (key_event.type == KEYEVENT_CHAR) {
return ui::KeyEvent(character, key_code, dom_code, flags, time_stamp);
return ui::KeyEvent::FromCharacter(character, key_code, dom_code, flags,
time_stamp);
}
ui::EventType type = ui::ET_UNKNOWN;

View File

@@ -14,13 +14,14 @@
#include "libcef/browser/native/menu_runner_mac.h"
#include "libcef/browser/thread_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/apple/owned_objc.h"
#include "base/apple/scoped_nsautorelease_pool.h"
#include "base/memory/ptr_util.h"
#include "base/threading/thread_restrictions.h"
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/input/native_web_keyboard_event.h"
#include "third_party/blink/public/common/input/web_input_event.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
@@ -29,10 +30,6 @@
#include "ui/events/keycodes/keyboard_codes_posix.h"
#include "ui/gfx/geometry/rect.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
// Wrapper NSView for the native view. Necessary to destroy the browser when
// the view is deleted.
@interface CefBrowserHostView : NSView {
@@ -257,7 +254,7 @@ void CefBrowserPlatformDelegateNativeMac::BrowserDestroyed(
}
bool CefBrowserPlatformDelegateNativeMac::CreateHostWindow() {
base::mac::ScopedNSAutoreleasePool autorelease_pool;
base::apple::ScopedNSAutoreleasePool autorelease_pool;
NSWindow* new_window = nil;
@@ -456,18 +453,16 @@ void CefBrowserPlatformDelegateNativeMac::ViewText(const std::string& text) {
bool CefBrowserPlatformDelegateNativeMac::HandleKeyboardEvent(
const content::NativeWebKeyboardEvent& event) {
// Give the top level menu equivalents a chance to handle the event.
if ([event.os_event type] == NSEventTypeKeyDown) {
return [[NSApp mainMenu] performKeyEquivalent:event.os_event];
NSEvent* ns_event = event.os_event.Get();
if (ns_event.type == NSEventTypeKeyDown) {
return [[NSApp mainMenu] performKeyEquivalent:ns_event];
}
return false;
}
// static
void CefBrowserPlatformDelegate::HandleExternalProtocol(const GURL& url) {}
CefEventHandle CefBrowserPlatformDelegateNativeMac::GetEventHandle(
const content::NativeWebKeyboardEvent& event) const {
return CAST_NSEVENT_TO_CEF_EVENT_HANDLE(event.os_event);
return CAST_NSEVENT_TO_CEF_EVENT_HANDLE(event.os_event.Get());
}
std::unique_ptr<CefJavaScriptDialogRunner>
@@ -532,7 +527,8 @@ CefBrowserPlatformDelegateNativeMac::TranslateWebKeyEvent(
isARepeat:NO
keyCode:key_event.native_key_code];
result = content::NativeWebKeyboardEvent(synthetic_event);
result = content::NativeWebKeyboardEvent(
base::apple::OwnedNSEvent(synthetic_event));
if (key_event.type == KEYEVENT_CHAR) {
result.SetType(blink::WebInputEvent::Type::kChar);
}

View File

@@ -18,9 +18,8 @@
#include "base/files/file_util.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h"
#include "base/win/win_util.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/common/input/native_web_keyboard_event.h"
#include "third_party/blink/public/common/input/web_mouse_event.h"
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
#include "ui/aura/window.h"
@@ -60,70 +59,6 @@ void WriteTempFileAndView(const std::string& data) {
ui::win::OpenFileViaShell(tmp_file);
}
bool HasExternalHandler(const std::string& scheme) {
base::win::RegKey key;
const std::wstring registry_path =
base::ASCIIToWide(scheme + "\\shell\\open\\command");
key.Open(HKEY_CLASSES_ROOT, registry_path.c_str(), KEY_READ);
if (key.Valid()) {
DWORD size = 0;
key.ReadValue(NULL, NULL, &size, NULL);
if (size > 2) {
// ShellExecute crashes the process when the command is empty.
// We check for "2" because it always returns the trailing NULL.
return true;
}
}
return false;
}
// Match the logic in chrome/browser/platform_util_win.cc
// OpenExternalOnWorkerThread.
void ExecuteExternalProtocol(const GURL& url) {
CEF_REQUIRE_BLOCKING();
if (!HasExternalHandler(url.scheme())) {
return;
}
// Quote the input scheme to be sure that the command does not have
// parameters unexpected by the external program. This url should already
// have been escaped.
std::string escaped_url = url.spec();
escaped_url.insert(0, "\"");
escaped_url += "\"";
// According to Mozilla in uriloader/exthandler/win/nsOSHelperAppService.cpp:
// "Some versions of windows (Win2k before SP3, Win XP before SP1) crash in
// ShellExecute on long URLs (bug 161357 on bugzilla.mozilla.org). IE 5 and 6
// support URLS of 2083 chars in length, 2K is safe."
//
// It may be possible to increase this. https://crbug.com/727909
const size_t kMaxUrlLength = 2048;
if (escaped_url.length() > kMaxUrlLength) {
return;
}
// Specify %windir%\system32 as the CWD so that any new proc spawned does not
// inherit this proc's CWD. Without this, uninstalls may be broken by a
// long-lived child proc that holds a handle to the browser's version
// directory (the browser's CWD). A process's CWD is in the standard list of
// directories to search when loading a DLL, and precedes the system directory
// when safe DLL search mode is disabled (not the default). Setting the CWD to
// the system directory is a nice way to mitigate a potential DLL search order
// hijack for processes that don't implement their own mitigation.
base::FilePath system_dir;
base::PathService::Get(base::DIR_SYSTEM, &system_dir);
if (reinterpret_cast<ULONG_PTR>(ShellExecuteA(
NULL, "open", escaped_url.c_str(), NULL,
system_dir.AsUTF8Unsafe().c_str(), SW_SHOWNORMAL)) <= 32) {
// On failure, it may be good to display a message to the user.
// https://crbug.com/727913
return;
}
}
gfx::Rect GetDisplayWorkAreaNearestPoint(gfx::Point dip_point) {
const auto display =
display::Screen::GetScreen()->GetDisplayNearestPoint(dip_point);
@@ -483,11 +418,6 @@ bool CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
}
}
// static
void CefBrowserPlatformDelegate::HandleExternalProtocol(const GURL& url) {
CEF_POST_USER_VISIBLE_TASK(base::BindOnce(ExecuteExternalProtocol, url));
}
CefEventHandle CefBrowserPlatformDelegateNativeWin::GetEventHandle(
const content::NativeWebKeyboardEvent& event) const {
if (!event.os_event) {
@@ -507,8 +437,8 @@ ui::KeyEvent CefBrowserPlatformDelegateNativeWin::TranslateUiKeyEvent(
base::TimeTicks time_stamp = GetEventTimeStamp();
if (key_event.type == KEYEVENT_CHAR) {
return ui::KeyEvent(key_event.windows_key_code /* character */, key_code,
dom_code, flags, time_stamp);
return ui::KeyEvent::FromCharacter(/*character=*/key_event.windows_key_code,
key_code, dom_code, flags, time_stamp);
}
ui::EventType type = ui::ET_UNKNOWN;

View File

@@ -90,7 +90,7 @@ scoped_refptr<ui::PlatformCursor> ToPlatformCursor(
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());
ui_cursor.custom_hotspot(), ui_cursor.image_scale_factor());
} else {
cursor_loader.SetDisplay(GetDisplay(browser));

View File

@@ -7,10 +7,6 @@
#import "ui/base/cocoa/cursor_utils.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace cursor_util {
namespace {

View File

@@ -12,10 +12,6 @@
#include "base/strings/utf_string_conversions.h"
#include "components/url_formatter/elide_url.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
// Helper object that receives the notification that the dialog/sheet is
// going away. Is responsible for cleaning itself up.
@interface CefJavaScriptDialogHelper : NSObject <NSAlertDelegate> {

View File

@@ -11,10 +11,6 @@
#import "ui/base/cocoa/menu_controller.h"
#include "ui/gfx/geometry/point.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
CefMenuRunnerMac::CefMenuRunnerMac() {}
CefMenuRunnerMac::~CefMenuRunnerMac() {}

View File

@@ -292,7 +292,7 @@ void SaveCookies(const CefBrowserContext::Getter& browser_context_getter,
std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create(
request.url, cookie_string, base::Time::Now(),
absl::make_optional(response_date), /*partition_key=*/absl::nullopt,
&returned_status);
/*block_truncated_cookies=*/true, &returned_status);
if (!returned_status.IsInclude()) {
continue;
}
@@ -318,4 +318,4 @@ void SaveCookies(const CefBrowserContext::Getter& browser_context_getter,
}
} // namespace cookie_helper
} // namespace net_service
} // namespace net_service

View File

@@ -274,8 +274,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
unhandled_request_callback_ = unhandled_request_callback;
// Default values for standard headers.
accept_language_ = browser_prefs::GetAcceptLanguageList(
cef_browser_context, browser.get(), /*expand=*/true);
accept_language_ = browser_prefs::GetAcceptLanguageList(profile);
DCHECK(!accept_language_.empty());
user_agent_ =
CefAppManager::Get()->GetContentClient()->browser()->GetUserAgent();

View File

@@ -70,7 +70,8 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
url::Origin(), absl::nullopt /* navigation_id */, ukm::SourceIdObj(),
&maybe_proxy_factory_receiver, nullptr /* header_client */,
nullptr /* bypass_redirect_checks */, nullptr /* disable_secure_dns */,
nullptr /* factory_override */);
nullptr /* factory_override */,
nullptr /* navigation_response_task_runner */);
// If anyone above indicated that they care about proxying, pass the
// intermediate pipe along to the URLLoaderFactoryGetter.
@@ -133,4 +134,4 @@ void URLLoaderFactoryGetter::DeleteOnCorrectThread() const {
delete this;
}
} // namespace net_service
} // namespace net_service

View File

@@ -9,7 +9,6 @@
#include "libcef/browser/osr/render_widget_host_view_osr.h"
#include "base/memory/shared_memory_mapping.h"
#include "components/viz/common/resources/resource_format.h"
#include "components/viz/common/resources/resource_sizes.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "services/viz/privileged/mojom/compositing/layered_window_updater.mojom.h"
@@ -77,7 +76,7 @@ void CefLayeredWindowUpdaterOSR::OnAllocatedSharedMemory(
// Make sure |pixel_size| is sane.
size_t expected_bytes;
bool size_result = viz::ResourceSizes::MaybeSizeInBytes(
pixel_size, viz::ResourceFormat::RGBA_8888, &expected_bytes);
pixel_size, viz::SinglePlaneFormat::kRGBA_8888, &expected_bytes);
if (!size_result) {
return;
}

View File

@@ -106,7 +106,7 @@ struct PopulateAxNodeAttributes {
case ax::mojom::IntAttribute::kTableRowIndex:
case ax::mojom::IntAttribute::kActivedescendantId:
case ax::mojom::IntAttribute::kInPageLinkTargetId:
case ax::mojom::IntAttribute::kErrormessageId:
case ax::mojom::IntAttribute::kErrormessageIdDeprecated:
case ax::mojom::IntAttribute::kDOMNodeId:
case ax::mojom::IntAttribute::kDropeffect:
case ax::mojom::IntAttribute::kMemberOfId:

View File

@@ -588,6 +588,17 @@ void CefRenderWidgetHostViewOSR::AddDamageRect(uint32_t sequence,
damage_rects_[sequence] = rect;
}
void CefRenderWidgetHostViewOSR::InvalidateLocalSurfaceIdAndAllocationGroup() {
InvalidateLocalSurfaceId();
}
void CefRenderWidgetHostViewOSR::ClearFallbackSurfaceForCommitPending() {
if (delegated_frame_host_) {
delegated_frame_host_->ClearFallbackSurfaceForCommitPending();
}
InvalidateLocalSurfaceId();
}
void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() {
if (delegated_frame_host_) {
delegated_frame_host_->ResetFallbackToFirstNavigationSurface();
@@ -1796,15 +1807,17 @@ void CefRenderWidgetHostViewOSR::RequestImeCompositionUpdate(
void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged(
const gfx::Range& range,
const std::vector<gfx::Rect>& character_bounds) {
const absl::optional<std::vector<gfx::Rect>>& character_bounds,
const absl::optional<std::vector<gfx::Rect>>& line_bounds) {
if (browser_impl_.get()) {
CefRange cef_range(range.start(), range.end());
CefRenderHandler::RectList rcList;
for (size_t i = 0; i < character_bounds.size(); ++i) {
rcList.push_back(CefRect(character_bounds[i].x(), character_bounds[i].y(),
character_bounds[i].width(),
character_bounds[i].height()));
if (character_bounds.has_value()) {
for (auto& rect : character_bounds.value()) {
rcList.push_back(
CefRect(rect.x(), rect.y(), rect.width(), rect.height()));
}
}
CefRefPtr<CefRenderHandler> handler =

View File

@@ -154,6 +154,8 @@ class CefRenderWidgetHostViewOSR
#endif // BUILDFLAG(IS_MAC)
// RenderWidgetHostViewBase implementation.
void InvalidateLocalSurfaceIdAndAllocationGroup() override;
void ClearFallbackSurfaceForCommitPending() override;
void ResetFallbackToFirstNavigationSurface() override;
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
const gfx::Rect& bounds,
@@ -181,7 +183,8 @@ class CefRenderWidgetHostViewOSR
viz::SurfaceId GetCurrentSurfaceId() const override;
void ImeCompositionRangeChanged(
const gfx::Range& range,
const std::vector<gfx::Rect>& character_bounds) override;
const absl::optional<std::vector<gfx::Rect>>& character_bounds,
const absl::optional<std::vector<gfx::Rect>>& line_bounds) override;
std::unique_ptr<content::SyntheticGestureTarget>
CreateSyntheticGestureTarget() override;
bool TransformPointToCoordSpaceForView(

View File

@@ -62,8 +62,9 @@ void SoftwareOutputDeviceProxy::Resize(const gfx::Size& viewport_pixel_size,
canvas_.reset();
size_t required_bytes;
if (!ResourceSizes::MaybeSizeInBytes(
viewport_pixel_size_, ResourceFormat::RGBA_8888, &required_bytes)) {
if (!ResourceSizes::MaybeSizeInBytes(viewport_pixel_size_,
SinglePlaneFormat::kRGBA_8888,
&required_bytes)) {
DLOG(ERROR) << "Invalid viewport size " << viewport_pixel_size_.ToString();
return;
}

View File

@@ -181,6 +181,17 @@ void CefTouchSelectionControllerClientOSR::OnSwipeToMoveCursorEnd() {
OnSelectionEvent(ui::INSERTION_HANDLE_DRAG_STOPPED);
}
void CefTouchSelectionControllerClientOSR::OnClientHitTestRegionUpdated(
ui::TouchSelectionControllerClient* client) {
if (client != active_client_ || !rwhv_->selection_controller() ||
rwhv_->selection_controller()->active_status() ==
ui::TouchSelectionController::INACTIVE) {
return;
}
active_client_->DidScroll();
}
void CefTouchSelectionControllerClientOSR::UpdateClientSelectionBounds(
const gfx::SelectionBound& start,
const gfx::SelectionBound& end) {

View File

@@ -72,6 +72,8 @@ class CefTouchSelectionControllerClientOSR
void DidStopFlinging() override;
void OnSwipeToMoveCursorBegin() override;
void OnSwipeToMoveCursorEnd() override;
void OnClientHitTestRegionUpdated(
ui::TouchSelectionControllerClient* client) override;
void UpdateClientSelectionBounds(
const gfx::SelectionBound& start,
const gfx::SelectionBound& end,

View File

@@ -125,6 +125,9 @@ class CefPermissionPrompt : public permissions::PermissionPrompt {
const override {
return permissions::PermissionPromptDisposition::CUSTOM_MODAL_DIALOG;
}
absl::optional<gfx::Rect> GetViewBoundsInScreen() const override {
return absl::nullopt;
}
private:
// We don't expose AcceptThisTime() because it's a special case for
@@ -199,6 +202,8 @@ cef_permission_request_types_t GetCefRequestType(
return CEF_PERMISSION_TYPE_IDLE_DETECTION;
case permissions::RequestType::kMicStream:
return CEF_PERMISSION_TYPE_MIC_STREAM;
case permissions::RequestType::kMidi:
return CEF_PERMISSION_TYPE_MIDI;
case permissions::RequestType::kMidiSysex:
return CEF_PERMISSION_TYPE_MIDI_SYSEX;
case permissions::RequestType::kMultipleDownloads:
@@ -211,14 +216,10 @@ cef_permission_request_types_t GetCefRequestType(
#endif
case permissions::RequestType::kRegisterProtocolHandler:
return CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER;
case permissions::RequestType::kSecurityAttestation:
return CEF_PERMISSION_TYPE_SECURITY_ATTESTATION;
case permissions::RequestType::kStorageAccess:
return CEF_PERMISSION_TYPE_STORAGE_ACCESS;
case permissions::RequestType::kTopLevelStorageAccess:
return CEF_PERMISSION_TYPE_TOP_LEVEL_STORAGE_ACCESS;
case permissions::RequestType::kU2fApiRequest:
return CEF_PERMISSION_TYPE_U2F_API_REQUEST;
case permissions::RequestType::kVrSession:
return CEF_PERMISSION_TYPE_VR_SESSION;
case permissions::RequestType::kWindowManagement:

View File

@@ -5,7 +5,6 @@
#include "libcef/browser/prefs/browser_prefs.h"
#include "libcef/browser/browser_context.h"
#include "libcef/browser/browser_host_base.h"
#include "libcef/browser/context.h"
#include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/prefs/pref_registrar.h"
@@ -21,7 +20,7 @@
#include "base/values.h"
#include "chrome/browser/accessibility/accessibility_ui.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/media/media_device_id_salt.h"
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_feature.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/media/webrtc/permission_bubble_media_access_handler.h"
#include "chrome/browser/net/profile_network_context_service.h"
@@ -41,11 +40,13 @@
#include "components/component_updater/component_updater_service.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/pref_names.h"
#include "components/domain_reliability/domain_reliability_prefs.h"
#include "components/flags_ui/pref_service_flags_storage.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/language/core/browser/language_prefs.h"
#include "components/language/core/browser/pref_names.h"
#include "components/media_device_salt/media_device_id_salt.h"
#include "components/permissions/permission_actions_history.h"
#include "components/permissions/permission_hats_trigger_helper.h"
#include "components/policy/core/common/policy_pref_names.h"
@@ -93,17 +94,9 @@ std::string ComputeAcceptLanguageFromPref(const std::string& language_pref) {
return net::HttpUtil::GenerateAcceptLanguageHeader(accept_languages_str);
}
// Return the most relevant setting based on |browser_context| and |browser|.
std::string GetAcceptLanguageListSetting(CefBrowserContext* browser_context,
CefBrowserHostBase* browser) {
if (browser) {
const auto& settings = browser->settings();
if (settings.accept_language_list.length > 0) {
return CefString(&settings.accept_language_list);
}
}
if (browser_context) {
// Return the most relevant setting based on |profile|.
std::string GetAcceptLanguageListSetting(Profile* profile) {
if (auto* browser_context = CefBrowserContext::FromProfile(profile)) {
const auto& settings = browser_context->settings();
if (settings.accept_language_list.length > 0) {
return CefString(&settings.accept_language_list);
@@ -268,8 +261,9 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
HostContentSettingsMap::RegisterProfilePrefs(registry.get());
language::LanguagePrefs::RegisterProfilePrefs(registry.get());
media_router::RegisterAccessCodeProfilePrefs(registry.get());
media_router::RegisterProfilePrefs(registry.get());
MediaDeviceIDSalt::RegisterProfilePrefs(registry.get());
media_device_salt::MediaDeviceIDSalt::RegisterProfilePrefs(registry.get());
PermissionBubbleMediaAccessHandler::RegisterProfilePrefs(registry.get());
permissions::PermissionActionsHistory::RegisterProfilePrefs(registry.get());
permissions::PermissionHatsTriggerHelper::RegisterProfilePrefs(
@@ -297,7 +291,6 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
!extensions::PrintPreviewEnabled());
registry->RegisterStringPref(
prefs::kPrintPreviewDefaultDestinationSelectionRules, std::string());
registry->RegisterBooleanPref(prefs::kCloudPrintSubmitEnabled, false);
registry->RegisterBooleanPref(prefs::kEnableMediaRouter, true);
printing::PolicySettings::RegisterProfilePrefs(registry.get());
printing::PrintPreviewStickySettings::RegisterProfilePrefs(registry.get());
@@ -319,6 +312,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
// Based on browser_prefs::RegisterProfilePrefs.
registry->RegisterBooleanPref(prefs::kAccessibilityPdfOcrAlwaysActive,
false);
registry->RegisterBooleanPref(prefs::kBlockTruncatedCookies, true);
// Spell checking preferences.
// Modify defaults from SpellcheckServiceFactory::RegisterProfilePrefs.
@@ -343,8 +337,8 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
// Language preferences. Used by ProfileNetworkContextService and
// InterceptedRequestHandlerWrapper.
const std::string& accept_language_list = GetAcceptLanguageListSetting(
CefBrowserContext::FromProfile(profile), /*browser=*/nullptr);
const std::string& accept_language_list =
GetAcceptLanguageListSetting(profile);
if (!accept_language_list.empty()) {
registry->SetDefaultPrefValue(language::prefs::kAcceptLanguages,
base::Value(accept_language_list));
@@ -362,26 +356,42 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
return factory.CreateSyncable(registry.get());
}
std::string GetAcceptLanguageList(CefBrowserContext* browser_context,
CefBrowserHostBase* browser,
bool expand) {
std::string GetAcceptLanguageList(Profile* profile) {
// Always prefer to the CEF settings configuration, if specified.
std::string accept_language_list =
GetAcceptLanguageListSetting(browser_context, browser);
if (accept_language_list.empty() && browser_context) {
std::string accept_language_list = GetAcceptLanguageListSetting(profile);
if (accept_language_list.empty() && profile) {
// Fall back to the preference value. For the Alloy runtime the default
// value comes from browser_prefs::CreatePrefService() above. For the Chrome
// runtime the default value comes from the configured locale
// (IDS_ACCEPT_LANGUAGES) which is then overridden by the user preference in
// chrome://settings/languages, all managed by language::LanguagePrefs.
auto prefs = browser_context->AsProfile()->GetPrefs();
accept_language_list = prefs->GetString(language::prefs::kAcceptLanguages);
accept_language_list =
profile->GetPrefs()->GetString(language::prefs::kAcceptLanguages);
}
if (!accept_language_list.empty() && expand) {
if (!accept_language_list.empty()) {
return ComputeAcceptLanguageFromPref(accept_language_list);
}
return std::string();
}
void SetInitialProfilePrefs(Profile* profile) {
auto* prefs = profile->GetPrefs();
// Language preferences.
const std::string& accept_language_list =
GetAcceptLanguageListSetting(profile);
if (!accept_language_list.empty()) {
// Used by ProfileNetworkContextService and InterceptedRequestHandlerWrapper
// (via GetAcceptLanguageList) for request headers, and
// renderer_preferences_util::UpdateFromSystemSettings() for
// `navigator.language`.
prefs->SetString(language::prefs::kAcceptLanguages, accept_language_list);
// Necessary to avoid a reset of the kAcceptLanguages value in
// LanguagePrefs::UpdateAcceptLanguagesPref().
prefs->SetString(language::prefs::kSelectedLanguages, accept_language_list);
}
}
} // namespace browser_prefs

View File

@@ -11,8 +11,6 @@ namespace base {
class FilePath;
}
class CefBrowserContext;
class CefBrowserHostBase;
class PrefRegistrySimple;
class PrefService;
class Profile;
@@ -36,9 +34,10 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
// Returns the value for populating the accept-language HTTP request header.
// |browser_context| and/or |browser| may be nullptr. If |expand| is true then
// base languages and Q values may be added.
std::string GetAcceptLanguageList(CefBrowserContext* browser_context,
CefBrowserHostBase* browser,
bool expand);
std::string GetAcceptLanguageList(Profile* profile);
// Set preferences for a newly initialized Profile.
void SetInitialProfilePrefs(Profile* profile);
} // namespace browser_prefs

View File

@@ -41,6 +41,7 @@
#include "media/media_buildflags.h"
#include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "ui/color/color_provider_key.h"
#include "ui/native_theme/native_theme.h"
namespace renderer_prefs {
@@ -102,7 +103,7 @@ void SetChromePrefs(Profile* profile, blink::web_pref::WebPreferences& web) {
web.allow_running_insecure_content =
prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent);
web.password_echo_enabled = browser_defaults::kPasswordEchoEnabled;
web.password_echo_enabled = false;
web.text_areas_are_resizable =
prefs->GetBoolean(prefs::kWebKitTextAreasAreResizable);
@@ -206,6 +207,7 @@ blink::mojom::PreferredColorScheme ToBlinkPreferredColorScheme(
// |native_theme| - For other platforms based on native theme scheme.
bool UpdatePreferredColorScheme(blink::web_pref::WebPreferences* web_prefs,
const GURL& url,
content::WebContents* web_contents,
const ui::NativeTheme* native_theme) {
auto old_preferred_color_scheme = web_prefs->preferred_color_scheme;
@@ -213,19 +215,13 @@ bool UpdatePreferredColorScheme(blink::web_pref::WebPreferences* web_prefs,
web_prefs->preferred_color_scheme =
ToBlinkPreferredColorScheme(native_theme->GetPreferredColorScheme());
// Force a light preferred color scheme on certain URLs if kWebUIDarkMode is
// disabled; some of the UI is not yet correctly themed.
if (!base::FeatureList::IsEnabled(features::kWebUIDarkMode)) {
// Update based on last committed url.
bool force_light = url.SchemeIs(content::kChromeUIScheme);
if (!force_light) {
force_light = url.SchemeIs(extensions::kExtensionScheme) &&
url.host_piece() == extension_misc::kPdfExtensionId;
}
if (force_light) {
web_prefs->preferred_color_scheme =
blink::mojom::PreferredColorScheme::kLight;
}
if (url.SchemeIs(content::kChromeUIScheme)) {
// WebUI should track the color mode of the ColorProvider associated with
// |web_contents|.
web_prefs->preferred_color_scheme =
web_contents->GetColorMode() == ui::ColorProviderKey::ColorMode::kLight
? blink::mojom::PreferredColorScheme::kLight
: blink::mojom::PreferredColorScheme::kDark;
}
return old_preferred_color_scheme != web_prefs->preferred_color_scheme;
@@ -419,7 +415,7 @@ void PopulateWebPreferences(content::RenderViewHost* rvh,
UpdatePreferredColorScheme(
&web,
web_contents->GetPrimaryMainFrame()->GetSiteInstance()->GetSiteURL(),
native_theme);
web_contents, native_theme);
// Set preferences based on the extension.
SetExtensionPrefs(web_contents, rvh, web);
@@ -445,7 +441,7 @@ bool PopulateWebPreferencesAfterNavigation(
blink::web_pref::WebPreferences& web) {
auto* native_theme = ui::NativeTheme::GetInstanceForWeb();
return UpdatePreferredColorScheme(&web, web_contents->GetLastCommittedURL(),
native_theme);
web_contents, native_theme);
}
} // namespace renderer_prefs

View File

@@ -229,6 +229,14 @@ void CefPrintDialogLinux::UpdateSettings(
UpdateSettings(std::move(settings), false);
}
#if BUILDFLAG(ENABLE_OOP_PRINTING_NO_OOP_BASIC_PRINT_DIALOG)
void CefPrintDialogLinux::LoadPrintSettings(
const printing::PrintSettings& settings) {
// TODO(linux): Need to read data from |settings.system_print_dialog_data()|?
UseDefaultSettings();
}
#endif
void CefPrintDialogLinux::ShowDialog(
gfx::NativeView parent_view,
bool has_selection,

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