Compare commits

..

43 Commits
3497 ... 3282

Author SHA1 Message Date
Marshall Greenblatt
96f907e55a cmake: Linux: Add missing binaries (issue #2394) 2018-02-27 15:39:15 -05:00
Alfred Reynolds
cd946151e1 Fix crash due to by delayed execution of JS functions on destroyed windows (issue #2038) 2018-02-22 16:28:34 -05:00
Dmitry Azaraev
61bd6b5e3a Add unit test for crash due to by delayed execution of JS functions on destroyed windows (issue #2038) 2018-02-22 16:28:25 -05:00
Tobias Taschner
cb6713fd49 Windows: cmake: Add CEF_RUNTIME_LIBRARY_FLAG for overriding VS runtime type. 2018-02-22 16:28:16 -05:00
Mike Wiedenbauer
a42c0eaa34 Fixes encoding issues when using a custom resource handler (issue #1906). 2018-02-22 16:28:06 -05:00
Marshall Greenblatt
1172b27916 Fix OSR transparency problems (issue #2212, issue #2345) 2018-02-22 16:27:33 -05:00
Alexander Guettler
435cf4d862 Fix input range handle does not follow mouse cursor with OSR (issue #2189) 2018-02-22 16:21:10 -05:00
Marshall Greenblatt
1e5b631452 Windows: Fix per-monitor DPI scaling of top-level browser windows and placement of context menus (issue #2313) 2018-02-21 17:15:38 -05:00
Marshall Greenblatt
8f26fe059b Windows: Add per-monitor DPI support (issue #2313) 2018-02-20 17:34:48 -05:00
Marshall Greenblatt
9091548f17 Fix crash when plugin is not found (issue #2379) 2018-02-12 16:22:51 -05:00
Marshall Greenblatt
973997f650 Add callbacks for network request access to cookies (issue #2374) 2018-02-06 16:34:47 -05:00
Marshall Greenblatt
fc9a4fa04a Fix crashes when loading Flash plugins with extensions disabled (issue #2359) 2018-02-02 19:08:13 -05:00
Marshall Greenblatt
923cb991ba Initialize required KeyedServiceFactories when extensions are disabled (issue #2359) 2018-02-02 19:07:20 -05:00
Marshall Greenblatt
67b06ea44f Fix crash when clicking PDF link (issue #2371) 2018-02-02 16:10:55 -05:00
Marshall Greenblatt
2171fc7dbe Remove problematic section from extensions_1947.patch 2018-02-02 14:20:47 -05:00
Marshall Greenblatt
0e44127ee5 Update to Chromium version 64.0.3282.119 2018-02-01 15:55:40 -05:00
Marshall Greenblatt
c8368c8b13 Update to Chromium version 64.0.3282.71 2018-01-05 20:00:33 -05:00
Marshall Greenblatt
b9ba8a4352 msvs_env.bat: Fix VS2017 path discovery and avoid CWD change (issue #2350, issue #2351) 2018-01-05 13:32:03 -05:00
Marshall Greenblatt
acb89916a0 Return Chrome 'Browser' value for DevTools remote debugging (issue #2300) 2018-01-04 18:54:37 -05:00
Marshall Greenblatt
cc4d57b920 Add CefURLRequest::ResponseWasCached method (issue #2283) 2018-01-03 16:15:59 -05:00
Marshall Greenblatt
c3dc5f71bb Update generated file copyright year 2018-01-03 16:15:49 -05:00
Marshall Greenblatt
1a680363b5 macOS: cmake: Don't create target name with spaces (issue #2342) 2018-01-03 15:04:48 -05:00
Dan Kegel
8d826cbe8c - Linux: Disable gcc warning about code in comments (issue #2346).
- macOS: Fix clang warning about display_unittest.cc missing a newline (issue #2347).
2018-01-03 18:52:09 +00:00
Marshall Greenblatt
45a037385a Linux: Fix crash when canceling the print dialog (issue #2341) 2018-01-02 16:53:25 -05:00
Dan Kegel
2de137fabe Linux: Switch to Debian Stretch sysroot (issue #2343) 2018-01-02 19:31:46 +00:00
Marshall Greenblatt
a422efc3e3 Return correct 'Browser' value for DevTools remote debugging (issue #2300) 2017-12-27 17:36:21 -05:00
Marshall Greenblatt
aac5f8d968 Fix proxy service initialization (issue #2066) 2017-12-27 16:39:10 -05:00
Marshall Greenblatt
080fc0848b cmake: Fix detection of tests folder 2017-12-27 15:53:18 -05:00
Marshall Greenblatt
29c0eb32da Windows: cmake: Add VS2017 15.5 build support 2017-12-27 15:53:11 -05:00
Marshall Greenblatt
a92bbdd169 Windows: Fix 64-bit build warning C4267 (issue #2335) 2017-12-27 15:53:04 -05:00
Marshall Greenblatt
642f29baac Merge webkit_set target into //WebKit/source/controller to fix deps race (issue #2339) 2017-12-27 13:22:27 -05:00
Marshall Greenblatt
9042f3719b Fix crash when ALT+Clicking invalid protocol link (issue #2306) 2017-12-22 16:42:33 -05:00
Marshall Greenblatt
e35e95bec3 Fix crash when using CefJSDialogHandler with the default dialog implementation (issue #2329) 2017-12-21 16:48:45 -05:00
Marshall Greenblatt
5a8af72a35 Windows: Fix x64 compile error (issue #2332) 2017-12-21 15:44:40 -05:00
Marshall Greenblatt
efd7475bf2 Fix crash when creating JS popup with no URL (issue #2330) 2017-12-21 14:59:09 -05:00
Marshall Greenblatt
08b0314f83 Fix assertion when calling SendProcessMessage from non-UI thread (issue #2325) 2017-12-19 15:15:46 -05:00
SergeyAvd
ef9531f0af Fix typos in the comments that generate the documentation 2017-12-18 18:45:47 -05:00
Mario Pistrich
d97b3f5e13 Add log level to CefDisplayHandler::OnConsoleMessage (issue #2234) 2017-12-18 18:38:25 -05:00
Marshall Greenblatt
7eacec0d91 Windows: Fix ui/base/ui_features.h file not found component build error 2017-12-18 18:38:19 -05:00
Andrei Kurushin
7c1bf316b2 Windows: Fix non x2 HiDPI OSR paint crop (issue #2299) 2017-12-18 14:39:49 -05:00
Marshall Greenblatt
739f67aa05 Fix README typo 2017-12-18 14:21:28 -05:00
Marshall Greenblatt
b34b281f4a Linux: Add missing swiftshader binaries to distribution (issue #2321) 2017-12-18 14:13:26 -05:00
Marshall Greenblatt
eca7d18013 Update to Chromium version 64.0.3282.24 2017-12-14 18:52:01 -05:00
547 changed files with 10298 additions and 12577 deletions

178
BUILD.gn
View File

@@ -13,14 +13,14 @@
# Optionally configure GN by setting the `GN_DEFINES` and/or `GN_ARGUMENTS`
# 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:
#
# > 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
# open "out\<build_dir>\cef.sln" for editing and debugging. Building must
@@ -100,32 +100,29 @@ import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//cef/cef_repack_locales.gni")
import("//chrome/common/features.gni")
import("//extensions/buildflags/buildflags.gni")
import("//extensions/features/features.gni")
import("//media/media_options.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//ppapi/buildflags/buildflags.gni")
import("//printing/buildflags/buildflags.gni")
import("//ppapi/features/features.gni")
import("//printing/features/features.gni")
import("//services/catalog/public/tools/catalog.gni")
import("//services/service_manager/public/service_manifest.gni")
import("//third_party/icu/config.gni")
import("//third_party/widevine/cdm/widevine.gni")
import("//tools/grit/repack.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("//ui/gl/features.gni")
import("//v8/gni/v8.gni")
if (is_clang) {
import("//build/config/clang/clang.gni")
}
if (is_linux) {
import("//build/config/linux/pkg_config.gni")
import("//third_party/fontconfig/fontconfig.gni")
}
if (is_mac) {
import("//build/config/mac/rules.gni")
import("//build/mac/tweak_info_plist.gni")
import("//build/util/version.gni")
import("//media/cdm/library_cdm/cdm_paths.gni")
import("//media/cdm/ppapi/cdm_paths.gni")
}
if (is_win) {
import("//build/config/win/console_app.gni")
@@ -150,12 +147,6 @@ if (is_clang) {
assert(!clang_use_chrome_plugins)
}
if (is_linux) {
# Use system fontconfig. This avoids a startup hang on Ubuntu 16.04.4 (see
# issue #2424).
assert(!use_bundled_fontconfig)
}
if (is_mac) {
# Always generate dSYM files. The make_distrib script will fail if
# enable_dsyms=true is not explicitly set when is_official_build=false.
@@ -272,11 +263,12 @@ if (is_win) {
deps = [
"//components/crash/core/common", # crash_keys
"//gpu/config:crash_keys",
# Required by chrome_switches.cc
"//chrome/common:buildflags",
"//ppapi/buildflags:buildflags",
"//printing/buildflags:buildflags",
"//chrome/common:features",
"//ppapi/features:features",
"//printing/features:features",
"//ui/base:ui_features",
]
}
@@ -381,6 +373,7 @@ static_library("libcef_static") {
"libcef/browser/file_dialog_manager.h",
"libcef/browser/frame_host_impl.cc",
"libcef/browser/frame_host_impl.h",
"libcef/browser/geolocation_impl.cc",
"libcef/browser/image_impl.cc",
"libcef/browser/image_impl.h",
"libcef/browser/javascript_dialog_runner.h",
@@ -403,8 +396,6 @@ static_library("libcef_static") {
"libcef/browser/net/chrome_scheme_handler.h",
"libcef/browser/net/cookie_store_proxy.cc",
"libcef/browser/net/cookie_store_proxy.h",
"libcef/browser/net/cookie_store_source.cc",
"libcef/browser/net/cookie_store_source.h",
"libcef/browser/net/crlset_file_util_impl.cc",
"libcef/browser/net/devtools_scheme_handler.cc",
"libcef/browser/net/devtools_scheme_handler.h",
@@ -451,6 +442,12 @@ static_library("libcef_static") {
"libcef/browser/osr/web_contents_view_osr.cc",
"libcef/browser/osr/web_contents_view_osr.h",
"libcef/browser/path_util_impl.cc",
"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_service_filter.cc",
"libcef/browser/plugins/plugin_service_filter.h",
"libcef/browser/prefs/browser_prefs.cc",
@@ -657,10 +654,8 @@ static_library("libcef_static") {
"//chrome/child",
"//chrome/common",
"//chrome/renderer",
"//chrome/services/printing:lib",
"//chrome/utility",
"//components/cdm/renderer",
"//components/certificate_transparency",
"//components/content_settings/core/browser",
"//components/content_settings/core/common",
"//components/crx_file",
@@ -677,10 +672,11 @@ static_library("libcef_static") {
"//components/printing/browser",
"//components/printing/common",
"//components/printing/renderer",
"//components/services/pdf_compositor:pdf_compositor_manifest",
"//components/services/pdf_compositor/public/cpp:utils",
"//components/services/pdf_compositor/public/interfaces",
"//components/printing/service:pdf_compositor_manifest",
"//components/printing/service/public/cpp:factory",
"//components/printing/service/public/interfaces",
"//components/proxy_config",
"//components/ssl_config",
"//components/update_client",
"//components/url_formatter",
"//components/user_prefs",
@@ -695,42 +691,46 @@ static_library("libcef_static") {
"//content/public/child",
"//content/public/common",
"//content/public/gpu",
"//content/public/network",
"//content/public/renderer",
"//content/public/utility",
"//crypto",
"//device/base",
"//device/geolocation",
"//device/geolocation/public/interfaces",
"//extensions/browser",
"//extensions/browser/api:api_registration",
"//extensions/buildflags",
"//extensions/common/api",
"//extensions/features",
"//extensions/renderer",
"//extensions/utility",
"//gpu",
"//ipc",
"//media",
"//media/blink",
"//net",
"//net/dns:mojo_client",
"//net:net_browser_services",
"//net:net_utility_services",
"//net:net_with_v8",
"//pdf",
"//ppapi/buildflags",
"//printing/buildflags",
"//services/network:network_service",
"//services/network/public/cpp",
"//ppapi/features",
"//printing/features",
"//services/service_manager/embedder",
"//services/service_manager/public/cpp",
"//services/service_manager/public/interfaces",
"//services/service_manager/runner/common",
"//skia",
"//storage/browser",
"//third_party/blink/public:blink",
"//third_party/brotli:dec",
"//third_party/cld_3/src/src:cld_3",
"//third_party/hunspell",
"//third_party/leveldatabase",
"//third_party/libxml",
"//third_party/WebKit/public:blink",
"//third_party/widevine/cdm:headers",
"//third_party/widevine/cdm",
"//third_party/widevine/cdm:widevinecdmadapter",
"//third_party/icu",
"//third_party/zlib:minizip",
"//tools/v8_context_snapshot:v8_context_snapshot",
"//ui/base",
"//ui/base/ime",
"//ui/events:events_base",
@@ -763,6 +763,8 @@ static_library("libcef_static") {
"libcef/browser/osr/browser_platform_delegate_osr_win.cc",
"libcef/browser/osr/browser_platform_delegate_osr_win.h",
"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.
"//chrome/utility/printing_handler.cc",
@@ -779,8 +781,6 @@ static_library("libcef_static") {
libs = [
"comctl32.lib",
# For D3D11_DECODER_PROFILE_H264_VLD_NOFGT.
"dxguid.lib",
]
}
@@ -833,21 +833,12 @@ static_library("libcef_static") {
}
if (is_posix && !is_mac) {
sources += [
"libcef/common/cef_crash_report_utils.cc",
"libcef/common/cef_crash_report_utils.h",
]
deps += [
"//components/crash/content/app",
"//components/crash/content/browser",
]
}
if (v8_use_external_startup_data && use_v8_context_snapshot) {
deps += [ "//tools/v8_context_snapshot" ]
}
if (use_aura) {
sources += [
"libcef/browser/native/window_delegate_view.cc",
@@ -922,7 +913,6 @@ static_library("libcef_static") {
]
deps += [
"//services/ui",
"//ui/aura",
"//ui/events",
"//ui/strings",
@@ -1033,8 +1023,6 @@ if (is_win) {
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",
]
@@ -1078,11 +1066,11 @@ template("cef_pak_scaled") {
# Each input pak file should also have a deps line for completeness.
# Add associated .h files in the make_pack_header("resources") target.
sources = [
"$root_gen_dir/blink/public/resources/blink_scaled_resources_${percent}_percent.pak",
"$root_gen_dir/chrome/renderer_resources_${percent}_percent.pak",
"$root_gen_dir/components/components_resources_${percent}_percent.pak",
"$root_gen_dir/content/app/resources/content_resources_${percent}_percent.pak",
"$root_gen_dir/extensions/extensions_browser_resources_${percent}_percent.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_scaled_resources_${percent}_percent.pak",
"$root_gen_dir/ui/resources/ui_resources_${percent}_percent.pak",
]
@@ -1090,18 +1078,18 @@ template("cef_pak_scaled") {
# the libcef_static target. Grit deps that generate .cc files must be
# listed both here and in the libcef_static target.
public_deps = [
"//third_party/WebKit/public:scaled_resources",
"//chrome/renderer:resources",
"//components/resources:components_scaled_resources",
"//content/app/resources",
"//extensions:extensions_browser_resources",
"//third_party/blink/public:scaled_resources",
"//ui/resources:ui_resources_grd",
]
deps = [
# This repack target generates the blink_scaled_resources_*_percent.pak
# file but doesn't expose the public_deps required by make_pack_header.
"//third_party/blink/public:scaled_resources_${percent}_percent",
"//third_party/WebKit/public:scaled_resources_${percent}_percent",
]
if (toolkit_views) {
@@ -1218,6 +1206,7 @@ repack("pak") {
# Each input pak file should also have a deps line for completeness.
# Add associated .h files in the make_pack_header("resources") target.
sources = [
"$root_gen_dir/blink/public/resources/blink_resources.pak",
"$root_gen_dir/chrome/browser_resources.pak",
"$root_gen_dir/chrome/net_internals_resources.pak",
"$root_gen_dir/chrome/common_resources.pak",
@@ -1226,13 +1215,13 @@ repack("pak") {
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
"$root_gen_dir/content/content_resources.pak",
"$root_gen_dir/net/net_resources.pak",
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
]
# Use public_deps so that generated grit headers are discoverable from
# the libcef_static target. Grit deps that generate .cc files must be
# listed both here and in the libcef_static target.
public_deps = [
"//third_party/WebKit/public:resources_grit",
"//chrome/browser:resources",
"//chrome/browser/resources:net_internals_resources",
"//chrome/common:resources",
@@ -1241,7 +1230,6 @@ repack("pak") {
"//content/browser/tracing:resources",
"//content:resources",
"//net:net_resources",
"//third_party/blink/public:resources",
]
output = "$root_out_dir/cef.pak"
@@ -1278,6 +1266,9 @@ template("make_pack_header") {
make_pack_header("resources") {
header = "$root_out_dir/includes/include/cef_pack_resources.h"
inputs = [
"$root_gen_dir/blink/public/resources/grit/media_controls_resources.h",
"$root_gen_dir/blink/public/resources/grit/blink_image_resources.h",
"$root_gen_dir/blink/public/resources/grit/blink_resources.h",
"$root_gen_dir/cef/grit/cef_resources.h",
"$root_gen_dir/chrome/grit/browser_resources.h",
"$root_gen_dir/chrome/grit/common_resources.h",
@@ -1292,7 +1283,6 @@ make_pack_header("resources") {
"$root_gen_dir/extensions/grit/extensions_renderer_resources.h",
"$root_gen_dir/extensions/grit/extensions_resources.h",
"$root_gen_dir/net/grit/net_resources.h",
"$root_gen_dir/third_party/blink/public/resources/grit/blink_resources.h",
"$root_gen_dir/ui/resources/grit/ui_resources.h",
"$root_gen_dir/ui/resources/grit/webui_resources.h",
"$root_gen_dir/ui/views/resources/grit/views_resources.h",
@@ -1358,6 +1348,8 @@ if (is_mac) {
"$root_out_dir/cef_200_percent.pak",
"$root_out_dir/cef_extensions.pak",
"$root_out_dir/devtools_resources.pak",
"$root_out_dir/v8_context_snapshot.bin",
"$root_out_dir/$widevine_cdm_path/widevinecdmadapter.plugin",
]
public_deps = [
@@ -1366,6 +1358,8 @@ if (is_mac) {
":pak_200_percent",
":pak_devtools",
":pak_extensions",
"//third_party/widevine/cdm:widevinecdmadapter",
"//tools/v8_context_snapshot:v8_context_snapshot",
]
if (icu_use_data_file) {
@@ -1379,10 +1373,6 @@ if (is_mac) {
"$root_out_dir/snapshot_blob.bin",
]
public_deps += [ "//v8" ]
if (use_v8_context_snapshot) {
sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
public_deps += [ "//tools/v8_context_snapshot" ]
}
}
outputs = [
@@ -1390,61 +1380,9 @@ if (is_mac) {
]
}
if (use_egl) {
# Add the ANGLE .dylibs in the MODULE_DIR of the Framework app bundle.
bundle_data("cef_framework_angle_binaries") {
sources = [
"$root_out_dir/egl_intermediates/libEGL.dylib",
"$root_out_dir/egl_intermediates/libGLESv2.dylib",
]
outputs = [
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
]
public_deps = [
"//ui/gl:angle_library_copy",
]
}
# Add the SwiftShader .dylibs in the MODULE_DIR of the Framework app bundle.
bundle_data("cef_framework_swiftshader_binaries") {
sources = [
"$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
"$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
]
outputs = [
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
]
public_deps = [
"//ui/gl:swiftshader_library_copy",
]
}
}
group("cef_framework_angle_library") {
if (use_egl) {
deps = [
":cef_framework_angle_binaries",
]
}
}
group("cef_framework_swiftshader_library") {
if (use_egl) {
deps = [
":cef_framework_swiftshader_binaries",
]
}
}
mac_framework_bundle("cef_framework") {
output_name = cef_framework_name
framework_version = "A"
framework_contents = [
"Libraries",
"Resources",
]
sources = gypi_paths2.includes_common +
gypi_paths2.includes_mac +
gypi_paths.autogen_cpp_includes +
@@ -1458,10 +1396,8 @@ if (is_mac) {
# - crash_report_sender.app
deps = [
":cef_framework_angle_library",
":cef_framework_locales",
":cef_framework_resources",
":cef_framework_swiftshader_library",
":libcef_static",
]
@@ -1482,11 +1418,11 @@ if (is_mac) {
if (is_component_build) {
# Set up the rpath for the framework so that it can find dylibs in the
# root output directory. The framework is at
# $app_name.app/Contents/Frameworks/$output_name.framework/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.
ldflags += [
"-rpath",
"@loader_path/../../../../../..",
"@loader_path/../../../..",
]
}
@@ -1523,12 +1459,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.
# Don't do this in Debug builds because it causes the resulting
# application to crash.
# Also need to do this for ASAN builds to work around
# https://crbug.com/832808.
# Don't do this in Debug builds because it causes the resulting application to crash.
ldflags = [ "-Wl,--version-script=" +
rebase_path("//cef/libcef_dll/libcef.lst") ]
}
@@ -1897,6 +1830,7 @@ if (is_mac) {
deps = [
":libcef",
":libcef_dll_wrapper",
"//build/config:exe_and_shlib_deps",
]
if (is_win) {
@@ -1970,6 +1904,7 @@ if (is_mac) {
deps = [
":libcef",
":libcef_dll_wrapper",
"//build/config:exe_and_shlib_deps",
]
if (is_win) {
@@ -2038,6 +1973,7 @@ if (is_mac) {
deps = [
":libcef",
":libcef_dll_wrapper",
"//build/config:exe_and_shlib_deps",
"//testing/gtest",
]

View File

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

View File

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

View File

@@ -8,7 +8,7 @@
# by hand. See the translator.README.txt file in the tools directory for
# more information.
#
# $hash=67bc21133e37f5361a39f25dcfe004616d467dbc$
# $hash=5f69924ad7517dee8adf933a7c013616ebb94c36$
#
{
@@ -38,6 +38,8 @@
'include/cef_find_handler.h',
'include/cef_focus_handler.h',
'include/cef_frame.h',
'include/cef_geolocation.h',
'include/cef_geolocation_handler.h',
'include/cef_image.h',
'include/cef_jsdialog_handler.h',
'include/cef_keyboard_handler.h',
@@ -129,6 +131,8 @@
'include/capi/cef_find_handler_capi.h',
'include/capi/cef_focus_handler_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_jsdialog_handler_capi.h',
'include/capi/cef_keyboard_handler_capi.h',
@@ -282,8 +286,14 @@
'libcef_dll/ctocpp/focus_handler_ctocpp.h',
'libcef_dll/cpptoc/frame_cpptoc.cc',
'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.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.h',
'libcef_dll/cpptoc/jsdialog_callback_cpptoc.cc',
@@ -432,8 +442,6 @@
'libcef_dll/ctocpp/urlrequest_client_ctocpp.h',
'libcef_dll/ctocpp/v8accessor_ctocpp.cc',
'libcef_dll/ctocpp/v8accessor_ctocpp.h',
'libcef_dll/ctocpp/v8array_buffer_release_callback_ctocpp.cc',
'libcef_dll/ctocpp/v8array_buffer_release_callback_ctocpp.h',
'libcef_dll/cpptoc/v8context_cpptoc.cc',
'libcef_dll/cpptoc/v8context_cpptoc.h',
'libcef_dll/cpptoc/v8exception_cpptoc.cc',
@@ -564,8 +572,14 @@
'libcef_dll/cpptoc/focus_handler_cpptoc.h',
'libcef_dll/ctocpp/frame_ctocpp.cc',
'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.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.h',
'libcef_dll/ctocpp/jsdialog_callback_ctocpp.cc',
@@ -714,8 +728,6 @@
'libcef_dll/cpptoc/urlrequest_client_cpptoc.h',
'libcef_dll/cpptoc/v8accessor_cpptoc.cc',
'libcef_dll/cpptoc/v8accessor_cpptoc.h',
'libcef_dll/cpptoc/v8array_buffer_release_callback_cpptoc.cc',
'libcef_dll/cpptoc/v8array_buffer_release_callback_cpptoc.h',
'libcef_dll/ctocpp/v8context_ctocpp.cc',
'libcef_dll/ctocpp/v8context_ctocpp.h',
'libcef_dll/ctocpp/v8exception_ctocpp.cc',

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,276 @@
// Copyright (c) 2014 Marshall A. Greenblatt. Portions copyright (c) 2012
// Google Inc. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the name Chromium Embedded
// Framework nor the names of its contributors may be used to endorse
// or promote products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef CEF_INCLUDE_BASE_CEF_THREAD_COLLISION_WARNER_H_
#define CEF_INCLUDE_BASE_CEF_THREAD_COLLISION_WARNER_H_
#pragma once
#if defined(BASE_THREADING_THREAD_COLLISION_WARNER_H_)
// Do nothing if the Chromium header has already been included.
// This can happen in cases where Chromium code is used directly by the
// client application. When using Chromium code directly always include
// the Chromium header first to avoid type conflicts.
#elif defined(USING_CHROMIUM_INCLUDES)
// When building CEF include the Chromium header directly.
#include "base/threading/thread_collision_warner.h"
#else // !USING_CHROMIUM_INCLUDES
// The following is substantially similar to the Chromium implementation.
// If the Chromium implementation diverges the below implementation should be
// updated to match.
#include <memory>
#include "include/base/cef_atomicops.h"
#include "include/base/cef_basictypes.h"
#include "include/base/cef_build.h"
#include "include/base/cef_logging.h"
#include "include/base/cef_macros.h"
// A helper class alongside macros to be used to verify assumptions about thread
// safety of a class.
//
// Example: Queue implementation non thread-safe but still usable if clients
// are synchronized somehow.
//
// In this case the macro DFAKE_SCOPED_LOCK has to be
// used, it checks that if a thread is inside the push/pop then
// noone else is still inside the pop/push
//
// class NonThreadSafeQueue {
// public:
// ...
// void push(int) { DFAKE_SCOPED_LOCK(push_pop_); ... }
// int pop() { DFAKE_SCOPED_LOCK(push_pop_); ... }
// ...
// private:
// DFAKE_MUTEX(push_pop_);
// };
//
//
// Example: Queue implementation non thread-safe but still usable if clients
// are synchronized somehow, it calls a method to "protect" from
// a "protected" method
//
// In this case the macro DFAKE_SCOPED_RECURSIVE_LOCK
// has to be used, it checks that if a thread is inside the push/pop
// then noone else is still inside the pop/push
//
// class NonThreadSafeQueue {
// public:
// void push(int) {
// DFAKE_SCOPED_LOCK(push_pop_);
// ...
// }
// int pop() {
// DFAKE_SCOPED_RECURSIVE_LOCK(push_pop_);
// bar();
// ...
// }
// void bar() { DFAKE_SCOPED_RECURSIVE_LOCK(push_pop_); ... }
// ...
// private:
// DFAKE_MUTEX(push_pop_);
// };
//
//
// Example: Queue implementation not usable even if clients are synchronized,
// so only one thread in the class life cycle can use the two members
// push/pop.
//
// In this case the macro DFAKE_SCOPED_LOCK_THREAD_LOCKED pins the
// specified
// critical section the first time a thread enters push or pop, from
// that time on only that thread is allowed to execute push or pop.
//
// class NonThreadSafeQueue {
// public:
// ...
// void push(int) { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... }
// int pop() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(push_pop_); ... }
// ...
// private:
// DFAKE_MUTEX(push_pop_);
// };
//
//
// Example: Class that has to be contructed/destroyed on same thread, it has
// a "shareable" method (with external synchronization) and a not
// shareable method (even with external synchronization).
//
// In this case 3 Critical sections have to be defined
//
// class ExoticClass {
// public:
// ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... }
// ~ExoticClass() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... }
//
// void Shareable() { DFAKE_SCOPED_LOCK(shareable_section_); ... }
// void NotShareable() { DFAKE_SCOPED_LOCK_THREAD_LOCKED(ctor_dtor_); ... }
// ...
// private:
// DFAKE_MUTEX(ctor_dtor_);
// DFAKE_MUTEX(shareable_section_);
// };
#if DCHECK_IS_ON()
// Defines a class member that acts like a mutex. It is used only as a
// verification tool.
#define DFAKE_MUTEX(obj) mutable base::ThreadCollisionWarner obj
// Asserts the call is never called simultaneously in two threads. Used at
// member function scope.
#define DFAKE_SCOPED_LOCK(obj) \
base::ThreadCollisionWarner::ScopedCheck s_check_##obj(&obj)
// Asserts the call is never called simultaneously in two threads. Used at
// member function scope. Same as DFAKE_SCOPED_LOCK but allows recursive locks.
#define DFAKE_SCOPED_RECURSIVE_LOCK(obj) \
base::ThreadCollisionWarner::ScopedRecursiveCheck sr_check_##obj(&obj)
// Asserts the code is always executed in the same thread.
#define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) \
base::ThreadCollisionWarner::Check check_##obj(&obj)
#else
#define DFAKE_MUTEX(obj) typedef void InternalFakeMutexType##obj
#define DFAKE_SCOPED_LOCK(obj) ((void)0)
#define DFAKE_SCOPED_RECURSIVE_LOCK(obj) ((void)0)
#define DFAKE_SCOPED_LOCK_THREAD_LOCKED(obj) ((void)0)
#endif
namespace base {
// The class ThreadCollisionWarner uses an Asserter to notify the collision
// AsserterBase is the interfaces and DCheckAsserter is the default asserter
// used. During the unit tests is used another class that doesn't "DCHECK"
// in case of collision (check thread_collision_warner_unittests.cc)
struct AsserterBase {
virtual ~AsserterBase() {}
virtual void warn() = 0;
};
struct DCheckAsserter : public AsserterBase {
virtual ~DCheckAsserter() {}
virtual void warn() OVERRIDE;
};
class ThreadCollisionWarner {
public:
// The parameter asserter is there only for test purpose
explicit ThreadCollisionWarner(AsserterBase* asserter = new DCheckAsserter())
: valid_thread_id_(0), counter_(0), asserter_(asserter) {}
~ThreadCollisionWarner() { delete asserter_; }
// This class is meant to be used through the macro
// DFAKE_SCOPED_LOCK_THREAD_LOCKED
// it doesn't leave the critical section, as opposed to ScopedCheck,
// because the critical section being pinned is allowed to be used only
// from one thread
class Check {
public:
explicit Check(ThreadCollisionWarner* warner) : warner_(warner) {
warner_->EnterSelf();
}
~Check() {}
private:
ThreadCollisionWarner* warner_;
DISALLOW_COPY_AND_ASSIGN(Check);
};
// This class is meant to be used through the macro
// DFAKE_SCOPED_LOCK
class ScopedCheck {
public:
explicit ScopedCheck(ThreadCollisionWarner* warner) : warner_(warner) {
warner_->Enter();
}
~ScopedCheck() { warner_->Leave(); }
private:
ThreadCollisionWarner* warner_;
DISALLOW_COPY_AND_ASSIGN(ScopedCheck);
};
// This class is meant to be used through the macro
// DFAKE_SCOPED_RECURSIVE_LOCK
class ScopedRecursiveCheck {
public:
explicit ScopedRecursiveCheck(ThreadCollisionWarner* warner)
: warner_(warner) {
warner_->EnterSelf();
}
~ScopedRecursiveCheck() { warner_->Leave(); }
private:
ThreadCollisionWarner* warner_;
DISALLOW_COPY_AND_ASSIGN(ScopedRecursiveCheck);
};
private:
// This method stores the current thread identifier and does a DCHECK
// if a another thread has already done it, it is safe if same thread
// calls this multiple time (recursion allowed).
void EnterSelf();
// Same as EnterSelf but recursion is not allowed.
void Enter();
// Removes the thread_id stored in order to allow other threads to
// call EnterSelf or Enter.
void Leave();
// This stores the thread id that is inside the critical section, if the
// value is 0 then no thread is inside.
volatile subtle::Atomic32 valid_thread_id_;
// Counter to trace how many time a critical section was "pinned"
// (when allowed) in order to unpin it when counter_ reaches 0.
volatile subtle::Atomic32 counter_;
// Here only for class unit tests purpose, during the test I need to not
// DCHECK but notify the collision with something else.
AsserterBase* asserter_;
DISALLOW_COPY_AND_ASSIGN(ThreadCollisionWarner);
};
} // namespace base
#endif // !USING_CHROMIUM_INCLUDES
#endif // CEF_INCLUDE_BASE_CEF_THREAD_COLLISION_WARNER_H_

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=1dbb0adf7ac5fd42b5a79d271834781664a7fd47$
// $hash=2a93a2e7a17c81d39ad1b8c1c1aa93d5d90b1100$
//
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
@@ -48,6 +48,7 @@
#include "include/capi/cef_drag_handler_capi.h"
#include "include/capi/cef_find_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_keyboard_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_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
// default implementation will be used.

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=00e6d1aa80d5998d89cc272dcb199cde0add12fa$
// $hash=e0605a0c9918e225b9282b6d5e6138a7d697945b$
//
#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(
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
// 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
// more information.
//
// $hash=e4da4fab11e33d34d70714be22e6f72579586ffe$
// $hash=0a8f009404aedce3f63f83864f754df60c36b293$
//
#ifndef CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_
@@ -129,12 +129,14 @@ extern "C" {
//
// CrashKeys section:
//
// A maximum of 26 crash keys of each size can be specified for use by the
// application. Crash key values will be truncated based on the specified size
// (small = 64 bytes, medium = 256 bytes, large = 1024 bytes). The value of
// crash keys can be set from any thread or process using the
// CefSetCrashKeyValue function. These key/value pairs will be sent to the crash
// server along with the crash dump file.
// Any number of crash keys can be specified for use by the application. Crash
// key values will be truncated based on the specified size (small = 63 bytes,
// medium = 252 bytes, large = 1008 bytes). The value of crash keys can be set
// from any thread or process using the CefSetCrashKeyValue function. These
// key/value pairs will be sent to the crash server along with the crash dump
// 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();

View File

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

View File

@@ -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
// more information.
//
// $hash=f2f3acb1df9815e4ac9bf34010ce260a2496ae5a$
// $hash=3fb1034cb02cfeddcaf02d8fde0dec5b8a18f416$
//
#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,
size_t character_boundsCount,
cef_rect_t const* character_bounds);
///
// Called when text selection has changed for the specified |browser|.
// |selected_text| is the currently selected text and |selected_range| is the
// character range.
///
void(CEF_CALLBACK* on_text_selection_changed)(
struct _cef_render_handler_t* self,
struct _cef_browser_t* browser,
const cef_string_t* selected_text,
const cef_range_t* selected_range);
} cef_render_handler_t;
#ifdef __cplusplus

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=fb34d81715ada28d5509cd33aa36f37829933a91$
// $hash=44b61ca19efaae0a664d6d502d550755fbf326fa$
//
#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_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
// 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
// more information.
//
// $hash=95e44047a75693dbae0ab6b07b415d188252bfdf$
// $hash=b8b5a62b11dbc48f0733c0522864e4dbda8b4f59$
//
#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
// cef_load_handler_t::OnLoadEnd will be called. If the navigation is canceled
// cef_load_handler_t::OnLoadError will be called with an |errorCode| value of
// ERR_ABORTED. The |user_gesture| value will be true (1) if the browser
// navigated via explicit user gesture (e.g. clicking a link) or false (0) if
// it navigated automatically (e.g. via the DomContentLoaded event).
// ERR_ABORTED.
///
int(CEF_CALLBACK* on_before_browse)(struct _cef_request_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame,
struct _cef_request_t* request,
int user_gesture,
int is_redirect);
///

View File

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

View File

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

View File

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

View File

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

View File

@@ -46,6 +46,7 @@
#include "include/cef_drag_handler.h"
#include "include/cef_find_handler.h"
#include "include/cef_focus_handler.h"
#include "include/cef_geolocation_handler.h"
#include "include/cef_jsdialog_handler.h"
#include "include/cef_keyboard_handler.h"
#include "include/cef_life_span_handler.h"
@@ -107,6 +108,15 @@ class CefClient : public virtual CefBaseRefCounted {
/*--cef()--*/
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
// default implementation will be used.

View File

@@ -64,17 +64,6 @@ class CefCookieManager : public virtual CefBaseRefCounted {
static CefRefPtr<CefCookieManager> GetGlobalManager(
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
// memory only. Otherwise, data will be stored at the specified |path|. To

View File

@@ -121,12 +121,14 @@
//
// CrashKeys section:
//
// A maximum of 26 crash keys of each size can be specified for use by the
// application. Crash key values will be truncated based on the specified size
// (small = 64 bytes, medium = 256 bytes, large = 1024 bytes). The value of
// crash keys can be set from any thread or process using the
// CefSetCrashKeyValue function. These key/value pairs will be sent to the crash
// server along with the crash dump file.
// Any number of crash keys can be specified for use by the application. Crash
// key values will be truncated based on the specified size (small = 63 bytes,
// medium = 252 bytes, large = 1008 bytes). The value of crash keys can be set
// from any thread or process using the CefSetCrashKeyValue function. These
// key/value pairs will be sent to the crash server along with the crash dump
// 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()--*/
bool CefCrashReportingEnabled();

View File

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

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,
const CefRange& selected_range,
const RectList& character_bounds) {}
///
// Called when text selection has changed for the specified |browser|.
// |selected_text| is the currently selected text and |selected_range| is
// the character range.
///
/*--cef(optional_param=selected_text,optional_param=selected_range)--*/
virtual void OnTextSelectionChanged(CefRefPtr<CefBrowser> browser,
const CefString& selected_text,
const CefRange& selected_range) {}
};
#endif // CEF_INCLUDE_CEF_RENDER_HANDLER_H_

View File

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

View File

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

View File

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

View File

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

View File

@@ -151,6 +151,14 @@ typedef struct _cef_settings_t {
///
size_t size;
///
// Set to true (1) to use a single process for the browser and renderer. This
// run mode is not officially supported by Chromium and is less stable than
// the multi-process default. Also configurable using the "single-process"
// command-line switch.
///
int single_process;
///
// Set to true (1) to disable the sandbox for sub-processes. See
// cef_sandbox_win.h for requirements to enable the sandbox on Windows. Also
@@ -181,7 +189,7 @@ typedef struct _cef_settings_t {
// Set to true (1) to have the browser process message loop run in a separate
// thread. If false (0) than the CefDoMessageLoopWork() function must be
// called from your application message loop. This option is only supported on
// Windows and Linux.
// Windows.
///
int multi_threaded_message_loop;
@@ -1256,12 +1264,6 @@ typedef enum {
// originated in the browser process.
///
UR_FLAG_NO_RETRY_ON_5XX = 1 << 5,
///
// If set 3XX responses will cause the fetch to halt immediately rather than
// continue through the redirect.
///
UR_FLAG_STOP_ON_REDIRECT = 1 << 6,
} cef_urlrequest_flags_t;
///
@@ -1377,41 +1379,23 @@ typedef enum {
///
// The main thread in the browser. This will be the same as the main
// application thread if CefInitialize() is called with a
// CefSettings.multi_threaded_message_loop value of false. Do not perform
// blocking tasks on this thread. All tasks posted after
// CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown()
// are guaranteed to run. This thread will outlive all other CEF threads.
// CefSettings.multi_threaded_message_loop value of false.
///
TID_UI,
///
// Used for blocking tasks (e.g. file system access) where the user won't
// notice if the task takes an arbitrarily long time to complete. All tasks
// posted after CefBrowserProcessHandler::OnContextInitialized() and before
// CefShutdown() are guaranteed to run.
// Used to interact with the database.
///
TID_FILE_BACKGROUND,
TID_FILE = TID_FILE_BACKGROUND,
TID_DB,
///
// Used for blocking tasks (e.g. file system access) that affect UI or
// responsiveness of future user interactions. Do not use if an immediate
// response to a user interaction is expected. All tasks posted after
// CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown()
// are guaranteed to run.
// Examples:
// - Updating the UI to reflect progress on a long task.
// - Loading data that might be shown in the UI after a future user
// interaction.
// Used to interact with the file system.
///
TID_FILE_USER_VISIBLE,
TID_FILE,
///
// Used for blocking tasks (e.g. file system access) that affect UI
// immediately after a user interaction. All tasks posted after
// CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown()
// are guaranteed to run.
// Example: Generating data shown in the UI immediately after a click.
// Used for file system operations that block user interactions.
// Responsiveness of this thread affects users.
///
TID_FILE_USER_BLOCKING,
@@ -1421,10 +1405,12 @@ typedef enum {
TID_PROCESS_LAUNCHER,
///
// Used to process IPC and network messages. Do not perform blocking tasks on
// this thread. All tasks posted after
// CefBrowserProcessHandler::OnContextInitialized() and before CefShutdown()
// are guaranteed to run.
// Used to handle slow HTTP cache operations.
///
TID_CACHE,
///
// Used to process IPC and network messages.
///
TID_IO,
@@ -1432,10 +1418,6 @@ typedef enum {
///
// 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,
} cef_thread_id_t;
@@ -2064,6 +2046,74 @@ typedef enum {
FILE_DIALOG_HIDEREADONLY_FLAG = 0x02000000,
} 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.
///

View File

@@ -539,6 +539,7 @@ struct CefSettingsTraits {
static inline void set(const struct_type* src,
struct_type* target,
bool copy) {
target->single_process = src->single_process;
target->no_sandbox = src->no_sandbox;
cef_string_set(src->browser_subprocess_path.str,
src->browser_subprocess_path.length,
@@ -831,6 +832,37 @@ struct CefCookieTraits {
///
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 {
typedef cef_cursor_info_t struct_type;

View File

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

View File

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

View File

@@ -12,6 +12,7 @@
#include "libcef/browser/context.h"
#include "libcef/browser/download_manager_delegate.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/request_context_impl.h"
#include "libcef/browser/ssl_host_state_delegate.h"
@@ -26,11 +27,11 @@
#include "base/strings/string_util.h"
#include "base/threading/thread_restrictions.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 "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/guest_view/browser/guest_view_manager.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_master.h"
#include "components/zoom/zoom_event_manager.h"
@@ -39,8 +40,7 @@
#include "content/public/browser/storage_partition.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/common/constants.h"
#include "net/proxy_resolution/proxy_config_service.h"
#include "net/proxy_resolution/proxy_resolution_service.h"
#include "net/proxy/proxy_config_service.h"
using content::BrowserThread;
@@ -162,7 +162,7 @@ class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener {
void CreateListenerForContext(const CefBrowserContext* context) {
CEF_REQUIRE_UIT();
auto listener = std::make_unique<visitedlink::VisitedLinkEventListener>(
auto listener = base::MakeUnique<visitedlink::VisitedLinkEventListener>(
const_cast<CefBrowserContext*>(context));
listener_map_.insert(std::make_pair(context, std::move(listener)));
}
@@ -176,11 +176,11 @@ class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener {
// visitedlink::VisitedLinkMaster::Listener methods.
void NewTable(base::ReadOnlySharedMemoryRegion* table_region) override {
void NewTable(mojo::SharedBufferHandle table) override {
CEF_REQUIRE_UIT();
ListenerMap::iterator it = listener_map_.begin();
for (; it != listener_map_.end(); ++it)
it->second->NewTable(table_region);
it->second->NewTable(table);
}
void Add(visitedlink::VisitedLinkCommon::Fingerprint fingerprint) override {
@@ -283,8 +283,9 @@ void CefBrowserContextImpl::Initialize() {
visitedlink_master_->Init();
// Initialize proxy configuration tracker.
pref_proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl(
GetPrefs(), BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)));
pref_proxy_config_tracker_.reset(
ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
GetPrefs()));
CefBrowserContext::PostInitialize();
@@ -418,9 +419,10 @@ CefBrowserContextImpl::GetSSLHostStateDelegate() {
return ssl_host_state_delegate_.get();
}
content::PermissionControllerDelegate*
CefBrowserContextImpl::GetPermissionControllerDelegate() {
return nullptr;
content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() {
if (!permission_manager_.get())
permission_manager_.reset(new CefPermissionManager(this));
return permission_manager_.get();
}
content::BackgroundFetchDelegate*
@@ -444,18 +446,10 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
CEF_REQUIRE_UIT();
DCHECK(!url_request_getter_.get());
auto io_thread_runner =
content::BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
// 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(
pref_proxy_config_tracker_->CreateTrackingProxyConfigService(
std::move(base_service)));
ProxyServiceFactory::CreateProxyConfigService(
pref_proxy_config_tracker_.get()));
if (extensions::ExtensionsEnabled()) {
// Handle only chrome-extension:// requests. CEF does not support
@@ -463,13 +457,17 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
// data in its installation directory).
extensions::InfoMap* extension_info_map = extension_system()->info_map();
(*protocol_handlers)[extensions::kExtensionScheme] =
extensions::CreateExtensionProtocolHandler(IsOffTheRecord(),
extension_info_map);
linked_ptr<net::URLRequestJobFactory::ProtocolHandler>(
extensions::CreateExtensionProtocolHandler(IsOffTheRecord(),
extension_info_map)
.release());
}
url_request_getter_ = new CefURLRequestContextGetterImpl(
settings_, GetPrefs(), io_thread_runner, protocol_handlers,
std::move(proxy_config_service), std::move(request_interceptors));
settings_, GetPrefs(),
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());
return url_request_getter_.get();
}

View File

@@ -67,8 +67,7 @@ class CefBrowserContextImpl : public CefBrowserContext,
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
content::PushMessagingService* GetPushMessagingService() override;
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
override;
content::PermissionManager* GetPermissionManager() override;
content::BackgroundFetchDelegate* GetBackgroundFetchDelegate() override;
content::BackgroundSyncController* GetBackgroundSyncController() override;
content::BrowsingDataRemoverDelegate* GetBrowsingDataRemoverDelegate()
@@ -122,6 +121,7 @@ class CefBrowserContextImpl : public CefBrowserContext,
std::unique_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
scoped_refptr<CefURLRequestContextGetterImpl> url_request_getter_;
std::unique_ptr<content::PermissionManager> permission_manager_;
std::unique_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_;
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
std::unique_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_;

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -154,7 +154,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
window_info->SetAsPopup(NULL, CefString());
#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->opener_process_id = opener->GetProcess()->GetID();
pending_popup->opener_frame_id = opener->GetRoutingID();

View File

@@ -16,7 +16,7 @@
#include "base/synchronization/lock.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 "url/gurl.h"

View File

@@ -10,6 +10,7 @@
#include "libcef/browser/browser_context_impl.h"
#include "libcef/browser/browser_context_keyed_service_factories.h"
#include "libcef/browser/browser_message_loop.h"
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h"
#include "libcef/browser/devtools_manager_delegate.h"
@@ -25,15 +26,11 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "chrome/browser/chrome_browser_main_extra_parts.h"
#include "chrome/browser/plugins/plugin_finder.h"
#include "content/public/browser/gpu_data_manager.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/constants.h"
#include "net/base/net_module.h"
#include "services/service_manager/embedder/result_codes.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/resource/resource_bundle.h"
#if defined(USE_AURA)
@@ -60,32 +57,21 @@ CefBrowserMainParts::CefBrowserMainParts(
const content::MainFunctionParams& parameters)
: BrowserMainParts(), devtools_delegate_(NULL) {}
CefBrowserMainParts::~CefBrowserMainParts() {
for (int i = static_cast<int>(chrome_extra_parts_.size()) - 1; i >= 0; --i)
delete chrome_extra_parts_[i];
chrome_extra_parts_.clear();
CefBrowserMainParts::~CefBrowserMainParts() {}
void CefBrowserMainParts::PreMainMessageLoopStart() {
if (!base::MessageLoop::current()) {
// Create the browser message loop.
message_loop_.reset(new CefBrowserMessageLoop());
}
}
void CefBrowserMainParts::AddParts(ChromeBrowserMainExtraParts* parts) {
chrome_extra_parts_.push_back(parts);
}
int CefBrowserMainParts::PreEarlyInitialization() {
void CefBrowserMainParts::PreEarlyInitialization() {
#if defined(USE_AURA) && defined(OS_LINUX)
// TODO(linux): Consider using a real input method or
// views::LinuxUI::SetInstance.
ui::InitializeInputMethodForTesting();
#endif
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreEarlyInitialization();
return service_manager::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() {
@@ -101,14 +87,6 @@ void CefBrowserMainParts::ToolkitInitialized() {
CefContentBrowserClient::Get()->GetResourceDllName());
#endif
#endif // defined(USE_AURA)
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->ToolkitInitialized();
}
void CefBrowserMainParts::PreMainMessageLoopStart() {
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreMainMessageLoopStart();
}
void CefBrowserMainParts::PostMainMessageLoopStart() {
@@ -118,9 +96,6 @@ void CefBrowserMainParts::PostMainMessageLoopStart() {
printing::PrintingContextLinux::SetPdfPaperSizeFunction(
&CefPrintDialogLinux::GetPdfPaperSize);
#endif
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostMainMessageLoopStart();
}
int CefBrowserMainParts::PreCreateThreads() {
@@ -134,28 +109,14 @@ int CefBrowserMainParts::PreCreateThreads() {
// before the IO thread is started.
content::GpuDataManager::GetInstance();
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PreCreateThreads();
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() {
#if defined(USE_AURA)
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
#endif
ui::MaterialDesignController::Initialize();
// CEF's profile is a BrowserContext.
PreProfileInit();
if (extensions::ExtensionsEnabled()) {
// Initialize extension global objects before creating the global
// BrowserContext.
@@ -174,16 +135,6 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
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;
CefContext::Get()->PopulateRequestContextSettings(&settings);
@@ -193,21 +144,12 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
CefBrowserContextImpl* browser_context = static_cast<CefBrowserContextImpl*>(
global_request_context_->GetBrowserContext());
PostProfileInit();
CefDevToolsManagerDelegate::StartHttpHandler(browser_context);
// Triggers initialization of the singleton instance on UI thread.
PluginFinder::GetInstance()->Init();
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() {
@@ -223,9 +165,6 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
extensions::ExtensionsBrowserClient::Set(NULL);
extensions_browser_client_.reset();
}
for (size_t i = 0; i < chrome_extra_parts_.size(); ++i)
chrome_extra_parts_[i]->PostMainMessageLoopRun();
}
void CefBrowserMainParts::PostDestroyThreads() {
@@ -234,23 +173,3 @@ void CefBrowserMainParts::PostDestroyThreads() {
delete views::ViewsDelegate::GetInstance();
#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

@@ -16,6 +16,11 @@
#include "content/public/browser/browser_main_parts.h"
#include "net/url_request/url_request_context_getter.h"
namespace base {
class MessageLoop;
class Thread;
} // namespace base
namespace content {
struct MainFunctionParams;
}
@@ -32,51 +37,26 @@ class WMState;
#endif
class CefDevToolsDelegate;
class ChromeBrowserMainExtraParts;
class CefBrowserMainParts : public content::BrowserMainParts {
public:
explicit CefBrowserMainParts(const content::MainFunctionParams& parameters);
~CefBrowserMainParts() override;
// Add additional ChromeBrowserMainExtraParts.
void AddParts(ChromeBrowserMainExtraParts* parts);
int PreEarlyInitialization() override;
void PostEarlyInitialization() override;
void ToolkitInitialized() override;
void PreMainMessageLoopStart() override;
void PostMainMessageLoopStart() override;
void PreEarlyInitialization() override;
void ToolkitInitialized() override;
int PreCreateThreads() override;
void ServiceManagerConnectionStarted(
content::ServiceManagerConnection* connection) override;
void PreMainMessageLoopRun() override;
void PostMainMessageLoopRun() 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 {
return global_request_context_;
}
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:
#if defined(OS_WIN)
void PlatformInitialize();
@@ -84,27 +64,16 @@ class CefBrowserMainParts : public content::BrowserMainParts {
CefRefPtr<CefRequestContextImpl> global_request_context_;
CefDevToolsDelegate* devtools_delegate_; // Deletes itself.
std::unique_ptr<base::MessageLoop> message_loop_;
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
std::unique_ptr<extensions::ExtensionsBrowserClient>
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)
std::unique_ptr<wm::WMState> wm_state_;
#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);
};

View File

@@ -8,7 +8,11 @@
#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() {
HRESULT res;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -15,8 +15,7 @@
#include "chrome/browser/printing/print_job_manager.h"
#include "components/net_log/chrome_net_log.h"
#include "content/public/common/content_switches.h"
#include "services/network/public/cpp/network_switches.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "ui/message_center/message_center.h"
ChromeBrowserProcessStub::ChromeBrowserProcessStub()
: initialized_(false),
@@ -117,12 +116,6 @@ ChromeBrowserProcessStub::network_connection_tracker() {
return NULL;
}
network::NetworkQualityTracker*
ChromeBrowserProcessStub::network_quality_tracker() {
NOTREACHED();
return NULL;
}
WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() {
NOTREACHED();
return NULL;
@@ -145,12 +138,6 @@ ChromeBrowserProcessStub::system_request_context() {
return NULL;
}
scoped_refptr<network::SharedURLLoaderFactory>
ChromeBrowserProcessStub::shared_url_loader_factory() {
NOTREACHED();
return NULL;
}
variations::VariationsService* ChromeBrowserProcessStub::variations_service() {
NOTREACHED();
return NULL;
@@ -178,7 +165,12 @@ ChromeBrowserProcessStub::notification_platform_bridge() {
return NULL;
}
policy::ChromeBrowserPolicyConnector*
message_center::MessageCenter* ChromeBrowserProcessStub::message_center() {
NOTREACHED();
return NULL;
}
policy::BrowserPolicyConnector*
ChromeBrowserProcessStub::browser_policy_connector() {
NOTREACHED();
return NULL;
@@ -199,7 +191,14 @@ GpuModeManager* ChromeBrowserProcessStub::gpu_mode_manager() {
return NULL;
}
void ChromeBrowserProcessStub::CreateDevToolsProtocolHandler() {
GpuProfileCache* ChromeBrowserProcessStub::gpu_profile_cache() {
NOTREACHED();
return NULL;
}
void ChromeBrowserProcessStub::CreateDevToolsHttpProtocolHandler(
const std::string& ip,
uint16_t port) {
NOTREACHED();
}
@@ -271,6 +270,7 @@ StatusTray* ChromeBrowserProcessStub::status_tray() {
safe_browsing::SafeBrowsingService*
ChromeBrowserProcessStub::safe_browsing_service() {
NOTREACHED();
return NULL;
}
@@ -301,10 +301,10 @@ net_log::ChromeNetLog* ChromeBrowserProcessStub::net_log() {
if (!net_log_) {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
net_log_ = std::make_unique<net_log::ChromeNetLog>();
if (command_line.HasSwitch(network::switches::kLogNetLog)) {
net_log_ = base::MakeUnique<net_log::ChromeNetLog>();
if (command_line.HasSwitch(switches::kLogNetLog)) {
net_log_->StartWritingToFile(
command_line.GetSwitchValuePath(network::switches::kLogNetLog),
command_line.GetSwitchValuePath(switches::kLogNetLog),
GetNetCaptureModeFromCommandLine(command_line),
command_line.GetCommandLineString(), std::string());
}
@@ -330,10 +330,12 @@ ChromeBrowserProcessStub::media_file_system_registry() {
return NULL;
}
#if BUILDFLAG(ENABLE_WEBRTC)
WebRtcLogUploader* ChromeBrowserProcessStub::webrtc_log_uploader() {
NOTREACHED();
return NULL;
}
#endif
network_time::NetworkTimeTracker*
ChromeBrowserProcessStub::network_time_tracker() {
@@ -357,6 +359,12 @@ resource_coordinator::TabManager* ChromeBrowserProcessStub::GetTabManager() {
return NULL;
}
physical_web::PhysicalWebDataSource*
ChromeBrowserProcessStub::GetPhysicalWebDataSource() {
NOTREACHED();
return NULL;
}
prefs::InProcessPrefServiceFactory*
ChromeBrowserProcessStub::pref_service_factory() const {
NOTREACHED();

View File

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

View File

@@ -75,6 +75,11 @@ ChromeProfileStub::GetRequestContextForExtensions() {
return GetRequestContext();
}
net::SSLConfigService* ChromeProfileStub::GetSSLConfigService() {
NOTREACHED();
return NULL;
}
bool ChromeProfileStub::IsSameProfile(Profile* profile) {
NOTREACHED();
return false;
@@ -95,6 +100,11 @@ void ChromeProfileStub::set_last_selected_directory(
NOTREACHED();
}
PrefProxyConfigTracker* ChromeProfileStub::GetProxyConfigTracker() {
NOTREACHED();
return NULL;
}
chrome_browser_net::Predictor* ChromeProfileStub::GetNetworkPredictor() {
NOTREACHED();
return NULL;

View File

@@ -34,10 +34,12 @@ class ChromeProfileStub : public Profile {
ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override;
PrefService* GetOffTheRecordPrefs() override;
net::URLRequestContextGetter* GetRequestContextForExtensions() override;
net::SSLConfigService* GetSSLConfigService() override;
bool IsSameProfile(Profile* profile) override;
base::Time GetStartTime() const override;
base::FilePath last_selected_directory() override;
void set_last_selected_directory(const base::FilePath& path) override;
PrefProxyConfigTracker* GetProxyConfigTracker() override;
chrome_browser_net::Predictor* GetNetworkPredictor() override;
GURL GetHomePage() override;
bool WasCreatedByVersionOrLater(const std::string& version) override;

View File

@@ -41,7 +41,6 @@
#include "base/json/json_reader.h"
#include "base/path_service.h"
#include "cef/grit/cef_resources.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_service.h"
#include "chrome/browser/plugins/plugin_info_host_impl.h"
#include "chrome/browser/profiles/profile.h"
@@ -50,10 +49,9 @@
#include "chrome/common/constants.mojom.h"
#include "chrome/grit/browser_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/navigation_params.h"
#include "components/services/pdf_compositor/public/interfaces/pdf_compositor.mojom.h"
#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h"
#include "content/browser/frame_host/navigation_handle_impl.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/plugin_service_impl.h"
@@ -76,23 +74,20 @@
#include "content/public/common/service_names.mojom.h"
#include "content/public/common/storage_quota_params.h"
#include "content/public/common/web_preferences.h"
#include "extensions/browser/api/web_request/web_request_api.h"
#include "extensions/browser/extension_message_filter.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
#include "extensions/browser/io_thread_extension_message_filter.h"
#include "extensions/common/constants.h"
#include "extensions/common/switches.h"
#include "net/ssl/ssl_cert_request_info.h"
#include "ppapi/host/ppapi_host.h"
#include "services/service_manager/embedder/switches.h"
#include "services/service_manager/public/mojom/connector.mojom.h"
#include "services/service_manager/sandbox/switches.h"
#include "services/metrics/metrics_mojo_service.h"
#include "services/metrics/public/interfaces/constants.mojom.h"
#include "services/proxy_resolver/public/interfaces/proxy_resolver.mojom.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/resource/resource_bundle.h"
#include "ui/base/ui_base_switches.h"
@@ -102,6 +97,10 @@
#include "libcef/common/widevine_loader.h"
#endif
#if defined(OS_MACOSX)
#include "components/spellcheck/browser/spellcheck_message_filter_platform.h"
#endif
#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include "base/debug/leak_annotations.h"
#include "chrome/common/chrome_paths.h"
@@ -295,7 +294,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
void RequestQuotaPermission(const content::StorageQuotaParams& params,
int render_process_id,
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
// interface for Persistent storage type.
callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
@@ -339,7 +338,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
breakpad::CrashHandlerHostLinux* CreateCrashHandlerHost(
const std::string& process_type) {
base::FilePath dumps_path;
base::PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path);
PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path);
{
ANNOTATE_SCOPED_MEMORY_LEAK;
// Uploads will only occur if a non-empty crash URL is specified in
@@ -431,14 +430,8 @@ bool NavigationOnUIThread(
request->Set(params, is_main_frame);
request->SetReadOnly(true);
// Initiating a new navigation in OnBeforeBrowse will delete the
// InterceptNavigationThrottle that currently owns this callback,
// resulting in a crash. Use the lock to prevent that.
std::unique_ptr<CefBrowserHostImpl::NavigationLock> navigation_lock =
browser->CreateNavigationLock();
ignore_navigation = handler->OnBeforeBrowse(
browser.get(), frame, request.get(), params.has_user_gesture(),
params.is_redirect());
browser.get(), frame, request.get(), params.is_redirect());
}
}
}
@@ -458,8 +451,6 @@ CefContentBrowserClient::~CefContentBrowserClient() {}
// static
CefContentBrowserClient* CefContentBrowserClient::Get() {
if (!CefContentClient::Get())
return nullptr;
return static_cast<CefContentBrowserClient*>(
CefContentClient::Get()->browser());
}
@@ -467,20 +458,25 @@ CefContentBrowserClient* CefContentBrowserClient::Get() {
content::BrowserMainParts* CefContentBrowserClient::CreateBrowserMainParts(
const content::MainFunctionParams& parameters) {
browser_main_parts_ = new CefBrowserMainParts(parameters);
browser_main_parts_->AddParts(
ChromeService::GetInstance()->CreateExtraParts());
return browser_main_parts_;
}
void CefContentBrowserClient::RenderProcessWillLaunch(
content::RenderProcessHost* host,
service_manager::mojom::ServiceRequest* service_request) {
content::RenderProcessHost* host) {
const int id = host->GetID();
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
host->AddFilter(new CefBrowserMessageFilter(id));
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
if (extensions::ExtensionsEnabled()) {
host->AddFilter(new extensions::ExtensionMessageFilter(id, profile));
host->AddFilter(
@@ -497,16 +493,6 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
host->Send(
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(
@@ -605,25 +591,28 @@ void CefContentBrowserClient::SiteInstanceDeleting(
}
void CefContentBrowserClient::RegisterInProcessServices(
StaticServiceMap* services,
content::ServiceManagerConnection* connection) {
StaticServiceMap* services) {
{
// For spell checking.
service_manager::EmbeddedServiceInfo info;
info.factory = ChromeService::GetInstance()->CreateChromeServiceFactory();
info.factory = base::Bind(&ChromeService::Create);
services->insert(std::make_pair(chrome::mojom::kServiceName, info));
}
{
// For metrics.
service_manager::EmbeddedServiceInfo info;
info.factory = base::Bind(&metrics::CreateMetricsService);
services->emplace(metrics::mojom::kMetricsServiceName, info);
}
}
void CefContentBrowserClient::RegisterOutOfProcessServices(
OutOfProcessServiceMap* services) {
(*services)[printing::mojom::kServiceName] =
base::BindRepeating(&base::ASCIIToUTF16, "PDF Compositor Service");
(*services)[printing::mojom::kChromePrintingServiceName] =
base::BindRepeating(&base::ASCIIToUTF16, "Printing Service");
base::ASCIIToUTF16("PDF Compositor Service");
(*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
base::BindRepeating(&l10n_util::GetStringUTF16,
IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
}
std::unique_ptr<base::Value> CefContentBrowserClient::GetServiceManifestOverlay(
@@ -650,8 +639,6 @@ std::vector<content::ContentBrowserClient::ServiceManifestInfo>
CefContentBrowserClient::GetExtraServiceManifests() {
return std::vector<ServiceManifestInfo>({
{printing::mojom::kServiceName, IDR_PDF_COMPOSITOR_MANIFEST},
{chrome::mojom::kRendererServiceName,
IDR_CHROME_RENDERER_SERVICE_MANIFEST},
});
}
@@ -675,6 +662,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
#if defined(OS_MACOSX)
switches::kFrameworkDirPath,
#endif
switches::kLang,
switches::kLocalesDirPath,
switches::kLogFile,
switches::kLogSeverity,
@@ -719,18 +707,10 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
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 (process_type == service_manager::switches::kZygoteProcess) {
if (process_type == switches::kZygoteProcess) {
// Propagate the following switches to the zygote command line (along with
// any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = {
@@ -740,9 +720,9 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
arraysize(kSwitchNames));
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
if (!browser_cmd->HasSwitch(service_manager::switches::kNoSandbox)) {
if (!browser_cmd->HasSwitch(switches::kNoSandbox)) {
// Pass the Widevine CDM path to the Zygote process. See comments in
// CefWidevineLoader::AddContentDecryptionModules.
// CefWidevineLoader::AddPepperPlugins.
const base::FilePath& cdm_path = CefWidevineLoader::GetInstance()->path();
if (!cdm_path.empty())
command_line->AppendSwitchPath(switches::kWidevineCdmPath, cdm_path);
@@ -772,10 +752,6 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
}
}
std::string CefContentBrowserClient::GetApplicationLocale() {
return g_browser_process->GetApplicationLocale();
}
content::QuotaPermissionContext*
CefContentBrowserClient::CreateQuotaPermissionContext() {
return new CefQuotaPermissionContext();
@@ -981,7 +957,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
}
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,
frame_id, parent_frame_id));
throttles.push_back(std::move(throttle));
@@ -996,7 +972,7 @@ void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
content::PosixFileDescriptorInfo* mappings) {
int crash_signal_fd = GetCrashSignalFD(command_line);
if (crash_signal_fd >= 0) {
mappings->Share(service_manager::kCrashDumpSignal, crash_signal_fd);
mappings->Share(kCrashDumpSignal, crash_signal_fd);
}
}
#endif // defined(OS_LINUX)
@@ -1008,7 +984,7 @@ const wchar_t* CefContentBrowserClient::GetResourceDllName() {
if (file_path[0] == 0) {
// Retrieve the module path (usually libcef.dll).
base::FilePath module;
base::PathService::Get(base::FILE_MODULE, &module);
PathService::Get(base::FILE_MODULE, &module);
const std::wstring wstr = module.value();
size_t count = std::min(static_cast<size_t>(MAX_PATH), wstr.size());
wcsncpy(file_path, wstr.c_str(), count);
@@ -1033,75 +1009,6 @@ void CefContentBrowserClient::ExposeInterfacesToRenderer(
base::MakeRefCounted<PluginInfoHostImpl>(host->GetID(), profile)));
}
std::unique_ptr<net::ClientCertStore>
CefContentBrowserClient::CreateClientCertStore(
content::ResourceContext* resource_context) {
if (!resource_context)
return nullptr;
return static_cast<CefResourceContext*>(resource_context)
->CreateClientCertStore();
}
void CefContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
int frame_tree_node_id,
NonNetworkURLLoaderFactoryMap* factories) {
if (!extensions::ExtensionsEnabled())
return;
content::WebContents* web_contents =
content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
factories->emplace(
extensions::kExtensionScheme,
extensions::CreateExtensionNavigationURLLoaderFactory(
web_contents->GetBrowserContext(),
!!extensions::WebViewGuest::FromWebContents(web_contents)));
}
void CefContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id,
int render_frame_id,
NonNetworkURLLoaderFactoryMap* factories) {
if (!extensions::ExtensionsEnabled())
return;
auto factory = extensions::CreateExtensionURLLoaderFactory(render_process_id,
render_frame_id);
if (factory)
factories->emplace(extensions::kExtensionScheme, std::move(factory));
}
bool CefContentBrowserClient::WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
bool is_navigation,
network::mojom::URLLoaderFactoryRequest* factory_request) {
if (!extensions::ExtensionsEnabled())
return false;
auto* web_request_api =
extensions::BrowserContextKeyedAPIFactory<extensions::WebRequestAPI>::Get(
browser_context);
return web_request_api->MaybeProxyURLLoaderFactory(frame, is_navigation,
factory_request);
}
bool CefContentBrowserClient::HandleExternalProtocol(
const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
int child_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture) {
CEF_POST_TASK(
CEF_UIT,
base::Bind(
base::IgnoreResult(
&CefContentBrowserClient::HandleExternalProtocolOnUIThread),
url, web_contents_getter));
return false;
}
void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
// Register as a Web-safe scheme so that requests for the scheme from a
// render process will be allowed in resource_dispatcher_host_impl.cc
@@ -1121,21 +1028,6 @@ CefDevToolsDelegate* CefContentBrowserClient::devtools_delegate() const {
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(
content::SiteInstance* site_instance) {
extensions::ExtensionRegistry* registry =
@@ -1145,18 +1037,3 @@ const extensions::Extension* CefContentBrowserClient::GetExtension(
return registry->enabled_extensions().GetExtensionOrAppByURL(
site_instance->GetSiteURL());
}
// static
void CefContentBrowserClient::HandleExternalProtocolOnUIThread(
const GURL& url,
const content::ResourceRequestInfo::WebContentsGetter&
web_contents_getter) {
CEF_REQUIRE_UIT();
content::WebContents* web_contents = web_contents_getter.Run();
if (web_contents) {
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForContents(web_contents);
if (browser.get())
browser->HandleExternalProtocol(url);
}
}

View File

@@ -43,17 +43,13 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
// ContentBrowserClient implementation.
content::BrowserMainParts* CreateBrowserMainParts(
const content::MainFunctionParams& parameters) override;
void RenderProcessWillLaunch(
content::RenderProcessHost* host,
service_manager::mojom::ServiceRequest* service_request) override;
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
const GURL& effective_url) override;
bool IsHandledURL(const GURL& url) override;
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
void RegisterInProcessServices(
StaticServiceMap* services,
content::ServiceManagerConnection* connection) override;
void RegisterInProcessServices(StaticServiceMap* services) override;
void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override;
std::unique_ptr<base::Value> GetServiceManifestOverlay(
base::StringPiece name) override;
@@ -62,7 +58,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
content::BrowserContext* context2) override;
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
int child_process_id) override;
std::string GetApplicationLocale() override;
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
void GetQuotaSettings(
content::BrowserContext* context,
@@ -127,51 +122,17 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
blink::AssociatedInterfaceRegistry* associated_registry,
content::RenderProcessHost* render_process_host) override;
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
content::ResourceContext* resource_context) override;
void RegisterNonNetworkNavigationURLLoaderFactories(
int frame_tree_node_id,
NonNetworkURLLoaderFactoryMap* factories) override;
void RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id,
int render_frame_id,
NonNetworkURLLoaderFactoryMap* factories) override;
bool WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
bool is_navigation,
network::mojom::URLLoaderFactoryRequest* factory_request) override;
bool HandleExternalProtocol(
const GURL& url,
content::ResourceRequestInfo::WebContentsGetter web_contents_getter,
int child_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture) override;
// Perform browser process registration for the custom scheme.
void RegisterCustomScheme(const std::string& scheme);
CefRefPtr<CefRequestContextImpl> request_context() 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:
// Returns the extension or app associated with |site_instance| or NULL.
const extensions::Extension* GetExtension(
content::SiteInstance* site_instance);
static void HandleExternalProtocolOnUIThread(
const GURL& url,
const content::ResourceRequestInfo::WebContentsGetter&
web_contents_getter);
CefBrowserMainParts* browser_main_parts_;
std::unique_ptr<content::PluginServiceFilter> plugin_service_filter_;

View File

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

View File

@@ -10,18 +10,19 @@
#include "libcef/browser/content_browser_client.h"
#include "libcef/browser/context.h"
#include "libcef/browser/net/cookie_store_source.h"
#include "libcef/browser/net/network_delegate.h"
#include "libcef/common/task_runner_impl.h"
#include "libcef/common/time_util.h"
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/threading/thread_restrictions.h"
#include "content/browser/storage_partition_impl.h"
#include "net/cookies/cookie_util.h"
#include "net/cookies/parsed_cookie.h"
#include "net/extras/sqlite/sqlite_persistent_cookie_store.h"
#include "net/url_request/url_request_context.h"
#include "url/gurl.h"
@@ -119,8 +120,7 @@ net::CookieStore* GetExistingCookieStoreHelper(
} // namespace
CefCookieManagerImpl::CefCookieManagerImpl(bool is_blocking)
: is_blocking_(is_blocking), weak_ptr_factory_(this) {}
CefCookieManagerImpl::CefCookieManagerImpl() : weak_ptr_factory_(this) {}
CefCookieManagerImpl::~CefCookieManagerImpl() {
CEF_REQUIRE_IOT();
@@ -131,7 +131,6 @@ void CefCookieManagerImpl::Initialize(
const CefString& path,
bool persist_session_cookies,
CefRefPtr<CefCompletionCallback> callback) {
CHECK(!is_blocking_);
if (request_context.get()) {
request_context_ = request_context;
request_context_->GetRequestContextImpl(
@@ -161,7 +160,7 @@ void CefCookieManagerImpl::GetCookieStore(
return;
}
DCHECK(is_blocking_ || cookie_source_);
DCHECK(cookie_store_.get());
// Binding ref-counted |this| to CookieStoreGetter may result in
// heap-use-after-free if (a) the CookieStoreGetter contains the last
@@ -184,8 +183,8 @@ void CefCookieManagerImpl::GetCookieStore(
net::CookieStore* CefCookieManagerImpl::GetExistingCookieStore() {
CEF_REQUIRE_IOT();
if (cookie_source_) {
return cookie_source_->GetCookieStore();
if (cookie_store_.get()) {
return cookie_store_.get();
} else if (request_context_impl_.get()) {
net::CookieStore* cookie_store =
request_context_impl_->GetExistingCookieStore();
@@ -193,9 +192,7 @@ net::CookieStore* CefCookieManagerImpl::GetExistingCookieStore() {
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;
}
@@ -286,13 +283,41 @@ bool CefCookieManagerImpl::SetStoragePath(
if (!path.empty())
new_path = base::FilePath(path);
if (!cookie_source_) {
cookie_source_.reset(new CefCookieStoreOwnerSource());
if (cookie_store_.get() &&
((storage_path_.empty() && path.empty()) || storage_path_ == new_path)) {
// The path has not changed so don't do anything.
RunAsyncCompletionOnIOThread(callback);
return true;
}
cookie_source_->SetCookieStoragePath(new_path, persist_session_cookies);
scoped_refptr<net::SQLitePersistentCookieStore> persistent_store;
if (!new_path.empty()) {
// TODO(cef): Move directory creation to the blocking pool instead of
// allowing file IO on this thread.
base::ThreadRestrictions::ScopedAllowIO allow_io;
if (base::DirectoryExists(new_path) || base::CreateDirectory(new_path)) {
const base::FilePath& cookie_path = new_path.AppendASCII("Cookies");
persistent_store = new net::SQLitePersistentCookieStore(
cookie_path, BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
BrowserThread::GetTaskRunnerForThread(BrowserThread::DB),
persist_session_cookies, NULL);
} else {
NOTREACHED() << "The cookie storage directory could not be created";
storage_path_.clear();
}
}
// Set the new cookie store that will be used for all new requests. The old
// cookie store, if any, will be automatically flushed and closed when no
// longer referenced.
cookie_store_.reset(new net::CookieMonster(persistent_store.get(), NULL));
if (persistent_store.get() && persist_session_cookies)
cookie_store_->SetPersistSessionCookies(true);
storage_path_ = new_path;
// Restore the previously supported schemes.
SetSupportedSchemesInternal(supported_schemes_, callback);
RunAsyncCompletionOnIOThread(callback);
return true;
}
@@ -470,10 +495,12 @@ void CefCookieManagerImpl::SetSupportedSchemesInternal(
return;
}
DCHECK(is_blocking_ || cookie_source_);
if (cookie_source_) {
cookie_source_->SetCookieSupportedSchemes(schemes);
}
DCHECK(cookie_store_.get());
if (!cookie_store_.get())
return;
supported_schemes_ = schemes;
SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_);
RunAsyncCompletionOnIOThread(callback);
}
@@ -525,13 +552,8 @@ void CefCookieManagerImpl::SetCookieInternal(
CEF_REQUIRE_IOT();
net::CookieStore* cookie_store = cookie_store_getter.Run();
if (!cookie_store) {
if (callback.get()) {
CEF_POST_TASK(CEF_IOT, base::Bind(&CefSetCookieCallback::OnComplete,
callback.get(), false));
}
if (!cookie_store)
return;
}
std::string name = CefString(&cookie.name).ToString();
std::string value = CefString(&cookie.value).ToString();
@@ -562,13 +584,8 @@ void CefCookieManagerImpl::DeleteCookiesInternal(
CEF_REQUIRE_IOT();
net::CookieStore* cookie_store = cookie_store_getter.Run();
if (!cookie_store) {
if (callback.get()) {
CEF_POST_TASK(CEF_IOT, base::Bind(&CefDeleteCookiesCallback::OnComplete,
callback.get(), 0));
}
if (!cookie_store)
return;
}
if (url.is_empty()) {
// Delete all cookies.
@@ -576,10 +593,10 @@ void CefCookieManagerImpl::DeleteCookiesInternal(
base::Bind(DeleteCookiesCallbackImpl, callback));
} else if (cookie_name.empty()) {
// Delete all matching host cookies.
net::CookieDeletionInfo delete_info;
delete_info.host = url.host();
cookie_store->DeleteAllMatchingInfoAsync(
delete_info, base::Bind(DeleteCookiesCallbackImpl, callback));
cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
base::Time(), base::Time::Max(),
content::StoragePartitionImpl::CreatePredicateForHostCookies(url),
base::Bind(DeleteCookiesCallbackImpl, callback));
} else {
// Delete all matching host and domain cookies.
cookie_store->DeleteCookieAsync(
@@ -593,10 +610,8 @@ void CefCookieManagerImpl::FlushStoreInternal(
CEF_REQUIRE_IOT();
net::CookieStore* cookie_store = cookie_store_getter.Run();
if (!cookie_store) {
RunAsyncCompletionOnIOThread(callback);
if (!cookie_store)
return;
}
cookie_store->FlushStore(base::Bind(RunAsyncCompletionOnIOThread, callback));
}
@@ -616,11 +631,6 @@ CefRefPtr<CefCookieManager> CefCookieManager::GetGlobalManager(
callback);
}
// static
CefRefPtr<CefCookieManager> CefCookieManager::GetBlockingManager() {
return new CefCookieManagerImpl(true);
}
// static
CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
const CefString& path,
@@ -632,8 +642,7 @@ CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
return NULL;
}
CefRefPtr<CefCookieManagerImpl> cookie_manager =
new CefCookieManagerImpl(false);
CefRefPtr<CefCookieManagerImpl> cookie_manager = new CefCookieManagerImpl();
cookie_manager->Initialize(NULL, path, persist_session_cookies, callback);
return cookie_manager.get();
}

View File

@@ -15,16 +15,13 @@
#include "base/memory/weak_ptr.h"
#include "net/cookies/cookie_monster.h"
class CefCookieStoreOwnerSource;
// Implementation of the CefCookieManager interface.
class CefCookieManagerImpl : public CefCookieManager {
public:
explicit CefCookieManagerImpl(bool is_blocking);
CefCookieManagerImpl();
~CefCookieManagerImpl() override;
// Must be called immediately after this object is created when |is_blocking|
// is false.
// Must be called immediately after this object is created.
void Initialize(CefRefPtr<CefRequestContextImpl> request_context,
const CefString& path,
bool persist_session_cookies,
@@ -116,15 +113,14 @@ class CefCookieManagerImpl : public CefCookieManager {
void FlushStoreInternal(CefRefPtr<CefCompletionCallback> callback,
const CookieStoreGetter& cookie_store_getter);
// If true all cookies will be blocked.
const bool is_blocking_;
// Used for cookie monsters owned by the context.
CefRefPtr<CefRequestContextImpl> request_context_;
scoped_refptr<CefURLRequestContextGetterImpl> request_context_impl_;
// Used for cookie monsters owned by this object.
std::unique_ptr<CefCookieStoreOwnerSource> cookie_source_;
base::FilePath storage_path_;
std::vector<std::string> supported_schemes_;
std::unique_ptr<net::CookieMonster> cookie_store_;
// Must be the last member.
base::WeakPtrFactory<CefCookieManagerImpl> weak_ptr_factory_;

View File

@@ -100,7 +100,7 @@ int ResponseWriter::Finish(int net_error,
}
static std::string GetFrontendURL() {
return base::StringPrintf("%s://%s/devtools_app.html",
return base::StringPrintf("%s://%s/inspector.html",
content::kChromeDevToolsScheme,
scheme::kChromeDevToolsHost);
}
@@ -163,7 +163,7 @@ void CefDevToolsFrontend::InspectElementAt(int x, int y) {
if (inspect_element_at_.x != x || inspect_element_at_.y != y)
inspect_element_at_.Set(x, y);
if (agent_host_)
agent_host_->InspectElement(inspected_contents_->GetFocusedFrame(), x, y);
agent_host_->InspectElement(this, x, y);
}
void CefDevToolsFrontend::Close() {
@@ -226,8 +226,8 @@ void CefDevToolsFrontend::DocumentAvailableInMainFrame() {
agent_host_ = agent_host;
agent_host_->AttachClient(this);
if (!inspect_element_at_.IsEmpty()) {
agent_host_->InspectElement(inspected_contents_->GetFocusedFrame(),
inspect_element_at_.x, inspect_element_at_.y);
agent_host_->InspectElement(this, inspect_element_at_.x,
inspect_element_at_.y);
}
}
}
@@ -240,8 +240,27 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
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(
const std::string& message) {
if (!agent_host_)
return;
std::string method;
base::ListValue* params = NULL;
base::DictionaryValue* dict = NULL;
@@ -256,7 +275,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
if (method == "dispatchProtocolMessage" && params && params->GetSize() == 1) {
std::string protocol_message;
if (!agent_host_ || !params->GetString(0, &protocol_message))
if (!params->GetString(0, &protocol_message))
return;
agent_host_->DispatchProtocolMessage(this, protocol_message);
} else if (method == "loadCompleted") {
@@ -299,9 +318,9 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
setting:
"It's not possible to disable this feature from settings."
chrome_policy {
DeveloperToolsAvailability {
DeveloperToolsDisabled {
policy_options {mode: MANDATORY}
DeveloperToolsAvailability: 2
DeveloperToolsDisabled: true
}
}
})");
@@ -342,8 +361,6 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);"));
} else if (method == "reattach") {
if (!agent_host_)
return;
agent_host_->DetachClient(this);
agent_host_->AttachClient(this);
} else if (method == "registerExtensionsAPI") {
@@ -392,7 +409,7 @@ void CefDevToolsFrontend::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK(it != pending_requests_.end());
base::DictionaryValue response;
auto headers = std::make_unique<base::DictionaryValue>();
auto headers = base::MakeUnique<base::DictionaryValue>();
net::HttpResponseHeaders* rh = source->GetResponseHeaders();
response.SetInteger("statusCode", rh ? rh->response_code() : 200);

View File

@@ -58,7 +58,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
return frontend_browser_;
}
private:
protected:
CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser,
content::WebContents* inspected_contents,
const CefPoint& inspect_element_at);
@@ -68,7 +68,8 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
void AgentHostClosed(content::DevToolsAgentHost* agent_host) override;
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
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:
// WebContentsObserver overrides

View File

@@ -105,7 +105,8 @@ void CefDevToolsManagerDelegate::StartHttpHandler(
if (!socket_factory)
return;
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();
@@ -137,6 +138,7 @@ std::string CefDevToolsManagerDelegate::GetDiscoveryPageHTML() {
.as_string();
}
bool CefDevToolsManagerDelegate::HasBundledFrontendResources() {
return true;
std::string CefDevToolsManagerDelegate::GetFrontendResource(
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(
const GURL& url) override;
std::string GetDiscoveryPageHTML() override;
bool HasBundledFrontendResources() override;
std::string GetFrontendResource(const std::string& path) override;
private:
DISALLOW_COPY_AND_ASSIGN(CefDevToolsManagerDelegate);

View File

@@ -6,11 +6,11 @@
#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"
CefDownloadItemImpl::CefDownloadItemImpl(download::DownloadItem* value)
: CefValueBase<CefDownloadItem, download::DownloadItem>(
CefDownloadItemImpl::CefDownloadItemImpl(content::DownloadItem* value)
: CefValueBase<CefDownloadItem, content::DownloadItem>(
value,
NULL,
kOwnerNoDelete,
@@ -26,17 +26,17 @@ bool CefDownloadItemImpl::IsValid() {
bool CefDownloadItemImpl::IsInProgress() {
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() {
CEF_VALUE_VERIFY_RETURN(false, false);
return const_value().GetState() == download::DownloadItem::COMPLETE;
return const_value().GetState() == content::DownloadItem::COMPLETE;
}
bool CefDownloadItemImpl::IsCanceled() {
CEF_VALUE_VERIFY_RETURN(false, false);
return const_value().GetState() == download::DownloadItem::CANCELLED;
return const_value().GetState() == content::DownloadItem::CANCELLED;
}
int64 CefDownloadItemImpl::GetCurrentSpeed() {

View File

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

View File

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

View File

@@ -12,11 +12,11 @@
#include "base/compiler_specific.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_delegate.h"
class CefDownloadManagerDelegate : public download::DownloadItem::Observer,
class CefDownloadManagerDelegate : public content::DownloadItem::Observer,
public content::DownloadManager::Observer,
public content::DownloadManagerDelegate,
public CefBrowserHostImpl::Observer {
@@ -26,24 +26,24 @@ class CefDownloadManagerDelegate : public download::DownloadItem::Observer,
private:
// DownloadItem::Observer methods.
void OnDownloadUpdated(download::DownloadItem* item) override;
void OnDownloadDestroyed(download::DownloadItem* item) override;
void OnDownloadUpdated(content::DownloadItem* item) override;
void OnDownloadDestroyed(content::DownloadItem* item) override;
// DownloadManager::Observer methods.
void OnDownloadCreated(content::DownloadManager* manager,
download::DownloadItem* item) override;
content::DownloadItem* item) override;
void ManagerGoingDown(content::DownloadManager* manager) override;
// DownloadManagerDelegate methods.
bool DetermineDownloadTarget(
download::DownloadItem* item,
content::DownloadItem* item,
const content::DownloadTargetCallback& callback) override;
void GetNextId(const content::DownloadIdCallback& callback) override;
// CefBrowserHostImpl::Observer methods.
void OnBrowserDestroyed(CefBrowserHostImpl* browser) override;
CefBrowserHostImpl* GetBrowser(download::DownloadItem* item);
CefBrowserHostImpl* GetBrowser(content::DownloadItem* item);
content::DownloadManager* manager_;
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 is necessary because DownloadItem::GetWebContents() may return NULL if
// 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_;
DISALLOW_COPY_AND_ASSIGN(CefDownloadManagerDelegate);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -160,9 +160,8 @@ CefRefPtr<CefBrowserHostImpl> CefExtensionFunctionDetails::GetCurrentBrowser()
CefRefPtr<CefExtensionHandler> handler = GetCefExtension()->GetHandler();
if (handler) {
// Give the handler an opportunity to specify a different browser.
CefRefPtr<CefBrowser> active_browser =
handler->GetActiveBrowser(GetCefExtension(), browser.get(),
function_->include_incognito_information());
CefRefPtr<CefBrowser> active_browser = handler->GetActiveBrowser(
GetCefExtension(), browser.get(), function_->include_incognito());
if (active_browser && active_browser != browser) {
CefRefPtr<CefBrowserHostImpl> active_browser_impl =
static_cast<CefBrowserHostImpl*>(active_browser.get());
@@ -201,9 +200,8 @@ bool CefExtensionFunctionDetails::CanAccessBrowser(
if (browser && browser->client()) {
CefRefPtr<CefExtensionHandler> handler = GetCefExtension()->GetHandler();
if (handler) {
return handler->CanAccessBrowser(
GetCefExtension(), browser.get(),
function_->include_incognito_information(), target);
return handler->CanAccessBrowser(GetCefExtension(), browser.get(),
function_->include_incognito(), target);
}
}
@@ -417,36 +415,36 @@ std::unique_ptr<api::tabs::Tab> CefExtensionFunctionDetails::CreateTabObject(
content::WebContents* contents = new_browser->web_contents();
bool is_loading = contents->IsLoading();
auto tab_object = std::make_unique<api::tabs::Tab>();
tab_object->id = std::make_unique<int>(new_browser->GetIdentifier());
auto tab_object = base::MakeUnique<api::tabs::Tab>();
tab_object->id = base::MakeUnique<int>(new_browser->GetIdentifier());
tab_object->index = index;
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);
tab_object->active = active;
tab_object->selected = true;
tab_object->highlighted = true;
tab_object->pinned = false;
// TODO(extensions): Use RecentlyAudibleHelper to populate |audible|.
tab_object->audible = base::MakeUnique<bool>(contents->WasRecentlyAudible());
tab_object->discarded = false;
tab_object->auto_discardable = false;
tab_object->muted_info = CreateMutedInfo(contents);
tab_object->incognito = false;
gfx::Size contents_size = contents->GetContainerBounds().size();
tab_object->width = std::make_unique<int>(contents_size.width());
tab_object->height = std::make_unique<int>(contents_size.height());
tab_object->url = std::make_unique<std::string>(contents->GetURL().spec());
tab_object->width = base::MakeUnique<int>(contents_size.width());
tab_object->height = base::MakeUnique<int>(contents_size.height());
tab_object->url = base::MakeUnique<std::string>(contents->GetURL().spec());
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();
if (entry && entry->GetFavicon().valid) {
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)
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;
}

View File

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

View File

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

View File

@@ -20,6 +20,7 @@
#include "base/path_service.h"
#include "base/strings/string_tokenizer.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/post_task.h"
#include "base/threading/thread_restrictions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_paths.h"
@@ -63,7 +64,7 @@ std::unique_ptr<base::DictionaryValue> ParseManifest(
JSONStringValueDeserializer deserializer(manifest_contents);
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.";
return NULL;
}
@@ -111,7 +112,7 @@ void LoadExtensionWithManifest(base::WeakPtr<CefExtensionSystem> context,
bool internal,
CefRefPtr<CefRequestContext> loader_context,
CefRefPtr<CefExtensionHandler> handler) {
CEF_REQUIRE_BLOCKING();
base::AssertBlockingAllowed();
std::unique_ptr<base::DictionaryValue> manifest =
ParseManifest(manifest_contents);
@@ -130,7 +131,7 @@ void LoadExtensionFromDisk(base::WeakPtr<CefExtensionSystem> context,
bool internal,
CefRefPtr<CefRequestContext> loader_context,
CefRefPtr<CefExtensionHandler> handler) {
CEF_REQUIRE_BLOCKING();
base::AssertBlockingAllowed();
base::FilePath manifest_path = root_directory.AppendASCII("manifest.json");
std::string manifest_contents;
@@ -238,7 +239,8 @@ void CefExtensionSystem::LoadExtension(
CefRefPtr<CefRequestContext> loader_context,
CefRefPtr<CefExtensionHandler> handler) {
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(),
root_directory, internal, loader_context, handler));
}
@@ -250,9 +252,11 @@ void CefExtensionSystem::LoadExtension(
CefRefPtr<CefRequestContext> loader_context,
CefRefPtr<CefExtensionHandler> handler) {
CEF_REQUIRE_UIT();
CEF_POST_USER_VISIBLE_TASK(base::BindOnce(
LoadExtensionWithManifest, weak_ptr_factory_.GetWeakPtr(),
manifest_contents, root_directory, internal, loader_context, handler));
base::PostTaskWithTraits(
FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()},
base::BindOnce(LoadExtensionWithManifest, weak_ptr_factory_.GetWeakPtr(),
manifest_contents, root_directory, internal,
loader_context, handler));
}
// Implementation based on ComponentLoader::Add.
@@ -363,10 +367,6 @@ void CefExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
app_sorting_.reset(new NullAppSorting);
}
void CefExtensionSystem::InitForIncognitoProfile() {
NOTREACHED();
}
ExtensionService* CefExtensionSystem::extension_service() {
return nullptr;
}
@@ -449,26 +449,15 @@ ContentVerifier* CefExtensionSystem::content_verifier() {
std::unique_ptr<ExtensionSet> CefExtensionSystem::GetDependentExtensions(
const Extension* extension) {
return std::make_unique<ExtensionSet>();
return base::MakeUnique<ExtensionSet>();
}
void CefExtensionSystem::InstallUpdate(
const std::string& extension_id,
const std::string& public_key,
const base::FilePath& temp_dir,
bool install_immediately,
InstallUpdateCallback install_update_callback) {
void CefExtensionSystem::InstallUpdate(const std::string& extension_id,
const base::FilePath& temp_dir) {
NOTREACHED();
base::DeleteFile(temp_dir, true /* recursive */);
}
bool CefExtensionSystem::FinishDelayedInstallationIfReady(
const std::string& extension_id,
bool install_immediately) {
NOTREACHED();
return false;
}
CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo(
const base::DictionaryValue* manifest,
const base::FilePath& directory,
@@ -477,7 +466,7 @@ CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo(
if (!root_directory.IsAbsolute()) {
// This path structure is required by
// url_request_util::MaybeCreateURLRequestResourceBundleJob.
CHECK(base::PathService::Get(chrome::DIR_RESOURCES, &root_directory));
CHECK(PathService::Get(chrome::DIR_RESOURCES, &root_directory));
root_directory = root_directory.Append(directory);
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -123,25 +123,6 @@ CefExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob(
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(
const GURL& url,
content::ResourceType resource_type,
@@ -254,19 +235,10 @@ bool CefExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) {
void CefExtensionsBrowserClient::PermitExternalProtocolHandler() {}
bool CefExtensionsBrowserClient::IsInDemoMode() {
return false;
}
bool CefExtensionsBrowserClient::IsRunningInForcedAppMode() {
return false;
}
bool CefExtensionsBrowserClient::IsAppModeForcedForApp(
const ExtensionId& extension_id) {
return false;
}
bool CefExtensionsBrowserClient::IsLoggedInAsPublicAccount() {
return false;
}

View File

@@ -51,18 +51,6 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
const base::FilePath& directory_path,
const std::string& content_security_policy,
bool send_cors_header) override;
base::FilePath GetBundleResourcePath(
const network::ResourceRequest& request,
const base::FilePath& extension_resources_path,
int* resource_id) const override;
void LoadResourceFromResourceBundle(
const network::ResourceRequest& request,
network::mojom::URLLoaderRequest loader,
const base::FilePath& resource_relative_path,
int resource_id,
const std::string& content_security_policy,
network::mojom::URLLoaderClientPtr client,
bool send_cors_header) override;
bool AllowCrossRendererResourceLoad(const GURL& url,
content::ResourceType resource_type,
ui::PageTransition page_transition,
@@ -84,9 +72,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
ExtensionHost** host) override;
bool DidVersionUpdate(content::BrowserContext* context) override;
void PermitExternalProtocolHandler() override;
bool IsInDemoMode() override;
bool IsRunningInForcedAppMode() override;
bool IsAppModeForcedForApp(const ExtensionId& extension_id) override;
bool IsLoggedInAsPublicAccount() override;
ExtensionSystemProvider* GetExtensionSystemFactory() override;
void RegisterExtensionFunctions(

View File

@@ -0,0 +1,107 @@
// 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/public/interfaces/geoposition.mojom.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::mojom::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::mojom::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::mojom::Geoposition::ErrorCode::NONE:
target.error_code = GEOPOSITON_ERROR_NONE;
break;
case device::mojom::Geoposition::ErrorCode::PERMISSION_DENIED:
target.error_code = GEOPOSITON_ERROR_PERMISSION_DENIED;
break;
case device::mojom::Geoposition::ErrorCode::POSITION_UNAVAILABLE:
target.error_code = GEOPOSITON_ERROR_POSITION_UNAVAILABLE;
break;
case device::mojom::Geoposition::ErrorCode::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(
content::WebContents* web_contents,
content::RenderFrameHost* render_frame_host,
const GURL& origin_url,
content::JavaScriptDialogType message_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
DialogClosedCallback callback,
bool* did_suppress_message) {
const GURL& origin_url = render_frame_host->GetLastCommittedURL();
CefRefPtr<CefClient> client = browser_->GetClient();
if (client.get()) {
CefRefPtr<CefJSDialogHandler> handler = client->GetJSDialogHandler();

View File

@@ -29,7 +29,7 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
// JavaScriptDialogManager methods.
void RunJavaScriptDialog(content::WebContents* web_contents,
content::RenderFrameHost* render_frame_host,
const GURL& origin_url,
content::JavaScriptDialogType message_type,
const base::string16& message_text,
const base::string16& default_prompt_text,

View File

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

View File

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

View File

@@ -346,6 +346,11 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateWheelEvent(
result.wheel_ticks_y = deltaY / scrollbarPixelsPerGtkTick;
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)
result.button = blink::WebMouseEvent::Button::kLeft;
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
@@ -383,8 +388,7 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMouseEvent(
TranslateModifiers(mouse_event.modifiers));
// timestamp
result.SetTimeStamp(base::TimeTicks() +
base::TimeDelta::FromSeconds(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/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "third_party/blink/public/platform/web_mouse_event.h"
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
#include "third_party/WebKit/public/platform/WebInputEvent.h"
#include "third_party/WebKit/public/platform/WebMouseEvent.h"
#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h"
#import "ui/base/cocoa/cocoa_base_utils.h"
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
#include "ui/events/keycodes/keyboard_codes_posix.h"
@@ -99,7 +99,6 @@
}
- (void)cleanup:(id)window {
[window_ setDelegate:nil];
[self release];
}
@@ -424,6 +423,11 @@ void CefBrowserPlatformDelegateNativeMac::TranslateWheelEvent(
result.wheel_ticks_y = deltaY / scrollbarPixelsPerCocoaTick;
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)
result.button = blink::WebMouseEvent::Button::kLeft;
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
@@ -469,8 +473,7 @@ void CefBrowserPlatformDelegateNativeMac::TranslateMouseEvent(
TranslateModifiers(mouse_event.modifiers));
// timestamp - Mac OSX specific
result.SetTimeStamp(base::TimeTicks() +
base::TimeDelta::FromSeconds(currentEventTimestamp()));
result.SetTimeStampSeconds(currentEventTimestamp());
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
}

View File

@@ -22,8 +22,8 @@
#include "base/win/registry.h"
#include "base/win/win_util.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "third_party/blink/public/platform/web_mouse_event.h"
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
#include "third_party/WebKit/public/platform/WebMouseEvent.h"
#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h"
#include "ui/aura/window.h"
#include "ui/base/win/shell.h"
#include "ui/display/display.h"
@@ -42,7 +42,7 @@
namespace {
void WriteTempFileAndView(scoped_refptr<base::RefCountedString> str) {
CEF_REQUIRE_BLOCKING();
CEF_REQUIRE_FILET();
base::FilePath tmp_file;
if (!base::CreateTemporaryFile(&tmp_file))
@@ -84,7 +84,7 @@ bool HasExternalHandler(const std::string& scheme) {
}
void ExecuteExternalProtocol(const GURL& url) {
CEF_REQUIRE_BLOCKING();
CEF_REQUIRE_FILET();
if (!HasExternalHandler(url.scheme()))
return;
@@ -324,7 +324,7 @@ void CefBrowserPlatformDelegateNativeWin::ViewText(const std::string& text) {
std::string str = text;
scoped_refptr<base::RefCountedString> str_ref =
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(
@@ -370,7 +370,8 @@ void CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
void CefBrowserPlatformDelegateNativeWin::HandleExternalProtocol(
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(
@@ -557,8 +558,7 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMouseEvent(
TranslateModifiers(mouse_event.modifiers));
// timestamp
result.SetTimeStamp(base::TimeTicks() +
base::TimeDelta::FromMilliseconds(GetMessageTime()));
result.SetTimeStampSeconds(GetMessageTime() / 1000.0);
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
}

View File

@@ -5,8 +5,6 @@
#include "libcef/browser/native/file_dialog_runner_win.h"
#include <windows.h>
#include <commdlg.h>
#include <shlobj.h>
#include <wrl/client.h>

View File

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

View File

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

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