Compare commits

..

97 Commits
3239 ... 3359

Author SHA1 Message Date
Marshall Greenblatt
d49d25f881 Update to Chromium version 66.0.3359.181 2018-05-16 19:24:12 +03:00
Marshall Greenblatt
3e1975534a Add support for automate-git.py --fast-update (issue #2435) 2018-05-16 14:29:25 +03:00
Marshall Greenblatt
d1df1907f3 Fix DCHECK due to unreliable is_main_frame state on XHR requests (issue #2433) 2018-05-04 16:44:35 +02:00
Marshall Greenblatt
5aa6c55c50 Fix Object.entries/.values with non-enumerable properties 2018-05-02 10:48:47 +02:00
Marshall Greenblatt
6c5418d0e9 Fix Remote Debugging is missing 'Select Element Button' 2018-05-02 10:38:57 +02:00
Felix Bruns
d0bfc4d2a4 Add user_gesture parameter to OnBeforeBrowse (issue #1526) 2018-04-27 17:13:13 +02:00
Marshall Greenblatt
8e7c5d6568 Update to Chromium version 66.0.3359.117 2018-04-18 20:43:34 -04:00
Marshall Greenblatt
7735948042 Linux: Fix startup hang on Ubuntu 16.04.4 (issue #2424) 2018-04-13 21:23:33 -04:00
Marshall Greenblatt
7f6bb962eb Linux: Fix ASAN link error: odr-violation: global 'typeinfo name for std::exception' (see https://crbug.com/832808) 2018-04-13 17:31:49 -04:00
Marshall Greenblatt
8235330984 Linux: Fix crash when closing popup after printing (issue #2422) 2018-04-12 14:40:58 -04:00
Christopher Cifra
45b333fa44 Add support for V8 ArrayBuffers (issue #244) 2018-04-10 16:07:45 -04:00
Mike Wiedenbauer
0cf891e89a Add CefDisplayHandler::OnLoadingProgressChange callback (issue #2382) 2018-04-10 13:54:36 -04:00
Mike Wiedenbauer
5211ca6298 Add ability to stop CefURLRequest on redirect (issue #1329) 2018-04-10 13:07:37 -04:00
Mike Wiedenbauer
bcb7529ed3 Add OSR text selection changed handler and remove hard-coded test bounds (issue #2383) 2018-04-09 14:25:54 -04:00
Marshall Greenblatt
0fee952053 Update to Chromium version 66.0.3359.81 2018-04-05 15:45:26 -04:00
Marshall Greenblatt
30bfedfb19 macOS: Fix compile errors (issue #2419) 2018-04-04 16:09:19 -04:00
Marshall Greenblatt
1e6d036cfe Fix compile error due to commit acb0922 (issue #2415) 2018-04-02 17:19:41 -04:00
Marshall Greenblatt
173d79a417 Fix crashes loading chrome://system with extensions disabled (issue #2415) 2018-03-29 14:04:39 -04:00
Marshall Greenblatt
9dcab19430 Allow empty username parameter to CefAuthCallback::Continue (issue #2275) 2018-03-28 19:31:07 -04:00
Marshall Greenblatt
049cf31b62 Don't include locales/*.info files in distribution (issue #2375) 2018-03-28 18:21:44 -04:00
Marshall Greenblatt
ddd0e80cbd Support override of crash_reporter.cfg settings with environment variables (issue #2413) 2018-03-28 17:16:34 -04:00
Marshall Greenblatt
828e17ec28 Windows: Fix crash report upload failure on Windows 7 (see https://crbug.com/826564). 2018-03-28 16:04:57 -04:00
John Mayhew
6f88af7923 Change CefFrame::GetName() to return assigned name if it is non-empty before returning unique name (issue #2403) 2018-03-28 15:16:40 -04:00
Marshall Greenblatt
bdc3b2a5ce Linux: Update to Debian sid sysroot (issue #2409) 2018-03-28 12:45:00 -04:00
Marshall Greenblatt
69868374eb Update to Chromium version 66.0.3359.50 2018-03-23 17:56:34 -04:00
Marshall Greenblatt
7a59914f97 Update to Chromium revision 66afc5e5 (#540276) 2018-03-22 16:56:23 -04:00
Marshall Greenblatt
4fb6e1ba29 macOS: Fix undesirable switch to discrete GPU during startup (issue #2398) 2018-03-16 14:04:16 -04:00
Marshall Greenblatt
e030236c36 Add CefCookieManager::GetBlockingManager (issue #2374) 2018-03-14 21:40:37 -04:00
Marshall Greenblatt
a98c6b1f52 Linux: Fix creation of client distribution 2018-03-08 10:55:05 -05:00
Marshall Greenblatt
5b136976e9 Revert "Linux: Add missing build dependency"
This commit causes the following build error when use_sysroot=true:

../../third_party/crashpad/crashpad/util/net/http_transport_libcurl.cc:17:10: fatal error: 'curl/curl.h' file not found
         ^~~~~~~~~~~~~
1 error generated.

This reverts commit cd6ff760dd.
2018-03-08 10:54:57 -05:00
Marshall Greenblatt
56bbee8efb cmake: Linux: Add missing binaries (issue #2394) 2018-02-27 15:37:19 -05:00
Marshall Greenblatt
cd6ff760dd Linux: Add missing build dependency 2018-02-27 12:31:13 -05:00
Alfred Reynolds
5caccda56c Fix crash due to by delayed execution of JS functions on destroyed windows (issue #2038) 2018-02-22 15:38:12 -05:00
Dmitry Azaraev
3b499d3d11 Add unit test for crash due to by delayed execution of JS functions on destroyed windows (issue #2038) 2018-02-22 15:37:55 -05:00
Tobias Taschner
cca0bcc8e0 Windows: cmake: Add CEF_RUNTIME_LIBRARY_FLAG for overriding VS runtime type. 2018-02-22 20:00:09 +00:00
Mike Wiedenbauer
39ccd85d77 Fixes encoding issues when using a custom resource handler (issue #1906). 2018-02-22 19:05:54 +00:00
Marshall Greenblatt
0ac37cefa1 Fix OSR transparency problems (issue #2212, issue #2345) 2018-02-22 13:05:53 -05:00
Alexander Guettler
36668efc2f Fix input range handle does not follow mouse cursor with OSR (issue #2189) 2018-02-22 17:09:28 +00:00
Marshall Greenblatt
a5a5e7ff08 Windows: Fix per-monitor DPI scaling of top-level browser windows and placement of context menus (issue #2313) 2018-02-21 16:58:54 -05:00
Marshall Greenblatt
57b9cf9ddd Windows: Add per-monitor DPI support (issue #2313) 2018-02-20 17:33:25 -05:00
Marshall Greenblatt
57fb011377 Fix test flakyness in renderer process OnLoadingStateChange history state 2018-02-20 13:51:59 -05:00
Marshall Greenblatt
9e644b7538 Update to Chromium revision bc084a8b (#530369) 2018-02-19 17:38:04 -05:00
Marshall Greenblatt
ac86b61139 Remove geolocation API support (issue #2380) 2018-02-12 18:51:11 -05:00
Marshall Greenblatt
c3f2c2e91c Fix style issues from commit de1bd28 2018-02-12 18:13:51 -05:00
Marshall Greenblatt
de1bd286f8 Enable browser-side navigation by default and remove CefRenderHandler::OnBeforeNavigation (issue #2290) 2018-02-12 18:01:43 -05:00
Marshall Greenblatt
98de8e79db Fix crash when plugin is not found (issue #2379) 2018-02-12 16:24:02 -05:00
Marshall Greenblatt
d34d3d1b3b Add callbacks for network request access to cookies (issue #2374) 2018-02-06 16:06:44 -05:00
Marshall Greenblatt
d7e1312e9d Fix crashes when loading Flash plugins with extensions disabled (issue #2359) 2018-02-02 19:02:07 -05:00
Marshall Greenblatt
a2f430c6f3 Initialize required KeyedServiceFactories when extensions are disabled (issue #2359) 2018-02-02 17:44:08 -05:00
Marshall Greenblatt
128fbfb2d6 Fix crash when clicking PDF link (issue #2371) 2018-02-02 16:28:03 -05:00
Marshall Greenblatt
6006f77bd9 msvs_env.bat: Fix VS2017 path discovery and avoid CWD change (issue #2350, issue #2351) 2018-01-05 13:30:05 -05:00
Marshall Greenblatt
232f6bc427 Return Chrome 'Browser' value for DevTools remote debugging (issue #2300) 2018-01-04 18:52:30 -05:00
Marshall Greenblatt
50ca6928c3 Add CefURLRequest::ResponseWasCached method (issue #2283) 2018-01-03 16:14:29 -05:00
Marshall Greenblatt
1c7391b70a Update generated file copyright year 2018-01-03 15:46:26 -05:00
Marshall Greenblatt
0cd8169125 macOS: cmake: Don't create target name with spaces (issue #2342) 2018-01-03 15:03:15 -05:00
Dan Kegel
6e457d6bb1 - Linux: Disable gcc warning about code in comments (issue #2346).
- macOS: Fix clang warning about display_unittest.cc missing a newline (issue #2347).
2018-01-03 13:53:38 -05:00
Marshall Greenblatt
8b4b6ac2ed Linux: Fix crash when canceling the print dialog (issue #2341) 2018-01-02 13:51:02 -08:00
Dan Kegel
3750c59aaa Linux: Switch to Debian Stretch sysroot (issue #2343) 2018-01-02 14:32:32 -05:00
Marshall Greenblatt
7b3d7b8575 Return correct 'Browser' value for DevTools remote debugging (issue #2300) 2017-12-27 17:35:15 -05:00
Marshall Greenblatt
e5d0cfe639 Fix proxy service initialization (issue #2066) 2017-12-27 16:38:34 -05:00
Marshall Greenblatt
f02e7b54b3 cmake: Fix detection of tests folder 2017-12-27 15:50:38 -05:00
Marshall Greenblatt
accf1f1613 Windows: cmake: Add VS2017 15.5 build support 2017-12-27 15:50:21 -05:00
Marshall Greenblatt
a724e90d52 Windows: Fix 64-bit build warning C4267 (issue #2335) 2017-12-27 15:49:52 -05:00
Marshall Greenblatt
4ddff77339 Merge webkit_set target into //WebKit/source/controller to fix deps race (issue #2339) 2017-12-27 13:20:12 -05:00
Marshall Greenblatt
54a015f785 Fix crash when ALT+Clicking invalid protocol link (issue #2306) 2017-12-22 16:05:32 -05:00
Marshall Greenblatt
f052e282dd Fix crash when using CefJSDialogHandler with the default dialog implementation (issue #2329) 2017-12-21 16:47:20 -05:00
Marshall Greenblatt
2fe9f7bd31 Windows: Fix x64 compile error (issue #2332) 2017-12-21 15:43:29 -05:00
Marshall Greenblatt
cafa5954dc Fix crash when creating JS popup with no URL (issue #2330) 2017-12-21 14:57:42 -05:00
Marshall Greenblatt
d8bc3d8372 Fix assertion when calling SendProcessMessage from non-UI thread (issue #2325) 2017-12-19 15:14:00 -05:00
SergeyAvd
4c5ccce85f Fix typos in the comments that generate the documentation 2017-12-18 18:46:41 -05:00
Mario Pistrich
552a3bf353 Add log level to CefDisplayHandler::OnConsoleMessage (issue #2234) 2017-12-18 18:36:56 -05:00
Marshall Greenblatt
c04652d193 Windows: Fix ui/base/ui_features.h file not found component build error 2017-12-18 18:32:53 -05:00
Andrei Kurushin
56557833d9 Windows: Fix non x2 HiDPI OSR paint crop (issue #2299) 2017-12-18 19:37:36 +00:00
Marshall Greenblatt
6a9a51222e Fix README typo 2017-12-18 14:18:03 -05:00
Marshall Greenblatt
14c030174e Linux: Add missing swiftshader binaries to distribution (issue #2321) 2017-12-18 11:07:45 -08:00
Marshall Greenblatt
8d51acb9be Update to Chromium revision 5fdc0fab (#520840)
- Windows now builds with clang by default.
2017-12-14 15:31:07 -05:00
Marshall Greenblatt
d5e141648b Fix OSR accessibility tests (issue #2312) 2017-12-12 15:57:46 -05:00
Tammo Hinrichs
4c795f5188 OSR: Fix GPU->CPU readback performance issues (issue #2046) 2017-12-05 13:05:12 -05:00
Marshall Greenblatt
7fe13d87c6 Fix accessibility information (issue #2312) 2017-12-04 14:20:06 -05:00
Marshall Greenblatt
7dcabf547b macOS: Fix build of widevinecdmadapter.plugin (issue #2314) 2017-12-04 12:41:57 -05:00
Marshall Greenblatt
69178d519e Fix bugs and test failures with browser-side navigation (issue #2290) 2017-11-30 18:20:24 -05:00
Per Lundberg
493bec52c9 README.md: Update CefSharp link 2017-11-30 15:37:05 -05:00
amaitland
b14167ad04 cmake: Don't require test projects with minimal distribution (issue #2169) 2017-11-30 15:36:58 -05:00
Tamas Lustyik
85d041c0e2 Making it possible to bridge C++ wrapper classes to C (issue #2311). 2017-11-28 15:57:10 +00:00
Tamas Lustyik
be2160e6c3 macOS: Added guard to previously overlooked C++ include (issue #2297) 2017-11-28 15:52:00 +00:00
Marshall Greenblatt
232a68480e cmake: Add v8_context_snapshot.bin binary file 2017-11-27 12:18:05 -05:00
Marshall Greenblatt
facee1f750 - Add cache awareness to CefURLRequest (issue #2283)
- Properly set referer values on server requests (issue #2278)
2017-11-17 17:14:05 -05:00
Marshall Greenblatt
7e783d6a37 Linux: Fix missing ui::Service symbols (issue #2294) 2017-11-16 12:23:51 -05:00
Marshall Greenblatt
059ed41926 Linux: Don't generate Chromium installer packages (issue #2301) 2017-11-15 19:28:16 -05:00
Marshall Greenblatt
7840b4f406 Enable Brotli encoding (issue #2303) 2017-11-15 17:21:34 -05:00
Lk Xf
4a6e9b636e Allow inclusion of cef_application_mac.h from pure C/ObjC (issue #2297) 2017-11-15 19:55:16 +00:00
Marshall Greenblatt
89a1f2b372 Add CefServer API for handling HTTP/WebSocket requests (issue #2278) 2017-11-15 12:00:36 -05:00
Marshall Greenblatt
bfdc2655ad Windows: Add VS2017.4 build support 2017-11-01 16:27:40 -04:00
Marshall Greenblatt
51136f6541 cmake: Fix accidental version dependency break (issue #2293) 2017-11-01 16:27:34 -04:00
Marshall Greenblatt
9f7bdcf7d5 Don't create 'GPUCache' and 'databases' directories when cache-path is unspecified (issue #2289) 2017-10-30 16:52:39 -04:00
Marshall Greenblatt
486e69e23b Windows: Add missing swiftshader binaries to distribution (issue #2291) 2017-10-30 14:49:25 -04:00
Marshall Greenblatt
c506c8c5c0 Windows: Don't recommend is_win_fastlink=true with VS2017 (issue #1691) 2017-10-27 19:02:59 -04:00
342 changed files with 9075 additions and 9004 deletions

View File

@@ -13,14 +13,14 @@
# Optionally configure GN by setting the `GN_DEFINES` and/or `GN_ARGUMENTS` # Optionally configure GN by setting the `GN_DEFINES` and/or `GN_ARGUMENTS`
# environment variables. # environment variables.
# #
# Example A: Use /DEBUG:FASTLINK on Windows: # Example A: Create an official build on Windows:
# #
# > set GN_DEFINES=is_win_fastlink=true # > set GN_DEFINES=is_official_build=true
# #
# Example B: Generate VS2015 project files in addition to the default Ninja # Example B: Generate VS2017 project files in addition to the default Ninja
# build files on Windows: # build files on Windows:
# #
# > set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/* # > set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/*
# #
# After completing the "GN Automated Build" or "GN Manual Build" section # After completing the "GN Automated Build" or "GN Manual Build" section
# open "out\<build_dir>\cef.sln" for editing and debugging. Building must # open "out\<build_dir>\cef.sln" for editing and debugging. Building must
@@ -111,18 +111,20 @@ import("//third_party/icu/config.gni")
import("//third_party/widevine/cdm/widevine.gni") import("//third_party/widevine/cdm/widevine.gni")
import("//tools/grit/repack.gni") import("//tools/grit/repack.gni")
import("//tools/grit/grit_rule.gni") import("//tools/grit/grit_rule.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("//v8/gni/v8.gni") import("//v8/gni/v8.gni")
if (is_clang) { if (is_clang) {
import("//build/config/clang/clang.gni") import("//build/config/clang/clang.gni")
} }
if (is_linux) { if (is_linux) {
import("//build/config/linux/pkg_config.gni") import("//build/config/linux/pkg_config.gni")
import("//third_party/fontconfig/fontconfig.gni")
} }
if (is_mac) { if (is_mac) {
import("//build/config/mac/rules.gni") import("//build/config/mac/rules.gni")
import("//build/mac/tweak_info_plist.gni") import("//build/mac/tweak_info_plist.gni")
import("//build/util/version.gni") import("//build/util/version.gni")
import("//media/cdm/ppapi/cdm_paths.gni") import("//media/cdm/library_cdm/cdm_paths.gni")
} }
if (is_win) { if (is_win) {
import("//build/config/win/console_app.gni") import("//build/config/win/console_app.gni")
@@ -147,6 +149,12 @@ if (is_clang) {
assert(!clang_use_chrome_plugins) assert(!clang_use_chrome_plugins)
} }
if (is_linux) {
# Use system fontconfig. This avoids a startup hang on Ubuntu 16.04.4 (see
# issue #2424).
assert(!use_bundled_fontconfig)
}
if (is_mac) { if (is_mac) {
# Always generate dSYM files. The make_distrib script will fail if # Always generate dSYM files. The make_distrib script will fail if
# enable_dsyms=true is not explicitly set when is_official_build=false. # enable_dsyms=true is not explicitly set when is_official_build=false.
@@ -263,12 +271,12 @@ if (is_win) {
deps = [ deps = [
"//components/crash/core/common", # crash_keys "//components/crash/core/common", # crash_keys
"//gpu/config:crash_keys",
# Required by chrome_switches.cc # Required by chrome_switches.cc
"//chrome/common:features", "//chrome/common:buildflags",
"//ppapi/features:features", "//ppapi/features:features",
"//printing/features:features", "//printing/features:features",
"//ui/base:ui_features",
] ]
} }
} }
@@ -280,6 +288,8 @@ static_library("libcef_static") {
"libcef/browser/browser_context.h", "libcef/browser/browser_context.h",
"libcef/browser/browser_context_impl.cc", "libcef/browser/browser_context_impl.cc",
"libcef/browser/browser_context_impl.h", "libcef/browser/browser_context_impl.h",
"libcef/browser/browser_context_keyed_service_factories.cc",
"libcef/browser/browser_context_keyed_service_factories.h",
"libcef/browser/browser_context_proxy.cc", "libcef/browser/browser_context_proxy.cc",
"libcef/browser/browser_context_proxy.h", "libcef/browser/browser_context_proxy.h",
"libcef/browser/browser_host_impl.cc", "libcef/browser/browser_host_impl.cc",
@@ -329,8 +339,6 @@ static_library("libcef_static") {
"libcef/browser/extensions/api/storage/sync_value_store_cache.h", "libcef/browser/extensions/api/storage/sync_value_store_cache.h",
"libcef/browser/extensions/api/tabs/tabs_api.cc", "libcef/browser/extensions/api/tabs/tabs_api.cc",
"libcef/browser/extensions/api/tabs/tabs_api.h", "libcef/browser/extensions/api/tabs/tabs_api.h",
"libcef/browser/extensions/browser_context_keyed_service_factories.cc",
"libcef/browser/extensions/browser_context_keyed_service_factories.h",
"libcef/browser/extensions/browser_extensions_util.cc", "libcef/browser/extensions/browser_extensions_util.cc",
"libcef/browser/extensions/browser_extensions_util.h", "libcef/browser/extensions/browser_extensions_util.h",
"libcef/browser/extensions/browser_platform_delegate_background.cc", "libcef/browser/extensions/browser_platform_delegate_background.cc",
@@ -372,7 +380,6 @@ static_library("libcef_static") {
"libcef/browser/file_dialog_manager.h", "libcef/browser/file_dialog_manager.h",
"libcef/browser/frame_host_impl.cc", "libcef/browser/frame_host_impl.cc",
"libcef/browser/frame_host_impl.h", "libcef/browser/frame_host_impl.h",
"libcef/browser/geolocation_impl.cc",
"libcef/browser/image_impl.cc", "libcef/browser/image_impl.cc",
"libcef/browser/image_impl.h", "libcef/browser/image_impl.h",
"libcef/browser/javascript_dialog_runner.h", "libcef/browser/javascript_dialog_runner.h",
@@ -441,16 +448,6 @@ static_library("libcef_static") {
"libcef/browser/osr/web_contents_view_osr.cc", "libcef/browser/osr/web_contents_view_osr.cc",
"libcef/browser/osr/web_contents_view_osr.h", "libcef/browser/osr/web_contents_view_osr.h",
"libcef/browser/path_util_impl.cc", "libcef/browser/path_util_impl.cc",
"libcef/browser/pepper/browser_pepper_host_factory.cc",
"libcef/browser/pepper/browser_pepper_host_factory.h",
"libcef/browser/permissions/permission_context.cc",
"libcef/browser/permissions/permission_context.h",
"libcef/browser/permissions/permission_manager.cc",
"libcef/browser/permissions/permission_manager.h",
"libcef/browser/permissions/permission_util.cc",
"libcef/browser/permissions/permission_util.h",
"libcef/browser/plugins/plugin_info_message_filter.cc",
"libcef/browser/plugins/plugin_info_message_filter.h",
"libcef/browser/plugins/plugin_service_filter.cc", "libcef/browser/plugins/plugin_service_filter.cc",
"libcef/browser/plugins/plugin_service_filter.h", "libcef/browser/plugins/plugin_service_filter.h",
"libcef/browser/prefs/browser_prefs.cc", "libcef/browser/prefs/browser_prefs.cc",
@@ -592,16 +589,6 @@ static_library("libcef_static") {
"libcef/renderer/extensions/print_render_frame_helper_delegate.h", "libcef/renderer/extensions/print_render_frame_helper_delegate.h",
"libcef/renderer/frame_impl.cc", "libcef/renderer/frame_impl.cc",
"libcef/renderer/frame_impl.h", "libcef/renderer/frame_impl.h",
"libcef/renderer/media/cef_key_systems.cc",
"libcef/renderer/media/cef_key_systems.h",
"libcef/renderer/pepper/pepper_helper.cc",
"libcef/renderer/pepper/pepper_helper.h",
"libcef/renderer/pepper/renderer_pepper_host_factory.cc",
"libcef/renderer/pepper/renderer_pepper_host_factory.h",
"libcef/renderer/plugins/cef_plugin_placeholder.cc",
"libcef/renderer/plugins/cef_plugin_placeholder.h",
"libcef/renderer/plugins/plugin_preroller.cc",
"libcef/renderer/plugins/plugin_preroller.h",
"libcef/renderer/render_frame_observer.cc", "libcef/renderer/render_frame_observer.cc",
"libcef/renderer/render_frame_observer.h", "libcef/renderer/render_frame_observer.h",
"libcef/renderer/render_frame_util.cc", "libcef/renderer/render_frame_util.cc",
@@ -667,6 +654,7 @@ static_library("libcef_static") {
"//chrome/child", "//chrome/child",
"//chrome/common", "//chrome/common",
"//chrome/renderer", "//chrome/renderer",
"//chrome/services/printing:lib",
"//chrome/utility", "//chrome/utility",
"//components/cdm/renderer", "//components/cdm/renderer",
"//components/content_settings/core/browser", "//components/content_settings/core/browser",
@@ -708,8 +696,6 @@ static_library("libcef_static") {
"//content/public/utility", "//content/public/utility",
"//crypto", "//crypto",
"//device/base", "//device/base",
"//device/geolocation",
"//device/hid",
"//extensions/browser", "//extensions/browser",
"//extensions/browser/api:api_registration", "//extensions/browser/api:api_registration",
"//extensions/common/api", "//extensions/common/api",
@@ -727,13 +713,15 @@ static_library("libcef_static") {
"//pdf", "//pdf",
"//ppapi/features", "//ppapi/features",
"//printing/features", "//printing/features",
"//services/network:network_service",
"//services/network/public/cpp",
"//services/service_manager/embedder", "//services/service_manager/embedder",
"//services/service_manager/public/interfaces", "//services/service_manager/public/cpp",
"//services/service_manager/runner/common", "//services/service_manager/runner/common",
"//skia", "//skia",
"//storage/browser", "//storage/browser",
"//third_party/brotli:dec", "//third_party/brotli:dec",
"//third_party/cld", "//third_party/cld_3/src/src:cld_3",
"//third_party/hunspell", "//third_party/hunspell",
"//third_party/leveldatabase", "//third_party/leveldatabase",
"//third_party/libxml", "//third_party/libxml",
@@ -742,7 +730,6 @@ static_library("libcef_static") {
"//third_party/widevine/cdm:widevinecdmadapter", "//third_party/widevine/cdm:widevinecdmadapter",
"//third_party/icu", "//third_party/icu",
"//third_party/zlib:minizip", "//third_party/zlib:minizip",
"//tools/v8_context_snapshot:v8_context_snapshot",
"//ui/base", "//ui/base",
"//ui/base/ime", "//ui/base/ime",
"//ui/events:events_base", "//ui/events:events_base",
@@ -775,8 +762,6 @@ static_library("libcef_static") {
"libcef/browser/osr/browser_platform_delegate_osr_win.cc", "libcef/browser/osr/browser_platform_delegate_osr_win.cc",
"libcef/browser/osr/browser_platform_delegate_osr_win.h", "libcef/browser/osr/browser_platform_delegate_osr_win.h",
"libcef/browser/osr/render_widget_host_view_osr_win.cc", "libcef/browser/osr/render_widget_host_view_osr_win.cc",
"libcef/common/crash_reporting_win.cc",
"libcef/common/crash_reporting_win.h",
# Part of //chrome/utility. # Part of //chrome/utility.
"//chrome/utility/printing_handler.cc", "//chrome/utility/printing_handler.cc",
@@ -837,7 +822,7 @@ static_library("libcef_static") {
} }
if (is_win || is_mac) { if (is_win || is_mac) {
deps += [ "//third_party/crashpad/crashpad/handler:handler_lib" ] deps += [ "//third_party/crashpad/crashpad/handler" ]
} }
if (use_x11) { if (use_x11) {
@@ -845,12 +830,21 @@ static_library("libcef_static") {
} }
if (is_posix && !is_mac) { if (is_posix && !is_mac) {
sources += [
"libcef/common/cef_crash_report_utils.cc",
"libcef/common/cef_crash_report_utils.h",
]
deps += [ deps += [
"//components/crash/content/app", "//components/crash/content/app",
"//components/crash/content/browser", "//components/crash/content/browser",
] ]
} }
if (v8_use_external_startup_data && use_v8_context_snapshot) {
deps += [ "//tools/v8_context_snapshot" ]
}
if (use_aura) { if (use_aura) {
sources += [ sources += [
"libcef/browser/native/window_delegate_view.cc", "libcef/browser/native/window_delegate_view.cc",
@@ -925,6 +919,7 @@ static_library("libcef_static") {
] ]
deps += [ deps += [
"//services/ui",
"//ui/aura", "//ui/aura",
"//ui/events", "//ui/events",
"//ui/strings", "//ui/strings",
@@ -942,6 +937,11 @@ static_library("libcef_static") {
if (is_win) { if (is_win) {
sources += [ sources += [
# Support for UI input events. # Support for UI input events.
# Part of //base/test:test_config which is testingonly.
"//base/test/test_switches.cc",
"//base/test/test_switches.h",
"//base/test/test_timeouts.cc",
"//base/test/test_timeouts.h",
# Part of //ui/aura:test_support which is testingonly. # Part of //ui/aura:test_support which is testingonly.
"//ui/aura/test/ui_controls_factory_aurawin.cc", "//ui/aura/test/ui_controls_factory_aurawin.cc",
# Part of //ui/base:test_support which is testingonly. # Part of //ui/base:test_support which is testingonly.
@@ -1029,6 +1029,10 @@ if (is_win) {
# #
cef_packaged_services = [ cef_packaged_services = [
"//chrome/app:chrome_manifest", # For spell checking.
"//chrome/app:chrome_renderer_manifest", # For spell checking.
"//chrome/services/printing:manifest",
"//services/metrics:manifest",
"//services/proxy_resolver:proxy_resolver_manifest", "//services/proxy_resolver:proxy_resolver_manifest",
] ]
@@ -1147,6 +1151,7 @@ repack("pak_extensions") {
"$root_gen_dir/chrome/component_extension_resources.pak", "$root_gen_dir/chrome/component_extension_resources.pak",
"$root_gen_dir/extensions/extensions_renderer_resources.pak", "$root_gen_dir/extensions/extensions_renderer_resources.pak",
"$root_gen_dir/extensions/extensions_resources.pak", "$root_gen_dir/extensions/extensions_resources.pak",
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
"$root_gen_dir/ui/resources/webui_resources.pak", "$root_gen_dir/ui/resources/webui_resources.pak",
] ]
@@ -1157,6 +1162,7 @@ repack("pak_extensions") {
"//chrome/browser/resources:component_extension_resources", "//chrome/browser/resources:component_extension_resources",
"//extensions:extensions_renderer_resources", "//extensions:extensions_renderer_resources",
"//extensions:extensions_resources_grd", "//extensions:extensions_resources_grd",
"//mojo/public/js:resources",
"//ui/resources:webui_resources_grd", "//ui/resources:webui_resources_grd",
] ]
@@ -1351,7 +1357,6 @@ if (is_mac) {
"$root_out_dir/cef_200_percent.pak", "$root_out_dir/cef_200_percent.pak",
"$root_out_dir/cef_extensions.pak", "$root_out_dir/cef_extensions.pak",
"$root_out_dir/devtools_resources.pak", "$root_out_dir/devtools_resources.pak",
"$root_out_dir/v8_context_snapshot.bin",
"$root_out_dir/$widevine_cdm_path/widevinecdmadapter.plugin", "$root_out_dir/$widevine_cdm_path/widevinecdmadapter.plugin",
] ]
@@ -1362,7 +1367,6 @@ if (is_mac) {
":pak_devtools", ":pak_devtools",
":pak_extensions", ":pak_extensions",
"//third_party/widevine/cdm:widevinecdmadapter", "//third_party/widevine/cdm:widevinecdmadapter",
"//tools/v8_context_snapshot:v8_context_snapshot",
] ]
if (icu_use_data_file) { if (icu_use_data_file) {
@@ -1376,6 +1380,10 @@ if (is_mac) {
"$root_out_dir/snapshot_blob.bin", "$root_out_dir/snapshot_blob.bin",
] ]
public_deps += [ "//v8" ] public_deps += [ "//v8" ]
if (use_v8_context_snapshot) {
sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
public_deps += [ "//tools/v8_context_snapshot" ]
}
} }
outputs = [ outputs = [
@@ -1442,6 +1450,7 @@ if (is_mac) {
deps = [ deps = [
":libcef_static", ":libcef_static",
"//build/config:exe_and_shlib_deps",
] ]
if (is_win) { if (is_win) {
@@ -1462,9 +1471,12 @@ if (is_mac) {
] ]
} }
if (is_linux && !is_debug && !using_sanitizer && use_allocator=="none") { if (is_linux && !is_debug && use_allocator=="none") {
# Only export necessary symbols from libcef.so. # Only export necessary symbols from libcef.so.
# Don't do this in Debug builds because it causes the resulting application to crash. # Don't do this in Debug builds because it causes the resulting
# application to crash.
# Also need to do this for ASAN builds to work around
# https://crbug.com/832808.
ldflags = [ "-Wl,--version-script=" + ldflags = [ "-Wl,--version-script=" +
rebase_path("//cef/libcef_dll/libcef.lst") ] rebase_path("//cef/libcef_dll/libcef.lst") ]
} }
@@ -1853,9 +1865,6 @@ if (is_mac) {
deps += [ deps += [
":cef_sandbox", ":cef_sandbox",
"//build/win:default_exe_manifest", "//build/win:default_exe_manifest",
# Tool that can be used for testing crash reporting.
"//content/shell:content_shell_crash_service",
] ]
libs = [ libs = [

View File

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

View File

@@ -42,7 +42,7 @@ The CEF project is an extension of the Chromium project. CEF maintains developme
The base CEF framework includes support for the C and C++ programming languages. Thanks to the hard work of external maintainers CEF can integrate with a number of other programming languages and frameworks. These external projects are not maintained by CEF so please contact the respective project maintainer if you have any questions or issues. The base CEF framework includes support for the C and C++ programming languages. Thanks to the hard work of external maintainers CEF can integrate with a number of other programming languages and frameworks. These external projects are not maintained by CEF so please contact the respective project maintainer if you have any questions or issues.
* .Net - https://github.com/chillitom/CefSharp * .Net (CEF3) - https://github.com/cefsharp/CefSharp
* .Net (CEF1) - https://bitbucket.org/fddima/cefglue * .Net (CEF1) - https://bitbucket.org/fddima/cefglue
* .Net/Mono (CEF3) - https://bitbucket.org/xilium/xilium.cefglue * .Net/Mono (CEF3) - https://bitbucket.org/xilium/xilium.cefglue
* .Net (CEF3) - https://bitbucket.org/chromiumfx/chromiumfx * .Net (CEF3) - https://bitbucket.org/chromiumfx/chromiumfx
@@ -82,4 +82,4 @@ If you would like to contribute source code changes to CEF please follow the bel
* Be submitted against the current [CEF master branch](https://bitbucket.org/chromiumembedded/cef/src/?at=master) unless explicitly fixing a bug in a CEF release branch. * Be submitted against the current [CEF master branch](https://bitbucket.org/chromiumembedded/cef/src/?at=master) unless explicitly fixing a bug in a CEF release branch.
* Follow the style of existing CEF source files. In general CEF uses the [Chromium coding style](http://www.chromium.org/developers/coding-style). * Follow the style of existing CEF source files. In general CEF uses the [Chromium coding style](http://www.chromium.org/developers/coding-style).
* Include new or modified unit tests as appropriate to the functionality. * Include new or modified unit tests as appropriate to the functionality.
* Not include unnecessary or unrelated changes. * Not include unnecessary or unrelated changes.

View File

@@ -8,7 +8,7 @@
# by hand. See the translator.README.txt file in the tools directory for # by hand. See the translator.README.txt file in the tools directory for
# more information. # more information.
# #
# $hash=5f69924ad7517dee8adf933a7c013616ebb94c36$ # $hash=67bc21133e37f5361a39f25dcfe004616d467dbc$
# #
{ {
@@ -38,8 +38,6 @@
'include/cef_find_handler.h', 'include/cef_find_handler.h',
'include/cef_focus_handler.h', 'include/cef_focus_handler.h',
'include/cef_frame.h', 'include/cef_frame.h',
'include/cef_geolocation.h',
'include/cef_geolocation_handler.h',
'include/cef_image.h', 'include/cef_image.h',
'include/cef_jsdialog_handler.h', 'include/cef_jsdialog_handler.h',
'include/cef_keyboard_handler.h', 'include/cef_keyboard_handler.h',
@@ -131,8 +129,6 @@
'include/capi/cef_find_handler_capi.h', 'include/capi/cef_find_handler_capi.h',
'include/capi/cef_focus_handler_capi.h', 'include/capi/cef_focus_handler_capi.h',
'include/capi/cef_frame_capi.h', 'include/capi/cef_frame_capi.h',
'include/capi/cef_geolocation_capi.h',
'include/capi/cef_geolocation_handler_capi.h',
'include/capi/cef_image_capi.h', 'include/capi/cef_image_capi.h',
'include/capi/cef_jsdialog_handler_capi.h', 'include/capi/cef_jsdialog_handler_capi.h',
'include/capi/cef_keyboard_handler_capi.h', 'include/capi/cef_keyboard_handler_capi.h',
@@ -286,14 +282,8 @@
'libcef_dll/ctocpp/focus_handler_ctocpp.h', 'libcef_dll/ctocpp/focus_handler_ctocpp.h',
'libcef_dll/cpptoc/frame_cpptoc.cc', 'libcef_dll/cpptoc/frame_cpptoc.cc',
'libcef_dll/cpptoc/frame_cpptoc.h', 'libcef_dll/cpptoc/frame_cpptoc.h',
'libcef_dll/cpptoc/geolocation_callback_cpptoc.cc',
'libcef_dll/cpptoc/geolocation_callback_cpptoc.h',
'libcef_dll/ctocpp/geolocation_handler_ctocpp.cc',
'libcef_dll/ctocpp/geolocation_handler_ctocpp.h',
'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.cc', 'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.cc',
'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.h', 'libcef_dll/cpptoc/get_extension_resource_callback_cpptoc.h',
'libcef_dll/ctocpp/get_geolocation_callback_ctocpp.cc',
'libcef_dll/ctocpp/get_geolocation_callback_ctocpp.h',
'libcef_dll/cpptoc/image_cpptoc.cc', 'libcef_dll/cpptoc/image_cpptoc.cc',
'libcef_dll/cpptoc/image_cpptoc.h', 'libcef_dll/cpptoc/image_cpptoc.h',
'libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc', 'libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc',
@@ -442,6 +432,8 @@
'libcef_dll/ctocpp/urlrequest_client_ctocpp.h', 'libcef_dll/ctocpp/urlrequest_client_ctocpp.h',
'libcef_dll/ctocpp/v8accessor_ctocpp.cc', 'libcef_dll/ctocpp/v8accessor_ctocpp.cc',
'libcef_dll/ctocpp/v8accessor_ctocpp.h', 'libcef_dll/ctocpp/v8accessor_ctocpp.h',
'libcef_dll/ctocpp/v8array_buffer_release_callback_ctocpp.cc',
'libcef_dll/ctocpp/v8array_buffer_release_callback_ctocpp.h',
'libcef_dll/cpptoc/v8context_cpptoc.cc', 'libcef_dll/cpptoc/v8context_cpptoc.cc',
'libcef_dll/cpptoc/v8context_cpptoc.h', 'libcef_dll/cpptoc/v8context_cpptoc.h',
'libcef_dll/cpptoc/v8exception_cpptoc.cc', 'libcef_dll/cpptoc/v8exception_cpptoc.cc',
@@ -572,14 +564,8 @@
'libcef_dll/cpptoc/focus_handler_cpptoc.h', 'libcef_dll/cpptoc/focus_handler_cpptoc.h',
'libcef_dll/ctocpp/frame_ctocpp.cc', 'libcef_dll/ctocpp/frame_ctocpp.cc',
'libcef_dll/ctocpp/frame_ctocpp.h', 'libcef_dll/ctocpp/frame_ctocpp.h',
'libcef_dll/ctocpp/geolocation_callback_ctocpp.cc',
'libcef_dll/ctocpp/geolocation_callback_ctocpp.h',
'libcef_dll/cpptoc/geolocation_handler_cpptoc.cc',
'libcef_dll/cpptoc/geolocation_handler_cpptoc.h',
'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.cc', 'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.cc',
'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.h', 'libcef_dll/ctocpp/get_extension_resource_callback_ctocpp.h',
'libcef_dll/cpptoc/get_geolocation_callback_cpptoc.cc',
'libcef_dll/cpptoc/get_geolocation_callback_cpptoc.h',
'libcef_dll/ctocpp/image_ctocpp.cc', 'libcef_dll/ctocpp/image_ctocpp.cc',
'libcef_dll/ctocpp/image_ctocpp.h', 'libcef_dll/ctocpp/image_ctocpp.h',
'libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc', 'libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc',
@@ -728,6 +714,8 @@
'libcef_dll/cpptoc/urlrequest_client_cpptoc.h', 'libcef_dll/cpptoc/urlrequest_client_cpptoc.h',
'libcef_dll/cpptoc/v8accessor_cpptoc.cc', 'libcef_dll/cpptoc/v8accessor_cpptoc.cc',
'libcef_dll/cpptoc/v8accessor_cpptoc.h', 'libcef_dll/cpptoc/v8accessor_cpptoc.h',
'libcef_dll/cpptoc/v8array_buffer_release_callback_cpptoc.cc',
'libcef_dll/cpptoc/v8array_buffer_release_callback_cpptoc.h',
'libcef_dll/ctocpp/v8context_ctocpp.cc', 'libcef_dll/ctocpp/v8context_ctocpp.cc',
'libcef_dll/ctocpp/v8context_ctocpp.h', 'libcef_dll/ctocpp/v8context_ctocpp.h',
'libcef_dll/ctocpp/v8exception_ctocpp.cc', 'libcef_dll/ctocpp/v8exception_ctocpp.cc',

View File

@@ -442,7 +442,6 @@
'tests/ceftests/extensions/view_unittest.cc', 'tests/ceftests/extensions/view_unittest.cc',
'tests/ceftests/file_util_unittest.cc', 'tests/ceftests/file_util_unittest.cc',
'tests/ceftests/frame_unittest.cc', 'tests/ceftests/frame_unittest.cc',
'tests/ceftests/geolocation_unittest.cc',
'tests/ceftests/image_unittest.cc', 'tests/ceftests/image_unittest.cc',
'tests/ceftests/image_util.cc', 'tests/ceftests/image_util.cc',
'tests/ceftests/image_util.h', 'tests/ceftests/image_util.h',

View File

@@ -86,6 +86,7 @@ if(OS_LINUX)
-Werror # Treat warnings as errors -Werror # Treat warnings as errors
-Wno-missing-field-initializers # Don't warn about missing field initializers -Wno-missing-field-initializers # Don't warn about missing field initializers
-Wno-unused-parameter # Don't warn about unused parameters -Wno-unused-parameter # Don't warn about unused parameters
-Wno-error=comment # Don't complain about code in ascii art
) )
list(APPEND CEF_C_COMPILER_FLAGS list(APPEND CEF_C_COMPILER_FLAGS
-std=c99 # Use the C99 language standard -std=c99 # Use the C99 language standard
@@ -197,9 +198,12 @@ if(OS_LINUX)
set(CEF_BINARY_FILES set(CEF_BINARY_FILES
chrome-sandbox chrome-sandbox
libcef.so libcef.so
libEGL.so
libGLESv2.so
natives_blob.bin natives_blob.bin
snapshot_blob.bin snapshot_blob.bin
v8_context_snapshot.bin v8_context_snapshot.bin
swiftshader
) )
# List of CEF resource files. # List of CEF resource files.
@@ -349,6 +353,13 @@ if(OS_WINDOWS)
# Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385). # Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use") set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
# Consumers using different runtime types may want to pass different flags
set(CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Optional flag specifying which runtime to use")
if (CEF_RUNTIME_LIBRARY_FLAG)
list(APPEND CEF_COMPILER_FLAGS_DEBUG ${CEF_RUNTIME_LIBRARY_FLAG}d)
list(APPEND CEF_COMPILER_FLAGS_RELEASE ${CEF_RUNTIME_LIBRARY_FLAG})
endif()
# Platform-specific compiler/linker flags. # Platform-specific compiler/linker flags.
set(CEF_LIBTYPE STATIC) set(CEF_LIBTYPE STATIC)
list(APPEND CEF_COMPILER_FLAGS list(APPEND CEF_COMPILER_FLAGS
@@ -368,12 +379,10 @@ if(OS_WINDOWS)
${CEF_DEBUG_INFO_FLAG} ${CEF_DEBUG_INFO_FLAG}
) )
list(APPEND CEF_COMPILER_FLAGS_DEBUG list(APPEND CEF_COMPILER_FLAGS_DEBUG
/MTd # Multithreaded debug runtime
/RTC1 # Disable optimizations /RTC1 # Disable optimizations
/Od # Enable basic run-time checks /Od # Enable basic run-time checks
) )
list(APPEND CEF_COMPILER_FLAGS_RELEASE list(APPEND CEF_COMPILER_FLAGS_RELEASE
/MT # Multithreaded release runtime
/O2 # Optimize for maximum speed /O2 # Optimize for maximum speed
/Ob2 # Inline any suitable function /Ob2 # Inline any suitable function
/GF # Enable string pooling /GF # Enable string pooling

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=2a93a2e7a17c81d39ad1b8c1c1aa93d5d90b1100$ // $hash=1dbb0adf7ac5fd42b5a79d271834781664a7fd47$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
@@ -48,7 +48,6 @@
#include "include/capi/cef_drag_handler_capi.h" #include "include/capi/cef_drag_handler_capi.h"
#include "include/capi/cef_find_handler_capi.h" #include "include/capi/cef_find_handler_capi.h"
#include "include/capi/cef_focus_handler_capi.h" #include "include/capi/cef_focus_handler_capi.h"
#include "include/capi/cef_geolocation_handler_capi.h"
#include "include/capi/cef_jsdialog_handler_capi.h" #include "include/capi/cef_jsdialog_handler_capi.h"
#include "include/capi/cef_keyboard_handler_capi.h" #include "include/capi/cef_keyboard_handler_capi.h"
#include "include/capi/cef_life_span_handler_capi.h" #include "include/capi/cef_life_span_handler_capi.h"
@@ -115,13 +114,6 @@ typedef struct _cef_client_t {
struct _cef_focus_handler_t*(CEF_CALLBACK* get_focus_handler)( struct _cef_focus_handler_t*(CEF_CALLBACK* get_focus_handler)(
struct _cef_client_t* self); struct _cef_client_t* self);
///
// Return the handler for geolocation permissions requests. If no handler is
// provided geolocation access will be denied by default.
///
struct _cef_geolocation_handler_t*(CEF_CALLBACK* get_geolocation_handler)(
struct _cef_client_t* self);
/// ///
// Return the handler for JavaScript dialogs. If no handler is provided the // Return the handler for JavaScript dialogs. If no handler is provided the
// default implementation will be used. // default implementation will be used.

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=e0605a0c9918e225b9282b6d5e6138a7d697945b$ // $hash=00e6d1aa80d5998d89cc272dcb199cde0add12fa$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
@@ -159,6 +159,16 @@ typedef struct _cef_cookie_manager_t {
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager( CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
struct _cef_completion_callback_t* callback); struct _cef_completion_callback_t* callback);
///
// Returns a cookie manager that neither stores nor retrieves cookies. All usage
// of cookies will be blocked including cookies accessed via the network
// (request/response headers), via JavaScript (document.cookie), and via
// cef_cookie_manager_t functions. No cookies will be displayed in DevTools. If
// you wish to only block cookies sent via the network use the
// cef_request_tHandler CanGetCookies and CanSetCookie functions instead.
///
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_blocking_manager();
/// ///
// Creates a new cookie manager. If |path| is NULL data will be stored in memory // Creates a new cookie manager. If |path| is NULL data will be stored in memory
// only. Otherwise, data will be stored at the specified |path|. To persist // only. Otherwise, data will be stored at the specified |path|. To persist

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=0a8f009404aedce3f63f83864f754df60c36b293$ // $hash=e4da4fab11e33d34d70714be22e6f72579586ffe$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_
@@ -129,14 +129,12 @@ extern "C" {
// //
// CrashKeys section: // CrashKeys section:
// //
// Any number of crash keys can be specified for use by the application. Crash // A maximum of 26 crash keys of each size can be specified for use by the
// key values will be truncated based on the specified size (small = 63 bytes, // application. Crash key values will be truncated based on the specified size
// medium = 252 bytes, large = 1008 bytes). The value of crash keys can be set // (small = 64 bytes, medium = 256 bytes, large = 1024 bytes). The value of
// from any thread or process using the CefSetCrashKeyValue function. These // crash keys can be set from any thread or process using the
// key/value pairs will be sent to the crash server along with the crash dump // CefSetCrashKeyValue function. These key/value pairs will be sent to the crash
// file. Medium and large values will be chunked for submission. For example, if // server along with the crash dump file.
// your key is named "mykey" then the value will be broken into ordered chunks
// and submitted using keys named "mykey-1", "mykey-2", etc.
/// ///
CEF_EXPORT int cef_crash_reporting_enabled(); CEF_EXPORT int cef_crash_reporting_enabled();

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=68988be0c2e0a1481ee6b27930391976c7041317$ // $hash=c7641e41aca6bf30b9c36092861f061d2b16ff82$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_
@@ -118,6 +118,7 @@ typedef struct _cef_display_handler_t {
/// ///
int(CEF_CALLBACK* on_console_message)(struct _cef_display_handler_t* self, int(CEF_CALLBACK* on_console_message)(struct _cef_display_handler_t* self,
struct _cef_browser_t* browser, struct _cef_browser_t* browser,
cef_log_severity_t level,
const cef_string_t* message, const cef_string_t* message,
const cef_string_t* source, const cef_string_t* source,
int line); int line);
@@ -131,6 +132,15 @@ typedef struct _cef_display_handler_t {
int(CEF_CALLBACK* on_auto_resize)(struct _cef_display_handler_t* self, int(CEF_CALLBACK* on_auto_resize)(struct _cef_display_handler_t* self,
struct _cef_browser_t* browser, struct _cef_browser_t* browser,
const cef_size_t* new_size); const cef_size_t* new_size);
///
// Called when the overall page loading progress has changed. |progress|
// ranges from 0.0 to 1.0.
///
void(CEF_CALLBACK* on_loading_progress_change)(
struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
double progress);
} cef_display_handler_t; } cef_display_handler_t;
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -1,79 +0,0 @@
// 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=2af1552c0d2dada94c325be8249bfd889b22ca58$
//
#ifndef CEF_INCLUDE_CAPI_CEF_GEOLOCATION_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_GEOLOCATION_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Implement this structure to receive geolocation updates. The functions of
// this structure will be called on the browser process UI thread.
///
typedef struct _cef_get_geolocation_callback_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Called with the 'best available' location information or, if the location
// update failed, with error information.
///
void(CEF_CALLBACK* on_location_update)(
struct _cef_get_geolocation_callback_t* self,
const struct _cef_geoposition_t* position);
} cef_get_geolocation_callback_t;
///
// Request a one-time geolocation update. This function bypasses any user
// permission checks so should only be used by code that is allowed to access
// location information.
///
CEF_EXPORT int cef_get_geolocation(cef_get_geolocation_callback_t* callback);
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_GEOLOCATION_CAPI_H_

View File

@@ -1,106 +0,0 @@
// 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=33573a1b0f1caa917899c087b9febe83c2cfd41f$
//
#ifndef CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_browser_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Callback structure used for asynchronous continuation of geolocation
// permission requests.
///
typedef struct _cef_geolocation_callback_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Call to allow or deny geolocation access.
///
void(CEF_CALLBACK* cont)(struct _cef_geolocation_callback_t* self, int allow);
} cef_geolocation_callback_t;
///
// Implement this structure to handle events related to geolocation permission
// requests. The functions of this structure will be called on the browser
// process UI thread.
///
typedef struct _cef_geolocation_handler_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Called when a page requests permission to access geolocation information.
// |requesting_url| is the URL requesting permission and |request_id| is the
// unique ID for the permission request. Return true (1) and call
// cef_geolocation_callback_t::cont() either in this function or at a later
// time to continue or cancel the request. Return false (0) to cancel the
// request immediately.
///
int(CEF_CALLBACK* on_request_geolocation_permission)(
struct _cef_geolocation_handler_t* self,
struct _cef_browser_t* browser,
const cef_string_t* requesting_url,
int request_id,
struct _cef_geolocation_callback_t* callback);
///
// Called when a geolocation access request is canceled. |request_id| is the
// unique ID for the permission request.
///
void(CEF_CALLBACK* on_cancel_geolocation_permission)(
struct _cef_geolocation_handler_t* self,
struct _cef_browser_t* browser,
int request_id);
} cef_geolocation_handler_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=3fb1034cb02cfeddcaf02d8fde0dec5b8a18f416$ // $hash=f2f3acb1df9815e4ac9bf34010ce260a2496ae5a$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
@@ -202,6 +202,17 @@ typedef struct _cef_render_handler_t {
const cef_range_t* selected_range, const cef_range_t* selected_range,
size_t character_boundsCount, size_t character_boundsCount,
cef_rect_t const* character_bounds); cef_rect_t const* character_bounds);
///
// Called when text selection has changed for the specified |browser|.
// |selected_text| is the currently selected text and |selected_range| is the
// character range.
///
void(CEF_CALLBACK* on_text_selection_changed)(
struct _cef_render_handler_t* self,
struct _cef_browser_t* browser,
const cef_string_t* selected_text,
const cef_range_t* selected_range);
} cef_render_handler_t; } cef_render_handler_t;
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=44b61ca19efaae0a664d6d502d550755fbf326fa$ // $hash=fb34d81715ada28d5509cd33aa36f37829933a91$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_
@@ -102,19 +102,6 @@ typedef struct _cef_render_process_handler_t {
struct _cef_load_handler_t*(CEF_CALLBACK* get_load_handler)( struct _cef_load_handler_t*(CEF_CALLBACK* get_load_handler)(
struct _cef_render_process_handler_t* self); struct _cef_render_process_handler_t* self);
///
// Called before browser navigation. Return true (1) to cancel the navigation
// or false (0) to allow the navigation to proceed. The |request| object
// cannot be modified in this callback.
///
int(CEF_CALLBACK* on_before_navigation)(
struct _cef_render_process_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame,
struct _cef_request_t* request,
cef_navigation_type_t navigation_type,
int is_redirect);
/// ///
// Called immediately after the V8 context for a frame has been created. To // Called immediately after the V8 context for a frame has been created. To
// retrieve the JavaScript 'window' object use the // retrieve the JavaScript 'window' object use the

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=52ba75e5a733ed0be9a064b9794c0181e714c090$ // $hash=95e44047a75693dbae0ab6b07b415d188252bfdf$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
@@ -112,12 +112,15 @@ typedef struct _cef_request_handler_t {
// If the navigation is allowed cef_load_handler_t::OnLoadStart and // If the navigation is allowed cef_load_handler_t::OnLoadStart and
// cef_load_handler_t::OnLoadEnd will be called. If the navigation is canceled // cef_load_handler_t::OnLoadEnd will be called. If the navigation is canceled
// cef_load_handler_t::OnLoadError will be called with an |errorCode| value of // cef_load_handler_t::OnLoadError will be called with an |errorCode| value of
// ERR_ABORTED. // ERR_ABORTED. The |user_gesture| value will be true (1) if the browser
// navigated via explicit user gesture (e.g. clicking a link) or false (0) if
// it navigated automatically (e.g. via the DomContentLoaded event).
/// ///
int(CEF_CALLBACK* on_before_browse)(struct _cef_request_handler_t* self, int(CEF_CALLBACK* on_before_browse)(struct _cef_request_handler_t* self,
struct _cef_browser_t* browser, struct _cef_browser_t* browser,
struct _cef_frame_t* frame, struct _cef_frame_t* frame,
struct _cef_request_t* request, struct _cef_request_t* request,
int user_gesture,
int is_redirect); int is_redirect);
/// ///
@@ -247,6 +250,29 @@ typedef struct _cef_request_handler_t {
const cef_string_t* scheme, const cef_string_t* scheme,
struct _cef_auth_callback_t* callback); struct _cef_auth_callback_t* callback);
///
// Called on the IO thread before sending a network request with a "Cookie"
// request header. Return true (1) to allow cookies to be included in the
// network request or false (0) to block cookies. The |request| object should
// not be modified in this callback.
///
int(CEF_CALLBACK* can_get_cookies)(struct _cef_request_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame,
struct _cef_request_t* request);
///
// Called on the IO thread when receiving a network request with a "Set-
// Cookie" response header value represented by |cookie|. Return true (1) to
// allow the cookie to be stored or false (0) to block the cookie. The
// |request| object should not be modified in this callback.
///
int(CEF_CALLBACK* can_set_cookie)(struct _cef_request_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame,
struct _cef_request_t* request,
const struct _cef_cookie_t* cookie);
/// ///
// Called on the IO thread when JavaScript requests a specific storage quota // Called on the IO thread when JavaScript requests a specific storage quota
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the // size via the webkitStorageInfo.requestQuota function. |origin_url| is the

View File

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

View File

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

View File

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

View File

@@ -46,7 +46,6 @@
#include "include/cef_drag_handler.h" #include "include/cef_drag_handler.h"
#include "include/cef_find_handler.h" #include "include/cef_find_handler.h"
#include "include/cef_focus_handler.h" #include "include/cef_focus_handler.h"
#include "include/cef_geolocation_handler.h"
#include "include/cef_jsdialog_handler.h" #include "include/cef_jsdialog_handler.h"
#include "include/cef_keyboard_handler.h" #include "include/cef_keyboard_handler.h"
#include "include/cef_life_span_handler.h" #include "include/cef_life_span_handler.h"
@@ -108,15 +107,6 @@ class CefClient : public virtual CefBaseRefCounted {
/*--cef()--*/ /*--cef()--*/
virtual CefRefPtr<CefFocusHandler> GetFocusHandler() { return NULL; } virtual CefRefPtr<CefFocusHandler> GetFocusHandler() { return NULL; }
///
// Return the handler for geolocation permissions requests. If no handler is
// provided geolocation access will be denied by default.
///
/*--cef()--*/
virtual CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() {
return NULL;
}
/// ///
// Return the handler for JavaScript dialogs. If no handler is provided the // Return the handler for JavaScript dialogs. If no handler is provided the
// default implementation will be used. // default implementation will be used.

View File

@@ -64,6 +64,17 @@ class CefCookieManager : public virtual CefBaseRefCounted {
static CefRefPtr<CefCookieManager> GetGlobalManager( static CefRefPtr<CefCookieManager> GetGlobalManager(
CefRefPtr<CefCompletionCallback> callback); CefRefPtr<CefCompletionCallback> callback);
///
// Returns a cookie manager that neither stores nor retrieves cookies. All
// usage of cookies will be blocked including cookies accessed via the network
// (request/response headers), via JavaScript (document.cookie), and via
// CefCookieManager methods. No cookies will be displayed in DevTools. If you
// wish to only block cookies sent via the network use the CefRequestHandler
// CanGetCookies and CanSetCookie methods instead.
///
/*--cef()--*/
static CefRefPtr<CefCookieManager> GetBlockingManager();
/// ///
// Creates a new cookie manager. If |path| is empty data will be stored in // Creates a new cookie manager. If |path| is empty data will be stored in
// memory only. Otherwise, data will be stored at the specified |path|. To // memory only. Otherwise, data will be stored at the specified |path|. To

View File

@@ -121,14 +121,12 @@
// //
// CrashKeys section: // CrashKeys section:
// //
// Any number of crash keys can be specified for use by the application. Crash // A maximum of 26 crash keys of each size can be specified for use by the
// key values will be truncated based on the specified size (small = 63 bytes, // application. Crash key values will be truncated based on the specified size
// medium = 252 bytes, large = 1008 bytes). The value of crash keys can be set // (small = 64 bytes, medium = 256 bytes, large = 1024 bytes). The value of
// from any thread or process using the CefSetCrashKeyValue function. These // crash keys can be set from any thread or process using the
// key/value pairs will be sent to the crash server along with the crash dump // CefSetCrashKeyValue function. These key/value pairs will be sent to the crash
// file. Medium and large values will be chunked for submission. For example, // server along with the crash dump file.
// if your key is named "mykey" then the value will be broken into ordered
// chunks and submitted using keys named "mykey-1", "mykey-2", etc.
/// ///
/*--cef()--*/ /*--cef()--*/
bool CefCrashReportingEnabled(); bool CefCrashReportingEnabled();

View File

@@ -109,6 +109,7 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
/// ///
/*--cef(optional_param=message,optional_param=source)--*/ /*--cef(optional_param=message,optional_param=source)--*/
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser, virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
cef_log_severity_t level,
const CefString& message, const CefString& message,
const CefString& source, const CefString& source,
int line) { int line) {
@@ -126,6 +127,14 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
const CefSize& new_size) { const CefSize& new_size) {
return false; return false;
} }
///
// Called when the overall page loading progress has changed. |progress|
// ranges from 0.0 to 1.0.
///
/*--cef()--*/
virtual void OnLoadingProgressChange(CefRefPtr<CefBrowser> browser,
double progress) {}
}; };
#endif // CEF_INCLUDE_CEF_DISPLAY_HANDLER_H_ #endif // CEF_INCLUDE_CEF_DISPLAY_HANDLER_H_

View File

@@ -1,66 +0,0 @@
// Copyright (c) 2012 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.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_GEOLOCATION_H_
#define CEF_INCLUDE_CEF_GEOLOCATION_H_
#pragma once
#include "include/cef_base.h"
///
// Implement this interface to receive geolocation updates. The methods of this
// class will be called on the browser process UI thread.
///
/*--cef(source=client)--*/
class CefGetGeolocationCallback : public virtual CefBaseRefCounted {
public:
///
// Called with the 'best available' location information or, if the location
// update failed, with error information.
///
/*--cef()--*/
virtual void OnLocationUpdate(const CefGeoposition& position) = 0;
};
///
// Request a one-time geolocation update. This function bypasses any user
// permission checks so should only be used by code that is allowed to access
// location information.
///
/*--cef()--*/
bool CefGetGeolocation(CefRefPtr<CefGetGeolocationCallback> callback);
#endif // CEF_INCLUDE_CEF_GEOLOCATION_H_

View File

@@ -1,92 +0,0 @@
// Copyright (c) 2012 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.
//
// ---------------------------------------------------------------------------
//
// The contents of this file must follow a specific format in order to
// support the CEF translator tool. See the translator.README.txt file in the
// tools directory for more information.
//
#ifndef CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_
#define CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_
#pragma once
#include "include/cef_base.h"
#include "include/cef_browser.h"
///
// Callback interface used for asynchronous continuation of geolocation
// permission requests.
///
/*--cef(source=library)--*/
class CefGeolocationCallback : public virtual CefBaseRefCounted {
public:
///
// Call to allow or deny geolocation access.
///
/*--cef(capi_name=cont)--*/
virtual void Continue(bool allow) = 0;
};
///
// Implement this interface to handle events related to geolocation permission
// requests. The methods of this class will be called on the browser process UI
// thread.
///
/*--cef(source=client)--*/
class CefGeolocationHandler : public virtual CefBaseRefCounted {
public:
///
// Called when a page requests permission to access geolocation information.
// |requesting_url| is the URL requesting permission and |request_id| is the
// unique ID for the permission request. Return true and call
// CefGeolocationCallback::Continue() either in this method or at a later
// time to continue or cancel the request. Return false to cancel the request
// immediately.
///
/*--cef()--*/
virtual bool OnRequestGeolocationPermission(
CefRefPtr<CefBrowser> browser,
const CefString& requesting_url,
int request_id,
CefRefPtr<CefGeolocationCallback> callback) {
return false;
}
///
// Called when a geolocation access request is canceled. |request_id| is the
// unique ID for the permission request.
///
/*--cef()--*/
virtual void OnCancelGeolocationPermission(CefRefPtr<CefBrowser> browser,
int request_id) {}
};
#endif // CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_

View File

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

View File

@@ -92,20 +92,6 @@ class CefRenderProcessHandler : public virtual CefBaseRefCounted {
/*--cef()--*/ /*--cef()--*/
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() { return NULL; } virtual CefRefPtr<CefLoadHandler> GetLoadHandler() { return NULL; }
///
// Called before browser navigation. Return true to cancel the navigation or
// false to allow the navigation to proceed. The |request| object cannot be
// modified in this callback.
///
/*--cef()--*/
virtual bool OnBeforeNavigation(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
NavigationType navigation_type,
bool is_redirect) {
return false;
}
/// ///
// Called immediately after the V8 context for a frame has been created. To // Called immediately after the V8 context for a frame has been created. To
// retrieve the JavaScript 'window' object use the CefV8Context::GetGlobal() // retrieve the JavaScript 'window' object use the CefV8Context::GetGlobal()

View File

@@ -106,12 +106,15 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
// If the navigation is allowed CefLoadHandler::OnLoadStart and // If the navigation is allowed CefLoadHandler::OnLoadStart and
// CefLoadHandler::OnLoadEnd will be called. If the navigation is canceled // CefLoadHandler::OnLoadEnd will be called. If the navigation is canceled
// CefLoadHandler::OnLoadError will be called with an |errorCode| value of // CefLoadHandler::OnLoadError will be called with an |errorCode| value of
// ERR_ABORTED. // ERR_ABORTED. The |user_gesture| value will be true if the browser
// navigated via explicit user gesture (e.g. clicking a link) or false if it
// navigated automatically (e.g. via the DomContentLoaded event).
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser, virtual bool OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame, CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request, CefRefPtr<CefRequest> request,
bool user_gesture,
bool is_redirect) { bool is_redirect) {
return false; return false;
} }
@@ -252,6 +255,33 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
return false; return false;
} }
///
// Called on the IO thread before sending a network request with a "Cookie"
// request header. Return true to allow cookies to be included in the network
// request or false to block cookies. The |request| object should not be
// modified in this callback.
///
/*--cef()--*/
virtual bool CanGetCookies(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request) {
return true;
}
///
// Called on the IO thread when receiving a network request with a
// "Set-Cookie" response header value represented by |cookie|. Return true to
// allow the cookie to be stored or false to block the cookie. The |request|
// object should not be modified in this callback.
///
/*--cef()--*/
virtual bool CanSetCookie(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
const CefCookie& cookie) {
return true;
}
/// ///
// Called on the IO thread when JavaScript requests a specific storage quota // Called on the IO thread when JavaScript requests a specific storage quota
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the // size via the webkitStorageInfo.requestQuota function. |origin_url| is the

View File

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

View File

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

View File

@@ -94,6 +94,11 @@ typedef enum {
/// ///
LOGSEVERITY_VERBOSE, LOGSEVERITY_VERBOSE,
///
// DEBUG logging.
///
LOGSEVERITY_DEBUG = LOGSEVERITY_VERBOSE,
/// ///
// INFO logging. // INFO logging.
/// ///
@@ -1259,6 +1264,12 @@ typedef enum {
// originated in the browser process. // originated in the browser process.
/// ///
UR_FLAG_NO_RETRY_ON_5XX = 1 << 5, UR_FLAG_NO_RETRY_ON_5XX = 1 << 5,
///
// If set 3XX responses will cause the fetch to halt immediately rather than
// continue through the redirect.
///
UR_FLAG_STOP_ON_REDIRECT = 1 << 6,
} cef_urlrequest_flags_t; } cef_urlrequest_flags_t;
/// ///
@@ -1374,38 +1385,49 @@ typedef enum {
/// ///
// The main thread in the browser. This will be the same as the main // The main thread in the browser. This will be the same as the main
// application thread if CefInitialize() is called with a // application thread if CefInitialize() is called with a
// CefSettings.multi_threaded_message_loop value of false. // CefSettings.multi_threaded_message_loop value of false. Do not perform
// blocking tasks on this thread. All tasks posted after
// CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown()
// are guaranteed to run. This thread will outlive all other CEF threads.
/// ///
TID_UI, TID_UI,
/// ///
// Used to interact with the database. // Used for blocking tasks (e.g. file system access) where the user won't
// notice if the task takes an arbitrarily long time to complete. All tasks
// posted after CefBrowserProcessHandler::OnContextInitialized() and before
// CefShutdown() are guaranteed to run.
/// ///
TID_DB, TID_FILE_BACKGROUND,
TID_FILE = TID_FILE_BACKGROUND,
/// ///
// Used to interact with the file system. // Used for blocking tasks (e.g. file system access) that affect UI or
// responsiveness of future user interactions. Do not use if an immediate
// response to a user interaction is expected. All tasks posted after
// CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown()
// are guaranteed to run.
// Examples:
// - Updating the UI to reflect progress on a long task.
// - Loading data that might be shown in the UI after a future user
// interaction.
/// ///
TID_FILE, TID_FILE_USER_VISIBLE,
/// ///
// Used for file system operations that block user interactions. // Used for blocking tasks (e.g. file system access) that affect UI
// Responsiveness of this thread affects users. // immediately after a user interaction. All tasks posted after
// CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown()
// are guaranteed to run.
// Example: Generating data shown in the UI immediately after a click.
/// ///
TID_FILE_USER_BLOCKING, TID_FILE_USER_BLOCKING,
/// ///
// Used to launch and terminate browser processes. // Used to process IPC and network messages. Do not perform blocking tasks on
/// // this thread. All tasks posted after
TID_PROCESS_LAUNCHER, // CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown()
// are guaranteed to run.
///
// Used to handle slow HTTP cache operations.
///
TID_CACHE,
///
// Used to process IPC and network messages.
/// ///
TID_IO, TID_IO,
@@ -1413,6 +1435,10 @@ typedef enum {
/// ///
// The main thread in the renderer. Used for all WebKit and V8 interaction. // The main thread in the renderer. Used for all WebKit and V8 interaction.
// Tasks may be posted to this thread after
// CefRenderProcessHandler::OnRenderThreadCreated but are not guaranteed to
// run before sub-process termination (sub-processes may be killed at any time
// without warning).
/// ///
TID_RENDERER, TID_RENDERER,
} cef_thread_id_t; } cef_thread_id_t;
@@ -2041,74 +2067,6 @@ typedef enum {
FILE_DIALOG_HIDEREADONLY_FLAG = 0x02000000, FILE_DIALOG_HIDEREADONLY_FLAG = 0x02000000,
} cef_file_dialog_mode_t; } cef_file_dialog_mode_t;
///
// Geoposition error codes.
///
typedef enum {
GEOPOSITON_ERROR_NONE = 0,
GEOPOSITON_ERROR_PERMISSION_DENIED,
GEOPOSITON_ERROR_POSITION_UNAVAILABLE,
GEOPOSITON_ERROR_TIMEOUT,
} cef_geoposition_error_code_t;
///
// Structure representing geoposition information. The properties of this
// structure correspond to those of the JavaScript Position object although
// their types may differ.
///
typedef struct _cef_geoposition_t {
///
// Latitude in decimal degrees north (WGS84 coordinate frame).
///
double latitude;
///
// Longitude in decimal degrees west (WGS84 coordinate frame).
///
double longitude;
///
// Altitude in meters (above WGS84 datum).
///
double altitude;
///
// Accuracy of horizontal position in meters.
///
double accuracy;
///
// Accuracy of altitude in meters.
///
double altitude_accuracy;
///
// Heading in decimal degrees clockwise from true north.
///
double heading;
///
// Horizontal component of device velocity in meters per second.
///
double speed;
///
// Time of position measurement in milliseconds since Epoch in UTC time. This
// is taken from the host computer's system clock.
///
cef_time_t timestamp;
///
// Error code, see enum above.
///
cef_geoposition_error_code_t error_code;
///
// Human-readable error message.
///
cef_string_t error_message;
} cef_geoposition_t;
/// ///
// Print job color mode values. // Print job color mode values.
/// ///

View File

@@ -832,37 +832,6 @@ struct CefCookieTraits {
/// ///
typedef CefStructBase<CefCookieTraits> CefCookie; typedef CefStructBase<CefCookieTraits> CefCookie;
struct CefGeopositionTraits {
typedef cef_geoposition_t struct_type;
static inline void init(struct_type* s) {}
static inline void clear(struct_type* s) {
cef_string_clear(&s->error_message);
}
static inline void set(const struct_type* src,
struct_type* target,
bool copy) {
target->latitude = src->latitude;
target->longitude = src->longitude;
target->altitude = src->altitude;
target->accuracy = src->accuracy;
target->altitude_accuracy = src->altitude_accuracy;
target->heading = src->heading;
target->speed = src->speed;
target->timestamp = src->timestamp;
target->error_code = src->error_code;
cef_string_set(src->error_message.str, src->error_message.length,
&target->error_message, copy);
}
};
///
// Class representing a geoposition.
///
typedef CefStructBase<CefGeopositionTraits> CefGeoposition;
struct CefCursorInfoTraits { struct CefCursorInfoTraits {
typedef cef_cursor_info_t struct_type; typedef cef_cursor_info_t struct_type;

View File

@@ -9,6 +9,7 @@
#include "libcef/common/extensions/extensions_util.h" #include "libcef/common/extensions/extensions_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/user_prefs/user_prefs.h" #include "components/user_prefs/user_prefs.h"
@@ -68,6 +69,9 @@ void CefBrowserContext::PostInitialize() {
const bool extensions_enabled = extensions::ExtensionsEnabled(); const bool extensions_enabled = extensions::ExtensionsEnabled();
if (extensions_enabled && !is_proxy_) if (extensions_enabled && !is_proxy_)
extension_system_->Init(); extension_system_->Init();
ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
this, resource_context_.get());
} }
void CefBrowserContext::Shutdown() { void CefBrowserContext::Shutdown() {
@@ -76,6 +80,9 @@ void CefBrowserContext::Shutdown() {
// Send notifications to clean up objects associated with this Profile. // Send notifications to clean up objects associated with this Profile.
MaybeSendDestroyedNotification(); MaybeSendDestroyedNotification();
ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext(
resource_context_.get());
// Remove any BrowserContextKeyedServiceFactory associations. This must be // Remove any BrowserContextKeyedServiceFactory associations. This must be
// called before the ProxyService owned by CefBrowserContextImpl is destroyed. // called before the ProxyService owned by CefBrowserContextImpl is destroyed.
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(

View File

@@ -12,7 +12,6 @@
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
#include "libcef/browser/download_manager_delegate.h" #include "libcef/browser/download_manager_delegate.h"
#include "libcef/browser/extensions/extension_system.h" #include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/permissions/permission_manager.h"
#include "libcef/browser/prefs/browser_prefs.h" #include "libcef/browser/prefs/browser_prefs.h"
#include "libcef/browser/request_context_impl.h" #include "libcef/browser/request_context_impl.h"
#include "libcef/browser/ssl_host_state_delegate.h" #include "libcef/browser/ssl_host_state_delegate.h"
@@ -27,11 +26,11 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "chrome/browser/font_family_cache.h" #include "chrome/browser/font_family_cache.h"
#include "chrome/browser/net/proxy_service_factory.h"
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h" #include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/guest_view/browser/guest_view_manager.h" #include "components/guest_view/browser/guest_view_manager.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
#include "components/visitedlink/browser/visitedlink_event_listener.h" #include "components/visitedlink/browser/visitedlink_event_listener.h"
#include "components/visitedlink/browser/visitedlink_master.h" #include "components/visitedlink/browser/visitedlink_master.h"
#include "components/zoom/zoom_event_manager.h" #include "components/zoom/zoom_event_manager.h"
@@ -40,7 +39,8 @@
#include "content/public/browser/storage_partition.h" #include "content/public/browser/storage_partition.h"
#include "extensions/browser/extension_protocols.h" #include "extensions/browser/extension_protocols.h"
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
#include "net/proxy/proxy_config_service.h" #include "net/proxy_resolution/proxy_config_service.h"
#include "net/proxy_resolution/proxy_service.h"
using content::BrowserThread; using content::BrowserThread;
@@ -162,7 +162,7 @@ class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener {
void CreateListenerForContext(const CefBrowserContext* context) { void CreateListenerForContext(const CefBrowserContext* context) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
auto listener = base::MakeUnique<visitedlink::VisitedLinkEventListener>( auto listener = std::make_unique<visitedlink::VisitedLinkEventListener>(
const_cast<CefBrowserContext*>(context)); const_cast<CefBrowserContext*>(context));
listener_map_.insert(std::make_pair(context, std::move(listener))); listener_map_.insert(std::make_pair(context, std::move(listener)));
} }
@@ -283,9 +283,8 @@ void CefBrowserContextImpl::Initialize() {
visitedlink_master_->Init(); visitedlink_master_->Init();
// Initialize proxy configuration tracker. // Initialize proxy configuration tracker.
pref_proxy_config_tracker_.reset( pref_proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl(
ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState( GetPrefs(), BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)));
GetPrefs()));
CefBrowserContext::PostInitialize(); CefBrowserContext::PostInitialize();
@@ -420,9 +419,7 @@ CefBrowserContextImpl::GetSSLHostStateDelegate() {
} }
content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() { content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() {
if (!permission_manager_.get()) return nullptr;
permission_manager_.reset(new CefPermissionManager(this));
return permission_manager_.get();
} }
content::BackgroundFetchDelegate* content::BackgroundFetchDelegate*
@@ -446,10 +443,18 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
DCHECK(!url_request_getter_.get()); DCHECK(!url_request_getter_.get());
auto io_thread_runner =
content::BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
// Initialize the proxy configuration service. // Initialize the proxy configuration service.
// TODO(cef): Determine if we can use the Chrome/Mojo implementation from
// https://crrev.com/d0d0d050
std::unique_ptr<net::ProxyConfigService> base_service(
net::ProxyResolutionService::CreateSystemProxyConfigService(
io_thread_runner));
std::unique_ptr<net::ProxyConfigService> proxy_config_service( std::unique_ptr<net::ProxyConfigService> proxy_config_service(
ProxyServiceFactory::CreateProxyConfigService( pref_proxy_config_tracker_->CreateTrackingProxyConfigService(
pref_proxy_config_tracker_.get())); std::move(base_service)));
if (extensions::ExtensionsEnabled()) { if (extensions::ExtensionsEnabled()) {
// Handle only chrome-extension:// requests. CEF does not support // Handle only chrome-extension:// requests. CEF does not support
@@ -464,10 +469,8 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
} }
url_request_getter_ = new CefURLRequestContextGetterImpl( url_request_getter_ = new CefURLRequestContextGetterImpl(
settings_, GetPrefs(), settings_, GetPrefs(), io_thread_runner, protocol_handlers,
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), std::move(proxy_config_service), std::move(request_interceptors));
protocol_handlers, std::move(proxy_config_service),
std::move(request_interceptors));
resource_context()->set_url_request_context_getter(url_request_getter_.get()); resource_context()->set_url_request_context_getter(url_request_getter_.get());
return url_request_getter_.get(); return url_request_getter_.get();
} }

View File

@@ -121,7 +121,6 @@ class CefBrowserContextImpl : public CefBrowserContext,
std::unique_ptr<CefDownloadManagerDelegate> download_manager_delegate_; std::unique_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
scoped_refptr<CefURLRequestContextGetterImpl> url_request_getter_; scoped_refptr<CefURLRequestContextGetterImpl> url_request_getter_;
std::unique_ptr<content::PermissionManager> permission_manager_;
std::unique_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_; std::unique_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_;
scoped_refptr<HostContentSettingsMap> host_content_settings_map_; scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
std::unique_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_; std::unique_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_;

View File

@@ -2,26 +2,34 @@
// Use of this source code is governed by a BSD-style license that can be found // Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file. // in the LICENSE file.
#include "libcef/browser/extensions/browser_context_keyed_service_factories.h" #include "libcef/browser/browser_context_keyed_service_factories.h"
#include "libcef/common/extensions/extensions_util.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h" #include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h" #include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
#include "chrome/browser/plugins/plugin_prefs_factory.h"
#include "chrome/browser/spellchecker/spellcheck_factory.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h" #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
#include "extensions/browser/api/alarms/alarm_manager.h" #include "extensions/browser/api/alarms/alarm_manager.h"
#include "extensions/browser/api/storage/storage_frontend.h" #include "extensions/browser/api/storage/storage_frontend.h"
#include "extensions/browser/renderer_startup_helper.h" #include "extensions/browser/renderer_startup_helper.h"
namespace extensions {
namespace cef { namespace cef {
void EnsureBrowserContextKeyedServiceFactoriesBuilt() { void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
AlarmManager::GetFactoryInstance();
CookieSettingsFactory::GetInstance(); CookieSettingsFactory::GetInstance();
PluginPrefsFactory::GetInstance();
PrefsTabHelper::GetServiceInstance(); PrefsTabHelper::GetServiceInstance();
RendererStartupHelperFactory::GetInstance(); SpellcheckServiceFactory::GetInstance();
StorageFrontend::GetFactoryInstance(); ThemeServiceFactory::GetInstance();
StreamsPrivateAPI::GetFactoryInstance();
if (extensions::ExtensionsEnabled()) {
extensions::AlarmManager::GetFactoryInstance();
extensions::RendererStartupHelperFactory::GetInstance();
extensions::StorageFrontend::GetFactoryInstance();
extensions::StreamsPrivateAPI::GetFactoryInstance();
}
} }
} // namespace cef } // namespace cef
} // namespace extensions

View File

@@ -2,10 +2,9 @@
// Use of this source code is governed by a BSD-style license that can be found // Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file. // in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_ #ifndef CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
#define CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_ #define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
namespace extensions {
namespace cef { namespace cef {
// Ensures the existence of any BrowserContextKeyedServiceFactory provided by // Ensures the existence of any BrowserContextKeyedServiceFactory provided by
@@ -14,6 +13,5 @@ namespace cef {
void EnsureBrowserContextKeyedServiceFactoriesBuilt(); void EnsureBrowserContextKeyedServiceFactoriesBuilt();
} // namespace cef } // namespace cef
} // namespace extensions
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_ #endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_

View File

@@ -53,7 +53,7 @@
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
#include "content/public/browser/desktop_media_id.h" #include "content/public/browser/desktop_media_id.h"
#include "content/public/browser/download_manager.h" #include "content/public/browser/download_manager.h"
#include "content/public/browser/download_url_parameters.h" #include "content/public/browser/download_request_utils.h"
#include "content/public/browser/host_zoom_map.h" #include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/keyboard_event_processing_result.h" #include "content/public/browser/keyboard_event_processing_result.h"
#include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/native_web_keyboard_event.h"
@@ -745,8 +745,8 @@ void CefBrowserHostImpl::StartDownload(const CefString& url) {
if (!manager) if (!manager)
return; return;
std::unique_ptr<content::DownloadUrlParameters> params( std::unique_ptr<download::DownloadUrlParameters> params(
content::DownloadUrlParameters::CreateForWebContentsMainFrame( content::DownloadRequestUtils::CreateDownloadForWebContentsMainFrame(
web_contents(), gurl, NO_TRAFFIC_ANNOTATION_YET)); web_contents(), gurl, NO_TRAFFIC_ANNOTATION_YET));
manager->DownloadUrl(std::move(params)); manager->DownloadUrl(std::move(params));
} }
@@ -1583,15 +1583,20 @@ void CefBrowserHostImpl::CancelContextMenu() {
} }
CefRefPtr<CefFrame> CefBrowserHostImpl::GetFrameForRequest( CefRefPtr<CefFrame> CefBrowserHostImpl::GetFrameForRequest(
net::URLRequest* request) { const net::URLRequest* request) {
CEF_REQUIRE_IOT(); CEF_REQUIRE_IOT();
const content::ResourceRequestInfo* info = const content::ResourceRequestInfo* info =
content::ResourceRequestInfo::ForRequest(request); content::ResourceRequestInfo::ForRequest(request);
if (!info) if (!info)
return nullptr; return nullptr;
// The value of |IsMainFrame| is unreliable in these cases.
const bool is_main_frame_state_flaky =
info->IsDownload() ||
info->GetResourceType() == content::RESOURCE_TYPE_XHR;
return GetOrCreateFrame(info->GetRenderFrameID(), info->GetFrameTreeNodeId(), return GetOrCreateFrame(info->GetRenderFrameID(), info->GetFrameTreeNodeId(),
CefFrameHostImpl::kUnspecifiedFrameId, CefFrameHostImpl::kUnspecifiedFrameId,
info->IsMainFrame(), base::string16(), GURL()); info->IsMainFrame(), is_main_frame_state_flaky,
base::string16(), GURL());
} }
void CefBrowserHostImpl::Navigate(const CefNavigateParams& params) { void CefBrowserHostImpl::Navigate(const CefNavigateParams& params) {
@@ -2219,6 +2224,16 @@ void CefBrowserHostImpl::LoadingStateChanged(content::WebContents* source,
} }
} }
void CefBrowserHostImpl::LoadProgressChanged(content::WebContents* source,
double progress) {
if (client_.get()) {
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
if (handler.get()) {
handler->OnLoadingProgressChange(this, progress);
}
}
}
void CefBrowserHostImpl::CloseContents(content::WebContents* source) { void CefBrowserHostImpl::CloseContents(content::WebContents* source) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
@@ -2276,8 +2291,24 @@ bool CefBrowserHostImpl::DidAddMessageToConsole(
const base::string16& source_id) { const base::string16& source_id) {
if (client_.get()) { if (client_.get()) {
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler(); CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
if (handler.get()) if (handler.get()) {
return handler->OnConsoleMessage(this, message, source_id, line_no); // Use LOGSEVERITY_DEBUG for unrecognized |level| values.
cef_log_severity_t log_level = LOGSEVERITY_DEBUG;
switch (level) {
case 0:
log_level = LOGSEVERITY_INFO;
break;
case 1:
log_level = LOGSEVERITY_WARNING;
break;
case 2:
log_level = LOGSEVERITY_ERROR;
break;
}
return handler->OnConsoleMessage(this, log_level, message, source_id,
line_no);
}
} }
return false; return false;
@@ -2728,7 +2759,7 @@ void CefBrowserHostImpl::DidFinishNavigation(
CefRefPtr<CefFrame> frame = CefRefPtr<CefFrame> frame =
GetOrCreateFrame(frame_id, navigation_handle->GetFrameTreeNodeId(), GetOrCreateFrame(frame_id, navigation_handle->GetFrameTreeNodeId(),
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame,
base::string16(), url); false, base::string16(), url);
if (error_code == net::OK) { if (error_code == net::OK) {
// The navigation has been committed and there is no error. // The navigation has been committed and there is no error.
@@ -2776,7 +2807,7 @@ void CefBrowserHostImpl::DidFailLoad(
GetOrCreateFrame(render_frame_host->GetRoutingID(), GetOrCreateFrame(render_frame_host->GetRoutingID(),
render_frame_host->GetFrameTreeNodeId(), render_frame_host->GetFrameTreeNodeId(),
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame,
base::string16(), validated_url); false, base::string16(), validated_url);
OnLoadError(frame, validated_url, error_code); OnLoadError(frame, validated_url, error_code);
OnLoadEnd(frame, validated_url, error_code); OnLoadEnd(frame, validated_url, error_code);
} }
@@ -2902,7 +2933,7 @@ void CefBrowserHostImpl::OnFrameIdentified(int64 frame_id,
base::string16 name) { base::string16 name) {
bool is_main_frame = (parent_frame_id == CefFrameHostImpl::kMainFrameId); bool is_main_frame = (parent_frame_id == CefFrameHostImpl::kMainFrameId);
GetOrCreateFrame(frame_id, kUnspecifiedFrameTreeNodeId, parent_frame_id, GetOrCreateFrame(frame_id, kUnspecifiedFrameTreeNodeId, parent_frame_id,
is_main_frame, name, GURL()); is_main_frame, false, name, GURL());
} }
void CefBrowserHostImpl::OnFrameFocused( void CefBrowserHostImpl::OnFrameFocused(
@@ -2944,7 +2975,7 @@ void CefBrowserHostImpl::OnDidFinishLoad(int64 frame_id,
CefRefPtr<CefFrame> frame = CefRefPtr<CefFrame> frame =
GetOrCreateFrame(frame_id, kUnspecifiedFrameTreeNodeId, GetOrCreateFrame(frame_id, kUnspecifiedFrameTreeNodeId,
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame, CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame,
base::string16(), validated_url); false, base::string16(), validated_url);
// Give internal scheme handlers an opportunity to update content. // Give internal scheme handlers an opportunity to update content.
scheme::DidFinishLoad(frame, validated_url); scheme::DidFinishLoad(frame, validated_url);
@@ -3193,6 +3224,7 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetOrCreateFrame(
int frame_tree_node_id, int frame_tree_node_id,
int64 parent_frame_id, int64 parent_frame_id,
bool is_main_frame, bool is_main_frame,
bool is_main_frame_state_flaky,
base::string16 frame_name, base::string16 frame_name,
const GURL& frame_url) { const GURL& frame_url) {
// We need either a valid |frame_id| or a valid |frame_tree_node_id|. // We need either a valid |frame_id| or a valid |frame_tree_node_id|.
@@ -3213,12 +3245,13 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetOrCreateFrame(
if (frame_id < 0) { if (frame_id < 0) {
// With PlzNavigate the renderer process representation might not exist yet. // With PlzNavigate the renderer process representation might not exist yet.
if (is_main_frame && main_frame_id_ != CefFrameHostImpl::kInvalidFrameId) { if ((is_main_frame || is_main_frame_state_flaky) &&
main_frame_id_ != CefFrameHostImpl::kInvalidFrameId) {
// Operating in the main frame. Continue using the existing main frame // Operating in the main frame. Continue using the existing main frame
// object until the new renderer process representation is created. // object until the new renderer process representation is created.
frame_id = main_frame_id_; frame_id = main_frame_id_;
} else { } else {
if (is_main_frame) { if (is_main_frame || is_main_frame_state_flaky) {
// Always use the same pending object for the main frame. // Always use the same pending object for the main frame.
frame_tree_node_id = kMainFrameTreeNodeId; frame_tree_node_id = kMainFrameTreeNodeId;
} }
@@ -3286,9 +3319,27 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetOrCreateFrame(
} }
} }
if (!frame_created) if (!frame_created && !is_main_frame_state_flaky)
frame->SetAttributes(is_main_frame, url, name, parent_frame_id); frame->SetAttributes(is_main_frame, url, name, parent_frame_id);
#if DCHECK_IS_ON()
// The main frame should always be correctly attributed.
DCHECK(main_frame_id_ == CefFrameHostImpl::kInvalidFrameId ||
main_frame_id_ >= 0)
<< main_frame_id_;
if (main_frame_id_ == CefFrameHostImpl::kInvalidFrameId) {
// With PlzNavigate the renderer process representation might not exist yet.
DCHECK(frame_id == CefFrameHostImpl::kMainFrameId ||
frame_id == CefFrameHostImpl::kUnspecifiedFrameId)
<< frame_id;
DCHECK(frame->IsMain());
} else if (main_frame_id_ == frame_id) {
DCHECK(frame->IsMain());
} else {
DCHECK(!frame->IsMain());
}
#endif
return frame.get(); return frame.get();
} }

View File

@@ -303,7 +303,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
#endif #endif
// Returns the frame associated with the specified URLRequest. // Returns the frame associated with the specified URLRequest.
CefRefPtr<CefFrame> GetFrameForRequest(net::URLRequest* request); CefRefPtr<CefFrame> GetFrameForRequest(const net::URLRequest* request);
// Navigate as specified by the |params| argument. // Navigate as specified by the |params| argument.
void Navigate(const CefNavigateParams& params); void Navigate(const CefNavigateParams& params);
@@ -407,6 +407,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
bool* was_blocked) override; bool* was_blocked) override;
void LoadingStateChanged(content::WebContents* source, void LoadingStateChanged(content::WebContents* source,
bool to_different_document) override; bool to_different_document) override;
void LoadProgressChanged(content::WebContents* source,
double progress) override;
void CloseContents(content::WebContents* source) override; void CloseContents(content::WebContents* source) override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override; void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
bool DidAddMessageToConsole(content::WebContents* source, bool DidAddMessageToConsole(content::WebContents* source,
@@ -478,7 +480,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
// content::WebContentsObserver methods. // content::WebContentsObserver methods.
using content::WebContentsObserver::BeforeUnloadFired; using content::WebContentsObserver::BeforeUnloadFired;
using content::WebContentsObserver::WasHidden;
void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override;
void RenderFrameHostChanged(content::RenderFrameHost* old_host, void RenderFrameHostChanged(content::RenderFrameHost* old_host,
content::RenderFrameHost* new_host) override; content::RenderFrameHost* new_host) override;
@@ -585,11 +586,13 @@ class CefBrowserHostImpl : public CefBrowserHost,
// if PlzNavigate is disabled; or >= 0 otherwise. |parent_frame_id| will be // if PlzNavigate is disabled; or >= 0 otherwise. |parent_frame_id| will be
// CefFrameHostImpl::kUnspecifiedFrameId if unknown. In cases where |frame_id| // CefFrameHostImpl::kUnspecifiedFrameId if unknown. In cases where |frame_id|
// is < 0 either the existing main frame object or a pending object will be // is < 0 either the existing main frame object or a pending object will be
// returned depending on current state. // returned depending on current state. If |is_main_frame_state_flaky| is true
// then the value of |is_main_frame| cannot be relied on.
CefRefPtr<CefFrame> GetOrCreateFrame(int64 frame_id, CefRefPtr<CefFrame> GetOrCreateFrame(int64 frame_id,
int frame_tree_node_id, int frame_tree_node_id,
int64 parent_frame_id, int64 parent_frame_id,
bool is_main_frame, bool is_main_frame,
bool is_main_frame_state_flaky,
base::string16 frame_name, base::string16 frame_name,
const GURL& frame_url); const GURL& frame_url);

View File

@@ -154,7 +154,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
window_info->SetAsPopup(NULL, CefString()); window_info->SetAsPopup(NULL, CefString());
#endif #endif
auto pending_popup = base::MakeUnique<CefBrowserInfoManager::PendingPopup>(); auto pending_popup = std::make_unique<CefBrowserInfoManager::PendingPopup>();
pending_popup->step = CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW; pending_popup->step = CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW;
pending_popup->opener_process_id = opener->GetProcess()->GetID(); pending_popup->opener_process_id = opener->GetProcess()->GetID();
pending_popup->opener_frame_id = opener->GetRoutingID(); pending_popup->opener_frame_id = opener->GetRoutingID();

View File

@@ -9,12 +9,11 @@
#include <string> #include <string>
#include "libcef/browser/browser_context_impl.h" #include "libcef/browser/browser_context_impl.h"
#include "libcef/browser/browser_context_proxy.h" #include "libcef/browser/browser_context_keyed_service_factories.h"
#include "libcef/browser/browser_message_loop.h" #include "libcef/browser/browser_message_loop.h"
#include "libcef/browser/content_browser_client.h" #include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
#include "libcef/browser/devtools_manager_delegate.h" #include "libcef/browser/devtools_manager_delegate.h"
#include "libcef/browser/extensions/browser_context_keyed_service_factories.h"
#include "libcef/browser/extensions/extension_system_factory.h" #include "libcef/browser/extensions/extension_system_factory.h"
#include "libcef/browser/extensions/extensions_browser_client.h" #include "libcef/browser/extensions/extensions_browser_client.h"
#include "libcef/browser/net/chrome_scheme_handler.h" #include "libcef/browser/net/chrome_scheme_handler.h"
@@ -25,16 +24,13 @@
#include "libcef/common/net/net_resource_provider.h" #include "libcef/common/net/net_resource_provider.h"
#include "base/bind.h" #include "base/bind.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "chrome/browser/chrome_browser_main_extra_parts.h"
#include "chrome/browser/plugins/plugin_finder.h" #include "chrome/browser/plugins/plugin_finder.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/gpu_data_manager.h" #include "content/public/browser/gpu_data_manager.h"
#include "content/public/common/content_switches.h" #include "content/public/common/result_codes.h"
#include "device/geolocation/access_token_store.h"
#include "device/geolocation/geolocation_delegate.h"
#include "device/geolocation/geolocation_provider.h"
#include "extensions/browser/extension_system.h" #include "extensions/browser/extension_system.h"
#include "extensions/common/constants.h" #include "extensions/common/constants.h"
#include "net/base/net_module.h" #include "net/base/net_module.h"
@@ -64,21 +60,32 @@ CefBrowserMainParts::CefBrowserMainParts(
const content::MainFunctionParams& parameters) const content::MainFunctionParams& parameters)
: BrowserMainParts(), devtools_delegate_(NULL) {} : BrowserMainParts(), devtools_delegate_(NULL) {}
CefBrowserMainParts::~CefBrowserMainParts() {} CefBrowserMainParts::~CefBrowserMainParts() {
for (int i = static_cast<int>(chrome_extra_parts_.size()) - 1; i >= 0; --i)
void CefBrowserMainParts::PreMainMessageLoopStart() { delete chrome_extra_parts_[i];
if (!base::MessageLoop::current()) { chrome_extra_parts_.clear();
// Create the browser message loop.
message_loop_.reset(new CefBrowserMessageLoop());
}
} }
void CefBrowserMainParts::PreEarlyInitialization() { void CefBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
chrome_extra_parts_.push_back(parts);
}
int CefBrowserMainParts::PreEarlyInitialization() {
#if defined(USE_AURA) && defined(OS_LINUX) #if defined(USE_AURA) && defined(OS_LINUX)
// TODO(linux): Consider using a real input method or // TODO(linux): Consider using a real input method or
// views::LinuxUI::SetInstance. // views::LinuxUI::SetInstance.
ui::InitializeInputMethodForTesting(); ui::InitializeInputMethodForTesting();
#endif #endif
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreEarlyInitialization();
return content::RESULT_CODE_NORMAL_EXIT;
}
void CefBrowserMainParts::PostEarlyInitialization() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostEarlyInitialization();
} }
void CefBrowserMainParts::ToolkitInitialized() { void CefBrowserMainParts::ToolkitInitialized() {
@@ -94,6 +101,19 @@ void CefBrowserMainParts::ToolkitInitialized() {
CefContentBrowserClient::Get()->GetResourceDllName()); CefContentBrowserClient::Get()->GetResourceDllName());
#endif #endif
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->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();
} }
void CefBrowserMainParts::PostMainMessageLoopStart() { void CefBrowserMainParts::PostMainMessageLoopStart() {
@@ -103,6 +123,9 @@ void CefBrowserMainParts::PostMainMessageLoopStart() {
printing::PrintingContextLinux::SetPdfPaperSizeFunction( printing::PrintingContextLinux::SetPdfPaperSizeFunction(
&CefPrintDialogLinux::GetPdfPaperSize); &CefPrintDialogLinux::GetPdfPaperSize);
#endif #endif
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostMainMessageLoopStart();
} }
int CefBrowserMainParts::PreCreateThreads() { int CefBrowserMainParts::PreCreateThreads() {
@@ -116,14 +139,26 @@ int CefBrowserMainParts::PreCreateThreads() {
// before the IO thread is started. // before the IO thread is started.
content::GpuDataManager::GetInstance(); content::GpuDataManager::GetInstance();
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreCreateThreads();
return 0; return 0;
} }
void CefBrowserMainParts::ServiceManagerConnectionStarted(
content::ServiceManagerConnection* connection) {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->ServiceManagerConnectionStarted(connection);
}
void CefBrowserMainParts::PreMainMessageLoopRun() { void CefBrowserMainParts::PreMainMessageLoopRun() {
#if defined(USE_AURA) #if defined(USE_AURA)
display::Screen::SetScreenInstance(views::CreateDesktopScreen()); display::Screen::SetScreenInstance(views::CreateDesktopScreen());
#endif #endif
// CEF's profile is a BrowserContext.
PreProfileInit();
if (extensions::ExtensionsEnabled()) { if (extensions::ExtensionsEnabled()) {
// Initialize extension global objects before creating the global // Initialize extension global objects before creating the global
// BrowserContext. // BrowserContext.
@@ -133,14 +168,25 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
new extensions::CefExtensionsBrowserClient); new extensions::CefExtensionsBrowserClient);
extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
// Register additional KeyedService factories here. See
// ChromeBrowserMainExtraPartsProfiles for details.
extensions::cef::EnsureBrowserContextKeyedServiceFactoriesBuilt();
extensions::CefExtensionSystemFactory::GetInstance(); extensions::CefExtensionSystemFactory::GetInstance();
} }
// Register additional KeyedService factories here. See
// ChromeBrowserMainExtraPartsProfiles for details.
cef::EnsureBrowserContextKeyedServiceFactoriesBuilt();
printing::CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt(); printing::CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt();
background_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits(
{base::TaskPriority::BACKGROUND,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
user_visible_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits(
{base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
user_blocking_task_runner_ = base::CreateSingleThreadTaskRunnerWithTraits(
{base::TaskPriority::USER_BLOCKING,
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
CefRequestContextSettings settings; CefRequestContextSettings settings;
CefContext::Get()->PopulateRequestContextSettings(&settings); CefContext::Get()->PopulateRequestContextSettings(&settings);
@@ -150,12 +196,21 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
CefBrowserContextImpl* browser_context = static_cast<CefBrowserContextImpl*>( CefBrowserContextImpl* browser_context = static_cast<CefBrowserContextImpl*>(
global_request_context_->GetBrowserContext()); global_request_context_->GetBrowserContext());
PostProfileInit();
CefDevToolsManagerDelegate::StartHttpHandler(browser_context); CefDevToolsManagerDelegate::StartHttpHandler(browser_context);
// Triggers initialization of the singleton instance on UI thread. // Triggers initialization of the singleton instance on UI thread.
PluginFinder::GetInstance()->Init(); PluginFinder::GetInstance()->Init();
scheme::RegisterWebUIControllerFactory(); scheme::RegisterWebUIControllerFactory();
// These have no equivalent in CEF.
PreBrowserStart();
PostBrowserStart();
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreMainMessageLoopRun();
} }
void CefBrowserMainParts::PostMainMessageLoopRun() { void CefBrowserMainParts::PostMainMessageLoopRun() {
@@ -171,6 +226,9 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
extensions::ExtensionsBrowserClient::Set(NULL); extensions::ExtensionsBrowserClient::Set(NULL);
extensions_browser_client_.reset(); extensions_browser_client_.reset();
} }
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostMainMessageLoopRun();
} }
void CefBrowserMainParts::PostDestroyThreads() { void CefBrowserMainParts::PostDestroyThreads() {
@@ -179,3 +237,23 @@ void CefBrowserMainParts::PostDestroyThreads() {
delete views::ViewsDelegate::GetInstance(); delete views::ViewsDelegate::GetInstance();
#endif #endif
} }
void CefBrowserMainParts::PreProfileInit() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreProfileInit();
}
void CefBrowserMainParts::PostProfileInit() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostProfileInit();
}
void CefBrowserMainParts::PreBrowserStart() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreBrowserStart();
}
void CefBrowserMainParts::PostBrowserStart() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostBrowserStart();
}

View File

@@ -37,26 +37,51 @@ class WMState;
#endif #endif
class CefDevToolsDelegate; class CefDevToolsDelegate;
class ChromeBrowserMainExtraParts;
class CefBrowserMainParts : public content::BrowserMainParts { class CefBrowserMainParts : public content::BrowserMainParts {
public: public:
explicit CefBrowserMainParts(const content::MainFunctionParams& parameters); explicit CefBrowserMainParts(const content::MainFunctionParams& parameters);
~CefBrowserMainParts() override; ~CefBrowserMainParts() override;
// Add additional ChromeBrowserMainExtraParts.
void AddParts(ChromeBrowserMainExtraParts* parts);
int PreEarlyInitialization() override;
void PostEarlyInitialization() override;
void ToolkitInitialized() override;
void PreMainMessageLoopStart() override; void PreMainMessageLoopStart() override;
void PostMainMessageLoopStart() override; void PostMainMessageLoopStart() override;
void PreEarlyInitialization() override;
void ToolkitInitialized() override;
int PreCreateThreads() override; int PreCreateThreads() override;
void ServiceManagerConnectionStarted(
content::ServiceManagerConnection* connection);
void PreMainMessageLoopRun() override; void PreMainMessageLoopRun() override;
void PostMainMessageLoopRun() override; void PostMainMessageLoopRun() override;
void PostDestroyThreads() override; void PostDestroyThreads() override;
// Additional stages for ChromeBrowserMainExtraParts. These stages are called
// in order from PreMainMessageLoopRun(). See implementation for details.
void PreProfileInit();
void PostProfileInit();
void PreBrowserStart();
void PostBrowserStart();
CefRefPtr<CefRequestContextImpl> request_context() const { CefRefPtr<CefRequestContextImpl> request_context() const {
return global_request_context_; return global_request_context_;
} }
CefDevToolsDelegate* devtools_delegate() const { return devtools_delegate_; } CefDevToolsDelegate* devtools_delegate() const { return devtools_delegate_; }
scoped_refptr<base::SingleThreadTaskRunner> background_task_runner() const {
return background_task_runner_;
}
scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner() const {
return user_visible_task_runner_;
}
scoped_refptr<base::SingleThreadTaskRunner> user_blocking_task_runner()
const {
return user_blocking_task_runner_;
}
private: private:
#if defined(OS_WIN) #if defined(OS_WIN)
void PlatformInitialize(); void PlatformInitialize();
@@ -70,10 +95,22 @@ class CefBrowserMainParts : public content::BrowserMainParts {
std::unique_ptr<extensions::ExtensionsBrowserClient> std::unique_ptr<extensions::ExtensionsBrowserClient>
extensions_browser_client_; extensions_browser_client_;
// Blocking task runners exposed via CefTaskRunner. For consistency with
// previous named thread behavior always execute all pending tasks before
// shutdown (e.g. to make sure critical data is saved to disk).
// |background_task_runner_| is also passed to SQLitePersistentCookieStore.
scoped_refptr<base::SingleThreadTaskRunner> background_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner_;
scoped_refptr<base::SingleThreadTaskRunner> user_blocking_task_runner_;
#if defined(USE_AURA) #if defined(USE_AURA)
std::unique_ptr<wm::WMState> wm_state_; std::unique_ptr<wm::WMState> wm_state_;
#endif #endif
// Vector of additional ChromeBrowserMainExtraParts.
// Parts are deleted in the inverse order they are added.
std::vector<ChromeBrowserMainExtraParts*> chrome_extra_parts_;
DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts); DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts);
}; };

View File

@@ -36,13 +36,13 @@ std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
const CefWindowInfo& window_info, const CefWindowInfo& window_info,
SkColor background_color) { SkColor background_color) {
#if defined(OS_WIN) #if defined(OS_WIN)
return base::MakeUnique<CefBrowserPlatformDelegateNativeWin>( return std::make_unique<CefBrowserPlatformDelegateNativeWin>(
window_info, background_color); window_info, background_color);
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
return base::MakeUnique<CefBrowserPlatformDelegateNativeMac>( return std::make_unique<CefBrowserPlatformDelegateNativeMac>(
window_info, background_color); window_info, background_color);
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
return base::MakeUnique<CefBrowserPlatformDelegateNativeLinux>( return std::make_unique<CefBrowserPlatformDelegateNativeLinux>(
window_info, background_color); window_info, background_color);
#endif #endif
} }
@@ -50,13 +50,13 @@ std::unique_ptr<CefBrowserPlatformDelegateNative> CreateNativeDelegate(
std::unique_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate( std::unique_ptr<CefBrowserPlatformDelegateOsr> CreateOSRDelegate(
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate) { std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate) {
#if defined(OS_WIN) #if defined(OS_WIN)
return base::MakeUnique<CefBrowserPlatformDelegateOsrWin>( return std::make_unique<CefBrowserPlatformDelegateOsrWin>(
std::move(native_delegate)); std::move(native_delegate));
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
return base::MakeUnique<CefBrowserPlatformDelegateOsrMac>( return std::make_unique<CefBrowserPlatformDelegateOsrMac>(
std::move(native_delegate)); std::move(native_delegate));
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
return base::MakeUnique<CefBrowserPlatformDelegateOsrLinux>( return std::make_unique<CefBrowserPlatformDelegateOsrLinux>(
std::move(native_delegate)); std::move(native_delegate));
#endif #endif
} }
@@ -85,7 +85,7 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
// Creating a background extension host without a window. // Creating a background extension host without a window.
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate = std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
CreateNativeDelegate(CefWindowInfo(), background_color); CreateNativeDelegate(CefWindowInfo(), background_color);
return base::MakeUnique<CefBrowserPlatformDelegateBackground>( return std::make_unique<CefBrowserPlatformDelegateBackground>(
std::move(native_delegate)); std::move(native_delegate));
} }
#if defined(USE_AURA) #if defined(USE_AURA)
@@ -93,7 +93,7 @@ std::unique_ptr<CefBrowserPlatformDelegate> CefBrowserPlatformDelegate::Create(
// CefWindowInfo is not used in this case. // CefWindowInfo is not used in this case.
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate = std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate =
CreateNativeDelegate(CefWindowInfo(), background_color); CreateNativeDelegate(CefWindowInfo(), background_color);
return base::MakeUnique<CefBrowserPlatformDelegateViews>( return std::make_unique<CefBrowserPlatformDelegateViews>(
std::move(native_delegate), std::move(native_delegate),
static_cast<CefBrowserViewImpl*>(create_params.browser_view.get())); static_cast<CefBrowserViewImpl*>(create_params.browser_view.get()));
} }

View File

@@ -356,6 +356,9 @@ class CefBrowserURLRequest::Context
CefResponseImpl* responseImpl = CefResponseImpl* responseImpl =
static_cast<CefResponseImpl*>(response_.get()); static_cast<CefResponseImpl*>(response_.get());
responseImpl->SetURL(fetcher_->GetURL().spec());
responseImpl->SetStatus(fetcher_->GetResponseCode());
net::HttpResponseHeaders* headers = fetcher_->GetResponseHeaders(); net::HttpResponseHeaders* headers = fetcher_->GetResponseHeaders();
if (headers) if (headers)
responseImpl->SetResponseHeaders(*headers); responseImpl->SetResponseHeaders(*headers);

View File

@@ -15,7 +15,7 @@
#include "chrome/browser/printing/print_job_manager.h" #include "chrome/browser/printing/print_job_manager.h"
#include "components/net_log/chrome_net_log.h" #include "components/net_log/chrome_net_log.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "ui/message_center/message_center.h" #include "services/network/public/cpp/network_switches.h"
ChromeBrowserProcessStub::ChromeBrowserProcessStub() ChromeBrowserProcessStub::ChromeBrowserProcessStub()
: initialized_(false), : initialized_(false),
@@ -96,12 +96,7 @@ metrics::MetricsService* ChromeBrowserProcessStub::metrics_service() {
} }
rappor::RapporServiceImpl* ChromeBrowserProcessStub::rappor_service() { rappor::RapporServiceImpl* ChromeBrowserProcessStub::rappor_service() {
NOTREACHED(); // Called from PluginInfoHostImpl::ReportMetrics.
return NULL;
}
ukm::UkmRecorder* ChromeBrowserProcessStub::ukm_recorder() {
NOTREACHED();
return NULL; return NULL;
} }
@@ -115,6 +110,12 @@ ChromeBrowserProcessStub::system_network_context_manager() {
return NULL; return NULL;
} }
content::NetworkConnectionTracker*
ChromeBrowserProcessStub::network_connection_tracker() {
NOTREACHED();
return NULL;
}
WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() { WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() {
NOTREACHED(); NOTREACHED();
return NULL; return NULL;
@@ -164,12 +165,7 @@ ChromeBrowserProcessStub::notification_platform_bridge() {
return NULL; return NULL;
} }
message_center::MessageCenter* ChromeBrowserProcessStub::message_center() { policy::ChromeBrowserPolicyConnector*
NOTREACHED();
return NULL;
}
policy::BrowserPolicyConnector*
ChromeBrowserProcessStub::browser_policy_connector() { ChromeBrowserProcessStub::browser_policy_connector() {
NOTREACHED(); NOTREACHED();
return NULL; return NULL;
@@ -190,14 +186,7 @@ GpuModeManager* ChromeBrowserProcessStub::gpu_mode_manager() {
return NULL; return NULL;
} }
GpuProfileCache* ChromeBrowserProcessStub::gpu_profile_cache() { void ChromeBrowserProcessStub::CreateDevToolsProtocolHandler() {
NOTREACHED();
return NULL;
}
void ChromeBrowserProcessStub::CreateDevToolsHttpProtocolHandler(
const std::string& ip,
uint16_t port) {
NOTREACHED(); NOTREACHED();
} }
@@ -285,6 +274,12 @@ ChromeBrowserProcessStub::subresource_filter_ruleset_service() {
return NULL; return NULL;
} }
optimization_guide::OptimizationGuideService*
ChromeBrowserProcessStub::optimization_guide_service() {
NOTREACHED();
return NULL;
}
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
void ChromeBrowserProcessStub::StartAutoupdateTimer() {} void ChromeBrowserProcessStub::StartAutoupdateTimer() {}
#endif #endif
@@ -294,10 +289,10 @@ net_log::ChromeNetLog* ChromeBrowserProcessStub::net_log() {
if (!net_log_) { if (!net_log_) {
const base::CommandLine& command_line = const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess(); *base::CommandLine::ForCurrentProcess();
net_log_ = base::MakeUnique<net_log::ChromeNetLog>(); net_log_ = std::make_unique<net_log::ChromeNetLog>();
if (command_line.HasSwitch(switches::kLogNetLog)) { if (command_line.HasSwitch(network::switches::kLogNetLog)) {
net_log_->StartWritingToFile( net_log_->StartWritingToFile(
command_line.GetSwitchValuePath(switches::kLogNetLog), command_line.GetSwitchValuePath(network::switches::kLogNetLog),
GetNetCaptureModeFromCommandLine(command_line), GetNetCaptureModeFromCommandLine(command_line),
command_line.GetCommandLineString(), std::string()); command_line.GetCommandLineString(), std::string());
} }
@@ -311,11 +306,6 @@ ChromeBrowserProcessStub::component_updater() {
return NULL; return NULL;
} }
CRLSetFetcher* ChromeBrowserProcessStub::crl_set_fetcher() {
NOTREACHED();
return NULL;
}
component_updater::SupervisedUserWhitelistInstaller* component_updater::SupervisedUserWhitelistInstaller*
ChromeBrowserProcessStub::supervised_user_whitelist_installer() { ChromeBrowserProcessStub::supervised_user_whitelist_installer() {
NOTREACHED(); NOTREACHED();

View File

@@ -47,9 +47,9 @@ class ChromeBrowserProcessStub : public BrowserProcess,
override; override;
metrics::MetricsService* metrics_service() override; metrics::MetricsService* metrics_service() override;
rappor::RapporServiceImpl* rappor_service() override; rappor::RapporServiceImpl* rappor_service() override;
ukm::UkmRecorder* ukm_recorder() override;
IOThread* io_thread() override; IOThread* io_thread() override;
SystemNetworkContextManager* system_network_context_manager() override; SystemNetworkContextManager* system_network_context_manager() override;
content::NetworkConnectionTracker* network_connection_tracker() override;
WatchDogThread* watchdog_thread() override; WatchDogThread* watchdog_thread() override;
ProfileManager* profile_manager() override; ProfileManager* profile_manager() override;
PrefService* local_state() override; PrefService* local_state() override;
@@ -59,14 +59,11 @@ class ChromeBrowserProcessStub : public BrowserProcess,
extensions::EventRouterForwarder* extension_event_router_forwarder() override; extensions::EventRouterForwarder* extension_event_router_forwarder() override;
NotificationUIManager* notification_ui_manager() override; NotificationUIManager* notification_ui_manager() override;
NotificationPlatformBridge* notification_platform_bridge() override; NotificationPlatformBridge* notification_platform_bridge() override;
message_center::MessageCenter* message_center() override; policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
policy::BrowserPolicyConnector* browser_policy_connector() override;
policy::PolicyService* policy_service() override; policy::PolicyService* policy_service() override;
IconManager* icon_manager() override; IconManager* icon_manager() override;
GpuModeManager* gpu_mode_manager() override; GpuModeManager* gpu_mode_manager() override;
GpuProfileCache* gpu_profile_cache() override; void CreateDevToolsProtocolHandler() override;
void CreateDevToolsHttpProtocolHandler(const std::string& ip,
uint16_t port) override;
void CreateDevToolsAutoOpener() override; void CreateDevToolsAutoOpener() override;
bool IsShuttingDown() override; bool IsShuttingDown() override;
printing::PrintJobManager* print_job_manager() override; printing::PrintJobManager* print_job_manager() override;
@@ -87,6 +84,8 @@ class ChromeBrowserProcessStub : public BrowserProcess,
override; override;
subresource_filter::ContentRulesetService* subresource_filter::ContentRulesetService*
subresource_filter_ruleset_service() override; subresource_filter_ruleset_service() override;
optimization_guide::OptimizationGuideService* optimization_guide_service()
override;
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) #if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
void StartAutoupdateTimer() override; void StartAutoupdateTimer() override;
@@ -94,7 +93,6 @@ class ChromeBrowserProcessStub : public BrowserProcess,
net_log::ChromeNetLog* net_log() override; net_log::ChromeNetLog* net_log() override;
component_updater::ComponentUpdateService* component_updater() override; component_updater::ComponentUpdateService* component_updater() override;
CRLSetFetcher* crl_set_fetcher() override;
component_updater::SupervisedUserWhitelistInstaller* component_updater::SupervisedUserWhitelistInstaller*
supervised_user_whitelist_installer() override; supervised_user_whitelist_installer() override;
MediaFileSystemRegistry* media_file_system_registry() override; MediaFileSystemRegistry* media_file_system_registry() override;

View File

@@ -33,7 +33,6 @@ void ChromeProfileStub::DestroyOffTheRecordProfile() {
} }
bool ChromeProfileStub::HasOffTheRecordProfile() { bool ChromeProfileStub::HasOffTheRecordProfile() {
NOTREACHED();
return false; return false;
} }
@@ -41,6 +40,10 @@ Profile* ChromeProfileStub::GetOriginalProfile() {
return this; return this;
} }
const Profile* ChromeProfileStub::GetOriginalProfile() const {
return this;
}
bool ChromeProfileStub::IsSupervised() const { bool ChromeProfileStub::IsSupervised() const {
return false; return false;
} }
@@ -97,22 +100,11 @@ void ChromeProfileStub::set_last_selected_directory(
NOTREACHED(); NOTREACHED();
} }
PrefProxyConfigTracker* ChromeProfileStub::GetProxyConfigTracker() {
NOTREACHED();
return NULL;
}
chrome_browser_net::Predictor* ChromeProfileStub::GetNetworkPredictor() { chrome_browser_net::Predictor* ChromeProfileStub::GetNetworkPredictor() {
NOTREACHED(); NOTREACHED();
return NULL; return NULL;
} }
void ChromeProfileStub::ClearNetworkingHistorySince(
base::Time time,
const base::Closure& completion) {
NOTREACHED();
}
GURL ChromeProfileStub::GetHomePage() { GURL ChromeProfileStub::GetHomePage() {
NOTREACHED(); NOTREACHED();
return GURL(); return GURL();

View File

@@ -27,6 +27,7 @@ class ChromeProfileStub : public Profile {
void DestroyOffTheRecordProfile() override; void DestroyOffTheRecordProfile() override;
bool HasOffTheRecordProfile() override; bool HasOffTheRecordProfile() override;
Profile* GetOriginalProfile() override; Profile* GetOriginalProfile() override;
const Profile* GetOriginalProfile() const override;
bool IsSupervised() const override; bool IsSupervised() const override;
bool IsChild() const override; bool IsChild() const override;
bool IsLegacySupervised() const override; bool IsLegacySupervised() const override;
@@ -38,10 +39,7 @@ class ChromeProfileStub : public Profile {
base::Time GetStartTime() const override; base::Time GetStartTime() const override;
base::FilePath last_selected_directory() override; base::FilePath last_selected_directory() override;
void set_last_selected_directory(const base::FilePath& path) override; void set_last_selected_directory(const base::FilePath& path) override;
PrefProxyConfigTracker* GetProxyConfigTracker() override;
chrome_browser_net::Predictor* GetNetworkPredictor() override; chrome_browser_net::Predictor* GetNetworkPredictor() override;
void ClearNetworkingHistorySince(base::Time time,
const base::Closure& completion) override;
GURL GetHomePage() override; GURL GetHomePage() override;
bool WasCreatedByVersionOrLater(const std::string& version) override; bool WasCreatedByVersionOrLater(const std::string& version) override;
void SetExitType(ExitType exit_type) override; void SetExitType(ExitType exit_type) override;

View File

@@ -19,8 +19,6 @@
#include "libcef/browser/extensions/extension_system.h" #include "libcef/browser/extensions/extension_system.h"
#include "libcef/browser/media_capture_devices_dispatcher.h" #include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/net/chrome_scheme_handler.h" #include "libcef/browser/net/chrome_scheme_handler.h"
#include "libcef/browser/pepper/browser_pepper_host_factory.h"
#include "libcef/browser/plugins/plugin_info_message_filter.h"
#include "libcef/browser/plugins/plugin_service_filter.h" #include "libcef/browser/plugins/plugin_service_filter.h"
#include "libcef/browser/prefs/renderer_prefs.h" #include "libcef/browser/prefs/renderer_prefs.h"
#include "libcef/browser/printing/printing_message_filter.h" #include "libcef/browser/printing/printing_message_filter.h"
@@ -43,11 +41,15 @@
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "cef/grit/cef_resources.h" #include "cef/grit/cef_resources.h"
#include "chrome/browser/chrome_service.h"
#include "chrome/browser/plugins/plugin_info_host_impl.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/spellchecker/spell_check_host_impl.h" #include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/constants.mojom.h"
#include "chrome/grit/browser_resources.h" #include "chrome/grit/browser_resources.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chrome/services/printing/public/mojom/constants.mojom.h"
#include "components/navigation_interception/intercept_navigation_throttle.h" #include "components/navigation_interception/intercept_navigation_throttle.h"
#include "components/navigation_interception/navigation_params.h" #include "components/navigation_interception/navigation_params.h"
#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h" #include "components/printing/service/public/interfaces/pdf_compositor.mojom.h"
@@ -82,7 +84,7 @@
#include "extensions/common/switches.h" #include "extensions/common/switches.h"
#include "net/ssl/ssl_cert_request_info.h" #include "net/ssl/ssl_cert_request_info.h"
#include "ppapi/host/ppapi_host.h" #include "ppapi/host/ppapi_host.h"
#include "services/proxy_resolver/public/interfaces/proxy_resolver.mojom.h" #include "services/service_manager/public/mojom/connector.mojom.h"
#include "storage/browser/quota/quota_settings.h" #include "storage/browser/quota/quota_settings.h"
#include "third_party/WebKit/public/web/WebWindowFeatures.h" #include "third_party/WebKit/public/web/WebWindowFeatures.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
@@ -94,10 +96,6 @@
#include "libcef/common/widevine_loader.h" #include "libcef/common/widevine_loader.h"
#endif #endif
#if defined(OS_MACOSX)
#include "components/spellcheck/browser/spellcheck_message_filter_platform.h"
#endif
#if defined(OS_POSIX) && !defined(OS_MACOSX) #if defined(OS_POSIX) && !defined(OS_MACOSX)
#include "base/debug/leak_annotations.h" #include "base/debug/leak_annotations.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
@@ -291,7 +289,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
void RequestQuotaPermission(const content::StorageQuotaParams& params, void RequestQuotaPermission(const content::StorageQuotaParams& params,
int render_process_id, int render_process_id,
const PermissionCallback& callback) override { const PermissionCallback& callback) override {
if (params.storage_type != storage::kStorageTypePersistent) { if (params.storage_type != blink::mojom::StorageType::kPersistent) {
// To match Chrome behavior we only support requesting quota with this // To match Chrome behavior we only support requesting quota with this
// interface for Persistent storage type. // interface for Persistent storage type.
callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW); callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
@@ -428,7 +426,8 @@ bool NavigationOnUIThread(
request->SetReadOnly(true); request->SetReadOnly(true);
ignore_navigation = handler->OnBeforeBrowse( ignore_navigation = handler->OnBeforeBrowse(
browser.get(), frame, request.get(), params.is_redirect()); browser.get(), frame, request.get(), params.has_user_gesture(),
params.is_redirect());
} }
} }
} }
@@ -448,6 +447,8 @@ CefContentBrowserClient::~CefContentBrowserClient() {}
// static // static
CefContentBrowserClient* CefContentBrowserClient::Get() { CefContentBrowserClient* CefContentBrowserClient::Get() {
if (!CefContentClient::Get())
return nullptr;
return static_cast<CefContentBrowserClient*>( return static_cast<CefContentBrowserClient*>(
CefContentClient::Get()->browser()); CefContentClient::Get()->browser());
} }
@@ -455,28 +456,20 @@ CefContentBrowserClient* CefContentBrowserClient::Get() {
content::BrowserMainParts* CefContentBrowserClient::CreateBrowserMainParts( content::BrowserMainParts* CefContentBrowserClient::CreateBrowserMainParts(
const content::MainFunctionParams& parameters) { const content::MainFunctionParams& parameters) {
browser_main_parts_ = new CefBrowserMainParts(parameters); browser_main_parts_ = new CefBrowserMainParts(parameters);
browser_main_parts_->AddParts(
ChromeService::GetInstance()->CreateExtraParts());
return browser_main_parts_; return browser_main_parts_;
} }
void CefContentBrowserClient::RenderProcessWillLaunch( void CefContentBrowserClient::RenderProcessWillLaunch(
content::RenderProcessHost* host) { content::RenderProcessHost* host,
service_manager::mojom::ServiceRequest* service_request) {
const int id = host->GetID(); const int id = host->GetID();
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
host->AddFilter(new CefBrowserMessageFilter(id)); host->AddFilter(new CefBrowserMessageFilter(id));
host->AddFilter(new printing::CefPrintingMessageFilter(id, profile)); host->AddFilter(new printing::CefPrintingMessageFilter(id, profile));
#if defined(OS_MACOSX)
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
host->AddFilter(new SpellCheckMessageFilterPlatform(id));
}
#endif
host->AddFilter(new CefPluginInfoMessageFilter(
id, static_cast<CefBrowserContext*>(profile)));
if (extensions::ExtensionsEnabled()) { if (extensions::ExtensionsEnabled()) {
host->AddFilter(new extensions::ExtensionMessageFilter(id, profile)); host->AddFilter(new extensions::ExtensionMessageFilter(id, profile));
host->AddFilter( host->AddFilter(
@@ -493,6 +486,16 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
host->Send( host->Send(
new CefProcessMsg_SetIsIncognitoProcess(profile->IsOffTheRecord())); new CefProcessMsg_SetIsIncognitoProcess(profile->IsOffTheRecord()));
service_manager::mojom::ServicePtr service;
*service_request = mojo::MakeRequest(&service);
service_manager::mojom::PIDReceiverPtr pid_receiver;
service_manager::Identity renderer_identity = host->GetChildIdentity();
ChromeService::GetInstance()->connector()->StartService(
service_manager::Identity(chrome::mojom::kRendererServiceName,
renderer_identity.user_id(),
renderer_identity.instance()),
std::move(service), mojo::MakeRequest(&pid_receiver));
} }
bool CefContentBrowserClient::ShouldUseProcessPerSite( bool CefContentBrowserClient::ShouldUseProcessPerSite(
@@ -590,11 +593,22 @@ void CefContentBrowserClient::SiteInstanceDeleting(
site_instance->GetId())); site_instance->GetId()));
} }
void CefContentBrowserClient::RegisterInProcessServices(
StaticServiceMap* services) {
{
// For spell checking.
service_manager::EmbeddedServiceInfo info;
info.factory = ChromeService::GetInstance()->CreateChromeServiceFactory();
services->insert(std::make_pair(chrome::mojom::kServiceName, info));
}
}
void CefContentBrowserClient::RegisterOutOfProcessServices( void CefContentBrowserClient::RegisterOutOfProcessServices(
OutOfProcessServiceMap* services) { OutOfProcessServiceMap* services) {
(*services)[printing::mojom::kServiceName] = (*services)[printing::mojom::kServiceName] =
base::ASCIIToUTF16("PDF Compositor Service"); base::ASCIIToUTF16("PDF Compositor Service");
(*services)[printing::mojom::kChromePrintingServiceName] =
base::ASCIIToUTF16("Printing Service");
(*services)[proxy_resolver::mojom::kProxyResolverServiceName] = (*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME); l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
} }
@@ -623,6 +637,8 @@ std::vector<content::ContentBrowserClient::ServiceManifestInfo>
CefContentBrowserClient::GetExtraServiceManifests() { CefContentBrowserClient::GetExtraServiceManifests() {
return std::vector<ServiceManifestInfo>({ return std::vector<ServiceManifestInfo>({
{printing::mojom::kServiceName, IDR_PDF_COMPOSITOR_MANIFEST}, {printing::mojom::kServiceName, IDR_PDF_COMPOSITOR_MANIFEST},
{chrome::mojom::kRendererServiceName,
IDR_CHROME_RENDERER_SERVICE_MANIFEST},
}); });
} }
@@ -646,7 +662,6 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
switches::kFrameworkDirPath, switches::kFrameworkDirPath,
#endif #endif
switches::kLang,
switches::kLocalesDirPath, switches::kLocalesDirPath,
switches::kLogFile, switches::kLogFile,
switches::kLogSeverity, switches::kLogSeverity,
@@ -664,11 +679,17 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
// Propagate the following switches to the renderer command line (along with // Propagate the following switches to the renderer command line (along with
// any associated values) if present in the browser command line. // any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = { static const char* const kSwitchNames[] = {
switches::kDisableExtensions, switches::kDisablePdfExtension, switches::kDisableExtensions,
switches::kDisableScrollBounce, switches::kDisableSpellChecking, switches::kDisablePdfExtension,
switches::kEnableSpeechInput, switches::kEnableSystemFlash, switches::kDisablePlugins,
switches::kPpapiFlashArgs, switches::kPpapiFlashPath, switches::kDisableScrollBounce,
switches::kPpapiFlashVersion, switches::kUncaughtExceptionStackSize, switches::kDisableSpellChecking,
switches::kEnableSpeechInput,
switches::kEnableSystemFlash,
switches::kPpapiFlashArgs,
switches::kPpapiFlashPath,
switches::kPpapiFlashVersion,
switches::kUncaughtExceptionStackSize,
}; };
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames, command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
arraysize(kSwitchNames)); arraysize(kSwitchNames));
@@ -685,6 +706,14 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
command_line->AppendSwitch(extensions::switches::kExtensionProcess); command_line->AppendSwitch(extensions::switches::kExtensionProcess);
} }
} }
} else {
// Propagate the following switches to non-renderer command line (along with
// any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = {
switches::kLang,
};
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
arraysize(kSwitchNames));
} }
#if defined(OS_LINUX) #if defined(OS_LINUX)
@@ -898,7 +927,7 @@ void CefContentBrowserClient::DidCreatePpapiPlugin(
content::BrowserPpapiHost* browser_host) { content::BrowserPpapiHost* browser_host) {
browser_host->GetPpapiHost()->AddHostFactoryFilter( browser_host->GetPpapiHost()->AddHostFactoryFilter(
std::unique_ptr<ppapi::host::HostFactory>( std::unique_ptr<ppapi::host::HostFactory>(
new CefBrowserPepperHostFactory(browser_host))); new ChromeBrowserPepperHostFactory(browser_host)));
} }
content::DevToolsManagerDelegate* content::DevToolsManagerDelegate*
@@ -935,7 +964,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
} }
std::unique_ptr<content::NavigationThrottle> throttle = std::unique_ptr<content::NavigationThrottle> throttle =
base::MakeUnique<navigation_interception::InterceptNavigationThrottle>( std::make_unique<navigation_interception::InterceptNavigationThrottle>(
navigation_handle, base::Bind(&NavigationOnUIThread, is_main_frame, navigation_handle, base::Bind(&NavigationOnUIThread, is_main_frame,
frame_id, parent_frame_id)); frame_id, parent_frame_id));
throttles.push_back(std::move(throttle)); throttles.push_back(std::move(throttle));
@@ -943,7 +972,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
return throttles; return throttles;
} }
#if defined(OS_POSIX) && !defined(OS_MACOSX) #if defined(OS_LINUX)
void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess( void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line, const base::CommandLine& command_line,
int child_process_id, int child_process_id,
@@ -953,7 +982,7 @@ void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
mappings->Share(kCrashDumpSignal, crash_signal_fd); mappings->Share(kCrashDumpSignal, crash_signal_fd);
} }
} }
#endif // defined(OS_POSIX) && !defined(OS_MACOSX) #endif // defined(OS_LINUX)
#if defined(OS_WIN) #if defined(OS_WIN)
const wchar_t* CefContentBrowserClient::GetResourceDllName() { const wchar_t* CefContentBrowserClient::GetResourceDllName() {
@@ -979,18 +1008,21 @@ bool CefContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy) {
void CefContentBrowserClient::ExposeInterfacesToRenderer( void CefContentBrowserClient::ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry, service_manager::BinderRegistry* registry,
content::AssociatedInterfaceRegistry* associated_registry, blink::AssociatedInterfaceRegistry* associated_registry,
content::RenderProcessHost* render_process_host) { content::RenderProcessHost* host) {
const base::CommandLine* command_line = Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
base::CommandLine::ForCurrentProcess(); host->GetChannel()->AddAssociatedInterfaceForIOThread(base::Bind(
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner = &PluginInfoHostImpl::OnPluginInfoHostRequest,
content::BrowserThread::GetTaskRunnerForThread( base::MakeRefCounted<PluginInfoHostImpl>(host->GetID(), profile)));
content::BrowserThread::UI); }
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
registry->AddInterface( std::unique_ptr<net::ClientCertStore>
base::Bind(&SpellCheckHostImpl::Create, render_process_host->GetID()), CefContentBrowserClient::CreateClientCertStore(
ui_task_runner); content::ResourceContext* resource_context) {
} if (!resource_context)
return nullptr;
return static_cast<CefResourceContext*>(resource_context)
->CreateClientCertStore();
} }
void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) { void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
@@ -1012,6 +1044,21 @@ CefDevToolsDelegate* CefContentBrowserClient::devtools_delegate() const {
return browser_main_parts_->devtools_delegate(); return browser_main_parts_->devtools_delegate();
} }
scoped_refptr<base::SingleThreadTaskRunner>
CefContentBrowserClient::background_task_runner() const {
return browser_main_parts_->background_task_runner();
}
scoped_refptr<base::SingleThreadTaskRunner>
CefContentBrowserClient::user_visible_task_runner() const {
return browser_main_parts_->user_visible_task_runner();
}
scoped_refptr<base::SingleThreadTaskRunner>
CefContentBrowserClient::user_blocking_task_runner() const {
return browser_main_parts_->user_blocking_task_runner();
}
const extensions::Extension* CefContentBrowserClient::GetExtension( const extensions::Extension* CefContentBrowserClient::GetExtension(
content::SiteInstance* site_instance) { content::SiteInstance* site_instance) {
extensions::ExtensionRegistry* registry = extensions::ExtensionRegistry* registry =

View File

@@ -43,12 +43,15 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
// ContentBrowserClient implementation. // ContentBrowserClient implementation.
content::BrowserMainParts* CreateBrowserMainParts( content::BrowserMainParts* CreateBrowserMainParts(
const content::MainFunctionParams& parameters) override; const content::MainFunctionParams& parameters) override;
void RenderProcessWillLaunch(content::RenderProcessHost* host) override; void RenderProcessWillLaunch(
content::RenderProcessHost* host,
service_manager::mojom::ServiceRequest* service_request) override;
bool ShouldUseProcessPerSite(content::BrowserContext* browser_context, bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
const GURL& effective_url) override; const GURL& effective_url) override;
bool IsHandledURL(const GURL& url) override; bool IsHandledURL(const GURL& url) override;
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override; void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
void SiteInstanceDeleting(content::SiteInstance* site_instance) override; void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
void RegisterInProcessServices(StaticServiceMap* services) override;
void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override; void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override;
std::unique_ptr<base::Value> GetServiceManifestOverlay( std::unique_ptr<base::Value> GetServiceManifestOverlay(
base::StringPiece name) override; base::StringPiece name) override;
@@ -104,7 +107,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
CreateThrottlesForNavigation( CreateThrottlesForNavigation(
content::NavigationHandle* navigation_handle) override; content::NavigationHandle* navigation_handle) override;
#if defined(OS_POSIX) && !defined(OS_MACOSX) #if defined(OS_LINUX)
void GetAdditionalMappedFilesForChildProcess( void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line, const base::CommandLine& command_line,
int child_process_id, int child_process_id,
@@ -118,15 +121,22 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
void ExposeInterfacesToRenderer( void ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry, service_manager::BinderRegistry* registry,
content::AssociatedInterfaceRegistry* associated_registry, blink::AssociatedInterfaceRegistry* associated_registry,
content::RenderProcessHost* render_process_host) override; content::RenderProcessHost* render_process_host) override;
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
content::ResourceContext* resource_context) override;
// Perform browser process registration for the custom scheme. // Perform browser process registration for the custom scheme.
void RegisterCustomScheme(const std::string& scheme); void RegisterCustomScheme(const std::string& scheme);
CefRefPtr<CefRequestContextImpl> request_context() const; CefRefPtr<CefRequestContextImpl> request_context() const;
CefDevToolsDelegate* devtools_delegate() const; CefDevToolsDelegate* devtools_delegate() const;
scoped_refptr<base::SingleThreadTaskRunner> background_task_runner() const;
scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner() const;
scoped_refptr<base::SingleThreadTaskRunner> user_blocking_task_runner() const;
private: private:
// Returns the extension or app associated with |site_instance| or NULL. // Returns the extension or app associated with |site_instance| or NULL.
const extensions::Extension* GetExtension( const extensions::Extension* GetExtension(

View File

@@ -120,7 +120,8 @@ net::CookieStore* GetExistingCookieStoreHelper(
} // namespace } // namespace
CefCookieManagerImpl::CefCookieManagerImpl() : weak_ptr_factory_(this) {} CefCookieManagerImpl::CefCookieManagerImpl(bool is_blocking)
: is_blocking_(is_blocking), weak_ptr_factory_(this) {}
CefCookieManagerImpl::~CefCookieManagerImpl() { CefCookieManagerImpl::~CefCookieManagerImpl() {
CEF_REQUIRE_IOT(); CEF_REQUIRE_IOT();
@@ -131,6 +132,7 @@ void CefCookieManagerImpl::Initialize(
const CefString& path, const CefString& path,
bool persist_session_cookies, bool persist_session_cookies,
CefRefPtr<CefCompletionCallback> callback) { CefRefPtr<CefCompletionCallback> callback) {
CHECK(!is_blocking_);
if (request_context.get()) { if (request_context.get()) {
request_context_ = request_context; request_context_ = request_context;
request_context_->GetRequestContextImpl( request_context_->GetRequestContextImpl(
@@ -160,7 +162,7 @@ void CefCookieManagerImpl::GetCookieStore(
return; return;
} }
DCHECK(cookie_store_.get()); DCHECK(is_blocking_ || cookie_store_.get());
// Binding ref-counted |this| to CookieStoreGetter may result in // Binding ref-counted |this| to CookieStoreGetter may result in
// heap-use-after-free if (a) the CookieStoreGetter contains the last // heap-use-after-free if (a) the CookieStoreGetter contains the last
@@ -192,7 +194,9 @@ net::CookieStore* CefCookieManagerImpl::GetExistingCookieStore() {
return cookie_store; return cookie_store;
} }
LOG(ERROR) << "Cookie store does not exist"; DCHECK(is_blocking_);
if (!is_blocking_)
LOG(ERROR) << "Cookie store does not exist";
return nullptr; return nullptr;
} }
@@ -299,7 +303,10 @@ bool CefCookieManagerImpl::SetStoragePath(
const base::FilePath& cookie_path = new_path.AppendASCII("Cookies"); const base::FilePath& cookie_path = new_path.AppendASCII("Cookies");
persistent_store = new net::SQLitePersistentCookieStore( persistent_store = new net::SQLitePersistentCookieStore(
cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), // 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); persist_session_cookies, NULL);
} else { } else {
NOTREACHED() << "The cookie storage directory could not be created"; NOTREACHED() << "The cookie storage directory could not be created";
@@ -495,12 +502,11 @@ void CefCookieManagerImpl::SetSupportedSchemesInternal(
return; return;
} }
DCHECK(cookie_store_.get()); DCHECK(is_blocking_ || cookie_store_.get());
if (!cookie_store_.get()) if (cookie_store_) {
return; supported_schemes_ = schemes;
SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_);
supported_schemes_ = schemes; }
SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_);
RunAsyncCompletionOnIOThread(callback); RunAsyncCompletionOnIOThread(callback);
} }
@@ -552,8 +558,13 @@ void CefCookieManagerImpl::SetCookieInternal(
CEF_REQUIRE_IOT(); CEF_REQUIRE_IOT();
net::CookieStore* cookie_store = cookie_store_getter.Run(); net::CookieStore* cookie_store = cookie_store_getter.Run();
if (!cookie_store) if (!cookie_store) {
if (callback.get()) {
CEF_POST_TASK(CEF_IOT, base::Bind(&CefSetCookieCallback::OnComplete,
callback.get(), false));
}
return; return;
}
std::string name = CefString(&cookie.name).ToString(); std::string name = CefString(&cookie.name).ToString();
std::string value = CefString(&cookie.value).ToString(); std::string value = CefString(&cookie.value).ToString();
@@ -564,13 +575,15 @@ void CefCookieManagerImpl::SetCookieInternal(
if (cookie.has_expires) if (cookie.has_expires)
cef_time_to_basetime(cookie.expires, expiration_time); cef_time_to_basetime(cookie.expires, expiration_time);
cookie_store->SetCookieWithDetailsAsync( cookie_store->SetCanonicalCookieAsync(
url, name, value, domain, path, net::CanonicalCookie::CreateSanitizedCookie(
base::Time(), // Creation time. url, name, value, domain, path,
expiration_time, base::Time(), // Creation time.
base::Time(), // Last access time. expiration_time,
base::Time(), // Last access time.
cookie.secure ? true : false, cookie.httponly ? true : false,
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT),
cookie.secure ? true : false, cookie.httponly ? true : false, cookie.secure ? true : false, cookie.httponly ? true : false,
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT,
base::Bind(SetCookieCallbackImpl, callback)); base::Bind(SetCookieCallbackImpl, callback));
} }
@@ -582,8 +595,13 @@ void CefCookieManagerImpl::DeleteCookiesInternal(
CEF_REQUIRE_IOT(); CEF_REQUIRE_IOT();
net::CookieStore* cookie_store = cookie_store_getter.Run(); net::CookieStore* cookie_store = cookie_store_getter.Run();
if (!cookie_store) if (!cookie_store) {
if (callback.get()) {
CEF_POST_TASK(CEF_IOT, base::Bind(&CefDeleteCookiesCallback::OnComplete,
callback.get(), 0));
}
return; return;
}
if (url.is_empty()) { if (url.is_empty()) {
// Delete all cookies. // Delete all cookies.
@@ -608,8 +626,10 @@ void CefCookieManagerImpl::FlushStoreInternal(
CEF_REQUIRE_IOT(); CEF_REQUIRE_IOT();
net::CookieStore* cookie_store = cookie_store_getter.Run(); net::CookieStore* cookie_store = cookie_store_getter.Run();
if (!cookie_store) if (!cookie_store) {
RunAsyncCompletionOnIOThread(callback);
return; return;
}
cookie_store->FlushStore(base::Bind(RunAsyncCompletionOnIOThread, callback)); cookie_store->FlushStore(base::Bind(RunAsyncCompletionOnIOThread, callback));
} }
@@ -629,6 +649,11 @@ CefRefPtr<CefCookieManager> CefCookieManager::GetGlobalManager(
callback); callback);
} }
// static
CefRefPtr<CefCookieManager> CefCookieManager::GetBlockingManager() {
return new CefCookieManagerImpl(true);
}
// static // static
CefRefPtr<CefCookieManager> CefCookieManager::CreateManager( CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
const CefString& path, const CefString& path,
@@ -640,7 +665,8 @@ CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
return NULL; return NULL;
} }
CefRefPtr<CefCookieManagerImpl> cookie_manager = new CefCookieManagerImpl(); CefRefPtr<CefCookieManagerImpl> cookie_manager =
new CefCookieManagerImpl(false);
cookie_manager->Initialize(NULL, path, persist_session_cookies, callback); cookie_manager->Initialize(NULL, path, persist_session_cookies, callback);
return cookie_manager.get(); return cookie_manager.get();
} }

View File

@@ -18,10 +18,11 @@
// Implementation of the CefCookieManager interface. // Implementation of the CefCookieManager interface.
class CefCookieManagerImpl : public CefCookieManager { class CefCookieManagerImpl : public CefCookieManager {
public: public:
CefCookieManagerImpl(); explicit CefCookieManagerImpl(bool is_blocking);
~CefCookieManagerImpl() override; ~CefCookieManagerImpl() override;
// Must be called immediately after this object is created. // Must be called immediately after this object is created when |is_blocking|
// is false.
void Initialize(CefRefPtr<CefRequestContextImpl> request_context, void Initialize(CefRefPtr<CefRequestContextImpl> request_context,
const CefString& path, const CefString& path,
bool persist_session_cookies, bool persist_session_cookies,
@@ -113,6 +114,9 @@ class CefCookieManagerImpl : public CefCookieManager {
void FlushStoreInternal(CefRefPtr<CefCompletionCallback> callback, void FlushStoreInternal(CefRefPtr<CefCompletionCallback> callback,
const CookieStoreGetter& cookie_store_getter); const CookieStoreGetter& cookie_store_getter);
// If true all cookies will be blocked.
const bool is_blocking_;
// Used for cookie monsters owned by the context. // Used for cookie monsters owned by the context.
CefRefPtr<CefRequestContextImpl> request_context_; CefRefPtr<CefRequestContextImpl> request_context_;
scoped_refptr<CefURLRequestContextGetterImpl> request_context_impl_; scoped_refptr<CefURLRequestContextGetterImpl> request_context_impl_;

View File

@@ -163,7 +163,7 @@ void CefDevToolsFrontend::InspectElementAt(int x, int y) {
if (inspect_element_at_.x != x || inspect_element_at_.y != y) if (inspect_element_at_.x != x || inspect_element_at_.y != y)
inspect_element_at_.Set(x, y); inspect_element_at_.Set(x, y);
if (agent_host_) if (agent_host_)
agent_host_->InspectElement(this, x, y); agent_host_->InspectElement(inspected_contents_->GetFocusedFrame(), x, y);
} }
void CefDevToolsFrontend::Close() { void CefDevToolsFrontend::Close() {
@@ -226,8 +226,8 @@ void CefDevToolsFrontend::DocumentAvailableInMainFrame() {
agent_host_ = agent_host; agent_host_ = agent_host;
agent_host_->AttachClient(this); agent_host_->AttachClient(this);
if (!inspect_element_at_.IsEmpty()) { if (!inspect_element_at_.IsEmpty()) {
agent_host_->InspectElement(this, inspect_element_at_.x, agent_host_->InspectElement(inspected_contents_->GetFocusedFrame(),
inspect_element_at_.y); inspect_element_at_.x, inspect_element_at_.y);
} }
} }
} }
@@ -240,27 +240,8 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
delete this; delete this;
} }
void CefDevToolsFrontend::SetPreferences(const std::string& json) {
if (json.empty())
return;
base::DictionaryValue* dict = nullptr;
std::unique_ptr<base::Value> parsed = base::JSONReader::Read(json);
if (!parsed || !parsed->GetAsDictionary(&dict))
return;
DictionaryPrefUpdate update(GetPrefs(), prefs::kDevToolsPreferences);
for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) {
if (!it.value().IsType(base::Value::Type::STRING))
continue;
update.Get()->SetWithoutPathExpansion(it.key(),
it.value().CreateDeepCopy());
}
}
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend( void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
const std::string& message) { const std::string& message) {
if (!agent_host_)
return;
std::string method; std::string method;
base::ListValue* params = NULL; base::ListValue* params = NULL;
base::DictionaryValue* dict = NULL; base::DictionaryValue* dict = NULL;
@@ -275,7 +256,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
if (method == "dispatchProtocolMessage" && params && params->GetSize() == 1) { if (method == "dispatchProtocolMessage" && params && params->GetSize() == 1) {
std::string protocol_message; std::string protocol_message;
if (!params->GetString(0, &protocol_message)) if (!agent_host_ || !params->GetString(0, &protocol_message))
return; return;
agent_host_->DispatchProtocolMessage(this, protocol_message); agent_host_->DispatchProtocolMessage(this, protocol_message);
} else if (method == "loadCompleted") { } else if (method == "loadCompleted") {
@@ -361,6 +342,8 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests( web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);")); base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);"));
} else if (method == "reattach") { } else if (method == "reattach") {
if (!agent_host_)
return;
agent_host_->DetachClient(this); agent_host_->DetachClient(this);
agent_host_->AttachClient(this); agent_host_->AttachClient(this);
} else if (method == "registerExtensionsAPI") { } else if (method == "registerExtensionsAPI") {
@@ -409,7 +392,7 @@ void CefDevToolsFrontend::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK(it != pending_requests_.end()); DCHECK(it != pending_requests_.end());
base::DictionaryValue response; base::DictionaryValue response;
auto headers = base::MakeUnique<base::DictionaryValue>(); auto headers = std::make_unique<base::DictionaryValue>();
net::HttpResponseHeaders* rh = source->GetResponseHeaders(); net::HttpResponseHeaders* rh = source->GetResponseHeaders();
response.SetInteger("statusCode", rh ? rh->response_code() : 200); response.SetInteger("statusCode", rh ? rh->response_code() : 200);
@@ -455,8 +438,7 @@ void CefDevToolsFrontend::SendMessageAck(int request_id,
} }
void CefDevToolsFrontend::AgentHostClosed( void CefDevToolsFrontend::AgentHostClosed(
content::DevToolsAgentHost* agent_host, content::DevToolsAgentHost* agent_host) {
bool replaced) {
DCHECK(agent_host == agent_host_.get()); DCHECK(agent_host == agent_host_.get());
agent_host_ = nullptr; agent_host_ = nullptr;
Close(); Close();

View File

@@ -58,19 +58,17 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
return frontend_browser_; return frontend_browser_;
} }
protected: private:
CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser, CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser,
content::WebContents* inspected_contents, content::WebContents* inspected_contents,
const CefPoint& inspect_element_at); const CefPoint& inspect_element_at);
~CefDevToolsFrontend() override; ~CefDevToolsFrontend() override;
// content::DevToolsAgentHostClient implementation. // content::DevToolsAgentHostClient implementation.
void AgentHostClosed(content::DevToolsAgentHost* agent_host, void AgentHostClosed(content::DevToolsAgentHost* agent_host) override;
bool replaced) override;
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host, void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
const std::string& message) override; const std::string& message) override;
void SetPreferences(const std::string& json); void HandleMessageFromDevToolsFrontend(const std::string& message);
virtual void HandleMessageFromDevToolsFrontend(const std::string& message);
private: private:
// WebContentsObserver overrides // WebContentsObserver overrides

View File

@@ -105,8 +105,12 @@ void CefDevToolsManagerDelegate::StartHttpHandler(
if (!socket_factory) if (!socket_factory)
return; return;
content::DevToolsAgentHost::StartRemoteDebuggingServer( content::DevToolsAgentHost::StartRemoteDebuggingServer(
std::move(socket_factory), std::string(), browser_context->GetPath(), std::move(socket_factory), browser_context->GetPath(), base::FilePath());
base::FilePath());
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kRemoteDebuggingPipe))
content::DevToolsAgentHost::StartRemoteDebuggingPipeHandler();
} }
// static // static
@@ -133,7 +137,6 @@ std::string CefDevToolsManagerDelegate::GetDiscoveryPageHTML() {
.as_string(); .as_string();
} }
std::string CefDevToolsManagerDelegate::GetFrontendResource( bool CefDevToolsManagerDelegate::HasBundledFrontendResources() {
const std::string& path) { return true;
return content::DevToolsFrontendHost::GetFrontendResource(path).as_string();
} }

View File

@@ -25,7 +25,7 @@ class CefDevToolsManagerDelegate : public content::DevToolsManagerDelegate {
scoped_refptr<content::DevToolsAgentHost> CreateNewTarget( scoped_refptr<content::DevToolsAgentHost> CreateNewTarget(
const GURL& url) override; const GURL& url) override;
std::string GetDiscoveryPageHTML() override; std::string GetDiscoveryPageHTML() override;
std::string GetFrontendResource(const std::string& path) override; bool HasBundledFrontendResources() override;
private: private:
DISALLOW_COPY_AND_ASSIGN(CefDevToolsManagerDelegate); DISALLOW_COPY_AND_ASSIGN(CefDevToolsManagerDelegate);

View File

@@ -6,11 +6,11 @@
#include "libcef/common/time_util.h" #include "libcef/common/time_util.h"
#include "content/public/browser/download_item.h" #include "components/download/public/common/download_item.h"
#include "url/gurl.h" #include "url/gurl.h"
CefDownloadItemImpl::CefDownloadItemImpl(content::DownloadItem* value) CefDownloadItemImpl::CefDownloadItemImpl(download::DownloadItem* value)
: CefValueBase<CefDownloadItem, content::DownloadItem>( : CefValueBase<CefDownloadItem, download::DownloadItem>(
value, value,
NULL, NULL,
kOwnerNoDelete, kOwnerNoDelete,
@@ -26,17 +26,17 @@ bool CefDownloadItemImpl::IsValid() {
bool CefDownloadItemImpl::IsInProgress() { bool CefDownloadItemImpl::IsInProgress() {
CEF_VALUE_VERIFY_RETURN(false, false); CEF_VALUE_VERIFY_RETURN(false, false);
return const_value().GetState() == content::DownloadItem::IN_PROGRESS; return const_value().GetState() == download::DownloadItem::IN_PROGRESS;
} }
bool CefDownloadItemImpl::IsComplete() { bool CefDownloadItemImpl::IsComplete() {
CEF_VALUE_VERIFY_RETURN(false, false); CEF_VALUE_VERIFY_RETURN(false, false);
return const_value().GetState() == content::DownloadItem::COMPLETE; return const_value().GetState() == download::DownloadItem::COMPLETE;
} }
bool CefDownloadItemImpl::IsCanceled() { bool CefDownloadItemImpl::IsCanceled() {
CEF_VALUE_VERIFY_RETURN(false, false); CEF_VALUE_VERIFY_RETURN(false, false);
return const_value().GetState() == content::DownloadItem::CANCELLED; return const_value().GetState() == download::DownloadItem::CANCELLED;
} }
int64 CefDownloadItemImpl::GetCurrentSpeed() { int64 CefDownloadItemImpl::GetCurrentSpeed() {

View File

@@ -9,15 +9,15 @@
#include "include/cef_download_item.h" #include "include/cef_download_item.h"
#include "libcef/common/value_base.h" #include "libcef/common/value_base.h"
namespace content { namespace download {
class DownloadItem; class DownloadItem;
} }
// CefDownloadItem implementation // CefDownloadItem implementation
class CefDownloadItemImpl class CefDownloadItemImpl
: public CefValueBase<CefDownloadItem, content::DownloadItem> { : public CefValueBase<CefDownloadItem, download::DownloadItem> {
public: public:
explicit CefDownloadItemImpl(content::DownloadItem* value); explicit CefDownloadItemImpl(download::DownloadItem* value);
// CefDownloadItem methods. // CefDownloadItem methods.
bool IsValid() override; bool IsValid() override;

View File

@@ -15,11 +15,12 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "content/public/browser/download_item_utils.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/common/file_chooser_params.h" #include "content/public/common/file_chooser_params.h"
#include "net/base/filename_util.h" #include "net/base/filename_util.h"
using content::DownloadItem; using download::DownloadItem;
using content::DownloadManager; using content::DownloadManager;
using content::WebContents; using content::WebContents;
@@ -53,11 +54,9 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
if (manager_) { if (manager_) {
base::FilePath path = base::FilePath(download_path); base::FilePath path = base::FilePath(download_path);
CEF_POST_TASK( CEF_POST_USER_VISIBLE_TASK(base::Bind(
CEF_FILET, &CefBeforeDownloadCallbackImpl::GenerateFilename, manager_,
base::Bind(&CefBeforeDownloadCallbackImpl::GenerateFilename, download_id_, suggested_name_, path, show_dialog, callback_));
manager_, download_id_, suggested_name_, path,
show_dialog, callback_));
} }
download_id_ = 0; download_id_ = 0;
@@ -77,6 +76,8 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
const base::FilePath& download_path, const base::FilePath& download_path,
bool show_dialog, bool show_dialog,
const content::DownloadTargetCallback& callback) { const content::DownloadTargetCallback& callback) {
CEF_REQUIRE_BLOCKING();
base::FilePath suggested_path = download_path; base::FilePath suggested_path = download_path;
if (!suggested_path.empty()) { if (!suggested_path.empty()) {
// Create the directory if necessary. // Create the directory if necessary.
@@ -114,13 +115,14 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
return; return;
DownloadItem* item = manager->GetDownload(download_id); DownloadItem* item = manager->GetDownload(download_id);
if (!item || item->GetState() != content::DownloadItem::IN_PROGRESS) if (!item || item->GetState() != DownloadItem::IN_PROGRESS)
return; return;
bool handled = false; bool handled = false;
if (show_dialog) { if (show_dialog) {
WebContents* web_contents = item->GetWebContents(); WebContents* web_contents =
content::DownloadItemUtils::GetWebContents(item);
CefRefPtr<CefBrowserHostImpl> browser = CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForContents(web_contents); CefBrowserHostImpl::GetBrowserForContents(web_contents);
if (browser.get()) { if (browser.get()) {
@@ -146,8 +148,8 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
if (!handled) { if (!handled) {
callback.Run(suggested_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, callback.Run(suggested_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, suggested_path, download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, suggested_path,
content::DOWNLOAD_INTERRUPT_REASON_NONE); download::DOWNLOAD_INTERRUPT_REASON_NONE);
} }
} }
@@ -163,8 +165,8 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
// The download will be cancelled if |path| is empty. // The download will be cancelled if |path| is empty.
callback.Run(path, DownloadItem::TARGET_DISPOSITION_OVERWRITE, callback.Run(path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path, download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
content::DOWNLOAD_INTERRUPT_REASON_NONE); download::DOWNLOAD_INTERRUPT_REASON_NONE);
} }
base::WeakPtr<DownloadManager> manager_; base::WeakPtr<DownloadManager> manager_;
@@ -206,7 +208,7 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
if (manager_) { if (manager_) {
DownloadItem* item = manager_->GetDownload(download_id_); DownloadItem* item = manager_->GetDownload(download_id_);
if (item && item->GetState() == content::DownloadItem::IN_PROGRESS) if (item && item->GetState() == DownloadItem::IN_PROGRESS)
item->Cancel(true); item->Cancel(true);
} }
@@ -219,7 +221,7 @@ class CefDownloadItemCallbackImpl : public CefDownloadItemCallback {
if (manager_) { if (manager_) {
DownloadItem* item = manager_->GetDownload(download_id_); DownloadItem* item = manager_->GetDownload(download_id_);
if (item && item->GetState() == content::DownloadItem::IN_PROGRESS) if (item && item->GetState() == DownloadItem::IN_PROGRESS)
item->Pause(); item->Pause();
} }
} }
@@ -316,7 +318,8 @@ void CefDownloadManagerDelegate::OnDownloadDestroyed(DownloadItem* item) {
void CefDownloadManagerDelegate::OnDownloadCreated(DownloadManager* manager, void CefDownloadManagerDelegate::OnDownloadCreated(DownloadManager* manager,
DownloadItem* item) { DownloadItem* item) {
CefBrowserHostImpl* browser = nullptr; CefBrowserHostImpl* browser = nullptr;
content::WebContents* contents = item->GetWebContents(); content::WebContents* contents =
content::DownloadItemUtils::GetWebContents(item);
if (contents) { if (contents) {
browser = CefBrowserHostImpl::GetBrowserForContents(contents).get(); browser = CefBrowserHostImpl::GetBrowserForContents(contents).get();
DCHECK(browser); DCHECK(browser);
@@ -360,8 +363,8 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
if (!item->GetForcedFilePath().empty()) { if (!item->GetForcedFilePath().empty()) {
callback.Run( callback.Run(
item->GetForcedFilePath(), DownloadItem::TARGET_DISPOSITION_OVERWRITE, item->GetForcedFilePath(), DownloadItem::TARGET_DISPOSITION_OVERWRITE,
content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, item->GetForcedFilePath(), download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, item->GetForcedFilePath(),
content::DOWNLOAD_INTERRUPT_REASON_NONE); download::DOWNLOAD_INTERRUPT_REASON_NONE);
return true; return true;
} }
@@ -419,6 +422,6 @@ CefBrowserHostImpl* CefDownloadManagerDelegate::GetBrowser(DownloadItem* item) {
// StartDownloadWithId (originating from CreateInterruptedDownload) with no // StartDownloadWithId (originating from CreateInterruptedDownload) with no
// associated WebContents and consequently no associated CEF browser. In that // associated WebContents and consequently no associated CEF browser. In that
// case DetermineDownloadTarget will be called before OnDownloadCreated. // case DetermineDownloadTarget will be called before OnDownloadCreated.
DCHECK(!item->GetWebContents()); DCHECK(!content::DownloadItemUtils::GetWebContents(item));
return nullptr; return nullptr;
} }

View File

@@ -12,11 +12,11 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "content/public/browser/download_item.h" #include "components/download/public/common/download_item.h"
#include "content/public/browser/download_manager.h" #include "content/public/browser/download_manager.h"
#include "content/public/browser/download_manager_delegate.h" #include "content/public/browser/download_manager_delegate.h"
class CefDownloadManagerDelegate : public content::DownloadItem::Observer, class CefDownloadManagerDelegate : public download::DownloadItem::Observer,
public content::DownloadManager::Observer, public content::DownloadManager::Observer,
public content::DownloadManagerDelegate, public content::DownloadManagerDelegate,
public CefBrowserHostImpl::Observer { public CefBrowserHostImpl::Observer {
@@ -26,24 +26,24 @@ class CefDownloadManagerDelegate : public content::DownloadItem::Observer,
private: private:
// DownloadItem::Observer methods. // DownloadItem::Observer methods.
void OnDownloadUpdated(content::DownloadItem* item) override; void OnDownloadUpdated(download::DownloadItem* item) override;
void OnDownloadDestroyed(content::DownloadItem* item) override; void OnDownloadDestroyed(download::DownloadItem* item) override;
// DownloadManager::Observer methods. // DownloadManager::Observer methods.
void OnDownloadCreated(content::DownloadManager* manager, void OnDownloadCreated(content::DownloadManager* manager,
content::DownloadItem* item) override; download::DownloadItem* item) override;
void ManagerGoingDown(content::DownloadManager* manager) override; void ManagerGoingDown(content::DownloadManager* manager) override;
// DownloadManagerDelegate methods. // DownloadManagerDelegate methods.
bool DetermineDownloadTarget( bool DetermineDownloadTarget(
content::DownloadItem* item, download::DownloadItem* item,
const content::DownloadTargetCallback& callback) override; const content::DownloadTargetCallback& callback) override;
void GetNextId(const content::DownloadIdCallback& callback) override; void GetNextId(const content::DownloadIdCallback& callback) override;
// CefBrowserHostImpl::Observer methods. // CefBrowserHostImpl::Observer methods.
void OnBrowserDestroyed(CefBrowserHostImpl* browser) override; void OnBrowserDestroyed(CefBrowserHostImpl* browser) override;
CefBrowserHostImpl* GetBrowser(content::DownloadItem* item); CefBrowserHostImpl* GetBrowser(download::DownloadItem* item);
content::DownloadManager* manager_; content::DownloadManager* manager_;
base::WeakPtrFactory<content::DownloadManager> manager_ptr_factory_; base::WeakPtrFactory<content::DownloadManager> manager_ptr_factory_;
@@ -51,7 +51,7 @@ class CefDownloadManagerDelegate : public content::DownloadItem::Observer,
// Map of DownloadItem to originating CefBrowserHostImpl. Maintaining this // Map of DownloadItem to originating CefBrowserHostImpl. Maintaining this
// map is necessary because DownloadItem::GetWebContents() may return NULL if // map is necessary because DownloadItem::GetWebContents() may return NULL if
// the browser navigates while the download is in progress. // the browser navigates while the download is in progress.
typedef std::map<content::DownloadItem*, CefBrowserHostImpl*> ItemBrowserMap; typedef std::map<download::DownloadItem*, CefBrowserHostImpl*> ItemBrowserMap;
ItemBrowserMap item_browser_map_; ItemBrowserMap item_browser_map_;
DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate); DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate);

View File

@@ -231,7 +231,8 @@ bool ExecuteCodeInTabFunction::LoadFile(const std::string& file) {
void ExecuteCodeInTabFunction::LoadFileComplete( void ExecuteCodeInTabFunction::LoadFileComplete(
const std::string& file, const std::string& file,
std::unique_ptr<std::string> data) { std::unique_ptr<std::string> data) {
DidLoadAndLocalizeFile(file, !!data.get(), std::move(data)); const bool success = !!data.get();
DidLoadAndLocalizeFile(file, success, std::move(data));
} }
bool TabsExecuteScriptFunction::ShouldInsertCSS() const { bool TabsExecuteScriptFunction::ShouldInsertCSS() const {

View File

@@ -92,7 +92,7 @@ class CefGetExtensionLoadFileCallbackImpl
static std::unique_ptr<std::string> LoadFileFromStream( static std::unique_ptr<std::string> LoadFileFromStream(
const std::string& file, const std::string& file,
CefRefPtr<CefStreamReader> stream) { CefRefPtr<CefStreamReader> stream) {
base::ThreadRestrictions::AssertIOAllowed(); base::AssertBlockingAllowed();
// Move to the end of the stream. // Move to the end of the stream.
stream->Seek(0, SEEK_END); stream->Seek(0, SEEK_END);
@@ -415,36 +415,36 @@ std::unique_ptr<api::tabs::Tab> CefExtensionFunctionDetails::CreateTabObject(
content::WebContents* contents = new_browser->web_contents(); content::WebContents* contents = new_browser->web_contents();
bool is_loading = contents->IsLoading(); bool is_loading = contents->IsLoading();
auto tab_object = base::MakeUnique<api::tabs::Tab>(); auto tab_object = std::make_unique<api::tabs::Tab>();
tab_object->id = base::MakeUnique<int>(new_browser->GetIdentifier()); tab_object->id = std::make_unique<int>(new_browser->GetIdentifier());
tab_object->index = index; tab_object->index = index;
tab_object->window_id = *tab_object->id; tab_object->window_id = *tab_object->id;
tab_object->status = base::MakeUnique<std::string>( tab_object->status = std::make_unique<std::string>(
is_loading ? keys::kStatusValueLoading : keys::kStatusValueComplete); is_loading ? keys::kStatusValueLoading : keys::kStatusValueComplete);
tab_object->active = active; tab_object->active = active;
tab_object->selected = true; tab_object->selected = true;
tab_object->highlighted = true; tab_object->highlighted = true;
tab_object->pinned = false; tab_object->pinned = false;
tab_object->audible = base::MakeUnique<bool>(contents->WasRecentlyAudible()); tab_object->audible = std::make_unique<bool>(contents->WasRecentlyAudible());
tab_object->discarded = false; tab_object->discarded = false;
tab_object->auto_discardable = false; tab_object->auto_discardable = false;
tab_object->muted_info = CreateMutedInfo(contents); tab_object->muted_info = CreateMutedInfo(contents);
tab_object->incognito = false; tab_object->incognito = false;
gfx::Size contents_size = contents->GetContainerBounds().size(); gfx::Size contents_size = contents->GetContainerBounds().size();
tab_object->width = base::MakeUnique<int>(contents_size.width()); tab_object->width = std::make_unique<int>(contents_size.width());
tab_object->height = base::MakeUnique<int>(contents_size.height()); tab_object->height = std::make_unique<int>(contents_size.height());
tab_object->url = base::MakeUnique<std::string>(contents->GetURL().spec()); tab_object->url = std::make_unique<std::string>(contents->GetURL().spec());
tab_object->title = tab_object->title =
base::MakeUnique<std::string>(base::UTF16ToUTF8(contents->GetTitle())); std::make_unique<std::string>(base::UTF16ToUTF8(contents->GetTitle()));
content::NavigationEntry* entry = contents->GetController().GetVisibleEntry(); content::NavigationEntry* entry = contents->GetController().GetVisibleEntry();
if (entry && entry->GetFavicon().valid) { if (entry && entry->GetFavicon().valid) {
tab_object->fav_icon_url = tab_object->fav_icon_url =
base::MakeUnique<std::string>(entry->GetFavicon().url.spec()); std::make_unique<std::string>(entry->GetFavicon().url.spec());
} }
if (opener_browser_id >= 0) if (opener_browser_id >= 0)
tab_object->opener_tab_id = base::MakeUnique<int>(opener_browser_id); tab_object->opener_tab_id = std::make_unique<int>(opener_browser_id);
return tab_object; return tab_object;
} }

View File

@@ -20,7 +20,6 @@
#include "base/path_service.h" #include "base/path_service.h"
#include "base/strings/string_tokenizer.h" #include "base/strings/string_tokenizer.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
@@ -64,7 +63,7 @@ std::unique_ptr<base::DictionaryValue> ParseManifest(
JSONStringValueDeserializer deserializer(manifest_contents); JSONStringValueDeserializer deserializer(manifest_contents);
std::unique_ptr<base::Value> manifest(deserializer.Deserialize(NULL, NULL)); std::unique_ptr<base::Value> manifest(deserializer.Deserialize(NULL, NULL));
if (!manifest.get() || !manifest->IsType(base::Value::Type::DICTIONARY)) { if (!manifest.get() || !manifest->is_dict()) {
LOG(ERROR) << "Failed to parse extension manifest."; LOG(ERROR) << "Failed to parse extension manifest.";
return NULL; return NULL;
} }
@@ -112,7 +111,7 @@ void LoadExtensionWithManifest(base::WeakPtr<CefExtensionSystem> context,
bool internal, bool internal,
CefRefPtr<CefRequestContext> loader_context, CefRefPtr<CefRequestContext> loader_context,
CefRefPtr<CefExtensionHandler> handler) { CefRefPtr<CefExtensionHandler> handler) {
base::ThreadRestrictions::AssertIOAllowed(); CEF_REQUIRE_BLOCKING();
std::unique_ptr<base::DictionaryValue> manifest = std::unique_ptr<base::DictionaryValue> manifest =
ParseManifest(manifest_contents); ParseManifest(manifest_contents);
@@ -131,7 +130,7 @@ void LoadExtensionFromDisk(base::WeakPtr<CefExtensionSystem> context,
bool internal, bool internal,
CefRefPtr<CefRequestContext> loader_context, CefRefPtr<CefRequestContext> loader_context,
CefRefPtr<CefExtensionHandler> handler) { CefRefPtr<CefExtensionHandler> handler) {
base::ThreadRestrictions::AssertIOAllowed(); CEF_REQUIRE_BLOCKING();
base::FilePath manifest_path = root_directory.AppendASCII("manifest.json"); base::FilePath manifest_path = root_directory.AppendASCII("manifest.json");
std::string manifest_contents; std::string manifest_contents;
@@ -239,8 +238,7 @@ void CefExtensionSystem::LoadExtension(
CefRefPtr<CefRequestContext> loader_context, CefRefPtr<CefRequestContext> loader_context,
CefRefPtr<CefExtensionHandler> handler) { CefRefPtr<CefExtensionHandler> handler) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
base::PostTaskWithTraits( CEF_POST_USER_VISIBLE_TASK(
FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()},
base::BindOnce(LoadExtensionFromDisk, weak_ptr_factory_.GetWeakPtr(), base::BindOnce(LoadExtensionFromDisk, weak_ptr_factory_.GetWeakPtr(),
root_directory, internal, loader_context, handler)); root_directory, internal, loader_context, handler));
} }
@@ -252,11 +250,9 @@ void CefExtensionSystem::LoadExtension(
CefRefPtr<CefRequestContext> loader_context, CefRefPtr<CefRequestContext> loader_context,
CefRefPtr<CefExtensionHandler> handler) { CefRefPtr<CefExtensionHandler> handler) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
base::PostTaskWithTraits( CEF_POST_USER_VISIBLE_TASK(base::BindOnce(
FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()}, LoadExtensionWithManifest, weak_ptr_factory_.GetWeakPtr(),
base::BindOnce(LoadExtensionWithManifest, weak_ptr_factory_.GetWeakPtr(), manifest_contents, root_directory, internal, loader_context, handler));
manifest_contents, root_directory, internal,
loader_context, handler));
} }
// Implementation based on ComponentLoader::Add. // Implementation based on ComponentLoader::Add.
@@ -367,6 +363,10 @@ void CefExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
app_sorting_.reset(new NullAppSorting); app_sorting_.reset(new NullAppSorting);
} }
void CefExtensionSystem::InitForIncognitoProfile() {
NOTREACHED();
}
ExtensionService* CefExtensionSystem::extension_service() { ExtensionService* CefExtensionSystem::extension_service() {
return nullptr; return nullptr;
} }
@@ -449,15 +449,25 @@ ContentVerifier* CefExtensionSystem::content_verifier() {
std::unique_ptr<ExtensionSet> CefExtensionSystem::GetDependentExtensions( std::unique_ptr<ExtensionSet> CefExtensionSystem::GetDependentExtensions(
const Extension* extension) { const Extension* extension) {
return base::MakeUnique<ExtensionSet>(); return std::make_unique<ExtensionSet>();
} }
void CefExtensionSystem::InstallUpdate(const std::string& extension_id, void CefExtensionSystem::InstallUpdate(
const base::FilePath& temp_dir) { const std::string& extension_id,
const std::string& public_key,
const base::FilePath& temp_dir,
InstallUpdateCallback install_update_callback) {
NOTREACHED(); NOTREACHED();
base::DeleteFile(temp_dir, true /* recursive */); base::DeleteFile(temp_dir, true /* recursive */);
} }
bool CefExtensionSystem::FinishDelayedInstallationIfReady(
const std::string& extension_id,
bool install_immediately) {
NOTREACHED();
return false;
}
CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo( CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo(
const base::DictionaryValue* manifest, const base::DictionaryValue* manifest,
const base::FilePath& directory, const base::FilePath& directory,

View File

@@ -89,6 +89,7 @@ class CefExtensionSystem : public ExtensionSystem {
// ExtensionSystem implementation: // ExtensionSystem implementation:
void InitForRegularProfile(bool extensions_enabled) override; void InitForRegularProfile(bool extensions_enabled) override;
void InitForIncognitoProfile() override;
ExtensionService* extension_service() override; ExtensionService* extension_service() override;
RuntimeData* runtime_data() override; RuntimeData* runtime_data() override;
ManagementPolicy* management_policy() override; ManagementPolicy* management_policy() override;
@@ -111,7 +112,11 @@ class CefExtensionSystem : public ExtensionSystem {
std::unique_ptr<ExtensionSet> GetDependentExtensions( std::unique_ptr<ExtensionSet> GetDependentExtensions(
const Extension* extension) override; const Extension* extension) override;
void InstallUpdate(const std::string& extension_id, void InstallUpdate(const std::string& extension_id,
const base::FilePath& temp_dir) override; const std::string& public_key,
const base::FilePath& temp_dir,
InstallUpdateCallback install_update_callback) override;
bool FinishDelayedInstallationIfReady(const std::string& extension_id,
bool install_immediately) override;
bool initialized() const { return initialized_; } bool initialized() const { return initialized_; }

View File

@@ -36,8 +36,8 @@ void CefExtensionWebContentsObserver::RenderFrameCreated(
// are allowed to use chrome://resources/ URLs. // are allowed to use chrome://resources/ URLs.
if ((extension->is_extension() || extension->is_platform_app()) && if ((extension->is_extension() || extension->is_platform_app()) &&
Manifest::IsComponentLocation(extension->location())) { Manifest::IsComponentLocation(extension->location())) {
policy->GrantOrigin(process_id, policy->GrantOrigin(
url::Origin(GURL(content::kChromeUIResourcesURL))); process_id, url::Origin::Create(GURL(content::kChromeUIResourcesURL)));
} }
} }

View File

@@ -123,11 +123,34 @@ CefExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob(
send_cors_header); send_cors_header);
} }
base::FilePath CefExtensionsBrowserClient::GetBundleResourcePath(
const network::ResourceRequest& request,
const base::FilePath& extension_resources_path,
int* resource_id) const {
*resource_id = 0;
return base::FilePath();
}
void CefExtensionsBrowserClient::LoadResourceFromResourceBundle(
const network::ResourceRequest& request,
network::mojom::URLLoaderRequest loader,
const base::FilePath& resource_relative_path,
int resource_id,
const std::string& content_security_policy,
network::mojom::URLLoaderClientPtr client,
bool send_cors_header) {
NOTREACHED() << "Load resources from bundles not supported.";
}
bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad( bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
net::URLRequest* request, const GURL& url,
content::ResourceType resource_type,
ui::PageTransition page_transition,
int child_id,
bool is_incognito, bool is_incognito,
const Extension* extension, const Extension* extension,
InfoMap* extension_info_map) { const ExtensionSet& extensions,
const ProcessMap& process_map) {
// TODO(cef): This bypasses additional checks added to // TODO(cef): This bypasses additional checks added to
// AllowCrossRendererResourceLoad() in https://crrev.com/5cf9d45c. Figure out // AllowCrossRendererResourceLoad() in https://crrev.com/5cf9d45c. Figure out
// why permission is not being granted based on "web_accessible_resources" // why permission is not being granted based on "web_accessible_resources"
@@ -137,7 +160,8 @@ bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
bool allowed = false; bool allowed = false;
if (url_request_util::AllowCrossRendererResourceLoad( if (url_request_util::AllowCrossRendererResourceLoad(
request, is_incognito, extension, extension_info_map, &allowed)) { url, resource_type, page_transition, child_id, is_incognito,
extension, extensions, process_map, &allowed)) {
return allowed; return allowed;
} }
@@ -234,6 +258,11 @@ bool CefExtensionsBrowserClient::IsRunningInForcedAppMode() {
return false; return false;
} }
bool CefExtensionsBrowserClient::IsAppModeForcedForApp(
const ExtensionId& extension_id) {
return false;
}
bool CefExtensionsBrowserClient::IsLoggedInAsPublicAccount() { bool CefExtensionsBrowserClient::IsLoggedInAsPublicAccount() {
return false; return false;
} }

View File

@@ -51,10 +51,26 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
const base::FilePath& directory_path, const base::FilePath& directory_path,
const std::string& content_security_policy, const std::string& content_security_policy,
bool send_cors_header) override; bool send_cors_header) override;
bool AllowCrossRendererResourceLoad(net::URLRequest* request, base::FilePath GetBundleResourcePath(
const network::ResourceRequest& request,
const base::FilePath& extension_resources_path,
int* resource_id) const override;
void LoadResourceFromResourceBundle(
const network::ResourceRequest& request,
network::mojom::URLLoaderRequest loader,
const base::FilePath& resource_relative_path,
int resource_id,
const std::string& content_security_policy,
network::mojom::URLLoaderClientPtr client,
bool send_cors_header) override;
bool AllowCrossRendererResourceLoad(const GURL& url,
content::ResourceType resource_type,
ui::PageTransition page_transition,
int child_id,
bool is_incognito, bool is_incognito,
const Extension* extension, const Extension* extension,
InfoMap* extension_info_map) override; const ExtensionSet& extensions,
const ProcessMap& process_map) override;
PrefService* GetPrefServiceForContext( PrefService* GetPrefServiceForContext(
content::BrowserContext* context) override; content::BrowserContext* context) override;
void GetEarlyExtensionPrefsObservers( void GetEarlyExtensionPrefsObservers(
@@ -69,6 +85,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
bool DidVersionUpdate(content::BrowserContext* context) override; bool DidVersionUpdate(content::BrowserContext* context) override;
void PermitExternalProtocolHandler() override; void PermitExternalProtocolHandler() override;
bool IsRunningInForcedAppMode() override; bool IsRunningInForcedAppMode() override;
bool IsAppModeForcedForApp(const ExtensionId& extension_id) override;
bool IsLoggedInAsPublicAccount() override; bool IsLoggedInAsPublicAccount() override;
ExtensionSystemProvider* GetExtensionSystemFactory() override; ExtensionSystemProvider* GetExtensionSystemFactory() override;
void RegisterExtensionFunctions( void RegisterExtensionFunctions(

View File

@@ -10,10 +10,26 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
namespace {
const char kGenericErrorMessage[] = "CefValueStore configured to error";
// Having this utility function allows ValueStore::Status to not have a copy
// constructor.
ValueStore::Status CreateStatusCopy(const ValueStore::Status& status) {
return ValueStore::Status(status.code, status.restore_status, status.message);
}
} // namespace
CefValueStore::CefValueStore() : read_count_(0), write_count_(0) {} CefValueStore::CefValueStore() : read_count_(0), write_count_(0) {}
CefValueStore::~CefValueStore() {} CefValueStore::~CefValueStore() {}
void CefValueStore::set_status_code(StatusCode status_code) {
status_ = ValueStore::Status(status_code, kGenericErrorMessage);
}
size_t CefValueStore::GetBytesInUse(const std::string& key) { size_t CefValueStore::GetBytesInUse(const std::string& key) {
// Let SettingsStorageQuotaEnforcer implement this. // Let SettingsStorageQuotaEnforcer implement this.
NOTREACHED(); NOTREACHED();
@@ -39,7 +55,10 @@ ValueStore::ReadResult CefValueStore::Get(const std::string& key) {
ValueStore::ReadResult CefValueStore::Get( ValueStore::ReadResult CefValueStore::Get(
const std::vector<std::string>& keys) { const std::vector<std::string>& keys) {
read_count_++; read_count_++;
base::DictionaryValue* settings = new base::DictionaryValue(); if (!status_.ok())
return ReadResult(CreateStatusCopy(status_));
auto settings = std::make_unique<base::DictionaryValue>();
for (std::vector<std::string>::const_iterator it = keys.begin(); for (std::vector<std::string>::const_iterator it = keys.begin();
it != keys.end(); ++it) { it != keys.end(); ++it) {
base::Value* value = NULL; base::Value* value = NULL;
@@ -47,12 +66,14 @@ ValueStore::ReadResult CefValueStore::Get(
settings->SetWithoutPathExpansion(*it, value->CreateDeepCopy()); settings->SetWithoutPathExpansion(*it, value->CreateDeepCopy());
} }
} }
return MakeReadResult(base::WrapUnique(settings), status_); return ReadResult(std::move(settings), CreateStatusCopy(status_));
} }
ValueStore::ReadResult CefValueStore::Get() { ValueStore::ReadResult CefValueStore::Get() {
read_count_++; read_count_++;
return MakeReadResult(storage_.CreateDeepCopy(), status_); if (!status_.ok())
return ReadResult(CreateStatusCopy(status_));
return ReadResult(storage_.CreateDeepCopy(), CreateStatusCopy(status_));
} }
ValueStore::WriteResult CefValueStore::Set(WriteOptions options, ValueStore::WriteResult CefValueStore::Set(WriteOptions options,
@@ -67,6 +88,9 @@ ValueStore::WriteResult CefValueStore::Set(
WriteOptions options, WriteOptions options,
const base::DictionaryValue& settings) { const base::DictionaryValue& settings) {
write_count_++; write_count_++;
if (!status_.ok())
return WriteResult(CreateStatusCopy(status_));
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList()); std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd(); for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd();
it.Advance()) { it.Advance()) {
@@ -79,7 +103,7 @@ ValueStore::WriteResult CefValueStore::Set(
storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy()); storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
} }
} }
return MakeWriteResult(std::move(changes), status_); return WriteResult(std::move(changes), CreateStatusCopy(status_));
} }
ValueStore::WriteResult CefValueStore::Remove(const std::string& key) { ValueStore::WriteResult CefValueStore::Remove(const std::string& key) {
@@ -89,6 +113,9 @@ ValueStore::WriteResult CefValueStore::Remove(const std::string& key) {
ValueStore::WriteResult CefValueStore::Remove( ValueStore::WriteResult CefValueStore::Remove(
const std::vector<std::string>& keys) { const std::vector<std::string>& keys) {
write_count_++; write_count_++;
if (!status_.ok())
return WriteResult(CreateStatusCopy(status_));
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList()); std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
for (std::vector<std::string>::const_iterator it = keys.begin(); for (std::vector<std::string>::const_iterator it = keys.begin();
it != keys.end(); ++it) { it != keys.end(); ++it) {
@@ -97,7 +124,7 @@ ValueStore::WriteResult CefValueStore::Remove(
changes->push_back(ValueStoreChange(*it, std::move(old_value), nullptr)); changes->push_back(ValueStoreChange(*it, std::move(old_value), nullptr));
} }
} }
return MakeWriteResult(std::move(changes), status_); return WriteResult(std::move(changes), CreateStatusCopy(status_));
} }
ValueStore::WriteResult CefValueStore::Clear() { ValueStore::WriteResult CefValueStore::Clear() {
@@ -107,4 +134,4 @@ ValueStore::WriteResult CefValueStore::Clear() {
keys.push_back(it.key()); keys.push_back(it.key());
} }
return Remove(keys); return Remove(keys);
} }

View File

@@ -31,6 +31,10 @@ class CefValueStore : public ValueStore {
int read_count() const { return read_count_; } int read_count() const { return read_count_; }
int write_count() const { return write_count_; } int write_count() const { return write_count_; }
// Sets the error code for requests. If OK, errors won't be thrown.
// Defaults to OK.
void set_status_code(StatusCode status_code);
// ValueStore implementation. // ValueStore implementation.
size_t GetBytesInUse(const std::string& key) override; size_t GetBytesInUse(const std::string& key) override;
size_t GetBytesInUse(const std::vector<std::string>& keys) override; size_t GetBytesInUse(const std::vector<std::string>& keys) override;

View File

@@ -1,106 +0,0 @@
// Copyright (c) 2012 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 "include/cef_geolocation.h"
#include "libcef/browser/context.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/time_util.h"
#include "base/logging.h"
#include "device/geolocation/geolocation_provider.h"
#include "device/geolocation/geoposition.h"
namespace {
class CefLocationRequest
: public base::RefCountedThreadSafe<CefLocationRequest> {
public:
explicit CefLocationRequest(CefRefPtr<CefGetGeolocationCallback> callback)
: callback_(callback) {
CEF_REQUIRE_UIT();
geo_callback_ = base::Bind(&CefLocationRequest::OnLocationUpdate, this);
device::GeolocationProvider* provider =
device::GeolocationProvider::GetInstance();
subscription_ = provider->AddLocationUpdateCallback(geo_callback_, true);
provider->UserDidOptIntoLocationServices();
}
private:
friend class base::RefCountedThreadSafe<CefLocationRequest>;
~CefLocationRequest() {}
void OnLocationUpdate(const device::Geoposition& position) {
CEF_REQUIRE_UIT();
if (callback_.get()) {
CefGeoposition cef_position;
SetPosition(position, cef_position);
callback_->OnLocationUpdate(cef_position);
callback_ = NULL;
}
subscription_.reset();
geo_callback_.Reset();
}
void SetPosition(const device::Geoposition& source, CefGeoposition& target) {
target.latitude = source.latitude;
target.longitude = source.longitude;
target.altitude = source.altitude;
target.accuracy = source.accuracy;
target.altitude_accuracy = source.altitude_accuracy;
target.heading = source.heading;
target.speed = source.speed;
cef_time_from_basetime(source.timestamp, target.timestamp);
switch (source.error_code) {
case device::Geoposition::ERROR_CODE_NONE:
target.error_code = GEOPOSITON_ERROR_NONE;
break;
case device::Geoposition::ERROR_CODE_PERMISSION_DENIED:
target.error_code = GEOPOSITON_ERROR_PERMISSION_DENIED;
break;
case device::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE:
target.error_code = GEOPOSITON_ERROR_POSITION_UNAVAILABLE;
break;
case device::Geoposition::ERROR_CODE_TIMEOUT:
target.error_code = GEOPOSITON_ERROR_TIMEOUT;
break;
}
CefString(&target.error_message) = source.error_message;
}
CefRefPtr<CefGetGeolocationCallback> callback_;
device::GeolocationProvider::LocationUpdateCallback geo_callback_;
std::unique_ptr<device::GeolocationProvider::Subscription> subscription_;
DISALLOW_COPY_AND_ASSIGN(CefLocationRequest);
};
} // namespace
bool CefGetGeolocation(CefRefPtr<CefGetGeolocationCallback> callback) {
if (!CONTEXT_STATE_VALID()) {
NOTREACHED() << "context not valid";
return false;
}
if (!callback.get()) {
NOTREACHED() << "invalid parameter";
return false;
}
if (CEF_CURRENTLY_ON_UIT()) {
if (device::GeolocationProvider::GetInstance()) {
// Will be released after the callback executes.
new CefLocationRequest(callback);
return true;
}
return false;
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(base::IgnoreResult(CefGetGeolocation), callback));
return true;
}
}

View File

@@ -79,12 +79,14 @@ void CefJavaScriptDialogManager::Destroy() {
void CefJavaScriptDialogManager::RunJavaScriptDialog( void CefJavaScriptDialogManager::RunJavaScriptDialog(
content::WebContents* web_contents, content::WebContents* web_contents,
const GURL& origin_url, content::RenderFrameHost* render_frame_host,
content::JavaScriptDialogType message_type, content::JavaScriptDialogType message_type,
const base::string16& message_text, const base::string16& message_text,
const base::string16& default_prompt_text, const base::string16& default_prompt_text,
DialogClosedCallback callback, DialogClosedCallback callback,
bool* did_suppress_message) { bool* did_suppress_message) {
const GURL& origin_url = render_frame_host->GetLastCommittedURL();
CefRefPtr<CefClient> client = browser_->GetClient(); CefRefPtr<CefClient> client = browser_->GetClient();
if (client.get()) { if (client.get()) {
CefRefPtr<CefJSDialogHandler> handler = client->GetJSDialogHandler(); CefRefPtr<CefJSDialogHandler> handler = client->GetJSDialogHandler();
@@ -138,6 +140,7 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
void CefJavaScriptDialogManager::RunBeforeUnloadDialog( void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
content::WebContents* web_contents, content::WebContents* web_contents,
content::RenderFrameHost* render_frame_host,
bool is_reload, bool is_reload,
DialogClosedCallback callback) { DialogClosedCallback callback) {
if (browser_->destruction_state() >= if (browser_->destruction_state() >=

View File

@@ -29,13 +29,14 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
// JavaScriptDialogManager methods. // JavaScriptDialogManager methods.
void RunJavaScriptDialog(content::WebContents* web_contents, void RunJavaScriptDialog(content::WebContents* web_contents,
const GURL& origin_url, content::RenderFrameHost* render_frame_host,
content::JavaScriptDialogType message_type, content::JavaScriptDialogType message_type,
const base::string16& message_text, const base::string16& message_text,
const base::string16& default_prompt_text, const base::string16& default_prompt_text,
DialogClosedCallback callback, DialogClosedCallback callback,
bool* did_suppress_message) override; bool* did_suppress_message) override;
void RunBeforeUnloadDialog(content::WebContents* web_contents, void RunBeforeUnloadDialog(content::WebContents* web_contents,
content::RenderFrameHost* render_frame_host,
bool is_reload, bool is_reload,
DialogClosedCallback callback) override; DialogClosedCallback callback) override;
void CancelDialogs(content::WebContents* web_contents, void CancelDialogs(content::WebContents* web_contents,

View File

@@ -346,11 +346,6 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateWheelEvent(
result.wheel_ticks_y = deltaY / scrollbarPixelsPerGtkTick; result.wheel_ticks_y = deltaY / scrollbarPixelsPerGtkTick;
result.has_precise_scrolling_deltas = true; result.has_precise_scrolling_deltas = true;
// Unless the phase and momentumPhase are passed in as parameters to this
// function, there is no way to know them
result.phase = blink::WebMouseWheelEvent::kPhaseNone;
result.momentum_phase = blink::WebMouseWheelEvent::kPhaseNone;
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON) if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
result.button = blink::WebMouseEvent::Button::kLeft; result.button = blink::WebMouseEvent::Button::kLeft;
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON) else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
@@ -389,4 +384,6 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMouseEvent(
// timestamp // timestamp
result.SetTimeStampSeconds(GetSystemUptime()); result.SetTimeStampSeconds(GetSystemUptime());
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
} }

View File

@@ -423,11 +423,6 @@ void CefBrowserPlatformDelegateNativeMac::TranslateWheelEvent(
result.wheel_ticks_y = deltaY / scrollbarPixelsPerCocoaTick; result.wheel_ticks_y = deltaY / scrollbarPixelsPerCocoaTick;
result.has_precise_scrolling_deltas = true; result.has_precise_scrolling_deltas = true;
// Unless the phase and momentumPhase are passed in as parameters to this
// function, there is no way to know them
result.phase = blink::WebMouseWheelEvent::kPhaseNone;
result.momentum_phase = blink::WebMouseWheelEvent::kPhaseNone;
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON) if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
result.button = blink::WebMouseEvent::Button::kLeft; result.button = blink::WebMouseEvent::Button::kLeft;
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON) else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
@@ -474,4 +469,6 @@ void CefBrowserPlatformDelegateNativeMac::TranslateMouseEvent(
// timestamp - Mac OSX specific // timestamp - Mac OSX specific
result.SetTimeStampSeconds(currentEventTimestamp()); result.SetTimeStampSeconds(currentEventTimestamp());
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
} }

View File

@@ -20,6 +20,7 @@
#include "base/memory/ref_counted_memory.h" #include "base/memory/ref_counted_memory.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h" #include "base/win/registry.h"
#include "base/win/win_util.h"
#include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/native_web_keyboard_event.h"
#include "third_party/WebKit/public/platform/WebMouseEvent.h" #include "third_party/WebKit/public/platform/WebMouseEvent.h"
#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h" #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h"
@@ -41,7 +42,7 @@
namespace { namespace {
void WriteTempFileAndView(scoped_refptr<base::RefCountedString> str) { void WriteTempFileAndView(scoped_refptr<base::RefCountedString> str) {
CEF_REQUIRE_FILET(); CEF_REQUIRE_BLOCKING();
base::FilePath tmp_file; base::FilePath tmp_file;
if (!base::CreateTemporaryFile(&tmp_file)) if (!base::CreateTemporaryFile(&tmp_file))
@@ -83,7 +84,7 @@ bool HasExternalHandler(const std::string& scheme) {
} }
void ExecuteExternalProtocol(const GURL& url) { void ExecuteExternalProtocol(const GURL& url) {
CEF_REQUIRE_FILET(); CEF_REQUIRE_BLOCKING();
if (!HasExternalHandler(url.scheme())) if (!HasExternalHandler(url.scheme()))
return; return;
@@ -95,21 +96,29 @@ void ExecuteExternalProtocol(const GURL& url) {
ShellExecuteA(NULL, "open", address.c_str(), NULL, NULL, SW_SHOWNORMAL); ShellExecuteA(NULL, "open", address.c_str(), NULL, NULL, SW_SHOWNORMAL);
} }
WORD KeyStatesToWord() { // DPI value for 1x scale factor.
static const USHORT kHighBitMaskShort = 0x8000; #define DPI_1X 96.0f
WORD result = 0;
if (GetKeyState(VK_CONTROL) & kHighBitMaskShort) float GetWindowScaleFactor(HWND hwnd) {
result |= MK_CONTROL; DCHECK(hwnd);
if (GetKeyState(VK_SHIFT) & kHighBitMaskShort)
result |= MK_SHIFT; if (base::win::IsProcessPerMonitorDpiAware()) {
if (GetKeyState(VK_LBUTTON) & kHighBitMaskShort) // Let Windows tell us the correct DPI.
result |= MK_LBUTTON; static auto get_dpi_for_window_func = []() {
if (GetKeyState(VK_MBUTTON) & kHighBitMaskShort) return reinterpret_cast<decltype(::GetDpiForWindow)*>(
result |= MK_MBUTTON; GetProcAddress(GetModuleHandle(L"user32.dll"), "GetDpiForWindow"));
if (GetKeyState(VK_RBUTTON) & kHighBitMaskShort) }();
result |= MK_RBUTTON; if (get_dpi_for_window_func)
return result; return static_cast<float>(get_dpi_for_window_func(hwnd)) / DPI_1X;
}
// Fallback to the monitor that contains the window center point.
RECT cr;
GetWindowRect(hwnd, &cr);
return display::Screen::GetScreen()
->GetDisplayNearestPoint(
gfx::Point((cr.right - cr.left) / 2, (cr.bottom - cr.top) / 2))
.device_scale_factor();
} }
} // namespace } // namespace
@@ -134,40 +143,49 @@ void CefBrowserPlatformDelegateNativeWin::BrowserDestroyed(
bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() { bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
RegisterWindowClass(); RegisterWindowClass();
has_frame_ = !(window_info_.style & WS_CHILD);
std::wstring windowName(CefString(&window_info_.window_name)); std::wstring windowName(CefString(&window_info_.window_name));
// Create the new browser window. // Create the new browser window.
window_info_.window = CreateWindowEx( CreateWindowEx(window_info_.ex_style, GetWndClass(), windowName.c_str(),
window_info_.ex_style, GetWndClass(), windowName.c_str(), window_info_.style, window_info_.x, window_info_.y,
window_info_.style, window_info_.x, window_info_.y, window_info_.width, window_info_.width, window_info_.height,
window_info_.height, window_info_.parent_window, window_info_.menu, window_info_.parent_window, window_info_.menu,
::GetModuleHandle(NULL), NULL); ::GetModuleHandle(NULL), this);
// It's possible for CreateWindowEx to fail if the parent window was // It's possible for CreateWindowEx to fail if the parent window was
// destroyed between the call to CreateBrowser and the above one. // destroyed between the call to CreateBrowser and the above one.
DCHECK(window_info_.window != NULL); DCHECK(window_info_.window);
if (!window_info_.window) if (!window_info_.window)
return false; return false;
host_window_created_ = true; host_window_created_ = true;
// Set window user data to this object for future reference from the window
// procedure.
gfx::SetWindowUserData(window_info_.window, this);
// Add a reference that will later be released in DestroyBrowser(). // Add a reference that will later be released in DestroyBrowser().
browser_->AddRef(); browser_->AddRef();
RECT cr; if (!called_enable_non_client_dpi_scaling_ && has_frame_ &&
GetClientRect(window_info_.window, &cr); base::win::IsProcessPerMonitorDpiAware()) {
// This call gets Windows to scale the non-client area when WM_DPICHANGED
// is fired on Windows versions < 10.0.14393.0.
// Derived signature; not available in headers.
static auto enable_child_window_dpi_message_func = []() {
using EnableChildWindowDpiMessagePtr = LRESULT(WINAPI*)(HWND, BOOL);
return reinterpret_cast<EnableChildWindowDpiMessagePtr>(GetProcAddress(
GetModuleHandle(L"user32.dll"), "EnableChildWindowDpiMessage"));
}();
if (enable_child_window_dpi_message_func)
enable_child_window_dpi_message_func(window_info_.window, TRUE);
}
DCHECK(!window_widget_); DCHECK(!window_widget_);
// Adjust for potential display scaling. // Convert from device coordinates to logical coordinates.
RECT cr;
GetClientRect(window_info_.window, &cr);
gfx::Point point = gfx::Point(cr.right, cr.bottom); gfx::Point point = gfx::Point(cr.right, cr.bottom);
float scale = display::Screen::GetScreen() const float scale = GetWindowScaleFactor(window_info_.window);
->GetDisplayNearestPoint(point)
.device_scale_factor();
point = point =
gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(point), 1.0f / scale)); gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(point), 1.0f / scale));
@@ -287,26 +305,26 @@ gfx::Point CefBrowserPlatformDelegateNativeWin::GetScreenPoint(
if (windowless_handler_) if (windowless_handler_)
return windowless_handler_->GetParentScreenPoint(view); return windowless_handler_->GetParentScreenPoint(view);
if (!window_widget_) if (!window_info_.window)
return view; return view;
aura::Window* window = window_widget_->GetNativeView(); // Convert from logical coordinates to device coordinates.
const gfx::Rect& bounds_in_screen = window->GetBoundsInScreen(); const float scale = GetWindowScaleFactor(window_info_.window);
const gfx::Point& screen_point = gfx::Point(bounds_in_screen.x() + view.x(), const gfx::Point& device_pt =
bounds_in_screen.y() + view.y()); gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(view), scale));
// Adjust for potential display scaling. // Convert from client coordinates to screen coordinates.
float scale = display::Screen::GetScreen() POINT screen_pt = {device_pt.x(), device_pt.y()};
->GetDisplayNearestPoint(screen_point) ClientToScreen(window_info_.window, &screen_pt);
.device_scale_factor();
return gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(screen_point), scale)); return gfx::Point(screen_pt.x, screen_pt.y);
} }
void CefBrowserPlatformDelegateNativeWin::ViewText(const std::string& text) { void CefBrowserPlatformDelegateNativeWin::ViewText(const std::string& text) {
std::string str = text; std::string str = text;
scoped_refptr<base::RefCountedString> str_ref = scoped_refptr<base::RefCountedString> str_ref =
base::RefCountedString::TakeString(&str); base::RefCountedString::TakeString(&str);
CEF_POST_TASK(CEF_FILET, base::Bind(WriteTempFileAndView, str_ref)); CEF_POST_USER_VISIBLE_TASK(base::Bind(WriteTempFileAndView, str_ref));
} }
void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent( void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
@@ -352,8 +370,7 @@ void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
void CefBrowserPlatformDelegateNativeWin::HandleExternalProtocol( void CefBrowserPlatformDelegateNativeWin::HandleExternalProtocol(
const GURL& url) { const GURL& url) {
// Execute on the FILE thread. CEF_POST_USER_VISIBLE_TASK(base::Bind(ExecuteExternalProtocol, url));
CEF_POST_TASK(CEF_FILET, base::Bind(ExecuteExternalProtocol, url));
} }
void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent( void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent(
@@ -387,8 +404,9 @@ void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent(
// TODO(cef): CefKeyEvent does not currently pass extended key status (see // TODO(cef): CefKeyEvent does not currently pass extended key status (see
// WM_KEYDOWN docs) which would be necessary to pass EF_IS_EXTENDED_KEY as // WM_KEYDOWN docs) which would be necessary to pass EF_IS_EXTENDED_KEY as
// the |flags| parameter to DomKeyFromKeyboardCode(). // the |flags| parameter to DomKeyFromKeyboardCode().
int flags = 0;
result.dom_key = ui::PlatformKeyMap::DomKeyFromKeyboardCode( result.dom_key = ui::PlatformKeyMap::DomKeyFromKeyboardCode(
ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), 0); ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), &flags);
} }
if (result.GetType() == blink::WebInputEvent::kChar || if (result.GetType() == blink::WebInputEvent::kChar ||
@@ -540,6 +558,8 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMouseEvent(
// timestamp // timestamp
result.SetTimeStampSeconds(GetMessageTime() / 1000.0); result.SetTimeStampSeconds(GetMessageTime() / 1000.0);
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
} }
// static // static
@@ -578,12 +598,15 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
UINT message, UINT message,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) { LPARAM lParam) {
CefBrowserPlatformDelegateNativeWin* platform_delegate = CefBrowserPlatformDelegateNativeWin* platform_delegate = nullptr;
static_cast<CefBrowserPlatformDelegateNativeWin*>(
gfx::GetWindowUserData(hwnd));
CefBrowserHostImpl* browser = nullptr; CefBrowserHostImpl* browser = nullptr;
if (platform_delegate)
browser = platform_delegate->browser_; if (message != WM_NCCREATE) {
platform_delegate = static_cast<CefBrowserPlatformDelegateNativeWin*>(
gfx::GetWindowUserData(hwnd));
if (platform_delegate)
browser = platform_delegate->browser_;
}
switch (message) { switch (message) {
case WM_CLOSE: case WM_CLOSE:
@@ -595,6 +618,31 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
// Allow the close. // Allow the close.
break; break;
case WM_NCCREATE: {
CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(lParam);
platform_delegate =
reinterpret_cast<CefBrowserPlatformDelegateNativeWin*>(
cs->lpCreateParams);
DCHECK(platform_delegate);
// Associate |platform_delegate| with the window handle.
gfx::SetWindowUserData(hwnd, platform_delegate);
platform_delegate->window_info_.window = hwnd;
if (platform_delegate->has_frame_ &&
base::win::IsProcessPerMonitorDpiAware()) {
// This call gets Windows to scale the non-client area when
// WM_DPICHANGED is fired on Windows versions >= 10.0.14393.0.
static auto enable_non_client_dpi_scaling_func = []() {
return reinterpret_cast<decltype(::EnableNonClientDpiScaling)*>(
GetProcAddress(GetModuleHandle(L"user32.dll"),
"EnableNonClientDpiScaling"));
}();
platform_delegate->called_enable_non_client_dpi_scaling_ =
!!(enable_non_client_dpi_scaling_func &&
enable_non_client_dpi_scaling_func(hwnd));
}
} break;
case WM_NCDESTROY: case WM_NCDESTROY:
if (platform_delegate) { if (platform_delegate) {
// Clear the user data pointer. // Clear the user data pointer.
@@ -633,6 +681,17 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
case WM_ERASEBKGND: case WM_ERASEBKGND:
return 0; return 0;
case WM_DPICHANGED:
if (platform_delegate && platform_delegate->has_frame_) {
// Suggested size and position of the current window scaled for the
// new DPI.
const RECT* rect = reinterpret_cast<RECT*>(lParam);
SetWindowPos(platform_delegate->GetHostWindowHandle(), NULL, rect->left,
rect->top, rect->right - rect->left,
rect->bottom - rect->top, SWP_NOZORDER | SWP_NOACTIVATE);
}
break;
} }
return DefWindowProc(hwnd, message, wParam, lParam); return DefWindowProc(hwnd, message, wParam, lParam);

View File

@@ -68,6 +68,9 @@ class CefBrowserPlatformDelegateNativeWin
// Widget hosting the web contents. It will be deleted automatically when the // Widget hosting the web contents. It will be deleted automatically when the
// associated root window is destroyed. // associated root window is destroyed.
views::Widget* window_widget_; views::Widget* window_widget_;
bool has_frame_ = false;
bool called_enable_non_client_dpi_scaling_ = false;
}; };
#endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_WIN_H_ #endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_WIN_H_

View File

@@ -5,8 +5,11 @@
#include "libcef/browser/native/file_dialog_runner_win.h" #include "libcef/browser/native/file_dialog_runner_win.h"
#include <windows.h>
#include <commdlg.h> #include <commdlg.h>
#include <shlobj.h> #include <shlobj.h>
#include <wrl/client.h>
#include "libcef/browser/browser_host_impl.h" #include "libcef/browser/browser_host_impl.h"
@@ -15,7 +18,6 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h" #include "base/win/registry.h"
#include "base/win/scoped_comptr.h"
#include "cef/grit/cef_strings.h" #include "cef/grit/cef_strings.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "net/base/mime_util.h" #include "net/base/mime_util.h"
@@ -395,7 +397,7 @@ bool RunOpenFolderDialog(const CefFileDialogRunner::FileChooserParams& params,
STRRET out_dir_buffer; STRRET out_dir_buffer;
ZeroMemory(&out_dir_buffer, sizeof(out_dir_buffer)); ZeroMemory(&out_dir_buffer, sizeof(out_dir_buffer));
out_dir_buffer.uType = STRRET_WSTR; out_dir_buffer.uType = STRRET_WSTR;
base::win::ScopedComPtr<IShellFolder> shell_folder; Microsoft::WRL::ComPtr<IShellFolder> shell_folder;
if (SHGetDesktopFolder(shell_folder.GetAddressOf()) == NOERROR) { if (SHGetDesktopFolder(shell_folder.GetAddressOf()) == NOERROR) {
HRESULT hr = shell_folder->GetDisplayNameOf(list, SHGDN_FORPARSING, HRESULT hr = shell_folder->GetDisplayNameOf(list, SHGDN_FORPARSING,
&out_dir_buffer); &out_dir_buffer);

View File

@@ -7,6 +7,8 @@
#define CEF_LIBCEF_BROWSER_NATIVE_JAVASCRIPT_DIALOG_RUNNER_WIN_H_ #define CEF_LIBCEF_BROWSER_NATIVE_JAVASCRIPT_DIALOG_RUNNER_WIN_H_
#pragma once #pragma once
#include <windows.h>
#include "libcef/browser/javascript_dialog_runner.h" #include "libcef/browser/javascript_dialog_runner.h"
class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner { class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner {

View File

@@ -11,9 +11,9 @@
#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_nsobject.h"
#if __OBJC__ #if __OBJC__
@class MenuController; @class MenuControllerCocoa;
#else #else
class MenuController; class MenuControllerCocoa;
#endif #endif
class CefMenuRunnerMac : public CefMenuRunner { class CefMenuRunnerMac : public CefMenuRunner {
@@ -28,7 +28,7 @@ class CefMenuRunnerMac : public CefMenuRunner {
void CancelContextMenu() override; void CancelContextMenu() override;
private: private:
base::scoped_nsobject<MenuController> menu_controller_; base::scoped_nsobject<MenuControllerCocoa> menu_controller_;
}; };
#endif // CEF_LIBCEF_BROWSER_NATIVE_MENU_RUNNER_MAC_H_ #endif // CEF_LIBCEF_BROWSER_NATIVE_MENU_RUNNER_MAC_H_

View File

@@ -21,14 +21,16 @@ bool CefMenuRunnerMac::RunContextMenu(
CefMenuModelImpl* model, CefMenuModelImpl* model,
const content::ContextMenuParams& params) { const content::ContextMenuParams& params) {
// Create a menu controller based on the model. // Create a menu controller based on the model.
menu_controller_.reset([[MenuController alloc] initWithModel:model->model() menu_controller_.reset([[MenuControllerCocoa alloc]
useWithPopUpButtonCell:NO]); initWithModel:model->model()
useWithPopUpButtonCell:NO]);
// Keep the menu controller alive (by adding an additional retain) until after // Keep the menu controller alive (by adding an additional retain) until after
// the menu has been dismissed. Otherwise it will crash if the browser is // the menu has been dismissed. Otherwise it will crash if the browser is
// destroyed (and consequently the menu controller is destroyed) while the // destroyed (and consequently the menu controller is destroyed) while the
// menu is still pending. // menu is still pending.
base::scoped_nsobject<MenuController> menu_controller_ref(menu_controller_); base::scoped_nsobject<MenuControllerCocoa> menu_controller_ref(
menu_controller_);
// Make sure events can be pumped while the menu is up. // Make sure events can be pumped while the menu is up.
base::MessageLoop::ScopedNestableTaskAllower allow( base::MessageLoop::ScopedNestableTaskAllower allow(

View File

@@ -109,7 +109,7 @@ static CefNativeMenuWin* GetCefNativeMenuWinFromHMENU(HMENU hmenu) {
// structure we have constructed in CefNativeMenuWin. // structure we have constructed in CefNativeMenuWin.
class CefNativeMenuWin::MenuHostWindow { class CefNativeMenuWin::MenuHostWindow {
public: public:
explicit MenuHostWindow(CefNativeMenuWin* parent) : parent_(parent) { MenuHostWindow() {
RegisterClass(); RegisterClass();
hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName, hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName,
L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
@@ -389,7 +389,6 @@ class CefNativeMenuWin::MenuHostWindow {
} }
HWND hwnd_; HWND hwnd_;
CefNativeMenuWin* parent_;
DISALLOW_COPY_AND_ASSIGN(MenuHostWindow); DISALLOW_COPY_AND_ASSIGN(MenuHostWindow);
}; };
@@ -648,7 +647,7 @@ void CefNativeMenuWin::AddMenuItemAt(int menu_index, int model_index) {
else else
mii.fType = MFT_OWNERDRAW; mii.fType = MFT_OWNERDRAW;
std::unique_ptr<ItemData> item_data = base::MakeUnique<ItemData>(); std::unique_ptr<ItemData> item_data = std::make_unique<ItemData>();
item_data->label = base::string16(); item_data->label = base::string16();
ui::MenuModel::ItemType type = model_->GetTypeAt(model_index); ui::MenuModel::ItemType type = model_->GetTypeAt(model_index);
if (type == ui::MenuModel::TYPE_SUBMENU) { if (type == ui::MenuModel::TYPE_SUBMENU) {
@@ -677,7 +676,7 @@ void CefNativeMenuWin::AddSeparatorItemAt(int menu_index, int model_index) {
mii.fType = MFT_SEPARATOR; mii.fType = MFT_SEPARATOR;
// Insert a dummy entry into our label list so we can index directly into it // Insert a dummy entry into our label list so we can index directly into it
// using item indices if need be. // using item indices if need be.
items_.insert(items_.begin() + model_index, base::MakeUnique<ItemData>()); items_.insert(items_.begin() + model_index, std::make_unique<ItemData>());
InsertMenuItem(menu_, menu_index, TRUE, &mii); InsertMenuItem(menu_, menu_index, TRUE, &mii);
} }
@@ -775,7 +774,7 @@ void CefNativeMenuWin::CreateHostWindow() {
// host window per menu hierarchy, no matter how many CefNativeMenuWin objects // host window per menu hierarchy, no matter how many CefNativeMenuWin objects
// exist wrapping submenus. // exist wrapping submenus.
if (!host_window_.get()) if (!host_window_.get())
host_window_.reset(new MenuHostWindow(this)); host_window_.reset(new MenuHostWindow());
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@@ -4,6 +4,8 @@
#include "libcef/browser/native/window_delegate_view.h" #include "libcef/browser/native/window_delegate_view.h"
#include <utility>
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/controls/webview/webview.h" #include "ui/views/controls/webview/webview.h"
@@ -55,7 +57,7 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
void CefWindowDelegateView::InitContent() { void CefWindowDelegateView::InitContent() {
SetBackground(views::CreateSolidBackground(background_color_)); SetBackground(views::CreateSolidBackground(background_color_));
SetLayoutManager(new views::FillLayout()); SetLayoutManager(std::make_unique<views::FillLayout>());
AddChildView(web_view_); AddChildView(web_view_);
} }

View File

@@ -13,7 +13,6 @@
#include "ui/base/x/x11_util.h" #include "ui/base/x/x11_util.h"
#include "ui/events/platform/platform_event_source.h" #include "ui/events/platform/platform_event_source.h"
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
#include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
@@ -38,7 +37,7 @@ const char kXdndProxy[] = "XdndProxy";
::Window root; ::Window root;
::Window parent; ::Window parent;
::Window* children; ::Window* children;
::Window child_window = None; ::Window child_window = x11::None;
unsigned int nchildren; unsigned int nchildren;
if (XQueryTree(display, window, &root, &parent, &children, &nchildren)) { if (XQueryTree(display, window, &root, &parent, &children, &nchildren)) {
DCHECK_EQ(1U, nchildren); DCHECK_EQ(1U, nchildren);
@@ -50,8 +49,8 @@ const char kXdndProxy[] = "XdndProxy";
::Window FindToplevelParent(::Display* display, ::Window window) { ::Window FindToplevelParent(::Display* display, ::Window window) {
::Window top_level_window = window; ::Window top_level_window = window;
::Window root = None; ::Window root = x11::None;
::Window parent = None; ::Window parent = x11::None;
::Window* children = NULL; ::Window* children = NULL;
unsigned int nchildren = 0; unsigned int nchildren = 0;
// Enumerate all parents of "window" to find the highest level window // Enumerate all parents of "window" to find the highest level window
@@ -91,12 +90,12 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
bounds_(bounds), bounds_(bounds),
focus_pending_(false), focus_pending_(false),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
if (parent_xwindow_ == None) if (parent_xwindow_ == x11::None)
parent_xwindow_ = DefaultRootWindow(xdisplay_); parent_xwindow_ = DefaultRootWindow(xdisplay_);
XSetWindowAttributes swa; XSetWindowAttributes swa;
memset(&swa, 0, sizeof(swa)); memset(&swa, 0, sizeof(swa));
swa.background_pixmap = None; swa.background_pixmap = x11::None;
swa.override_redirect = false; swa.override_redirect = false;
xwindow_ = XCreateWindow(xdisplay_, parent_xwindow_, bounds.x(), bounds.y(), xwindow_ = XCreateWindow(xdisplay_, parent_xwindow_, bounds.x(), bounds.y(),
bounds.width(), bounds.height(), bounds.width(), bounds.height(),
@@ -148,12 +147,12 @@ void CefWindowX11::Close() {
ev.xclient.message_type = gfx::GetAtom(kWMProtocols); ev.xclient.message_type = gfx::GetAtom(kWMProtocols);
ev.xclient.format = 32; ev.xclient.format = 32;
ev.xclient.data.l[0] = gfx::GetAtom(kWMDeleteWindow); ev.xclient.data.l[0] = gfx::GetAtom(kWMDeleteWindow);
ev.xclient.data.l[1] = CurrentTime; ev.xclient.data.l[1] = x11::CurrentTime;
XSendEvent(xdisplay_, xwindow_, False, NoEventMask, &ev); XSendEvent(xdisplay_, xwindow_, false, NoEventMask, &ev);
} }
void CefWindowX11::Show() { void CefWindowX11::Show() {
if (xwindow_ == None) if (xwindow_ == x11::None)
return; return;
if (!window_mapped_) { if (!window_mapped_) {
@@ -170,11 +169,8 @@ void CefWindowX11::Show() {
XMapWindow(xdisplay_, xwindow_); XMapWindow(xdisplay_, xwindow_);
// We now block until our window is mapped. Some X11 APIs will crash and // TODO(thomasanderson): Find out why this flush is necessary.
// burn if passed |xwindow_| before the window is mapped, and XMapWindow is XFlush(xdisplay_);
// asynchronous.
if (ui::X11EventSource::GetInstance())
ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_);
window_mapped_ = true; window_mapped_ = true;
// Setup the drag and drop proxy on the top level window of the application // Setup the drag and drop proxy on the top level window of the application
@@ -205,7 +201,7 @@ void CefWindowX11::Show() {
} }
void CefWindowX11::Hide() { void CefWindowX11::Hide() {
if (xwindow_ == None) if (xwindow_ == x11::None)
return; return;
if (window_mapped_) { if (window_mapped_) {
@@ -215,22 +211,22 @@ void CefWindowX11::Hide() {
} }
void CefWindowX11::Focus() { void CefWindowX11::Focus() {
if (xwindow_ == None || !window_mapped_) if (xwindow_ == x11::None || !window_mapped_)
return; return;
if (browser_.get()) { if (browser_.get()) {
::Window child = FindChild(xdisplay_, xwindow_); ::Window child = FindChild(xdisplay_, xwindow_);
if (child && ui::IsWindowVisible(child)) { if (child && ui::IsWindowVisible(child)) {
// Give focus to the child DesktopWindowTreeHostX11. // Give focus to the child DesktopWindowTreeHostX11.
XSetInputFocus(xdisplay_, child, RevertToParent, CurrentTime); XSetInputFocus(xdisplay_, child, RevertToParent, x11::CurrentTime);
} }
} else { } else {
XSetInputFocus(xdisplay_, xwindow_, RevertToParent, CurrentTime); XSetInputFocus(xdisplay_, xwindow_, RevertToParent, x11::CurrentTime);
} }
} }
void CefWindowX11::SetBounds(const gfx::Rect& bounds) { void CefWindowX11::SetBounds(const gfx::Rect& bounds) {
if (xwindow_ == None) if (xwindow_ == x11::None)
return; return;
bool origin_changed = bounds_.origin() != bounds.origin(); bool origin_changed = bounds_.origin() != bounds.origin();
@@ -315,7 +311,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
// Allow the close. // Allow the close.
XDestroyWindow(xdisplay_, xwindow_); XDestroyWindow(xdisplay_, xwindow_);
xwindow_ = None; xwindow_ = x11::None;
if (browser_.get()) { if (browser_.get()) {
// Force the browser to be destroyed and release the reference // Force the browser to be destroyed and release the reference
@@ -329,7 +325,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
XEvent reply_event = *xev; XEvent reply_event = *xev;
reply_event.xclient.window = parent_xwindow_; reply_event.xclient.window = parent_xwindow_;
XSendEvent(xdisplay_, reply_event.xclient.window, False, XSendEvent(xdisplay_, reply_event.xclient.window, false,
SubstructureRedirectMask | SubstructureNotifyMask, SubstructureRedirectMask | SubstructureNotifyMask,
&reply_event); &reply_event);
XFlush(xdisplay_); XFlush(xdisplay_);
@@ -337,7 +333,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
} }
break; break;
} }
case FocusIn: case x11::FocusIn:
// This message is received first followed by a "_NET_ACTIVE_WINDOW" // This message is received first followed by a "_NET_ACTIVE_WINDOW"
// message sent to the root window. When X11DesktopHandler handles the // message sent to the root window. When X11DesktopHandler handles the
// "_NET_ACTIVE_WINDOW" message it will erroneously mark the WebView // "_NET_ACTIVE_WINDOW" message it will erroneously mark the WebView
@@ -351,7 +347,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
100); 100);
} }
break; break;
case FocusOut: case x11::FocusOut:
// Cancel the pending focus change if some other window has gained focus // Cancel the pending focus change if some other window has gained focus
// while waiting for the async task to run. Otherwise we can get stuck in // while waiting for the async task to run. Otherwise we can get stuck in
// a focus change loop. // a focus change loop.

View File

@@ -37,6 +37,7 @@
#include "content/browser/webui/content_web_ui_controller_factory.h" #include "content/browser/webui/content_web_ui_controller_factory.h"
#include "content/public/browser/browser_url_handler.h" #include "content/public/browser/browser_url_handler.h"
#include "content/public/common/url_constants.h" #include "content/public/common/url_constants.h"
#include "content/public/common/url_utils.h"
#include "content/public/common/user_agent.h" #include "content/public/common/user_agent.h"
#include "ipc/ipc_channel.h" #include "ipc/ipc_channel.h"
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
@@ -71,7 +72,6 @@ const char* kAllowedWebUIHosts[] = {
chrome::kChromeUINetInternalsHost, chrome::kChromeUINetInternalsHost,
content::kChromeUINetworkErrorHost, content::kChromeUINetworkErrorHost,
content::kChromeUINetworkErrorsListingHost, content::kChromeUINetworkErrorsListingHost,
content::kChromeUINetworkViewCacheHost,
content::kChromeUIResourcesHost, content::kChromeUIResourcesHost,
content::kChromeUIServiceWorkerInternalsHost, content::kChromeUIServiceWorkerInternalsHost,
chrome::kChromeUISystemInfoHost, chrome::kChromeUISystemInfoHost,
@@ -169,7 +169,7 @@ bool IsDebugURL(const GURL& url) {
// Also include URLs handled by the browser process in // Also include URLs handled by the browser process in
// content/browser/frame_host/debug_urls.cc HandleDebugURL(). // content/browser/frame_host/debug_urls.cc HandleDebugURL().
for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) { for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
GURL host(chrome::kChromeDebugURLs[i]); GURL host(chrome::kChromeDebugURLs[i]);
if (url.GetOrigin() == host.GetOrigin()) if (url.GetOrigin() == host.GetOrigin())
return true; return true;
@@ -186,7 +186,7 @@ bool IsDebugURL(const GURL& url) {
} }
void GetDebugURLs(std::vector<std::string>* urls) { void GetDebugURLs(std::vector<std::string>* urls) {
for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) { for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
urls->push_back(chrome::kChromeDebugURLs[i]); urls->push_back(chrome::kChromeDebugURLs[i]);
} }
@@ -793,6 +793,7 @@ void DidFinishChromeLoad(CefRefPtr<CefFrame> frame, const GURL& validated_url) {
switch (host_id) { switch (host_id) {
case CHROME_VERSION: case CHROME_VERSION:
DidFinishChromeVersionLoad(frame); DidFinishChromeVersionLoad(frame);
break;
default: default:
break; break;
} }

View File

@@ -11,6 +11,32 @@
#include "base/logging.h" #include "base/logging.h"
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
namespace {
class NullCookieChangeDispatcher : public net::CookieChangeDispatcher {
public:
NullCookieChangeDispatcher() {}
~NullCookieChangeDispatcher() override {}
// net::CookieChangeDispatcher
std::unique_ptr<net::CookieChangeSubscription> AddCallbackForCookie(
const GURL& url,
const std::string& name,
net::CookieChangeCallback callback) override WARN_UNUSED_RESULT {
return nullptr;
}
std::unique_ptr<net::CookieChangeSubscription> AddCallbackForAllChanges(
net::CookieChangeCallback callback) override WARN_UNUSED_RESULT {
return nullptr;
}
private:
DISALLOW_COPY_AND_ASSIGN(NullCookieChangeDispatcher);
};
} // namespace
CefCookieStoreProxy::CefCookieStoreProxy( CefCookieStoreProxy::CefCookieStoreProxy(
CefURLRequestContextImpl* parent, CefURLRequestContextImpl* parent,
CefRefPtr<CefRequestContextHandler> handler) CefRefPtr<CefRequestContextHandler> handler)
@@ -33,29 +59,8 @@ void CefCookieStoreProxy::SetCookieWithOptionsAsync(
if (cookie_store) { if (cookie_store) {
cookie_store->SetCookieWithOptionsAsync(url, cookie_line, options, cookie_store->SetCookieWithOptionsAsync(url, cookie_line, options,
std::move(callback)); std::move(callback));
} } else if (!callback.is_null()) {
} std::move(callback).Run(false);
void CefCookieStoreProxy::SetCookieWithDetailsAsync(
const GURL& url,
const std::string& name,
const std::string& value,
const std::string& domain,
const std::string& path,
base::Time creation_time,
base::Time expiration_time,
base::Time last_access_time,
bool secure,
bool http_only,
net::CookieSameSite same_site,
net::CookiePriority priority,
SetCookiesCallback callback) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) {
cookie_store->SetCookieWithDetailsAsync(
url, name, value, domain, path, creation_time, expiration_time,
last_access_time, secure, http_only, same_site, priority,
std::move(callback));
} }
} }
@@ -69,48 +74,53 @@ void CefCookieStoreProxy::SetCanonicalCookieAsync(
cookie_store->SetCanonicalCookieAsync(std::move(cookie), secure_source, cookie_store->SetCanonicalCookieAsync(std::move(cookie), secure_source,
modify_http_only, modify_http_only,
std::move(callback)); std::move(callback));
} else if (!callback.is_null()) {
std::move(callback).Run(false);
} }
} }
void CefCookieStoreProxy::GetCookiesWithOptionsAsync(
const GURL& url,
const net::CookieOptions& options,
GetCookiesCallback callback) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store)
cookie_store->GetCookiesWithOptionsAsync(url, options, std::move(callback));
}
void CefCookieStoreProxy::GetCookieListWithOptionsAsync( void CefCookieStoreProxy::GetCookieListWithOptionsAsync(
const GURL& url, const GURL& url,
const net::CookieOptions& options, const net::CookieOptions& options,
GetCookieListCallback callback) { GetCookieListCallback callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store) {
cookie_store->GetCookieListWithOptionsAsync(url, options, cookie_store->GetCookieListWithOptionsAsync(url, options,
std::move(callback)); std::move(callback));
} else if (!callback.is_null()) {
std::move(callback).Run(net::CookieList());
}
} }
void CefCookieStoreProxy::GetAllCookiesAsync(GetCookieListCallback callback) { void CefCookieStoreProxy::GetAllCookiesAsync(GetCookieListCallback callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store) {
cookie_store->GetAllCookiesAsync(std::move(callback)); cookie_store->GetAllCookiesAsync(std::move(callback));
} else if (!callback.is_null()) {
std::move(callback).Run(net::CookieList());
}
} }
void CefCookieStoreProxy::DeleteCookieAsync(const GURL& url, void CefCookieStoreProxy::DeleteCookieAsync(const GURL& url,
const std::string& cookie_name, const std::string& cookie_name,
base::OnceClosure callback) { base::OnceClosure callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store) {
cookie_store->DeleteCookieAsync(url, cookie_name, std::move(callback)); cookie_store->DeleteCookieAsync(url, cookie_name, std::move(callback));
} else if (!callback.is_null()) {
std::move(callback).Run();
}
} }
void CefCookieStoreProxy::DeleteCanonicalCookieAsync( void CefCookieStoreProxy::DeleteCanonicalCookieAsync(
const net::CanonicalCookie& cookie, const net::CanonicalCookie& cookie,
DeleteCallback callback) { DeleteCallback callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store) {
cookie_store->DeleteCanonicalCookieAsync(cookie, std::move(callback)); cookie_store->DeleteCanonicalCookieAsync(cookie, std::move(callback));
} else if (!callback.is_null()) {
std::move(callback).Run(0);
}
} }
void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync( void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync(
@@ -121,6 +131,8 @@ void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync(
if (cookie_store) { if (cookie_store) {
cookie_store->DeleteAllCreatedBetweenAsync(delete_begin, delete_end, cookie_store->DeleteAllCreatedBetweenAsync(delete_begin, delete_end,
std::move(callback)); std::move(callback));
} else if (!callback.is_null()) {
std::move(callback).Run(0);
} }
} }
@@ -133,39 +145,37 @@ void CefCookieStoreProxy::DeleteAllCreatedBetweenWithPredicateAsync(
if (cookie_store) { if (cookie_store) {
cookie_store->DeleteAllCreatedBetweenWithPredicateAsync( cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
delete_begin, delete_end, predicate, std::move(callback)); delete_begin, delete_end, predicate, std::move(callback));
} else if (!callback.is_null()) {
std::move(callback).Run(0);
} }
} }
void CefCookieStoreProxy::DeleteSessionCookiesAsync(DeleteCallback callback) { void CefCookieStoreProxy::DeleteSessionCookiesAsync(DeleteCallback callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store) {
cookie_store->DeleteSessionCookiesAsync(std::move(callback)); cookie_store->DeleteSessionCookiesAsync(std::move(callback));
} else if (!callback.is_null()) {
std::move(callback).Run(0);
}
} }
void CefCookieStoreProxy::FlushStore(base::OnceClosure callback) { void CefCookieStoreProxy::FlushStore(base::OnceClosure callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store) {
cookie_store->FlushStore(std::move(callback)); cookie_store->FlushStore(std::move(callback));
} else if (!callback.is_null()) {
std::move(callback).Run();
}
} }
std::unique_ptr<net::CookieStore::CookieChangedSubscription> net::CookieChangeDispatcher& CefCookieStoreProxy::GetChangeDispatcher() {
CefCookieStoreProxy::AddCallbackForCookie(
const GURL& url,
const std::string& name,
const CookieChangedCallback& callback) {
net::CookieStore* cookie_store = GetCookieStore(); net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store) if (cookie_store)
return cookie_store->AddCallbackForCookie(url, name, callback); return cookie_store->GetChangeDispatcher();
return nullptr;
}
std::unique_ptr<net::CookieStore::CookieChangedSubscription> if (!null_dispatcher_)
CefCookieStoreProxy::AddCallbackForAllChanges( null_dispatcher_.reset(new NullCookieChangeDispatcher());
const CookieChangedCallback& callback) { return *null_dispatcher_;
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store)
return cookie_store->AddCallbackForAllChanges(callback);
return nullptr;
} }
bool CefCookieStoreProxy::IsEphemeral() { bool CefCookieStoreProxy::IsEphemeral() {
@@ -178,25 +188,23 @@ bool CefCookieStoreProxy::IsEphemeral() {
net::CookieStore* CefCookieStoreProxy::GetCookieStore() { net::CookieStore* CefCookieStoreProxy::GetCookieStore() {
CEF_REQUIRE_IOT(); CEF_REQUIRE_IOT();
net::CookieStore* cookie_store = nullptr;
CefRefPtr<CefCookieManager> manager = handler_->GetCookieManager(); CefRefPtr<CefCookieManager> manager = handler_->GetCookieManager();
if (manager.get()) { if (manager.get()) {
// Use the cookie store provided by the manager. // Use the cookie store provided by the manager. May be nullptr if the
cookie_store = reinterpret_cast<CefCookieManagerImpl*>(manager.get()) // cookie manager is blocking.
->GetExistingCookieStore(); return reinterpret_cast<CefCookieManagerImpl*>(manager.get())
DCHECK(cookie_store); ->GetExistingCookieStore();
return cookie_store;
} }
DCHECK(parent_); DCHECK(parent_);
if (parent_) { if (parent_) {
// Use the cookie store from the parent. // Use the cookie store from the parent.
cookie_store = parent_->cookie_store(); net::CookieStore* cookie_store = parent_->cookie_store();
DCHECK(cookie_store); DCHECK(cookie_store);
if (!cookie_store) if (!cookie_store)
LOG(ERROR) << "Cookie store does not exist"; LOG(ERROR) << "Cookie store does not exist";
return cookie_store;
} }
return cookie_store; return nullptr;
} }

View File

@@ -26,26 +26,10 @@ class CefCookieStoreProxy : public net::CookieStore {
const std::string& cookie_line, const std::string& cookie_line,
const net::CookieOptions& options, const net::CookieOptions& options,
SetCookiesCallback callback) override; SetCookiesCallback callback) override;
void SetCookieWithDetailsAsync(const GURL& url,
const std::string& name,
const std::string& value,
const std::string& domain,
const std::string& path,
base::Time creation_time,
base::Time expiration_time,
base::Time last_access_time,
bool secure,
bool http_only,
net::CookieSameSite same_site,
net::CookiePriority priority,
SetCookiesCallback callback) override;
void SetCanonicalCookieAsync(std::unique_ptr<net::CanonicalCookie> cookie, void SetCanonicalCookieAsync(std::unique_ptr<net::CanonicalCookie> cookie,
bool secure_source, bool secure_source,
bool modify_http_only, bool modify_http_only,
SetCookiesCallback callback) override; SetCookiesCallback callback) override;
void GetCookiesWithOptionsAsync(const GURL& url,
const net::CookieOptions& options,
GetCookiesCallback callback) override;
void GetCookieListWithOptionsAsync(const GURL& url, void GetCookieListWithOptionsAsync(const GURL& url,
const net::CookieOptions& options, const net::CookieOptions& options,
GetCookieListCallback callback) override; GetCookieListCallback callback) override;
@@ -65,12 +49,7 @@ class CefCookieStoreProxy : public net::CookieStore {
DeleteCallback callback) override; DeleteCallback callback) override;
void DeleteSessionCookiesAsync(DeleteCallback callback) override; void DeleteSessionCookiesAsync(DeleteCallback callback) override;
void FlushStore(base::OnceClosure callback) override; void FlushStore(base::OnceClosure callback) override;
std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie( net::CookieChangeDispatcher& GetChangeDispatcher() override;
const GURL& url,
const std::string& name,
const CookieChangedCallback& callback) override;
std::unique_ptr<CookieChangedSubscription> AddCallbackForAllChanges(
const CookieChangedCallback& callback) override;
bool IsEphemeral() override; bool IsEphemeral() override;
private: private:
@@ -81,6 +60,8 @@ class CefCookieStoreProxy : public net::CookieStore {
CefURLRequestContextImpl* parent_; CefURLRequestContextImpl* parent_;
CefRefPtr<CefRequestContextHandler> handler_; CefRefPtr<CefRequestContextHandler> handler_;
std::unique_ptr<net::CookieChangeDispatcher> null_dispatcher_;
DISALLOW_COPY_AND_ASSIGN(CefCookieStoreProxy); DISALLOW_COPY_AND_ASSIGN(CefCookieStoreProxy);
}; };

View File

@@ -9,10 +9,8 @@
#include "base/files/file_util.h" #include "base/files/file_util.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/task_scheduler/post_task.h"
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "net/cert/crl_set.h" #include "net/cert/crl_set.h"
#include "net/cert/crl_set_storage.h"
#include "net/ssl/ssl_config_service.h" #include "net/ssl/ssl_config_service.h"
namespace { namespace {
@@ -21,19 +19,11 @@ namespace {
void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set) { void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set) {
CEF_REQUIRE_IOT(); CEF_REQUIRE_IOT();
net::SSLConfigService::SetCRLSetIfNewer(crl_set);
scoped_refptr<net::CRLSet> old_crl_set(net::SSLConfigService::GetCRLSet());
if (old_crl_set.get() && old_crl_set->sequence() > crl_set->sequence()) {
LOG(WARNING) << "Refusing to downgrade CRL set from #"
<< old_crl_set->sequence() << "to #" << crl_set->sequence();
} else {
net::SSLConfigService::SetCRLSet(crl_set);
VLOG(1) << "Installed CRL set #" << crl_set->sequence();
}
} }
void LoadFromDisk(const base::FilePath& path) { void LoadFromDisk(const base::FilePath& path) {
base::ThreadRestrictions::AssertIOAllowed(); CEF_REQUIRE_BLOCKING();
std::string crl_set_bytes; std::string crl_set_bytes;
if (!base::ReadFileToString(path, &crl_set_bytes)) { if (!base::ReadFileToString(path, &crl_set_bytes)) {
@@ -42,7 +32,7 @@ void LoadFromDisk(const base::FilePath& path) {
} }
scoped_refptr<net::CRLSet> crl_set; scoped_refptr<net::CRLSet> crl_set;
if (!net::CRLSetStorage::Parse(crl_set_bytes, &crl_set)) { if (!net::CRLSet::Parse(crl_set_bytes, &crl_set)) {
LOG(WARNING) << "Failed to parse CRL set from " << path.MaybeAsASCII(); LOG(WARNING) << "Failed to parse CRL set from " << path.MaybeAsASCII();
return; return;
} }
@@ -59,7 +49,5 @@ void CefLoadCRLSetsFile(const CefString& path) {
return; return;
} }
base::PostTaskWithTraits(FROM_HERE, CEF_POST_USER_VISIBLE_TASK(base::BindOnce(&LoadFromDisk, path));
{base::TaskPriority::BACKGROUND, base::MayBlock()},
base::BindOnce(&LoadFromDisk, path));
} }

View File

@@ -9,7 +9,7 @@
namespace net_util { namespace net_util {
bool IsInternalRequest(net::URLRequest* request) { bool IsInternalRequest(const net::URLRequest* request) {
// With PlzNavigate we now receive blob URLs. Ignore these URLs. // With PlzNavigate we now receive blob URLs. Ignore these URLs.
// See https://crbug.com/776884 for details. // See https://crbug.com/776884 for details.
if (request->url().SchemeIs(url::kBlobScheme)) { if (request->url().SchemeIs(url::kBlobScheme)) {

View File

@@ -14,7 +14,7 @@ namespace net_util {
// Returns true if |request| is handled internally and should not be exposed via // Returns true if |request| is handled internally and should not be exposed via
// the CEF API. // the CEF API.
bool IsInternalRequest(net::URLRequest* request); bool IsInternalRequest(const net::URLRequest* request);
}; // namespace net_util }; // namespace net_util

View File

@@ -9,6 +9,7 @@
#include "include/cef_urlrequest.h" #include "include/cef_urlrequest.h"
#include "libcef/browser/browser_host_impl.h" #include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/cookie_manager_impl.h"
#include "libcef/browser/net/net_util.h" #include "libcef/browser/net/net_util.h"
#include "libcef/browser/net/source_stream.h" #include "libcef/browser/net/source_stream.h"
#include "libcef/browser/net/url_request_user_data.h" #include "libcef/browser/net/url_request_user_data.h"
@@ -271,7 +272,7 @@ std::unique_ptr<net::SourceStream> CefNetworkDelegate::CreateSourceStream(
} }
if (cef_filter && cef_filter->InitFilter()) if (cef_filter && cef_filter->InitFilter())
return base::MakeUnique<CefSourceStream>(cef_filter, std::move(upstream)); return std::make_unique<CefSourceStream>(cef_filter, std::move(upstream));
return upstream; return upstream;
} }
@@ -440,6 +441,64 @@ net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(
return AUTH_REQUIRED_RESPONSE_NO_ACTION; return AUTH_REQUIRED_RESPONSE_NO_ACTION;
} }
bool CefNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
const net::CookieList& cookie_list) {
if (net_util::IsInternalRequest(&request))
return true;
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForRequest(&request);
if (browser.get()) {
CefRefPtr<CefClient> client = browser->GetClient();
if (client.get()) {
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
if (handler.get()) {
CefRefPtr<CefFrame> frame = browser->GetFrameForRequest(&request);
CefRefPtr<CefRequestImpl> cefRequest = new CefRequestImpl();
cefRequest->Set(&request);
cefRequest->SetReadOnly(true);
return handler->CanGetCookies(browser.get(), frame, cefRequest.get());
}
}
}
return true;
}
bool CefNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
const net::CanonicalCookie& cookie,
net::CookieOptions* options) {
if (net_util::IsInternalRequest(&request))
return true;
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForRequest(&request);
if (browser.get()) {
CefRefPtr<CefClient> client = browser->GetClient();
if (client.get()) {
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
if (handler.get()) {
CefRefPtr<CefFrame> frame = browser->GetFrameForRequest(&request);
CefRefPtr<CefRequestImpl> cefRequest = new CefRequestImpl();
cefRequest->Set(&request);
cefRequest->SetReadOnly(true);
CefCookie cefCookie;
if (!CefCookieManagerImpl::GetCefCookie(cookie, cefCookie))
return true;
return handler->CanSetCookie(browser.get(), frame, cefRequest.get(),
cefCookie);
}
}
}
return true;
}
bool CefNetworkDelegate::OnCanAccessFile( bool CefNetworkDelegate::OnCanAccessFile(
const net::URLRequest& request, const net::URLRequest& request,
const base::FilePath& original_path, const base::FilePath& original_path,

View File

@@ -38,6 +38,11 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
const AuthCallback& callback, const AuthCallback& callback,
net::AuthCredentials* credentials) override; net::AuthCredentials* credentials) override;
void OnCompleted(net::URLRequest* request, bool started) override; void OnCompleted(net::URLRequest* request, bool started) override;
bool OnCanGetCookies(const net::URLRequest& request,
const net::CookieList& cookie_list) override;
bool OnCanSetCookie(const net::URLRequest& request,
const net::CanonicalCookie& cookie,
net::CookieOptions* options) override;
bool OnCanAccessFile(const net::URLRequest& request, bool OnCanAccessFile(const net::URLRequest& request,
const base::FilePath& original_path, const base::FilePath& original_path,
const base::FilePath& absolute_path) const override; const base::FilePath& absolute_path) const override;

View File

@@ -328,6 +328,22 @@ bool CefResourceRequestJob::GetMimeType(std::string* mime_type) const {
return true; return true;
} }
bool CefResourceRequestJob::GetCharset(std::string* charset) {
CEF_REQUIRE_IOT();
if (net::HttpResponseHeaders* headers = GetResponseHeaders())
return headers->GetCharset(charset);
return false;
}
int CefResourceRequestJob::GetResponseCode() const {
CEF_REQUIRE_IOT();
if (response_.get())
return response_->GetStatus();
return -1;
}
void CefResourceRequestJob::SendHeaders() { void CefResourceRequestJob::SendHeaders() {
CEF_REQUIRE_IOT(); CEF_REQUIRE_IOT();
@@ -403,7 +419,7 @@ void CefResourceRequestJob::AddCookieHeaderAndStart() {
void CefResourceRequestJob::DoLoadCookies() { void CefResourceRequestJob::DoLoadCookies() {
net::CookieOptions options; net::CookieOptions options;
options.set_include_httponly(); options.set_include_httponly();
request_->context()->cookie_store()->GetCookiesWithOptionsAsync( request_->context()->cookie_store()->GetCookieListWithOptionsAsync(
request_->url(), options, request_->url(), options,
base::Bind(&CefResourceRequestJob::OnCookiesLoaded, base::Bind(&CefResourceRequestJob::OnCookiesLoaded,
weak_factory_.GetWeakPtr())); weak_factory_.GetWeakPtr()));
@@ -411,7 +427,7 @@ void CefResourceRequestJob::DoLoadCookies() {
void CefResourceRequestJob::CheckCookiePolicyAndLoad( void CefResourceRequestJob::CheckCookiePolicyAndLoad(
const net::CookieList& cookie_list) { const net::CookieList& cookie_list) {
bool can_get_cookies = CanGetCookies(cookie_list); bool can_get_cookies = !cookie_list.empty() && CanGetCookies(cookie_list);
if (can_get_cookies) { if (can_get_cookies) {
net::CookieList::const_iterator it = cookie_list.begin(); net::CookieList::const_iterator it = cookie_list.begin();
for (; it != cookie_list.end(); ++it) { for (; it != cookie_list.end(); ++it) {
@@ -430,8 +446,11 @@ void CefResourceRequestJob::CheckCookiePolicyAndLoad(
DoStartTransaction(); DoStartTransaction();
} }
void CefResourceRequestJob::OnCookiesLoaded(const std::string& cookie_line) { void CefResourceRequestJob::OnCookiesLoaded(
if (!cookie_line.empty()) { const net::CookieList& cookie_list) {
if (!cookie_list.empty()) {
const std::string& cookie_line =
net::CanonicalCookie::BuildCookieLine(cookie_list);
CefRequest::HeaderMap headerMap; CefRequest::HeaderMap headerMap;
cef_request_->GetHeaderMap(headerMap); cef_request_->GetHeaderMap(headerMap);
headerMap.insert( headerMap.insert(
@@ -500,25 +519,29 @@ void CefResourceRequestJob::SaveNextCookie() {
return; return;
} }
const std::string& cookie_line =
response_cookies_[response_cookies_save_index_];
net::CookieOptions options; net::CookieOptions options;
options.set_include_httponly(); options.set_include_httponly();
bool can_set_cookie = std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create(
CanSetCookie(response_cookies_[response_cookies_save_index_], &options); request_->url(), cookie_line, base::Time::Now(), options);
bool can_set_cookie = cookie && CanSetCookie(*cookie, &options);
if (can_set_cookie) { if (can_set_cookie) {
CefCookie cookie; CefCookie cef_cookie;
if (CefCookieManagerImpl::GetCefCookie( if (CefCookieManagerImpl::GetCefCookie(request_->url(), cookie_line,
request_->url(), response_cookies_[response_cookies_save_index_], cef_cookie)) {
cookie)) { can_set_cookie = handler_->CanSetCookie(cef_cookie);
can_set_cookie = handler_->CanSetCookie(cookie);
} else { } else {
can_set_cookie = false; can_set_cookie = false;
} }
} }
if (can_set_cookie) { if (can_set_cookie) {
request_->context()->cookie_store()->SetCookieWithOptionsAsync( request_->context()->cookie_store()->SetCanonicalCookieAsync(
request_->url(), response_cookies_[response_cookies_save_index_], std::move(cookie), request_->url().SchemeIsCryptographic(),
options, !options.exclude_httponly(),
base::Bind(&CefResourceRequestJob::OnCookieSaved, base::Bind(&CefResourceRequestJob::OnCookieSaved,
weak_factory_.GetWeakPtr())); weak_factory_.GetWeakPtr()));
return; return;

View File

@@ -20,7 +20,7 @@
namespace net { namespace net {
class HttpResponseHeaders; class HttpResponseHeaders;
class URLRequest; class URLRequest;
} } // namespace net
class CefResourceRequestJobCallback; class CefResourceRequestJobCallback;
@@ -40,6 +40,8 @@ class CefResourceRequestJob : public net::URLRequestJob {
void GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const 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) override;
bool GetMimeType(std::string* mime_type) const override; bool GetMimeType(std::string* mime_type) const override;
bool GetCharset(std::string* charset) override;
int GetResponseCode() const override;
void SendHeaders(); void SendHeaders();
@@ -47,7 +49,7 @@ class CefResourceRequestJob : public net::URLRequestJob {
void AddCookieHeaderAndStart(); void AddCookieHeaderAndStart();
void DoLoadCookies(); void DoLoadCookies();
void CheckCookiePolicyAndLoad(const net::CookieList& cookie_list); void CheckCookiePolicyAndLoad(const net::CookieList& cookie_list);
void OnCookiesLoaded(const std::string& cookie_line); void OnCookiesLoaded(const net::CookieList& cookie_list);
void DoStartTransaction(); void DoStartTransaction();
void StartTransaction(); void StartTransaction();

View File

@@ -35,7 +35,7 @@ void InstallInternalProtectedHandlers(
url::kFileScheme, url::kFileScheme,
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>( linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
new net::FileProtocolHandler(base::CreateTaskRunnerWithTraits( new net::FileProtocolHandler(base::CreateTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::BACKGROUND, {base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}))))); base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN})))));
#if !BUILDFLAG(DISABLE_FTP_SUPPORT) #if !BUILDFLAG(DISABLE_FTP_SUPPORT)
protocol_handlers->insert(std::make_pair( protocol_handlers->insert(std::make_pair(

View File

@@ -8,6 +8,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/cookie_manager_impl.h" #include "libcef/browser/cookie_manager_impl.h"
#include "libcef/browser/net/network_delegate.h" #include "libcef/browser/net/network_delegate.h"
#include "libcef/browser/net/scheme_handler.h" #include "libcef/browser/net/scheme_handler.h"
@@ -25,14 +26,12 @@
#include "base/threading/thread_restrictions.h" #include "base/threading/thread_restrictions.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/net_log/chrome_net_log.h" #include "components/net_log/chrome_net_log.h"
#include "components/network_session_configurator/browser/network_session_configurator.h" #include "components/network_session_configurator/browser/network_session_configurator.h"
#include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "content/network/proxy_service_mojo.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/common/content_client.h" #include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
@@ -52,9 +51,9 @@
#include "net/http/http_server_properties_impl.h" #include "net/http/http_server_properties_impl.h"
#include "net/http/http_util.h" #include "net/http/http_util.h"
#include "net/http/transport_security_state.h" #include "net/http/transport_security_state.h"
#include "net/proxy/dhcp_proxy_script_fetcher_factory.h" #include "net/proxy_resolution/dhcp_pac_file_fetcher_factory.h"
#include "net/proxy/proxy_script_fetcher_impl.h" #include "net/proxy_resolution/pac_file_fetcher_impl.h"
#include "net/proxy/proxy_service.h" #include "net/proxy_resolution/proxy_service.h"
#include "net/ssl/ssl_config_service_defaults.h" #include "net/ssl/ssl_config_service_defaults.h"
#include "net/url_request/http_user_agent_settings.h" #include "net/url_request/http_user_agent_settings.h"
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
@@ -63,6 +62,7 @@
#include "net/url_request/url_request_intercepting_job_factory.h" #include "net/url_request/url_request_intercepting_job_factory.h"
#include "net/url_request/url_request_job_factory_impl.h" #include "net/url_request/url_request_job_factory_impl.h"
#include "net/url_request/url_request_job_manager.h" #include "net/url_request/url_request_job_manager.h"
#include "services/network/proxy_service_mojo.h"
#include "url/url_constants.h" #include "url/url_constants.h"
#if defined(OS_WIN) #if defined(OS_WIN)
@@ -109,12 +109,13 @@ class CefHttpUserAgentSettings : public net::HttpUserAgentSettings {
DISALLOW_COPY_AND_ASSIGN(CefHttpUserAgentSettings); DISALLOW_COPY_AND_ASSIGN(CefHttpUserAgentSettings);
}; };
// Based on ProxyServiceFactory::CreateProxyService which was deleted in // Based on ProxyResolutionServiceFactory::CreateProxyResolutionService which
// http://crrev.com/1c261ff4. // was deleted in http://crrev.com/1c261ff4.
std::unique_ptr<net::ProxyService> CreateProxyService( std::unique_ptr<net::ProxyResolutionService> CreateProxyResolutionService(
net::NetLog* net_log, net::NetLog* net_log,
net::URLRequestContext* context, net::URLRequestContext* context,
net::NetworkDelegate* network_delegate, net::NetworkDelegate* network_delegate,
proxy_resolver::mojom::ProxyResolverFactoryPtr proxy_resolver_factory,
std::unique_ptr<net::ProxyConfigService> proxy_config_service, std::unique_ptr<net::ProxyConfigService> proxy_config_service,
const base::CommandLine& command_line, const base::CommandLine& command_line,
bool quick_check_enabled, bool quick_check_enabled,
@@ -129,28 +130,27 @@ std::unique_ptr<net::ProxyService> CreateProxyService(
use_v8 = false; // Fallback to non-v8 implementation. use_v8 = false; // Fallback to non-v8 implementation.
} }
std::unique_ptr<net::ProxyService> proxy_service; std::unique_ptr<net::ProxyResolutionService> proxy_service;
if (use_v8) { if (use_v8) {
std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher; std::unique_ptr<net::DhcpProxyScriptFetcher> dhcp_proxy_script_fetcher;
net::DhcpProxyScriptFetcherFactory dhcp_factory; net::DhcpProxyScriptFetcherFactory dhcp_factory;
dhcp_proxy_script_fetcher = dhcp_factory.Create(context); dhcp_proxy_script_fetcher = dhcp_factory.Create(context);
proxy_service = content::CreateProxyServiceUsingMojoFactory( proxy_service = network::CreateProxyServiceUsingMojoFactory(
ChromeMojoProxyResolverFactory::GetInstance(), std::move(proxy_resolver_factory), std::move(proxy_config_service),
std::move(proxy_config_service), std::make_unique<net::ProxyScriptFetcherImpl>(context),
new net::ProxyScriptFetcherImpl(context),
std::move(dhcp_proxy_script_fetcher), context->host_resolver(), net_log, std::move(dhcp_proxy_script_fetcher), context->host_resolver(), net_log,
network_delegate); network_delegate);
} else { } else {
proxy_service = net::ProxyService::CreateUsingSystemProxyResolver( proxy_service = net::ProxyResolutionService::CreateUsingSystemProxyResolver(
std::move(proxy_config_service), net_log); std::move(proxy_config_service), net_log);
} }
proxy_service->set_quick_check_enabled(quick_check_enabled); proxy_service->set_quick_check_enabled(quick_check_enabled);
proxy_service->set_sanitize_url_policy( proxy_service->set_sanitize_url_policy(
pac_https_url_stripping_enabled pac_https_url_stripping_enabled
? net::ProxyService::SanitizeUrlPolicy::SAFE ? net::ProxyResolutionService::SanitizeUrlPolicy::SAFE
: net::ProxyService::SanitizeUrlPolicy::UNSAFE); : net::ProxyResolutionService::SanitizeUrlPolicy::UNSAFE);
return proxy_service; return proxy_service;
} }
@@ -164,13 +164,15 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
content::ProtocolHandlerMap* protocol_handlers, content::ProtocolHandlerMap* protocol_handlers,
std::unique_ptr<net::ProxyConfigService> proxy_config_service, std::unique_ptr<net::ProxyConfigService> proxy_config_service,
content::URLRequestInterceptorScopedVector request_interceptors) content::URLRequestInterceptorScopedVector request_interceptors)
: settings_(settings), io_state_(base::MakeUnique<IOState>()) { : settings_(settings), io_state_(std::make_unique<IOState>()) {
// Must first be created on the UI thread. // Must first be created on the UI thread.
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
io_state_->net_log_ = g_browser_process->net_log(), io_state_->net_log_ = g_browser_process->net_log(),
DCHECK(io_state_->net_log_); DCHECK(io_state_->net_log_);
io_state_->io_task_runner_ = std::move(io_task_runner); io_state_->io_task_runner_ = std::move(io_task_runner);
io_state_->proxy_resolver_factory_ =
ChromeMojoProxyResolverFactory::CreateWithStrongBinding();
io_state_->proxy_config_service_ = std::move(proxy_config_service); io_state_->proxy_config_service_ = std::move(proxy_config_service);
io_state_->request_interceptors_ = std::move(request_interceptors); io_state_->request_interceptors_ = std::move(request_interceptors);
@@ -245,9 +247,9 @@ void CefURLRequestContextGetterImpl::ShutdownOnIOThread() {
shutting_down_ = true; shutting_down_ = true;
// Delete the ProxyService object here so that any pending requests will be // Delete the ProxyResolutionService object here so that any pending requests
// canceled before the URLRequestContext is destroyed. // will be canceled before the URLRequestContext is destroyed.
io_state_->storage_->set_proxy_service(NULL); io_state_->storage_->set_proxy_resolution_service(NULL);
io_state_.reset(); io_state_.reset();
@@ -314,14 +316,16 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
settings_.enable_net_security_expiration ? true : false); settings_.enable_net_security_expiration ? true : false);
io_state_->storage_->set_ct_policy_enforcer(std::move(ct_policy_enforcer)); io_state_->storage_->set_ct_policy_enforcer(std::move(ct_policy_enforcer));
std::unique_ptr<net::ProxyService> system_proxy_service = std::unique_ptr<net::ProxyResolutionService> system_proxy_service =
CreateProxyService(io_state_->net_log_, CreateProxyResolutionService(
io_state_->url_request_context_.get(), io_state_->net_log_, io_state_->url_request_context_.get(),
io_state_->url_request_context_->network_delegate(), io_state_->url_request_context_->network_delegate(),
std::move(io_state_->proxy_config_service_), std::move(io_state_->proxy_resolver_factory_),
*command_line, quick_check_enabled_.GetValue(), std::move(io_state_->proxy_config_service_), *command_line,
pac_https_url_stripping_enabled_.GetValue()); quick_check_enabled_.GetValue(),
io_state_->storage_->set_proxy_service(std::move(system_proxy_service)); pac_https_url_stripping_enabled_.GetValue());
io_state_->storage_->set_proxy_resolution_service(
std::move(system_proxy_service));
io_state_->storage_->set_ssl_config_service( io_state_->storage_->set_ssl_config_service(
new net::SSLConfigServiceDefaults); new net::SSLConfigServiceDefaults);
@@ -370,8 +374,8 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
io_state_->url_request_context_->cert_transparency_verifier(); io_state_->url_request_context_->cert_transparency_verifier();
network_session_context.ct_policy_enforcer = network_session_context.ct_policy_enforcer =
io_state_->url_request_context_->ct_policy_enforcer(); io_state_->url_request_context_->ct_policy_enforcer();
network_session_context.proxy_service = network_session_context.proxy_resolution_service =
io_state_->url_request_context_->proxy_service(); io_state_->url_request_context_->proxy_resolution_service();
network_session_context.ssl_config_service = network_session_context.ssl_config_service =
io_state_->url_request_context_->ssl_config_service(); io_state_->url_request_context_->ssl_config_service();
network_session_context.http_auth_handler_factory = network_session_context.http_auth_handler_factory =
@@ -412,7 +416,7 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
scheme::RegisterInternalHandlers(io_state_->url_request_manager_.get()); scheme::RegisterInternalHandlers(io_state_->url_request_manager_.get());
io_state_->request_interceptors_.push_back( io_state_->request_interceptors_.push_back(
base::MakeUnique<CefRequestInterceptor>()); std::make_unique<CefRequestInterceptor>());
// Set up interceptors in the reverse order. // Set up interceptors in the reverse order.
std::unique_ptr<net::URLRequestJobFactory> top_job_factory = std::unique_ptr<net::URLRequestJobFactory> top_job_factory =
@@ -470,7 +474,10 @@ void CefURLRequestContextGetterImpl::SetCookieStoragePath(
const base::FilePath& cookie_path = path.AppendASCII("Cookies"); const base::FilePath& cookie_path = path.AppendASCII("Cookies");
persistent_store = new net::SQLitePersistentCookieStore( persistent_store = new net::SQLitePersistentCookieStore(
cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
BrowserThread::GetTaskRunnerForThread(BrowserThread::DB), // 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); persist_session_cookies, NULL);
} else { } else {
NOTREACHED() << "The cookie storage directory could not be created"; NOTREACHED() << "The cookie storage directory could not be created";
@@ -526,21 +533,12 @@ net::CookieStore* CefURLRequestContextGetterImpl::GetExistingCookieStore()
return nullptr; return nullptr;
} }
void CefURLRequestContextGetterImpl::CreateProxyConfigService() {
if (io_state_->proxy_config_service_.get())
return;
io_state_->proxy_config_service_ =
net::ProxyService::CreateSystemProxyConfigService(
io_state_->io_task_runner_);
}
void CefURLRequestContextGetterImpl::UpdateServerWhitelist() { void CefURLRequestContextGetterImpl::UpdateServerWhitelist() {
io_state_->http_auth_preferences_->set_server_whitelist( io_state_->http_auth_preferences_->SetServerWhitelist(
auth_server_whitelist_.GetValue()); auth_server_whitelist_.GetValue());
} }
void CefURLRequestContextGetterImpl::UpdateDelegateWhitelist() { void CefURLRequestContextGetterImpl::UpdateDelegateWhitelist() {
io_state_->http_auth_preferences_->set_delegate_whitelist( io_state_->http_auth_preferences_->SetDelegateWhitelist(
auth_negotiate_delegate_whitelist_.GetValue()); auth_negotiate_delegate_whitelist_.GetValue());
} }

View File

@@ -17,6 +17,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h"
#include "components/prefs/pref_member.h" #include "components/prefs/pref_member.h"
#include "content/public/browser/browser_context.h" #include "content/public/browser/browser_context.h"
#include "net/url_request/url_request_job_factory.h" #include "net/url_request/url_request_job_factory.h"
@@ -84,7 +85,6 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
} }
private: private:
void CreateProxyConfigService();
void UpdateServerWhitelist(); void UpdateServerWhitelist();
void UpdateDelegateWhitelist(); void UpdateDelegateWhitelist();
@@ -117,6 +117,8 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
std::vector<std::string> cookie_supported_schemes_; std::vector<std::string> cookie_supported_schemes_;
std::vector<CefRefPtr<CefRequestContextHandler>> handler_list_; std::vector<CefRefPtr<CefRequestContextHandler>> handler_list_;
proxy_resolver::mojom::ProxyResolverFactoryPtr proxy_resolver_factory_;
}; };
std::unique_ptr<IOState> io_state_; std::unique_ptr<IOState> io_state_;

View File

@@ -28,7 +28,7 @@ CefURLRequestContextProxy::CefURLRequestContextProxy(
set_cert_transparency_verifier(parent->cert_transparency_verifier()); set_cert_transparency_verifier(parent->cert_transparency_verifier());
set_ct_policy_enforcer(parent->ct_policy_enforcer()); set_ct_policy_enforcer(parent->ct_policy_enforcer());
set_channel_id_service(parent->channel_id_service()); set_channel_id_service(parent->channel_id_service());
set_proxy_service(parent->proxy_service()); set_proxy_resolution_service(parent->proxy_resolution_service());
set_ssl_config_service(parent->ssl_config_service()); set_ssl_config_service(parent->ssl_config_service());
set_http_auth_handler_factory(parent->http_auth_handler_factory()); set_http_auth_handler_factory(parent->http_auth_handler_factory());
set_http_transaction_factory(parent->http_transaction_factory()); set_http_transaction_factory(parent->http_transaction_factory());

View File

@@ -275,12 +275,12 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
DragTargetDragLeave(); DragTargetDragLeave();
const gfx::Point client_pt(event.x, event.y); const gfx::Point client_pt(event.x, event.y);
gfx::Point transformed_pt; gfx::PointF transformed_pt;
current_rwh_for_drag_ = current_rwh_for_drag_ =
web_contents->GetInputEventRouter() web_contents->GetInputEventRouter()
->GetRenderWidgetHostAtPoint( ->GetRenderWidgetHostAtPoint(
web_contents->GetRenderViewHost()->GetWidget()->GetView(), web_contents->GetRenderViewHost()->GetWidget()->GetView(),
client_pt, &transformed_pt) gfx::PointF(client_pt), &transformed_pt)
->GetWeakPtr(); ->GetWeakPtr();
current_rvh_for_drag_ = web_contents->GetRenderViewHost(); current_rvh_for_drag_ = web_contents->GetRenderViewHost();
@@ -304,8 +304,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
return; return;
} }
current_rwh_for_drag_->DragTargetDragEnter(*drop_data, transformed_pt, current_rwh_for_drag_->DragTargetDragEnter(
screen_pt, ops, modifiers); *drop_data, transformed_pt, gfx::PointF(screen_pt), ops, modifiers);
} }
void CefBrowserPlatformDelegateOsr::DragTargetDragOver( void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
@@ -322,27 +322,27 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
const gfx::Point client_pt(event.x, event.y); const gfx::Point client_pt(event.x, event.y);
const gfx::Point& screen_pt = GetScreenPoint(client_pt); const gfx::Point& screen_pt = GetScreenPoint(client_pt);
gfx::Point transformed_pt; gfx::PointF transformed_pt;
content::RenderWidgetHostImpl* target_rwh = content::RenderWidgetHostImpl* target_rwh =
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint( web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
web_contents->GetRenderViewHost()->GetWidget()->GetView(), client_pt, web_contents->GetRenderViewHost()->GetWidget()->GetView(),
&transformed_pt); gfx::PointF(client_pt), &transformed_pt);
if (target_rwh != current_rwh_for_drag_.get()) { if (target_rwh != current_rwh_for_drag_.get()) {
if (current_rwh_for_drag_) { if (current_rwh_for_drag_) {
gfx::Point transformed_leave_point = client_pt; gfx::PointF transformed_leave_point(client_pt);
gfx::Point transformed_screen_point = screen_pt; gfx::PointF transformed_screen_point(screen_pt);
static_cast<content::RenderWidgetHostViewBase*>( static_cast<content::RenderWidgetHostViewBase*>(
web_contents->GetRenderWidgetHostView()) web_contents->GetRenderWidgetHostView())
->TransformPointToCoordSpaceForView( ->TransformPointToCoordSpaceForView(
client_pt, gfx::PointF(client_pt),
static_cast<content::RenderWidgetHostViewBase*>( static_cast<content::RenderWidgetHostViewBase*>(
current_rwh_for_drag_->GetView()), current_rwh_for_drag_->GetView()),
&transformed_leave_point); &transformed_leave_point);
static_cast<content::RenderWidgetHostViewBase*>( static_cast<content::RenderWidgetHostViewBase*>(
web_contents->GetRenderWidgetHostView()) web_contents->GetRenderWidgetHostView())
->TransformPointToCoordSpaceForView( ->TransformPointToCoordSpaceForView(
screen_pt, gfx::PointF(screen_pt),
static_cast<content::RenderWidgetHostViewBase*>( static_cast<content::RenderWidgetHostViewBase*>(
current_rwh_for_drag_->GetView()), current_rwh_for_drag_->GetView()),
&transformed_screen_point); &transformed_screen_point);
@@ -359,7 +359,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
static_cast<blink::WebDragOperationsMask>(allowed_ops); static_cast<blink::WebDragOperationsMask>(allowed_ops);
int modifiers = TranslateModifiers(event.modifiers); int modifiers = TranslateModifiers(event.modifiers);
target_rwh->DragTargetDragOver(transformed_pt, screen_pt, ops, modifiers); target_rwh->DragTargetDragOver(transformed_pt, gfx::PointF(screen_pt), ops,
modifiers);
} }
void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() { void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
@@ -369,7 +370,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
} }
if (current_rwh_for_drag_) { if (current_rwh_for_drag_) {
current_rwh_for_drag_->DragTargetDragLeave(gfx::Point(), gfx::Point()); current_rwh_for_drag_->DragTargetDragLeave(gfx::PointF(), gfx::PointF());
current_rwh_for_drag_.reset(); current_rwh_for_drag_.reset();
} }
@@ -388,27 +389,27 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
gfx::Point client_pt(event.x, event.y); gfx::Point client_pt(event.x, event.y);
const gfx::Point& screen_pt = GetScreenPoint(client_pt); const gfx::Point& screen_pt = GetScreenPoint(client_pt);
gfx::Point transformed_pt; gfx::PointF transformed_pt;
content::RenderWidgetHostImpl* target_rwh = content::RenderWidgetHostImpl* target_rwh =
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint( web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
web_contents->GetRenderViewHost()->GetWidget()->GetView(), client_pt, web_contents->GetRenderViewHost()->GetWidget()->GetView(),
&transformed_pt); gfx::PointF(client_pt), &transformed_pt);
if (target_rwh != current_rwh_for_drag_.get()) { if (target_rwh != current_rwh_for_drag_.get()) {
if (current_rwh_for_drag_) { if (current_rwh_for_drag_) {
gfx::Point transformed_leave_point = client_pt; gfx::PointF transformed_leave_point(client_pt);
gfx::Point transformed_screen_point = screen_pt; gfx::PointF transformed_screen_point(screen_pt);
static_cast<content::RenderWidgetHostViewBase*>( static_cast<content::RenderWidgetHostViewBase*>(
web_contents->GetRenderWidgetHostView()) web_contents->GetRenderWidgetHostView())
->TransformPointToCoordSpaceForView( ->TransformPointToCoordSpaceForView(
client_pt, gfx::PointF(client_pt),
static_cast<content::RenderWidgetHostViewBase*>( static_cast<content::RenderWidgetHostViewBase*>(
current_rwh_for_drag_->GetView()), current_rwh_for_drag_->GetView()),
&transformed_leave_point); &transformed_leave_point);
static_cast<content::RenderWidgetHostViewBase*>( static_cast<content::RenderWidgetHostViewBase*>(
web_contents->GetRenderWidgetHostView()) web_contents->GetRenderWidgetHostView())
->TransformPointToCoordSpaceForView( ->TransformPointToCoordSpaceForView(
screen_pt, gfx::PointF(screen_pt),
static_cast<content::RenderWidgetHostViewBase*>( static_cast<content::RenderWidgetHostViewBase*>(
current_rwh_for_drag_->GetView()), current_rwh_for_drag_->GetView()),
&transformed_screen_point); &transformed_screen_point);
@@ -428,8 +429,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
content::DropData* drop_data = data_impl->drop_data(); content::DropData* drop_data = data_impl->drop_data();
int modifiers = TranslateModifiers(event.modifiers); int modifiers = TranslateModifiers(event.modifiers);
target_rwh->DragTargetDrop(*drop_data, transformed_pt, screen_pt, target_rwh->DragTargetDrop(*drop_data, transformed_pt,
modifiers); gfx::PointF(screen_pt), modifiers);
} }
drag_data_ = nullptr; drag_data_ = nullptr;
@@ -495,20 +496,20 @@ void CefBrowserPlatformDelegateOsr::DragSourceEndedAt(
// |client_loc| and |screen_loc| are in the root coordinate space, for // |client_loc| and |screen_loc| are in the root coordinate space, for
// non-root RenderWidgetHosts they need to be transformed. // non-root RenderWidgetHosts they need to be transformed.
gfx::Point transformed_point = client_loc; gfx::PointF transformed_point(client_loc);
gfx::Point transformed_screen_point = screen_loc; gfx::PointF transformed_screen_point(screen_loc);
if (source_rwh && web_contents->GetRenderWidgetHostView()) { if (source_rwh && web_contents->GetRenderWidgetHostView()) {
static_cast<content::RenderWidgetHostViewBase*>( static_cast<content::RenderWidgetHostViewBase*>(
web_contents->GetRenderWidgetHostView()) web_contents->GetRenderWidgetHostView())
->TransformPointToCoordSpaceForView( ->TransformPointToCoordSpaceForView(
client_loc, gfx::PointF(client_loc),
static_cast<content::RenderWidgetHostViewBase*>( static_cast<content::RenderWidgetHostViewBase*>(
source_rwh->GetView()), source_rwh->GetView()),
&transformed_point); &transformed_point);
static_cast<content::RenderWidgetHostViewBase*>( static_cast<content::RenderWidgetHostViewBase*>(
web_contents->GetRenderWidgetHostView()) web_contents->GetRenderWidgetHostView())
->TransformPointToCoordSpaceForView( ->TransformPointToCoordSpaceForView(
screen_loc, gfx::PointF(screen_loc),
static_cast<content::RenderWidgetHostViewBase*>( static_cast<content::RenderWidgetHostViewBase*>(
source_rwh->GetView()), source_rwh->GetView()),
&transformed_screen_point); &transformed_screen_point);

View File

@@ -12,7 +12,8 @@
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "content/public/browser/ax_event_notification_details.h" #include "content/public/browser/ax_event_notification_details.h"
#include "ui/accessibility/ax_enums.h" #include "ui/accessibility/ax_enum_util.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_text_utils.h" #include "ui/accessibility/ax_text_utils.h"
#include "ui/accessibility/ax_tree_update.h" #include "ui/accessibility/ax_tree_update.h"
#include "ui/gfx/transform.h" #include "ui/gfx/transform.h"
@@ -39,9 +40,10 @@ CefRefPtr<CefListValue> ToCefValue(uint32_t state) {
int index = 0; int index = 0;
// Iterate and find which states are set. // Iterate and find which states are set.
for (unsigned i = ui::AX_STATE_NONE; i <= ui::AX_STATE_LAST; i++) { for (unsigned i = static_cast<unsigned>(ax::mojom::Role::kNone);
i <= static_cast<unsigned>(ax::mojom::Role::kLast); i++) {
if (state & (1 << i)) if (state & (1 << i))
value->SetString(index++, ToString(static_cast<ui::AXState>(i))); value->SetString(index++, ToString(static_cast<ax::mojom::State>(i)));
} }
return value; return value;
} }
@@ -65,125 +67,124 @@ struct PopulateAxNodeAttributes {
: attributes(attrs) {} : attributes(attrs) {}
// Int Attributes // Int Attributes
void operator()(const std::pair<ui::AXIntAttribute, int32_t> attr) { void operator()(const std::pair<ax::mojom::IntAttribute, int32_t> attr) {
if (attr.first == ui::AX_INT_ATTRIBUTE_NONE) if (attr.first == ax::mojom::IntAttribute::kNone)
return; return;
switch (attr.first) { switch (attr.first) {
case ui::AX_INT_ATTRIBUTE_NONE: case ax::mojom::IntAttribute::kNone:
break; break;
case ui::AX_ATTR_SCROLL_X: case ax::mojom::IntAttribute::kScrollX:
case ui::AX_ATTR_SCROLL_X_MIN: case ax::mojom::IntAttribute::kScrollXMin:
case ui::AX_ATTR_SCROLL_X_MAX: case ax::mojom::IntAttribute::kScrollXMax:
case ui::AX_ATTR_SCROLL_Y: case ax::mojom::IntAttribute::kScrollY:
case ui::AX_ATTR_SCROLL_Y_MIN: case ax::mojom::IntAttribute::kScrollYMin:
case ui::AX_ATTR_SCROLL_Y_MAX: case ax::mojom::IntAttribute::kScrollYMax:
case ui::AX_ATTR_HIERARCHICAL_LEVEL: case ax::mojom::IntAttribute::kHierarchicalLevel:
case ui::AX_ATTR_TEXT_SEL_START: case ax::mojom::IntAttribute::kTextSelStart:
case ui::AX_ATTR_TEXT_SEL_END: case ax::mojom::IntAttribute::kTextSelEnd:
case ui::AX_ATTR_ARIA_COLUMN_COUNT: case ax::mojom::IntAttribute::kAriaColumnCount:
case ui::AX_ATTR_ARIA_CELL_COLUMN_INDEX: case ax::mojom::IntAttribute::kAriaCellColumnIndex:
case ui::AX_ATTR_ARIA_ROW_COUNT: case ax::mojom::IntAttribute::kAriaRowCount:
case ui::AX_ATTR_ARIA_CELL_ROW_INDEX: case ax::mojom::IntAttribute::kAriaCellRowIndex:
case ui::AX_ATTR_TABLE_ROW_COUNT: case ax::mojom::IntAttribute::kTableRowCount:
case ui::AX_ATTR_TABLE_COLUMN_COUNT: case ax::mojom::IntAttribute::kTableColumnCount:
case ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX: case ax::mojom::IntAttribute::kTableCellColumnIndex:
case ui::AX_ATTR_TABLE_CELL_ROW_INDEX: case ax::mojom::IntAttribute::kTableCellRowIndex:
case ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN: case ax::mojom::IntAttribute::kTableCellColumnSpan:
case ui::AX_ATTR_TABLE_CELL_ROW_SPAN: case ax::mojom::IntAttribute::kTableCellRowSpan:
case ui::AX_ATTR_TABLE_COLUMN_HEADER_ID: case ax::mojom::IntAttribute::kTableColumnHeaderId:
case ui::AX_ATTR_TABLE_COLUMN_INDEX: case ax::mojom::IntAttribute::kTableColumnIndex:
case ui::AX_ATTR_TABLE_HEADER_ID: case ax::mojom::IntAttribute::kTableHeaderId:
case ui::AX_ATTR_TABLE_ROW_HEADER_ID: case ax::mojom::IntAttribute::kTableRowHeaderId:
case ui::AX_ATTR_TABLE_ROW_INDEX: case ax::mojom::IntAttribute::kTableRowIndex:
case ui::AX_ATTR_ACTIVEDESCENDANT_ID: case ax::mojom::IntAttribute::kActivedescendantId:
case ui::AX_ATTR_IN_PAGE_LINK_TARGET_ID: case ax::mojom::IntAttribute::kInPageLinkTargetId:
case ui::AX_ATTR_ERRORMESSAGE_ID: case ax::mojom::IntAttribute::kErrormessageId:
case ui::AX_ATTR_DETAILS_ID: case ax::mojom::IntAttribute::kDetailsId:
case ui::AX_ATTR_MEMBER_OF_ID: case ax::mojom::IntAttribute::kMemberOfId:
case ui::AX_ATTR_NEXT_ON_LINE_ID: case ax::mojom::IntAttribute::kNextFocusId:
case ui::AX_ATTR_PREVIOUS_ON_LINE_ID: case ax::mojom::IntAttribute::kNextOnLineId:
case ui::AX_ATTR_CHILD_TREE_ID: case ax::mojom::IntAttribute::kPreviousFocusId:
case ui::AX_ATTR_SET_SIZE: case ax::mojom::IntAttribute::kPreviousOnLineId:
case ui::AX_ATTR_POS_IN_SET: case ax::mojom::IntAttribute::kChildTreeId:
case ax::mojom::IntAttribute::kSetSize:
case ax::mojom::IntAttribute::kPosInSet:
attributes->SetInt(ToString(attr.first), attr.second); attributes->SetInt(ToString(attr.first), attr.second);
break; break;
case ui::AX_ATTR_DEFAULT_ACTION_VERB: case ax::mojom::IntAttribute::kDefaultActionVerb:
attributes->SetString( attributes->SetString(
ToString(attr.first), ToString(attr.first),
ui::ActionVerbToUnlocalizedString( ui::ActionVerbToUnlocalizedString(
static_cast<ui::AXDefaultActionVerb>(attr.second))); static_cast<ax::mojom::DefaultActionVerb>(attr.second)));
break; break;
case ui::AX_ATTR_INVALID_STATE: case ax::mojom::IntAttribute::kInvalidState: {
if (ui::AX_INVALID_STATE_NONE != attr.second) { auto state = static_cast<ax::mojom::InvalidState>(attr.second);
attributes->SetString( if (ax::mojom::InvalidState::kNone != state) {
ToString(attr.first), attributes->SetString(ToString(attr.first), ToString(state));
ToString(static_cast<ui::AXInvalidState>(attr.second)));
} }
break; } break;
case ui::AX_ATTR_CHECKED_STATE: case ax::mojom::IntAttribute::kCheckedState: {
if (ui::AX_CHECKED_STATE_NONE != attr.second) { auto state = static_cast<ax::mojom::CheckedState>(attr.second);
attributes->SetString( if (ax::mojom::CheckedState::kNone != state) {
ToString(attr.first), attributes->SetString(ToString(attr.first), ToString(state));
ToString(static_cast<ui::AXCheckedState>(attr.second)));
} }
break; } break;
case ui::AX_ATTR_RESTRICTION: case ax::mojom::IntAttribute::kRestriction:
attributes->SetString( attributes->SetString(
ToString(attr.first), ToString(attr.first),
ToString(static_cast<ui::AXRestriction>(attr.second))); ToString(static_cast<ax::mojom::Restriction>(attr.second)));
break; break;
case ui::AX_ATTR_SORT_DIRECTION: case ax::mojom::IntAttribute::kSortDirection: {
if (ui::AX_SORT_DIRECTION_NONE != attr.second) { auto state = static_cast<ax::mojom::SortDirection>(attr.second);
attributes->SetString( if (ax::mojom::SortDirection::kNone != state) {
ToString(attr.first), attributes->SetString(ToString(attr.first), ToString(state));
ToString(static_cast<ui::AXSortDirection>(attr.second)));
} }
break; } break;
case ui::AX_ATTR_NAME_FROM: case ax::mojom::IntAttribute::kNameFrom:
attributes->SetString( attributes->SetString(
ToString(attr.first), ToString(attr.first),
ToString(static_cast<ui::AXNameFrom>(attr.second))); ToString(static_cast<ax::mojom::NameFrom>(attr.second)));
break; break;
case ui::AX_ATTR_COLOR_VALUE: case ax::mojom::IntAttribute::kColorValue:
case ui::AX_ATTR_BACKGROUND_COLOR: case ax::mojom::IntAttribute::kBackgroundColor:
case ui::AX_ATTR_COLOR: case ax::mojom::IntAttribute::kColor:
attributes->SetString(ToString(attr.first), attributes->SetString(ToString(attr.first),
base::StringPrintf("0x%X", attr.second)); base::StringPrintf("0x%X", attr.second));
break; break;
case ui::AX_ATTR_DESCRIPTION_FROM: case ax::mojom::IntAttribute::kDescriptionFrom:
attributes->SetString( attributes->SetString(
ToString(attr.first), ToString(attr.first),
ToString(static_cast<ui::AXDescriptionFrom>(attr.second))); ToString(static_cast<ax::mojom::DescriptionFrom>(attr.second)));
break; break;
case ui::AX_ATTR_ARIA_CURRENT_STATE: case ax::mojom::IntAttribute::kAriaCurrentState: {
if (ui::AX_ARIA_CURRENT_STATE_NONE != attr.second) { auto state = static_cast<ax::mojom::AriaCurrentState>(attr.second);
attributes->SetString( if (ax::mojom::AriaCurrentState::kNone != state) {
ToString(attr.first), attributes->SetString(ToString(attr.first), ToString(state));
ToString(static_cast<ui::AXAriaCurrentState>(attr.second)));
} }
break; } break;
case ui::AX_ATTR_TEXT_DIRECTION: case ax::mojom::IntAttribute::kTextDirection: {
if (ui::AX_TEXT_DIRECTION_NONE != attr.second) { auto state = static_cast<ax::mojom::TextDirection>(attr.second);
attributes->SetString( if (ax::mojom::TextDirection::kNone != state) {
ToString(attr.first), attributes->SetString(ToString(attr.first), ToString(state));
ToString(static_cast<ui::AXTextDirection>(attr.second)));
} }
break; } break;
case ui::AX_ATTR_TEXT_STYLE: { case ax::mojom::IntAttribute::kTextStyle: {
auto text_style = static_cast<ui::AXTextStyle>(attr.second); auto text_style = static_cast<ax::mojom::TextStyle>(attr.second);
if (text_style == ui::AX_TEXT_STYLE_NONE) if (text_style == ax::mojom::TextStyle::kNone)
break; break;
static ui::AXTextStyle textStyleArr[] = { static ax::mojom::TextStyle textStyleArr[] = {
ui::AX_TEXT_STYLE_BOLD, ui::AX_TEXT_STYLE_ITALIC, ax::mojom::TextStyle::kTextStyleBold,
ui::AX_TEXT_STYLE_UNDERLINE, ui::AX_TEXT_STYLE_LINE_THROUGH}; ax::mojom::TextStyle::kTextStyleItalic,
ax::mojom::TextStyle::kTextStyleUnderline,
ax::mojom::TextStyle::kTextStyleLineThrough};
CefRefPtr<CefListValue> list = CefListValue::Create(); CefRefPtr<CefListValue> list = CefListValue::Create();
int index = 0; int index = 0;
// Iterate and find which states are set. // Iterate and find which states are set.
for (unsigned i = 0; i < arraysize(textStyleArr); i++) { for (unsigned i = 0; i < arraysize(textStyleArr); i++) {
if (text_style & textStyleArr[i]) if (attr.second & static_cast<int>(textStyleArr[i]))
list->SetString(index++, ToString(textStyleArr[i])); list->SetString(index++, ToString(textStyleArr[i]));
} }
attributes->SetList(ToString(attr.first), list); attributes->SetList(ToString(attr.first), list);
@@ -192,43 +193,44 @@ struct PopulateAxNodeAttributes {
} }
// Set Bool Attributes. // Set Bool Attributes.
void operator()(const std::pair<ui::AXBoolAttribute, bool> attr) { void operator()(const std::pair<ax::mojom::BoolAttribute, bool> attr) {
if (attr.first != ui::AX_BOOL_ATTRIBUTE_NONE) if (attr.first != ax::mojom::BoolAttribute::kNone)
attributes->SetBool(ToString(attr.first), attr.second); attributes->SetBool(ToString(attr.first), attr.second);
} }
// Set String Attributes. // Set String Attributes.
void operator()(const std::pair<ui::AXStringAttribute, std::string>& attr) { void operator()(
if (attr.first != ui::AX_STRING_ATTRIBUTE_NONE) const std::pair<ax::mojom::StringAttribute, std::string>& attr) {
if (attr.first != ax::mojom::StringAttribute::kNone)
attributes->SetString(ToString(attr.first), attr.second); attributes->SetString(ToString(attr.first), attr.second);
} }
// Set Float attributes. // Set Float attributes.
void operator()(const std::pair<ui::AXFloatAttribute, float>& attr) { void operator()(const std::pair<ax::mojom::FloatAttribute, float>& attr) {
if (attr.first != ui::AX_FLOAT_ATTRIBUTE_NONE) if (attr.first != ax::mojom::FloatAttribute::kNone)
attributes->SetDouble(ToString(attr.first), attr.second); attributes->SetDouble(ToString(attr.first), attr.second);
} }
// Set Int list attributes. // Set Int list attributes.
void operator()( void operator()(const std::pair<ax::mojom::IntListAttribute,
const std::pair<ui::AXIntListAttribute, std::vector<int32_t>>& attr) { std::vector<int32_t>>& attr) {
if (attr.first != ui::AX_INT_LIST_ATTRIBUTE_NONE) { if (attr.first != ax::mojom::IntListAttribute::kNone) {
CefRefPtr<CefListValue> list; CefRefPtr<CefListValue> list;
if (ui::AX_ATTR_MARKER_TYPES == attr.first) { if (ax::mojom::IntListAttribute::kMarkerTypes == attr.first) {
list = CefListValue::Create(); list = CefListValue::Create();
int index = 0; int index = 0;
for (size_t i = 0; i < attr.second.size(); ++i) { for (size_t i = 0; i < attr.second.size(); ++i) {
auto type = static_cast<ui::AXMarkerType>(attr.second[i]); auto type = static_cast<ax::mojom::MarkerType>(attr.second[i]);
if (type == ui::AX_MARKER_TYPE_NONE) if (type == ax::mojom::MarkerType::kNone)
continue; continue;
static ui::AXMarkerType marktypeArr[] = { static ax::mojom::MarkerType marktypeArr[] = {
ui::AX_MARKER_TYPE_SPELLING, ui::AX_MARKER_TYPE_GRAMMAR, ax::mojom::MarkerType::kSpelling, ax::mojom::MarkerType::kGrammar,
ui::AX_MARKER_TYPE_TEXT_MATCH}; ax::mojom::MarkerType::kTextMatch};
// Iterate and find which markers are set. // Iterate and find which markers are set.
for (unsigned j = 0; j < arraysize(marktypeArr); j++) { for (unsigned j = 0; j < arraysize(marktypeArr); j++) {
if (type & marktypeArr[j]) if (attr.second[i] & static_cast<int>(marktypeArr[j]))
list->SetString(index++, ToString(marktypeArr[j])); list->SetString(index++, ToString(marktypeArr[j]));
} }
} }
@@ -265,9 +267,10 @@ CefRefPtr<CefDictionaryValue> ToCefValue(const ui::AXNodeData& node) {
CefRefPtr<CefListValue> actions_strings; CefRefPtr<CefListValue> actions_strings;
size_t actions_idx = 0; size_t actions_idx = 0;
for (int action_index = ui::AX_ACTION_NONE + 1; for (int action_index = static_cast<int>(ax::mojom::Action::kNone) + 1;
action_index <= ui::AX_ACTION_LAST; ++action_index) { action_index <= static_cast<int>(ax::mojom::Action::kLast);
auto action = static_cast<ui::AXAction>(action_index); ++action_index) {
auto action = static_cast<ax::mojom::Action>(action_index);
if (node.HasAction(action)) { if (node.HasAction(action)) {
if (!actions_strings) if (!actions_strings)
actions_strings = CefListValue::Create(); actions_strings = CefListValue::Create();
@@ -381,10 +384,10 @@ CefRefPtr<CefDictionaryValue> ToCefValue(
if (eventData.ax_tree_id != -1) if (eventData.ax_tree_id != -1)
value->SetInt("ax_tree_id", eventData.ax_tree_id); value->SetInt("ax_tree_id", eventData.ax_tree_id);
if (eventData.event_type != ui::AX_EVENT_NONE) if (eventData.event_type != ax::mojom::Event::kNone)
value->SetString("event_type", ToString(eventData.event_type)); value->SetString("event_type", ToString(eventData.event_type));
if (eventData.event_from != ui::AX_EVENT_FROM_NONE) if (eventData.event_from != ax::mojom::EventFrom::kNone)
value->SetString("event_from", ToString(eventData.event_from)); value->SetString("event_from", ToString(eventData.event_from));
value->SetDictionary("update", ToCefValue(eventData.update)); value->SetDictionary("update", ToCefValue(eventData.update));

View File

@@ -17,24 +17,28 @@
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/strings/utf_string_conversions.h"
#include "cc/base/switches.h" #include "cc/base/switches.h"
#include "components/viz/common/features.h"
#include "components/viz/common/frame_sinks/copy_output_request.h" #include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/common/frame_sinks/delay_based_time_source.h" #include "components/viz/common/frame_sinks/delay_based_time_source.h"
#include "components/viz/common/gl_helper.h" #include "components/viz/common/gl_helper.h"
#include "components/viz/common/switches.h"
#include "content/browser/bad_message.h" #include "content/browser/bad_message.h"
#include "content/browser/compositor/image_transport_factory.h" #include "content/browser/compositor/image_transport_factory.h"
#include "content/browser/frame_host/render_widget_host_view_guest.h" #include "content/browser/frame_host/render_widget_host_view_guest.h"
#include "content/browser/renderer_host/dip_util.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_delegate.h"
#include "content/browser/renderer_host/render_widget_host_impl.h" #include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_frame_subscriber.h"
#include "content/common/input_messages.h" #include "content/common/input_messages.h"
#include "content/common/view_messages.h" #include "content/common/view_messages.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/context_factory.h" #include "content/public/browser/context_factory.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "media/base/video_frame.h" #include "media/base/video_frame.h"
#include "ui/compositor/compositor_vsync_manager.h"
#include "ui/gfx/geometry/dip_util.h" #include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/geometry/size_conversions.h"
@@ -90,7 +94,7 @@ class CefCopyFrameGenerator {
&CefCopyFrameGenerator::CopyFromCompositingSurfaceHasResult, &CefCopyFrameGenerator::CopyFromCompositingSurfaceHasResult,
weak_ptr_factory_.GetWeakPtr(), damage_rect)); weak_ptr_factory_.GetWeakPtr(), damage_rect));
request->set_area(gfx::Rect(view_->GetPhysicalBackingSize())); request->set_area(gfx::Rect(view_->GetCompositorViewportPixelSize()));
view_->GetRootLayer()->RequestCopyOfOutput(std::move(request)); view_->GetRootLayer()->RequestCopyOfOutput(std::move(request));
} }
@@ -235,10 +239,16 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
local_surface_id_ = local_surface_id_allocator_.GenerateId(); local_surface_id_ = local_surface_id_allocator_.GenerateId();
// Surface synchronization is not supported with OSR.
DCHECK(!features::IsSurfaceSynchronizationEnabled());
#if !defined(OS_MACOSX) #if !defined(OS_MACOSX)
delegated_frame_host_ = base::MakeUnique<content::DelegatedFrameHost>( // Matching the attributes from BrowserCompositorMac.
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
AllocateFrameSinkId(is_guest_view_hack), this, AllocateFrameSinkId(is_guest_view_hack), this,
false /* enable_surface_synchronization */); features::IsSurfaceSynchronizationEnabled(),
base::FeatureList::IsEnabled(features::kVizDisplayCompositor),
true /* should_register_frame_sink_id */);
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
#endif #endif
@@ -255,11 +265,12 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
content::ImageTransportFactory::GetInstance(); content::ImageTransportFactory::GetInstance();
ui::ContextFactoryPrivate* context_factory_private = ui::ContextFactoryPrivate* context_factory_private =
factory->GetContextFactoryPrivate(); factory->GetContextFactoryPrivate();
// Matching the attributes from RecyclableCompositorMac.
compositor_.reset( compositor_.reset(
new ui::Compositor(context_factory_private->AllocateFrameSinkId(), new ui::Compositor(context_factory_private->AllocateFrameSinkId(),
content::GetContextFactory(), context_factory_private, content::GetContextFactory(), context_factory_private,
base::ThreadTaskRunnerHandle::Get(), base::ThreadTaskRunnerHandle::Get(),
false /* enable_surface_synchronization */, features::IsSurfaceSynchronizationEnabled(),
false /* enable_pixel_canvas */)); false /* enable_pixel_canvas */));
compositor_->SetAcceleratedWidget(compositor_widget_); compositor_->SetAcceleratedWidget(compositor_widget_);
compositor_->SetDelegate(this); compositor_->SetDelegate(this);
@@ -321,11 +332,6 @@ void CefRenderWidgetHostViewOSR::InitAsChild(gfx::NativeView parent_view) {
Show(); Show();
} }
content::RenderWidgetHost* CefRenderWidgetHostViewOSR::GetRenderWidgetHost()
const {
return render_widget_host_;
}
void CefRenderWidgetHostViewOSR::SetSize(const gfx::Size& size) {} void CefRenderWidgetHostViewOSR::SetSize(const gfx::Size& size) {}
void CefRenderWidgetHostViewOSR::SetBounds(const gfx::Rect& rect) {} void CefRenderWidgetHostViewOSR::SetBounds(const gfx::Rect& rect) {}
@@ -363,9 +369,12 @@ void CefRenderWidgetHostViewOSR::Show() {
browser_compositor_->SetRenderWidgetHostIsHidden(false); browser_compositor_->SetRenderWidgetHostIsHidden(false);
#else #else
delegated_frame_host_->SetCompositor(compositor_.get()); delegated_frame_host_->SetCompositor(compositor_.get());
delegated_frame_host_->WasShown(ui::LatencyInfo()); delegated_frame_host_->WasShown(
GetLocalSurfaceId(), GetRootLayer()->bounds().size(), ui::LatencyInfo());
#endif #endif
// Note that |render_widget_host_| will retrieve size parameters from the
// DelegatedFrameHost, so it must have WasShown called after.
if (render_widget_host_) if (render_widget_host_)
render_widget_host_->WasShown(ui::LatencyInfo()); render_widget_host_->WasShown(ui::LatencyInfo());
} }
@@ -443,7 +452,8 @@ void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink(
void CefRenderWidgetHostViewOSR::SubmitCompositorFrame( void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
const viz::LocalSurfaceId& local_surface_id, const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame) { viz::CompositorFrame frame,
viz::mojom::HitTestRegionListPtr hit_test_region_list) {
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame"); TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame");
if (frame.metadata.root_scroll_offset != last_scroll_offset_) { if (frame.metadata.root_scroll_offset != last_scroll_offset_) {
@@ -472,8 +482,8 @@ void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
// We would normally call BrowserCompositorMac::SubmitCompositorFrame on // We would normally call BrowserCompositorMac::SubmitCompositorFrame on
// macOS, however it contains compositor resize logic that we don't want. // macOS, however it contains compositor resize logic that we don't want.
// Consequently we instead call the SwapDelegatedFrame method directly. // Consequently we instead call the SwapDelegatedFrame method directly.
GetDelegatedFrameHost()->SubmitCompositorFrame(local_surface_id, GetDelegatedFrameHost()->SubmitCompositorFrame(
std::move(frame)); local_surface_id, std::move(frame), std::move(hit_test_region_list));
} else { } else {
if (!copy_frame_generator_.get()) { if (!copy_frame_generator_.get()) {
copy_frame_generator_.reset( copy_frame_generator_.reset(
@@ -491,8 +501,8 @@ void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
// We would normally call BrowserCompositorMac::SubmitCompositorFrame on // We would normally call BrowserCompositorMac::SubmitCompositorFrame on
// macOS, however it contains compositor resize logic that we don't want. // macOS, however it contains compositor resize logic that we don't want.
// Consequently we instead call the SwapDelegatedFrame method directly. // Consequently we instead call the SwapDelegatedFrame method directly.
GetDelegatedFrameHost()->SubmitCompositorFrame(local_surface_id, GetDelegatedFrameHost()->SubmitCompositorFrame(
std::move(frame)); local_surface_id, std::move(frame), std::move(hit_test_region_list));
// Request a copy of the last compositor frame which will eventually call // Request a copy of the last compositor frame which will eventually call
// OnPaint asynchronously. // OnPaint asynchronously.
@@ -655,44 +665,55 @@ gfx::Size CefRenderWidgetHostViewOSR::GetRequestedRendererSize() const {
return GetDelegatedFrameHost()->GetRequestedRendererSize(); return GetDelegatedFrameHost()->GetRequestedRendererSize();
} }
gfx::Size CefRenderWidgetHostViewOSR::GetPhysicalBackingSize() const { gfx::Size CefRenderWidgetHostViewOSR::GetCompositorViewportPixelSize() const {
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(), return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
current_device_scale_factor_); current_device_scale_factor_);
} }
void CefRenderWidgetHostViewOSR::CopyFromSurface( void CefRenderWidgetHostViewOSR::CopyFromSurface(
const gfx::Rect& src_subrect, const gfx::Rect& src_rect,
const gfx::Size& dst_size, const gfx::Size& output_size,
const content::ReadbackRequestCallback& callback, base::OnceCallback<void(const SkBitmap&)> callback) {
const SkColorType color_type) { GetDelegatedFrameHost()->CopyFromCompositingSurface(src_rect, output_size,
GetDelegatedFrameHost()->CopyFromCompositingSurface(src_subrect, dst_size, std::move(callback));
callback, color_type);
} }
void CefRenderWidgetHostViewOSR::CopyFromSurfaceToVideoFrame( void CefRenderWidgetHostViewOSR::GetScreenInfo(
const gfx::Rect& src_subrect, content::ScreenInfo* results) const {
scoped_refptr<media::VideoFrame> target, if (!browser_impl_.get())
const base::Callback<void(const gfx::Rect&, bool)>& callback) { return;
GetDelegatedFrameHost()->CopyFromCompositingSurfaceToVideoFrame(
src_subrect, target, callback); CefScreenInfo screen_info(kDefaultScaleFactor, 0, 0, false, CefRect(),
CefRect());
CefRefPtr<CefRenderHandler> handler =
browser_impl_->client()->GetRenderHandler();
if (handler.get() &&
(!handler->GetScreenInfo(browser_impl_.get(), screen_info) ||
screen_info.rect.width == 0 || screen_info.rect.height == 0 ||
screen_info.available_rect.width == 0 ||
screen_info.available_rect.height == 0)) {
// If a screen rectangle was not provided, try using the view rectangle
// instead. Otherwise, popup views may be drawn incorrectly, or not at all.
CefRect screenRect;
if (!handler->GetViewRect(browser_impl_.get(), screenRect)) {
NOTREACHED();
screenRect = CefRect();
}
if (screen_info.rect.width == 0 && screen_info.rect.height == 0)
screen_info.rect = screenRect;
if (screen_info.available_rect.width == 0 &&
screen_info.available_rect.height == 0)
screen_info.available_rect = screenRect;
}
*results = ScreenInfoFrom(screen_info);
} }
void CefRenderWidgetHostViewOSR::BeginFrameSubscription( gfx::Vector2d CefRenderWidgetHostViewOSR::GetOffsetFromRootSurface() {
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber) { return gfx::Vector2d();
GetDelegatedFrameHost()->BeginFrameSubscription(std::move(subscriber));
}
void CefRenderWidgetHostViewOSR::EndFrameSubscription() {
GetDelegatedFrameHost()->EndFrameSubscription();
}
bool CefRenderWidgetHostViewOSR::HasAcceleratedSurface(
const gfx::Size& desired_size) {
// CEF doesn't use GetBackingStore for accelerated pages, so it doesn't
// matter what is returned here as GetBackingStore is the only caller of this
// method.
NOTREACHED();
return false;
} }
gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() { gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
@@ -707,6 +728,17 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
return GetViewBounds(); return GetViewBounds();
} }
content::RenderWidgetHostImpl*
CefRenderWidgetHostViewOSR::GetRenderWidgetHostImpl() const {
return render_widget_host_;
}
viz::SurfaceId CefRenderWidgetHostViewOSR::GetCurrentSurfaceId() const {
return GetDelegatedFrameHost()
? GetDelegatedFrameHost()->GetCurrentSurfaceId()
: viz::SurfaceId();
}
content::BrowserAccessibilityManager* content::BrowserAccessibilityManager*
CefRenderWidgetHostViewOSR::CreateBrowserAccessibilityManager( CefRenderWidgetHostViewOSR::CreateBrowserAccessibilityManager(
content::BrowserAccessibilityDelegate* delegate, content::BrowserAccessibilityDelegate* delegate,
@@ -783,6 +815,31 @@ void CefRenderWidgetHostViewOSR::ImeCancelComposition() {
RequestImeCompositionUpdate(false); RequestImeCompositionUpdate(false);
} }
void CefRenderWidgetHostViewOSR::SelectionChanged(const base::string16& text,
size_t offset,
const gfx::Range& range) {
RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
if (!browser_impl_.get())
return;
CefString selected_text;
if (!range.is_empty() && !text.empty()) {
size_t pos = range.GetMin() - offset;
size_t n = range.length();
if (pos + n <= text.length())
selected_text = text.substr(pos, n);
}
CefRefPtr<CefRenderHandler> handler =
browser_impl_->GetClient()->GetRenderHandler();
if (handler.get()) {
CefRange cef_range(range.start(), range.end());
handler->OnTextSelectionChanged(browser_impl_.get(), selected_text,
cef_range);
}
}
void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) { void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) {
SetFrameRate(); SetFrameRate();
@@ -796,43 +853,19 @@ void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) {
} }
} }
void CefRenderWidgetHostViewOSR::ProcessKeyboardEvent( void CefRenderWidgetHostViewOSR::SetWantsAnimateOnlyBeginFrames() {
const content::NativeWebKeyboardEvent& event, if (GetDelegatedFrameHost()) {
const ui::LatencyInfo& latency) { GetDelegatedFrameHost()->SetWantsAnimateOnlyBeginFrames();
render_widget_host_->ForwardKeyboardEventWithLatencyInfo(event, latency); }
}
void CefRenderWidgetHostViewOSR::ProcessMouseEvent(
const blink::WebMouseEvent& event,
const ui::LatencyInfo& latency) {
render_widget_host_->ForwardMouseEventWithLatencyInfo(event, latency);
}
void CefRenderWidgetHostViewOSR::ProcessMouseWheelEvent(
const blink::WebMouseWheelEvent& event,
const ui::LatencyInfo& latency) {
render_widget_host_->ForwardWheelEventWithLatencyInfo(event, latency);
}
void CefRenderWidgetHostViewOSR::ProcessTouchEvent(
const blink::WebTouchEvent& event,
const ui::LatencyInfo& latency) {
render_widget_host_->ForwardTouchEventWithLatencyInfo(event, latency);
}
void CefRenderWidgetHostViewOSR::ProcessGestureEvent(
const blink::WebGestureEvent& event,
const ui::LatencyInfo& latency) {
render_widget_host_->ForwardGestureEventWithLatencyInfo(event, latency);
} }
bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace( bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
const gfx::Point& point, const gfx::PointF& point,
const viz::SurfaceId& original_surface, const viz::SurfaceId& original_surface,
gfx::Point* transformed_point) { gfx::PointF* transformed_point) {
// Transformations use physical pixels rather than DIP, so conversion // Transformations use physical pixels rather than DIP, so conversion
// is necessary. // is necessary.
gfx::Point point_in_pixels = gfx::PointF point_in_pixels =
gfx::ConvertPointToPixel(current_device_scale_factor_, point); gfx::ConvertPointToPixel(current_device_scale_factor_, point);
if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpace( if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpace(
point_in_pixels, original_surface, transformed_point)) { point_in_pixels, original_surface, transformed_point)) {
@@ -845,9 +878,9 @@ bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
} }
bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView( bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
const gfx::Point& point, const gfx::PointF& point,
RenderWidgetHostViewBase* target_view, RenderWidgetHostViewBase* target_view,
gfx::Point* transformed_point) { gfx::PointF* transformed_point) {
if (target_view == this) { if (target_view == this) {
*transformed_point = point; *transformed_point = point;
return true; return true;
@@ -860,6 +893,16 @@ bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
point, target_view, transformed_point); point, target_view, transformed_point);
} }
void CefRenderWidgetHostViewOSR::DidNavigate() {
#if defined(OS_MACOSX)
browser_compositor_->DidNavigate();
#else
ResizeRootLayer();
if (delegated_frame_host_)
delegated_frame_host_->DidNavigate();
#endif
}
std::unique_ptr<viz::SoftwareOutputDevice> std::unique_ptr<viz::SoftwareOutputDevice>
CefRenderWidgetHostViewOSR::CreateSoftwareOutputDevice( CefRenderWidgetHostViewOSR::CreateSoftwareOutputDevice(
ui::Compositor* compositor) { ui::Compositor* compositor) {
@@ -883,8 +926,7 @@ bool CefRenderWidgetHostViewOSR::DelegatedFrameHostIsVisible() const {
return !render_widget_host_->is_hidden(); return !render_widget_host_->is_hidden();
} }
SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor( SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor() const {
SkColor color) const {
// When making an element on the page fullscreen the element's background // When making an element on the page fullscreen the element's background
// may not match the page's, so use black as the gutter color to avoid // may not match the page's, so use black as the gutter color to avoid
// flashes of brighter colors during the transition. // flashes of brighter colors during the transition.
@@ -892,12 +934,7 @@ SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor(
render_widget_host_->delegate()->IsFullscreenForCurrentTab()) { render_widget_host_->delegate()->IsFullscreenForCurrentTab()) {
return SK_ColorBLACK; return SK_ColorBLACK;
} }
return color; return background_color_;
}
gfx::Size CefRenderWidgetHostViewOSR::DelegatedFrameHostDesiredSizeInDIP()
const {
return GetRootLayer()->bounds().size();
} }
bool CefRenderWidgetHostViewOSR::DelegatedFrameCanCreateResizeLock() const { bool CefRenderWidgetHostViewOSR::DelegatedFrameCanCreateResizeLock() const {
@@ -909,14 +946,17 @@ CefRenderWidgetHostViewOSR::DelegatedFrameHostCreateResizeLock() {
HoldResize(); HoldResize();
const gfx::Size& desired_size = GetRootLayer()->bounds().size(); const gfx::Size& desired_size = GetRootLayer()->bounds().size();
return base::MakeUnique<content::CompositorResizeLock>(this, desired_size); return std::make_unique<content::CompositorResizeLock>(this, desired_size);
} }
viz::LocalSurfaceId CefRenderWidgetHostViewOSR::GetLocalSurfaceId() const { viz::LocalSurfaceId CefRenderWidgetHostViewOSR::GetLocalSurfaceId() const {
return local_surface_id_; return local_surface_id_;
} }
void CefRenderWidgetHostViewOSR::OnBeginFrame() { void CefRenderWidgetHostViewOSR::OnFirstSurfaceActivation(
const viz::SurfaceInfo& surface_info) {}
void CefRenderWidgetHostViewOSR::OnBeginFrame(base::TimeTicks frame_time) {
// TODO(cef): Maybe we can use this method in combination with // TODO(cef): Maybe we can use this method in combination with
// OnSetNeedsBeginFrames() instead of using CefBeginFrameTimer. // OnSetNeedsBeginFrames() instead of using CefBeginFrameTimer.
// See https://codereview.chromium.org/1841083007. // See https://codereview.chromium.org/1841083007.
@@ -926,6 +966,14 @@ bool CefRenderWidgetHostViewOSR::IsAutoResizeEnabled() const {
return render_widget_host_->auto_resize_enabled(); return render_widget_host_->auto_resize_enabled();
} }
void CefRenderWidgetHostViewOSR::OnFrameTokenChanged(uint32_t frame_token) {
render_widget_host_->DidProcessFrame(frame_token);
}
void CefRenderWidgetHostViewOSR::DidReceiveFirstFrameAfterNavigation() {
render_widget_host_->DidReceiveFirstFrameAfterNavigation();
}
std::unique_ptr<ui::CompositorLock> std::unique_ptr<ui::CompositorLock>
CefRenderWidgetHostViewOSR::GetCompositorLock( CefRenderWidgetHostViewOSR::GetCompositorLock(
ui::CompositorLockClient* client) { ui::CompositorLockClient* client) {
@@ -959,42 +1007,6 @@ void CefRenderWidgetHostViewOSR::WasResized() {
} }
ResizeRootLayer(); ResizeRootLayer();
if (render_widget_host_)
render_widget_host_->WasResized();
GetDelegatedFrameHost()->WasResized();
}
void CefRenderWidgetHostViewOSR::GetScreenInfo(content::ScreenInfo* results) {
if (!browser_impl_.get())
return;
CefScreenInfo screen_info(kDefaultScaleFactor, 0, 0, false, CefRect(),
CefRect());
CefRefPtr<CefRenderHandler> handler =
browser_impl_->client()->GetRenderHandler();
if (handler.get() &&
(!handler->GetScreenInfo(browser_impl_.get(), screen_info) ||
screen_info.rect.width == 0 || screen_info.rect.height == 0 ||
screen_info.available_rect.width == 0 ||
screen_info.available_rect.height == 0)) {
// If a screen rectangle was not provided, try using the view rectangle
// instead. Otherwise, popup views may be drawn incorrectly, or not at all.
CefRect screenRect;
if (!handler->GetViewRect(browser_impl_.get(), screenRect)) {
NOTREACHED();
screenRect = CefRect();
}
if (screen_info.rect.width == 0 && screen_info.rect.height == 0)
screen_info.rect = screenRect;
if (screen_info.available_rect.width == 0 &&
screen_info.available_rect.height == 0)
screen_info.available_rect = screenRect;
}
*results = ScreenInfoFrom(screen_info);
} }
void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() { void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() {
@@ -1004,7 +1016,22 @@ void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() {
// TODO(OSR): Update the backing store. // TODO(OSR): Update the backing store.
if (render_widget_host_->delegate())
render_widget_host_->delegate()->SendScreenRects();
else
render_widget_host_->SendScreenRects();
#if defined(OS_MACOSX)
// RenderWidgetHostImpl will query BrowserCompositorMac for the dimensions
// to send to the renderer, so it is required that BrowserCompositorMac be
// updated first. Only notify RenderWidgetHostImpl of the update if any
// properties it will query have changed.
if (browser_compositor_->UpdateNSViewAndDisplay())
render_widget_host_->NotifyScreenInfoChanged();
#else
render_widget_host_->NotifyScreenInfoChanged(); render_widget_host_->NotifyScreenInfoChanged();
#endif
// We might want to change the cursor scale factor here as well - see the // We might want to change the cursor scale factor here as well - see the
// cache for the current_cursor_, as passed by UpdateCursor from the renderer // cache for the current_cursor_, as passed by UpdateCursor from the renderer
// in the rwhv_aura (current_cursor_.SetScaleFactor) // in the rwhv_aura (current_cursor_.SetScaleFactor)
@@ -1024,7 +1051,7 @@ void CefRenderWidgetHostViewOSR::Invalidate(
return; return;
} }
InvalidateInternal(gfx::Rect(GetPhysicalBackingSize())); InvalidateInternal(gfx::Rect(GetCompositorViewportPixelSize()));
} }
void CefRenderWidgetHostViewOSR::SendKeyEvent( void CefRenderWidgetHostViewOSR::SendKeyEvent(
@@ -1032,7 +1059,7 @@ void CefRenderWidgetHostViewOSR::SendKeyEvent(
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::SendKeyEvent"); TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::SendKeyEvent");
if (render_widget_host_ && render_widget_host_->GetView()) { if (render_widget_host_ && render_widget_host_->GetView()) {
// Direct routing requires that events go directly to the View. // Direct routing requires that events go directly to the View.
render_widget_host_->GetView()->ProcessKeyboardEvent( render_widget_host_->ForwardKeyboardEventWithLatencyInfo(
event, ui::LatencyInfo(event.GetType() == blink::WebInputEvent::kChar || event, ui::LatencyInfo(event.GetType() == blink::WebInputEvent::kChar ||
event.GetType() == event.GetType() ==
blink::WebInputEvent::kRawKeyDown blink::WebInputEvent::kRawKeyDown
@@ -1294,16 +1321,11 @@ void CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
current_device_scale_factor_ = new_scale_factor; current_device_scale_factor_ = new_scale_factor;
if (render_widget_host_ && render_widget_host_->delegate())
render_widget_host_->delegate()->UpdateDeviceScaleFactor(new_scale_factor);
// Notify the guest hosts if any. // Notify the guest hosts if any.
for (auto guest_host_view : guest_host_views_) { for (auto guest_host_view : guest_host_views_) {
content::RenderWidgetHostImpl* rwhi = guest_host_view->render_widget_host(); content::RenderWidgetHostImpl* rwhi = guest_host_view->render_widget_host();
if (!rwhi) if (!rwhi)
continue; continue;
if (rwhi->delegate())
rwhi->delegate()->UpdateDeviceScaleFactor(new_scale_factor);
if (rwhi->GetView()) if (rwhi->GetView())
rwhi->GetView()->set_current_device_scale_factor(new_scale_factor); rwhi->GetView()->set_current_device_scale_factor(new_scale_factor);
} }
@@ -1332,9 +1354,22 @@ void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
local_surface_id_ = local_surface_id_allocator_.GenerateId(); local_surface_id_ = local_surface_id_allocator_.GenerateId();
GetRootLayer()->SetBounds(gfx::Rect(size)); GetRootLayer()->SetBounds(gfx::Rect(size));
GetCompositor()->SetScaleAndSize(current_device_scale_factor_, GetCompositor()->SetScaleAndSize(current_device_scale_factor_, size_in_pixels,
size_in_pixels); local_surface_id_);
PlatformResizeCompositorWidget(size_in_pixels); PlatformResizeCompositorWidget(size_in_pixels);
#if defined(OS_MACOSX)
bool resized = browser_compositor_->UpdateNSViewAndDisplay();
#else
bool resized = true;
GetDelegatedFrameHost()->WasResized(local_surface_id_, size,
cc::DeadlinePolicy::UseDefaultDeadline());
#endif
// Note that |render_widget_host_| will retrieve resize parameters from the
// DelegatedFrameHost, so it must have WasResized called after.
if (resized && render_widget_host_)
render_widget_host_->WasResized();
} }
void CefRenderWidgetHostViewOSR::OnBeginFrameTimerTick() { void CefRenderWidgetHostViewOSR::OnBeginFrameTimerTick() {
@@ -1434,10 +1469,9 @@ void CefRenderWidgetHostViewOSR::RemoveGuestHostView(
void CefRenderWidgetHostViewOSR::RegisterGuestViewFrameSwappedCallback( void CefRenderWidgetHostViewOSR::RegisterGuestViewFrameSwappedCallback(
content::RenderWidgetHostViewGuest* guest_host_view) { content::RenderWidgetHostViewGuest* guest_host_view) {
guest_host_view->RegisterFrameSwappedCallback( guest_host_view->RegisterFrameSwappedCallback(base::BindOnce(
base::MakeUnique<base::Closure>(base::Bind( &CefRenderWidgetHostViewOSR::OnGuestViewFrameSwapped,
&CefRenderWidgetHostViewOSR::OnGuestViewFrameSwapped, weak_ptr_factory_.GetWeakPtr(), base::Unretained(guest_host_view)));
weak_ptr_factory_.GetWeakPtr(), base::Unretained(guest_host_view))));
guest_host_view->set_current_device_scale_factor( guest_host_view->set_current_device_scale_factor(
current_device_scale_factor_); current_device_scale_factor_);
} }

View File

@@ -16,7 +16,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/viz/common/frame_sinks/begin_frame_source.h" #include "components/viz/common/frame_sinks/begin_frame_source.h"
#include "components/viz/common/surfaces/local_surface_id_allocator.h" #include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
#include "content/browser/renderer_host/compositor_resize_lock.h" #include "content/browser/renderer_host/compositor_resize_lock.h"
#include "content/browser/renderer_host/delegated_frame_host.h" #include "content/browser/renderer_host/delegated_frame_host.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h" #include "content/browser/renderer_host/render_widget_host_view_base.h"
@@ -86,7 +86,7 @@ class MacHelper;
class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase, class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
public ui::CompositorDelegate public ui::CompositorDelegate
#if !defined(OS_MACOSX) #if !defined(OS_MACOSX)
, ,
public content::DelegatedFrameHostClient, public content::DelegatedFrameHostClient,
public content::CompositorResizeLockClient public content::CompositorResizeLockClient
#endif #endif
@@ -100,7 +100,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
// RenderWidgetHostView implementation. // RenderWidgetHostView implementation.
void InitAsChild(gfx::NativeView parent_view) override; void InitAsChild(gfx::NativeView parent_view) override;
content::RenderWidgetHost* GetRenderWidgetHost() const override;
void SetSize(const gfx::Size& size) override; void SetSize(const gfx::Size& size) override;
void SetBounds(const gfx::Rect& rect) override; void SetBounds(const gfx::Rect& rect) override;
gfx::Vector2dF GetLastScrollOffset() const override; gfx::Vector2dF GetLastScrollOffset() const override;
@@ -119,21 +118,23 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void UnlockMouse() override; void UnlockMouse() override;
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override;
void SetActive(bool active) override; void SetActive(bool active) override;
void ShowDefinitionForSelection() override; void ShowDefinitionForSelection() override;
bool SupportsSpeech() const override; bool SupportsSpeech() const override;
void SpeakSelection() override; void SpeakSelection() override;
bool IsSpeaking() const override; bool IsSpeaking() const override;
void StopSpeaking() override; void StopSpeaking() override;
bool ShouldContinueToPauseForFrame() override;
#endif // defined(OS_MACOSX) #endif // defined(OS_MACOSX)
// RenderWidgetHostViewBase implementation. // RenderWidgetHostViewBase implementation.
void DidCreateNewRendererCompositorFrameSink( void DidCreateNewRendererCompositorFrameSink(
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink)
override; override;
void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id, void SubmitCompositorFrame(
viz::CompositorFrame frame) override; const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
viz::mojom::HitTestRegionListPtr hit_test_region_list) override;
void ClearCompositorFrame() override; void ClearCompositorFrame() override;
void InitAsPopup(content::RenderWidgetHostView* parent_host_view, void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
const gfx::Rect& pos) override; const gfx::Rect& pos) override;
@@ -149,21 +150,16 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void SetTooltipText(const base::string16& tooltip_text) override; void SetTooltipText(const base::string16& tooltip_text) override;
gfx::Size GetRequestedRendererSize() const override; gfx::Size GetRequestedRendererSize() const override;
gfx::Size GetPhysicalBackingSize() const override; gfx::Size GetCompositorViewportPixelSize() const override;
void CopyFromSurface(const gfx::Rect& src_subrect, void CopyFromSurface(
const gfx::Size& dst_size, const gfx::Rect& src_rect,
const content::ReadbackRequestCallback& callback, const gfx::Size& output_size,
const SkColorType color_type) override; base::OnceCallback<void(const SkBitmap&)> callback) override;
void CopyFromSurfaceToVideoFrame( void GetScreenInfo(content::ScreenInfo* results) const override;
const gfx::Rect& src_subrect, gfx::Vector2d GetOffsetFromRootSurface() override;
scoped_refptr<media::VideoFrame> target,
const base::Callback<void(const gfx::Rect&, bool)>& callback) override;
void BeginFrameSubscription(
std::unique_ptr<content::RenderWidgetHostViewFrameSubscriber> subscriber)
override;
void EndFrameSubscription() override;
bool HasAcceleratedSurface(const gfx::Size& desired_size) override;
gfx::Rect GetBoundsInRootWindow() override; gfx::Rect GetBoundsInRootWindow() override;
content::RenderWidgetHostImpl* GetRenderWidgetHostImpl() const override;
viz::SurfaceId GetCurrentSurfaceId() const override;
content::BrowserAccessibilityManager* CreateBrowserAccessibilityManager( content::BrowserAccessibilityManager* CreateBrowserAccessibilityManager(
content::BrowserAccessibilityDelegate* delegate, content::BrowserAccessibilityDelegate* delegate,
bool for_root_frame) override; bool for_root_frame) override;
@@ -177,24 +173,20 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
const std::vector<gfx::Rect>& character_bounds) override; const std::vector<gfx::Rect>& character_bounds) override;
void SetNeedsBeginFrames(bool enabled) override; void SetNeedsBeginFrames(bool enabled) override;
void SetWantsAnimateOnlyBeginFrames() override;
void ProcessKeyboardEvent(const content::NativeWebKeyboardEvent& event, bool TransformPointToLocalCoordSpace(const gfx::PointF& point,
const ui::LatencyInfo& latency) override;
void ProcessMouseEvent(const blink::WebMouseEvent& event,
const ui::LatencyInfo& latency) override;
void ProcessMouseWheelEvent(const blink::WebMouseWheelEvent& event,
const ui::LatencyInfo& latency) override;
void ProcessTouchEvent(const blink::WebTouchEvent& event,
const ui::LatencyInfo& latency) override;
void ProcessGestureEvent(const blink::WebGestureEvent& event,
const ui::LatencyInfo& latency) override;
bool TransformPointToLocalCoordSpace(const gfx::Point& point,
const viz::SurfaceId& original_surface, const viz::SurfaceId& original_surface,
gfx::Point* transformed_point) override; gfx::PointF* transformed_point) override;
bool TransformPointToCoordSpaceForView( bool TransformPointToCoordSpaceForView(
const gfx::Point& point, const gfx::PointF& point,
RenderWidgetHostViewBase* target_view, RenderWidgetHostViewBase* target_view,
gfx::Point* transformed_point) override; gfx::PointF* transformed_point) override;
void DidNavigate() override;
void SelectionChanged(const base::string16& text,
size_t offset,
const gfx::Range& range) override;
// ui::CompositorDelegate implementation. // ui::CompositorDelegate implementation.
std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice( std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice(
@@ -204,14 +196,16 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
// DelegatedFrameHostClient implementation. // DelegatedFrameHostClient implementation.
ui::Layer* DelegatedFrameHostGetLayer() const override; ui::Layer* DelegatedFrameHostGetLayer() const override;
bool DelegatedFrameHostIsVisible() const override; bool DelegatedFrameHostIsVisible() const override;
SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override; SkColor DelegatedFrameHostGetGutterColor() const override;
gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override;
bool DelegatedFrameCanCreateResizeLock() const override; bool DelegatedFrameCanCreateResizeLock() const override;
std::unique_ptr<content::CompositorResizeLock> std::unique_ptr<content::CompositorResizeLock>
DelegatedFrameHostCreateResizeLock() override; DelegatedFrameHostCreateResizeLock() override;
viz::LocalSurfaceId GetLocalSurfaceId() const override; viz::LocalSurfaceId GetLocalSurfaceId() const override;
void OnBeginFrame() override; void OnFirstSurfaceActivation(const viz::SurfaceInfo& surface_info) override;
void OnBeginFrame(base::TimeTicks frame_time) override;
bool IsAutoResizeEnabled() const override; bool IsAutoResizeEnabled() const override;
void OnFrameTokenChanged(uint32_t frame_token) override;
void DidReceiveFirstFrameAfterNavigation() override;
// CompositorResizeLockClient implementation. // CompositorResizeLockClient implementation.
std::unique_ptr<ui::CompositorLock> GetCompositorLock( std::unique_ptr<ui::CompositorLock> GetCompositorLock(
@@ -222,7 +216,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
bool InstallTransparency(); bool InstallTransparency();
void WasResized(); void WasResized();
void GetScreenInfo(content::ScreenInfo* results);
void OnScreenInfoChanged(); void OnScreenInfoChanged();
void Invalidate(CefBrowserHost::PaintElementType type); void Invalidate(CefBrowserHost::PaintElementType type);
void SendKeyEvent(const content::NativeWebKeyboardEvent& event); void SendKeyEvent(const content::NativeWebKeyboardEvent& event);
@@ -331,7 +324,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
#endif #endif
viz::LocalSurfaceId local_surface_id_; viz::LocalSurfaceId local_surface_id_;
viz::LocalSurfaceIdAllocator local_surface_id_allocator_; viz::ParentLocalSurfaceIdAllocator local_surface_id_allocator_;
#if defined(OS_WIN) #if defined(OS_WIN)
std::unique_ptr<gfx::WindowImpl> window_; std::unique_ptr<gfx::WindowImpl> window_;

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