mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
81 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9aea513c1c | ||
|
df2fcc86b7 | ||
|
6d8faa4942 | ||
|
7c74b173ae | ||
|
b3c8970bae | ||
|
ee28c52b2d | ||
|
396e93c645 | ||
|
e5b78a54cf | ||
|
aabe4c4cfc | ||
|
a42963aa05 | ||
|
4b48a153c7 | ||
|
fcd71ff604 | ||
|
e81cdf2664 | ||
|
b7e0359c52 | ||
|
0357a228bd | ||
|
500aec0399 | ||
|
142c56012f | ||
|
b46a26f6a4 | ||
|
29552e0ff5 | ||
|
f406a7400a | ||
|
db41052eac | ||
|
503b1176a5 | ||
|
2e7b0e4a16 | ||
|
f4dd8c19ff | ||
|
57fb011377 | ||
|
9e644b7538 | ||
|
ac86b61139 | ||
|
c3f2c2e91c | ||
|
de1bd286f8 | ||
|
98de8e79db | ||
|
d34d3d1b3b | ||
|
d7e1312e9d | ||
|
a2f430c6f3 | ||
|
128fbfb2d6 | ||
|
6006f77bd9 | ||
|
232f6bc427 | ||
|
50ca6928c3 | ||
|
1c7391b70a | ||
|
0cd8169125 | ||
|
6e457d6bb1 | ||
|
8b4b6ac2ed | ||
|
3750c59aaa | ||
|
7b3d7b8575 | ||
|
e5d0cfe639 | ||
|
f02e7b54b3 | ||
|
accf1f1613 | ||
|
a724e90d52 | ||
|
4ddff77339 | ||
|
54a015f785 | ||
|
f052e282dd | ||
|
2fe9f7bd31 | ||
|
cafa5954dc | ||
|
d8bc3d8372 | ||
|
4c5ccce85f | ||
|
552a3bf353 | ||
|
c04652d193 | ||
|
56557833d9 | ||
|
6a9a51222e | ||
|
14c030174e | ||
|
8d51acb9be | ||
|
d5e141648b | ||
|
4c795f5188 | ||
|
7fe13d87c6 | ||
|
7dcabf547b | ||
|
69178d519e | ||
|
493bec52c9 | ||
|
b14167ad04 | ||
|
85d041c0e2 | ||
|
be2160e6c3 | ||
|
232a68480e | ||
|
facee1f750 | ||
|
7e783d6a37 | ||
|
059ed41926 | ||
|
7840b4f406 | ||
|
4a6e9b636e | ||
|
89a1f2b372 | ||
|
bfdc2655ad | ||
|
51136f6541 | ||
|
9f7bdcf7d5 | ||
|
486e69e23b | ||
|
c506c8c5c0 |
84
BUILD.gn
84
BUILD.gn
@@ -13,14 +13,14 @@
|
||||
# Optionally configure GN by setting the `GN_DEFINES` and/or `GN_ARGUMENTS`
|
||||
# environment variables.
|
||||
#
|
||||
# Example A: Use /DEBUG:FASTLINK on Windows:
|
||||
# Example A: Create an official build on Windows:
|
||||
#
|
||||
# > set GN_DEFINES=is_win_fastlink=true
|
||||
# > set GN_DEFINES=is_official_build=true
|
||||
#
|
||||
# Example B: Generate VS2015 project files in addition to the default Ninja
|
||||
# Example B: Generate VS2017 project files in addition to the default Ninja
|
||||
# build files on Windows:
|
||||
#
|
||||
# > set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
|
||||
# > set GN_ARGUMENTS=--ide=vs2017 --sln=cef --filters=//cef/*
|
||||
#
|
||||
# After completing the "GN Automated Build" or "GN Manual Build" section
|
||||
# open "out\<build_dir>\cef.sln" for editing and debugging. Building must
|
||||
@@ -111,12 +111,14 @@ 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("//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")
|
||||
@@ -147,6 +149,12 @@ if (is_clang) {
|
||||
assert(!clang_use_chrome_plugins)
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
# Use system fontconfig. This avoids a startup hang on Ubuntu 16.04.4 (see
|
||||
# issue #2424).
|
||||
assert(!use_bundled_fontconfig)
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
# Always generate dSYM files. The make_distrib script will fail if
|
||||
# enable_dsyms=true is not explicitly set when is_official_build=false.
|
||||
@@ -263,12 +271,12 @@ if (is_win) {
|
||||
|
||||
deps = [
|
||||
"//components/crash/core/common", # crash_keys
|
||||
"//gpu/config:crash_keys",
|
||||
|
||||
# Required by chrome_switches.cc
|
||||
"//chrome/common:features",
|
||||
"//ppapi/features:features",
|
||||
"//printing/features:features",
|
||||
"//ui/base:ui_features",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -280,6 +288,8 @@ static_library("libcef_static") {
|
||||
"libcef/browser/browser_context.h",
|
||||
"libcef/browser/browser_context_impl.cc",
|
||||
"libcef/browser/browser_context_impl.h",
|
||||
"libcef/browser/browser_context_keyed_service_factories.cc",
|
||||
"libcef/browser/browser_context_keyed_service_factories.h",
|
||||
"libcef/browser/browser_context_proxy.cc",
|
||||
"libcef/browser/browser_context_proxy.h",
|
||||
"libcef/browser/browser_host_impl.cc",
|
||||
@@ -329,8 +339,6 @@ static_library("libcef_static") {
|
||||
"libcef/browser/extensions/api/storage/sync_value_store_cache.h",
|
||||
"libcef/browser/extensions/api/tabs/tabs_api.cc",
|
||||
"libcef/browser/extensions/api/tabs/tabs_api.h",
|
||||
"libcef/browser/extensions/browser_context_keyed_service_factories.cc",
|
||||
"libcef/browser/extensions/browser_context_keyed_service_factories.h",
|
||||
"libcef/browser/extensions/browser_extensions_util.cc",
|
||||
"libcef/browser/extensions/browser_extensions_util.h",
|
||||
"libcef/browser/extensions/browser_platform_delegate_background.cc",
|
||||
@@ -372,7 +380,6 @@ 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",
|
||||
@@ -441,16 +448,6 @@ 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/pepper/browser_pepper_host_factory.cc",
|
||||
"libcef/browser/pepper/browser_pepper_host_factory.h",
|
||||
"libcef/browser/permissions/permission_context.cc",
|
||||
"libcef/browser/permissions/permission_context.h",
|
||||
"libcef/browser/permissions/permission_manager.cc",
|
||||
"libcef/browser/permissions/permission_manager.h",
|
||||
"libcef/browser/permissions/permission_util.cc",
|
||||
"libcef/browser/permissions/permission_util.h",
|
||||
"libcef/browser/plugins/plugin_info_message_filter.cc",
|
||||
"libcef/browser/plugins/plugin_info_message_filter.h",
|
||||
"libcef/browser/plugins/plugin_service_filter.cc",
|
||||
"libcef/browser/plugins/plugin_service_filter.h",
|
||||
"libcef/browser/prefs/browser_prefs.cc",
|
||||
@@ -592,16 +589,6 @@ static_library("libcef_static") {
|
||||
"libcef/renderer/extensions/print_render_frame_helper_delegate.h",
|
||||
"libcef/renderer/frame_impl.cc",
|
||||
"libcef/renderer/frame_impl.h",
|
||||
"libcef/renderer/media/cef_key_systems.cc",
|
||||
"libcef/renderer/media/cef_key_systems.h",
|
||||
"libcef/renderer/pepper/pepper_helper.cc",
|
||||
"libcef/renderer/pepper/pepper_helper.h",
|
||||
"libcef/renderer/pepper/renderer_pepper_host_factory.cc",
|
||||
"libcef/renderer/pepper/renderer_pepper_host_factory.h",
|
||||
"libcef/renderer/plugins/cef_plugin_placeholder.cc",
|
||||
"libcef/renderer/plugins/cef_plugin_placeholder.h",
|
||||
"libcef/renderer/plugins/plugin_preroller.cc",
|
||||
"libcef/renderer/plugins/plugin_preroller.h",
|
||||
"libcef/renderer/render_frame_observer.cc",
|
||||
"libcef/renderer/render_frame_observer.h",
|
||||
"libcef/renderer/render_frame_util.cc",
|
||||
@@ -667,6 +654,7 @@ static_library("libcef_static") {
|
||||
"//chrome/child",
|
||||
"//chrome/common",
|
||||
"//chrome/renderer",
|
||||
"//chrome/services/printing:lib",
|
||||
"//chrome/utility",
|
||||
"//components/cdm/renderer",
|
||||
"//components/content_settings/core/browser",
|
||||
@@ -708,8 +696,6 @@ static_library("libcef_static") {
|
||||
"//content/public/utility",
|
||||
"//crypto",
|
||||
"//device/base",
|
||||
"//device/geolocation",
|
||||
"//device/hid",
|
||||
"//extensions/browser",
|
||||
"//extensions/browser/api:api_registration",
|
||||
"//extensions/common/api",
|
||||
@@ -727,13 +713,15 @@ static_library("libcef_static") {
|
||||
"//pdf",
|
||||
"//ppapi/features",
|
||||
"//printing/features",
|
||||
"//services/network:network_service",
|
||||
"//services/network/public/cpp",
|
||||
"//services/service_manager/embedder",
|
||||
"//services/service_manager/public/interfaces",
|
||||
"//services/service_manager/runner/common",
|
||||
"//skia",
|
||||
"//storage/browser",
|
||||
"//third_party/brotli:dec",
|
||||
"//third_party/cld",
|
||||
"//third_party/cld_3/src/src:cld_3",
|
||||
"//third_party/hunspell",
|
||||
"//third_party/leveldatabase",
|
||||
"//third_party/libxml",
|
||||
@@ -742,7 +730,6 @@ static_library("libcef_static") {
|
||||
"//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",
|
||||
@@ -775,8 +762,6 @@ static_library("libcef_static") {
|
||||
"libcef/browser/osr/browser_platform_delegate_osr_win.cc",
|
||||
"libcef/browser/osr/browser_platform_delegate_osr_win.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",
|
||||
@@ -837,7 +822,7 @@ static_library("libcef_static") {
|
||||
}
|
||||
|
||||
if (is_win || is_mac) {
|
||||
deps += [ "//third_party/crashpad/crashpad/handler:handler_lib" ]
|
||||
deps += [ "//third_party/crashpad/crashpad/handler" ]
|
||||
}
|
||||
|
||||
if (use_x11) {
|
||||
@@ -845,12 +830,21 @@ 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",
|
||||
@@ -925,6 +919,7 @@ static_library("libcef_static") {
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//services/ui",
|
||||
"//ui/aura",
|
||||
"//ui/events",
|
||||
"//ui/strings",
|
||||
@@ -942,6 +937,11 @@ static_library("libcef_static") {
|
||||
if (is_win) {
|
||||
sources += [
|
||||
# Support for UI input events.
|
||||
# Part of //base/test:test_config which is testingonly.
|
||||
"//base/test/test_switches.cc",
|
||||
"//base/test/test_switches.h",
|
||||
"//base/test/test_timeouts.cc",
|
||||
"//base/test/test_timeouts.h",
|
||||
# Part of //ui/aura:test_support which is testingonly.
|
||||
"//ui/aura/test/ui_controls_factory_aurawin.cc",
|
||||
# Part of //ui/base:test_support which is testingonly.
|
||||
@@ -1029,6 +1029,9 @@ if (is_win) {
|
||||
#
|
||||
|
||||
cef_packaged_services = [
|
||||
"//chrome/app:chrome_manifest", # For spell checking.
|
||||
"//chrome/services/printing:manifest",
|
||||
"//services/metrics:manifest",
|
||||
"//services/proxy_resolver:proxy_resolver_manifest",
|
||||
]
|
||||
|
||||
@@ -1147,6 +1150,7 @@ repack("pak_extensions") {
|
||||
"$root_gen_dir/chrome/component_extension_resources.pak",
|
||||
"$root_gen_dir/extensions/extensions_renderer_resources.pak",
|
||||
"$root_gen_dir/extensions/extensions_resources.pak",
|
||||
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
|
||||
"$root_gen_dir/ui/resources/webui_resources.pak",
|
||||
]
|
||||
|
||||
@@ -1157,6 +1161,7 @@ repack("pak_extensions") {
|
||||
"//chrome/browser/resources:component_extension_resources",
|
||||
"//extensions:extensions_renderer_resources",
|
||||
"//extensions:extensions_resources_grd",
|
||||
"//mojo/public/js:resources",
|
||||
"//ui/resources:webui_resources_grd",
|
||||
]
|
||||
|
||||
@@ -1351,7 +1356,6 @@ if (is_mac) {
|
||||
"$root_out_dir/cef_200_percent.pak",
|
||||
"$root_out_dir/cef_extensions.pak",
|
||||
"$root_out_dir/devtools_resources.pak",
|
||||
"$root_out_dir/v8_context_snapshot.bin",
|
||||
"$root_out_dir/$widevine_cdm_path/widevinecdmadapter.plugin",
|
||||
]
|
||||
|
||||
@@ -1362,7 +1366,6 @@ if (is_mac) {
|
||||
":pak_devtools",
|
||||
":pak_extensions",
|
||||
"//third_party/widevine/cdm:widevinecdmadapter",
|
||||
"//tools/v8_context_snapshot:v8_context_snapshot",
|
||||
]
|
||||
|
||||
if (icu_use_data_file) {
|
||||
@@ -1376,6 +1379,10 @@ 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 = [
|
||||
@@ -1853,9 +1860,6 @@ if (is_mac) {
|
||||
deps += [
|
||||
":cef_sandbox",
|
||||
"//build/win:default_exe_manifest",
|
||||
|
||||
# Tool that can be used for testing crash reporting.
|
||||
"//content/shell:content_shell_crash_service",
|
||||
]
|
||||
|
||||
libs = [
|
||||
|
@@ -7,5 +7,5 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/63.0.3239.132',
|
||||
'chromium_checkout': 'refs/tags/65.0.3325.181',
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@ The CEF project is an extension of the Chromium project. CEF maintains developme
|
||||
|
||||
The base CEF framework includes support for the C and C++ programming languages. Thanks to the hard work of external maintainers CEF can integrate with a number of other programming languages and frameworks. These external projects are not maintained by CEF so please contact the respective project maintainer if you have any questions or issues.
|
||||
|
||||
* .Net - https://github.com/chillitom/CefSharp
|
||||
* .Net (CEF3) - https://github.com/cefsharp/CefSharp
|
||||
* .Net (CEF1) - https://bitbucket.org/fddima/cefglue
|
||||
* .Net/Mono (CEF3) - https://bitbucket.org/xilium/xilium.cefglue
|
||||
* .Net (CEF3) - https://bitbucket.org/chromiumfx/chromiumfx
|
||||
@@ -82,4 +82,4 @@ If you would like to contribute source code changes to CEF please follow the bel
|
||||
* Be submitted against the current [CEF master branch](https://bitbucket.org/chromiumembedded/cef/src/?at=master) unless explicitly fixing a bug in a CEF release branch.
|
||||
* Follow the style of existing CEF source files. In general CEF uses the [Chromium coding style](http://www.chromium.org/developers/coding-style).
|
||||
* Include new or modified unit tests as appropriate to the functionality.
|
||||
* Not include unnecessary or unrelated changes.
|
||||
* Not include unnecessary or unrelated changes.
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# by hand. See the translator.README.txt file in the tools directory for
|
||||
# more information.
|
||||
#
|
||||
# $hash=5f69924ad7517dee8adf933a7c013616ebb94c36$
|
||||
# $hash=bede6f61d0f5b45669b8e924144e4200c41f869b$
|
||||
#
|
||||
|
||||
{
|
||||
@@ -38,8 +38,6 @@
|
||||
'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',
|
||||
@@ -131,8 +129,6 @@
|
||||
'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',
|
||||
@@ -286,14 +282,8 @@
|
||||
'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',
|
||||
@@ -572,14 +562,8 @@
|
||||
'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',
|
||||
|
@@ -442,7 +442,6 @@
|
||||
'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',
|
||||
|
@@ -86,6 +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 complain about code in ascii art
|
||||
)
|
||||
list(APPEND CEF_C_COMPILER_FLAGS
|
||||
-std=c99 # Use the C99 language standard
|
||||
@@ -197,9 +198,12 @@ if(OS_LINUX)
|
||||
set(CEF_BINARY_FILES
|
||||
chrome-sandbox
|
||||
libcef.so
|
||||
libEGL.so
|
||||
libGLESv2.so
|
||||
natives_blob.bin
|
||||
snapshot_blob.bin
|
||||
v8_context_snapshot.bin
|
||||
swiftshader
|
||||
)
|
||||
|
||||
# List of CEF resource files.
|
||||
@@ -349,6 +353,13 @@ if(OS_WINDOWS)
|
||||
# Consumers who run into LNK4099 warnings can pass /Z7 instead (see issue #385).
|
||||
set(CEF_DEBUG_INFO_FLAG "/Zi" CACHE STRING "Optional flag specifying specific /Z flag to use")
|
||||
|
||||
# Consumers using different runtime types may want to pass different flags
|
||||
set(CEF_RUNTIME_LIBRARY_FLAG "/MT" CACHE STRING "Optional flag specifying which runtime to use")
|
||||
if (CEF_RUNTIME_LIBRARY_FLAG)
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG ${CEF_RUNTIME_LIBRARY_FLAG}d)
|
||||
list(APPEND CEF_COMPILER_FLAGS_RELEASE ${CEF_RUNTIME_LIBRARY_FLAG})
|
||||
endif()
|
||||
|
||||
# Platform-specific compiler/linker flags.
|
||||
set(CEF_LIBTYPE STATIC)
|
||||
list(APPEND CEF_COMPILER_FLAGS
|
||||
@@ -368,12 +379,10 @@ if(OS_WINDOWS)
|
||||
${CEF_DEBUG_INFO_FLAG}
|
||||
)
|
||||
list(APPEND CEF_COMPILER_FLAGS_DEBUG
|
||||
/MTd # Multithreaded debug runtime
|
||||
/RTC1 # Disable optimizations
|
||||
/Od # Enable basic run-time checks
|
||||
)
|
||||
list(APPEND CEF_COMPILER_FLAGS_RELEASE
|
||||
/MT # Multithreaded release runtime
|
||||
/O2 # Optimize for maximum speed
|
||||
/Ob2 # Inline any suitable function
|
||||
/GF # Enable string pooling
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=2a93a2e7a17c81d39ad1b8c1c1aa93d5d90b1100$
|
||||
// $hash=1dbb0adf7ac5fd42b5a79d271834781664a7fd47$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
||||
@@ -48,7 +48,6 @@
|
||||
#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"
|
||||
@@ -115,13 +114,6 @@ 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.
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=e0605a0c9918e225b9282b6d5e6138a7d697945b$
|
||||
// $hash=00e6d1aa80d5998d89cc272dcb199cde0add12fa$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
|
||||
@@ -159,6 +159,16 @@ typedef struct _cef_cookie_manager_t {
|
||||
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
|
||||
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
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=0a8f009404aedce3f63f83864f754df60c36b293$
|
||||
// $hash=e4da4fab11e33d34d70714be22e6f72579586ffe$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_CRASH_UTIL_CAPI_H_
|
||||
@@ -129,14 +129,12 @@ extern "C" {
|
||||
//
|
||||
// CrashKeys section:
|
||||
//
|
||||
// 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.
|
||||
// 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.
|
||||
///
|
||||
CEF_EXPORT int cef_crash_reporting_enabled();
|
||||
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=68988be0c2e0a1481ee6b27930391976c7041317$
|
||||
// $hash=ab31ef5d72b4b1c9809698e5fbbdae21918af713$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_
|
||||
@@ -118,6 +118,7 @@ typedef struct _cef_display_handler_t {
|
||||
///
|
||||
int(CEF_CALLBACK* on_console_message)(struct _cef_display_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_log_severity_t level,
|
||||
const cef_string_t* message,
|
||||
const cef_string_t* source,
|
||||
int line);
|
||||
|
@@ -1,79 +0,0 @@
|
||||
// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool and should not edited
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=2af1552c0d2dada94c325be8249bfd889b22ca58$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_GEOLOCATION_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_GEOLOCATION_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
// Implement this structure to receive geolocation updates. The functions of
|
||||
// this structure will be called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_get_geolocation_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Called with the 'best available' location information or, if the location
|
||||
// update failed, with error information.
|
||||
///
|
||||
void(CEF_CALLBACK* on_location_update)(
|
||||
struct _cef_get_geolocation_callback_t* self,
|
||||
const struct _cef_geoposition_t* position);
|
||||
} cef_get_geolocation_callback_t;
|
||||
|
||||
///
|
||||
// Request a one-time geolocation update. This function bypasses any user
|
||||
// permission checks so should only be used by code that is allowed to access
|
||||
// location information.
|
||||
///
|
||||
CEF_EXPORT int cef_get_geolocation(cef_get_geolocation_callback_t* callback);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_GEOLOCATION_CAPI_H_
|
@@ -1,106 +0,0 @@
|
||||
// Copyright (c) 2018 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool and should not edited
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=33573a1b0f1caa917899c087b9febe83c2cfd41f$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
// Callback structure used for asynchronous continuation of geolocation
|
||||
// permission requests.
|
||||
///
|
||||
typedef struct _cef_geolocation_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Call to allow or deny geolocation access.
|
||||
///
|
||||
void(CEF_CALLBACK* cont)(struct _cef_geolocation_callback_t* self, int allow);
|
||||
} cef_geolocation_callback_t;
|
||||
|
||||
///
|
||||
// Implement this structure to handle events related to geolocation permission
|
||||
// requests. The functions of this structure will be called on the browser
|
||||
// process UI thread.
|
||||
///
|
||||
typedef struct _cef_geolocation_handler_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Called when a page requests permission to access geolocation information.
|
||||
// |requesting_url| is the URL requesting permission and |request_id| is the
|
||||
// unique ID for the permission request. Return true (1) and call
|
||||
// cef_geolocation_callback_t::cont() either in this function or at a later
|
||||
// time to continue or cancel the request. Return false (0) to cancel the
|
||||
// request immediately.
|
||||
///
|
||||
int(CEF_CALLBACK* on_request_geolocation_permission)(
|
||||
struct _cef_geolocation_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* requesting_url,
|
||||
int request_id,
|
||||
struct _cef_geolocation_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called when a geolocation access request is canceled. |request_id| is the
|
||||
// unique ID for the permission request.
|
||||
///
|
||||
void(CEF_CALLBACK* on_cancel_geolocation_permission)(
|
||||
struct _cef_geolocation_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int request_id);
|
||||
} cef_geolocation_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_GEOLOCATION_HANDLER_CAPI_H_
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=44b61ca19efaae0a664d6d502d550755fbf326fa$
|
||||
// $hash=fb34d81715ada28d5509cd33aa36f37829933a91$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RENDER_PROCESS_HANDLER_CAPI_H_
|
||||
@@ -102,19 +102,6 @@ typedef struct _cef_render_process_handler_t {
|
||||
struct _cef_load_handler_t*(CEF_CALLBACK* get_load_handler)(
|
||||
struct _cef_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
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=52ba75e5a733ed0be9a064b9794c0181e714c090$
|
||||
// $hash=b8b5a62b11dbc48f0733c0522864e4dbda8b4f59$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||
@@ -247,6 +247,29 @@ typedef struct _cef_request_handler_t {
|
||||
const cef_string_t* scheme,
|
||||
struct _cef_auth_callback_t* callback);
|
||||
|
||||
///
|
||||
// Called on the IO thread before sending a network request with a "Cookie"
|
||||
// request header. Return true (1) to allow cookies to be included in the
|
||||
// network request or false (0) to block cookies. The |request| object should
|
||||
// not be modified in this callback.
|
||||
///
|
||||
int(CEF_CALLBACK* can_get_cookies)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request);
|
||||
|
||||
///
|
||||
// Called on the IO thread when receiving a network request with a "Set-
|
||||
// Cookie" response header value represented by |cookie|. Return true (1) to
|
||||
// allow the cookie to be stored or false (0) to block the cookie. The
|
||||
// |request| object should not be modified in this callback.
|
||||
///
|
||||
int(CEF_CALLBACK* can_set_cookie)(struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_frame_t* frame,
|
||||
struct _cef_request_t* request,
|
||||
const struct _cef_cookie_t* cookie);
|
||||
|
||||
///
|
||||
// Called on the IO thread when JavaScript requests a specific storage quota
|
||||
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the
|
||||
|
@@ -50,7 +50,7 @@ class CefAuthCallback : public virtual CefBaseRefCounted {
|
||||
///
|
||||
// Continue the authentication request.
|
||||
///
|
||||
/*--cef(capi_name=cont,optional_param=password)--*/
|
||||
/*--cef(capi_name=cont,optional_param=username,optional_param=password)--*/
|
||||
virtual void Continue(const CefString& username,
|
||||
const CefString& password) = 0;
|
||||
|
||||
|
@@ -46,7 +46,6 @@
|
||||
#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"
|
||||
@@ -108,15 +107,6 @@ 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.
|
||||
|
@@ -64,6 +64,17 @@ 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
|
||||
|
@@ -121,14 +121,12 @@
|
||||
//
|
||||
// CrashKeys section:
|
||||
//
|
||||
// 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.
|
||||
// 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.
|
||||
///
|
||||
/*--cef()--*/
|
||||
bool CefCrashReportingEnabled();
|
||||
|
@@ -109,6 +109,7 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef(optional_param=message,optional_param=source)--*/
|
||||
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
cef_log_severity_t level,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line) {
|
||||
|
@@ -1,66 +0,0 @@
|
||||
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// The contents of this file must follow a specific format in order to
|
||||
// support the CEF translator tool. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CEF_GEOLOCATION_H_
|
||||
#define CEF_INCLUDE_CEF_GEOLOCATION_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
///
|
||||
// Implement this interface to receive geolocation updates. The methods of this
|
||||
// class will be called on the browser process UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefGetGeolocationCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Called with the 'best available' location information or, if the location
|
||||
// update failed, with error information.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnLocationUpdate(const CefGeoposition& position) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Request a one-time geolocation update. This function bypasses any user
|
||||
// permission checks so should only be used by code that is allowed to access
|
||||
// location information.
|
||||
///
|
||||
/*--cef()--*/
|
||||
bool CefGetGeolocation(CefRefPtr<CefGetGeolocationCallback> callback);
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_GEOLOCATION_H_
|
@@ -1,92 +0,0 @@
|
||||
// Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// The contents of this file must follow a specific format in order to
|
||||
// support the CEF translator tool. See the translator.README.txt file in the
|
||||
// tools directory for more information.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_
|
||||
#define CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_browser.h"
|
||||
|
||||
///
|
||||
// Callback interface used for asynchronous continuation of geolocation
|
||||
// permission requests.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefGeolocationCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Call to allow or deny geolocation access.
|
||||
///
|
||||
/*--cef(capi_name=cont)--*/
|
||||
virtual void Continue(bool allow) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Implement this interface to handle events related to geolocation permission
|
||||
// requests. The methods of this class will be called on the browser process UI
|
||||
// thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefGeolocationHandler : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Called when a page requests permission to access geolocation information.
|
||||
// |requesting_url| is the URL requesting permission and |request_id| is the
|
||||
// unique ID for the permission request. Return true and call
|
||||
// CefGeolocationCallback::Continue() either in this method or at a later
|
||||
// time to continue or cancel the request. Return false to cancel the request
|
||||
// immediately.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnRequestGeolocationPermission(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const CefString& requesting_url,
|
||||
int request_id,
|
||||
CefRefPtr<CefGeolocationCallback> callback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called when a geolocation access request is canceled. |request_id| is the
|
||||
// unique ID for the permission request.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnCancelGeolocationPermission(CefRefPtr<CefBrowser> browser,
|
||||
int request_id) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_GEOLOCATION_HANDLER_H_
|
@@ -92,20 +92,6 @@ 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()
|
||||
|
@@ -252,6 +252,33 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread before sending a network request with a "Cookie"
|
||||
// request header. Return true to allow cookies to be included in the network
|
||||
// request or false to block cookies. The |request| object should not be
|
||||
// modified in this callback.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool CanGetCookies(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread when receiving a network request with a
|
||||
// "Set-Cookie" response header value represented by |cookie|. Return true to
|
||||
// allow the cookie to be stored or false to block the cookie. The |request|
|
||||
// object should not be modified in this callback.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool CanSetCookie(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
const CefCookie& cookie) {
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the IO thread when JavaScript requests a specific storage quota
|
||||
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the
|
||||
|
@@ -94,6 +94,11 @@ typedef enum {
|
||||
///
|
||||
LOGSEVERITY_VERBOSE,
|
||||
|
||||
///
|
||||
// DEBUG logging.
|
||||
///
|
||||
LOGSEVERITY_DEBUG = LOGSEVERITY_VERBOSE,
|
||||
|
||||
///
|
||||
// INFO logging.
|
||||
///
|
||||
@@ -2041,74 +2046,6 @@ 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.
|
||||
///
|
||||
|
@@ -832,37 +832,6 @@ 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;
|
||||
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
|
||||
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
#include "components/user_prefs/user_prefs.h"
|
||||
@@ -68,6 +69,9 @@ void CefBrowserContext::PostInitialize() {
|
||||
const bool extensions_enabled = extensions::ExtensionsEnabled();
|
||||
if (extensions_enabled && !is_proxy_)
|
||||
extension_system_->Init();
|
||||
|
||||
ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
|
||||
this, resource_context_.get());
|
||||
}
|
||||
|
||||
void CefBrowserContext::Shutdown() {
|
||||
@@ -76,6 +80,9 @@ void CefBrowserContext::Shutdown() {
|
||||
// Send notifications to clean up objects associated with this Profile.
|
||||
MaybeSendDestroyedNotification();
|
||||
|
||||
ChromePluginServiceFilter::GetInstance()->UnregisterResourceContext(
|
||||
resource_context_.get());
|
||||
|
||||
// Remove any BrowserContextKeyedServiceFactory associations. This must be
|
||||
// called before the ProxyService owned by CefBrowserContextImpl is destroyed.
|
||||
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#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"
|
||||
@@ -27,11 +26,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"
|
||||
@@ -41,6 +40,7 @@
|
||||
#include "extensions/browser/extension_protocols.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/proxy/proxy_config_service.h"
|
||||
#include "net/proxy/proxy_service.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
@@ -283,9 +283,8 @@ void CefBrowserContextImpl::Initialize() {
|
||||
visitedlink_master_->Init();
|
||||
|
||||
// Initialize proxy configuration tracker.
|
||||
pref_proxy_config_tracker_.reset(
|
||||
ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
|
||||
GetPrefs()));
|
||||
pref_proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl(
|
||||
GetPrefs(), BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)));
|
||||
|
||||
CefBrowserContext::PostInitialize();
|
||||
|
||||
@@ -420,9 +419,7 @@ CefBrowserContextImpl::GetSSLHostStateDelegate() {
|
||||
}
|
||||
|
||||
content::PermissionManager* CefBrowserContextImpl::GetPermissionManager() {
|
||||
if (!permission_manager_.get())
|
||||
permission_manager_.reset(new CefPermissionManager(this));
|
||||
return permission_manager_.get();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::BackgroundFetchDelegate*
|
||||
@@ -446,10 +443,17 @@ 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::ProxyService::CreateSystemProxyConfigService(io_thread_runner));
|
||||
std::unique_ptr<net::ProxyConfigService> proxy_config_service(
|
||||
ProxyServiceFactory::CreateProxyConfigService(
|
||||
pref_proxy_config_tracker_.get()));
|
||||
pref_proxy_config_tracker_->CreateTrackingProxyConfigService(
|
||||
std::move(base_service)));
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
// Handle only chrome-extension:// requests. CEF does not support
|
||||
@@ -464,10 +468,8 @@ net::URLRequestContextGetter* CefBrowserContextImpl::CreateRequestContext(
|
||||
}
|
||||
|
||||
url_request_getter_ = new CefURLRequestContextGetterImpl(
|
||||
settings_, GetPrefs(),
|
||||
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
|
||||
protocol_handlers, std::move(proxy_config_service),
|
||||
std::move(request_interceptors));
|
||||
settings_, GetPrefs(), io_thread_runner, 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();
|
||||
}
|
||||
|
@@ -121,7 +121,6 @@ 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_;
|
||||
|
@@ -2,26 +2,34 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/extensions/browser_context_keyed_service_factories.h"
|
||||
#include "libcef/browser/browser_context_keyed_service_factories.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "chrome/browser/content_settings/cookie_settings_factory.h"
|
||||
#include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
|
||||
#include "chrome/browser/plugins/plugin_prefs_factory.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||
#include "chrome/browser/themes/theme_service_factory.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "extensions/browser/api/alarms/alarm_manager.h"
|
||||
#include "extensions/browser/api/storage/storage_frontend.h"
|
||||
#include "extensions/browser/renderer_startup_helper.h"
|
||||
|
||||
namespace extensions {
|
||||
namespace cef {
|
||||
|
||||
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
|
||||
AlarmManager::GetFactoryInstance();
|
||||
CookieSettingsFactory::GetInstance();
|
||||
PluginPrefsFactory::GetInstance();
|
||||
PrefsTabHelper::GetServiceInstance();
|
||||
RendererStartupHelperFactory::GetInstance();
|
||||
StorageFrontend::GetFactoryInstance();
|
||||
StreamsPrivateAPI::GetFactoryInstance();
|
||||
SpellcheckServiceFactory::GetInstance();
|
||||
ThemeServiceFactory::GetInstance();
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extensions::AlarmManager::GetFactoryInstance();
|
||||
extensions::RendererStartupHelperFactory::GetInstance();
|
||||
extensions::StorageFrontend::GetFactoryInstance();
|
||||
extensions::StreamsPrivateAPI::GetFactoryInstance();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace cef
|
||||
} // namespace extensions
|
@@ -2,10 +2,9 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be found
|
||||
// in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
#define CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
#ifndef CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
#define CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
|
||||
namespace extensions {
|
||||
namespace cef {
|
||||
|
||||
// Ensures the existence of any BrowserContextKeyedServiceFactory provided by
|
||||
@@ -14,6 +13,5 @@ namespace cef {
|
||||
void EnsureBrowserContextKeyedServiceFactoriesBuilt();
|
||||
|
||||
} // namespace cef
|
||||
} // namespace extensions
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
||||
#endif // CEF_LIBCEF_BROWSER_BROWSER_CONTEXT_KEYED_SERVICE_FACTORIES_H_
|
@@ -1583,15 +1583,17 @@ void CefBrowserHostImpl::CancelContextMenu() {
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserHostImpl::GetFrameForRequest(
|
||||
net::URLRequest* request) {
|
||||
const net::URLRequest* request) {
|
||||
CEF_REQUIRE_IOT();
|
||||
const content::ResourceRequestInfo* info =
|
||||
content::ResourceRequestInfo::ForRequest(request);
|
||||
if (!info)
|
||||
return nullptr;
|
||||
// The value of |IsMainFrame| is unreliable when |IsDownload| returns true.
|
||||
return GetOrCreateFrame(info->GetRenderFrameID(), info->GetFrameTreeNodeId(),
|
||||
CefFrameHostImpl::kUnspecifiedFrameId,
|
||||
info->IsMainFrame(), base::string16(), GURL());
|
||||
info->IsMainFrame(), info->IsDownload(),
|
||||
base::string16(), GURL());
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::Navigate(const CefNavigateParams& params) {
|
||||
@@ -2276,8 +2278,24 @@ bool CefBrowserHostImpl::DidAddMessageToConsole(
|
||||
const base::string16& source_id) {
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
||||
if (handler.get())
|
||||
return handler->OnConsoleMessage(this, message, source_id, line_no);
|
||||
if (handler.get()) {
|
||||
// Use LOGSEVERITY_DEBUG for unrecognized |level| values.
|
||||
cef_log_severity_t log_level = LOGSEVERITY_DEBUG;
|
||||
switch (level) {
|
||||
case 0:
|
||||
log_level = LOGSEVERITY_INFO;
|
||||
break;
|
||||
case 1:
|
||||
log_level = LOGSEVERITY_WARNING;
|
||||
break;
|
||||
case 2:
|
||||
log_level = LOGSEVERITY_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
return handler->OnConsoleMessage(this, log_level, message, source_id,
|
||||
line_no);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -2728,7 +2746,7 @@ void CefBrowserHostImpl::DidFinishNavigation(
|
||||
CefRefPtr<CefFrame> frame =
|
||||
GetOrCreateFrame(frame_id, navigation_handle->GetFrameTreeNodeId(),
|
||||
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame,
|
||||
base::string16(), url);
|
||||
false, base::string16(), url);
|
||||
|
||||
if (error_code == net::OK) {
|
||||
// The navigation has been committed and there is no error.
|
||||
@@ -2776,7 +2794,7 @@ void CefBrowserHostImpl::DidFailLoad(
|
||||
GetOrCreateFrame(render_frame_host->GetRoutingID(),
|
||||
render_frame_host->GetFrameTreeNodeId(),
|
||||
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame,
|
||||
base::string16(), validated_url);
|
||||
false, base::string16(), validated_url);
|
||||
OnLoadError(frame, validated_url, error_code);
|
||||
OnLoadEnd(frame, validated_url, error_code);
|
||||
}
|
||||
@@ -2902,7 +2920,7 @@ void CefBrowserHostImpl::OnFrameIdentified(int64 frame_id,
|
||||
base::string16 name) {
|
||||
bool is_main_frame = (parent_frame_id == CefFrameHostImpl::kMainFrameId);
|
||||
GetOrCreateFrame(frame_id, kUnspecifiedFrameTreeNodeId, parent_frame_id,
|
||||
is_main_frame, name, GURL());
|
||||
is_main_frame, false, name, GURL());
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnFrameFocused(
|
||||
@@ -2944,7 +2962,7 @@ void CefBrowserHostImpl::OnDidFinishLoad(int64 frame_id,
|
||||
CefRefPtr<CefFrame> frame =
|
||||
GetOrCreateFrame(frame_id, kUnspecifiedFrameTreeNodeId,
|
||||
CefFrameHostImpl::kUnspecifiedFrameId, is_main_frame,
|
||||
base::string16(), validated_url);
|
||||
false, base::string16(), validated_url);
|
||||
|
||||
// Give internal scheme handlers an opportunity to update content.
|
||||
scheme::DidFinishLoad(frame, validated_url);
|
||||
@@ -3193,6 +3211,7 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetOrCreateFrame(
|
||||
int frame_tree_node_id,
|
||||
int64 parent_frame_id,
|
||||
bool is_main_frame,
|
||||
bool is_download,
|
||||
base::string16 frame_name,
|
||||
const GURL& frame_url) {
|
||||
// We need either a valid |frame_id| or a valid |frame_tree_node_id|.
|
||||
@@ -3213,12 +3232,13 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetOrCreateFrame(
|
||||
|
||||
if (frame_id < 0) {
|
||||
// With PlzNavigate the renderer process representation might not exist yet.
|
||||
if (is_main_frame && main_frame_id_ != CefFrameHostImpl::kInvalidFrameId) {
|
||||
if ((is_main_frame || is_download) &&
|
||||
main_frame_id_ != CefFrameHostImpl::kInvalidFrameId) {
|
||||
// Operating in the main frame. Continue using the existing main frame
|
||||
// object until the new renderer process representation is created.
|
||||
frame_id = main_frame_id_;
|
||||
} else {
|
||||
if (is_main_frame) {
|
||||
if (is_main_frame || is_download) {
|
||||
// Always use the same pending object for the main frame.
|
||||
frame_tree_node_id = kMainFrameTreeNodeId;
|
||||
}
|
||||
@@ -3286,9 +3306,27 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetOrCreateFrame(
|
||||
}
|
||||
}
|
||||
|
||||
if (!frame_created)
|
||||
if (!frame_created && !is_download)
|
||||
frame->SetAttributes(is_main_frame, url, name, parent_frame_id);
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
// The main frame should always be correctly attributed.
|
||||
DCHECK(main_frame_id_ == CefFrameHostImpl::kInvalidFrameId ||
|
||||
main_frame_id_ >= 0)
|
||||
<< main_frame_id_;
|
||||
if (main_frame_id_ == CefFrameHostImpl::kInvalidFrameId) {
|
||||
// With PlzNavigate the renderer process representation might not exist yet.
|
||||
DCHECK(frame_id == CefFrameHostImpl::kMainFrameId ||
|
||||
frame_id == CefFrameHostImpl::kUnspecifiedFrameId)
|
||||
<< frame_id;
|
||||
DCHECK(frame->IsMain());
|
||||
} else if (main_frame_id_ == frame_id) {
|
||||
DCHECK(frame->IsMain());
|
||||
} else {
|
||||
DCHECK(!frame->IsMain());
|
||||
}
|
||||
#endif
|
||||
|
||||
return frame.get();
|
||||
}
|
||||
|
||||
|
@@ -303,7 +303,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
#endif
|
||||
|
||||
// Returns the frame associated with the specified URLRequest.
|
||||
CefRefPtr<CefFrame> GetFrameForRequest(net::URLRequest* request);
|
||||
CefRefPtr<CefFrame> GetFrameForRequest(const net::URLRequest* request);
|
||||
|
||||
// Navigate as specified by the |params| argument.
|
||||
void Navigate(const CefNavigateParams& params);
|
||||
@@ -585,11 +585,13 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// if PlzNavigate is disabled; or >= 0 otherwise. |parent_frame_id| will be
|
||||
// CefFrameHostImpl::kUnspecifiedFrameId if unknown. In cases where |frame_id|
|
||||
// is < 0 either the existing main frame object or a pending object will be
|
||||
// returned depending on current state.
|
||||
// returned depending on current state. If |is_download| is true then the
|
||||
// value of |is_main_frame| cannot be relied on.
|
||||
CefRefPtr<CefFrame> GetOrCreateFrame(int64 frame_id,
|
||||
int frame_tree_node_id,
|
||||
int64 parent_frame_id,
|
||||
bool is_main_frame,
|
||||
bool is_download,
|
||||
base::string16 frame_name,
|
||||
const GURL& frame_url);
|
||||
|
||||
|
@@ -9,12 +9,11 @@
|
||||
#include <string>
|
||||
|
||||
#include "libcef/browser/browser_context_impl.h"
|
||||
#include "libcef/browser/browser_context_proxy.h"
|
||||
#include "libcef/browser/browser_context_keyed_service_factories.h"
|
||||
#include "libcef/browser/browser_message_loop.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/browser_context_keyed_service_factories.h"
|
||||
#include "libcef/browser/extensions/extension_system_factory.h"
|
||||
#include "libcef/browser/extensions/extensions_browser_client.h"
|
||||
#include "libcef/browser/net/chrome_scheme_handler.h"
|
||||
@@ -25,16 +24,11 @@
|
||||
#include "libcef/common/net/net_resource_provider.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "chrome/browser/plugins/plugin_finder.h"
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "device/geolocation/access_token_store.h"
|
||||
#include "device/geolocation/geolocation_delegate.h"
|
||||
#include "device/geolocation/geolocation_provider.h"
|
||||
#include "content/public/common/result_codes.h"
|
||||
#include "extensions/browser/extension_system.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/base/net_module.h"
|
||||
@@ -73,12 +67,13 @@ void CefBrowserMainParts::PreMainMessageLoopStart() {
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserMainParts::PreEarlyInitialization() {
|
||||
int CefBrowserMainParts::PreEarlyInitialization() {
|
||||
#if defined(USE_AURA) && defined(OS_LINUX)
|
||||
// TODO(linux): Consider using a real input method or
|
||||
// views::LinuxUI::SetInstance.
|
||||
ui::InitializeInputMethodForTesting();
|
||||
#endif
|
||||
return content::RESULT_CODE_NORMAL_EXIT;
|
||||
}
|
||||
|
||||
void CefBrowserMainParts::ToolkitInitialized() {
|
||||
@@ -133,12 +128,13 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
||||
new extensions::CefExtensionsBrowserClient);
|
||||
extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
|
||||
|
||||
// Register additional KeyedService factories here. See
|
||||
// ChromeBrowserMainExtraPartsProfiles for details.
|
||||
extensions::cef::EnsureBrowserContextKeyedServiceFactoriesBuilt();
|
||||
extensions::CefExtensionSystemFactory::GetInstance();
|
||||
}
|
||||
|
||||
// Register additional KeyedService factories here. See
|
||||
// ChromeBrowserMainExtraPartsProfiles for details.
|
||||
cef::EnsureBrowserContextKeyedServiceFactoriesBuilt();
|
||||
|
||||
printing::CefPrintingMessageFilter::EnsureShutdownNotifierFactoryBuilt();
|
||||
|
||||
CefRequestContextSettings settings;
|
||||
|
@@ -45,7 +45,7 @@ class CefBrowserMainParts : public content::BrowserMainParts {
|
||||
|
||||
void PreMainMessageLoopStart() override;
|
||||
void PostMainMessageLoopStart() override;
|
||||
void PreEarlyInitialization() override;
|
||||
int PreEarlyInitialization() override;
|
||||
void ToolkitInitialized() override;
|
||||
int PreCreateThreads() override;
|
||||
void PreMainMessageLoopRun() override;
|
||||
|
@@ -96,12 +96,7 @@ metrics::MetricsService* ChromeBrowserProcessStub::metrics_service() {
|
||||
}
|
||||
|
||||
rappor::RapporServiceImpl* ChromeBrowserProcessStub::rappor_service() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ukm::UkmRecorder* ChromeBrowserProcessStub::ukm_recorder() {
|
||||
NOTREACHED();
|
||||
// Called from PluginInfoHostImpl::ReportMetrics.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -115,6 +110,12 @@ ChromeBrowserProcessStub::system_network_context_manager() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content::NetworkConnectionTracker*
|
||||
ChromeBrowserProcessStub::network_connection_tracker() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
@@ -169,7 +170,7 @@ message_center::MessageCenter* ChromeBrowserProcessStub::message_center() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
policy::BrowserPolicyConnector*
|
||||
policy::ChromeBrowserPolicyConnector*
|
||||
ChromeBrowserProcessStub::browser_policy_connector() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
@@ -190,11 +191,6 @@ GpuModeManager* ChromeBrowserProcessStub::gpu_mode_manager() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
GpuProfileCache* ChromeBrowserProcessStub::gpu_profile_cache() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ChromeBrowserProcessStub::CreateDevToolsHttpProtocolHandler(
|
||||
const std::string& ip,
|
||||
uint16_t port) {
|
||||
@@ -285,6 +281,12 @@ ChromeBrowserProcessStub::subresource_filter_ruleset_service() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
optimization_guide::OptimizationGuideService*
|
||||
ChromeBrowserProcessStub::optimization_guide_service() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
|
||||
void ChromeBrowserProcessStub::StartAutoupdateTimer() {}
|
||||
#endif
|
||||
@@ -311,11 +313,6 @@ ChromeBrowserProcessStub::component_updater() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CRLSetFetcher* ChromeBrowserProcessStub::crl_set_fetcher() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
component_updater::SupervisedUserWhitelistInstaller*
|
||||
ChromeBrowserProcessStub::supervised_user_whitelist_installer() {
|
||||
NOTREACHED();
|
||||
|
@@ -47,9 +47,9 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
override;
|
||||
metrics::MetricsService* metrics_service() override;
|
||||
rappor::RapporServiceImpl* rappor_service() override;
|
||||
ukm::UkmRecorder* ukm_recorder() override;
|
||||
IOThread* io_thread() override;
|
||||
SystemNetworkContextManager* system_network_context_manager() override;
|
||||
content::NetworkConnectionTracker* network_connection_tracker() override;
|
||||
WatchDogThread* watchdog_thread() override;
|
||||
ProfileManager* profile_manager() override;
|
||||
PrefService* local_state() override;
|
||||
@@ -60,11 +60,10 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
NotificationUIManager* notification_ui_manager() override;
|
||||
NotificationPlatformBridge* notification_platform_bridge() override;
|
||||
message_center::MessageCenter* message_center() override;
|
||||
policy::BrowserPolicyConnector* browser_policy_connector() override;
|
||||
policy::ChromeBrowserPolicyConnector* browser_policy_connector() override;
|
||||
policy::PolicyService* policy_service() override;
|
||||
IconManager* icon_manager() override;
|
||||
GpuModeManager* gpu_mode_manager() override;
|
||||
GpuProfileCache* gpu_profile_cache() override;
|
||||
void CreateDevToolsHttpProtocolHandler(const std::string& ip,
|
||||
uint16_t port) override;
|
||||
void CreateDevToolsAutoOpener() override;
|
||||
@@ -87,6 +86,8 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
override;
|
||||
subresource_filter::ContentRulesetService*
|
||||
subresource_filter_ruleset_service() override;
|
||||
optimization_guide::OptimizationGuideService* optimization_guide_service()
|
||||
override;
|
||||
|
||||
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
|
||||
void StartAutoupdateTimer() override;
|
||||
@@ -94,7 +95,6 @@ class ChromeBrowserProcessStub : public BrowserProcess,
|
||||
|
||||
net_log::ChromeNetLog* net_log() override;
|
||||
component_updater::ComponentUpdateService* component_updater() override;
|
||||
CRLSetFetcher* crl_set_fetcher() override;
|
||||
component_updater::SupervisedUserWhitelistInstaller*
|
||||
supervised_user_whitelist_installer() override;
|
||||
MediaFileSystemRegistry* media_file_system_registry() override;
|
||||
|
@@ -33,7 +33,6 @@ void ChromeProfileStub::DestroyOffTheRecordProfile() {
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::HasOffTheRecordProfile() {
|
||||
NOTREACHED();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -41,6 +40,10 @@ Profile* ChromeProfileStub::GetOriginalProfile() {
|
||||
return this;
|
||||
}
|
||||
|
||||
const Profile* ChromeProfileStub::GetOriginalProfile() const {
|
||||
return this;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsSupervised() const {
|
||||
return false;
|
||||
}
|
||||
@@ -97,22 +100,11 @@ void ChromeProfileStub::set_last_selected_directory(
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
PrefProxyConfigTracker* ChromeProfileStub::GetProxyConfigTracker() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
chrome_browser_net::Predictor* ChromeProfileStub::GetNetworkPredictor() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ChromeProfileStub::ClearNetworkingHistorySince(
|
||||
base::Time time,
|
||||
const base::Closure& completion) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
GURL ChromeProfileStub::GetHomePage() {
|
||||
NOTREACHED();
|
||||
return GURL();
|
||||
|
@@ -27,6 +27,7 @@ class ChromeProfileStub : public Profile {
|
||||
void DestroyOffTheRecordProfile() override;
|
||||
bool HasOffTheRecordProfile() override;
|
||||
Profile* GetOriginalProfile() override;
|
||||
const Profile* GetOriginalProfile() const override;
|
||||
bool IsSupervised() const override;
|
||||
bool IsChild() const override;
|
||||
bool IsLegacySupervised() const override;
|
||||
@@ -38,10 +39,7 @@ class ChromeProfileStub : public Profile {
|
||||
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;
|
||||
void ClearNetworkingHistorySince(base::Time time,
|
||||
const base::Closure& completion) override;
|
||||
GURL GetHomePage() override;
|
||||
bool WasCreatedByVersionOrLater(const std::string& version) override;
|
||||
void SetExitType(ExitType exit_type) override;
|
||||
|
@@ -19,8 +19,6 @@
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/media_capture_devices_dispatcher.h"
|
||||
#include "libcef/browser/net/chrome_scheme_handler.h"
|
||||
#include "libcef/browser/pepper/browser_pepper_host_factory.h"
|
||||
#include "libcef/browser/plugins/plugin_info_message_filter.h"
|
||||
#include "libcef/browser/plugins/plugin_service_filter.h"
|
||||
#include "libcef/browser/prefs/renderer_prefs.h"
|
||||
#include "libcef/browser/printing/printing_message_filter.h"
|
||||
@@ -43,11 +41,15 @@
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/path_service.h"
|
||||
#include "cef/grit/cef_resources.h"
|
||||
#include "chrome/browser/chrome_service.h"
|
||||
#include "chrome/browser/plugins/plugin_info_host_impl.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/spellchecker/spell_check_host_impl.h"
|
||||
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/constants.mojom.h"
|
||||
#include "chrome/grit/browser_resources.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "chrome/services/printing/public/interfaces/constants.mojom.h"
|
||||
#include "components/navigation_interception/intercept_navigation_throttle.h"
|
||||
#include "components/navigation_interception/navigation_params.h"
|
||||
#include "components/printing/service/public/interfaces/pdf_compositor.mojom.h"
|
||||
@@ -291,7 +293,7 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||
void RequestQuotaPermission(const content::StorageQuotaParams& params,
|
||||
int render_process_id,
|
||||
const PermissionCallback& callback) override {
|
||||
if (params.storage_type != storage::kStorageTypePersistent) {
|
||||
if (params.storage_type != blink::mojom::StorageType::kPersistent) {
|
||||
// To match Chrome behavior we only support requesting quota with this
|
||||
// interface for Persistent storage type.
|
||||
callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
|
||||
@@ -474,9 +476,6 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
|
||||
}
|
||||
#endif
|
||||
|
||||
host->AddFilter(new CefPluginInfoMessageFilter(
|
||||
id, static_cast<CefBrowserContext*>(profile)));
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
host->AddFilter(new extensions::ExtensionMessageFilter(id, profile));
|
||||
host->AddFilter(
|
||||
@@ -590,11 +589,22 @@ void CefContentBrowserClient::SiteInstanceDeleting(
|
||||
site_instance->GetId()));
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterInProcessServices(
|
||||
StaticServiceMap* services) {
|
||||
{
|
||||
// For spell checking.
|
||||
service_manager::EmbeddedServiceInfo info;
|
||||
info.factory = base::Bind(&ChromeService::Create);
|
||||
services->insert(std::make_pair(chrome::mojom::kServiceName, info));
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterOutOfProcessServices(
|
||||
OutOfProcessServiceMap* services) {
|
||||
(*services)[printing::mojom::kServiceName] =
|
||||
base::ASCIIToUTF16("PDF Compositor Service");
|
||||
|
||||
(*services)[printing::mojom::kChromePrintingServiceName] =
|
||||
base::ASCIIToUTF16("Printing Service");
|
||||
(*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
|
||||
l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
|
||||
}
|
||||
@@ -646,7 +656,6 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
#if defined(OS_MACOSX)
|
||||
switches::kFrameworkDirPath,
|
||||
#endif
|
||||
switches::kLang,
|
||||
switches::kLocalesDirPath,
|
||||
switches::kLogFile,
|
||||
switches::kLogSeverity,
|
||||
@@ -664,11 +673,17 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
// Propagate the following switches to the renderer command line (along with
|
||||
// any associated values) if present in the browser command line.
|
||||
static const char* const kSwitchNames[] = {
|
||||
switches::kDisableExtensions, switches::kDisablePdfExtension,
|
||||
switches::kDisableScrollBounce, switches::kDisableSpellChecking,
|
||||
switches::kEnableSpeechInput, switches::kEnableSystemFlash,
|
||||
switches::kPpapiFlashArgs, switches::kPpapiFlashPath,
|
||||
switches::kPpapiFlashVersion, switches::kUncaughtExceptionStackSize,
|
||||
switches::kDisableExtensions,
|
||||
switches::kDisablePdfExtension,
|
||||
switches::kDisablePlugins,
|
||||
switches::kDisableScrollBounce,
|
||||
switches::kDisableSpellChecking,
|
||||
switches::kEnableSpeechInput,
|
||||
switches::kEnableSystemFlash,
|
||||
switches::kPpapiFlashArgs,
|
||||
switches::kPpapiFlashPath,
|
||||
switches::kPpapiFlashVersion,
|
||||
switches::kUncaughtExceptionStackSize,
|
||||
};
|
||||
command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames,
|
||||
arraysize(kSwitchNames));
|
||||
@@ -685,6 +700,14 @@ 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)
|
||||
@@ -898,7 +921,7 @@ void CefContentBrowserClient::DidCreatePpapiPlugin(
|
||||
content::BrowserPpapiHost* browser_host) {
|
||||
browser_host->GetPpapiHost()->AddHostFactoryFilter(
|
||||
std::unique_ptr<ppapi::host::HostFactory>(
|
||||
new CefBrowserPepperHostFactory(browser_host)));
|
||||
new ChromeBrowserPepperHostFactory(browser_host)));
|
||||
}
|
||||
|
||||
content::DevToolsManagerDelegate*
|
||||
@@ -943,7 +966,7 @@ CefContentBrowserClient::CreateThrottlesForNavigation(
|
||||
return throttles;
|
||||
}
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#if defined(OS_LINUX)
|
||||
void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
||||
const base::CommandLine& command_line,
|
||||
int child_process_id,
|
||||
@@ -953,7 +976,7 @@ void CefContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
|
||||
mappings->Share(kCrashDumpSignal, crash_signal_fd);
|
||||
}
|
||||
}
|
||||
#endif // defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#endif // defined(OS_LINUX)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
const wchar_t* CefContentBrowserClient::GetResourceDllName() {
|
||||
@@ -979,18 +1002,12 @@ bool CefContentBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy) {
|
||||
|
||||
void CefContentBrowserClient::ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
content::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* render_process_host) {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner =
|
||||
content::BrowserThread::GetTaskRunnerForThread(
|
||||
content::BrowserThread::UI);
|
||||
if (!command_line->HasSwitch(switches::kDisableSpellChecking)) {
|
||||
registry->AddInterface(
|
||||
base::Bind(&SpellCheckHostImpl::Create, render_process_host->GetID()),
|
||||
ui_task_runner);
|
||||
}
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* host) {
|
||||
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
|
||||
host->GetChannel()->AddAssociatedInterfaceForIOThread(base::Bind(
|
||||
&PluginInfoHostImpl::OnPluginInfoHostRequest,
|
||||
base::MakeRefCounted<PluginInfoHostImpl>(host->GetID(), profile)));
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
|
||||
|
@@ -49,6 +49,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
bool IsHandledURL(const GURL& url) override;
|
||||
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
|
||||
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
|
||||
void RegisterInProcessServices(StaticServiceMap* services) override;
|
||||
void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override;
|
||||
std::unique_ptr<base::Value> GetServiceManifestOverlay(
|
||||
base::StringPiece name) override;
|
||||
@@ -104,7 +105,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
CreateThrottlesForNavigation(
|
||||
content::NavigationHandle* navigation_handle) override;
|
||||
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#if defined(OS_LINUX)
|
||||
void GetAdditionalMappedFilesForChildProcess(
|
||||
const base::CommandLine& command_line,
|
||||
int child_process_id,
|
||||
@@ -118,7 +119,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
|
||||
void ExposeInterfacesToRenderer(
|
||||
service_manager::BinderRegistry* registry,
|
||||
content::AssociatedInterfaceRegistry* associated_registry,
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* render_process_host) override;
|
||||
|
||||
// Perform browser process registration for the custom scheme.
|
||||
|
@@ -120,7 +120,8 @@ net::CookieStore* GetExistingCookieStoreHelper(
|
||||
|
||||
} // namespace
|
||||
|
||||
CefCookieManagerImpl::CefCookieManagerImpl() : weak_ptr_factory_(this) {}
|
||||
CefCookieManagerImpl::CefCookieManagerImpl(bool is_blocking)
|
||||
: is_blocking_(is_blocking), weak_ptr_factory_(this) {}
|
||||
|
||||
CefCookieManagerImpl::~CefCookieManagerImpl() {
|
||||
CEF_REQUIRE_IOT();
|
||||
@@ -131,6 +132,7 @@ 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(
|
||||
@@ -160,7 +162,7 @@ void CefCookieManagerImpl::GetCookieStore(
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(cookie_store_.get());
|
||||
DCHECK(is_blocking_ || cookie_store_.get());
|
||||
|
||||
// Binding ref-counted |this| to CookieStoreGetter may result in
|
||||
// heap-use-after-free if (a) the CookieStoreGetter contains the last
|
||||
@@ -192,7 +194,9 @@ net::CookieStore* CefCookieManagerImpl::GetExistingCookieStore() {
|
||||
return cookie_store;
|
||||
}
|
||||
|
||||
LOG(ERROR) << "Cookie store does not exist";
|
||||
DCHECK(is_blocking_);
|
||||
if (!is_blocking_)
|
||||
LOG(ERROR) << "Cookie store does not exist";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -495,12 +499,11 @@ void CefCookieManagerImpl::SetSupportedSchemesInternal(
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(cookie_store_.get());
|
||||
if (!cookie_store_.get())
|
||||
return;
|
||||
|
||||
supported_schemes_ = schemes;
|
||||
SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_);
|
||||
DCHECK(is_blocking_ || cookie_store_.get());
|
||||
if (cookie_store_) {
|
||||
supported_schemes_ = schemes;
|
||||
SetCookieMonsterSchemes(cookie_store_.get(), supported_schemes_);
|
||||
}
|
||||
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
}
|
||||
@@ -552,8 +555,13 @@ void CefCookieManagerImpl::SetCookieInternal(
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = cookie_store_getter.Run();
|
||||
if (!cookie_store)
|
||||
if (!cookie_store) {
|
||||
if (callback.get()) {
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefSetCookieCallback::OnComplete,
|
||||
callback.get(), false));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
std::string name = CefString(&cookie.name).ToString();
|
||||
std::string value = CefString(&cookie.value).ToString();
|
||||
@@ -564,13 +572,15 @@ void CefCookieManagerImpl::SetCookieInternal(
|
||||
if (cookie.has_expires)
|
||||
cef_time_to_basetime(cookie.expires, expiration_time);
|
||||
|
||||
cookie_store->SetCookieWithDetailsAsync(
|
||||
url, name, value, domain, path,
|
||||
base::Time(), // Creation time.
|
||||
expiration_time,
|
||||
base::Time(), // Last access time.
|
||||
cookie_store->SetCanonicalCookieAsync(
|
||||
net::CanonicalCookie::CreateSanitizedCookie(
|
||||
url, name, value, domain, path,
|
||||
base::Time(), // Creation time.
|
||||
expiration_time,
|
||||
base::Time(), // Last access time.
|
||||
cookie.secure ? true : false, cookie.httponly ? true : false,
|
||||
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT),
|
||||
cookie.secure ? true : false, cookie.httponly ? true : false,
|
||||
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT,
|
||||
base::Bind(SetCookieCallbackImpl, callback));
|
||||
}
|
||||
|
||||
@@ -582,8 +592,13 @@ void CefCookieManagerImpl::DeleteCookiesInternal(
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = cookie_store_getter.Run();
|
||||
if (!cookie_store)
|
||||
if (!cookie_store) {
|
||||
if (callback.get()) {
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefDeleteCookiesCallback::OnComplete,
|
||||
callback.get(), 0));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (url.is_empty()) {
|
||||
// Delete all cookies.
|
||||
@@ -608,8 +623,10 @@ void CefCookieManagerImpl::FlushStoreInternal(
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = cookie_store_getter.Run();
|
||||
if (!cookie_store)
|
||||
if (!cookie_store) {
|
||||
RunAsyncCompletionOnIOThread(callback);
|
||||
return;
|
||||
}
|
||||
|
||||
cookie_store->FlushStore(base::Bind(RunAsyncCompletionOnIOThread, callback));
|
||||
}
|
||||
@@ -629,6 +646,11 @@ CefRefPtr<CefCookieManager> CefCookieManager::GetGlobalManager(
|
||||
callback);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefCookieManager> CefCookieManager::GetBlockingManager() {
|
||||
return new CefCookieManagerImpl(true);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
|
||||
const CefString& path,
|
||||
@@ -640,7 +662,8 @@ CefRefPtr<CefCookieManager> CefCookieManager::CreateManager(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefCookieManagerImpl> cookie_manager = new CefCookieManagerImpl();
|
||||
CefRefPtr<CefCookieManagerImpl> cookie_manager =
|
||||
new CefCookieManagerImpl(false);
|
||||
cookie_manager->Initialize(NULL, path, persist_session_cookies, callback);
|
||||
return cookie_manager.get();
|
||||
}
|
||||
|
@@ -18,10 +18,11 @@
|
||||
// Implementation of the CefCookieManager interface.
|
||||
class CefCookieManagerImpl : public CefCookieManager {
|
||||
public:
|
||||
CefCookieManagerImpl();
|
||||
explicit CefCookieManagerImpl(bool is_blocking);
|
||||
~CefCookieManagerImpl() override;
|
||||
|
||||
// Must be called immediately after this object is created.
|
||||
// Must be called immediately after this object is created when |is_blocking|
|
||||
// is false.
|
||||
void Initialize(CefRefPtr<CefRequestContextImpl> request_context,
|
||||
const CefString& path,
|
||||
bool persist_session_cookies,
|
||||
@@ -113,6 +114,9 @@ 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_;
|
||||
|
@@ -240,27 +240,8 @@ 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;
|
||||
@@ -275,7 +256,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
|
||||
if (method == "dispatchProtocolMessage" && params && params->GetSize() == 1) {
|
||||
std::string protocol_message;
|
||||
if (!params->GetString(0, &protocol_message))
|
||||
if (!agent_host_ || !params->GetString(0, &protocol_message))
|
||||
return;
|
||||
agent_host_->DispatchProtocolMessage(this, protocol_message);
|
||||
} else if (method == "loadCompleted") {
|
||||
@@ -361,6 +342,8 @@ 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") {
|
||||
@@ -455,8 +438,7 @@ void CefDevToolsFrontend::SendMessageAck(int request_id,
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::AgentHostClosed(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
bool replaced) {
|
||||
content::DevToolsAgentHost* agent_host) {
|
||||
DCHECK(agent_host == agent_host_.get());
|
||||
agent_host_ = nullptr;
|
||||
Close();
|
||||
|
@@ -58,19 +58,17 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
return frontend_browser_;
|
||||
}
|
||||
|
||||
protected:
|
||||
private:
|
||||
CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser,
|
||||
content::WebContents* inspected_contents,
|
||||
const CefPoint& inspect_element_at);
|
||||
~CefDevToolsFrontend() override;
|
||||
|
||||
// content::DevToolsAgentHostClient implementation.
|
||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host,
|
||||
bool replaced) override;
|
||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host) override;
|
||||
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
|
||||
const std::string& message) override;
|
||||
void SetPreferences(const std::string& json);
|
||||
virtual void HandleMessageFromDevToolsFrontend(const std::string& message);
|
||||
void HandleMessageFromDevToolsFrontend(const std::string& message);
|
||||
|
||||
private:
|
||||
// WebContentsObserver overrides
|
||||
|
@@ -107,6 +107,11 @@ void CefDevToolsManagerDelegate::StartHttpHandler(
|
||||
content::DevToolsAgentHost::StartRemoteDebuggingServer(
|
||||
std::move(socket_factory), std::string(), browser_context->GetPath(),
|
||||
base::FilePath());
|
||||
|
||||
const base::CommandLine& command_line =
|
||||
*base::CommandLine::ForCurrentProcess();
|
||||
if (command_line.HasSwitch(switches::kRemoteDebuggingPipe))
|
||||
content::DevToolsAgentHost::StartRemoteDebuggingPipeHandler();
|
||||
}
|
||||
|
||||
// static
|
||||
|
@@ -231,7 +231,8 @@ bool ExecuteCodeInTabFunction::LoadFile(const std::string& file) {
|
||||
void ExecuteCodeInTabFunction::LoadFileComplete(
|
||||
const std::string& file,
|
||||
std::unique_ptr<std::string> data) {
|
||||
DidLoadAndLocalizeFile(file, !!data.get(), std::move(data));
|
||||
const bool success = !!data.get();
|
||||
DidLoadAndLocalizeFile(file, success, std::move(data));
|
||||
}
|
||||
|
||||
bool TabsExecuteScriptFunction::ShouldInsertCSS() const {
|
||||
|
@@ -92,7 +92,7 @@ class CefGetExtensionLoadFileCallbackImpl
|
||||
static std::unique_ptr<std::string> LoadFileFromStream(
|
||||
const std::string& file,
|
||||
CefRefPtr<CefStreamReader> stream) {
|
||||
base::ThreadRestrictions::AssertIOAllowed();
|
||||
base::AssertBlockingAllowed();
|
||||
|
||||
// Move to the end of the stream.
|
||||
stream->Seek(0, SEEK_END);
|
||||
|
@@ -64,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->IsType(base::Value::Type::DICTIONARY)) {
|
||||
if (!manifest.get() || !manifest->is_dict()) {
|
||||
LOG(ERROR) << "Failed to parse extension manifest.";
|
||||
return NULL;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ void LoadExtensionWithManifest(base::WeakPtr<CefExtensionSystem> context,
|
||||
bool internal,
|
||||
CefRefPtr<CefRequestContext> loader_context,
|
||||
CefRefPtr<CefExtensionHandler> handler) {
|
||||
base::ThreadRestrictions::AssertIOAllowed();
|
||||
base::AssertBlockingAllowed();
|
||||
|
||||
std::unique_ptr<base::DictionaryValue> manifest =
|
||||
ParseManifest(manifest_contents);
|
||||
@@ -131,7 +131,7 @@ void LoadExtensionFromDisk(base::WeakPtr<CefExtensionSystem> context,
|
||||
bool internal,
|
||||
CefRefPtr<CefRequestContext> loader_context,
|
||||
CefRefPtr<CefExtensionHandler> handler) {
|
||||
base::ThreadRestrictions::AssertIOAllowed();
|
||||
base::AssertBlockingAllowed();
|
||||
|
||||
base::FilePath manifest_path = root_directory.AppendASCII("manifest.json");
|
||||
std::string manifest_contents;
|
||||
@@ -367,6 +367,10 @@ void CefExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
|
||||
app_sorting_.reset(new NullAppSorting);
|
||||
}
|
||||
|
||||
void CefExtensionSystem::InitForIncognitoProfile() {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
ExtensionService* CefExtensionSystem::extension_service() {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -452,8 +456,11 @@ std::unique_ptr<ExtensionSet> CefExtensionSystem::GetDependentExtensions(
|
||||
return base::MakeUnique<ExtensionSet>();
|
||||
}
|
||||
|
||||
void CefExtensionSystem::InstallUpdate(const std::string& extension_id,
|
||||
const base::FilePath& temp_dir) {
|
||||
void CefExtensionSystem::InstallUpdate(
|
||||
const std::string& extension_id,
|
||||
const std::string& public_key,
|
||||
const base::FilePath& temp_dir,
|
||||
InstallUpdateCallback install_update_callback) {
|
||||
NOTREACHED();
|
||||
base::DeleteFile(temp_dir, true /* recursive */);
|
||||
}
|
||||
|
@@ -89,6 +89,7 @@ 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;
|
||||
@@ -111,7 +112,9 @@ class CefExtensionSystem : public ExtensionSystem {
|
||||
std::unique_ptr<ExtensionSet> GetDependentExtensions(
|
||||
const Extension* extension) override;
|
||||
void InstallUpdate(const std::string& extension_id,
|
||||
const base::FilePath& temp_dir) override;
|
||||
const std::string& public_key,
|
||||
const base::FilePath& temp_dir,
|
||||
InstallUpdateCallback install_update_callback) override;
|
||||
|
||||
bool initialized() const { return initialized_; }
|
||||
|
||||
|
@@ -36,8 +36,8 @@ void CefExtensionWebContentsObserver::RenderFrameCreated(
|
||||
// are allowed to use chrome://resources/ URLs.
|
||||
if ((extension->is_extension() || extension->is_platform_app()) &&
|
||||
Manifest::IsComponentLocation(extension->location())) {
|
||||
policy->GrantOrigin(process_id,
|
||||
url::Origin(GURL(content::kChromeUIResourcesURL)));
|
||||
policy->GrantOrigin(
|
||||
process_id, url::Origin::Create(GURL(content::kChromeUIResourcesURL)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -124,10 +124,14 @@ CefExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob(
|
||||
}
|
||||
|
||||
bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||
net::URLRequest* request,
|
||||
const GURL& url,
|
||||
content::ResourceType resource_type,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool is_incognito,
|
||||
const Extension* extension,
|
||||
InfoMap* extension_info_map) {
|
||||
const ExtensionSet& extensions,
|
||||
const ProcessMap& process_map) {
|
||||
// TODO(cef): This bypasses additional checks added to
|
||||
// AllowCrossRendererResourceLoad() in https://crrev.com/5cf9d45c. Figure out
|
||||
// why permission is not being granted based on "web_accessible_resources"
|
||||
@@ -137,7 +141,8 @@ bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||
|
||||
bool allowed = false;
|
||||
if (url_request_util::AllowCrossRendererResourceLoad(
|
||||
request, is_incognito, extension, extension_info_map, &allowed)) {
|
||||
url, resource_type, page_transition, child_id, is_incognito,
|
||||
extension, extensions, process_map, &allowed)) {
|
||||
return allowed;
|
||||
}
|
||||
|
||||
|
@@ -51,10 +51,14 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
const base::FilePath& directory_path,
|
||||
const std::string& content_security_policy,
|
||||
bool send_cors_header) override;
|
||||
bool AllowCrossRendererResourceLoad(net::URLRequest* request,
|
||||
bool AllowCrossRendererResourceLoad(const GURL& url,
|
||||
content::ResourceType resource_type,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool is_incognito,
|
||||
const Extension* extension,
|
||||
InfoMap* extension_info_map) override;
|
||||
const ExtensionSet& extensions,
|
||||
const ProcessMap& process_map) override;
|
||||
PrefService* GetPrefServiceForContext(
|
||||
content::BrowserContext* context) override;
|
||||
void GetEarlyExtensionPrefsObservers(
|
||||
|
@@ -10,10 +10,26 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const char kGenericErrorMessage[] = "CefValueStore configured to error";
|
||||
|
||||
// Having this utility function allows ValueStore::Status to not have a copy
|
||||
// constructor.
|
||||
ValueStore::Status CreateStatusCopy(const ValueStore::Status& status) {
|
||||
return ValueStore::Status(status.code, status.restore_status, status.message);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefValueStore::CefValueStore() : read_count_(0), write_count_(0) {}
|
||||
|
||||
CefValueStore::~CefValueStore() {}
|
||||
|
||||
void CefValueStore::set_status_code(StatusCode status_code) {
|
||||
status_ = ValueStore::Status(status_code, kGenericErrorMessage);
|
||||
}
|
||||
|
||||
size_t CefValueStore::GetBytesInUse(const std::string& key) {
|
||||
// Let SettingsStorageQuotaEnforcer implement this.
|
||||
NOTREACHED();
|
||||
@@ -39,7 +55,10 @@ ValueStore::ReadResult CefValueStore::Get(const std::string& key) {
|
||||
ValueStore::ReadResult CefValueStore::Get(
|
||||
const std::vector<std::string>& keys) {
|
||||
read_count_++;
|
||||
base::DictionaryValue* settings = new base::DictionaryValue();
|
||||
if (!status_.ok())
|
||||
return ReadResult(CreateStatusCopy(status_));
|
||||
|
||||
auto settings = std::make_unique<base::DictionaryValue>();
|
||||
for (std::vector<std::string>::const_iterator it = keys.begin();
|
||||
it != keys.end(); ++it) {
|
||||
base::Value* value = NULL;
|
||||
@@ -47,12 +66,14 @@ ValueStore::ReadResult CefValueStore::Get(
|
||||
settings->SetWithoutPathExpansion(*it, value->CreateDeepCopy());
|
||||
}
|
||||
}
|
||||
return MakeReadResult(base::WrapUnique(settings), status_);
|
||||
return ReadResult(std::move(settings), CreateStatusCopy(status_));
|
||||
}
|
||||
|
||||
ValueStore::ReadResult CefValueStore::Get() {
|
||||
read_count_++;
|
||||
return MakeReadResult(storage_.CreateDeepCopy(), status_);
|
||||
if (!status_.ok())
|
||||
return ReadResult(CreateStatusCopy(status_));
|
||||
return ReadResult(storage_.CreateDeepCopy(), CreateStatusCopy(status_));
|
||||
}
|
||||
|
||||
ValueStore::WriteResult CefValueStore::Set(WriteOptions options,
|
||||
@@ -67,6 +88,9 @@ ValueStore::WriteResult CefValueStore::Set(
|
||||
WriteOptions options,
|
||||
const base::DictionaryValue& settings) {
|
||||
write_count_++;
|
||||
if (!status_.ok())
|
||||
return WriteResult(CreateStatusCopy(status_));
|
||||
|
||||
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
|
||||
for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd();
|
||||
it.Advance()) {
|
||||
@@ -79,7 +103,7 @@ ValueStore::WriteResult CefValueStore::Set(
|
||||
storage_.SetWithoutPathExpansion(it.key(), it.value().CreateDeepCopy());
|
||||
}
|
||||
}
|
||||
return MakeWriteResult(std::move(changes), status_);
|
||||
return WriteResult(std::move(changes), CreateStatusCopy(status_));
|
||||
}
|
||||
|
||||
ValueStore::WriteResult CefValueStore::Remove(const std::string& key) {
|
||||
@@ -89,6 +113,9 @@ ValueStore::WriteResult CefValueStore::Remove(const std::string& key) {
|
||||
ValueStore::WriteResult CefValueStore::Remove(
|
||||
const std::vector<std::string>& keys) {
|
||||
write_count_++;
|
||||
if (!status_.ok())
|
||||
return WriteResult(CreateStatusCopy(status_));
|
||||
|
||||
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
|
||||
for (std::vector<std::string>::const_iterator it = keys.begin();
|
||||
it != keys.end(); ++it) {
|
||||
@@ -97,7 +124,7 @@ ValueStore::WriteResult CefValueStore::Remove(
|
||||
changes->push_back(ValueStoreChange(*it, std::move(old_value), nullptr));
|
||||
}
|
||||
}
|
||||
return MakeWriteResult(std::move(changes), status_);
|
||||
return WriteResult(std::move(changes), CreateStatusCopy(status_));
|
||||
}
|
||||
|
||||
ValueStore::WriteResult CefValueStore::Clear() {
|
||||
@@ -107,4 +134,4 @@ ValueStore::WriteResult CefValueStore::Clear() {
|
||||
keys.push_back(it.key());
|
||||
}
|
||||
return Remove(keys);
|
||||
}
|
||||
}
|
@@ -31,6 +31,10 @@ class CefValueStore : public ValueStore {
|
||||
int read_count() const { return read_count_; }
|
||||
int write_count() const { return write_count_; }
|
||||
|
||||
// Sets the error code for requests. If OK, errors won't be thrown.
|
||||
// Defaults to OK.
|
||||
void set_status_code(StatusCode status_code);
|
||||
|
||||
// ValueStore implementation.
|
||||
size_t GetBytesInUse(const std::string& key) override;
|
||||
size_t GetBytesInUse(const std::vector<std::string>& keys) override;
|
||||
|
@@ -1,106 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#include "include/cef_geolocation.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/time_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "device/geolocation/geolocation_provider.h"
|
||||
#include "device/geolocation/geoposition.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class CefLocationRequest
|
||||
: public base::RefCountedThreadSafe<CefLocationRequest> {
|
||||
public:
|
||||
explicit CefLocationRequest(CefRefPtr<CefGetGeolocationCallback> callback)
|
||||
: callback_(callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
geo_callback_ = base::Bind(&CefLocationRequest::OnLocationUpdate, this);
|
||||
device::GeolocationProvider* provider =
|
||||
device::GeolocationProvider::GetInstance();
|
||||
subscription_ = provider->AddLocationUpdateCallback(geo_callback_, true);
|
||||
provider->UserDidOptIntoLocationServices();
|
||||
}
|
||||
|
||||
private:
|
||||
friend class base::RefCountedThreadSafe<CefLocationRequest>;
|
||||
|
||||
~CefLocationRequest() {}
|
||||
|
||||
void OnLocationUpdate(const device::Geoposition& position) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (callback_.get()) {
|
||||
CefGeoposition cef_position;
|
||||
SetPosition(position, cef_position);
|
||||
callback_->OnLocationUpdate(cef_position);
|
||||
callback_ = NULL;
|
||||
}
|
||||
subscription_.reset();
|
||||
geo_callback_.Reset();
|
||||
}
|
||||
|
||||
void SetPosition(const device::Geoposition& source, CefGeoposition& target) {
|
||||
target.latitude = source.latitude;
|
||||
target.longitude = source.longitude;
|
||||
target.altitude = source.altitude;
|
||||
target.accuracy = source.accuracy;
|
||||
target.altitude_accuracy = source.altitude_accuracy;
|
||||
target.heading = source.heading;
|
||||
target.speed = source.speed;
|
||||
cef_time_from_basetime(source.timestamp, target.timestamp);
|
||||
|
||||
switch (source.error_code) {
|
||||
case device::Geoposition::ERROR_CODE_NONE:
|
||||
target.error_code = GEOPOSITON_ERROR_NONE;
|
||||
break;
|
||||
case device::Geoposition::ERROR_CODE_PERMISSION_DENIED:
|
||||
target.error_code = GEOPOSITON_ERROR_PERMISSION_DENIED;
|
||||
break;
|
||||
case device::Geoposition::ERROR_CODE_POSITION_UNAVAILABLE:
|
||||
target.error_code = GEOPOSITON_ERROR_POSITION_UNAVAILABLE;
|
||||
break;
|
||||
case device::Geoposition::ERROR_CODE_TIMEOUT:
|
||||
target.error_code = GEOPOSITON_ERROR_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
|
||||
CefString(&target.error_message) = source.error_message;
|
||||
}
|
||||
|
||||
CefRefPtr<CefGetGeolocationCallback> callback_;
|
||||
device::GeolocationProvider::LocationUpdateCallback geo_callback_;
|
||||
std::unique_ptr<device::GeolocationProvider::Subscription> subscription_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefLocationRequest);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
bool CefGetGeolocation(CefRefPtr<CefGetGeolocationCallback> callback) {
|
||||
if (!CONTEXT_STATE_VALID()) {
|
||||
NOTREACHED() << "context not valid";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!callback.get()) {
|
||||
NOTREACHED() << "invalid parameter";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (device::GeolocationProvider::GetInstance()) {
|
||||
// Will be released after the callback executes.
|
||||
new CefLocationRequest(callback);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(base::IgnoreResult(CefGetGeolocation), callback));
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -138,6 +138,7 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
|
||||
|
||||
void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
|
||||
content::WebContents* web_contents,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
bool is_reload,
|
||||
DialogClosedCallback callback) {
|
||||
if (browser_->destruction_state() >=
|
||||
|
@@ -36,6 +36,7 @@ class CefJavaScriptDialogManager : public content::JavaScriptDialogManager {
|
||||
DialogClosedCallback callback,
|
||||
bool* did_suppress_message) override;
|
||||
void RunBeforeUnloadDialog(content::WebContents* web_contents,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
bool is_reload,
|
||||
DialogClosedCallback callback) override;
|
||||
void CancelDialogs(content::WebContents* web_contents,
|
||||
|
@@ -346,11 +346,6 @@ 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)
|
||||
@@ -389,4 +384,6 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateMouseEvent(
|
||||
|
||||
// timestamp
|
||||
result.SetTimeStampSeconds(GetSystemUptime());
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
@@ -423,11 +423,6 @@ 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)
|
||||
@@ -474,4 +469,6 @@ void CefBrowserPlatformDelegateNativeMac::TranslateMouseEvent(
|
||||
|
||||
// timestamp - Mac OSX specific
|
||||
result.SetTimeStampSeconds(currentEventTimestamp());
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "base/memory/ref_counted_memory.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/win/registry.h"
|
||||
#include "base/win/win_util.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "third_party/WebKit/public/platform/WebMouseEvent.h"
|
||||
#include "third_party/WebKit/public/platform/WebMouseWheelEvent.h"
|
||||
@@ -95,21 +96,29 @@ void ExecuteExternalProtocol(const GURL& url) {
|
||||
ShellExecuteA(NULL, "open", address.c_str(), NULL, NULL, SW_SHOWNORMAL);
|
||||
}
|
||||
|
||||
WORD KeyStatesToWord() {
|
||||
static const USHORT kHighBitMaskShort = 0x8000;
|
||||
WORD result = 0;
|
||||
// DPI value for 1x scale factor.
|
||||
#define DPI_1X 96.0f
|
||||
|
||||
if (GetKeyState(VK_CONTROL) & kHighBitMaskShort)
|
||||
result |= MK_CONTROL;
|
||||
if (GetKeyState(VK_SHIFT) & kHighBitMaskShort)
|
||||
result |= MK_SHIFT;
|
||||
if (GetKeyState(VK_LBUTTON) & kHighBitMaskShort)
|
||||
result |= MK_LBUTTON;
|
||||
if (GetKeyState(VK_MBUTTON) & kHighBitMaskShort)
|
||||
result |= MK_MBUTTON;
|
||||
if (GetKeyState(VK_RBUTTON) & kHighBitMaskShort)
|
||||
result |= MK_RBUTTON;
|
||||
return result;
|
||||
float GetWindowScaleFactor(HWND hwnd) {
|
||||
DCHECK(hwnd);
|
||||
|
||||
if (base::win::IsProcessPerMonitorDpiAware()) {
|
||||
// Let Windows tell us the correct DPI.
|
||||
static auto get_dpi_for_window_func = []() {
|
||||
return reinterpret_cast<decltype(::GetDpiForWindow)*>(
|
||||
GetProcAddress(GetModuleHandle(L"user32.dll"), "GetDpiForWindow"));
|
||||
}();
|
||||
if (get_dpi_for_window_func)
|
||||
return static_cast<float>(get_dpi_for_window_func(hwnd)) / DPI_1X;
|
||||
}
|
||||
|
||||
// Fallback to the monitor that contains the window center point.
|
||||
RECT cr;
|
||||
GetWindowRect(hwnd, &cr);
|
||||
return display::Screen::GetScreen()
|
||||
->GetDisplayNearestPoint(
|
||||
gfx::Point((cr.right - cr.left) / 2, (cr.bottom - cr.top) / 2))
|
||||
.device_scale_factor();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -134,40 +143,49 @@ void CefBrowserPlatformDelegateNativeWin::BrowserDestroyed(
|
||||
bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
|
||||
RegisterWindowClass();
|
||||
|
||||
has_frame_ = !(window_info_.style & WS_CHILD);
|
||||
|
||||
std::wstring windowName(CefString(&window_info_.window_name));
|
||||
|
||||
// Create the new browser window.
|
||||
window_info_.window = CreateWindowEx(
|
||||
window_info_.ex_style, GetWndClass(), windowName.c_str(),
|
||||
window_info_.style, window_info_.x, window_info_.y, window_info_.width,
|
||||
window_info_.height, window_info_.parent_window, window_info_.menu,
|
||||
::GetModuleHandle(NULL), NULL);
|
||||
CreateWindowEx(window_info_.ex_style, GetWndClass(), windowName.c_str(),
|
||||
window_info_.style, window_info_.x, window_info_.y,
|
||||
window_info_.width, window_info_.height,
|
||||
window_info_.parent_window, window_info_.menu,
|
||||
::GetModuleHandle(NULL), this);
|
||||
|
||||
// It's possible for CreateWindowEx to fail if the parent window was
|
||||
// destroyed between the call to CreateBrowser and the above one.
|
||||
DCHECK(window_info_.window != NULL);
|
||||
DCHECK(window_info_.window);
|
||||
if (!window_info_.window)
|
||||
return false;
|
||||
|
||||
host_window_created_ = true;
|
||||
|
||||
// Set window user data to this object for future reference from the window
|
||||
// procedure.
|
||||
gfx::SetWindowUserData(window_info_.window, this);
|
||||
|
||||
// Add a reference that will later be released in DestroyBrowser().
|
||||
browser_->AddRef();
|
||||
|
||||
RECT cr;
|
||||
GetClientRect(window_info_.window, &cr);
|
||||
if (!called_enable_non_client_dpi_scaling_ && has_frame_ &&
|
||||
base::win::IsProcessPerMonitorDpiAware()) {
|
||||
// This call gets Windows to scale the non-client area when WM_DPICHANGED
|
||||
// is fired on Windows versions < 10.0.14393.0.
|
||||
// Derived signature; not available in headers.
|
||||
static auto enable_child_window_dpi_message_func = []() {
|
||||
using EnableChildWindowDpiMessagePtr = LRESULT(WINAPI*)(HWND, BOOL);
|
||||
return reinterpret_cast<EnableChildWindowDpiMessagePtr>(GetProcAddress(
|
||||
GetModuleHandle(L"user32.dll"), "EnableChildWindowDpiMessage"));
|
||||
}();
|
||||
if (enable_child_window_dpi_message_func)
|
||||
enable_child_window_dpi_message_func(window_info_.window, TRUE);
|
||||
}
|
||||
|
||||
DCHECK(!window_widget_);
|
||||
|
||||
// Adjust for potential display scaling.
|
||||
// Convert from device coordinates to logical coordinates.
|
||||
RECT cr;
|
||||
GetClientRect(window_info_.window, &cr);
|
||||
gfx::Point point = gfx::Point(cr.right, cr.bottom);
|
||||
float scale = display::Screen::GetScreen()
|
||||
->GetDisplayNearestPoint(point)
|
||||
.device_scale_factor();
|
||||
const float scale = GetWindowScaleFactor(window_info_.window);
|
||||
point =
|
||||
gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(point), 1.0f / scale));
|
||||
|
||||
@@ -287,19 +305,19 @@ gfx::Point CefBrowserPlatformDelegateNativeWin::GetScreenPoint(
|
||||
if (windowless_handler_)
|
||||
return windowless_handler_->GetParentScreenPoint(view);
|
||||
|
||||
if (!window_widget_)
|
||||
if (!window_info_.window)
|
||||
return view;
|
||||
|
||||
aura::Window* window = window_widget_->GetNativeView();
|
||||
const gfx::Rect& bounds_in_screen = window->GetBoundsInScreen();
|
||||
const gfx::Point& screen_point = gfx::Point(bounds_in_screen.x() + view.x(),
|
||||
bounds_in_screen.y() + view.y());
|
||||
// Convert from logical coordinates to device coordinates.
|
||||
const float scale = GetWindowScaleFactor(window_info_.window);
|
||||
const gfx::Point& device_pt =
|
||||
gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(view), scale));
|
||||
|
||||
// Adjust for potential display scaling.
|
||||
float scale = display::Screen::GetScreen()
|
||||
->GetDisplayNearestPoint(screen_point)
|
||||
.device_scale_factor();
|
||||
return gfx::ToFlooredPoint(gfx::ScalePoint(gfx::PointF(screen_point), scale));
|
||||
// Convert from client coordinates to screen coordinates.
|
||||
POINT screen_pt = {device_pt.x(), device_pt.y()};
|
||||
ClientToScreen(window_info_.window, &screen_pt);
|
||||
|
||||
return gfx::Point(screen_pt.x, screen_pt.y);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateNativeWin::ViewText(const std::string& text) {
|
||||
@@ -387,8 +405,9 @@ void CefBrowserPlatformDelegateNativeWin::TranslateKeyEvent(
|
||||
// TODO(cef): CefKeyEvent does not currently pass extended key status (see
|
||||
// WM_KEYDOWN docs) which would be necessary to pass EF_IS_EXTENDED_KEY as
|
||||
// the |flags| parameter to DomKeyFromKeyboardCode().
|
||||
int flags = 0;
|
||||
result.dom_key = ui::PlatformKeyMap::DomKeyFromKeyboardCode(
|
||||
ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), 0);
|
||||
ui::KeyboardCodeForWindowsKeyCode(key_event.windows_key_code), &flags);
|
||||
}
|
||||
|
||||
if (result.GetType() == blink::WebInputEvent::kChar ||
|
||||
@@ -540,6 +559,8 @@ void CefBrowserPlatformDelegateNativeWin::TranslateMouseEvent(
|
||||
|
||||
// timestamp
|
||||
result.SetTimeStampSeconds(GetMessageTime() / 1000.0);
|
||||
|
||||
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -578,12 +599,15 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam) {
|
||||
CefBrowserPlatformDelegateNativeWin* platform_delegate =
|
||||
static_cast<CefBrowserPlatformDelegateNativeWin*>(
|
||||
gfx::GetWindowUserData(hwnd));
|
||||
CefBrowserPlatformDelegateNativeWin* platform_delegate = nullptr;
|
||||
CefBrowserHostImpl* browser = nullptr;
|
||||
if (platform_delegate)
|
||||
browser = platform_delegate->browser_;
|
||||
|
||||
if (message != WM_NCCREATE) {
|
||||
platform_delegate = static_cast<CefBrowserPlatformDelegateNativeWin*>(
|
||||
gfx::GetWindowUserData(hwnd));
|
||||
if (platform_delegate)
|
||||
browser = platform_delegate->browser_;
|
||||
}
|
||||
|
||||
switch (message) {
|
||||
case WM_CLOSE:
|
||||
@@ -595,6 +619,31 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
// Allow the close.
|
||||
break;
|
||||
|
||||
case WM_NCCREATE: {
|
||||
CREATESTRUCT* cs = reinterpret_cast<CREATESTRUCT*>(lParam);
|
||||
platform_delegate =
|
||||
reinterpret_cast<CefBrowserPlatformDelegateNativeWin*>(
|
||||
cs->lpCreateParams);
|
||||
DCHECK(platform_delegate);
|
||||
// Associate |platform_delegate| with the window handle.
|
||||
gfx::SetWindowUserData(hwnd, platform_delegate);
|
||||
platform_delegate->window_info_.window = hwnd;
|
||||
|
||||
if (platform_delegate->has_frame_ &&
|
||||
base::win::IsProcessPerMonitorDpiAware()) {
|
||||
// This call gets Windows to scale the non-client area when
|
||||
// WM_DPICHANGED is fired on Windows versions >= 10.0.14393.0.
|
||||
static auto enable_non_client_dpi_scaling_func = []() {
|
||||
return reinterpret_cast<decltype(::EnableNonClientDpiScaling)*>(
|
||||
GetProcAddress(GetModuleHandle(L"user32.dll"),
|
||||
"EnableNonClientDpiScaling"));
|
||||
}();
|
||||
platform_delegate->called_enable_non_client_dpi_scaling_ =
|
||||
!!(enable_non_client_dpi_scaling_func &&
|
||||
enable_non_client_dpi_scaling_func(hwnd));
|
||||
}
|
||||
} break;
|
||||
|
||||
case WM_NCDESTROY:
|
||||
if (platform_delegate) {
|
||||
// Clear the user data pointer.
|
||||
@@ -633,6 +682,17 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
return 0;
|
||||
|
||||
case WM_DPICHANGED:
|
||||
if (platform_delegate && platform_delegate->has_frame_) {
|
||||
// Suggested size and position of the current window scaled for the
|
||||
// new DPI.
|
||||
const RECT* rect = reinterpret_cast<RECT*>(lParam);
|
||||
SetWindowPos(platform_delegate->GetHostWindowHandle(), NULL, rect->left,
|
||||
rect->top, rect->right - rect->left,
|
||||
rect->bottom - rect->top, SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
|
@@ -68,6 +68,9 @@ class CefBrowserPlatformDelegateNativeWin
|
||||
// Widget hosting the web contents. It will be deleted automatically when the
|
||||
// associated root window is destroyed.
|
||||
views::Widget* window_widget_;
|
||||
|
||||
bool has_frame_ = false;
|
||||
bool called_enable_non_client_dpi_scaling_ = false;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_WIN_H_
|
||||
|
@@ -5,8 +5,11 @@
|
||||
|
||||
#include "libcef/browser/native/file_dialog_runner_win.h"
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <commdlg.h>
|
||||
#include <shlobj.h>
|
||||
#include <wrl/client.h>
|
||||
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
|
||||
@@ -15,7 +18,6 @@
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/win/registry.h"
|
||||
#include "base/win/scoped_comptr.h"
|
||||
#include "cef/grit/cef_strings.h"
|
||||
#include "chrome/grit/generated_resources.h"
|
||||
#include "net/base/mime_util.h"
|
||||
@@ -395,7 +397,7 @@ bool RunOpenFolderDialog(const CefFileDialogRunner::FileChooserParams& params,
|
||||
STRRET out_dir_buffer;
|
||||
ZeroMemory(&out_dir_buffer, sizeof(out_dir_buffer));
|
||||
out_dir_buffer.uType = STRRET_WSTR;
|
||||
base::win::ScopedComPtr<IShellFolder> shell_folder;
|
||||
Microsoft::WRL::ComPtr<IShellFolder> shell_folder;
|
||||
if (SHGetDesktopFolder(shell_folder.GetAddressOf()) == NOERROR) {
|
||||
HRESULT hr = shell_folder->GetDisplayNameOf(list, SHGDN_FORPARSING,
|
||||
&out_dir_buffer);
|
||||
|
@@ -7,6 +7,8 @@
|
||||
#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 {
|
||||
|
@@ -11,9 +11,9 @@
|
||||
#include "base/mac/scoped_nsobject.h"
|
||||
|
||||
#if __OBJC__
|
||||
@class MenuController;
|
||||
@class MenuControllerCocoa;
|
||||
#else
|
||||
class MenuController;
|
||||
class MenuControllerCocoa;
|
||||
#endif
|
||||
|
||||
class CefMenuRunnerMac : public CefMenuRunner {
|
||||
@@ -28,7 +28,7 @@ class CefMenuRunnerMac : public CefMenuRunner {
|
||||
void CancelContextMenu() override;
|
||||
|
||||
private:
|
||||
base::scoped_nsobject<MenuController> menu_controller_;
|
||||
base::scoped_nsobject<MenuControllerCocoa> menu_controller_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NATIVE_MENU_RUNNER_MAC_H_
|
||||
|
@@ -21,14 +21,16 @@ bool CefMenuRunnerMac::RunContextMenu(
|
||||
CefMenuModelImpl* model,
|
||||
const content::ContextMenuParams& params) {
|
||||
// Create a menu controller based on the model.
|
||||
menu_controller_.reset([[MenuController alloc] initWithModel:model->model()
|
||||
useWithPopUpButtonCell:NO]);
|
||||
menu_controller_.reset([[MenuControllerCocoa alloc]
|
||||
initWithModel:model->model()
|
||||
useWithPopUpButtonCell:NO]);
|
||||
|
||||
// Keep the menu controller alive (by adding an additional retain) until after
|
||||
// the menu has been dismissed. Otherwise it will crash if the browser is
|
||||
// destroyed (and consequently the menu controller is destroyed) while the
|
||||
// menu is still pending.
|
||||
base::scoped_nsobject<MenuController> menu_controller_ref(menu_controller_);
|
||||
base::scoped_nsobject<MenuControllerCocoa> menu_controller_ref(
|
||||
menu_controller_);
|
||||
|
||||
// Make sure events can be pumped while the menu is up.
|
||||
base::MessageLoop::ScopedNestableTaskAllower allow(
|
||||
|
@@ -109,7 +109,7 @@ static CefNativeMenuWin* GetCefNativeMenuWinFromHMENU(HMENU hmenu) {
|
||||
// structure we have constructed in CefNativeMenuWin.
|
||||
class CefNativeMenuWin::MenuHostWindow {
|
||||
public:
|
||||
explicit MenuHostWindow(CefNativeMenuWin* parent) : parent_(parent) {
|
||||
MenuHostWindow() {
|
||||
RegisterClass();
|
||||
hwnd_ = CreateWindowEx(l10n_util::GetExtendedStyles(), kWindowClassName,
|
||||
L"", 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
|
||||
@@ -389,7 +389,6 @@ class CefNativeMenuWin::MenuHostWindow {
|
||||
}
|
||||
|
||||
HWND hwnd_;
|
||||
CefNativeMenuWin* parent_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(MenuHostWindow);
|
||||
};
|
||||
@@ -775,7 +774,7 @@ void CefNativeMenuWin::CreateHostWindow() {
|
||||
// host window per menu hierarchy, no matter how many CefNativeMenuWin objects
|
||||
// exist wrapping submenus.
|
||||
if (!host_window_.get())
|
||||
host_window_.reset(new MenuHostWindow(this));
|
||||
host_window_.reset(new MenuHostWindow());
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "libcef/browser/native/window_delegate_view.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/controls/webview/webview.h"
|
||||
@@ -55,7 +57,7 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
|
||||
|
||||
void CefWindowDelegateView::InitContent() {
|
||||
SetBackground(views::CreateSolidBackground(background_color_));
|
||||
SetLayoutManager(new views::FillLayout());
|
||||
SetLayoutManager(std::make_unique<views::FillLayout>());
|
||||
AddChildView(web_view_);
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,6 @@
|
||||
|
||||
#include "ui/base/x/x11_util.h"
|
||||
#include "ui/events/platform/platform_event_source.h"
|
||||
#include "ui/events/platform/x11/x11_event_source.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
|
||||
#include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
|
||||
|
||||
@@ -38,7 +37,7 @@ const char kXdndProxy[] = "XdndProxy";
|
||||
::Window root;
|
||||
::Window parent;
|
||||
::Window* children;
|
||||
::Window child_window = None;
|
||||
::Window child_window = x11::None;
|
||||
unsigned int nchildren;
|
||||
if (XQueryTree(display, window, &root, &parent, &children, &nchildren)) {
|
||||
DCHECK_EQ(1U, nchildren);
|
||||
@@ -50,8 +49,8 @@ const char kXdndProxy[] = "XdndProxy";
|
||||
|
||||
::Window FindToplevelParent(::Display* display, ::Window window) {
|
||||
::Window top_level_window = window;
|
||||
::Window root = None;
|
||||
::Window parent = None;
|
||||
::Window root = x11::None;
|
||||
::Window parent = x11::None;
|
||||
::Window* children = NULL;
|
||||
unsigned int nchildren = 0;
|
||||
// Enumerate all parents of "window" to find the highest level window
|
||||
@@ -91,12 +90,12 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
bounds_(bounds),
|
||||
focus_pending_(false),
|
||||
weak_ptr_factory_(this) {
|
||||
if (parent_xwindow_ == None)
|
||||
if (parent_xwindow_ == x11::None)
|
||||
parent_xwindow_ = DefaultRootWindow(xdisplay_);
|
||||
|
||||
XSetWindowAttributes swa;
|
||||
memset(&swa, 0, sizeof(swa));
|
||||
swa.background_pixmap = None;
|
||||
swa.background_pixmap = x11::None;
|
||||
swa.override_redirect = false;
|
||||
xwindow_ = XCreateWindow(xdisplay_, parent_xwindow_, bounds.x(), bounds.y(),
|
||||
bounds.width(), bounds.height(),
|
||||
@@ -148,12 +147,12 @@ void CefWindowX11::Close() {
|
||||
ev.xclient.message_type = gfx::GetAtom(kWMProtocols);
|
||||
ev.xclient.format = 32;
|
||||
ev.xclient.data.l[0] = gfx::GetAtom(kWMDeleteWindow);
|
||||
ev.xclient.data.l[1] = CurrentTime;
|
||||
XSendEvent(xdisplay_, xwindow_, False, NoEventMask, &ev);
|
||||
ev.xclient.data.l[1] = x11::CurrentTime;
|
||||
XSendEvent(xdisplay_, xwindow_, false, NoEventMask, &ev);
|
||||
}
|
||||
|
||||
void CefWindowX11::Show() {
|
||||
if (xwindow_ == None)
|
||||
if (xwindow_ == x11::None)
|
||||
return;
|
||||
|
||||
if (!window_mapped_) {
|
||||
@@ -170,11 +169,8 @@ void CefWindowX11::Show() {
|
||||
|
||||
XMapWindow(xdisplay_, xwindow_);
|
||||
|
||||
// We now block until our window is mapped. Some X11 APIs will crash and
|
||||
// burn if passed |xwindow_| before the window is mapped, and XMapWindow is
|
||||
// asynchronous.
|
||||
if (ui::X11EventSource::GetInstance())
|
||||
ui::X11EventSource::GetInstance()->BlockUntilWindowMapped(xwindow_);
|
||||
// TODO(thomasanderson): Find out why this flush is necessary.
|
||||
XFlush(xdisplay_);
|
||||
window_mapped_ = true;
|
||||
|
||||
// Setup the drag and drop proxy on the top level window of the application
|
||||
@@ -205,7 +201,7 @@ void CefWindowX11::Show() {
|
||||
}
|
||||
|
||||
void CefWindowX11::Hide() {
|
||||
if (xwindow_ == None)
|
||||
if (xwindow_ == x11::None)
|
||||
return;
|
||||
|
||||
if (window_mapped_) {
|
||||
@@ -215,22 +211,22 @@ void CefWindowX11::Hide() {
|
||||
}
|
||||
|
||||
void CefWindowX11::Focus() {
|
||||
if (xwindow_ == None || !window_mapped_)
|
||||
if (xwindow_ == x11::None || !window_mapped_)
|
||||
return;
|
||||
|
||||
if (browser_.get()) {
|
||||
::Window child = FindChild(xdisplay_, xwindow_);
|
||||
if (child && ui::IsWindowVisible(child)) {
|
||||
// Give focus to the child DesktopWindowTreeHostX11.
|
||||
XSetInputFocus(xdisplay_, child, RevertToParent, CurrentTime);
|
||||
XSetInputFocus(xdisplay_, child, RevertToParent, x11::CurrentTime);
|
||||
}
|
||||
} else {
|
||||
XSetInputFocus(xdisplay_, xwindow_, RevertToParent, CurrentTime);
|
||||
XSetInputFocus(xdisplay_, xwindow_, RevertToParent, x11::CurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
void CefWindowX11::SetBounds(const gfx::Rect& bounds) {
|
||||
if (xwindow_ == None)
|
||||
if (xwindow_ == x11::None)
|
||||
return;
|
||||
|
||||
bool origin_changed = bounds_.origin() != bounds.origin();
|
||||
@@ -315,7 +311,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
||||
// Allow the close.
|
||||
XDestroyWindow(xdisplay_, xwindow_);
|
||||
|
||||
xwindow_ = None;
|
||||
xwindow_ = x11::None;
|
||||
|
||||
if (browser_.get()) {
|
||||
// Force the browser to be destroyed and release the reference
|
||||
@@ -329,7 +325,7 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
||||
XEvent reply_event = *xev;
|
||||
reply_event.xclient.window = parent_xwindow_;
|
||||
|
||||
XSendEvent(xdisplay_, reply_event.xclient.window, False,
|
||||
XSendEvent(xdisplay_, reply_event.xclient.window, false,
|
||||
SubstructureRedirectMask | SubstructureNotifyMask,
|
||||
&reply_event);
|
||||
XFlush(xdisplay_);
|
||||
|
@@ -37,6 +37,7 @@
|
||||
#include "content/browser/webui/content_web_ui_controller_factory.h"
|
||||
#include "content/public/browser/browser_url_handler.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "content/public/common/url_utils.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "ipc/ipc_channel.h"
|
||||
#include "net/url_request/url_request.h"
|
||||
@@ -169,7 +170,7 @@ bool IsDebugURL(const GURL& url) {
|
||||
|
||||
// Also include URLs handled by the browser process in
|
||||
// content/browser/frame_host/debug_urls.cc HandleDebugURL().
|
||||
for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
GURL host(chrome::kChromeDebugURLs[i]);
|
||||
if (url.GetOrigin() == host.GetOrigin())
|
||||
return true;
|
||||
@@ -186,7 +187,7 @@ bool IsDebugURL(const GURL& url) {
|
||||
}
|
||||
|
||||
void GetDebugURLs(std::vector<std::string>* urls) {
|
||||
for (int i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
for (size_t i = 0; i < chrome::kNumberOfChromeDebugURLs; ++i) {
|
||||
urls->push_back(chrome::kChromeDebugURLs[i]);
|
||||
}
|
||||
|
||||
|
@@ -33,29 +33,8 @@ void CefCookieStoreProxy::SetCookieWithOptionsAsync(
|
||||
if (cookie_store) {
|
||||
cookie_store->SetCookieWithOptionsAsync(url, cookie_line, options,
|
||||
std::move(callback));
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::SetCookieWithDetailsAsync(
|
||||
const GURL& url,
|
||||
const std::string& name,
|
||||
const std::string& value,
|
||||
const std::string& domain,
|
||||
const std::string& path,
|
||||
base::Time creation_time,
|
||||
base::Time expiration_time,
|
||||
base::Time last_access_time,
|
||||
bool secure,
|
||||
bool http_only,
|
||||
net::CookieSameSite same_site,
|
||||
net::CookiePriority priority,
|
||||
SetCookiesCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store) {
|
||||
cookie_store->SetCookieWithDetailsAsync(
|
||||
url, name, value, domain, path, creation_time, expiration_time,
|
||||
last_access_time, secure, http_only, same_site, priority,
|
||||
std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +48,8 @@ void CefCookieStoreProxy::SetCanonicalCookieAsync(
|
||||
cookie_store->SetCanonicalCookieAsync(std::move(cookie), secure_source,
|
||||
modify_http_only,
|
||||
std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,8 +58,11 @@ void CefCookieStoreProxy::GetCookiesWithOptionsAsync(
|
||||
const net::CookieOptions& options,
|
||||
GetCookiesCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->GetCookiesWithOptionsAsync(url, options, std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(std::string());
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::GetCookieListWithOptionsAsync(
|
||||
@@ -86,31 +70,43 @@ void CefCookieStoreProxy::GetCookieListWithOptionsAsync(
|
||||
const net::CookieOptions& options,
|
||||
GetCookieListCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->GetCookieListWithOptionsAsync(url, options,
|
||||
std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(net::CookieList());
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::GetAllCookiesAsync(GetCookieListCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->GetAllCookiesAsync(std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(net::CookieList());
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::DeleteCookieAsync(const GURL& url,
|
||||
const std::string& cookie_name,
|
||||
base::OnceClosure callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteCookieAsync(url, cookie_name, std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run();
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::DeleteCanonicalCookieAsync(
|
||||
const net::CanonicalCookie& cookie,
|
||||
DeleteCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteCanonicalCookieAsync(cookie, std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync(
|
||||
@@ -121,6 +117,8 @@ void CefCookieStoreProxy::DeleteAllCreatedBetweenAsync(
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteAllCreatedBetweenAsync(delete_begin, delete_end,
|
||||
std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,19 +131,27 @@ void CefCookieStoreProxy::DeleteAllCreatedBetweenWithPredicateAsync(
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteAllCreatedBetweenWithPredicateAsync(
|
||||
delete_begin, delete_end, predicate, std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::DeleteSessionCookiesAsync(DeleteCallback callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->DeleteSessionCookiesAsync(std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run(0);
|
||||
}
|
||||
}
|
||||
|
||||
void CefCookieStoreProxy::FlushStore(base::OnceClosure callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
cookie_store->FlushStore(std::move(callback));
|
||||
} else if (!callback.is_null()) {
|
||||
std::move(callback).Run();
|
||||
}
|
||||
}
|
||||
|
||||
std::unique_ptr<net::CookieStore::CookieChangedSubscription>
|
||||
@@ -154,8 +160,9 @@ CefCookieStoreProxy::AddCallbackForCookie(
|
||||
const std::string& name,
|
||||
const CookieChangedCallback& callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
return cookie_store->AddCallbackForCookie(url, name, callback);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -163,8 +170,9 @@ std::unique_ptr<net::CookieStore::CookieChangedSubscription>
|
||||
CefCookieStoreProxy::AddCallbackForAllChanges(
|
||||
const CookieChangedCallback& callback) {
|
||||
net::CookieStore* cookie_store = GetCookieStore();
|
||||
if (cookie_store)
|
||||
if (cookie_store) {
|
||||
return cookie_store->AddCallbackForAllChanges(callback);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -178,25 +186,23 @@ bool CefCookieStoreProxy::IsEphemeral() {
|
||||
net::CookieStore* CefCookieStoreProxy::GetCookieStore() {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
net::CookieStore* cookie_store = nullptr;
|
||||
|
||||
CefRefPtr<CefCookieManager> manager = handler_->GetCookieManager();
|
||||
if (manager.get()) {
|
||||
// Use the cookie store provided by the manager.
|
||||
cookie_store = reinterpret_cast<CefCookieManagerImpl*>(manager.get())
|
||||
->GetExistingCookieStore();
|
||||
DCHECK(cookie_store);
|
||||
return cookie_store;
|
||||
// Use the cookie store provided by the manager. May be nullptr if the
|
||||
// cookie manager is blocking.
|
||||
return reinterpret_cast<CefCookieManagerImpl*>(manager.get())
|
||||
->GetExistingCookieStore();
|
||||
}
|
||||
|
||||
DCHECK(parent_);
|
||||
if (parent_) {
|
||||
// Use the cookie store from the parent.
|
||||
cookie_store = parent_->cookie_store();
|
||||
net::CookieStore* cookie_store = parent_->cookie_store();
|
||||
DCHECK(cookie_store);
|
||||
if (!cookie_store)
|
||||
LOG(ERROR) << "Cookie store does not exist";
|
||||
return cookie_store;
|
||||
}
|
||||
|
||||
return cookie_store;
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -26,19 +26,6 @@ class CefCookieStoreProxy : public net::CookieStore {
|
||||
const std::string& cookie_line,
|
||||
const net::CookieOptions& options,
|
||||
SetCookiesCallback callback) override;
|
||||
void SetCookieWithDetailsAsync(const GURL& url,
|
||||
const std::string& name,
|
||||
const std::string& value,
|
||||
const std::string& domain,
|
||||
const std::string& path,
|
||||
base::Time creation_time,
|
||||
base::Time expiration_time,
|
||||
base::Time last_access_time,
|
||||
bool secure,
|
||||
bool http_only,
|
||||
net::CookieSameSite same_site,
|
||||
net::CookiePriority priority,
|
||||
SetCookiesCallback callback) override;
|
||||
void SetCanonicalCookieAsync(std::unique_ptr<net::CanonicalCookie> cookie,
|
||||
bool secure_source,
|
||||
bool modify_http_only,
|
||||
|
@@ -21,19 +21,11 @@ namespace {
|
||||
|
||||
void SetCRLSetIfNewer(scoped_refptr<net::CRLSet> crl_set) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
scoped_refptr<net::CRLSet> old_crl_set(net::SSLConfigService::GetCRLSet());
|
||||
if (old_crl_set.get() && old_crl_set->sequence() > crl_set->sequence()) {
|
||||
LOG(WARNING) << "Refusing to downgrade CRL set from #"
|
||||
<< old_crl_set->sequence() << "to #" << crl_set->sequence();
|
||||
} else {
|
||||
net::SSLConfigService::SetCRLSet(crl_set);
|
||||
VLOG(1) << "Installed CRL set #" << crl_set->sequence();
|
||||
}
|
||||
net::SSLConfigService::SetCRLSetIfNewer(crl_set);
|
||||
}
|
||||
|
||||
void LoadFromDisk(const base::FilePath& path) {
|
||||
base::ThreadRestrictions::AssertIOAllowed();
|
||||
base::AssertBlockingAllowed();
|
||||
|
||||
std::string crl_set_bytes;
|
||||
if (!base::ReadFileToString(path, &crl_set_bytes)) {
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
namespace net_util {
|
||||
|
||||
bool IsInternalRequest(net::URLRequest* request) {
|
||||
bool IsInternalRequest(const net::URLRequest* request) {
|
||||
// With PlzNavigate we now receive blob URLs. Ignore these URLs.
|
||||
// See https://crbug.com/776884 for details.
|
||||
if (request->url().SchemeIs(url::kBlobScheme)) {
|
||||
|
@@ -14,7 +14,7 @@ namespace net_util {
|
||||
|
||||
// Returns true if |request| is handled internally and should not be exposed via
|
||||
// the CEF API.
|
||||
bool IsInternalRequest(net::URLRequest* request);
|
||||
bool IsInternalRequest(const net::URLRequest* request);
|
||||
|
||||
}; // namespace net_util
|
||||
|
||||
|
@@ -9,6 +9,7 @@
|
||||
|
||||
#include "include/cef_urlrequest.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/cookie_manager_impl.h"
|
||||
#include "libcef/browser/net/net_util.h"
|
||||
#include "libcef/browser/net/source_stream.h"
|
||||
#include "libcef/browser/net/url_request_user_data.h"
|
||||
@@ -440,6 +441,64 @@ net::NetworkDelegate::AuthRequiredResponse CefNetworkDelegate::OnAuthRequired(
|
||||
return AUTH_REQUIRED_RESPONSE_NO_ACTION;
|
||||
}
|
||||
|
||||
bool CefNetworkDelegate::OnCanGetCookies(const net::URLRequest& request,
|
||||
const net::CookieList& cookie_list) {
|
||||
if (net_util::IsInternalRequest(&request))
|
||||
return true;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForRequest(&request);
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefFrame> frame = browser->GetFrameForRequest(&request);
|
||||
|
||||
CefRefPtr<CefRequestImpl> cefRequest = new CefRequestImpl();
|
||||
cefRequest->Set(&request);
|
||||
cefRequest->SetReadOnly(true);
|
||||
|
||||
return handler->CanGetCookies(browser.get(), frame, cefRequest.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefNetworkDelegate::OnCanSetCookie(const net::URLRequest& request,
|
||||
const net::CanonicalCookie& cookie,
|
||||
net::CookieOptions* options) {
|
||||
if (net_util::IsInternalRequest(&request))
|
||||
return true;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForRequest(&request);
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefFrame> frame = browser->GetFrameForRequest(&request);
|
||||
|
||||
CefRefPtr<CefRequestImpl> cefRequest = new CefRequestImpl();
|
||||
cefRequest->Set(&request);
|
||||
cefRequest->SetReadOnly(true);
|
||||
|
||||
CefCookie cefCookie;
|
||||
if (!CefCookieManagerImpl::GetCefCookie(cookie, cefCookie))
|
||||
return true;
|
||||
|
||||
return handler->CanSetCookie(browser.get(), frame, cefRequest.get(),
|
||||
cefCookie);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefNetworkDelegate::OnCanAccessFile(
|
||||
const net::URLRequest& request,
|
||||
const base::FilePath& original_path,
|
||||
|
@@ -38,6 +38,11 @@ class CefNetworkDelegate : public net::NetworkDelegateImpl {
|
||||
const AuthCallback& callback,
|
||||
net::AuthCredentials* credentials) override;
|
||||
void OnCompleted(net::URLRequest* request, bool started) override;
|
||||
bool OnCanGetCookies(const net::URLRequest& request,
|
||||
const net::CookieList& cookie_list) override;
|
||||
bool OnCanSetCookie(const net::URLRequest& request,
|
||||
const net::CanonicalCookie& cookie,
|
||||
net::CookieOptions* options) override;
|
||||
bool OnCanAccessFile(const net::URLRequest& request,
|
||||
const base::FilePath& original_path,
|
||||
const base::FilePath& absolute_path) const override;
|
||||
|
@@ -328,6 +328,14 @@ bool CefResourceRequestJob::GetMimeType(std::string* mime_type) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefResourceRequestJob::GetCharset(std::string* charset) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
if (net::HttpResponseHeaders *headers = GetResponseHeaders())
|
||||
return headers->GetCharset(charset);
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefResourceRequestJob::SendHeaders() {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
@@ -411,7 +419,7 @@ void CefResourceRequestJob::DoLoadCookies() {
|
||||
|
||||
void CefResourceRequestJob::CheckCookiePolicyAndLoad(
|
||||
const net::CookieList& cookie_list) {
|
||||
bool can_get_cookies = CanGetCookies(cookie_list);
|
||||
bool can_get_cookies = !cookie_list.empty() && CanGetCookies(cookie_list);
|
||||
if (can_get_cookies) {
|
||||
net::CookieList::const_iterator it = cookie_list.begin();
|
||||
for (; it != cookie_list.end(); ++it) {
|
||||
@@ -500,25 +508,29 @@ void CefResourceRequestJob::SaveNextCookie() {
|
||||
return;
|
||||
}
|
||||
|
||||
const std::string& cookie_line =
|
||||
response_cookies_[response_cookies_save_index_];
|
||||
|
||||
net::CookieOptions options;
|
||||
options.set_include_httponly();
|
||||
bool can_set_cookie =
|
||||
CanSetCookie(response_cookies_[response_cookies_save_index_], &options);
|
||||
std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create(
|
||||
request_->url(), cookie_line, base::Time::Now(), options);
|
||||
|
||||
bool can_set_cookie = cookie && CanSetCookie(*cookie, &options);
|
||||
if (can_set_cookie) {
|
||||
CefCookie cookie;
|
||||
if (CefCookieManagerImpl::GetCefCookie(
|
||||
request_->url(), response_cookies_[response_cookies_save_index_],
|
||||
cookie)) {
|
||||
can_set_cookie = handler_->CanSetCookie(cookie);
|
||||
CefCookie cef_cookie;
|
||||
if (CefCookieManagerImpl::GetCefCookie(request_->url(), cookie_line,
|
||||
cef_cookie)) {
|
||||
can_set_cookie = handler_->CanSetCookie(cef_cookie);
|
||||
} else {
|
||||
can_set_cookie = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (can_set_cookie) {
|
||||
request_->context()->cookie_store()->SetCookieWithOptionsAsync(
|
||||
request_->url(), response_cookies_[response_cookies_save_index_],
|
||||
options,
|
||||
request_->context()->cookie_store()->SetCanonicalCookieAsync(
|
||||
std::move(cookie), request_->url().SchemeIsCryptographic(),
|
||||
!options.exclude_httponly(),
|
||||
base::Bind(&CefResourceRequestJob::OnCookieSaved,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
return;
|
||||
|
@@ -40,6 +40,7 @@ class CefResourceRequestJob : public net::URLRequestJob {
|
||||
void GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const override;
|
||||
bool IsRedirectResponse(GURL* location, int* http_status_code) override;
|
||||
bool GetMimeType(std::string* mime_type) const override;
|
||||
bool GetCharset(std::string* charset) override;
|
||||
|
||||
void SendHeaders();
|
||||
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
@@ -115,6 +114,7 @@ std::unique_ptr<net::ProxyService> CreateProxyService(
|
||||
net::NetLog* net_log,
|
||||
net::URLRequestContext* context,
|
||||
net::NetworkDelegate* network_delegate,
|
||||
proxy_resolver::mojom::ProxyResolverFactoryPtr proxy_resolver_factory,
|
||||
std::unique_ptr<net::ProxyConfigService> proxy_config_service,
|
||||
const base::CommandLine& command_line,
|
||||
bool quick_check_enabled,
|
||||
@@ -136,9 +136,8 @@ std::unique_ptr<net::ProxyService> CreateProxyService(
|
||||
dhcp_proxy_script_fetcher = dhcp_factory.Create(context);
|
||||
|
||||
proxy_service = content::CreateProxyServiceUsingMojoFactory(
|
||||
ChromeMojoProxyResolverFactory::GetInstance(),
|
||||
std::move(proxy_config_service),
|
||||
new net::ProxyScriptFetcherImpl(context),
|
||||
std::move(proxy_resolver_factory), std::move(proxy_config_service),
|
||||
base::MakeUnique<net::ProxyScriptFetcherImpl>(context),
|
||||
std::move(dhcp_proxy_script_fetcher), context->host_resolver(), net_log,
|
||||
network_delegate);
|
||||
} else {
|
||||
@@ -171,6 +170,8 @@ CefURLRequestContextGetterImpl::CefURLRequestContextGetterImpl(
|
||||
io_state_->net_log_ = g_browser_process->net_log(),
|
||||
DCHECK(io_state_->net_log_);
|
||||
io_state_->io_task_runner_ = std::move(io_task_runner);
|
||||
io_state_->proxy_resolver_factory_ =
|
||||
ChromeMojoProxyResolverFactory::CreateWithStrongBinding();
|
||||
io_state_->proxy_config_service_ = std::move(proxy_config_service);
|
||||
io_state_->request_interceptors_ = std::move(request_interceptors);
|
||||
|
||||
@@ -318,6 +319,7 @@ net::URLRequestContext* CefURLRequestContextGetterImpl::GetURLRequestContext() {
|
||||
CreateProxyService(io_state_->net_log_,
|
||||
io_state_->url_request_context_.get(),
|
||||
io_state_->url_request_context_->network_delegate(),
|
||||
std::move(io_state_->proxy_resolver_factory_),
|
||||
std::move(io_state_->proxy_config_service_),
|
||||
*command_line, quick_check_enabled_.GetValue(),
|
||||
pac_https_url_stripping_enabled_.GetValue());
|
||||
@@ -526,21 +528,12 @@ net::CookieStore* CefURLRequestContextGetterImpl::GetExistingCookieStore()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::CreateProxyConfigService() {
|
||||
if (io_state_->proxy_config_service_.get())
|
||||
return;
|
||||
|
||||
io_state_->proxy_config_service_ =
|
||||
net::ProxyService::CreateSystemProxyConfigService(
|
||||
io_state_->io_task_runner_);
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::UpdateServerWhitelist() {
|
||||
io_state_->http_auth_preferences_->set_server_whitelist(
|
||||
io_state_->http_auth_preferences_->SetServerWhitelist(
|
||||
auth_server_whitelist_.GetValue());
|
||||
}
|
||||
|
||||
void CefURLRequestContextGetterImpl::UpdateDelegateWhitelist() {
|
||||
io_state_->http_auth_preferences_->set_delegate_whitelist(
|
||||
io_state_->http_auth_preferences_->SetDelegateWhitelist(
|
||||
auth_negotiate_delegate_whitelist_.GetValue());
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "chrome/browser/net/chrome_mojo_proxy_resolver_factory.h"
|
||||
#include "components/prefs/pref_member.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "net/url_request/url_request_job_factory.h"
|
||||
@@ -84,7 +85,6 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
|
||||
}
|
||||
|
||||
private:
|
||||
void CreateProxyConfigService();
|
||||
void UpdateServerWhitelist();
|
||||
void UpdateDelegateWhitelist();
|
||||
|
||||
@@ -117,6 +117,8 @@ class CefURLRequestContextGetterImpl : public CefURLRequestContextGetter {
|
||||
std::vector<std::string> cookie_supported_schemes_;
|
||||
|
||||
std::vector<CefRefPtr<CefRequestContextHandler>> handler_list_;
|
||||
|
||||
proxy_resolver::mojom::ProxyResolverFactoryPtr proxy_resolver_factory_;
|
||||
};
|
||||
std::unique_ptr<IOState> io_state_;
|
||||
|
||||
|
@@ -275,12 +275,12 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
|
||||
DragTargetDragLeave();
|
||||
|
||||
const gfx::Point client_pt(event.x, event.y);
|
||||
gfx::Point transformed_pt;
|
||||
gfx::PointF transformed_pt;
|
||||
current_rwh_for_drag_ =
|
||||
web_contents->GetInputEventRouter()
|
||||
->GetRenderWidgetHostAtPoint(
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||
client_pt, &transformed_pt)
|
||||
gfx::PointF(client_pt), &transformed_pt)
|
||||
->GetWeakPtr();
|
||||
current_rvh_for_drag_ = web_contents->GetRenderViewHost();
|
||||
|
||||
@@ -304,8 +304,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
|
||||
return;
|
||||
}
|
||||
|
||||
current_rwh_for_drag_->DragTargetDragEnter(*drop_data, transformed_pt,
|
||||
screen_pt, ops, modifiers);
|
||||
current_rwh_for_drag_->DragTargetDragEnter(
|
||||
*drop_data, transformed_pt, gfx::PointF(screen_pt), ops, modifiers);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
||||
@@ -322,27 +322,27 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
||||
const gfx::Point client_pt(event.x, event.y);
|
||||
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
||||
|
||||
gfx::Point transformed_pt;
|
||||
gfx::PointF transformed_pt;
|
||||
content::RenderWidgetHostImpl* target_rwh =
|
||||
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(), client_pt,
|
||||
&transformed_pt);
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||
gfx::PointF(client_pt), &transformed_pt);
|
||||
|
||||
if (target_rwh != current_rwh_for_drag_.get()) {
|
||||
if (current_rwh_for_drag_) {
|
||||
gfx::Point transformed_leave_point = client_pt;
|
||||
gfx::Point transformed_screen_point = screen_pt;
|
||||
gfx::PointF transformed_leave_point(client_pt);
|
||||
gfx::PointF transformed_screen_point(screen_pt);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
client_pt,
|
||||
gfx::PointF(client_pt),
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
current_rwh_for_drag_->GetView()),
|
||||
&transformed_leave_point);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
screen_pt,
|
||||
gfx::PointF(screen_pt),
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
current_rwh_for_drag_->GetView()),
|
||||
&transformed_screen_point);
|
||||
@@ -359,7 +359,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
|
||||
static_cast<blink::WebDragOperationsMask>(allowed_ops);
|
||||
int modifiers = TranslateModifiers(event.modifiers);
|
||||
|
||||
target_rwh->DragTargetDragOver(transformed_pt, screen_pt, ops, modifiers);
|
||||
target_rwh->DragTargetDragOver(transformed_pt, gfx::PointF(screen_pt), ops,
|
||||
modifiers);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
|
||||
@@ -369,7 +370,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragLeave() {
|
||||
}
|
||||
|
||||
if (current_rwh_for_drag_) {
|
||||
current_rwh_for_drag_->DragTargetDragLeave(gfx::Point(), gfx::Point());
|
||||
current_rwh_for_drag_->DragTargetDragLeave(gfx::PointF(), gfx::PointF());
|
||||
current_rwh_for_drag_.reset();
|
||||
}
|
||||
|
||||
@@ -388,27 +389,27 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
||||
gfx::Point client_pt(event.x, event.y);
|
||||
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
|
||||
|
||||
gfx::Point transformed_pt;
|
||||
gfx::PointF transformed_pt;
|
||||
content::RenderWidgetHostImpl* target_rwh =
|
||||
web_contents->GetInputEventRouter()->GetRenderWidgetHostAtPoint(
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(), client_pt,
|
||||
&transformed_pt);
|
||||
web_contents->GetRenderViewHost()->GetWidget()->GetView(),
|
||||
gfx::PointF(client_pt), &transformed_pt);
|
||||
|
||||
if (target_rwh != current_rwh_for_drag_.get()) {
|
||||
if (current_rwh_for_drag_) {
|
||||
gfx::Point transformed_leave_point = client_pt;
|
||||
gfx::Point transformed_screen_point = screen_pt;
|
||||
gfx::PointF transformed_leave_point(client_pt);
|
||||
gfx::PointF transformed_screen_point(screen_pt);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
client_pt,
|
||||
gfx::PointF(client_pt),
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
current_rwh_for_drag_->GetView()),
|
||||
&transformed_leave_point);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
screen_pt,
|
||||
gfx::PointF(screen_pt),
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
current_rwh_for_drag_->GetView()),
|
||||
&transformed_screen_point);
|
||||
@@ -428,8 +429,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
||||
content::DropData* drop_data = data_impl->drop_data();
|
||||
int modifiers = TranslateModifiers(event.modifiers);
|
||||
|
||||
target_rwh->DragTargetDrop(*drop_data, transformed_pt, screen_pt,
|
||||
modifiers);
|
||||
target_rwh->DragTargetDrop(*drop_data, transformed_pt,
|
||||
gfx::PointF(screen_pt), modifiers);
|
||||
}
|
||||
|
||||
drag_data_ = nullptr;
|
||||
@@ -495,20 +496,20 @@ void CefBrowserPlatformDelegateOsr::DragSourceEndedAt(
|
||||
|
||||
// |client_loc| and |screen_loc| are in the root coordinate space, for
|
||||
// non-root RenderWidgetHosts they need to be transformed.
|
||||
gfx::Point transformed_point = client_loc;
|
||||
gfx::Point transformed_screen_point = screen_loc;
|
||||
gfx::PointF transformed_point(client_loc);
|
||||
gfx::PointF transformed_screen_point(screen_loc);
|
||||
if (source_rwh && web_contents->GetRenderWidgetHostView()) {
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
client_loc,
|
||||
gfx::PointF(client_loc),
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
source_rwh->GetView()),
|
||||
&transformed_point);
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
web_contents->GetRenderWidgetHostView())
|
||||
->TransformPointToCoordSpaceForView(
|
||||
screen_loc,
|
||||
gfx::PointF(screen_loc),
|
||||
static_cast<content::RenderWidgetHostViewBase*>(
|
||||
source_rwh->GetView()),
|
||||
&transformed_screen_point);
|
||||
|
@@ -101,7 +101,9 @@ struct PopulateAxNodeAttributes {
|
||||
case ui::AX_ATTR_ERRORMESSAGE_ID:
|
||||
case ui::AX_ATTR_DETAILS_ID:
|
||||
case ui::AX_ATTR_MEMBER_OF_ID:
|
||||
case ui::AX_ATTR_NEXT_FOCUS_ID:
|
||||
case ui::AX_ATTR_NEXT_ON_LINE_ID:
|
||||
case ui::AX_ATTR_PREVIOUS_FOCUS_ID:
|
||||
case ui::AX_ATTR_PREVIOUS_ON_LINE_ID:
|
||||
case ui::AX_ATTR_CHILD_TREE_ID:
|
||||
case ui::AX_ATTR_SET_SIZE:
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "components/viz/common/frame_sinks/copy_output_request.h"
|
||||
#include "components/viz/common/frame_sinks/delay_based_time_source.h"
|
||||
#include "components/viz/common/gl_helper.h"
|
||||
#include "components/viz/common/switches.h"
|
||||
#include "content/browser/bad_message.h"
|
||||
#include "content/browser/compositor/image_transport_factory.h"
|
||||
#include "content/browser/frame_host/render_widget_host_view_guest.h"
|
||||
@@ -238,7 +239,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
#if !defined(OS_MACOSX)
|
||||
delegated_frame_host_ = base::MakeUnique<content::DelegatedFrameHost>(
|
||||
AllocateFrameSinkId(is_guest_view_hack), this,
|
||||
false /* enable_surface_synchronization */);
|
||||
false /* enable_surface_synchronization */, false /* enable_viz */);
|
||||
|
||||
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR));
|
||||
#endif
|
||||
@@ -321,11 +322,6 @@ void CefRenderWidgetHostViewOSR::InitAsChild(gfx::NativeView parent_view) {
|
||||
Show();
|
||||
}
|
||||
|
||||
content::RenderWidgetHost* CefRenderWidgetHostViewOSR::GetRenderWidgetHost()
|
||||
const {
|
||||
return render_widget_host_;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetSize(const gfx::Size& size) {}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetBounds(const gfx::Rect& rect) {}
|
||||
@@ -443,7 +439,8 @@ void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink(
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
||||
const viz::LocalSurfaceId& local_surface_id,
|
||||
viz::CompositorFrame frame) {
|
||||
viz::CompositorFrame frame,
|
||||
viz::mojom::HitTestRegionListPtr hit_test_region_list) {
|
||||
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::OnSwapCompositorFrame");
|
||||
|
||||
if (frame.metadata.root_scroll_offset != last_scroll_offset_) {
|
||||
@@ -472,8 +469,8 @@ void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
||||
// We would normally call BrowserCompositorMac::SubmitCompositorFrame on
|
||||
// macOS, however it contains compositor resize logic that we don't want.
|
||||
// Consequently we instead call the SwapDelegatedFrame method directly.
|
||||
GetDelegatedFrameHost()->SubmitCompositorFrame(local_surface_id,
|
||||
std::move(frame));
|
||||
GetDelegatedFrameHost()->SubmitCompositorFrame(
|
||||
local_surface_id, std::move(frame), std::move(hit_test_region_list));
|
||||
} else {
|
||||
if (!copy_frame_generator_.get()) {
|
||||
copy_frame_generator_.reset(
|
||||
@@ -491,8 +488,8 @@ void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
||||
// We would normally call BrowserCompositorMac::SubmitCompositorFrame on
|
||||
// macOS, however it contains compositor resize logic that we don't want.
|
||||
// Consequently we instead call the SwapDelegatedFrame method directly.
|
||||
GetDelegatedFrameHost()->SubmitCompositorFrame(local_surface_id,
|
||||
std::move(frame));
|
||||
GetDelegatedFrameHost()->SubmitCompositorFrame(
|
||||
local_surface_id, std::move(frame), std::move(hit_test_region_list));
|
||||
|
||||
// Request a copy of the last compositor frame which will eventually call
|
||||
// OnPaint asynchronously.
|
||||
@@ -707,6 +704,17 @@ gfx::Rect CefRenderWidgetHostViewOSR::GetBoundsInRootWindow() {
|
||||
return GetViewBounds();
|
||||
}
|
||||
|
||||
content::RenderWidgetHostImpl*
|
||||
CefRenderWidgetHostViewOSR::GetRenderWidgetHostImpl() const {
|
||||
return render_widget_host_;
|
||||
}
|
||||
|
||||
viz::SurfaceId CefRenderWidgetHostViewOSR::GetCurrentSurfaceId() const {
|
||||
return GetDelegatedFrameHost()
|
||||
? GetDelegatedFrameHost()->GetCurrentSurfaceId()
|
||||
: viz::SurfaceId();
|
||||
}
|
||||
|
||||
content::BrowserAccessibilityManager*
|
||||
CefRenderWidgetHostViewOSR::CreateBrowserAccessibilityManager(
|
||||
content::BrowserAccessibilityDelegate* delegate,
|
||||
@@ -796,43 +804,19 @@ void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) {
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ProcessKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event,
|
||||
const ui::LatencyInfo& latency) {
|
||||
render_widget_host_->ForwardKeyboardEventWithLatencyInfo(event, latency);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ProcessMouseEvent(
|
||||
const blink::WebMouseEvent& event,
|
||||
const ui::LatencyInfo& latency) {
|
||||
render_widget_host_->ForwardMouseEventWithLatencyInfo(event, latency);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ProcessMouseWheelEvent(
|
||||
const blink::WebMouseWheelEvent& event,
|
||||
const ui::LatencyInfo& latency) {
|
||||
render_widget_host_->ForwardWheelEventWithLatencyInfo(event, latency);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ProcessTouchEvent(
|
||||
const blink::WebTouchEvent& event,
|
||||
const ui::LatencyInfo& latency) {
|
||||
render_widget_host_->ForwardTouchEventWithLatencyInfo(event, latency);
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ProcessGestureEvent(
|
||||
const blink::WebGestureEvent& event,
|
||||
const ui::LatencyInfo& latency) {
|
||||
render_widget_host_->ForwardGestureEventWithLatencyInfo(event, latency);
|
||||
void CefRenderWidgetHostViewOSR::SetWantsAnimateOnlyBeginFrames() {
|
||||
if (GetDelegatedFrameHost()) {
|
||||
GetDelegatedFrameHost()->SetWantsAnimateOnlyBeginFrames();
|
||||
}
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
|
||||
const gfx::Point& point,
|
||||
const gfx::PointF& point,
|
||||
const viz::SurfaceId& original_surface,
|
||||
gfx::Point* transformed_point) {
|
||||
gfx::PointF* transformed_point) {
|
||||
// Transformations use physical pixels rather than DIP, so conversion
|
||||
// is necessary.
|
||||
gfx::Point point_in_pixels =
|
||||
gfx::PointF point_in_pixels =
|
||||
gfx::ConvertPointToPixel(current_device_scale_factor_, point);
|
||||
if (!GetDelegatedFrameHost()->TransformPointToLocalCoordSpace(
|
||||
point_in_pixels, original_surface, transformed_point)) {
|
||||
@@ -845,9 +829,9 @@ bool CefRenderWidgetHostViewOSR::TransformPointToLocalCoordSpace(
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
|
||||
const gfx::Point& point,
|
||||
const gfx::PointF& point,
|
||||
RenderWidgetHostViewBase* target_view,
|
||||
gfx::Point* transformed_point) {
|
||||
gfx::PointF* transformed_point) {
|
||||
if (target_view == this) {
|
||||
*transformed_point = point;
|
||||
return true;
|
||||
@@ -883,8 +867,7 @@ bool CefRenderWidgetHostViewOSR::DelegatedFrameHostIsVisible() const {
|
||||
return !render_widget_host_->is_hidden();
|
||||
}
|
||||
|
||||
SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor(
|
||||
SkColor color) const {
|
||||
SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor() const {
|
||||
// When making an element on the page fullscreen the element's background
|
||||
// may not match the page's, so use black as the gutter color to avoid
|
||||
// flashes of brighter colors during the transition.
|
||||
@@ -892,7 +875,7 @@ SkColor CefRenderWidgetHostViewOSR::DelegatedFrameHostGetGutterColor(
|
||||
render_widget_host_->delegate()->IsFullscreenForCurrentTab()) {
|
||||
return SK_ColorBLACK;
|
||||
}
|
||||
return color;
|
||||
return background_color_;
|
||||
}
|
||||
|
||||
gfx::Size CefRenderWidgetHostViewOSR::DelegatedFrameHostDesiredSizeInDIP()
|
||||
@@ -916,7 +899,7 @@ viz::LocalSurfaceId CefRenderWidgetHostViewOSR::GetLocalSurfaceId() const {
|
||||
return local_surface_id_;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnBeginFrame() {
|
||||
void CefRenderWidgetHostViewOSR::OnBeginFrame(base::TimeTicks frame_time) {
|
||||
// TODO(cef): Maybe we can use this method in combination with
|
||||
// OnSetNeedsBeginFrames() instead of using CefBeginFrameTimer.
|
||||
// See https://codereview.chromium.org/1841083007.
|
||||
@@ -926,6 +909,10 @@ bool CefRenderWidgetHostViewOSR::IsAutoResizeEnabled() const {
|
||||
return render_widget_host_->auto_resize_enabled();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnFrameTokenChanged(uint32_t frame_token) {
|
||||
render_widget_host_->DidProcessFrame(frame_token);
|
||||
}
|
||||
|
||||
std::unique_ptr<ui::CompositorLock>
|
||||
CefRenderWidgetHostViewOSR::GetCompositorLock(
|
||||
ui::CompositorLockClient* client) {
|
||||
@@ -1032,7 +1019,7 @@ void CefRenderWidgetHostViewOSR::SendKeyEvent(
|
||||
TRACE_EVENT0("libcef", "CefRenderWidgetHostViewOSR::SendKeyEvent");
|
||||
if (render_widget_host_ && render_widget_host_->GetView()) {
|
||||
// Direct routing requires that events go directly to the View.
|
||||
render_widget_host_->GetView()->ProcessKeyboardEvent(
|
||||
render_widget_host_->ForwardKeyboardEventWithLatencyInfo(
|
||||
event, ui::LatencyInfo(event.GetType() == blink::WebInputEvent::kChar ||
|
||||
event.GetType() ==
|
||||
blink::WebInputEvent::kRawKeyDown
|
||||
@@ -1294,16 +1281,11 @@ void CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
|
||||
|
||||
current_device_scale_factor_ = new_scale_factor;
|
||||
|
||||
if (render_widget_host_ && render_widget_host_->delegate())
|
||||
render_widget_host_->delegate()->UpdateDeviceScaleFactor(new_scale_factor);
|
||||
|
||||
// Notify the guest hosts if any.
|
||||
for (auto guest_host_view : guest_host_views_) {
|
||||
content::RenderWidgetHostImpl* rwhi = guest_host_view->render_widget_host();
|
||||
if (!rwhi)
|
||||
continue;
|
||||
if (rwhi->delegate())
|
||||
rwhi->delegate()->UpdateDeviceScaleFactor(new_scale_factor);
|
||||
if (rwhi->GetView())
|
||||
rwhi->GetView()->set_current_device_scale_factor(new_scale_factor);
|
||||
}
|
||||
@@ -1332,8 +1314,8 @@ void CefRenderWidgetHostViewOSR::ResizeRootLayer() {
|
||||
local_surface_id_ = local_surface_id_allocator_.GenerateId();
|
||||
|
||||
GetRootLayer()->SetBounds(gfx::Rect(size));
|
||||
GetCompositor()->SetScaleAndSize(current_device_scale_factor_,
|
||||
size_in_pixels);
|
||||
GetCompositor()->SetScaleAndSize(current_device_scale_factor_, size_in_pixels,
|
||||
local_surface_id_);
|
||||
PlatformResizeCompositorWidget(size_in_pixels);
|
||||
}
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "build/build_config.h"
|
||||
#include "components/viz/common/frame_sinks/begin_frame_source.h"
|
||||
#include "components/viz/common/surfaces/local_surface_id_allocator.h"
|
||||
#include "components/viz/common/surfaces/parent_local_surface_id_allocator.h"
|
||||
#include "content/browser/renderer_host/compositor_resize_lock.h"
|
||||
#include "content/browser/renderer_host/delegated_frame_host.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||
@@ -86,7 +86,7 @@ class MacHelper;
|
||||
class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
public ui::CompositorDelegate
|
||||
#if !defined(OS_MACOSX)
|
||||
,
|
||||
,
|
||||
public content::DelegatedFrameHostClient,
|
||||
public content::CompositorResizeLockClient
|
||||
#endif
|
||||
@@ -100,7 +100,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
|
||||
// RenderWidgetHostView implementation.
|
||||
void InitAsChild(gfx::NativeView parent_view) override;
|
||||
content::RenderWidgetHost* GetRenderWidgetHost() const override;
|
||||
void SetSize(const gfx::Size& size) override;
|
||||
void SetBounds(const gfx::Rect& rect) override;
|
||||
gfx::Vector2dF GetLastScrollOffset() const override;
|
||||
@@ -119,7 +118,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void UnlockMouse() override;
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
ui::AcceleratedWidgetMac* GetAcceleratedWidgetMac() const override;
|
||||
void SetActive(bool active) override;
|
||||
void ShowDefinitionForSelection() override;
|
||||
bool SupportsSpeech() const override;
|
||||
@@ -132,8 +130,10 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void DidCreateNewRendererCompositorFrameSink(
|
||||
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink)
|
||||
override;
|
||||
void SubmitCompositorFrame(const viz::LocalSurfaceId& local_surface_id,
|
||||
viz::CompositorFrame frame) override;
|
||||
void SubmitCompositorFrame(
|
||||
const viz::LocalSurfaceId& local_surface_id,
|
||||
viz::CompositorFrame frame,
|
||||
viz::mojom::HitTestRegionListPtr hit_test_region_list) override;
|
||||
void ClearCompositorFrame() override;
|
||||
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& pos) override;
|
||||
@@ -164,6 +164,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void EndFrameSubscription() override;
|
||||
bool HasAcceleratedSurface(const gfx::Size& desired_size) override;
|
||||
gfx::Rect GetBoundsInRootWindow() override;
|
||||
content::RenderWidgetHostImpl* GetRenderWidgetHostImpl() const override;
|
||||
viz::SurfaceId GetCurrentSurfaceId() const override;
|
||||
content::BrowserAccessibilityManager* CreateBrowserAccessibilityManager(
|
||||
content::BrowserAccessibilityDelegate* delegate,
|
||||
bool for_root_frame) override;
|
||||
@@ -177,24 +179,15 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
const std::vector<gfx::Rect>& character_bounds) override;
|
||||
|
||||
void SetNeedsBeginFrames(bool enabled) override;
|
||||
void SetWantsAnimateOnlyBeginFrames() override;
|
||||
|
||||
void ProcessKeyboardEvent(const content::NativeWebKeyboardEvent& event,
|
||||
const ui::LatencyInfo& latency) override;
|
||||
void ProcessMouseEvent(const blink::WebMouseEvent& event,
|
||||
const ui::LatencyInfo& latency) override;
|
||||
void ProcessMouseWheelEvent(const blink::WebMouseWheelEvent& event,
|
||||
const ui::LatencyInfo& latency) override;
|
||||
void ProcessTouchEvent(const blink::WebTouchEvent& event,
|
||||
const ui::LatencyInfo& latency) override;
|
||||
void ProcessGestureEvent(const blink::WebGestureEvent& event,
|
||||
const ui::LatencyInfo& latency) override;
|
||||
bool TransformPointToLocalCoordSpace(const gfx::Point& point,
|
||||
bool TransformPointToLocalCoordSpace(const gfx::PointF& point,
|
||||
const viz::SurfaceId& original_surface,
|
||||
gfx::Point* transformed_point) override;
|
||||
gfx::PointF* transformed_point) override;
|
||||
bool TransformPointToCoordSpaceForView(
|
||||
const gfx::Point& point,
|
||||
const gfx::PointF& point,
|
||||
RenderWidgetHostViewBase* target_view,
|
||||
gfx::Point* transformed_point) override;
|
||||
gfx::PointF* transformed_point) override;
|
||||
|
||||
// ui::CompositorDelegate implementation.
|
||||
std::unique_ptr<viz::SoftwareOutputDevice> CreateSoftwareOutputDevice(
|
||||
@@ -204,14 +197,15 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
// DelegatedFrameHostClient implementation.
|
||||
ui::Layer* DelegatedFrameHostGetLayer() const override;
|
||||
bool DelegatedFrameHostIsVisible() const override;
|
||||
SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override;
|
||||
SkColor DelegatedFrameHostGetGutterColor() const override;
|
||||
gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override;
|
||||
bool DelegatedFrameCanCreateResizeLock() const override;
|
||||
std::unique_ptr<content::CompositorResizeLock>
|
||||
DelegatedFrameHostCreateResizeLock() override;
|
||||
viz::LocalSurfaceId GetLocalSurfaceId() const override;
|
||||
void OnBeginFrame() override;
|
||||
void OnBeginFrame(base::TimeTicks frame_time) override;
|
||||
bool IsAutoResizeEnabled() const override;
|
||||
void OnFrameTokenChanged(uint32_t frame_token) override;
|
||||
|
||||
// CompositorResizeLockClient implementation.
|
||||
std::unique_ptr<ui::CompositorLock> GetCompositorLock(
|
||||
@@ -331,7 +325,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
#endif
|
||||
|
||||
viz::LocalSurfaceId local_surface_id_;
|
||||
viz::LocalSurfaceIdAllocator local_surface_id_allocator_;
|
||||
viz::ParentLocalSurfaceIdAllocator local_surface_id_allocator_;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
std::unique_ptr<gfx::WindowImpl> window_;
|
||||
|
@@ -26,14 +26,7 @@ class MacHelper : public content::BrowserCompositorMacClient,
|
||||
|
||||
// BrowserCompositorMacClient methods:
|
||||
|
||||
NSView* BrowserCompositorMacGetNSView() const override {
|
||||
// Intentionally return nil so that
|
||||
// BrowserCompositorMac::DelegatedFrameHostDesiredSizeInDIP uses the layer
|
||||
// size instead of the NSView size.
|
||||
return nil;
|
||||
}
|
||||
|
||||
SkColor BrowserCompositorMacGetGutterColor(SkColor color) const override {
|
||||
SkColor BrowserCompositorMacGetGutterColor() const override {
|
||||
// When making an element on the page fullscreen the element's background
|
||||
// may not match the page's, so use black as the gutter color to avoid
|
||||
// flashes of brighter colors during the transition.
|
||||
@@ -41,19 +34,21 @@ class MacHelper : public content::BrowserCompositorMacClient,
|
||||
view_->render_widget_host()->delegate()->IsFullscreenForCurrentTab()) {
|
||||
return SK_ColorBLACK;
|
||||
}
|
||||
return color;
|
||||
return view_->background_color();
|
||||
}
|
||||
|
||||
void BrowserCompositorMacOnBeginFrame() override {}
|
||||
|
||||
viz::LocalSurfaceId GetLocalSurfaceId() const override {
|
||||
return view_->local_surface_id();
|
||||
void OnFrameTokenChanged(uint32_t frame_token) override {
|
||||
view_->render_widget_host()->DidProcessFrame(frame_token);
|
||||
}
|
||||
|
||||
// AcceleratedWidgetMacNSView methods:
|
||||
|
||||
NSView* AcceleratedWidgetGetNSView() const override {
|
||||
return [view_->window_ contentView];
|
||||
// Intentionally return nil so that BrowserCompositorMac::GetViewProperties
|
||||
// uses the layer size instead of the NSView size.
|
||||
return nil;
|
||||
}
|
||||
|
||||
void AcceleratedWidgetGetVSyncParameters(
|
||||
@@ -72,13 +67,6 @@ class MacHelper : public content::BrowserCompositorMacClient,
|
||||
DISALLOW_COPY_AND_ASSIGN(MacHelper);
|
||||
};
|
||||
|
||||
ui::AcceleratedWidgetMac* CefRenderWidgetHostViewOSR::GetAcceleratedWidgetMac()
|
||||
const {
|
||||
if (browser_compositor_)
|
||||
return browser_compositor_->GetAcceleratedWidgetMac();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetActive(bool active) {}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ShowDefinitionForSelection() {}
|
||||
|
@@ -127,6 +127,8 @@ LPCWSTR ToCursorID(WebCursorInfo::Type type) {
|
||||
return MAKEINTRESOURCE(IDC_HAND_GRAB);
|
||||
case WebCursorInfo::kTypeGrabbing:
|
||||
return MAKEINTRESOURCE(IDC_HAND_GRABBING);
|
||||
case WebCursorInfo::kTypeCustom:
|
||||
break;
|
||||
}
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
|
@@ -63,6 +63,8 @@ void CefWebContentsViewOSR::StoreFocus() {}
|
||||
|
||||
void CefWebContentsViewOSR::RestoreFocus() {}
|
||||
|
||||
void CefWebContentsViewOSR::FocusThroughTabTraversal(bool reverse) {}
|
||||
|
||||
void CefWebContentsViewOSR::GotFocus(
|
||||
content::RenderWidgetHostImpl* render_widget_host) {
|
||||
if (web_contents_) {
|
||||
@@ -133,9 +135,10 @@ CefWebContentsViewOSR::CreateViewForPopupWidget(
|
||||
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewCreated(content::RenderViewHost* host) {
|
||||
// |view| will be nullptr the first time this method is called for popup
|
||||
// browsers.
|
||||
CefRenderWidgetHostViewOSR* view = GetView();
|
||||
if (!host)
|
||||
return;
|
||||
CefRenderWidgetHostViewOSR* view =
|
||||
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
|
||||
if (view)
|
||||
view->InstallTransparency();
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
void SetInitialFocus() override;
|
||||
void StoreFocus() override;
|
||||
void RestoreFocus() override;
|
||||
void FocusThroughTabTraversal(bool reverse) override;
|
||||
content::DropData* GetDropData() const override;
|
||||
gfx::Rect GetViewBounds() const override;
|
||||
void CreateView(const gfx::Size& initial_size,
|
||||
|
@@ -1,107 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/pepper/browser_pepper_host_factory.h"
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_broker_message_filter.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_flash_browser_host.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_flash_drm_host.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_output_protection_message_filter.h"
|
||||
#include "chrome/browser/renderer_host/pepper/pepper_platform_verification_message_filter.h"
|
||||
#include "content/public/browser/browser_ppapi_host.h"
|
||||
#include "ppapi/host/message_filter_host.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
#include "ppapi/host/resource_host.h"
|
||||
#include "ppapi/proxy/ppapi_messages.h"
|
||||
#include "ppapi/shared_impl/ppapi_permissions.h"
|
||||
|
||||
using ppapi::host::MessageFilterHost;
|
||||
using ppapi::host::ResourceHost;
|
||||
using ppapi::host::ResourceMessageFilter;
|
||||
|
||||
CefBrowserPepperHostFactory::CefBrowserPepperHostFactory(
|
||||
content::BrowserPpapiHost* host)
|
||||
: host_(host) {}
|
||||
|
||||
CefBrowserPepperHostFactory::~CefBrowserPepperHostFactory() {}
|
||||
|
||||
std::unique_ptr<ResourceHost> CefBrowserPepperHostFactory::CreateResourceHost(
|
||||
ppapi::host::PpapiHost* host,
|
||||
PP_Resource resource,
|
||||
PP_Instance instance,
|
||||
const IPC::Message& message) {
|
||||
DCHECK(host == host_->GetPpapiHost());
|
||||
|
||||
// Make sure the plugin is giving us a valid instance for this resource.
|
||||
if (!host_->IsValidInstance(instance))
|
||||
return nullptr;
|
||||
|
||||
// Private interfaces.
|
||||
if (host_->GetPpapiHost()->permissions().HasPermission(
|
||||
ppapi::PERMISSION_PRIVATE)) {
|
||||
switch (message.type()) {
|
||||
case PpapiHostMsg_Broker_Create::ID: {
|
||||
scoped_refptr<ResourceMessageFilter> broker_filter(
|
||||
new chrome::PepperBrokerMessageFilter(instance, host_));
|
||||
return std::unique_ptr<ResourceHost>(new MessageFilterHost(
|
||||
host_->GetPpapiHost(), instance, resource, broker_filter));
|
||||
}
|
||||
case PpapiHostMsg_PlatformVerification_Create::ID: {
|
||||
scoped_refptr<ResourceMessageFilter> pv_filter(
|
||||
new chrome::PepperPlatformVerificationMessageFilter(host_,
|
||||
instance));
|
||||
return std::unique_ptr<ResourceHost>(new MessageFilterHost(
|
||||
host_->GetPpapiHost(), instance, resource, pv_filter));
|
||||
}
|
||||
case PpapiHostMsg_OutputProtection_Create::ID: {
|
||||
scoped_refptr<ResourceMessageFilter> output_protection_filter(
|
||||
new chrome::PepperOutputProtectionMessageFilter(host_, instance));
|
||||
return std::unique_ptr<ResourceHost>(
|
||||
new MessageFilterHost(host_->GetPpapiHost(), instance, resource,
|
||||
output_protection_filter));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Flash interfaces.
|
||||
if (host_->GetPpapiHost()->permissions().HasPermission(
|
||||
ppapi::PERMISSION_FLASH)) {
|
||||
switch (message.type()) {
|
||||
case PpapiHostMsg_Flash_Create::ID:
|
||||
return base::MakeUnique<chrome::PepperFlashBrowserHost>(host_, instance,
|
||||
resource);
|
||||
case PpapiHostMsg_FlashClipboard_Create::ID: {
|
||||
scoped_refptr<ResourceMessageFilter> clipboard_filter(
|
||||
new chrome::PepperFlashClipboardMessageFilter);
|
||||
return base::MakeUnique<MessageFilterHost>(
|
||||
host_->GetPpapiHost(), instance, resource, clipboard_filter);
|
||||
}
|
||||
case PpapiHostMsg_FlashDRM_Create::ID:
|
||||
return base::MakeUnique<chrome::PepperFlashDRMHost>(host_, instance,
|
||||
resource);
|
||||
}
|
||||
}
|
||||
|
||||
// Permissions for the following interfaces will be checked at the
|
||||
// time of the corresponding instance's methods calls (because
|
||||
// permission check can be performed only on the UI
|
||||
// thread). Currently these interfaces are available only for
|
||||
// whitelisted apps which may not have access to the other private
|
||||
// interfaces.
|
||||
if (message.type() == PpapiHostMsg_IsolatedFileSystem_Create::ID) {
|
||||
chrome::PepperIsolatedFileSystemMessageFilter* isolated_fs_filter =
|
||||
chrome::PepperIsolatedFileSystemMessageFilter::Create(instance, host_);
|
||||
if (!isolated_fs_filter)
|
||||
return nullptr;
|
||||
return base::MakeUnique<MessageFilterHost>(host, instance, resource,
|
||||
isolated_fs_filter);
|
||||
}
|
||||
|
||||
NOTREACHED() << "Unhandled message type: " << message.type();
|
||||
return nullptr;
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PEPPER_BROWSER_PEPPER_HOST_FACTORY_H_
|
||||
#define CEF_LIBCEF_BROWSER_PEPPER_BROWSER_PEPPER_HOST_FACTORY_H_
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/macros.h"
|
||||
#include "ppapi/host/host_factory.h"
|
||||
|
||||
namespace content {
|
||||
class BrowserPpapiHost;
|
||||
} // namespace content
|
||||
|
||||
class CefBrowserPepperHostFactory : public ppapi::host::HostFactory {
|
||||
public:
|
||||
// Non-owning pointer to the filter must outlive this class.
|
||||
explicit CefBrowserPepperHostFactory(content::BrowserPpapiHost* host);
|
||||
~CefBrowserPepperHostFactory() override;
|
||||
|
||||
std::unique_ptr<ppapi::host::ResourceHost> CreateResourceHost(
|
||||
ppapi::host::PpapiHost* host,
|
||||
PP_Resource resource,
|
||||
PP_Instance instance,
|
||||
const IPC::Message& message) override;
|
||||
|
||||
private:
|
||||
// Non-owning pointer.
|
||||
content::BrowserPpapiHost* host_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserPepperHostFactory);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PEPPER_BROWSER_PEPPER_HOST_FACTORY_H_
|
@@ -1,250 +0,0 @@
|
||||
// Copyright 2015 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/permissions/permission_context.h"
|
||||
|
||||
#include "include/cef_client.h"
|
||||
#include "include/cef_geolocation_handler.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/permissions/permission_util.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "content/public/browser/permission_type.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/origin_util.h"
|
||||
#include "device/geolocation/geolocation_provider.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Whether the permission should be restricted to secure origins.
|
||||
bool IsRestrictedToSecureOrigins(content::PermissionType permission) {
|
||||
return false;
|
||||
}
|
||||
|
||||
class CefGeolocationCallbackImpl : public CefGeolocationCallback {
|
||||
public:
|
||||
typedef CefPermissionContext::PermissionDecidedCallback CallbackType;
|
||||
|
||||
explicit CefGeolocationCallbackImpl(const CallbackType& callback)
|
||||
: callback_(callback) {}
|
||||
|
||||
void Continue(bool allow) override {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!callback_.is_null()) {
|
||||
if (allow) {
|
||||
device::GeolocationProvider::GetInstance()
|
||||
->UserDidOptIntoLocationServices();
|
||||
}
|
||||
|
||||
callback_.Run(allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK);
|
||||
callback_.Reset();
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefGeolocationCallbackImpl::Continue,
|
||||
this, allow));
|
||||
}
|
||||
}
|
||||
|
||||
void Disconnect() { callback_.Reset(); }
|
||||
|
||||
private:
|
||||
CallbackType callback_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefGeolocationCallbackImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefGeolocationCallbackImpl);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
CefPermissionContext::CefPermissionContext(CefBrowserContext* profile)
|
||||
: profile_(profile), weak_ptr_factory_(this) {}
|
||||
|
||||
bool CefPermissionContext::SupportsPermission(
|
||||
content::PermissionType permission) {
|
||||
// Only Geolocation permissions are currently supported.
|
||||
return permission == content::PermissionType::GEOLOCATION;
|
||||
}
|
||||
|
||||
void CefPermissionContext::RequestPermission(
|
||||
content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_frame,
|
||||
const BrowserPermissionCallback& callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
|
||||
DecidePermission(permission, web_contents, id, requesting_frame.GetOrigin(),
|
||||
web_contents->GetLastCommittedURL().GetOrigin(), callback);
|
||||
}
|
||||
|
||||
void CefPermissionContext::CancelPermissionRequest(
|
||||
content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
const PermissionRequestID& id) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
DCHECK(permission == content::PermissionType::GEOLOCATION);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForContents(web_contents);
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefGeolocationHandler> handler =
|
||||
client->GetGeolocationHandler();
|
||||
if (handler.get())
|
||||
handler->OnCancelGeolocationPermission(browser.get(), id.request_id());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefPermissionContext::ResetPermission(content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) {
|
||||
profile_->GetHostContentSettingsMap()->SetContentSettingCustomScope(
|
||||
ContentSettingsPattern::FromURLNoWildcard(requesting_origin),
|
||||
ContentSettingsPattern::FromURLNoWildcard(embedding_origin),
|
||||
permission_util::PermissionTypeToContentSetting(permission),
|
||||
std::string(), CONTENT_SETTING_DEFAULT);
|
||||
}
|
||||
|
||||
ContentSetting CefPermissionContext::GetPermissionStatus(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) const {
|
||||
if (IsRestrictedToSecureOrigins(permission) &&
|
||||
!content::IsOriginSecure(requesting_origin)) {
|
||||
return CONTENT_SETTING_BLOCK;
|
||||
}
|
||||
|
||||
return profile_->GetHostContentSettingsMap()->GetContentSetting(
|
||||
requesting_origin, embedding_origin,
|
||||
permission_util::PermissionTypeToContentSetting(permission),
|
||||
std::string());
|
||||
}
|
||||
|
||||
void CefPermissionContext::DecidePermission(
|
||||
content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const BrowserPermissionCallback& callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
|
||||
if (!requesting_origin.is_valid() || !embedding_origin.is_valid()) {
|
||||
NotifyPermissionSet(permission, id, requesting_origin, embedding_origin,
|
||||
callback, false /* persist */, CONTENT_SETTING_BLOCK);
|
||||
return;
|
||||
}
|
||||
|
||||
if (IsRestrictedToSecureOrigins(permission) &&
|
||||
!content::IsOriginSecure(requesting_origin)) {
|
||||
NotifyPermissionSet(permission, id, requesting_origin, embedding_origin,
|
||||
callback, false /* persist */, CONTENT_SETTING_BLOCK);
|
||||
return;
|
||||
}
|
||||
|
||||
ContentSetting content_setting =
|
||||
profile_->GetHostContentSettingsMap()->GetContentSetting(
|
||||
requesting_origin, embedding_origin,
|
||||
permission_util::PermissionTypeToContentSetting(permission),
|
||||
std::string());
|
||||
|
||||
if (content_setting == CONTENT_SETTING_ALLOW ||
|
||||
content_setting == CONTENT_SETTING_BLOCK) {
|
||||
NotifyPermissionSet(permission, id, requesting_origin, embedding_origin,
|
||||
callback, false /* persist */, content_setting);
|
||||
return;
|
||||
}
|
||||
|
||||
QueryPermission(permission, id, requesting_origin, embedding_origin,
|
||||
base::Bind(&CefPermissionContext::NotifyPermissionSet,
|
||||
weak_ptr_factory_.GetWeakPtr(), permission, id,
|
||||
requesting_origin, embedding_origin, callback,
|
||||
false /* persist */));
|
||||
}
|
||||
|
||||
void CefPermissionContext::QueryPermission(
|
||||
content::PermissionType permission,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const PermissionDecidedCallback& callback) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
DCHECK(permission == content::PermissionType::GEOLOCATION);
|
||||
|
||||
bool proceed = false;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser =
|
||||
CefBrowserHostImpl::GetBrowserForFrame(id.render_process_id(),
|
||||
id.render_frame_id());
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get()) {
|
||||
CefRefPtr<CefGeolocationHandler> handler =
|
||||
client->GetGeolocationHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefGeolocationCallbackImpl> callbackImpl(
|
||||
new CefGeolocationCallbackImpl(callback));
|
||||
|
||||
// Notify the handler.
|
||||
proceed = handler->OnRequestGeolocationPermission(
|
||||
browser.get(), requesting_origin.spec(), id.request_id(),
|
||||
callbackImpl.get());
|
||||
if (!proceed)
|
||||
callbackImpl->Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!proceed) {
|
||||
// Disallow geolocation access by default.
|
||||
callback.Run(CONTENT_SETTING_BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
void CefPermissionContext::NotifyPermissionSet(
|
||||
content::PermissionType permission,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const BrowserPermissionCallback& callback,
|
||||
bool persist,
|
||||
ContentSetting content_setting) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
|
||||
if (persist) {
|
||||
UpdateContentSetting(permission, requesting_origin, embedding_origin,
|
||||
content_setting);
|
||||
}
|
||||
|
||||
if (content_setting == CONTENT_SETTING_DEFAULT) {
|
||||
content_setting =
|
||||
profile_->GetHostContentSettingsMap()->GetDefaultContentSetting(
|
||||
permission_util::PermissionTypeToContentSetting(permission),
|
||||
nullptr);
|
||||
}
|
||||
|
||||
DCHECK_NE(content_setting, CONTENT_SETTING_DEFAULT);
|
||||
callback.Run(content_setting);
|
||||
}
|
||||
|
||||
void CefPermissionContext::UpdateContentSetting(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
ContentSetting content_setting) {
|
||||
DCHECK_EQ(requesting_origin, requesting_origin.GetOrigin());
|
||||
DCHECK_EQ(embedding_origin, embedding_origin.GetOrigin());
|
||||
DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
|
||||
content_setting == CONTENT_SETTING_BLOCK);
|
||||
|
||||
profile_->GetHostContentSettingsMap()->SetContentSettingCustomScope(
|
||||
ContentSettingsPattern::FromURLNoWildcard(requesting_origin),
|
||||
ContentSettingsPattern::FromURLNoWildcard(embedding_origin),
|
||||
permission_util::PermissionTypeToContentSetting(permission),
|
||||
std::string(), content_setting);
|
||||
}
|
@@ -1,96 +0,0 @@
|
||||
// Copyright 2015 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_H_
|
||||
#define CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_H_
|
||||
|
||||
#include "base/callback_forward.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "chrome/browser/permissions/permission_request_id.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
|
||||
class CefBrowserContext;
|
||||
|
||||
namespace content {
|
||||
enum class PermissionType;
|
||||
class WebContents;
|
||||
}; // namespace content
|
||||
|
||||
// Based on chrome/browser/permissions/permission_context_base.h
|
||||
class CefPermissionContext {
|
||||
public:
|
||||
explicit CefPermissionContext(CefBrowserContext* profile);
|
||||
|
||||
using BrowserPermissionCallback = base::Callback<void(ContentSetting)>;
|
||||
using PermissionDecidedCallback = base::Callback<void(ContentSetting)>;
|
||||
|
||||
// Returns true if support exists for querying the embedder about the
|
||||
// specified permission type.
|
||||
bool SupportsPermission(content::PermissionType permission);
|
||||
|
||||
// The renderer is requesting permission to push messages.
|
||||
// When the answer to a permission request has been determined, |callback|
|
||||
// should be called with the result.
|
||||
void RequestPermission(content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_frame,
|
||||
const BrowserPermissionCallback& callback);
|
||||
|
||||
// Withdraw an existing permission request, no op if the permission request
|
||||
// was already cancelled by some other means.
|
||||
void CancelPermissionRequest(content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
const PermissionRequestID& id);
|
||||
|
||||
// Resets the permission to its default value.
|
||||
void ResetPermission(content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin);
|
||||
|
||||
// Returns whether the permission has been granted, denied...
|
||||
ContentSetting GetPermissionStatus(content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) const;
|
||||
|
||||
private:
|
||||
// Decide whether the permission should be granted.
|
||||
// Calls PermissionDecided if permission can be decided non-interactively,
|
||||
// or NotifyPermissionSet if permission decided by presenting an infobar.
|
||||
void DecidePermission(content::PermissionType permission,
|
||||
content::WebContents* web_contents,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const BrowserPermissionCallback& callback);
|
||||
|
||||
void QueryPermission(content::PermissionType permission,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const PermissionDecidedCallback& callback);
|
||||
|
||||
void NotifyPermissionSet(content::PermissionType permission,
|
||||
const PermissionRequestID& id,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const BrowserPermissionCallback& callback,
|
||||
bool persist,
|
||||
ContentSetting content_setting);
|
||||
|
||||
// Store the decided permission as a content setting.
|
||||
void UpdateContentSetting(content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
ContentSetting content_setting);
|
||||
|
||||
CefBrowserContext* profile_;
|
||||
|
||||
base::WeakPtrFactory<CefPermissionContext> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPermissionContext);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_CONTEXT_H_
|
@@ -1,356 +0,0 @@
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/permissions/permission_manager.h"
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/permissions/permission_util.h"
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "content/public/browser/permission_type.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/render_process_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
|
||||
using blink::mojom::PermissionStatus;
|
||||
using content::PermissionType;
|
||||
|
||||
namespace {
|
||||
|
||||
// Helper method to convert ContentSetting to PermissionStatus.
|
||||
PermissionStatus ContentSettingToPermissionStatus(ContentSetting setting) {
|
||||
switch (setting) {
|
||||
case CONTENT_SETTING_ALLOW:
|
||||
case CONTENT_SETTING_SESSION_ONLY:
|
||||
return PermissionStatus::GRANTED;
|
||||
case CONTENT_SETTING_BLOCK:
|
||||
return PermissionStatus::DENIED;
|
||||
case CONTENT_SETTING_ASK:
|
||||
return PermissionStatus::ASK;
|
||||
case CONTENT_SETTING_DETECT_IMPORTANT_CONTENT:
|
||||
case CONTENT_SETTING_DEFAULT:
|
||||
case CONTENT_SETTING_NUM_SETTINGS:
|
||||
break;
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
return PermissionStatus::DENIED;
|
||||
}
|
||||
|
||||
// Helper method to convert PermissionStatus to ContentSetting.
|
||||
ContentSetting PermissionStatusToContentSetting(PermissionStatus status) {
|
||||
switch (status) {
|
||||
case PermissionStatus::GRANTED:
|
||||
return CONTENT_SETTING_ALLOW;
|
||||
case PermissionStatus::DENIED:
|
||||
return CONTENT_SETTING_BLOCK;
|
||||
case PermissionStatus::ASK:
|
||||
return CONTENT_SETTING_ASK;
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
return CONTENT_SETTING_BLOCK;
|
||||
}
|
||||
|
||||
// Wrap a callback taking a PermissionStatus to pass it as a callback taking a
|
||||
// ContentSetting.
|
||||
void ContentSettingToPermissionStatusCallbackWrapper(
|
||||
const base::Callback<void(PermissionStatus)>& callback,
|
||||
ContentSetting setting) {
|
||||
callback.Run(ContentSettingToPermissionStatus(setting));
|
||||
}
|
||||
|
||||
// Returns whether the permission has a constant PermissionStatus value (i.e.
|
||||
// always approved or always denied).
|
||||
bool IsConstantPermission(PermissionType type) {
|
||||
switch (type) {
|
||||
case PermissionType::MIDI:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void PermissionRequestResponseCallbackWrapper(
|
||||
const base::Callback<void(PermissionStatus)>& callback,
|
||||
const std::vector<PermissionStatus>& vector) {
|
||||
DCHECK_EQ(vector.size(), 1ul);
|
||||
callback.Run(vector[0]);
|
||||
}
|
||||
|
||||
// Function used for handling permission types which do not change their
|
||||
// value i.e. they are always approved or always denied etc.
|
||||
// CONTENT_SETTING_DEFAULT is returned if the permission needs further handling.
|
||||
// This function should only be called when IsConstantPermission has returned
|
||||
// true for the PermissionType.
|
||||
ContentSetting GetContentSettingForConstantPermission(PermissionType type) {
|
||||
DCHECK(IsConstantPermission(type));
|
||||
switch (type) {
|
||||
case PermissionType::MIDI:
|
||||
return CONTENT_SETTING_ALLOW;
|
||||
default:
|
||||
return CONTENT_SETTING_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
PermissionStatus GetPermissionStatusForConstantPermission(PermissionType type) {
|
||||
return ContentSettingToPermissionStatus(
|
||||
GetContentSettingForConstantPermission(type));
|
||||
}
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
class CefPermissionManager::PendingRequest {
|
||||
public:
|
||||
PendingRequest(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const std::vector<PermissionType> permissions,
|
||||
const base::Callback<void(const std::vector<PermissionStatus>&)>&
|
||||
callback)
|
||||
: render_process_id_(render_frame_host->GetProcess()->GetID()),
|
||||
render_frame_id_(render_frame_host->GetRoutingID()),
|
||||
callback_(callback),
|
||||
permissions_(permissions),
|
||||
results_(permissions.size(), PermissionStatus::DENIED),
|
||||
remaining_results_(permissions.size()) {}
|
||||
|
||||
void SetPermissionStatus(int permission_id, PermissionStatus status) {
|
||||
DCHECK(!IsComplete());
|
||||
|
||||
results_[permission_id] = status;
|
||||
--remaining_results_;
|
||||
}
|
||||
|
||||
bool IsComplete() const { return remaining_results_ == 0; }
|
||||
|
||||
int render_process_id() const { return render_process_id_; }
|
||||
int render_frame_id() const { return render_frame_id_; }
|
||||
|
||||
const base::Callback<void(const std::vector<PermissionStatus>&)> callback()
|
||||
const {
|
||||
return callback_;
|
||||
}
|
||||
|
||||
std::vector<PermissionType> permissions() const { return permissions_; }
|
||||
|
||||
std::vector<PermissionStatus> results() const { return results_; }
|
||||
|
||||
private:
|
||||
int render_process_id_;
|
||||
int render_frame_id_;
|
||||
const base::Callback<void(const std::vector<PermissionStatus>&)> callback_;
|
||||
std::vector<PermissionType> permissions_;
|
||||
std::vector<PermissionStatus> results_;
|
||||
size_t remaining_results_;
|
||||
};
|
||||
|
||||
struct CefPermissionManager::Subscription {
|
||||
PermissionType permission;
|
||||
GURL requesting_origin;
|
||||
GURL embedding_origin;
|
||||
base::Callback<void(PermissionStatus)> callback;
|
||||
ContentSetting current_value;
|
||||
};
|
||||
|
||||
CefPermissionManager::CefPermissionManager(CefBrowserContext* profile)
|
||||
: profile_(profile), context_(profile), weak_ptr_factory_(this) {}
|
||||
|
||||
CefPermissionManager::~CefPermissionManager() {
|
||||
if (!subscriptions_.IsEmpty())
|
||||
profile_->GetHostContentSettingsMap()->RemoveObserver(this);
|
||||
}
|
||||
|
||||
int CefPermissionManager::RequestPermission(
|
||||
PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<void(PermissionStatus)>& callback) {
|
||||
return RequestPermissions(
|
||||
std::vector<PermissionType>(1, permission), render_frame_host,
|
||||
requesting_origin, user_gesture,
|
||||
base::Bind(&PermissionRequestResponseCallbackWrapper, callback));
|
||||
}
|
||||
|
||||
int CefPermissionManager::RequestPermissions(
|
||||
const std::vector<PermissionType>& permissions,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<void(const std::vector<PermissionStatus>&)>&
|
||||
callback) {
|
||||
if (permissions.empty()) {
|
||||
callback.Run(std::vector<PermissionStatus>());
|
||||
return kNoPendingOperation;
|
||||
}
|
||||
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(render_frame_host);
|
||||
GURL embedding_origin = web_contents->GetLastCommittedURL().GetOrigin();
|
||||
|
||||
std::unique_ptr<PendingRequest> pending_request =
|
||||
base::MakeUnique<PendingRequest>(render_frame_host, permissions,
|
||||
callback);
|
||||
int request_id = pending_requests_.Add(std::move(pending_request));
|
||||
|
||||
const PermissionRequestID request(render_frame_host, request_id);
|
||||
|
||||
for (size_t i = 0; i < permissions.size(); ++i) {
|
||||
const PermissionType permission = permissions[i];
|
||||
|
||||
if (IsConstantPermission(permission) ||
|
||||
!context_.SupportsPermission(permission)) {
|
||||
OnPermissionsRequestResponseStatus(
|
||||
request_id, i,
|
||||
GetPermissionStatus(permission, requesting_origin, embedding_origin));
|
||||
continue;
|
||||
}
|
||||
|
||||
context_.RequestPermission(
|
||||
permission, web_contents, request, requesting_origin,
|
||||
base::Bind(
|
||||
&ContentSettingToPermissionStatusCallbackWrapper,
|
||||
base::Bind(
|
||||
&CefPermissionManager::OnPermissionsRequestResponseStatus,
|
||||
weak_ptr_factory_.GetWeakPtr(), request_id, i)));
|
||||
}
|
||||
|
||||
// The request might have been resolved already.
|
||||
if (!pending_requests_.Lookup(request_id))
|
||||
return kNoPendingOperation;
|
||||
|
||||
return request_id;
|
||||
}
|
||||
|
||||
void CefPermissionManager::OnPermissionsRequestResponseStatus(
|
||||
int request_id,
|
||||
int permission_id,
|
||||
PermissionStatus status) {
|
||||
PendingRequest* pending_request = pending_requests_.Lookup(request_id);
|
||||
pending_request->SetPermissionStatus(permission_id, status);
|
||||
|
||||
if (!pending_request->IsComplete())
|
||||
return;
|
||||
|
||||
pending_request->callback().Run(pending_request->results());
|
||||
pending_requests_.Remove(request_id);
|
||||
}
|
||||
|
||||
void CefPermissionManager::CancelPermissionRequest(int request_id) {
|
||||
PendingRequest* pending_request = pending_requests_.Lookup(request_id);
|
||||
if (!pending_request)
|
||||
return;
|
||||
|
||||
content::RenderFrameHost* render_frame_host =
|
||||
content::RenderFrameHost::FromID(pending_request->render_process_id(),
|
||||
pending_request->render_frame_id());
|
||||
DCHECK(render_frame_host);
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(render_frame_host);
|
||||
DCHECK(web_contents);
|
||||
|
||||
const PermissionRequestID request(pending_request->render_process_id(),
|
||||
pending_request->render_frame_id(),
|
||||
request_id);
|
||||
for (PermissionType permission : pending_request->permissions()) {
|
||||
if (!context_.SupportsPermission(permission))
|
||||
continue;
|
||||
context_.CancelPermissionRequest(permission, web_contents, request);
|
||||
}
|
||||
pending_requests_.Remove(request_id);
|
||||
}
|
||||
|
||||
void CefPermissionManager::ResetPermission(PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) {
|
||||
if (!context_.SupportsPermission(permission))
|
||||
return;
|
||||
context_.ResetPermission(permission, requesting_origin, embedding_origin);
|
||||
}
|
||||
|
||||
PermissionStatus CefPermissionManager::GetPermissionStatus(
|
||||
PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) {
|
||||
if (IsConstantPermission(permission))
|
||||
return GetPermissionStatusForConstantPermission(permission);
|
||||
|
||||
if (!context_.SupportsPermission(permission))
|
||||
return PermissionStatus::DENIED;
|
||||
|
||||
return ContentSettingToPermissionStatus(context_.GetPermissionStatus(
|
||||
permission, requesting_origin, embedding_origin));
|
||||
}
|
||||
|
||||
int CefPermissionManager::SubscribePermissionStatusChange(
|
||||
PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const base::Callback<void(PermissionStatus)>& callback) {
|
||||
if (subscriptions_.IsEmpty())
|
||||
profile_->GetHostContentSettingsMap()->AddObserver(this);
|
||||
|
||||
std::unique_ptr<Subscription> subscription = base::MakeUnique<Subscription>();
|
||||
subscription->permission = permission;
|
||||
subscription->requesting_origin = requesting_origin;
|
||||
subscription->embedding_origin = embedding_origin;
|
||||
subscription->callback = callback;
|
||||
|
||||
subscription->current_value = PermissionStatusToContentSetting(
|
||||
GetPermissionStatus(permission, subscription->requesting_origin,
|
||||
subscription->embedding_origin));
|
||||
|
||||
return subscriptions_.Add(std::move(subscription));
|
||||
}
|
||||
|
||||
void CefPermissionManager::UnsubscribePermissionStatusChange(
|
||||
int subscription_id) {
|
||||
// Whether |subscription_id| is known will be checked by the Remove() call.
|
||||
subscriptions_.Remove(subscription_id);
|
||||
|
||||
if (subscriptions_.IsEmpty())
|
||||
profile_->GetHostContentSettingsMap()->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void CefPermissionManager::OnContentSettingChanged(
|
||||
const ContentSettingsPattern& primary_pattern,
|
||||
const ContentSettingsPattern& secondary_pattern,
|
||||
ContentSettingsType content_type,
|
||||
std::string resource_identifier) {
|
||||
std::list<base::Closure> callbacks;
|
||||
|
||||
for (SubscriptionsMap::iterator iter(&subscriptions_); !iter.IsAtEnd();
|
||||
iter.Advance()) {
|
||||
Subscription* subscription = iter.GetCurrentValue();
|
||||
if (permission_util::PermissionTypeToContentSetting(
|
||||
subscription->permission) != content_type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (primary_pattern.IsValid() &&
|
||||
!primary_pattern.Matches(subscription->requesting_origin))
|
||||
continue;
|
||||
if (secondary_pattern.IsValid() &&
|
||||
!secondary_pattern.Matches(subscription->embedding_origin))
|
||||
continue;
|
||||
|
||||
ContentSetting new_value =
|
||||
PermissionStatusToContentSetting(GetPermissionStatus(
|
||||
subscription->permission, subscription->requesting_origin,
|
||||
subscription->embedding_origin));
|
||||
if (subscription->current_value == new_value)
|
||||
continue;
|
||||
|
||||
subscription->current_value = new_value;
|
||||
|
||||
// Add the callback to |callbacks| which will be run after the loop to
|
||||
// prevent re-entrance issues.
|
||||
callbacks.push_back(base::Bind(
|
||||
subscription->callback, ContentSettingToPermissionStatus(new_value)));
|
||||
}
|
||||
|
||||
for (const auto& callback : callbacks)
|
||||
callback.Run();
|
||||
}
|
@@ -1,100 +0,0 @@
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
|
||||
#define CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
|
||||
|
||||
#include "libcef/browser/permissions/permission_context.h"
|
||||
|
||||
#include "base/callback_forward.h"
|
||||
#include "base/containers/id_map.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "components/content_settings/core/browser/content_settings_observer.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
#include "components/keyed_service/core/keyed_service.h"
|
||||
#include "content/public/browser/permission_manager.h"
|
||||
|
||||
class CefBrowserContext;
|
||||
|
||||
namespace content {
|
||||
enum class PermissionType;
|
||||
class WebContents;
|
||||
}; // namespace content
|
||||
|
||||
// Implementation based on chrome/browser/permissions/permission_manager.h
|
||||
class CefPermissionManager : public KeyedService,
|
||||
public content::PermissionManager,
|
||||
public content_settings::Observer {
|
||||
public:
|
||||
explicit CefPermissionManager(CefBrowserContext* profile);
|
||||
~CefPermissionManager() override;
|
||||
|
||||
// content::CefPermissionManager implementation.
|
||||
int RequestPermission(
|
||||
content::PermissionType permission,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
|
||||
override;
|
||||
int RequestPermissions(
|
||||
const std::vector<content::PermissionType>& permissions,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& requesting_origin,
|
||||
bool user_gesture,
|
||||
const base::Callback<
|
||||
void(const std::vector<blink::mojom::PermissionStatus>&)>& callback)
|
||||
override;
|
||||
void CancelPermissionRequest(int request_id) override;
|
||||
void ResetPermission(content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) override;
|
||||
blink::mojom::PermissionStatus GetPermissionStatus(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin) override;
|
||||
int SubscribePermissionStatusChange(
|
||||
content::PermissionType permission,
|
||||
const GURL& requesting_origin,
|
||||
const GURL& embedding_origin,
|
||||
const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
|
||||
override;
|
||||
void UnsubscribePermissionStatusChange(int subscription_id) override;
|
||||
|
||||
private:
|
||||
class PendingRequest;
|
||||
using PendingRequestsMap = base::IDMap<std::unique_ptr<PendingRequest>>;
|
||||
|
||||
struct Subscription;
|
||||
using SubscriptionsMap = base::IDMap<std::unique_ptr<Subscription>>;
|
||||
|
||||
// Called when a permission was decided for a given PendingRequest. The
|
||||
// PendingRequest is identified by its |request_id| and the permission is
|
||||
// identified by its |permission_id|. If the PendingRequest contains more than
|
||||
// one permission, it will wait for the remaining permissions to be resolved.
|
||||
// When all the permissions have been resolved, the PendingRequest's callback
|
||||
// is run.
|
||||
void OnPermissionsRequestResponseStatus(
|
||||
int request_id,
|
||||
int permission_id,
|
||||
blink::mojom::PermissionStatus status);
|
||||
|
||||
// content_settings::Observer implementation.
|
||||
void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern,
|
||||
const ContentSettingsPattern& secondary_pattern,
|
||||
ContentSettingsType content_type,
|
||||
std::string resource_identifier) override;
|
||||
|
||||
CefBrowserContext* profile_;
|
||||
PendingRequestsMap pending_requests_;
|
||||
SubscriptionsMap subscriptions_;
|
||||
CefPermissionContext context_;
|
||||
|
||||
base::WeakPtrFactory<CefPermissionManager> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPermissionManager);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_MANAGER_H_
|
@@ -1,56 +0,0 @@
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/permissions/permission_util.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
using content::PermissionType;
|
||||
|
||||
namespace permission_util {
|
||||
|
||||
ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) {
|
||||
switch (permission) {
|
||||
case PermissionType::MIDI_SYSEX:
|
||||
return CONTENT_SETTINGS_TYPE_MIDI_SYSEX;
|
||||
case PermissionType::PUSH_MESSAGING:
|
||||
case PermissionType::NOTIFICATIONS:
|
||||
return CONTENT_SETTINGS_TYPE_NOTIFICATIONS;
|
||||
case PermissionType::GEOLOCATION:
|
||||
return CONTENT_SETTINGS_TYPE_GEOLOCATION;
|
||||
case PermissionType::PROTECTED_MEDIA_IDENTIFIER:
|
||||
#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
|
||||
return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER;
|
||||
#else
|
||||
NOTIMPLEMENTED();
|
||||
break;
|
||||
#endif
|
||||
case PermissionType::DURABLE_STORAGE:
|
||||
return CONTENT_SETTINGS_TYPE_DURABLE_STORAGE;
|
||||
case PermissionType::MIDI:
|
||||
// This will hit the NOTREACHED below.
|
||||
break;
|
||||
case PermissionType::AUDIO_CAPTURE:
|
||||
return CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC;
|
||||
case PermissionType::VIDEO_CAPTURE:
|
||||
return CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA;
|
||||
case PermissionType::BACKGROUND_SYNC:
|
||||
return CONTENT_SETTINGS_TYPE_BACKGROUND_SYNC;
|
||||
case PermissionType::FLASH:
|
||||
return CONTENT_SETTINGS_TYPE_PLUGINS;
|
||||
case PermissionType::SENSORS:
|
||||
return CONTENT_SETTINGS_TYPE_SENSORS;
|
||||
case PermissionType::ACCESSIBILITY_EVENTS:
|
||||
return CONTENT_SETTINGS_TYPE_ACCESSIBILITY_EVENTS;
|
||||
case PermissionType::NUM:
|
||||
// This will hit the NOTREACHED below.
|
||||
break;
|
||||
}
|
||||
|
||||
NOTREACHED() << "Unknown content setting for permission "
|
||||
<< static_cast<int>(permission);
|
||||
return CONTENT_SETTINGS_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
} // namespace permission_util
|
@@ -1,19 +0,0 @@
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_
|
||||
#define CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_
|
||||
|
||||
#include "components/content_settings/core/common/content_settings_types.h"
|
||||
#include "content/public/browser/permission_type.h"
|
||||
|
||||
namespace permission_util {
|
||||
|
||||
// Helper method to convert PermissionType to ContentSettingType.
|
||||
ContentSettingsType PermissionTypeToContentSetting(
|
||||
content::PermissionType permission);
|
||||
|
||||
} // namespace permission_util
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PERMISSIONS_PERMISSION_UTIL_H_
|
@@ -1,514 +0,0 @@
|
||||
// Copyright 2015 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "libcef/browser/plugins/plugin_info_message_filter.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/plugins/plugin_service_filter.h"
|
||||
#include "libcef/browser/web_plugin_impl.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "base/metrics/histogram_macros.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "build/build_config.h"
|
||||
#include "chrome/browser/plugins/plugin_finder.h"
|
||||
#include "chrome/browser/plugins/plugins_field_trial.h"
|
||||
#include "chrome/common/features.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "components/content_settings/core/common/content_settings_utils.h"
|
||||
#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
|
||||
#include "components/nacl/common/features.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/plugin_service.h"
|
||||
#include "content/public/browser/plugin_service_filter.h"
|
||||
#include "content/public/common/content_constants.h"
|
||||
#include "content/public/common/webplugininfo.h"
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
#include "extensions/browser/guest_view/web_view/web_view_renderer_state.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/extension.h"
|
||||
#include "extensions/common/manifest_handlers/webview_info.h"
|
||||
#include "url/gurl.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
|
||||
|
||||
#if BUILDFLAG(ENABLE_NACL)
|
||||
#include "components/nacl/common/nacl_constants.h"
|
||||
#endif
|
||||
|
||||
using content::PluginService;
|
||||
using content::WebPluginInfo;
|
||||
|
||||
namespace {
|
||||
|
||||
// There's a race condition between deletion of the CefPluginInfoMessageFilter
|
||||
// object on the UI thread and deletion of the PrefService (owned by Profile)
|
||||
// on the UI thread. If the PrefService will be deleted first then
|
||||
// PrefMember::Destroy() must be called from ShutdownOnUIThread() to avoid
|
||||
// heap-use-after-free on CefPluginInfoMessageFilter destruction (due to
|
||||
// ~PrefMember trying to access the already-deleted PrefService).
|
||||
// ShutdownNotifierFactory makes sure that ShutdownOnUIThread() is called in
|
||||
// this case.
|
||||
class ShutdownNotifierFactory
|
||||
: public BrowserContextKeyedServiceShutdownNotifierFactory {
|
||||
public:
|
||||
static ShutdownNotifierFactory* GetInstance();
|
||||
|
||||
private:
|
||||
friend struct base::LazyInstanceTraitsBase<ShutdownNotifierFactory>;
|
||||
|
||||
ShutdownNotifierFactory()
|
||||
: BrowserContextKeyedServiceShutdownNotifierFactory(
|
||||
"CefPluginInfoMessageFilter") {}
|
||||
~ShutdownNotifierFactory() override {}
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ShutdownNotifierFactory);
|
||||
};
|
||||
|
||||
base::LazyInstance<ShutdownNotifierFactory>::Leaky g_shutdown_notifier_factory =
|
||||
LAZY_INSTANCE_INITIALIZER;
|
||||
|
||||
// static
|
||||
ShutdownNotifierFactory* ShutdownNotifierFactory::GetInstance() {
|
||||
return g_shutdown_notifier_factory.Pointer();
|
||||
}
|
||||
|
||||
// For certain sandboxed Pepper plugins, use the JavaScript Content Settings.
|
||||
bool ShouldUseJavaScriptSettingForPlugin(const WebPluginInfo& plugin) {
|
||||
if (plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_IN_PROCESS &&
|
||||
plugin.type != WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_NACL)
|
||||
// Treat Native Client invocations like JavaScript.
|
||||
if (plugin.name == base::ASCIIToUTF16(nacl::kNaClPluginName))
|
||||
return true;
|
||||
#endif
|
||||
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
// Treat CDM invocations like JavaScript.
|
||||
if (plugin.name == base::ASCIIToUTF16(kWidevineCdmDisplayName)) {
|
||||
DCHECK(plugin.type == WebPluginInfo::PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS);
|
||||
return true;
|
||||
}
|
||||
#endif // defined(WIDEVINE_CDM_AVAILABLE) && BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
enum PluginAvailabilityStatusForUMA {
|
||||
PLUGIN_NOT_REGISTERED,
|
||||
PLUGIN_AVAILABLE,
|
||||
PLUGIN_DISABLED,
|
||||
PLUGIN_AVAILABILITY_STATUS_MAX
|
||||
};
|
||||
|
||||
static void SendPluginAvailabilityUMA(const std::string& mime_type,
|
||||
PluginAvailabilityStatusForUMA status) {
|
||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||
// Only report results for Widevine CDM.
|
||||
if (mime_type != kWidevineCdmPluginMimeType)
|
||||
return;
|
||||
|
||||
UMA_HISTOGRAM_ENUMERATION("Plugin.AvailabilityStatus.WidevineCdm", status,
|
||||
PLUGIN_AVAILABILITY_STATUS_MAX);
|
||||
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
||||
}
|
||||
|
||||
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
void ReportMetrics(const std::string& mime_type,
|
||||
const GURL& url,
|
||||
const url::Origin& main_frame_origin) {}
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
// Returns whether a request from a plugin to load |resource| from a renderer
|
||||
// with process id |process_id| is a request for an internal resource by an app
|
||||
// listed in |accessible_resources| in its manifest.
|
||||
bool IsPluginLoadingAccessibleResourceInWebView(
|
||||
extensions::ExtensionRegistry* extension_registry,
|
||||
int process_id,
|
||||
const GURL& resource) {
|
||||
extensions::WebViewRendererState* renderer_state =
|
||||
extensions::WebViewRendererState::GetInstance();
|
||||
std::string partition_id;
|
||||
if (!renderer_state->IsGuest(process_id) ||
|
||||
!renderer_state->GetPartitionID(process_id, &partition_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string extension_id = resource.host();
|
||||
const extensions::Extension* extension = extension_registry->GetExtensionById(
|
||||
extension_id, extensions::ExtensionRegistry::ENABLED);
|
||||
if (!extension || !extensions::WebviewInfo::IsResourceWebviewAccessible(
|
||||
extension, partition_id, resource.path())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Make sure the renderer making the request actually belongs to the
|
||||
// same extension.
|
||||
std::string owner_extension;
|
||||
return renderer_state->GetOwnerInfo(process_id, nullptr, &owner_extension) &&
|
||||
owner_extension == extension_id;
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
|
||||
} // namespace
|
||||
|
||||
CefPluginInfoMessageFilter::Context::Context(int render_process_id,
|
||||
CefBrowserContext* profile)
|
||||
: render_process_id_(render_process_id),
|
||||
resource_context_(
|
||||
static_cast<CefResourceContext*>(profile->GetResourceContext())),
|
||||
host_content_settings_map_(profile->GetHostContentSettingsMap()) {
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
if (extensions::ExtensionsEnabled())
|
||||
extension_registry_ = extensions::ExtensionRegistry::Get(profile);
|
||||
#endif
|
||||
|
||||
allow_outdated_plugins_.Init(prefs::kPluginsAllowOutdated,
|
||||
profile->GetPrefs());
|
||||
allow_outdated_plugins_.MoveToThread(
|
||||
content::BrowserThread::GetTaskRunnerForThread(
|
||||
content::BrowserThread::IO));
|
||||
always_authorize_plugins_.Init(prefs::kPluginsAlwaysAuthorize,
|
||||
profile->GetPrefs());
|
||||
always_authorize_plugins_.MoveToThread(
|
||||
content::BrowserThread::GetTaskRunnerForThread(
|
||||
content::BrowserThread::IO));
|
||||
}
|
||||
|
||||
CefPluginInfoMessageFilter::Context::~Context() {}
|
||||
|
||||
void CefPluginInfoMessageFilter::Context::ShutdownOnUIThread() {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
always_authorize_plugins_.Destroy();
|
||||
allow_outdated_plugins_.Destroy();
|
||||
}
|
||||
|
||||
CefPluginInfoMessageFilter::CefPluginInfoMessageFilter(
|
||||
int render_process_id,
|
||||
CefBrowserContext* profile)
|
||||
: BrowserMessageFilter(ExtensionMsgStart),
|
||||
context_(render_process_id, profile),
|
||||
main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
|
||||
weak_ptr_factory_(this) {
|
||||
shutdown_notifier_ =
|
||||
ShutdownNotifierFactory::GetInstance()->Get(profile)->Subscribe(
|
||||
base::Bind(&CefPluginInfoMessageFilter::ShutdownOnUIThread,
|
||||
base::Unretained(this)));
|
||||
}
|
||||
|
||||
void CefPluginInfoMessageFilter::ShutdownOnUIThread() {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
context_.ShutdownOnUIThread();
|
||||
shutdown_notifier_.reset();
|
||||
}
|
||||
|
||||
bool CefPluginInfoMessageFilter::OnMessageReceived(
|
||||
const IPC::Message& message) {
|
||||
IPC_BEGIN_MESSAGE_MAP(CefPluginInfoMessageFilter, message)
|
||||
IPC_MESSAGE_HANDLER_DELAY_REPLY(CefViewHostMsg_GetPluginInfo,
|
||||
OnGetPluginInfo)
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
IPC_MESSAGE_HANDLER(CefViewHostMsg_IsInternalPluginAvailableForMimeType,
|
||||
OnIsInternalPluginAvailableForMimeType)
|
||||
#endif
|
||||
IPC_MESSAGE_UNHANDLED(return false)
|
||||
IPC_END_MESSAGE_MAP()
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefPluginInfoMessageFilter::OnDestruct() const {
|
||||
const_cast<CefPluginInfoMessageFilter*>(this)
|
||||
->weak_ptr_factory_.InvalidateWeakPtrs();
|
||||
|
||||
// Destroy on the UI thread because we contain a |PrefMember|.
|
||||
content::BrowserThread::DeleteOnUIThread::Destruct(this);
|
||||
}
|
||||
|
||||
CefPluginInfoMessageFilter::~CefPluginInfoMessageFilter() {}
|
||||
|
||||
struct CefPluginInfoMessageFilter::GetPluginInfo_Params {
|
||||
int render_frame_id;
|
||||
GURL url;
|
||||
bool is_main_frame;
|
||||
url::Origin main_frame_origin;
|
||||
std::string mime_type;
|
||||
};
|
||||
|
||||
void CefPluginInfoMessageFilter::OnGetPluginInfo(
|
||||
int render_frame_id,
|
||||
const GURL& url,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
const std::string& mime_type,
|
||||
IPC::Message* reply_msg) {
|
||||
GetPluginInfo_Params params = {render_frame_id, url, is_main_frame,
|
||||
main_frame_origin, mime_type};
|
||||
PluginService::GetInstance()->GetPlugins(
|
||||
base::Bind(&CefPluginInfoMessageFilter::PluginsLoaded,
|
||||
weak_ptr_factory_.GetWeakPtr(), params, reply_msg));
|
||||
}
|
||||
|
||||
void CefPluginInfoMessageFilter::PluginsLoaded(
|
||||
const GetPluginInfo_Params& params,
|
||||
IPC::Message* reply_msg,
|
||||
const std::vector<WebPluginInfo>& plugins) {
|
||||
CefViewHostMsg_GetPluginInfo_Output output;
|
||||
|
||||
// This also fills in |actual_mime_type|.
|
||||
std::unique_ptr<PluginMetadata> plugin_metadata;
|
||||
context_.FindEnabledPlugin(params, &output.status, &output.plugin,
|
||||
&output.actual_mime_type, &plugin_metadata);
|
||||
|
||||
if (plugin_metadata) {
|
||||
output.group_identifier = plugin_metadata->identifier();
|
||||
output.group_name = plugin_metadata->name();
|
||||
}
|
||||
|
||||
CefViewHostMsg_GetPluginInfo::WriteReplyParams(reply_msg, output);
|
||||
Send(reply_msg);
|
||||
if (output.status != CefViewHostMsg_GetPluginInfo_Status::kNotFound) {
|
||||
main_thread_task_runner_->PostTask(
|
||||
FROM_HERE, base::Bind(&ReportMetrics, output.actual_mime_type,
|
||||
params.url, params.main_frame_origin));
|
||||
}
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
void CefPluginInfoMessageFilter::OnIsInternalPluginAvailableForMimeType(
|
||||
const std::string& mime_type,
|
||||
bool* is_available,
|
||||
std::vector<base::string16>* additional_param_names,
|
||||
std::vector<base::string16>* additional_param_values) {
|
||||
std::vector<WebPluginInfo> plugins;
|
||||
PluginService::GetInstance()->GetInternalPlugins(&plugins);
|
||||
|
||||
bool is_plugin_disabled = false;
|
||||
for (size_t i = 0; i < plugins.size(); ++i) {
|
||||
const WebPluginInfo& plugin = plugins[i];
|
||||
const std::vector<content::WebPluginMimeType>& mime_types =
|
||||
plugin.mime_types;
|
||||
for (size_t j = 0; j < mime_types.size(); ++j) {
|
||||
if (mime_types[j].mime_type == mime_type) {
|
||||
if (!context_.IsPluginEnabled(plugin)) {
|
||||
is_plugin_disabled = true;
|
||||
break;
|
||||
}
|
||||
|
||||
*is_available = true;
|
||||
*additional_param_names = mime_types[j].additional_param_names;
|
||||
*additional_param_values = mime_types[j].additional_param_values;
|
||||
SendPluginAvailabilityUMA(mime_type, PLUGIN_AVAILABLE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*is_available = false;
|
||||
SendPluginAvailabilityUMA(
|
||||
mime_type, is_plugin_disabled ? PLUGIN_DISABLED : PLUGIN_NOT_REGISTERED);
|
||||
}
|
||||
|
||||
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
|
||||
void CefPluginInfoMessageFilter::Context::DecidePluginStatus(
|
||||
const GetPluginInfo_Params& params,
|
||||
const WebPluginInfo& plugin,
|
||||
const PluginMetadata* plugin_metadata,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status) const {
|
||||
PluginMetadata::SecurityStatus plugin_status =
|
||||
plugin_metadata->GetSecurityStatus(plugin);
|
||||
|
||||
if (plugin_status == PluginMetadata::SECURITY_STATUS_FULLY_TRUSTED) {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
return;
|
||||
}
|
||||
|
||||
ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
|
||||
bool uses_default_content_setting = true;
|
||||
bool is_managed = false;
|
||||
// Check plugin content settings. The primary URL is the top origin URL and
|
||||
// the secondary URL is the plugin URL.
|
||||
GetPluginContentSetting(plugin, params.main_frame_origin.GetURL(), params.url,
|
||||
plugin_metadata->identifier(), &plugin_setting,
|
||||
&uses_default_content_setting, &is_managed);
|
||||
|
||||
// TODO(tommycli): Remove once we deprecate the plugin ASK policy.
|
||||
bool legacy_ask_user = plugin_setting == CONTENT_SETTING_ASK;
|
||||
plugin_setting = PluginsFieldTrial::EffectiveContentSetting(
|
||||
host_content_settings_map_, CONTENT_SETTINGS_TYPE_PLUGINS,
|
||||
plugin_setting);
|
||||
|
||||
DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
|
||||
DCHECK(plugin_setting != CONTENT_SETTING_ASK);
|
||||
|
||||
// Check if the plugin is crashing too much.
|
||||
if (PluginService::GetInstance()->IsPluginUnstable(plugin.path) &&
|
||||
!always_authorize_plugins_.GetValue() &&
|
||||
plugin_setting != CONTENT_SETTING_BLOCK && uses_default_content_setting) {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kUnauthorized;
|
||||
return;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
// If an app has explicitly made internal resources available by listing them
|
||||
// in |accessible_resources| in the manifest, then allow them to be loaded by
|
||||
// plugins inside a guest-view.
|
||||
if (extensions::ExtensionsEnabled() &&
|
||||
params.url.SchemeIs(extensions::kExtensionScheme) && !is_managed &&
|
||||
plugin_setting == CONTENT_SETTING_BLOCK &&
|
||||
IsPluginLoadingAccessibleResourceInWebView(
|
||||
extension_registry_, render_process_id_, params.url)) {
|
||||
plugin_setting = CONTENT_SETTING_ALLOW;
|
||||
}
|
||||
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
|
||||
if (plugin_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
|
||||
} else if (plugin_setting == CONTENT_SETTING_BLOCK) {
|
||||
// For managed users with the ASK policy, we allow manually running plugins
|
||||
// via context menu. This is the closest to admin intent.
|
||||
*status = is_managed && !legacy_ask_user
|
||||
? CefViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy
|
||||
: CefViewHostMsg_GetPluginInfo_Status::kBlocked;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
// Allow an embedder of <webview> to block a plugin from being loaded inside
|
||||
// the guest. In order to do this, set the status to 'Unauthorized' here,
|
||||
// and update the status as appropriate depending on the response from the
|
||||
// embedder.
|
||||
if (*status == CefViewHostMsg_GetPluginInfo_Status::kAllowed ||
|
||||
*status == CefViewHostMsg_GetPluginInfo_Status::kBlocked ||
|
||||
*status == CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent) {
|
||||
if (extensions::WebViewRendererState::GetInstance()->IsGuest(
|
||||
render_process_id_)) {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kUnauthorized;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CefPluginInfoMessageFilter::Context::FindEnabledPlugin(
|
||||
const GetPluginInfo_Params& params,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status,
|
||||
WebPluginInfo* plugin,
|
||||
std::string* actual_mime_type,
|
||||
std::unique_ptr<PluginMetadata>* plugin_metadata) const {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
|
||||
bool allow_wildcard = true;
|
||||
std::vector<WebPluginInfo> matching_plugins;
|
||||
std::vector<std::string> mime_types;
|
||||
PluginService::GetInstance()->GetPluginInfoArray(
|
||||
params.url, params.mime_type, allow_wildcard, &matching_plugins,
|
||||
&mime_types);
|
||||
if (matching_plugins.empty()) {
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kNotFound;
|
||||
return false;
|
||||
}
|
||||
|
||||
CefPluginServiceFilter* filter = static_cast<CefPluginServiceFilter*>(
|
||||
PluginService::GetInstance()->GetFilter());
|
||||
DCHECK(filter);
|
||||
|
||||
CefViewHostMsg_GetPluginInfo_Status first_status = *status;
|
||||
|
||||
size_t i = 0;
|
||||
for (; i < matching_plugins.size(); ++i) {
|
||||
*plugin = matching_plugins[i];
|
||||
*actual_mime_type = mime_types[i];
|
||||
*plugin_metadata = PluginFinder::GetInstance()->GetPluginMetadata(*plugin);
|
||||
|
||||
DecidePluginStatus(params, *plugin, (*plugin_metadata).get(), status);
|
||||
if (filter->IsPluginAvailable(render_process_id_, resource_context_,
|
||||
params.url, params.is_main_frame,
|
||||
params.main_frame_origin, plugin, status)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
first_status = *status;
|
||||
}
|
||||
|
||||
// If we broke out of the loop, we have found an enabled plugin.
|
||||
bool enabled = i < matching_plugins.size();
|
||||
if (!enabled) {
|
||||
// Otherwise, we only found disabled/not-found plugins, so we take the first
|
||||
// one.
|
||||
*plugin = matching_plugins[0];
|
||||
*actual_mime_type = mime_types[0];
|
||||
*plugin_metadata = PluginFinder::GetInstance()->GetPluginMetadata(*plugin);
|
||||
*status = first_status;
|
||||
}
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
void CefPluginInfoMessageFilter::Context::GetPluginContentSetting(
|
||||
const WebPluginInfo& plugin,
|
||||
const GURL& policy_url,
|
||||
const GURL& plugin_url,
|
||||
const std::string& resource,
|
||||
ContentSetting* setting,
|
||||
bool* uses_default_content_setting,
|
||||
bool* is_managed) const {
|
||||
std::unique_ptr<base::Value> value;
|
||||
content_settings::SettingInfo info;
|
||||
bool uses_plugin_specific_setting = false;
|
||||
if (ShouldUseJavaScriptSettingForPlugin(plugin)) {
|
||||
value = host_content_settings_map_->GetWebsiteSetting(
|
||||
policy_url, policy_url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string(),
|
||||
&info);
|
||||
} else {
|
||||
content_settings::SettingInfo specific_info;
|
||||
std::unique_ptr<base::Value> specific_setting =
|
||||
host_content_settings_map_->GetWebsiteSetting(
|
||||
policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS, resource,
|
||||
&specific_info);
|
||||
content_settings::SettingInfo general_info;
|
||||
std::unique_ptr<base::Value> general_setting =
|
||||
host_content_settings_map_->GetWebsiteSetting(
|
||||
policy_url, plugin_url, CONTENT_SETTINGS_TYPE_PLUGINS,
|
||||
std::string(), &general_info);
|
||||
|
||||
// If there is a plugin-specific setting, we use it, unless the general
|
||||
// setting was set by policy, in which case it takes precedence.
|
||||
uses_plugin_specific_setting =
|
||||
specific_setting &&
|
||||
general_info.source != content_settings::SETTING_SOURCE_POLICY;
|
||||
if (uses_plugin_specific_setting) {
|
||||
value = std::move(specific_setting);
|
||||
info = specific_info;
|
||||
} else {
|
||||
value = std::move(general_setting);
|
||||
info = general_info;
|
||||
}
|
||||
}
|
||||
*setting = content_settings::ValueToContentSetting(value.get());
|
||||
*uses_default_content_setting =
|
||||
!uses_plugin_specific_setting &&
|
||||
info.primary_pattern == ContentSettingsPattern::Wildcard() &&
|
||||
info.secondary_pattern == ContentSettingsPattern::Wildcard();
|
||||
*is_managed = info.source == content_settings::SETTING_SOURCE_POLICY;
|
||||
}
|
||||
|
||||
bool CefPluginInfoMessageFilter::Context::IsPluginEnabled(
|
||||
const content::WebPluginInfo& plugin) const {
|
||||
return true;
|
||||
}
|
@@ -1,139 +0,0 @@
|
||||
// Copyright 2015 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright 2012 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_
|
||||
#define CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/sequenced_task_runner_helpers.h"
|
||||
#include "chrome/browser/plugins/plugin_metadata.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "components/content_settings/core/common/content_settings.h"
|
||||
#include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
|
||||
#include "components/prefs/pref_member.h"
|
||||
#include "content/public/browser/browser_message_filter.h"
|
||||
#include "extensions/features/features.h"
|
||||
#include "media/media_features.h"
|
||||
|
||||
class CefBrowserContext;
|
||||
class CefResourceContext;
|
||||
struct CefViewHostMsg_GetPluginInfo_Output;
|
||||
enum class CefViewHostMsg_GetPluginInfo_Status;
|
||||
class GURL;
|
||||
|
||||
namespace content {
|
||||
struct WebPluginInfo;
|
||||
}
|
||||
|
||||
namespace extensions {
|
||||
class ExtensionRegistry;
|
||||
}
|
||||
|
||||
namespace url {
|
||||
class Origin;
|
||||
}
|
||||
|
||||
// This class filters out incoming IPC messages requesting plugin information.
|
||||
class CefPluginInfoMessageFilter : public content::BrowserMessageFilter {
|
||||
public:
|
||||
struct GetPluginInfo_Params;
|
||||
|
||||
// Contains all the information needed by the CefPluginInfoMessageFilter.
|
||||
class Context {
|
||||
public:
|
||||
Context(int render_process_id, CefBrowserContext* profile);
|
||||
|
||||
~Context();
|
||||
void ShutdownOnUIThread();
|
||||
|
||||
void DecidePluginStatus(const GetPluginInfo_Params& params,
|
||||
const content::WebPluginInfo& plugin,
|
||||
const PluginMetadata* plugin_metadata,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status) const;
|
||||
bool FindEnabledPlugin(
|
||||
const GetPluginInfo_Params& params,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status,
|
||||
content::WebPluginInfo* plugin,
|
||||
std::string* actual_mime_type,
|
||||
std::unique_ptr<PluginMetadata>* plugin_metadata) const;
|
||||
void GetPluginContentSetting(const content::WebPluginInfo& plugin,
|
||||
const GURL& policy_url,
|
||||
const GURL& plugin_url,
|
||||
const std::string& resource,
|
||||
ContentSetting* setting,
|
||||
bool* is_default,
|
||||
bool* is_managed) const;
|
||||
bool IsPluginEnabled(const content::WebPluginInfo& plugin) const;
|
||||
|
||||
private:
|
||||
int render_process_id_;
|
||||
CefResourceContext* resource_context_;
|
||||
#if BUILDFLAG(ENABLE_EXTENSIONS)
|
||||
extensions::ExtensionRegistry* extension_registry_;
|
||||
#endif
|
||||
const HostContentSettingsMap* host_content_settings_map_;
|
||||
|
||||
BooleanPrefMember allow_outdated_plugins_;
|
||||
BooleanPrefMember always_authorize_plugins_;
|
||||
};
|
||||
|
||||
CefPluginInfoMessageFilter(int render_process_id, CefBrowserContext* profile);
|
||||
|
||||
// content::BrowserMessageFilter methods:
|
||||
bool OnMessageReceived(const IPC::Message& message) override;
|
||||
void OnDestruct() const override;
|
||||
|
||||
private:
|
||||
friend struct content::BrowserThread::DeleteOnThread<
|
||||
content::BrowserThread::UI>;
|
||||
friend class base::DeleteHelper<CefPluginInfoMessageFilter>;
|
||||
|
||||
void ShutdownOnUIThread();
|
||||
~CefPluginInfoMessageFilter() override;
|
||||
|
||||
void OnGetPluginInfo(int render_frame_id,
|
||||
const GURL& url,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
const std::string& mime_type,
|
||||
IPC::Message* reply_msg);
|
||||
|
||||
// |params| wraps the parameters passed to |OnGetPluginInfo|, because
|
||||
// |base::Bind| doesn't support the required arity <http://crbug.com/98542>.
|
||||
void PluginsLoaded(const GetPluginInfo_Params& params,
|
||||
IPC::Message* reply_msg,
|
||||
const std::vector<content::WebPluginInfo>& plugins);
|
||||
|
||||
#if BUILDFLAG(ENABLE_LIBRARY_CDMS)
|
||||
// Returns whether any internal plugin supporting |mime_type| is registered
|
||||
// and enabled. Does not determine whether the plugin can actually be
|
||||
// instantiated (e.g. whether it has all its dependencies).
|
||||
// When the returned *|is_available| is true, |additional_param_names| and
|
||||
// |additional_param_values| contain the name-value pairs, if any, specified
|
||||
// for the *first* non-disabled plugin found that is registered for
|
||||
// |mime_type|.
|
||||
void OnIsInternalPluginAvailableForMimeType(
|
||||
const std::string& mime_type,
|
||||
bool* is_available,
|
||||
std::vector<base::string16>* additional_param_names,
|
||||
std::vector<base::string16>* additional_param_values);
|
||||
#endif
|
||||
|
||||
Context context_;
|
||||
std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
|
||||
shutdown_notifier_;
|
||||
|
||||
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
|
||||
base::WeakPtrFactory<CefPluginInfoMessageFilter> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPluginInfoMessageFilter);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_INFO_MESSAGE_FILTER_H_
|
@@ -9,7 +9,6 @@
|
||||
#include "libcef/browser/resource_context.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/web_plugin_impl.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/content_client.h"
|
||||
|
||||
#include "extensions/common/constants.h"
|
||||
@@ -30,8 +29,7 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
|
||||
CefResourceContext* resource_context = const_cast<CefResourceContext*>(
|
||||
reinterpret_cast<const CefResourceContext*>(context));
|
||||
CefViewHostMsg_GetPluginInfo_Status status =
|
||||
CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
chrome::mojom::PluginStatus status = chrome::mojom::PluginStatus::kAllowed;
|
||||
|
||||
// Perform origin check here because we're passing an empty origin value to
|
||||
// IsPluginAvailable() below.
|
||||
@@ -54,8 +52,8 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
// retrieve the actual load decision with a non-empty origin. That will
|
||||
// determine whether the plugin load is allowed or the plugin placeholder is
|
||||
// displayed.
|
||||
return IsPluginAvailable(render_process_id, resource_context, url,
|
||||
is_main_frame, url::Origin(), plugin, &status);
|
||||
return IsPluginAvailable(render_process_id, render_frame_id, resource_context,
|
||||
url, is_main_frame, url::Origin(), plugin, &status);
|
||||
}
|
||||
|
||||
bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id,
|
||||
@@ -65,21 +63,24 @@ bool CefPluginServiceFilter::CanLoadPlugin(int render_process_id,
|
||||
|
||||
bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
int render_process_id,
|
||||
CefResourceContext* resource_context,
|
||||
int render_frame_id,
|
||||
content::ResourceContext* content_resource_context,
|
||||
const GURL& url,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
content::WebPluginInfo* plugin,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status) {
|
||||
if (*status == CefViewHostMsg_GetPluginInfo_Status::kNotFound ||
|
||||
*status == CefViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported) {
|
||||
chrome::mojom::PluginStatus* status) {
|
||||
CefResourceContext* resource_context =
|
||||
static_cast<CefResourceContext*>(content_resource_context);
|
||||
|
||||
if (*status == chrome::mojom::PluginStatus::kNotFound) {
|
||||
// The plugin does not exist so no need to query the handler.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (plugin->path == CefString(CefContentClient::kPDFPluginPath)) {
|
||||
// Always allow the internal PDF plugin to load.
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
*status = chrome::mojom::PluginStatus::kAllowed;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -89,41 +90,41 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
// Always allow extension origins to load plugins.
|
||||
// TODO(extensions): Revisit this decision once CEF supports more than just
|
||||
// the PDF extension.
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
*status = chrome::mojom::PluginStatus::kAllowed;
|
||||
return true;
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextHandler> handler = resource_context->GetHandler();
|
||||
if (!handler) {
|
||||
// No handler so go with the default plugin load decision.
|
||||
return *status != CefViewHostMsg_GetPluginInfo_Status::kDisabled;
|
||||
return *status != chrome::mojom::PluginStatus::kDisabled;
|
||||
}
|
||||
|
||||
// Check for a cached plugin load decision.
|
||||
if (resource_context->HasPluginLoadDecision(render_process_id, plugin->path,
|
||||
is_main_frame, main_frame_origin,
|
||||
status)) {
|
||||
return *status != CefViewHostMsg_GetPluginInfo_Status::kDisabled;
|
||||
return *status != chrome::mojom::PluginStatus::kDisabled;
|
||||
}
|
||||
|
||||
CefRefPtr<CefWebPluginInfoImpl> pluginInfo(new CefWebPluginInfoImpl(*plugin));
|
||||
|
||||
cef_plugin_policy_t plugin_policy = PLUGIN_POLICY_ALLOW;
|
||||
switch (*status) {
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kAllowed:
|
||||
case chrome::mojom::PluginStatus::kAllowed:
|
||||
plugin_policy = PLUGIN_POLICY_ALLOW;
|
||||
break;
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kBlocked:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kBlockedByPolicy:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kOutdatedBlocked:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kOutdatedDisallowed:
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kUnauthorized:
|
||||
case chrome::mojom::PluginStatus::kBlocked:
|
||||
case chrome::mojom::PluginStatus::kBlockedByPolicy:
|
||||
case chrome::mojom::PluginStatus::kOutdatedBlocked:
|
||||
case chrome::mojom::PluginStatus::kOutdatedDisallowed:
|
||||
case chrome::mojom::PluginStatus::kUnauthorized:
|
||||
plugin_policy = PLUGIN_POLICY_BLOCK;
|
||||
break;
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kDisabled:
|
||||
case chrome::mojom::PluginStatus::kDisabled:
|
||||
plugin_policy = PLUGIN_POLICY_DISABLE;
|
||||
break;
|
||||
case CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent:
|
||||
case chrome::mojom::PluginStatus::kPlayImportantContent:
|
||||
plugin_policy = PLUGIN_POLICY_DETECT_IMPORTANT;
|
||||
break;
|
||||
default:
|
||||
@@ -137,16 +138,16 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
pluginInfo.get(), &plugin_policy)) {
|
||||
switch (plugin_policy) {
|
||||
case PLUGIN_POLICY_ALLOW:
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kAllowed;
|
||||
*status = chrome::mojom::PluginStatus::kAllowed;
|
||||
break;
|
||||
case PLUGIN_POLICY_DETECT_IMPORTANT:
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kPlayImportantContent;
|
||||
*status = chrome::mojom::PluginStatus::kPlayImportantContent;
|
||||
break;
|
||||
case PLUGIN_POLICY_BLOCK:
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kBlocked;
|
||||
*status = chrome::mojom::PluginStatus::kBlocked;
|
||||
break;
|
||||
case PLUGIN_POLICY_DISABLE:
|
||||
*status = CefViewHostMsg_GetPluginInfo_Status::kDisabled;
|
||||
*status = chrome::mojom::PluginStatus::kDisabled;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -156,5 +157,5 @@ bool CefPluginServiceFilter::IsPluginAvailable(
|
||||
is_main_frame, main_frame_origin,
|
||||
*status);
|
||||
|
||||
return *status != CefViewHostMsg_GetPluginInfo_Status::kDisabled;
|
||||
return *status != chrome::mojom::PluginStatus::kDisabled;
|
||||
}
|
||||
|
@@ -5,14 +5,16 @@
|
||||
#ifndef CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_SERVICE_FILTER_H_
|
||||
#define CEF_LIBCEF_BROWSER_PLUGINS_PLUGIN_SERVICE_FILTER_H_
|
||||
|
||||
#include "chrome/common/plugin.mojom.h"
|
||||
#include "content/public/browser/plugin_service_filter.h"
|
||||
|
||||
#include "include/internal/cef_types.h"
|
||||
|
||||
#include "base/macros.h"
|
||||
|
||||
class CefResourceContext;
|
||||
enum class CefViewHostMsg_GetPluginInfo_Status;
|
||||
namespace content {
|
||||
class ResourceContext;
|
||||
}
|
||||
|
||||
class CefPluginServiceFilter : public content::PluginServiceFilter {
|
||||
public:
|
||||
@@ -32,16 +34,19 @@ class CefPluginServiceFilter : public content::PluginServiceFilter {
|
||||
bool CanLoadPlugin(int render_process_id,
|
||||
const base::FilePath& path) override;
|
||||
|
||||
// Called from the above IsPluginAvailable method and from
|
||||
// PluginInfoHostImpl::Context::FindEnabledPlugin.
|
||||
// Returns false if the plugin is not found or disabled. May call
|
||||
// CefRequestContextHandler::OnBeforePluginLoad if possible/necessary.
|
||||
// See related discussion in issue #2015.
|
||||
bool IsPluginAvailable(int render_process_id,
|
||||
CefResourceContext* resource_context,
|
||||
int render_frame_id,
|
||||
content::ResourceContext* resource_context,
|
||||
const GURL& url,
|
||||
bool is_main_frame,
|
||||
const url::Origin& main_frame_origin,
|
||||
content::WebPluginInfo* plugin,
|
||||
CefViewHostMsg_GetPluginInfo_Status* status);
|
||||
chrome::mojom::PluginStatus* status);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPluginServiceFilter);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user