Compare commits

..

66 Commits
3440 ... 3538

Author SHA1 Message Date
Marshall Greenblatt
cb937fc9cd Windows: Fix sandbox link error with binary distribution (issue #2546) 2018-11-13 13:46:51 -05:00
Marshall Greenblatt
56227877aa Update to Chromium version 70.0.3538.102 2018-11-12 16:57:34 -05:00
Marshall Greenblatt
e710be4f64 cefclient: Fix new window always on top (issue #1468) 2018-11-05 13:47:17 -05:00
Marshall Greenblatt
458cc98590 Fix incorrect quota size (issue #2452) 2018-10-26 15:47:35 -04:00
Marshall Greenblatt
1d1fe01a48 Update to Chromium version 70.0.3538.77 2018-10-25 18:36:05 -04:00
Marshall Greenblatt
5e6699b223 Fix substitution of localized strings for directory listings (issue #2412) 2018-10-19 14:41:34 -04:00
Marshall Greenblatt
678fa78c28 Fix ArrayBuffer crashes and add performance test (issue #2521) 2018-10-10 16:14:26 +03:00
Marshall Greenblatt
924c2e339e Windows: Fix crashes when dragging an image with OSR enabled (issue #2525) 2018-10-10 14:46:14 +03:00
Marshall Greenblatt
c8ac6c879d Linux: cefclient: Fix crash when creating popup window (issue #2512) 2018-10-10 13:49:22 +03:00
Isaac Devine
5969b2bbb8 Windows: Fix hidden dropdowns when the window is topmost (issue #1468)
Also add a --always-on-top flag to cefclient to allow easier testing of this
behavior on Windows and Linux.
2018-10-10 12:12:29 +03:00
Marshall Greenblatt
fbc59483b9 Fix crash using CefCookieManager::SetStoragePath (issue #2522) 2018-10-08 19:12:47 +03:00
Marshall Greenblatt
dcdb070ecd macOS: Fix crash when showing a select popup with CefDoMessageLoopWork (issue #2495) 2018-09-28 16:30:38 +02:00
Marshall Greenblatt
b69a4a2e3d Add missing include for DISALLOW_COPY_AND_ASSIGN 2018-09-28 15:50:01 +02:00
Marshall Greenblatt
df6fb4f06e Update to Chromium version 70.0.3538.35 2018-09-28 15:40:26 +02:00
Marshall Greenblatt
b8ca094aca Fix redraw of OSR PDF viewer (issue #2507) 2018-09-27 16:02:55 +02:00
Marshall Greenblatt
01ef24d928 Fix DCHECK when mouse wheel deltas are 0 (issue #2515) 2018-09-27 14:24:45 +02:00
Marshall Greenblatt
ce3a5d5a7b Linux: Add missing return statement (issue #2014) 2018-09-25 13:25:08 +02:00
Marshall Greenblatt
36bc0371bf Linux: Add missing use_gtk check (issue #2014) 2018-09-24 16:12:16 +02:00
Marshall Greenblatt
391685c279 Add TS_PROCESS_OOM termination status (issue #2510) 2018-09-24 10:52:22 +02:00
Marshall Greenblatt
7016b2def6 Fix crash when high contrast themes are enabled (issue #2508) 2018-09-21 16:37:00 +02:00
Marshall Greenblatt
f9b6257652 Windows: cmake: Add VS2017 15.8 build support 2018-09-21 11:13:46 +02:00
Marshall Greenblatt
6d61f0c90f Linux: Add multi-threaded message loop support (issue #2512) 2018-09-20 15:26:54 +02:00
Marshall Greenblatt
006d0629a0 Fix crash when hovering buttons in OSR PDF viewer (issue #2488) 2018-09-14 11:19:44 +02:00
Marshall Greenblatt
8f5df4027b Remove Singleton patches which are no longer required (issue #2362) 2018-09-06 21:54:33 +02:00
Marshall Greenblatt
1489b9dde4 Windows: Fix DCHECKs during shutdown with multi-threaded message loop mode (issue #2362) 2018-09-06 17:35:58 +02:00
Marshall Greenblatt
e858849615 Fix external message pump (issue #2493) 2018-09-06 14:43:20 +02:00
Marshall Greenblatt
876e82f444 Linux: Zero initialize MwmHints (issue #2492) 2018-09-06 13:49:39 +02:00
Marshall Greenblatt
74b4a5fe27 macOS: Fix crash when closing full-screen window (issue #2491) 2018-09-06 13:49:33 +02:00
Marshall Greenblatt
b3f2995808 Linux: Remove GTK build dependency (issue #2014) 2018-09-06 11:34:40 +02:00
Marshall Greenblatt
5fa11acf79 Update to Chromium version 70.0.3538.7 2018-09-05 22:22:57 +02:00
Marshall Greenblatt
a64237bcb0 Update to Chromium version 70.0.3538.0 (#587811)
Known issues:
- The CefLoadCRLSetsFile function needs to be re-implemented (see issue #2497).
- Linux: GTK2 support has been removed. The cefclient sample needs to be updated
  to use GTK3 (see issue #2014).
2018-09-05 15:42:42 +02:00
Marshall Greenblatt
ea0e213bef Update to Chromium version 70.0.3516.0 (#581409) 2018-08-10 11:31:08 -04:00
Marshall Greenblatt
a659b48fd1 Update to Chromium version 70.0.3507.0 (#578961) 2018-08-02 15:15:23 -04:00
Marshall Greenblatt
4cc3a221c3 macOS: Update README.txt for distribution content changes 2018-07-30 16:15:19 -04:00
Marshall Greenblatt
dec98a5534 macOS: Add support for and enable the V2 sandbox (issue #2459)
The CEF_USE_SANDBOX define is now used on all platforms.
2018-07-27 22:33:31 -04:00
Marshall Greenblatt
fcad76b405 macOS: Load the CEF framework using dlopen instead of direct linking (issue #2459)
This is a prerequisite for using the Chromium V2 sandbox.
2018-07-27 17:36:49 -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
393 changed files with 9214 additions and 4168 deletions

181
BUILD.gn
View File

@@ -112,6 +112,7 @@ 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")
@@ -349,6 +350,8 @@ static_library("libcef_static") {
"libcef/browser/extensions/component_extension_resource_manager.h",
"libcef/browser/extensions/extensions_api_client.cc",
"libcef/browser/extensions/extensions_api_client.h",
"libcef/browser/extensions/extensions_browser_api_provider.cc",
"libcef/browser/extensions/extensions_browser_api_provider.h",
"libcef/browser/extensions/extensions_browser_client.cc",
"libcef/browser/extensions/extensions_browser_client.h",
"libcef/browser/extensions/extension_background_host.cc",
@@ -402,6 +405,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",
@@ -519,6 +524,8 @@ static_library("libcef_static") {
"libcef/common/drag_data_impl.h",
"libcef/common/extensions/chrome_generated_schemas.cc",
"libcef/common/extensions/chrome_generated_schemas.h",
"libcef/common/extensions/extensions_api_provider.cc",
"libcef/common/extensions/extensions_api_provider.h",
"libcef/common/extensions/extensions_client.cc",
"libcef/common/extensions/extensions_client.h",
"libcef/common/extensions/extensions_util.cc",
@@ -634,9 +641,7 @@ static_library("libcef_static") {
]
deps = [
# Generate pack files and associated CEF header files.
":make_pack_header_resources",
":make_pack_header_strings",
":cef_make_headers",
# Generate API bindings for extensions.
# TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
@@ -674,6 +679,7 @@ static_library("libcef_static") {
"//components/printing/browser",
"//components/printing/common",
"//components/printing/renderer",
"//components/safe_browsing/db:test_database_manager",
"//components/services/pdf_compositor:pdf_compositor_manifest",
"//components/services/pdf_compositor/public/cpp:utils",
"//components/services/pdf_compositor/public/interfaces",
@@ -697,17 +703,17 @@ static_library("libcef_static") {
"//crypto",
"//device/base",
"//extensions/browser",
"//extensions/browser/api:api_registration",
"//extensions/browser:core_api_provider",
"//extensions/buildflags",
"//extensions/common/api",
"//extensions/common:core_api_provider",
"//extensions/renderer",
"//gpu",
"//ipc",
"//media",
"//media/blink",
"//net",
"//net:net_browser_services",
"//net:net_utility_services",
"//net/dns:mojo_client",
"//net:net_with_v8",
"//pdf",
"//ppapi/buildflags",
@@ -768,6 +774,7 @@ static_library("libcef_static") {
]
deps += [
"//chrome/install_static:secondary_module",
"//chrome_elf",
]
@@ -777,6 +784,8 @@ static_library("libcef_static") {
libs = [
"comctl32.lib",
# For D3D11_DECODER_PROFILE_H264_VLD_NOFGT.
"dxguid.lib",
]
}
@@ -797,7 +806,6 @@ static_library("libcef_static") {
deps += [
"//build/config/freetype",
"//services/ui:lib",
"//third_party/fontconfig",
]
}
@@ -918,7 +926,6 @@ static_library("libcef_static") {
]
deps += [
"//services/ui",
"//ui/aura",
"//ui/events",
"//ui/strings",
@@ -1002,6 +1009,10 @@ static_library("libcef_dll_wrapper") {
gypi_paths2.libcef_dll_wrapper_sources_common +
gypi_paths.autogen_client_side
if (is_mac) {
sources += gypi_paths2.libcef_dll_wrapper_sources_mac
}
defines = [ "WRAPPING_CEF_SHARED" ]
configs += [ ":libcef_dll_wrapper_config" ]
@@ -1022,6 +1033,15 @@ if (is_win) {
}
}
if (is_mac) {
static_library("cef_sandbox") {
sources = [ "libcef_dll/sandbox/sandbox_mac.mm" ]
# CEF sources use include paths relative to the CEF root directory.
include_dirs = [ "." ]
deps = [ "//sandbox/mac:seatbelt" ]
}
}
#
# Service manifests.
@@ -1311,6 +1331,14 @@ make_pack_header("strings") {
]
}
# Generate pack files and associated CEF header files.
group("cef_make_headers") {
deps = [
":make_pack_header_resources",
":make_pack_header_strings",
]
}
#
# libcef dll/framework target.
@@ -1386,11 +1414,58 @@ 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",
]
@@ -1407,19 +1482,16 @@ if (is_mac) {
# - crash_report_sender.app
deps = [
":cef_framework_angle_library",
":cef_framework_locales",
":cef_framework_resources",
":cef_framework_swiftshader_library",
":libcef_static",
]
# Both the main app executable and helper executables need to link the
# framework. Because they are at different directory depths, using
# @executable_path as the install_name would require using install_name_tool
# on one of the executables. However install_name_tool only operates
# in-place, which is problematic to express in GN. Instead, use rpath-based
# loading.
# We don't link the framework so just use the path from the main executable.
ldflags = [
"-Wl,-install_name,@rpath/Frameworks/$output_name.framework/$output_name",
"-Wl,-install_name,@executable_path/../Frameworks/$output_name.framework/$output_name",
"-compatibility_version",
cef_dylib_version,
"-current_version",
@@ -1450,7 +1522,6 @@ if (is_mac) {
deps = [
":libcef_static",
"//build/config:exe_and_shlib_deps",
]
if (is_win) {
@@ -1519,7 +1590,8 @@ if (is_mac) {
sources = invoker.helper_sources
deps = [
":cef_framework+link",
":cef_make_headers",
":cef_sandbox",
":libcef_dll_wrapper",
]
if (defined(invoker.helper_deps)) {
@@ -1528,12 +1600,16 @@ if (is_mac) {
ldflags = [
# The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
# so set rpath up to Contents/ so that the loader can find Frameworks/.
# so set rpath up to the base.
"-rpath",
"@executable_path/../../../..",
"@executable_path/../../../../../..",
]
info_plist_target = ":${app_name}_helper_plist"
if (defined(invoker.helper_defines)) {
defines = invoker.helper_defines
}
}
bundle_data("${app_name}_framework_bundle_data") {
@@ -1544,7 +1620,7 @@ if (is_mac) {
]
public_deps = [
":cef_framework+link",
":cef_framework",
":${app_name}_helper_app",
]
@@ -1570,6 +1646,7 @@ if (is_mac) {
sources = invoker.sources
deps = [
":libcef_dll_wrapper",
":${app_name}_framework_bundle_data",
]
if (defined(invoker.deps)) {
@@ -1580,12 +1657,9 @@ if (is_mac) {
libs = invoker.libs
}
ldflags = [
# The main app is at $app_name.app/Contents/MacOS/$app_name
# so set rpath up to Contents/ so that the loader can find Frameworks/.
"-rpath",
"@executable_path/../",
]
if (defined(invoker.defines)) {
defines = invoker.defines
}
info_plist_target = ":${app_name}_plist"
}
@@ -1637,19 +1711,21 @@ if (is_mac) {
helper_sources = gypi_paths2.includes_mac +
gypi_paths2.includes_common +
gypi_paths2.includes_wrapper +
gypi_paths2.includes_wrapper_mac +
gypi_paths2.shared_sources_common +
gypi_paths2.shared_sources_renderer +
gypi_paths2.shared_sources_mac_helper +
gypi_paths2.cefclient_sources_common +
gypi_paths2.cefclient_sources_renderer
helper_deps = [
":libcef_dll_wrapper",
helper_defines = [
"CEF_USE_SANDBOX",
]
info_plist = "tests/cefclient/resources/mac/Info.plist"
sources = gypi_paths2.includes_mac +
gypi_paths2.includes_common +
gypi_paths2.includes_wrapper +
gypi_paths2.includes_wrapper_mac +
gypi_paths2.shared_sources_browser +
gypi_paths2.shared_sources_common +
gypi_paths2.shared_sources_mac +
@@ -1661,12 +1737,14 @@ if (is_mac) {
":cefclient_resources_bundle_data_extensions_set_page_color",
":cefclient_resources_bundle_data_english",
":cefclient_xibs",
":libcef_dll_wrapper",
]
libs = [
"AppKit.framework",
"OpenGL.framework",
]
defines = [
"CEF_USE_SANDBOX",
]
}
@@ -1707,22 +1785,26 @@ if (is_mac) {
helper_sources = gypi_paths2.includes_mac +
gypi_paths2.includes_common +
gypi_paths2.includes_wrapper +
gypi_paths2.includes_wrapper_mac +
gypi_paths2.cefsimple_sources_mac_helper
helper_deps = [
":libcef_dll_wrapper",
helper_defines = [
"CEF_USE_SANDBOX",
]
info_plist = "tests/cefsimple/mac/Info.plist"
sources = gypi_paths2.includes_mac +
gypi_paths2.includes_common +
gypi_paths2.includes_wrapper +
gypi_paths2.includes_wrapper_mac +
gypi_paths2.cefsimple_sources_common +
gypi_paths2.cefsimple_sources_mac
deps = [
":cefsimple_resources_bundle_data",
":cefsimple_resources_bundle_data_english",
":cefsimple_xibs",
":libcef_dll_wrapper",
]
defines = [
"CEF_USE_SANDBOX",
]
}
@@ -1768,14 +1850,17 @@ if (is_mac) {
gypi_paths2.shared_sources_mac_helper +
gypi_paths2.ceftests_sources_mac_helper
helper_deps = [
":libcef_dll_wrapper",
"//testing/gtest",
]
helper_defines = [
"CEF_USE_SANDBOX",
]
info_plist = "tests/ceftests/resources/mac/Info.plist"
sources = gypi_paths2.includes_mac +
gypi_paths2.includes_common +
gypi_paths2.includes_wrapper +
gypi_paths2.includes_wrapper_mac +
gypi_paths2.shared_sources_browser +
gypi_paths2.shared_sources_common +
gypi_paths2.shared_sources_mac +
@@ -1785,12 +1870,14 @@ if (is_mac) {
":ceftests_resources_bundle_data",
":ceftests_resources_bundle_data_english",
":ceftests_xibs",
":libcef_dll_wrapper",
"//testing/gtest",
]
libs = [
"AppKit.framework",
]
defines = [
"CEF_USE_SANDBOX",
]
}
} else {
#
@@ -1845,7 +1932,10 @@ if (is_mac) {
deps = [
":libcef",
":libcef_dll_wrapper",
"//build/config:exe_and_shlib_deps",
]
defines = [
"CEF_USE_SANDBOX",
]
if (is_win) {
@@ -1857,9 +1947,8 @@ if (is_mac) {
configs -= [ "//build/config/win:console" ]
configs += [ "//build/config/win:windowed" ]
defines = [
defines += [
"CEF_USE_ATL",
"CEF_USE_SANDBOX",
]
deps += [
@@ -1919,7 +2008,10 @@ if (is_mac) {
deps = [
":libcef",
":libcef_dll_wrapper",
"//build/config:exe_and_shlib_deps",
]
defines = [
"CEF_USE_SANDBOX",
]
if (is_win) {
@@ -1930,10 +2022,6 @@ if (is_mac) {
configs -= [ "//build/config/win:console" ]
configs += [ "//build/config/win:windowed" ]
defines = [
"CEF_USE_SANDBOX",
]
deps += [
":cef_sandbox",
"//build/win:default_exe_manifest",
@@ -1988,18 +2076,17 @@ if (is_mac) {
deps = [
":libcef",
":libcef_dll_wrapper",
"//build/config:exe_and_shlib_deps",
"//testing/gtest",
]
defines = [
"CEF_USE_SANDBOX",
]
if (is_win) {
sources += gypi_paths2.shared_sources_win +
gypi_paths2.ceftests_sources_win
defines = [
"CEF_USE_SANDBOX",
]
deps += [
":cef_sandbox",
"//build/win:default_exe_manifest",

View File

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

View File

@@ -41,9 +41,11 @@
'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_*',

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',
@@ -66,6 +65,9 @@
'include/wrapper/cef_xml_object.h',
'include/wrapper/cef_zip_archive.h',
],
'includes_wrapper_mac': [
'include/wrapper/cef_library_loader.h',
],
'includes_win': [
'include/base/internal/cef_atomicops_x86_msvc.h',
'include/base/internal/cef_bind_internal_win.h',
@@ -77,6 +79,7 @@
'include/base/internal/cef_atomicops_atomicword_compat.h',
'include/base/internal/cef_atomicops_mac.h',
'include/cef_application_mac.h',
'include/cef_sandbox_mac.h',
'include/internal/cef_mac.h',
'include/internal/cef_types_mac.h',
],
@@ -115,7 +118,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': [
@@ -143,6 +145,10 @@
'libcef_dll/wrapper/libcef_dll_wrapper.cc',
'libcef_dll/wrapper/libcef_dll_wrapper2.cc',
],
'libcef_dll_wrapper_sources_mac': [
'libcef_dll/wrapper/cef_library_loader_mac.mm',
'libcef_dll/wrapper/libcef_dll_dylib.cc',
],
'shared_sources_browser': [
'tests/shared/browser/client_app_browser.cc',
'tests/shared/browser/client_app_browser.h',
@@ -370,6 +376,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',
@@ -379,6 +387,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

@@ -31,10 +31,11 @@ macro(PRINT_CEF_CONFIG)
endif()
if(OS_WINDOWS)
message(STATUS "CEF Windows sandbox: ${USE_SANDBOX}")
message(STATUS "Visual Studio ATL support: ${USE_ATL}")
endif()
message(STATUS "CEF sandbox: ${USE_SANDBOX}")
set(_libraries ${CEF_STANDARD_LIBS})
if(OS_WINDOWS AND USE_SANDBOX)
list(APPEND _libraries ${CEF_SANDBOX_STANDARD_LIBS})
@@ -185,22 +186,6 @@ endif(OS_LINUX)
if(OS_MACOSX)
# Fix the framework rpath in the helper executable.
macro(FIX_MACOSX_HELPER_FRAMEWORK_RPATH target)
# The helper is in $app_name.app/Contents/Frameworks/$app_name Helper.app/Contents/MacOS/
# so set rpath up to Contents/ so that the loader can find Frameworks/.
set_target_properties(${target} PROPERTIES INSTALL_RPATH "@executable_path/../../../..")
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
endmacro()
# Fix the framework rpath in the main executable.
macro(FIX_MACOSX_MAIN_FRAMEWORK_RPATH target)
# The main app is at $app_name.app/Contents/MacOS/$app_name
# so set rpath up to Contents/ so that the loader can find Frameworks/.
set_target_properties(${target} PROPERTIES INSTALL_RPATH "@executable_path/..")
set_target_properties(${target} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
endmacro()
# Manually process and copy over resource files.
macro(COPY_MACOSX_RESOURCES resource_list prefix_list target source_dir app_path)
foreach(FILENAME ${resource_list})

View File

@@ -66,6 +66,10 @@ list(APPEND CEF_COMPILER_DEFINES
)
# Configure use of the sandbox.
option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
#
# Linux configuration.
#
@@ -217,6 +221,12 @@ if(OS_LINUX)
icudtl.dat
locales
)
if(USE_SANDBOX)
list(APPEND CEF_COMPILER_DEFINES
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
)
endif()
endif()
@@ -314,9 +324,15 @@ if(OS_MACOSX)
set(CEF_BINARY_DIR_DEBUG "${_CEF_ROOT}/Debug")
set(CEF_BINARY_DIR_RELEASE "${_CEF_ROOT}/Release")
# CEF library paths.
set(CEF_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/Chromium Embedded Framework.framework/Chromium Embedded Framework")
set(CEF_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/Chromium Embedded Framework.framework/Chromium Embedded Framework")
if(USE_SANDBOX)
list(APPEND CEF_COMPILER_DEFINES
CEF_USE_SANDBOX # Used by apps to test if the sandbox is enabled
)
# CEF sandbox library paths.
set(CEF_SANDBOX_LIB_DEBUG "${CEF_BINARY_DIR_DEBUG}/cef_sandbox.a")
set(CEF_SANDBOX_LIB_RELEASE "${CEF_BINARY_DIR_RELEASE}/cef_sandbox.a")
endif()
endif()
@@ -333,8 +349,6 @@ if(OS_WINDOWS)
set(CMAKE_CXX_FLAGS_RELEASE "")
endif()
# Configure use of the sandbox.
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. For a list of all version numbers see
@@ -346,6 +360,7 @@ if(OS_WINDOWS)
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)
@@ -464,6 +479,7 @@ if(OS_WINDOWS)
dbghelp.lib
psapi.lib
version.lib
wbemuuid.lib
winmm.lib
)

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 {
@@ -60,6 +60,7 @@ namespace cef_subtle {
class RefCountedBase {
public:
bool HasOneRef() const { return ref_count_ == 1; }
bool HasAtLeastOneRef() const { return ref_count_ >= 1; }
protected:
RefCountedBase()
@@ -78,10 +79,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 +87,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,14 +105,13 @@ class RefCountedBase {
mutable bool in_dtor_;
#endif
DFAKE_MUTEX(add_release_);
DISALLOW_COPY_AND_ASSIGN(RefCountedBase);
};
class RefCountedThreadSafeBase {
public:
bool HasOneRef() const;
bool HasAtLeastOneRef() const;
protected:
RefCountedThreadSafeBase();

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

@@ -69,6 +69,11 @@ typedef struct _cef_base_ref_counted_t {
// Returns true (1) if the current reference count is 1.
///
int(CEF_CALLBACK* has_one_ref)(struct _cef_base_ref_counted_t* self);
///
// Returns true (1) if the current reference count is at least 1.
///
int(CEF_CALLBACK* has_at_least_one_ref)(struct _cef_base_ref_counted_t* self);
} cef_base_ref_counted_t;
///

View File

@@ -68,6 +68,11 @@ class CefBaseRefCounted {
///
virtual bool HasOneRef() const = 0;
///
// Returns true if the reference count is at least 1.
///
virtual bool HasAtLeastOneRef() const = 0;
protected:
virtual ~CefBaseRefCounted() {}
};
@@ -102,6 +107,13 @@ class CefRefCount {
///
bool HasOneRef() const { return base::AtomicRefCountIsOne(&ref_count_); }
///
// Returns true if the reference count is at least 1.
///
bool HasAtLeastOneRef() const {
return !base::AtomicRefCountIsZero(&ref_count_);
}
private:
mutable base::AtomicRefCount ref_count_;
DISALLOW_COPY_AND_ASSIGN(CefRefCount);
@@ -122,6 +134,9 @@ class CefRefCount {
return false; \
} \
bool HasOneRef() const OVERRIDE { return ref_count_.HasOneRef(); } \
bool HasAtLeastOneRef() const OVERRIDE { \
return ref_count_.HasAtLeastOneRef(); \
} \
\
private: \
CefRefCount ref_count_;

87
include/cef_sandbox_mac.h Normal file
View File

@@ -0,0 +1,87 @@
// Copyright (c) 2018 Marshall A. Greenblatt. 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_CEF_SANDBOX_MAC_H_
#define CEF_INCLUDE_CEF_SANDBOX_MAC_H_
#pragma once
#include "include/base/cef_build.h"
#if defined(OS_MACOSX)
#ifdef __cplusplus
extern "C" {
#endif
// The sandbox is used to restrict sub-processes (renderer, plugin, GPU, etc)
// from directly accessing system resources. This helps to protect the user
// from untrusted and potentially malicious Web content.
// See http://www.chromium.org/developers/design-documents/sandbox for
// complete details.
//
// To enable the sandbox on macOS the following requirements must be met:
// 1. Link the helper process executable with the cef_sandbox static library.
// 2. Call the cef_sandbox_initialize() function at the beginning of the
// helper executable main() function and before loading the CEF framework
// library. See include/wrapper/cef_library_loader.h for example usage.
///
// Initialize the sandbox for this process. Returns the sandbox context
// handle on success or NULL on failure. The returned handle should be
// passed to cef_sandbox_destroy() immediately before process termination.
///
void* cef_sandbox_initialize(int argc, char** argv);
///
// Destroy the specified sandbox context handle.
///
void cef_sandbox_destroy(void* sandbox_context);
#ifdef __cplusplus
}
///
// Scoped helper for managing the life span of a sandbox context handle.
///
class CefScopedSandboxContext {
public:
CefScopedSandboxContext();
~CefScopedSandboxContext();
// Load the sandbox for this process. Returns true on success.
bool Initialize(int argc, char** argv);
private:
void* sandbox_context_;
};
#endif // __cplusplus
#endif // defined(OS_MACOSX)
#endif // CEF_INCLUDE_CEF_SANDBOX_MAC_H_

View File

@@ -181,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;
@@ -789,6 +789,11 @@ typedef enum {
// Segmentation fault.
///
TS_PROCESS_CRASHED,
///
// Out of memory. Some platforms may use TS_PROCESS_CRASHED instead.
///
TS_PROCESS_OOM,
} cef_termination_status_t;
///

View File

@@ -0,0 +1,128 @@
// Copyright (c) 2018 Marshall A. Greenblatt. 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_WRAPPER_CEF_LIBRARY_LOADER_H_
#define CEF_INCLUDE_WRAPPER_CEF_LIBRARY_LOADER_H_
#pragma once
#include "include/base/cef_build.h"
#ifdef __cplusplus
#include <string>
#include "include/base/cef_macros.h"
extern "C" {
#endif // __cplusplus
///
// Load the CEF library at the specified |path|. Returns true (1) on
// success and false (0) on failure.
///
int cef_load_library(const char* path);
///
// Unload the CEF library that was previously loaded. Returns true (1)
// on success and false (0) on failure.
///
int cef_unload_library();
#ifdef __cplusplus
}
#if defined(OS_MACOSX)
///
// Scoped helper for loading and unloading the CEF framework library at
// runtime from the expected location in the app bundle. Loading at runtime
// instead of linking directly is a requirement of the macOS sandbox
// implementation.
//
// Example usage in the main process:
//
// #include "include/wrapper/cef_library_loader.h"
//
// int main(int argc, char* argv[]) {
// // Dynamically load the CEF framework library.
// CefScopedLibraryLoader library_loader;
// if (!library_loader.LoadInMain())
// return 1;
//
// // Continue with CEF initialization...
// }
//
// Example usage in the helper process:
//
// #include "include/cef_sandbox_mac.h"
// #include "include/wrapper/cef_library_loader.h"
//
// int main(int argc, char* argv[]) {
// // Initialize the macOS sandbox for this helper process.
// CefScopedSandboxContext sandbox_context;
// if (!sandbox_context.Initialize(argc, argv))
// return 1;
//
// // Dynamically load the CEF framework library.
// CefScopedLibraryLoader library_loader;
// if (!library_loader.LoadInHelper())
// return 1;
//
// // Continue with CEF initialization...
// }
///
class CefScopedLibraryLoader {
public:
CefScopedLibraryLoader();
~CefScopedLibraryLoader();
///
// Load the CEF framework in the main process from the expected app
// bundle location relative to the executable. Returns true if the
// load succeeds.
///
bool LoadInMain() { return Load(false); }
///
// Load the CEF framework in the helper process from the expected app
// bundle location relative to the executable. Returns true if the
// load succeeds.
///
bool LoadInHelper() { return Load(true); }
private:
bool Load(bool helper);
bool loaded_;
DISALLOW_COPY_AND_ASSIGN(CefScopedLibraryLoader);
};
#endif // defined(OS_MACOSX)
#endif // __cplusplus
#endif // CEF_INCLUDE_WRAPPER_CEF_LIBRARY_LOADER_H_

View File

@@ -105,6 +105,10 @@ void CefBrowserContext::Shutdown() {
}
}
base::FilePath CefBrowserContext::GetCachePath() const {
return GetPath();
}
content::ResourceContext* CefBrowserContext::GetResourceContext() {
return resource_context_.get();
}
@@ -130,6 +134,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

@@ -137,6 +137,7 @@ class CefBrowserContext : public ChromeProfileStub {
virtual void Initialize();
// BrowserContext methods.
base::FilePath GetCachePath() const override;
content::ResourceContext* GetResourceContext() override;
net::URLRequestContextGetter* GetRequestContext() override;
net::URLRequestContextGetter* CreateMediaRequestContext() override;
@@ -146,6 +147,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

@@ -418,7 +418,8 @@ CefBrowserContextImpl::GetSSLHostStateDelegate() {
return ssl_host_state_delegate_.get();
}
content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() {
content::PermissionControllerDelegate*
CefBrowserContextImpl::GetPermissionControllerDelegate() {
return nullptr;
}
@@ -518,7 +519,7 @@ HostContentSettingsMap* CefBrowserContextImpl::GetHostContentSettingsMap() {
// that can be stored in the settings map (for example, default values set
// via DefaultProvider::SetWebsiteSetting).
host_content_settings_map_ =
new HostContentSettingsMap(GetPrefs(), false, false, false);
new HostContentSettingsMap(GetPrefs(), false, false, false, false);
// Change the default plugin policy.
const base::CommandLine* command_line =

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()

View File

@@ -224,10 +224,17 @@ bool CefBrowserHost::CreateBrowser(
return false;
}
if (windowInfo.windowless_rendering_enabled &&
!CefContext::Get()->settings().windowless_rendering_enabled) {
LOG(ERROR) << "Creating a windowless browser without setting "
"CefSettings.windowless_rendering_enabled may result in "
"reduced performance or runtime errors.";
}
// Create the browser on the UI thread.
CreateBrowserHelper* helper = new CreateBrowserHelper(
windowInfo, client, url, settings, request_context);
CEF_POST_TASK(CEF_UIT, base::Bind(CreateBrowserWithHelper, helper));
CEF_POST_TASK(CEF_UIT, base::BindOnce(CreateBrowserWithHelper, helper));
return true;
}
@@ -268,6 +275,11 @@ CefRefPtr<CefBrowser> CefBrowserHost::CreateBrowserSync(
create_params.window_info.reset(new CefWindowInfo(windowInfo));
create_params.client = client;
create_params.url = GURL(url.ToString());
if (!url.empty() && !create_params.url.is_valid() &&
!create_params.url.has_scheme()) {
std::string new_url = std::string("http://") + url.ToString();
create_params.url = GURL(new_url);
}
create_params.settings = settings;
create_params.request_context = request_context;
@@ -615,8 +627,8 @@ void CefBrowserHostImpl::CloseBrowser(bool force_close) {
CloseContents(contents);
}
} else {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::CloseBrowser, this,
force_close));
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::CloseBrowser,
this, force_close));
}
}
@@ -644,7 +656,7 @@ bool CefBrowserHostImpl::TryCloseBrowser() {
void CefBrowserHostImpl::SetFocus(bool focus) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::SetFocus, this, focus));
base::BindOnce(&CefBrowserHostImpl::SetFocus, this, focus));
return;
}
@@ -698,8 +710,8 @@ void CefBrowserHostImpl::SetZoomLevel(double zoomLevel) {
if (web_contents())
content::HostZoomMap::SetZoomLevel(web_contents(), zoomLevel);
} else {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SetZoomLevel, this,
zoomLevel));
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::SetZoomLevel,
this, zoomLevel));
}
}
@@ -712,9 +724,9 @@ void CefBrowserHostImpl::RunFileDialog(
CefRefPtr<CefRunFileDialogCallback> callback) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::RunFileDialog, this, mode,
title, default_file_path, accept_filters,
selected_accept_filter, callback));
base::BindOnce(&CefBrowserHostImpl::RunFileDialog, this, mode,
title, default_file_path, accept_filters,
selected_accept_filter, callback));
return;
}
@@ -726,8 +738,8 @@ void CefBrowserHostImpl::RunFileDialog(
void CefBrowserHostImpl::StartDownload(const CefString& url) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::StartDownload, this, url));
CEF_POST_TASK(
CEF_UIT, base::BindOnce(&CefBrowserHostImpl::StartDownload, this, url));
return;
}
@@ -761,9 +773,10 @@ void CefBrowserHostImpl::DownloadImage(
bool bypass_cache,
CefRefPtr<CefDownloadImageCallback> callback) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::DownloadImage, this,
image_url, is_favicon, max_image_size,
bypass_cache, callback));
CEF_POST_TASK(
CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::DownloadImage, this, image_url,
is_favicon, max_image_size, bypass_cache, callback));
return;
}
@@ -779,7 +792,7 @@ void CefBrowserHostImpl::DownloadImage(
web_contents()->DownloadImage(
gurl, is_favicon, max_image_size * gfx::ImageSkia::GetMaxSupportedScale(),
bypass_cache, base::Bind(OnDownloadImage, max_image_size, callback));
bypass_cache, base::BindOnce(OnDownloadImage, max_image_size, callback));
}
void CefBrowserHostImpl::Print() {
@@ -790,7 +803,7 @@ void CefBrowserHostImpl::Print() {
printing::CefPrintViewManager::FromWebContents(actionable_contents)
->PrintNow(actionable_contents->GetRenderViewHost()->GetMainFrame());
} else {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::Print, this));
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::Print, this));
}
}
@@ -811,8 +824,8 @@ void CefBrowserHostImpl::PrintToPDF(const CefString& path,
->PrintToPDF(actionable_contents->GetMainFrame(), base::FilePath(path),
settings, pdf_callback);
} else {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::PrintToPDF, this,
path, settings, callback));
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::PrintToPDF, this,
path, settings, callback));
}
}
@@ -840,8 +853,8 @@ void CefBrowserHostImpl::Find(int identifier,
web_contents()->Find(identifier, searchText, options);
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::Find, this, identifier,
searchText, forward, matchCase, findNext));
base::BindOnce(&CefBrowserHostImpl::Find, this, identifier,
searchText, forward, matchCase, findNext));
}
}
@@ -855,8 +868,8 @@ void CefBrowserHostImpl::StopFinding(bool clearSelection) {
: content::STOP_FIND_ACTION_KEEP_SELECTION;
web_contents()->StopFinding(action);
} else {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::StopFinding, this,
clearSelection));
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::StopFinding,
this, clearSelection));
}
}
@@ -884,7 +897,7 @@ void CefBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo,
} else {
ShowDevToolsHelper* helper = new ShowDevToolsHelper(
this, windowInfo, client, settings, inspect_element_at);
CEF_POST_TASK(CEF_UIT, base::Bind(ShowDevToolsWithHelper, helper));
CEF_POST_TASK(CEF_UIT, base::BindOnce(ShowDevToolsWithHelper, helper));
}
}
@@ -895,7 +908,7 @@ void CefBrowserHostImpl::CloseDevTools() {
devtools_frontend_->Close();
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::CloseDevTools, this));
base::BindOnce(&CefBrowserHostImpl::CloseDevTools, this));
}
}
@@ -916,8 +929,9 @@ void CefBrowserHostImpl::GetNavigationEntries(
return;
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::GetNavigationEntries,
this, visitor, current_only));
CEF_POST_TASK(
CEF_UIT, base::BindOnce(&CefBrowserHostImpl::GetNavigationEntries, this,
visitor, current_only));
return;
}
@@ -973,8 +987,8 @@ void CefBrowserHostImpl::SetAccessibilityState(
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::SetAccessibilityState, this,
accessibility_state));
base::BindOnce(&CefBrowserHostImpl::SetAccessibilityState,
this, accessibility_state));
return;
}
@@ -997,8 +1011,9 @@ void CefBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SetAutoResizeEnabled,
this, enabled, min_size, max_size));
CEF_POST_TASK(
CEF_UIT, base::BindOnce(&CefBrowserHostImpl::SetAutoResizeEnabled, this,
enabled, min_size, max_size));
return;
}
@@ -1039,8 +1054,9 @@ bool CefBrowserHostImpl::IsWindowRenderingDisabled() {
void CefBrowserHostImpl::ReplaceMisspelling(const CefString& word) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::ReplaceMisspelling,
this, word));
CEF_POST_TASK(
CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::ReplaceMisspelling, this, word));
return;
}
@@ -1050,8 +1066,9 @@ void CefBrowserHostImpl::ReplaceMisspelling(const CefString& word) {
void CefBrowserHostImpl::AddWordToDictionary(const CefString& word) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::AddWordToDictionary,
this, word));
CEF_POST_TASK(
CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::AddWordToDictionary, this, word));
return;
}
@@ -1073,7 +1090,8 @@ void CefBrowserHostImpl::AddWordToDictionary(const CefString& word) {
void CefBrowserHostImpl::WasResized() {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::WasResized, this));
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::WasResized, this));
return;
}
@@ -1091,7 +1109,7 @@ void CefBrowserHostImpl::WasHidden(bool hidden) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHost::WasHidden, this, hidden));
base::BindOnce(&CefBrowserHost::WasHidden, this, hidden));
return;
}
@@ -1110,7 +1128,7 @@ void CefBrowserHostImpl::NotifyScreenInfoChanged() {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(
CEF_UIT,
base::Bind(&CefBrowserHostImpl::NotifyScreenInfoChanged, this));
base::BindOnce(&CefBrowserHostImpl::NotifyScreenInfoChanged, this));
return;
}
@@ -1128,7 +1146,7 @@ void CefBrowserHostImpl::Invalidate(PaintElementType type) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::Invalidate, this, type));
base::BindOnce(&CefBrowserHostImpl::Invalidate, this, type));
return;
}
@@ -1140,8 +1158,8 @@ void CefBrowserHostImpl::Invalidate(PaintElementType type) {
void CefBrowserHostImpl::SendKeyEvent(const CefKeyEvent& event) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::SendKeyEvent, this, event));
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::SendKeyEvent,
this, event));
return;
}
@@ -1160,8 +1178,9 @@ void CefBrowserHostImpl::SendMouseClickEvent(const CefMouseEvent& event,
bool mouseUp,
int clickCount) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SendMouseClickEvent,
this, event, type, mouseUp, clickCount));
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::SendMouseClickEvent, this,
event, type, mouseUp, clickCount));
return;
}
@@ -1177,8 +1196,9 @@ void CefBrowserHostImpl::SendMouseClickEvent(const CefMouseEvent& event,
void CefBrowserHostImpl::SendMouseMoveEvent(const CefMouseEvent& event,
bool mouseLeave) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SendMouseMoveEvent,
this, event, mouseLeave));
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::SendMouseMoveEvent, this,
event, mouseLeave));
return;
}
@@ -1193,9 +1213,15 @@ void CefBrowserHostImpl::SendMouseMoveEvent(const CefMouseEvent& event,
void CefBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event,
int deltaX,
int deltaY) {
if (deltaX == 0 && deltaY == 0) {
// Nothing to do.
return;
}
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SendMouseWheelEvent,
this, event, deltaX, deltaY));
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::SendMouseWheelEvent, this,
event, deltaX, deltaY));
return;
}
@@ -1213,8 +1239,9 @@ void CefBrowserHostImpl::SendFocusEvent(bool setFocus) {
void CefBrowserHostImpl::SendCaptureLostEvent() {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::SendCaptureLostEvent, this));
CEF_POST_TASK(
CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::SendCaptureLostEvent, this));
return;
}
@@ -1229,7 +1256,7 @@ void CefBrowserHostImpl::NotifyMoveOrResizeStarted() {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(
CEF_UIT,
base::Bind(&CefBrowserHostImpl::NotifyMoveOrResizeStarted, this));
base::BindOnce(&CefBrowserHostImpl::NotifyMoveOrResizeStarted, this));
return;
}
@@ -1253,8 +1280,8 @@ int CefBrowserHostImpl::GetWindowlessFrameRate() {
void CefBrowserHostImpl::SetWindowlessFrameRate(int frame_rate) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::SetWindowlessFrameRate, this,
frame_rate));
base::BindOnce(&CefBrowserHostImpl::SetWindowlessFrameRate,
this, frame_rate));
return;
}
@@ -1278,16 +1305,17 @@ bool CefBrowserHostImpl::CanGoBack() {
void CefBrowserHostImpl::GoBack() {
if (CEF_CURRENTLY_ON_UIT()) {
if (frame_destruction_pending_) {
// Try again after frame destruction has completed.
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::GoBack, this));
if (navigation_locked()) {
// Try again after the lock has been released.
set_pending_navigation_action(
base::BindOnce(&CefBrowserHostImpl::GoBack, this));
return;
}
if (web_contents() && web_contents()->GetController().CanGoBack())
web_contents()->GetController().GoBack();
} else {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::GoBack, this));
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::GoBack, this));
}
}
@@ -1298,16 +1326,18 @@ bool CefBrowserHostImpl::CanGoForward() {
void CefBrowserHostImpl::GoForward() {
if (CEF_CURRENTLY_ON_UIT()) {
if (frame_destruction_pending_) {
// Try again after frame destruction has completed.
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::GoForward, this));
if (navigation_locked()) {
// Try again after the lock has been released.
set_pending_navigation_action(
base::BindOnce(&CefBrowserHostImpl::GoForward, this));
return;
}
if (web_contents() && web_contents()->GetController().CanGoForward())
web_contents()->GetController().GoForward();
} else {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::GoForward, this));
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::GoForward, this));
}
}
@@ -1318,25 +1348,26 @@ bool CefBrowserHostImpl::IsLoading() {
void CefBrowserHostImpl::Reload() {
if (CEF_CURRENTLY_ON_UIT()) {
if (frame_destruction_pending_) {
// Try again after frame destruction has completed.
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::Reload, this));
if (navigation_locked()) {
// Try again after the lock has been released.
set_pending_navigation_action(
base::BindOnce(&CefBrowserHostImpl::Reload, this));
return;
}
if (web_contents())
web_contents()->GetController().Reload(content::ReloadType::NORMAL, true);
} else {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::Reload, this));
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::Reload, this));
}
}
void CefBrowserHostImpl::ReloadIgnoreCache() {
if (CEF_CURRENTLY_ON_UIT()) {
if (frame_destruction_pending_) {
// Try again after frame destruction has completed.
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::ReloadIgnoreCache, this));
if (navigation_locked()) {
// Try again after the lock has been released.
set_pending_navigation_action(
base::BindOnce(&CefBrowserHostImpl::ReloadIgnoreCache, this));
return;
}
@@ -1346,22 +1377,23 @@ void CefBrowserHostImpl::ReloadIgnoreCache() {
}
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::ReloadIgnoreCache, this));
base::BindOnce(&CefBrowserHostImpl::ReloadIgnoreCache, this));
}
}
void CefBrowserHostImpl::StopLoad() {
if (CEF_CURRENTLY_ON_UIT()) {
if (frame_destruction_pending_) {
// Try again after frame destruction has completed.
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::StopLoad, this));
if (navigation_locked()) {
// Try again after the lock has been released.
set_pending_navigation_action(
base::BindOnce(&CefBrowserHostImpl::StopLoad, this));
return;
}
if (web_contents())
web_contents()->Stop();
} else {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::StopLoad, this));
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::StopLoad, this));
}
}
@@ -1650,11 +1682,11 @@ void CefBrowserHostImpl::LoadURL(int64 frame_id,
if (frame_id == CefFrameHostImpl::kMainFrameId) {
// Go through the navigation controller.
if (CEF_CURRENTLY_ON_UIT()) {
if (frame_destruction_pending_) {
// Try again after frame destruction has completed.
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::LoadURL, this, frame_id,
url, referrer, transition, extra_headers));
if (navigation_locked()) {
// Try again after the lock has been released.
set_pending_navigation_action(
base::BindOnce(&CefBrowserHostImpl::LoadURL, this, frame_id, url,
referrer, transition, extra_headers));
return;
}
@@ -1678,9 +1710,9 @@ void CefBrowserHostImpl::LoadURL(int64 frame_id,
OnSetFocus(FOCUS_SOURCE_NAVIGATION);
}
} else {
CEF_POST_TASK(
CEF_UIT, base::Bind(&CefBrowserHostImpl::LoadURL, this, frame_id, url,
referrer, transition, extra_headers));
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::LoadURL, this, frame_id,
url, referrer, transition, extra_headers));
}
} else {
CefNavigateParams params(GURL(url), transition);
@@ -1739,8 +1771,9 @@ void CefBrowserHostImpl::SendCommand(
Send(new CefMsg_Request(MSG_ROUTING_NONE, params));
} else {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SendCommand, this,
frame_id, command, responseHandler));
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::SendCommand, this,
frame_id, command, responseHandler));
}
}
@@ -1780,9 +1813,10 @@ void CefBrowserHostImpl::SendCode(
Send(new CefMsg_Request(MSG_ROUTING_NONE, params));
} else {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::SendCode, this,
frame_id, is_javascript, code, script_url,
script_start_line, responseHandler));
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::SendCode, this, frame_id,
is_javascript, code, script_url,
script_start_line, responseHandler));
}
}
@@ -1794,7 +1828,7 @@ void CefBrowserHostImpl::ExecuteJavaScriptWithUserGestureForTests(
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(
CEF_UIT,
base::Bind(
base::BindOnce(
&CefBrowserHostImpl::ExecuteJavaScriptWithUserGestureForTests, this,
frame_id, javascript));
return;
@@ -1818,7 +1852,7 @@ void CefBrowserHostImpl::ExecuteJavaScriptWithUserGestureForTests(
void CefBrowserHostImpl::ViewText(const std::string& text) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::ViewText, this, text));
base::BindOnce(&CefBrowserHostImpl::ViewText, this, text));
return;
}
@@ -1841,7 +1875,7 @@ void CefBrowserHostImpl::HandleExternalProtocol(const GURL& url) {
} else {
CEF_POST_TASK(
CEF_UIT,
base::Bind(&CefBrowserHostImpl::HandleExternalProtocol, this, url));
base::BindOnce(&CefBrowserHostImpl::HandleExternalProtocol, this, url));
}
}
@@ -1883,8 +1917,8 @@ void CefBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
if (platform_delegate_)
platform_delegate_->SendFocusEvent(true);
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::OnSetFocus, this, source));
CEF_POST_TASK(
CEF_UIT, base::BindOnce(&CefBrowserHostImpl::OnSetFocus, this, source));
}
}
@@ -1952,9 +1986,10 @@ void CefBrowserHostImpl::ImeSetComposition(
}
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::ImeSetComposition, this, text,
underlines, replacement_range, selection_range));
CEF_POST_TASK(
CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::ImeSetComposition, this, text,
underlines, replacement_range, selection_range));
return;
}
@@ -1975,8 +2010,8 @@ void CefBrowserHostImpl::ImeCommitText(const CefString& text,
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::ImeCommitText, this, text,
replacement_range, relative_cursor_pos));
base::BindOnce(&CefBrowserHostImpl::ImeCommitText, this, text,
replacement_range, relative_cursor_pos));
return;
}
@@ -1995,8 +2030,8 @@ void CefBrowserHostImpl::ImeFinishComposingText(bool keep_selection) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::ImeFinishComposingText, this,
keep_selection));
base::BindOnce(&CefBrowserHostImpl::ImeFinishComposingText,
this, keep_selection));
return;
}
@@ -2013,8 +2048,9 @@ void CefBrowserHostImpl::ImeCancelComposition() {
}
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::ImeCancelComposition, this));
CEF_POST_TASK(
CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::ImeCancelComposition, this));
return;
}
@@ -2034,8 +2070,9 @@ void CefBrowserHostImpl::DragTargetDragEnter(
}
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::DragTargetDragEnter,
this, drag_data, event, allowed_ops));
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::DragTargetDragEnter, this,
drag_data, event, allowed_ops));
return;
}
@@ -2059,8 +2096,9 @@ void CefBrowserHostImpl::DragTargetDragOver(
}
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::DragTargetDragOver,
this, event, allowed_ops));
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::DragTargetDragOver, this,
event, allowed_ops));
return;
}
@@ -2077,8 +2115,8 @@ void CefBrowserHostImpl::DragTargetDragLeave() {
}
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragTargetDragLeave, this));
CEF_POST_TASK(CEF_UIT, base::BindOnce(
&CefBrowserHostImpl::DragTargetDragLeave, this));
return;
}
@@ -2095,8 +2133,8 @@ void CefBrowserHostImpl::DragTargetDrop(const CefMouseEvent& event) {
}
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragTargetDrop, this, event));
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostImpl::DragTargetDrop,
this, event));
return;
}
@@ -2115,7 +2153,7 @@ void CefBrowserHostImpl::DragSourceSystemDragEnded() {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(
CEF_UIT,
base::Bind(&CefBrowserHostImpl::DragSourceSystemDragEnded, this));
base::BindOnce(&CefBrowserHostImpl::DragSourceSystemDragEnded, this));
return;
}
@@ -2135,8 +2173,9 @@ void CefBrowserHostImpl::DragSourceEndedAt(
}
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefBrowserHostImpl::DragSourceEndedAt,
this, x, y, op));
CEF_POST_TASK(
CEF_UIT,
base::BindOnce(&CefBrowserHostImpl::DragSourceEndedAt, this, x, y, op));
return;
}
@@ -2552,7 +2591,7 @@ void CefBrowserHostImpl::ResizeDueToAutoResize(content::WebContents* source,
void CefBrowserHostImpl::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) {
content::MediaResponseCallback callback) {
CEF_REQUIRE_UIT();
content::MediaStreamDevices devices;
@@ -2561,8 +2600,8 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kEnableMediaStream)) {
// Cancel the request.
callback.Run(devices, content::MEDIA_DEVICE_PERMISSION_DENIED,
std::unique_ptr<content::MediaStreamUI>());
std::move(callback).Run(devices, content::MEDIA_DEVICE_PERMISSION_DENIED,
std::unique_ptr<content::MediaStreamUI>());
return;
}
@@ -2572,7 +2611,7 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
bool webcam_requested =
(request.video_type == content::MEDIA_DEVICE_VIDEO_CAPTURE);
bool screen_requested =
(request.video_type == content::MEDIA_DESKTOP_VIDEO_CAPTURE);
(request.video_type == content::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE);
if (microphone_requested || webcam_requested || screen_requested) {
// Pick the desired device or fall back to the first available of the
// given type.
@@ -2594,13 +2633,14 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
media_id =
content::DesktopMediaID::Parse(request.requested_video_device_id);
}
devices.push_back(content::MediaStreamDevice(
content::MEDIA_DESKTOP_VIDEO_CAPTURE, media_id.ToString(), "Screen"));
devices.push_back(
content::MediaStreamDevice(content::MEDIA_GUM_DESKTOP_VIDEO_CAPTURE,
media_id.ToString(), "Screen"));
}
}
callback.Run(devices, content::MEDIA_DEVICE_OK,
std::unique_ptr<content::MediaStreamUI>());
std::move(callback).Run(devices, content::MEDIA_DEVICE_OK,
std::unique_ptr<content::MediaStreamUI>());
}
bool CefBrowserHostImpl::CheckMediaAccessPermission(
@@ -2746,15 +2786,16 @@ void CefBrowserHostImpl::RenderProcessGone(base::TerminationStatus status) {
ts = TS_PROCESS_WAS_KILLED;
else if (status == base::TERMINATION_STATUS_PROCESS_CRASHED)
ts = TS_PROCESS_CRASHED;
else if (status == base::TERMINATION_STATUS_OOM)
ts = TS_PROCESS_OOM;
else if (status != base::TERMINATION_STATUS_ABNORMAL_TERMINATION)
return;
if (client_.get()) {
CefRefPtr<CefRequestHandler> handler = client_->GetRequestHandler();
if (handler.get()) {
frame_destruction_pending_ = true;
std::unique_ptr<NavigationLock> navigation_lock = CreateNavigationLock();
handler->OnRenderProcessTerminated(this, ts);
frame_destruction_pending_ = false;
}
}
}
@@ -2900,13 +2941,13 @@ bool CefBrowserHostImpl::OnMessageReceived(
}
void CefBrowserHostImpl::AccessibilityEventReceived(
const std::vector<content::AXEventNotificationDetails>& eventData) {
const content::AXEventNotificationDetails& content_event_bundle) {
// Only needed in windowless mode.
if (IsWindowless()) {
if (!web_contents() || !platform_delegate_)
return;
platform_delegate_->AccessibilityEventReceived(eventData);
platform_delegate_->AccessibilityEventReceived(content_event_bundle);
}
}
@@ -2945,6 +2986,38 @@ bool CefBrowserHostImpl::HasObserver(Observer* observer) const {
return observers_.HasObserver(observer);
}
CefBrowserHostImpl::NavigationLock::NavigationLock(
CefRefPtr<CefBrowserHostImpl> browser)
: browser_(browser) {
CEF_REQUIRE_UIT();
browser_->navigation_lock_count_++;
}
CefBrowserHostImpl::NavigationLock::~NavigationLock() {
CEF_REQUIRE_UIT();
if (--browser_->navigation_lock_count_ == 0) {
if (!browser_->pending_navigation_action_.is_null()) {
CEF_POST_TASK(CEF_UIT, std::move(browser_->pending_navigation_action_));
}
}
}
std::unique_ptr<CefBrowserHostImpl::NavigationLock>
CefBrowserHostImpl::CreateNavigationLock() {
return base::WrapUnique(new NavigationLock(this));
}
bool CefBrowserHostImpl::navigation_locked() const {
CEF_REQUIRE_UIT();
return navigation_lock_count_ > 0;
}
void CefBrowserHostImpl::set_pending_navigation_action(
base::OnceClosure action) {
CEF_REQUIRE_UIT();
pending_navigation_action_ = std::move(action);
}
// content::WebContentsObserver::OnMessageReceived() message handlers.
// -----------------------------------------------------------------------------
@@ -3118,7 +3191,6 @@ CefBrowserHostImpl::CefBrowserHostImpl(
main_frame_id_(CefFrameHostImpl::kInvalidFrameId),
focused_frame_id_(CefFrameHostImpl::kInvalidFrameId),
destruction_state_(DESTRUCTION_STATE_NONE),
frame_destruction_pending_(false),
window_destroyed_(false),
is_in_onsetfocus_(false),
focus_on_editable_field_(false),
@@ -3483,12 +3555,11 @@ void CefBrowserHostImpl::OnLoadError(CefRefPtr<CefFrame> frame,
if (client_.get()) {
CefRefPtr<CefLoadHandler> handler = client_->GetLoadHandler();
if (handler.get()) {
frame_destruction_pending_ = true;
std::unique_ptr<NavigationLock> navigation_lock = CreateNavigationLock();
// Notify the handler that loading has failed.
handler->OnLoadError(this, frame,
static_cast<cef_errorcode_t>(error_code),
net::ErrorToShortString(error_code), url.spec());
frame_destruction_pending_ = false;
}
}
}
@@ -3554,9 +3625,9 @@ void CefBrowserHostImpl::ConfigureAutoResize() {
bool CefBrowserHostImpl::Send(IPC::Message* message) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(
CEF_UIT, base::Bind(base::IgnoreResult(&CefBrowserHostImpl::Send), this,
message));
CEF_POST_TASK(CEF_UIT,
base::BindOnce(base::IgnoreResult(&CefBrowserHostImpl::Send),
this, message));
return true;
}

View File

@@ -474,7 +474,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
void RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) override;
content::MediaResponseCallback callback) override;
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
content::MediaStreamType type) override;
@@ -506,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;
@@ -522,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;
@@ -581,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,
@@ -687,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.
@@ -729,7 +749,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefDevToolsFrontend* devtools_frontend_;
// Observers that want to be notified of changes to this object.
base::ObserverList<Observer> observers_;
base::ObserverList<Observer>::Unchecked observers_;
// Used to provide unique incremental IDs for each find request.
int find_request_id_counter_ = 0;

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"
@@ -26,7 +25,7 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/task/post_task.h"
#include "chrome/browser/chrome_browser_main_extra_parts.h"
#include "chrome/browser/plugins/plugin_finder.h"
#include "content/public/browser/gpu_data_manager.h"
@@ -34,6 +33,7 @@
#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)
@@ -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();
@@ -178,7 +175,7 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
printing::CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt();
background_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits(
{base::TaskPriority::BACKGROUND,
{base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
user_visible_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits(
{base::TaskPriority::USER_VISIBLE,
@@ -222,16 +219,16 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
DCHECK(global_request_context_->HasOneRef());
global_request_context_ = NULL;
if (extensions::ExtensionsEnabled()) {
extensions::ExtensionsBrowserClient::Set(NULL);
extensions_browser_client_.reset();
}
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostMainMessageLoopRun();
}
void CefBrowserMainParts::PostDestroyThreads() {
if (extensions::ExtensionsEnabled()) {
extensions::ExtensionsBrowserClient::Set(NULL);
extensions_browser_client_.reset();
}
#if defined(USE_AURA)
// Delete the DesktopTestViewsDelegate.
delete views::ViewsDelegate::GetInstance();

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;
}
@@ -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

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

View File

@@ -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"
@@ -63,26 +62,26 @@ class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
: url_request_(url_request), task_runner_(task_runner) {}
// net::URLFetcherResponseWriter methods.
int Initialize(const net::CompletionCallback& callback) override {
int Initialize(net::CompletionOnceCallback callback) override {
return net::OK;
}
int Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) override {
net::CompletionOnceCallback callback) override {
if (url_request_.get()) {
task_runner_->PostTask(
FROM_HERE,
base::Bind(&CefURLFetcherResponseWriter::WriteOnClientThread,
url_request_, scoped_refptr<net::IOBuffer>(buffer),
num_bytes, callback,
num_bytes, base::Passed(std::move(callback)),
CefTaskRunnerImpl::GetCurrentTaskRunner()));
return net::ERR_IO_PENDING;
}
return num_bytes;
}
int Finish(int net_error, const net::CompletionCallback& callback) override {
int Finish(int net_error, net::CompletionOnceCallback callback) override {
if (url_request_.get())
url_request_ = NULL;
return net::OK;
@@ -93,7 +92,7 @@ class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
CefRefPtr<CefBrowserURLRequest> url_request,
scoped_refptr<net::IOBuffer> buffer,
int num_bytes,
const net::CompletionCallback& callback,
net::CompletionOnceCallback callback,
scoped_refptr<base::SequencedTaskRunner> source_message_loop_proxy) {
CefRefPtr<CefURLRequestClient> client = url_request->GetClient();
if (client.get())
@@ -102,12 +101,12 @@ class CefURLFetcherResponseWriter : public net::URLFetcherResponseWriter {
source_message_loop_proxy->PostTask(
FROM_HERE,
base::Bind(&CefURLFetcherResponseWriter::ContinueOnSourceThread,
num_bytes, callback));
num_bytes, base::Passed(std::move(callback))));
}
static void ContinueOnSourceThread(int num_bytes,
const net::CompletionCallback& callback) {
callback.Run(num_bytes);
net::CompletionOnceCallback callback) {
std::move(callback).Run(num_bytes);
}
CefRefPtr<CefBrowserURLRequest> url_request_;

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),
@@ -110,8 +111,8 @@ ChromeBrowserProcessStub::system_network_context_manager() {
return NULL;
}
content::NetworkConnectionTracker*
ChromeBrowserProcessStub::network_connection_tracker() {
network::NetworkQualityTracker*
ChromeBrowserProcessStub::network_quality_tracker() {
NOTREACHED();
return NULL;
}
@@ -138,6 +139,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;

View File

@@ -49,11 +49,13 @@ class ChromeBrowserProcessStub : public BrowserProcess,
rappor::RapporServiceImpl* rappor_service() override;
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;

View File

@@ -53,7 +53,6 @@ bool ChromeProfileStub::IsChild() const {
}
bool ChromeProfileStub::IsLegacySupervised() const {
NOTREACHED();
return false;
}

View File

@@ -431,6 +431,11 @@ 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.has_user_gesture(),
params.is_redirect());
@@ -613,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(
@@ -766,6 +772,17 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
}
}
bool CefContentBrowserClient::ShouldEnableStrictSiteIsolation() {
// TODO(cef): Enable this mode once we figure out why it breaks ceftests that
// rely on command-line arguments passed to the renderer process. It looks
// like the first renderer process is getting all of the callbacks despite
// multiple renderer processes being launched.
// For example, V8RendererTest::OnBrowserCreated appears to get the same
// kV8TestCmdArg value twice when running with:
// --gtest_filter=V8Test.ContextEvalCspBypassUnsafeEval:V8Test.ContextEntered
return false;
}
std::string CefContentBrowserClient::GetApplicationLocale() {
return g_browser_process->GetApplicationLocale();
}
@@ -780,8 +797,8 @@ void CefContentBrowserClient::GetQuotaSettings(
content::StoragePartition* partition,
storage::OptionalQuotaSettingsCallback callback) {
const base::FilePath& cache_path = partition->GetPath();
storage::GetNominalDynamicSettings(cache_path, !cache_path.empty(),
std::move(callback));
storage::GetNominalDynamicSettings(
cache_path, cache_path.empty() /* is_incognito */, std::move(callback));
}
content::MediaObserver* CefContentBrowserClient::GetMediaObserver() {
@@ -1065,15 +1082,17 @@ void CefContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
}
bool CefContentBrowserClient::WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
bool is_navigation,
const GURL& url,
network::mojom::URLLoaderFactoryRequest* factory_request) {
if (!extensions::ExtensionsEnabled())
return false;
auto* web_request_api =
extensions::BrowserContextKeyedAPIFactory<extensions::WebRequestAPI>::Get(
frame->GetProcess()->GetBrowserContext());
browser_context);
return web_request_api->MaybeProxyURLLoaderFactory(frame, is_navigation,
factory_request);
}

