Compare commits

...

92 Commits
3359 ... 3497

Author SHA1 Message Date
Marshall Greenblatt
7f37a0a130 Fix substitution of localized strings for directory listings (issue #2412) 2018-10-19 14:43:31 -04:00
Marshall Greenblatt
cd24143111 Fix ArrayBuffer crashes and add performance test (issue #2521) 2018-10-10 16:15:25 +03:00
Marshall Greenblatt
ead5caf25a Windows: Fix crashes when dragging an image with OSR enabled (issue #2525) 2018-10-10 14:47:18 +03:00
Marshall Greenblatt
c6dbc58c5f Linux: cefclient: Fix crash when creating popup window (issue #2512) 2018-10-10 13:50:37 +03:00
Marshall Greenblatt
00188c7052 Fix crash using CefCookieManager::SetStoragePath (issue #2522) 2018-10-08 19:22:38 +03:00
Marshall Greenblatt
b472a8d9ea macOS: Fix crash when showing a select popup with CefDoMessageLoopWork (issue #2495) 2018-09-28 16:31:53 +02:00
Marshall Greenblatt
847fd4fd63 Add missing include for DISALLOW_COPY_AND_ASSIGN 2018-09-28 15:51:57 +02:00
Marshall Greenblatt
0a87d5f25f Fix redraw of OSR PDF viewer (issue #2507) 2018-09-27 16:05:22 +02:00
Marshall Greenblatt
13f506f92a Fix crash when high contrast themes are enabled (issue #2508) 2018-09-21 16:36:00 +02:00
Marshall Greenblatt
4c165056e1 Windows: cmake: Add VS2017 15.8 build support 2018-09-21 11:12:42 +02:00
Marshall Greenblatt
461fa1fe83 Update to Chromium version 69.0.3497.100 2018-09-20 17:12:42 +02:00
Marshall Greenblatt
bf8b64d70e Linux: Add multi-threaded message loop support (issue #2512) 2018-09-20 06:10:45 -07:00
Marshall Greenblatt
004ef913a2 Fix crash when hovering buttons in OSR PDF viewer (issue #2488) 2018-09-14 11:19:53 +02:00
Marshall Greenblatt
9df58650e1 RTL document in <iframe> should have left-hand scrollbar (see https://crbug.com/250514#c34) 2018-09-14 10:29:55 +02:00
Marshall Greenblatt
a4f7e361be Remove Singleton patches which are no longer required (issue #2362) 2018-09-06 21:57:52 +02:00
Marshall Greenblatt
52427ce97f Windows: Fix DCHECKs during shutdown with multi-threaded message loop mode (issue #2362) 2018-09-06 17:39:11 +02:00
Marshall Greenblatt
01f9a30b1d Fix external message pump (issue #2493) 2018-09-06 14:52:58 +02:00
Marshall Greenblatt
fd089efa24 Linux: Zero initialize MwmHints (issue #2492) 2018-09-06 13:51:06 +02:00
Marshall Greenblatt
3f956461bb macOS: Fix crash when closing full-screen window (issue #2491) 2018-09-06 13:50:59 +02:00
Marshall Greenblatt
4f87de9f52 Linux: Fix compile error 2018-09-06 10:33:28 +02:00
Marshall Greenblatt
532ce6b99c Update to Chromium version 69.0.3497.81 2018-09-05 19:30:35 +02:00
Marshall Greenblatt
633c181700 macOS: Fix compile error (issue #2489) 2018-08-17 11:08:41 -04:00
Marshall Greenblatt
7ed3a545e9 Update to Chromium version 69.0.3497.32 2018-08-15 17:01:54 -04:00
Marshall Greenblatt
17f0192053 macOS: Update README.txt for distribution content changes 2018-07-30 16:23:39 -04:00
Marshall Greenblatt
f7ae4ed0da Update to Chromium version 69.0.3497.12 2018-07-25 20:00:11 -04:00
Marshall Greenblatt
0fb03e7aa1 macOS: Fix OSR configuration of device scale factor 2018-07-25 16:55:11 -04:00
Marshall Greenblatt
7f3c21b64a macOS: Add angle and swiftshader libraries to the app bundle (issue #2446)" 2018-07-25 15:18:24 -04:00
Marshall Greenblatt
339ce47575 macOS: Add the LSEnvironment variable MallocNanoZone=0 (see https://crbug.com/861939) 2018-07-25 14:23:54 -04:00
Marshall Greenblatt
7d09642925 Update to Chromium version 69.0.3497.0 (#576753) 2018-07-24 12:15:30 -04:00
Alexander Guettler
fad6aec5d0 Add MouseWheelPhaseHandler for OSR (issue #2214) 2018-07-13 15:50:16 -04:00
Marshall Greenblatt
96bd993d99 Update to Chromium version 69.0.3489.0 (#574445) 2018-07-13 15:29:39 -04:00
Marshall Greenblatt
8e9d736cda Windows: Fix failure in tools/clang/scripts/update.py with custom VS toolchain (issue #2474) 2018-07-12 14:53:36 -04:00
Marshall Greenblatt
6a76bdb040 Revert "Disable cfi-icall which is not supported by the CEF bindings layer (issue #2472)"
This reverts commit 66b5dc3d55.
2018-07-12 10:58:49 -07:00
Marshall Greenblatt
cf5b322efc Linux: Fix cfi-icall failure in atk_util_auralinux_gtk2.cc (issue #2472) 2018-07-12 10:58:29 -07:00
Marshall Greenblatt
7139f01103 Fix cfi-cast failure in CefBrowserMessageLoop::current (issue #2472) 2018-07-12 10:58:29 -07:00
Marshall Greenblatt
0d12959a50 Disable cfi-icall checks for CEF bindings (issue #2472) 2018-07-12 10:58:29 -07:00
Marshall Greenblatt
10c01ff43e Remove include/base/cef_thread_collision_warner.h which is unused and causes linker errors with CFI builds (issue #2472) 2018-07-12 10:58:29 -07:00
Marshall Greenblatt
66b5dc3d55 Disable cfi-icall which is not supported by the CEF bindings layer (issue #2472) 2018-07-11 12:32:48 -04:00
Marshall Greenblatt
f12ad6b634 Add missing include 2018-07-09 16:12:39 -04:00
Marshall Greenblatt
5bf4d4febd Fix passing of lang command-line flag to the renderer (issue #2468) 2018-07-09 16:10:03 -04:00
Marshall Greenblatt
448a112352 CefFrame::GetURL in the renderer process should return the provisional URL for popups during loading (issue #2448) 2018-07-09 14:36:37 -04:00
Marshall Greenblatt
9229cdd0eb Remove CefSettings.single_process. This mode is not supported and CefSettings makes it too easy to enable. The command-line flag still exists. 2018-07-09 13:31:32 -04:00
Alexander Guettler
9e22c975fa Windows: Remove /llvmlibthin from link command (issue #2470) 2018-07-09 11:37:13 -04:00
Marshall Greenblatt
6301e06c8a Update to Chromium version 69.0.3483.0 (#572879) 2018-07-09 11:23:23 -04:00
Kudo Chien
123324f5f9 Fix PDF print and save buttons (issue #2463). 2018-07-05 18:32:01 +00:00
Marshall Greenblatt
eb3325a9ae Fix application of DEPS.patch for 3029 branch 2018-07-05 14:24:49 -04:00
Marshall Greenblatt
2d48a07bec Update to Chromium version 69.0.3476.0 (#571360) 2018-07-03 13:48:07 -04:00
Marshall Greenblatt
669e8673ce Linux: cmake: Don't warn about code in comments (issue #2346) 2018-06-27 12:47:39 -04:00
Marshall Greenblatt
b03c54bfbe Linux: Use poll instead of select to fix crash during startup (issue #2466) 2018-06-27 12:40:59 -04:00
Marshall Greenblatt
35830c88e5 Update to Chromium version 69.0.3464.0 (#567918) 2018-06-19 15:49:32 -04:00
Cristian Amarie
3c3045a5cb Add http:// prefix to browser creation URLs if necessary (issue #2427) 2018-06-15 20:14:47 +00:00
Marshall Greenblatt
b25374c8e7 Pass BrowserProcessSubThread to ContentMainDelegate::RunProcess (issue #2456) 2018-06-15 15:55:54 -04:00
Marshall Greenblatt
4f28c5ffff Windows: cmake: Add VS2017 15.6 & 15.7 build support 2018-06-12 14:40:30 -04:00
Marshall Greenblatt
12043b16e7 Update to Chromium version 69.0.3453.0 (#565531) 2018-06-12 14:16:03 -04:00
Marshall Greenblatt
d9ebd4c50f Switch DevTools to the default view that doesn't show screencast 2018-06-07 12:57:46 -04:00
Marshall Greenblatt
f6f2c9a0ca Update to Chromium version 68.0.3440.0 (#561733) 2018-06-04 12:43:08 -04:00
Marshall Greenblatt
21310e4374 macOS: Fix rendering with surface synchronization (issue #2447) 2018-05-31 16:34:44 -04:00
Marshall Greenblatt
08ff72fa20 Update to Chromium version 68.0.3433.0 (#559327)
Known issues:
- Windows now requires VS 2017 15.7.1 with 10.0.17134.0 SDK.
2018-05-22 17:03:01 +03:00
Marshall Greenblatt
12cc069b69 Improve reliability of automate-git.py --fast-update, add --resave (issue #2435) 2018-05-21 14:06:35 +03:00
Marshall Greenblatt
cd27cbc802 Update to Chromium version 68.0.3425.0 (#557062)
Known issues:
- Surface synchronization is now enabled for OSR, see issue #2447.
- Jumbo build is broken, fixed in https://crrev.com/868717ce.
2018-05-21 13:54:23 +03:00
Marshall Greenblatt
a9f0fa9dfe Update to Chromium version 68.0.3416.0 (#554961) 2018-05-19 12:35:20 +03:00
Marshall Greenblatt
240ba800ed Update to Chromium version 68.0.3409.0 (#553714)
Known issues:
- Download fails with empty cache path due to https://crrev.com/950748a25f.
  Fixed in https://crrev.com/087ef223ac.
2018-05-18 13:07:14 +03:00
Marshall Greenblatt
84e2286995 Update to Chromium version 68.0.3403.0 (#552595) 2018-05-16 21:03:56 +02:00
Marshall Greenblatt
58413e16b1 Fix usage of automate-git.py --fast-update with new checkouts (issue #2435) 2018-05-16 20:27:39 +02:00
Marshall Greenblatt
58e2e4b23d Support less error-prone update of just CEF changes with automate-git.py --force-cef-update (issue #2435) 2018-05-16 18:37:37 +02:00
Marshall Greenblatt
77dc8157d0 Use absolute path to avoid execution failure with automate-git.py --test-prefix=xvfb-run (issue #2435). 2018-05-16 11:27:33 +03:00
Marshall Greenblatt
8426da0de6 Update to Chromium version 68.0.3399.0 (#551554) 2018-05-16 11:23:34 +03:00
Marshall Greenblatt
66484d799e Support analysis of Chromium update status with automate-git.py --log-chromium-changes (issue #2435) 2018-05-15 17:06:49 +03:00
Marshall Greenblatt
dcf533cc3c Fix patching of files with Windows line endings on Posix systems 2018-05-15 03:42:16 -07:00
Marshall Greenblatt
67708d07f2 Support running tests with automate-git.py --run-tests (issue #2435) 2018-05-14 13:43:36 +03:00
Marshall Greenblatt
d1d4f7a3ef Improve handling of patches during Chromium update (issue #2435) 2018-05-11 14:09:26 +03:00
Marshall Greenblatt
46e8152b6d Support automatic Chromium updates with automate-git.py --chromium-channel=canary (issue #2433) 2018-05-08 16:33:59 +02:00
Marshall Greenblatt
1f4f8f4af7 Support faster incremental Chromium/CEF updates with automate-git.py --fast-update (issue #2435). 2018-05-08 10:29:07 +02:00
Marshall Greenblatt
f24f885eeb Fix DCHECK due to unreliable is_main_frame state on XHR requests (issue #2433) 2018-05-04 16:42:02 +02:00
Marshall Greenblatt
a3c55f1d26 Update to Chromium revision 9ef2aa86 (#550428) 2018-05-04 10:50:26 +02:00
Cristian Amarie
f6c9a96a12 Add missing space at the end of verbose build command (issue #2431). 2018-05-01 15:55:47 +00:00
Felix Bruns
4b33c17533 Add user_gesture parameter to OnBeforeBrowse (issue #1526) 2018-04-27 15:11:53 +00:00
Marshall Greenblatt
0677d0d9de Linux: Fix startup hang on Ubuntu 16.04.4 (issue #2424) 2018-04-13 21:21:17 -04:00
Marshall Greenblatt
64d86a7397 Linux: Fix ASAN link error: odr-violation: global 'typeinfo name for std::exception' (see https://crbug.com/832808) 2018-04-13 17:30:17 -04:00
Marshall Greenblatt
87e33b1692 Linux: Fix crash when closing popup after printing (issue #2422) 2018-04-12 14:35:57 -04:00
Christopher Cifra
4315f3b724 Add support for V8 ArrayBuffers (issue #244) 2018-04-10 16:05:19 -04:00
Mike Wiedenbauer
bb28b85bdd Add CefDisplayHandler::OnLoadingProgressChange callback (issue #2382) 2018-04-10 13:52:31 -04:00
Mike Wiedenbauer
90863b8c5d Add ability to stop CefURLRequest on redirect (issue #1329) 2018-04-10 13:05:18 -04:00
Mike Wiedenbauer
c3f5e6463c Add OSR text selection changed handler and remove hard-coded test bounds (issue #2383) 2018-04-09 13:50:19 -04:00
Marshall Greenblatt
b220672c42 Fix compile error due to commit acb0922 (issue #2415) 2018-04-02 17:17:40 -04:00
Marshall Greenblatt
acb0922500 Fix crashes loading chrome://system with extensions disabled (issue #2415) 2018-03-29 13:58:52 -04:00
Marshall Greenblatt
b44919e3c5 Allow empty username parameter to CefAuthCallback::Continue (issue #2275) 2018-03-28 19:29:28 -04:00
Marshall Greenblatt
a1f47abaf6 Don't include locales/*.info files in distribution (issue #2375) 2018-03-28 18:20:10 -04:00
Marshall Greenblatt
ff8aa46e5e Support override of crash_reporter.cfg settings with environment variables (issue #2413) 2018-03-28 17:15:05 -04:00
Marshall Greenblatt
d4ec164297 Windows: Fix crash report upload failure on Windows 7 (see https://crbug.com/826564). 2018-03-28 16:02:11 -04:00
John Mayhew
e312a35ef3 Change CefFrame::GetName() to return assigned name if it is non-empty before returning unique name (issue #2403) 2018-03-28 17:30:15 +00:00
Marshall Greenblatt
3018e1866b Linux: Update to Debian sid sysroot (issue #2409) 2018-03-28 12:42:55 -04:00
460 changed files with 9748 additions and 5280 deletions

128
BUILD.gn
View File

@@ -100,11 +100,11 @@ import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//cef/cef_repack_locales.gni")
import("//chrome/common/features.gni")
import("//extensions/features/features.gni")
import("//extensions/buildflags/buildflags.gni")
import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//ppapi/features/features.gni")
import("//printing/features/features.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni")
import("//services/catalog/public/tools/catalog.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//third_party/icu/config.gni")
@@ -112,12 +112,14 @@ import("//third_party/widevine/cdm/widevine.gni")
import("//tools/grit/repack.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("//ui/gl/features.gni")
import("//v8/gni/v8.gni")
if (is_clang) {
import("//build/config/clang/clang.gni")
}
if (is_linux) {
import("//build/config/linux/pkg_config.gni")
import("//third_party/fontconfig/fontconfig.gni")
}
if (is_mac) {
import("//build/config/mac/rules.gni")
@@ -148,6 +150,12 @@ if (is_clang) {
assert(!clang_use_chrome_plugins)
}
if (is_linux) {
# Use system fontconfig. This avoids a startup hang on Ubuntu 16.04.4 (see
# issue #2424).
assert(!use_bundled_fontconfig)
}
if (is_mac) {
# Always generate dSYM files. The make_distrib script will fail if
# enable_dsyms=true is not explicitly set when is_official_build=false.
@@ -267,8 +275,8 @@ if (is_win) {
# Required by chrome_switches.cc
"//chrome/common:buildflags",
"//ppapi/features:features",
"//printing/features:features",
"//ppapi/buildflags:buildflags",
"//printing/buildflags:buildflags",
"//ui/base:ui_features",
]
}
@@ -395,6 +403,8 @@ static_library("libcef_static") {
"libcef/browser/net/chrome_scheme_handler.h",
"libcef/browser/net/cookie_store_proxy.cc",
"libcef/browser/net/cookie_store_proxy.h",
"libcef/browser/net/cookie_store_source.cc",
"libcef/browser/net/cookie_store_source.h",
"libcef/browser/net/crlset_file_util_impl.cc",
"libcef/browser/net/devtools_scheme_handler.cc",
"libcef/browser/net/devtools_scheme_handler.h",
@@ -650,6 +660,7 @@ static_library("libcef_static") {
"//chrome/services/printing:lib",
"//chrome/utility",
"//components/cdm/renderer",
"//components/certificate_transparency",
"//components/content_settings/core/browser",
"//components/content_settings/core/common",
"//components/crx_file",
@@ -666,11 +677,10 @@ static_library("libcef_static") {
"//components/printing/browser",
"//components/printing/common",
"//components/printing/renderer",
"//components/printing/service:pdf_compositor_manifest",
"//components/printing/service/public/cpp:factory",
"//components/printing/service/public/interfaces",
"//components/services/pdf_compositor:pdf_compositor_manifest",
"//components/services/pdf_compositor/public/cpp:utils",
"//components/services/pdf_compositor/public/interfaces",
"//components/proxy_config",
"//components/ssl_config",
"//components/update_client",
"//components/url_formatter",
"//components/user_prefs",
@@ -691,21 +701,19 @@ static_library("libcef_static") {
"//device/base",
"//extensions/browser",
"//extensions/browser/api:api_registration",
"//extensions/buildflags",
"//extensions/common/api",
"//extensions/features",
"//extensions/renderer",
"//extensions/utility",
"//gpu",
"//ipc",
"//media",
"//media/blink",
"//net",
"//net:net_browser_services",
"//net:net_utility_services",
"//net/dns:mojo_client",
"//net:net_with_v8",
"//pdf",
"//ppapi/features",
"//printing/features",
"//ppapi/buildflags",
"//printing/buildflags",
"//services/network:network_service",
"//services/network/public/cpp",
"//services/service_manager/embedder",
@@ -713,14 +721,14 @@ static_library("libcef_static") {
"//services/service_manager/runner/common",
"//skia",
"//storage/browser",
"//third_party/blink/public:blink",
"//third_party/brotli:dec",
"//third_party/cld_3/src/src:cld_3",
"//third_party/hunspell",
"//third_party/leveldatabase",
"//third_party/libxml",
"//third_party/WebKit/public:blink",
"//third_party/widevine/cdm:headers",
"//third_party/widevine/cdm:widevinecdmadapter",
"//third_party/widevine/cdm",
"//third_party/icu",
"//third_party/zlib:minizip",
"//ui/base",
@@ -771,6 +779,8 @@ static_library("libcef_static") {
libs = [
"comctl32.lib",
# For D3D11_DECODER_PROFILE_H264_VLD_NOFGT.
"dxguid.lib",
]
}
@@ -1068,11 +1078,11 @@ template("cef_pak_scaled") {
# Each input pak file should also have a deps line for completeness.
# Add associated .h files in the make_pack_header("resources") target.
sources = [
"$root_gen_dir/blink/public/resources/blink_scaled_resources_${percent}_percent.pak",
"$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
"$root_gen_dir/components/components_resources_${percent}_percent.pak",
"$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
"$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_${percent}_percent.pak",
"$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
]
@@ -1080,18 +1090,18 @@ template("cef_pak_scaled") {
# the libcef_static target. Grit deps that generate .cc files must be
# listed both here and in the libcef_static target.
public_deps = [
"//third_party/WebKit/public:scaled_resources",
"//chrome/renderer:resources",
"//components/resources:components_scaled_resources",
"//content/app/resources",
"//extensions:extensions_browser_resources",
"//third_party/blink/public:scaled_resources",
"//ui/resources:ui_resources_grd",
]
deps = [
# This repack target generates the blink_scaled_resources_*_percent.pak
# file but doesn't expose the public_deps required by make_pack_header.
"//third_party/WebKit/public:scaled_resources_${percent}_percent",
"//third_party/blink/public:scaled_resources_${percent}_percent",
]
if (toolkit_views) {
@@ -1208,7 +1218,6 @@ repack("pak") {
# Each input pak file should also have a deps line for completeness.
# Add associated .h files in the make_pack_header("resources") target.
sources = [
"$root_gen_dir/blink/public/resources/blink_resources.pak",
"$root_gen_dir/chrome/browser_resources.pak",
"$root_gen_dir/chrome/net_internals_resources.pak",
"$root_gen_dir/chrome/common_resources.pak",
@@ -1217,13 +1226,13 @@ repack("pak") {
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
]
# Use public_deps so that generated grit headers are discoverable from
# the libcef_static target. Grit deps that generate .cc files must be
# listed both here and in the libcef_static target.
public_deps = [
"//third_party/WebKit/public:resources_grit",
"//chrome/browser:resources",
"//chrome/browser/resources:net_internals_resources",
"//chrome/common:resources",
@@ -1232,6 +1241,7 @@ repack("pak") {
"//content/browser/tracing:resources",
"//content:resources",
"//net:net_resources",
"//third_party/blink/public:resources",
]
output = "$root_out_dir/cef.pak"
@@ -1268,9 +1278,6 @@ template("make_pack_header") {
make_pack_header("resources") {
header = "$root_out_dir/includes/include/cef_pack_resources.h"
inputs = [
"$root_gen_dir/blink/public/resources/grit/media_controls_resources.h",
"$root_gen_dir/blink/public/resources/grit/blink_image_resources.h",
"$root_gen_dir/blink/public/resources/grit/blink_resources.h",
"$root_gen_dir/cef/grit/cef_resources.h",
"$root_gen_dir/chrome/grit/browser_resources.h",
"$root_gen_dir/chrome/grit/common_resources.h",
@@ -1285,6 +1292,7 @@ make_pack_header("resources") {
"$root_gen_dir/extensions/grit/extensions_renderer_resources.h",
"$root_gen_dir/extensions/grit/extensions_resources.h",
"$root_gen_dir/net/grit/net_resources.h",
"$root_gen_dir/third_party/blink/public/resources/grit/blink_resources.h",
"$root_gen_dir/ui/resources/grit/ui_resources.h",
"$root_gen_dir/ui/resources/grit/webui_resources.h",
"$root_gen_dir/ui/views/resources/grit/views_resources.h",
@@ -1350,7 +1358,6 @@ if (is_mac) {
"$root_out_dir/cef_200_percent.pak",
"$root_out_dir/cef_extensions.pak",
"$root_out_dir/devtools_resources.pak",
"$root_out_dir/$widevine_cdm_path/widevinecdmadapter.plugin",
]
public_deps = [
@@ -1359,7 +1366,6 @@ if (is_mac) {
":pak_200_percent",
":pak_devtools",
":pak_extensions",
"//third_party/widevine/cdm:widevinecdmadapter",
]
if (icu_use_data_file) {
@@ -1384,9 +1390,61 @@ if (is_mac) {
]
}
if (use_egl) {
# Add the ANGLE .dylibs in the MODULE_DIR of the Framework app bundle.
bundle_data("cef_framework_angle_binaries") {
sources = [
"$root_out_dir/egl_intermediates/libEGL.dylib",
"$root_out_dir/egl_intermediates/libGLESv2.dylib",
]
outputs = [
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
]
public_deps = [
"//ui/gl:angle_library_copy",
]
}
# Add the SwiftShader .dylibs in the MODULE_DIR of the Framework app bundle.
bundle_data("cef_framework_swiftshader_binaries") {
sources = [
"$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
"$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
]
outputs = [
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
]
public_deps = [
"//ui/gl:swiftshader_library_copy",
]
}
}
group("cef_framework_angle_library") {
if (use_egl) {
deps = [
":cef_framework_angle_binaries",
]
}
}
group("cef_framework_swiftshader_library") {
if (use_egl) {
deps = [
":cef_framework_swiftshader_binaries",
]
}
}
mac_framework_bundle("cef_framework") {
output_name = cef_framework_name
framework_version = "A"
framework_contents = [
"Libraries",
"Resources",
]
sources = gypi_paths2.includes_common +
gypi_paths2.includes_mac +
gypi_paths.autogen_cpp_includes +
@@ -1400,8 +1458,10 @@ if (is_mac) {
# - crash_report_sender.app
deps = [
":cef_framework_angle_library",
":cef_framework_locales",
":cef_framework_resources",
":cef_framework_swiftshader_library",
":libcef_static",
]
@@ -1422,11 +1482,11 @@ if (is_mac) {
if (is_component_build) {
# Set up the rpath for the framework so that it can find dylibs in the
# root output directory. The framework is at
# $app_name.app/Contents/Frameworks/$output_name.framework/$output_name
# $app_name.app/Contents/Frameworks/$output_name.framework/Versions/A/$output_name
# so use loader_path to go back to the root output directory.
ldflags += [
"-rpath",
"@loader_path/../../../..",
"@loader_path/../../../../../..",
]
}
@@ -1463,9 +1523,12 @@ if (is_mac) {
]
}
if (is_linux && !is_debug && !using_sanitizer && use_allocator=="none") {
if (is_linux && !is_debug && use_allocator=="none") {
# Only export necessary symbols from libcef.so.
# Don't do this in Debug builds because it causes the resulting application to crash.
# Don't do this in Debug builds because it causes the resulting
# application to crash.
# Also need to do this for ASAN builds to work around
# https://crbug.com/832808.
ldflags = [ "-Wl,--version-script=" +
rebase_path("//cef/libcef_dll/libcef.lst") ]
}
@@ -1834,7 +1897,6 @@ if (is_mac) {
deps = [
":libcef",
":libcef_dll_wrapper",
"//build/config:exe_and_shlib_deps",
]
if (is_win) {
@@ -1908,7 +1970,6 @@ if (is_mac) {
deps = [
":libcef",
":libcef_dll_wrapper",
"//build/config:exe_and_shlib_deps",
]
if (is_win) {
@@ -1977,7 +2038,6 @@ if (is_mac) {
deps = [
":libcef",
":libcef_dll_wrapper",
"//build/config:exe_and_shlib_deps",
"//testing/gtest",
]

View File

@@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': '66afc5e5d10127546cc4b98b9117aff588b5e66b',
'chromium_checkout': 'refs/tags/69.0.3497.100',
}

73
CHROMIUM_UPDATE.txt Normal file
View File

@@ -0,0 +1,73 @@
# The Chromium Embedded Framework (CEF) project is built on top of the Chromium
# project source tree. When updating Chromium to a new version certain files and
# patterns should be observed for changes. If changes are detected then the CEF
# source code or patch files will likely need to be updated.
#
# Add `--log-chromium-changes` to the automate-git.py command-line to output
# the following files in the <download-dir>:
#
# * chromium_update_changes.diff
# Files in the chromium/src directory that have changed. See the 'files'
# section below.
#
# * chromium_update_patterns.txt
# Files in the chromium/src directory that contain invalid/unexpected
# patterns. See the 'patterns' section below. Failure of this step is
# considered a fatal error during update.
#
# * chromium_update_patches.txt
# Output from attempting to update existing Chromium patch files using the
# patch_updater.py tool. Failure of this step is considered a fatal error
# during update.
#
# For complete update instructions see:
# https://bitbucket.org/chromiumembedded/cef/wiki/ChromiumUpdate.md
{
# Files in the chromium/src directory that should be evaluated for changes.
# Similar changes may need to be applied to the CEF source code.
'files': [
'chrome/browser/browser_process.h',
'chrome/browser/extensions/api/tabs/tabs_api.*',
'chrome/browser/extensions/chrome_component_extension_resource_manager.*',
'chrome/browser/extensions/chrome_extension_web_contents_observer.*',
'chrome/browser/extensions/component_loader.*',
'chrome/browser/extensions/extension_service.*',
'chrome/browser/printing/print_view_manager*',
'chrome/browser/printing/printing_message_filter*',
'chrome/browser/profiles/profile.h',
'chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate.*',
'chrome/common/extensions/api/*_features.json',
'chrome/renderer/chrome_content_renderer_client.*',
'chrome/renderer/extensions/chrome_extensions_renderer_client.*',
'content/browser/renderer_host/render_widget_host_view_base.*',
'content/public/browser/content_browser_client.*',
'content/public/browser/render_widget_host_view.h',
'content/public/browser/storage_partition.h',
'content/public/browser/web_contents_delegate.h',
'content/public/common/content_features.cc',
'content/shell/BUILD.gn',
'content/shell/app/*',
'content/shell/browser/shell_*',
'content/shell/browser/renderer_host/shell_*',
'content/shell/common/shell_*',
'content/shell/gpu/shell_*',
'content/shell/renderer/shell_*',
'content/shell/utility/shell_*',
'extensions/shell/*',
'net/cookies/cookie_store.h',
],
# Patterns that should not be found in the chromium/src directory after
# applying patch files.
'patterns': [
{
# New instances of this static_cast are added to the Chromium sources with
# some regularity. If unfixed they will result in runtime crashes.
'pattern': 'static_cast<StoragePartitionImpl\*>(',
'exclude_matches': '^(.+?)test(.+?):',
'message': 'New instances in non-test files should be converted to ' +\
'call StoragePartition methods.' +\
'\nSee storage_partition_1973.patch.',
},
],
}

View File

@@ -8,7 +8,7 @@
# by hand. See the translator.README.txt file in the tools directory for
# more information.
#
# $hash=bede6f61d0f5b45669b8e924144e4200c41f869b$
# $hash=67bc21133e37f5361a39f25dcfe004616d467dbc$
#
{
@@ -432,6 +432,8 @@
'libcef_dll/ctocpp/urlrequest_client_ctocpp.h',
'libcef_dll/ctocpp/v8accessor_ctocpp.cc',
'libcef_dll/ctocpp/v8accessor_ctocpp.h',
'libcef_dll/ctocpp/v8array_buffer_release_callback_ctocpp.cc',
'libcef_dll/ctocpp/v8array_buffer_release_callback_ctocpp.h',
'libcef_dll/cpptoc/v8context_cpptoc.cc',
'libcef_dll/cpptoc/v8context_cpptoc.h',
'libcef_dll/cpptoc/v8exception_cpptoc.cc',
@@ -712,6 +714,8 @@
'libcef_dll/cpptoc/urlrequest_client_cpptoc.h',
'libcef_dll/cpptoc/v8accessor_cpptoc.cc',
'libcef_dll/cpptoc/v8accessor_cpptoc.h',
'libcef_dll/cpptoc/v8array_buffer_release_callback_cpptoc.cc',
'libcef_dll/cpptoc/v8array_buffer_release_callback_cpptoc.h',
'libcef_dll/ctocpp/v8context_ctocpp.cc',
'libcef_dll/ctocpp/v8context_ctocpp.h',
'libcef_dll/ctocpp/v8exception_ctocpp.cc',

View File

@@ -26,7 +26,6 @@
'include/base/cef_string16.h',
'include/base/cef_template_util.h',
'include/base/cef_thread_checker.h',
'include/base/cef_thread_collision_warner.h',
'include/base/cef_trace_event.h',
'include/base/cef_tuple.h',
'include/base/cef_weak_ptr.h',
@@ -115,7 +114,6 @@
'libcef_dll/base/cef_ref_counted.cc',
'libcef_dll/base/cef_string16.cc',
'libcef_dll/base/cef_thread_checker_impl.cc',
'libcef_dll/base/cef_thread_collision_warner.cc',
'libcef_dll/base/cef_weak_ptr.cc',
],
'libcef_dll_wrapper_sources_common': [
@@ -159,7 +157,6 @@
'tests/shared/browser/main_message_loop_std.cc',
'tests/shared/browser/main_message_loop_std.h',
'tests/shared/browser/resource_util.h',
'tests/shared/browser/resource_util.h',
],
'shared_sources_common': [
'tests/shared/common/client_app.cc',
@@ -371,6 +368,8 @@
'tests/cefclient/browser/dialog_handler_gtk.cc',
'tests/cefclient/browser/dialog_handler_gtk.h',
'tests/cefclient/browser/main_context_impl_posix.cc',
'tests/cefclient/browser/main_message_loop_multithreaded_gtk.cc',
'tests/cefclient/browser/main_message_loop_multithreaded_gtk.h',
'tests/cefclient/browser/print_handler_gtk.cc',
'tests/cefclient/browser/print_handler_gtk.h',
'tests/cefclient/browser/resource_util_linux.cc',
@@ -380,6 +379,8 @@
'tests/cefclient/browser/root_window_views.h',
'tests/cefclient/browser/temp_window_x11.cc',
'tests/cefclient/browser/temp_window_x11.h',
'tests/cefclient/browser/util_gtk.cc',
'tests/cefclient/browser/util_gtk.h',
'tests/cefclient/browser/views_menu_bar.cc',
'tests/cefclient/browser/views_menu_bar.h',
'tests/cefclient/browser/views_style.cc',

View File

@@ -86,7 +86,8 @@ if(OS_LINUX)
-Werror # Treat warnings as errors
-Wno-missing-field-initializers # Don't warn about missing field initializers
-Wno-unused-parameter # Don't warn about unused parameters
-Wno-error=comment # Don't complain about code in ascii art
-Wno-error=comment # Don't warn about code in comments
-Wno-comment # Don't warn about code in comments
)
list(APPEND CEF_C_COMPILER_FLAGS
-std=c99 # Use the C99 language standard
@@ -336,12 +337,16 @@ if(OS_WINDOWS)
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
if(USE_SANDBOX)
# Check if the current MSVC version is compatible with the cef_sandbox.lib
# static library.
# static library. For a list of all version numbers see
# https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering
list(APPEND supported_msvc_versions
1900 # VS2015 and updates 1, 2, & 3
1910 # VS2017 version 15.1 & 15.2
1911 # VS2017 version 15.3 & 15.4
1912 # VS2017 version 15.5
1913 # VS2017 version 15.6
1914 # VS2017 version 15.7
1915 # VS2017 version 15.8
)
list(FIND supported_msvc_versions ${MSVC_VERSION} _index)
if (${_index} EQUAL -1)

View File

@@ -162,6 +162,16 @@
#define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0
#endif
// Sanitizers annotations.
#if defined(__has_attribute)
#if __has_attribute(no_sanitize)
#define NO_SANITIZE(what) __attribute__((no_sanitize(what)))
#endif
#endif
#if !defined(NO_SANITIZE)
#define NO_SANITIZE(what)
#endif
#endif // !USING_CHROMIUM_INCLUDES
// Annotate a virtual method indicating it must be overriding a virtual method

View File

@@ -51,7 +51,7 @@
#include "include/base/cef_atomic_ref_count.h"
#include "include/base/cef_build.h"
#include "include/base/cef_logging.h"
#include "include/base/cef_thread_collision_warner.h"
#include "include/base/cef_macros.h"
namespace base {
@@ -78,10 +78,6 @@ class RefCountedBase {
}
void AddRef() const {
// TODO(maruel): Add back once it doesn't assert 500 times/sec.
// Current thread books the critical section "AddRelease"
// without release it.
// DFAKE_SCOPED_LOCK_THREAD_LOCKED(add_release_);
#if DCHECK_IS_ON()
DCHECK(!in_dtor_);
#endif
@@ -90,10 +86,6 @@ class RefCountedBase {
// Returns true if the object should self-delete.
bool Release() const {
// TODO(maruel): Add back once it doesn't assert 500 times/sec.
// Current thread books the critical section "AddRelease"
// without release it.
// DFAKE_SCOPED_LOCK_THREAD_LOCKED(add_release_);
#if DCHECK_IS_ON()
DCHECK(!in_dtor_);
#endif
@@ -112,8 +104,6 @@ class RefCountedBase {
mutable bool in_dtor_;
#endif
DFAKE_MUTEX(add_release_);
DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
};

View File

@@ -86,6 +86,7 @@ typedef std::char_traits<wchar_t> string16_char_traits;
#include "include/base/cef_macros.h"
namespace cef {
namespace base {
typedef uint16_t char16;
@@ -156,7 +157,15 @@ struct string16_char_traits {
static int_type eof() { return static_cast<int_type>(EOF); }
};
typedef std::basic_string<char16, base::string16_char_traits> string16;
typedef std::basic_string<char16, string16_char_traits> string16;
} // namespace base
} // namespace cef
namespace base {
typedef cef::base::char16 char16;
typedef cef::base::string16 string16;
extern std::ostream& operator<<(std::ostream& out, const string16& str);
@@ -204,8 +213,8 @@ extern void PrintTo(const string16& str, std::ostream* out);
//
// TODO(mark): File this bug with Apple and update this note with a bug number.
extern template class std::basic_string<base::char16,
base::string16_char_traits>;
extern template class std::basic_string<cef::base::char16,
cef::base::string16_char_traits>;
#endif // WCHAR_T_IS_UTF32

View File

@@ -1,276 +0,0 @@
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
// 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_THREAD_COLLISION_WARNER_H_
#define CEF_INCLUDE_BASE_CEF_THREAD_COLLISION_WARNER_H_
#pragma once
#if defined(BASE_THREADING_THREAD_COLLISION_WARNER_H_)
// Do nothing if the Chromium header has already been included.
// This can happen in cases where Chromium code is used directly by the
// client application. When using Chromium code directly always include
// the Chromium header first to avoid type conflicts.
#elif defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/threading/thread_collision_warner.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 <memory>
#include "include/base/cef_atomicops.h"
#include "include/base/cef_basictypes.h"
#include "include/base/cef_build.h"
#include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
// A helper class alongside macros to be used to verify assumptions about thread
// safety of a class.
//
// Example: Queue implementation non thread-safe but still usable if clients
// are synchronized somehow.
//
// In this case the macro DFAKE_SCOPED_LOCK has to be
// used, it checks that if a thread is inside the push/pop then
// noone else is still inside the pop/push
//
// class NonThreadSafeQueue {
// public:
// ...
// void push(int) { DFAKE_SCOPED_LOCK(push_pop_); ... }
// int pop() { DFAKE_SCOPED_LOCK(push_pop_); ... }
// ...
// private:
// DFAKE_MUTEX(push_pop_);
// };
//
//
// Example: Queue implementation non thread-safe but still usable if clients
// are synchronized somehow, it calls a method to "protect" from
// a "protected" method
//
// In this case the macro DFAKE_SCOPED_RECURSIVE_LOCK
// has to be used, it checks that if a thread is inside the push/pop
// then noone else is still inside the pop/push
//
// class NonThreadSafeQueue {
// public:
// void push(int) {
// DFAKE_SCOPED_LOCK(push_pop_);
// ...
// }
// int pop() {
// DFAKE_SCOPED_RECURSIVE_LOCK(push_pop_);
// bar();
// ...
// }
// void bar() { DFAKE_SCOPED_RECURSIVE_LOCK(push_pop_); ... }
// ...
// private:
// DFAKE_MUTEX(push_pop_);
// };
//
//
// Example: Queue implementation not usable even if clients are synchronized,
// so only one thread in the class life cycle can use the two members
// push/pop.
//
// In this case the macro DFAKE_SCOPED_LOCK_THREAD_LOCKED pins the
// specified
// critical section the first time a thread enters push or pop, from
// that time on only that thread is allowed to execute push or pop.
//
// class NonThreadSafeQueue {
// public:
// ...
// void push(int) { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... }
// int pop() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... }
// ...
// private:
// DFAKE_MUTEX(push_pop_);
// };
//
//
// Example: Class that has to be contructed/destroyed on same thread, it has
// a "shareable" method (with external synchronization) and a not
// shareable method (even with external synchronization).
//
// In this case 3 Critical sections have to be defined
//
// class ExoticClass {
// public:
// ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... }
// ~ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... }
//
// void Shareable() { DFAKE_SCOPED_LOCK(shareable_section_); ... }
// void NotShareable() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... }
// ...
// private:
// DFAKE_MUTEX(ctor_dtor_);
// DFAKE_MUTEX(shareable_section_);
// };
#if DCHECK_IS_ON()
// Defines a class member that acts like a mutex. It is used only as a
// verification tool.
#define DFAKE_MUTEX(obj) mutable base::ThreadCollisionWarner obj
// Asserts the call is never called simultaneously in two threads. Used at
// member function scope.
#define DFAKE_SCOPED_LOCK(obj) \
base::ThreadCollisionWarner::ScopedCheck s_check_##obj(&obj)
// Asserts the call is never called simultaneously in two threads. Used at
// member function scope. Same as DFAKE_SCOPED_LOCK but allows recursive locks.
#define DFAKE_SCOPED_RECURSIVE_LOCK(obj) \
base::ThreadCollisionWarner::ScopedRecursiveCheck sr_check_##obj(&obj)
// Asserts the code is always executed in the same thread.
#define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) \
base::ThreadCollisionWarner::Check check_##obj(&obj)
#else
#define DFAKE_MUTEX(obj) typedef void InternalFakeMutexType##obj
#define DFAKE_SCOPED_LOCK(obj) ((void)0)
#define DFAKE_SCOPED_RECURSIVE_LOCK(obj) ((void)0)
#define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) ((void)0)
#endif
namespace base {
// The class ThreadCollisionWarner uses an Asserter to notify the collision
// AsserterBase is the interfaces and DCheckAsserter is the default asserter
// used. During the unit tests is used another class that doesn't "DCHECK"
// in case of collision (check thread_collision_warner_unittests.cc)
struct AsserterBase {
virtual ~AsserterBase() {}
virtual void warn() = 0;
};
struct DCheckAsserter : public AsserterBase {
virtual ~DCheckAsserter() {}
virtual void warn() OVERRIDE;
};
class ThreadCollisionWarner {
public:
// The parameter asserter is there only for test purpose
explicit ThreadCollisionWarner(AsserterBase* asserter = new DCheckAsserter())
: valid_thread_id_(0), counter_(0), asserter_(asserter) {}
~ThreadCollisionWarner() { delete asserter_; }
// This class is meant to be used through the macro
// DFAKE_SCOPED_LOCK_THREAD_LOCKED
// it doesn't leave the critical section, as opposed to ScopedCheck,
// because the critical section being pinned is allowed to be used only
// from one thread
class Check {
public:
explicit Check(ThreadCollisionWarner* warner) : warner_(warner) {
warner_->EnterSelf();
}
~Check() {}
private:
ThreadCollisionWarner* warner_;
DISALLOW_COPY_AND_ASSIGN(Check);
};
// This class is meant to be used through the macro
// DFAKE_SCOPED_LOCK
class ScopedCheck {
public:
explicit ScopedCheck(ThreadCollisionWarner* warner) : warner_(warner) {
warner_->Enter();
}
~ScopedCheck() { warner_->Leave(); }
private:
ThreadCollisionWarner* warner_;
DISALLOW_COPY_AND_ASSIGN(ScopedCheck);
};
// This class is meant to be used through the macro
// DFAKE_SCOPED_RECURSIVE_LOCK
class ScopedRecursiveCheck {
public:
explicit ScopedRecursiveCheck(ThreadCollisionWarner* warner)
: warner_(warner) {
warner_->EnterSelf();
}
~ScopedRecursiveCheck() { warner_->Leave(); }
private:
ThreadCollisionWarner* warner_;
DISALLOW_COPY_AND_ASSIGN(ScopedRecursiveCheck);
};
private:
// This method stores the current thread identifier and does a DCHECK
// if a another thread has already done it, it is safe if same thread
// calls this multiple time (recursion allowed).
void EnterSelf();
// Same as EnterSelf but recursion is not allowed.
void Enter();
// Removes the thread_id stored in order to allow other threads to
// call EnterSelf or Enter.
void Leave();
// This stores the thread id that is inside the critical section, if the
// value is 0 then no thread is inside.
volatile subtle::Atomic32 valid_thread_id_;
// Counter to trace how many time a critical section was "pinned"
// (when allowed) in order to unpin it when counter_ reaches 0.
volatile subtle::Atomic32 counter_;
// Here only for class unit tests purpose, during the test I need to not
// DCHECK but notify the collision with something else.
AsserterBase* asserter_;
DISALLOW_COPY_AND_ASSIGN(ThreadCollisionWarner);
};
} // namespace base
#endif // !USING_CHROMIUM_INCLUDES
#endif // CEF_INCLUDE_BASE_CEF_THREAD_COLLISION_WARNER_H_

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=ab31ef5d72b4b1c9809698e5fbbdae21918af713$
// $hash=c7641e41aca6bf30b9c36092861f061d2b16ff82$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_
@@ -132,6 +132,15 @@ typedef struct _cef_display_handler_t {
int(CEF_CALLBACK* on_auto_resize)(struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
const cef_size_t* new_size);
///
// Called when the overall page loading progress has changed. |progress|
// ranges from 0.0 to 1.0.
///
void(CEF_CALLBACK* on_loading_progress_change)(
struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
double progress);
} cef_display_handler_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=3fb1034cb02cfeddcaf02d8fde0dec5b8a18f416$
// $hash=f2f3acb1df9815e4ac9bf34010ce260a2496ae5a$
//
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
@@ -202,6 +202,17 @@ typedef struct _cef_render_handler_t {
const cef_range_t* selected_range,
size_t character_boundsCount,
cef_rect_t const* character_bounds);
///
// Called when text selection has changed for the specified |browser|.
// |selected_text| is the currently selected text and |selected_range| is the
// character range.
///
void(CEF_CALLBACK* on_text_selection_changed)(
struct _cef_render_handler_t* self,
struct _cef_browser_t* browser,
const cef_string_t* selected_text,
const cef_range_t* selected_range);
} cef_render_handler_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=b8b5a62b11dbc48f0733c0522864e4dbda8b4f59$
// $hash=95e44047a75693dbae0ab6b07b415d188252bfdf$
//
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
@@ -112,12 +112,15 @@ typedef struct _cef_request_handler_t {
// If the navigation is allowed cef_load_handler_t::OnLoadStart and
// cef_load_handler_t::OnLoadEnd will be called. If the navigation is canceled
// cef_load_handler_t::OnLoadError will be called with an |errorCode| value of
// ERR_ABORTED.
// ERR_ABORTED. The |user_gesture| value will be true (1) if the browser
// navigated via explicit user gesture (e.g. clicking a link) or false (0) if
// it navigated automatically (e.g. via the DomContentLoaded event).
///
int(CEF_CALLBACK* on_before_browse)(struct _cef_request_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame,
struct _cef_request_t* request,
int user_gesture,
int is_redirect);
///

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=561e4711432158fd3da971f3c0240dcf5e8e782a$
// $hash=fd2cbc427bccf30298e26dd6c3bcef9551433f8b$
//
#ifndef CEF_INCLUDE_CAPI_CEF_RESPONSE_CAPI_H_
@@ -127,6 +127,18 @@ typedef struct _cef_response_t {
///
void(CEF_CALLBACK* set_header_map)(struct _cef_response_t* self,
cef_string_multimap_t headerMap);
///
// Get the resolved URL after redirects or changed as a result of HSTS.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_url)(struct _cef_response_t* self);
///
// Set the resolved URL after redirects or changed as a result of HSTS.
///
void(CEF_CALLBACK* set_url)(struct _cef_response_t* self,
const cef_string_t* url);
} cef_response_t;
///

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=e9e43167b1cf8033bd7e6ba6931213d7cf4b69b5$
// $hash=2303574e76708e5311aede8e66eb7f1f679e0d1f$
//
#ifndef CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_
@@ -355,6 +355,25 @@ typedef struct _cef_v8exception_t {
int(CEF_CALLBACK* get_end_column)(struct _cef_v8exception_t* self);
} cef_v8exception_t;
///
// Callback structure that is passed to cef_v8value_t::CreateArrayBuffer.
///
typedef struct _cef_v8array_buffer_release_callback_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Called to release |buffer| when the ArrayBuffer JS object is garbage
// collected. |buffer| is the value that was passed to CreateArrayBuffer along
// with this object.
///
void(CEF_CALLBACK* release_buffer)(
struct _cef_v8array_buffer_release_callback_t* self,
void* buffer);
} cef_v8array_buffer_release_callback_t;
///
// Structure representing a V8 value handle. V8 handles can only be accessed
// from the thread on which they are created. Valid threads for creating a V8
@@ -425,6 +444,11 @@ typedef struct _cef_v8value_t {
///
int(CEF_CALLBACK* is_array)(struct _cef_v8value_t* self);
///
// True if the value type is an ArrayBuffer.
///
int(CEF_CALLBACK* is_array_buffer)(struct _cef_v8value_t* self);
///
// True if the value type is function.
///
@@ -639,6 +663,25 @@ typedef struct _cef_v8value_t {
///
int(CEF_CALLBACK* get_array_length)(struct _cef_v8value_t* self);
// ARRAY BUFFER METHODS - These functions are only available on ArrayBuffers.
///
// Returns the ReleaseCallback object associated with the ArrayBuffer or NULL
// if the ArrayBuffer was not created with CreateArrayBuffer.
///
struct _cef_v8array_buffer_release_callback_t*(
CEF_CALLBACK* get_array_buffer_release_callback)(
struct _cef_v8value_t* self);
///
// Prevent the ArrayBuffer from using it's memory block by setting the length
// to zero. This operation cannot be undone. If the ArrayBuffer was created
// with CreateArrayBuffer then
// cef_v8array_buffer_release_callback_t::ReleaseBuffer will be called to
// release the underlying buffer.
///
int(CEF_CALLBACK* neuter_array_buffer)(struct _cef_v8value_t* self);
// FUNCTION METHODS - These functions are only available on functions.
///
@@ -751,6 +794,21 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_object(
///
CEF_EXPORT cef_v8value_t* cef_v8value_create_array(int length);
///
// Create a new cef_v8value_t object of type ArrayBuffer which wraps the
// provided |buffer| of size |length| bytes. The ArrayBuffer is externalized,
// meaning that it does not own |buffer|. The caller is responsible for freeing
// |buffer| when requested via a call to cef_v8array_buffer_release_callback_t::
// ReleaseBuffer. This function should only be called from within the scope of a
// cef_render_process_handler_t, cef_v8handler_t or cef_v8accessor_t callback,
// or in combination with calling enter() and exit() on a stored cef_v8context_t
// reference.
///
CEF_EXPORT cef_v8value_t* cef_v8value_create_array_buffer(
void* buffer,
size_t length,
cef_v8array_buffer_release_callback_t* release_callback);
///
// Create a new cef_v8value_t object of type function. This function should only
// be called from within the scope of a cef_render_process_handler_t,

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=ec4f722423ff89dd2ff61fd3336bda1776081023$
// $hash=8815d0d0778cc210fb6f9ede9dafc5ca51124169$
//
#ifndef CEF_INCLUDE_CAPI_CEF_WEB_PLUGIN_CAPI_H_
@@ -202,9 +202,6 @@ CEF_EXPORT void cef_is_web_plugin_unstable(
// 2. widevinecdm file from the CDM binary distribution (e.g.
// widevinecdm.dll on on Windows, libwidevinecdm.dylib on OS X,
// libwidevinecdm.so on Linux).
// 3. widevidecdmadapter file from the CEF binary distribution (e.g.
// widevinecdmadapter.dll on Windows, widevinecdmadapter.plugin on OS X,
// libwidevinecdmadapter.so on Linux).
//
// If any of these files are missing or if the manifest file has incorrect
// contents the registration will fail and |callback| will receive a |result|

View File

@@ -50,7 +50,7 @@ class CefAuthCallback : public virtual CefBaseRefCounted {
///
// Continue the authentication request.
///
/*--cef(capi_name=cont,optional_param=password)--*/
/*--cef(capi_name=cont,optional_param=username,optional_param=password)--*/
virtual void Continue(const CefString& username,
const CefString& password) = 0;

View File

@@ -127,6 +127,14 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
const CefSize& new_size) {
return false;
}
///
// Called when the overall page loading progress has changed. |progress|
// ranges from 0.0 to 1.0.
///
/*--cef()--*/
virtual void OnLoadingProgressChange(CefRefPtr<CefBrowser> browser,
double progress) {}
};
#endif // CEF_INCLUDE_CEF_DISPLAY_HANDLER_H_

View File

@@ -204,6 +204,16 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
virtual void OnImeCompositionRangeChanged(CefRefPtr<CefBrowser> browser,
const CefRange& selected_range,
const RectList& character_bounds) {}
///
// Called when text selection has changed for the specified |browser|.
// |selected_text| is the currently selected text and |selected_range| is
// the character range.
///
/*--cef(optional_param=selected_text,optional_param=selected_range)--*/
virtual void OnTextSelectionChanged(CefRefPtr<CefBrowser> browser,
const CefString& selected_text,
const CefRange& selected_range) {}
};
#endif // CEF_INCLUDE_CEF_RENDER_HANDLER_H_

View File

@@ -106,12 +106,15 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
// If the navigation is allowed CefLoadHandler::OnLoadStart and
// CefLoadHandler::OnLoadEnd will be called. If the navigation is canceled
// CefLoadHandler::OnLoadError will be called with an |errorCode| value of
// ERR_ABORTED.
// ERR_ABORTED. The |user_gesture| value will be true if the browser
// navigated via explicit user gesture (e.g. clicking a link) or false if it
// navigated automatically (e.g. via the DomContentLoaded event).
///
/*--cef()--*/
virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool user_gesture,
bool is_redirect) {
return false;
}

View File

@@ -128,6 +128,18 @@ class CefResponse : public virtual CefBaseRefCounted {
///
/*--cef()--*/
virtual void SetHeaderMap(const HeaderMap& headerMap) = 0;
///
// Get the resolved URL after redirects or changed as a result of HSTS.
///
/*--cef()--*/
virtual CefString GetURL() = 0;
///
// Set the resolved URL after redirects or changed as a result of HSTS.
///
/*--cef()--*/
virtual void SetURL(const CefString& url) = 0;
};
#endif // CEF_INCLUDE_CEF_RESPONSE_H_

View File

@@ -407,6 +407,21 @@ class CefV8Exception : public virtual CefBaseRefCounted {
virtual int GetEndColumn() = 0;
};
///
// Callback interface that is passed to CefV8Value::CreateArrayBuffer.
///
/*--cef(source=client)--*/
class CefV8ArrayBufferReleaseCallback : public virtual CefBaseRefCounted {
public:
///
// Called to release |buffer| when the ArrayBuffer JS object is garbage
// collected. |buffer| is the value that was passed to CreateArrayBuffer along
// with this object.
///
/*--cef()--*/
virtual void ReleaseBuffer(void* buffer) = 0;
};
///
// Class representing a V8 value handle. V8 handles can only be accessed from
// the thread on which they are created. Valid threads for creating a V8 handle
@@ -493,6 +508,22 @@ class CefV8Value : public virtual CefBaseRefCounted {
/*--cef()--*/
static CefRefPtr<CefV8Value> CreateArray(int length);
///
// Create a new CefV8Value object of type ArrayBuffer which wraps the provided
// |buffer| of size |length| bytes. The ArrayBuffer is externalized, meaning
// that it does not own |buffer|. The caller is responsible for freeing
// |buffer| when requested via a call to CefV8ArrayBufferReleaseCallback::
// ReleaseBuffer. This method should only be called from within the scope of a
// CefRenderProcessHandler, CefV8Handler or CefV8Accessor callback, or in
// combination with calling Enter() and Exit() on a stored CefV8Context
// reference.
///
/*--cef()--*/
static CefRefPtr<CefV8Value> CreateArrayBuffer(
void* buffer,
size_t length,
CefRefPtr<CefV8ArrayBufferReleaseCallback> release_callback);
///
// Create a new CefV8Value object of type function. This method should only be
// called from within the scope of a CefRenderProcessHandler, CefV8Handler or
@@ -571,6 +602,12 @@ class CefV8Value : public virtual CefBaseRefCounted {
/*--cef()--*/
virtual bool IsArray() = 0;
///
// True if the value type is an ArrayBuffer.
///
/*--cef()--*/
virtual bool IsArrayBuffer() = 0;
///
// True if the value type is function.
///
@@ -793,6 +830,25 @@ class CefV8Value : public virtual CefBaseRefCounted {
/*--cef()--*/
virtual int GetArrayLength() = 0;
// ARRAY BUFFER METHODS - These methods are only available on ArrayBuffers.
///
// Returns the ReleaseCallback object associated with the ArrayBuffer or NULL
// if the ArrayBuffer was not created with CreateArrayBuffer.
///
/*--cef()--*/
virtual CefRefPtr<CefV8ArrayBufferReleaseCallback>
GetArrayBufferReleaseCallback() = 0;
///
// Prevent the ArrayBuffer from using it's memory block by setting the length
// to zero. This operation cannot be undone. If the ArrayBuffer was created
// with CreateArrayBuffer then CefV8ArrayBufferReleaseCallback::ReleaseBuffer
// will be called to release the underlying buffer.
///
/*--cef()--*/
virtual bool NeuterArrayBuffer() = 0;
// FUNCTION METHODS - These methods are only available on functions.
///

View File

@@ -179,9 +179,6 @@ class CefRegisterCdmCallback : public virtual CefBaseRefCounted {
// 2. widevinecdm file from the CDM binary distribution (e.g.
// widevinecdm.dll on on Windows, libwidevinecdm.dylib on OS X,
// libwidevinecdm.so on Linux).
// 3. widevidecdmadapter file from the CEF binary distribution (e.g.
// widevinecdmadapter.dll on Windows, widevinecdmadapter.plugin on OS X,
// libwidevinecdmadapter.so on Linux).
//
// If any of these files are missing or if the manifest file has incorrect
// contents the registration will fail and |callback| will receive a |result|

View File

@@ -151,14 +151,6 @@ typedef struct _cef_settings_t {
///
size_t size;
///
// Set to true (1) to use a single process for the browser and renderer. This
// run mode is not officially supported by Chromium and is less stable than
// the multi-process default. Also configurable using the "single-process"
// command-line switch.
///
int single_process;
///
// Set to true (1) to disable the sandbox for sub-processes. See
// cef_sandbox_win.h for requirements to enable the sandbox on Windows. Also
@@ -189,7 +181,7 @@ typedef struct _cef_settings_t {
// Set to true (1) to have the browser process message loop run in a separate
// thread. If false (0) than the CefDoMessageLoopWork() function must be
// called from your application message loop. This option is only supported on
// Windows.
// Windows and Linux.
///
int multi_threaded_message_loop;
@@ -1264,6 +1256,12 @@ typedef enum {
// originated in the browser process.
///
UR_FLAG_NO_RETRY_ON_5XX = 1 << 5,
///
// If set 3XX responses will cause the fetch to halt immediately rather than
// continue through the redirect.
///
UR_FLAG_STOP_ON_REDIRECT = 1 << 6,
} cef_urlrequest_flags_t;
///
@@ -1417,6 +1415,11 @@ typedef enum {
///
TID_FILE_USER_BLOCKING,
///
// Used to launch and terminate browser processes.
///
TID_PROCESS_LAUNCHER,
///
// Used to process IPC and network messages. Do not perform blocking tasks on
// this thread. All tasks posted after

View File

@@ -539,7 +539,6 @@ struct CefSettingsTraits {
static inline void set(const struct_type* src,
struct_type* target,
bool copy) {
target->single_process = src->single_process;
target->no_sandbox = src->no_sandbox;
cef_string_set(src->browser_subprocess_path.str,
src->browser_subprocess_path.length,

View File

@@ -130,6 +130,12 @@ ChromeZoomLevelPrefs* CefBrowserContext::GetZoomLevelPrefs() {
GetStoragePartition(this, NULL)->GetZoomLevelDelegate());
}
scoped_refptr<network::SharedURLLoaderFactory>
CefBrowserContext::GetURLLoaderFactory() {
return GetDefaultStoragePartition(this)
->GetURLLoaderFactoryForBrowserProcess();
}
void CefBrowserContext::OnRenderFrameDeleted(int render_process_id,
int render_frame_id,
bool is_main_frame,

View File

@@ -146,6 +146,7 @@ class CefBrowserContext : public ChromeProfileStub {
// Profile methods.
ChromeZoomLevelPrefs* GetZoomLevelPrefs() override;
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override;
// Returns a RequestContext associated with this object. If this object is a
// *Proxy then it will return the single associated proxy RequestContext. If

View File

@@ -40,7 +40,7 @@
#include "extensions/browser/extension_protocols.h"
#include "extensions/common/constants.h"
#include "net/proxy_resolution/proxy_config_service.h"
#include "net/proxy_resolution/proxy_service.h"
#include "net/proxy_resolution/proxy_resolution_service.h"
using content::BrowserThread;
@@ -176,11 +176,11 @@ class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener {
// visitedlink::VisitedLinkMaster::Listener methods.
void NewTable(mojo::SharedBufferHandle table) override {
void NewTable(base::ReadOnlySharedMemoryRegion* table_region) override {
CEF_REQUIRE_UIT();
ListenerMap::iterator it = listener_map_.begin();
for (; it != listener_map_.end(); ++it)
it->second->NewTable(table);
it->second->NewTable(table_region);
}
void Add(visitedlink::VisitedLinkCommon::Fingerprint fingerprint) override {
@@ -418,7 +418,8 @@ CefBrowserContextImpl::GetSSLHostStateDelegate() {
return ssl_host_state_delegate_.get();
}
content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() {
content::PermissionControllerDelegate*
CefBrowserContextImpl::GetPermissionControllerDelegate() {
return nullptr;
}
@@ -462,10 +463,8 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
// data in its installation directory).
extensions::InfoMap* extension_info_map = extension_system()->info_map();
(*protocol_handlers)[extensions::kExtensionScheme] =
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
extensions::CreateExtensionProtocolHandler(IsOffTheRecord(),
extension_info_map)
.release());
extensions::CreateExtensionProtocolHandler(IsOffTheRecord(),
extension_info_map);
}
url_request_getter_ = new CefURLRequestContextGetterImpl(

View File

@@ -67,7 +67,8 @@ class CefBrowserContextImpl : public CefBrowserContext,
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
content::PushMessagingService* GetPushMessagingService() override;
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionManager* GetPermissionManager() override;
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
override;
content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
content::BackgroundSyncController* GetBackgroundSyncController() override;
content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate()

View File

@@ -153,8 +153,9 @@ CefBrowserContextProxy::GetSSLHostStateDelegate() {
return parent_->GetSSLHostStateDelegate();
}
content::PermissionManager* CefBrowserContextProxy::GetPermissionManager() {
return parent_->GetPermissionManager();
content::PermissionControllerDelegate*
CefBrowserContextProxy::GetPermissionControllerDelegate() {
return parent_->GetPermissionControllerDelegate();
}
content::BackgroundFetchDelegate*

View File

@@ -42,7 +42,8 @@ class CefBrowserContextProxy : public CefBrowserContext {
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
content::PushMessagingService* GetPushMessagingService() override;
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionManager* GetPermissionManager() override;
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
override;
content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
content::BackgroundSyncController* GetBackgroundSyncController() override;
content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate()

File diff suppressed because it is too large Load Diff

View File

@@ -400,13 +400,15 @@ class CefBrowserHostImpl : public CefBrowserHost,
const content::OpenURLParams& params) override;
bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
void AddNewContents(content::WebContents* source,
content::WebContents* new_contents,
std::unique_ptr<content::WebContents> new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture,
bool* was_blocked) override;
void LoadingStateChanged(content::WebContents* source,
bool to_different_document) override;
void LoadProgressChanged(content::WebContents* source,
double progress) override;
void CloseContents(content::WebContents* source) override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
bool DidAddMessageToConsole(content::WebContents* source,
@@ -450,8 +452,10 @@ class CefBrowserHostImpl : public CefBrowserHost,
void RunFileChooser(content::RenderFrameHost* render_frame_host,
const content::FileChooserParams& params) override;
bool EmbedsFullscreenWidget() const override;
void EnterFullscreenModeForTab(content::WebContents* web_contents,
const GURL& origin) override;
void EnterFullscreenModeForTab(
content::WebContents* web_contents,
const GURL& origin,
const blink::WebFullscreenOptions& options) override;
void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
bool IsFullscreenForTabOrPending(
const content::WebContents* web_contents) const override;
@@ -470,8 +474,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
void RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) override;
bool CheckMediaAccessPermission(content::WebContents* web_contents,
content::MediaResponseCallback callback) override;
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
content::MediaStreamType type) override;
bool IsNeverVisible(content::WebContents* web_contents) override;
@@ -502,8 +506,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
bool OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* render_frame_host) override;
void AccessibilityEventReceived(
const std::vector<content::AXEventNotificationDetails>& eventData)
override;
const content::AXEventNotificationDetails& content_event_bundle) override;
void AccessibilityLocationChangesReceived(
const std::vector<content::AXLocationChangeNotificationDetails>& locData)
override;
@@ -518,6 +521,20 @@ class CefBrowserHostImpl : public CefBrowserHost,
void RemoveObserver(Observer* observer);
bool HasObserver(Observer* observer) const;
class NavigationLock final {
private:
friend class CefBrowserHostImpl;
friend std::unique_ptr<NavigationLock>::deleter_type;
explicit NavigationLock(CefRefPtr<CefBrowserHostImpl> browser);
~NavigationLock();
CefRefPtr<CefBrowserHostImpl> browser_;
};
// Block navigation-related events on NavigationLock life span.
std::unique_ptr<NavigationLock> CreateNavigationLock();
private:
class DevToolsWebContentsObserver;
@@ -525,6 +542,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
const CefBrowserSettings& settings,
CefRefPtr<CefClient> client,
content::WebContents* web_contents,
bool own_web_contents,
scoped_refptr<CefBrowserInfo> browser_info,
CefRefPtr<CefBrowserHostImpl> opener,
bool is_devtools_popup,
@@ -562,6 +580,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
CefRefPtr<CefExtension> extension);
void set_owned_web_contents(content::WebContents* owned_contents);
// Give the platform delegate an opportunity to create the host window.
bool CreateHostWindow();
@@ -574,6 +594,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
void DestroyExtensionHost();
void OnExtensionHostDeleted();
// Returns true if navigation actions are currently locked.
bool navigation_locked() const;
// Action to be executed once the navigation lock is released.
void set_pending_navigation_action(base::OnceClosure action);
// Update or create a frame object. |frame_id| (renderer routing id) will be
// >= 0 if the frame currently exists in the renderer process. |frame_id| will
// be < 0 for the main frame if it has not yet navigated for the first time,
@@ -584,13 +609,13 @@ class CefBrowserHostImpl : public CefBrowserHost,
// if PlzNavigate is disabled; or >= 0 otherwise. |parent_frame_id| will be
// CefFrameHostImpl::kUnspecifiedFrameId if unknown. In cases where |frame_id|
// is < 0 either the existing main frame object or a pending object will be
// returned depending on current state. If |is_download| is true then the
// value of |is_main_frame| cannot be relied on.
// returned depending on current state. If |is_main_frame_state_flaky| is true
// then the value of |is_main_frame| cannot be relied on.
CefRefPtr<CefFrame> GetOrCreateFrame(int64 frame_id,
int frame_tree_node_id,
int64 parent_frame_id,
bool is_main_frame,
bool is_download,
bool is_main_frame_state_flaky,
base::string16 frame_name,
const GURL& frame_url);
@@ -624,6 +649,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Create the CefFileDialogManager if it doesn't already exist.
void EnsureFileDialogManager();
void ConfigureAutoResize();
// Send a message to the RenderViewHost associated with this browser.
// TODO(cef): With the introduction of OOPIFs, WebContents can span multiple
// processes. Messages should be sent to specific RenderFrameHosts instead.
@@ -631,7 +658,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefBrowserSettings settings_;
CefRefPtr<CefClient> client_;
std::unique_ptr<content::WebContents> web_contents_;
scoped_refptr<CefBrowserInfo> browser_info_;
CefWindowHandle opener_;
CefRefPtr<CefRequestContext> request_context_;
@@ -640,6 +666,12 @@ class CefBrowserHostImpl : public CefBrowserHost,
const bool is_views_hosted_;
CefWindowHandle host_window_handle_;
// Non-nullptr if this object owns the WebContents. Will be nullptr for popup
// browsers between the calls to WebContentsCreated() and AddNewContents(),
// and may never be set if the parent browser is destroyed during popup
// creation.
std::unique_ptr<content::WebContents> owned_web_contents_;
// Volatile state information. All access must be protected by the state lock.
base::Lock state_lock_;
bool is_loading_;
@@ -673,9 +705,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
// thread.
DestructionState destruction_state_;
// True if frame destruction is currently pending. Navigation should not occur
// while this flag is true.
bool frame_destruction_pending_;
// Navigation will not occur while |navigation_lock_count_| > 0.
// |pending_navigation_action_| will be executed when the lock is released.
// Only accessed on the UI thread.
int navigation_lock_count_ = 0;
base::OnceClosure pending_navigation_action_;
// True if the OS window hosting the browser has been destroyed. Only accessed
// on the UI thread.
@@ -725,6 +759,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefRefPtr<CefExtension> extension_;
bool is_background_host_ = false;
// Used with auto-resize.
bool auto_resize_enabled_ = false;
gfx::Size auto_resize_min_;
gfx::Size auto_resize_max_;
IMPLEMENT_REFCOUNTING(CefBrowserHostImpl);
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostImpl);
};

View File

@@ -16,7 +16,7 @@
#include "base/synchronization/lock.h"
#include "content/public/browser/render_process_host_observer.h"
#include "third_party/WebKit/public/web/window_features.mojom.h"
#include "third_party/blink/public/web/window_features.mojom.h"
#include "ui/base/window_open_disposition.h"
#include "url/gurl.h"

View File

@@ -10,7 +10,6 @@
#include "libcef/browser/browser_context_impl.h"
#include "libcef/browser/browser_context_keyed_service_factories.h"
#include "libcef/browser/browser_message_loop.h"
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h"
#include "libcef/browser/devtools_manager_delegate.h"
@@ -30,10 +29,11 @@
#include "chrome/browser/chrome_browser_main_extra_parts.h"
#include "chrome/browser/plugins/plugin_finder.h"
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/common/result_codes.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/constants.h"
#include "net/base/net_module.h"
#include "services/service_manager/embedder/result_codes.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h"
#if defined(USE_AURA)
@@ -80,7 +80,7 @@ int CefBrowserMainParts::PreEarlyInitialization() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreEarlyInitialization();
return content::RESULT_CODE_NORMAL_EXIT;
return service_manager::RESULT_CODE_NORMAL_EXIT;
}
void CefBrowserMainParts::PostEarlyInitialization() {
@@ -107,11 +107,6 @@ void CefBrowserMainParts::ToolkitInitialized() {
}
void CefBrowserMainParts::PreMainMessageLoopStart() {
if (!base::MessageLoop::current()) {
// Create the browser message loop.
message_loop_.reset(new CefBrowserMessageLoop());
}
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreMainMessageLoopStart();
}
@@ -156,6 +151,8 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
#endif
ui::MaterialDesignController::Initialize();
// CEF's profile is a BrowserContext.
PreProfileInit();

View File

@@ -16,11 +16,6 @@
#include "content/public/browser/browser_main_parts.h"
#include "net/url_request/url_request_context_getter.h"
namespace base {
class MessageLoop;
class Thread;
} // namespace base
namespace content {
struct MainFunctionParams;
}
@@ -54,7 +49,7 @@ class CefBrowserMainParts : public content::BrowserMainParts {
void PostMainMessageLoopStart() override;
int PreCreateThreads() override;
void ServiceManagerConnectionStarted(
content::ServiceManagerConnection* connection);
content::ServiceManagerConnection* connection) override;
void PreMainMessageLoopRun() override;
void PostMainMessageLoopRun() override;
void PostDestroyThreads() override;
@@ -89,7 +84,6 @@ class CefBrowserMainParts : public content::BrowserMainParts {
CefRefPtr<CefRequestContextImpl> global_request_context_;
CefDevToolsDelegate* devtools_delegate_; // Deletes itself.
std::unique_ptr<base::MessageLoop> message_loop_;
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
std::unique_ptr<extensions::ExtensionsBrowserClient>

View File

@@ -8,11 +8,7 @@
#include "libcef/browser/browser_main.h"
#include "cef/grit/cef_strings.h"
#include "content/public/browser/utility_process_host.h"
#include "content/public/browser/utility_process_host_client.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/win/direct_write.h"
#include "base/logging.h"
void CefBrowserMainParts::PlatformInitialize() {
HRESULT res;

View File

@@ -7,7 +7,6 @@
#include "libcef/common/content_client.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#if defined(OS_MACOSX)
#include "base/mac/scoped_nsautorelease_pool.h"
@@ -103,20 +102,3 @@ CefBrowserMessageLoop::CefBrowserMessageLoop()
}
CefBrowserMessageLoop::~CefBrowserMessageLoop() {}
// static
CefBrowserMessageLoop* CefBrowserMessageLoop::current() {
base::MessageLoop* loop = base::MessageLoop::current();
DCHECK(loop->IsType(base::MessageLoop::TYPE_UI));
return static_cast<CefBrowserMessageLoop*>(loop);
}
void CefBrowserMessageLoop::DoMessageLoopIteration() {
base::RunLoop run_loop;
run_loop.RunUntilIdle();
}
void CefBrowserMessageLoop::RunMessageLoop() {
base::RunLoop run_loop;
run_loop.Run();
}

View File

@@ -17,15 +17,6 @@ class CefBrowserMessageLoop : public base::MessageLoopForUI {
CefBrowserMessageLoop();
~CefBrowserMessageLoop() override;
// Returns the CefBrowserMessageLoop of the current thread.
static CefBrowserMessageLoop* current();
// Do a single interation of the UI message loop.
void DoMessageLoopIteration();
// Run the UI message loop.
void RunMessageLoop();
private:
DISALLOW_COPY_AND_ASSIGN(CefBrowserMessageLoop);
};

View File

@@ -196,7 +196,7 @@ void CefBrowserPlatformDelegate::DragSourceSystemDragEnded() {
}
void CefBrowserPlatformDelegate::AccessibilityEventReceived(
const std::vector<content::AXEventNotificationDetails>& eventData) {
const content::AXEventNotificationDetails& eventData) {
NOTREACHED();
}

View File

@@ -22,14 +22,14 @@ namespace blink {
class WebMouseEvent;
class WebMouseWheelEvent;
class WebInputEvent;
}
} // namespace blink
namespace content {
struct NativeWebKeyboardEvent;
class RenderViewHost;
class RenderViewHostDelegateView;
class WebContentsView;
}
} // namespace content
#if defined(USE_AURA)
namespace views {
@@ -140,7 +140,7 @@ class CefBrowserPlatformDelegate {
virtual SkColor GetBackgroundColor() const = 0;
// Notify the window that it was resized.
virtual void WasResized() = 0;
virtual void SynchronizeVisualProperties() = 0;
// Send input events.
virtual void SendKeyEvent(const content::NativeWebKeyboardEvent& event) = 0;
@@ -262,7 +262,7 @@ class CefBrowserPlatformDelegate {
virtual void DragSourceEndedAt(int x, int y, cef_drag_operations_mask_t op);
virtual void DragSourceSystemDragEnded();
virtual void AccessibilityEventReceived(
const std::vector<content::AXEventNotificationDetails>& eventData);
const content::AXEventNotificationDetails& eventData);
virtual void AccessibilityLocationChangesReceived(
const std::vector<content::AXLocationChangeNotificationDetails>& locData);

View File

@@ -20,7 +20,6 @@
#include "base/message_loop/message_loop.h"
#include "base/strings/string_util.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/url_fetcher.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
@@ -356,6 +355,9 @@ class CefBrowserURLRequest::Context
CefResponseImpl* responseImpl =
static_cast<CefResponseImpl*>(response_.get());
responseImpl->SetURL(fetcher_->GetURL().spec());
responseImpl->SetStatus(fetcher_->GetResponseCode());
net::HttpResponseHeaders* headers = fetcher_->GetResponseHeaders();
if (headers)
responseImpl->SetResponseHeaders(*headers);

View File

@@ -16,6 +16,7 @@
#include "components/net_log/chrome_net_log.h"
#include "content/public/common/content_switches.h"
#include "services/network/public/cpp/network_switches.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
ChromeBrowserProcessStub::ChromeBrowserProcessStub()
: initialized_(false),
@@ -116,6 +117,12 @@ ChromeBrowserProcessStub::network_connection_tracker() {
return NULL;
}
network::NetworkQualityTracker*
ChromeBrowserProcessStub::network_quality_tracker() {
NOTREACHED();
return NULL;
}
WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() {
NOTREACHED();
return NULL;
@@ -138,6 +145,12 @@ ChromeBrowserProcessStub::system_request_context() {
return NULL;
}
scoped_refptr<network::SharedURLLoaderFactory>
ChromeBrowserProcessStub::shared_url_loader_factory() {
NOTREACHED();
return NULL;
}
variations::VariationsService* ChromeBrowserProcessStub::variations_service() {
NOTREACHED();
return NULL;
@@ -258,7 +271,6 @@ StatusTray* ChromeBrowserProcessStub::status_tray() {
safe_browsing::SafeBrowsingService*
ChromeBrowserProcessStub::safe_browsing_service() {
NOTREACHED();
return NULL;
}
@@ -318,12 +330,10 @@ ChromeBrowserProcessStub::media_file_system_registry() {
return NULL;
}
#if BUILDFLAG(ENABLE_WEBRTC)
WebRtcLogUploader* ChromeBrowserProcessStub::webrtc_log_uploader() {
NOTREACHED();
return NULL;
}
#endif
network_time::NetworkTimeTracker*
ChromeBrowserProcessStub::network_time_tracker() {
@@ -347,12 +357,6 @@ resource_coordinator::TabManager* ChromeBrowserProcessStub::GetTabManager() {
return NULL;
}
physical_web::PhysicalWebDataSource*
ChromeBrowserProcessStub::GetPhysicalWebDataSource() {
NOTREACHED();
return NULL;
}
prefs::InProcessPrefServiceFactory*
ChromeBrowserProcessStub::pref_service_factory() const {
NOTREACHED();

View File

@@ -16,7 +16,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/event_router_forwarder.h"
#include "chrome/browser/profiles/incognito_helpers.h"
#include "media/media_features.h"
#include "media/media_buildflags.h"
class ChromeProfileManagerStub;
@@ -50,10 +50,13 @@ class ChromeBrowserProcessStub : public BrowserProcess,
IOThread* io_thread() override;
SystemNetworkContextManager* system_network_context_manager() override;
content::NetworkConnectionTracker* network_connection_tracker() override;
network::NetworkQualityTracker* network_quality_tracker() override;
WatchDogThread* watchdog_thread() override;
ProfileManager* profile_manager() override;
PrefService* local_state() override;
net::URLRequestContextGetter* system_request_context() override;
scoped_refptr<network::SharedURLLoaderFactory> shared_url_loader_factory()
override;
variations::VariationsService* variations_service() override;
BrowserProcessPlatformPart* platform_part() override;
extensions::EventRouterForwarder* extension_event_router_forwarder() override;
@@ -96,15 +99,12 @@ class ChromeBrowserProcessStub : public BrowserProcess,
component_updater::SupervisedUserWhitelistInstaller*
supervised_user_whitelist_installer() override;
MediaFileSystemRegistry* media_file_system_registry() override;
#if BUILDFLAG(ENABLE_WEBRTC)
WebRtcLogUploader* webrtc_log_uploader() override;
#endif
network_time::NetworkTimeTracker* network_time_tracker() override;
gcm::GCMDriver* gcm_driver() override;
shell_integration::DefaultWebClientState CachedDefaultWebClientState()
override;
resource_coordinator::TabManager* GetTabManager() override;
physical_web::PhysicalWebDataSource* GetPhysicalWebDataSource() override;
prefs::InProcessPrefServiceFactory* pref_service_factory() const override;
// BrowserContextIncognitoHelper implementation.

View File

@@ -75,11 +75,6 @@ ChromeProfileStub::GetRequestContextForExtensions() {
return GetRequestContext();
}
net::SSLConfigService* ChromeProfileStub::GetSSLConfigService() {
NOTREACHED();
return NULL;
}
bool ChromeProfileStub::IsSameProfile(Profile* profile) {
NOTREACHED();
return false;

View File

@@ -34,7 +34,6 @@ class ChromeProfileStub : public Profile {
ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override;
PrefService* GetOffTheRecordPrefs() override;
net::URLRequestContextGetter* GetRequestContextForExtensions() override;
net::SSLConfigService* GetSSLConfigService() override;
bool IsSameProfile(Profile* profile) override;
base::Time GetStartTime() const override;
base::FilePath last_selected_directory() override;

View File

@@ -41,6 +41,7 @@
#include "base/json/json_reader.h"
#include "base/path_service.h"
#include "cef/grit/cef_resources.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_service.h"
#include "chrome/browser/plugins/plugin_info_host_impl.h"
#include "chrome/browser/profiles/profile.h"
@@ -52,7 +53,7 @@
#include "chrome/services/printing/public/mojom/constants.mojom.h"
#include "components/navigation_interception/intercept_navigation_throttle.h"
#include "components/navigation_interception/navigation_params.h"
#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h"
#include "components/services/pdf_compositor/public/interfaces/pdf_compositor.mojom.h"
#include "content/browser/frame_host/navigation_handle_impl.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/plugin_service_impl.h"
@@ -75,18 +76,23 @@
#include "content/public/common/service_names.mojom.h"
#include "content/public/common/storage_quota_params.h"
#include "content/public/common/web_preferences.h"
#include "extensions/browser/api/web_request/web_request_api.h"
#include "extensions/browser/extension_message_filter.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/io_thread_extension_message_filter.h"
#include "extensions/common/constants.h"
#include "extensions/common/switches.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "ppapi/host/ppapi_host.h"
#include "services/service_manager/embedder/switches.h"
#include "services/service_manager/public/mojom/connector.mojom.h"
#include "services/service_manager/sandbox/switches.h"
#include "storage/browser/quota/quota_settings.h"
#include "third_party/WebKit/public/web/WebWindowFeatures.h"
#include "third_party/blink/public/web/web_window_features.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_switches.h"
@@ -333,7 +339,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
const std::string& process_type) {
base::FilePath dumps_path;
PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path);
base::PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path);
{
ANNOTATE_SCOPED_MEMORY_LEAK;
// Uploads will only occur if a non-empty crash URL is specified in
@@ -425,8 +431,14 @@ bool NavigationOnUIThread(
request->Set(params, is_main_frame);
request->SetReadOnly(true);
// Initiating a new navigation in OnBeforeBrowse will delete the
// InterceptNavigationThrottle that currently owns this callback,
// resulting in a crash. Use the lock to prevent that.
std::unique_ptr<CefBrowserHostImpl::NavigationLock> navigation_lock =
browser->CreateNavigationLock();
ignore_navigation = handler->OnBeforeBrowse(
browser.get(), frame, request.get(), params.is_redirect());
browser.get(), frame, request.get(), params.has_user_gesture(),
params.is_redirect());
}
}
}
@@ -593,7 +605,8 @@ void CefContentBrowserClient::SiteInstanceDeleting(
}
void CefContentBrowserClient::RegisterInProcessServices(
StaticServiceMap* services) {
StaticServiceMap* services,
content::ServiceManagerConnection* connection) {
{
// For spell checking.
service_manager::EmbeddedServiceInfo info;
@@ -605,11 +618,12 @@ void CefContentBrowserClient::RegisterInProcessServices(
void CefContentBrowserClient::RegisterOutOfProcessServices(
OutOfProcessServiceMap* services) {
(*services)[printing::mojom::kServiceName] =
base::ASCIIToUTF16("PDF Compositor Service");
base::BindRepeating(&base::ASCIIToUTF16, "PDF Compositor Service");
(*services)[printing::mojom::kChromePrintingServiceName] =
base::ASCIIToUTF16("Printing Service");
base::BindRepeating(&base::ASCIIToUTF16, "Printing Service");
(*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
base::BindRepeating(&l10n_util::GetStringUTF16,
IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
}
std::unique_ptr<base::Value> CefContentBrowserClient::GetServiceManifestOverlay(
@@ -716,7 +730,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
}
#if defined(OS_LINUX)
if (process_type == switches::kZygoteProcess) {
if (process_type == service_manager::switches::kZygoteProcess) {
// Propagate the following switches to the zygote command line (along with
// any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = {
@@ -726,9 +740,9 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
arraysize(kSwitchNames));
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
if (!browser_cmd->HasSwitch(switches::kNoSandbox)) {
if (!browser_cmd->HasSwitch(service_manager::switches::kNoSandbox)) {
// Pass the Widevine CDM path to the Zygote process. See comments in
// CefWidevineLoader::AddPepperPlugins.
// CefWidevineLoader::AddContentDecryptionModules.
const base::FilePath& cdm_path = CefWidevineLoader::GetInstance()->path();
if (!cdm_path.empty())
command_line->AppendSwitchPath(switches::kWidevineCdmPath, cdm_path);
@@ -758,6 +772,10 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
}
}
std::string CefContentBrowserClient::GetApplicationLocale() {
return g_browser_process->GetApplicationLocale();
}
content::QuotaPermissionContext*
CefContentBrowserClient::CreateQuotaPermissionContext() {
return new CefQuotaPermissionContext();
@@ -978,7 +996,7 @@ void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
content::PosixFileDescriptorInfo* mappings) {
int crash_signal_fd = GetCrashSignalFD(command_line);
if (crash_signal_fd >= 0) {
mappings->Share(kCrashDumpSignal, crash_signal_fd);
mappings->Share(service_manager::kCrashDumpSignal, crash_signal_fd);
}
}
#endif // defined(OS_LINUX)
@@ -990,7 +1008,7 @@ const wchar_t* CefContentBrowserClient::GetResourceDllName() {
if (file_path[0] == 0) {
// Retrieve the module path (usually libcef.dll).
base::FilePath module;
PathService::Get(base::FILE_MODULE, &module);
base::PathService::Get(base::FILE_MODULE, &module);
const std::wstring wstr = module.value();
size_t count = std::min(static_cast<size_t>(MAX_PATH), wstr.size());
wcsncpy(file_path, wstr.c_str(), count);
@@ -1024,6 +1042,66 @@ CefContentBrowserClient::CreateClientCertStore(
->CreateClientCertStore();
}
void CefContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
int frame_tree_node_id,
NonNetworkURLLoaderFactoryMap* factories) {
if (!extensions::ExtensionsEnabled())
return;
content::WebContents* web_contents =
content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
factories->emplace(
extensions::kExtensionScheme,
extensions::CreateExtensionNavigationURLLoaderFactory(
web_contents->GetBrowserContext(),
!!extensions::WebViewGuest::FromWebContents(web_contents)));
}
void CefContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id,
int render_frame_id,
NonNetworkURLLoaderFactoryMap* factories) {
if (!extensions::ExtensionsEnabled())
return;
auto factory = extensions::CreateExtensionURLLoaderFactory(render_process_id,
render_frame_id);
if (factory)
factories->emplace(extensions::kExtensionScheme, std::move(factory));
}
bool CefContentBrowserClient::WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
bool is_navigation,
network::mojom::URLLoaderFactoryRequest* factory_request) {
if (!extensions::ExtensionsEnabled())
return false;
auto* web_request_api =
extensions::BrowserContextKeyedAPIFactory<extensions::WebRequestAPI>::Get(
browser_context);
return web_request_api->MaybeProxyURLLoaderFactory(frame, is_navigation,
factory_request);
}
bool CefContentBrowserClient::HandleExternalProtocol(
const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
int child_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture) {
CEF_POST_TASK(
CEF_UIT,
base::Bind(
base::IgnoreResult(
&CefContentBrowserClient::HandleExternalProtocolOnUIThread),
url, web_contents_getter));
return false;
}
void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
// Register as a Web-safe scheme so that requests for the scheme from a
// render process will be allowed in resource_dispatcher_host_impl.cc
@@ -1067,3 +1145,18 @@ const extensions::Extension* CefContentBrowserClient::GetExtension(
return registry->enabled_extensions().GetExtensionOrAppByURL(
site_instance->GetSiteURL());
}
// static
void CefContentBrowserClient::HandleExternalProtocolOnUIThread(
const GURL& url,
const content::ResourceRequestInfo::WebContentsGetter&
web_contents_getter) {
CEF_REQUIRE_UIT();
content::WebContents* web_contents = web_contents_getter.Run();
if (web_contents) {
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForContents(web_contents);
if (browser.get())
browser->HandleExternalProtocol(url);
}
}

View File

@@ -51,7 +51,9 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
bool IsHandledURL(const GURL& url) override;
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
void RegisterInProcessServices(StaticServiceMap* services) override;
void RegisterInProcessServices(
StaticServiceMap* services,
content::ServiceManagerConnection* connection) override;
void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override;
std::unique_ptr<base::Value> GetServiceManifestOverlay(
base::StringPiece name) override;
@@ -60,6 +62,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
content::BrowserContext* context2) override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override;
std::string GetApplicationLocale() override;
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
void GetQuotaSettings(
content::BrowserContext* context,
@@ -127,6 +130,28 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
content::ResourceContext* resource_context) override;
void RegisterNonNetworkNavigationURLLoaderFactories(
int frame_tree_node_id,
NonNetworkURLLoaderFactoryMap* factories) override;
void RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id,
int render_frame_id,
NonNetworkURLLoaderFactoryMap* factories) override;
bool WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
bool is_navigation,
network::mojom::URLLoaderFactoryRequest* factory_request) override;
bool HandleExternalProtocol(
const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
int child_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture) override;
// Perform browser process registration for the custom scheme.
void RegisterCustomScheme(const std::string& scheme);
@@ -142,6 +167,11 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
const extensions::Extension* GetExtension(
content::SiteInstance* site_instance);
static void HandleExternalProtocolOnUIThread(
const GURL& url,
const content::ResourceRequestInfo::WebContentsGetter&
web_contents_getter);
CefBrowserMainParts* browser_main_parts_;
std::unique_ptr<content::PluginServiceFilter> plugin_service_filter_;

View File

@@ -7,7 +7,6 @@
#include "libcef/browser/browser_info.h"
#include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/browser_main.h"
#include "libcef/browser/browser_message_loop.h"
#include "libcef/browser/chrome_browser_process_stub.h"
#include "libcef/browser/thread_util.h"
#include "libcef/browser/trace_subscriber.h"
@@ -21,6 +20,7 @@
#include "base/command_line.h"
#include "base/debug/debugger.h"
#include "base/files/file_util.h"
#include "base/run_loop.h"
#include "base/synchronization/waitable_event.h"
#include "components/network_session_configurator/common/network_switches.h"
#include "content/app/content_service_manager_main_delegate.h"
@@ -29,6 +29,7 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_switches.h"
#include "services/service_manager/embedder/main.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_switches.h"
#if defined(OS_WIN)
@@ -271,7 +272,8 @@ void CefDoMessageLoopWork() {
return;
}
CefBrowserMessageLoop::current()->DoMessageLoopIteration();
base::RunLoop run_loop;
run_loop.RunUntilIdle();
}
void CefRunMessageLoop() {
@@ -287,7 +289,8 @@ void CefRunMessageLoop() {
return;
}
CefBrowserMessageLoop::current()->RunMessageLoop();
base::RunLoop run_loop;
run_loop.Run();
}
void CefQuitMessageLoop() {
@@ -341,7 +344,7 @@ bool CefContext::Initialize(const CefMainArgs& args,
init_thread_id_ = base::PlatformThread::CurrentId();
settings_ = settings;
#if !defined(OS_WIN)
#if !(defined(OS_WIN) || defined(OS_LINUX))
if (settings.multi_threaded_message_loop) {
NOTIMPLEMENTED() << "multi_threaded_message_loop is not supported.";
return false;
@@ -524,6 +527,8 @@ void CefContext::FinishShutdownOnUIThread(
static_cast<ChromeBrowserProcessStub*>(g_browser_process)->Shutdown();
ui::ResourceBundle::GetSharedInstance().CleanupOnUIThread();
if (uithread_shutdown_event)
uithread_shutdown_event->Signal();
}

View File

@@ -10,19 +10,18 @@
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h"
#include "libcef/browser/net/cookie_store_source.h"
#include "libcef/browser/net/network_delegate.h"
#include "libcef/common/task_runner_impl.h"
#include "libcef/common/time_util.h"
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/threading/thread_restrictions.h"
#include "content/browser/storage_partition_impl.h"
#include "net/cookies/cookie_util.h"
#include "net/cookies/parsed_cookie.h"
#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
#include "net/url_request/url_request_context.h"
#include "url/gurl.h"
@@ -162,7 +161,7 @@ void CefCookieManagerImpl::GetCookieStore(
return;
}
DCHECK(is_blocking_ || cookie_store_.get());
DCHECK(is_blocking_ || cookie_source_);
// Binding ref-counted |this| to CookieStoreGetter may result in
// heap-use-after-free if (a) the CookieStoreGetter contains the last
@@ -185,8 +184,8 @@ void CefCookieManagerImpl::GetCookieStore(
net::CookieStore* CefCookieManagerImpl::GetExistingCookieStore() {
CEF_REQUIRE_IOT();
if (cookie_store_.get()) {
return cookie_store_.get();
if (cookie_source_) {
return cookie_source_->GetCookieStore();
} else if (request_context_impl_.get()) {
net::CookieStore* cookie_store =
request_context_impl_->GetExistingCookieStore();
@@ -287,44 +286,13 @@ bool CefCookieManagerImpl::SetStoragePath(
if (!path.empty())
new_path = base::FilePath(path);
if (cookie_store_.get() &&
((storage_path_.empty() && path.empty()) || storage_path_ == new_path)) {
// The path has not changed so don't do anything.
RunAsyncCompletionOnIOThread(callback);
return true;
if (!cookie_source_) {
cookie_source_.reset(new CefCookieStoreOwnerSource());
}
scoped_refptr<net::SQLitePersistentCookieStore> persistent_store;
if (!new_path.empty()) {
// TODO(cef): Move directory creation to the blocking pool instead of
// allowing file IO on this thread.
base::ThreadRestrictions::ScopedAllowIO allow_io;
if (base::DirectoryExists(new_path) || base::CreateDirectory(new_path)) {
const base::FilePath& cookie_path = new_path.AppendASCII("Cookies");
persistent_store = new net::SQLitePersistentCookieStore(
cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
// Intentionally using the background task runner exposed by CEF to
// facilitate unit test expectations. This task runner MUST be
// configured with BLOCK_SHUTDOWN.
CefContentBrowserClient::Get()->background_task_runner(),
persist_session_cookies, NULL);
} else {
NOTREACHED() << "The cookie storage directory could not be created";
storage_path_.clear();
}
}
// Set the new cookie store that will be used for all new requests. The old
// cookie store, if any, will be automatically flushed and closed when no
// longer referenced.
cookie_store_.reset(new net::CookieMonster(persistent_store.get(), NULL));
if (persistent_store.get() && persist_session_cookies)
cookie_store_->SetPersistSessionCookies(true);
storage_path_ = new_path;
// Restore the previously supported schemes.
SetSupportedSchemesInternal(supported_schemes_, callback);
cookie_source_->SetCookieStoragePath(new_path, persist_session_cookies);
RunAsyncCompletionOnIOThread(callback);
return true;
}
@@ -502,10 +470,9 @@ void CefCookieManagerImpl::SetSupportedSchemesInternal(
return;
}
DCHECK(is_blocking_ || cookie_store_.get());
if (cookie_store_) {
supported_schemes_ = schemes;
SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_);
DCHECK(is_blocking_ || cookie_source_);
if (cookie_source_) {
cookie_source_->SetCookieSupportedSchemes(schemes);
}
RunAsyncCompletionOnIOThread(callback);
@@ -609,10 +576,10 @@ void CefCookieManagerImpl::DeleteCookiesInternal(
base::Bind(DeleteCookiesCallbackImpl, callback));
} else if (cookie_name.empty()) {
// Delete all matching host cookies.
cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
base::Time(), base::Time::Max(),
content::StoragePartitionImpl::CreatePredicateForHostCookies(url),
base::Bind(DeleteCookiesCallbackImpl, callback));
net::CookieDeletionInfo delete_info;
delete_info.host = url.host();
cookie_store->DeleteAllMatchingInfoAsync(
delete_info, base::Bind(DeleteCookiesCallbackImpl, callback));
} else {
// Delete all matching host and domain cookies.
cookie_store->DeleteCookieAsync(

View File

@@ -15,6 +15,8 @@
#include "base/memory/weak_ptr.h"
#include "net/cookies/cookie_monster.h"
class CefCookieStoreOwnerSource;
// Implementation of the CefCookieManager interface.
class CefCookieManagerImpl : public CefCookieManager {
public:
@@ -122,9 +124,7 @@ class CefCookieManagerImpl : public CefCookieManager {
scoped_refptr<CefURLRequestContextGetterImpl> request_context_impl_;
// Used for cookie monsters owned by this object.
base::FilePath storage_path_;
std::vector<std::string> supported_schemes_;
std::unique_ptr<net::CookieMonster> cookie_store_;
std::unique_ptr<CefCookieStoreOwnerSource> cookie_source_;
// Must be the last member.
base::WeakPtrFactory<CefCookieManagerImpl> weak_ptr_factory_;

View File

@@ -100,7 +100,7 @@ int ResponseWriter::Finish(int net_error,
}
static std::string GetFrontendURL() {
return base::StringPrintf("%s://%s/inspector.html",
return base::StringPrintf("%s://%s/devtools_app.html",
content::kChromeDevToolsScheme,
scheme::kChromeDevToolsHost);
}
@@ -299,9 +299,9 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
setting:
"It's not possible to disable this feature from settings."
chrome_policy {
DeveloperToolsDisabled {
DeveloperToolsAvailability {
policy_options {mode: MANDATORY}
DeveloperToolsDisabled: true
DeveloperToolsAvailability: 2
}
}
})");

View File

@@ -90,7 +90,7 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
}
if (suggested_path.empty()) {
if (PathService::Get(base::DIR_TEMP, &suggested_path)) {
if (base::PathService::Get(base::DIR_TEMP, &suggested_path)) {
// Use the temp directory.
suggested_path = suggested_path.Append(suggested_name);
} else {

View File

@@ -142,11 +142,11 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
return set_init_result(SUCCESS);
}
bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() {
bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage(std::string* error) {
CHECK_GE(execute_tab_id_, 0);
CefRefPtr<CefBrowserHostImpl> browser =
cef_details_.GetBrowserForTabIdAgain(execute_tab_id_, &error_);
cef_details_.GetBrowserForTabIdAgain(execute_tab_id_, error);
if (!browser)
return false;
@@ -156,7 +156,7 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() {
ExtensionApiFrameIdMap::GetRenderFrameHostById(browser->web_contents(),
frame_id);
if (!rfh) {
error_ = ErrorUtils::FormatErrorMessage(keys::kFrameNotFoundError,
*error = ErrorUtils::FormatErrorMessage(keys::kFrameNotFoundError,
base::IntToString(frame_id),
base::IntToString(execute_tab_id_));
return false;
@@ -180,12 +180,12 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() {
// NOTE: This can give the wrong answer due to race conditions, but it is OK,
// we check again in the renderer.
if (!extension()->permissions_data()->CanAccessPage(
extension(), effective_document_url, execute_tab_id_, &error_)) {
if (!extension()->permissions_data()->CanAccessPage(effective_document_url,
execute_tab_id_, error)) {
if (is_about_url &&
extension()->permissions_data()->active_permissions().HasAPIPermission(
APIPermission::kTab)) {
error_ = ErrorUtils::FormatErrorMessage(
*error = ErrorUtils::FormatErrorMessage(
manifest_errors::kCannotAccessAboutUrl,
rfh->GetLastCommittedURL().spec(),
rfh->GetLastCommittedOrigin().Serialize());
@@ -196,11 +196,12 @@ bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage() {
return true;
}
ScriptExecutor* ExecuteCodeInTabFunction::GetScriptExecutor() {
ScriptExecutor* ExecuteCodeInTabFunction::GetScriptExecutor(
std::string* error) {
CHECK_GE(execute_tab_id_, 0);
CefRefPtr<CefBrowserHostImpl> browser =
cef_details_.GetBrowserForTabIdAgain(execute_tab_id_, &error_);
cef_details_.GetBrowserForTabIdAgain(execute_tab_id_, error);
if (!browser)
return nullptr;
@@ -217,7 +218,8 @@ const GURL& ExecuteCodeInTabFunction::GetWebViewSrc() const {
return GURL::EmptyGURL();
}
bool ExecuteCodeInTabFunction::LoadFile(const std::string& file) {
bool ExecuteCodeInTabFunction::LoadFile(const std::string& file,
std::string* error) {
if (cef_details_.LoadFile(
file, base::BindOnce(&ExecuteCodeInTabFunction::LoadFileComplete,
this, file))) {
@@ -225,7 +227,7 @@ bool ExecuteCodeInTabFunction::LoadFile(const std::string& file) {
}
// Default handling.
return ExecuteCodeFunction::LoadFile(file);
return ExecuteCodeFunction::LoadFile(file, error);
}
void ExecuteCodeInTabFunction::LoadFileComplete(
@@ -239,15 +241,6 @@ bool TabsExecuteScriptFunction::ShouldInsertCSS() const {
return false;
}
void TabsExecuteScriptFunction::OnExecuteCodeFinished(
const std::string& error,
const GURL& on_url,
const base::ListValue& result) {
if (error.empty())
SetResult(result.CreateDeepCopy());
ExecuteCodeInTabFunction::OnExecuteCodeFinished(error, on_url, result);
}
bool TabsInsertCSSFunction::ShouldInsertCSS() const {
return true;
}
@@ -264,10 +257,31 @@ content::WebContents* ZoomAPIFunction::GetWebContents(int tab_id) {
return browser->web_contents();
}
void ZoomAPIFunction::SendResponse(bool success) {
ResponseValue response;
if (success) {
response = ArgumentList(std::move(results_));
} else {
response = results_ ? ErrorWithArguments(std::move(results_), error_)
: Error(error_);
}
Respond(std::move(response));
}
ExtensionFunction::ResponseAction ZoomAPIFunction::Run() {
if (RunAsync())
return RespondLater();
// TODO(devlin): Track these down and eliminate them if possible. We
// shouldn't return results and an error.
if (results_)
return RespondNow(ErrorWithArguments(std::move(results_), error_));
return RespondNow(Error(error_));
}
bool TabsSetZoomFunction::RunAsync() {
std::unique_ptr<tabs::SetZoom::Params> params(
tabs::SetZoom::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
EXTENSION_FUNCTION_PRERUN_VALIDATE(params);
int tab_id = params->tab_id ? *params->tab_id : -1;
content::WebContents* web_contents = GetWebContents(tab_id);
@@ -275,7 +289,7 @@ bool TabsSetZoomFunction::RunAsync() {
return false;
GURL url(web_contents->GetVisibleURL());
if (extensions::PermissionsData::IsRestrictedUrl(url, extension(), &error_))
if (extension()->permissions_data()->IsRestrictedUrl(url, &error_))
return false;
zoom::ZoomController* zoom_controller =
@@ -299,7 +313,7 @@ bool TabsSetZoomFunction::RunAsync() {
bool TabsGetZoomFunction::RunAsync() {
std::unique_ptr<tabs::GetZoom::Params> params(
tabs::GetZoom::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
EXTENSION_FUNCTION_PRERUN_VALIDATE(params);
int tab_id = params->tab_id ? *params->tab_id : -1;
content::WebContents* web_contents = GetWebContents(tab_id);
@@ -319,7 +333,7 @@ bool TabsSetZoomSettingsFunction::RunAsync() {
std::unique_ptr<tabs::SetZoomSettings::Params> params(
tabs::SetZoomSettings::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
EXTENSION_FUNCTION_PRERUN_VALIDATE(params);
int tab_id = params->tab_id ? *params->tab_id : -1;
content::WebContents* web_contents = GetWebContents(tab_id);
@@ -327,7 +341,7 @@ bool TabsSetZoomSettingsFunction::RunAsync() {
return false;
GURL url(web_contents->GetVisibleURL());
if (PermissionsData::IsRestrictedUrl(url, extension(), &error_))
if (extension()->permissions_data()->IsRestrictedUrl(url, &error_))
return false;
// "per-origin" scope is only available in "automatic" mode.
@@ -370,7 +384,7 @@ bool TabsSetZoomSettingsFunction::RunAsync() {
bool TabsGetZoomSettingsFunction::RunAsync() {
std::unique_ptr<tabs::GetZoomSettings::Params> params(
tabs::GetZoomSettings::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params);
EXTENSION_FUNCTION_PRERUN_VALIDATE(params);
int tab_id = params->tab_id ? *params->tab_id : -1;
content::WebContents* web_contents = GetWebContents(tab_id);

View File

@@ -55,11 +55,11 @@ class ExecuteCodeInTabFunction : public ExecuteCodeFunction {
// Initializes |execute_tab_id_| and |details_|.
InitResult Init() override;
bool CanExecuteScriptOnPage() override;
ScriptExecutor* GetScriptExecutor() override;
bool CanExecuteScriptOnPage(std::string* error) override;
ScriptExecutor* GetScriptExecutor(std::string* error) override;
bool IsWebView() const override;
const GURL& GetWebViewSrc() const override;
bool LoadFile(const std::string& file) override;
bool LoadFile(const std::string& file, std::string* error) override;
private:
const CefExtensionFunctionDetails cef_details_;
@@ -78,10 +78,6 @@ class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction {
private:
~TabsExecuteScriptFunction() override {}
void OnExecuteCodeFinished(const std::string& error,
const GURL& on_url,
const base::ListValue& script_result) override;
DECLARE_EXTENSION_FUNCTION("tabs.executeScript", TABS_EXECUTESCRIPT)
};
@@ -94,7 +90,8 @@ class TabsInsertCSSFunction : public ExecuteCodeInTabFunction {
DECLARE_EXTENSION_FUNCTION("tabs.insertCSS", TABS_INSERTCSS)
};
class ZoomAPIFunction : public AsyncExtensionFunction {
// Based on ChromeAsyncExtensionFunction.
class ZoomAPIFunction : public UIThreadExtensionFunction {
public:
ZoomAPIFunction();
@@ -103,10 +100,26 @@ class ZoomAPIFunction : public AsyncExtensionFunction {
// Gets the WebContents for |tab_id| if it is specified. Otherwise get the
// WebContents for the active tab in the current window. Calling this function
// may set error_.
// may set |error_|.
content::WebContents* GetWebContents(int tab_id);
virtual bool RunAsync() = 0;
// Responds with success/failure. |results_| or |error_| should be set
// accordingly.
void SendResponse(bool success);
// Exposed versions of ExtensionFunction::results_ and
// ExtensionFunction::error_ that are curried into the response.
// These need to keep the same name to avoid breaking existing
// implementations, but this should be temporary with crbug.com/648275
// and crbug.com/634140.
std::unique_ptr<base::ListValue> results_;
std::string error_;
private:
ResponseAction Run() final;
const CefExtensionFunctionDetails cef_details_;
};

View File

@@ -39,7 +39,7 @@ SkColor CefBrowserPlatformDelegateBackground::GetBackgroundColor() const {
return native_delegate_->GetBackgroundColor();
}
void CefBrowserPlatformDelegateBackground::WasResized() {
void CefBrowserPlatformDelegateBackground::SynchronizeVisualProperties() {
// Nothing to do here.
}

View File

@@ -22,7 +22,7 @@ class CefBrowserPlatformDelegateBackground
void CloseHostWindow() override;
CefWindowHandle GetHostWindowHandle() const override;
SkColor GetBackgroundColor() const override;
void WasResized() override;
void SynchronizeVisualProperties() override;
void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override;
void SendMouseEvent(const blink::WebMouseEvent& event) override;
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) override;

View File

@@ -3,13 +3,15 @@
// found in the LICENSE file.
// APIs must also be registered in
// libcef/common/extensions/api/_*_features.json files. See
// libcef/common/extensions/api/_*_features.json files and possibly
// CefExtensionsDispatcherDelegate::PopulateSourceMap. See
// libcef/common/extensions/api/README.txt for additional details.
#include "libcef/browser/extensions/chrome_api_registration.h"
#include "libcef/browser/extensions/api/tabs/tabs_api.h"
#include "chrome/browser/extensions/api/content_settings/content_settings_api.h"
#include "chrome/browser/extensions/api/resources_private/resources_private_api.h"
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
#include "extensions/browser/api/alarms/alarms_api.h"
@@ -37,6 +39,12 @@ const char* const kSupportedAPIs[] = {
EXTENSION_FUNCTION_NAME(AlarmsGetAllFunction),
EXTENSION_FUNCTION_NAME(AlarmsClearFunction),
EXTENSION_FUNCTION_NAME(AlarmsClearAllFunction),
"contentSettings",
EXTENSION_FUNCTION_NAME(ContentSettingsContentSettingClearFunction),
EXTENSION_FUNCTION_NAME(ContentSettingsContentSettingGetFunction),
EXTENSION_FUNCTION_NAME(ContentSettingsContentSettingSetFunction),
EXTENSION_FUNCTION_NAME(
ContentSettingsContentSettingGetResourceIdentifiersFunction),
"storage",
EXTENSION_FUNCTION_NAME(StorageStorageAreaGetFunction),
EXTENSION_FUNCTION_NAME(StorageStorageAreaSetFunction),
@@ -75,6 +83,11 @@ void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
registry->RegisterFunction<AlarmsGetAllFunction>();
registry->RegisterFunction<AlarmsClearFunction>();
registry->RegisterFunction<AlarmsClearAllFunction>();
registry->RegisterFunction<ContentSettingsContentSettingClearFunction>();
registry->RegisterFunction<ContentSettingsContentSettingGetFunction>();
registry->RegisterFunction<ContentSettingsContentSettingSetFunction>();
registry->RegisterFunction<
ContentSettingsContentSettingGetResourceIdentifiersFunction>();
registry->RegisterFunction<StorageStorageAreaGetFunction>();
registry->RegisterFunction<StorageStorageAreaSetFunction>();
registry->RegisterFunction<StorageStorageAreaRemoveFunction>();

View File

@@ -25,7 +25,7 @@ bool CefComponentExtensionResourceManager::IsComponentExtensionResource(
base::FilePath directory_path = extension_path;
base::FilePath resources_dir;
base::FilePath relative_path;
if (!PathService::Get(chrome::DIR_RESOURCES, &resources_dir) ||
if (!base::PathService::Get(chrome::DIR_RESOURCES, &resources_dir) ||
!resources_dir.AppendRelativePath(directory_path, &relative_path)) {
return false;
}

View File

@@ -160,8 +160,9 @@ CefRefPtr<CefBrowserHostImpl> CefExtensionFunctionDetails::GetCurrentBrowser()
CefRefPtr<CefExtensionHandler> handler = GetCefExtension()->GetHandler();
if (handler) {
// Give the handler an opportunity to specify a different browser.
CefRefPtr<CefBrowser> active_browser = handler->GetActiveBrowser(
GetCefExtension(), browser.get(), function_->include_incognito());
CefRefPtr<CefBrowser> active_browser =
handler->GetActiveBrowser(GetCefExtension(), browser.get(),
function_->include_incognito_information());
if (active_browser && active_browser != browser) {
CefRefPtr<CefBrowserHostImpl> active_browser_impl =
static_cast<CefBrowserHostImpl*>(active_browser.get());
@@ -200,8 +201,9 @@ bool CefExtensionFunctionDetails::CanAccessBrowser(
if (browser && browser->client()) {
CefRefPtr<CefExtensionHandler> handler = GetCefExtension()->GetHandler();
if (handler) {
return handler->CanAccessBrowser(GetCefExtension(), browser.get(),
function_->include_incognito(), target);
return handler->CanAccessBrowser(
GetCefExtension(), browser.get(),
function_->include_incognito_information(), target);
}
}
@@ -425,7 +427,7 @@ std::unique_ptr<api::tabs::Tab> CefExtensionFunctionDetails::CreateTabObject(
tab_object->selected = true;
tab_object->highlighted = true;
tab_object->pinned = false;
tab_object->audible = std::make_unique<bool>(contents->WasRecentlyAudible());
// TODO(extensions): Use RecentlyAudibleHelper to populate |audible|.
tab_object->discarded = false;
tab_object->auto_discardable = false;
tab_object->muted_info = CreateMutedInfo(contents);

View File

@@ -7,6 +7,7 @@
#include "libcef/browser/extensions/extensions_browser_client.h"
#include "base/logging.h"
#include "content/public/browser/web_contents.h"
namespace extensions {
@@ -28,11 +29,12 @@ CefExtensionHostDelegate::GetJavaScriptDialogManager() {
return NULL;
}
void CefExtensionHostDelegate::CreateTab(content::WebContents* web_contents,
const std::string& extension_id,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture) {
void CefExtensionHostDelegate::CreateTab(
std::unique_ptr<content::WebContents> web_contents,
const std::string& extension_id,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture) {
// TODO(cef): Add support for extensions opening popup windows.
NOTIMPLEMENTED();
}
@@ -40,14 +42,14 @@ void CefExtensionHostDelegate::CreateTab(content::WebContents* web_contents,
void CefExtensionHostDelegate::ProcessMediaAccessRequest(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback,
content::MediaResponseCallback callback,
const Extension* extension) {
// Never routed here from CefBrowserHostImpl.
NOTREACHED();
}
bool CefExtensionHostDelegate::CheckMediaAccessPermission(
content::WebContents* web_contents,
content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
content::MediaStreamType type,
const Extension* extension) {

View File

@@ -21,16 +21,16 @@ class CefExtensionHostDelegate : public ExtensionHostDelegate {
void OnExtensionHostCreated(content::WebContents* web_contents) override;
void OnRenderViewCreatedForBackgroundPage(ExtensionHost* host) override;
content::JavaScriptDialogManager* GetJavaScriptDialogManager() override;
void CreateTab(content::WebContents* web_contents,
void CreateTab(std::unique_ptr<content::WebContents> web_contents,
const std::string& extension_id,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture) override;
void ProcessMediaAccessRequest(content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback,
content::MediaResponseCallback callback,
const Extension* extension) override;
bool CheckMediaAccessPermission(content::WebContents* web_contents,
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
content::MediaStreamType type,
const Extension* extension) override;

View File

@@ -456,6 +456,7 @@ void CefExtensionSystem::InstallUpdate(
const std::string& extension_id,
const std::string& public_key,
const base::FilePath& temp_dir,
bool install_immediately,
InstallUpdateCallback install_update_callback) {
NOTREACHED();
base::DeleteFile(temp_dir, true /* recursive */);
@@ -476,7 +477,7 @@ CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo(
if (!root_directory.IsAbsolute()) {
// This path structure is required by
// url_request_util::MaybeCreateURLRequestResourceBundleJob.
CHECK(PathService::Get(chrome::DIR_RESOURCES, &root_directory));
CHECK(base::PathService::Get(chrome::DIR_RESOURCES, &root_directory));
root_directory = root_directory.Append(directory);
}
}

View File

@@ -114,6 +114,7 @@ class CefExtensionSystem : public ExtensionSystem {
void InstallUpdate(const std::string& extension_id,
const std::string& public_key,
const base::FilePath& temp_dir,
bool install_immediately,
InstallUpdateCallback install_update_callback) override;
bool FinishDelayedInstallationIfReady(const std::string& extension_id,
bool install_immediately) override;

View File

@@ -12,7 +12,7 @@
#include "extensions/browser/extension_system.h"
#include "extensions/browser/notification_types.h"
#include "extensions/browser/runtime_data.h"
#include "third_party/WebKit/public/platform/WebGestureEvent.h"
#include "third_party/blink/public/platform/web_gesture_event.h"
using content::NativeWebKeyboardEvent;
using content::OpenURLParams;

View File

@@ -21,6 +21,16 @@ CefExtensionWebContentsObserver::CefExtensionWebContentsObserver(
CefExtensionWebContentsObserver::~CefExtensionWebContentsObserver() {}
// static
void CefExtensionWebContentsObserver::CreateForWebContents(
content::WebContents* web_contents) {
content::WebContentsUserData<
CefExtensionWebContentsObserver>::CreateForWebContents(web_contents);
// Initialize this instance if necessary.
FromWebContents(web_contents)->Initialize();
}
void CefExtensionWebContentsObserver::RenderFrameCreated(
content::RenderFrameHost* render_frame_host) {
ExtensionWebContentsObserver::RenderFrameCreated(render_frame_host);
@@ -36,7 +46,7 @@ void CefExtensionWebContentsObserver::RenderFrameCreated(
// are allowed to use chrome://resources/ URLs.
if ((extension->is_extension() || extension->is_platform_app()) &&
Manifest::IsComponentLocation(extension->location())) {
policy->GrantOrigin(
policy->GrantRequestOrigin(
process_id, url::Origin::Create(GURL(content::kChromeUIResourcesURL)));
}
}

View File

@@ -22,6 +22,10 @@ class CefExtensionWebContentsObserver
public:
~CefExtensionWebContentsObserver() override;
// Creates and initializes an instance of this class for the given
// |web_contents|, if it doesn't already exist.
static void CreateForWebContents(content::WebContents* web_contents);
ScriptExecutor* script_executor() { return script_executor_.get(); }
private:

View File

@@ -254,6 +254,10 @@ bool CefExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) {
void CefExtensionsBrowserClient::PermitExternalProtocolHandler() {}
bool CefExtensionsBrowserClient::IsInDemoMode() {
return false;
}
bool CefExtensionsBrowserClient::IsRunningInForcedAppMode() {
return false;
}

View File

@@ -84,6 +84,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
ExtensionHost** host) override;
bool DidVersionUpdate(content::BrowserContext* context) override;
void PermitExternalProtocolHandler() override;
bool IsInDemoMode() override;
bool IsRunningInForcedAppMode() override;
bool IsAppModeForcedForApp(const ExtensionId& extension_id) override;
bool IsLoggedInAsPublicAccount() override;

View File

@@ -20,10 +20,10 @@ SkColor CefBrowserPlatformDelegateNative::GetBackgroundColor() const {
return background_color_;
}
void CefBrowserPlatformDelegateNative::WasResized() {
void CefBrowserPlatformDelegateNative::SynchronizeVisualProperties() {
content::RenderViewHost* host = browser_->web_contents()->GetRenderViewHost();
if (host)
host->GetWidget()->WasResized();
host->GetWidget()->SynchronizeVisualProperties();
}
void CefBrowserPlatformDelegateNative::SendKeyEvent(

View File

@@ -26,7 +26,7 @@ class CefBrowserPlatformDelegateNative : public CefBrowserPlatformDelegate {
// CefBrowserPlatformDelegate methods:
SkColor GetBackgroundColor() const override;
void WasResized() override;
void SynchronizeVisualProperties() override;
void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override;
void SendMouseEvent(const blink::WebMouseEvent& event) override;
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) override;

View File

@@ -383,7 +383,8 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMouseEvent(
TranslateModifiers(mouse_event.modifiers));
// timestamp
result.SetTimeStampSeconds(GetSystemUptime());
result.SetTimeStamp(base::TimeTicks() +
base::TimeDelta::FromSeconds(GetSystemUptime()));
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
}

View File

@@ -20,9 +20,9 @@
#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 "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/WebKit/public/platform/WebMouseEvent.h"
#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "third_party/blink/public/platform/web_mouse_event.h"
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
#import "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
#include "ui/events/keycodes/keyboard_codes_posix.h"
@@ -99,6 +99,7 @@
}
- (void)cleanup:(id)window {
[window_ setDelegate:nil];
[self release];
}
@@ -468,7 +469,8 @@ void CefBrowserPlatformDelegateNativeMac::TranslateMouseEvent(
TranslateModifiers(mouse_event.modifiers));
// timestamp - Mac OSX specific
result.SetTimeStampSeconds(currentEventTimestamp());
result.SetTimeStamp(base::TimeTicks() +
base::TimeDelta::FromSeconds(currentEventTimestamp()));
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
}

View File

@@ -22,8 +22,8 @@
#include "base/win/registry.h"
#include "base/win/win_util.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "third_party/WebKit/public/platform/WebMouseEvent.h"
#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h"
#include "third_party/blink/public/platform/web_mouse_event.h"
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
#include "ui/aura/window.h"
#include "ui/base/win/shell.h"
#include "ui/display/display.h"
@@ -557,7 +557,8 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMouseEvent(
TranslateModifiers(mouse_event.modifiers));
// timestamp
result.SetTimeStampSeconds(GetMessageTime() / 1000.0);
result.SetTimeStamp(base::TimeTicks() +
base::TimeDelta::FromMilliseconds(GetMessageTime()));
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
}

View File

@@ -121,7 +121,7 @@ void CefJavaScriptDialogRunnerWin::Run(
HMODULE hModule = NULL;
// Try to load the dialog from the DLL.
if (PathService::Get(base::DIR_MODULE, &file_path)) {
if (base::PathService::Get(base::DIR_MODULE, &file_path)) {
file_path = file_path.Append(L"libcef.dll");
hModule = ::GetModuleHandle(file_path.value().c_str());
}

View File

@@ -9,6 +9,7 @@
#include "base/compiler_specific.h"
#import "base/mac/scoped_sending_event.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
#import "ui/base/cocoa/menu_controller.h"
#include "ui/gfx/geometry/point.h"
@@ -33,8 +34,7 @@ bool CefMenuRunnerMac::RunContextMenu(
menu_controller_);
// Make sure events can be pumped while the menu is up.
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
// One of the events that could be pumped is |window.close()|.
// User-initiated event-tracking loops protect against this by

View File

@@ -8,6 +8,7 @@
#include "libcef/browser/native/menu_2.h"
#include "base/message_loop/message_loop.h"
#include "base/message_loop/message_loop_current.h"
#include "ui/gfx/geometry/point.h"
CefMenuRunnerWin::CefMenuRunnerWin() {}
@@ -21,8 +22,7 @@ bool CefMenuRunnerWin::RunContextMenu(
menu_->Rebuild(NULL);
// Make sure events can be pumped while the menu is up.
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
const gfx::Point& screen_point =
browser->GetScreenPoint(gfx::Point(params.x, params.y));

View File

@@ -26,7 +26,7 @@ const char kNetWMPing[] = "_NET_WM_PING";
const char kNetWMState[] = "_NET_WM_STATE";
const char kXdndProxy[] = "XdndProxy";
::Window FindEventTarget(const base::NativeEvent& xev) {
::Window FindEventTarget(const ui::PlatformEvent& xev) {
::Window target = xev->xany.window;
if (xev->type == GenericEvent)
target = static_cast<XIDeviceEvent*>(xev->xcookie.data)->event;
@@ -104,6 +104,7 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
InputOutput,
CopyFromParent, // visual
CWBackPixmap | CWOverrideRedirect, &swa);
CHECK(xwindow_);
if (ui::PlatformEventSource::GetInstance())
ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);

View File

@@ -36,6 +36,7 @@
#include "content/browser/frame_host/debug_urls.h"
#include "content/browser/webui/content_web_ui_controller_factory.h"
#include "content/public/browser/browser_url_handler.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/url_utils.h"
#include "content/public/common/user_agent.h"
@@ -211,24 +212,20 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
return false;
}
content::WebUIController* CreateWebUIControllerForURL(
std::unique_ptr<content::WebUIController> CreateWebUIControllerForURL(
content::WebUI* web_ui,
const GURL& url) const override {
content::WebUIController* controller = nullptr;
std::unique_ptr<content::WebUIController> controller;
if (!AllowWebUIForURL(url))
return controller;
controller = content::ContentWebUIControllerFactory::GetInstance()
->CreateWebUIControllerForURL(web_ui, url);
if (controller != nullptr)
if (controller.get())
return controller;
controller = ChromeWebUIControllerFactory::GetInstance()
->CreateWebUIControllerForURL(web_ui, url);
if (controller != nullptr)
return controller;
return nullptr;
return ChromeWebUIControllerFactory::GetInstance()
->CreateWebUIControllerForURL(web_ui, url);
}
content::WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context,
@@ -437,7 +434,7 @@ std::string GetCommandLine() {
std::string GetModulePath() {
base::FilePath path;
if (PathService::Get(base::FILE_MODULE, &path))
if (base::PathService::Get(base::FILE_MODULE, &path))
return CefString(path.value());
return std::string();
}

View File

@@ -4,12 +4,12 @@
#include "libcef/browser/net/cookie_store_proxy.h"
#include "libcef/browser/cookie_manager_impl.h"
#include "libcef/browser/net/url_request_context_impl.h"
#include "include/cef_request_context.h"
#include "libcef/browser/net/cookie_store_source.h"
#include "libcef/browser/thread_util.h"
#include "base/logging.h"
#include "net/url_request/url_request_context.h"
#include "net/cookies/cookie_change_dispatcher.h"
namespace {
@@ -22,12 +22,18 @@ class NullCookieChangeDispatcher : public net::CookieChangeDispatcher {
std::unique_ptr<net::CookieChangeSubscription> AddCallbackForCookie(
const GURL& url,
const std::string& name,
net::CookieChangeCallback callback) override WARN_UNUSED_RESULT {
net::CookieChangeCallback callback) override {
return nullptr;
}
std::unique_ptr<net::CookieChangeSubscription> AddCallbackForUrl(
const GURL& url,
net::CookieChangeCallback callback) override {
return nullptr;
}
std::unique_ptr<net::CookieChangeSubscription> AddCallbackForAllChanges(
net::CookieChangeCallback callback) override WARN_UNUSED_RESULT {
net::CookieChangeCallback callback) override {
return nullptr;
}
@@ -38,12 +44,10 @@ class NullCookieChangeDispatcher : public net::CookieChangeDispatcher {
} // namespace
CefCookieStoreProxy::CefCookieStoreProxy(
CefURLRequestContextImpl* parent,
CefRefPtr<CefRequestContextHandler> handler)
: parent_(parent), handler_(handler) {
std::unique_ptr<CefCookieStoreSource> source)
: source_(std::move(source)) {
CEF_REQUIRE_IOT();
DCHECK(parent_);
DCHECK(handler_.get());
DCHECK(source_);
}
CefCookieStoreProxy::~CefCookieStoreProxy() {
@@ -123,28 +127,24 @@ void CefCookieStoreProxy::DeleteCanonicalCookieAsync(
}
}
void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync(
const base::Time& delete_begin,
const base::Time& delete_end,
void CefCookieStoreProxy::DeleteAllCreatedInTimeRangeAsync(
const net::CookieDeletionInfo::TimeRange& creation_range,
DeleteCallback callback) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) {
cookie_store->DeleteAllCreatedBetweenAsync(delete_begin, delete_end,
std::move(callback));
cookie_store->DeleteAllCreatedInTimeRangeAsync(creation_range,
std::move(callback));
} else if (!callback.is_null()) {
std::move(callback).Run(0);
}
}
void CefCookieStoreProxy::DeleteAllCreatedBetweenWithPredicateAsync(
const base::Time& delete_begin,
const base::Time& delete_end,
const CookiePredicate& predicate,
void CefCookieStoreProxy::DeleteAllMatchingInfoAsync(
net::CookieDeletionInfo delete_info,
DeleteCallback callback) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) {
cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
delete_begin, delete_end, predicate, std::move(callback));
cookie_store->DeleteAllMatchingInfoAsync(delete_info, std::move(callback));
} else if (!callback.is_null()) {
std::move(callback).Run(0);
}
@@ -187,24 +187,5 @@ bool CefCookieStoreProxy::IsEphemeral() {
net::CookieStore* CefCookieStoreProxy::GetCookieStore() {
CEF_REQUIRE_IOT();
CefRefPtr<CefCookieManager> manager = handler_->GetCookieManager();
if (manager.get()) {
// Use the cookie store provided by the manager. May be nullptr if the
// cookie manager is blocking.
return reinterpret_cast<CefCookieManagerImpl*>(manager.get())
->GetExistingCookieStore();
}
DCHECK(parent_);
if (parent_) {
// Use the cookie store from the parent.
net::CookieStore* cookie_store = parent_->cookie_store();
DCHECK(cookie_store);
if (!cookie_store)
LOG(ERROR) << "Cookie store does not exist";
return cookie_store;
}
return nullptr;
return source_->GetCookieStore();
}

View File

@@ -6,19 +6,15 @@
#define CEF_LIBCEF_BROWSER_COOKIE_STORE_PROXY_H_
#pragma once
#include "include/cef_request_context_handler.h"
#include "net/cookies/cookie_store.h"
class CefURLRequestContextImpl;
class CefCookieStoreSource;
// Proxies cookie requests to the CefRequestContextHandler or global cookie
// store. Life span is controlled by CefURLRequestContextProxy. Only accessed on
// the IO thread. See browser_context.h for an object relationship diagram.
// Proxies cookie requests to a CefCookieStoreSource (see comments on the
// implementation classes for details). Only accessed on the IO thread.
class CefCookieStoreProxy : public net::CookieStore {
public:
CefCookieStoreProxy(CefURLRequestContextImpl* parent,
CefRefPtr<CefRequestContextHandler> handler);
explicit CefCookieStoreProxy(std::unique_ptr<CefCookieStoreSource> source);
~CefCookieStoreProxy() override;
// net::CookieStore methods.
@@ -39,14 +35,11 @@ class CefCookieStoreProxy : public net::CookieStore {
base::OnceClosure callback) override;
void DeleteCanonicalCookieAsync(const net::CanonicalCookie& cookie,
DeleteCallback callback) override;
void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin,
const base::Time& delete_end,
DeleteCallback callback) override;
void DeleteAllCreatedBetweenWithPredicateAsync(
const base::Time& delete_begin,
const base::Time& delete_end,
const CookiePredicate& predicate,
void DeleteAllCreatedInTimeRangeAsync(
const net::CookieDeletionInfo::TimeRange& creation_range,
DeleteCallback callback) override;
void DeleteAllMatchingInfoAsync(net::CookieDeletionInfo delete_info,
DeleteCallback callback) override;
void DeleteSessionCookiesAsync(DeleteCallback callback) override;
void FlushStore(base::OnceClosure callback) override;
net::CookieChangeDispatcher& GetChangeDispatcher() override;
@@ -55,11 +48,7 @@ class CefCookieStoreProxy : public net::CookieStore {
private:
net::CookieStore* GetCookieStore();
// The |parent_| pointer is kept alive by CefURLRequestContextGetterProxy
// which has a ref to the owning CefURLRequestContextGetterImpl.
CefURLRequestContextImpl* parent_;
CefRefPtr<CefRequestContextHandler> handler_;
std::unique_ptr<CefCookieStoreSource> const source_;
std::unique_ptr<net::CookieChangeDispatcher> null_dispatcher_;
DISALLOW_COPY_AND_ASSIGN(CefCookieStoreProxy);

View File

@@ -0,0 +1,110 @@
// Copyright (c) 2018 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file.
#include "libcef/browser/net/cookie_store_source.h"
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/cookie_manager_impl.h"
#include "libcef/browser/net/url_request_context_impl.h"
#include "libcef/browser/thread_util.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
CefCookieStoreHandlerSource::CefCookieStoreHandlerSource(
CefURLRequestContextImpl* parent,
CefRefPtr<CefRequestContextHandler> handler)
: parent_(parent), handler_(handler) {
DCHECK(parent_);
DCHECK(handler_);
}
net::CookieStore* CefCookieStoreHandlerSource::GetCookieStore() {
CEF_REQUIRE_IOT();
CefRefPtr<CefCookieManager> manager = handler_->GetCookieManager();
if (manager) {
// Use the cookie store provided by the manager. May be nullptr if the
// cookie manager is blocking.
return reinterpret_cast<CefCookieManagerImpl*>(manager.get())
->GetExistingCookieStore();
}
DCHECK(parent_);
if (parent_) {
// Use the cookie store from the parent.
net::CookieStore* cookie_store = parent_->cookie_store();
DCHECK(cookie_store);
if (!cookie_store)
LOG(ERROR) << "Cookie store does not exist";
return cookie_store;
}
return nullptr;
}
CefCookieStoreOwnerSource::CefCookieStoreOwnerSource() {}
void CefCookieStoreOwnerSource::SetCookieStoragePath(
const base::FilePath& path,
bool persist_session_cookies) {
CEF_REQUIRE_IOT();
if (cookie_store_ && ((path_.empty() && path.empty()) || path_ == path)) {
// The path has not changed so don't do anything.
return;
}
scoped_refptr<net::SQLitePersistentCookieStore> persistent_store;
if (!path.empty()) {
// TODO(cef): Move directory creation to the blocking pool instead of
// allowing file IO on this thread.
base::ThreadRestrictions::ScopedAllowIO allow_io;
if (base::DirectoryExists(path) || base::CreateDirectory(path)) {
const base::FilePath& cookie_path = path.AppendASCII("Cookies");
persistent_store = new net::SQLitePersistentCookieStore(
cookie_path,
content::BrowserThread::GetTaskRunnerForThread(
content::BrowserThread::IO),
// Intentionally using the background task runner exposed by CEF to
// facilitate unit test expectations. This task runner MUST be
// configured with BLOCK_SHUTDOWN.
CefContentBrowserClient::Get()->background_task_runner(),
persist_session_cookies, NULL);
} else {
NOTREACHED() << "The cookie storage directory could not be created";
}
}
// Set the new cookie store that will be used for all new requests. The old
// cookie store, if any, will be automatically flushed and closed when no
// longer referenced.
std::unique_ptr<net::CookieMonster> cookie_monster(
new net::CookieMonster(persistent_store.get(), nullptr));
if (persistent_store.get() && persist_session_cookies)
cookie_monster->SetPersistSessionCookies(true);
path_ = path;
// Restore the previously supported schemes.
CefCookieManagerImpl::SetCookieMonsterSchemes(cookie_monster.get(),
supported_schemes_);
cookie_store_ = std::move(cookie_monster);
}
void CefCookieStoreOwnerSource::SetCookieSupportedSchemes(
const std::vector<std::string>& schemes) {
CEF_REQUIRE_IOT();
supported_schemes_ = schemes;
CefCookieManagerImpl::SetCookieMonsterSchemes(
static_cast<net::CookieMonster*>(cookie_store_.get()),
supported_schemes_);
}
net::CookieStore* CefCookieStoreOwnerSource::GetCookieStore() {
CEF_REQUIRE_IOT();
return cookie_store_.get();
}

View File

@@ -0,0 +1,73 @@
// Copyright (c) 2018 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that can
// be found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_COOKIE_STORE_SOURCE_H_
#define CEF_LIBCEF_BROWSER_COOKIE_STORE_SOURCE_H_
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "include/cef_request_context_handler.h"
#include "base/macros.h"
namespace base {
class FilePath;
}
namespace net {
class CookieStore;
}
class CefURLRequestContextImpl;
// Abstract base class for CookieStore sources. Only accessed on the IO thread.
class CefCookieStoreSource {
public:
virtual net::CookieStore* GetCookieStore() = 0;
virtual ~CefCookieStoreSource() {}
};
// Sources a cookie store that is created/owned by a CefCookieManager or the
// parent context. Life span is controlled by CefURLRequestContextProxy. See
// browser_context.h for an object relationship diagram.
class CefCookieStoreHandlerSource : public CefCookieStoreSource {
public:
CefCookieStoreHandlerSource(CefURLRequestContextImpl* parent,
CefRefPtr<CefRequestContextHandler> handler);
net::CookieStore* GetCookieStore() override;
private:
// The |parent_| pointer is kept alive by CefURLRequestContextGetterProxy
// which has a ref to the owning CefURLRequestContextGetterImpl.
CefURLRequestContextImpl* parent_;
CefRefPtr<CefRequestContextHandler> handler_;
DISALLOW_COPY_AND_ASSIGN(CefCookieStoreHandlerSource);
};
// Sources a cookie store that is created/owned by this object. Life span is
// controlled by the owning URLRequestContext.
class CefCookieStoreOwnerSource : public CefCookieStoreSource {
public:
CefCookieStoreOwnerSource();
void SetCookieStoragePath(const base::FilePath& path,
bool persist_session_cookies);
void SetCookieSupportedSchemes(const std::vector<std::string>& schemes);
net::CookieStore* GetCookieStore() override;
private:
std::unique_ptr<net::CookieStore> cookie_store_;
base::FilePath path_;
std::vector<std::string> supported_schemes_;
DISALLOW_COPY_AND_ASSIGN(CefCookieStoreOwnerSource);
};
#endif // CEF_LIBCEF_BROWSER_COOKIE_STORE_SOURCE_H_

View File

@@ -32,18 +32,18 @@ namespace {
class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
public:
typedef net::CompletionCallback CallbackType;
typedef net::CompletionOnceCallback CallbackType;
CefBeforeResourceLoadCallbackImpl(CefRefPtr<CefRequestImpl> cef_request,
GURL* new_url,
net::URLRequest* url_request,
bool force_google_safesearch,
const CallbackType& callback)
CallbackType callback)
: cef_request_(cef_request),
new_url_(new_url),
url_request_(url_request),
force_google_safesearch_(force_google_safesearch),
callback_(callback) {
callback_(std::move(callback)) {
DCHECK(new_url);
DCHECK(url_request_);
@@ -56,13 +56,14 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
if (!callback_.is_null()) {
// The callback is still pending. Cancel it now.
if (CEF_CURRENTLY_ON_IOT()) {
RunNow(cef_request_, new_url_, url_request_, callback_,
RunNow(cef_request_, new_url_, url_request_, std::move(callback_),
force_google_safesearch_, false);
} else {
CEF_POST_TASK(
CEF_IOT, base::Bind(&CefBeforeResourceLoadCallbackImpl::RunNow,
cef_request_, new_url_, url_request_, callback_,
force_google_safesearch_, false));
CEF_POST_TASK(CEF_IOT,
base::Bind(&CefBeforeResourceLoadCallbackImpl::RunNow,
cef_request_, new_url_, url_request_,
base::Passed(std::move(callback_)),
force_google_safesearch_, false));
}
}
}
@@ -79,12 +80,13 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
void ContinueNow(bool allow) {
CEF_REQUIRE_IOT();
if (!callback_.is_null()) {
RunNow(cef_request_, new_url_, url_request_, callback_,
RunNow(cef_request_, new_url_, url_request_, std::move(callback_),
force_google_safesearch_, allow);
Disconnect();
}
}
private:
void Disconnect() {
CEF_REQUIRE_IOT();
cef_request_ = nullptr;
@@ -93,7 +95,6 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
callback_.Reset();
}
private:
// Used to disconnect the callback when the associated URLRequest is
// destroyed.
class Disconnector : public base::SupportsUserData::Data {
@@ -114,7 +115,7 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
static void RunNow(CefRefPtr<CefRequestImpl> cef_request,
GURL* new_url,
net::URLRequest* request,
const CallbackType& callback,
CallbackType callback,
bool force_google_safesearch,
bool allow) {
CEF_REQUIRE_IOT();
@@ -144,7 +145,7 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
if (force_google_safesearch && allow && new_url->is_empty())
safe_search_util::ForceGoogleSafeSearch(request, new_url);
callback.Run(allow ? net::OK : net::ERR_ABORTED);
std::move(callback).Run(allow ? net::OK : net::ERR_ABORTED);
}
}
@@ -168,17 +169,18 @@ int CefBeforeResourceLoadCallbackImpl::kLocatorKey = 0;
class CefAuthCallbackImpl : public CefAuthCallback {
public:
CefAuthCallbackImpl(const net::NetworkDelegate::AuthCallback& callback,
net::AuthCredentials* credentials)
: callback_(callback), credentials_(credentials) {}
typedef net::NetworkDelegate::AuthCallback CallbackType;
CefAuthCallbackImpl(CallbackType callback, net::AuthCredentials* credentials)
: callback_(std::move(callback)), credentials_(credentials) {}
~CefAuthCallbackImpl() override {
if (!callback_.is_null()) {
// The auth callback is still pending. Cancel it now.
if (CEF_CURRENTLY_ON_IOT()) {
CancelNow(callback_);
CancelNow(std::move(callback_));
} else {
CEF_POST_TASK(CEF_IOT,
base::Bind(&CefAuthCallbackImpl::CancelNow, callback_));
CEF_POST_TASK(CEF_IOT, base::Bind(&CefAuthCallbackImpl::CancelNow,
base::Passed(std::move(callback_))));
}
}
}
@@ -187,8 +189,8 @@ class CefAuthCallbackImpl : public CefAuthCallback {
if (CEF_CURRENTLY_ON_IOT()) {
if (!callback_.is_null()) {
credentials_->Set(username, password);
callback_.Run(net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_SET_AUTH);
callback_.Reset();
std::move(callback_).Run(
net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_SET_AUTH);
}
} else {
CEF_POST_TASK(CEF_IOT, base::Bind(&CefAuthCallbackImpl::Continue, this,
@@ -199,23 +201,23 @@ class CefAuthCallbackImpl : public CefAuthCallback {
void Cancel() override {
if (CEF_CURRENTLY_ON_IOT()) {
if (!callback_.is_null()) {
CancelNow(callback_);
callback_.Reset();
CancelNow(std::move(callback_));
}
} else {
CEF_POST_TASK(CEF_IOT, base::Bind(&CefAuthCallbackImpl::Cancel, this));
}
}
void Disconnect() { callback_.Reset(); }
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
private:
static void CancelNow(const net::NetworkDelegate::AuthCallback& callback) {
static void CancelNow(CallbackType callback) {
CEF_REQUIRE_IOT();
callback.Run(net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION);
std::move(callback).Run(
net::NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION);
}
net::NetworkDelegate::AuthCallback callback_;
CallbackType callback_;
net::AuthCredentials* credentials_;
IMPLEMENT_REFCOUNTING(CefAuthCallbackImpl);
@@ -277,10 +279,9 @@ std::unique_ptr<net::SourceStream> CefNetworkDelegate::CreateSourceStream(
return upstream;
}
int CefNetworkDelegate::OnBeforeURLRequest(
net::URLRequest* request,
const net::CompletionCallback& callback,
GURL* new_url) {
int CefNetworkDelegate::OnBeforeURLRequest(net::URLRequest* request,
net::CompletionOnceCallback callback,
GURL* new_url) {
if (net_util::IsInternalRequest(request))
return net::OK;
@@ -312,7 +313,7 @@ int CefNetworkDelegate::OnBeforeURLRequest(
CefRefPtr<CefBeforeResourceLoadCallbackImpl> callbackImpl(
new CefBeforeResourceLoadCallbackImpl(requestPtr, new_url, request,
force_google_safesearch,
callback));
std::move(callback)));
// Give the client an opportunity to evaluate the request.
cef_return_value_t retval = handler->OnBeforeResourceLoad(
@@ -338,7 +339,9 @@ int CefNetworkDelegate::OnBeforeURLRequest(
return net::OK;
}
void CefNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) {
void CefNetworkDelegate::OnCompleted(net::URLRequest* request,
bool started,
int net_error) {
if (net_util::IsInternalRequest(request))
return;
@@ -391,7 +394,7 @@ void CefNetworkDelegate::OnCompleted(net::URLRequest* request, bool started) {
net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(
net::URLRequest* request,
const net::AuthChallengeInfo& auth_info,
const AuthCallback& callback,
AuthCallback callback,
net::AuthCredentials* credentials) {
if (net_util::IsInternalRequest(request))
return AUTH_REQUIRED_RESPONSE_NO_ACTION;
@@ -406,14 +409,14 @@ net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(
CefRefPtr<CefFrame> frame = browser->GetFrameForRequest(request);
CefRefPtr<CefAuthCallbackImpl> callbackPtr(
new CefAuthCallbackImpl(callback, credentials));
new CefAuthCallbackImpl(std::move(callback), credentials));
if (handler->GetAuthCredentials(
browser.get(), frame, auth_info.is_proxy,
auth_info.challenger.host(), auth_info.challenger.port(),
auth_info.realm, auth_info.scheme, callbackPtr.get())) {
return AUTH_REQUIRED_RESPONSE_IO_PENDING;
} else {
callbackPtr->Disconnect();
callback = callbackPtr->Disconnect();
}
}
}
@@ -426,14 +429,14 @@ net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(
CefRefPtr<CefURLRequestClient> client = user_data->GetClient();
if (client.get()) {
CefRefPtr<CefAuthCallbackImpl> callbackPtr(
new CefAuthCallbackImpl(callback, credentials));
new CefAuthCallbackImpl(std::move(callback), credentials));
if (client->GetAuthCredentials(
auth_info.is_proxy, auth_info.challenger.host(),
auth_info.challenger.port(), auth_info.realm, auth_info.scheme,
callbackPtr.get())) {
return AUTH_REQUIRED_RESPONSE_IO_PENDING;
} else {
callbackPtr->Disconnect();
callback = callbackPtr->Disconnect();
}
}
}

View File

@@ -30,14 +30,16 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
net::URLRequest* request,
std::unique_ptr<net::SourceStream> upstream) override;
int OnBeforeURLRequest(net::URLRequest* request,
const net::CompletionCallback& callback,
net::CompletionOnceCallback callback,
GURL* new_url) override;
AuthRequiredResponse OnAuthRequired(
net::URLRequest* request,
const net::AuthChallengeInfo& auth_info,
const AuthCallback& callback,
AuthCallback callback,
net::AuthCredentials* credentials) override;
void OnCompleted(net::URLRequest* request, bool started) override;
void OnCompleted(net::URLRequest* request,
bool started,
int net_error) override;
bool OnCanGetCookies(const net::URLRequest& request,
const net::CookieList& cookie_list) override;
bool OnCanSetCookie(const net::URLRequest& request,

View File

@@ -282,11 +282,14 @@ void CefResourceRequestJob::GetLoadTimingInfo(
load_timing_info->receive_headers_end = receive_headers_end_;
}
bool CefResourceRequestJob::IsRedirectResponse(GURL* location,
int* http_status_code) {
bool CefResourceRequestJob::IsRedirectResponse(
GURL* location,
int* http_status_code,
bool* insecure_scheme_was_upgraded) {
CEF_REQUIRE_IOT();
bool redirect = false;
*insecure_scheme_was_upgraded = false;
if (redirect_url_.is_valid()) {
// Redirect to the new URL.
@@ -336,6 +339,14 @@ bool CefResourceRequestJob::GetCharset(std::string* charset) {
return false;
}
int CefResourceRequestJob::GetResponseCode() const {
CEF_REQUIRE_IOT();
if (response_.get())
return response_->GetStatus();
return -1;
}
void CefResourceRequestJob::SendHeaders() {
CEF_REQUIRE_IOT();

View File

@@ -38,9 +38,12 @@ class CefResourceRequestJob : public net::URLRequestJob {
int ReadRawData(net::IOBuffer* dest, int dest_size) override;
void GetResponseInfo(net::HttpResponseInfo* info) override;
void GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const override;
bool IsRedirectResponse(GURL* location, int* http_status_code) override;
bool IsRedirectResponse(GURL* location,
int* http_status_code,
bool* insecure_scheme_was_upgraded) override;
bool GetMimeType(std::string* mime_type) const override;
bool GetCharset(std::string* charset) override;
int GetResponseCode() const override;
void SendHeaders();

View File

@@ -14,7 +14,7 @@
#include "base/task_scheduler/post_task.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/url_constants.h"
#include "net/net_features.h"
#include "net/net_buildflags.h"
#include "net/url_request/data_protocol_handler.h"
#include "net/url_request/file_protocol_handler.h"
#include "net/url_request/ftp_protocol_handler.h"
@@ -29,19 +29,16 @@ void InstallInternalProtectedHandlers(
content::ProtocolHandlerMap* protocol_handlers,
net::HostResolver* host_resolver) {
protocol_handlers->insert(std::make_pair(
url::kDataScheme, linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
new net::DataProtocolHandler)));
url::kDataScheme, std::make_unique<net::DataProtocolHandler>()));
protocol_handlers->insert(std::make_pair(
url::kFileScheme,
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
new net::FileProtocolHandler(base::CreateTaskRunnerWithTraits(
std::make_unique<net::FileProtocolHandler>(
base::CreateTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})))));
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))));
#if !BUILDFLAG(DISABLE_FTP_SUPPORT)
protocol_handlers->insert(std::make_pair(
url::kFtpScheme,
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
net::FtpProtocolHandler::Create(host_resolver).release())));
url::kFtpScheme, net::FtpProtocolHandler::Create(host_resolver)));
#endif
for (content::ProtocolHandlerMap::iterator it = protocol_handlers->begin();

View File

@@ -10,6 +10,8 @@
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/cookie_manager_impl.h"
#include "libcef/browser/net/cookie_store_proxy.h"
#include "libcef/browser/net/cookie_store_source.h"
#include "libcef/browser/net/network_delegate.h"
#include "libcef/browser/net/scheme_handler.h"
#include "libcef/browser/net/url_request_interceptor.h"
@@ -18,7 +20,6 @@
#include "libcef/common/content_client.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
@@ -28,6 +29,8 @@
#include "chrome/browser/browser_process.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/certificate_transparency/chrome_ct_policy_enforcer.h"
#include "components/certificate_transparency/ct_known_logs.h"
#include "components/net_log/chrome_net_log.h"
#include "components/network_session_configurator/browser/network_session_configurator.h"
#include "components/prefs/pref_registry_simple.h"
@@ -37,13 +40,10 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/url_constants.h"
#include "net/cert/cert_verifier.h"
#include "net/cert/ct_known_logs.h"
#include "net/cert/ct_log_verifier.h"
#include "net/cert/ct_policy_enforcer.h"
#include "net/cert/multi_log_ct_verifier.h"
#include "net/cookies/cookie_monster.h"
#include "net/dns/host_resolver.h"
#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
#include "net/ftp/ftp_network_layer.h"
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_auth_preferences.h"
@@ -53,7 +53,7 @@
#include "net/http/transport_security_state.h"
#include "net/proxy_resolution/dhcp_pac_file_fetcher_factory.h"
#include "net/proxy_resolution/pac_file_fetcher_impl.h"
#include "net/proxy_resolution/proxy_service.h"
#include "net/proxy_resolution/proxy_resolution_service.h"
#include "net/ssl/ssl_config_service_defaults.h"
#include "net/url_request/http_user_agent_settings.h"
#include "net/url_request/url_request.h"
@@ -132,14 +132,14 @@ std::unique_ptr<net::ProxyResolutionService> CreateProxyResolutionService(
std::unique_ptr<net::ProxyResolutionService> proxy_service;
if (use_v8) {
std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher;
net::DhcpProxyScriptFetcherFactory dhcp_factory;
dhcp_proxy_script_fetcher = dhcp_factory.Create(context);
std::unique_ptr<net::DhcpPacFileFetcher> dhcp_pac_file_fetcher;
net::DhcpPacFileFetcherFactory dhcp_factory;
dhcp_pac_file_fetcher = dhcp_factory.Create(context);
proxy_service = network::CreateProxyServiceUsingMojoFactory(
proxy_service = network::CreateProxyResolutionServiceUsingMojoFactory(
std::move(proxy_resolver_factory), std::move(proxy_config_service),
std::make_unique<net::ProxyScriptFetcherImpl>(context),
std::move(dhcp_proxy_script_fetcher), context->host_resolver(), net_log,
net::PacFileFetcherImpl::Create(context),
std::move(dhcp_pac_file_fetcher), context->host_resolver(), net_log,
network_delegate);
} else {
proxy_service = net::ProxyResolutionService::CreateUsingSystemProxyResolver(
@@ -155,6 +155,27 @@ std::unique_ptr<net::ProxyResolutionService> CreateProxyResolutionService(
return proxy_service;
}
// Based on net::ct::CreateLogVerifiersForKnownLogs which was deleted in
// https://crrev.com/24711fe395.
std::vector<scoped_refptr<const net::CTLogVerifier>>
CreateLogVerifiersForKnownLogs() {
std::vector<scoped_refptr<const net::CTLogVerifier>> verifiers;
for (const auto& log : certificate_transparency::GetKnownLogs()) {
scoped_refptr<const net::CTLogVerifier> log_verifier =
net::CTLogVerifier::Create(
base::StringPiece(log.log_key, log.log_key_length), log.log_name,
log.log_dns_domain);
// Make sure no null logs enter verifiers. Parsing of all statically
// configured logs should always succeed, unless there has been binary or
// memory corruption.
CHECK(log_verifier);
verifiers.push_back(std::move(log_verifier));
}
return verifiers;
}
} // namespace
CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
@@ -304,14 +325,15 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
std::move(transport_security_state));
std::vector<scoped_refptr<const net::CTLogVerifier>> ct_logs(
net::ct::CreateLogVerifiersForKnownLogs());
CreateLogVerifiersForKnownLogs());
std::unique_ptr<net::MultiLogCTVerifier> ct_verifier(
new net::MultiLogCTVerifier());
ct_verifier->AddLogs(ct_logs);
io_state_->storage_->set_cert_transparency_verifier(std::move(ct_verifier));
std::unique_ptr<net::CTPolicyEnforcer> ct_policy_enforcer(
new net::CTPolicyEnforcer);
std::unique_ptr<certificate_transparency::ChromeCTPolicyEnforcer>
ct_policy_enforcer(
new certificate_transparency::ChromeCTPolicyEnforcer);
ct_policy_enforcer->set_enforce_net_security_expiration(
settings_.enable_net_security_expiration ? true : false);
io_state_->storage_->set_ct_policy_enforcer(std::move(ct_policy_enforcer));
@@ -328,7 +350,7 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
std::move(system_proxy_service));
io_state_->storage_->set_ssl_config_service(
new net::SSLConfigServiceDefaults);
std::make_unique<net::SSLConfigServiceDefaults>());
std::vector<std::string> supported_schemes;
supported_schemes.push_back("basic");
@@ -336,18 +358,12 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
supported_schemes.push_back("ntlm");
supported_schemes.push_back("negotiate");
io_state_->http_auth_preferences_.reset(new net::HttpAuthPreferences(
supported_schemes
#if defined(OS_POSIX) && !defined(OS_ANDROID)
,
io_state_->gsapi_library_name_
#endif
));
io_state_->http_auth_preferences_.reset(new net::HttpAuthPreferences());
io_state_->storage_->set_http_auth_handler_factory(
net::HttpAuthHandlerRegistryFactory::Create(
io_state_->http_auth_preferences_.get(),
io_state_->url_request_context_->host_resolver()));
io_state_->url_request_context_->host_resolver(),
io_state_->http_auth_preferences_.get(), supported_schemes));
io_state_->storage_->set_http_server_properties(
base::WrapUnique(new net::HttpServerPropertiesImpl));
@@ -457,57 +473,21 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
const base::FilePath& path,
bool persist_session_cookies) {
CEF_REQUIRE_IOT();
if (io_state_->url_request_context_->cookie_store() &&
((io_state_->cookie_store_path_.empty() && path.empty()) ||
io_state_->cookie_store_path_ == path)) {
// The path has not changed so don't do anything.
return;
if (!io_state_->cookie_source_) {
// Use a proxy because we can't change the URLRequestContext's CookieStore
// during runtime.
io_state_->cookie_source_ = new CefCookieStoreOwnerSource();
io_state_->storage_->set_cookie_store(std::make_unique<CefCookieStoreProxy>(
base::WrapUnique(io_state_->cookie_source_)));
}
scoped_refptr<net::SQLitePersistentCookieStore> persistent_store;
if (!path.empty()) {
// TODO(cef): Move directory creation to the blocking pool instead of
// allowing file IO on this thread.
base::ThreadRestrictions::ScopedAllowIO allow_io;
if (base::DirectoryExists(path) || base::CreateDirectory(path)) {
const base::FilePath& cookie_path = path.AppendASCII("Cookies");
persistent_store = new net::SQLitePersistentCookieStore(
cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
// Intentionally using the background task runner exposed by CEF to
// facilitate unit test expectations. This task runner MUST be
// configured with BLOCK_SHUTDOWN.
CefContentBrowserClient::Get()->background_task_runner(),
persist_session_cookies, NULL);
} else {
NOTREACHED() << "The cookie storage directory could not be created";
}
}
// Set the new cookie store that will be used for all new requests. The old
// cookie store, if any, will be automatically flushed and closed when no
// longer referenced.
std::unique_ptr<net::CookieMonster> cookie_monster(
new net::CookieMonster(persistent_store.get(), NULL));
if (persistent_store.get() && persist_session_cookies)
cookie_monster->SetPersistSessionCookies(true);
io_state_->cookie_store_path_ = path;
// Restore the previously supported schemes.
CefCookieManagerImpl::SetCookieMonsterSchemes(
cookie_monster.get(), io_state_->cookie_supported_schemes_);
io_state_->storage_->set_cookie_store(std::move(cookie_monster));
io_state_->cookie_source_->SetCookieStoragePath(path,
persist_session_cookies);
}
void CefURLRequestContextGetterImpl::SetCookieSupportedSchemes(
const std::vector<std::string>& schemes) {
CEF_REQUIRE_IOT();
io_state_->cookie_supported_schemes_ = schemes;
CefCookieManagerImpl::SetCookieMonsterSchemes(
static_cast<net::CookieMonster*>(GetExistingCookieStore()),
io_state_->cookie_supported_schemes_);
io_state_->cookie_source_->SetCookieSupportedSchemes(schemes);
}
void CefURLRequestContextGetterImpl::AddHandler(
@@ -524,9 +504,8 @@ void CefURLRequestContextGetterImpl::AddHandler(
net::CookieStore* CefURLRequestContextGetterImpl::GetExistingCookieStore()
const {
CEF_REQUIRE_IOT();
if (io_state_->url_request_context_ &&
io_state_->url_request_context_->cookie_store()) {
return io_state_->url_request_context_->cookie_store();
if (io_state_->cookie_source_) {
return io_state_->cookie_source_->GetCookieStore();
}
LOG(ERROR) << "Cookie store does not exist";

View File

@@ -22,6 +22,7 @@
#include "content/public/browser/browser_context.h"
#include "net/url_request/url_request_job_factory.h"
class CefCookieStoreOwnerSource;
class PrefRegistrySimple;
class PrefService;
@@ -113,8 +114,8 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
content::ProtocolHandlerMap protocol_handlers_;
content::URLRequestInterceptorScopedVector request_interceptors_;
base::FilePath cookie_store_path_;
std::vector<std::string> cookie_supported_schemes_;
// Owned by the URLRequestContextStorage.
CefCookieStoreOwnerSource* cookie_source_ = nullptr;
std::vector<CefRefPtr<CefRequestContextHandler>> handler_list_;

View File

@@ -5,6 +5,7 @@
#include "libcef/browser/net/url_request_context_proxy.h"
#include "libcef/browser/net/cookie_store_proxy.h"
#include "libcef/browser/net/cookie_store_source.h"
#include "libcef/browser/net/url_request_context_impl.h"
#include "libcef/browser/thread_util.h"
@@ -16,7 +17,8 @@ CefURLRequestContextProxy::CefURLRequestContextProxy(
DCHECK(handler.get());
// Cookie store that proxies to the browser implementation.
cookie_store_proxy_.reset(new CefCookieStoreProxy(parent, handler));
cookie_store_proxy_.reset(new CefCookieStoreProxy(
std::make_unique<CefCookieStoreHandlerSource>(parent, handler)));
set_cookie_store(cookie_store_proxy_.get());
// All other values refer to the parent request context.

View File

@@ -13,6 +13,7 @@
#include "libcef/browser/osr/web_contents_view_osr.h"
#include "libcef/common/drag_data_impl.h"
#include "base/message_loop/message_loop_current.h"
#include "content/browser/renderer_host/render_widget_host_input_event_router.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/render_view_host.h"
@@ -72,10 +73,10 @@ SkColor CefBrowserPlatformDelegateOsr::GetBackgroundColor() const {
return native_delegate_->GetBackgroundColor();
}
void CefBrowserPlatformDelegateOsr::WasResized() {
void CefBrowserPlatformDelegateOsr::SynchronizeVisualProperties() {
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
if (view)
view->WasResized();
view->SynchronizeVisualProperties();
}
void CefBrowserPlatformDelegateOsr::SendKeyEvent(
@@ -455,8 +456,7 @@ void CefBrowserPlatformDelegateOsr::StartDragging(
CefRefPtr<CefDragDataImpl> drag_data(
new CefDragDataImpl(drop_data, cef_image, cef_image_pos));
drag_data->SetReadOnly(true);
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
base::MessageLoopCurrent::ScopedNestableTaskAllower allow;
handled = handler->StartDragging(
browser_, drag_data.get(),
static_cast<CefRenderHandler::DragOperationsMask>(allowed_ops),
@@ -535,7 +535,7 @@ void CefBrowserPlatformDelegateOsr::DragSourceSystemDragEnded() {
}
void CefBrowserPlatformDelegateOsr::AccessibilityEventReceived(
const std::vector<content::AXEventNotificationDetails>& eventData) {
const content::AXEventNotificationDetails& eventData) {
CefRefPtr<CefRenderHandler> handler = browser_->client()->GetRenderHandler();
if (handler.get()) {
CefRefPtr<CefAccessibilityHandler> acchandler =

View File

@@ -28,7 +28,7 @@ class CefBrowserPlatformDelegateOsr
void BrowserCreated(CefBrowserHostImpl* browser) override;
void BrowserDestroyed(CefBrowserHostImpl* browser) override;
SkColor GetBackgroundColor() const override;
void WasResized() override;
void SynchronizeVisualProperties() override;
void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override;
void SendMouseEvent(const blink::WebMouseEvent& event) override;
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) override;
@@ -90,8 +90,7 @@ class CefBrowserPlatformDelegateOsr
void DragSourceEndedAt(int x, int y, cef_drag_operations_mask_t op) override;
void DragSourceSystemDragEnded() override;
void AccessibilityEventReceived(
const std::vector<content::AXEventNotificationDetails>& eventData)
override;
const content::AXEventNotificationDetails& eventData) override;
void AccessibilityLocationChangesReceived(
const std::vector<content::AXLocationChangeNotificationDetails>& locData)
override;

View File

@@ -40,8 +40,8 @@ CefRefPtr<CefListValue> ToCefValue(uint32_t state) {
int index = 0;
// Iterate and find which states are set.
for (unsigned i = static_cast<unsigned>(ax::mojom::Role::kNone);
i <= static_cast<unsigned>(ax::mojom::Role::kLast); i++) {
for (unsigned i = static_cast<unsigned>(ax::mojom::Role::kMinValue) + 1;
i <= static_cast<unsigned>(ax::mojom::Role::kMaxValue); i++) {
if (state & (1 << i))
value->SetString(index++, ToString(static_cast<ax::mojom::State>(i)));
}
@@ -80,6 +80,7 @@ struct PopulateAxNodeAttributes {
case ax::mojom::IntAttribute::kScrollY:
case ax::mojom::IntAttribute::kScrollYMin:
case ax::mojom::IntAttribute::kScrollYMax:
case ax::mojom::IntAttribute::kHasPopup:
case ax::mojom::IntAttribute::kHierarchicalLevel:
case ax::mojom::IntAttribute::kTextSelStart:
case ax::mojom::IntAttribute::kTextSelEnd:
@@ -169,6 +170,12 @@ struct PopulateAxNodeAttributes {
attributes->SetString(ToString(attr.first), ToString(state));
}
} break;
case ax::mojom::IntAttribute::kTextPosition: {
auto state = static_cast<ax::mojom::TextPosition>(attr.second);
if (ax::mojom::TextPosition::kNone != state) {
attributes->SetString(ToString(attr.first), ToString(state));
}
} break;
case ax::mojom::IntAttribute::kTextStyle: {
auto text_style = static_cast<ax::mojom::TextStyle>(attr.second);
if (text_style == ax::mojom::TextStyle::kNone)
@@ -267,8 +274,8 @@ CefRefPtr<CefDictionaryValue> ToCefValue(const ui::AXNodeData& node) {
CefRefPtr<CefListValue> actions_strings;
size_t actions_idx = 0;
for (int action_index = static_cast<int>(ax::mojom::Action::kNone) + 1;
action_index <= static_cast<int>(ax::mojom::Action::kLast);
for (int action_index = static_cast<int>(ax::mojom::Action::kMinValue) + 1;
action_index <= static_cast<int>(ax::mojom::Action::kMaxValue);
++action_index) {
auto action = static_cast<ax::mojom::Action>(action_index);
if (node.HasAction(action)) {
@@ -373,24 +380,53 @@ CefRefPtr<CefDictionaryValue> ToCefValue(const ui::AXTreeUpdate& update) {
return value;
}
// Converts AXEvent to CefDictionaryValue.
CefRefPtr<CefDictionaryValue> ToCefValue(const ui::AXEvent& event) {
CefRefPtr<CefDictionaryValue> value = CefDictionaryValue::Create();
if (event.event_type != ax::mojom::Event::kNone)
value->SetString("event_type", ToString(event.event_type));
if (event.id != -1)
value->SetInt("id", event.id);
if (event.event_from != ax::mojom::EventFrom::kNone)
value->SetString("event_from", ToString(event.event_from));
if (event.action_request_id != -1)
value->SetInt("action_request_id", event.action_request_id);
return value;
}
// Convert AXEventNotificationDetails to CefDictionaryValue.
CefRefPtr<CefDictionaryValue> ToCefValue(
const content::AXEventNotificationDetails& eventData) {
CefRefPtr<CefDictionaryValue> value = CefDictionaryValue::Create();
if (eventData.id != -1)
value->SetInt("id", eventData.id);
if (eventData.ax_tree_id != -1)
value->SetInt("ax_tree_id", eventData.ax_tree_id);
if (eventData.event_type != ax::mojom::Event::kNone)
value->SetString("event_type", ToString(eventData.event_type));
if (eventData.updates.size() > 0) {
CefRefPtr<CefListValue> updates = CefListValue::Create();
updates->SetSize(eventData.updates.size());
size_t i = 0;
for (const auto& update : eventData.updates) {
updates->SetDictionary(i++, ToCefValue(update));
}
value->SetList("updates", updates);
}
if (eventData.event_from != ax::mojom::EventFrom::kNone)
value->SetString("event_from", ToString(eventData.event_from));
if (eventData.events.size() > 0) {
CefRefPtr<CefListValue> events = CefListValue::Create();
events->SetSize(eventData.events.size());
size_t i = 0;
for (const auto& event : eventData.events) {
events->SetDictionary(i++, ToCefValue(event));
}
value->SetList("events", events);
}
value->SetDictionary("update", ToCefValue(eventData.update));
return value;
}
@@ -412,7 +448,7 @@ CefRefPtr<CefDictionaryValue> ToCefValue(const ui::AXRelativeBounds& location) {
return value;
}
// Convert AXEventNotificationDetails to CefDictionaryValue.
// Convert AXLocationChangeNotificationDetails to CefDictionaryValue.
CefRefPtr<CefDictionaryValue> ToCefValue(
const content::AXLocationChangeNotificationDetails& locData) {
CefRefPtr<CefDictionaryValue> value = CefDictionaryValue::Create();
@@ -443,9 +479,9 @@ CefRefPtr<CefListValue> ToCefValue(const std::vector<T>& vecData) {
namespace osr_accessibility_util {
CefRefPtr<CefValue> ParseAccessibilityEventData(
const std::vector<content::AXEventNotificationDetails>& data) {
const content::AXEventNotificationDetails& data) {
CefRefPtr<CefValue> value = CefValue::Create();
value->SetList(ToCefValue(data));
value->SetDictionary(ToCefValue(data));
return value;
}

View File

@@ -19,7 +19,7 @@ namespace osr_accessibility_util {
// Convert Accessibility Event and location updates to CefValue, which may be
// consumed or serialized with CefJSONWrite.
CefRefPtr<CefValue> ParseAccessibilityEventData(
const std::vector<content::AXEventNotificationDetails>& data);
const content::AXEventNotificationDetails& data);
CefRefPtr<CefValue> ParseAccessibilityLocationData(
const std::vector<content::AXLocationChangeNotificationDetails>& data);

View File

@@ -17,6 +17,7 @@
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "cc/base/switches.h"
#include "components/viz/common/features.h"
#include "components/viz/common/frame_sinks/copy_output_request.h"
@@ -26,6 +27,7 @@
#include "content/browser/bad_message.h"
#include "content/browser/compositor/image_transport_factory.h"
#include "content/browser/frame_host/render_widget_host_view_guest.h"
#include "content/browser/renderer_host/cursor_manager.h"
#include "content/browser/renderer_host/dip_util.h"
#include "content/browser/renderer_host/render_widget_host_delegate.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
@@ -93,7 +95,7 @@ class CefCopyFrameGenerator {
&CefCopyFrameGenerator::CopyFromCompositingSurfaceHasResult,
weak_ptr_factory_.GetWeakPtr(), damage_rect));
request->set_area(gfx::Rect(view_->GetPhysicalBackingSize()));
request->set_area(gfx::Rect(view_->GetCompositorViewportPixelSize()));
view_->GetRootLayer()->RequestCopyOfOutput(std::move(request));
}
@@ -205,7 +207,8 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
content::RenderWidgetHost* widget,
CefRenderWidgetHostViewOSR* parent_host_view,
bool is_guest_view_hack)
: background_color_(background_color),
: content::RenderWidgetHostViewBase(widget),
background_color_(background_color),
frame_rate_threshold_us_(0),
#if !defined(OS_MACOSX)
compositor_widget_(gfx::kNullAcceleratedWidget),
@@ -221,6 +224,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
is_showing_(!render_widget_host_->is_hidden()),
is_destroyed_(false),
is_scroll_offset_changed_pending_(false),
mouse_wheel_phase_handler_(this),
weak_ptr_factory_(this) {
DCHECK(render_widget_host_);
DCHECK(!render_widget_host_->GetView());
@@ -236,16 +240,12 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
content::RenderViewHost::From(render_widget_host_));
}
#if !defined(OS_MACOSX)
local_surface_id_ = local_surface_id_allocator_.GenerateId();
// Surface synchronization is not supported with OSR.
DCHECK(!features::IsSurfaceSynchronizationEnabled());
#if !defined(OS_MACOSX)
// Matching the attributes from BrowserCompositorMac.
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
AllocateFrameSinkId(is_guest_view_hack), this,
features::IsSurfaceSynchronizationEnabled(),
base::FeatureList::IsEnabled(features::kVizDisplayCompositor),
true /* should_register_frame_sink_id */);
@@ -277,7 +277,9 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
#endif
if (browser_impl_.get())
ResizeRootLayer();
ResizeRootLayer(false);
cursor_manager_.reset(new content::CursorManager(this));
// Do this last because it may result in a call to SetNeedsBeginFrames.
render_widget_host_->SetView(this);
@@ -327,7 +329,7 @@ void CefRenderWidgetHostViewOSR::InitAsChild(gfx::NativeView parent_view) {
// The parent view should not render while the full-screen view exists.
parent_host_view_->Hide();
ResizeRootLayer();
ResizeRootLayer(false);
Show();
}
@@ -335,10 +337,6 @@ void CefRenderWidgetHostViewOSR::SetSize(const gfx::Size& size) {}
void CefRenderWidgetHostViewOSR::SetBounds(const gfx::Rect& rect) {}
gfx::Vector2dF CefRenderWidgetHostViewOSR::GetLastScrollOffset() const {
return last_scroll_offset_;
}
gfx::NativeView CefRenderWidgetHostViewOSR::GetNativeView() const {
return gfx::NativeView();
}
@@ -368,14 +366,14 @@ void CefRenderWidgetHostViewOSR::Show() {
browser_compositor_->SetRenderWidgetHostIsHidden(false);
#else
delegated_frame_host_->SetCompositor(compositor_.get());
delegated_frame_host_->WasShown(
GetLocalSurfaceId(), GetRootLayer()->bounds().size(), ui::LatencyInfo());
delegated_frame_host_->WasShown(GetLocalSurfaceId(),
GetRootLayer()->bounds().size(), false);
#endif
// Note that |render_widget_host_| will retrieve size parameters from the
// DelegatedFrameHost, so it must have WasShown called after.
if (render_widget_host_)
render_widget_host_->WasShown(ui::LatencyInfo());
render_widget_host_->WasShown(false);
}
void CefRenderWidgetHostViewOSR::Hide() {
@@ -402,6 +400,11 @@ bool CefRenderWidgetHostViewOSR::IsShowing() {
return is_showing_;
}
void CefRenderWidgetHostViewOSR::EnsureSurfaceSynchronizedForLayoutTest() {
++latest_capture_sequence_number_;
SynchronizeVisualProperties();
}
gfx::Rect CefRenderWidgetHostViewOSR::GetViewBounds() const {
if (IsPopupWidget())
return popup_position_;
@@ -430,16 +433,36 @@ void CefRenderWidgetHostViewOSR::SetBackgroundColor(SkColor color) {
}
}
SkColor CefRenderWidgetHostViewOSR::background_color() const {
base::Optional<SkColor> CefRenderWidgetHostViewOSR::GetBackgroundColor() const {
return background_color_;
}
void CefRenderWidgetHostViewOSR::UpdateBackgroundColor() {
NOTREACHED();
}
bool CefRenderWidgetHostViewOSR::LockMouse() {
return false;
}
void CefRenderWidgetHostViewOSR::UnlockMouse() {}
void CefRenderWidgetHostViewOSR::TakeFallbackContentFrom(
content::RenderWidgetHostView* view) {
DCHECK(!static_cast<RenderWidgetHostViewBase*>(view)
->IsRenderWidgetHostViewChildFrame());
DCHECK(!static_cast<RenderWidgetHostViewBase*>(view)
->IsRenderWidgetHostViewGuest());
CefRenderWidgetHostViewOSR* view_cef =
static_cast<CefRenderWidgetHostViewOSR*>(view);
SetBackgroundColor(view_cef->background_color_);
if (GetDelegatedFrameHost() && view_cef->GetDelegatedFrameHost()) {
GetDelegatedFrameHost()->TakeFallbackContentFrom(
view_cef->GetDelegatedFrameHost());
}
host()->GetContentRenderingTimeoutFrom(view_cef->host());
}
void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink(
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) {
renderer_compositor_frame_sink_ = renderer_compositor_frame_sink;
@@ -452,7 +475,7 @@ void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink(
void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
viz::mojom::HitTestRegionListPtr hit_test_region_list) {
base::Optional<viz::HitTestRegionList> hit_test_region_list) {
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame");
if (frame.metadata.root_scroll_offset != last_scroll_offset_) {
@@ -540,7 +563,7 @@ void CefRenderWidgetHostViewOSR::InitAsPopup(
if (handler.get())
handler->OnPopupSize(browser_impl_.get(), widget_pos);
ResizeRootLayer();
ResizeRootLayer(false);
Show();
}
@@ -613,6 +636,10 @@ void CefRenderWidgetHostViewOSR::UpdateCursor(
#endif
}
content::CursorManager* CefRenderWidgetHostViewOSR::GetCursorManager() {
return cursor_manager_.get();
}
void CefRenderWidgetHostViewOSR::SetIsLoading(bool is_loading) {}
void CefRenderWidgetHostViewOSR::RenderProcessGone(
@@ -660,15 +687,15 @@ void CefRenderWidgetHostViewOSR::SetTooltipText(
}
}
gfx::Size CefRenderWidgetHostViewOSR::GetRequestedRendererSize() const {
return GetDelegatedFrameHost()->GetRequestedRendererSize();
}
gfx::Size CefRenderWidgetHostViewOSR::GetPhysicalBackingSize() const {
gfx::Size CefRenderWidgetHostViewOSR::GetCompositorViewportPixelSize() const {
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
current_device_scale_factor_);
}
uint32_t CefRenderWidgetHostViewOSR::GetCaptureSequenceNumber() const {
return latest_capture_sequence_number_;
}
void CefRenderWidgetHostViewOSR::CopyFromSurface(
const gfx::Rect& src_rect,
const gfx::Size& output_size,
@@ -711,9 +738,8 @@ void CefRenderWidgetHostViewOSR::GetScreenInfo(
*results = ScreenInfoFrom(screen_info);
}
gfx::Vector2d CefRenderWidgetHostViewOSR::GetOffsetFromRootSurface() {
return gfx::Vector2d();
}
void CefRenderWidgetHostViewOSR::TransformPointToRootSurface(
gfx::PointF* point) {}
gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
if (!browser_impl_.get())
@@ -727,11 +753,6 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
return GetViewBounds();
}
content::RenderWidgetHostImpl*
CefRenderWidgetHostViewOSR::GetRenderWidgetHostImpl() const {
return render_widget_host_;
}
viz::SurfaceId CefRenderWidgetHostViewOSR::GetCurrentSurfaceId() const {
return GetDelegatedFrameHost()
? GetDelegatedFrameHost()->GetCurrentSurfaceId()
@@ -765,7 +786,9 @@ void CefRenderWidgetHostViewOSR::ImeSetComposition(
for (const CefCompositionUnderline& line : underlines) {
web_underlines.push_back(ui::ImeTextSpan(
ui::ImeTextSpan::Type::kComposition, line.range.from, line.range.to,
line.color, line.thick ? true : false, line.background_color));
line.thick ? ui::ImeTextSpan::Thickness::kThick
: ui::ImeTextSpan::Thickness::kThin,
line.color, line.background_color, std::vector<std::string>()));
}
gfx::Range range(replacement_range.from, replacement_range.to);
@@ -814,6 +837,42 @@ void CefRenderWidgetHostViewOSR::ImeCancelComposition() {
RequestImeCompositionUpdate(false);
}
void CefRenderWidgetHostViewOSR::SelectionChanged(const base::string16& text,
size_t offset,
const gfx::Range& range) {
RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
if (!browser_impl_.get())
return;
CefString selected_text;
if (!range.is_empty() && !text.empty()) {
size_t pos = range.GetMin() - offset;
size_t n = range.length();
if (pos + n <= text.length())
selected_text = text.substr(pos, n);
}
CefRefPtr<CefRenderHandler> handler =
browser_impl_->GetClient()->GetRenderHandler();
if (handler.get()) {
CefRange cef_range(range.start(), range.end());
handler->OnTextSelectionChanged(browser_impl_.get(), selected_text,
cef_range);
}
}
#if !defined(OS_MACOSX)
const viz::LocalSurfaceId& CefRenderWidgetHostViewOSR::GetLocalSurfaceId()
const {
return local_surface_id_;
}
#endif
const viz::FrameSinkId& CefRenderWidgetHostViewOSR::GetFrameSinkId() const {
return GetDelegatedFrameHost()->frame_sink_id();
}
void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) {
SetFrameRate();
@@ -833,7 +892,7 @@ void CefRenderWidgetHostViewOSR::SetWantsAnimateOnlyBeginFrames() {
}
}
bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpaceLegacy(
const gfx::PointF& point,
const viz::SurfaceId& original_surface,
gfx::PointF* transformed_point) {
@@ -841,7 +900,7 @@ bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
// is necessary.
gfx::PointF point_in_pixels =
gfx::ConvertPointToPixel(current_device_scale_factor_, point);
if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpace(
if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpaceLegacy(
point_in_pixels, original_surface, transformed_point)) {
return false;
}
@@ -854,7 +913,8 @@ bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
const gfx::PointF& point,
RenderWidgetHostViewBase* target_view,
gfx::PointF* transformed_point) {
gfx::PointF* transformed_point,
viz::EventSource source) {
if (target_view == this) {
*transformed_point = point;
return true;
@@ -864,14 +924,16 @@ bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
// but it is not necessary here because the final target view is responsible
// for converting before computing the final transform.
return GetDelegatedFrameHost()->TransformPointToCoordSpaceForView(
point, target_view, transformed_point);
point, target_view, transformed_point, source);
}
void CefRenderWidgetHostViewOSR::DidNavigate() {
// With surface synchronization enabled we need to force synchronization on
// first navigation.
ResizeRootLayer(true);
#if defined(OS_MACOSX)
browser_compositor_->DidNavigate();
#else
ResizeRootLayer();
if (delegated_frame_host_)
delegated_frame_host_->DidNavigate();
#endif
@@ -884,7 +946,7 @@ CefRenderWidgetHostViewOSR::CreateSoftwareOutputDevice(
DCHECK(!copy_frame_generator_);
DCHECK(!software_output_device_);
software_output_device_ = new CefSoftwareOutputDeviceOSR(
compositor, background_color() == SK_ColorTRANSPARENT,
compositor, background_color_ == SK_ColorTRANSPARENT,
base::Bind(&CefRenderWidgetHostViewOSR::OnPaint,
weak_ptr_factory_.GetWeakPtr()));
return base::WrapUnique(software_output_device_);
@@ -911,22 +973,6 @@ SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor() const {
return background_color_;
}
bool CefRenderWidgetHostViewOSR::DelegatedFrameCanCreateResizeLock() const {
return !render_widget_host_->auto_resize_enabled();
}
std::unique_ptr<content::CompositorResizeLock>
CefRenderWidgetHostViewOSR::DelegatedFrameHostCreateResizeLock() {
HoldResize();
const gfx::Size& desired_size = GetRootLayer()->bounds().size();
return std::make_unique<content::CompositorResizeLock>(this, desired_size);
}
viz::LocalSurfaceId CefRenderWidgetHostViewOSR::GetLocalSurfaceId() const {
return local_surface_id_;
}
void CefRenderWidgetHostViewOSR::OnFirstSurfaceActivation(
const viz::SurfaceInfo& surface_info) {}
@@ -936,10 +982,6 @@ void CefRenderWidgetHostViewOSR::OnBeginFrame(base::TimeTicks frame_time) {
// See https://codereview.chromium.org/1841083007.
}
bool CefRenderWidgetHostViewOSR::IsAutoResizeEnabled() const {
return render_widget_host_->auto_resize_enabled();
}
void CefRenderWidgetHostViewOSR::OnFrameTokenChanged(uint32_t frame_token) {
render_widget_host_->DidProcessFrame(frame_token);
}
@@ -948,39 +990,29 @@ void CefRenderWidgetHostViewOSR::DidReceiveFirstFrameAfterNavigation() {
render_widget_host_->DidReceiveFirstFrameAfterNavigation();
}
std::unique_ptr<ui::CompositorLock>
CefRenderWidgetHostViewOSR::GetCompositorLock(
ui::CompositorLockClient* client) {
return GetCompositor()->GetCompositorLock(client);
}
void CefRenderWidgetHostViewOSR::CompositorResizeLockEnded() {
ReleaseResize();
}
#endif // !defined(OS_MACOSX)
bool CefRenderWidgetHostViewOSR::InstallTransparency() {
if (background_color() == SK_ColorTRANSPARENT) {
SetBackgroundColor(background_color());
if (background_color_ == SK_ColorTRANSPARENT) {
SetBackgroundColor(background_color_);
#if defined(OS_MACOSX)
browser_compositor_->SetBackgroundColor(background_color());
browser_compositor_->SetBackgroundColor(background_color_);
#else
compositor_->SetBackgroundColor(background_color());
compositor_->SetBackgroundColor(background_color_);
#endif
return true;
}
return false;
}
void CefRenderWidgetHostViewOSR::WasResized() {
void CefRenderWidgetHostViewOSR::SynchronizeVisualProperties() {
if (hold_resize_) {
if (!pending_resize_)
pending_resize_ = true;
return;
}
ResizeRootLayer();
ResizeRootLayer(false);
}
void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() {
@@ -1000,7 +1032,7 @@ void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() {
// to send to the renderer, so it is required that BrowserCompositorMac be
// updated first. Only notify RenderWidgetHostImpl of the update if any
// properties it will query have changed.
if (browser_compositor_->UpdateNSViewAndDisplay())
if (UpdateNSViewAndDisplay())
render_widget_host_->NotifyScreenInfoChanged();
#else
render_widget_host_->NotifyScreenInfoChanged();
@@ -1025,7 +1057,7 @@ void CefRenderWidgetHostViewOSR::Invalidate(
return;
}
InvalidateInternal(gfx::Rect(GetPhysicalBackingSize()));
InvalidateInternal(gfx::Rect(GetCompositorViewportPixelSize()));
}
void CefRenderWidgetHostViewOSR::SendKeyEvent(
@@ -1098,21 +1130,32 @@ void CefRenderWidgetHostViewOSR::SendMouseEvent(
void CefRenderWidgetHostViewOSR::SendMouseWheelEvent(
const blink::WebMouseWheelEvent& event) {
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::SendMouseWheelEvent");
blink::WebMouseWheelEvent mouse_wheel_event(event);
mouse_wheel_phase_handler_.SendWheelEndForTouchpadScrollingIfNeeded();
mouse_wheel_phase_handler_.AddPhaseIfNeededAndScheduleEndEvent(
mouse_wheel_event, false);
if (!IsPopupWidget()) {
if (browser_impl_.get())
browser_impl_->CancelContextMenu();
if (popup_host_view_) {
if (popup_host_view_->popup_position_.Contains(
event.PositionInWidget().x, event.PositionInWidget().y)) {
blink::WebMouseWheelEvent popup_event(event);
popup_event.SetPositionInWidget(
event.PositionInWidget().x - popup_host_view_->popup_position_.x(),
event.PositionInWidget().y - popup_host_view_->popup_position_.y());
popup_event.SetPositionInScreen(popup_event.PositionInWidget().x,
popup_event.PositionInWidget().y);
mouse_wheel_event.PositionInWidget().x,
mouse_wheel_event.PositionInWidget().y)) {
blink::WebMouseWheelEvent popup_mouse_wheel_event(mouse_wheel_event);
popup_mouse_wheel_event.SetPositionInWidget(
mouse_wheel_event.PositionInWidget().x -
popup_host_view_->popup_position_.x(),
mouse_wheel_event.PositionInWidget().y -
popup_host_view_->popup_position_.y());
popup_mouse_wheel_event.SetPositionInScreen(
popup_mouse_wheel_event.PositionInWidget().x,
popup_mouse_wheel_event.PositionInWidget().y);
popup_host_view_->SendMouseWheelEvent(popup_event);
popup_host_view_->SendMouseWheelEvent(popup_mouse_wheel_event);
return;
} else {
// Scrolling outside of the popup widget so destroy it.
@@ -1131,16 +1174,17 @@ void CefRenderWidgetHostViewOSR::SendMouseWheelEvent(
}
const gfx::Rect& guest_bounds =
guest_host_view->render_widget_host_->GetView()->GetViewBounds();
if (guest_bounds.Contains(event.PositionInWidget().x,
event.PositionInWidget().y)) {
blink::WebMouseWheelEvent guest_event(event);
guest_event.SetPositionInWidget(
event.PositionInWidget().x - guest_bounds.x(),
event.PositionInWidget().y - guest_bounds.y());
guest_event.SetPositionInScreen(guest_event.PositionInWidget().x,
guest_event.PositionInWidget().y);
if (guest_bounds.Contains(mouse_wheel_event.PositionInWidget().x,
mouse_wheel_event.PositionInWidget().y)) {
blink::WebMouseWheelEvent guest_mouse_wheel_event(mouse_wheel_event);
guest_mouse_wheel_event.SetPositionInWidget(
mouse_wheel_event.PositionInWidget().x - guest_bounds.x(),
mouse_wheel_event.PositionInWidget().y - guest_bounds.y());
guest_mouse_wheel_event.SetPositionInScreen(
guest_mouse_wheel_event.PositionInWidget().x,
guest_mouse_wheel_event.PositionInWidget().y);
guest_host_view->SendMouseWheelEvent(guest_event);
guest_host_view->SendMouseWheelEvent(guest_mouse_wheel_event);
return;
}
}
@@ -1150,7 +1194,7 @@ void CefRenderWidgetHostViewOSR::SendMouseWheelEvent(
if (render_widget_host_ && render_widget_host_->GetView()) {
// Direct routing requires that mouse events go directly to the View.
render_widget_host_->GetView()->ProcessMouseWheelEvent(
event, ui::LatencyInfo(ui::SourceEventType::WHEEL));
mouse_wheel_event, ui::LatencyInfo(ui::SourceEventType::WHEEL));
}
}
@@ -1193,8 +1237,10 @@ void CefRenderWidgetHostViewOSR::ReleaseResize() {
hold_resize_ = false;
if (pending_resize_) {
pending_resize_ = false;
CEF_POST_TASK(CEF_UIT, base::Bind(&CefRenderWidgetHostViewOSR::WasResized,
weak_ptr_factory_.GetWeakPtr()));
CEF_POST_TASK(
CEF_UIT,
base::Bind(&CefRenderWidgetHostViewOSR::SynchronizeVisualProperties,
weak_ptr_factory_.GetWeakPtr()));
}
}
@@ -1209,7 +1255,8 @@ void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
if (!handler.get())
return;
// Don't execute WasResized while the OnPaint callback is pending.
// Don't execute SynchronizeVisualProperties while the OnPaint callback is
// pending.
HoldResize();
gfx::Rect rect_in_bitmap(0, 0, bitmap_width, bitmap_height);
@@ -1260,9 +1307,11 @@ void CefRenderWidgetHostViewOSR::SetFrameRate() {
osr_util::ClampFrameRate(browser->settings().windowless_frame_rate);
frame_rate_threshold_us_ = 1000000 / frame_rate;
// Configure the VSync interval for the browser process.
GetCompositor()->vsync_manager()->SetAuthoritativeVSyncInterval(
base::TimeDelta::FromMicroseconds(frame_rate_threshold_us_));
if (GetCompositor()) {
// Configure the VSync interval for the browser process.
GetCompositor()->vsync_manager()->SetAuthoritativeVSyncInterval(
base::TimeDelta::FromMicroseconds(frame_rate_threshold_us_));
}
if (copy_frame_generator_.get()) {
copy_frame_generator_->set_frame_rate_threshold_us(
@@ -1305,7 +1354,7 @@ void CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
}
}
void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
void CefRenderWidgetHostViewOSR::ResizeRootLayer(bool force) {
SetFrameRate();
const float orgScaleFactor = current_device_scale_factor_;
@@ -1319,31 +1368,37 @@ void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
else
size = popup_position_.size();
if (!scaleFactorDidChange && size == GetRootLayer()->bounds().size())
if (!force && !scaleFactorDidChange &&
size == GetRootLayer()->bounds().size()) {
return;
}
GetRootLayer()->SetBounds(gfx::Rect(size));
#if defined(OS_MACOSX)
bool resized = UpdateNSViewAndDisplay();
#else
const gfx::Size& size_in_pixels =
gfx::ConvertSizeToPixel(current_device_scale_factor_, size);
local_surface_id_ = local_surface_id_allocator_.GenerateId();
GetRootLayer()->SetBounds(gfx::Rect(size));
GetCompositor()->SetScaleAndSize(current_device_scale_factor_, size_in_pixels,
local_surface_id_);
if (GetCompositor()) {
GetCompositor()->SetScaleAndSize(current_device_scale_factor_,
size_in_pixels, local_surface_id_);
}
PlatformResizeCompositorWidget(size_in_pixels);
#if defined(OS_MACOSX)
bool resized = browser_compositor_->UpdateNSViewAndDisplay();
#else
bool resized = true;
GetDelegatedFrameHost()->WasResized(local_surface_id_, size,
cc::DeadlinePolicy::UseDefaultDeadline());
#endif
GetDelegatedFrameHost()->EmbedSurface(
local_surface_id_, size, cc::DeadlinePolicy::UseDefaultDeadline());
#endif // !defined(OS_MACOSX)
// Note that |render_widget_host_| will retrieve resize parameters from the
// DelegatedFrameHost, so it must have WasResized called after.
// DelegatedFrameHost, so it must have SynchronizeVisualProperties called
// after.
if (resized && render_widget_host_)
render_widget_host_->WasResized();
render_widget_host_->SynchronizeVisualProperties();
}
void CefRenderWidgetHostViewOSR::OnBeginFrameTimerTick() {
@@ -1514,7 +1569,7 @@ viz::FrameSinkId CefRenderWidgetHostViewOSR::AllocateFrameSinkId(
void CefRenderWidgetHostViewOSR::UpdateBackgroundColorFromRenderer(
SkColor color) {
if (color == background_color())
if (color == background_color_)
return;
background_color_ = color;

View File

@@ -17,8 +17,8 @@
#include "build/build_config.h"
#include "components/viz/common/frame_sinks/begin_frame_source.h"
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
#include "content/browser/renderer_host/compositor_resize_lock.h"
#include "content/browser/renderer_host/delegated_frame_host.h"
#include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "ui/compositor/compositor.h"
@@ -39,6 +39,7 @@ class RenderWidgetHost;
class RenderWidgetHostImpl;
class RenderWidgetHostViewGuest;
class BackingStore;
class CursorManager;
} // namespace content
class CefBeginFrameTimer;
@@ -87,8 +88,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
public ui::CompositorDelegate
#if !defined(OS_MACOSX)
,
public content::DelegatedFrameHostClient,
public content::CompositorResizeLockClient
public content::DelegatedFrameHostClient
#endif
{
public:
@@ -102,28 +102,28 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void InitAsChild(gfx::NativeView parent_view) override;
void SetSize(const gfx::Size& size) override;
void SetBounds(const gfx::Rect& rect) override;
gfx::Vector2dF GetLastScrollOffset() const override;
gfx::NativeView GetNativeView() const override;
gfx::NativeViewAccessible GetNativeViewAccessible() override;
void Focus() override;
bool HasFocus() const override;
uint32_t GetCaptureSequenceNumber() const override;
bool IsSurfaceAvailableForCopy() const override;
void Show() override;
void Hide() override;
bool IsShowing() override;
void EnsureSurfaceSynchronizedForLayoutTest() override;
gfx::Rect GetViewBounds() const override;
void SetBackgroundColor(SkColor color) override;
SkColor background_color() const override;
base::Optional<SkColor> GetBackgroundColor() const override;
void UpdateBackgroundColor() override;
bool LockMouse() override;
void UnlockMouse() override;
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
#if defined(OS_MACOSX)
void SetActive(bool active) override;
void ShowDefinitionForSelection() override;
bool SupportsSpeech() const override;
void SpeakSelection() override;
bool IsSpeaking() const override;
void StopSpeaking() override;
bool ShouldContinueToPauseForFrame() override;
#endif // defined(OS_MACOSX)
@@ -134,7 +134,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void SubmitCompositorFrame(
const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
viz::mojom::HitTestRegionListPtr hit_test_region_list) override;
base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
void ClearCompositorFrame() override;
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
const gfx::Rect& pos) override;
@@ -148,17 +148,20 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
int error_code) override;
void Destroy() override;
void SetTooltipText(const base::string16& tooltip_text) override;
content::CursorManager* GetCursorManager() override;
gfx::Size GetRequestedRendererSize() const override;
gfx::Size GetPhysicalBackingSize() const override;
gfx::Size GetCompositorViewportPixelSize() const override;
void CopyFromSurface(
const gfx::Rect& src_rect,
const gfx::Size& output_size,
base::OnceCallback<void(const SkBitmap&)> callback) override;
void GetScreenInfo(content::ScreenInfo* results) const override;
gfx::Vector2d GetOffsetFromRootSurface() override;
void TransformPointToRootSurface(gfx::PointF* point) override;
gfx::Rect GetBoundsInRootWindow() override;
content::RenderWidgetHostImpl* GetRenderWidgetHostImpl() const override;
#if defined(OS_MACOSX)
viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(
const cc::RenderFrameMetadata& metadata) override;
#endif
viz::SurfaceId GetCurrentSurfaceId() const override;
content::BrowserAccessibilityManager* CreateBrowserAccessibilityManager(
content::BrowserAccessibilityDelegate* delegate,
@@ -175,15 +178,24 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void SetNeedsBeginFrames(bool enabled) override;
void SetWantsAnimateOnlyBeginFrames() override;
bool TransformPointToLocalCoordSpace(const gfx::PointF& point,
const viz::SurfaceId& original_surface,
gfx::PointF* transformed_point) override;
bool TransformPointToLocalCoordSpaceLegacy(
const gfx::PointF& point,
const viz::SurfaceId& original_surface,
gfx::PointF* transformed_point) override;
bool TransformPointToCoordSpaceForView(
const gfx::PointF& point,
RenderWidgetHostViewBase* target_view,
gfx::PointF* transformed_point) override;
gfx::PointF* transformed_point,
viz::EventSource source = viz::EventSource::ANY) override;
void DidNavigate() override;
void SelectionChanged(const base::string16& text,
size_t offset,
const gfx::Range& range) override;
const viz::LocalSurfaceId& GetLocalSurfaceId() const override;
const viz::FrameSinkId& GetFrameSinkId() const override;
// ui::CompositorDelegate implementation.
std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice(
ui::Compositor* compositor) override;
@@ -193,25 +205,15 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
ui::Layer* DelegatedFrameHostGetLayer() const override;
bool DelegatedFrameHostIsVisible() const override;
SkColor DelegatedFrameHostGetGutterColor() const override;
bool DelegatedFrameCanCreateResizeLock() const override;
std::unique_ptr<content::CompositorResizeLock>
DelegatedFrameHostCreateResizeLock() override;
viz::LocalSurfaceId GetLocalSurfaceId() const override;
void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
void OnBeginFrame(base::TimeTicks frame_time) override;
bool IsAutoResizeEnabled() const override;
void OnFrameTokenChanged(uint32_t frame_token) override;
void DidReceiveFirstFrameAfterNavigation() override;
// CompositorResizeLockClient implementation.
std::unique_ptr<ui::CompositorLock> GetCompositorLock(
ui::CompositorLockClient* client) override;
void CompositorResizeLockEnded() override;
#endif // !defined(OS_MACOSX)
bool InstallTransparency();
void WasResized();
void SynchronizeVisualProperties();
void OnScreenInfoChanged();
void Invalidate(CefBrowserHost::PaintElementType type);
void SendKeyEvent(const content::NativeWebKeyboardEvent& event);
@@ -238,7 +240,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
const CefRange& replacement_range,
int relative_cursor_pos);
void ImeFinishComposingText(bool keep_selection);
void ImeCancelComposition();
void ImeCancelComposition() override;
CefRefPtr<CefBrowserHostImpl> browser_impl() const { return browser_impl_; }
void set_browser_impl(CefRefPtr<CefBrowserHostImpl> browser) {
@@ -258,14 +260,18 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
}
ui::Layer* GetRootLayer() const;
viz::LocalSurfaceId local_surface_id() const { return local_surface_id_; }
#if defined(OS_MACOSX)
content::BrowserCompositorMac* browser_compositor() const {
return browser_compositor_.get();
}
#endif
private:
content::DelegatedFrameHost* GetDelegatedFrameHost() const;
void SetFrameRate();
void SetDeviceScaleFactor();
void ResizeRootLayer();
void ResizeRootLayer(bool force);
// Called by CefBeginFrameTimer to send a BeginFrame request.
void OnBeginFrameTimerTick();
@@ -297,10 +303,18 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void UpdateBackgroundColorFromRenderer(SkColor color);
#if defined(OS_MACOSX)
display::Display GetDisplay();
void OnDidUpdateVisualPropertiesComplete(
const cc::RenderFrameMetadata& metadata);
friend class MacHelper;
#endif
bool UpdateNSViewAndDisplay();
#endif // defined(OS_MACOSX)
void PlatformCreateCompositorWidget(bool is_guest_view_hack);
#if !defined(OS_MACOSX)
void PlatformResizeCompositorWidget(const gfx::Size& size);
#endif
void PlatformDestroyCompositorWidget();
#if defined(USE_AURA)
@@ -317,10 +331,9 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
gfx::AcceleratedWidget compositor_widget_;
std::unique_ptr<content::DelegatedFrameHost> delegated_frame_host_;
std::unique_ptr<ui::Layer> root_layer_;
#endif
viz::LocalSurfaceId local_surface_id_;
viz::ParentLocalSurfaceIdAllocator local_surface_id_allocator_;
#endif
#if defined(OS_WIN)
std::unique_ptr<gfx::WindowImpl> window_;
@@ -334,6 +347,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
std::unique_ptr<ui::XScopedCursor> invisible_cursor_;
#endif
std::unique_ptr<content::CursorManager> cursor_manager_;
// Used to control the VSync rate in subprocesses when BeginFrame scheduling
// is enabled.
std::unique_ptr<CefBeginFrameTimer> begin_frame_timer_;
@@ -373,9 +388,16 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
gfx::Vector2dF last_scroll_offset_;
bool is_scroll_offset_changed_pending_;
content::MouseWheelPhaseHandler mouse_wheel_phase_handler_;
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink_ =
nullptr;
// Latest capture sequence number which is incremented when the caller
// requests surfaces be synchronized via
// EnsureSurfaceSynchronizedForLayoutTest().
uint32_t latest_capture_sequence_number_ = 0u;
base::WeakPtrFactory<CefRenderWidgetHostViewOSR> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(CefRenderWidgetHostViewOSR);

View File

@@ -11,7 +11,7 @@
#include "libcef/browser/native/window_x11.h"
#include "third_party/WebKit/public/platform/WebCursorInfo.h"
#include "third_party/blink/public/platform/web_cursor_info.h"
#include "ui/base/x/x11_util.h"
#include "ui/gfx/x/x11_types.h"

View File

@@ -17,6 +17,7 @@
#include "base/strings/utf_string_conversions.h"
#include "content/common/view_messages.h"
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
#include "ui/display/screen.h"
class MacHelper : public content::BrowserCompositorMacClient,
public ui::AcceleratedWidgetMacNSView {
@@ -34,36 +35,45 @@ class MacHelper : public content::BrowserCompositorMacClient,
view_->render_widget_host()->delegate()->IsFullscreenForCurrentTab()) {
return SK_ColorBLACK;
}
return view_->background_color();
return *view_->GetBackgroundColor();
}
void BrowserCompositorMacOnBeginFrame() override {}
void BrowserCompositorMacOnBeginFrame(base::TimeTicks frame_time) override {}
void OnFrameTokenChanged(uint32_t frame_token) override {
view_->render_widget_host()->DidProcessFrame(frame_token);
}
// AcceleratedWidgetMacNSView methods:
NSView* AcceleratedWidgetGetNSView() const override {
// Intentionally return nil so that BrowserCompositorMac::GetViewProperties
// uses the layer size instead of the NSView size.
return nil;
}
void AcceleratedWidgetGetVSyncParameters(
base::TimeTicks* timebase,
base::TimeDelta* interval) const override {
*timebase = base::TimeTicks();
*interval = base::TimeDelta();
}
void AcceleratedWidgetSwapCompleted() override {}
void DidReceiveFirstFrameAfterNavigation() override {
view_->render_widget_host()->DidReceiveFirstFrameAfterNavigation();
}
void DestroyCompositorForShutdown() override {}
bool SynchronizeVisualProperties(
const base::Optional<viz::LocalSurfaceId>&
child_allocated_local_surface_id) override {
auto* browser_compositor = view_->browser_compositor();
if (child_allocated_local_surface_id) {
browser_compositor->UpdateRendererLocalSurfaceIdFromChild(
*child_allocated_local_surface_id);
} else {
browser_compositor->AllocateNewRendererLocalSurfaceId();
}
if (auto* host = browser_compositor->GetDelegatedFrameHost()) {
host->EmbedSurface(browser_compositor->GetRendererLocalSurfaceId(),
browser_compositor->GetRendererSize(),
cc::DeadlinePolicy::UseDefaultDeadline());
}
return view_->render_widget_host()->SynchronizeVisualProperties();
}
// AcceleratedWidgetMacNSView methods:
void AcceleratedWidgetCALayerParamsUpdated() override {}
private:
// Guaranteed to outlive this object.
CefRenderWidgetHostViewOSR* view_;
@@ -75,22 +85,57 @@ void CefRenderWidgetHostViewOSR::SetActive(bool active) {}
void CefRenderWidgetHostViewOSR::ShowDefinitionForSelection() {}
bool CefRenderWidgetHostViewOSR::SupportsSpeech() const {
return false;
}
void CefRenderWidgetHostViewOSR::SpeakSelection() {}
bool CefRenderWidgetHostViewOSR::IsSpeaking() const {
return false;
}
void CefRenderWidgetHostViewOSR::StopSpeaking() {}
bool CefRenderWidgetHostViewOSR::ShouldContinueToPauseForFrame() {
return browser_compositor_->ShouldContinueToPauseForFrame();
}
viz::ScopedSurfaceIdAllocator
CefRenderWidgetHostViewOSR::DidUpdateVisualProperties(
const cc::RenderFrameMetadata& metadata) {
base::OnceCallback<void()> allocation_task = base::BindOnce(
base::IgnoreResult(
&CefRenderWidgetHostViewOSR::OnDidUpdateVisualPropertiesComplete),
weak_ptr_factory_.GetWeakPtr(), metadata);
return browser_compositor_->GetScopedRendererSurfaceIdAllocator(
std::move(allocation_task));
}
display::Display CefRenderWidgetHostViewOSR::GetDisplay() {
content::ScreenInfo screen_info;
GetScreenInfo(&screen_info);
// Start with a reasonable display representation.
display::Display display =
display::Screen::GetScreen()->GetDisplayNearestView(nullptr);
// Populate attributes based on |screen_info|.
display.set_bounds(screen_info.rect);
display.set_work_area(screen_info.available_rect);
display.set_device_scale_factor(screen_info.device_scale_factor);
display.set_color_space(screen_info.color_space);
display.set_color_depth(screen_info.depth);
display.set_depth_per_component(screen_info.depth_per_component);
display.set_is_monochrome(screen_info.is_monochrome);
display.SetRotationAsDegree(screen_info.orientation_angle);
return display;
}
void CefRenderWidgetHostViewOSR::OnDidUpdateVisualPropertiesComplete(
const cc::RenderFrameMetadata& metadata) {
DCHECK_EQ(current_device_scale_factor_, metadata.device_scale_factor);
browser_compositor_->SynchronizeVisualProperties(
metadata.device_scale_factor, metadata.viewport_size_in_pixels,
metadata.local_surface_id.value_or(viz::LocalSurfaceId()));
}
const viz::LocalSurfaceId& CefRenderWidgetHostViewOSR::GetLocalSurfaceId()
const {
return browser_compositor_->GetRendererLocalSurfaceId();
}
ui::Compositor* CefRenderWidgetHostViewOSR::GetCompositor() const {
return browser_compositor_->GetCompositor();
}
@@ -104,6 +149,11 @@ content::DelegatedFrameHost* CefRenderWidgetHostViewOSR::GetDelegatedFrameHost()
return browser_compositor_->GetDelegatedFrameHost();
}
bool CefRenderWidgetHostViewOSR::UpdateNSViewAndDisplay() {
return browser_compositor_->UpdateNSViewAndDisplay(
GetRootLayer()->bounds().size(), GetDisplay());
}
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget(
bool is_guest_view_hack) {
// Create a borderless non-visible 1x1 window.
@@ -121,13 +171,10 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget(
mac_helper_ = new MacHelper(this);
browser_compositor_.reset(new content::BrowserCompositorMac(
mac_helper_, mac_helper_, render_widget_host_->is_hidden(), true,
mac_helper_, mac_helper_, render_widget_host_->is_hidden(), GetDisplay(),
AllocateFrameSinkId(is_guest_view_hack)));
}
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(
const gfx::Size&) {}
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
DCHECK(window_);

View File

@@ -10,7 +10,7 @@
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/content_browser_client.h"
#include "third_party/WebKit/public/platform/WebCursorInfo.h"
#include "third_party/blink/public/platform/web_cursor_info.h"
#include "ui/resources/grit/ui_unscaled_resources.h"
namespace {
@@ -26,10 +26,12 @@ class CefCompositorHostWin : public gfx::WindowImpl {
~CefCompositorHostWin() override { DestroyWindow(hwnd()); }
private:
CR_BEGIN_MSG_MAP_EX(CompositorHostWin)
CR_BEGIN_MSG_MAP_EX(CefCompositorHostWin)
CR_MSG_WM_PAINT(OnPaint)
CR_END_MSG_MAP()
CR_MSG_MAP_CLASS_DECLARATIONS(CefCompositorHostWin)
void OnPaint(HDC dc) { ValidateRect(hwnd(), NULL); }
DISALLOW_COPY_AND_ASSIGN(CefCompositorHostWin);

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