Compare commits

..

46 Commits
3396 ... 3239

Author SHA1 Message Date
Marshall Greenblatt
071d1c1653 Update to Chromium version 63.0.3239.132 2018-01-05 16:54:56 -05:00
Marshall Greenblatt
143bd4d425 msvs_env.bat: Fix VS2017 path discovery and avoid CWD change (issue #2350, issue #2351) 2018-01-05 13:32:43 -05:00
Marshall Greenblatt
86eb141c53 Return Chrome 'Browser' value for DevTools remote debugging (issue #2300) 2018-01-04 18:56:37 -05:00
Marshall Greenblatt
1ad5e2a261 Add CefURLRequest::ResponseWasCached method (issue #2283) 2018-01-03 16:20:46 -05:00
Marshall Greenblatt
36e4511b03 Update generated file copyright year 2018-01-03 16:19:38 -05:00
Marshall Greenblatt
449f1bef66 macOS: cmake: Don't create target name with spaces (issue #2342) 2018-01-03 15:06:03 -05:00
Marshall Greenblatt
5bd3361a6a Linux: Fix crash when canceling the print dialog (issue #2341) 2018-01-02 16:57:53 -05:00
Marshall Greenblatt
735b74619e Return correct 'Browser' value for DevTools remote debugging (issue #2300) 2017-12-27 17:37:04 -05:00
Marshall Greenblatt
585cb1a434 Fix proxy service initialization (issue #2066) 2017-12-27 17:11:10 -05:00
Marshall Greenblatt
1728ce6627 cmake: Fix detection of tests folder 2017-12-27 15:54:24 -05:00
Marshall Greenblatt
89a6ca1e6b Windows: cmake: Add VS2017 15.5 build support 2017-12-27 15:54:15 -05:00
Marshall Greenblatt
4d4fcde2fa Windows: Fix 64-bit build warning C4267 (issue #2335) 2017-12-27 15:54:08 -05:00
Marshall Greenblatt
dba68c026c Merge webkit_set target into //WebKit/source/controller to fix deps race (issue #2339) 2017-12-27 13:26:14 -05:00
Marshall Greenblatt
85f637afcf Fix crash when ALT+Clicking invalid protocol link (issue #2306) 2017-12-22 16:44:15 -05:00
Marshall Greenblatt
093cae4c85 Fix crash when using CefJSDialogHandler with the default dialog implementation (issue #2329) 2017-12-21 16:49:36 -05:00
Marshall Greenblatt
7e1e1d0d0a Windows: Fix x64 compile error (issue #2332) 2017-12-21 15:44:08 -05:00
Marshall Greenblatt
49a64fa360 Fix crash when creating JS popup with no URL (issue #2330) 2017-12-21 15:00:36 -05:00
Marshall Greenblatt
cd33baaff6 Fix assertion when calling SendProcessMessage from non-UI thread (issue #2325) 2017-12-19 15:16:32 -05:00
SergeyAvd
f6d6dfc859 Fix typos in the comments that generate the documentation 2017-12-18 18:47:22 -05:00
Andrei Kurushin
8e694795d0 Windows: Fix non x2 HiDPI OSR paint crop (issue #2299) 2017-12-18 14:40:45 -05:00
Marshall Greenblatt
e9b47cb6ea Fix README typo 2017-12-18 14:20:46 -05:00
Marshall Greenblatt
0e1cda7e04 Linux: Add missing swiftshader binaries to distribution (issue #2321) 2017-12-18 14:14:46 -05:00
Marshall Greenblatt
68fddaef3c Update to Chromium version 63.0.3239.109 2017-12-15 17:00:44 -05:00
Marshall Greenblatt
385b2d4fb7 Fix OSR accessibility tests (issue #2312) 2017-12-12 15:59:20 -05:00
Marshall Greenblatt
ab289f8c21 Fix crash database size calculation 2017-12-05 16:59:37 -05:00
Tammo Hinrichs
8f2fa9905f OSR: Fix GPU->CPU readback performance issues (issue #2046) 2017-12-05 13:45:26 -05:00
Marshall Greenblatt
39f8ab63f3 Update to Chromium version 63.0.3239.70 2017-12-04 21:47:52 -05:00
Marshall Greenblatt
41192da2df Fix accessibility information (issue #2312) 2017-12-04 14:21:52 -05:00
Marshall Greenblatt
9b0d05362e macOS: Fix build of widevinecdmadapter.plugin (issue #2314) 2017-12-04 13:00:53 -05:00
Marshall Greenblatt
ddfc3edc4e Fix bugs and test failures with browser-side navigation (issue #2290) 2017-11-30 18:42:48 -05:00
amaitland
29d23fad6a cmake: Don't require test projects with minimal distribution (issue #2169) 2017-11-30 18:42:35 -05:00
Tamas Lustyik
5a69704c47 Making it possible to bridge C++ wrapper classes to C (issue #2311). 2017-11-28 10:59:35 -05:00
Tamas Lustyik
d360639327 macOS: Added guard to previously overlooked C++ include (issue #2297) 2017-11-28 10:59:28 -05:00
Marshall Greenblatt
6f5973b172 cmake: Add v8_context_snapshot.bin binary file 2017-11-27 12:17:23 -05:00
Marshall Greenblatt
c9d6700b30 - Add cache awareness to CefURLRequest (issue #2283)
- Properly set referer values on server requests (issue #2278)
2017-11-17 17:15:05 -05:00
Marshall Greenblatt
90cce6787e Linux: Fix missing ui::Service symbols (issue #2294) 2017-11-16 12:24:40 -05:00
Marshall Greenblatt
be1919cd6d Linux: Don't generate Chromium installer packages (issue #2301) 2017-11-15 19:29:29 -05:00
Marshall Greenblatt
f4d6298737 Enable Brotli encoding (issue #2303) 2017-11-15 17:22:37 -05:00
Lk Xf
c32f283647 Allow inclusion of cef_application_mac.h from pure C/ObjC (issue #2297) 2017-11-15 14:57:05 -05:00
Marshall Greenblatt
4b39753c41 Add CefServer API for handling HTTP/WebSocket requests (issue #2278) 2017-11-15 12:45:51 -05:00
Marshall Greenblatt
39e689d80a Windows: Add VS2017.4 build support 2017-11-01 16:26:22 -04:00
Marshall Greenblatt
bd91a91b94 cmake: Fix accidental version dependency break (issue #2293) 2017-11-01 16:26:16 -04:00
Marshall Greenblatt
5493b3dc2c Don't create 'GPUCache' and 'databases' directories when cache-path is unspecified (issue #2289) 2017-10-30 16:54:24 -04:00
Marshall Greenblatt
e93622f514 Windows: Add missing swiftshader binaries to distribution (issue #2291) 2017-10-30 14:44:52 -04:00
Marshall Greenblatt
8e3630ccad Windows: Don't recommend is_win_fastlink=true with VS2017 (issue #1691) 2017-10-27 19:01:04 -04:00
Marshall Greenblatt
4cab649aac Update to Chromium version 63.0.3239.18 2017-10-27 19:00:17 -04:00
372 changed files with 9894 additions and 10048 deletions

145
BUILD.gn
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: Create an official build on Windows: # Example A: Use /DEBUG:FASTLINK on Windows:
# #
# > set GN_DEFINES=is_official_build=true # > set GN_DEFINES=is_win_fastlink=true
# #
# Example B: Generate VS2017 project files in addition to the default Ninja # Example B: Generate VS2015 project files in addition to the default Ninja
# build files on Windows: # build files on Windows:
# #
# > set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/* # > set GN_ARGUMENTS=--ide=vs2015 --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
@@ -100,31 +100,29 @@ import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni") import("//build/config/ui.gni")
import("//cef/cef_repack_locales.gni") import("//cef/cef_repack_locales.gni")
import("//chrome/common/features.gni") import("//chrome/common/features.gni")
import("//extensions/buildflags/buildflags.gni") import("//extensions/features/features.gni")
import("//media/media_options.gni") import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni") import("//mojo/public/tools/bindings/mojom.gni")
import("//ppapi/buildflags/buildflags.gni") import("//ppapi/features/features.gni")
import("//printing/buildflags/buildflags.gni") import("//printing/features/features.gni")
import("//services/catalog/public/tools/catalog.gni") import("//services/catalog/public/tools/catalog.gni")
import("//services/service_manager/public/service_manifest.gni") import("//services/service_manager/public/service_manifest.gni")
import("//third_party/icu/config.gni") 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/library_cdm/cdm_paths.gni") import("//media/cdm/ppapi/cdm_paths.gni")
} }
if (is_win) { if (is_win) {
import("//build/config/win/console_app.gni") import("//build/config/win/console_app.gni")
@@ -149,12 +147,6 @@ 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.
@@ -271,12 +263,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:buildflags", "//chrome/common:features",
"//ppapi/buildflags:buildflags", "//ppapi/features:features",
"//printing/buildflags:buildflags", "//printing/features:features",
"//ui/base:ui_features",
] ]
} }
} }
@@ -288,8 +280,6 @@ 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",
@@ -339,6 +329,8 @@ 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",
@@ -380,6 +372,7 @@ 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",
@@ -448,6 +441,16 @@ 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",
@@ -589,6 +592,16 @@ 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",
@@ -654,7 +667,6 @@ 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",
@@ -696,11 +708,14 @@ 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/buildflags",
"//extensions/common/api", "//extensions/common/api",
"//extensions/features",
"//extensions/renderer", "//extensions/renderer",
"//extensions/utility",
"//gpu", "//gpu",
"//ipc", "//ipc",
"//media", "//media",
@@ -710,25 +725,24 @@ static_library("libcef_static") {
"//net:net_utility_services", "//net:net_utility_services",
"//net:net_with_v8", "//net:net_with_v8",
"//pdf", "//pdf",
"//ppapi/buildflags", "//ppapi/features",
"//printing/buildflags", "//printing/features",
"//services/network:network_service",
"//services/network/public/cpp",
"//services/service_manager/embedder", "//services/service_manager/embedder",
"//services/service_manager/public/cpp", "//services/service_manager/public/interfaces",
"//services/service_manager/runner/common", "//services/service_manager/runner/common",
"//skia", "//skia",
"//storage/browser", "//storage/browser",
"//third_party/blink/public:blink",
"//third_party/brotli:dec", "//third_party/brotli:dec",
"//third_party/cld_3/src/src:cld_3", "//third_party/cld",
"//third_party/hunspell", "//third_party/hunspell",
"//third_party/leveldatabase", "//third_party/leveldatabase",
"//third_party/libxml", "//third_party/libxml",
"//third_party/WebKit/public:blink",
"//third_party/widevine/cdm:headers", "//third_party/widevine/cdm:headers",
"//third_party/widevine/cdm", "//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",
@@ -761,6 +775,8 @@ 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",
@@ -821,7 +837,7 @@ static_library("libcef_static") {
} }
if (is_win || is_mac) { if (is_win || is_mac) {
deps += [ "//third_party/crashpad/crashpad/handler" ] deps += [ "//third_party/crashpad/crashpad/handler:handler_lib" ]
} }
if (use_x11) { if (use_x11) {
@@ -829,21 +845,12 @@ 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",
@@ -918,7 +925,6 @@ static_library("libcef_static") {
] ]
deps += [ deps += [
"//services/ui",
"//ui/aura", "//ui/aura",
"//ui/events", "//ui/events",
"//ui/strings", "//ui/strings",
@@ -936,11 +942,6 @@ 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.
@@ -1028,10 +1029,6 @@ 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",
] ]
@@ -1074,11 +1071,11 @@ template("cef_pak_scaled") {
# Each input pak file should also have a deps line for completeness. # Each input pak file should also have a deps line for completeness.
# Add associated .h files in the make_pack_header("resources") target. # Add associated .h files in the make_pack_header("resources") target.
sources = [ sources = [
"$root_gen_dir/blink/public/resources/blink_scaled_resources_${percent}_percent.pak",
"$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak", "$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
"$root_gen_dir/components/components_resources_${percent}_percent.pak", "$root_gen_dir/components/components_resources_${percent}_percent.pak",
"$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak", "$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
"$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak", "$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_${percent}_percent.pak",
"$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak", "$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
] ]
@@ -1086,18 +1083,18 @@ template("cef_pak_scaled") {
# the libcef_static target. Grit deps that generate .cc files must be # the libcef_static target. Grit deps that generate .cc files must be
# listed both here and in the libcef_static target. # listed both here and in the libcef_static target.
public_deps = [ public_deps = [
"//third_party/WebKit/public:scaled_resources",
"//chrome/renderer:resources", "//chrome/renderer:resources",
"//components/resources:components_scaled_resources", "//components/resources:components_scaled_resources",
"//content/app/resources", "//content/app/resources",
"//extensions:extensions_browser_resources", "//extensions:extensions_browser_resources",
"//third_party/blink/public:scaled_resources",
"//ui/resources:ui_resources_grd", "//ui/resources:ui_resources_grd",
] ]
deps = [ deps = [
# This repack target generates the blink_scaled_resources_*_percent.pak # This repack target generates the blink_scaled_resources_*_percent.pak
# file but doesn't expose the public_deps required by make_pack_header. # file but doesn't expose the public_deps required by make_pack_header.
"//third_party/blink/public:scaled_resources_${percent}_percent", "//third_party/WebKit/public:scaled_resources_${percent}_percent",
] ]
if (toolkit_views) { if (toolkit_views) {
@@ -1150,7 +1147,6 @@ 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",
] ]
@@ -1161,7 +1157,6 @@ 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",
] ]
@@ -1214,6 +1209,7 @@ repack("pak") {
# Each input pak file should also have a deps line for completeness. # Each input pak file should also have a deps line for completeness.
# Add associated .h files in the make_pack_header("resources") target. # Add associated .h files in the make_pack_header("resources") target.
sources = [ sources = [
"$root_gen_dir/blink/public/resources/blink_resources.pak",
"$root_gen_dir/chrome/browser_resources.pak", "$root_gen_dir/chrome/browser_resources.pak",
"$root_gen_dir/chrome/net_internals_resources.pak", "$root_gen_dir/chrome/net_internals_resources.pak",
"$root_gen_dir/chrome/common_resources.pak", "$root_gen_dir/chrome/common_resources.pak",
@@ -1222,13 +1218,13 @@ repack("pak") {
"$root_gen_dir/content/browser/tracing/tracing_resources.pak", "$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak", "$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/net/net_resources.pak", "$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
] ]
# Use public_deps so that generated grit headers are discoverable from # Use public_deps so that generated grit headers are discoverable from
# the libcef_static target. Grit deps that generate .cc files must be # the libcef_static target. Grit deps that generate .cc files must be
# listed both here and in the libcef_static target. # listed both here and in the libcef_static target.
public_deps = [ public_deps = [
"//third_party/WebKit/public:resources_grit",
"//chrome/browser:resources", "//chrome/browser:resources",
"//chrome/browser/resources:net_internals_resources", "//chrome/browser/resources:net_internals_resources",
"//chrome/common:resources", "//chrome/common:resources",
@@ -1237,7 +1233,6 @@ repack("pak") {
"//content/browser/tracing:resources", "//content/browser/tracing:resources",
"//content:resources", "//content:resources",
"//net:net_resources", "//net:net_resources",
"//third_party/blink/public:resources",
] ]
output = "$root_out_dir/cef.pak" output = "$root_out_dir/cef.pak"
@@ -1274,6 +1269,9 @@ template("make_pack_header") {
make_pack_header("resources") { make_pack_header("resources") {
header = "$root_out_dir/includes/include/cef_pack_resources.h" header = "$root_out_dir/includes/include/cef_pack_resources.h"
inputs = [ inputs = [
"$root_gen_dir/blink/public/resources/grit/media_controls_resources.h",
"$root_gen_dir/blink/public/resources/grit/blink_image_resources.h",
"$root_gen_dir/blink/public/resources/grit/blink_resources.h",
"$root_gen_dir/cef/grit/cef_resources.h", "$root_gen_dir/cef/grit/cef_resources.h",
"$root_gen_dir/chrome/grit/browser_resources.h", "$root_gen_dir/chrome/grit/browser_resources.h",
"$root_gen_dir/chrome/grit/common_resources.h", "$root_gen_dir/chrome/grit/common_resources.h",
@@ -1288,7 +1286,6 @@ make_pack_header("resources") {
"$root_gen_dir/extensions/grit/extensions_renderer_resources.h", "$root_gen_dir/extensions/grit/extensions_renderer_resources.h",
"$root_gen_dir/extensions/grit/extensions_resources.h", "$root_gen_dir/extensions/grit/extensions_resources.h",
"$root_gen_dir/net/grit/net_resources.h", "$root_gen_dir/net/grit/net_resources.h",
"$root_gen_dir/third_party/blink/public/resources/grit/blink_resources.h",
"$root_gen_dir/ui/resources/grit/ui_resources.h", "$root_gen_dir/ui/resources/grit/ui_resources.h",
"$root_gen_dir/ui/resources/grit/webui_resources.h", "$root_gen_dir/ui/resources/grit/webui_resources.h",
"$root_gen_dir/ui/views/resources/grit/views_resources.h", "$root_gen_dir/ui/views/resources/grit/views_resources.h",
@@ -1354,6 +1351,8 @@ 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",
] ]
public_deps = [ public_deps = [
@@ -1362,6 +1361,8 @@ if (is_mac) {
":pak_200_percent", ":pak_200_percent",
":pak_devtools", ":pak_devtools",
":pak_extensions", ":pak_extensions",
"//third_party/widevine/cdm:widevinecdmadapter",
"//tools/v8_context_snapshot:v8_context_snapshot",
] ]
if (icu_use_data_file) { if (icu_use_data_file) {
@@ -1375,10 +1376,6 @@ 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 = [
@@ -1389,11 +1386,6 @@ if (is_mac) {
mac_framework_bundle("cef_framework") { mac_framework_bundle("cef_framework") {
output_name = cef_framework_name output_name = cef_framework_name
framework_version = "A"
framework_contents = [
"Resources",
]
sources = gypi_paths2.includes_common + sources = gypi_paths2.includes_common +
gypi_paths2.includes_mac + gypi_paths2.includes_mac +
gypi_paths.autogen_cpp_includes + gypi_paths.autogen_cpp_includes +
@@ -1429,11 +1421,11 @@ if (is_mac) {
if (is_component_build) { if (is_component_build) {
# Set up the rpath for the framework so that it can find dylibs in the # Set up the rpath for the framework so that it can find dylibs in the
# root output directory. The framework is at # root output directory. The framework is at
# $app_name.app/Contents/Frameworks/$output_name.framework/Versions/A/$output_name # $app_name.app/Contents/Frameworks/$output_name.framework/$output_name
# so use loader_path to go back to the root output directory. # so use loader_path to go back to the root output directory.
ldflags += [ ldflags += [
"-rpath", "-rpath",
"@loader_path/../../../../../..", "@loader_path/../../../..",
] ]
} }
@@ -1450,7 +1442,6 @@ if (is_mac) {
deps = [ deps = [
":libcef_static", ":libcef_static",
"//build/config:exe_and_shlib_deps",
] ]
if (is_win) { if (is_win) {
@@ -1471,12 +1462,9 @@ if (is_mac) {
] ]
} }
if (is_linux && !is_debug && use_allocator=="none") { if (is_linux && !is_debug && !using_sanitizer && 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 # Don't do this in Debug builds because it causes the resulting application to crash.
# 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") ]
} }
@@ -1865,6 +1853,9 @@ 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/67.0.3396.79', 'chromium_checkout': 'refs/tags/63.0.3239.132',
} }

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 (CEF3) - https://github.com/cefsharp/CefSharp * .Net - https://github.com/chillitom/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

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=67bc21133e37f5361a39f25dcfe004616d467dbc$ # $hash=5f69924ad7517dee8adf933a7c013616ebb94c36$
# #
{ {
@@ -38,6 +38,8 @@
'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',
@@ -129,6 +131,8 @@
'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',
@@ -282,8 +286,14 @@
'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',
@@ -432,8 +442,6 @@
'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',
@@ -564,8 +572,14 @@
'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',
@@ -714,8 +728,6 @@
'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

@@ -159,6 +159,7 @@
'tests/shared/browser/main_message_loop_std.cc', 'tests/shared/browser/main_message_loop_std.cc',
'tests/shared/browser/main_message_loop_std.h', 'tests/shared/browser/main_message_loop_std.h',
'tests/shared/browser/resource_util.h', 'tests/shared/browser/resource_util.h',
'tests/shared/browser/resource_util.h',
], ],
'shared_sources_common': [ 'shared_sources_common': [
'tests/shared/common/client_app.cc', 'tests/shared/common/client_app.cc',
@@ -441,6 +442,7 @@
'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,8 +86,6 @@ 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 warn about code in comments
-Wno-comment # Don't warn about code in comments
) )
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
@@ -199,12 +197,9 @@ 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.
@@ -337,15 +332,12 @@ if(OS_WINDOWS)
option(USE_SANDBOX "Enable or disable use of the sandbox." ON) option(USE_SANDBOX "Enable or disable use of the sandbox." ON)
if(USE_SANDBOX) if(USE_SANDBOX)
# Check if the current MSVC version is compatible with the cef_sandbox.lib # Check if the current MSVC version is compatible with the cef_sandbox.lib
# static library. For a list of all version numbers see # static library.
# https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering
list(APPEND supported_msvc_versions list(APPEND supported_msvc_versions
1900 # VS2015 and updates 1, 2, & 3 1900 # VS2015 and updates 1, 2, & 3
1910 # VS2017 version 15.1 & 15.2 1910 # VS2017 version 15.1 & 15.2
1911 # VS2017 version 15.3 & 15.4 1911 # VS2017 version 15.3 & 15.4
1912 # VS2017 version 15.5 1912 # VS2017 version 15.5
1913 # VS2017 version 15.6
1914 # VS2017 version 15.7
) )
list(FIND supported_msvc_versions ${MSVC_VERSION} _index) list(FIND supported_msvc_versions ${MSVC_VERSION} _index)
if (${_index} EQUAL -1) if (${_index} EQUAL -1)
@@ -357,13 +349,6 @@ 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
@@ -383,10 +368,12 @@ 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=1dbb0adf7ac5fd42b5a79d271834781664a7fd47$ // $hash=2a93a2e7a17c81d39ad1b8c1c1aa93d5d90b1100$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
@@ -48,6 +48,7 @@
#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"
@@ -114,6 +115,13 @@ 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=00e6d1aa80d5998d89cc272dcb199cde0add12fa$ // $hash=e0605a0c9918e225b9282b6d5e6138a7d697945b$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
@@ -159,16 +159,6 @@ 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=e4da4fab11e33d34d70714be22e6f72579586ffe$ // $hash=0a8f009404aedce3f63f83864f754df60c36b293$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_
@@ -129,12 +129,14 @@ extern "C" {
// //
// CrashKeys section: // CrashKeys section:
// //
// A maximum of 26 crash keys of each size can be specified for use by the // Any number of crash keys can be specified for use by the application. Crash
// application. Crash key values will be truncated based on the specified size // key values will be truncated based on the specified size (small = 63 bytes,
// (small = 64 bytes, medium = 256 bytes, large = 1024 bytes). The value of // medium = 252 bytes, large = 1008 bytes). The value of crash keys can be set
// crash keys can be set from any thread or process using the // from any thread or process using the CefSetCrashKeyValue function. These
// CefSetCrashKeyValue function. These key/value pairs will be sent to the crash // key/value pairs will be sent to the crash server along with the crash dump
// server along with the crash dump file. // file. Medium and large values will be chunked for submission. For example, 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_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=c7641e41aca6bf30b9c36092861f061d2b16ff82$ // $hash=68988be0c2e0a1481ee6b27930391976c7041317$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_
@@ -118,7 +118,6 @@ 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);
@@ -132,15 +131,6 @@ 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

@@ -0,0 +1,79 @@
// 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

@@ -0,0 +1,106 @@
// 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=f2f3acb1df9815e4ac9bf34010ce260a2496ae5a$ // $hash=3fb1034cb02cfeddcaf02d8fde0dec5b8a18f416$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
@@ -202,17 +202,6 @@ 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=fb34d81715ada28d5509cd33aa36f37829933a91$ // $hash=44b61ca19efaae0a664d6d502d550755fbf326fa$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_
@@ -102,6 +102,19 @@ 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=95e44047a75693dbae0ab6b07b415d188252bfdf$ // $hash=52ba75e5a733ed0be9a064b9794c0181e714c090$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
@@ -112,15 +112,12 @@ 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. The |user_gesture| value will be true (1) if the browser // ERR_ABORTED.
// 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);
/// ///
@@ -250,29 +247,6 @@ 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=fd2cbc427bccf30298e26dd6c3bcef9551433f8b$ // $hash=561e4711432158fd3da971f3c0240dcf5e8e782a$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_RESPONSE_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_RESPONSE_CAPI_H_
@@ -127,18 +127,6 @@ 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=2303574e76708e5311aede8e66eb7f1f679e0d1f$ // $hash=e9e43167b1cf8033bd7e6ba6931213d7cf4b69b5$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_
@@ -355,25 +355,6 @@ 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
@@ -444,11 +425,6 @@ 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.
/// ///
@@ -663,25 +639,6 @@ 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.
/// ///
@@ -794,21 +751,6 @@ 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

@@ -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=8815d0d0778cc210fb6f9ede9dafc5ca51124169$ // $hash=ec4f722423ff89dd2ff61fd3336bda1776081023$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_WEB_PLUGIN_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_WEB_PLUGIN_CAPI_H_
@@ -202,6 +202,9 @@ CEF_EXPORT void cef_is_web_plugin_unstable(
// 2. widevinecdm file from the CDM binary distribution (e.g. // 2. widevinecdm file from the CDM binary distribution (e.g.
// widevinecdm.dll on on Windows, libwidevinecdm.dylib on OS X, // widevinecdm.dll on on Windows, libwidevinecdm.dylib on OS X,
// libwidevinecdm.so on Linux). // libwidevinecdm.so on Linux).
// 3. widevidecdmadapter file from the CEF binary distribution (e.g.
// widevinecdmadapter.dll on Windows, widevinecdmadapter.plugin on OS X,
// libwidevinecdmadapter.so on Linux).
// //
// If any of these files are missing or if the manifest file has incorrect // If any of these files are missing or if the manifest file has incorrect
// contents the registration will fail and |callback| will receive a |result| // contents the registration will fail and |callback| will receive a |result|

View File

@@ -50,7 +50,7 @@ class CefAuthCallback : public virtual CefBaseRefCounted {
/// ///
// Continue the authentication request. // Continue the authentication request.
/// ///
/*--cef(capi_name=cont,optional_param=username,optional_param=password)--*/ /*--cef(capi_name=cont,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,6 +46,7 @@
#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"
@@ -107,6 +108,15 @@ 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,17 +64,6 @@ 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,12 +121,14 @@
// //
// CrashKeys section: // CrashKeys section:
// //
// A maximum of 26 crash keys of each size can be specified for use by the // Any number of crash keys can be specified for use by the application. Crash
// application. Crash key values will be truncated based on the specified size // key values will be truncated based on the specified size (small = 63 bytes,
// (small = 64 bytes, medium = 256 bytes, large = 1024 bytes). The value of // medium = 252 bytes, large = 1008 bytes). The value of crash keys can be set
// crash keys can be set from any thread or process using the // from any thread or process using the CefSetCrashKeyValue function. These
// CefSetCrashKeyValue function. These key/value pairs will be sent to the crash // key/value pairs will be sent to the crash server along with the crash dump
// server along with the crash dump file. // file. Medium and large values will be chunked for submission. For example,
// 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,7 +109,6 @@ 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) {
@@ -127,14 +126,6 @@ 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_

66
include/cef_geolocation.h Normal file
View File

@@ -0,0 +1,66 @@
// 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

@@ -0,0 +1,92 @@
// 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,16 +204,6 @@ 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,6 +92,20 @@ 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,15 +106,12 @@ 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. The |user_gesture| value will be true if the browser // ERR_ABORTED.
// 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;
} }
@@ -255,33 +252,6 @@ 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,18 +128,6 @@ 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,21 +407,6 @@ 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
@@ -508,22 +493,6 @@ 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
@@ -602,12 +571,6 @@ 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.
/// ///
@@ -830,25 +793,6 @@ 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

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

View File

@@ -94,11 +94,6 @@ typedef enum {
/// ///
LOGSEVERITY_VERBOSE, LOGSEVERITY_VERBOSE,
///
// DEBUG logging.
///
LOGSEVERITY_DEBUG = LOGSEVERITY_VERBOSE,
/// ///
// INFO logging. // INFO logging.
/// ///
@@ -1264,12 +1259,6 @@ 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;
/// ///
@@ -1385,41 +1374,23 @@ 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. Do not perform // CefSettings.multi_threaded_message_loop value of false.
// 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 for blocking tasks (e.g. file system access) where the user won't // Used to interact with the database.
// 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_FILE_BACKGROUND, TID_DB,
TID_FILE = TID_FILE_BACKGROUND,
/// ///
// Used for blocking tasks (e.g. file system access) that affect UI or // Used to interact with the file system.
// 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_USER_VISIBLE, TID_FILE,
/// ///
// Used for blocking tasks (e.g. file system access) that affect UI // Used for file system operations that block user interactions.
// immediately after a user interaction. All tasks posted after // Responsiveness of this thread affects users.
// 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,
@@ -1429,10 +1400,12 @@ typedef enum {
TID_PROCESS_LAUNCHER, TID_PROCESS_LAUNCHER,
/// ///
// Used to process IPC and network messages. Do not perform blocking tasks on // Used to handle slow HTTP cache operations.
// this thread. All tasks posted after ///
// CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown() TID_CACHE,
// are guaranteed to run.
///
// Used to process IPC and network messages.
/// ///
TID_IO, TID_IO,
@@ -1440,10 +1413,6 @@ 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;
@@ -2072,6 +2041,74 @@ 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,6 +832,37 @@ 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,7 +9,6 @@
#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"
@@ -69,9 +68,6 @@ 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() {
@@ -80,9 +76,6 @@ 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,6 +12,7 @@
#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"
@@ -26,11 +27,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"
@@ -39,8 +40,7 @@
#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_resolution/proxy_config_service.h" #include "net/proxy/proxy_config_service.h"
#include "net/proxy_resolution/proxy_resolution_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 = std::make_unique<visitedlink::VisitedLinkEventListener>( auto listener = base::MakeUnique<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)));
} }
@@ -176,11 +176,11 @@ class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener {
// visitedlink::VisitedLinkMaster::Listener methods. // visitedlink::VisitedLinkMaster::Listener methods.
void NewTable(base::ReadOnlySharedMemoryRegion* table_region) override { void NewTable(mojo::SharedBufferHandle table) override {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
ListenerMap::iterator it = listener_map_.begin(); ListenerMap::iterator it = listener_map_.begin();
for (; it != listener_map_.end(); ++it) for (; it != listener_map_.end(); ++it)
it->second->NewTable(table_region); it->second->NewTable(table);
} }
void Add(visitedlink::VisitedLinkCommon::Fingerprint fingerprint) override { void Add(visitedlink::VisitedLinkCommon::Fingerprint fingerprint) override {
@@ -283,8 +283,9 @@ void CefBrowserContextImpl::Initialize() {
visitedlink_master_->Init(); visitedlink_master_->Init();
// Initialize proxy configuration tracker. // Initialize proxy configuration tracker.
pref_proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl( pref_proxy_config_tracker_.reset(
GetPrefs(), BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))); ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
GetPrefs()));
CefBrowserContext::PostInitialize(); CefBrowserContext::PostInitialize();
@@ -419,7 +420,9 @@ CefBrowserContextImpl::GetSSLHostStateDelegate() {
} }
content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() { content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() {
return nullptr; if (!permission_manager_.get())
permission_manager_.reset(new CefPermissionManager(this));
return permission_manager_.get();
} }
content::BackgroundFetchDelegate* content::BackgroundFetchDelegate*
@@ -443,18 +446,10 @@ 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(
pref_proxy_config_tracker_->CreateTrackingProxyConfigService( ProxyServiceFactory::CreateProxyConfigService(
std::move(base_service))); pref_proxy_config_tracker_.get()));
if (extensions::ExtensionsEnabled()) { if (extensions::ExtensionsEnabled()) {
// Handle only chrome-extension:// requests. CEF does not support // Handle only chrome-extension:// requests. CEF does not support
@@ -462,13 +457,17 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
// data in its installation directory). // data in its installation directory).
extensions::InfoMap* extension_info_map = extension_system()->info_map(); extensions::InfoMap* extension_info_map = extension_system()->info_map();
(*protocol_handlers)[extensions::kExtensionScheme] = (*protocol_handlers)[extensions::kExtensionScheme] =
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
extensions::CreateExtensionProtocolHandler(IsOffTheRecord(), extensions::CreateExtensionProtocolHandler(IsOffTheRecord(),
extension_info_map); extension_info_map)
.release());
} }
url_request_getter_ = new CefURLRequestContextGetterImpl( url_request_getter_ = new CefURLRequestContextGetterImpl(
settings_, GetPrefs(), io_thread_runner, protocol_handlers, settings_, GetPrefs(),
std::move(proxy_config_service), std::move(request_interceptors)); BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
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,6 +121,7 @@ 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

@@ -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_request_utils.h" #include "content/public/browser/download_url_parameters.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"
@@ -71,7 +71,7 @@
#include "content/public/common/favicon_url.h" #include "content/public/common/favicon_url.h"
#include "extensions/browser/process_manager.h" #include "extensions/browser/process_manager.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
#include "third_party/blink/public/web/web_find_options.h" #include "third_party/WebKit/public/web/WebFindOptions.h"
#include "ui/events/base_event_utils.h" #include "ui/events/base_event_utils.h"
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
@@ -745,8 +745,8 @@ void CefBrowserHostImpl::StartDownload(const CefString& url) {
if (!manager) if (!manager)
return; return;
std::unique_ptr<download::DownloadUrlParameters> params( std::unique_ptr<content::DownloadUrlParameters> params(
content::DownloadRequestUtils::CreateDownloadForWebContentsMainFrame( content::DownloadUrlParameters::CreateForWebContentsMainFrame(
web_contents(), gurl, NO_TRAFFIC_ANNOTATION_YET)); web_contents(), gurl, NO_TRAFFIC_ANNOTATION_YET));
manager->DownloadUrl(std::move(params)); manager->DownloadUrl(std::move(params));
} }
@@ -999,17 +999,16 @@ void CefBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
return; return;
} }
if (enabled == auto_resize_enabled_) if (!web_contents() || !web_contents()->GetRenderViewHost())
return; return;
auto_resize_enabled_ = enabled;
if (enabled) { if (enabled) {
auto_resize_min_ = gfx::Size(min_size.width, min_size.height); web_contents()->GetRenderViewHost()->EnableAutoResize(
auto_resize_max_ = gfx::Size(max_size.width, max_size.height); gfx::Size(min_size.width, min_size.height),
gfx::Size(max_size.width, max_size.height));
} else { } else {
auto_resize_min_ = auto_resize_max_ = gfx::Size(); web_contents()->GetRenderViewHost()->DisableAutoResize(gfx::Size());
} }
ConfigureAutoResize();
} }
CefRefPtr<CefExtension> CefBrowserHostImpl::GetExtension() { CefRefPtr<CefExtension> CefBrowserHostImpl::GetExtension() {
@@ -1584,20 +1583,15 @@ void CefBrowserHostImpl::CancelContextMenu() {
} }
CefRefPtr<CefFrame> CefBrowserHostImpl::GetFrameForRequest( CefRefPtr<CefFrame> CefBrowserHostImpl::GetFrameForRequest(
const net::URLRequest* request) { 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(), is_main_frame_state_flaky, info->IsMainFrame(), base::string16(), GURL());
base::string16(), GURL());
} }
void CefBrowserHostImpl::Navigate(const CefNavigateParams& params) { void CefBrowserHostImpl::Navigate(const CefNavigateParams& params) {
@@ -2225,16 +2219,6 @@ 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();
@@ -2292,24 +2276,8 @@ 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())
// Use LOGSEVERITY_DEBUG for unrecognized |level| values. return handler->OnConsoleMessage(this, message, source_id, line_no);
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;
@@ -2587,7 +2555,7 @@ void CefBrowserHostImpl::RequestMediaAccessPermission(
} }
bool CefBrowserHostImpl::CheckMediaAccessPermission( bool CefBrowserHostImpl::CheckMediaAccessPermission(
content::RenderFrameHost* render_frame_host, content::WebContents* web_contents,
const GURL& security_origin, const GURL& security_origin,
content::MediaStreamType type) { content::MediaStreamType type) {
// Check media access permission without prompting the user. This is called // Check media access permission without prompting the user. This is called
@@ -2705,8 +2673,6 @@ void CefBrowserHostImpl::RenderViewDeleted(
} }
void CefBrowserHostImpl::RenderViewReady() { void CefBrowserHostImpl::RenderViewReady() {
ConfigureAutoResize();
// Send the queued messages. // Send the queued messages.
queue_messages_ = false; queue_messages_ = false;
while (!queued_messages_.empty()) { while (!queued_messages_.empty()) {
@@ -2762,7 +2728,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,
false, base::string16(), url); 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.
@@ -2810,7 +2776,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,
false, base::string16(), validated_url); 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);
} }
@@ -2936,7 +2902,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, false, name, GURL()); is_main_frame, name, GURL());
} }
void CefBrowserHostImpl::OnFrameFocused( void CefBrowserHostImpl::OnFrameFocused(
@@ -2978,7 +2944,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,
false, base::string16(), validated_url); 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);
@@ -3227,7 +3193,6 @@ 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|.
@@ -3248,13 +3213,12 @@ 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 || is_main_frame_state_flaky) && if (is_main_frame && main_frame_id_ != CefFrameHostImpl::kInvalidFrameId) {
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 || is_main_frame_state_flaky) { if (is_main_frame) {
// 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;
} }
@@ -3322,27 +3286,9 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetOrCreateFrame(
} }
} }
if (!frame_created && !is_main_frame_state_flaky) if (!frame_created)
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();
} }
@@ -3513,20 +3459,6 @@ void CefBrowserHostImpl::EnsureFileDialogManager() {
} }
} }
void CefBrowserHostImpl::ConfigureAutoResize() {
CEF_REQUIRE_UIT();
if (!web_contents() || !web_contents()->GetRenderWidgetHostView()) {
return;
}
if (auto_resize_enabled_) {
web_contents()->GetRenderWidgetHostView()->EnableAutoResize(
auto_resize_min_, auto_resize_max_);
} else {
web_contents()->GetRenderWidgetHostView()->DisableAutoResize(gfx::Size());
}
}
bool CefBrowserHostImpl::Send(IPC::Message* message) { bool CefBrowserHostImpl::Send(IPC::Message* message) {
if (!CEF_CURRENTLY_ON_UIT()) { if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK( CEF_POST_TASK(

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(const net::URLRequest* request); CefRefPtr<CefFrame> GetFrameForRequest(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,8 +407,6 @@ 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,
@@ -473,13 +471,14 @@ class CefBrowserHostImpl : public CefBrowserHost,
content::WebContents* web_contents, content::WebContents* web_contents,
const content::MediaStreamRequest& request, const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback) override; const content::MediaResponseCallback& callback) override;
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host, bool CheckMediaAccessPermission(content::WebContents* web_contents,
const GURL& security_origin, const GURL& security_origin,
content::MediaStreamType type) override; content::MediaStreamType type) override;
bool IsNeverVisible(content::WebContents* web_contents) override; bool IsNeverVisible(content::WebContents* web_contents) override;
// 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;
@@ -586,13 +585,11 @@ 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. If |is_main_frame_state_flaky| is true // returned depending on current state.
// 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);
@@ -626,8 +623,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
// Create the CefFileDialogManager if it doesn't already exist. // Create the CefFileDialogManager if it doesn't already exist.
void EnsureFileDialogManager(); void EnsureFileDialogManager();
void ConfigureAutoResize();
// Send a message to the RenderViewHost associated with this browser. // Send a message to the RenderViewHost associated with this browser.
// TODO(cef): With the introduction of OOPIFs, WebContents can span multiple // TODO(cef): With the introduction of OOPIFs, WebContents can span multiple
// processes. Messages should be sent to specific RenderFrameHosts instead. // processes. Messages should be sent to specific RenderFrameHosts instead.
@@ -729,11 +724,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
CefRefPtr<CefExtension> extension_; CefRefPtr<CefExtension> extension_;
bool is_background_host_ = false; bool is_background_host_ = false;
// Used with auto-resize.
bool auto_resize_enabled_ = false;
gfx::Size auto_resize_min_;
gfx::Size auto_resize_max_;
IMPLEMENT_REFCOUNTING(CefBrowserHostImpl); IMPLEMENT_REFCOUNTING(CefBrowserHostImpl);
DISALLOW_COPY_AND_ASSIGN(CefBrowserHostImpl); DISALLOW_COPY_AND_ASSIGN(CefBrowserHostImpl);
}; };

View File

@@ -154,7 +154,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
window_info->SetAsPopup(NULL, CefString()); window_info->SetAsPopup(NULL, CefString());
#endif #endif
auto pending_popup = std::make_unique<CefBrowserInfoManager::PendingPopup>(); auto pending_popup = base::MakeUnique<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

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

View File

@@ -9,11 +9,12 @@
#include <string> #include <string>
#include "libcef/browser/browser_context_impl.h" #include "libcef/browser/browser_context_impl.h"
#include "libcef/browser/browser_context_keyed_service_factories.h" #include "libcef/browser/browser_context_proxy.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"
@@ -24,13 +25,16 @@
#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/result_codes.h" #include "content/public/common/content_switches.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"
@@ -60,32 +64,21 @@ 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)
delete chrome_extra_parts_[i]; void CefBrowserMainParts::PreMainMessageLoopStart() {
chrome_extra_parts_.clear(); if (!base::MessageLoop::current()) {
// Create the browser message loop.
message_loop_.reset(new CefBrowserMessageLoop());
}
} }
void CefBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) { void CefBrowserMainParts::PreEarlyInitialization() {
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() {
@@ -101,19 +94,6 @@ 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() {
@@ -123,9 +103,6 @@ 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() {
@@ -139,26 +116,14 @@ 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.
@@ -168,25 +133,14 @@ 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);
@@ -196,21 +150,12 @@ 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() {
@@ -226,9 +171,6 @@ 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() {
@@ -237,23 +179,3 @@ 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,51 +37,26 @@ 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();
@@ -95,22 +70,10 @@ 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

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

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 std::make_unique<CefBrowserPlatformDelegateNativeWin>( return base::MakeUnique<CefBrowserPlatformDelegateNativeWin>(
window_info, background_color); window_info, background_color);
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
return std::make_unique<CefBrowserPlatformDelegateNativeMac>( return base::MakeUnique<CefBrowserPlatformDelegateNativeMac>(
window_info, background_color); window_info, background_color);
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
return std::make_unique<CefBrowserPlatformDelegateNativeLinux>( return base::MakeUnique<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 std::make_unique<CefBrowserPlatformDelegateOsrWin>( return base::MakeUnique<CefBrowserPlatformDelegateOsrWin>(
std::move(native_delegate)); std::move(native_delegate));
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
return std::make_unique<CefBrowserPlatformDelegateOsrMac>( return base::MakeUnique<CefBrowserPlatformDelegateOsrMac>(
std::move(native_delegate)); std::move(native_delegate));
#elif defined(OS_LINUX) #elif defined(OS_LINUX)
return std::make_unique<CefBrowserPlatformDelegateOsrLinux>( return base::MakeUnique<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 std::make_unique<CefBrowserPlatformDelegateBackground>( return base::MakeUnique<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 std::make_unique<CefBrowserPlatformDelegateViews>( return base::MakeUnique<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,9 +356,6 @@ 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 "services/network/public/cpp/network_switches.h" #include "ui/message_center/message_center.h"
ChromeBrowserProcessStub::ChromeBrowserProcessStub() ChromeBrowserProcessStub::ChromeBrowserProcessStub()
: initialized_(false), : initialized_(false),
@@ -96,7 +96,12 @@ metrics::MetricsService* ChromeBrowserProcessStub::metrics_service() {
} }
rappor::RapporServiceImpl* ChromeBrowserProcessStub::rappor_service() { rappor::RapporServiceImpl* ChromeBrowserProcessStub::rappor_service() {
// Called from PluginInfoHostImpl::ReportMetrics. NOTREACHED();
return NULL;
}
ukm::UkmRecorder* ChromeBrowserProcessStub::ukm_recorder() {
NOTREACHED();
return NULL; return NULL;
} }
@@ -110,12 +115,6 @@ 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;
@@ -165,7 +164,12 @@ ChromeBrowserProcessStub::notification_platform_bridge() {
return NULL; return NULL;
} }
policy::ChromeBrowserPolicyConnector* message_center::MessageCenter* ChromeBrowserProcessStub::message_center() {
NOTREACHED();
return NULL;
}
policy::BrowserPolicyConnector*
ChromeBrowserProcessStub::browser_policy_connector() { ChromeBrowserProcessStub::browser_policy_connector() {
NOTREACHED(); NOTREACHED();
return NULL; return NULL;
@@ -186,7 +190,14 @@ GpuModeManager* ChromeBrowserProcessStub::gpu_mode_manager() {
return NULL; return NULL;
} }
void ChromeBrowserProcessStub::CreateDevToolsProtocolHandler() { GpuProfileCache* ChromeBrowserProcessStub::gpu_profile_cache() {
NOTREACHED();
return NULL;
}
void ChromeBrowserProcessStub::CreateDevToolsHttpProtocolHandler(
const std::string& ip,
uint16_t port) {
NOTREACHED(); NOTREACHED();
} }
@@ -274,12 +285,6 @@ 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
@@ -289,10 +294,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_ = std::make_unique<net_log::ChromeNetLog>(); net_log_ = base::MakeUnique<net_log::ChromeNetLog>();
if (command_line.HasSwitch(network::switches::kLogNetLog)) { if (command_line.HasSwitch(switches::kLogNetLog)) {
net_log_->StartWritingToFile( net_log_->StartWritingToFile(
command_line.GetSwitchValuePath(network::switches::kLogNetLog), command_line.GetSwitchValuePath(switches::kLogNetLog),
GetNetCaptureModeFromCommandLine(command_line), GetNetCaptureModeFromCommandLine(command_line),
command_line.GetCommandLineString(), std::string()); command_line.GetCommandLineString(), std::string());
} }
@@ -306,6 +311,11 @@ 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

@@ -16,7 +16,7 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/event_router_forwarder.h" #include "chrome/browser/extensions/event_router_forwarder.h"
#include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/incognito_helpers.h"
#include "media/media_buildflags.h" #include "media/media_features.h"
class ChromeProfileManagerStub; class ChromeProfileManagerStub;
@@ -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,11 +59,14 @@ 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;
policy::ChromeBrowserPolicyConnector* browser_policy_connector() override; message_center::MessageCenter* message_center() 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;
void CreateDevToolsProtocolHandler() override; GpuProfileCache* gpu_profile_cache() 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;
@@ -84,8 +87,6 @@ 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;
@@ -93,6 +94,7 @@ 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,6 +33,7 @@ void ChromeProfileStub::DestroyOffTheRecordProfile() {
} }
bool ChromeProfileStub::HasOffTheRecordProfile() { bool ChromeProfileStub::HasOffTheRecordProfile() {
NOTREACHED();
return false; return false;
} }
@@ -40,10 +41,6 @@ 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;
} }
@@ -100,11 +97,22 @@ 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,7 +27,6 @@ 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;
@@ -39,7 +38,10 @@ 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,6 +19,8 @@
#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"
@@ -41,16 +43,11 @@
#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/browser_process.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/renderer_host/pepper/chrome_browser_pepper_host_factory.h" #include "chrome/browser/spellchecker/spell_check_host_impl.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"
@@ -76,9 +73,7 @@
#include "content/public/common/service_names.mojom.h" #include "content/public/common/service_names.mojom.h"
#include "content/public/common/storage_quota_params.h" #include "content/public/common/storage_quota_params.h"
#include "content/public/common/web_preferences.h" #include "content/public/common/web_preferences.h"
#include "extensions/browser/api/web_request/web_request_api.h"
#include "extensions/browser/extension_message_filter.h" #include "extensions/browser/extension_message_filter.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_registry.h"
#include "extensions/browser/extensions_browser_client.h" #include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h" #include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
@@ -87,9 +82,9 @@
#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/service_manager/public/mojom/connector.mojom.h" #include "services/proxy_resolver/public/interfaces/proxy_resolver.mojom.h"
#include "storage/browser/quota/quota_settings.h" #include "storage/browser/quota/quota_settings.h"
#include "third_party/blink/public/web/web_window_features.h" #include "third_party/WebKit/public/web/WebWindowFeatures.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_switches.h" #include "ui/base/ui_base_switches.h"
@@ -99,6 +94,10 @@
#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"
@@ -292,7 +291,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 != blink::mojom::StorageType::kPersistent) { if (params.storage_type != storage::kStorageTypePersistent) {
// 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);
@@ -429,8 +428,7 @@ bool NavigationOnUIThread(
request->SetReadOnly(true); request->SetReadOnly(true);
ignore_navigation = handler->OnBeforeBrowse( ignore_navigation = handler->OnBeforeBrowse(
browser.get(), frame, request.get(), params.has_user_gesture(), browser.get(), frame, request.get(), params.is_redirect());
params.is_redirect());
} }
} }
} }
@@ -450,8 +448,6 @@ 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());
} }
@@ -459,20 +455,28 @@ 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(
@@ -489,16 +493,6 @@ 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(
@@ -596,22 +590,11 @@ 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);
} }
@@ -640,8 +623,6 @@ 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},
}); });
} }
@@ -665,6 +646,7 @@ 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,
@@ -682,17 +664,11 @@ 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::kDisableExtensions, switches::kDisablePdfExtension,
switches::kDisablePdfExtension, switches::kDisableScrollBounce, switches::kDisableSpellChecking,
switches::kDisablePlugins, switches::kEnableSpeechInput, switches::kEnableSystemFlash,
switches::kDisableScrollBounce, switches::kPpapiFlashArgs, switches::kPpapiFlashPath,
switches::kDisableSpellChecking, switches::kPpapiFlashVersion, switches::kUncaughtExceptionStackSize,
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));
@@ -709,14 +685,6 @@ 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)
@@ -732,7 +700,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS) #if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
if (!browser_cmd->HasSwitch(switches::kNoSandbox)) { if (!browser_cmd->HasSwitch(switches::kNoSandbox)) {
// Pass the Widevine CDM path to the Zygote process. See comments in // Pass the Widevine CDM path to the Zygote process. See comments in
// CefWidevineLoader::AddContentDecryptionModules. // CefWidevineLoader::AddPepperPlugins.
const base::FilePath& cdm_path = CefWidevineLoader::GetInstance()->path(); const base::FilePath& cdm_path = CefWidevineLoader::GetInstance()->path();
if (!cdm_path.empty()) if (!cdm_path.empty())
command_line->AppendSwitchPath(switches::kWidevineCdmPath, cdm_path); command_line->AppendSwitchPath(switches::kWidevineCdmPath, cdm_path);
@@ -762,10 +730,6 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
} }
} }
std::string CefContentBrowserClient::GetApplicationLocale() {
return g_browser_process->GetApplicationLocale();
}
content::QuotaPermissionContext* content::QuotaPermissionContext*
CefContentBrowserClient::CreateQuotaPermissionContext() { CefContentBrowserClient::CreateQuotaPermissionContext() {
return new CefQuotaPermissionContext(); return new CefQuotaPermissionContext();
@@ -934,7 +898,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 ChromeBrowserPepperHostFactory(browser_host))); new CefBrowserPepperHostFactory(browser_host)));
} }
content::DevToolsManagerDelegate* content::DevToolsManagerDelegate*
@@ -971,7 +935,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
} }
std::unique_ptr<content::NavigationThrottle> throttle = std::unique_ptr<content::NavigationThrottle> throttle =
std::make_unique<navigation_interception::InterceptNavigationThrottle>( base::MakeUnique<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));
@@ -979,7 +943,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
return throttles; return throttles;
} }
#if defined(OS_LINUX) #if defined(OS_POSIX) && !defined(OS_MACOSX)
void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess( void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line, const base::CommandLine& command_line,
int child_process_id, int child_process_id,
@@ -989,7 +953,7 @@ void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
mappings->Share(kCrashDumpSignal, crash_signal_fd); mappings->Share(kCrashDumpSignal, crash_signal_fd);
} }
} }
#endif // defined(OS_LINUX) #endif // defined(OS_POSIX) && !defined(OS_MACOSX)
#if defined(OS_WIN) #if defined(OS_WIN)
const wchar_t* CefContentBrowserClient::GetResourceDllName() { const wchar_t* CefContentBrowserClient::GetResourceDllName() {
@@ -1015,83 +979,18 @@ bool CefContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy) {
void CefContentBrowserClient::ExposeInterfacesToRenderer( void CefContentBrowserClient::ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry, service_manager::BinderRegistry* registry,
blink::AssociatedInterfaceRegistry* associated_registry, content::AssociatedInterfaceRegistry* associated_registry,
content::RenderProcessHost* host) { content::RenderProcessHost* render_process_host) {
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); const base::CommandLine* command_line =
host->GetChannel()->AddAssociatedInterfaceForIOThread(base::Bind( base::CommandLine::ForCurrentProcess();
&PluginInfoHostImpl::OnPluginInfoHostRequest, scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
base::MakeRefCounted<PluginInfoHostImpl>(host->GetID(), profile))); content::BrowserThread::GetTaskRunnerForThread(
} content::BrowserThread::UI);
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
std::unique_ptr<net::ClientCertStore> registry->AddInterface(
CefContentBrowserClient::CreateClientCertStore( base::Bind(&SpellCheckHostImpl::Create, render_process_host->GetID()),
content::ResourceContext* resource_context) { ui_task_runner);
if (!resource_context) }
return nullptr;
return static_cast<CefResourceContext*>(resource_context)
->CreateClientCertStore();
}
void CefContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
content::RenderFrameHost* frame_host,
NonNetworkURLLoaderFactoryMap* factories) {
if (!extensions::ExtensionsEnabled())
return;
content::BrowserContext* browser_context =
frame_host->GetProcess()->GetBrowserContext();
factories->emplace(
extensions::kExtensionScheme,
extensions::CreateExtensionNavigationURLLoaderFactory(
frame_host,
extensions::ExtensionSystem::Get(browser_context)->info_map()));
}
void CefContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
content::RenderFrameHost* frame_host,
const GURL& frame_url,
NonNetworkURLLoaderFactoryMap* factories) {
if (!extensions::ExtensionsEnabled())
return;
content::BrowserContext* browser_context =
frame_host->GetProcess()->GetBrowserContext();
auto factory = extensions::MaybeCreateExtensionSubresourceURLLoaderFactory(
frame_host, frame_url,
extensions::ExtensionSystem::Get(browser_context)->info_map());
if (factory)
factories->emplace(extensions::kExtensionScheme, std::move(factory));
}
bool CefContentBrowserClient::WillCreateURLLoaderFactory(
content::RenderFrameHost* frame,
bool is_navigation,
network::mojom::URLLoaderFactoryRequest* factory_request) {
if (!extensions::ExtensionsEnabled())
return false;
auto* web_request_api =
extensions::BrowserContextKeyedAPIFactory<extensions::WebRequestAPI>::Get(
frame->GetProcess()->GetBrowserContext());
return web_request_api->MaybeProxyURLLoaderFactory(frame, is_navigation,
factory_request);
}
bool CefContentBrowserClient::HandleExternalProtocol(
const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
int child_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture) {
CEF_POST_TASK(
CEF_UIT,
base::Bind(
base::IgnoreResult(
&CefContentBrowserClient::HandleExternalProtocolOnUIThread),
url, web_contents_getter));
return false;
} }
void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) { void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
@@ -1113,21 +1012,6 @@ 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 =
@@ -1137,18 +1021,3 @@ const extensions::Extension* CefContentBrowserClient::GetExtension(
return registry->enabled_extensions().GetExtensionOrAppByURL( return registry->enabled_extensions().GetExtensionOrAppByURL(
site_instance->GetSiteURL()); site_instance->GetSiteURL());
} }
// static
void CefContentBrowserClient::HandleExternalProtocolOnUIThread(
const GURL& url,
const content::ResourceRequestInfo::WebContentsGetter&
web_contents_getter) {
CEF_REQUIRE_UIT();
content::WebContents* web_contents = web_contents_getter.Run();
if (web_contents) {
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForContents(web_contents);
if (browser.get())
browser->HandleExternalProtocol(url);
}
}

View File

@@ -43,15 +43,12 @@ 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( void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
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;
@@ -60,7 +57,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
content::BrowserContext* context2) override; content::BrowserContext* context2) override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line, void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override; int child_process_id) override;
std::string GetApplicationLocale() override;
content::QuotaPermissionContext* CreateQuotaPermissionContext() override; content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
void GetQuotaSettings( void GetQuotaSettings(
content::BrowserContext* context, content::BrowserContext* context,
@@ -108,7 +104,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
CreateThrottlesForNavigation( CreateThrottlesForNavigation(
content::NavigationHandle* navigation_handle) override; content::NavigationHandle* navigation_handle) override;
#if defined(OS_LINUX) #if defined(OS_POSIX) && !defined(OS_MACOSX)
void GetAdditionalMappedFilesForChildProcess( void GetAdditionalMappedFilesForChildProcess(
const base::CommandLine& command_line, const base::CommandLine& command_line,
int child_process_id, int child_process_id,
@@ -122,53 +118,20 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
void ExposeInterfacesToRenderer( void ExposeInterfacesToRenderer(
service_manager::BinderRegistry* registry, service_manager::BinderRegistry* registry,
blink::AssociatedInterfaceRegistry* associated_registry, content::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;
void RegisterNonNetworkNavigationURLLoaderFactories(
content::RenderFrameHost* frame_host,
NonNetworkURLLoaderFactoryMap* factories) override;
void RegisterNonNetworkSubresourceURLLoaderFactories(
content::RenderFrameHost* frame_host,
const GURL& frame_url,
NonNetworkURLLoaderFactoryMap* factories) override;
bool WillCreateURLLoaderFactory(
content::RenderFrameHost* frame,
bool is_navigation,
network::mojom::URLLoaderFactoryRequest* factory_request) override;
bool HandleExternalProtocol(
const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
int child_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture) override;
// Perform browser process registration for the custom scheme. // 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(
content::SiteInstance* site_instance); content::SiteInstance* site_instance);
static void HandleExternalProtocolOnUIThread(
const GURL& url,
const content::ResourceRequestInfo::WebContentsGetter&
web_contents_getter);
CefBrowserMainParts* browser_main_parts_; CefBrowserMainParts* browser_main_parts_;
std::unique_ptr<content::PluginServiceFilter> plugin_service_filter_; std::unique_ptr<content::PluginServiceFilter> plugin_service_filter_;

View File

@@ -120,8 +120,7 @@ net::CookieStore* GetExistingCookieStoreHelper(
} // namespace } // namespace
CefCookieManagerImpl::CefCookieManagerImpl(bool is_blocking) CefCookieManagerImpl::CefCookieManagerImpl() : weak_ptr_factory_(this) {}
: is_blocking_(is_blocking), weak_ptr_factory_(this) {}
CefCookieManagerImpl::~CefCookieManagerImpl() { CefCookieManagerImpl::~CefCookieManagerImpl() {
CEF_REQUIRE_IOT(); CEF_REQUIRE_IOT();
@@ -132,7 +131,6 @@ 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(
@@ -162,7 +160,7 @@ void CefCookieManagerImpl::GetCookieStore(
return; return;
} }
DCHECK(is_blocking_ || cookie_store_.get()); DCHECK(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
@@ -194,8 +192,6 @@ net::CookieStore* CefCookieManagerImpl::GetExistingCookieStore() {
return cookie_store; return cookie_store;
} }
DCHECK(is_blocking_);
if (!is_blocking_)
LOG(ERROR) << "Cookie store does not exist"; LOG(ERROR) << "Cookie store does not exist";
return nullptr; return nullptr;
} }
@@ -303,10 +299,7 @@ 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),
// Intentionally using the background task runner exposed by CEF to BrowserThread::GetTaskRunnerForThread(BrowserThread::DB),
// 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";
@@ -502,11 +495,12 @@ void CefCookieManagerImpl::SetSupportedSchemesInternal(
return; return;
} }
DCHECK(is_blocking_ || cookie_store_.get()); DCHECK(cookie_store_.get());
if (cookie_store_) { if (!cookie_store_.get())
return;
supported_schemes_ = schemes; supported_schemes_ = schemes;
SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_); SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_);
}
RunAsyncCompletionOnIOThread(callback); RunAsyncCompletionOnIOThread(callback);
} }
@@ -558,13 +552,8 @@ 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();
@@ -575,15 +564,13 @@ 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->SetCanonicalCookieAsync( cookie_store->SetCookieWithDetailsAsync(
net::CanonicalCookie::CreateSanitizedCookie(
url, name, value, domain, path, url, name, value, domain, path,
base::Time(), // Creation time. base::Time(), // Creation time.
expiration_time, expiration_time,
base::Time(), // Last access time. base::Time(), // Last access time.
cookie.secure ? true : false, cookie.httponly ? true : false, cookie.secure ? true : false, cookie.httponly ? true : false,
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT), net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT,
cookie.secure ? true : false, cookie.httponly ? true : false,
base::Bind(SetCookieCallbackImpl, callback)); base::Bind(SetCookieCallbackImpl, callback));
} }
@@ -595,13 +582,8 @@ 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.
@@ -626,10 +608,8 @@ 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));
} }
@@ -649,11 +629,6 @@ 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,
@@ -665,8 +640,7 @@ CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
return NULL; return NULL;
} }
CefRefPtr<CefCookieManagerImpl> cookie_manager = CefRefPtr<CefCookieManagerImpl> cookie_manager = new CefCookieManagerImpl();
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,11 +18,10 @@
// Implementation of the CefCookieManager interface. // Implementation of the CefCookieManager interface.
class CefCookieManagerImpl : public CefCookieManager { class CefCookieManagerImpl : public CefCookieManager {
public: public:
explicit CefCookieManagerImpl(bool is_blocking); CefCookieManagerImpl();
~CefCookieManagerImpl() override; ~CefCookieManagerImpl() override;
// Must be called immediately after this object is created when |is_blocking| // Must be called immediately after this object is created.
// 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,
@@ -114,9 +113,6 @@ 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

@@ -100,7 +100,7 @@ int ResponseWriter::Finish(int net_error,
} }
static std::string GetFrontendURL() { static std::string GetFrontendURL() {
return base::StringPrintf("%s://%s/devtools_app.html", return base::StringPrintf("%s://%s/inspector.html",
content::kChromeDevToolsScheme, content::kChromeDevToolsScheme,
scheme::kChromeDevToolsHost); scheme::kChromeDevToolsHost);
} }
@@ -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(inspected_contents_->GetFocusedFrame(), x, y); agent_host_->InspectElement(this, 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(inspected_contents_->GetFocusedFrame(), agent_host_->InspectElement(this, inspect_element_at_.x,
inspect_element_at_.x, inspect_element_at_.y); inspect_element_at_.y);
} }
} }
} }
@@ -240,8 +240,27 @@ 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;
@@ -256,7 +275,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 (!agent_host_ || !params->GetString(0, &protocol_message)) if (!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") {
@@ -342,8 +361,6 @@ 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") {
@@ -392,7 +409,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 = std::make_unique<base::DictionaryValue>(); auto headers = base::MakeUnique<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);
@@ -438,7 +455,8 @@ 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,17 +58,19 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
return frontend_browser_; return frontend_browser_;
} }
private: protected:
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) override; void AgentHostClosed(content::DevToolsAgentHost* agent_host,
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 HandleMessageFromDevToolsFrontend(const std::string& message); void SetPreferences(const std::string& json);
virtual void HandleMessageFromDevToolsFrontend(const std::string& message);
private: private:
// WebContentsObserver overrides // WebContentsObserver overrides

View File

@@ -105,12 +105,8 @@ void CefDevToolsManagerDelegate::StartHttpHandler(
if (!socket_factory) if (!socket_factory)
return; return;
content::DevToolsAgentHost::StartRemoteDebuggingServer( content::DevToolsAgentHost::StartRemoteDebuggingServer(
std::move(socket_factory), browser_context->GetPath(), base::FilePath()); std::move(socket_factory), std::string(), browser_context->GetPath(),
base::FilePath());
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kRemoteDebuggingPipe))
content::DevToolsAgentHost::StartRemoteDebuggingPipeHandler();
} }
// static // static
@@ -137,6 +133,7 @@ std::string CefDevToolsManagerDelegate::GetDiscoveryPageHTML() {
.as_string(); .as_string();
} }
bool CefDevToolsManagerDelegate::HasBundledFrontendResources() { std::string CefDevToolsManagerDelegate::GetFrontendResource(
return true; const std::string& path) {
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;
bool HasBundledFrontendResources() override; std::string GetFrontendResource(const std::string& path) 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 "components/download/public/common/download_item.h" #include "content/public/browser/download_item.h"
#include "url/gurl.h" #include "url/gurl.h"
CefDownloadItemImpl::CefDownloadItemImpl(download::DownloadItem* value) CefDownloadItemImpl::CefDownloadItemImpl(content::DownloadItem* value)
: CefValueBase<CefDownloadItem, download::DownloadItem>( : CefValueBase<CefDownloadItem, content::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() == download::DownloadItem::IN_PROGRESS; return const_value().GetState() == content::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() == download::DownloadItem::COMPLETE; return const_value().GetState() == content::DownloadItem::COMPLETE;
} }
bool CefDownloadItemImpl::IsCanceled() { bool CefDownloadItemImpl::IsCanceled() {
CEF_VALUE_VERIFY_RETURN(false, false); CEF_VALUE_VERIFY_RETURN(false, false);
return const_value().GetState() == download::DownloadItem::CANCELLED; return const_value().GetState() == content::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 download { namespace content {
class DownloadItem; class DownloadItem;
} }
// CefDownloadItem implementation // CefDownloadItem implementation
class CefDownloadItemImpl class CefDownloadItemImpl
: public CefValueBase<CefDownloadItem, download::DownloadItem> { : public CefValueBase<CefDownloadItem, content::DownloadItem> {
public: public:
explicit CefDownloadItemImpl(download::DownloadItem* value); explicit CefDownloadItemImpl(content::DownloadItem* value);
// CefDownloadItem methods. // CefDownloadItem methods.
bool IsValid() override; bool IsValid() override;

View File

@@ -15,12 +15,11 @@
#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 download::DownloadItem; using content::DownloadItem;
using content::DownloadManager; using content::DownloadManager;
using content::WebContents; using content::WebContents;
@@ -54,9 +53,11 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
if (manager_) { if (manager_) {
base::FilePath path = base::FilePath(download_path); base::FilePath path = base::FilePath(download_path);
CEF_POST_USER_VISIBLE_TASK(base::Bind( CEF_POST_TASK(
&CefBeforeDownloadCallbackImpl::GenerateFilename, manager_, CEF_FILET,
download_id_, suggested_name_, path, show_dialog, callback_)); base::Bind(&CefBeforeDownloadCallbackImpl::GenerateFilename,
manager_, download_id_, suggested_name_, path,
show_dialog, callback_));
} }
download_id_ = 0; download_id_ = 0;
@@ -76,8 +77,6 @@ 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.
@@ -115,14 +114,13 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
return; return;
DownloadItem* item = manager->GetDownload(download_id); DownloadItem* item = manager->GetDownload(download_id);
if (!item || item->GetState() != DownloadItem::IN_PROGRESS) if (!item || item->GetState() != content::DownloadItem::IN_PROGRESS)
return; return;
bool handled = false; bool handled = false;
if (show_dialog) { if (show_dialog) {
WebContents* web_contents = WebContents* web_contents = item->GetWebContents();
content::DownloadItemUtils::GetWebContents(item);
CefRefPtr<CefBrowserHostImpl> browser = CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForContents(web_contents); CefBrowserHostImpl::GetBrowserForContents(web_contents);
if (browser.get()) { if (browser.get()) {
@@ -148,8 +146,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,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, suggested_path, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, suggested_path,
download::DOWNLOAD_INTERRUPT_REASON_NONE); content::DOWNLOAD_INTERRUPT_REASON_NONE);
} }
} }
@@ -165,8 +163,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,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
download::DOWNLOAD_INTERRUPT_REASON_NONE); content::DOWNLOAD_INTERRUPT_REASON_NONE);
} }
base::WeakPtr<DownloadManager> manager_; base::WeakPtr<DownloadManager> manager_;
@@ -208,7 +206,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() == DownloadItem::IN_PROGRESS) if (item && item->GetState() == content::DownloadItem::IN_PROGRESS)
item->Cancel(true); item->Cancel(true);
} }
@@ -221,7 +219,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() == DownloadItem::IN_PROGRESS) if (item && item->GetState() == content::DownloadItem::IN_PROGRESS)
item->Pause(); item->Pause();
} }
} }
@@ -318,8 +316,7 @@ 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 = content::WebContents* contents = item->GetWebContents();
content::DownloadItemUtils::GetWebContents(item);
if (contents) { if (contents) {
browser = CefBrowserHostImpl::GetBrowserForContents(contents).get(); browser = CefBrowserHostImpl::GetBrowserForContents(contents).get();
DCHECK(browser); DCHECK(browser);
@@ -363,8 +360,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,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, item->GetForcedFilePath(), content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, item->GetForcedFilePath(),
download::DOWNLOAD_INTERRUPT_REASON_NONE); content::DOWNLOAD_INTERRUPT_REASON_NONE);
return true; return true;
} }
@@ -422,6 +419,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(!content::DownloadItemUtils::GetWebContents(item)); DCHECK(!item->GetWebContents());
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 "components/download/public/common/download_item.h" #include "content/public/browser/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 download::DownloadItem::Observer, class CefDownloadManagerDelegate : public content::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 download::DownloadItem::Observer,
private: private:
// DownloadItem::Observer methods. // DownloadItem::Observer methods.
void OnDownloadUpdated(download::DownloadItem* item) override; void OnDownloadUpdated(content::DownloadItem* item) override;
void OnDownloadDestroyed(download::DownloadItem* item) override; void OnDownloadDestroyed(content::DownloadItem* item) override;
// DownloadManager::Observer methods. // DownloadManager::Observer methods.
void OnDownloadCreated(content::DownloadManager* manager, void OnDownloadCreated(content::DownloadManager* manager,
download::DownloadItem* item) override; content::DownloadItem* item) override;
void ManagerGoingDown(content::DownloadManager* manager) override; void ManagerGoingDown(content::DownloadManager* manager) override;
// DownloadManagerDelegate methods. // DownloadManagerDelegate methods.
bool DetermineDownloadTarget( bool DetermineDownloadTarget(
download::DownloadItem* item, content::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(download::DownloadItem* item); CefBrowserHostImpl* GetBrowser(content::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 download::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<download::DownloadItem*, CefBrowserHostImpl*> ItemBrowserMap; typedef std::map<content::DownloadItem*, CefBrowserHostImpl*> ItemBrowserMap;
ItemBrowserMap item_browser_map_; ItemBrowserMap item_browser_map_;
DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate); DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate);

View File

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

View File

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

View File

@@ -2,34 +2,26 @@
// 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/browser_context_keyed_service_factories.h" #include "libcef/browser/extensions/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();
SpellcheckServiceFactory::GetInstance(); RendererStartupHelperFactory::GetInstance();
ThemeServiceFactory::GetInstance(); StorageFrontend::GetFactoryInstance();
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,9 +2,10 @@
// 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_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_ #ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_ #define CEF_LIBCEF_BROWSER_EXTENSIONS_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
@@ -13,5 +14,6 @@ namespace cef {
void EnsureBrowserContextKeyedServiceFactoriesBuilt(); void EnsureBrowserContextKeyedServiceFactoriesBuilt();
} // namespace cef } // namespace cef
} // namespace extensions
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_ #endif // CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_

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::AssertBlockingAllowed(); base::ThreadRestrictions::AssertIOAllowed();
// 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 = std::make_unique<api::tabs::Tab>(); auto tab_object = base::MakeUnique<api::tabs::Tab>();
tab_object->id = std::make_unique<int>(new_browser->GetIdentifier()); tab_object->id = base::MakeUnique<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 = std::make_unique<std::string>( tab_object->status = base::MakeUnique<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 = std::make_unique<bool>(contents->WasRecentlyAudible()); tab_object->audible = base::MakeUnique<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 = std::make_unique<int>(contents_size.width()); tab_object->width = base::MakeUnique<int>(contents_size.width());
tab_object->height = std::make_unique<int>(contents_size.height()); tab_object->height = base::MakeUnique<int>(contents_size.height());
tab_object->url = std::make_unique<std::string>(contents->GetURL().spec()); tab_object->url = base::MakeUnique<std::string>(contents->GetURL().spec());
tab_object->title = tab_object->title =
std::make_unique<std::string>(base::UTF16ToUTF8(contents->GetTitle())); base::MakeUnique<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 =
std::make_unique<std::string>(entry->GetFavicon().url.spec()); base::MakeUnique<std::string>(entry->GetFavicon().url.spec());
} }
if (opener_browser_id >= 0) if (opener_browser_id >= 0)
tab_object->opener_tab_id = std::make_unique<int>(opener_browser_id); tab_object->opener_tab_id = base::MakeUnique<int>(opener_browser_id);
return tab_object; return tab_object;
} }

View File

@@ -47,7 +47,7 @@ void CefExtensionHostDelegate::ProcessMediaAccessRequest(
} }
bool CefExtensionHostDelegate::CheckMediaAccessPermission( bool CefExtensionHostDelegate::CheckMediaAccessPermission(
content::RenderFrameHost* render_frame_host, content::WebContents* web_contents,
const GURL& security_origin, const GURL& security_origin,
content::MediaStreamType type, content::MediaStreamType type,
const Extension* extension) { const Extension* extension) {

View File

@@ -30,7 +30,7 @@ class CefExtensionHostDelegate : public ExtensionHostDelegate {
const content::MediaStreamRequest& request, const content::MediaStreamRequest& request,
const content::MediaResponseCallback& callback, const content::MediaResponseCallback& callback,
const Extension* extension) override; const Extension* extension) override;
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host, bool CheckMediaAccessPermission(content::WebContents* web_contents,
const GURL& security_origin, const GURL& security_origin,
content::MediaStreamType type, content::MediaStreamType type,
const Extension* extension) override; const Extension* extension) override;

View File

@@ -20,6 +20,7 @@
#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"
@@ -63,7 +64,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->is_dict()) { if (!manifest.get() || !manifest->IsType(base::Value::Type::DICTIONARY)) {
LOG(ERROR) << "Failed to parse extension manifest."; LOG(ERROR) << "Failed to parse extension manifest.";
return NULL; return NULL;
} }
@@ -111,7 +112,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) {
CEF_REQUIRE_BLOCKING(); base::ThreadRestrictions::AssertIOAllowed();
std::unique_ptr<base::DictionaryValue> manifest = std::unique_ptr<base::DictionaryValue> manifest =
ParseManifest(manifest_contents); ParseManifest(manifest_contents);
@@ -130,7 +131,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) {
CEF_REQUIRE_BLOCKING(); base::ThreadRestrictions::AssertIOAllowed();
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;
@@ -238,7 +239,8 @@ void CefExtensionSystem::LoadExtension(
CefRefPtr<CefRequestContext> loader_context, CefRefPtr<CefRequestContext> loader_context,
CefRefPtr<CefExtensionHandler> handler) { CefRefPtr<CefExtensionHandler> handler) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
CEF_POST_USER_VISIBLE_TASK( base::PostTaskWithTraits(
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));
} }
@@ -250,9 +252,11 @@ void CefExtensionSystem::LoadExtension(
CefRefPtr<CefRequestContext> loader_context, CefRefPtr<CefRequestContext> loader_context,
CefRefPtr<CefExtensionHandler> handler) { CefRefPtr<CefExtensionHandler> handler) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
CEF_POST_USER_VISIBLE_TASK(base::BindOnce( base::PostTaskWithTraits(
LoadExtensionWithManifest, weak_ptr_factory_.GetWeakPtr(), FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()},
manifest_contents, root_directory, internal, loader_context, handler)); base::BindOnce(LoadExtensionWithManifest, weak_ptr_factory_.GetWeakPtr(),
manifest_contents, root_directory, internal,
loader_context, handler));
} }
// Implementation based on ComponentLoader::Add. // Implementation based on ComponentLoader::Add.
@@ -363,10 +367,6 @@ 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,25 +449,15 @@ ContentVerifier* CefExtensionSystem::content_verifier() {
std::unique_ptr<ExtensionSet> CefExtensionSystem::GetDependentExtensions( std::unique_ptr<ExtensionSet> CefExtensionSystem::GetDependentExtensions(
const Extension* extension) { const Extension* extension) {
return std::make_unique<ExtensionSet>(); return base::MakeUnique<ExtensionSet>();
} }
void CefExtensionSystem::InstallUpdate( void CefExtensionSystem::InstallUpdate(const std::string& extension_id,
const std::string& extension_id, const base::FilePath& temp_dir) {
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,7 +89,6 @@ 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;
@@ -112,11 +111,7 @@ 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 std::string& public_key, const base::FilePath& temp_dir) override;
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

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

View File

@@ -21,16 +21,6 @@ CefExtensionWebContentsObserver::CefExtensionWebContentsObserver(
CefExtensionWebContentsObserver::~CefExtensionWebContentsObserver() {} CefExtensionWebContentsObserver::~CefExtensionWebContentsObserver() {}
// static
void CefExtensionWebContentsObserver::CreateForWebContents(
content::WebContents* web_contents) {
content::WebContentsUserData<
CefExtensionWebContentsObserver>::CreateForWebContents(web_contents);
// Initialize this instance if necessary.
FromWebContents(web_contents)->Initialize();
}
void CefExtensionWebContentsObserver::RenderFrameCreated( void CefExtensionWebContentsObserver::RenderFrameCreated(
content::RenderFrameHost* render_frame_host) { content::RenderFrameHost* render_frame_host) {
ExtensionWebContentsObserver::RenderFrameCreated(render_frame_host); ExtensionWebContentsObserver::RenderFrameCreated(render_frame_host);
@@ -46,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( policy->GrantOrigin(process_id,
process_id, url::Origin::Create(GURL(content::kChromeUIResourcesURL))); url::Origin(GURL(content::kChromeUIResourcesURL)));
} }
} }

View File

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

View File

@@ -123,34 +123,11 @@ 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(
const GURL& url, net::URLRequest* request,
content::ResourceType resource_type,
ui::PageTransition page_transition,
int child_id,
bool is_incognito, bool is_incognito,
const Extension* extension, const Extension* extension,
const ExtensionSet& extensions, InfoMap* extension_info_map) {
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"
@@ -160,8 +137,7 @@ bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
bool allowed = false; bool allowed = false;
if (url_request_util::AllowCrossRendererResourceLoad( if (url_request_util::AllowCrossRendererResourceLoad(
url, resource_type, page_transition, child_id, is_incognito, request, is_incognito, extension, extension_info_map, &allowed)) {
extension, extensions, process_map, &allowed)) {
return allowed; return allowed;
} }
@@ -258,11 +234,6 @@ 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,26 +51,10 @@ 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;
base::FilePath GetBundleResourcePath( bool AllowCrossRendererResourceLoad(net::URLRequest* request,
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,
const ExtensionSet& extensions, InfoMap* extension_info_map) override;
const ProcessMap& process_map) override;
PrefService* GetPrefServiceForContext( PrefService* GetPrefServiceForContext(
content::BrowserContext* context) override; content::BrowserContext* context) override;
void GetEarlyExtensionPrefsObservers( void GetEarlyExtensionPrefsObservers(
@@ -85,7 +69,6 @@ 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,26 +10,10 @@
#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();
@@ -55,10 +39,7 @@ 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_++;
if (!status_.ok()) base::DictionaryValue* settings = new base::DictionaryValue();
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;
@@ -66,14 +47,12 @@ ValueStore::ReadResult CefValueStore::Get(
settings->SetWithoutPathExpansion(*it, value->CreateDeepCopy()); settings->SetWithoutPathExpansion(*it, value->CreateDeepCopy());
} }
} }
return ReadResult(std::move(settings), CreateStatusCopy(status_)); return MakeReadResult(base::WrapUnique(settings), status_);
} }
ValueStore::ReadResult CefValueStore::Get() { ValueStore::ReadResult CefValueStore::Get() {
read_count_++; read_count_++;
if (!status_.ok()) return MakeReadResult(storage_.CreateDeepCopy(), status_);
return ReadResult(CreateStatusCopy(status_));
return ReadResult(storage_.CreateDeepCopy(), CreateStatusCopy(status_));
} }
ValueStore::WriteResult CefValueStore::Set(WriteOptions options, ValueStore::WriteResult CefValueStore::Set(WriteOptions options,
@@ -88,9 +67,6 @@ 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()) {
@@ -103,7 +79,7 @@ ValueStore::WriteResult CefValueStore::Set(
storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy()); storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
} }
} }
return WriteResult(std::move(changes), CreateStatusCopy(status_)); return MakeWriteResult(std::move(changes), status_);
} }
ValueStore::WriteResult CefValueStore::Remove(const std::string& key) { ValueStore::WriteResult CefValueStore::Remove(const std::string& key) {
@@ -113,9 +89,6 @@ 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) {
@@ -124,7 +97,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 WriteResult(std::move(changes), CreateStatusCopy(status_)); return MakeWriteResult(std::move(changes), status_);
} }
ValueStore::WriteResult CefValueStore::Clear() { ValueStore::WriteResult CefValueStore::Clear() {

View File

@@ -31,10 +31,6 @@ 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

@@ -0,0 +1,106 @@
// 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,14 +79,12 @@ void CefJavaScriptDialogManager::Destroy() {
void CefJavaScriptDialogManager::RunJavaScriptDialog( void CefJavaScriptDialogManager::RunJavaScriptDialog(
content::WebContents* web_contents, content::WebContents* web_contents,
content::RenderFrameHost* render_frame_host, const GURL& origin_url,
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();
@@ -140,7 +138,6 @@ 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,14 +29,13 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
// JavaScriptDialogManager methods. // JavaScriptDialogManager methods.
void RunJavaScriptDialog(content::WebContents* web_contents, void RunJavaScriptDialog(content::WebContents* web_contents,
content::RenderFrameHost* render_frame_host, const GURL& origin_url,
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,6 +346,11 @@ 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)
@@ -384,6 +389,4 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMouseEvent(
// timestamp // timestamp
result.SetTimeStampSeconds(GetSystemUptime()); result.SetTimeStampSeconds(GetSystemUptime());
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
} }

View File

@@ -20,9 +20,9 @@
#include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/native_web_keyboard_event.h"
#include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "third_party/blink/public/platform/web_input_event.h" #include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/blink/public/platform/web_mouse_event.h" #include "third_party/WebKit/public/platform/WebMouseEvent.h"
#include "third_party/blink/public/platform/web_mouse_wheel_event.h" #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h"
#import "ui/base/cocoa/cocoa_base_utils.h" #import "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/underlay_opengl_hosting_window.h" #import "ui/base/cocoa/underlay_opengl_hosting_window.h"
#include "ui/events/keycodes/keyboard_codes_posix.h" #include "ui/events/keycodes/keyboard_codes_posix.h"
@@ -423,6 +423,11 @@ 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)
@@ -469,6 +474,4 @@ 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,10 +20,9 @@
#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/blink/public/platform/web_mouse_event.h" #include "third_party/WebKit/public/platform/WebMouseEvent.h"
#include "third_party/blink/public/platform/web_mouse_wheel_event.h" #include "third_party/WebKit/public/platform/WebMouseWheelEvent.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
#include "ui/base/win/shell.h" #include "ui/base/win/shell.h"
#include "ui/display/display.h" #include "ui/display/display.h"
@@ -42,7 +41,7 @@
namespace { namespace {
void WriteTempFileAndView(scoped_refptr<base::RefCountedString> str) { void WriteTempFileAndView(scoped_refptr<base::RefCountedString> str) {
CEF_REQUIRE_BLOCKING(); CEF_REQUIRE_FILET();
base::FilePath tmp_file; base::FilePath tmp_file;
if (!base::CreateTemporaryFile(&tmp_file)) if (!base::CreateTemporaryFile(&tmp_file))
@@ -84,7 +83,7 @@ bool HasExternalHandler(const std::string& scheme) {
} }
void ExecuteExternalProtocol(const GURL& url) { void ExecuteExternalProtocol(const GURL& url) {
CEF_REQUIRE_BLOCKING(); CEF_REQUIRE_FILET();
if (!HasExternalHandler(url.scheme())) if (!HasExternalHandler(url.scheme()))
return; return;
@@ -96,29 +95,21 @@ 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);
} }
// DPI value for 1x scale factor. WORD KeyStatesToWord() {
#define DPI_1X 96.0f static const USHORT kHighBitMaskShort = 0x8000;
WORD result = 0;
float GetWindowScaleFactor(HWND hwnd) { if (GetKeyState(VK_CONTROL) & kHighBitMaskShort)
DCHECK(hwnd); result |= MK_CONTROL;
if (GetKeyState(VK_SHIFT) & kHighBitMaskShort)
if (base::win::IsProcessPerMonitorDpiAware()) { result |= MK_SHIFT;
// Let Windows tell us the correct DPI. if (GetKeyState(VK_LBUTTON) & kHighBitMaskShort)
static auto get_dpi_for_window_func = []() { result |= MK_LBUTTON;
return reinterpret_cast<decltype(::GetDpiForWindow)*>( if (GetKeyState(VK_MBUTTON) & kHighBitMaskShort)
GetProcAddress(GetModuleHandle(L"user32.dll"), "GetDpiForWindow")); result |= MK_MBUTTON;
}(); if (GetKeyState(VK_RBUTTON) & kHighBitMaskShort)
if (get_dpi_for_window_func) result |= MK_RBUTTON;
return static_cast<float>(get_dpi_for_window_func(hwnd)) / DPI_1X; return result;
}
// 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
@@ -143,49 +134,40 @@ 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.
CreateWindowEx(window_info_.ex_style, GetWndClass(), windowName.c_str(), window_info_.window = CreateWindowEx(
window_info_.style, window_info_.x, window_info_.y, window_info_.ex_style, GetWndClass(), windowName.c_str(),
window_info_.width, window_info_.height, window_info_.style, window_info_.x, window_info_.y, window_info_.width,
window_info_.parent_window, window_info_.menu, window_info_.height, window_info_.parent_window, window_info_.menu,
::GetModuleHandle(NULL), this); ::GetModuleHandle(NULL), NULL);
// 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); DCHECK(window_info_.window != NULL);
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();
if (!called_enable_non_client_dpi_scaling_ && has_frame_ && RECT cr;
base::win::IsProcessPerMonitorDpiAware()) { GetClientRect(window_info_.window, &cr);
// 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_);
// Convert from device coordinates to logical coordinates. // Adjust for potential display scaling.
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);
const float scale = GetWindowScaleFactor(window_info_.window); float scale = display::Screen::GetScreen()
->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));
@@ -305,26 +287,26 @@ gfx::Point CefBrowserPlatformDelegateNativeWin::GetScreenPoint(
if (windowless_handler_) if (windowless_handler_)
return windowless_handler_->GetParentScreenPoint(view); return windowless_handler_->GetParentScreenPoint(view);
if (!window_info_.window) if (!window_widget_)
return view; return view;
// Convert from logical coordinates to device coordinates. aura::Window* window = window_widget_->GetNativeView();
const float scale = GetWindowScaleFactor(window_info_.window); const gfx::Rect& bounds_in_screen = window->GetBoundsInScreen();
const gfx::Point& device_pt = const gfx::Point& screen_point = gfx::Point(bounds_in_screen.x() + view.x(),
gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(view), scale)); bounds_in_screen.y() + view.y());
// Convert from client coordinates to screen coordinates. // Adjust for potential display scaling.
POINT screen_pt = {device_pt.x(), device_pt.y()}; float scale = display::Screen::GetScreen()
ClientToScreen(window_info_.window, &screen_pt); ->GetDisplayNearestPoint(screen_point)
.device_scale_factor();
return gfx::Point(screen_pt.x, screen_pt.y); return gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(screen_point), scale));
} }
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_USER_VISIBLE_TASK(base::Bind(WriteTempFileAndView, str_ref)); CEF_POST_TASK(CEF_FILET, base::Bind(WriteTempFileAndView, str_ref));
} }
void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent( void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
@@ -370,7 +352,8 @@ void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
void CefBrowserPlatformDelegateNativeWin::HandleExternalProtocol( void CefBrowserPlatformDelegateNativeWin::HandleExternalProtocol(
const GURL& url) { const GURL& url) {
CEF_POST_USER_VISIBLE_TASK(base::Bind(ExecuteExternalProtocol, url)); // Execute on the FILE thread.
CEF_POST_TASK(CEF_FILET, base::Bind(ExecuteExternalProtocol, url));
} }
void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent( void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent(
@@ -404,9 +387,8 @@ 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), &flags); ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), 0);
} }
if (result.GetType() == blink::WebInputEvent::kChar || if (result.GetType() == blink::WebInputEvent::kChar ||
@@ -558,8 +540,6 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMouseEvent(
// timestamp // timestamp
result.SetTimeStampSeconds(GetMessageTime() / 1000.0); result.SetTimeStampSeconds(GetMessageTime() / 1000.0);
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
} }
// static // static
@@ -598,15 +578,12 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
UINT message, UINT message,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) { LPARAM lParam) {
CefBrowserPlatformDelegateNativeWin* platform_delegate = nullptr; CefBrowserPlatformDelegateNativeWin* platform_delegate =
CefBrowserHostImpl* browser = nullptr; static_cast<CefBrowserPlatformDelegateNativeWin*>(
if (message != WM_NCCREATE) {
platform_delegate = static_cast<CefBrowserPlatformDelegateNativeWin*>(
gfx::GetWindowUserData(hwnd)); gfx::GetWindowUserData(hwnd));
CefBrowserHostImpl* browser = nullptr;
if (platform_delegate) if (platform_delegate)
browser = platform_delegate->browser_; browser = platform_delegate->browser_;
}
switch (message) { switch (message) {
case WM_CLOSE: case WM_CLOSE:
@@ -618,31 +595,6 @@ 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.
@@ -681,17 +633,6 @@ 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,9 +68,6 @@ 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,11 +5,8 @@
#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"
@@ -18,6 +15,7 @@
#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"
@@ -397,7 +395,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;
Microsoft::WRL::ComPtr<IShellFolder> shell_folder; base::win::ScopedComPtr<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,8 +7,6 @@
#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 MenuControllerCocoa; @class MenuController;
#else #else
class MenuControllerCocoa; class MenuController;
#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<MenuControllerCocoa> menu_controller_; base::scoped_nsobject<MenuController> menu_controller_;
}; };
#endif // CEF_LIBCEF_BROWSER_NATIVE_MENU_RUNNER_MAC_H_ #endif // CEF_LIBCEF_BROWSER_NATIVE_MENU_RUNNER_MAC_H_

View File

@@ -21,16 +21,14 @@ 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([[MenuControllerCocoa alloc] menu_controller_.reset([[MenuController alloc] initWithModel:model->model()
initWithModel:model->model()
useWithPopUpButtonCell:NO]); 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<MenuControllerCocoa> menu_controller_ref( base::scoped_nsobject<MenuController> menu_controller_ref(menu_controller_);
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:
MenuHostWindow() { explicit MenuHostWindow(CefNativeMenuWin* parent) : parent_(parent) {
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,6 +389,7 @@ class CefNativeMenuWin::MenuHostWindow {
} }
HWND hwnd_; HWND hwnd_;
CefNativeMenuWin* parent_;
DISALLOW_COPY_AND_ASSIGN(MenuHostWindow); DISALLOW_COPY_AND_ASSIGN(MenuHostWindow);
}; };
@@ -647,7 +648,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 = std::make_unique<ItemData>(); std::unique_ptr<ItemData> item_data = base::MakeUnique<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) {
@@ -676,7 +677,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, std::make_unique<ItemData>()); items_.insert(items_.begin() + model_index, base::MakeUnique<ItemData>());
InsertMenuItem(menu_, menu_index, TRUE, &mii); InsertMenuItem(menu_, menu_index, TRUE, &mii);
} }
@@ -774,7 +775,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()); host_window_.reset(new MenuHostWindow(this));
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@@ -4,8 +4,6 @@
#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"
@@ -57,7 +55,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(std::make_unique<views::FillLayout>()); SetLayoutManager(new views::FillLayout());
AddChildView(web_view_); AddChildView(web_view_);
} }

View File

@@ -13,6 +13,7 @@
#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"
@@ -26,7 +27,7 @@ const char kNetWMPing[] = "_NET_WM_PING";
const char kNetWMState[] = "_NET_WM_STATE"; const char kNetWMState[] = "_NET_WM_STATE";
const char kXdndProxy[] = "XdndProxy"; const char kXdndProxy[] = "XdndProxy";
::Window FindEventTarget(const ui::PlatformEvent& xev) { ::Window FindEventTarget(const base::NativeEvent& xev) {
::Window target = xev->xany.window; ::Window target = xev->xany.window;
if (xev->type == GenericEvent) if (xev->type == GenericEvent)
target = static_cast<XIDeviceEvent*>(xev->xcookie.data)->event; target = static_cast<XIDeviceEvent*>(xev->xcookie.data)->event;
@@ -37,7 +38,7 @@ const char kXdndProxy[] = "XdndProxy";
::Window root; ::Window root;
::Window parent; ::Window parent;
::Window* children; ::Window* children;
::Window child_window = x11::None; ::Window child_window = 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);
@@ -49,8 +50,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 = x11::None; ::Window root = None;
::Window parent = x11::None; ::Window parent = 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
@@ -90,12 +91,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_ == x11::None) if (parent_xwindow_ == 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 = x11::None; swa.background_pixmap = 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(),
@@ -147,12 +148,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] = x11::CurrentTime; ev.xclient.data.l[1] = CurrentTime;
XSendEvent(xdisplay_, xwindow_, false, NoEventMask, &ev); XSendEvent(xdisplay_, xwindow_, False, NoEventMask, &ev);
} }
void CefWindowX11::Show() { void CefWindowX11::Show() {
if (xwindow_ == x11::None) if (xwindow_ == None)
return; return;
if (!window_mapped_) { if (!window_mapped_) {
@@ -169,8 +170,11 @@ void CefWindowX11::Show() {
XMapWindow(xdisplay_, xwindow_); XMapWindow(xdisplay_, xwindow_);
// TODO(thomasanderson): Find out why this flush is necessary. // We now block until our window is mapped. Some X11 APIs will crash and
XFlush(xdisplay_); // burn if passed |xwindow_| before the window is mapped, and XMapWindow is
// 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
@@ -201,7 +205,7 @@ void CefWindowX11::Show() {
} }
void CefWindowX11::Hide() { void CefWindowX11::Hide() {
if (xwindow_ == x11::None) if (xwindow_ == None)
return; return;
if (window_mapped_) { if (window_mapped_) {
@@ -211,22 +215,22 @@ void CefWindowX11::Hide() {
} }
void CefWindowX11::Focus() { void CefWindowX11::Focus() {
if (xwindow_ == x11::None || !window_mapped_) if (xwindow_ == 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, x11::CurrentTime); XSetInputFocus(xdisplay_, child, RevertToParent, CurrentTime);
} }
} else { } else {
XSetInputFocus(xdisplay_, xwindow_, RevertToParent, x11::CurrentTime); XSetInputFocus(xdisplay_, xwindow_, RevertToParent, CurrentTime);
} }
} }
void CefWindowX11::SetBounds(const gfx::Rect& bounds) { void CefWindowX11::SetBounds(const gfx::Rect& bounds) {
if (xwindow_ == x11::None) if (xwindow_ == None)
return; return;
bool origin_changed = bounds_.origin() != bounds.origin(); bool origin_changed = bounds_.origin() != bounds.origin();
@@ -311,7 +315,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
// Allow the close. // Allow the close.
XDestroyWindow(xdisplay_, xwindow_); XDestroyWindow(xdisplay_, xwindow_);
xwindow_ = x11::None; xwindow_ = 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
@@ -325,7 +329,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_);
@@ -333,7 +337,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
} }
break; break;
} }
case x11::FocusIn: case 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
@@ -347,7 +351,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
100); 100);
} }
break; break;
case x11::FocusOut: case 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,7 +37,6 @@
#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"
@@ -72,6 +71,7 @@ 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 (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) { for (int 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 (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) { for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
urls->push_back(chrome::kChromeDebugURLs[i]); urls->push_back(chrome::kChromeDebugURLs[i]);
} }
@@ -793,7 +793,6 @@ 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,38 +11,6 @@
#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 {
return nullptr;
}
std::unique_ptr<net::CookieChangeSubscription> AddCallbackForUrl(
const GURL& url,
net::CookieChangeCallback callback) override {
return nullptr;
}
std::unique_ptr<net::CookieChangeSubscription> AddCallbackForAllChanges(
net::CookieChangeCallback callback) override {
return nullptr;
}
private:
DISALLOW_COPY_AND_ASSIGN(NullCookieChangeDispatcher);
};
} // namespace
CefCookieStoreProxy::CefCookieStoreProxy( CefCookieStoreProxy::CefCookieStoreProxy(
CefURLRequestContextImpl* parent, CefURLRequestContextImpl* parent,
CefRefPtr<CefRequestContextHandler> handler) CefRefPtr<CefRequestContextHandler> handler)
@@ -65,8 +33,29 @@ 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));
} }
} }
@@ -80,53 +69,48 @@ 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(
@@ -137,8 +121,6 @@ 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);
} }
} }
@@ -151,37 +133,39 @@ 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();
}
} }
net::CookieChangeDispatcher& CefCookieStoreProxy::GetChangeDispatcher() { std::unique_ptr<net::CookieStore::CookieChangedSubscription>
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->GetChangeDispatcher(); return cookie_store->AddCallbackForCookie(url, name, callback);
return nullptr;
}
if (!null_dispatcher_) std::unique_ptr<net::CookieStore::CookieChangedSubscription>
null_dispatcher_.reset(new NullCookieChangeDispatcher()); CefCookieStoreProxy::AddCallbackForAllChanges(
return *null_dispatcher_; const CookieChangedCallback& callback) {
net::CookieStore* cookie_store = GetCookieStore();
if (cookie_store)
return cookie_store->AddCallbackForAllChanges(callback);
return nullptr;
} }
bool CefCookieStoreProxy::IsEphemeral() { bool CefCookieStoreProxy::IsEphemeral() {
@@ -194,23 +178,25 @@ 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. May be nullptr if the // Use the cookie store provided by the manager.
// cookie manager is blocking. cookie_store = reinterpret_cast<CefCookieManagerImpl*>(manager.get())
return reinterpret_cast<CefCookieManagerImpl*>(manager.get())
->GetExistingCookieStore(); ->GetExistingCookieStore();
DCHECK(cookie_store);
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.
net::CookieStore* cookie_store = parent_->cookie_store(); 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 nullptr; return cookie_store;
} }

View File

@@ -26,10 +26,26 @@ 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;
@@ -49,7 +65,12 @@ 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;
net::CookieChangeDispatcher& GetChangeDispatcher() override; std::unique_ptr<CookieChangedSubscription> AddCallbackForCookie(
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:
@@ -60,8 +81,6 @@ 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,8 +9,10 @@
#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 {
@@ -19,11 +21,19 @@ 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) {
CEF_REQUIRE_BLOCKING(); base::ThreadRestrictions::AssertIOAllowed();
std::string crl_set_bytes; std::string crl_set_bytes;
if (!base::ReadFileToString(path, &crl_set_bytes)) { if (!base::ReadFileToString(path, &crl_set_bytes)) {
@@ -32,7 +42,7 @@ void LoadFromDisk(const base::FilePath& path) {
} }
scoped_refptr<net::CRLSet> crl_set; scoped_refptr<net::CRLSet> crl_set;
if (!net::CRLSet::Parse(crl_set_bytes, &crl_set)) { if (!net::CRLSetStorage::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;
} }
@@ -49,5 +59,7 @@ void CefLoadCRLSetsFile(const CefString& path) {
return; return;
} }
CEF_POST_USER_VISIBLE_TASK(base::BindOnce(&LoadFromDisk, path)); base::PostTaskWithTraits(FROM_HERE,
{base::TaskPriority::BACKGROUND, base::MayBlock()},
base::BindOnce(&LoadFromDisk, path));
} }

View File

@@ -9,7 +9,7 @@
namespace net_util { namespace net_util {
bool IsInternalRequest(const net::URLRequest* request) { bool IsInternalRequest(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(const net::URLRequest* request); bool IsInternalRequest(net::URLRequest* request);
}; // namespace net_util }; // namespace net_util

View File

@@ -9,7 +9,6 @@
#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"
@@ -272,7 +271,7 @@ std::unique_ptr<net::SourceStream> CefNetworkDelegate::CreateSourceStream(
} }
if (cef_filter && cef_filter->InitFilter()) if (cef_filter && cef_filter->InitFilter())
return std::make_unique<CefSourceStream>(cef_filter, std::move(upstream)); return base::MakeUnique<CefSourceStream>(cef_filter, std::move(upstream));
return upstream; return upstream;
} }
@@ -441,64 +440,6 @@ 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,11 +38,6 @@ 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,22 +328,6 @@ 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();
@@ -419,7 +403,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()->GetCookieListWithOptionsAsync( request_->context()->cookie_store()->GetCookiesWithOptionsAsync(
request_->url(), options, request_->url(), options,
base::Bind(&CefResourceRequestJob::OnCookiesLoaded, base::Bind(&CefResourceRequestJob::OnCookiesLoaded,
weak_factory_.GetWeakPtr())); weak_factory_.GetWeakPtr()));
@@ -427,7 +411,7 @@ void CefResourceRequestJob::DoLoadCookies() {
void CefResourceRequestJob::CheckCookiePolicyAndLoad( void CefResourceRequestJob::CheckCookiePolicyAndLoad(
const net::CookieList& cookie_list) { const net::CookieList& cookie_list) {
bool can_get_cookies = !cookie_list.empty() && CanGetCookies(cookie_list); bool can_get_cookies = 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) {
@@ -446,11 +430,8 @@ void CefResourceRequestJob::CheckCookiePolicyAndLoad(
DoStartTransaction(); DoStartTransaction();
} }
void CefResourceRequestJob::OnCookiesLoaded( void CefResourceRequestJob::OnCookiesLoaded(const std::string& cookie_line) {
const net::CookieList& cookie_list) { if (!cookie_line.empty()) {
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(
@@ -519,29 +500,25 @@ 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();
std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create( bool can_set_cookie =
request_->url(), cookie_line, base::Time::Now(), options); CanSetCookie(response_cookies_[response_cookies_save_index_], &options);
bool can_set_cookie = cookie && CanSetCookie(*cookie, &options);
if (can_set_cookie) { if (can_set_cookie) {
CefCookie cef_cookie; CefCookie cookie;
if (CefCookieManagerImpl::GetCefCookie(request_->url(), cookie_line, if (CefCookieManagerImpl::GetCefCookie(
cef_cookie)) { request_->url(), response_cookies_[response_cookies_save_index_],
can_set_cookie = handler_->CanSetCookie(cef_cookie); 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()->SetCanonicalCookieAsync( request_->context()->cookie_store()->SetCookieWithOptionsAsync(
std::move(cookie), request_->url().SchemeIsCryptographic(), request_->url(), response_cookies_[response_cookies_save_index_],
!options.exclude_httponly(), options,
base::Bind(&CefResourceRequestJob::OnCookieSaved, base::Bind(&CefResourceRequestJob::OnCookieSaved,
weak_factory_.GetWeakPtr())); weak_factory_.GetWeakPtr()));
return; return;

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