mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
25 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
1c446e7301 | ||
|
7b802c9272 | ||
|
a33bdbcdb4 | ||
|
a3e4933507 | ||
|
d12ef0f15d | ||
|
cce1b63049 | ||
|
badf1061f2 | ||
|
ec58f88052 | ||
|
e70b0c3cfe | ||
|
1802ceeb85 | ||
|
919206cd65 | ||
|
52b5cc5da4 | ||
|
892739653a | ||
|
29aedaf650 | ||
|
9d2a31ec60 | ||
|
05e96e04fa | ||
|
e6096029c7 | ||
|
f96cd1de5e | ||
|
d9fd476670 | ||
|
bc10d1ab8b | ||
|
df7fb8ec6d | ||
|
74f7b0cb38 | ||
|
b440f4c949 | ||
|
408e48bde6 | ||
|
14948082f3 |
@@ -1,8 +1,6 @@
|
||||
# This file is an addendum to the Chromium AUTHORS file. It lists authors
|
||||
# through March 16, 2015 when Git was introduced for source code management.
|
||||
# A list of additional authors added after that date can be found by executing
|
||||
# this command on a local Git checkout:
|
||||
# git log --all --format="%aN <%aE>" | sort -u
|
||||
# This file is an addendum to the Chromium AUTHORS file.
|
||||
# Names should be added to this file like so:
|
||||
# Name or Organization <email address>
|
||||
|
||||
Marshall Greenblatt <magreenblatt@gmail.com>
|
||||
Jamie Kirkpatrick <jkp@spotify.com>
|
||||
|
172
BUILD.gn
172
BUILD.gn
@@ -106,7 +106,6 @@ import("//media/media_options.gni")
|
||||
import("//mojo/public/tools/bindings/mojom.gni")
|
||||
import("//ppapi/buildflags/buildflags.gni")
|
||||
import("//printing/buildflags/buildflags.gni")
|
||||
import("//testing/test.gni")
|
||||
import("//third_party/icu/config.gni")
|
||||
import("//third_party/widevine/cdm/widevine.gni")
|
||||
import("//tools/grit/repack.gni")
|
||||
@@ -254,6 +253,7 @@ if (is_linux) {
|
||||
# Set ENABLE_PRINTING=1 ENABLE_BASIC_PRINTING=1.
|
||||
assert(enable_basic_printing)
|
||||
assert(enable_print_preview)
|
||||
assert(!enable_service_discovery)
|
||||
|
||||
# Enable support for Widevine CDM.
|
||||
assert(enable_widevine)
|
||||
@@ -263,6 +263,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.
|
||||
@@ -297,10 +303,6 @@ gypi_paths2 = exec_script("//cef/tools/gypi_to_gn.py",
|
||||
"scope",
|
||||
[ "cef_paths2.gypi" ])
|
||||
|
||||
includes_common = gypi_paths2.includes_common + gypi_paths2.includes_common_capi
|
||||
includes_mac = gypi_paths2.includes_mac + gypi_paths2.includes_mac_capi
|
||||
includes_linux = gypi_paths2.includes_linux + gypi_paths2.includes_linux_capi
|
||||
includes_win = gypi_paths2.includes_win + gypi_paths2.includes_win_capi
|
||||
|
||||
#
|
||||
# Targets that will be built when depending on "//cef".
|
||||
@@ -311,7 +313,6 @@ group("cef") {
|
||||
deps = [
|
||||
":cefsimple",
|
||||
":ceftests",
|
||||
":libcef_static_unittests",
|
||||
]
|
||||
|
||||
if (!is_linux || use_x11) {
|
||||
@@ -369,46 +370,9 @@ if (is_win) {
|
||||
}
|
||||
}
|
||||
|
||||
# libcef_static source files that have unit tests.
|
||||
source_set("libcef_static_unittested") {
|
||||
sources = [
|
||||
"libcef/browser/devtools/devtools_util.cc",
|
||||
"libcef/browser/devtools/devtools_util.h",
|
||||
]
|
||||
|
||||
deps = [
|
||||
"//base",
|
||||
]
|
||||
|
||||
configs += [
|
||||
"libcef/features:config",
|
||||
"//build/config:precompiled_headers",
|
||||
]
|
||||
}
|
||||
|
||||
# Executable target for libcef_static unit tests.
|
||||
test("libcef_static_unittests") {
|
||||
sources = [
|
||||
"libcef/browser/devtools/devtools_util_unittest.cc",
|
||||
]
|
||||
|
||||
deps = [
|
||||
":libcef_static_unittested",
|
||||
"//base/test:run_all_unittests",
|
||||
"//testing/gtest",
|
||||
]
|
||||
|
||||
configs += [
|
||||
"libcef/features:config",
|
||||
"//build/config:precompiled_headers",
|
||||
]
|
||||
}
|
||||
|
||||
static_library("libcef_static") {
|
||||
sources = includes_common +
|
||||
sources = gypi_paths2.includes_common +
|
||||
gypi_paths.autogen_cpp_includes + [
|
||||
"libcef/browser/audio_capturer.cc",
|
||||
"libcef/browser/audio_capturer.h",
|
||||
"libcef/browser/browser_context.cc",
|
||||
"libcef/browser/browser_context.h",
|
||||
"libcef/browser/browser_context_keyed_service_factories.cc",
|
||||
@@ -443,14 +407,10 @@ static_library("libcef_static") {
|
||||
"libcef/browser/context.h",
|
||||
"libcef/browser/context_menu_params_impl.cc",
|
||||
"libcef/browser/context_menu_params_impl.h",
|
||||
"libcef/browser/devtools/devtools_controller.cc",
|
||||
"libcef/browser/devtools/devtools_controller.h",
|
||||
"libcef/browser/devtools/devtools_file_manager.cc",
|
||||
"libcef/browser/devtools/devtools_file_manager.h",
|
||||
"libcef/browser/devtools/devtools_frontend.cc",
|
||||
"libcef/browser/devtools/devtools_frontend.h",
|
||||
"libcef/browser/devtools/devtools_manager.cc",
|
||||
"libcef/browser/devtools/devtools_manager.h",
|
||||
"libcef/browser/devtools/devtools_manager_delegate.cc",
|
||||
"libcef/browser/devtools/devtools_manager_delegate.h",
|
||||
"libcef/browser/download_item_impl.cc",
|
||||
@@ -746,6 +706,17 @@ static_library("libcef_static") {
|
||||
"libcef/renderer/url_loader_throttle_provider_impl.h",
|
||||
"libcef/renderer/v8_impl.cc",
|
||||
"libcef/renderer/v8_impl.h",
|
||||
|
||||
"//chrome/browser/local_discovery/service_discovery_device_lister.cc",
|
||||
"//chrome/browser/local_discovery/service_discovery_device_lister.h",
|
||||
"//chrome/browser/local_discovery/service_discovery_client_impl.cc",
|
||||
"//chrome/browser/local_discovery/service_discovery_client_impl.h",
|
||||
"//chrome/browser/local_discovery/service_discovery_client.cc",
|
||||
"//chrome/browser/local_discovery/service_discovery_client.h",
|
||||
"//chrome/browser/local_discovery/service_discovery_client_mdns.cc",
|
||||
"//chrome/browser/local_discovery/service_discovery_client_mdns.h",
|
||||
"//chrome/browser/local_discovery/service_discovery_shared_client.cc",
|
||||
"//chrome/browser/local_discovery/service_discovery_shared_client.h",
|
||||
]
|
||||
|
||||
configs += [
|
||||
@@ -774,8 +745,6 @@ static_library("libcef_static") {
|
||||
":cef_make_headers",
|
||||
":cef_service_manifests",
|
||||
|
||||
":libcef_static_unittested",
|
||||
|
||||
# Generate API bindings for extensions.
|
||||
# TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||
# libcef/common/extensions/api/README.txt for details.
|
||||
@@ -813,9 +782,10 @@ static_library("libcef_static") {
|
||||
"//components/printing/common",
|
||||
"//components/printing/renderer",
|
||||
"//components/proxy_config",
|
||||
"//components/safe_browsing/core/db:test_database_manager",
|
||||
"//components/services/print_compositor/public/cpp",
|
||||
"//components/services/print_compositor/public/mojom",
|
||||
"//components/safe_browsing/db:test_database_manager",
|
||||
"//components/services/pdf_compositor/public/cpp",
|
||||
"//components/services/pdf_compositor/public/mojom",
|
||||
"//components/tracing",
|
||||
"//components/update_client",
|
||||
"//components/url_formatter",
|
||||
"//components/user_prefs",
|
||||
@@ -878,7 +848,7 @@ static_library("libcef_static") {
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
sources += includes_win + [
|
||||
sources += gypi_paths2.includes_win + [
|
||||
"libcef/browser/browser_main_win.cc",
|
||||
"libcef/browser/native/browser_platform_delegate_native_win.cc",
|
||||
"libcef/browser/native/browser_platform_delegate_native_win.h",
|
||||
@@ -923,7 +893,7 @@ static_library("libcef_static") {
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
sources += includes_linux + [
|
||||
sources += gypi_paths2.includes_linux + [
|
||||
"libcef/browser/native/browser_platform_delegate_native_linux.cc",
|
||||
"libcef/browser/native/browser_platform_delegate_native_linux.h",
|
||||
"libcef/browser/native/menu_runner_linux.cc",
|
||||
@@ -955,7 +925,7 @@ static_library("libcef_static") {
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
sources += includes_mac + [
|
||||
sources += gypi_paths2.includes_mac + [
|
||||
"libcef/browser/native/browser_platform_delegate_native_mac.h",
|
||||
"libcef/browser/native/browser_platform_delegate_native_mac.mm",
|
||||
"libcef/browser/native/file_dialog_runner_mac.h",
|
||||
@@ -986,7 +956,7 @@ static_library("libcef_static") {
|
||||
]
|
||||
|
||||
deps += [
|
||||
"//components/crash/core/app",
|
||||
"//components/crash/content/app",
|
||||
"//components/crash/content/browser",
|
||||
]
|
||||
}
|
||||
@@ -1118,8 +1088,8 @@ static_library("libcef_static") {
|
||||
"//ui/aura/test/aura_test_utils.cc",
|
||||
"//ui/aura/test/aura_test_utils.h",
|
||||
# Part of //ui/events:test_support which is testingonly.
|
||||
"//ui/events/test/x11_event_waiter.cc",
|
||||
"//ui/events/test/x11_event_waiter.h",
|
||||
"//ui/events/test/platform_event_waiter.cc",
|
||||
"//ui/events/test/platform_event_waiter.h",
|
||||
]
|
||||
|
||||
if (use_x11) {
|
||||
@@ -1169,7 +1139,7 @@ config("libcef_dll_wrapper_config") {
|
||||
|
||||
# libcef_dll_wrapper target.
|
||||
static_library("libcef_dll_wrapper") {
|
||||
sources = includes_common +
|
||||
sources = gypi_paths2.includes_common +
|
||||
gypi_paths.autogen_cpp_includes +
|
||||
gypi_paths2.includes_capi +
|
||||
gypi_paths.autogen_capi_includes +
|
||||
@@ -1227,6 +1197,7 @@ source_set("cef_content_browser_overlay_manifest") {
|
||||
|
||||
deps = [
|
||||
"//base",
|
||||
"//chrome/common:mojo_bindings",
|
||||
"//extensions/buildflags",
|
||||
"//extensions/common:mojom",
|
||||
"//extensions/common/api:mojom",
|
||||
@@ -1417,16 +1388,13 @@ repack("pak") {
|
||||
# Add associated .h files in the make_pack_header("resources") target.
|
||||
sources = [
|
||||
"$root_gen_dir/chrome/browser_resources.pak",
|
||||
"$root_gen_dir/chrome/dev_ui_browser_resources.pak",
|
||||
"$root_gen_dir/chrome/net_internals_resources.pak",
|
||||
"$root_gen_dir/chrome/print_preview_resources.pak",
|
||||
"$root_gen_dir/chrome/common_resources.pak",
|
||||
"$root_gen_dir/components/components_resources.pak",
|
||||
"$root_gen_dir/components/dev_ui_components_resources.pak",
|
||||
"$root_gen_dir/cef/cef_resources.pak",
|
||||
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
|
||||
"$root_gen_dir/content/content_resources.pak",
|
||||
"$root_gen_dir/content/dev_ui_content_resources.pak",
|
||||
"$root_gen_dir/net/net_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
|
||||
]
|
||||
@@ -1435,17 +1403,14 @@ repack("pak") {
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
"//chrome/browser:dev_ui_browser_resources",
|
||||
"//chrome/browser:resources",
|
||||
"//chrome/browser/resources/net_internals:net_internals_resources",
|
||||
"//chrome/browser/resources:print_preview_resources",
|
||||
"//chrome/common:resources",
|
||||
"//components/resources:components_resources",
|
||||
"//components/resources:dev_ui_components_resources",
|
||||
":cef_resources",
|
||||
"//content/browser/tracing:resources",
|
||||
"//content:content_resources",
|
||||
"//content:dev_ui_content_resources",
|
||||
"//content:resources",
|
||||
"//net:net_resources",
|
||||
"//third_party/blink/public:resources",
|
||||
]
|
||||
@@ -1488,15 +1453,12 @@ make_pack_header("resources") {
|
||||
"$root_gen_dir/chrome/grit/browser_resources.h",
|
||||
"$root_gen_dir/chrome/grit/common_resources.h",
|
||||
"$root_gen_dir/chrome/grit/component_extension_resources.h",
|
||||
"$root_gen_dir/chrome/grit/dev_ui_browser_resources.h",
|
||||
"$root_gen_dir/chrome/grit/net_internals_resources.h",
|
||||
"$root_gen_dir/chrome/grit/renderer_resources.h",
|
||||
"$root_gen_dir/components/grit/components_resources.h",
|
||||
"$root_gen_dir/components/grit/dev_ui_components_resources.h",
|
||||
"$root_gen_dir/content/browser/devtools/grit/devtools_resources.h",
|
||||
"$root_gen_dir/content/browser/tracing/grit/tracing_resources.h",
|
||||
"$root_gen_dir/content/grit/content_resources.h",
|
||||
"$root_gen_dir/content/grit/dev_ui_content_resources.h",
|
||||
"$root_gen_dir/extensions/grit/extensions_browser_resources.h",
|
||||
"$root_gen_dir/extensions/grit/extensions_renderer_resources.h",
|
||||
"$root_gen_dir/extensions/grit/extensions_resources.h",
|
||||
@@ -1525,29 +1487,11 @@ make_pack_header("strings") {
|
||||
]
|
||||
}
|
||||
|
||||
# Generate cef_api_hash.h.
|
||||
action("make_api_hash_header") {
|
||||
script = "tools/make_api_hash_header.py"
|
||||
|
||||
# List of all C API files that will be checked for changes by cef_api_hash.py.
|
||||
inputs = gypi_paths2.includes_common_capi +
|
||||
gypi_paths2.includes_linux_capi +
|
||||
gypi_paths2.includes_mac_capi +
|
||||
gypi_paths2.includes_win_capi +
|
||||
gypi_paths2.includes_capi +
|
||||
gypi_paths.autogen_capi_includes
|
||||
include_dir = [ "include" ]
|
||||
outputs = [ "$root_out_dir/includes/include/cef_api_hash.h" ]
|
||||
|
||||
args = rebase_path(outputs + include_dir, root_build_dir)
|
||||
}
|
||||
|
||||
# Generate pack files and associated CEF header files.
|
||||
group("cef_make_headers") {
|
||||
deps = [
|
||||
":make_pack_header_resources",
|
||||
":make_pack_header_strings",
|
||||
":make_api_hash_header",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1645,15 +1589,12 @@ if (is_mac) {
|
||||
sources = [
|
||||
"$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
|
||||
"$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
|
||||
"$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
|
||||
"$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
|
||||
]
|
||||
outputs = [
|
||||
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
|
||||
]
|
||||
public_deps = [
|
||||
"//ui/gl:swiftshader_egl_library_copy",
|
||||
"//ui/gl:swiftshader_vk_library_copy",
|
||||
"//ui/gl:swiftshader_library_copy",
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1683,8 +1624,8 @@ if (is_mac) {
|
||||
"Resources",
|
||||
]
|
||||
|
||||
sources = includes_common +
|
||||
includes_mac +
|
||||
sources = gypi_paths2.includes_common +
|
||||
gypi_paths2.includes_mac +
|
||||
gypi_paths.autogen_cpp_includes +
|
||||
gypi_paths2.includes_capi +
|
||||
gypi_paths.autogen_capi_includes +
|
||||
@@ -1727,7 +1668,7 @@ if (is_mac) {
|
||||
}
|
||||
} else {
|
||||
shared_library("libcef") {
|
||||
sources = includes_common +
|
||||
sources = gypi_paths2.includes_common +
|
||||
gypi_paths.autogen_cpp_includes +
|
||||
gypi_paths2.includes_capi +
|
||||
gypi_paths.autogen_capi_includes +
|
||||
@@ -1739,10 +1680,15 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
sources += includes_win + [
|
||||
sources += gypi_paths2.includes_win + [
|
||||
"libcef_dll/libcef_dll.rc",
|
||||
]
|
||||
|
||||
# This is a large module that can't do incremental linking in some cases.
|
||||
configs -= [ "//build/config/win:default_incremental_linking" ]
|
||||
configs +=
|
||||
[ "//build/config/win:default_large_module_incremental_linking" ]
|
||||
|
||||
deps += [
|
||||
# Bring in ui_unscaled_resources.rc which contains custom cursors.
|
||||
# TODO(cef): Remove this once custom cursors can be loaded via
|
||||
@@ -1950,8 +1896,8 @@ if (is_mac) {
|
||||
|
||||
cef_app("cefclient") {
|
||||
helper_info_plist = "tests/cefclient/resources/mac/helper-Info.plist"
|
||||
helper_sources = includes_common +
|
||||
includes_mac +
|
||||
helper_sources = gypi_paths2.includes_mac +
|
||||
gypi_paths2.includes_common +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_mac +
|
||||
gypi_paths2.shared_sources_common +
|
||||
@@ -1964,8 +1910,8 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
info_plist = "tests/cefclient/resources/mac/Info.plist"
|
||||
sources = includes_common +
|
||||
includes_mac +
|
||||
sources = gypi_paths2.includes_mac +
|
||||
gypi_paths2.includes_common +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_mac +
|
||||
gypi_paths2.shared_sources_browser +
|
||||
@@ -2023,8 +1969,8 @@ if (is_mac) {
|
||||
|
||||
cef_app("cefsimple") {
|
||||
helper_info_plist = "tests/cefsimple/mac/helper-Info.plist"
|
||||
helper_sources = includes_common +
|
||||
includes_mac +
|
||||
helper_sources = gypi_paths2.includes_mac +
|
||||
gypi_paths2.includes_common +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_mac +
|
||||
gypi_paths2.cefsimple_sources_mac_helper
|
||||
@@ -2033,8 +1979,8 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
info_plist = "tests/cefsimple/mac/Info.plist"
|
||||
sources = includes_common +
|
||||
includes_mac +
|
||||
sources = gypi_paths2.includes_mac +
|
||||
gypi_paths2.includes_common +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_mac +
|
||||
gypi_paths2.cefsimple_sources_common +
|
||||
@@ -2100,8 +2046,8 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
info_plist = "tests/ceftests/resources/mac/Info.plist"
|
||||
sources = includes_common +
|
||||
includes_mac +
|
||||
sources = gypi_paths2.includes_mac +
|
||||
gypi_paths2.includes_common +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_mac +
|
||||
gypi_paths2.shared_sources_browser +
|
||||
@@ -2169,7 +2115,7 @@ if (is_mac) {
|
||||
}
|
||||
|
||||
executable("cefclient") {
|
||||
sources = includes_common +
|
||||
sources = gypi_paths2.includes_common +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.shared_sources_browser +
|
||||
gypi_paths2.shared_sources_common +
|
||||
@@ -2188,7 +2134,7 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
sources += includes_win +
|
||||
sources += gypi_paths2.includes_win +
|
||||
gypi_paths2.shared_sources_win +
|
||||
gypi_paths2.cefclient_sources_win
|
||||
|
||||
@@ -2223,7 +2169,7 @@ if (is_mac) {
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
sources += includes_linux +
|
||||
sources += gypi_paths2.includes_linux +
|
||||
gypi_paths2.shared_sources_linux +
|
||||
gypi_paths2.cefclient_sources_linux
|
||||
|
||||
@@ -2262,7 +2208,7 @@ if (is_mac) {
|
||||
#
|
||||
|
||||
executable("cefsimple") {
|
||||
sources = includes_common +
|
||||
sources = gypi_paths2.includes_common +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.cefsimple_sources_common
|
||||
|
||||
@@ -2276,7 +2222,7 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
sources += includes_win +
|
||||
sources += gypi_paths2.includes_win +
|
||||
gypi_paths2.cefsimple_sources_win
|
||||
|
||||
# Set /SUBSYSTEM:WINDOWS.
|
||||
@@ -2296,7 +2242,7 @@ if (is_mac) {
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
sources += includes_linux +
|
||||
sources += gypi_paths2.includes_linux +
|
||||
gypi_paths2.cefsimple_sources_linux
|
||||
|
||||
if (use_x11) {
|
||||
@@ -2327,7 +2273,7 @@ if (is_mac) {
|
||||
executable("ceftests") {
|
||||
testonly = true
|
||||
|
||||
sources = includes_common +
|
||||
sources = gypi_paths2.includes_common +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.shared_sources_browser +
|
||||
gypi_paths2.shared_sources_common +
|
||||
|
@@ -7,6 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/83.0.4103.106',
|
||||
'depot_tools_checkout': 'fc5e103221'
|
||||
'chromium_checkout': 'refs/tags/80.0.3987.163',
|
||||
'depot_tools_checkout': 'ec2a6ce270'
|
||||
}
|
||||
|
@@ -57,9 +57,7 @@
|
||||
'content/shell/renderer/shell_*',
|
||||
'content/shell/utility/shell_*',
|
||||
'extensions/shell/*',
|
||||
'net/base/features.cc',
|
||||
'net/cookies/cookie_store.h',
|
||||
'services/network/public/cpp/features.cc',
|
||||
'ui/base/ui_base_features.cc',
|
||||
],
|
||||
# Patterns that should not be found in the chromium/src directory after
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# by hand. See the translator.README.txt file in the tools directory for
|
||||
# more information.
|
||||
#
|
||||
# $hash=72268a78a76d7d91b8ad47f6b6e9f6d9cb04d9cf$
|
||||
# $hash=578c0aef11c3c7840679e480069fc9031c628e25$
|
||||
#
|
||||
|
||||
{
|
||||
@@ -16,7 +16,6 @@
|
||||
'autogen_cpp_includes': [
|
||||
'include/cef_accessibility_handler.h',
|
||||
'include/cef_app.h',
|
||||
'include/cef_audio_handler.h',
|
||||
'include/cef_auth_callback.h',
|
||||
'include/cef_browser.h',
|
||||
'include/cef_browser_process_handler.h',
|
||||
@@ -26,7 +25,6 @@
|
||||
'include/cef_context_menu_handler.h',
|
||||
'include/cef_cookie.h',
|
||||
'include/cef_crash_util.h',
|
||||
'include/cef_devtools_message_observer.h',
|
||||
'include/cef_dialog_handler.h',
|
||||
'include/cef_display_handler.h',
|
||||
'include/cef_dom.h',
|
||||
@@ -113,7 +111,6 @@
|
||||
'autogen_capi_includes': [
|
||||
'include/capi/cef_accessibility_handler_capi.h',
|
||||
'include/capi/cef_app_capi.h',
|
||||
'include/capi/cef_audio_handler_capi.h',
|
||||
'include/capi/cef_auth_callback_capi.h',
|
||||
'include/capi/cef_browser_capi.h',
|
||||
'include/capi/cef_browser_process_handler_capi.h',
|
||||
@@ -123,7 +120,6 @@
|
||||
'include/capi/cef_context_menu_handler_capi.h',
|
||||
'include/capi/cef_cookie_capi.h',
|
||||
'include/capi/cef_crash_util_capi.h',
|
||||
'include/capi/cef_devtools_message_observer_capi.h',
|
||||
'include/capi/cef_dialog_handler_capi.h',
|
||||
'include/capi/cef_display_handler_capi.h',
|
||||
'include/capi/cef_dom_capi.h',
|
||||
@@ -212,8 +208,6 @@
|
||||
'libcef_dll/ctocpp/accessibility_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/app_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/app_ctocpp.h',
|
||||
'libcef_dll/ctocpp/audio_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/audio_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/auth_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/auth_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/before_download_callback_cpptoc.cc',
|
||||
@@ -262,8 +256,6 @@
|
||||
'libcef_dll/ctocpp/domvisitor_ctocpp.h',
|
||||
'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.h',
|
||||
'libcef_dll/ctocpp/dialog_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/dialog_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/dictionary_value_cpptoc.cc',
|
||||
@@ -330,8 +322,6 @@
|
||||
'libcef_dll/cpptoc/media_router_cpptoc.h',
|
||||
'libcef_dll/cpptoc/media_sink_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_sink_cpptoc.h',
|
||||
'libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/media_source_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_source_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/menu_button_cpptoc.cc',
|
||||
@@ -522,8 +512,6 @@
|
||||
'libcef_dll/cpptoc/accessibility_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/app_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/app_cpptoc.h',
|
||||
'libcef_dll/cpptoc/audio_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/audio_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/auth_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/auth_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/before_download_callback_ctocpp.cc',
|
||||
@@ -572,8 +560,6 @@
|
||||
'libcef_dll/cpptoc/domvisitor_cpptoc.h',
|
||||
'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.h',
|
||||
'libcef_dll/cpptoc/dialog_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/dialog_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/dictionary_value_ctocpp.cc',
|
||||
@@ -640,8 +626,6 @@
|
||||
'libcef_dll/ctocpp/media_router_ctocpp.h',
|
||||
'libcef_dll/ctocpp/media_sink_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_sink_ctocpp.h',
|
||||
'libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/media_source_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_source_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/menu_button_ctocpp.cc',
|
||||
|
@@ -39,21 +39,19 @@
|
||||
'include/cef_config.h',
|
||||
'include/cef_version.h',
|
||||
'include/internal/cef_export.h',
|
||||
'include/internal/cef_ptr.h',
|
||||
'include/internal/cef_string_wrappers.h',
|
||||
'include/internal/cef_types_wrappers.h',
|
||||
],
|
||||
'includes_common_capi': [
|
||||
'include/internal/cef_logging_internal.h',
|
||||
'include/internal/cef_ptr.h',
|
||||
'include/internal/cef_string.h',
|
||||
'include/internal/cef_string_list.h',
|
||||
'include/internal/cef_string_map.h',
|
||||
'include/internal/cef_string_multimap.h',
|
||||
'include/internal/cef_string_types.h',
|
||||
'include/internal/cef_string_wrappers.h',
|
||||
'include/internal/cef_thread_internal.h',
|
||||
'include/internal/cef_time.h',
|
||||
'include/internal/cef_trace_event_internal.h',
|
||||
'include/internal/cef_types.h',
|
||||
'include/internal/cef_types_wrappers.h',
|
||||
],
|
||||
'includes_capi': [
|
||||
'include/capi/cef_base_capi.h',
|
||||
@@ -77,10 +75,8 @@
|
||||
'include/base/internal/cef_atomicops_x86_msvc.h',
|
||||
'include/base/internal/cef_bind_internal_win.h',
|
||||
'include/cef_sandbox_win.h',
|
||||
'include/internal/cef_win.h',
|
||||
],
|
||||
'includes_win_capi': [
|
||||
'include/internal/cef_types_win.h',
|
||||
'include/internal/cef_win.h',
|
||||
],
|
||||
'includes_mac': [
|
||||
'include/base/internal/cef_atomicops_atomicword_compat.h',
|
||||
@@ -88,8 +84,6 @@
|
||||
'include/cef_application_mac.h',
|
||||
'include/cef_sandbox_mac.h',
|
||||
'include/internal/cef_mac.h',
|
||||
],
|
||||
'includes_mac_capi': [
|
||||
'include/internal/cef_types_mac.h',
|
||||
],
|
||||
'includes_linux': [
|
||||
@@ -98,8 +92,6 @@
|
||||
'include/base/internal/cef_atomicops_arm64_gcc.h',
|
||||
'include/base/internal/cef_atomicops_x86_gcc.h',
|
||||
'include/internal/cef_linux.h',
|
||||
],
|
||||
'includes_linux_capi': [
|
||||
'include/internal/cef_types_linux.h',
|
||||
],
|
||||
'libcef_sources_common': [
|
||||
@@ -466,11 +458,9 @@
|
||||
'tests/cefsimple/simple_handler_linux.cc',
|
||||
],
|
||||
'ceftests_sources_common': [
|
||||
'tests/ceftests/audio_output_unittest.cc',
|
||||
'tests/ceftests/browser_info_map_unittest.cc',
|
||||
'tests/ceftests/command_line_unittest.cc',
|
||||
'tests/ceftests/cookie_unittest.cc',
|
||||
'tests/ceftests/devtools_message_unittest.cc',
|
||||
'tests/ceftests/dialog_unittest.cc',
|
||||
'tests/ceftests/display_unittest.cc',
|
||||
'tests/ceftests/dom_unittest.cc',
|
||||
@@ -567,7 +557,6 @@
|
||||
'tests/shared/browser/resource_util.h',
|
||||
'tests/shared/browser/resource_util_mac.mm',
|
||||
'tests/shared/browser/resource_util_posix.cc',
|
||||
'tests/ceftests/audio_output_unittest.cc',
|
||||
'tests/ceftests/client_app_delegates.cc',
|
||||
'tests/ceftests/cookie_unittest.cc',
|
||||
'tests/ceftests/dom_unittest.cc',
|
||||
|
@@ -1,121 +0,0 @@
|
||||
// Copyright (c) 2020 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=430877d950508a545d0baa18c8c8c0d2d183fec4$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
// Implement this structure to handle audio events.
|
||||
///
|
||||
typedef struct _cef_audio_handler_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Called on the UI thread to allow configuration of audio stream parameters.
|
||||
// Return true (1) to proceed with audio stream capture, or false (0) to
|
||||
// cancel it. All members of |params| can optionally be configured here, but
|
||||
// they are also pre-filled with some sensible defaults.
|
||||
///
|
||||
int(CEF_CALLBACK* get_audio_parameters)(struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_audio_parameters_t* params);
|
||||
|
||||
///
|
||||
// Called on a browser audio capture thread when the browser starts streaming
|
||||
// audio. OnAudioSteamStopped will always be called after
|
||||
// OnAudioStreamStarted; both functions may be called multiple times for the
|
||||
// same browser. |params| contains the audio parameters like sample rate and
|
||||
// channel layout. |channels| is the number of channels.
|
||||
///
|
||||
void(CEF_CALLBACK* on_audio_stream_started)(
|
||||
struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_audio_parameters_t* params,
|
||||
int channels);
|
||||
|
||||
///
|
||||
// Called on the audio stream thread when a PCM packet is received for the
|
||||
// stream. |data| is an array representing the raw PCM data as a floating
|
||||
// point type, i.e. 4-byte value(s). |frames| is the number of frames in the
|
||||
// PCM packet. |pts| is the presentation timestamp (in milliseconds since the
|
||||
// Unix Epoch) and represents the time at which the decompressed packet should
|
||||
// be presented to the user. Based on |frames| and the |channel_layout| value
|
||||
// passed to OnAudioStreamStarted you can calculate the size of the |data|
|
||||
// array in bytes.
|
||||
///
|
||||
void(CEF_CALLBACK* on_audio_stream_packet)(struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const float** data,
|
||||
int frames,
|
||||
int64 pts);
|
||||
|
||||
///
|
||||
// Called on the UI thread when the stream has stopped. OnAudioSteamStopped
|
||||
// will always be called after OnAudioStreamStarted; both functions may be
|
||||
// called multiple times for the same stream.
|
||||
///
|
||||
void(CEF_CALLBACK* on_audio_stream_stopped)(struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
// Called on the UI or audio stream thread when an error occurred. During the
|
||||
// stream creation phase this callback will be called on the UI thread while
|
||||
// in the capturing phase it will be called on the audio stream thread. The
|
||||
// stream will be stopped immediately.
|
||||
///
|
||||
void(CEF_CALLBACK* on_audio_stream_error)(struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* message);
|
||||
} cef_audio_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_AUDIO_HANDLER_CAPI_H_
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=6cb00a0fa3631a46903abb3a783f315895511db2$
|
||||
// $hash=ba4033eaf40a8ee24408b89b78496bf1381e7e6b$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||
@@ -41,12 +41,10 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_devtools_message_observer_capi.h"
|
||||
#include "include/capi/cef_drag_data_capi.h"
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
#include "include/capi/cef_image_capi.h"
|
||||
#include "include/capi/cef_navigation_entry_capi.h"
|
||||
#include "include/capi/cef_registration_capi.h"
|
||||
#include "include/capi/cef_request_context_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -486,71 +484,6 @@ typedef struct _cef_browser_host_t {
|
||||
///
|
||||
int(CEF_CALLBACK* has_dev_tools)(struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
// Send a function call message over the DevTools protocol. |message| must be
|
||||
// a UTF8-encoded JSON dictionary that contains "id" (int), "function"
|
||||
// (string) and "params" (dictionary, optional) values. See the DevTools
|
||||
// protocol documentation at https://chromedevtools.github.io/devtools-
|
||||
// protocol/ for details of supported functions and the expected "params"
|
||||
// dictionary contents. |message| will be copied if necessary. This function
|
||||
// will return true (1) if called on the UI thread and the message was
|
||||
// successfully submitted for validation, otherwise false (0). Validation will
|
||||
// be applied asynchronously and any messages that fail due to formatting
|
||||
// errors or missing parameters may be discarded without notification. Prefer
|
||||
// ExecuteDevToolsMethod if a more structured approach to message formatting
|
||||
// is desired.
|
||||
//
|
||||
// Every valid function call will result in an asynchronous function result or
|
||||
// error message that references the sent message "id". Event messages are
|
||||
// received while notifications are enabled (for example, between function
|
||||
// calls for "Page.enable" and "Page.disable"). All received messages will be
|
||||
// delivered to the observer(s) registered with AddDevToolsMessageObserver.
|
||||
// See cef_dev_tools_message_observer_t::OnDevToolsMessage documentation for
|
||||
// details of received message contents.
|
||||
//
|
||||
// Usage of the SendDevToolsMessage, ExecuteDevToolsMethod and
|
||||
// AddDevToolsMessageObserver functions does not require an active DevTools
|
||||
// front-end or remote-debugging session. Other active DevTools sessions will
|
||||
// continue to function independently. However, any modification of global
|
||||
// browser state by one session may not be reflected in the UI of other
|
||||
// sessions.
|
||||
//
|
||||
// Communication with the DevTools front-end (when displayed) can be logged
|
||||
// for development purposes by passing the `--devtools-protocol-log-
|
||||
// file=<path>` command-line flag.
|
||||
///
|
||||
int(CEF_CALLBACK* send_dev_tools_message)(struct _cef_browser_host_t* self,
|
||||
const void* message,
|
||||
size_t message_size);
|
||||
|
||||
///
|
||||
// Execute a function call over the DevTools protocol. This is a more
|
||||
// structured version of SendDevToolsMessage. |message_id| is an incremental
|
||||
// number that uniquely identifies the message (pass 0 to have the next number
|
||||
// assigned automatically based on previous values). |function| is the
|
||||
// function name. |params| are the function parameters, which may be NULL. See
|
||||
// the DevTools protocol documentation (linked above) for details of supported
|
||||
// functions and the expected |params| dictionary contents. This function will
|
||||
// return the assigned message ID if called on the UI thread and the message
|
||||
// was successfully submitted for validation, otherwise 0. See the
|
||||
// SendDevToolsMessage documentation for additional usage information.
|
||||
///
|
||||
int(CEF_CALLBACK* execute_dev_tools_method)(
|
||||
struct _cef_browser_host_t* self,
|
||||
int message_id,
|
||||
const cef_string_t* method,
|
||||
struct _cef_dictionary_value_t* params);
|
||||
|
||||
///
|
||||
// Add an observer for DevTools protocol messages (function results and
|
||||
// events). The observer will remain registered until the returned
|
||||
// Registration object is destroyed. See the SendDevToolsMessage documentation
|
||||
// for additional usage information.
|
||||
///
|
||||
struct _cef_registration_t*(CEF_CALLBACK* add_dev_tools_message_observer)(
|
||||
struct _cef_browser_host_t* self,
|
||||
struct _cef_dev_tools_message_observer_t* observer);
|
||||
|
||||
///
|
||||
// Retrieve a snapshot of current navigation entries as values sent to the
|
||||
// specified visitor. If |current_only| is true (1) only the current
|
||||
|
@@ -33,14 +33,13 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=8d4cb3e0bbf230804c93898daa4a8b2866a2c1ce$
|
||||
// $hash=6a0312765614a697d56e87c8503afba8404bb08b$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_audio_handler_capi.h"
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_context_menu_handler_capi.h"
|
||||
#include "include/capi/cef_dialog_handler_capi.h"
|
||||
@@ -70,12 +69,6 @@ typedef struct _cef_client_t {
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Return the handler for audio rendering events.
|
||||
///
|
||||
struct _cef_audio_handler_t*(CEF_CALLBACK* get_audio_handler)(
|
||||
struct _cef_client_t* self);
|
||||
|
||||
///
|
||||
// Return the handler for context menus. If no handler is provided the default
|
||||
// implementation will be used.
|
||||
|
@@ -1,147 +0,0 @@
|
||||
// Copyright (c) 2020 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=86906c2e971fea7e479738f59bbf85d71ce31953$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_browser_t;
|
||||
|
||||
///
|
||||
// Callback structure for cef_browser_host_t::AddDevToolsMessageObserver. The
|
||||
// functions of this structure will be called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_dev_tools_message_observer_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Method that will be called on receipt of a DevTools protocol message.
|
||||
// |browser| is the originating browser instance. |message| is a UTF8-encoded
|
||||
// JSON dictionary representing either a function result or an event.
|
||||
// |message| is only valid for the scope of this callback and should be copied
|
||||
// if necessary. Return true (1) if the message was handled or false (0) if
|
||||
// the message should be further processed and passed to the
|
||||
// OnDevToolsMethodResult or OnDevToolsEvent functions as appropriate.
|
||||
//
|
||||
// Method result dictionaries include an "id" (int) value that identifies the
|
||||
// orginating function call sent from cef_browser_host_t::SendDevToolsMessage,
|
||||
// and optionally either a "result" (dictionary) or "error" (dictionary)
|
||||
// value. The "error" dictionary will contain "code" (int) and "message"
|
||||
// (string) values. Event dictionaries include a "function" (string) value and
|
||||
// optionally a "params" (dictionary) value. See the DevTools protocol
|
||||
// documentation at https://chromedevtools.github.io/devtools-protocol/ for
|
||||
// details of supported function calls and the expected "result" or "params"
|
||||
// dictionary contents. JSON dictionaries can be parsed using the CefParseJSON
|
||||
// function if desired, however be aware of performance considerations when
|
||||
// parsing large messages (some of which may exceed 1MB in size).
|
||||
///
|
||||
int(CEF_CALLBACK* on_dev_tools_message)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const void* message,
|
||||
size_t message_size);
|
||||
|
||||
///
|
||||
// Method that will be called after attempted execution of a DevTools protocol
|
||||
// function. |browser| is the originating browser instance. |message_id| is
|
||||
// the "id" value that identifies the originating function call message. If
|
||||
// the function succeeded |success| will be true (1) and |result| will be the
|
||||
// UTF8-encoded JSON "result" dictionary value (which may be NULL). If the
|
||||
// function failed |success| will be false (0) and |result| will be the
|
||||
// UTF8-encoded JSON "error" dictionary value. |result| is only valid for the
|
||||
// scope of this callback and should be copied if necessary. See the
|
||||
// OnDevToolsMessage documentation for additional details on |result|
|
||||
// contents.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dev_tools_method_result)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
int message_id,
|
||||
int success,
|
||||
const void* result,
|
||||
size_t result_size);
|
||||
|
||||
///
|
||||
// Method that will be called on receipt of a DevTools protocol event.
|
||||
// |browser| is the originating browser instance. |function| is the "function"
|
||||
// value. |params| is the UTF8-encoded JSON "params" dictionary value (which
|
||||
// may be NULL). |params| is only valid for the scope of this callback and
|
||||
// should be copied if necessary. See the OnDevToolsMessage documentation for
|
||||
// additional details on |params| contents.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dev_tools_event)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* method,
|
||||
const void* params,
|
||||
size_t params_size);
|
||||
|
||||
///
|
||||
// Method that will be called when the DevTools agent has attached. |browser|
|
||||
// is the originating browser instance. This will generally occur in response
|
||||
// to the first message sent while the agent is detached.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dev_tools_agent_attached)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
|
||||
///
|
||||
// Method that will be called when the DevTools agent has detached. |browser|
|
||||
// is the originating browser instance. Any function results that were pending
|
||||
// before the agent became detached will not be delivered, and any active
|
||||
// event subscriptions will be canceled.
|
||||
///
|
||||
void(CEF_CALLBACK* on_dev_tools_agent_detached)(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
} cef_dev_tools_message_observer_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_DEVTOOLS_MESSAGE_OBSERVER_CAPI_H_
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=9d5077fdb3fe7fa0ff1141f839988ac821eba4bf$
|
||||
// $hash=a7070419332ec8f6d6e4df898c8eb666b988970a$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||
@@ -50,7 +50,6 @@ extern "C" {
|
||||
struct _cef_media_observer_t;
|
||||
struct _cef_media_route_create_callback_t;
|
||||
struct _cef_media_route_t;
|
||||
struct _cef_media_sink_device_info_callback_t;
|
||||
struct _cef_media_sink_t;
|
||||
struct _cef_media_source_t;
|
||||
|
||||
@@ -265,19 +264,6 @@ typedef struct _cef_media_sink_t {
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_description)(
|
||||
struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns the icon type for this sink.
|
||||
///
|
||||
cef_media_sink_icon_type_t(CEF_CALLBACK* get_icon_type)(
|
||||
struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Asynchronously retrieves device info.
|
||||
///
|
||||
void(CEF_CALLBACK* get_device_info)(
|
||||
struct _cef_media_sink_t* self,
|
||||
struct _cef_media_sink_device_info_callback_t* callback);
|
||||
|
||||
///
|
||||
// Returns true (1) if this sink accepts content via Cast.
|
||||
///
|
||||
@@ -295,25 +281,6 @@ typedef struct _cef_media_sink_t {
|
||||
struct _cef_media_source_t* source);
|
||||
} cef_media_sink_t;
|
||||
|
||||
///
|
||||
// Callback structure for cef_media_sink_t::GetDeviceInfo. The functions of this
|
||||
// structure will be called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_media_sink_device_info_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Method that will be executed asyncronously once device information has been
|
||||
// retrieved.
|
||||
///
|
||||
void(CEF_CALLBACK* on_media_sink_device_info)(
|
||||
struct _cef_media_sink_device_info_callback_t* self,
|
||||
const struct _cef_media_sink_device_info_t* device_info);
|
||||
} cef_media_sink_device_info_callback_t;
|
||||
|
||||
///
|
||||
// Represents a source from which media can be routed. Instances of this object
|
||||
// are retrieved via cef_media_router_t::GetSource. The functions of this
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=14cf03e02d8ca3416e65f756470afd8185c7bc78$
|
||||
// $hash=3bc4225f43428d8a3a24dcac1830dafac18b0caf$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_PARSER_CAPI_H_
|
||||
@@ -140,16 +140,6 @@ CEF_EXPORT struct _cef_value_t* cef_parse_json(
|
||||
const cef_string_t* json_string,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
// Parses the specified UTF8-encoded |json| buffer of size |json_size| and
|
||||
// returns a dictionary or list representation. If JSON parsing fails this
|
||||
// function returns NULL.
|
||||
///
|
||||
CEF_EXPORT struct _cef_value_t* cef_parse_json_buffer(
|
||||
const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
// Parses the specified |json_string| and returns a dictionary or list
|
||||
// representation. If JSON parsing fails this function returns NULL and
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=0167eb1abe614bd6391d273a8085fa3e53e7c217$
|
||||
// $hash=a28219cc8c1cb53faacaf236374c3cf2c0c45bef$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||
@@ -253,14 +253,6 @@ typedef struct _cef_request_handler_t {
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_termination_status_t status);
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when the window.document object of
|
||||
// the main frame has been created.
|
||||
///
|
||||
void(CEF_CALLBACK* on_document_available_in_main_frame)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
} cef_request_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -29,7 +29,12 @@
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the make_api_hash_header.py tool.
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=789c89f59dd4f5aac704644d0d64cbf658506382$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_API_HASH_H_
|
||||
@@ -42,13 +47,13 @@
|
||||
// way that may cause binary incompatibility with other builds. The universal
|
||||
// hash value will change if any platform is affected whereas the platform hash
|
||||
// values will change only if that particular platform is affected.
|
||||
#define CEF_API_HASH_UNIVERSAL "385d8af3c6da76f123f3aa292d3a3308ef456297"
|
||||
#define CEF_API_HASH_UNIVERSAL "5f9a1d7977affd8006aff83fe4ab7c408c3288f0"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "4bb528b0bb076ed5177d6581cfca12dd7b2fee04"
|
||||
#define CEF_API_HASH_PLATFORM "5131b8a7e8097ab4c415227c65e7385a3363b56f"
|
||||
#elif defined(OS_MACOSX)
|
||||
#define CEF_API_HASH_PLATFORM "f6580fc0858f3580b7d25e1d094dd0a336132522"
|
||||
#define CEF_API_HASH_PLATFORM "136b3df0013c4997f81de2eba43fca2e36ad603c"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "83f3053840abba3b83e43ade58230f10b48591dd"
|
||||
#define CEF_API_HASH_PLATFORM "7353c7e128ad2e0185a93f488876e607f57f576a"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -1,111 +0,0 @@
|
||||
// Copyright (c) 2019 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_AUDIO_HANDLER_H_
|
||||
#define CEF_INCLUDE_CEF_AUDIO_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_browser.h"
|
||||
|
||||
///
|
||||
// Implement this interface to handle audio events.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefAudioHandler : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
typedef cef_channel_layout_t ChannelLayout;
|
||||
|
||||
///
|
||||
// Called on the UI thread to allow configuration of audio stream parameters.
|
||||
// Return true to proceed with audio stream capture, or false to cancel it.
|
||||
// All members of |params| can optionally be configured here, but they are
|
||||
// also pre-filled with some sensible defaults.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool GetAudioParameters(CefRefPtr<CefBrowser> browser,
|
||||
CefAudioParameters& params) {
|
||||
return true;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on a browser audio capture thread when the browser starts
|
||||
// streaming audio. OnAudioSteamStopped will always be called after
|
||||
// OnAudioStreamStarted; both methods may be called multiple times
|
||||
// for the same browser. |params| contains the audio parameters like
|
||||
// sample rate and channel layout. |channels| is the number of channels.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnAudioStreamStarted(CefRefPtr<CefBrowser> browser,
|
||||
const CefAudioParameters& params,
|
||||
int channels) = 0;
|
||||
|
||||
///
|
||||
// Called on the audio stream thread when a PCM packet is received for the
|
||||
// stream. |data| is an array representing the raw PCM data as a floating
|
||||
// point type, i.e. 4-byte value(s). |frames| is the number of frames in the
|
||||
// PCM packet. |pts| is the presentation timestamp (in milliseconds since the
|
||||
// Unix Epoch) and represents the time at which the decompressed packet should
|
||||
// be presented to the user. Based on |frames| and the |channel_layout| value
|
||||
// passed to OnAudioStreamStarted you can calculate the size of the |data|
|
||||
// array in bytes.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnAudioStreamPacket(CefRefPtr<CefBrowser> browser,
|
||||
const float** data,
|
||||
int frames,
|
||||
int64 pts) = 0;
|
||||
|
||||
///
|
||||
// Called on the UI thread when the stream has stopped. OnAudioSteamStopped
|
||||
// will always be called after OnAudioStreamStarted; both methods may be
|
||||
// called multiple times for the same stream.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnAudioStreamStopped(CefRefPtr<CefBrowser> browser) = 0;
|
||||
|
||||
///
|
||||
// Called on the UI or audio stream thread when an error occurred. During the
|
||||
// stream creation phase this callback will be called on the UI thread while
|
||||
// in the capturing phase it will be called on the audio stream thread. The
|
||||
// stream will be stopped immediately.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnAudioStreamError(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message) = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_AUDIO_HANDLER_H_
|
@@ -40,12 +40,10 @@
|
||||
|
||||
#include <vector>
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_devtools_message_observer.h"
|
||||
#include "include/cef_drag_data.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_image.h"
|
||||
#include "include/cef_navigation_entry.h"
|
||||
#include "include/cef_registration.h"
|
||||
#include "include/cef_request_context.h"
|
||||
|
||||
class CefBrowserHost;
|
||||
@@ -519,69 +517,6 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual bool HasDevTools() = 0;
|
||||
|
||||
///
|
||||
// Send a method call message over the DevTools protocol. |message| must be a
|
||||
// UTF8-encoded JSON dictionary that contains "id" (int), "method" (string)
|
||||
// and "params" (dictionary, optional) values. See the DevTools protocol
|
||||
// documentation at https://chromedevtools.github.io/devtools-protocol/ for
|
||||
// details of supported methods and the expected "params" dictionary contents.
|
||||
// |message| will be copied if necessary. This method will return true if
|
||||
// called on the UI thread and the message was successfully submitted for
|
||||
// validation, otherwise false. Validation will be applied asynchronously and
|
||||
// any messages that fail due to formatting errors or missing parameters may
|
||||
// be discarded without notification. Prefer ExecuteDevToolsMethod if a more
|
||||
// structured approach to message formatting is desired.
|
||||
//
|
||||
// Every valid method call will result in an asynchronous method result or
|
||||
// error message that references the sent message "id". Event messages are
|
||||
// received while notifications are enabled (for example, between method calls
|
||||
// for "Page.enable" and "Page.disable"). All received messages will be
|
||||
// delivered to the observer(s) registered with AddDevToolsMessageObserver.
|
||||
// See CefDevToolsMessageObserver::OnDevToolsMessage documentation for details
|
||||
// of received message contents.
|
||||
//
|
||||
// Usage of the SendDevToolsMessage, ExecuteDevToolsMethod and
|
||||
// AddDevToolsMessageObserver methods does not require an active DevTools
|
||||
// front-end or remote-debugging session. Other active DevTools sessions will
|
||||
// continue to function independently. However, any modification of global
|
||||
// browser state by one session may not be reflected in the UI of other
|
||||
// sessions.
|
||||
//
|
||||
// Communication with the DevTools front-end (when displayed) can be logged
|
||||
// for development purposes by passing the
|
||||
// `--devtools-protocol-log-file=<path>` command-line flag.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool SendDevToolsMessage(const void* message,
|
||||
size_t message_size) = 0;
|
||||
|
||||
///
|
||||
// Execute a method call over the DevTools protocol. This is a more structured
|
||||
// version of SendDevToolsMessage. |message_id| is an incremental number that
|
||||
// uniquely identifies the message (pass 0 to have the next number assigned
|
||||
// automatically based on previous values). |method| is the method name.
|
||||
// |params| are the method parameters, which may be empty. See the DevTools
|
||||
// protocol documentation (linked above) for details of supported methods and
|
||||
// the expected |params| dictionary contents. This method will return the
|
||||
// assigned message ID if called on the UI thread and the message was
|
||||
// successfully submitted for validation, otherwise 0. See the
|
||||
// SendDevToolsMessage documentation for additional usage information.
|
||||
///
|
||||
/*--cef(optional_param=params)--*/
|
||||
virtual int ExecuteDevToolsMethod(int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) = 0;
|
||||
|
||||
///
|
||||
// Add an observer for DevTools protocol messages (method results and events).
|
||||
// The observer will remain registered until the returned Registration object
|
||||
// is destroyed. See the SendDevToolsMessage documentation for additional
|
||||
// usage information.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefRegistration> AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) = 0;
|
||||
|
||||
///
|
||||
// Retrieve a snapshot of current navigation entries as values sent to the
|
||||
// specified visitor. If |current_only| is true only the current navigation
|
||||
|
@@ -38,7 +38,6 @@
|
||||
#define CEF_INCLUDE_CEF_CLIENT_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_audio_handler.h"
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_context_menu_handler.h"
|
||||
#include "include/cef_dialog_handler.h"
|
||||
@@ -61,12 +60,6 @@
|
||||
/*--cef(source=client,no_debugct_check)--*/
|
||||
class CefClient : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Return the handler for audio rendering events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefAudioHandler> GetAudioHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for context menus. If no handler is provided the default
|
||||
// implementation will be used.
|
||||
|
@@ -1,130 +0,0 @@
|
||||
// Copyright (c) 2020 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_DEVTOOLS_MESSAGE_OBSERVER_H_
|
||||
#define CEF_INCLUDE_CEF_DEVTOOLS_MESSAGE_OBSERVER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
class CefBrowser;
|
||||
|
||||
///
|
||||
// Callback interface for CefBrowserHost::AddDevToolsMessageObserver. The
|
||||
// methods of this class will be called on the browser process UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefDevToolsMessageObserver : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Method that will be called on receipt of a DevTools protocol message.
|
||||
// |browser| is the originating browser instance. |message| is a UTF8-encoded
|
||||
// JSON dictionary representing either a method result or an event. |message|
|
||||
// is only valid for the scope of this callback and should be copied if
|
||||
// necessary. Return true if the message was handled or false if the message
|
||||
// should be further processed and passed to the OnDevToolsMethodResult or
|
||||
// OnDevToolsEvent methods as appropriate.
|
||||
//
|
||||
// Method result dictionaries include an "id" (int) value that identifies the
|
||||
// orginating method call sent from CefBrowserHost::SendDevToolsMessage, and
|
||||
// optionally either a "result" (dictionary) or "error" (dictionary) value.
|
||||
// The "error" dictionary will contain "code" (int) and "message" (string)
|
||||
// values. Event dictionaries include a "method" (string) value and optionally
|
||||
// a "params" (dictionary) value. See the DevTools protocol documentation at
|
||||
// https://chromedevtools.github.io/devtools-protocol/ for details of
|
||||
// supported method calls and the expected "result" or "params" dictionary
|
||||
// contents. JSON dictionaries can be parsed using the CefParseJSON function
|
||||
// if desired, however be aware of performance considerations when parsing
|
||||
// large messages (some of which may exceed 1MB in size).
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool OnDevToolsMessage(CefRefPtr<CefBrowser> browser,
|
||||
const void* message,
|
||||
size_t message_size) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
// Method that will be called after attempted execution of a DevTools protocol
|
||||
// method. |browser| is the originating browser instance. |message_id| is the
|
||||
// "id" value that identifies the originating method call message. If the
|
||||
// method succeeded |success| will be true and |result| will be the
|
||||
// UTF8-encoded JSON "result" dictionary value (which may be empty). If the
|
||||
// method failed |success| will be false and |result| will be the UTF8-encoded
|
||||
// JSON "error" dictionary value. |result| is only valid for the scope of this
|
||||
// callback and should be copied if necessary. See the OnDevToolsMessage
|
||||
// documentation for additional details on |result| contents.
|
||||
///
|
||||
/*--cef(optional_param=result)--*/
|
||||
virtual void OnDevToolsMethodResult(CefRefPtr<CefBrowser> browser,
|
||||
int message_id,
|
||||
bool success,
|
||||
const void* result,
|
||||
size_t result_size) {}
|
||||
|
||||
///
|
||||
// Method that will be called on receipt of a DevTools protocol event.
|
||||
// |browser| is the originating browser instance. |method| is the "method"
|
||||
// value. |params| is the UTF8-encoded JSON "params" dictionary value (which
|
||||
// may be empty). |params| is only valid for the scope of this callback and
|
||||
// should be copied if necessary. See the OnDevToolsMessage documentation for
|
||||
// additional details on |params| contents.
|
||||
///
|
||||
/*--cef(optional_param=params)--*/
|
||||
virtual void OnDevToolsEvent(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& method,
|
||||
const void* params,
|
||||
size_t params_size) {}
|
||||
|
||||
///
|
||||
// Method that will be called when the DevTools agent has attached. |browser|
|
||||
// is the originating browser instance. This will generally occur in response
|
||||
// to the first message sent while the agent is detached.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnDevToolsAgentAttached(CefRefPtr<CefBrowser> browser) {}
|
||||
|
||||
///
|
||||
// Method that will be called when the DevTools agent has detached. |browser|
|
||||
// is the originating browser instance. Any method results that were pending
|
||||
// before the agent became detached will not be delivered, and any active
|
||||
// event subscriptions will be canceled.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnDevToolsAgentDetached(CefRefPtr<CefBrowser> browser) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_DEVTOOLS_MESSAGE_OBSERVER_H_
|
@@ -46,7 +46,6 @@ class CefMediaObserver;
|
||||
class CefMediaRoute;
|
||||
class CefMediaRouteCreateCallback;
|
||||
class CefMediaSink;
|
||||
class CefMediaSinkDeviceInfoCallback;
|
||||
class CefMediaSource;
|
||||
|
||||
///
|
||||
@@ -222,8 +221,6 @@ class CefMediaRouteCreateCallback : public virtual CefBaseRefCounted {
|
||||
/*--cef(source=library)--*/
|
||||
class CefMediaSink : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
typedef cef_media_sink_icon_type_t IconType;
|
||||
|
||||
///
|
||||
// Returns the ID for this sink.
|
||||
///
|
||||
@@ -248,19 +245,6 @@ class CefMediaSink : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual CefString GetDescription() = 0;
|
||||
|
||||
///
|
||||
// Returns the icon type for this sink.
|
||||
///
|
||||
/*--cef(default_retval=CEF_MSIT_GENERIC)--*/
|
||||
virtual IconType GetIconType() = 0;
|
||||
|
||||
///
|
||||
// Asynchronously retrieves device info.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Returns true if this sink accepts content via Cast.
|
||||
///
|
||||
@@ -280,22 +264,6 @@ class CefMediaSink : public virtual CefBaseRefCounted {
|
||||
virtual bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Callback interface for CefMediaSink::GetDeviceInfo. The methods of this
|
||||
// class will be called on the browser process UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefMediaSinkDeviceInfoCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Method that will be executed asyncronously once device information has been
|
||||
// retrieved.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnMediaSinkDeviceInfo(
|
||||
const CefMediaSinkDeviceInfo& device_info) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Represents a source from which media can be routed. Instances of this object
|
||||
// are retrieved via CefMediaRouter::GetSource. The methods of this class may be
|
||||
|
@@ -133,16 +133,6 @@ CefString CefURIDecode(const CefString& text,
|
||||
CefRefPtr<CefValue> CefParseJSON(const CefString& json_string,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
// Parses the specified UTF8-encoded |json| buffer of size |json_size| and
|
||||
// returns a dictionary or list representation. If JSON parsing fails this
|
||||
// method returns NULL.
|
||||
///
|
||||
/*--cef(capi_name=cef_parse_json_buffer)--*/
|
||||
CefRefPtr<CefValue> CefParseJSON(const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
// Parses the specified |json_string| and returns a dictionary or list
|
||||
// representation. If JSON parsing fails this method returns NULL and populates
|
||||
|
@@ -252,13 +252,6 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) {}
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when the window.document object of
|
||||
// the main frame has been created.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnDocumentAvailableInMainFrame(CefRefPtr<CefBrowser> browser) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REQUEST_HANDLER_H_
|
||||
|
@@ -170,25 +170,23 @@ typedef struct _cef_settings_t {
|
||||
// will be used. If this value is empty on macOS then a helper executable must
|
||||
// exist at "Contents/Frameworks/<app> Helper.app/Contents/MacOS/<app> Helper"
|
||||
// in the top-level app bundle. See the comments on CefExecuteProcess() for
|
||||
// details. If this value is non-empty then it must be an absolute path. Also
|
||||
// configurable using the "browser-subprocess-path" command-line switch.
|
||||
// details. Also configurable using the "browser-subprocess-path" command-line
|
||||
// switch.
|
||||
///
|
||||
cef_string_t browser_subprocess_path;
|
||||
|
||||
///
|
||||
// The path to the CEF framework directory on macOS. If this value is empty
|
||||
// then the framework must exist at "Contents/Frameworks/Chromium Embedded
|
||||
// Framework.framework" in the top-level app bundle. If this value is
|
||||
// non-empty then it must be an absolute path. Also configurable using the
|
||||
// "framework-dir-path" command-line switch.
|
||||
// Framework.framework" in the top-level app bundle. Also configurable using
|
||||
// the "framework-dir-path" command-line switch.
|
||||
///
|
||||
cef_string_t framework_dir_path;
|
||||
|
||||
///
|
||||
// The path to the main bundle on macOS. If this value is empty then it
|
||||
// defaults to the top-level app bundle. If this value is non-empty then it
|
||||
// must be an absolute path. Also configurable using the "main-bundle-path"
|
||||
// command-line switch.
|
||||
// defaults to the top-level app bundle. Also configurable using
|
||||
// the "main-bundle-path" command-line switch.
|
||||
///
|
||||
cef_string_t main_bundle_path;
|
||||
|
||||
@@ -229,35 +227,33 @@ typedef struct _cef_settings_t {
|
||||
|
||||
///
|
||||
// The location where data for the global browser cache will be stored on
|
||||
// disk. If this value is non-empty then it must be an absolute path that is
|
||||
// either equal to or a child directory of CefSettings.root_cache_path. If
|
||||
// this value is empty then browsers will be created in "incognito mode" where
|
||||
// in-memory caches are used for storage and no data is persisted to disk.
|
||||
// HTML5 databases such as localStorage will only persist across sessions if a
|
||||
// cache path is specified. Can be overridden for individual CefRequestContext
|
||||
// instances via the CefRequestContextSettings.cache_path value.
|
||||
// disk. If non-empty this must be either equal to or a child directory of
|
||||
// CefSettings.root_cache_path. If empty then browsers will be created in
|
||||
// "incognito mode" where in-memory caches are used for storage and no data is
|
||||
// persisted to disk. HTML5 databases such as localStorage will only persist
|
||||
// across sessions if a cache path is specified. Can be overridden for
|
||||
// individual CefRequestContext instances via the
|
||||
// CefRequestContextSettings.cache_path value.
|
||||
///
|
||||
cef_string_t cache_path;
|
||||
|
||||
///
|
||||
// The root directory that all CefSettings.cache_path and
|
||||
// CefRequestContextSettings.cache_path values must have in common. If this
|
||||
// value is empty and CefSettings.cache_path is non-empty then it will
|
||||
// default to the CefSettings.cache_path value. If this value is non-empty
|
||||
// then it must be an absolute path. Failure to set this value correctly may
|
||||
// result in the sandbox blocking read/write access to the cache_path
|
||||
// directory.
|
||||
// value is empty and CefSettings.cache_path is non-empty then this value will
|
||||
// default to the CefSettings.cache_path value. Failure to set this value
|
||||
// correctly may result in the sandbox blocking read/write access to the
|
||||
// cache_path directory.
|
||||
///
|
||||
cef_string_t root_cache_path;
|
||||
|
||||
///
|
||||
// The location where user data such as spell checking dictionary files will
|
||||
// be stored on disk. If this value is empty then the default
|
||||
// platform-specific user data directory will be used ("~/.cef_user_data"
|
||||
// directory on Linux, "~/Library/Application Support/CEF/User Data" directory
|
||||
// on Mac OS X, "Local Settings\Application Data\CEF\User Data" directory
|
||||
// under the user profile directory on Windows). If this value is non-empty
|
||||
// then it must be an absolute path.
|
||||
// be stored on disk. If empty then the default platform-specific user data
|
||||
// directory will be used ("~/.cef_user_data" directory on Linux,
|
||||
// "~/Library/Application Support/CEF/User Data" directory on Mac OS X,
|
||||
// "Local Settings\Application Data\CEF\User Data" directory under the user
|
||||
// profile directory on Windows).
|
||||
///
|
||||
cef_string_t user_data_path;
|
||||
|
||||
@@ -337,17 +333,16 @@ typedef struct _cef_settings_t {
|
||||
// The fully qualified path for the resources directory. If this value is
|
||||
// empty the cef.pak and/or devtools_resources.pak files must be located in
|
||||
// the module directory on Windows/Linux or the app bundle Resources directory
|
||||
// on Mac OS X. If this value is non-empty then it must be an absolute path.
|
||||
// Also configurable using the "resources-dir-path" command-line switch.
|
||||
// on Mac OS X. Also configurable using the "resources-dir-path" command-line
|
||||
// switch.
|
||||
///
|
||||
cef_string_t resources_dir_path;
|
||||
|
||||
///
|
||||
// The fully qualified path for the locales directory. If this value is empty
|
||||
// the locales directory must be located in the module directory. If this
|
||||
// value is non-empty then it must be an absolute path. This value is ignored
|
||||
// on Mac OS X where pack files are always loaded from the app bundle
|
||||
// Resources directory. Also configurable using the "locales-dir-path"
|
||||
// the locales directory must be located in the module directory. This value
|
||||
// is ignored on Mac OS X where pack files are always loaded from the app
|
||||
// bundle Resources directory. Also configurable using the "locales-dir-path"
|
||||
// command-line switch.
|
||||
///
|
||||
cef_string_t locales_dir_path;
|
||||
@@ -433,13 +428,13 @@ typedef struct _cef_request_context_settings_t {
|
||||
|
||||
///
|
||||
// The location where cache data for this request context will be stored on
|
||||
// disk. If this value is non-empty then it must be an absolute path that is
|
||||
// either equal to or a child directory of CefSettings.root_cache_path. If
|
||||
// this value is empty then browsers will be created in "incognito mode" where
|
||||
// in-memory caches are used for storage and no data is persisted to disk.
|
||||
// HTML5 databases such as localStorage will only persist across sessions if a
|
||||
// cache path is specified. To share the global browser cache and related
|
||||
// configuration set this value to match the CefSettings.cache_path value.
|
||||
// disk. If non-empty this must be either equal to or a child directory of
|
||||
// CefSettings.root_cache_path. If empty then browsers will be created in
|
||||
// "incognito mode" where in-memory caches are used for storage and no data is
|
||||
// persisted to disk. HTML5 databases such as localStorage will only persist
|
||||
// across sessions if a cache path is specified. To share the global browser
|
||||
// cache and related configuration set this value to match the
|
||||
// CefSettings.cache_path value.
|
||||
///
|
||||
cef_string_t cache_path;
|
||||
|
||||
@@ -730,32 +725,8 @@ typedef struct _cef_urlparts_t {
|
||||
// Query string component (i.e., everything following the '?').
|
||||
///
|
||||
cef_string_t query;
|
||||
|
||||
///
|
||||
// Fragment (hash) identifier component (i.e., the string following the '#').
|
||||
///
|
||||
cef_string_t fragment;
|
||||
} cef_urlparts_t;
|
||||
|
||||
///
|
||||
// Cookie priority values.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_COOKIE_PRIORITY_LOW = -1,
|
||||
CEF_COOKIE_PRIORITY_MEDIUM = 0,
|
||||
CEF_COOKIE_PRIORITY_HIGH = 1,
|
||||
} cef_cookie_priority_t;
|
||||
|
||||
///
|
||||
// Cookie same site values.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_COOKIE_SAME_SITE_UNSPECIFIED,
|
||||
CEF_COOKIE_SAME_SITE_NO_RESTRICTION,
|
||||
CEF_COOKIE_SAME_SITE_LAX_MODE,
|
||||
CEF_COOKIE_SAME_SITE_STRICT_MODE,
|
||||
} cef_cookie_same_site_t;
|
||||
|
||||
///
|
||||
// Cookie information.
|
||||
///
|
||||
@@ -810,16 +781,6 @@ typedef struct _cef_cookie_t {
|
||||
///
|
||||
int has_expires;
|
||||
cef_time_t expires;
|
||||
|
||||
///
|
||||
// Same site.
|
||||
///
|
||||
cef_cookie_same_site_t same_site;
|
||||
|
||||
///
|
||||
// Priority.
|
||||
///
|
||||
cef_cookie_priority_t priority;
|
||||
} cef_cookie_t;
|
||||
|
||||
///
|
||||
@@ -2272,13 +2233,7 @@ typedef enum {
|
||||
CT_ZOOMOUT,
|
||||
CT_GRAB,
|
||||
CT_GRABBING,
|
||||
CT_MIDDLE_PANNING_VERTICAL,
|
||||
CT_MIDDLE_PANNING_HORIZONTAL,
|
||||
CT_CUSTOM,
|
||||
CT_DND_NONE,
|
||||
CT_DND_MOVE,
|
||||
CT_DND_COPY,
|
||||
CT_DND_LINK,
|
||||
} cef_cursor_type_t;
|
||||
|
||||
///
|
||||
@@ -2464,13 +2419,13 @@ typedef struct _cef_pdf_print_settings_t {
|
||||
int scale_factor;
|
||||
|
||||
///
|
||||
// Margins in points. Only used if |margin_type| is set to
|
||||
// Margins in millimeters. Only used if |margin_type| is set to
|
||||
// PDF_PRINT_MARGIN_CUSTOM.
|
||||
///
|
||||
int margin_top;
|
||||
int margin_right;
|
||||
int margin_bottom;
|
||||
int margin_left;
|
||||
double margin_top;
|
||||
double margin_right;
|
||||
double margin_bottom;
|
||||
double margin_left;
|
||||
|
||||
///
|
||||
// Margin type.
|
||||
@@ -2961,16 +2916,6 @@ typedef enum {
|
||||
CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED,
|
||||
} cef_cdm_registration_error_t;
|
||||
|
||||
///
|
||||
// Composition underline style.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_CUS_SOLID,
|
||||
CEF_CUS_DOT,
|
||||
CEF_CUS_DASH,
|
||||
CEF_CUS_NONE,
|
||||
} cef_composition_underline_style_t;
|
||||
|
||||
///
|
||||
// Structure representing IME composition underline information. This is a thin
|
||||
// wrapper around Blink's WebCompositionUnderline class and should be kept in
|
||||
@@ -2996,147 +2941,12 @@ typedef struct _cef_composition_underline_t {
|
||||
// Set to true (1) for thick underline.
|
||||
///
|
||||
int thick;
|
||||
|
||||
///
|
||||
// Style.
|
||||
///
|
||||
cef_composition_underline_style_t style;
|
||||
} cef_composition_underline_t;
|
||||
|
||||
///
|
||||
// Enumerates the various representations of the ordering of audio channels.
|
||||
// Must be kept synchronized with media::ChannelLayout from Chromium.
|
||||
// See media\base\channel_layout.h
|
||||
///
|
||||
typedef enum {
|
||||
CEF_CHANNEL_LAYOUT_NONE = 0,
|
||||
CEF_CHANNEL_LAYOUT_UNSUPPORTED = 1,
|
||||
|
||||
// Front C
|
||||
CEF_CHANNEL_LAYOUT_MONO = 2,
|
||||
|
||||
// Front L, Front R
|
||||
CEF_CHANNEL_LAYOUT_STEREO = 3,
|
||||
|
||||
// Front L, Front R, Back C
|
||||
CEF_CHANNEL_LAYOUT_2_1 = 4,
|
||||
|
||||
// Front L, Front R, Front C
|
||||
CEF_CHANNEL_LAYOUT_SURROUND = 5,
|
||||
|
||||
// Front L, Front R, Front C, Back C
|
||||
CEF_CHANNEL_LAYOUT_4_0 = 6,
|
||||
|
||||
// Front L, Front R, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_2_2 = 7,
|
||||
|
||||
// Front L, Front R, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_QUAD = 8,
|
||||
|
||||
// Front L, Front R, Front C, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_5_0 = 9,
|
||||
|
||||
// Front L, Front R, Front C, LFE, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_5_1 = 10,
|
||||
|
||||
// Front L, Front R, Front C, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_5_0_BACK = 11,
|
||||
|
||||
// Front L, Front R, Front C, LFE, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_5_1_BACK = 12,
|
||||
|
||||
// Front L, Front R, Front C, Side L, Side R, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_7_0 = 13,
|
||||
|
||||
// Front L, Front R, Front C, LFE, Side L, Side R, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_7_1 = 14,
|
||||
|
||||
// Front L, Front R, Front C, LFE, Side L, Side R, Front LofC, Front RofC
|
||||
CEF_CHANNEL_LAYOUT_7_1_WIDE = 15,
|
||||
|
||||
// Stereo L, Stereo R
|
||||
CEF_CHANNEL_LAYOUT_STEREO_DOWNMIX = 16,
|
||||
|
||||
// Stereo L, Stereo R, LFE
|
||||
CEF_CHANNEL_LAYOUT_2POINT1 = 17,
|
||||
|
||||
// Stereo L, Stereo R, Front C, LFE
|
||||
CEF_CHANNEL_LAYOUT_3_1 = 18,
|
||||
|
||||
// Stereo L, Stereo R, Front C, Rear C, LFE
|
||||
CEF_CHANNEL_LAYOUT_4_1 = 19,
|
||||
|
||||
// Stereo L, Stereo R, Front C, Side L, Side R, Back C
|
||||
CEF_CHANNEL_LAYOUT_6_0 = 20,
|
||||
|
||||
// Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC
|
||||
CEF_CHANNEL_LAYOUT_6_0_FRONT = 21,
|
||||
|
||||
// Stereo L, Stereo R, Front C, Rear L, Rear R, Rear C
|
||||
CEF_CHANNEL_LAYOUT_HEXAGONAL = 22,
|
||||
|
||||
// Stereo L, Stereo R, Front C, LFE, Side L, Side R, Rear Center
|
||||
CEF_CHANNEL_LAYOUT_6_1 = 23,
|
||||
|
||||
// Stereo L, Stereo R, Front C, LFE, Back L, Back R, Rear Center
|
||||
CEF_CHANNEL_LAYOUT_6_1_BACK = 24,
|
||||
|
||||
// Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC, LFE
|
||||
CEF_CHANNEL_LAYOUT_6_1_FRONT = 25,
|
||||
|
||||
// Front L, Front R, Front C, Side L, Side R, Front LofC, Front RofC
|
||||
CEF_CHANNEL_LAYOUT_7_0_FRONT = 26,
|
||||
|
||||
// Front L, Front R, Front C, LFE, Back L, Back R, Front LofC, Front RofC
|
||||
CEF_CHANNEL_LAYOUT_7_1_WIDE_BACK = 27,
|
||||
|
||||
// Front L, Front R, Front C, Side L, Side R, Rear L, Back R, Back C.
|
||||
CEF_CHANNEL_LAYOUT_OCTAGONAL = 28,
|
||||
|
||||
// Channels are not explicitly mapped to speakers.
|
||||
CEF_CHANNEL_LAYOUT_DISCRETE = 29,
|
||||
|
||||
// Front L, Front R, Front C. Front C contains the keyboard mic audio. This
|
||||
// layout is only intended for input for WebRTC. The Front C channel
|
||||
// is stripped away in the WebRTC audio input pipeline and never seen outside
|
||||
// of that.
|
||||
CEF_CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC = 30,
|
||||
|
||||
// Front L, Front R, Side L, Side R, LFE
|
||||
CEF_CHANNEL_LAYOUT_4_1_QUAD_SIDE = 31,
|
||||
|
||||
// Actual channel layout is specified in the bitstream and the actual channel
|
||||
// count is unknown at Chromium media pipeline level (useful for audio
|
||||
// pass-through mode).
|
||||
CEF_CHANNEL_LAYOUT_BITSTREAM = 32,
|
||||
|
||||
// Max value, must always equal the largest entry ever logged.
|
||||
CEF_CHANNEL_LAYOUT_MAX = CEF_CHANNEL_LAYOUT_BITSTREAM
|
||||
} cef_channel_layout_t;
|
||||
|
||||
///
|
||||
// Structure representing the audio parameters for setting up the audio handler.
|
||||
///
|
||||
typedef struct _cef_audio_parameters_t {
|
||||
///
|
||||
// Layout of the audio channels
|
||||
///
|
||||
cef_channel_layout_t channel_layout;
|
||||
|
||||
///
|
||||
// Sample rate
|
||||
//
|
||||
int sample_rate;
|
||||
|
||||
///
|
||||
// Number of frames per buffer
|
||||
///
|
||||
int frames_per_buffer;
|
||||
} cef_audio_parameters_t;
|
||||
|
||||
///
|
||||
// Result codes for CefMediaRouter::CreateRoute. Should be kept in sync with
|
||||
// Chromium's media_router::RouteRequestResult::ResultCode type.
|
||||
// Result codes for CefMediaRouter::CreateRoute. These constants match
|
||||
// their equivalents in Chromium's route_request_result.h and should not be
|
||||
// renumbered.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_MRCR_UNKNOWN_ERROR = 0,
|
||||
@@ -3163,32 +2973,6 @@ typedef enum {
|
||||
CEF_MRCS_TERMINATED,
|
||||
} cef_media_route_connection_state_t;
|
||||
|
||||
///
|
||||
// Icon types for a MediaSink object. Should be kept in sync with Chromium's
|
||||
// media_router::SinkIconType type.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_MSIT_CAST,
|
||||
CEF_MSIT_CAST_AUDIO_GROUP,
|
||||
CEF_MSIT_CAST_AUDIO,
|
||||
CEF_MSIT_MEETING,
|
||||
CEF_MSIT_HANGOUT,
|
||||
CEF_MSIT_EDUCATION,
|
||||
CEF_MSIT_WIRED_DISPLAY,
|
||||
CEF_MSIT_GENERIC,
|
||||
|
||||
CEF_MSIT_TOTAL_COUNT, // The total number of values.
|
||||
} cef_media_sink_icon_type_t;
|
||||
|
||||
///
|
||||
// Device information for a MediaSink object.
|
||||
///
|
||||
typedef struct _cef_media_sink_device_info_t {
|
||||
cef_string_t ip_address;
|
||||
int port;
|
||||
cef_string_t model_name;
|
||||
} cef_media_sink_device_info_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -743,7 +743,6 @@ struct CefURLPartsTraits {
|
||||
cef_string_clear(&s->origin);
|
||||
cef_string_clear(&s->path);
|
||||
cef_string_clear(&s->query);
|
||||
cef_string_clear(&s->fragment);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
@@ -760,8 +759,6 @@ struct CefURLPartsTraits {
|
||||
cef_string_set(src->origin.str, src->origin.length, &target->origin, copy);
|
||||
cef_string_set(src->path.str, src->path.length, &target->path, copy);
|
||||
cef_string_set(src->query.str, src->query.length, &target->query, copy);
|
||||
cef_string_set(src->fragment.str, src->fragment.length, &target->fragment,
|
||||
copy);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -851,8 +848,6 @@ struct CefCookieTraits {
|
||||
target->last_access = src->last_access;
|
||||
target->has_expires = src->has_expires;
|
||||
target->expires = src->expires;
|
||||
target->same_site = src->same_site;
|
||||
target->priority = src->priority;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -871,7 +866,10 @@ struct CefCursorInfoTraits {
|
||||
static inline void set(const struct_type* src,
|
||||
struct_type* target,
|
||||
bool copy) {
|
||||
*target = *src;
|
||||
target->hotspot = src->hotspot;
|
||||
target->image_scale_factor = src->image_scale_factor;
|
||||
target->buffer = src->buffer;
|
||||
target->size = src->size;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -944,14 +942,23 @@ typedef CefStructBase<CefBoxLayoutSettingsTraits> CefBoxLayoutSettings;
|
||||
struct CefCompositionUnderlineTraits {
|
||||
typedef cef_composition_underline_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
static inline void init(struct_type* s) {
|
||||
s->range.from = 0;
|
||||
s->range.to = 0;
|
||||
s->color = 0;
|
||||
s->background_color = 0;
|
||||
s->thick = 0;
|
||||
}
|
||||
|
||||
static inline void clear(struct_type* s) {}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
struct_type* target,
|
||||
bool copy) {
|
||||
*target = *src;
|
||||
target->range = src->range;
|
||||
target->color = src->color;
|
||||
target->background_color = src->background_color;
|
||||
target->thick = src->thick;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -960,49 +967,4 @@ struct CefCompositionUnderlineTraits {
|
||||
///
|
||||
typedef CefStructBase<CefCompositionUnderlineTraits> CefCompositionUnderline;
|
||||
|
||||
struct CefAudioParametersTraits {
|
||||
typedef cef_audio_parameters_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
|
||||
static inline void clear(struct_type* s) {}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
struct_type* target,
|
||||
bool copy) {
|
||||
*target = *src;
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
// Class representing CefAudioParameters settings
|
||||
///
|
||||
typedef CefStructBase<CefAudioParametersTraits> CefAudioParameters;
|
||||
|
||||
struct CefMediaSinkDeviceInfoTraits {
|
||||
typedef cef_media_sink_device_info_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
|
||||
static inline void clear(struct_type* s) {
|
||||
cef_string_clear(&s->ip_address);
|
||||
cef_string_clear(&s->model_name);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
struct_type* target,
|
||||
bool copy) {
|
||||
cef_string_set(src->ip_address.str, src->ip_address.length,
|
||||
&target->ip_address, copy);
|
||||
target->port = src->port;
|
||||
cef_string_set(src->model_name.str, src->model_name.length,
|
||||
&target->model_name, copy);
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
// Class representing MediaSink device info.
|
||||
///
|
||||
typedef CefStructBase<CefMediaSinkDeviceInfoTraits> CefMediaSinkDeviceInfo;
|
||||
|
||||
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_
|
||||
|
@@ -1,125 +0,0 @@
|
||||
// Copyright (c) 2019 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2011 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/audio_capturer.h"
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
|
||||
#include "components/mirroring/service/captured_audio_input.h"
|
||||
#include "content/public/browser/audio_loopback_stream_creator.h"
|
||||
#include "media/audio/audio_input_device.h"
|
||||
|
||||
namespace {
|
||||
|
||||
media::ChannelLayout TranslateChannelLayout(
|
||||
cef_channel_layout_t channel_layout) {
|
||||
// Verify that our enum matches Chromium's values. The enum values match
|
||||
// between those enums and existing values don't ever change, so it's enough
|
||||
// to check that there are no new ones added.
|
||||
static_assert(
|
||||
static_cast<int>(CEF_CHANNEL_LAYOUT_MAX) ==
|
||||
static_cast<int>(media::CHANNEL_LAYOUT_MAX),
|
||||
"cef_channel_layout_t must match the ChannelLayout enum in Chromium");
|
||||
return static_cast<media::ChannelLayout>(channel_layout);
|
||||
}
|
||||
|
||||
void StreamCreatorHelper(
|
||||
content::WebContents* source_web_contents,
|
||||
content::AudioLoopbackStreamCreator* audio_stream_creator,
|
||||
mojo::PendingRemote<mirroring::mojom::AudioStreamCreatorClient> client,
|
||||
const media::AudioParameters& params,
|
||||
uint32_t total_segments) {
|
||||
audio_stream_creator->CreateLoopbackStream(
|
||||
source_web_contents, params, total_segments,
|
||||
base::BindRepeating(
|
||||
[](mojo::PendingRemote<mirroring::mojom::AudioStreamCreatorClient>
|
||||
client,
|
||||
mojo::PendingRemote<media::mojom::AudioInputStream> stream,
|
||||
mojo::PendingReceiver<media::mojom::AudioInputStreamClient>
|
||||
client_receiver,
|
||||
media::mojom::ReadOnlyAudioDataPipePtr data_pipe) {
|
||||
mojo::Remote<mirroring::mojom::AudioStreamCreatorClient>
|
||||
audio_client(std::move(client));
|
||||
audio_client->StreamCreated(
|
||||
std::move(stream), std::move(client_receiver),
|
||||
std::move(data_pipe), false /* initially_muted */);
|
||||
},
|
||||
base::Passed(&client)));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefAudioCapturer::CefAudioCapturer(const CefAudioParameters& params,
|
||||
CefRefPtr<CefBrowserHostImpl> browser,
|
||||
CefRefPtr<CefAudioHandler> audio_handler)
|
||||
: params_(params),
|
||||
browser_(browser),
|
||||
audio_handler_(audio_handler),
|
||||
audio_stream_creator_(content::AudioLoopbackStreamCreator::
|
||||
CreateInProcessAudioLoopbackStreamCreator()) {
|
||||
media::AudioParameters audio_params(
|
||||
media::AudioParameters::AUDIO_PCM_LINEAR,
|
||||
TranslateChannelLayout(params.channel_layout), params.sample_rate,
|
||||
params.frames_per_buffer);
|
||||
|
||||
if (!audio_params.IsValid()) {
|
||||
LOG(ERROR) << "Invalid audio parameters";
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(browser_);
|
||||
DCHECK(audio_handler_);
|
||||
DCHECK(browser_->web_contents());
|
||||
|
||||
channels_ = audio_params.channels();
|
||||
audio_input_device_ = new media::AudioInputDevice(
|
||||
std::make_unique<mirroring::CapturedAudioInput>(base::BindRepeating(
|
||||
&StreamCreatorHelper, base::Unretained(browser_->web_contents()),
|
||||
base::Unretained(audio_stream_creator_.get()))),
|
||||
media::AudioInputDevice::kLoopback);
|
||||
|
||||
audio_input_device_->Initialize(audio_params, this);
|
||||
audio_input_device_->Start();
|
||||
}
|
||||
|
||||
CefAudioCapturer::~CefAudioCapturer() {
|
||||
StopStream();
|
||||
}
|
||||
|
||||
void CefAudioCapturer::OnCaptureStarted() {
|
||||
audio_handler_->OnAudioStreamStarted(browser_, params_, channels_);
|
||||
DCHECK(!capturing_);
|
||||
capturing_ = true;
|
||||
}
|
||||
|
||||
void CefAudioCapturer::Capture(const media::AudioBus* source,
|
||||
base::TimeTicks audio_capture_time,
|
||||
double /*volume*/,
|
||||
bool /*key_pressed*/) {
|
||||
const int channels = source->channels();
|
||||
std::array<const float*, media::CHANNELS_MAX> data;
|
||||
DCHECK(channels == channels_);
|
||||
DCHECK(channels <= static_cast<int>(data.size()));
|
||||
for (int c = 0; c < channels; ++c) {
|
||||
data[c] = source->channel(c);
|
||||
}
|
||||
base::TimeDelta pts = audio_capture_time - base::TimeTicks::UnixEpoch();
|
||||
audio_handler_->OnAudioStreamPacket(browser_, data.data(), source->frames(),
|
||||
pts.InMilliseconds());
|
||||
}
|
||||
|
||||
void CefAudioCapturer::OnCaptureError(const std::string& message) {
|
||||
audio_handler_->OnAudioStreamError(browser_, message);
|
||||
StopStream();
|
||||
}
|
||||
|
||||
void CefAudioCapturer::StopStream() {
|
||||
if (audio_input_device_)
|
||||
audio_input_device_->Stop();
|
||||
if (capturing_)
|
||||
audio_handler_->OnAudioStreamStopped(browser_);
|
||||
|
||||
audio_input_device_ = nullptr;
|
||||
capturing_ = false;
|
||||
}
|
@@ -1,53 +0,0 @@
|
||||
// Copyright (c) 2019 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2011 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_AUDIO_CAPTURER_H_
|
||||
#define CEF_LIBCEF_BROWSER_AUDIO_CAPTURER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/internal/cef_ptr.h"
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
|
||||
#include "media/base/audio_capturer_source.h"
|
||||
|
||||
namespace content {
|
||||
class AudioLoopbackStreamCreator;
|
||||
} // namespace content
|
||||
|
||||
namespace media {
|
||||
class AudioInputDevice;
|
||||
} // namespace media
|
||||
|
||||
class CefAudioHandler;
|
||||
class CefBrowserHostImpl;
|
||||
|
||||
class CefAudioCapturer : public media::AudioCapturerSource::CaptureCallback {
|
||||
public:
|
||||
CefAudioCapturer(const CefAudioParameters& params,
|
||||
CefRefPtr<CefBrowserHostImpl> browser,
|
||||
CefRefPtr<CefAudioHandler> audio_handler);
|
||||
~CefAudioCapturer() override;
|
||||
|
||||
private:
|
||||
void OnCaptureStarted() override;
|
||||
void Capture(const media::AudioBus* audio_source,
|
||||
base::TimeTicks audio_capture_time,
|
||||
double volume,
|
||||
bool key_pressed) override;
|
||||
void OnCaptureError(const std::string& message) override;
|
||||
void OnCaptureMuted(bool is_muted) override {}
|
||||
|
||||
void StopStream();
|
||||
|
||||
CefAudioParameters params_;
|
||||
CefRefPtr<CefBrowserHostImpl> browser_;
|
||||
CefRefPtr<CefAudioHandler> audio_handler_;
|
||||
std::unique_ptr<content::AudioLoopbackStreamCreator> audio_stream_creator_;
|
||||
scoped_refptr<media::AudioInputDevice> audio_input_device_;
|
||||
bool capturing_ = false;
|
||||
int channels_ = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_AUDIO_CAPTURER_H_
|
@@ -8,6 +8,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/media_router/media_router_manager.h"
|
||||
@@ -47,6 +48,7 @@
|
||||
#include "extensions/browser/process_manager.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/proxy_resolution/proxy_config_service.h"
|
||||
#include "net/proxy_resolution/proxy_resolution_service.h"
|
||||
#include "services/network/public/mojom/cors_origin_pattern.mojom.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
@@ -291,23 +293,36 @@ CefBrowserContext::~CefBrowserContext() {
|
||||
}
|
||||
|
||||
void CefBrowserContext::Initialize() {
|
||||
CefContext* context = CefContext::Get();
|
||||
|
||||
cache_path_ = base::FilePath(CefString(&settings_.cache_path));
|
||||
if (!context->ValidateCachePath(cache_path_)) {
|
||||
// Reset to in-memory storage.
|
||||
CefString(&settings_.cache_path).clear();
|
||||
cache_path_ = base::FilePath();
|
||||
}
|
||||
|
||||
if (!cache_path_.empty())
|
||||
g_manager.Get().SetImplPath(this, cache_path_);
|
||||
|
||||
if (settings_.accept_language_list.length == 0) {
|
||||
// Use the global language list setting.
|
||||
CefString(&settings_.accept_language_list) =
|
||||
CefString(&context->settings().accept_language_list);
|
||||
}
|
||||
|
||||
if (!!settings_.persist_session_cookies) {
|
||||
set_should_persist_session_cookies(true);
|
||||
}
|
||||
|
||||
key_ = std::make_unique<ProfileKey>(cache_path_);
|
||||
key_ = std::make_unique<ProfileKey>(GetPath());
|
||||
SimpleKeyMap::GetInstance()->Associate(this, key_.get());
|
||||
|
||||
// Initialize the PrefService object.
|
||||
pref_service_ = browser_prefs::CreatePrefService(
|
||||
this, cache_path_, !!settings_.persist_user_preferences);
|
||||
|
||||
content::BrowserContext::Initialize(this, cache_path_);
|
||||
content::BrowserContext::Initialize(this, GetPath());
|
||||
|
||||
resource_context_.reset(new CefResourceContext(IsOffTheRecord()));
|
||||
|
||||
|
@@ -296,7 +296,7 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
~CefBrowserContext() override;
|
||||
|
||||
// Members initialized during construction are safe to access from any thread.
|
||||
const CefRequestContextSettings settings_;
|
||||
CefRequestContextSettings settings_;
|
||||
base::FilePath cache_path_;
|
||||
|
||||
// CefRequestContextImpl objects referencing this object.
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/audio_capturer.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_info.h"
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
@@ -16,7 +15,8 @@
|
||||
#include "libcef/browser/browser_util.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools/devtools_manager.h"
|
||||
#include "libcef/browser/devtools/devtools_frontend.h"
|
||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "libcef/browser/extensions/extension_background_host.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
@@ -47,8 +47,6 @@
|
||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "components/favicon/core/favicon_url.h"
|
||||
#include "components/spellcheck/common/spellcheck_features.h"
|
||||
#include "components/zoom/zoom_controller.h"
|
||||
#include "content/browser/gpu/compositor_util.h"
|
||||
#include "content/browser/web_contents/web_contents_impl.h"
|
||||
@@ -71,6 +69,7 @@
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/favicon_url.h"
|
||||
#include "extensions/browser/process_manager.h"
|
||||
#include "net/base/net_errors.h"
|
||||
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
|
||||
@@ -194,9 +193,6 @@ void OnDownloadImage(uint32 max_image_size,
|
||||
image_impl.get());
|
||||
}
|
||||
|
||||
static constexpr base::TimeDelta kRecentlyAudibleTimeout =
|
||||
base::TimeDelta::FromSeconds(2);
|
||||
|
||||
} // namespace
|
||||
|
||||
// CefBrowserHost static methods.
|
||||
@@ -551,6 +547,26 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::GetBrowserForFrameRoute(
|
||||
// CefBrowserHostImpl methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// WebContentsObserver that will be notified when the frontend WebContents is
|
||||
// destroyed so that the inspected browser can clear its DevTools references.
|
||||
class CefBrowserHostImpl::DevToolsWebContentsObserver
|
||||
: public content::WebContentsObserver {
|
||||
public:
|
||||
DevToolsWebContentsObserver(CefBrowserHostImpl* browser,
|
||||
content::WebContents* frontend_web_contents)
|
||||
: WebContentsObserver(frontend_web_contents), browser_(browser) {}
|
||||
|
||||
// WebContentsObserver methods:
|
||||
void WebContentsDestroyed() override {
|
||||
browser_->OnDevToolsWebContentsDestroyed();
|
||||
}
|
||||
|
||||
private:
|
||||
CefBrowserHostImpl* browser_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DevToolsWebContentsObserver);
|
||||
};
|
||||
|
||||
CefBrowserHostImpl::~CefBrowserHostImpl() {}
|
||||
|
||||
CefRefPtr<CefBrowser> CefBrowserHostImpl::GetBrowser() {
|
||||
@@ -843,29 +859,39 @@ void CefBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!web_contents())
|
||||
return;
|
||||
|
||||
if (devtools_frontend_) {
|
||||
if (!inspect_element_at.IsEmpty()) {
|
||||
devtools_frontend_->InspectElementAt(inspect_element_at.x,
|
||||
inspect_element_at.y);
|
||||
}
|
||||
devtools_frontend_->Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
devtools_frontend_ = CefDevToolsFrontend::Show(
|
||||
this, windowInfo, client, settings, inspect_element_at);
|
||||
devtools_observer_.reset(new DevToolsWebContentsObserver(
|
||||
this, devtools_frontend_->frontend_browser()->web_contents()));
|
||||
} else {
|
||||
ShowDevToolsHelper* helper = new ShowDevToolsHelper(
|
||||
this, windowInfo, client, settings, inspect_element_at);
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(ShowDevToolsWithHelper, helper));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return;
|
||||
devtools_manager_->ShowDevTools(windowInfo, client, settings,
|
||||
inspect_element_at);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::CloseDevTools() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!devtools_frontend_)
|
||||
return;
|
||||
devtools_frontend_->Close();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::CloseDevTools, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!devtools_manager_)
|
||||
return;
|
||||
devtools_manager_->CloseDevTools();
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::HasDevTools() {
|
||||
@@ -874,84 +900,7 @@ bool CefBrowserHostImpl::HasDevTools() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!devtools_manager_)
|
||||
return false;
|
||||
return devtools_manager_->HasDevTools();
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::SendDevToolsMessage(const void* message,
|
||||
size_t message_size) {
|
||||
if (!message || message_size == 0)
|
||||
return false;
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
std::string message_str(static_cast<const char*>(message), message_size);
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(
|
||||
[](CefRefPtr<CefBrowserHostImpl> self, std::string message_str) {
|
||||
self->SendDevToolsMessage(message_str.data(), message_str.size());
|
||||
},
|
||||
CefRefPtr<CefBrowserHostImpl>(this), std::move(message_str)));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return false;
|
||||
return devtools_manager_->SendDevToolsMessage(message, message_size);
|
||||
}
|
||||
|
||||
int CefBrowserHostImpl::ExecuteDevToolsMethod(
|
||||
int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::BindOnce(base::IgnoreResult(
|
||||
&CefBrowserHostImpl::ExecuteDevToolsMethod),
|
||||
this, message_id, method, params));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return 0;
|
||||
return devtools_manager_->ExecuteDevToolsMethod(message_id, method, params);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRegistration> CefBrowserHostImpl::AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) {
|
||||
if (!observer)
|
||||
return nullptr;
|
||||
auto registration = CefDevToolsManager::CreateRegistration(observer);
|
||||
InitializeDevToolsRegistrationOnUIThread(registration);
|
||||
return registration.get();
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::EnsureDevToolsManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!web_contents())
|
||||
return false;
|
||||
|
||||
if (!devtools_manager_) {
|
||||
devtools_manager_.reset(new CefDevToolsManager(this));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::InitializeDevToolsRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(
|
||||
&CefBrowserHostImpl::InitializeDevToolsRegistrationOnUIThread, this,
|
||||
registration));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return;
|
||||
devtools_manager_->InitializeRegistrationOnUIThread(registration);
|
||||
return (devtools_frontend_ != nullptr);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::GetNavigationEntries(
|
||||
@@ -1107,18 +1056,16 @@ void CefBrowserHostImpl::AddWordToDictionary(const CefString& word) {
|
||||
if (!web_contents())
|
||||
return;
|
||||
|
||||
SpellcheckService* spellcheck = nullptr;
|
||||
content::BrowserContext* browser_context =
|
||||
web_contents()->GetBrowserContext();
|
||||
if (browser_context) {
|
||||
spellcheck = SpellcheckServiceFactory::GetForContext(browser_context);
|
||||
SpellcheckService* spellcheck =
|
||||
SpellcheckServiceFactory::GetForContext(browser_context);
|
||||
if (spellcheck)
|
||||
spellcheck->GetCustomDictionary()->AddWord(word);
|
||||
}
|
||||
#if defined(OS_MACOSX)
|
||||
if (spellcheck && spellcheck::UseBrowserSpellChecker()) {
|
||||
spellcheck_platform::AddWord(spellcheck->platform_spell_checker(), word);
|
||||
}
|
||||
spellcheck_platform::AddWord(word);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1609,12 +1556,6 @@ void CefBrowserHostImpl::DestroyBrowser() {
|
||||
javascript_dialog_manager_.reset(nullptr);
|
||||
menu_manager_.reset(nullptr);
|
||||
|
||||
// Delete the audio capturer
|
||||
recently_audible_timer_.Stop();
|
||||
audio_capturer_.reset(nullptr);
|
||||
|
||||
devtools_manager_.reset(nullptr);
|
||||
|
||||
// Delete the platform delegate.
|
||||
platform_delegate_.reset(nullptr);
|
||||
|
||||
@@ -1767,9 +1708,9 @@ void CefBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
|
||||
|
||||
void CefBrowserHostImpl::RunFileChooser(
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
CefFileDialogRunner::RunFileChooserCallback callback) {
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback) {
|
||||
EnsureFileDialogManager();
|
||||
file_dialog_manager_->RunFileChooser(params, std::move(callback));
|
||||
file_dialog_manager_->RunFileChooser(params, callback);
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::EmbedsFullscreenWidget() {
|
||||
@@ -2526,9 +2467,9 @@ bool CefBrowserHostImpl::CheckMediaAccessPermission(
|
||||
return command_line->HasSwitch(switches::kEnableMediaStream);
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::IsNeverComposited(content::WebContents* web_contents) {
|
||||
bool CefBrowserHostImpl::IsNeverVisible(content::WebContents* web_contents) {
|
||||
if (extension_host_)
|
||||
return extension_host_->IsNeverComposited(web_contents);
|
||||
return extension_host_->IsNeverVisible(web_contents);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2703,24 +2644,17 @@ void CefBrowserHostImpl::DidStopLoading() {
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DocumentAvailableInMainFrame() {
|
||||
{
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
has_document_ = true;
|
||||
}
|
||||
|
||||
if (client_) {
|
||||
CefRefPtr<CefRequestHandler> handler = client_->GetRequestHandler();
|
||||
if (handler)
|
||||
handler->OnDocumentAvailableInMainFrame(this);
|
||||
}
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
has_document_ = true;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidFailLoad(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url,
|
||||
int error_code) {
|
||||
// The navigation failed after commit. OnLoadStart was called so we also
|
||||
// call OnLoadEnd.
|
||||
int error_code,
|
||||
const base::string16& error_description) {
|
||||
// The navigation failed after commit. OnLoadStart was called so we also call
|
||||
// OnLoadEnd.
|
||||
auto frame = browser_info_->GetFrameForHost(render_frame_host);
|
||||
frame->RefreshAttributes();
|
||||
OnLoadError(frame, validated_url, error_code);
|
||||
@@ -2746,14 +2680,15 @@ void CefBrowserHostImpl::PluginCrashed(const base::FilePath& plugin_path,
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidUpdateFaviconURL(
|
||||
const std::vector<blink::mojom::FaviconURLPtr>& candidates) {
|
||||
const std::vector<content::FaviconURL>& candidates) {
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
||||
if (handler.get()) {
|
||||
std::vector<CefString> icon_urls;
|
||||
for (const auto& icon : candidates) {
|
||||
if (icon->icon_type == blink::mojom::FaviconIconType::kFavicon)
|
||||
icon_urls.push_back(icon->icon_url.spec());
|
||||
std::vector<content::FaviconURL>::const_iterator it = candidates.begin();
|
||||
for (; it != candidates.end(); ++it) {
|
||||
if (it->icon_type == content::FaviconURL::IconType::kFavicon)
|
||||
icon_urls.push_back(it->icon_url.spec());
|
||||
}
|
||||
if (!icon_urls.empty())
|
||||
handler->OnFaviconURLChange(this, icon_urls);
|
||||
@@ -2761,25 +2696,6 @@ void CefBrowserHostImpl::DidUpdateFaviconURL(
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnAudioStateChanged(bool audible) {
|
||||
if (audible) {
|
||||
recently_audible_timer_.Stop();
|
||||
StartAudioCapturer();
|
||||
} else if (audio_capturer_) {
|
||||
// If you have a media playing that has a short quiet moment, web_contents
|
||||
// will immediately switch to non-audible state. We don't want to stop
|
||||
// audio stream so quickly, let's give the stream some time to resume
|
||||
// playing.
|
||||
recently_audible_timer_.Start(
|
||||
FROM_HERE, kRecentlyAudibleTimeout,
|
||||
base::BindOnce(&CefBrowserHostImpl::OnRecentlyAudibleTimerFired, this));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnRecentlyAudibleTimerFired() {
|
||||
audio_capturer_.reset();
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::OnMessageReceived(const IPC::Message& message) {
|
||||
// Handle the cursor message here if mouse cursor change is disabled instead
|
||||
// of propegating the message to the normal handler.
|
||||
@@ -2875,25 +2791,6 @@ bool CefBrowserHostImpl::HasObserver(Observer* observer) const {
|
||||
return observers_.HasObserver(observer);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::StartAudioCapturer() {
|
||||
if (!client_.get() || audio_capturer_)
|
||||
return;
|
||||
|
||||
CefRefPtr<CefAudioHandler> audio_handler = client_->GetAudioHandler();
|
||||
if (!audio_handler.get())
|
||||
return;
|
||||
|
||||
CefAudioParameters params;
|
||||
params.channel_layout = CEF_CHANNEL_LAYOUT_STEREO;
|
||||
params.sample_rate = media::AudioParameters::kAudioCDSampleRate;
|
||||
params.frames_per_buffer = 1024;
|
||||
|
||||
if (!audio_handler->GetAudioParameters(this, params))
|
||||
return;
|
||||
|
||||
audio_capturer_.reset(new CefAudioCapturer(params, this, audio_handler));
|
||||
}
|
||||
|
||||
CefBrowserHostImpl::NavigationLock::NavigationLock(
|
||||
CefRefPtr<CefBrowserHostImpl> browser)
|
||||
: browser_(browser) {
|
||||
@@ -2965,6 +2862,18 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
||||
platform_delegate_(std::move(platform_delegate)),
|
||||
is_windowless_(platform_delegate_->IsWindowless()),
|
||||
is_views_hosted_(platform_delegate_->IsViewsHosted()),
|
||||
host_window_handle_(kNullWindowHandle),
|
||||
is_loading_(false),
|
||||
can_go_back_(false),
|
||||
can_go_forward_(false),
|
||||
has_document_(false),
|
||||
is_fullscreen_(false),
|
||||
destruction_state_(DESTRUCTION_STATE_NONE),
|
||||
window_destroyed_(false),
|
||||
is_in_onsetfocus_(false),
|
||||
focus_on_editable_field_(false),
|
||||
mouse_cursor_change_disabled_(false),
|
||||
devtools_frontend_(nullptr),
|
||||
extension_(extension) {
|
||||
if (opener.get() && !platform_delegate_->IsViewsHosted()) {
|
||||
// GetOpenerWindowHandle() only returns a value for non-views-hosted
|
||||
@@ -3175,6 +3084,11 @@ void CefBrowserHostImpl::OnTitleChange(const base::string16& title) {
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnDevToolsWebContentsDestroyed() {
|
||||
devtools_observer_.reset();
|
||||
devtools_frontend_ = nullptr;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::EnsureFileDialogManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!file_dialog_manager_.get() && platform_delegate_) {
|
||||
|
@@ -48,10 +48,9 @@ class Widget;
|
||||
}
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
class CefAudioCapturer;
|
||||
class CefBrowserInfo;
|
||||
class CefBrowserPlatformDelegate;
|
||||
class CefDevToolsManager;
|
||||
class CefDevToolsFrontend;
|
||||
class SiteInstance;
|
||||
|
||||
// Implementation of CefBrowser.
|
||||
@@ -192,12 +191,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
const CefPoint& inspect_element_at) override;
|
||||
void CloseDevTools() override;
|
||||
bool HasDevTools() override;
|
||||
bool SendDevToolsMessage(const void* message, size_t message_size) override;
|
||||
int ExecuteDevToolsMethod(int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) override;
|
||||
CefRefPtr<CefRegistration> AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) override;
|
||||
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
|
||||
bool current_only) override;
|
||||
void SetMouseCursorChangeDisabled(bool disabled) override;
|
||||
@@ -358,8 +351,9 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// Run the file chooser dialog specified by |params|. Only a single dialog may
|
||||
// be pending at any given time. |callback| will be executed asynchronously
|
||||
// after the dialog is dismissed or if another dialog is already pending.
|
||||
void RunFileChooser(const CefFileDialogRunner::FileChooserParams& params,
|
||||
CefFileDialogRunner::RunFileChooserCallback callback);
|
||||
void RunFileChooser(
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback);
|
||||
|
||||
bool HandleContextMenu(content::WebContents* web_contents,
|
||||
const content::ContextMenuParams& params);
|
||||
@@ -464,7 +458,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
|
||||
const GURL& security_origin,
|
||||
blink::mojom::MediaStreamType type) override;
|
||||
bool IsNeverComposited(content::WebContents* web_contents) override;
|
||||
bool IsNeverVisible(content::WebContents* web_contents) override;
|
||||
content::PictureInPictureResult EnterPictureInPicture(
|
||||
content::WebContents* web_contents,
|
||||
const viz::SurfaceId& surface_id,
|
||||
@@ -487,13 +481,13 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void DocumentAvailableInMainFrame() override;
|
||||
void DidFailLoad(content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url,
|
||||
int error_code) override;
|
||||
int error_code,
|
||||
const base::string16& error_description) override;
|
||||
void TitleWasSet(content::NavigationEntry* entry) override;
|
||||
void PluginCrashed(const base::FilePath& plugin_path,
|
||||
base::ProcessId plugin_pid) override;
|
||||
void DidUpdateFaviconURL(
|
||||
const std::vector<blink::mojom::FaviconURLPtr>& candidates) override;
|
||||
void OnAudioStateChanged(bool audible) override;
|
||||
const std::vector<content::FaviconURL>& candidates) override;
|
||||
bool OnMessageReceived(const IPC::Message& message) override;
|
||||
bool OnMessageReceived(const IPC::Message& message,
|
||||
content::RenderFrameHost* render_frame_host) override;
|
||||
@@ -513,7 +507,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void AddObserver(Observer* observer);
|
||||
void RemoveObserver(Observer* observer);
|
||||
bool HasObserver(Observer* observer) const;
|
||||
|
||||
class NavigationLock final {
|
||||
private:
|
||||
friend class CefBrowserHostImpl;
|
||||
@@ -529,6 +522,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
std::unique_ptr<NavigationLock> CreateNavigationLock();
|
||||
|
||||
private:
|
||||
class DevToolsWebContentsObserver;
|
||||
|
||||
static CefRefPtr<CefBrowserHostImpl> CreateInternal(
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
@@ -585,19 +580,13 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void OnFullscreenModeChange(bool fullscreen);
|
||||
void OnTitleChange(const base::string16& title);
|
||||
|
||||
void OnDevToolsWebContentsDestroyed();
|
||||
|
||||
// Create the CefFileDialogManager if it doesn't already exist.
|
||||
void EnsureFileDialogManager();
|
||||
|
||||
void ConfigureAutoResize();
|
||||
|
||||
void StartAudioCapturer();
|
||||
|
||||
void OnRecentlyAudibleTimerFired();
|
||||
|
||||
bool EnsureDevToolsManager();
|
||||
void InitializeDevToolsRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration);
|
||||
|
||||
CefBrowserSettings settings_;
|
||||
CefRefPtr<CefClient> client_;
|
||||
scoped_refptr<CefBrowserInfo> browser_info_;
|
||||
@@ -606,7 +595,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate_;
|
||||
const bool is_windowless_;
|
||||
const bool is_views_hosted_;
|
||||
CefWindowHandle host_window_handle_ = kNullWindowHandle;
|
||||
CefWindowHandle host_window_handle_;
|
||||
|
||||
// Non-nullptr if this object owns the WebContents. Will be nullptr for popup
|
||||
// browsers between the calls to WebContentsCreated() and AddNewContents(),
|
||||
@@ -616,18 +605,18 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
|
||||
// Volatile state information. All access must be protected by the state lock.
|
||||
base::Lock state_lock_;
|
||||
bool is_loading_ = false;
|
||||
bool can_go_back_ = false;
|
||||
bool can_go_forward_ = false;
|
||||
bool has_document_ = false;
|
||||
bool is_fullscreen_ = false;
|
||||
bool is_loading_;
|
||||
bool can_go_back_;
|
||||
bool can_go_forward_;
|
||||
bool has_document_;
|
||||
bool is_fullscreen_;
|
||||
|
||||
// The currently focused frame, or nullptr if the main frame is focused.
|
||||
CefRefPtr<CefFrameHostImpl> focused_frame_;
|
||||
|
||||
// Represents the current browser destruction state. Only accessed on the UI
|
||||
// thread.
|
||||
DestructionState destruction_state_ = DESTRUCTION_STATE_NONE;
|
||||
DestructionState destruction_state_;
|
||||
|
||||
// Navigation will not occur while |navigation_lock_count_| > 0.
|
||||
// |pending_navigation_action_| will be executed when the lock is released.
|
||||
@@ -637,18 +626,18 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
|
||||
// True if the OS window hosting the browser has been destroyed. Only accessed
|
||||
// on the UI thread.
|
||||
bool window_destroyed_ = false;
|
||||
bool window_destroyed_;
|
||||
|
||||
// True if currently in the OnSetFocus callback. Only accessed on the UI
|
||||
// thread.
|
||||
bool is_in_onsetfocus_ = false;
|
||||
bool is_in_onsetfocus_;
|
||||
|
||||
// True if the focus is currently on an editable field on the page. Only
|
||||
// accessed on the UI thread.
|
||||
bool focus_on_editable_field_ = false;
|
||||
bool focus_on_editable_field_;
|
||||
|
||||
// True if mouse cursor change is disabled.
|
||||
bool mouse_cursor_change_disabled_ = false;
|
||||
bool mouse_cursor_change_disabled_;
|
||||
|
||||
// Used for managing notification subscriptions.
|
||||
std::unique_ptr<content::NotificationRegistrar> registrar_;
|
||||
@@ -662,8 +651,12 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// Used for creating and managing context menus.
|
||||
std::unique_ptr<CefMenuManager> menu_manager_;
|
||||
|
||||
// Used for creating and managing DevTools instances.
|
||||
std::unique_ptr<CefDevToolsManager> devtools_manager_;
|
||||
// Track the lifespan of the frontend WebContents associated with this
|
||||
// browser.
|
||||
std::unique_ptr<DevToolsWebContentsObserver> devtools_observer_;
|
||||
// CefDevToolsFrontend will delete itself when the frontend WebContents is
|
||||
// destroyed.
|
||||
CefDevToolsFrontend* devtools_frontend_;
|
||||
|
||||
// Observers that want to be notified of changes to this object.
|
||||
base::ObserverList<Observer>::Unchecked observers_;
|
||||
@@ -676,14 +669,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
CefRefPtr<CefExtension> extension_;
|
||||
bool is_background_host_ = false;
|
||||
|
||||
// Used for capturing audio for CefAudioHandler.
|
||||
std::unique_ptr<CefAudioCapturer> audio_capturer_;
|
||||
|
||||
// Timer for determining when "recently audible" transitions to false. This
|
||||
// starts running when a tab stops being audible, and is canceled if it starts
|
||||
// being audible again before it fires.
|
||||
base::OneShotTimer recently_audible_timer_;
|
||||
|
||||
// Used with auto-resize.
|
||||
bool auto_resize_enabled_ = false;
|
||||
gfx::Size auto_resize_min_;
|
||||
|
@@ -32,11 +32,11 @@
|
||||
#include "chrome/browser/plugins/plugin_finder.h"
|
||||
#include "components/constrained_window/constrained_window_views.h"
|
||||
#include "content/public/browser/gpu_data_manager.h"
|
||||
#include "content/public/browser/network_service_instance.h"
|
||||
#include "extensions/browser/extension_system.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/base/net_module.h"
|
||||
#include "services/service_manager/embedder/result_codes.h"
|
||||
#include "ui/base/material_design/material_design_controller.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
#if defined(USE_AURA) && defined(USE_X11)
|
||||
@@ -51,8 +51,6 @@
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "chrome/browser/chrome_browser_main_win.h"
|
||||
#include "chrome/browser/win/parental_controls.h"
|
||||
#include "components/os_crypt/os_crypt.h"
|
||||
#include "ui/base/cursor/cursor_loader_win.h"
|
||||
#endif
|
||||
#endif // defined(USE_AURA)
|
||||
@@ -74,6 +72,11 @@
|
||||
#include "libcef/browser/printing/print_dialog_linux.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "components/os_crypt/os_crypt.h"
|
||||
#endif
|
||||
|
||||
CefBrowserMainParts::CefBrowserMainParts(
|
||||
const content::MainFunctionParams& parameters)
|
||||
: BrowserMainParts(), devtools_delegate_(nullptr) {}
|
||||
@@ -120,13 +123,14 @@ void CefBrowserMainParts::PreMainMessageLoopStart() {
|
||||
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
// Initialize the OSCrypt.
|
||||
PrefService* local_state = g_browser_process->local_state();
|
||||
DCHECK(local_state);
|
||||
bool os_crypt_init = OSCrypt::Init(local_state);
|
||||
DCHECK(os_crypt_init);
|
||||
OSCrypt::Init(local_state);
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// installer_util references strings that are normally compiled into
|
||||
// setup.exe. In Chrome, these strings are in the locale files.
|
||||
ChromeBrowserMainPartsWin::SetupInstallerUtilStrings();
|
||||
@@ -162,6 +166,8 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
||||
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
|
||||
#endif
|
||||
|
||||
ui::MaterialDesignController::Initialize();
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
// Initialize extension global objects before creating the global
|
||||
// BrowserContext.
|
||||
@@ -191,7 +197,7 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||
|
||||
CefRequestContextSettings settings;
|
||||
CefContext::Get()->PopulateGlobalRequestContextSettings(&settings);
|
||||
CefContext::Get()->PopulateRequestContextSettings(&settings);
|
||||
|
||||
// Create the global RequestContext.
|
||||
global_request_context_ =
|
||||
@@ -201,12 +207,6 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
||||
|
||||
CefDevToolsManagerDelegate::StartHttpHandler(browser_context);
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Windows parental controls calls can be slow, so we do an early init here
|
||||
// that calculates this value off of the UI thread.
|
||||
InitializeWinParentalControls();
|
||||
#endif
|
||||
|
||||
// Triggers initialization of the singleton instance on UI thread.
|
||||
PluginFinder::GetInstance()->Init();
|
||||
|
||||
|
@@ -34,17 +34,11 @@ class MessagePumpExternal : public base::MessagePumpForUI {
|
||||
base::mac::ScopedNSAutoreleasePool autorelease_pool;
|
||||
#endif
|
||||
|
||||
base::TimeTicks next_run_time; // is_null()
|
||||
const bool has_more_work = DirectRunWork(delegate, &next_run_time);
|
||||
const bool has_more_work = DirectRunWork(delegate);
|
||||
if (!has_more_work)
|
||||
break;
|
||||
|
||||
if (next_run_time.is_null()) {
|
||||
// We have more work that should run immediately.
|
||||
next_run_time = base::TimeTicks::Now();
|
||||
}
|
||||
|
||||
const base::TimeDelta& delta = next_run_time - start;
|
||||
const base::TimeDelta& delta = base::TimeTicks::Now() - start;
|
||||
if (delta.InSecondsF() > max_time_slice_)
|
||||
break;
|
||||
}
|
||||
@@ -60,31 +54,26 @@ class MessagePumpExternal : public base::MessagePumpForUI {
|
||||
}
|
||||
|
||||
private:
|
||||
static bool DirectRunWork(Delegate* delegate,
|
||||
base::TimeTicks* next_run_time) {
|
||||
bool more_immediate_work = false;
|
||||
bool more_idle_work = false;
|
||||
bool more_delayed_work = false;
|
||||
bool DirectRunWork(Delegate* delegate) {
|
||||
bool did_work = false;
|
||||
bool did_delayed_work = false;
|
||||
bool did_idle_work = false;
|
||||
|
||||
Delegate::NextWorkInfo next_work_info = delegate->DoWork();
|
||||
// Perform work & delayed work.
|
||||
// If no work was found, then perform idle work.
|
||||
|
||||
// is_immediate() returns true if the next task is ready right away.
|
||||
more_immediate_work = next_work_info.is_immediate();
|
||||
if (!more_immediate_work) {
|
||||
// DoIdleWork() returns true if idle work was all done.
|
||||
more_idle_work = !delegate->DoIdleWork();
|
||||
did_work = delegate->DoWork();
|
||||
|
||||
// Check the next PendingTask's |delayed_run_time|.
|
||||
// is_max() returns true if there are no more immediate nor delayed tasks.
|
||||
more_delayed_work = !next_work_info.delayed_run_time.is_max();
|
||||
if (more_delayed_work && !more_idle_work) {
|
||||
// The only remaining work that we know about is the PendingTask.
|
||||
// Consider the run time for that task in the time slice calculation.
|
||||
*next_run_time = next_work_info.delayed_run_time;
|
||||
}
|
||||
// We are using an external timer, so we don't have any action based on the
|
||||
// returned next delayed work time.
|
||||
base::TimeTicks next_time;
|
||||
did_delayed_work = delegate->DoDelayedWork(&next_time);
|
||||
|
||||
if (!did_work && !did_delayed_work) {
|
||||
did_idle_work = delegate->DoIdleWork();
|
||||
}
|
||||
|
||||
return more_immediate_work || more_idle_work || more_delayed_work;
|
||||
return did_work || did_delayed_work || did_idle_work;
|
||||
}
|
||||
|
||||
const float max_time_slice_;
|
||||
|
@@ -157,17 +157,15 @@ ProfileManager* ChromeBrowserProcessStub::profile_manager() {
|
||||
PrefService* ChromeBrowserProcessStub::local_state() {
|
||||
DCHECK(initialized_);
|
||||
if (!local_state_) {
|
||||
// Use a location that is shared by all request contexts.
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
const base::FilePath& root_cache_path =
|
||||
base::FilePath(CefString(&settings.root_cache_path));
|
||||
const base::FilePath& cache_path =
|
||||
base::FilePath(CefString(&settings.cache_path));
|
||||
|
||||
// Used for very early NetworkService initialization.
|
||||
// Always persist preferences for this PrefService if possible because it
|
||||
// contains the cookie encryption key on Windows.
|
||||
local_state_ =
|
||||
browser_prefs::CreatePrefService(nullptr /* profile */, root_cache_path,
|
||||
true /* persist_user_preferences */);
|
||||
local_state_ = browser_prefs::CreatePrefService(
|
||||
nullptr /* profile */, cache_path, true /* persist_user_preferences */);
|
||||
}
|
||||
return local_state_.get();
|
||||
}
|
||||
@@ -374,8 +372,3 @@ ChromeBrowserProcessStub::resource_coordinator_parts() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BuildState* ChromeBrowserProcessStub::GetBuildState() {
|
||||
NOTREACHED();
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -98,7 +98,6 @@ class ChromeBrowserProcessStub : public BrowserProcess {
|
||||
resource_coordinator::TabManager* GetTabManager() override;
|
||||
resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
|
||||
override;
|
||||
BuildState* GetBuildState() override;
|
||||
|
||||
private:
|
||||
bool initialized_;
|
||||
|
@@ -5,35 +5,9 @@
|
||||
|
||||
#include "libcef/browser/chrome_profile_stub.h"
|
||||
|
||||
#include "components/variations/variations_client.h"
|
||||
#include "components/variations/variations_http_header_provider.h"
|
||||
#include "content/public/browser/resource_context.h"
|
||||
#include "net/url_request/url_request_context.h"
|
||||
|
||||
namespace {
|
||||
|
||||
class CefVariationsClient : public variations::VariationsClient {
|
||||
public:
|
||||
explicit CefVariationsClient(content::BrowserContext* browser_context)
|
||||
: browser_context_(browser_context) {}
|
||||
|
||||
~CefVariationsClient() override = default;
|
||||
|
||||
bool IsIncognito() const override {
|
||||
return browser_context_->IsOffTheRecord();
|
||||
}
|
||||
|
||||
std::string GetVariationsHeader() const override {
|
||||
return variations::VariationsHttpHeaderProvider::GetInstance()
|
||||
->GetClientDataHeader(false /* is_signed_in */);
|
||||
}
|
||||
|
||||
private:
|
||||
content::BrowserContext* browser_context_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
ChromeProfileStub::ChromeProfileStub() {}
|
||||
|
||||
ChromeProfileStub::~ChromeProfileStub() {}
|
||||
@@ -46,12 +20,6 @@ bool ChromeProfileStub::IsOffTheRecord() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
variations::VariationsClient* ChromeProfileStub::GetVariationsClient() {
|
||||
if (!variations_client_)
|
||||
variations_client_ = std::make_unique<CefVariationsClient>(this);
|
||||
return variations_client_.get();
|
||||
}
|
||||
|
||||
scoped_refptr<base::SequencedTaskRunner> ChromeProfileStub::GetIOTaskRunner() {
|
||||
NOTREACHED();
|
||||
return scoped_refptr<base::SequencedTaskRunner>();
|
||||
|
@@ -22,7 +22,6 @@ class ChromeProfileStub : public Profile {
|
||||
// Profile methods.
|
||||
bool IsOffTheRecord() override;
|
||||
bool IsOffTheRecord() const override;
|
||||
variations::VariationsClient* GetVariationsClient() override;
|
||||
scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override;
|
||||
std::string GetProfileUserName() const override;
|
||||
ProfileType GetProfileType() const override;
|
||||
@@ -49,8 +48,6 @@ class ChromeProfileStub : public Profile {
|
||||
void SetCreationTimeForTesting(base::Time creation_time) override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<variations::VariationsClient> variations_client_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ChromeProfileStub);
|
||||
};
|
||||
|
||||
|
@@ -77,6 +77,7 @@
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/browser_ppapi_host.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "content/public/browser/client_certificate_delegate.h"
|
||||
#include "content/public/browser/navigation_handle.h"
|
||||
#include "content/public/browser/overlay_window.h"
|
||||
@@ -101,7 +102,6 @@
|
||||
#include "extensions/browser/extensions_browser_client.h"
|
||||
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
|
||||
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
|
||||
#include "extensions/browser/url_loader_factory_manager.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/switches.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
@@ -115,8 +115,6 @@
|
||||
#include "services/service_manager/public/mojom/connector.mojom.h"
|
||||
#include "services/service_manager/sandbox/switches.h"
|
||||
#include "storage/browser/quota/quota_settings.h"
|
||||
#include "third_party/blink/public/mojom/insecure_input/insecure_input_service.mojom.h"
|
||||
#include "third_party/blink/public/mojom/prerender/prerender.mojom.h"
|
||||
#include "third_party/blink/public/web/web_window_features.h"
|
||||
#include "third_party/widevine/cdm/buildflags.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
@@ -131,13 +129,14 @@
|
||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||
#include "base/debug/leak_annotations.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "components/crash/content/app/breakpad_linux.h"
|
||||
#include "components/crash/content/browser/crash_handler_host_linux.h"
|
||||
#include "components/crash/core/app/breakpad_linux.h"
|
||||
#include "content/public/common/content_descriptors.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include "net/ssl/client_cert_store_mac.h"
|
||||
#include "services/audio/public/mojom/constants.mojom.h"
|
||||
#include "services/video_capture/public/mojom/constants.mojom.h"
|
||||
#endif
|
||||
|
||||
@@ -158,19 +157,18 @@ namespace {
|
||||
|
||||
class CefQuotaCallbackImpl : public CefRequestCallback {
|
||||
public:
|
||||
using CallbackType = content::QuotaPermissionContext::PermissionCallback;
|
||||
|
||||
explicit CefQuotaCallbackImpl(CallbackType callback)
|
||||
: callback_(std::move(callback)) {}
|
||||
explicit CefQuotaCallbackImpl(
|
||||
const content::QuotaPermissionContext::PermissionCallback& callback)
|
||||
: callback_(callback) {}
|
||||
|
||||
~CefQuotaCallbackImpl() {
|
||||
if (!callback_.is_null()) {
|
||||
// The callback is still pending. Cancel it now.
|
||||
if (CEF_CURRENTLY_ON_IOT()) {
|
||||
RunNow(std::move(callback_), false);
|
||||
RunNow(callback_, false);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefQuotaCallbackImpl::RunNow,
|
||||
std::move(callback_), false));
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefQuotaCallbackImpl::RunNow,
|
||||
callback_, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,28 +176,31 @@ class CefQuotaCallbackImpl : public CefRequestCallback {
|
||||
void Continue(bool allow) override {
|
||||
if (CEF_CURRENTLY_ON_IOT()) {
|
||||
if (!callback_.is_null()) {
|
||||
RunNow(std::move(callback_), allow);
|
||||
RunNow(callback_, allow);
|
||||
callback_.Reset();
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefQuotaCallbackImpl::Continue,
|
||||
this, allow));
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefQuotaCallbackImpl::Continue, this, allow));
|
||||
}
|
||||
}
|
||||
|
||||
void Cancel() override { Continue(false); }
|
||||
|
||||
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
void Disconnect() { callback_.Reset(); }
|
||||
|
||||
private:
|
||||
static void RunNow(CallbackType callback, bool allow) {
|
||||
static void RunNow(
|
||||
const content::QuotaPermissionContext::PermissionCallback& callback,
|
||||
bool allow) {
|
||||
CEF_REQUIRE_IOT();
|
||||
std::move(callback).Run(
|
||||
callback.Run(
|
||||
allow ? content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_ALLOW
|
||||
: content::QuotaPermissionContext::
|
||||
QUOTA_PERMISSION_RESPONSE_DISALLOW);
|
||||
}
|
||||
|
||||
CallbackType callback_;
|
||||
content::QuotaPermissionContext::PermissionCallback callback_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefQuotaCallbackImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefQuotaCallbackImpl);
|
||||
@@ -281,10 +282,9 @@ class CefSelectClientCertificateCallbackImpl
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
RunNow(std::move(delegate_), cert);
|
||||
} else {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefSelectClientCertificateCallbackImpl::RunNow,
|
||||
std::move(delegate_), cert));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefSelectClientCertificateCallbackImpl::RunNow,
|
||||
base::Passed(std::move(delegate_)), cert));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -296,9 +296,9 @@ class CefSelectClientCertificateCallbackImpl
|
||||
if (cert) {
|
||||
CefX509CertificateImpl* certImpl =
|
||||
static_cast<CefX509CertificateImpl*>(cert.get());
|
||||
certImpl->AcquirePrivateKey(base::BindOnce(
|
||||
&CefSelectClientCertificateCallbackImpl::RunWithPrivateKey,
|
||||
std::move(delegate), cert));
|
||||
certImpl->AcquirePrivateKey(
|
||||
base::Bind(&CefSelectClientCertificateCallbackImpl::RunWithPrivateKey,
|
||||
base::Passed(std::move(delegate)), cert));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -334,11 +334,11 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||
// The callback will be dispatched on the IO thread.
|
||||
void RequestQuotaPermission(const content::StorageQuotaParams& params,
|
||||
int render_process_id,
|
||||
PermissionCallback callback) override {
|
||||
const PermissionCallback& callback) override {
|
||||
if (params.storage_type != blink::mojom::StorageType::kPersistent) {
|
||||
// To match Chrome behavior we only support requesting quota with this
|
||||
// interface for Persistent storage type.
|
||||
std::move(callback).Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
|
||||
callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -353,22 +353,19 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefQuotaCallbackImpl> callbackImpl(
|
||||
new CefQuotaCallbackImpl(std::move(callback)));
|
||||
new CefQuotaCallbackImpl(callback));
|
||||
handled = handler->OnQuotaRequest(
|
||||
browser.get(), params.origin_url.spec(), params.requested_size,
|
||||
callbackImpl.get());
|
||||
if (!handled) {
|
||||
// May return nullptr if the client has already executed the
|
||||
// callback.
|
||||
callback = callbackImpl->Disconnect();
|
||||
}
|
||||
if (!handled)
|
||||
callbackImpl->Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!handled && !callback.is_null()) {
|
||||
if (!handled) {
|
||||
// Disallow the request by default.
|
||||
std::move(callback).Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
|
||||
callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,30 +504,6 @@ void BindPluginInfoHost(
|
||||
std::move(receiver));
|
||||
}
|
||||
|
||||
base::FilePath GetRootCachePath() {
|
||||
// The CefContext::ValidateCachePath method enforces the requirement that all
|
||||
// cache_path values be either equal to or a child of root_cache_path.
|
||||
return base::FilePath(
|
||||
CefString(&CefContext::Get()->settings().root_cache_path));
|
||||
}
|
||||
|
||||
// Register BrowserInterfaceBroker's GetInterface() handler callbacks for
|
||||
// chrome-specific document-scoped interfaces.
|
||||
// Stub implementations to silence "Empty binder for interface
|
||||
// blink.mojom.[Name] for the frame/document scope" errors.
|
||||
// Based on chrome/browser/chrome_browser_interface_binders.cc.
|
||||
void PopulateChromeFrameBinders(
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
||||
map->Add<blink::mojom::InsecureInputService>(base::BindRepeating(
|
||||
[](content::RenderFrameHost* frame_host,
|
||||
mojo::PendingReceiver<blink::mojom::InsecureInputService> receiver) {
|
||||
}));
|
||||
|
||||
map->Add<blink::mojom::PrerenderProcessor>(base::BindRepeating(
|
||||
[](content::RenderFrameHost* frame_host,
|
||||
mojo::PendingReceiver<blink::mojom::PrerenderProcessor> receiver) {}));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefContentBrowserClient::CefContentBrowserClient()
|
||||
@@ -626,17 +599,6 @@ bool CefContentBrowserClient::DoesSiteRequireDedicatedProcess(
|
||||
return extension != nullptr;
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::OverrideURLLoaderFactoryParams(
|
||||
content::BrowserContext* browser_context,
|
||||
const url::Origin& origin,
|
||||
bool is_for_isolated_world,
|
||||
network::mojom::URLLoaderFactoryParams* factory_params) {
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extensions::URLLoaderFactoryManager::OverrideURLLoaderFactoryParams(
|
||||
browser_context, origin, is_for_isolated_world, factory_params);
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::GetAdditionalWebUISchemes(
|
||||
std::vector<std::string>* additional_schemes) {
|
||||
// Any schemes listed here are treated as WebUI schemes but do not get WebUI
|
||||
@@ -881,6 +843,18 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::AdjustUtilityServiceProcessCommandLine(
|
||||
const service_manager::Identity& identity,
|
||||
base::CommandLine* command_line) {
|
||||
#if defined(OS_MACOSX)
|
||||
// On Mac, the video-capture and audio services require a CFRunLoop, provided
|
||||
// by a UI message loop, to run AVFoundation and CoreAudio code.
|
||||
// See https://crbug.com/834581
|
||||
if (identity.name() == audio::mojom::kServiceName)
|
||||
command_line->AppendSwitch(switches::kMessageLoopTypeUi);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string CefContentBrowserClient::GetApplicationLocale() {
|
||||
return g_browser_process->GetApplicationLocale();
|
||||
}
|
||||
@@ -910,6 +884,16 @@ CefContentBrowserClient::CreateQuotaPermissionContext() {
|
||||
return new CefQuotaPermissionContext();
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::GetQuotaSettings(
|
||||
content::BrowserContext* context,
|
||||
content::StoragePartition* partition,
|
||||
base::OnceCallback<void(base::Optional<storage::QuotaSettings>)> callback) {
|
||||
const base::FilePath& cache_path = partition->GetPath();
|
||||
storage::GetNominalDynamicSettings(
|
||||
cache_path, cache_path.empty() /* is_incognito */,
|
||||
storage::GetDefaultDeviceInfoHelper(), std::move(callback));
|
||||
}
|
||||
|
||||
content::MediaObserver* CefContentBrowserClient::GetMediaObserver() {
|
||||
return CefMediaCaptureDevicesDispatcher::GetInstance();
|
||||
}
|
||||
@@ -1125,13 +1109,16 @@ CefContentBrowserClient::CreateURLLoaderThrottles(
|
||||
request.resource_type, frame_tree_node_id));
|
||||
|
||||
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||
bool is_off_the_record = profile->IsOffTheRecord();
|
||||
|
||||
chrome::mojom::DynamicParams dynamic_params = {
|
||||
profile->GetPrefs()->GetBoolean(prefs::kForceGoogleSafeSearch),
|
||||
profile->GetPrefs()->GetInteger(prefs::kForceYouTubeRestrict),
|
||||
profile->GetPrefs()->GetString(prefs::kAllowedDomainsForApps)};
|
||||
result.push_back(
|
||||
std::make_unique<GoogleURLLoaderThrottle>(std::move(dynamic_params)));
|
||||
profile->GetPrefs()->GetString(prefs::kAllowedDomainsForApps),
|
||||
variations::VariationsHttpHeaderProvider::GetInstance()
|
||||
->GetClientDataHeader(false /* is_signed_in */)};
|
||||
result.push_back(std::make_unique<GoogleURLLoaderThrottle>(
|
||||
is_off_the_record, std::move(dynamic_params)));
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -1287,7 +1274,6 @@ bool CefContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
bool* bypass_redirect_checks,
|
||||
bool* disable_secure_dns,
|
||||
network::mojom::URLLoaderFactoryOverridePtr* factory_override) {
|
||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||
browser_context, frame, render_process_id,
|
||||
@@ -1334,7 +1320,10 @@ CefContentBrowserClient::GetNetworkContextsParentDirectory() {
|
||||
base::PathService::Get(chrome::DIR_USER_DATA, &user_data_path);
|
||||
DCHECK(!user_data_path.empty());
|
||||
|
||||
const auto& root_cache_path = GetRootCachePath();
|
||||
// The CefContext::ValidateCachePath method enforces the requirement that all
|
||||
// cache_path values be either equal to or a child of root_cache_path.
|
||||
const base::FilePath& root_cache_path =
|
||||
base::FilePath(CefString(&CefContext::Get()->settings().root_cache_path));
|
||||
|
||||
// root_cache_path may sometimes be empty or a child of user_data_path, so
|
||||
// only return the one path in that case.
|
||||
@@ -1411,8 +1400,6 @@ CefContentBrowserClient::CreateWindowForPictureInPicture(
|
||||
void CefContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
||||
PopulateChromeFrameBinders(map);
|
||||
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return;
|
||||
|
||||
@@ -1437,11 +1424,6 @@ void CefContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
extension);
|
||||
}
|
||||
|
||||
base::FilePath
|
||||
CefContentBrowserClient::GetSandboxedStorageServiceDataDirectory() {
|
||||
return GetRootCachePath();
|
||||
}
|
||||
|
||||
std::string CefContentBrowserClient::GetProduct() {
|
||||
// Match the logic in chrome_content_browser_client.cc GetProduct().
|
||||
return ::GetProduct();
|
||||
@@ -1480,6 +1462,16 @@ CefContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
|
||||
return mime_types;
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
|
||||
// Register as a Web-safe scheme so that requests for the scheme from a
|
||||
// render process will be allowed in resource_dispatcher_host_impl.cc
|
||||
// ShouldServiceRequest.
|
||||
content::ChildProcessSecurityPolicy* policy =
|
||||
content::ChildProcessSecurityPolicy::GetInstance();
|
||||
if (!policy->IsWebSafeScheme(scheme))
|
||||
policy->RegisterWebSafeScheme(scheme);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextImpl> CefContentBrowserClient::request_context()
|
||||
const {
|
||||
return browser_main_parts_->request_context();
|
||||
|
@@ -46,11 +46,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
const GURL& effective_url) override;
|
||||
bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context,
|
||||
const GURL& effective_site_url) override;
|
||||
void OverrideURLLoaderFactoryParams(
|
||||
content::BrowserContext* browser_context,
|
||||
const url::Origin& origin,
|
||||
bool is_for_isolated_world,
|
||||
network::mojom::URLLoaderFactoryParams* factory_params) override;
|
||||
void GetAdditionalWebUISchemes(
|
||||
std::vector<std::string>* additional_schemes) override;
|
||||
void GetAdditionalViewSourceSchemes(
|
||||
@@ -68,12 +63,20 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
base::StringPiece name) override;
|
||||
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
||||
int child_process_id) override;
|
||||
void AdjustUtilityServiceProcessCommandLine(
|
||||
const service_manager::Identity& identity,
|
||||
base::CommandLine* command_line) override;
|
||||
std::string GetApplicationLocale() override;
|
||||
scoped_refptr<network::SharedURLLoaderFactory>
|
||||
GetSystemSharedURLLoaderFactory() override;
|
||||
network::mojom::NetworkContext* GetSystemNetworkContext() override;
|
||||
scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext()
|
||||
override;
|
||||
void GetQuotaSettings(
|
||||
content::BrowserContext* context,
|
||||
content::StoragePartition* partition,
|
||||
base::OnceCallback<void(base::Optional<storage::QuotaSettings>)> callback)
|
||||
override;
|
||||
content::MediaObserver* GetMediaObserver() override;
|
||||
content::SpeechRecognitionManagerDelegate*
|
||||
CreateSpeechRecognitionManagerDelegate() override;
|
||||
@@ -169,7 +172,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
bool* bypass_redirect_checks,
|
||||
bool* disable_secure_dns,
|
||||
network::mojom::URLLoaderFactoryOverridePtr* factory_override) override;
|
||||
void OnNetworkServiceCreated(
|
||||
network::mojom::NetworkService* network_service) override;
|
||||
@@ -202,7 +204,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map)
|
||||
override;
|
||||
base::FilePath GetSandboxedStorageServiceDataDirectory() override;
|
||||
|
||||
std::string GetProduct() override;
|
||||
std::string GetChromeProduct() override;
|
||||
std::string GetUserAgent() override;
|
||||
@@ -210,6 +212,9 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(
|
||||
content::BrowserContext* browser_context) override;
|
||||
|
||||
// Perform browser process registration for the custom scheme.
|
||||
void RegisterCustomScheme(const std::string& scheme);
|
||||
|
||||
CefRefPtr<CefRequestContextImpl> request_context() const;
|
||||
CefDevToolsDelegate* devtools_delegate() const;
|
||||
|
||||
|
@@ -37,13 +37,13 @@
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "chrome/chrome_elf/chrome_elf_main.h"
|
||||
#include "chrome/install_static/initialize_from_primary_module.h"
|
||||
#include "components/crash/core/app/crashpad.h"
|
||||
#include "components/crash/content/app/crashpad.h"
|
||||
#include "content/public/app/sandbox_helper_win.h"
|
||||
#include "sandbox/win/src/sandbox_types.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
#include "components/crash/core/app/crash_switches.h"
|
||||
#include "components/crash/content/app/crash_switches.h"
|
||||
#include "third_party/crashpad/crashpad/handler/handler_main.h"
|
||||
#endif
|
||||
|
||||
@@ -97,12 +97,12 @@ void InitCrashReporter() {
|
||||
|
||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||
|
||||
// Based on components/crash/core/app/run_as_crashpad_handler_win.cc
|
||||
// Based on components/crash/content/app/run_as_crashpad_handler_win.cc
|
||||
// Remove the "--type=crashpad-handler" command-line flag that will otherwise
|
||||
// confuse the crashpad handler.
|
||||
// Chrome uses an embedded crashpad handler on Windows only and imports this
|
||||
// function via the existing "run_as_crashpad_handler" target defined in
|
||||
// components/crash/core/app/BUILD.gn. CEF uses an embedded handler on both
|
||||
// components/crash/content/app/BUILD.gn. CEF uses an embedded handler on both
|
||||
// Windows and macOS so we define the function here instead of using the
|
||||
// existing target (because we can't use that target on macOS).
|
||||
int RunAsCrashpadHandler(const base::CommandLine& command_line) {
|
||||
@@ -160,85 +160,6 @@ bool GetColor(const cef_color_t cef_in, bool is_windowless, SkColor* sk_out) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Convert |path_str| to a normalized FilePath.
|
||||
base::FilePath NormalizePath(const cef_string_t& path_str,
|
||||
const char* name,
|
||||
bool* has_error = nullptr) {
|
||||
if (has_error)
|
||||
*has_error = false;
|
||||
|
||||
base::FilePath path = base::FilePath(CefString(&path_str));
|
||||
if (path.EndsWithSeparator()) {
|
||||
// Remove the trailing separator because it will interfere with future
|
||||
// equality checks.
|
||||
path = path.StripTrailingSeparators();
|
||||
}
|
||||
|
||||
if (!path.empty() && !path.IsAbsolute()) {
|
||||
LOG(ERROR) << "The " << name << " directory (" << path.value()
|
||||
<< ") is not an absolute path. Defaulting to empty.";
|
||||
if (has_error)
|
||||
*has_error = true;
|
||||
path = base::FilePath();
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
void SetPath(cef_string_t& path_str, const base::FilePath& path) {
|
||||
#if defined(OS_WIN)
|
||||
CefString(&path_str).FromWString(path.value());
|
||||
#else
|
||||
CefString(&path_str).FromString(path.value());
|
||||
#endif
|
||||
}
|
||||
|
||||
// Convert |path_str| to a normalized FilePath and update the |path_str| value.
|
||||
base::FilePath NormalizePathAndSet(cef_string_t& path_str, const char* name) {
|
||||
const base::FilePath& path = NormalizePath(path_str, name);
|
||||
SetPath(path_str, path);
|
||||
return path;
|
||||
}
|
||||
|
||||
// Verify that |cache_path| is valid and create it if necessary.
|
||||
bool ValidateCachePath(const base::FilePath& cache_path,
|
||||
const base::FilePath& root_cache_path) {
|
||||
if (cache_path.empty())
|
||||
return true;
|
||||
|
||||
if (!root_cache_path.empty() && root_cache_path != cache_path &&
|
||||
!root_cache_path.IsParent(cache_path)) {
|
||||
LOG(ERROR) << "The cache_path directory (" << cache_path.value()
|
||||
<< ") is not a child of the root_cache_path directory ("
|
||||
<< root_cache_path.value() << ")";
|
||||
return false;
|
||||
}
|
||||
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (!base::DirectoryExists(cache_path) &&
|
||||
!base::CreateDirectory(cache_path)) {
|
||||
LOG(ERROR) << "The cache_path directory (" << cache_path.value()
|
||||
<< ") could not be created.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Like NormalizePathAndSet but with additional checks specific to the
|
||||
// cache_path value.
|
||||
base::FilePath NormalizeCachePathAndSet(cef_string_t& path_str,
|
||||
const base::FilePath& root_cache_path) {
|
||||
bool has_error = false;
|
||||
base::FilePath path = NormalizePath(path_str, "cache_path", &has_error);
|
||||
if (has_error || !ValidateCachePath(path, root_cache_path)) {
|
||||
LOG(ERROR) << "The cache_path is invalid. Defaulting to in-memory storage.";
|
||||
path = base::FilePath();
|
||||
}
|
||||
SetPath(path_str, path);
|
||||
return path;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int CefExecuteProcess(const CefMainArgs& args,
|
||||
@@ -449,22 +370,17 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
SignalChromeElf();
|
||||
#endif
|
||||
|
||||
const base::FilePath& root_cache_path =
|
||||
NormalizePathAndSet(settings_.root_cache_path, "root_cache_path");
|
||||
const base::FilePath& cache_path =
|
||||
NormalizeCachePathAndSet(settings_.cache_path, root_cache_path);
|
||||
if (root_cache_path.empty() && !cache_path.empty()) {
|
||||
CefString(&settings_.root_cache_path) = cache_path.value();
|
||||
base::FilePath cache_path = base::FilePath(CefString(&settings_.cache_path));
|
||||
if (!ValidateCachePath(cache_path)) {
|
||||
// Reset to in-memory storage.
|
||||
CefString(&settings_.cache_path).clear();
|
||||
cache_path = base::FilePath();
|
||||
}
|
||||
const base::FilePath& root_cache_path =
|
||||
base::FilePath(CefString(&settings_.root_cache_path));
|
||||
if (root_cache_path.empty() && !cache_path.empty()) {
|
||||
CefString(&settings_.root_cache_path) = CefString(&settings_.cache_path);
|
||||
}
|
||||
|
||||
// All other paths that need to be normalized.
|
||||
NormalizePathAndSet(settings_.browser_subprocess_path,
|
||||
"browser_subprocess_path");
|
||||
NormalizePathAndSet(settings_.framework_dir_path, "framework_dir_path");
|
||||
NormalizePathAndSet(settings_.main_bundle_path, "main_bundle_path");
|
||||
NormalizePathAndSet(settings_.user_data_path, "user_data_path");
|
||||
NormalizePathAndSet(settings_.resources_dir_path, "resources_dir_path");
|
||||
NormalizePathAndSet(settings_.locales_dir_path, "locales_dir_path");
|
||||
|
||||
main_delegate_.reset(new CefMainDelegate(application));
|
||||
browser_info_manager_.reset(new CefBrowserInfoManager);
|
||||
@@ -602,14 +518,11 @@ CefTraceSubscriber* CefContext::GetTraceSubscriber() {
|
||||
return trace_subscriber_.get();
|
||||
}
|
||||
|
||||
void CefContext::PopulateGlobalRequestContextSettings(
|
||||
void CefContext::PopulateRequestContextSettings(
|
||||
CefRequestContextSettings* settings) {
|
||||
CefRefPtr<CefCommandLine> command_line =
|
||||
CefCommandLine::GetGlobalCommandLine();
|
||||
|
||||
// This value was already normalized in Initialize.
|
||||
CefString(&settings->cache_path) = CefString(&settings_.cache_path);
|
||||
|
||||
settings->persist_session_cookies =
|
||||
settings_.persist_session_cookies ||
|
||||
command_line->HasSwitch(switches::kPersistSessionCookies);
|
||||
@@ -623,17 +536,29 @@ void CefContext::PopulateGlobalRequestContextSettings(
|
||||
CefString(&settings_.accept_language_list);
|
||||
}
|
||||
|
||||
void CefContext::NormalizeRequestContextSettings(
|
||||
CefRequestContextSettings* settings) {
|
||||
// The |root_cache_path| value was already normalized in Initialize.
|
||||
const base::FilePath& root_cache_path = CefString(&settings_.root_cache_path);
|
||||
NormalizeCachePathAndSet(settings->cache_path, root_cache_path);
|
||||
bool CefContext::ValidateCachePath(const base::FilePath& cache_path) {
|
||||
if (cache_path.empty())
|
||||
return true;
|
||||
|
||||
if (settings->accept_language_list.length == 0) {
|
||||
// Use the global language list setting.
|
||||
CefString(&settings->accept_language_list) =
|
||||
CefString(&settings_.accept_language_list);
|
||||
const base::FilePath& root_cache_path =
|
||||
base::FilePath(CefString(&settings_.root_cache_path));
|
||||
if (!root_cache_path.empty() && root_cache_path != cache_path &&
|
||||
!root_cache_path.IsParent(cache_path)) {
|
||||
LOG(ERROR) << "The cache_path directory (" << cache_path.value()
|
||||
<< ") is not a child of the root_cache_path directory ("
|
||||
<< root_cache_path.value() << ")";
|
||||
return false;
|
||||
}
|
||||
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (!base::DirectoryExists(cache_path) &&
|
||||
!base::CreateDirectory(cache_path)) {
|
||||
LOG(ERROR) << "The cache_path directory (" << cache_path.value()
|
||||
<< ") could not be created.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefContext::AddObserver(Observer* observer) {
|
||||
|
@@ -87,11 +87,10 @@ class CefContext {
|
||||
|
||||
// Populate request context settings for the global system context based on
|
||||
// CefSettings and command-line flags.
|
||||
void PopulateGlobalRequestContextSettings(
|
||||
CefRequestContextSettings* settings);
|
||||
void PopulateRequestContextSettings(CefRequestContextSettings* settings);
|
||||
|
||||
// Normalize and validate request context settings for user-created contexts.
|
||||
void NormalizeRequestContextSettings(CefRequestContextSettings* settings);
|
||||
// Verify that |cache_path| is valid and create it if necessary.
|
||||
bool ValidateCachePath(const base::FilePath& cache_path);
|
||||
|
||||
// Manage observer objects. The observer must either outlive this object or
|
||||
// remove itself before destruction. These methods can only be called on the
|
||||
|
@@ -9,7 +9,7 @@
|
||||
#include "include/cef_context_menu_handler.h"
|
||||
#include "libcef/common/value_base.h"
|
||||
|
||||
#include "content/public/browser/context_menu_params.h"
|
||||
#include "content/public/common/context_menu_params.h"
|
||||
|
||||
// CefContextMenuParams implementation. This class is not thread safe.
|
||||
class CefContextMenuParamsImpl
|
||||
|
@@ -1,137 +0,0 @@
|
||||
// Copyright (c) 2020 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/devtools/devtools_controller.h"
|
||||
|
||||
#include "libcef/browser/devtools/devtools_util.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/json/json_writer.h"
|
||||
#include "content/public/browser/devtools_agent_host.h"
|
||||
|
||||
CefDevToolsController::CefDevToolsController(
|
||||
content::WebContents* inspected_contents)
|
||||
: inspected_contents_(inspected_contents), weak_ptr_factory_(this) {
|
||||
DCHECK(inspected_contents_);
|
||||
}
|
||||
|
||||
CefDevToolsController::~CefDevToolsController() {
|
||||
if (agent_host_) {
|
||||
agent_host_->DetachClient(this);
|
||||
AgentHostClosed(agent_host_.get());
|
||||
}
|
||||
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnDevToolsControllerDestroyed();
|
||||
}
|
||||
}
|
||||
|
||||
bool CefDevToolsController::SendDevToolsMessage(
|
||||
const base::StringPiece& message) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!EnsureAgentHost())
|
||||
return false;
|
||||
|
||||
agent_host_->DispatchProtocolMessage(
|
||||
this, base::as_bytes(base::make_span(message)));
|
||||
return true;
|
||||
}
|
||||
|
||||
int CefDevToolsController::ExecuteDevToolsMethod(
|
||||
int suggested_message_id,
|
||||
const std::string& method,
|
||||
const base::DictionaryValue* params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!EnsureAgentHost())
|
||||
return 0;
|
||||
|
||||
// Message IDs must always be increasing and unique.
|
||||
int message_id = suggested_message_id;
|
||||
if (message_id < next_message_id_)
|
||||
message_id = next_message_id_++;
|
||||
else
|
||||
next_message_id_ = message_id + 1;
|
||||
|
||||
base::DictionaryValue message;
|
||||
message.SetIntKey("id", message_id);
|
||||
message.SetStringKey("method", method);
|
||||
if (params)
|
||||
message.SetKey("params", params->Clone());
|
||||
|
||||
std::string protocol_message;
|
||||
if (!base::JSONWriter::Write(message, &protocol_message))
|
||||
return 0;
|
||||
|
||||
agent_host_->DispatchProtocolMessage(
|
||||
this, base::as_bytes(base::make_span(protocol_message)));
|
||||
return message_id;
|
||||
}
|
||||
|
||||
void CefDevToolsController::AgentHostClosed(
|
||||
content::DevToolsAgentHost* agent_host) {
|
||||
DCHECK(agent_host == agent_host_.get());
|
||||
agent_host_ = nullptr;
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnDevToolsAgentDetached();
|
||||
}
|
||||
}
|
||||
|
||||
void CefDevToolsController::AddObserver(Observer* observer) {
|
||||
CEF_REQUIRE_UIT();
|
||||
observers_.AddObserver(observer);
|
||||
}
|
||||
|
||||
void CefDevToolsController::RemoveObserver(Observer* observer) {
|
||||
CEF_REQUIRE_UIT();
|
||||
observers_.RemoveObserver(observer);
|
||||
}
|
||||
|
||||
void CefDevToolsController::DispatchProtocolMessage(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
base::span<const uint8_t> message) {
|
||||
if (!observers_.might_have_observers())
|
||||
return;
|
||||
|
||||
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
||||
message.size());
|
||||
if (!devtools_util::ProtocolParser::IsValidMessage(str_message)) {
|
||||
LOG(WARNING) << "Invalid message: " << str_message.substr(0, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
devtools_util::ProtocolParser parser;
|
||||
|
||||
for (auto& observer : observers_) {
|
||||
if (observer.OnDevToolsMessage(str_message)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Only perform parsing a single time.
|
||||
if (parser.Initialize(str_message) && parser.IsFailure()) {
|
||||
LOG(WARNING) << "Failed to parse message: " << str_message.substr(0, 100);
|
||||
}
|
||||
|
||||
if (parser.IsEvent()) {
|
||||
observer.OnDevToolsEvent(parser.method_, parser.params_);
|
||||
} else if (parser.IsResult()) {
|
||||
observer.OnDevToolsMethodResult(parser.message_id_, parser.success_,
|
||||
parser.params_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CefDevToolsController::EnsureAgentHost() {
|
||||
if (!agent_host_) {
|
||||
agent_host_ =
|
||||
content::DevToolsAgentHost::GetOrCreateFor(inspected_contents_);
|
||||
if (agent_host_) {
|
||||
agent_host_->AttachClient(this);
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnDevToolsAgentAttached();
|
||||
}
|
||||
}
|
||||
}
|
||||
return !!agent_host_;
|
||||
}
|
@@ -1,79 +0,0 @@
|
||||
// Copyright (c) 2020 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_DEVTOOLS_DEVTOOLS_CONTROLLER_H_
|
||||
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_CONTROLLER_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "content/public/browser/devtools_agent_host_client.h"
|
||||
|
||||
#include "base/containers/span.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/observer_list.h"
|
||||
#include "base/values.h"
|
||||
|
||||
namespace content {
|
||||
class WebContents;
|
||||
}
|
||||
|
||||
class CefDevToolsController : public content::DevToolsAgentHostClient {
|
||||
public:
|
||||
class Observer : public base::CheckedObserver {
|
||||
public:
|
||||
// See CefDevToolsMessageObserver documentation.
|
||||
virtual bool OnDevToolsMessage(const base::StringPiece& message) = 0;
|
||||
virtual void OnDevToolsMethodResult(int message_id,
|
||||
bool success,
|
||||
const base::StringPiece& result) = 0;
|
||||
virtual void OnDevToolsEvent(const base::StringPiece& method,
|
||||
const base::StringPiece& params) = 0;
|
||||
virtual void OnDevToolsAgentAttached() = 0;
|
||||
virtual void OnDevToolsAgentDetached() = 0;
|
||||
|
||||
virtual void OnDevToolsControllerDestroyed() = 0;
|
||||
|
||||
protected:
|
||||
~Observer() override {}
|
||||
};
|
||||
|
||||
// |inspected_contents| will outlive this object.
|
||||
explicit CefDevToolsController(content::WebContents* inspected_contents);
|
||||
~CefDevToolsController() override;
|
||||
|
||||
// See CefBrowserHost methods of the same name for documentation.
|
||||
bool SendDevToolsMessage(const base::StringPiece& message);
|
||||
int ExecuteDevToolsMethod(int message_id,
|
||||
const std::string& method,
|
||||
const base::DictionaryValue* params);
|
||||
|
||||
// |observer| must outlive this object or be removed.
|
||||
void AddObserver(Observer* observer);
|
||||
void RemoveObserver(Observer* observer);
|
||||
|
||||
base::WeakPtr<CefDevToolsController> GetWeakPtr() {
|
||||
return weak_ptr_factory_.GetWeakPtr();
|
||||
}
|
||||
|
||||
private:
|
||||
// content::DevToolsAgentHostClient implementation:
|
||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host) override;
|
||||
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
|
||||
base::span<const uint8_t> message) override;
|
||||
|
||||
bool EnsureAgentHost();
|
||||
|
||||
content::WebContents* const inspected_contents_;
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
||||
int next_message_id_ = 1;
|
||||
|
||||
base::ObserverList<Observer> observers_;
|
||||
|
||||
base::WeakPtrFactory<CefDevToolsController> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsController);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_CONTROLLER_H_
|
@@ -6,18 +6,13 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <iomanip>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/net/devtools_scheme_handler.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/guid.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/json/json_writer.h"
|
||||
@@ -50,16 +45,10 @@
|
||||
#include "net/base/net_errors.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "net/traffic_annotation/network_traffic_annotation.h"
|
||||
#include "services/network/public/cpp/resource_response.h"
|
||||
#include "services/network/public/cpp/simple_url_loader.h"
|
||||
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
|
||||
#include "services/network/public/mojom/url_response_head.mojom.h"
|
||||
#include "storage/browser/file_system/native_file_util.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#elif defined(OS_POSIX)
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -70,20 +59,9 @@ static std::string GetFrontendURL() {
|
||||
}
|
||||
|
||||
std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
|
||||
const net::HttpResponseHeaders* rh,
|
||||
bool success,
|
||||
int net_error) {
|
||||
const net::HttpResponseHeaders* rh) {
|
||||
auto response = std::make_unique<base::DictionaryValue>();
|
||||
int responseCode = 200;
|
||||
if (rh) {
|
||||
responseCode = rh->response_code();
|
||||
} else if (!success) {
|
||||
// In case of no headers, assume file:// URL and failed to load
|
||||
responseCode = 404;
|
||||
}
|
||||
response->SetInteger("statusCode", responseCode);
|
||||
response->SetInteger("netError", net_error);
|
||||
response->SetString("netErrorName", net::ErrorToString(net_error));
|
||||
response->SetInteger("statusCode", rh ? rh->response_code() : 200);
|
||||
|
||||
auto headers = std::make_unique<base::DictionaryValue>();
|
||||
size_t iterator = 0;
|
||||
@@ -98,71 +76,6 @@ std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
|
||||
return response;
|
||||
}
|
||||
|
||||
const int kMaxLogLineLength = 1024;
|
||||
|
||||
void WriteTimestamp(std::stringstream& stream) {
|
||||
#if defined(OS_WIN)
|
||||
SYSTEMTIME local_time;
|
||||
GetLocalTime(&local_time);
|
||||
stream << std::setfill('0') << std::setw(2) << local_time.wMonth
|
||||
<< std::setw(2) << local_time.wDay << '/' << std::setw(2)
|
||||
<< local_time.wHour << std::setw(2) << local_time.wMinute
|
||||
<< std::setw(2) << local_time.wSecond << '.' << std::setw(3)
|
||||
<< local_time.wMilliseconds;
|
||||
#elif defined(OS_POSIX)
|
||||
timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
time_t t = tv.tv_sec;
|
||||
struct tm local_time;
|
||||
localtime_r(&t, &local_time);
|
||||
struct tm* tm_time = &local_time;
|
||||
stream << std::setfill('0') << std::setw(2) << 1 + tm_time->tm_mon
|
||||
<< std::setw(2) << tm_time->tm_mday << '/' << std::setw(2)
|
||||
<< tm_time->tm_hour << std::setw(2) << tm_time->tm_min << std::setw(2)
|
||||
<< tm_time->tm_sec << '.' << std::setw(6) << tv.tv_usec;
|
||||
#else
|
||||
#error Unsupported platform
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogProtocolMessage(const base::FilePath& log_file,
|
||||
ProtocolMessageType type,
|
||||
std::string to_log) {
|
||||
// Track if logging has failed, in which case we don't keep trying.
|
||||
static bool log_error = false;
|
||||
if (log_error)
|
||||
return;
|
||||
|
||||
if (storage::NativeFileUtil::EnsureFileExists(log_file, nullptr) !=
|
||||
base::File::FILE_OK) {
|
||||
LOG(ERROR) << "Failed to create file " << log_file.value();
|
||||
log_error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string type_label;
|
||||
switch (type) {
|
||||
case ProtocolMessageType::METHOD:
|
||||
type_label = "METHOD";
|
||||
break;
|
||||
case ProtocolMessageType::RESULT:
|
||||
type_label = "RESULT";
|
||||
break;
|
||||
case ProtocolMessageType::EVENT:
|
||||
type_label = "EVENT";
|
||||
break;
|
||||
}
|
||||
|
||||
std::stringstream stream;
|
||||
WriteTimestamp(stream);
|
||||
stream << ": " << type_label << ": " << to_log << "\n";
|
||||
const std::string& str = stream.str();
|
||||
if (!base::AppendToFile(log_file, str.c_str(), str.size())) {
|
||||
LOG(ERROR) << "Failed to write file " << log_file.value();
|
||||
log_error = true;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class CefDevToolsFrontend::NetworkResourceLoader
|
||||
@@ -209,8 +122,7 @@ class CefDevToolsFrontend::NetworkResourceLoader
|
||||
}
|
||||
|
||||
void OnComplete(bool success) override {
|
||||
auto response = BuildObjectForResponse(response_headers_.get(), success,
|
||||
loader_->NetError());
|
||||
auto response = BuildObjectForResponse(response_headers_.get());
|
||||
bindings_->SendMessageAck(request_id_, response.get());
|
||||
|
||||
bindings_->loaders_.erase(bindings_->loaders_.find(this));
|
||||
@@ -233,12 +145,11 @@ const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
|
||||
|
||||
// static
|
||||
CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||
CefBrowserHostImpl* inspected_browser,
|
||||
CefRefPtr<CefBrowserHostImpl> inspected_browser,
|
||||
const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at,
|
||||
base::OnceClosure frontend_destroyed_callback) {
|
||||
const CefPoint& inspect_element_at) {
|
||||
CefBrowserSettings new_settings = settings;
|
||||
if (!windowInfo.windowless_rendering_enabled &&
|
||||
CefColorGetA(new_settings.background_color) != SK_AlphaOPAQUE) {
|
||||
@@ -265,8 +176,7 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||
// destroyed.
|
||||
CefDevToolsFrontend* devtools_frontend = new CefDevToolsFrontend(
|
||||
static_cast<CefBrowserHostImpl*>(frontend_browser.get()),
|
||||
inspected_contents, inspect_element_at,
|
||||
std::move(frontend_destroyed_callback));
|
||||
inspected_contents, inspect_element_at);
|
||||
|
||||
// Need to load the URL after creating the DevTools objects.
|
||||
frontend_browser->GetMainFrame()->LoadURL(GetFrontendURL());
|
||||
@@ -295,23 +205,23 @@ void CefDevToolsFrontend::Close() {
|
||||
frontend_browser_.get(), true));
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::DisconnectFromTarget() {
|
||||
if (!agent_host_)
|
||||
return;
|
||||
agent_host_->DetachClient(this);
|
||||
agent_host_ = nullptr;
|
||||
}
|
||||
|
||||
CefDevToolsFrontend::CefDevToolsFrontend(
|
||||
CefBrowserHostImpl* frontend_browser,
|
||||
CefRefPtr<CefBrowserHostImpl> frontend_browser,
|
||||
content::WebContents* inspected_contents,
|
||||
const CefPoint& inspect_element_at,
|
||||
base::OnceClosure frontend_destroyed_callback)
|
||||
const CefPoint& inspect_element_at)
|
||||
: content::WebContentsObserver(frontend_browser->web_contents()),
|
||||
frontend_browser_(frontend_browser),
|
||||
inspected_contents_(inspected_contents),
|
||||
inspect_element_at_(inspect_element_at),
|
||||
frontend_destroyed_callback_(std::move(frontend_destroyed_callback)),
|
||||
file_manager_(frontend_browser, GetPrefs()),
|
||||
protocol_log_file_(
|
||||
base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
|
||||
switches::kDevToolsProtocolLogFile)),
|
||||
weak_factory_(this) {
|
||||
DCHECK(!frontend_destroyed_callback_.is_null());
|
||||
}
|
||||
file_manager_(frontend_browser.get(), GetPrefs()),
|
||||
weak_factory_(this) {}
|
||||
|
||||
CefDevToolsFrontend::~CefDevToolsFrontend() {}
|
||||
|
||||
@@ -358,7 +268,6 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
|
||||
agent_host_->DetachClient(this);
|
||||
agent_host_ = nullptr;
|
||||
}
|
||||
std::move(frontend_destroyed_callback_).Run();
|
||||
delete this;
|
||||
}
|
||||
|
||||
@@ -380,11 +289,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
std::string protocol_message;
|
||||
if (!agent_host_ || !params->GetString(0, &protocol_message))
|
||||
return;
|
||||
if (ProtocolLoggingEnabled()) {
|
||||
LogProtocolMessage(ProtocolMessageType::METHOD, protocol_message);
|
||||
}
|
||||
agent_host_->DispatchProtocolMessage(
|
||||
this, base::as_bytes(base::make_span(protocol_message)));
|
||||
agent_host_->DispatchProtocolMessage(this, protocol_message);
|
||||
} else if (method == "loadCompleted") {
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
base::ASCIIToUTF16("DevToolsAPI.setUseSoftMenu(true);"),
|
||||
@@ -403,7 +308,6 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
if (!gurl.is_valid()) {
|
||||
base::DictionaryValue response;
|
||||
response.SetInteger("statusCode", 404);
|
||||
response.SetBoolean("urlValid", false);
|
||||
SendMessageAck(request_id, &response);
|
||||
return;
|
||||
}
|
||||
@@ -440,7 +344,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
// TODO(caseq): this preserves behavior of URLFetcher-based
|
||||
// implementation. We really need to pass proper first party origin from
|
||||
// the front-end.
|
||||
resource_request->site_for_cookies = net::SiteForCookies::FromUrl(gurl);
|
||||
resource_request->site_for_cookies = gurl;
|
||||
resource_request->headers.AddHeadersFromString(headers);
|
||||
|
||||
std::unique_ptr<network::mojom::URLLoaderFactory> file_url_loader_factory;
|
||||
@@ -531,20 +435,10 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
|
||||
void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
base::span<const uint8_t> message) {
|
||||
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
||||
message.size());
|
||||
if (ProtocolLoggingEnabled()) {
|
||||
// Quick check to avoid parsing the JSON object. Events begin with a
|
||||
// "method" value whereas method results begin with an "id" value.
|
||||
LogProtocolMessage(str_message.starts_with("{\"method\":")
|
||||
? ProtocolMessageType::EVENT
|
||||
: ProtocolMessageType::RESULT,
|
||||
str_message);
|
||||
}
|
||||
if (str_message.length() < kMaxMessageChunkSize) {
|
||||
const std::string& message) {
|
||||
if (message.length() < kMaxMessageChunkSize) {
|
||||
std::string param;
|
||||
base::EscapeJSONString(str_message, true, ¶m);
|
||||
base::EscapeJSONString(message, true, ¶m);
|
||||
std::string code = "DevToolsAPI.dispatchMessage(" + param + ");";
|
||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
@@ -552,11 +446,10 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
return;
|
||||
}
|
||||
|
||||
size_t total_size = str_message.length();
|
||||
for (size_t pos = 0; pos < str_message.length();
|
||||
pos += kMaxMessageChunkSize) {
|
||||
size_t total_size = message.length();
|
||||
for (size_t pos = 0; pos < message.length(); pos += kMaxMessageChunkSize) {
|
||||
std::string param;
|
||||
base::EscapeJSONString(str_message.substr(pos, kMaxMessageChunkSize), true,
|
||||
base::EscapeJSONString(message.substr(pos, kMaxMessageChunkSize), true,
|
||||
¶m);
|
||||
std::string code = "DevToolsAPI.dispatchMessageChunk(" + param + "," +
|
||||
std::to_string(pos ? 0 : total_size) + ");";
|
||||
@@ -595,23 +488,6 @@ void CefDevToolsFrontend::SendMessageAck(int request_id,
|
||||
CallClientFunction("DevToolsAPI.embedderMessageAck", &id_value, arg, nullptr);
|
||||
}
|
||||
|
||||
bool CefDevToolsFrontend::ProtocolLoggingEnabled() const {
|
||||
return !protocol_log_file_.empty();
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::LogProtocolMessage(ProtocolMessageType type,
|
||||
const base::StringPiece& message) {
|
||||
DCHECK(ProtocolLoggingEnabled());
|
||||
|
||||
std::string to_log = message.substr(0, kMaxLogLineLength).as_string();
|
||||
|
||||
// Execute in an ordered context that allows blocking.
|
||||
auto task_runner = CefContentBrowserClient::Get()->background_task_runner();
|
||||
task_runner->PostTask(
|
||||
FROM_HERE, base::BindOnce(::LogProtocolMessage, protocol_log_file_, type,
|
||||
std::move(to_log)));
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::AgentHostClosed(
|
||||
content::DevToolsAgentHost* agent_host) {
|
||||
DCHECK(agent_host == agent_host_.get());
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include "libcef/browser/devtools/devtools_file_manager.h"
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
@@ -32,44 +31,42 @@ class WebContents;
|
||||
|
||||
class PrefService;
|
||||
|
||||
enum class ProtocolMessageType {
|
||||
METHOD,
|
||||
RESULT,
|
||||
EVENT,
|
||||
};
|
||||
|
||||
class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
public content::DevToolsAgentHostClient {
|
||||
public:
|
||||
static CefDevToolsFrontend* Show(
|
||||
CefBrowserHostImpl* inspected_browser,
|
||||
CefRefPtr<CefBrowserHostImpl> inspected_browser,
|
||||
const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at,
|
||||
base::OnceClosure frontend_destroyed_callback);
|
||||
const CefPoint& inspect_element_at);
|
||||
|
||||
void Activate();
|
||||
void Focus();
|
||||
void InspectElementAt(int x, int y);
|
||||
void Close();
|
||||
|
||||
void DisconnectFromTarget();
|
||||
|
||||
void CallClientFunction(const std::string& function_name,
|
||||
const base::Value* arg1,
|
||||
const base::Value* arg2,
|
||||
const base::Value* arg3);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> frontend_browser() const {
|
||||
return frontend_browser_;
|
||||
}
|
||||
|
||||
private:
|
||||
CefDevToolsFrontend(CefBrowserHostImpl* frontend_browser,
|
||||
CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser,
|
||||
content::WebContents* inspected_contents,
|
||||
const CefPoint& inspect_element_at,
|
||||
base::OnceClosure destroyed_callback);
|
||||
const CefPoint& inspect_element_at);
|
||||
~CefDevToolsFrontend() override;
|
||||
|
||||
// content::DevToolsAgentHostClient implementation.
|
||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host) override;
|
||||
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
|
||||
base::span<const uint8_t> message) override;
|
||||
const std::string& message) override;
|
||||
void HandleMessageFromDevToolsFrontend(const std::string& message);
|
||||
|
||||
private:
|
||||
@@ -81,17 +78,12 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
|
||||
void SendMessageAck(int request_id, const base::Value* arg1);
|
||||
|
||||
bool ProtocolLoggingEnabled() const;
|
||||
void LogProtocolMessage(ProtocolMessageType type,
|
||||
const base::StringPiece& message);
|
||||
|
||||
PrefService* GetPrefs() const;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> frontend_browser_;
|
||||
content::WebContents* inspected_contents_;
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
||||
CefPoint inspect_element_at_;
|
||||
base::OnceClosure frontend_destroyed_callback_;
|
||||
std::unique_ptr<content::DevToolsFrontendHost> frontend_host_;
|
||||
|
||||
class NetworkResourceLoader;
|
||||
@@ -101,9 +93,6 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
using ExtensionsAPIs = std::map<std::string, std::string>;
|
||||
ExtensionsAPIs extensions_api_;
|
||||
CefDevToolsFileManager file_manager_;
|
||||
|
||||
const base::FilePath protocol_log_file_;
|
||||
|
||||
base::WeakPtrFactory<CefDevToolsFrontend> weak_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsFrontend);
|
||||
|
@@ -1,200 +0,0 @@
|
||||
// Copyright (c) 2020 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/devtools/devtools_manager.h"
|
||||
|
||||
#include "libcef/browser/devtools/devtools_controller.h"
|
||||
#include "libcef/browser/devtools/devtools_frontend.h"
|
||||
|
||||
#include "content/public/browser/web_contents.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// May be created on any thread but will be destroyed on the UI thread.
|
||||
class CefDevToolsRegistrationImpl : public CefRegistration,
|
||||
public CefDevToolsController::Observer {
|
||||
public:
|
||||
explicit CefDevToolsRegistrationImpl(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer)
|
||||
: observer_(observer) {
|
||||
DCHECK(observer_);
|
||||
}
|
||||
|
||||
~CefDevToolsRegistrationImpl() override {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// May be null if OnDevToolsControllerDestroyed was called.
|
||||
if (!controller_)
|
||||
return;
|
||||
|
||||
controller_->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void Initialize(CefBrowserHostImpl* browser,
|
||||
base::WeakPtr<CefDevToolsController> controller) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(browser && controller);
|
||||
DCHECK(!browser_ && !controller_);
|
||||
browser_ = browser;
|
||||
controller_ = controller;
|
||||
|
||||
controller_->AddObserver(this);
|
||||
}
|
||||
|
||||
private:
|
||||
// CefDevToolsController::Observer methods:
|
||||
bool OnDevToolsMessage(const base::StringPiece& message) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
return observer_->OnDevToolsMessage(browser_, message.data(),
|
||||
message.size());
|
||||
}
|
||||
|
||||
void OnDevToolsMethodResult(int message_id,
|
||||
bool success,
|
||||
const base::StringPiece& result) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
observer_->OnDevToolsMethodResult(browser_, message_id, success,
|
||||
result.data(), result.size());
|
||||
}
|
||||
|
||||
void OnDevToolsEvent(const base::StringPiece& method,
|
||||
const base::StringPiece& params) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
observer_->OnDevToolsEvent(browser_, method.as_string(), params.data(),
|
||||
params.size());
|
||||
}
|
||||
|
||||
void OnDevToolsAgentAttached() override {
|
||||
CEF_REQUIRE_UIT();
|
||||
observer_->OnDevToolsAgentAttached(browser_);
|
||||
}
|
||||
|
||||
void OnDevToolsAgentDetached() override {
|
||||
CEF_REQUIRE_UIT();
|
||||
observer_->OnDevToolsAgentDetached(browser_);
|
||||
}
|
||||
|
||||
void OnDevToolsControllerDestroyed() override {
|
||||
CEF_REQUIRE_UIT();
|
||||
browser_ = nullptr;
|
||||
controller_.reset();
|
||||
}
|
||||
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer_;
|
||||
|
||||
CefBrowserHostImpl* browser_ = nullptr;
|
||||
base::WeakPtr<CefDevToolsController> controller_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefDevToolsRegistrationImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsRegistrationImpl);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
CefDevToolsManager::CefDevToolsManager(CefBrowserHostImpl* inspected_browser)
|
||||
: inspected_browser_(inspected_browser), weak_ptr_factory_(this) {
|
||||
CEF_REQUIRE_UIT();
|
||||
}
|
||||
|
||||
CefDevToolsManager::~CefDevToolsManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
}
|
||||
|
||||
void CefDevToolsManager::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (devtools_frontend_) {
|
||||
if (!inspect_element_at.IsEmpty()) {
|
||||
devtools_frontend_->InspectElementAt(inspect_element_at.x,
|
||||
inspect_element_at.y);
|
||||
}
|
||||
devtools_frontend_->Focus();
|
||||
return;
|
||||
}
|
||||
|
||||
devtools_frontend_ = CefDevToolsFrontend::Show(
|
||||
inspected_browser_, windowInfo, client, settings, inspect_element_at,
|
||||
base::BindOnce(&CefDevToolsManager::OnFrontEndDestroyed,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
||||
void CefDevToolsManager::CloseDevTools() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!devtools_frontend_)
|
||||
return;
|
||||
devtools_frontend_->Close();
|
||||
}
|
||||
|
||||
bool CefDevToolsManager::HasDevTools() {
|
||||
CEF_REQUIRE_UIT();
|
||||
return !!devtools_frontend_;
|
||||
}
|
||||
|
||||
bool CefDevToolsManager::SendDevToolsMessage(const void* message,
|
||||
size_t message_size) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!message || message_size == 0)
|
||||
return false;
|
||||
|
||||
if (!EnsureController())
|
||||
return false;
|
||||
|
||||
return devtools_controller_->SendDevToolsMessage(
|
||||
base::StringPiece(static_cast<const char*>(message), message_size));
|
||||
}
|
||||
|
||||
int CefDevToolsManager::ExecuteDevToolsMethod(
|
||||
int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (method.empty())
|
||||
return 0;
|
||||
|
||||
if (!EnsureController())
|
||||
return 0;
|
||||
|
||||
if (params && params->IsValid()) {
|
||||
CefDictionaryValueImpl* impl =
|
||||
static_cast<CefDictionaryValueImpl*>(params.get());
|
||||
CefValueController::AutoLock lock_scope(impl->controller());
|
||||
return devtools_controller_->ExecuteDevToolsMethod(message_id, method,
|
||||
impl->GetValueUnsafe());
|
||||
} else {
|
||||
return devtools_controller_->ExecuteDevToolsMethod(message_id, method,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefRegistration> CefDevToolsManager::CreateRegistration(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) {
|
||||
DCHECK(observer);
|
||||
return new CefDevToolsRegistrationImpl(observer);
|
||||
}
|
||||
|
||||
void CefDevToolsManager::InitializeRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (!EnsureController())
|
||||
return;
|
||||
|
||||
static_cast<CefDevToolsRegistrationImpl*>(registration.get())
|
||||
->Initialize(inspected_browser_, devtools_controller_->GetWeakPtr());
|
||||
}
|
||||
|
||||
void CefDevToolsManager::OnFrontEndDestroyed() {
|
||||
devtools_frontend_ = nullptr;
|
||||
}
|
||||
|
||||
bool CefDevToolsManager::EnsureController() {
|
||||
if (!devtools_controller_) {
|
||||
devtools_controller_.reset(
|
||||
new CefDevToolsController(inspected_browser_->web_contents()));
|
||||
}
|
||||
return true;
|
||||
}
|
@@ -1,69 +0,0 @@
|
||||
// Copyright (c) 2020 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_DEVTOOLS_DEVTOOLS_MANAGER_H_
|
||||
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_browser.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
|
||||
class CefBrowserHostImpl;
|
||||
class CefDevToolsController;
|
||||
class CefDevToolsFrontend;
|
||||
|
||||
namespace content {
|
||||
class WebContents;
|
||||
}
|
||||
|
||||
// Manages DevTools instances. Methods must be called on the UI thread unless
|
||||
// otherwise indicated.
|
||||
class CefDevToolsManager {
|
||||
public:
|
||||
// |inspected_browser| will outlive this object.
|
||||
explicit CefDevToolsManager(CefBrowserHostImpl* inspected_browser);
|
||||
~CefDevToolsManager();
|
||||
|
||||
// See CefBrowserHost methods of the same name for documentation.
|
||||
void ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at);
|
||||
void CloseDevTools();
|
||||
bool HasDevTools();
|
||||
bool SendDevToolsMessage(const void* message, size_t message_size);
|
||||
int ExecuteDevToolsMethod(int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> param);
|
||||
|
||||
// These methods are used to implement
|
||||
// CefBrowserHost::AddDevToolsMessageObserver. CreateRegistration is safe to
|
||||
// call on any thread. InitializeRegistrationOnUIThread should be called
|
||||
// immediately afterwards on the UI thread.
|
||||
static CefRefPtr<CefRegistration> CreateRegistration(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer);
|
||||
void InitializeRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration);
|
||||
|
||||
private:
|
||||
void OnFrontEndDestroyed();
|
||||
|
||||
bool EnsureController();
|
||||
|
||||
CefBrowserHostImpl* const inspected_browser_;
|
||||
|
||||
// CefDevToolsFrontend will delete itself when the frontend WebContents is
|
||||
// destroyed.
|
||||
CefDevToolsFrontend* devtools_frontend_ = nullptr;
|
||||
|
||||
// Used for sending DevTools protocol messages without an active frontend.
|
||||
std::unique_ptr<CefDevToolsController> devtools_controller_;
|
||||
|
||||
base::WeakPtrFactory<CefDevToolsManager> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsManager);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_MANAGER_H_
|
@@ -1,131 +0,0 @@
|
||||
// Copyright (c) 2020 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/devtools/devtools_util.h"
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
|
||||
namespace devtools_util {
|
||||
|
||||
namespace {
|
||||
|
||||
bool IsValidDictionary(const base::StringPiece& str, bool allow_empty) {
|
||||
return str.length() >= (allow_empty ? 2 : 3) && str[0] == '{' &&
|
||||
str[str.length() - 1] == '}';
|
||||
}
|
||||
|
||||
// Example:
|
||||
// {"method":"Target.targetDestroyed","params":{"targetId":"1234..."}}
|
||||
bool ParseEvent(const base::StringPiece& message,
|
||||
base::StringPiece& method,
|
||||
base::StringPiece& params) {
|
||||
static const char kMethodStart[] = "{\"method\":\"";
|
||||
static const char kMethodEnd[] = "\"";
|
||||
static const char kParamsStart[] = ",\"params\":";
|
||||
|
||||
if (!message.starts_with(kMethodStart))
|
||||
return false;
|
||||
|
||||
const size_t method_start = sizeof(kMethodStart) - 1;
|
||||
const size_t method_end = message.find(kMethodEnd, method_start);
|
||||
if (method_end < 0U)
|
||||
return false;
|
||||
method = message.substr(method_start, method_end - method_start);
|
||||
if (method.empty())
|
||||
return false;
|
||||
|
||||
size_t remainder_start = method_end + sizeof(kMethodEnd) - 1;
|
||||
if (remainder_start == message.size() - 1) {
|
||||
// No more contents.
|
||||
params = base::StringPiece();
|
||||
} else {
|
||||
const base::StringPiece& remainder = message.substr(remainder_start);
|
||||
if (remainder.starts_with(kParamsStart)) {
|
||||
// Stop immediately before the message closing bracket.
|
||||
remainder_start += sizeof(kParamsStart) - 1;
|
||||
params =
|
||||
message.substr(remainder_start, message.size() - 1 - remainder_start);
|
||||
} else {
|
||||
// Invalid format.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsValidDictionary(params, /*allow_empty=*/true))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Examples:
|
||||
// {"id":3,"result":{}}
|
||||
// {"id":4,"result":{"debuggerId":"-2193881606781505058.81393575456727957"}}
|
||||
// {"id":5,"error":{"code":-32000,"message":"Not supported"}}
|
||||
bool ParseResult(const base::StringPiece& message,
|
||||
int& message_id,
|
||||
bool& success,
|
||||
base::StringPiece& result) {
|
||||
static const char kIdStart[] = "{\"id\":";
|
||||
static const char kIdEnd[] = ",";
|
||||
static const char kResultStart[] = "\"result\":";
|
||||
static const char kErrorStart[] = "\"error\":";
|
||||
|
||||
if (!message.starts_with(kIdStart))
|
||||
return false;
|
||||
|
||||
const size_t id_start = sizeof(kIdStart) - 1;
|
||||
const size_t id_end = message.find(kIdEnd, id_start);
|
||||
if (id_end < 0U)
|
||||
return false;
|
||||
const base::StringPiece& id_str = message.substr(id_start, id_end - id_start);
|
||||
if (id_str.empty() || !base::StringToInt(id_str, &message_id))
|
||||
return false;
|
||||
|
||||
size_t remainder_start = id_end + sizeof(kIdEnd) - 1;
|
||||
const base::StringPiece& remainder = message.substr(remainder_start);
|
||||
if (remainder.starts_with(kResultStart)) {
|
||||
// Stop immediately before the message closing bracket.
|
||||
remainder_start += sizeof(kResultStart) - 1;
|
||||
result =
|
||||
message.substr(remainder_start, message.size() - 1 - remainder_start);
|
||||
success = true;
|
||||
} else if (remainder.starts_with(kErrorStart)) {
|
||||
// Stop immediately before the message closing bracket.
|
||||
remainder_start += sizeof(kErrorStart) - 1;
|
||||
result =
|
||||
message.substr(remainder_start, message.size() - 1 - remainder_start);
|
||||
success = false;
|
||||
} else {
|
||||
// Invalid format.
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!IsValidDictionary(result, /*allow_empty=*/true))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// static
|
||||
bool ProtocolParser::IsValidMessage(const base::StringPiece& message) {
|
||||
return IsValidDictionary(message, /*allow_empty=*/false);
|
||||
}
|
||||
|
||||
bool ProtocolParser::Initialize(const base::StringPiece& message) {
|
||||
if (status_ != UNINITIALIZED)
|
||||
return false;
|
||||
|
||||
if (ParseEvent(message, method_, params_)) {
|
||||
status_ = EVENT;
|
||||
} else if (ParseResult(message, message_id_, success_, params_)) {
|
||||
status_ = RESULT;
|
||||
} else {
|
||||
status_ = FAILURE;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace devtools_util
|
@@ -1,72 +0,0 @@
|
||||
// Copyright (c) 2020 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_DEVTOOLS_DEVTOOLS_UTIL_H_
|
||||
#define CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
#include "base/strings/string_piece.h"
|
||||
|
||||
namespace devtools_util {
|
||||
|
||||
// Fast parser for DevTools JSON protocol messages. This implementation makes
|
||||
// certain assumptions about the JSON object structure (value order and
|
||||
// formatting) to avoid stateful parsing of messages that may be large
|
||||
// (sometimes > 1MB in size). The message must be a JSON dictionary that starts
|
||||
// with a "method" or "id" value which is non-empty and of the expected data
|
||||
// type. Messages that have a "method" value (event message) may optionally have
|
||||
// a "params" dictionary. Messages that have an "id" value (result message) must
|
||||
// have a "result" or "error" dictionary. The dictionary contents are not
|
||||
// validated and may be empty ("{}").
|
||||
//
|
||||
// Example event message:
|
||||
// {"method":"Target.targetDestroyed","params":{"targetId":"1234..."}}
|
||||
//
|
||||
// Example result messages:
|
||||
// {"id":3,"result":{}}
|
||||
// {"id":4,"result":{"debuggerId":"-2193881606781505058.81393575456727957"}}
|
||||
// {"id":5,"error":{"code":-32000,"message":"Not supported"}}
|
||||
struct ProtocolParser {
|
||||
ProtocolParser() = default;
|
||||
|
||||
// Checks for a non-empty JSON dictionary.
|
||||
static bool IsValidMessage(const base::StringPiece& message);
|
||||
|
||||
// Returns false if already initialized.
|
||||
bool Initialize(const base::StringPiece& message);
|
||||
|
||||
bool IsInitialized() const { return status_ != UNINITIALIZED; }
|
||||
bool IsEvent() const { return status_ == EVENT; }
|
||||
bool IsResult() const { return status_ == RESULT; }
|
||||
bool IsFailure() const { return status_ == FAILURE; }
|
||||
|
||||
void Reset() { status_ = UNINITIALIZED; }
|
||||
|
||||
// For event messages:
|
||||
// "method" string:
|
||||
base::StringPiece method_;
|
||||
|
||||
// For result messages:
|
||||
// "id" int:
|
||||
int message_id_ = 0;
|
||||
// true if "result" value, false if "error" value:
|
||||
bool success_ = false;
|
||||
|
||||
// For both:
|
||||
// "params", "result" or "error" dictionary:
|
||||
base::StringPiece params_;
|
||||
|
||||
private:
|
||||
enum Status {
|
||||
UNINITIALIZED,
|
||||
EVENT, // Event message.
|
||||
RESULT, // Result message.
|
||||
FAILURE, // Parsing failure.
|
||||
};
|
||||
Status status_ = UNINITIALIZED;
|
||||
};
|
||||
|
||||
} // namespace devtools_util
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_DEVTOOLS_DEVTOOLS_UTIL_H_
|
@@ -1,204 +0,0 @@
|
||||
// Copyright (c) 2020 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/devtools/devtools_util.h"
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
using namespace devtools_util;
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_IsValidMessage) {
|
||||
// Empty dictionary is not valid.
|
||||
EXPECT_FALSE(ProtocolParser::IsValidMessage(""));
|
||||
EXPECT_FALSE(ProtocolParser::IsValidMessage("{}"));
|
||||
|
||||
// Incorrectly formatted dictionary is not valid.
|
||||
EXPECT_FALSE(ProtocolParser::IsValidMessage("{ ]"));
|
||||
|
||||
// Everything else is valid (we don't verify JSON structure).
|
||||
EXPECT_TRUE(ProtocolParser::IsValidMessage("{ }"));
|
||||
EXPECT_TRUE(ProtocolParser::IsValidMessage("{blah blah}"));
|
||||
EXPECT_TRUE(ProtocolParser::IsValidMessage("{method:\"foobar\"}"));
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsFailure_Unknown) {
|
||||
ProtocolParser parser;
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Empty message is invalid.
|
||||
EXPECT_TRUE(parser.Initialize(""));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Empty dictionary is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Unrecognized dictionary type is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{blah blah}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsFailure_EventMalformed) {
|
||||
ProtocolParser parser;
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Empty method is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{\"method\":\"\"}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Unrecognized value is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{\"method\":\"foo\",oops:false}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Params must be a dictionary.
|
||||
EXPECT_TRUE(parser.Initialize("{\"method\":\",params:[]}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsEvent) {
|
||||
ProtocolParser parser;
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Method without params is valid.
|
||||
std::string message = "{\"method\":\"Test.myMethod\"}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsEvent());
|
||||
EXPECT_STREQ("Test.myMethod", parser.method_.as_string().data());
|
||||
EXPECT_TRUE(parser.params_.empty());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Method with empty params dictionary is valid.
|
||||
message = "{\"method\":\"Test.myMethod2\",\"params\":{}}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsEvent());
|
||||
EXPECT_STREQ("Test.myMethod2", parser.method_.as_string().data());
|
||||
EXPECT_STREQ("{}", parser.params_.as_string().data());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Method with non-empty params dictionary is valid.
|
||||
message = "{\"method\":\"Test.myMethod3\",\"params\":{\"foo\":\"bar\"}}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsEvent());
|
||||
EXPECT_STREQ("Test.myMethod3", parser.method_.as_string().data());
|
||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.as_string().data());
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsFailure_ResultMalformed) {
|
||||
ProtocolParser parser;
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Empty ID is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{\"id\":,result:{}}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Missing result or error value is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{\"id\":1}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Unrecognized value is invalid.
|
||||
EXPECT_TRUE(parser.Initialize("{\"id\":1,oops:false}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Result must be a dictionary.
|
||||
EXPECT_TRUE(parser.Initialize("{\"id\":1,\"result\":[]}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Error must be a dictionary.
|
||||
EXPECT_TRUE(parser.Initialize("{\"id\":1,\"error\":[]}"));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsFailure());
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Result) {
|
||||
ProtocolParser parser;
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Id with empty result dictionary is valid.
|
||||
std::string message = "{\"id\":1,\"result\":{}}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsResult());
|
||||
EXPECT_EQ(1, parser.message_id_);
|
||||
EXPECT_TRUE(parser.success_);
|
||||
EXPECT_STREQ("{}", parser.params_.as_string().data());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Id with non-empty result dictionary is valid.
|
||||
message = "{\"id\":2,\"result\":{\"foo\":\"bar\"}}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsResult());
|
||||
EXPECT_EQ(2, parser.message_id_);
|
||||
EXPECT_TRUE(parser.success_);
|
||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.as_string().data());
|
||||
}
|
||||
|
||||
TEST(DevToolsUtil, ProtocolParser_Initialize_IsResult_Error) {
|
||||
ProtocolParser parser;
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Id with empty error dictionary is valid.
|
||||
std::string message = "{\"id\":1,\"error\":{}}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsResult());
|
||||
EXPECT_EQ(1, parser.message_id_);
|
||||
EXPECT_FALSE(parser.success_);
|
||||
EXPECT_STREQ("{}", parser.params_.as_string().data());
|
||||
|
||||
parser.Reset();
|
||||
EXPECT_FALSE(parser.IsInitialized());
|
||||
|
||||
// Id with non-empty error dictionary is valid.
|
||||
message = "{\"id\":2,\"error\":{\"foo\":\"bar\"}}";
|
||||
EXPECT_TRUE(parser.Initialize(message));
|
||||
EXPECT_TRUE(parser.IsInitialized());
|
||||
EXPECT_TRUE(parser.IsResult());
|
||||
EXPECT_EQ(2, parser.message_id_);
|
||||
EXPECT_FALSE(parser.success_);
|
||||
EXPECT_STREQ("{\"foo\":\"bar\"}", parser.params_.as_string().data());
|
||||
}
|
@@ -43,11 +43,11 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
CefBeforeDownloadCallbackImpl(const base::WeakPtr<DownloadManager>& manager,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_name,
|
||||
content::DownloadTargetCallback callback)
|
||||
const content::DownloadTargetCallback& callback)
|
||||
: manager_(manager),
|
||||
download_id_(download_id),
|
||||
suggested_name_(suggested_name),
|
||||
callback_(std::move(callback)) {}
|
||||
callback_(callback) {}
|
||||
|
||||
void Continue(const CefString& download_path, bool show_dialog) override {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
@@ -56,27 +56,28 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
|
||||
if (manager_) {
|
||||
base::FilePath path = base::FilePath(download_path);
|
||||
CEF_POST_USER_VISIBLE_TASK(
|
||||
base::BindOnce(&CefBeforeDownloadCallbackImpl::GenerateFilename,
|
||||
manager_, download_id_, suggested_name_, path,
|
||||
show_dialog, std::move(callback_)));
|
||||
CEF_POST_USER_VISIBLE_TASK(base::Bind(
|
||||
&CefBeforeDownloadCallbackImpl::GenerateFilename, manager_,
|
||||
download_id_, suggested_name_, path, show_dialog, callback_));
|
||||
}
|
||||
|
||||
download_id_ = 0;
|
||||
callback_.Reset();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBeforeDownloadCallbackImpl::Continue,
|
||||
this, download_path, show_dialog));
|
||||
base::Bind(&CefBeforeDownloadCallbackImpl::Continue, this,
|
||||
download_path, show_dialog));
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static void GenerateFilename(base::WeakPtr<DownloadManager> manager,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_name,
|
||||
const base::FilePath& download_path,
|
||||
bool show_dialog,
|
||||
content::DownloadTargetCallback callback) {
|
||||
static void GenerateFilename(
|
||||
base::WeakPtr<DownloadManager> manager,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_name,
|
||||
const base::FilePath& download_path,
|
||||
bool show_dialog,
|
||||
const content::DownloadTargetCallback& callback) {
|
||||
CEF_REQUIRE_BLOCKING();
|
||||
|
||||
base::FilePath suggested_path = download_path;
|
||||
@@ -102,16 +103,16 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBeforeDownloadCallbackImpl::ChooseDownloadPath,
|
||||
manager, download_id, suggested_path, show_dialog,
|
||||
std::move(callback)));
|
||||
base::Bind(&CefBeforeDownloadCallbackImpl::ChooseDownloadPath, manager,
|
||||
download_id, suggested_path, show_dialog, callback));
|
||||
}
|
||||
|
||||
static void ChooseDownloadPath(base::WeakPtr<DownloadManager> manager,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_path,
|
||||
bool show_dialog,
|
||||
content::DownloadTargetCallback callback) {
|
||||
static void ChooseDownloadPath(
|
||||
base::WeakPtr<DownloadManager> manager,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_path,
|
||||
bool show_dialog,
|
||||
const content::DownloadTargetCallback& callback) {
|
||||
if (!manager)
|
||||
return;
|
||||
|
||||
@@ -141,23 +142,21 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
|
||||
browser->RunFileChooser(
|
||||
params,
|
||||
base::BindOnce(
|
||||
base::Bind(
|
||||
&CefBeforeDownloadCallbackImpl::ChooseDownloadPathCallback,
|
||||
std::move(callback)));
|
||||
callback));
|
||||
}
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
std::move(callback).Run(
|
||||
suggested_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download::DownloadItem::MixedContentStatus::UNKNOWN, suggested_path,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
callback.Run(suggested_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, suggested_path,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void ChooseDownloadPathCallback(
|
||||
content::DownloadTargetCallback callback,
|
||||
const content::DownloadTargetCallback& callback,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths) {
|
||||
DCHECK_LE(file_paths.size(), (size_t)1);
|
||||
@@ -167,10 +166,9 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
path = file_paths.front();
|
||||
|
||||
// The download will be cancelled if |path| is empty.
|
||||
std::move(callback).Run(path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download::DownloadItem::MixedContentStatus::UNKNOWN,
|
||||
path, download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
callback.Run(path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
}
|
||||
|
||||
base::WeakPtr<DownloadManager> manager_;
|
||||
@@ -349,13 +347,12 @@ void CefDownloadManagerDelegate::ManagerGoingDown(DownloadManager* manager) {
|
||||
|
||||
bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
||||
DownloadItem* item,
|
||||
content::DownloadTargetCallback* callback) {
|
||||
const content::DownloadTargetCallback& callback) {
|
||||
if (!item->GetForcedFilePath().empty()) {
|
||||
std::move(*callback).Run(
|
||||
callback.Run(
|
||||
item->GetForcedFilePath(), DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download::DownloadItem::MixedContentStatus::UNKNOWN,
|
||||
item->GetForcedFilePath(), download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, item->GetForcedFilePath(),
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -375,7 +372,7 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
||||
CefRefPtr<CefBeforeDownloadCallback> callbackObj(
|
||||
new CefBeforeDownloadCallbackImpl(manager_ptr_factory_.GetWeakPtr(),
|
||||
item->GetId(), suggested_name,
|
||||
std::move(*callback)));
|
||||
callback));
|
||||
|
||||
handler->OnBeforeDownload(browser.get(), download_item.get(),
|
||||
suggested_name.value(), callbackObj);
|
||||
@@ -387,9 +384,9 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::GetNextId(
|
||||
content::DownloadIdCallback callback) {
|
||||
const content::DownloadIdCallback& callback) {
|
||||
static uint32 next_id = DownloadItem::kInvalidId + 1;
|
||||
std::move(callback).Run(next_id++);
|
||||
callback.Run(next_id++);
|
||||
}
|
||||
|
||||
std::string CefDownloadManagerDelegate::ApplicationClientIdForFileScanning() {
|
||||
|
@@ -37,8 +37,8 @@ class CefDownloadManagerDelegate : public download::DownloadItem::Observer,
|
||||
// DownloadManagerDelegate methods.
|
||||
bool DetermineDownloadTarget(
|
||||
download::DownloadItem* item,
|
||||
content::DownloadTargetCallback* callback) override;
|
||||
void GetNextId(content::DownloadIdCallback callback) override;
|
||||
const content::DownloadTargetCallback& callback) override;
|
||||
void GetNextId(const content::DownloadIdCallback& callback) override;
|
||||
std::string ApplicationClientIdForFileScanning() override;
|
||||
|
||||
// CefBrowserHostImpl::Observer methods.
|
||||
|
@@ -44,9 +44,10 @@ class CefGetExtensionLoadFileCallbackImpl
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
RunNow(file_, std::move(callback_), nullptr);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(
|
||||
&CefGetExtensionLoadFileCallbackImpl::RunNow,
|
||||
file_, std::move(callback_), nullptr));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefGetExtensionLoadFileCallbackImpl::RunNow, file_,
|
||||
base::Passed(std::move(callback_)), nullptr));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -55,9 +56,10 @@ class CefGetExtensionLoadFileCallbackImpl
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!callback_.is_null()) {
|
||||
// Always continue asynchronously.
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(
|
||||
&CefGetExtensionLoadFileCallbackImpl::RunNow,
|
||||
file_, std::move(callback_), stream));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefGetExtensionLoadFileCallbackImpl::RunNow, file_,
|
||||
base::Passed(std::move(callback_)), stream));
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(
|
||||
@@ -423,8 +425,8 @@ std::unique_ptr<api::tabs::Tab> CefExtensionFunctionDetails::CreateTabObject(
|
||||
tab_object->id = std::make_unique<int>(new_browser->GetIdentifier());
|
||||
tab_object->index = index;
|
||||
tab_object->window_id = *tab_object->id;
|
||||
tab_object->status = is_loading ? api::tabs::TAB_STATUS_LOADING
|
||||
: api::tabs::TAB_STATUS_COMPLETE;
|
||||
tab_object->status = std::make_unique<std::string>(
|
||||
is_loading ? keys::kStatusValueLoading : keys::kStatusValueComplete);
|
||||
tab_object->active = active;
|
||||
tab_object->selected = true;
|
||||
tab_object->highlighted = true;
|
||||
|
@@ -44,7 +44,6 @@
|
||||
#include "extensions/browser/runtime_data.h"
|
||||
#include "extensions/browser/service_worker_manager.h"
|
||||
#include "extensions/browser/state_store.h"
|
||||
#include "extensions/browser/unloaded_extension_reason.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/extension_messages.h"
|
||||
#include "extensions/common/file_util.h"
|
||||
@@ -97,8 +96,9 @@ void LoadExtensionOnUIThread(base::WeakPtr<CefExtensionSystem> context,
|
||||
CefRefPtr<CefExtensionHandler> handler) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(LoadExtensionOnUIThread, context,
|
||||
std::move(manifest), root_directory,
|
||||
internal, loader_context, handler));
|
||||
base::Passed(std::move(manifest)),
|
||||
root_directory, internal,
|
||||
loader_context, handler));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ AppSorting* CefExtensionSystem::app_sorting() {
|
||||
// ExtensionSystemImpl::RegisterExtensionWithRequestContexts.
|
||||
void CefExtensionSystem::RegisterExtensionWithRequestContexts(
|
||||
const Extension* extension,
|
||||
base::OnceClosure callback) {
|
||||
const base::Closure& callback) {
|
||||
// TODO(extensions): The |incognito_enabled| value should be set based on
|
||||
// manifest settings.
|
||||
base::PostTaskAndReply(
|
||||
@@ -456,7 +456,7 @@ void CefExtensionSystem::RegisterExtensionWithRequestContexts(
|
||||
base::RetainedRef(extension), base::Time::Now(),
|
||||
true, // incognito_enabled
|
||||
false), // notifications_disabled
|
||||
std::move(callback));
|
||||
callback);
|
||||
}
|
||||
|
||||
// Implementation based on
|
||||
|
@@ -102,7 +102,7 @@ class CefExtensionSystem : public ExtensionSystem {
|
||||
AppSorting* app_sorting() override;
|
||||
void RegisterExtensionWithRequestContexts(
|
||||
const Extension* extension,
|
||||
base::OnceClosure callback) override;
|
||||
const base::Closure& callback) override;
|
||||
void UnregisterExtensionWithRequestContexts(
|
||||
const std::string& extension_id,
|
||||
const UnloadedExtensionReason reason) override;
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include "extensions/browser/extension_system.h"
|
||||
#include "extensions/browser/notification_types.h"
|
||||
#include "extensions/browser/runtime_data.h"
|
||||
#include "third_party/blink/public/common/input/web_gesture_event.h"
|
||||
#include "third_party/blink/public/platform/web_gesture_event.h"
|
||||
|
||||
using content::NativeWebKeyboardEvent;
|
||||
using content::OpenURLParams;
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "extensions/browser/extension_host_delegate.h"
|
||||
#include "extensions/browser/extensions_browser_interface_binders.h"
|
||||
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
|
||||
#include "extensions/browser/mojo/interface_registration.h"
|
||||
#include "extensions/browser/url_request_util.h"
|
||||
#include "extensions/common/api/mime_handler.mojom.h"
|
||||
#include "extensions/common/constants.h"
|
||||
@@ -167,7 +168,7 @@ void CefExtensionsBrowserClient::LoadResourceFromResourceBundle(
|
||||
|
||||
bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||
const GURL& url,
|
||||
blink::mojom::ResourceType resource_type,
|
||||
content::ResourceType resource_type,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool is_incognito,
|
||||
@@ -306,6 +307,14 @@ void CefExtensionsBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
base::BindRepeating(&BindBeforeUnloadControl));
|
||||
}
|
||||
|
||||
void CefExtensionsBrowserClient::RegisterExtensionInterfaces(
|
||||
service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>*
|
||||
registry,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const Extension* extension) const {
|
||||
RegisterInterfacesForExtension(registry, render_frame_host, extension);
|
||||
}
|
||||
|
||||
std::unique_ptr<RuntimeAPIDelegate>
|
||||
CefExtensionsBrowserClient::CreateRuntimeAPIDelegate(
|
||||
content::BrowserContext* context) const {
|
||||
|
@@ -55,7 +55,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||
bool send_cors_header) override;
|
||||
bool AllowCrossRendererResourceLoad(const GURL& url,
|
||||
blink::mojom::ResourceType resource_type,
|
||||
content::ResourceType resource_type,
|
||||
ui::PageTransition page_transition,
|
||||
int child_id,
|
||||
bool is_incognito,
|
||||
@@ -86,6 +86,10 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
binder_map,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const Extension* extension) const override;
|
||||
void RegisterExtensionInterfaces(service_manager::BinderRegistryWithArgs<
|
||||
content::RenderFrameHost*>* registry,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const Extension* extension) const override;
|
||||
std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
|
||||
content::BrowserContext* context) const override;
|
||||
const ComponentExtensionResourceManager*
|
||||
|
@@ -32,9 +32,9 @@ const char kPdfResourceIdentifier[] = "chromium-pdf";
|
||||
const char kPdfPluginName[] = "Chrome PDF Viewer";
|
||||
|
||||
std::string GetManifest() {
|
||||
std::string manifest_contents =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_PDF_MANIFEST);
|
||||
std::string manifest_contents = ui::ResourceBundle::GetSharedInstance()
|
||||
.GetRawDataResource(IDR_PDF_MANIFEST)
|
||||
.as_string();
|
||||
DCHECK(manifest_contents.find(kNameTag) != std::string::npos);
|
||||
base::ReplaceFirstSubstringAfterOffset(&manifest_contents, 0, kNameTag,
|
||||
kPdfPluginName);
|
||||
|
@@ -20,20 +20,17 @@ namespace {
|
||||
|
||||
class CefFileDialogCallbackImpl : public CefFileDialogCallback {
|
||||
public:
|
||||
using CallbackType = CefFileDialogRunner::RunFileChooserCallback;
|
||||
|
||||
explicit CefFileDialogCallbackImpl(CallbackType callback)
|
||||
: callback_(std::move(callback)) {}
|
||||
|
||||
explicit CefFileDialogCallbackImpl(
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback)
|
||||
: callback_(callback) {}
|
||||
~CefFileDialogCallbackImpl() override {
|
||||
if (!callback_.is_null()) {
|
||||
// The callback is still pending. Cancel it now.
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
CancelNow(std::move(callback_));
|
||||
CancelNow(callback_);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefFileDialogCallbackImpl::CancelNow,
|
||||
std::move(callback_)));
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefFileDialogCallbackImpl::CancelNow,
|
||||
callback_));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,36 +45,41 @@ class CefFileDialogCallbackImpl : public CefFileDialogCallback {
|
||||
for (; it != file_paths.end(); ++it)
|
||||
vec.push_back(base::FilePath(*it));
|
||||
}
|
||||
std::move(callback_).Run(selected_accept_filter, vec);
|
||||
callback_.Run(selected_accept_filter, vec);
|
||||
callback_.Reset();
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefFileDialogCallbackImpl::Continue, this,
|
||||
selected_accept_filter, file_paths));
|
||||
base::Bind(&CefFileDialogCallbackImpl::Continue, this,
|
||||
selected_accept_filter, file_paths));
|
||||
}
|
||||
}
|
||||
|
||||
void Cancel() override {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!callback_.is_null()) {
|
||||
CancelNow(std::move(callback_));
|
||||
CancelNow(callback_);
|
||||
callback_.Reset();
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefFileDialogCallbackImpl::Cancel, this));
|
||||
base::Bind(&CefFileDialogCallbackImpl::Cancel, this));
|
||||
}
|
||||
}
|
||||
|
||||
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
bool IsConnected() { return !callback_.is_null(); }
|
||||
|
||||
void Disconnect() { callback_.Reset(); }
|
||||
|
||||
private:
|
||||
static void CancelNow(CallbackType callback) {
|
||||
static void CancelNow(
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
std::vector<base::FilePath> file_paths;
|
||||
std::move(callback).Run(0, file_paths);
|
||||
callback.Run(0, file_paths);
|
||||
}
|
||||
|
||||
CallbackType callback_;
|
||||
CefFileDialogRunner::RunFileChooserCallback callback_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefFileDialogCallbackImpl);
|
||||
};
|
||||
@@ -97,16 +99,16 @@ class UploadFolderHelper
|
||||
: public net::DirectoryLister::DirectoryListerDelegate {
|
||||
public:
|
||||
explicit UploadFolderHelper(
|
||||
CefFileDialogRunner::RunFileChooserCallback callback)
|
||||
: callback_(std::move(callback)) {}
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback)
|
||||
: callback_(callback) {}
|
||||
|
||||
~UploadFolderHelper() override {
|
||||
if (!callback_.is_null()) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
CancelNow(std::move(callback_));
|
||||
CancelNow(callback_);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&UploadFolderHelper::CancelNow,
|
||||
std::move(callback_)));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&UploadFolderHelper::CancelNow, callback_));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,15 +123,17 @@ class UploadFolderHelper
|
||||
void OnListDone(int error) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!callback_.is_null()) {
|
||||
std::move(callback_).Run(0, select_files_);
|
||||
callback_.Run(0, select_files_);
|
||||
callback_.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static void CancelNow(CefFileDialogRunner::RunFileChooserCallback callback) {
|
||||
static void CancelNow(
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
std::vector<base::FilePath> file_paths;
|
||||
std::move(callback).Run(0, file_paths);
|
||||
callback.Run(0, file_paths);
|
||||
}
|
||||
|
||||
CefFileDialogRunner::RunFileChooserCallback callback_;
|
||||
@@ -211,35 +215,37 @@ void CefFileDialogManager::RunFileChooser(
|
||||
|
||||
CefFileDialogRunner::RunFileChooserCallback callback;
|
||||
if (params.mode == blink::mojom::FileChooserParams::Mode::kUploadFolder) {
|
||||
callback = base::BindOnce(
|
||||
callback = base::Bind(
|
||||
&CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode, std::move(listener));
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode,
|
||||
base::Passed(std::move(listener)));
|
||||
} else {
|
||||
callback = base::BindOnce(
|
||||
&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode, std::move(listener));
|
||||
callback =
|
||||
base::Bind(&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode,
|
||||
base::Passed(std::move(listener)));
|
||||
}
|
||||
|
||||
RunFileChooserInternal(cef_params, std::move(callback));
|
||||
RunFileChooserInternal(cef_params, callback);
|
||||
}
|
||||
|
||||
void CefFileDialogManager::RunFileChooser(
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
CefFileDialogRunner::RunFileChooserCallback callback) {
|
||||
CefFileDialogRunner::RunFileChooserCallback host_callback =
|
||||
base::BindOnce(&CefFileDialogManager::OnRunFileChooserCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback));
|
||||
RunFileChooserInternal(params, std::move(host_callback));
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback) {
|
||||
const CefFileDialogRunner::RunFileChooserCallback& host_callback =
|
||||
base::Bind(&CefFileDialogManager::OnRunFileChooserCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), callback);
|
||||
RunFileChooserInternal(params, host_callback);
|
||||
}
|
||||
|
||||
void CefFileDialogManager::RunFileChooserInternal(
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
CefFileDialogRunner::RunFileChooserCallback callback) {
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (file_chooser_pending_) {
|
||||
// Dismiss the new dialog immediately.
|
||||
std::move(callback).Run(0, std::vector<base::FilePath>());
|
||||
callback.Run(0, std::vector<base::FilePath>());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -283,30 +289,35 @@ void CefFileDialogManager::RunFileChooserInternal(
|
||||
accept_filters.push_back(*it);
|
||||
|
||||
CefRefPtr<CefFileDialogCallbackImpl> callbackImpl(
|
||||
new CefFileDialogCallbackImpl(std::move(callback)));
|
||||
new CefFileDialogCallbackImpl(callback));
|
||||
handled = handler->OnFileDialog(
|
||||
browser_, static_cast<cef_file_dialog_mode_t>(mode), params.title,
|
||||
params.default_file_name.value(), accept_filters,
|
||||
params.selected_accept_filter, callbackImpl.get());
|
||||
if (!handled) {
|
||||
// May return nullptr if the client has already executed the callback.
|
||||
callback = callbackImpl->Disconnect();
|
||||
if (callbackImpl->IsConnected()) {
|
||||
callbackImpl->Disconnect();
|
||||
} else {
|
||||
// User executed the callback even though they returned false.
|
||||
NOTREACHED();
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!handled && !callback.is_null()) {
|
||||
if (!handled) {
|
||||
if (runner_.get()) {
|
||||
runner_->Run(browser_, params, std::move(callback));
|
||||
runner_->Run(browser_, params, callback);
|
||||
} else {
|
||||
LOG(WARNING) << "No file dialog runner available for this platform";
|
||||
std::move(callback).Run(0, std::vector<base::FilePath>());
|
||||
callback.Run(0, std::vector<base::FilePath>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefFileDialogManager::OnRunFileChooserCallback(
|
||||
CefFileDialogRunner::RunFileChooserCallback callback,
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths) {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -314,8 +325,8 @@ void CefFileDialogManager::OnRunFileChooserCallback(
|
||||
Cleanup();
|
||||
|
||||
// Execute the callback asynchronously.
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(std::move(callback),
|
||||
selected_accept_filter, file_paths));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(callback, selected_accept_filter, file_paths));
|
||||
}
|
||||
|
||||
void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback(
|
||||
@@ -333,9 +344,10 @@ void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback(
|
||||
} else {
|
||||
lister_.reset(new net::DirectoryLister(
|
||||
file_paths[0], net::DirectoryLister::NO_SORT_RECURSIVE,
|
||||
new UploadFolderHelper(base::BindOnce(
|
||||
&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), mode, std::move(listener)))));
|
||||
new UploadFolderHelper(
|
||||
base::Bind(&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), mode,
|
||||
base::Passed(std::move(listener))))));
|
||||
lister_->Start();
|
||||
}
|
||||
}
|
||||
|
@@ -52,18 +52,19 @@ class CefFileDialogManager {
|
||||
// Run the file chooser dialog specified by |params|. Only a single dialog may
|
||||
// be pending at any given time. |callback| will be executed asynchronously
|
||||
// after the dialog is dismissed or if another dialog is already pending.
|
||||
void RunFileChooser(const CefFileDialogRunner::FileChooserParams& params,
|
||||
CefFileDialogRunner::RunFileChooserCallback callback);
|
||||
void RunFileChooser(
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback);
|
||||
|
||||
private:
|
||||
void RunFileChooserInternal(
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
CefFileDialogRunner::RunFileChooserCallback callback);
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback);
|
||||
|
||||
// Used with the RunFileChooser variant where the caller specifies a callback
|
||||
// (no associated RenderFrameHost).
|
||||
void OnRunFileChooserCallback(
|
||||
CefFileDialogRunner::RunFileChooserCallback callback,
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths);
|
||||
|
||||
|
@@ -30,7 +30,7 @@ class CefFileDialogRunner {
|
||||
};
|
||||
|
||||
// The argument vector will be empty if the dialog was canceled.
|
||||
typedef base::OnceCallback<void(int, const std::vector<base::FilePath>&)>
|
||||
typedef base::Callback<void(int, const std::vector<base::FilePath>&)>
|
||||
RunFileChooserCallback;
|
||||
|
||||
// Display the file chooser dialog. Execute |callback| on completion.
|
||||
|
@@ -19,19 +19,17 @@ namespace {
|
||||
|
||||
class CefJSDialogCallbackImpl : public CefJSDialogCallback {
|
||||
public:
|
||||
using CallbackType = content::JavaScriptDialogManager::DialogClosedCallback;
|
||||
using Callback = content::JavaScriptDialogManager::DialogClosedCallback;
|
||||
|
||||
CefJSDialogCallbackImpl(CallbackType callback)
|
||||
: callback_(std::move(callback)) {}
|
||||
CefJSDialogCallbackImpl(Callback callback) : callback_(std::move(callback)) {}
|
||||
~CefJSDialogCallbackImpl() override {
|
||||
if (!callback_.is_null()) {
|
||||
// The callback is still pending. Cancel it now.
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
CancelNow(std::move(callback_));
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefJSDialogCallbackImpl::CancelNow,
|
||||
std::move(callback_)));
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefJSDialogCallbackImpl::CancelNow,
|
||||
base::Passed(std::move(callback_))));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,20 +40,20 @@ class CefJSDialogCallbackImpl : public CefJSDialogCallback {
|
||||
std::move(callback_).Run(success, user_input);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefJSDialogCallbackImpl::Continue,
|
||||
this, success, user_input));
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefJSDialogCallbackImpl::Continue,
|
||||
this, success, user_input));
|
||||
}
|
||||
}
|
||||
|
||||
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
Callback Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
|
||||
private:
|
||||
static void CancelNow(CallbackType callback) {
|
||||
static void CancelNow(Callback callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
std::move(callback).Run(false, base::string16());
|
||||
}
|
||||
|
||||
CallbackType callback_;
|
||||
Callback callback_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefJSDialogCallbackImpl);
|
||||
};
|
||||
@@ -132,10 +130,11 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
|
||||
url_formatter::FormatUrlForSecurityDisplay(origin_url);
|
||||
|
||||
DCHECK(!callback.is_null());
|
||||
runner_->Run(
|
||||
browser_, message_type, display_url, message_text, default_prompt_text,
|
||||
base::BindOnce(&CefJavaScriptDialogManager::DialogClosed,
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
|
||||
runner_->Run(browser_, message_type, display_url, message_text,
|
||||
default_prompt_text,
|
||||
base::Bind(&CefJavaScriptDialogManager::DialogClosed,
|
||||
weak_ptr_factory_.GetWeakPtr(),
|
||||
base::Passed(std::move(callback))));
|
||||
}
|
||||
|
||||
void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
|
||||
@@ -186,13 +185,13 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
|
||||
dialog_running_ = true;
|
||||
|
||||
DCHECK(!callback.is_null());
|
||||
runner_->Run(
|
||||
browser_, content::JAVASCRIPT_DIALOG_TYPE_CONFIRM,
|
||||
base::string16(), // display_url
|
||||
message_text,
|
||||
base::string16(), // default_prompt_text
|
||||
base::BindOnce(&CefJavaScriptDialogManager::DialogClosed,
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
|
||||
runner_->Run(browser_, content::JAVASCRIPT_DIALOG_TYPE_CONFIRM,
|
||||
base::string16(), // display_url
|
||||
message_text,
|
||||
base::string16(), // default_prompt_text
|
||||
base::Bind(&CefJavaScriptDialogManager::DialogClosed,
|
||||
weak_ptr_factory_.GetWeakPtr(),
|
||||
base::Passed(std::move(callback))));
|
||||
}
|
||||
|
||||
void CefJavaScriptDialogManager::CancelDialogs(
|
||||
|
@@ -15,8 +15,8 @@ class CefBrowserHostImpl;
|
||||
|
||||
class CefJavaScriptDialogRunner {
|
||||
public:
|
||||
typedef base::OnceCallback<void(bool /* success */,
|
||||
const base::string16& /* user_input */)>
|
||||
typedef base::Callback<void(bool /* success */,
|
||||
const base::string16& /* user_input */)>
|
||||
DialogClosedCallback;
|
||||
|
||||
// Run the dialog. Execute |callback| on completion.
|
||||
@@ -25,7 +25,7 @@ class CefJavaScriptDialogRunner {
|
||||
const base::string16& display_url,
|
||||
const base::string16& message_text,
|
||||
const base::string16& default_prompt_text,
|
||||
DialogClosedCallback callback) = 0;
|
||||
const DialogClosedCallback& callback) = 0;
|
||||
|
||||
// Cancel a dialog mid-flight.
|
||||
virtual void Cancel() = 0;
|
||||
|
@@ -38,7 +38,10 @@ CefRefPtr<CefMediaSource> CefMediaRouteImpl::GetSource() {
|
||||
}
|
||||
|
||||
CefRefPtr<CefMediaSink> CefMediaRouteImpl::GetSink() {
|
||||
return new CefMediaSinkImpl(route_.media_sink_id(), route_.media_sink_name());
|
||||
// Note: The MediaRoute::media_sink_name() method is missing in this Chromium
|
||||
// verison, so we need to use an empty value.
|
||||
return new CefMediaSinkImpl(route_.media_sink_id(),
|
||||
std::string() /* sink_name */);
|
||||
}
|
||||
|
||||
void CefMediaRouteImpl::SendRouteMessage(const void* message,
|
||||
|
@@ -4,84 +4,6 @@
|
||||
|
||||
#include "libcef/browser/media_router/media_sink_impl.h"
|
||||
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.h"
|
||||
#include "chrome/browser/media/router/providers/cast/dual_media_sink_service.h"
|
||||
#include "chrome/common/media_router/discovery/media_sink_internal.h"
|
||||
#include "chrome/common/media_router/discovery/media_sink_service_base.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using SinkServiceVector = std::vector<media_router::MediaSinkServiceBase*>;
|
||||
|
||||
SinkServiceVector GetSinkServices() {
|
||||
CEF_REQUIRE_UIT();
|
||||
auto sink_service = media_router::DualMediaSinkService::GetInstance();
|
||||
return {sink_service->GetCastMediaSinkServiceImpl(),
|
||||
sink_service->GetDialMediaSinkServiceImpl()};
|
||||
}
|
||||
|
||||
void GetSinkInternalAndContinue(
|
||||
SinkServiceVector services,
|
||||
const media_router::MediaSink::Id& sink_id,
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
CefMediaSinkDeviceInfo device_info;
|
||||
const media_router::MediaSinkInternal* sink_internal = nullptr;
|
||||
|
||||
for (auto service : services) {
|
||||
sink_internal = service->GetSinkById(sink_id);
|
||||
if (sink_internal)
|
||||
break;
|
||||
}
|
||||
|
||||
if (sink_internal) {
|
||||
if (sink_internal->is_cast_sink()) {
|
||||
const auto& cast_data = sink_internal->cast_data();
|
||||
CefString(&device_info.ip_address) =
|
||||
cast_data.ip_endpoint.ToStringWithoutPort();
|
||||
device_info.port = cast_data.ip_endpoint.port();
|
||||
CefString(&device_info.model_name) = cast_data.model_name;
|
||||
} else if (sink_internal->is_dial_sink()) {
|
||||
const auto& dial_data = sink_internal->dial_data();
|
||||
CefString(&device_info.ip_address) = dial_data.ip_address.ToString();
|
||||
if (dial_data.app_url.is_valid() && dial_data.app_url.has_port()) {
|
||||
base::StringToInt(dial_data.app_url.port_piece(), &device_info.port);
|
||||
}
|
||||
CefString(&device_info.model_name) = dial_data.model_name;
|
||||
}
|
||||
}
|
||||
|
||||
// Execute the callback on the UI thread.
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefMediaSinkDeviceInfoCallback::OnMediaSinkDeviceInfo,
|
||||
callback, device_info));
|
||||
}
|
||||
|
||||
void GetDeviceInfo(const media_router::MediaSink::Id& sink_id,
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
auto next_step = base::BindOnce(
|
||||
[](const media_router::MediaSink::Id& sink_id,
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::BindOnce(GetSinkInternalAndContinue,
|
||||
GetSinkServices(), sink_id, callback));
|
||||
},
|
||||
sink_id, callback);
|
||||
|
||||
if (CEF_CURRENTLY_ON(CEF_UIT)) {
|
||||
std::move(next_step).Run();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, std::move(next_step));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefMediaSinkImpl::CefMediaSinkImpl(const media_router::MediaSink& sink)
|
||||
: sink_(sink) {}
|
||||
|
||||
@@ -105,20 +27,6 @@ CefString CefMediaSinkImpl::GetDescription() {
|
||||
return sink_.description().value_or("");
|
||||
}
|
||||
|
||||
CefMediaSink::IconType CefMediaSinkImpl::GetIconType() {
|
||||
// Verify that our enum matches Chromium's values.
|
||||
static_assert(static_cast<int>(CEF_MSIT_TOTAL_COUNT) ==
|
||||
static_cast<int>(media_router::SinkIconType::TOTAL_COUNT),
|
||||
"enum mismatch");
|
||||
|
||||
return static_cast<CefMediaSink::IconType>(sink_.icon_type());
|
||||
}
|
||||
|
||||
void CefMediaSinkImpl::GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
::GetDeviceInfo(sink_.id(), callback);
|
||||
}
|
||||
|
||||
bool CefMediaSinkImpl::IsCastSink() {
|
||||
return sink_.provider_id() == media_router::CAST;
|
||||
}
|
||||
|
@@ -22,9 +22,6 @@ class CefMediaSinkImpl : public CefMediaSink {
|
||||
bool IsValid() override;
|
||||
CefString GetName() override;
|
||||
CefString GetDescription() override;
|
||||
IconType GetIconType() override;
|
||||
void GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) override;
|
||||
bool IsCastSink() override;
|
||||
bool IsDialSink() override;
|
||||
bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) override;
|
||||
|
@@ -11,8 +11,8 @@
|
||||
#include "libcef/browser/menu_runner.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "content/public/browser/context_menu_params.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
#include "content/public/common/context_menu_params.h"
|
||||
|
||||
namespace content {
|
||||
class RenderFrameHost;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
||||
#include "third_party/blink/public/platform/web_mouse_event.h"
|
||||
|
||||
CefBrowserPlatformDelegateNative::CefBrowserPlatformDelegateNative(
|
||||
const CefWindowInfo& window_info,
|
||||
|
@@ -258,10 +258,10 @@ void CefBrowserPlatformDelegate::HandleExternalProtocol(const GURL& url) {}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle(
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
// TODO(cef): We need to return an XEvent* from this method, but
|
||||
// |event.os_event->native_event()| now returns a ui::Event* instead.
|
||||
// See https://crbug.com/965991.
|
||||
return nullptr;
|
||||
if (!event.os_event)
|
||||
return nullptr;
|
||||
return const_cast<CefEventHandle>(
|
||||
static_cast<CefEventHandle>(event.os_event->native_event()));
|
||||
}
|
||||
|
||||
std::unique_ptr<CefMenuRunner>
|
||||
|
@@ -21,9 +21,9 @@
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "third_party/blink/public/common/input/web_input_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
|
||||
#include "third_party/blink/public/platform/web_input_event.h"
|
||||
#include "third_party/blink/public/platform/web_mouse_event.h"
|
||||
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
|
||||
#import "ui/base/cocoa/cocoa_base_utils.h"
|
||||
#import "ui/base/cocoa/underlay_opengl_hosting_window.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
@@ -526,7 +526,8 @@ CefBrowserPlatformDelegateNativeMac::TranslateWebWheelEvent(
|
||||
result.delta_y = deltaY;
|
||||
result.wheel_ticks_x = deltaX / scrollbarPixelsPerCocoaTick;
|
||||
result.wheel_ticks_y = deltaY / scrollbarPixelsPerCocoaTick;
|
||||
result.delta_units = ui::ScrollGranularity::kScrollByPrecisePixel;
|
||||
result.delta_units =
|
||||
ui::input_types::ScrollGranularity::kScrollByPrecisePixel;
|
||||
|
||||
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||
|
@@ -22,8 +22,8 @@
|
||||
#include "base/win/registry.h"
|
||||
#include "base/win/win_util.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
|
||||
#include "third_party/blink/public/platform/web_mouse_event.h"
|
||||
#include "third_party/blink/public/platform/web_mouse_wheel_event.h"
|
||||
#include "ui/aura/window.h"
|
||||
#include "ui/base/win/shell.h"
|
||||
#include "ui/display/display.h"
|
||||
|
@@ -9,10 +9,6 @@
|
||||
|
||||
#include "libcef/browser/file_dialog_runner.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
|
||||
@class NSView;
|
||||
|
||||
class CefFileDialogRunnerMac : public CefFileDialogRunner {
|
||||
public:
|
||||
CefFileDialogRunnerMac();
|
||||
@@ -21,21 +17,6 @@ class CefFileDialogRunnerMac : public CefFileDialogRunner {
|
||||
void Run(CefBrowserHostImpl* browser,
|
||||
const FileChooserParams& params,
|
||||
RunFileChooserCallback callback) override;
|
||||
|
||||
private:
|
||||
static void RunOpenFileDialog(
|
||||
base::WeakPtr<CefFileDialogRunnerMac> weak_this,
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
NSView* view,
|
||||
int filter_index);
|
||||
static void RunSaveFileDialog(
|
||||
base::WeakPtr<CefFileDialogRunnerMac> weak_this,
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
NSView* view,
|
||||
int filter_index);
|
||||
|
||||
CefFileDialogRunner::RunFileChooserCallback callback_;
|
||||
base::WeakPtrFactory<CefFileDialogRunnerMac> weak_ptr_factory_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_NATIVE_FILE_DIALOG_RUNNER_MAC_H_
|
||||
|
@@ -229,34 +229,12 @@ void AddFilters(NSPopUpButton* button,
|
||||
|
||||
@end
|
||||
|
||||
CefFileDialogRunnerMac::CefFileDialogRunnerMac() : weak_ptr_factory_(this) {}
|
||||
namespace {
|
||||
|
||||
void CefFileDialogRunnerMac::Run(CefBrowserHostImpl* browser,
|
||||
const FileChooserParams& params,
|
||||
RunFileChooserCallback callback) {
|
||||
callback_ = std::move(callback);
|
||||
|
||||
int filter_index = params.selected_accept_filter;
|
||||
NSView* owner = CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(browser->GetWindowHandle());
|
||||
auto weak_this = weak_ptr_factory_.GetWeakPtr();
|
||||
|
||||
if (params.mode == blink::mojom::FileChooserParams::Mode::kOpen ||
|
||||
params.mode == blink::mojom::FileChooserParams::Mode::kOpenMultiple ||
|
||||
params.mode == blink::mojom::FileChooserParams::Mode::kUploadFolder) {
|
||||
RunOpenFileDialog(weak_this, params, owner, filter_index);
|
||||
} else if (params.mode == blink::mojom::FileChooserParams::Mode::kSave) {
|
||||
RunSaveFileDialog(weak_this, params, owner, filter_index);
|
||||
} else {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void CefFileDialogRunnerMac::RunOpenFileDialog(
|
||||
base::WeakPtr<CefFileDialogRunnerMac> weak_this,
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
NSView* view,
|
||||
int filter_index) {
|
||||
void RunOpenFileDialog(const CefFileDialogRunner::FileChooserParams& params,
|
||||
NSView* view,
|
||||
int filter_index,
|
||||
CefFileDialogRunner::RunFileChooserCallback callback) {
|
||||
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
|
||||
|
||||
base::string16 title;
|
||||
@@ -330,21 +308,18 @@ void CefFileDialogRunnerMac::RunOpenFileDialog(
|
||||
if (url.isFileURL)
|
||||
files.push_back(base::FilePath(url.path.UTF8String));
|
||||
}
|
||||
std::move(weak_this->callback_)
|
||||
.Run(filter_index_to_use, files);
|
||||
callback.Run(filter_index_to_use, files);
|
||||
} else {
|
||||
std::move(weak_this->callback_)
|
||||
.Run(filter_index_to_use, std::vector<base::FilePath>());
|
||||
callback.Run(filter_index_to_use,
|
||||
std::vector<base::FilePath>());
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
// static
|
||||
void CefFileDialogRunnerMac::RunSaveFileDialog(
|
||||
base::WeakPtr<CefFileDialogRunnerMac> weak_this,
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
NSView* view,
|
||||
int filter_index) {
|
||||
void RunSaveFileDialog(const CefFileDialogRunner::FileChooserParams& params,
|
||||
NSView* view,
|
||||
int filter_index,
|
||||
CefFileDialogRunner::RunFileChooserCallback callback) {
|
||||
NSSavePanel* savePanel = [NSSavePanel savePanel];
|
||||
|
||||
base::string16 title;
|
||||
@@ -396,11 +371,31 @@ void CefFileDialogRunnerMac::RunSaveFileDialog(
|
||||
NSURL* url = savePanel.URL;
|
||||
const char* path = url.path.UTF8String;
|
||||
std::vector<base::FilePath> files(1, base::FilePath(path));
|
||||
std::move(weak_this->callback_)
|
||||
.Run(filter_index_to_use, files);
|
||||
callback.Run(filter_index_to_use, files);
|
||||
} else {
|
||||
std::move(weak_this->callback_)
|
||||
.Run(filter_index_to_use, std::vector<base::FilePath>());
|
||||
callback.Run(filter_index_to_use,
|
||||
std::vector<base::FilePath>());
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefFileDialogRunnerMac::CefFileDialogRunnerMac() {}
|
||||
|
||||
void CefFileDialogRunnerMac::Run(CefBrowserHostImpl* browser,
|
||||
const FileChooserParams& params,
|
||||
RunFileChooserCallback callback) {
|
||||
int filter_index = params.selected_accept_filter;
|
||||
NSView* owner = CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(browser->GetWindowHandle());
|
||||
|
||||
if (params.mode == blink::mojom::FileChooserParams::Mode::kOpen ||
|
||||
params.mode == blink::mojom::FileChooserParams::Mode::kOpenMultiple ||
|
||||
params.mode == blink::mojom::FileChooserParams::Mode::kUploadFolder) {
|
||||
RunOpenFileDialog(params, owner, filter_index, callback);
|
||||
} else if (params.mode == blink::mojom::FileChooserParams::Mode::kSave) {
|
||||
RunSaveFileDialog(params, owner, filter_index, callback);
|
||||
} else {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
}
|
||||
|
@@ -520,5 +520,5 @@ void CefFileDialogRunnerWin::Run(CefBrowserHostImpl* browser,
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
std::move(callback).Run(filter_index, files);
|
||||
callback.Run(filter_index, files);
|
||||
}
|
||||
|
@@ -29,7 +29,7 @@ class CefJavaScriptDialogRunnerMac : public CefJavaScriptDialogRunner {
|
||||
const base::string16& display_url,
|
||||
const base::string16& message_text,
|
||||
const base::string16& default_prompt_text,
|
||||
DialogClosedCallback callback) override;
|
||||
const DialogClosedCallback& callback) override;
|
||||
void Cancel() override;
|
||||
|
||||
// Callback from CefJavaScriptDialogHelper when the dialog is closed.
|
||||
|
@@ -38,7 +38,7 @@
|
||||
- (id)initHelperWithCallback:
|
||||
(CefJavaScriptDialogRunner::DialogClosedCallback)callback {
|
||||
if (self = [super init])
|
||||
callback_ = std::move(callback);
|
||||
callback_ = callback;
|
||||
|
||||
return self;
|
||||
}
|
||||
@@ -69,7 +69,7 @@
|
||||
if (textField_)
|
||||
input = base::SysNSStringToUTF16([textField_ stringValue]);
|
||||
|
||||
std::move(callback_).Run(success, input);
|
||||
callback_.Run(success, input);
|
||||
}
|
||||
|
||||
- (void)cancel {
|
||||
@@ -92,15 +92,15 @@ void CefJavaScriptDialogRunnerMac::Run(
|
||||
const base::string16& display_url,
|
||||
const base::string16& message_text,
|
||||
const base::string16& default_prompt_text,
|
||||
DialogClosedCallback callback) {
|
||||
const DialogClosedCallback& callback) {
|
||||
DCHECK(!helper_.get());
|
||||
callback_ = std::move(callback);
|
||||
callback_ = callback;
|
||||
|
||||
bool text_field = message_type == content::JAVASCRIPT_DIALOG_TYPE_PROMPT;
|
||||
bool one_button = message_type == content::JAVASCRIPT_DIALOG_TYPE_ALERT;
|
||||
|
||||
helper_.reset([[CefJavaScriptDialogHelper alloc]
|
||||
initHelperWithCallback:base::BindOnce(
|
||||
initHelperWithCallback:base::Bind(
|
||||
&CefJavaScriptDialogRunnerMac::DialogClosed,
|
||||
weak_ptr_factory_.GetWeakPtr())]);
|
||||
|
||||
@@ -167,5 +167,5 @@ void CefJavaScriptDialogRunnerMac::DialogClosed(
|
||||
bool success,
|
||||
const base::string16& user_input) {
|
||||
helper_.reset(nil);
|
||||
std::move(callback_).Run(success, user_input);
|
||||
callback_.Run(success, user_input);
|
||||
}
|
||||
|
@@ -96,13 +96,13 @@ void CefJavaScriptDialogRunnerWin::Run(
|
||||
const base::string16& display_url,
|
||||
const base::string16& message_text,
|
||||
const base::string16& default_prompt_text,
|
||||
DialogClosedCallback callback) {
|
||||
const DialogClosedCallback& callback) {
|
||||
DCHECK(!dialog_win_);
|
||||
|
||||
message_type_ = message_type;
|
||||
message_text_ = message_text;
|
||||
default_prompt_text_ = default_prompt_text;
|
||||
callback_ = std::move(callback);
|
||||
callback_ = callback;
|
||||
|
||||
InstallMessageHook();
|
||||
hook_installed_ = true;
|
||||
@@ -177,7 +177,8 @@ void CefJavaScriptDialogRunnerWin::CloseDialog(
|
||||
// cleared. Otherwise, RenderWidgetHostImpl::IsIgnoringInputEvents will
|
||||
// return true and RenderWidgetHostViewAura::OnWindowFocused will fail to
|
||||
// re-assign browser focus.
|
||||
std::move(callback_).Run(success, user_input);
|
||||
callback_.Run(success, user_input);
|
||||
callback_.Reset();
|
||||
Cancel();
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,7 @@ class CefJavaScriptDialogRunnerWin : public CefJavaScriptDialogRunner {
|
||||
const base::string16& display_url,
|
||||
const base::string16& message_text,
|
||||
const base::string16& default_prompt_text,
|
||||
DialogClosedCallback callback) override;
|
||||
const DialogClosedCallback& callback) override;
|
||||
void Cancel() override;
|
||||
|
||||
private:
|
||||
|
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "ui/base/x/x11_util.h"
|
||||
#include "ui/events/platform/platform_event_source.h"
|
||||
#include "ui/events/x/x11_event_translation.h"
|
||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
|
||||
#include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
|
||||
|
||||
@@ -29,6 +28,13 @@ const char kNetWMState[] = "_NET_WM_STATE";
|
||||
const char kXdndProxy[] = "XdndProxy";
|
||||
const char kUTF8String[] = "UTF8_STRING";
|
||||
|
||||
::Window FindEventTarget(const ui::PlatformEvent& xev) {
|
||||
::Window target = xev->xany.window;
|
||||
if (xev->type == GenericEvent)
|
||||
target = static_cast<XIDeviceEvent*>(xev->xcookie.data)->event;
|
||||
return target;
|
||||
}
|
||||
|
||||
::Window FindChild(::Display* display, ::Window window) {
|
||||
::Window root;
|
||||
::Window parent;
|
||||
@@ -103,8 +109,8 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
CWBackPixmap | CWOverrideRedirect, &swa);
|
||||
CHECK(xwindow_);
|
||||
|
||||
DCHECK(ui::X11EventSource::HasInstance());
|
||||
ui::X11EventSource::GetInstance()->AddXEventDispatcher(this);
|
||||
if (ui::PlatformEventSource::GetInstance())
|
||||
ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
||||
|
||||
long event_mask = FocusChangeMask | StructureNotifyMask | PropertyChangeMask;
|
||||
XSelectInput(xdisplay_, xwindow_, event_mask);
|
||||
@@ -142,8 +148,8 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
|
||||
CefWindowX11::~CefWindowX11() {
|
||||
DCHECK(!xwindow_);
|
||||
DCHECK(ui::X11EventSource::HasInstance());
|
||||
ui::X11EventSource::GetInstance()->RemoveXEventDispatcher(this);
|
||||
if (ui::PlatformEventSource::GetInstance())
|
||||
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
||||
}
|
||||
|
||||
void CefWindowX11::Close() {
|
||||
@@ -282,88 +288,12 @@ views::DesktopWindowTreeHostX11* CefWindowX11::GetHost() {
|
||||
}
|
||||
|
||||
bool CefWindowX11::CanDispatchEvent(const ui::PlatformEvent& event) {
|
||||
DCHECK_NE(xwindow_, x11::None);
|
||||
return !!current_xevent_;
|
||||
::Window target = FindEventTarget(event);
|
||||
return target == xwindow_;
|
||||
}
|
||||
|
||||
uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
||||
DCHECK_NE(xwindow_, x11::None);
|
||||
DCHECK(event);
|
||||
DCHECK(current_xevent_);
|
||||
|
||||
ProcessXEvent(current_xevent_);
|
||||
return ui::POST_DISPATCH_STOP_PROPAGATION;
|
||||
}
|
||||
|
||||
// Called by X11EventSourceLibevent to determine whether this XEventDispatcher
|
||||
// implementation is able to process the next translated event sent by it.
|
||||
void CefWindowX11::CheckCanDispatchNextPlatformEvent(XEvent* xev) {
|
||||
current_xevent_ = IsTargetedBy(*xev) ? xev : nullptr;
|
||||
}
|
||||
|
||||
void CefWindowX11::PlatformEventDispatchFinished() {
|
||||
current_xevent_ = nullptr;
|
||||
}
|
||||
|
||||
ui::PlatformEventDispatcher* CefWindowX11::GetPlatformEventDispatcher() {
|
||||
return this;
|
||||
}
|
||||
|
||||
bool CefWindowX11::DispatchXEvent(XEvent* xev) {
|
||||
if (!IsTargetedBy(*xev))
|
||||
return false;
|
||||
ProcessXEvent(xev);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefWindowX11::ContinueFocus() {
|
||||
if (!focus_pending_)
|
||||
return;
|
||||
if (browser_.get())
|
||||
browser_->SetFocus(true);
|
||||
focus_pending_ = false;
|
||||
}
|
||||
|
||||
bool CefWindowX11::TopLevelAlwaysOnTop() const {
|
||||
::Window toplevel_window = FindToplevelParent(xdisplay_, xwindow_);
|
||||
|
||||
Atom state_atom = gfx::GetAtom("_NET_WM_STATE");
|
||||
Atom state_keep_above = gfx::GetAtom("_NET_WM_STATE_KEEP_ABOVE");
|
||||
Atom* states;
|
||||
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long num_items;
|
||||
unsigned long bytes_after;
|
||||
|
||||
XGetWindowProperty(xdisplay_, toplevel_window, state_atom, 0, 1024,
|
||||
x11::False, XA_ATOM, &actual_type, &actual_format,
|
||||
&num_items, &bytes_after,
|
||||
reinterpret_cast<unsigned char**>(&states));
|
||||
|
||||
bool always_on_top = false;
|
||||
|
||||
for (unsigned long i = 0; i < num_items; ++i) {
|
||||
if (states[i] == state_keep_above) {
|
||||
always_on_top = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(states);
|
||||
|
||||
return always_on_top;
|
||||
}
|
||||
|
||||
bool CefWindowX11::IsTargetedBy(const XEvent& xev) const {
|
||||
::Window target_window =
|
||||
(xev.type == GenericEvent)
|
||||
? static_cast<XIDeviceEvent*>(xev.xcookie.data)->event
|
||||
: xev.xany.window;
|
||||
return target_window == xwindow_;
|
||||
}
|
||||
|
||||
void CefWindowX11::ProcessXEvent(XEvent* xev) {
|
||||
XEvent* xev = event;
|
||||
switch (xev->type) {
|
||||
case ConfigureNotify: {
|
||||
DCHECK_EQ(xwindow_, xev->xconfigure.event);
|
||||
@@ -472,4 +402,45 @@ void CefWindowX11::ProcessXEvent(XEvent* xev) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ui::POST_DISPATCH_STOP_PROPAGATION;
|
||||
}
|
||||
|
||||
void CefWindowX11::ContinueFocus() {
|
||||
if (!focus_pending_)
|
||||
return;
|
||||
if (browser_.get())
|
||||
browser_->SetFocus(true);
|
||||
focus_pending_ = false;
|
||||
}
|
||||
|
||||
bool CefWindowX11::TopLevelAlwaysOnTop() const {
|
||||
::Window toplevel_window = FindToplevelParent(xdisplay_, xwindow_);
|
||||
|
||||
Atom state_atom = gfx::GetAtom("_NET_WM_STATE");
|
||||
Atom state_keep_above = gfx::GetAtom("_NET_WM_STATE_KEEP_ABOVE");
|
||||
Atom* states;
|
||||
|
||||
Atom actual_type;
|
||||
int actual_format;
|
||||
unsigned long num_items;
|
||||
unsigned long bytes_after;
|
||||
|
||||
XGetWindowProperty(xdisplay_, toplevel_window, state_atom, 0, 1024,
|
||||
x11::False, XA_ATOM, &actual_type, &actual_format,
|
||||
&num_items, &bytes_after,
|
||||
reinterpret_cast<unsigned char**>(&states));
|
||||
|
||||
bool always_on_top = false;
|
||||
|
||||
for (unsigned long i = 0; i < num_items; ++i) {
|
||||
if (states[i] == state_keep_above) {
|
||||
always_on_top = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
XFree(states);
|
||||
|
||||
return always_on_top;
|
||||
}
|
||||
|
@@ -16,7 +16,6 @@ typedef struct _XDisplay Display;
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "ui/events/platform/platform_event_dispatcher.h"
|
||||
#include "ui/events/platform/x11/x11_event_source.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/gfx/x/x11_atom_cache.h"
|
||||
|
||||
@@ -26,8 +25,7 @@ class DesktopWindowTreeHostX11;
|
||||
|
||||
// Object wrapper for an X11 Window.
|
||||
// Based on WindowTreeHostX11 and DesktopWindowTreeHostX11.
|
||||
class CefWindowX11 : public ui::PlatformEventDispatcher,
|
||||
public ui::XEventDispatcher {
|
||||
class CefWindowX11 : public ui::PlatformEventDispatcher {
|
||||
public:
|
||||
CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||
::Window parent_xwindow,
|
||||
@@ -52,12 +50,6 @@ class CefWindowX11 : public ui::PlatformEventDispatcher,
|
||||
bool CanDispatchEvent(const ui::PlatformEvent& event) override;
|
||||
uint32_t DispatchEvent(const ui::PlatformEvent& event) override;
|
||||
|
||||
// ui::XEventDispatcher methods:
|
||||
void CheckCanDispatchNextPlatformEvent(XEvent* xev) override;
|
||||
void PlatformEventDispatchFinished() override;
|
||||
ui::PlatformEventDispatcher* GetPlatformEventDispatcher() override;
|
||||
bool DispatchXEvent(XEvent* event) override;
|
||||
|
||||
::Window xwindow() const { return xwindow_; }
|
||||
gfx::Rect bounds() const { return bounds_; }
|
||||
|
||||
@@ -66,9 +58,6 @@ class CefWindowX11 : public ui::PlatformEventDispatcher,
|
||||
private:
|
||||
void ContinueFocus();
|
||||
|
||||
bool IsTargetedBy(const XEvent& xev) const;
|
||||
void ProcessXEvent(XEvent* xev);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> browser_;
|
||||
|
||||
// The display and the native X window hosting the root window.
|
||||
@@ -84,11 +73,6 @@ class CefWindowX11 : public ui::PlatformEventDispatcher,
|
||||
|
||||
bool focus_pending_;
|
||||
|
||||
// Tells if this dispatcher can process next translated event based on a
|
||||
// previous check in ::CheckCanDispatchNextPlatformEvent based on a XID
|
||||
// target.
|
||||
XEvent* current_xevent_ = nullptr;
|
||||
|
||||
// Must always be the last member.
|
||||
base::WeakPtrFactory<CefWindowX11> weak_ptr_factory_;
|
||||
|
||||
|
@@ -37,7 +37,7 @@ struct CefNavigateParams {
|
||||
// lead to undesired cookie blocking. Third-party cookie blocking can be
|
||||
// bypassed by setting site_for_cookies = url, but this should ideally
|
||||
// only be done if there really is no way to determine the correct value.
|
||||
net::SiteForCookies site_for_cookies;
|
||||
GURL site_for_cookies;
|
||||
|
||||
// Additional HTTP request headers.
|
||||
std::string headers;
|
||||
|
@@ -43,7 +43,6 @@
|
||||
#include "content/public/common/url_utils.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "ipc/ipc_channel.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
using extensions::api::cef::kSupportedAPIs;
|
||||
@@ -75,7 +74,6 @@ const char* kAllowedWebUIHosts[] = {
|
||||
content::kChromeUIAppCacheInternalsHost,
|
||||
chrome::kChromeUIAccessibilityHost,
|
||||
content::kChromeUIBlobInternalsHost,
|
||||
chrome::kChromeUIChromeURLsHost,
|
||||
chrome::kChromeUICreditsHost,
|
||||
kChromeUIExtensionsSupportHost,
|
||||
content::kChromeUIGpuHost,
|
||||
@@ -120,7 +118,6 @@ const struct {
|
||||
const char* host;
|
||||
ChromeHostId host_id;
|
||||
} kAllowedCefHosts[] = {
|
||||
{chrome::kChromeUIChromeURLsHost, CHROME_WEBUI_HOSTS},
|
||||
{kChromeUIExtensionsSupportHost, CHROME_EXTENSIONS_SUPPORT},
|
||||
{kChromeUILicenseHost, CHROME_LICENSE},
|
||||
{chrome::kChromeUIVersionHost, CHROME_VERSION},
|
||||
@@ -344,17 +341,16 @@ bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) {
|
||||
}
|
||||
|
||||
bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
||||
std::string piece =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_CEF_LICENSE_TXT);
|
||||
base::StringPiece piece = CefContentClient::Get()->GetDataResource(
|
||||
IDR_CEF_LICENSE_TXT, ui::SCALE_FACTOR_NONE);
|
||||
if (piece.empty()) {
|
||||
NOTREACHED() << "Failed to load license txt resource.";
|
||||
return false;
|
||||
}
|
||||
|
||||
*mime_type = "text/html";
|
||||
*output = "<html><head><title>License</title></head><body><pre>" + piece +
|
||||
"</pre></body></html>";
|
||||
*output = "<html><head><title>License</title></head><body><pre>" +
|
||||
piece.as_string() + "</pre></body></html>";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -362,10 +358,9 @@ bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
||||
bool OnVersionUI(Profile* profile,
|
||||
std::string* mime_type,
|
||||
std::string* output) {
|
||||
std::string tmpl =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_CEF_VERSION_HTML);
|
||||
if (tmpl.empty()) {
|
||||
base::StringPiece piece = CefContentClient::Get()->GetDataResource(
|
||||
IDR_CEF_VERSION_HTML, ui::SCALE_FACTOR_NONE);
|
||||
if (piece.empty()) {
|
||||
NOTREACHED() << "Failed to load version html resource.";
|
||||
return false;
|
||||
}
|
||||
@@ -386,6 +381,7 @@ bool OnVersionUI(Profile* profile,
|
||||
parser.Add("MODULEPATH", GetModulePath());
|
||||
parser.Add("CACHEPATH", CefString(profile->GetPath().value()));
|
||||
|
||||
std::string tmpl = piece.as_string();
|
||||
parser.Parse(&tmpl);
|
||||
|
||||
*mime_type = "text/html";
|
||||
@@ -396,8 +392,8 @@ bool OnVersionUI(Profile* profile,
|
||||
|
||||
bool OnWebUIHostsUI(std::string* mime_type, std::string* output) {
|
||||
std::string html =
|
||||
"<html>\n<head><title>Chrome URLs</title></head>\n"
|
||||
"<body bgcolor=\"white\"><h3>List of Chrome URLs</h3>\n<ul>\n";
|
||||
"<html>\n<head><title>WebUI Hosts</title></head>\n"
|
||||
"<body bgcolor=\"white\"><h3>WebUI Hosts</h3>\n<ul>\n";
|
||||
|
||||
std::vector<std::string> list;
|
||||
GetAllowedHosts(&list);
|
||||
|
@@ -17,7 +17,7 @@ namespace {
|
||||
void UpdateCRLSet(const std::string& crl_set_bytes) {
|
||||
CEF_REQUIRE_UIT();
|
||||
content::GetNetworkService()->UpdateCRLSet(
|
||||
base::as_bytes(base::make_span(crl_set_bytes)), base::DoNothing());
|
||||
base::as_bytes(base::make_span(crl_set_bytes)));
|
||||
}
|
||||
|
||||
void LoadFromDisk(const base::FilePath& path) {
|
||||
|
@@ -158,15 +158,13 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory {
|
||||
action.mime_type = GetMimeType(url.path());
|
||||
|
||||
if (!action.bytes && action.resource_id >= 0) {
|
||||
std::string str =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
action.resource_id);
|
||||
if (str.empty()) {
|
||||
action.bytes =
|
||||
CefContentClient::Get()->GetDataResourceBytes(action.resource_id);
|
||||
if (!action.bytes) {
|
||||
NOTREACHED() << "Failed to load internal resource for id: "
|
||||
<< action.resource_id << " URL: " << url.spec().c_str();
|
||||
return nullptr;
|
||||
}
|
||||
action.bytes = base::RefCountedString::TakeString(&str);
|
||||
}
|
||||
|
||||
if (action.bytes) {
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||
#include "services/network/public/cpp/simple_url_loader.h"
|
||||
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
|
||||
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -255,23 +254,6 @@ class CefBrowserURLRequest::Context
|
||||
|
||||
resource_request->render_frame_id = render_frame_id;
|
||||
|
||||
// Behave the same as a subresource load.
|
||||
resource_request->fetch_request_context_type =
|
||||
static_cast<int>(blink::mojom::RequestContextType::SUBRESOURCE);
|
||||
resource_request->resource_type =
|
||||
static_cast<int>(blink::mojom::ResourceType::kSubResource);
|
||||
|
||||
// Set the origin to match the request.
|
||||
const GURL& url = GURL(request_->GetURL().ToString());
|
||||
resource_request->request_initiator = url::Origin::Create(url);
|
||||
|
||||
if (request_flags & UR_FLAG_ALLOW_STORED_CREDENTIALS) {
|
||||
// Include SameSite cookies.
|
||||
resource_request->attach_same_site_cookies = true;
|
||||
resource_request->site_for_cookies =
|
||||
net::SiteForCookies::FromOrigin(*resource_request->request_initiator);
|
||||
}
|
||||
|
||||
// SimpleURLLoader is picky about the body contents. Try to populate them
|
||||
// correctly below.
|
||||
auto request_body = resource_request->request_body;
|
||||
@@ -298,7 +280,7 @@ class CefBrowserURLRequest::Context
|
||||
|
||||
// Associate the request with |request_id|.
|
||||
request_id_ = request_id;
|
||||
loader_->SetRequestID(request_id);
|
||||
loader_->SetRequestId(request_id);
|
||||
g_manager.Get().Add(request_id, url_request_, client_);
|
||||
|
||||
if (request_body) {
|
||||
|
@@ -15,6 +15,7 @@
|
||||
#include "net/cookies/cookie_util.h"
|
||||
#include "services/network/cookie_manager.h"
|
||||
#include "services/network/public/cpp/resource_request.h"
|
||||
#include "services/network/public/cpp/resource_response.h"
|
||||
|
||||
namespace net_service {
|
||||
|
||||
@@ -168,14 +169,14 @@ void LoadCookies(content::BrowserContext* browser_context,
|
||||
|
||||
void SaveCookies(content::BrowserContext* browser_context,
|
||||
const network::ResourceRequest& request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
const network::ResourceResponseHead& head,
|
||||
const AllowCookieCallback& allow_cookie_callback,
|
||||
DoneCookieCallback done_callback) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
if (request.credentials_mode == network::mojom::CredentialsMode::kOmit ||
|
||||
request.url.IsAboutBlank() || !headers ||
|
||||
!headers->HasHeader(net_service::kHTTPSetCookieHeaderName)) {
|
||||
request.url.IsAboutBlank() || !head.headers ||
|
||||
!head.headers->HasHeader(net_service::kHTTPSetCookieHeaderName)) {
|
||||
// Continue immediately without saving cookies.
|
||||
std::move(done_callback).Run(0, {});
|
||||
return;
|
||||
@@ -184,7 +185,7 @@ void SaveCookies(content::BrowserContext* browser_context,
|
||||
// Match the logic in
|
||||
// URLRequestHttpJob::SaveCookiesAndNotifyHeadersComplete.
|
||||
base::Time response_date;
|
||||
if (!headers->GetDateValue(&response_date))
|
||||
if (!head.headers->GetDateValue(&response_date))
|
||||
response_date = base::Time();
|
||||
|
||||
net::CookieOptions options;
|
||||
@@ -200,7 +201,7 @@ void SaveCookies(content::BrowserContext* browser_context,
|
||||
net::CookieList allowed_cookies;
|
||||
int total_count = 0;
|
||||
|
||||
while (headers->EnumerateHeader(&iter, name, &cookie_string)) {
|
||||
while (head.headers->EnumerateHeader(&iter, name, &cookie_string)) {
|
||||
total_count++;
|
||||
|
||||
net::CanonicalCookie::CookieInclusionStatus returned_status;
|
||||
|
@@ -12,12 +12,9 @@ namespace content {
|
||||
class BrowserContext;
|
||||
}
|
||||
|
||||
namespace net {
|
||||
class HttpResponseHeaders;
|
||||
}
|
||||
|
||||
namespace network {
|
||||
struct ResourceRequest;
|
||||
struct ResourceResponseHead;
|
||||
} // namespace network
|
||||
|
||||
namespace net_service {
|
||||
@@ -48,7 +45,7 @@ void LoadCookies(content::BrowserContext* browser_context,
|
||||
// on the IO thread.
|
||||
void SaveCookies(content::BrowserContext* browser_context,
|
||||
const network::ResourceRequest& request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
const network::ResourceResponseHead& head,
|
||||
const AllowCookieCallback& allow_cookie_callback,
|
||||
DoneCookieCallback done_callback);
|
||||
|
||||
|
@@ -47,9 +47,6 @@ void SetCookieCallbackImpl(CefRefPtr<CefSetCookieCallback> callback,
|
||||
net::CanonicalCookie::CookieInclusionStatus status) {
|
||||
if (!callback.get())
|
||||
return;
|
||||
if (!status.IsInclude()) {
|
||||
LOG(WARNING) << "SetCookie failed with reason: " << status.GetDebugString();
|
||||
}
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefSetCookieCallback::OnComplete,
|
||||
callback.get(), status.IsInclude()));
|
||||
}
|
||||
@@ -206,8 +203,6 @@ bool CefCookieManagerImpl::VisitUrlCookies(
|
||||
net::CookieOptions options;
|
||||
if (includeHttpOnly)
|
||||
options.set_include_httponly();
|
||||
options.set_same_site_cookie_context(
|
||||
net::CookieOptions::SameSiteCookieContext::MakeInclusive());
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
@@ -244,18 +239,13 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url,
|
||||
if (cookie.has_expires)
|
||||
cef_time_to_basetime(cookie.expires, expiration_time);
|
||||
|
||||
net::CookieSameSite same_site =
|
||||
net_service::MakeCookieSameSite(cookie.same_site);
|
||||
net::CookiePriority priority =
|
||||
net_service::MakeCookiePriority(cookie.priority);
|
||||
|
||||
auto canonical_cookie = net::CanonicalCookie::CreateSanitizedCookie(
|
||||
gurl, name, value, domain, path,
|
||||
base::Time(), // Creation time.
|
||||
expiration_time,
|
||||
base::Time(), // Last access time.
|
||||
cookie.secure ? true : false, cookie.httponly ? true : false, same_site,
|
||||
priority);
|
||||
cookie.secure ? true : false, cookie.httponly ? true : false,
|
||||
net::CookieSameSite::UNSPECIFIED, net::COOKIE_PRIORITY_DEFAULT);
|
||||
|
||||
if (!canonical_cookie) {
|
||||
SetCookieCallbackImpl(callback,
|
||||
@@ -268,8 +258,6 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url,
|
||||
net::CookieOptions options;
|
||||
if (cookie.httponly)
|
||||
options.set_include_httponly();
|
||||
options.set_same_site_cookie_context(
|
||||
net::CookieOptions::SameSiteCookieContext::MakeInclusive());
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
|
@@ -11,7 +11,7 @@
|
||||
|
||||
#include "base/barrier_closure.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "components/safe_browsing/core/common/safebrowsing_constants.h"
|
||||
#include "components/safe_browsing/common/safebrowsing_constants.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/browser/resource_context.h"
|
||||
@@ -245,8 +245,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||
bool waiting_for_upload_progress_ack_ = false;
|
||||
|
||||
network::ResourceRequest request_;
|
||||
network::mojom::URLResponseHeadPtr current_response_;
|
||||
scoped_refptr<net::HttpResponseHeaders> current_headers_;
|
||||
network::ResourceResponseHead current_response_;
|
||||
scoped_refptr<net::HttpResponseHeaders> override_headers_;
|
||||
GURL original_url_;
|
||||
GURL redirect_url_;
|
||||
@@ -427,15 +426,16 @@ void InterceptedRequest::OnHeadersReceived(
|
||||
return;
|
||||
}
|
||||
|
||||
current_headers_ = base::MakeRefCounted<net::HttpResponseHeaders>(headers);
|
||||
current_response_.headers =
|
||||
base::MakeRefCounted<net::HttpResponseHeaders>(headers);
|
||||
on_headers_received_callback_ = std::move(callback);
|
||||
|
||||
base::Optional<net::RedirectInfo> redirect_info;
|
||||
std::string location;
|
||||
if (current_headers_->IsRedirect(&location)) {
|
||||
if (current_response_.headers->IsRedirect(&location)) {
|
||||
const GURL new_url = request_.url.Resolve(location);
|
||||
redirect_info =
|
||||
MakeRedirectInfo(request_, current_headers_.get(), new_url, 0);
|
||||
MakeRedirectInfo(request_, current_response_.headers.get(), new_url, 0);
|
||||
}
|
||||
|
||||
HandleResponseOrRedirectHeaders(
|
||||
@@ -448,16 +448,16 @@ void InterceptedRequest::OnHeadersReceived(
|
||||
|
||||
void InterceptedRequest::OnReceiveResponse(
|
||||
network::mojom::URLResponseHeadPtr head) {
|
||||
current_response_ = std::move(head);
|
||||
|
||||
if (current_request_uses_header_client_) {
|
||||
// Use the headers we got from OnHeadersReceived as that'll contain
|
||||
// Set-Cookie if it existed.
|
||||
DCHECK(current_headers_);
|
||||
current_response_->headers = current_headers_;
|
||||
current_headers_ = nullptr;
|
||||
auto saved_headers = current_response_.headers;
|
||||
DCHECK(saved_headers);
|
||||
current_response_ = head;
|
||||
current_response_.headers = saved_headers;
|
||||
ContinueToResponseStarted(net::OK);
|
||||
} else {
|
||||
current_response_ = head;
|
||||
HandleResponseOrRedirectHeaders(
|
||||
base::nullopt,
|
||||
base::BindOnce(&InterceptedRequest::ContinueToResponseStarted,
|
||||
@@ -470,16 +470,16 @@ void InterceptedRequest::OnReceiveRedirect(
|
||||
network::mojom::URLResponseHeadPtr head) {
|
||||
bool needs_callback = false;
|
||||
|
||||
current_response_ = std::move(head);
|
||||
|
||||
if (current_request_uses_header_client_) {
|
||||
// Use the headers we got from OnHeadersReceived as that'll contain
|
||||
// Set-Cookie if it existed. May be null for synthetic redirects.
|
||||
if (current_headers_) {
|
||||
current_response_->headers = current_headers_;
|
||||
current_headers_ = nullptr;
|
||||
auto saved_headers = current_response_.headers;
|
||||
current_response_ = head;
|
||||
if (saved_headers) {
|
||||
current_response_.headers = saved_headers;
|
||||
}
|
||||
} else {
|
||||
current_response_ = head;
|
||||
needs_callback = true;
|
||||
}
|
||||
|
||||
@@ -625,35 +625,33 @@ void InterceptedRequest::InterceptResponseReceived(
|
||||
DCHECK(!response);
|
||||
|
||||
// Perform the redirect.
|
||||
current_response_ = network::mojom::URLResponseHead::New();
|
||||
current_response_->request_start = base::TimeTicks::Now();
|
||||
current_response_->response_start = base::TimeTicks::Now();
|
||||
|
||||
auto headers = MakeResponseHeaders(
|
||||
network::ResourceResponseHead head;
|
||||
head.request_start = base::TimeTicks::Now();
|
||||
head.response_start = base::TimeTicks::Now();
|
||||
head.headers = MakeResponseHeaders(
|
||||
net::HTTP_TEMPORARY_REDIRECT, std::string(), std::string(),
|
||||
std::string(), -1, {}, false /* allow_existing_header_override */);
|
||||
current_response_->headers = headers;
|
||||
|
||||
current_response_->encoded_data_length = headers->raw_headers().length();
|
||||
current_response_->content_length = current_response_->encoded_body_length =
|
||||
0;
|
||||
head.encoded_data_length = head.headers->raw_headers().length();
|
||||
head.content_length = head.encoded_body_length = 0;
|
||||
|
||||
std::string origin;
|
||||
if (request_.headers.GetHeader(net::HttpRequestHeaders::kOrigin, &origin) &&
|
||||
origin != url::Origin().Serialize()) {
|
||||
// Allow redirects of cross-origin resource loads.
|
||||
headers->AddHeader(MakeHeader(
|
||||
head.headers->AddHeader(MakeHeader(
|
||||
network::cors::header_names::kAccessControlAllowOrigin, origin));
|
||||
}
|
||||
|
||||
if (request_.credentials_mode ==
|
||||
network::mojom::CredentialsMode::kInclude) {
|
||||
headers->AddHeader(MakeHeader(
|
||||
head.headers->AddHeader(MakeHeader(
|
||||
network::cors::header_names::kAccessControlAllowCredentials, "true"));
|
||||
}
|
||||
|
||||
current_response_ = head;
|
||||
const net::RedirectInfo& redirect_info =
|
||||
MakeRedirectInfo(request_, headers.get(), request_.url, 0);
|
||||
MakeRedirectInfo(request_, head.headers.get(), request_.url, 0);
|
||||
HandleResponseOrRedirectHeaders(
|
||||
redirect_info,
|
||||
base::BindOnce(&InterceptedRequest::ContinueToBeforeRedirect,
|
||||
@@ -717,21 +715,17 @@ void InterceptedRequest::HandleResponseOrRedirectHeaders(
|
||||
redirect_url_ = redirect_info.has_value() ? redirect_info->new_url : GURL();
|
||||
original_url_ = request_.url;
|
||||
|
||||
// |current_response_| may be nullptr when called from OnHeadersReceived.
|
||||
auto headers =
|
||||
current_response_ ? current_response_->headers : current_headers_;
|
||||
|
||||
// Even though |head| is const we can get a non-const pointer to the headers
|
||||
// and modifications we make are passed to the target client.
|
||||
factory_->request_handler_->ProcessResponseHeaders(
|
||||
id_, request_, redirect_url_, headers.get());
|
||||
id_, request_, redirect_url_, current_response_);
|
||||
|
||||
// Pause handling of client messages before waiting on an async callback.
|
||||
if (proxied_client_binding_)
|
||||
proxied_client_binding_.PauseIncomingMethodCallProcessing();
|
||||
|
||||
factory_->request_handler_->OnRequestResponse(
|
||||
id_, &request_, headers.get(), redirect_info,
|
||||
id_, &request_, current_response_, redirect_info,
|
||||
base::BindOnce(&InterceptedRequest::ContinueResponseOrRedirect,
|
||||
weak_factory_.GetWeakPtr(), std::move(continuation)));
|
||||
}
|
||||
@@ -755,7 +749,7 @@ void InterceptedRequest::ContinueResponseOrRedirect(
|
||||
// Make sure to update current_response_, since when OnReceiveResponse
|
||||
// is called we will not use its headers as it might be missing the
|
||||
// Set-Cookie line (which gets stripped by the IPC layer).
|
||||
current_response_->headers = override_headers_;
|
||||
current_response_.headers = override_headers_;
|
||||
}
|
||||
redirect_url_ = redirect_url;
|
||||
|
||||
@@ -786,22 +780,21 @@ void InterceptedRequest::ContinueToHandleOverrideHeaders(int error_code) {
|
||||
net::RedirectInfo InterceptedRequest::MakeRedirectResponseAndInfo(
|
||||
const GURL& new_location) {
|
||||
// Clear the Content-Type values.
|
||||
current_response_->mime_type = current_response_->charset = std::string();
|
||||
current_response_->headers->RemoveHeader(
|
||||
current_response_.mime_type = current_response_.charset = std::string();
|
||||
current_response_.headers->RemoveHeader(
|
||||
net::HttpRequestHeaders::kContentType);
|
||||
|
||||
// Clear the Content-Length values.
|
||||
current_response_->content_length = current_response_->encoded_body_length =
|
||||
0;
|
||||
current_response_->headers->RemoveHeader(
|
||||
current_response_.content_length = current_response_.encoded_body_length = 0;
|
||||
current_response_.headers->RemoveHeader(
|
||||
net::HttpRequestHeaders::kContentLength);
|
||||
|
||||
current_response_->encoded_data_length =
|
||||
current_response_->headers->raw_headers().size();
|
||||
current_response_.encoded_data_length =
|
||||
current_response_.headers->raw_headers().size();
|
||||
|
||||
const net::RedirectInfo& redirect_info = MakeRedirectInfo(
|
||||
request_, current_response_->headers.get(), new_location, 0);
|
||||
current_response_->headers->ReplaceStatusLine(
|
||||
request_, current_response_.headers.get(), new_location, 0);
|
||||
current_response_.headers->ReplaceStatusLine(
|
||||
MakeStatusLine(redirect_info.status_code, std::string(), true));
|
||||
|
||||
return redirect_info;
|
||||
@@ -831,12 +824,10 @@ void InterceptedRequest::ContinueToBeforeRedirect(
|
||||
if (redirect_url.is_valid()) {
|
||||
net::RedirectInfo new_redirect_info = redirect_info;
|
||||
new_redirect_info.new_url = redirect_url;
|
||||
target_client_->OnReceiveRedirect(new_redirect_info,
|
||||
std::move(current_response_));
|
||||
target_client_->OnReceiveRedirect(new_redirect_info, current_response_);
|
||||
request_.url = redirect_url;
|
||||
} else {
|
||||
target_client_->OnReceiveRedirect(redirect_info,
|
||||
std::move(current_response_));
|
||||
target_client_->OnReceiveRedirect(redirect_info, current_response_);
|
||||
request_.url = redirect_info.new_url;
|
||||
}
|
||||
|
||||
@@ -874,8 +865,8 @@ void InterceptedRequest::ContinueToResponseStarted(int error_code) {
|
||||
|
||||
std::string location;
|
||||
const bool is_redirect = redirect_url.is_valid() ||
|
||||
(current_response_->headers &&
|
||||
current_response_->headers->IsRedirect(&location));
|
||||
(current_response_.headers &&
|
||||
current_response_.headers->IsRedirect(&location));
|
||||
if (stream_loader_ && is_redirect) {
|
||||
// Redirecting from OnReceiveResponse generally isn't supported by the
|
||||
// NetworkService, so we can only support it when using a custom loader.
|
||||
@@ -899,7 +890,7 @@ void InterceptedRequest::ContinueToResponseStarted(int error_code) {
|
||||
if (proxied_client_binding_)
|
||||
proxied_client_binding_.ResumeIncomingMethodCallProcessing();
|
||||
|
||||
target_client_->OnReceiveResponse(std::move(current_response_));
|
||||
target_client_->OnReceiveResponse(current_response_);
|
||||
}
|
||||
|
||||
if (stream_loader_)
|
||||
@@ -1032,7 +1023,7 @@ void InterceptedRequestHandler::ShouldInterceptRequest(
|
||||
void InterceptedRequestHandler::OnRequestResponse(
|
||||
const RequestId& id,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
const network::ResourceResponseHead& head,
|
||||
base::Optional<net::RedirectInfo> redirect_info,
|
||||
OnRequestResponseResultCallback callback) {
|
||||
std::move(callback).Run(
|
||||
|
@@ -18,6 +18,7 @@
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "mojo/public/cpp/bindings/binding_set.h"
|
||||
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
||||
#include "services/network/public/cpp/resource_response.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||
|
||||
@@ -75,10 +76,11 @@ class InterceptedRequestHandler {
|
||||
// method is called in response to a redirect. Even though |head| is const the
|
||||
// |head.headers| value is non-const and any changes will be passed to the
|
||||
// client.
|
||||
virtual void ProcessResponseHeaders(const RequestId& id,
|
||||
const network::ResourceRequest& request,
|
||||
const GURL& redirect_url,
|
||||
net::HttpResponseHeaders* headers) {}
|
||||
virtual void ProcessResponseHeaders(
|
||||
const RequestId& id,
|
||||
const network::ResourceRequest& request,
|
||||
const GURL& redirect_url,
|
||||
const network::ResourceResponseHead& head) {}
|
||||
|
||||
enum class ResponseMode {
|
||||
// Continue the request.
|
||||
@@ -99,7 +101,7 @@ class InterceptedRequestHandler {
|
||||
virtual void OnRequestResponse(
|
||||
const RequestId& id,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
const network::ResourceResponseHead& head,
|
||||
base::Optional<net::RedirectInfo> redirect_info,
|
||||
OnRequestResponseResultCallback callback);
|
||||
|
||||
|
@@ -31,7 +31,6 @@
|
||||
#include "net/base/load_flags.h"
|
||||
#include "net/http/http_status_code.h"
|
||||
#include "net/http/http_util.h"
|
||||
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
|
||||
#include "ui/base/page_transition_types.h"
|
||||
#include "url/origin.h"
|
||||
|
||||
@@ -593,7 +592,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
new RequestCallbackWrapper(base::BindOnce(
|
||||
&InterceptedRequestHandlerWrapper::ContinueShouldInterceptRequest,
|
||||
weak_ptr_factory_.GetWeakPtr(), id, base::Unretained(request),
|
||||
std::move(callback)));
|
||||
base::Passed(std::move(callback))));
|
||||
|
||||
cef_return_value_t retval = state->handler_->OnBeforeResourceLoad(
|
||||
init_state_->browser_, init_state_->frame_,
|
||||
@@ -688,10 +687,11 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
std::move(callback).Run(std::move(resource_response));
|
||||
}
|
||||
|
||||
void ProcessResponseHeaders(const RequestId& id,
|
||||
const network::ResourceRequest& request,
|
||||
const GURL& redirect_url,
|
||||
net::HttpResponseHeaders* headers) override {
|
||||
void ProcessResponseHeaders(
|
||||
const RequestId& id,
|
||||
const network::ResourceRequest& request,
|
||||
const GURL& redirect_url,
|
||||
const network::ResourceResponseHead& head) override {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
RequestState* state = GetState(id);
|
||||
@@ -708,15 +708,15 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
else
|
||||
state->pending_response_->SetReadOnly(false);
|
||||
|
||||
if (headers)
|
||||
state->pending_response_->SetResponseHeaders(*headers);
|
||||
if (head.headers)
|
||||
state->pending_response_->SetResponseHeaders(*head.headers);
|
||||
|
||||
state->pending_response_->SetReadOnly(true);
|
||||
}
|
||||
|
||||
void OnRequestResponse(const RequestId& id,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
const network::ResourceResponseHead& head,
|
||||
base::Optional<net::RedirectInfo> redirect_info,
|
||||
OnRequestResponseResultCallback callback) override {
|
||||
CEF_REQUIRE_IOT();
|
||||
@@ -735,7 +735,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
if (!state->handler_) {
|
||||
// Cookies may come from a scheme handler.
|
||||
MaybeSaveCookies(
|
||||
id, state, request, headers,
|
||||
id, state, request, head,
|
||||
base::BindOnce(
|
||||
std::move(callback), ResponseMode::CONTINUE, nullptr,
|
||||
redirect_info.has_value() ? redirect_info->new_url : GURL()));
|
||||
@@ -746,17 +746,17 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
DCHECK(state->pending_response_);
|
||||
|
||||
if (redirect_info.has_value()) {
|
||||
HandleRedirect(id, state, request, headers, *redirect_info,
|
||||
HandleRedirect(id, state, request, head, *redirect_info,
|
||||
std::move(callback));
|
||||
} else {
|
||||
HandleResponse(id, state, request, headers, std::move(callback));
|
||||
HandleResponse(id, state, request, head, std::move(callback));
|
||||
}
|
||||
}
|
||||
|
||||
void HandleRedirect(const RequestId& id,
|
||||
RequestState* state,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
const network::ResourceResponseHead& head,
|
||||
const net::RedirectInfo& redirect_info,
|
||||
OnRequestResponseResultCallback callback) {
|
||||
GURL new_url = redirect_info.new_url;
|
||||
@@ -786,13 +786,13 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
auto exec_callback = base::BindOnce(
|
||||
std::move(callback), ResponseMode::CONTINUE, nullptr, new_url);
|
||||
|
||||
MaybeSaveCookies(id, state, request, headers, std::move(exec_callback));
|
||||
MaybeSaveCookies(id, state, request, head, std::move(exec_callback));
|
||||
}
|
||||
|
||||
void HandleResponse(const RequestId& id,
|
||||
RequestState* state,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
const network::ResourceResponseHead& head,
|
||||
OnRequestResponseResultCallback callback) {
|
||||
// The client may modify |pending_request_| in OnResourceResponse.
|
||||
state->pending_request_->SetReadOnly(false);
|
||||
@@ -835,13 +835,13 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
MaybeSaveCookies(id, state, request, headers, std::move(exec_callback));
|
||||
MaybeSaveCookies(id, state, request, head, std::move(exec_callback));
|
||||
}
|
||||
|
||||
void MaybeSaveCookies(const RequestId& id,
|
||||
RequestState* state,
|
||||
network::ResourceRequest* request,
|
||||
net::HttpResponseHeaders* headers,
|
||||
const network::ResourceResponseHead& head,
|
||||
base::OnceClosure callback) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
@@ -863,7 +863,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
auto done_cookie_callback = base::BindOnce(
|
||||
&InterceptedRequestHandlerWrapper::ContinueWithSavedCookies,
|
||||
weak_ptr_factory_.GetWeakPtr(), id, std::move(callback));
|
||||
net_service::SaveCookies(init_state_->browser_context_, *request, headers,
|
||||
net_service::SaveCookies(init_state_->browser_context_, *request, head,
|
||||
allow_cookie_callback,
|
||||
std::move(done_cookie_callback));
|
||||
}
|
||||
@@ -1203,8 +1203,8 @@ void InitOnUIThread(
|
||||
if (request.render_frame_id >= 0) {
|
||||
// TODO(network): Are these main frame checks equivalent?
|
||||
if (request.is_main_frame ||
|
||||
static_cast<blink::mojom::ResourceType>(request.resource_type) ==
|
||||
blink::mojom::ResourceType::kMainFrame) {
|
||||
static_cast<content::ResourceType>(request.resource_type) ==
|
||||
content::ResourceType::kMainFrame) {
|
||||
frame = web_contents->GetMainFrame();
|
||||
DCHECK(frame);
|
||||
} else {
|
||||
|
@@ -420,8 +420,8 @@ void InputStreamReader::RunSkipCallback(int64_t bytes_skipped) {
|
||||
DCHECK(!pending_skip_callback_.is_null());
|
||||
job_thread_task_runner_->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(InputStreamReader::RunSkipCallbackOnJobThread,
|
||||
bytes_skipped, std::move(pending_skip_callback_)));
|
||||
base::Bind(InputStreamReader::RunSkipCallbackOnJobThread, bytes_skipped,
|
||||
base::Passed(std::move(pending_skip_callback_))));
|
||||
|
||||
// Reset callback state.
|
||||
pending_callback_id_ = -1;
|
||||
@@ -433,8 +433,9 @@ void InputStreamReader::RunReadCallback(int bytes_read) {
|
||||
|
||||
DCHECK(!pending_read_callback_.is_null());
|
||||
job_thread_task_runner_->PostTask(
|
||||
FROM_HERE, base::BindOnce(InputStreamReader::RunReadCallbackOnJobThread,
|
||||
bytes_read, std::move(pending_read_callback_)));
|
||||
FROM_HERE,
|
||||
base::Bind(InputStreamReader::RunReadCallbackOnJobThread, bytes_read,
|
||||
base::Passed(std::move(pending_read_callback_))));
|
||||
|
||||
// Reset callback state.
|
||||
pending_callback_id_ = -1;
|
||||
@@ -610,12 +611,9 @@ void StreamReaderURLLoader::OnReaderSkipCompleted(int64_t bytes_skipped) {
|
||||
HeadersComplete(net::HTTP_OK, -1);
|
||||
} else if (bytes_skipped == byte_range_.first_byte_position()) {
|
||||
// We skipped the expected number of bytes.
|
||||
int64_t expected_content_length = -1;
|
||||
if (byte_range_.HasLastBytePosition()) {
|
||||
expected_content_length = byte_range_.last_byte_position() -
|
||||
byte_range_.first_byte_position() + 1;
|
||||
DCHECK_GE(expected_content_length, 0);
|
||||
}
|
||||
int64_t expected_content_length = byte_range_.last_byte_position() -
|
||||
byte_range_.first_byte_position() + 1;
|
||||
DCHECK_GE(expected_content_length, 0);
|
||||
HeadersComplete(net::HTTP_OK, expected_content_length);
|
||||
} else {
|
||||
RequestComplete(bytes_skipped < 0 ? bytes_skipped : net::ERR_FAILED);
|
||||
@@ -642,38 +640,32 @@ void StreamReaderURLLoader::HeadersComplete(int orig_status_code,
|
||||
return;
|
||||
}
|
||||
|
||||
auto pending_response = network::mojom::URLResponseHead::New();
|
||||
pending_response->request_start = base::TimeTicks::Now();
|
||||
pending_response->response_start = base::TimeTicks::Now();
|
||||
|
||||
auto headers = MakeResponseHeaders(
|
||||
pending_response_.request_start = base::TimeTicks::Now();
|
||||
pending_response_.response_start = base::TimeTicks::Now();
|
||||
pending_response_.headers = MakeResponseHeaders(
|
||||
status_code, status_text, mime_type, charset, content_length,
|
||||
extra_headers, false /* allow_existing_header_override */);
|
||||
pending_response->headers = headers;
|
||||
|
||||
if (content_length >= 0)
|
||||
pending_response->content_length = content_length;
|
||||
pending_response_.content_length = content_length;
|
||||
|
||||
if (!mime_type.empty()) {
|
||||
pending_response->mime_type = mime_type;
|
||||
pending_response_.mime_type = mime_type;
|
||||
if (!charset.empty())
|
||||
pending_response->charset = charset;
|
||||
pending_response_.charset = charset;
|
||||
}
|
||||
|
||||
if (header_client_.is_bound()) {
|
||||
header_client_->OnHeadersReceived(
|
||||
headers->raw_headers(), net::IPEndPoint(),
|
||||
pending_response_.headers->raw_headers(), net::IPEndPoint(),
|
||||
base::BindOnce(&StreamReaderURLLoader::ContinueWithResponseHeaders,
|
||||
weak_factory_.GetWeakPtr(),
|
||||
std::move(pending_response)));
|
||||
weak_factory_.GetWeakPtr()));
|
||||
} else {
|
||||
ContinueWithResponseHeaders(std::move(pending_response), net::OK,
|
||||
base::nullopt, base::nullopt);
|
||||
ContinueWithResponseHeaders(net::OK, base::nullopt, GURL());
|
||||
}
|
||||
}
|
||||
|
||||
void StreamReaderURLLoader::ContinueWithResponseHeaders(
|
||||
network::mojom::URLResponseHeadPtr pending_response,
|
||||
int32_t result,
|
||||
const base::Optional<std::string>& headers,
|
||||
const base::Optional<GURL>& redirect_url) {
|
||||
@@ -684,35 +676,34 @@ void StreamReaderURLLoader::ContinueWithResponseHeaders(
|
||||
|
||||
if (headers) {
|
||||
DCHECK(header_client_.is_bound());
|
||||
pending_response->headers =
|
||||
pending_response_.headers =
|
||||
base::MakeRefCounted<net::HttpResponseHeaders>(*headers);
|
||||
}
|
||||
|
||||
auto pending_headers = pending_response->headers;
|
||||
|
||||
// What the length would be if we sent headers over the network. Used to
|
||||
// calculate data length.
|
||||
header_length_ = pending_headers->raw_headers().length();
|
||||
header_length_ = pending_response_.headers->raw_headers().length();
|
||||
|
||||
DCHECK(client_.is_bound());
|
||||
|
||||
std::string location;
|
||||
const auto has_redirect_url = redirect_url && !redirect_url->is_empty();
|
||||
if (has_redirect_url || pending_headers->IsRedirect(&location)) {
|
||||
pending_response->encoded_data_length = header_length_;
|
||||
pending_response->content_length = pending_response->encoded_body_length =
|
||||
if (has_redirect_url || pending_response_.headers->IsRedirect(&location)) {
|
||||
pending_response_.encoded_data_length = header_length_;
|
||||
pending_response_.content_length = pending_response_.encoded_body_length =
|
||||
0;
|
||||
const GURL new_location =
|
||||
has_redirect_url ? *redirect_url : request_.url.Resolve(location);
|
||||
client_->OnReceiveRedirect(
|
||||
MakeRedirectInfo(request_, pending_headers.get(), new_location,
|
||||
pending_headers->response_code()),
|
||||
std::move(pending_response));
|
||||
MakeRedirectInfo(request_, pending_response_.headers.get(),
|
||||
new_location,
|
||||
pending_response_.headers->response_code()),
|
||||
pending_response_);
|
||||
// The client will restart the request with a new loader.
|
||||
// |this| will be deleted.
|
||||
CleanUp();
|
||||
} else {
|
||||
client_->OnReceiveResponse(std::move(pending_response));
|
||||
client_->OnReceiveResponse(pending_response_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -13,9 +13,9 @@
|
||||
#include "mojo/public/cpp/system/simple_watcher.h"
|
||||
#include "net/http/http_byte_range.h"
|
||||
#include "services/network/public/cpp/net_adapters.h"
|
||||
#include "services/network/public/cpp/resource_response.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "services/network/public/mojom/url_loader.mojom.h"
|
||||
#include "services/network/public/mojom/url_response_head.mojom.h"
|
||||
|
||||
namespace net_service {
|
||||
|
||||
@@ -188,11 +188,9 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
|
||||
|
||||
void OnReaderSkipCompleted(int64_t bytes_skipped);
|
||||
void HeadersComplete(int status_code, int64_t expected_content_length);
|
||||
void ContinueWithResponseHeaders(
|
||||
network::mojom::URLResponseHeadPtr pending_response,
|
||||
int32_t result,
|
||||
const base::Optional<std::string>& headers,
|
||||
const base::Optional<GURL>& redirect_url);
|
||||
void ContinueWithResponseHeaders(int32_t result,
|
||||
const base::Optional<std::string>& headers,
|
||||
const base::Optional<GURL>& redirect_url);
|
||||
|
||||
void SendBody();
|
||||
void ReadMore();
|
||||
@@ -207,6 +205,8 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
|
||||
|
||||
const RequestId request_id_;
|
||||
|
||||
network::ResourceResponseHead pending_response_;
|
||||
|
||||
size_t header_length_ = 0;
|
||||
int64_t total_bytes_read_ = 0;
|
||||
|
||||
|
@@ -55,7 +55,7 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
|
||||
content::devtools_instrumentation::WillCreateURLLoaderFactory(
|
||||
static_cast<content::RenderFrameHostImpl*>(render_frame_host),
|
||||
false /* is_navigation */, false /* is_download */,
|
||||
&maybe_proxy_factory_request, nullptr /* factory_override */);
|
||||
&maybe_proxy_factory_request);
|
||||
}
|
||||
|
||||
// Allow the Content embedder to inject itself if it wants to.
|
||||
@@ -64,8 +64,7 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
|
||||
content::ContentBrowserClient::URLLoaderFactoryType::kDocumentSubResource,
|
||||
url::Origin(), base::nullopt /* navigation_id */,
|
||||
&maybe_proxy_factory_request, nullptr /* header_client */,
|
||||
nullptr /* bypass_redirect_checks */, nullptr /* disable_secure_dns */,
|
||||
nullptr /* factory_override */);
|
||||
nullptr /* bypass_redirect_checks */, nullptr /* factory_override */);
|
||||
|
||||
// If anyone above indicated that they care about proxying, pass the
|
||||
// intermediate pipe along to the URLLoaderFactoryGetter.
|
||||
|
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
#include "third_party/blink/public/common/input/web_touch_event.h"
|
||||
#include "third_party/blink/public/platform/web_touch_event.h"
|
||||
#include "ui/events/gesture_detection/motion_event_generic.h"
|
||||
|
||||
// Implementation of MotionEvent which takes a stream of CefTouchEvents.
|
||||
|
@@ -103,7 +103,7 @@ struct PopulateAxNodeAttributes {
|
||||
case ax::mojom::IntAttribute::kActivedescendantId:
|
||||
case ax::mojom::IntAttribute::kInPageLinkTargetId:
|
||||
case ax::mojom::IntAttribute::kErrormessageId:
|
||||
case ax::mojom::IntAttribute::kDOMNodeId:
|
||||
case ax::mojom::IntAttribute::kDetailsId:
|
||||
case ax::mojom::IntAttribute::kDropeffect:
|
||||
case ax::mojom::IntAttribute::kMemberOfId:
|
||||
case ax::mojom::IntAttribute::kNextFocusId:
|
||||
|
@@ -25,8 +25,10 @@
|
||||
#include "components/viz/common/frame_sinks/begin_frame_args.h"
|
||||
#include "components/viz/common/frame_sinks/copy_output_request.h"
|
||||
#include "components/viz/common/frame_sinks/delay_based_time_source.h"
|
||||
#include "components/viz/common/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/gpu/gpu_data_manager_impl.h"
|
||||
#include "content/browser/renderer_host/cursor_manager.h"
|
||||
#include "content/browser/renderer_host/delegated_frame_host.h"
|
||||
@@ -46,6 +48,7 @@
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "media/base/video_frame.h"
|
||||
#include "ui/base/cursor/types/cursor_types.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
#include "ui/events/blink/blink_event_util.h"
|
||||
#include "ui/events/gesture_detection/gesture_provider_config_helper.h"
|
||||
@@ -61,7 +64,7 @@ const size_t kMaxDamageRects = 10;
|
||||
|
||||
const float kDefaultScaleFactor = 1.0;
|
||||
|
||||
content::ScreenInfo ScreenInfoFrom(const CefScreenInfo& src) {
|
||||
static content::ScreenInfo ScreenInfoFrom(const CefScreenInfo& src) {
|
||||
content::ScreenInfo screenInfo;
|
||||
screenInfo.device_scale_factor = src.device_scale_factor;
|
||||
screenInfo.depth = src.depth;
|
||||
@@ -101,6 +104,12 @@ class CefDelegatedFrameHostClient : public content::DelegatedFrameHostClient {
|
||||
return *view_->GetBackgroundColor();
|
||||
}
|
||||
|
||||
void OnBeginFrame(base::TimeTicks frame_time) override {
|
||||
// TODO(cef): Maybe we can use this method in combination with
|
||||
// OnSetNeedsBeginFrames() instead of using CefBeginFrameTimer.
|
||||
// See https://codereview.chromium.org/1841083007.
|
||||
}
|
||||
|
||||
void OnFrameTokenChanged(uint32_t frame_token) override {
|
||||
view_->render_widget_host()->DidProcessFrame(frame_token);
|
||||
}
|
||||
@@ -170,23 +179,6 @@ float GetDeviceScaleFactor(CefBrowserHostImpl* browser) {
|
||||
return screen_info.device_scale_factor;
|
||||
}
|
||||
|
||||
ui::ImeTextSpan::UnderlineStyle GetImeUnderlineStyle(
|
||||
cef_composition_underline_style_t style) {
|
||||
switch (style) {
|
||||
case CEF_CUS_SOLID:
|
||||
return ui::ImeTextSpan::UnderlineStyle::kSolid;
|
||||
case CEF_CUS_DOT:
|
||||
return ui::ImeTextSpan::UnderlineStyle::kDot;
|
||||
case CEF_CUS_DASH:
|
||||
return ui::ImeTextSpan::UnderlineStyle::kDash;
|
||||
case CEF_CUS_NONE:
|
||||
return ui::ImeTextSpan::UnderlineStyle::kNone;
|
||||
}
|
||||
|
||||
NOTREACHED();
|
||||
return ui::ImeTextSpan::UnderlineStyle::kSolid;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
@@ -233,11 +225,15 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
||||
|
||||
external_begin_frame_enabled_ = use_external_begin_frame;
|
||||
|
||||
auto context_factory = content::GetContextFactory();
|
||||
content::ImageTransportFactory* factory =
|
||||
content::ImageTransportFactory::GetInstance();
|
||||
ui::ContextFactoryPrivate* context_factory_private =
|
||||
factory->GetContextFactoryPrivate();
|
||||
|
||||
// Matching the attributes from RecyclableCompositorMac.
|
||||
compositor_.reset(new ui::Compositor(
|
||||
context_factory->AllocateFrameSinkId(), context_factory,
|
||||
context_factory_private->AllocateFrameSinkId(),
|
||||
content::GetContextFactory(), context_factory_private,
|
||||
base::ThreadTaskRunnerHandle::Get(), false /* enable_pixel_canvas */,
|
||||
use_external_begin_frame));
|
||||
compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
|
||||
@@ -440,14 +436,8 @@ base::Optional<SkColor> CefRenderWidgetHostViewOSR::GetBackgroundColor() {
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UpdateBackgroundColor() {}
|
||||
|
||||
blink::mojom::PointerLockResult CefRenderWidgetHostViewOSR::LockMouse(
|
||||
bool request_unadjusted_movement) {
|
||||
return blink::mojom::PointerLockResult::kPermissionDenied;
|
||||
}
|
||||
|
||||
blink::mojom::PointerLockResult CefRenderWidgetHostViewOSR::ChangeMouseLock(
|
||||
bool request_unadjusted_movement) {
|
||||
return blink::mojom::PointerLockResult::kPermissionDenied;
|
||||
bool CefRenderWidgetHostViewOSR::LockMouse(bool request_unadjusted_movement) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::UnlockMouse() {}
|
||||
@@ -466,6 +456,11 @@ void CefRenderWidgetHostViewOSR::TakeFallbackContentFrom(
|
||||
host()->GetContentRenderingTimeoutFrom(view_cef->host());
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::DidCreateNewRendererCompositorFrameSink(
|
||||
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnPresentCompositorFrame() {}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::OnDidUpdateVisualPropertiesComplete(
|
||||
@@ -537,6 +532,13 @@ void CefRenderWidgetHostViewOSR::AddDamageRect(uint32_t sequence,
|
||||
damage_rects_[sequence] = rect;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SubmitCompositorFrame(
|
||||
const viz::LocalSurfaceId& local_surface_id,
|
||||
viz::CompositorFrame frame,
|
||||
base::Optional<viz::HitTestRegionList> hit_test_region_list) {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() {
|
||||
delegated_frame_host_->ResetFallbackToFirstNavigationSurface();
|
||||
}
|
||||
@@ -594,29 +596,39 @@ void CefRenderWidgetHostViewOSR::UpdateCursor(
|
||||
browser_impl_->GetClient()->GetRenderHandler();
|
||||
CHECK(handler);
|
||||
|
||||
const auto& ui_cursor = cursor.cursor();
|
||||
const content::CursorInfo& cursor_info = cursor.info();
|
||||
|
||||
const cef_cursor_type_t cursor_type =
|
||||
static_cast<cef_cursor_type_t>(ui_cursor.type());
|
||||
static_cast<cef_cursor_type_t>(cursor_info.type);
|
||||
CefCursorInfo custom_cursor_info;
|
||||
if (ui_cursor.type() == ui::mojom::CursorType::kCustom) {
|
||||
custom_cursor_info.hotspot.x = ui_cursor.custom_hotspot().x();
|
||||
custom_cursor_info.hotspot.y = ui_cursor.custom_hotspot().y();
|
||||
custom_cursor_info.image_scale_factor = ui_cursor.image_scale_factor();
|
||||
custom_cursor_info.buffer = ui_cursor.custom_bitmap().getPixels();
|
||||
custom_cursor_info.size.width = ui_cursor.custom_bitmap().width();
|
||||
custom_cursor_info.size.height = ui_cursor.custom_bitmap().height();
|
||||
if (cursor_info.type == ui::CursorType::kCustom) {
|
||||
custom_cursor_info.hotspot.x = cursor_info.hotspot.x();
|
||||
custom_cursor_info.hotspot.y = cursor_info.hotspot.y();
|
||||
custom_cursor_info.image_scale_factor = cursor_info.image_scale_factor;
|
||||
custom_cursor_info.buffer = cursor_info.custom_image.getPixels();
|
||||
custom_cursor_info.size.width = cursor_info.custom_image.width();
|
||||
custom_cursor_info.size.height = cursor_info.custom_image.height();
|
||||
}
|
||||
|
||||
#if defined(USE_AURA)
|
||||
content::WebCursor web_cursor(ui_cursor);
|
||||
content::WebCursor web_cursor(cursor_info);
|
||||
|
||||
ui::PlatformCursor platform_cursor;
|
||||
if (ui_cursor.type() == ui::mojom::CursorType::kCustom) {
|
||||
if (cursor_info.type == ui::CursorType::kCustom) {
|
||||
ui::Cursor ui_cursor(ui::CursorType::kCustom);
|
||||
SkBitmap bitmap;
|
||||
gfx::Point hotspot;
|
||||
float scale_factor;
|
||||
web_cursor.CreateScaledBitmapAndHotspotFromCustomData(&bitmap, &hotspot,
|
||||
&scale_factor);
|
||||
ui_cursor.set_custom_bitmap(bitmap);
|
||||
ui_cursor.set_custom_hotspot(hotspot);
|
||||
ui_cursor.set_device_scale_factor(scale_factor);
|
||||
|
||||
// |web_cursor| owns the resulting |platform_cursor|.
|
||||
platform_cursor = web_cursor.GetPlatformCursor(ui_cursor);
|
||||
} else {
|
||||
platform_cursor = GetPlatformCursor(ui_cursor.type());
|
||||
platform_cursor = GetPlatformCursor(cursor_info.type);
|
||||
}
|
||||
|
||||
handler->OnCursorChange(browser_impl_.get(), platform_cursor, cursor_type,
|
||||
@@ -796,8 +808,7 @@ void CefRenderWidgetHostViewOSR::ImeSetComposition(
|
||||
ui::ImeTextSpan::Type::kComposition, line.range.from, line.range.to,
|
||||
line.thick ? ui::ImeTextSpan::Thickness::kThick
|
||||
: ui::ImeTextSpan::Thickness::kThin,
|
||||
GetImeUnderlineStyle(line.style), line.background_color, line.color,
|
||||
std::vector<std::string>()));
|
||||
line.background_color, line.color, std::vector<std::string>()));
|
||||
}
|
||||
gfx::Range range(replacement_range.from, replacement_range.to);
|
||||
|
||||
@@ -900,6 +911,20 @@ CefRenderWidgetHostViewOSR::CreateSyntheticGestureTarget() {
|
||||
return std::make_unique<CefSyntheticGestureTargetOSR>(host());
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetNeedsBeginFrames(bool enabled) {
|
||||
SetFrameRate();
|
||||
|
||||
if (host_display_client_) {
|
||||
host_display_client_->SetActive(enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::SetWantsAnimateOnlyBeginFrames() {
|
||||
if (delegated_frame_host_) {
|
||||
delegated_frame_host_->SetWantsAnimateOnlyBeginFrames();
|
||||
}
|
||||
}
|
||||
|
||||
bool CefRenderWidgetHostViewOSR::TransformPointToCoordSpaceForView(
|
||||
const gfx::PointF& point,
|
||||
RenderWidgetHostViewBase* target_view,
|
||||
@@ -1061,8 +1086,8 @@ void CefRenderWidgetHostViewOSR::SendExternalBeginFrame() {
|
||||
if (render_widget_host_)
|
||||
render_widget_host_->ProgressFlingIfNeeded(frame_time);
|
||||
|
||||
compositor_->IssueExternalBeginFrame(
|
||||
begin_frame_args, /* force= */ true,
|
||||
compositor_->context_factory_private()->IssueExternalBeginFrame(
|
||||
compositor_.get(), begin_frame_args, /* force= */ true,
|
||||
base::BindOnce(&CefRenderWidgetHostViewOSR::OnFrameComplete,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
|
||||
@@ -1074,18 +1099,9 @@ void CefRenderWidgetHostViewOSR::SendExternalBeginFrame() {
|
||||
void CefRenderWidgetHostViewOSR::SendKeyEvent(
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
TRACE_EVENT0("cef", "CefRenderWidgetHostViewOSR::SendKeyEvent");
|
||||
content::RenderWidgetHostImpl* target_host = render_widget_host_;
|
||||
|
||||
// If there are multiple widgets on the page (such as when there are
|
||||
// out-of-process iframes), pick the one that should process this event.
|
||||
if (render_widget_host_ && render_widget_host_->delegate()) {
|
||||
target_host = render_widget_host_->delegate()->GetFocusedRenderWidgetHost(
|
||||
render_widget_host_);
|
||||
}
|
||||
|
||||
if (target_host && target_host->GetView()) {
|
||||
if (render_widget_host_ && render_widget_host_->GetView()) {
|
||||
// Direct routing requires that events go directly to the View.
|
||||
target_host->ForwardKeyboardEventWithLatencyInfo(
|
||||
render_widget_host_->ForwardKeyboardEventWithLatencyInfo(
|
||||
event, ui::LatencyInfo(event.GetType() == blink::WebInputEvent::kChar ||
|
||||
event.GetType() ==
|
||||
blink::WebInputEvent::kRawKeyDown
|
||||
@@ -1105,15 +1121,13 @@ void CefRenderWidgetHostViewOSR::SendMouseEvent(
|
||||
|
||||
if (popup_host_view_) {
|
||||
if (popup_host_view_->popup_position_.Contains(
|
||||
event.PositionInWidget().x(), event.PositionInWidget().y())) {
|
||||
event.PositionInWidget().x, event.PositionInWidget().y)) {
|
||||
blink::WebMouseEvent popup_event(event);
|
||||
popup_event.SetPositionInWidget(
|
||||
event.PositionInWidget().x() -
|
||||
popup_host_view_->popup_position_.x(),
|
||||
event.PositionInWidget().y() -
|
||||
popup_host_view_->popup_position_.y());
|
||||
popup_event.SetPositionInScreen(popup_event.PositionInWidget().x(),
|
||||
popup_event.PositionInWidget().y());
|
||||
event.PositionInWidget().x - popup_host_view_->popup_position_.x(),
|
||||
event.PositionInWidget().y - popup_host_view_->popup_position_.y());
|
||||
popup_event.SetPositionInScreen(popup_event.PositionInWidget().x,
|
||||
popup_event.PositionInWidget().y);
|
||||
|
||||
popup_host_view_->SendMouseEvent(popup_event);
|
||||
return;
|
||||
@@ -1126,14 +1140,14 @@ void CefRenderWidgetHostViewOSR::SendMouseEvent(
|
||||
}
|
||||
const gfx::Rect& guest_bounds =
|
||||
guest_host_view->render_widget_host_->GetView()->GetViewBounds();
|
||||
if (guest_bounds.Contains(event.PositionInWidget().x(),
|
||||
event.PositionInWidget().y())) {
|
||||
if (guest_bounds.Contains(event.PositionInWidget().x,
|
||||
event.PositionInWidget().y)) {
|
||||
blink::WebMouseEvent guest_event(event);
|
||||
guest_event.SetPositionInWidget(
|
||||
event.PositionInWidget().x() - guest_bounds.x(),
|
||||
event.PositionInWidget().y() - guest_bounds.y());
|
||||
guest_event.SetPositionInScreen(guest_event.PositionInWidget().x(),
|
||||
guest_event.PositionInWidget().y());
|
||||
event.PositionInWidget().x - guest_bounds.x(),
|
||||
event.PositionInWidget().y - guest_bounds.y());
|
||||
guest_event.SetPositionInScreen(guest_event.PositionInWidget().x,
|
||||
guest_event.PositionInWidget().y);
|
||||
|
||||
guest_host_view->SendMouseEvent(guest_event);
|
||||
return;
|
||||
@@ -1167,16 +1181,14 @@ void CefRenderWidgetHostViewOSR::SendMouseWheelEvent(
|
||||
|
||||
if (popup_host_view_) {
|
||||
if (popup_host_view_->popup_position_.Contains(
|
||||
event.PositionInWidget().x(), event.PositionInWidget().y())) {
|
||||
event.PositionInWidget().x, event.PositionInWidget().y)) {
|
||||
blink::WebMouseWheelEvent popup_mouse_wheel_event(event);
|
||||
popup_mouse_wheel_event.SetPositionInWidget(
|
||||
event.PositionInWidget().x() -
|
||||
popup_host_view_->popup_position_.x(),
|
||||
event.PositionInWidget().y() -
|
||||
popup_host_view_->popup_position_.y());
|
||||
event.PositionInWidget().x - popup_host_view_->popup_position_.x(),
|
||||
event.PositionInWidget().y - popup_host_view_->popup_position_.y());
|
||||
popup_mouse_wheel_event.SetPositionInScreen(
|
||||
popup_mouse_wheel_event.PositionInWidget().x(),
|
||||
popup_mouse_wheel_event.PositionInWidget().y());
|
||||
popup_mouse_wheel_event.PositionInWidget().x,
|
||||
popup_mouse_wheel_event.PositionInWidget().y);
|
||||
|
||||
popup_host_view_->SendMouseWheelEvent(popup_mouse_wheel_event);
|
||||
return;
|
||||
@@ -1197,15 +1209,15 @@ void CefRenderWidgetHostViewOSR::SendMouseWheelEvent(
|
||||
}
|
||||
const gfx::Rect& guest_bounds =
|
||||
guest_host_view->render_widget_host_->GetView()->GetViewBounds();
|
||||
if (guest_bounds.Contains(event.PositionInWidget().x(),
|
||||
event.PositionInWidget().y())) {
|
||||
if (guest_bounds.Contains(event.PositionInWidget().x,
|
||||
event.PositionInWidget().y)) {
|
||||
blink::WebMouseWheelEvent guest_mouse_wheel_event(event);
|
||||
guest_mouse_wheel_event.SetPositionInWidget(
|
||||
event.PositionInWidget().x() - guest_bounds.x(),
|
||||
event.PositionInWidget().y() - guest_bounds.y());
|
||||
event.PositionInWidget().x - guest_bounds.x(),
|
||||
event.PositionInWidget().y - guest_bounds.y());
|
||||
guest_mouse_wheel_event.SetPositionInScreen(
|
||||
guest_mouse_wheel_event.PositionInWidget().x(),
|
||||
guest_mouse_wheel_event.PositionInWidget().y());
|
||||
guest_mouse_wheel_event.PositionInWidget().x,
|
||||
guest_mouse_wheel_event.PositionInWidget().y);
|
||||
|
||||
guest_host_view->SendMouseWheelEvent(guest_mouse_wheel_event);
|
||||
return;
|
||||
@@ -1399,8 +1411,8 @@ void CefRenderWidgetHostViewOSR::UpdateFrameRate() {
|
||||
}
|
||||
|
||||
gfx::Size CefRenderWidgetHostViewOSR::SizeInPixels() {
|
||||
return gfx::ScaleToCeiledSize(GetViewBounds().size(),
|
||||
current_device_scale_factor_);
|
||||
return gfx::ConvertSizeToPixel(current_device_scale_factor_,
|
||||
GetViewBounds().size());
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||
#include "content/browser/renderer_host/text_input_manager.h"
|
||||
#include "content/public/common/widget_type.h"
|
||||
#include "ui/base/mojom/cursor_type.mojom-shared.h"
|
||||
#include "ui/base/cursor/types/cursor_types.h"
|
||||
#include "ui/compositor/compositor.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
#include "ui/events/gesture_detection/filtered_gesture_provider.h"
|
||||
@@ -49,6 +49,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(USE_AURA)
|
||||
#include "third_party/blink/public/platform/web_cursor_info.h"
|
||||
#include "ui/base/cursor/cursor.h"
|
||||
#endif
|
||||
|
||||
@@ -123,10 +124,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void SetBackgroundColor(SkColor color) override;
|
||||
base::Optional<SkColor> GetBackgroundColor() override;
|
||||
void UpdateBackgroundColor() override;
|
||||
blink::mojom::PointerLockResult LockMouse(
|
||||
bool request_unadjusted_movement) override;
|
||||
blink::mojom::PointerLockResult ChangeMouseLock(
|
||||
bool request_unadjusted_movement) override;
|
||||
bool LockMouse(bool request_unadjusted_movement) override;
|
||||
void UnlockMouse() override;
|
||||
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
|
||||
|
||||
@@ -137,6 +135,13 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
#endif // defined(OS_MACOSX)
|
||||
|
||||
// RenderWidgetHostViewBase implementation.
|
||||
void DidCreateNewRendererCompositorFrameSink(
|
||||
viz::mojom::CompositorFrameSinkClient* renderer_compositor_frame_sink)
|
||||
override;
|
||||
void SubmitCompositorFrame(
|
||||
const viz::LocalSurfaceId& local_surface_id,
|
||||
viz::CompositorFrame frame,
|
||||
base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
|
||||
void ResetFallbackToFirstNavigationSurface() override;
|
||||
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& pos) override;
|
||||
@@ -171,6 +176,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
const std::vector<gfx::Rect>& character_bounds) override;
|
||||
std::unique_ptr<content::SyntheticGestureTarget>
|
||||
CreateSyntheticGestureTarget() override;
|
||||
void SetNeedsBeginFrames(bool enabled) override;
|
||||
void SetWantsAnimateOnlyBeginFrames() override;
|
||||
bool TransformPointToCoordSpaceForView(
|
||||
const gfx::PointF& point,
|
||||
RenderWidgetHostViewBase* target_view,
|
||||
@@ -323,7 +330,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
void UpdateBackgroundColorFromRenderer(SkColor color);
|
||||
|
||||
#if defined(USE_AURA)
|
||||
ui::PlatformCursor GetPlatformCursor(ui::mojom::CursorType type);
|
||||
ui::PlatformCursor GetPlatformCursor(ui::CursorType type);
|
||||
#endif
|
||||
|
||||
// The background color of the web content.
|
||||
@@ -393,6 +400,9 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
||||
|
||||
content::MouseWheelPhaseHandler mouse_wheel_phase_handler_;
|
||||
|
||||
std::unique_ptr<viz::mojom::CompositorFrameSinkClient>
|
||||
renderer_compositor_frame_sink_;
|
||||
|
||||
// Latest capture sequence number which is incremented when the caller
|
||||
// requests surfaces be synchronized via
|
||||
// EnsureSurfaceSynchronizedForLayoutTest().
|
||||
|
@@ -5,6 +5,8 @@
|
||||
|
||||
#include "libcef/browser/osr/render_widget_host_view_osr.h"
|
||||
|
||||
#include "third_party/blink/public/platform/web_cursor_info.h"
|
||||
|
||||
#if defined(USE_X11)
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/cursorfont.h>
|
||||
@@ -21,108 +23,110 @@ namespace {
|
||||
|
||||
// Based on ui/base/cursor/cursor_loader_x11.cc.
|
||||
|
||||
int ToCursorID(ui::mojom::CursorType type) {
|
||||
using blink::WebCursorInfo;
|
||||
|
||||
int ToCursorID(ui::CursorType type) {
|
||||
switch (type) {
|
||||
case ui::mojom::CursorType::kPointer:
|
||||
case ui::CursorType::kPointer:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kCross:
|
||||
case ui::CursorType::kCross:
|
||||
return XC_crosshair;
|
||||
case ui::mojom::CursorType::kHand:
|
||||
case ui::CursorType::kHand:
|
||||
return XC_hand2;
|
||||
case ui::mojom::CursorType::kIBeam:
|
||||
case ui::CursorType::kIBeam:
|
||||
return XC_xterm;
|
||||
case ui::mojom::CursorType::kWait:
|
||||
case ui::CursorType::kWait:
|
||||
return XC_watch;
|
||||
case ui::mojom::CursorType::kHelp:
|
||||
case ui::CursorType::kHelp:
|
||||
return XC_question_arrow;
|
||||
case ui::mojom::CursorType::kEastResize:
|
||||
case ui::CursorType::kEastResize:
|
||||
return XC_right_side;
|
||||
case ui::mojom::CursorType::kNorthResize:
|
||||
case ui::CursorType::kNorthResize:
|
||||
return XC_top_side;
|
||||
case ui::mojom::CursorType::kNorthEastResize:
|
||||
case ui::CursorType::kNorthEastResize:
|
||||
return XC_top_right_corner;
|
||||
case ui::mojom::CursorType::kNorthWestResize:
|
||||
case ui::CursorType::kNorthWestResize:
|
||||
return XC_top_left_corner;
|
||||
case ui::mojom::CursorType::kSouthResize:
|
||||
case ui::CursorType::kSouthResize:
|
||||
return XC_bottom_side;
|
||||
case ui::mojom::CursorType::kSouthEastResize:
|
||||
case ui::CursorType::kSouthEastResize:
|
||||
return XC_bottom_right_corner;
|
||||
case ui::mojom::CursorType::kSouthWestResize:
|
||||
case ui::CursorType::kSouthWestResize:
|
||||
return XC_bottom_left_corner;
|
||||
case ui::mojom::CursorType::kWestResize:
|
||||
case ui::CursorType::kWestResize:
|
||||
return XC_left_side;
|
||||
case ui::mojom::CursorType::kNorthSouthResize:
|
||||
case ui::CursorType::kNorthSouthResize:
|
||||
return XC_sb_v_double_arrow;
|
||||
case ui::mojom::CursorType::kEastWestResize:
|
||||
case ui::CursorType::kEastWestResize:
|
||||
return XC_sb_h_double_arrow;
|
||||
case ui::mojom::CursorType::kNorthEastSouthWestResize:
|
||||
case ui::CursorType::kNorthEastSouthWestResize:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kNorthWestSouthEastResize:
|
||||
case ui::CursorType::kNorthWestSouthEastResize:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kColumnResize:
|
||||
case ui::CursorType::kColumnResize:
|
||||
return XC_sb_h_double_arrow;
|
||||
case ui::mojom::CursorType::kRowResize:
|
||||
case ui::CursorType::kRowResize:
|
||||
return XC_sb_v_double_arrow;
|
||||
case ui::mojom::CursorType::kMiddlePanning:
|
||||
case ui::CursorType::kMiddlePanning:
|
||||
return XC_fleur;
|
||||
case ui::mojom::CursorType::kEastPanning:
|
||||
case ui::CursorType::kEastPanning:
|
||||
return XC_sb_right_arrow;
|
||||
case ui::mojom::CursorType::kNorthPanning:
|
||||
case ui::CursorType::kNorthPanning:
|
||||
return XC_sb_up_arrow;
|
||||
case ui::mojom::CursorType::kNorthEastPanning:
|
||||
case ui::CursorType::kNorthEastPanning:
|
||||
return XC_top_right_corner;
|
||||
case ui::mojom::CursorType::kNorthWestPanning:
|
||||
case ui::CursorType::kNorthWestPanning:
|
||||
return XC_top_left_corner;
|
||||
case ui::mojom::CursorType::kSouthPanning:
|
||||
case ui::CursorType::kSouthPanning:
|
||||
return XC_sb_down_arrow;
|
||||
case ui::mojom::CursorType::kSouthEastPanning:
|
||||
case ui::CursorType::kSouthEastPanning:
|
||||
return XC_bottom_right_corner;
|
||||
case ui::mojom::CursorType::kSouthWestPanning:
|
||||
case ui::CursorType::kSouthWestPanning:
|
||||
return XC_bottom_left_corner;
|
||||
case ui::mojom::CursorType::kWestPanning:
|
||||
case ui::CursorType::kWestPanning:
|
||||
return XC_sb_left_arrow;
|
||||
case ui::mojom::CursorType::kMove:
|
||||
case ui::CursorType::kMove:
|
||||
return XC_fleur;
|
||||
case ui::mojom::CursorType::kVerticalText:
|
||||
case ui::CursorType::kVerticalText:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kCell:
|
||||
case ui::CursorType::kCell:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kContextMenu:
|
||||
case ui::CursorType::kContextMenu:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kAlias:
|
||||
case ui::CursorType::kAlias:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kProgress:
|
||||
case ui::CursorType::kProgress:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kNoDrop:
|
||||
case ui::CursorType::kNoDrop:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kCopy:
|
||||
case ui::CursorType::kCopy:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kNotAllowed:
|
||||
case ui::CursorType::kNotAllowed:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kZoomIn:
|
||||
case ui::CursorType::kZoomIn:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kZoomOut:
|
||||
case ui::CursorType::kZoomOut:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kGrab:
|
||||
case ui::CursorType::kGrab:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kGrabbing:
|
||||
case ui::CursorType::kGrabbing:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kMiddlePanningVertical:
|
||||
case ui::CursorType::kMiddlePanningVertical:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kMiddlePanningHorizontal:
|
||||
case ui::CursorType::kMiddlePanningHorizontal:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kDndNone:
|
||||
case ui::CursorType::kDndNone:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kDndMove:
|
||||
case ui::CursorType::kDndMove:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kDndCopy:
|
||||
case ui::CursorType::kDndCopy:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kDndLink:
|
||||
case ui::CursorType::kDndLink:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kNull:
|
||||
case ui::CursorType::kNull:
|
||||
return XC_left_ptr;
|
||||
case ui::mojom::CursorType::kCustom:
|
||||
case ui::mojom::CursorType::kNone:
|
||||
case ui::CursorType::kCustom:
|
||||
case ui::CursorType::kNone:
|
||||
break;
|
||||
}
|
||||
NOTREACHED();
|
||||
@@ -180,9 +184,9 @@ XCursorCache* cursor_cache = nullptr;
|
||||
#endif // defined(USE_X11)
|
||||
|
||||
ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor(
|
||||
ui::mojom::CursorType type) {
|
||||
ui::CursorType type) {
|
||||
#if defined(USE_X11)
|
||||
if (type == ui::mojom::CursorType::kNone) {
|
||||
if (type == ui::CursorType::kNone) {
|
||||
if (!invisible_cursor_) {
|
||||
invisible_cursor_.reset(new ui::XScopedCursor(ui::CreateInvisibleCursor(),
|
||||
gfx::GetXDisplay()));
|
||||
|
@@ -10,6 +10,7 @@
|
||||
#include "libcef/browser/browser_host_impl.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
|
||||
#include "third_party/blink/public/platform/web_cursor_info.h"
|
||||
#include "ui/resources/grit/ui_unscaled_resources.h"
|
||||
|
||||
namespace {
|
||||
@@ -38,110 +39,112 @@ class CefCompositorHostWin : public gfx::WindowImpl {
|
||||
|
||||
// From content/common/cursors/webcursor_win.cc.
|
||||
|
||||
LPCWSTR ToCursorID(ui::mojom::CursorType type) {
|
||||
using blink::WebCursorInfo;
|
||||
|
||||
LPCWSTR ToCursorID(ui::CursorType type) {
|
||||
switch (type) {
|
||||
case ui::mojom::CursorType::kPointer:
|
||||
case ui::CursorType::kPointer:
|
||||
return IDC_ARROW;
|
||||
case ui::mojom::CursorType::kCross:
|
||||
case ui::CursorType::kCross:
|
||||
return IDC_CROSS;
|
||||
case ui::mojom::CursorType::kHand:
|
||||
case ui::CursorType::kHand:
|
||||
return IDC_HAND;
|
||||
case ui::mojom::CursorType::kIBeam:
|
||||
case ui::CursorType::kIBeam:
|
||||
return IDC_IBEAM;
|
||||
case ui::mojom::CursorType::kWait:
|
||||
case ui::CursorType::kWait:
|
||||
return IDC_WAIT;
|
||||
case ui::mojom::CursorType::kHelp:
|
||||
case ui::CursorType::kHelp:
|
||||
return IDC_HELP;
|
||||
case ui::mojom::CursorType::kEastResize:
|
||||
case ui::CursorType::kEastResize:
|
||||
return IDC_SIZEWE;
|
||||
case ui::mojom::CursorType::kNorthResize:
|
||||
case ui::CursorType::kNorthResize:
|
||||
return IDC_SIZENS;
|
||||
case ui::mojom::CursorType::kNorthEastResize:
|
||||
case ui::CursorType::kNorthEastResize:
|
||||
return IDC_SIZENESW;
|
||||
case ui::mojom::CursorType::kNorthWestResize:
|
||||
case ui::CursorType::kNorthWestResize:
|
||||
return IDC_SIZENWSE;
|
||||
case ui::mojom::CursorType::kSouthResize:
|
||||
case ui::CursorType::kSouthResize:
|
||||
return IDC_SIZENS;
|
||||
case ui::mojom::CursorType::kSouthEastResize:
|
||||
case ui::CursorType::kSouthEastResize:
|
||||
return IDC_SIZENWSE;
|
||||
case ui::mojom::CursorType::kSouthWestResize:
|
||||
case ui::CursorType::kSouthWestResize:
|
||||
return IDC_SIZENESW;
|
||||
case ui::mojom::CursorType::kWestResize:
|
||||
case ui::CursorType::kWestResize:
|
||||
return IDC_SIZEWE;
|
||||
case ui::mojom::CursorType::kNorthSouthResize:
|
||||
case ui::CursorType::kNorthSouthResize:
|
||||
return IDC_SIZENS;
|
||||
case ui::mojom::CursorType::kEastWestResize:
|
||||
case ui::CursorType::kEastWestResize:
|
||||
return IDC_SIZEWE;
|
||||
case ui::mojom::CursorType::kNorthEastSouthWestResize:
|
||||
case ui::CursorType::kNorthEastSouthWestResize:
|
||||
return IDC_SIZENESW;
|
||||
case ui::mojom::CursorType::kNorthWestSouthEastResize:
|
||||
case ui::CursorType::kNorthWestSouthEastResize:
|
||||
return IDC_SIZENWSE;
|
||||
case ui::mojom::CursorType::kColumnResize:
|
||||
case ui::CursorType::kColumnResize:
|
||||
return MAKEINTRESOURCE(IDC_COLRESIZE);
|
||||
case ui::mojom::CursorType::kRowResize:
|
||||
case ui::CursorType::kRowResize:
|
||||
return MAKEINTRESOURCE(IDC_ROWRESIZE);
|
||||
case ui::mojom::CursorType::kMiddlePanning:
|
||||
case ui::CursorType::kMiddlePanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_MIDDLE);
|
||||
case ui::mojom::CursorType::kEastPanning:
|
||||
case ui::CursorType::kEastPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_EAST);
|
||||
case ui::mojom::CursorType::kNorthPanning:
|
||||
case ui::CursorType::kNorthPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_NORTH);
|
||||
case ui::mojom::CursorType::kNorthEastPanning:
|
||||
case ui::CursorType::kNorthEastPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_NORTH_EAST);
|
||||
case ui::mojom::CursorType::kNorthWestPanning:
|
||||
case ui::CursorType::kNorthWestPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_NORTH_WEST);
|
||||
case ui::mojom::CursorType::kSouthPanning:
|
||||
case ui::CursorType::kSouthPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_SOUTH);
|
||||
case ui::mojom::CursorType::kSouthEastPanning:
|
||||
case ui::CursorType::kSouthEastPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_SOUTH_EAST);
|
||||
case ui::mojom::CursorType::kSouthWestPanning:
|
||||
case ui::CursorType::kSouthWestPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_SOUTH_WEST);
|
||||
case ui::mojom::CursorType::kWestPanning:
|
||||
case ui::CursorType::kWestPanning:
|
||||
return MAKEINTRESOURCE(IDC_PAN_WEST);
|
||||
case ui::mojom::CursorType::kMove:
|
||||
case ui::CursorType::kMove:
|
||||
return IDC_SIZEALL;
|
||||
case ui::mojom::CursorType::kVerticalText:
|
||||
case ui::CursorType::kVerticalText:
|
||||
return MAKEINTRESOURCE(IDC_VERTICALTEXT);
|
||||
case ui::mojom::CursorType::kCell:
|
||||
case ui::CursorType::kCell:
|
||||
return MAKEINTRESOURCE(IDC_CELL);
|
||||
case ui::mojom::CursorType::kContextMenu:
|
||||
case ui::CursorType::kContextMenu:
|
||||
return IDC_ARROW;
|
||||
case ui::mojom::CursorType::kAlias:
|
||||
case ui::CursorType::kAlias:
|
||||
return MAKEINTRESOURCE(IDC_ALIAS);
|
||||
case ui::mojom::CursorType::kProgress:
|
||||
case ui::CursorType::kProgress:
|
||||
return IDC_APPSTARTING;
|
||||
case ui::mojom::CursorType::kNoDrop:
|
||||
case ui::CursorType::kNoDrop:
|
||||
return IDC_NO;
|
||||
case ui::mojom::CursorType::kCopy:
|
||||
case ui::CursorType::kCopy:
|
||||
return MAKEINTRESOURCE(IDC_COPYCUR);
|
||||
case ui::mojom::CursorType::kNone:
|
||||
case ui::CursorType::kNone:
|
||||
return MAKEINTRESOURCE(IDC_CURSOR_NONE);
|
||||
case ui::mojom::CursorType::kNotAllowed:
|
||||
case ui::CursorType::kNotAllowed:
|
||||
return IDC_NO;
|
||||
case ui::mojom::CursorType::kZoomIn:
|
||||
case ui::CursorType::kZoomIn:
|
||||
return MAKEINTRESOURCE(IDC_ZOOMIN);
|
||||
case ui::mojom::CursorType::kZoomOut:
|
||||
case ui::CursorType::kZoomOut:
|
||||
return MAKEINTRESOURCE(IDC_ZOOMOUT);
|
||||
case ui::mojom::CursorType::kGrab:
|
||||
case ui::CursorType::kGrab:
|
||||
return MAKEINTRESOURCE(IDC_HAND_GRAB);
|
||||
case ui::mojom::CursorType::kGrabbing:
|
||||
case ui::CursorType::kGrabbing:
|
||||
return MAKEINTRESOURCE(IDC_HAND_GRABBING);
|
||||
case ui::mojom::CursorType::kNull:
|
||||
case ui::CursorType::kNull:
|
||||
return IDC_NO;
|
||||
case ui::mojom::CursorType::kMiddlePanningVertical:
|
||||
case ui::CursorType::kMiddlePanningVertical:
|
||||
return MAKEINTRESOURCE(IDC_PAN_MIDDLE_VERTICAL);
|
||||
case ui::mojom::CursorType::kMiddlePanningHorizontal:
|
||||
case ui::CursorType::kMiddlePanningHorizontal:
|
||||
return MAKEINTRESOURCE(IDC_PAN_MIDDLE_HORIZONTAL);
|
||||
// TODO(cef): Find better cursors for these things
|
||||
case ui::mojom::CursorType::kDndNone:
|
||||
case ui::CursorType::kDndNone:
|
||||
return IDC_ARROW;
|
||||
case ui::mojom::CursorType::kDndMove:
|
||||
case ui::CursorType::kDndMove:
|
||||
return IDC_ARROW;
|
||||
case ui::mojom::CursorType::kDndCopy:
|
||||
case ui::CursorType::kDndCopy:
|
||||
return IDC_ARROW;
|
||||
case ui::mojom::CursorType::kDndLink:
|
||||
case ui::CursorType::kDndLink:
|
||||
return IDC_ARROW;
|
||||
case ui::mojom::CursorType::kCustom:
|
||||
case ui::CursorType::kCustom:
|
||||
break;
|
||||
}
|
||||
NOTREACHED();
|
||||
@@ -155,7 +158,7 @@ bool IsSystemCursorID(LPCWSTR cursor_id) {
|
||||
} // namespace
|
||||
|
||||
ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor(
|
||||
ui::mojom::CursorType type) {
|
||||
ui::CursorType type) {
|
||||
HMODULE module_handle = NULL;
|
||||
const wchar_t* cursor_id = ToCursorID(type);
|
||||
if (!IsSystemCursorID(cursor_id)) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user