View File

@@ -62,6 +62,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
content::BrowserContext* context2) override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override;
bool ShouldEnableStrictSiteIsolation() override;
std::string GetApplicationLocale() override;
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
void GetQuotaSettings(
@@ -138,8 +139,10 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
int render_frame_id,
NonNetworkURLLoaderFactoryMap* factories) override;
bool WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
bool is_navigation,
const GURL& url,
network::mojom::URLLoaderFactoryRequest* factory_request) override;
bool HandleExternalProtocol(

View File

@@ -29,10 +29,12 @@
#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)
#include "base/strings/utf_string_conversions.h"
#include "chrome/install_static/initialize_from_primary_module.h"
#include "chrome_elf/chrome_elf_main.h"
#include "components/crash/content/app/crashpad.h"
#include "content/public/app/sandbox_helper_win.h"
@@ -71,6 +73,16 @@ void DisableFMA3() {
}
#endif // defined(ARCH_CPU_X86_64)
// Transfer state from chrome_elf.dll to the libcef.dll. Accessed when
// loading chrome://system.
void InitInstallDetails() {
static bool initialized = false;
if (initialized)
return;
initialized = true;
install_static::InitializeFromPrimaryModule();
}
// Signal chrome_elf to initialize crash reporting, rather than doing it in
// DllMain. See https://crbug.com/656800 for details.
void InitCrashReporter() {
@@ -156,6 +168,7 @@ int CefExecuteProcess(const CefMainArgs& args,
#if defined(ARCH_CPU_X86_64)
DisableFMA3();
#endif
InitInstallDetails();
InitCrashReporter();
#endif
@@ -215,6 +228,7 @@ bool CefInitialize(const CefMainArgs& args,
#if defined(ARCH_CPU_X86_64)
DisableFMA3();
#endif
InitInstallDetails();
InitCrashReporter();
#endif
@@ -343,7 +357,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;
@@ -526,6 +540,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,20 @@
#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 "chrome/browser/browser_process.h"
#include "components/net_log/chrome_net_log.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 +163,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 +186,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 +288,14 @@ 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,
g_browser_process->net_log());
RunAsyncCompletionOnIOThread(callback);
return true;
}
@@ -502,10 +473,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);

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

@@ -34,6 +34,7 @@
#include "content/public/common/content_client.h"
#include "content/public/common/url_constants.h"
#include "ipc/ipc_channel.h"
#include "net/base/completion_once_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/http/http_response_headers.h"
@@ -52,11 +53,11 @@ class ResponseWriter : public net::URLFetcherResponseWriter {
~ResponseWriter() override;
// URLFetcherResponseWriter overrides:
int Initialize(const net::CompletionCallback& callback) override;
int Initialize(net::CompletionOnceCallback callback) override;
int Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) override;
int Finish(int net_error, const net::CompletionCallback& callback) override;
net::CompletionOnceCallback callback) override;
int Finish(int net_error, net::CompletionOnceCallback callback) override;
private:
base::WeakPtr<CefDevToolsFrontend> shell_devtools_;
@@ -72,13 +73,13 @@ ResponseWriter::ResponseWriter(
ResponseWriter::~ResponseWriter() {}
int ResponseWriter::Initialize(const net::CompletionCallback& callback) {
int ResponseWriter::Initialize(net::CompletionOnceCallback callback) {
return net::OK;
}
int ResponseWriter::Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) {
net::CompletionOnceCallback callback) {
std::string chunk = std::string(buffer->data(), num_bytes);
if (!base::IsStringUTF8(chunk))
return num_bytes;
@@ -95,7 +96,7 @@ int ResponseWriter::Write(net::IOBuffer* buffer,
}
int ResponseWriter::Finish(int net_error,
const net::CompletionCallback& callback) {
net::CompletionOnceCallback callback) {
return net::OK;
}
@@ -299,9 +300,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

@@ -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

@@ -11,7 +11,7 @@
#include "libcef/browser/thread_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/task/post_task.h"
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/profiles/profile.h"
@@ -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

@@ -42,7 +42,7 @@ void CefExtensionHostDelegate::CreateTab(
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();
@@ -62,4 +62,16 @@ ExtensionHostQueue* CefExtensionHostDelegate::GetExtensionHostQueue() const {
return CefExtensionsBrowserClient::Get()->GetExtensionHostQueue();
}
gfx::Size CefExtensionHostDelegate::EnterPictureInPicture(
content::WebContents* web_contents,
const viz::SurfaceId& surface_id,
const gfx::Size& natural_size) {
NOTREACHED();
return gfx::Size();
}
void CefExtensionHostDelegate::ExitPictureInPicture() {
NOTREACHED();
}
} // namespace extensions

View File

@@ -28,13 +28,17 @@ class CefExtensionHostDelegate : public ExtensionHostDelegate {
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::RenderFrameHost* render_frame_host,
const GURL& security_origin,
content::MediaStreamType type,
const Extension* extension) override;
ExtensionHostQueue* GetExtensionHostQueue() const override;
gfx::Size EnterPictureInPicture(content::WebContents* web_contents,
const viz::SurfaceId& surface_id,
const gfx::Size& natural_size) override;
void ExitPictureInPicture() override;
private:
DISALLOW_COPY_AND_ASSIGN(CefExtensionHostDelegate);

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 */);

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

@@ -9,8 +9,6 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/common/url_constants.h"
DEFINE_WEB_CONTENTS_USER_DATA_KEY(extensions::CefExtensionWebContentsObserver);
namespace extensions {
CefExtensionWebContentsObserver::CefExtensionWebContentsObserver(
@@ -46,7 +44,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

@@ -38,7 +38,8 @@ class CefExtensionWebContentsObserver
// Our content script observers. Declare at top so that it will outlive all
// other members, since they might add themselves as observers.
base::ObserverList<ScriptExecutionObserver> script_execution_observers_;
base::ObserverList<ScriptExecutionObserver>::Unchecked
script_execution_observers_;
std::unique_ptr<ScriptExecutor> script_executor_;

View File

@@ -0,0 +1,29 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "libcef/browser/extensions/chrome_api_registration.h"
#include "libcef/browser/extensions/extensions_browser_api_provider.h"
//#include "cef/libcef/browser/extensions/api/generated_api_registration.h"
#include "extensions/browser/api/generated_api_registration.h"
namespace extensions {
CefExtensionsBrowserAPIProvider::CefExtensionsBrowserAPIProvider() =
default;
CefExtensionsBrowserAPIProvider::~CefExtensionsBrowserAPIProvider() =
default;
void CefExtensionsBrowserAPIProvider::RegisterExtensionFunctions(
ExtensionFunctionRegistry* registry) {
// CEF-only APIs.
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
// libcef/common/extensions/api/README.txt for details.
// api::cef::CefGeneratedFunctionRegistry::RegisterAll(registry);
// Chrome APIs whitelisted by CEF.
api::cef::ChromeFunctionRegistry::RegisterAll(registry);
}
} // namespace extensions

View File

@@ -0,0 +1,26 @@
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_BROWSER_API_PROVIDER_H_
#define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_BROWSER_API_PROVIDER_H_
#include "base/macros.h"
#include "extensions/browser/extensions_browser_api_provider.h"
namespace extensions {
class CefExtensionsBrowserAPIProvider : public ExtensionsBrowserAPIProvider {
public:
CefExtensionsBrowserAPIProvider();
~CefExtensionsBrowserAPIProvider() override;
void RegisterExtensionFunctions(ExtensionFunctionRegistry* registry) override;
private:
DISALLOW_COPY_AND_ASSIGN(CefExtensionsBrowserAPIProvider);
};
} // namespace extensions
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_BROWSER_API_PROVIDER_H_

View File

@@ -9,15 +9,14 @@
#include "libcef/browser/browser_context_impl.h"
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/extensions/chrome_api_registration.h"
#include "libcef/browser/extensions/component_extension_resource_manager.h"
#include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/extensions/extension_system_factory.h"
#include "libcef/browser/extensions/extension_web_contents_observer.h"
#include "libcef/browser/extensions/extensions_api_client.h"
#include "libcef/browser/extensions/extensions_browser_api_provider.h"
#include "libcef/browser/request_context_impl.h"
//#include "cef/libcef/browser/extensions/api/generated_api_registration.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/chrome_url_request_util.h"
#include "chrome/browser/extensions/event_router_forwarder.h"
@@ -25,11 +24,10 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/api/generated_api_registration.h"
#include "extensions/browser/api/runtime/runtime_api_delegate.h"
#include "extensions/browser/app_sorting.h"
#include "extensions/browser/core_extensions_browser_api_provider.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_function_registry.h"
#include "extensions/browser/extension_host_delegate.h"
#include "extensions/browser/mojo/interface_registration.h"
#include "extensions/browser/serial_extension_host_queue.h"
@@ -43,7 +41,10 @@ namespace extensions {
CefExtensionsBrowserClient::CefExtensionsBrowserClient()
: api_client_(new CefExtensionsAPIClient),
resource_manager_(new CefComponentExtensionResourceManager) {}
resource_manager_(new CefComponentExtensionResourceManager) {
AddAPIProvider(std::make_unique<CoreExtensionsBrowserAPIProvider>());
AddAPIProvider(std::make_unique<CefExtensionsBrowserAPIProvider>());
}
CefExtensionsBrowserClient::~CefExtensionsBrowserClient() {}
@@ -254,6 +255,15 @@ bool CefExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) {
void CefExtensionsBrowserClient::PermitExternalProtocolHandler() {}
bool CefExtensionsBrowserClient::IsInDemoMode() {
return false;
}
bool CefExtensionsBrowserClient::IsScreensaverInDemoMode(
const std::string& app_id) {
return false;
}
bool CefExtensionsBrowserClient::IsRunningInForcedAppMode() {
return false;
}
@@ -272,20 +282,6 @@ CefExtensionsBrowserClient::GetExtensionSystemFactory() {
return CefExtensionSystemFactory::GetInstance();
}
void CefExtensionsBrowserClient::RegisterExtensionFunctions(
ExtensionFunctionRegistry* registry) const {
// Register core extension-system APIs.
api::GeneratedFunctionRegistry::RegisterAll(registry);
// CEF-only APIs.
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
// libcef/common/extensions/api/README.txt for details.
// api::cef::CefGeneratedFunctionRegistry::RegisterAll(registry);
// Chrome APIs whitelisted by CEF.
api::cef::ChromeFunctionRegistry::RegisterAll(registry);
}
void CefExtensionsBrowserClient::RegisterExtensionInterfaces(
service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>*
registry,

View File

@@ -84,12 +84,12 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
ExtensionHost** host) override;
bool DidVersionUpdate(content::BrowserContext* context) override;
void PermitExternalProtocolHandler() override;
bool IsInDemoMode() override;
bool IsScreensaverInDemoMode(const std::string& app_id) override;
bool IsRunningInForcedAppMode() override;
bool IsAppModeForcedForApp(const ExtensionId& extension_id) override;
bool IsLoggedInAsPublicAccount() override;
ExtensionSystemProvider* GetExtensionSystemFactory() override;
void RegisterExtensionFunctions(
ExtensionFunctionRegistry* registry) const override;
void RegisterExtensionInterfaces(service_manager::BinderRegistryWithArgs<
content::RenderFrameHost*>* registry,
content::RenderFrameHost* render_frame_host,

View File

@@ -78,8 +78,8 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
// Add a reference that will be released in BrowserDestroyed().
browser_->AddRef();
CefWindowDelegateView* delegate_view =
new CefWindowDelegateView(GetBackgroundColor());
CefWindowDelegateView* delegate_view = new CefWindowDelegateView(
GetBackgroundColor(), window_x11_->TopLevelAlwaysOnTop());
delegate_view->Init(window_info_.window, browser_->web_contents(),
gfx::Rect(gfx::Point(), rect.size()));

View File

@@ -99,6 +99,7 @@
}
- (void)cleanup:(id)window {
[window_ setDelegate:nil];
[self release];
}

View File

@@ -189,8 +189,15 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
point =
gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(point), 1.0f / scale));
// Stay on top if top-most window hosting the web view is topmost.
HWND top_level_window = GetAncestor(window_info_.window, GA_ROOT);
DWORD top_level_window_ex_styles =
GetWindowLongPtr(top_level_window, GWL_EXSTYLE);
bool always_on_top =
(top_level_window_ex_styles & WS_EX_TOPMOST) == WS_EX_TOPMOST;
CefWindowDelegateView* delegate_view =
new CefWindowDelegateView(GetBackgroundColor());
new CefWindowDelegateView(GetBackgroundColor(), always_on_top);
delegate_view->Init(window_info_.window, browser_->web_contents(),
gfx::Rect(0, 0, point.x(), point.y()));

View File

@@ -140,7 +140,7 @@ class CefNativeMenuWin : public MenuWrapper {
MenuAction menu_action_;
// A list of listeners to call when the menu opens.
base::ObserverList<MenuListener> listeners_;
base::ObserverList<MenuListener>::Unchecked listeners_;
// Keep track of whether the listeners have already been called at least
// once.

View File

@@ -12,8 +12,11 @@
#include "ui/views/layout/fill_layout.h"
#include "ui/views/widget/widget.h"
CefWindowDelegateView::CefWindowDelegateView(SkColor background_color)
: background_color_(background_color), web_view_(NULL) {}
CefWindowDelegateView::CefWindowDelegateView(SkColor background_color,
bool always_on_top)
: background_color_(background_color),
web_view_(NULL),
always_on_top_(always_on_top) {}
void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
content::WebContents* web_contents,
@@ -44,6 +47,8 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
// CefBrowserHostImpl::PlatformSetFocus.
params.activatable = views::Widget::InitParams::ACTIVATABLE_YES;
params.keep_on_top = always_on_top_;
// Results in a call to InitContent().
widget->Init(params);

View File

@@ -20,7 +20,7 @@ class WebView;
// will be deleted automatically when the associated root window is destroyed.
class CefWindowDelegateView : public views::WidgetDelegateView {
public:
explicit CefWindowDelegateView(SkColor background_color);
CefWindowDelegateView(SkColor background_color, bool always_on_top);
// Create the Widget and associated root window.
void Init(gfx::AcceleratedWidget parent_widget,
@@ -43,6 +43,7 @@ class CefWindowDelegateView : public views::WidgetDelegateView {
private:
SkColor background_color_;
views::WebView* web_view_;
bool always_on_top_;
DISALLOW_COPY_AND_ASSIGN(CefWindowDelegateView);
};

View File

@@ -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);
@@ -395,3 +396,34 @@ void CefWindowX11::ContinueFocus() {
browser_->SetFocus(true);
focus_pending_ = false;
}
bool CefWindowX11::TopLevelAlwaysOnTop() const {
::Window toplevel_window = FindToplevelParent(xdisplay_, xwindow_);
Atom state_atom = gfx::GetAtom("_NET_WM_STATE");
Atom state_keep_above = gfx::GetAtom("_NET_WM_STATE_KEEP_ABOVE");
Atom* states;
Atom actual_type;
int actual_format;
unsigned long num_items;
unsigned long bytes_after;
XGetWindowProperty(xdisplay_, toplevel_window, state_atom, 0, 1024,
x11::False, XA_ATOM, &actual_type, &actual_format,
&num_items, &bytes_after,
reinterpret_cast<unsigned char**>(&states));
bool always_on_top = false;
for (unsigned long i = 0; i < num_items; ++i) {
if (states[i] == state_keep_above) {
always_on_top = true;
break;
}
}
XFree(states);
return always_on_top;
}

View File

@@ -52,6 +52,8 @@ class CefWindowX11 : public ui::PlatformEventDispatcher {
::Window xwindow() const { return xwindow_; }
gfx::Rect bounds() const { return bounds_; }
bool TopLevelAlwaysOnTop() const;
private:
void ContinueFocus();

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"
@@ -61,7 +62,7 @@ const char kChromeUIWebUIHostsHost[] = "webui-hosts";
// testing all related functionality in CEF.
const char* kAllowedWebUIHosts[] = {
content::kChromeUIAppCacheInternalsHost,
content::kChromeUIAccessibilityHost,
chrome::kChromeUIAccessibilityHost,
content::kChromeUIBlobInternalsHost,
chrome::kChromeUICreditsHost,
content::kChromeUIGpuHost,
@@ -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,

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 {
@@ -44,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() {
@@ -189,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.
@@ -52,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,111 @@
// 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,
net::NetLog* net_log) {
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, net_log));
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,75 @@
// 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 NetLog;
} // namespace net
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,
net::NetLog* net_log);
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

@@ -19,7 +19,7 @@ namespace {
void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set) {
CEF_REQUIRE_IOT();
net::SSLConfigService::SetCRLSetIfNewer(crl_set);
// TODO(cef): Re-implement via NetworkService.
}
void LoadFromDisk(const base::FilePath& path) {

View File

@@ -20,7 +20,7 @@
#include "base/command_line.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string_util.h"
#include "chrome/browser/net/safe_search_util.h"
#include "chrome/common/net/safe_search_util.h"
#include "components/prefs/pref_member.h"
#include "components/prefs/pref_service.h"
#include "content/public/common/content_switches.h"
@@ -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();
@@ -142,9 +143,9 @@ class CefBeforeResourceLoadCallbackImpl : public CefRequestCallback {
// Only execute the callback if the request has not been canceled.
if (request->status().status() != net::URLRequestStatus::CANCELED) {
if (force_google_safesearch && allow && new_url->is_empty())
safe_search_util::ForceGoogleSafeSearch(request, new_url);
safe_search_util::ForceGoogleSafeSearch(request->url(), 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(
@@ -332,13 +333,15 @@ int CefNetworkDelegate::OnBeforeURLRequest(
}
if (force_google_safesearch && new_url->is_empty())
safe_search_util::ForceGoogleSafeSearch(request, new_url);
safe_search_util::ForceGoogleSafeSearch(request->url(), new_url);
// Continue the request immediately.
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.

View File

@@ -38,7 +38,9 @@ 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;

View File

@@ -11,7 +11,7 @@
#include "libcef/common/net/scheme_registration.h"
#include "base/memory/ptr_util.h"
#include "base/task_scheduler/post_task.h"
#include "base/task/post_task.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/url_constants.h"
#include "net/net_buildflags.h"

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"
@@ -43,7 +44,6 @@
#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"
@@ -350,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");
@@ -358,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));
@@ -479,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,
io_state_->net_log_);
}
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(
@@ -546,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

@@ -192,15 +192,7 @@ bool CefBrowserPlatformDelegateOsr::IsViewsHosted() const {
}
void CefBrowserPlatformDelegateOsr::WasHidden(bool hidden) {
CefRenderWidgetHostViewOSR* view = GetOSRHostView();
if (view) {
if (hidden)
view->Hide();
else
view->Show();
}
// Also notify the WebContentsImpl for consistency.
// The WebContentsImpl will notify the OSR view.
content::WebContentsImpl* web_contents =
static_cast<content::WebContentsImpl*>(browser_->web_contents());
if (web_contents) {
@@ -535,7 +527,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

@@ -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

@@ -380,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;
}
@@ -419,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();
@@ -450,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

@@ -27,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"
@@ -223,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());
@@ -244,7 +246,6 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
// Matching the attributes from BrowserCompositorMac.
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
AllocateFrameSinkId(is_guest_view_hack), this,
base::FeatureList::IsEnabled(features::kVizDisplayCompositor),
true /* should_register_frame_sink_id */);
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
@@ -277,6 +278,8 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
if (browser_impl_.get())
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);
}
@@ -290,7 +293,7 @@ CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
// necessary to remove all connections to its old ui::Compositor.
if (is_showing_)
delegated_frame_host_->WasHidden();
delegated_frame_host_->ResetCompositor();
delegated_frame_host_->DetachFromCompositor();
#endif
PlatformDestroyCompositorWidget();
@@ -361,15 +364,15 @@ void CefRenderWidgetHostViewOSR::Show() {
#if defined(OS_MACOSX)
browser_compositor_->SetRenderWidgetHostIsHidden(false);
#else
delegated_frame_host_->SetCompositor(compositor_.get());
delegated_frame_host_->WasShown(
GetLocalSurfaceId(), GetRootLayer()->bounds().size(), ui::LatencyInfo());
delegated_frame_host_->AttachToCompositor(compositor_.get());
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() {
@@ -386,7 +389,7 @@ void CefRenderWidgetHostViewOSR::Hide() {
browser_compositor_->SetRenderWidgetHostIsHidden(true);
#else
GetDelegatedFrameHost()->WasHidden();
GetDelegatedFrameHost()->ResetCompositor();
GetDelegatedFrameHost()->DetachFromCompositor();
#endif
is_showing_ = false;
@@ -535,6 +538,10 @@ void CefRenderWidgetHostViewOSR::ClearCompositorFrame() {
GetDelegatedFrameHost()->ClearDelegatedFrame();
}
void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() {
GetDelegatedFrameHost()->ResetFallbackToFirstNavigationSurface();
}
void CefRenderWidgetHostViewOSR::InitAsPopup(
content::RenderWidgetHostView* parent_host_view,
const gfx::Rect& pos) {
@@ -632,6 +639,10 @@ void CefRenderWidgetHostViewOSR::UpdateCursor(
#endif
}
content::CursorManager* CefRenderWidgetHostViewOSR::GetCursorManager() {
return cursor_manager_.get();
}
void CefRenderWidgetHostViewOSR::SetIsLoading(bool is_loading) {}
void CefRenderWidgetHostViewOSR::RenderProcessGone(
@@ -679,10 +690,6 @@ void CefRenderWidgetHostViewOSR::SetTooltipText(
}
}
gfx::Size CefRenderWidgetHostViewOSR::GetRequestedRendererSize() const {
return GetDelegatedFrameHost()->GetRequestedRendererSize();
}
gfx::Size CefRenderWidgetHostViewOSR::GetCompositorViewportPixelSize() const {
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
current_device_scale_factor_);
@@ -762,12 +769,6 @@ CefRenderWidgetHostViewOSR::CreateBrowserAccessibilityManager(
return NULL;
}
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
void CefRenderWidgetHostViewOSR::ShowDisambiguationPopup(
const gfx::Rect& rect_pixels,
const SkBitmap& zoomed_bitmap) {}
#endif
void CefRenderWidgetHostViewOSR::ImeSetComposition(
const CefString& text,
const std::vector<CefCompositionUnderline>& underlines,
@@ -859,12 +860,13 @@ void CefRenderWidgetHostViewOSR::SelectionChanged(const base::string16& text,
}
#if !defined(OS_MACOSX)
viz::LocalSurfaceId CefRenderWidgetHostViewOSR::GetLocalSurfaceId() const {
const viz::LocalSurfaceId& CefRenderWidgetHostViewOSR::GetLocalSurfaceId()
const {
return local_surface_id_;
}
#endif
viz::FrameSinkId CefRenderWidgetHostViewOSR::GetFrameSinkId() {
const viz::FrameSinkId& CefRenderWidgetHostViewOSR::GetFrameSinkId() const {
return GetDelegatedFrameHost()->frame_sink_id();
}
@@ -915,11 +917,7 @@ bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
return true;
}
// In TransformPointToLocalCoordSpace() there is a Point-to-Pixel conversion,
// 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, source);
return false;
}
void CefRenderWidgetHostViewOSR::DidNavigate() {
@@ -954,7 +952,8 @@ ui::Layer* CefRenderWidgetHostViewOSR::DelegatedFrameHostGetLayer() const {
}
bool CefRenderWidgetHostViewOSR::DelegatedFrameHostIsVisible() const {
return !render_widget_host_->is_hidden();
// Called indirectly from DelegatedFrameHost::WasShown.
return is_showing_;
}
SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor() const {
@@ -981,10 +980,6 @@ void CefRenderWidgetHostViewOSR::OnFrameTokenChanged(uint32_t frame_token) {
render_widget_host_->DidProcessFrame(frame_token);
}
void CefRenderWidgetHostViewOSR::DidReceiveFirstFrameAfterNavigation() {
render_widget_host_->DidReceiveFirstFrameAfterNavigation();
}
#endif // !defined(OS_MACOSX)
bool CefRenderWidgetHostViewOSR::InstallTransparency() {
@@ -1125,21 +1120,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.
@@ -1158,16 +1164,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;
}
}
@@ -1177,7 +1184,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));
}
}
@@ -1373,7 +1380,7 @@ void CefRenderWidgetHostViewOSR::ResizeRootLayer(bool force) {
PlatformResizeCompositorWidget(size_in_pixels);
bool resized = true;
GetDelegatedFrameHost()->SynchronizeVisualProperties(
GetDelegatedFrameHost()->EmbedSurface(
local_surface_id_, size, cc::DeadlinePolicy::UseDefaultDeadline());
#endif // !defined(OS_MACOSX)

View File

@@ -18,6 +18,7 @@
#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/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"
@@ -33,11 +34,17 @@
#include "ui/gfx/win/window_impl.h"
#endif
#if defined(USE_AURA)
#include "third_party/blink/public/platform/web_cursor_info.h"
#include "ui/base/cursor/cursor.h"
#endif
namespace content {
class RenderWidgetHost;
class RenderWidgetHostImpl;
class RenderWidgetHostViewGuest;
class BackingStore;
class CursorManager;
} // namespace content
class CefBeginFrameTimer;
@@ -134,6 +141,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
viz::CompositorFrame frame,
base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
void ClearCompositorFrame() override;
void ResetFallbackToFirstNavigationSurface() override;
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
const gfx::Rect& pos) override;
void InitAsFullscreen(
@@ -146,8 +154,8 @@ 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 GetCompositorViewportPixelSize() const override;
void CopyFromSurface(
const gfx::Rect& src_rect,
@@ -156,15 +164,15 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void GetScreenInfo(content::ScreenInfo* results) const override;
void TransformPointToRootSurface(gfx::PointF* point) override;
gfx::Rect GetBoundsInRootWindow() 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,
bool for_root_frame) override;
#if defined(TOOLKIT_VIEWS) || defined(USE_AURA)
void ShowDisambiguationPopup(const gfx::Rect& rect_pixels,
const SkBitmap& zoomed_bitmap) override;
#endif
void ImeCompositionRangeChanged(
const gfx::Range& range,
const std::vector<gfx::Rect>& character_bounds) override;
@@ -187,8 +195,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
size_t offset,
const gfx::Range& range) override;
viz::LocalSurfaceId GetLocalSurfaceId() const override;
viz::FrameSinkId GetFrameSinkId() override;
const viz::LocalSurfaceId& GetLocalSurfaceId() const override;
const viz::FrameSinkId& GetFrameSinkId() const override;
// ui::CompositorDelegate implementation.
std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice(
@@ -202,7 +210,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
void OnBeginFrame(base::TimeTicks frame_time) override;
void OnFrameTokenChanged(uint32_t frame_token) override;
void DidReceiveFirstFrameAfterNavigation() override;
#endif // !defined(OS_MACOSX)
bool InstallTransparency();
@@ -254,6 +261,12 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
}
ui::Layer* GetRootLayer() const;
#if defined(OS_MACOSX)
content::BrowserCompositorMac* browser_compositor() const {
return browser_compositor_.get();
}
#endif
private:
content::DelegatedFrameHost* GetDelegatedFrameHost() const;
@@ -291,6 +304,10 @@ 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;
bool UpdateNSViewAndDisplay();
#endif // defined(OS_MACOSX)
@@ -331,6 +348,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_;
@@ -370,6 +389,8 @@ 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;

View File

@@ -15,19 +15,11 @@
#include "base/compiler_specific.h"
#include "base/strings/utf_string_conversions.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/common/view_messages.h"
#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
#include "ui/display/screen.h"
namespace {
display::Display GetDisplay() {
// TODO(cef): Get display info from callbacks.
return display::Screen::GetScreen()->GetDisplayNearestView(nullptr);
}
} // namespace
class MacHelper : public content::BrowserCompositorMacClient,
public ui::AcceleratedWidgetMacNSView {
public:
@@ -53,26 +45,32 @@ class MacHelper : public content::BrowserCompositorMacClient,
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 AcceleratedWidgetCALayerParamsUpdated() override {}
void DidReceiveFirstFrameAfterNavigation() override {
view_->render_widget_host()->DidReceiveFirstFrameAfterNavigation();
}
void DestroyCompositorForShutdown() override {}
bool SynchronizeVisualProperties() 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_;
@@ -90,7 +88,48 @@ bool CefRenderWidgetHostViewOSR::ShouldContinueToPauseForFrame() {
return browser_compositor_->ShouldContinueToPauseForFrame();
}
viz::LocalSurfaceId CefRenderWidgetHostViewOSR::GetLocalSurfaceId() const {
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();
}
@@ -129,8 +168,8 @@ void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget(
mac_helper_ = new MacHelper(this);
browser_compositor_.reset(new content::BrowserCompositorMac(
mac_helper_, mac_helper_, render_widget_host_->is_hidden(), true,
GetDisplay(), AllocateFrameSinkId(is_guest_view_hack)));
mac_helper_, mac_helper_, render_widget_host_->is_hidden(), GetDisplay(),
AllocateFrameSinkId(is_guest_view_hack)));
}
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {

View File

@@ -135,8 +135,11 @@ void CefWebContentsViewOSR::RenderViewCreated(content::RenderViewHost* host) {
view->InstallTransparency();
}
void CefWebContentsViewOSR::RenderViewSwappedIn(content::RenderViewHost* host) {
}
void CefWebContentsViewOSR::RenderViewReady() {}
void CefWebContentsViewOSR::RenderViewHostChanged(
content::RenderViewHost* old_host,
content::RenderViewHost* new_host) {}
void CefWebContentsViewOSR::SetOverscrollControllerEnabled(bool enabled) {}

View File

@@ -51,7 +51,9 @@ class CefWebContentsViewOSR : public content::WebContentsView,
content::RenderWidgetHost* render_widget_host) override;
void SetPageTitle(const base::string16& title) override;
void RenderViewCreated(content::RenderViewHost* host) override;
void RenderViewSwappedIn(content::RenderViewHost* host) override;
void RenderViewReady() override;
void RenderViewHostChanged(content::RenderViewHost* old_host,
content::RenderViewHost* new_host) override;
void SetOverscrollControllerEnabled(bool enabled) override;
#if defined(OS_MACOSX)

View File

@@ -13,8 +13,9 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/strings/string_number_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/task/post_task.h"
#include "base/values.h"
#include "chrome/browser/accessibility/accessibility_ui.h"
#include "chrome/browser/net/prediction_options.h"
#include "chrome/browser/plugins/plugin_info_host_impl.h"
#include "chrome/browser/prefs/chrome_command_line_pref_store.h"
@@ -86,7 +87,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
const base::FilePath& pref_path =
cache_path.AppendASCII(browser_prefs::kUserPrefsFileName);
scoped_refptr<JsonPrefStore> json_pref_store = new JsonPrefStore(
pref_path, sequenced_task_runner, std::unique_ptr<PrefFilter>());
pref_path, std::unique_ptr<PrefFilter>(), sequenced_task_runner);
factory.set_user_prefs(json_pref_store.get());
} else {
scoped_refptr<CefPrefStore> cef_pref_store = new CefPrefStore();
@@ -142,6 +143,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
->RegisterProfilePrefsForServices(profile, registry.get());
// Default preferences.
AccessibilityUIMessageHandler::RegisterProfilePrefs(registry.get());
CefMediaCaptureDevicesDispatcher::RegisterPrefs(registry.get());
CefURLRequestContextGetterImpl::RegisterPrefs(registry.get());
chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry.get());

View File

@@ -94,9 +94,12 @@ void CefPrefStore::ReadPrefsAsync(ReadErrorDelegate* error_delegate) {
NotifyInitializationCompleted();
}
void CefPrefStore::CommitPendingWrite(base::OnceClosure done_callback) {
void CefPrefStore::CommitPendingWrite(
base::OnceClosure done_callback,
base::OnceClosure synchronous_done_callback) {
committed_ = true;
PersistentPrefStore::CommitPendingWrite(std::move(done_callback));
PersistentPrefStore::CommitPendingWrite(std::move(done_callback),
std::move(synchronous_done_callback));
}
void CefPrefStore::SchedulePendingLossyWrites() {}

View File

@@ -45,7 +45,9 @@ class CefPrefStore : public PersistentPrefStore {
PrefReadError GetReadError() const override;
PersistentPrefStore::PrefReadError ReadPrefs() override;
void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override;
virtual void CommitPendingWrite(base::OnceClosure done_callback) override;
virtual void CommitPendingWrite(
base::OnceClosure done_callback,
base::OnceClosure synchronous_done_callback) override;
void SchedulePendingLossyWrites() override;
void ClearMutableValues() override;
void OnStoreDeletionFromDisk() override;
@@ -109,7 +111,7 @@ class CefPrefStore : public PersistentPrefStore {
bool committed_;
std::unique_ptr<ReadErrorDelegate> error_delegate_;
base::ObserverList<PrefStore::Observer, true> observers_;
base::ObserverList<PrefStore::Observer, true>::Unchecked observers_;
DISALLOW_COPY_AND_ASSIGN(CefPrefStore);
};

View File

@@ -20,14 +20,12 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "printing/pdf_metafile_skia.h"
#include "printing/metafile_skia.h"
#include "libcef/browser/thread_util.h"
using content::BrowserThread;
DEFINE_WEB_CONTENTS_USER_DATA_KEY(printing::CefPrintViewManager);
namespace printing {
namespace {
@@ -150,7 +148,7 @@ void SavePdfFile(scoped_refptr<base::RefCountedBytes> data,
CEF_REQUIRE_BLOCKING();
DCHECK_GT(data->size(), 0U);
PdfMetafileSkia metafile;
MetafileSkia metafile;
metafile.InitFromData(static_cast<const void*>(data->front()), data->size());
base::File file(path,
@@ -259,7 +257,9 @@ void CefPrintViewManager::OnRequestPrintPreview(
}
void CefPrintViewManager::OnMetafileReadyForPrinting(
const PrintHostMsg_DidPreviewDocument_Params& params) {
content::RenderFrameHost* render_frame_host,
const PrintHostMsg_DidPreviewDocument_Params& params,
const PrintHostMsg_PreviewIds& ids) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
StopWorker(params.document_cookie);

View File

@@ -14,9 +14,10 @@
namespace content {
class RenderFrameHost;
class RenderProcessHost;
}
} // namespace content
struct PrintHostMsg_DidPreviewDocument_Params;
struct PrintHostMsg_PreviewIds;
struct PrintHostMsg_RequestPrintPreview_Params;
namespace printing {
@@ -52,7 +53,9 @@ class CefPrintViewManager
void OnDidShowPrintDialog(content::RenderFrameHost* rfh);
void OnRequestPrintPreview(const PrintHostMsg_RequestPrintPreview_Params&);
void OnMetafileReadyForPrinting(
const PrintHostMsg_DidPreviewDocument_Params&);
content::RenderFrameHost* render_frame_host,
const PrintHostMsg_DidPreviewDocument_Params& params,
const PrintHostMsg_PreviewIds& ids);
void TerminatePdfPrintJob();

View File

@@ -16,7 +16,7 @@
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/task/post_task.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
@@ -27,7 +27,6 @@
#include "chrome/browser/printing/printer_query.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
#include "components/printing/browser/print_composite_client.h"
@@ -43,14 +42,12 @@
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "extensions/common/constants.h"
#include "mojo/public/cpp/system/buffer.h"
#include "printing/buildflags/buildflags.h"
#include "printing/pdf_metafile_skia.h"
#include "printing/metafile_skia.h"
#include "printing/print_settings.h"
#include "printing/printed_document.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
#if defined(OS_WIN)
#include "base/command_line.h"
@@ -62,18 +59,6 @@ using content::BrowserThread;
namespace printing {
namespace {
bool PrintingPdfContent(content::RenderFrameHost* rfh) {
GURL url = rfh->GetLastCommittedURL();
// Whether it is inside print preview or pdf plugin extension.
return url.GetOrigin() == chrome::kChromeUIPrintURL ||
(url.SchemeIs(extensions::kExtensionScheme) &&
url.host_piece() == extension_misc::kPdfExtensionId);
}
} // namespace
CefPrintViewManagerBase::CefPrintViewManagerBase(
content::WebContents* web_contents)
: PrintManager(web_contents),
@@ -113,8 +98,7 @@ void CefPrintViewManagerBase::PrintDocument(
print_job_->StartConversionToNativeFormat(print_data, page_size, content_area,
offsets);
#else
std::unique_ptr<PdfMetafileSkia> metafile =
std::make_unique<PdfMetafileSkia>();
std::unique_ptr<MetafileSkia> metafile = std::make_unique<MetafileSkia>();
CHECK(metafile->InitFromData(print_data->front(), print_data->size()));
// Update the rendered document. It will send notifications to the listener.
@@ -196,10 +180,9 @@ void CefPrintViewManagerBase::OnDidPrintDocument(
}
auto* client = PrintCompositeClient::FromWebContents(web_contents());
if (IsOopifEnabled() && !PrintingPdfContent(render_frame_host)) {
if (IsOopifEnabled() && print_job_->document()->settings().is_modifiable()) {
client->DoCompositeDocumentToPdf(
params.document_cookie, render_frame_host, content.metafile_data_handle,
content.data_size, content.subframe_content_info,
params.document_cookie, render_frame_host, content,
base::BindOnce(&CefPrintViewManagerBase::OnComposePdfDone,
weak_ptr_factory_.GetWeakPtr(), params));
return;

View File

@@ -281,9 +281,9 @@ void CefPrintingMessageFilter::OnUpdatePrintSettingsReply(
}
}
void CefPrintingMessageFilter::OnCheckForCancel(int32_t preview_ui_id,
int preview_request_id,
bool* cancel) {
void CefPrintingMessageFilter::OnCheckForCancel(
const PrintHostMsg_PreviewIds& ids,
bool* cancel) {
*cancel = false;
}

View File

@@ -17,6 +17,7 @@
#include "content/public/browser/browser_message_filter.h"
#include "printing/buildflags/buildflags.h"
struct PrintHostMsg_PreviewIds;
struct PrintHostMsg_ScriptedPrint_Params;
class Profile;
@@ -74,9 +75,7 @@ class CefPrintingMessageFilter : public content::BrowserMessageFilter {
IPC::Message* reply_msg);
// Check to see if print preview has been cancelled.
void OnCheckForCancel(int32_t preview_ui_id,
int preview_request_id,
bool* cancel);
void OnCheckForCancel(const PrintHostMsg_PreviewIds& ids, bool* cancel);
std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
printing_shutdown_notifier_;

View File

@@ -66,11 +66,6 @@ void CefResourceContext::RemoveUserData(const void* key) {
content::ResourceContext::RemoveUserData(key);
}
net::HostResolver* CefResourceContext::GetHostResolver() {
CHECK(getter_.get());
return getter_->GetHostResolver();
}
net::URLRequestContext* CefResourceContext::GetRequestContext() {
CHECK(getter_.get());
return getter_->GetURLRequestContext();

View File

@@ -38,7 +38,6 @@ class CefResourceContext : public content::ResourceContext {
void RemoveUserData(const void* key) override;
// ResourceContext implementation.
net::HostResolver* GetHostResolver() override;
net::URLRequestContext* GetRequestContext() override;
std::unique_ptr<net::ClientCertStore> CreateClientCertStore();

View File

@@ -21,8 +21,6 @@
#include "content/public/browser/speech_recognition_manager.h"
#include "content/public/browser/speech_recognition_session_context.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/speech_recognition_error.h"
#include "content/public/common/speech_recognition_result.h"
using content::BrowserThread;
using content::SpeechRecognitionManager;
@@ -52,11 +50,11 @@ void CefSpeechRecognitionManagerDelegate::OnAudioEnd(int session_id) {}
void CefSpeechRecognitionManagerDelegate::OnRecognitionResults(
int session_id,
const content::SpeechRecognitionResults& result) {}
const std::vector<blink::mojom::SpeechRecognitionResultPtr>& result) {}
void CefSpeechRecognitionManagerDelegate::OnRecognitionError(
int session_id,
const content::SpeechRecognitionError& error) {}
const blink::mojom::SpeechRecognitionError& error) {}
void CefSpeechRecognitionManagerDelegate::OnAudioLevelsChange(
int session_id,

View File

@@ -31,10 +31,11 @@ class CefSpeechRecognitionManagerDelegate
void OnRecognitionEnd(int session_id) override;
void OnRecognitionResults(
int session_id,
const content::SpeechRecognitionResults& result) override;
const std::vector<blink::mojom::SpeechRecognitionResultPtr>& result)
override;
void OnRecognitionError(
int session_id,
const content::SpeechRecognitionError& error) override;
const blink::mojom::SpeechRecognitionError& error) override;
void OnAudioLevelsChange(int session_id,
float volume,
float noise_volume) override;

View File

@@ -17,8 +17,7 @@ CertPolicy::~CertPolicy() {}
// For an allowance, we consider a given |cert| to be a match to a saved
// allowed cert if the |error| is an exact match to or subset of the errors
// in the saved CertStatus.
bool CertPolicy::Check(const net::X509Certificate& cert,
net::CertStatus error) const {
bool CertPolicy::Check(const net::X509Certificate& cert, int error) const {
net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256();
const auto& allowed_iter = allowed_.find(fingerprint);
if ((allowed_iter != allowed_.end()) && (allowed_iter->second & error) &&
@@ -28,8 +27,7 @@ bool CertPolicy::Check(const net::X509Certificate& cert,
return false;
}
void CertPolicy::Allow(const net::X509Certificate& cert,
net::CertStatus error) {
void CertPolicy::Allow(const net::X509Certificate& cert, int error) {
// If this same cert had already been saved with a different error status,
// this will replace it with the new error status.
net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256();
@@ -59,7 +57,7 @@ bool CefSSLHostStateDelegate::DidHostRunInsecureContent(
void CefSSLHostStateDelegate::AllowCert(const std::string& host,
const net::X509Certificate& cert,
net::CertStatus error) {
int error) {
cert_policy_for_host_[host].Allow(cert, error);
}
@@ -84,7 +82,7 @@ void CefSSLHostStateDelegate::Clear(
SSLHostStateDelegate::CertJudgment CefSSLHostStateDelegate::QueryPolicy(
const std::string& host,
const net::X509Certificate& cert,
net::CertStatus error,
int error,
bool* expired_previous_decision) {
return cert_policy_for_host_[host].Check(cert, error)
? SSLHostStateDelegate::ALLOWED

View File

@@ -10,7 +10,6 @@
#include "content/public/browser/ssl_host_state_delegate.h"
#include "net/base/hash_value.h"
#include "net/cert/cert_status_flags.h"
#include "net/cert/x509_certificate.h"
// Implementation based on android_webview/browser/aw_ssl_host_state_delegate.h.
@@ -25,11 +24,11 @@ class CertPolicy {
// Returns true if the user has decided to proceed through the ssl error
// before. For a certificate to be allowed, it must not have any
// *additional* errors from when it was allowed.
bool Check(const net::X509Certificate& cert, net::CertStatus error) const;
bool Check(const net::X509Certificate& cert, int error) const;
// Causes the policy to allow this certificate for a given |error|. And
// remember the user's choice.
void Allow(const net::X509Certificate& cert, net::CertStatus error);
void Allow(const net::X509Certificate& cert, int error);
// Returns true if and only if there exists a user allow exception for some
// certificate.
@@ -37,7 +36,7 @@ class CertPolicy {
private:
// The set of fingerprints of allowed certificates.
std::map<net::SHA256HashValue, net::CertStatus> allowed_;
std::map<net::SHA256HashValue, int> allowed_;
};
} // namespace internal
@@ -50,13 +49,13 @@ class CefSSLHostStateDelegate : public content::SSLHostStateDelegate {
// SSLHostStateDelegate methods:
void AllowCert(const std::string& host,
const net::X509Certificate& cert,
net::CertStatus error) override;
int error) override;
void Clear(
const base::Callback<bool(const std::string&)>& host_filter) override;
content::SSLHostStateDelegate::CertJudgment QueryPolicy(
const std::string& host,
const net::X509Certificate& cert,
net::CertStatus error,
int error,
bool* expired_previous_decision) override;
void HostRanInsecureContent(const std::string& host,
int child_id,

View File

@@ -88,6 +88,11 @@ CefStoragePartitionProxy::GetCacheStorageContext() {
return parent_->GetCacheStorageContext();
}
content::GeneratedCodeCacheContext*
CefStoragePartitionProxy::GetGeneratedCodeCacheContext() {
return parent_->GetGeneratedCodeCacheContext();
}
content::HostZoomMap* CefStoragePartitionProxy::GetHostZoomMap() {
return parent_->GetHostZoomMap();
}
@@ -156,6 +161,10 @@ void CefStoragePartitionProxy::Flush() {
parent_->Flush();
}
void CefStoragePartitionProxy::ResetURLLoaderFactories() {
parent_->ResetURLLoaderFactories();
}
void CefStoragePartitionProxy::ClearBluetoothAllowedDevicesMapForTesting() {
parent_->ClearBluetoothAllowedDevicesMapForTesting();
}
@@ -193,11 +202,6 @@ CefStoragePartitionProxy::GetBluetoothAllowedDevicesMap() {
return parent_->GetBluetoothAllowedDevicesMap();
}
content::BlobURLLoaderFactory*
CefStoragePartitionProxy::GetBlobURLLoaderFactory() {
return parent_->GetBlobURLLoaderFactory();
}
content::BlobRegistryWrapper* CefStoragePartitionProxy::GetBlobRegistry() {
return parent_->GetBlobRegistry();
}
@@ -222,7 +226,7 @@ content::BrowserContext* CefStoragePartitionProxy::browser_context() const {
mojo::BindingId CefStoragePartitionProxy::Bind(
int process_id,
mojo::InterfaceRequest<content::mojom::StoragePartitionService> request) {
mojo::InterfaceRequest<blink::mojom::StoragePartitionService> request) {
return parent_->Bind(process_id, std::move(request));
}

View File

@@ -40,6 +40,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
content::ServiceWorkerContext* GetServiceWorkerContext() override;
content::SharedWorkerService* GetSharedWorkerService() override;
content::CacheStorageContext* GetCacheStorageContext() override;
content::GeneratedCodeCacheContext* GetGeneratedCodeCacheContext() override;
content::HostZoomMap* GetHostZoomMap() override;
content::HostZoomLevelContext* GetHostZoomLevelContext() override;
content::ZoomLevelDelegate* GetZoomLevelDelegate() override;
@@ -69,6 +70,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
const base::Callback<bool(const GURL&)>& url_matcher,
base::OnceClosure callback) override;
void Flush() override;
void ResetURLLoaderFactories() override;
void ClearBluetoothAllowedDevicesMapForTesting() override;
void FlushNetworkInterfaceForTesting() override;
void WaitForDeletionTasksForTesting() override;
@@ -77,7 +79,6 @@ class CefStoragePartitionProxy : public content::StoragePartition {
content::PaymentAppContextImpl* GetPaymentAppContext() override;
content::BroadcastChannelProvider* GetBroadcastChannelProvider() override;
content::BluetoothAllowedDevicesMap* GetBluetoothAllowedDevicesMap() override;
content::BlobURLLoaderFactory* GetBlobURLLoaderFactory() override;
content::BlobRegistryWrapper* GetBlobRegistry() override;
content::PrefetchURLLoaderService* GetPrefetchURLLoaderService() override;
content::CookieStoreContext* GetCookieStoreContext() override;
@@ -85,7 +86,7 @@ class CefStoragePartitionProxy : public content::StoragePartition {
content::BrowserContext* browser_context() const override;
mojo::BindingId Bind(
int process_id,
mojo::InterfaceRequest<content::mojom::StoragePartitionService> request)
mojo::InterfaceRequest<blink::mojom::StoragePartitionService> request)
override;
void set_site_for_service_worker(
const GURL& site_for_service_worker) override;

View File

@@ -8,7 +8,7 @@
#include "base/location.h"
#include "base/logging.h"
#include "base/task_scheduler/post_task.h"
#include "base/task/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "content/public/browser/browser_thread.h"
@@ -70,7 +70,7 @@
// Post a blocking task where the user won't notice if it takes an arbitrarily
// long time to complete.
#define CEF_POST_BACKGROUND_TASK(task) \
CEF_POST_BLOCKING_TASK(base::TaskPriority::BACKGROUND, task)
CEF_POST_BLOCKING_TASK(base::TaskPriority::BEST_EFFORT, task)
// Assert that blocking is allowed on the current thread.
#define CEF_REQUIRE_BLOCKING() base::AssertBlockingAllowed()
@@ -87,6 +87,9 @@
return false; \
} \
bool HasOneRef() const OVERRIDE { return ref_count_.HasOneRef(); } \
bool HasAtLeastOneRef() const OVERRIDE { \
return ref_count_.HasAtLeastOneRef(); \
} \
\
private: \
CefRefCount ref_count_;

View File

@@ -323,7 +323,7 @@ void CefWindowView::CreateWidget() {
};
Atom mwmHintsProperty = XInternAtom(display, "_MOTIF_WM_HINTS", 0);
struct MwmHints hints;
struct MwmHints hints = {};
hints.flags = MWM_HINTS_DECORATIONS;
hints.decorations = 0;
XChangeProperty(display, window, mwmHintsProperty, mwmHintsProperty, 32,

View File

@@ -96,9 +96,6 @@ CefString CefDragDataImpl::GetFragmentBaseURL() {
CefString CefDragDataImpl::GetFileName() {
base::AutoLock lock_scope(lock_);
if (data_.file_contents_content_disposition.empty())
return CefString();
base::Optional<base::FilePath> filename =
data_.GetSafeFilenameForImageFileContents();
return filename ? CefString(filename->value()) : CefString();

View File

@@ -18,20 +18,18 @@ import("//tools/json_schema_compiler/json_features.gni")
#schema_include_rules = "//cef/libcef/browser/extensions/api:extensions::api::cef::%(namespace)s"
#schema_dependencies = [ "//extensions/common/api" ]
#
#json_schema_api("api") {
#generated_json_strings("api") {
# sources = schema_sources
# schemas = true
# bundle = true
# configs = [ "//build/config:precompiled_headers" ]
# bundle_name = "Cef"
#
# deps = schema_dependencies
#}
#
#json_schema_api("api_registration") {
#function_registration("api_registration") {
# sources = schema_sources
# impl_dir = "//cef/libcef/browser/extensions/api"
# bundle_registration = true
# configs = [ "//build/config:precompiled_headers" ]
# bundle_name = "Cef"
#
@@ -43,45 +41,34 @@ import("//tools/json_schema_compiler/json_features.gni")
json_features("cef_api_features") {
feature_type = "APIFeature"
provider_class = "CefAPIFeatureProvider"
method_name = "AddCEFAPIFeatures"
sources = [
"//extensions/common/api/_api_features.json",
"_api_features.json",
]
}
json_features("cef_permission_features") {
feature_type = "PermissionFeature"
provider_class = "CefPermissionFeatureProvider"
method_name = "AddCEFPermissionFeatures"
sources = [
"//extensions/common/api/_permission_features.json",
"_permission_features.json",
]
}
json_features("cef_manifest_features") {
feature_type = "ManifestFeature"
provider_class = "CefManifestFeatureProvider"
method_name = "AddCEFManifestFeatures"
sources = [
# Use the same manifest features as Chrome.
"//chrome/common/extensions/api/_manifest_features.json",
"//extensions/common/api/_manifest_features.json",
]
}
json_features("cef_behavior_features") {
feature_type = "BehaviorFeature"
provider_class = "CefBehaviorFeatureProvider"
sources = [
"//extensions/common/api/_behavior_features.json",
]
}
group("extensions_features") {
public_deps = [
":cef_api_features",
":cef_behavior_features",
":cef_manifest_features",
":cef_permission_features",
"//extensions/common/api:extensions_features",
]
}

View File

@@ -12,6 +12,10 @@
{
// From chrome/common/extensions/api/_api_features.json.
// Required by the PDF extension which is hosted in a guest view.
"contentSettings": {
"dependencies": ["permission:contentSettings"],
"contexts": ["blessed_extension"]
},
"mimeHandlerViewGuestInternal": {
"internal": true,
"contexts": "all",

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