mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
85 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
fdc7504631 | ||
|
304e015509 | ||
|
6c81b2125f | ||
|
a46056b1eb | ||
|
7efb1099d9 | ||
|
c8a556f173 | ||
|
97011bca14 | ||
|
83f4983b73 | ||
|
d246bb6967 | ||
|
1058991018 | ||
|
ffc2f0ea62 | ||
|
1a795a1b4b | ||
|
7448470392 | ||
|
a8731e7501 | ||
|
eeda28cdc8 | ||
|
3dd2e2902a | ||
|
d9aa1a58ec | ||
|
7c5e746ea4 | ||
|
149ccf946f | ||
|
3f2c37255f | ||
|
7077b0efe1 | ||
|
1812f94ebd | ||
|
c551bc2695 | ||
|
f7c90a6bb2 | ||
|
08c49aa624 | ||
|
2fef70b664 | ||
|
48637c687c | ||
|
d808850d4e | ||
|
0fb8a5f1ea | ||
|
98e6450272 | ||
|
a9aef28966 | ||
|
790d248111 | ||
|
640cd0f411 | ||
|
cfe8e320be | ||
|
5780bf40d4 | ||
|
31d3e88d32 | ||
|
7ecaa8afdd | ||
|
8c996d2efd | ||
|
d8b4281c06 | ||
|
c82eb3e80f | ||
|
14571658a2 | ||
|
aa4473e2c6 | ||
|
9deef4189c | ||
|
25d81e0f1d | ||
|
70590a759d | ||
|
8d01442d75 | ||
|
d65483ae16 | ||
|
7c6e53ddfb | ||
|
ff0c36b465 | ||
|
dafce45e49 | ||
|
be6af15754 | ||
|
cbc0625272 | ||
|
fd1f465fa7 | ||
|
8ed39e4ae5 | ||
|
3adb801ca8 | ||
|
ccf7b28723 | ||
|
e876217e24 | ||
|
ec0c57d0e1 | ||
|
87a7c4f94b | ||
|
27257d0288 | ||
|
245bc9bfab | ||
|
fa519f5108 | ||
|
30d83cb94a | ||
|
f5c79bf50c | ||
|
ea1324a9f1 | ||
|
261a8899fc | ||
|
a5de549456 | ||
|
bdaa857c49 | ||
|
1c14900093 | ||
|
01f385a6f7 | ||
|
cf6b57d659 | ||
|
f742ab4994 | ||
|
cfac1c347c | ||
|
047e8f9349 | ||
|
3d87a68561 | ||
|
66433c1869 | ||
|
869ae21c9f | ||
|
03fd5b15da | ||
|
fecd582035 | ||
|
180e9bd362 | ||
|
2fbb6ba1e9 | ||
|
51e12b3866 | ||
|
a6f9d78c1c | ||
|
8cf82c24dc | ||
|
438382c5df |
156
BUILD.gn
156
BUILD.gn
@@ -106,6 +106,7 @@ import("//media/media_options.gni")
|
|||||||
import("//mojo/public/tools/bindings/mojom.gni")
|
import("//mojo/public/tools/bindings/mojom.gni")
|
||||||
import("//ppapi/buildflags/buildflags.gni")
|
import("//ppapi/buildflags/buildflags.gni")
|
||||||
import("//printing/buildflags/buildflags.gni")
|
import("//printing/buildflags/buildflags.gni")
|
||||||
|
import("//testing/test.gni")
|
||||||
import("//third_party/icu/config.gni")
|
import("//third_party/icu/config.gni")
|
||||||
import("//third_party/widevine/cdm/widevine.gni")
|
import("//third_party/widevine/cdm/widevine.gni")
|
||||||
import("//tools/grit/repack.gni")
|
import("//tools/grit/repack.gni")
|
||||||
@@ -253,7 +254,6 @@ if (is_linux) {
|
|||||||
# Set ENABLE_PRINTING=1 ENABLE_BASIC_PRINTING=1.
|
# Set ENABLE_PRINTING=1 ENABLE_BASIC_PRINTING=1.
|
||||||
assert(enable_basic_printing)
|
assert(enable_basic_printing)
|
||||||
assert(enable_print_preview)
|
assert(enable_print_preview)
|
||||||
assert(!enable_service_discovery)
|
|
||||||
|
|
||||||
# Enable support for Widevine CDM.
|
# Enable support for Widevine CDM.
|
||||||
assert(enable_widevine)
|
assert(enable_widevine)
|
||||||
@@ -263,12 +263,6 @@ if (is_clang) {
|
|||||||
assert(!clang_use_chrome_plugins)
|
assert(!clang_use_chrome_plugins)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_linux) {
|
|
||||||
# Use system fontconfig. This avoids a startup hang on Ubuntu 16.04.4 (see
|
|
||||||
# issue #2424).
|
|
||||||
assert(!use_bundled_fontconfig)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_mac) {
|
if (is_mac) {
|
||||||
# Always generate dSYM files. The make_distrib script will fail if
|
# Always generate dSYM files. The make_distrib script will fail if
|
||||||
# enable_dsyms=true is not explicitly set when is_official_build=false.
|
# enable_dsyms=true is not explicitly set when is_official_build=false.
|
||||||
@@ -303,6 +297,10 @@ gypi_paths2 = exec_script("//cef/tools/gypi_to_gn.py",
|
|||||||
"scope",
|
"scope",
|
||||||
[ "cef_paths2.gypi" ])
|
[ "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".
|
# Targets that will be built when depending on "//cef".
|
||||||
@@ -313,6 +311,7 @@ group("cef") {
|
|||||||
deps = [
|
deps = [
|
||||||
":cefsimple",
|
":cefsimple",
|
||||||
":ceftests",
|
":ceftests",
|
||||||
|
":libcef_static_unittests",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (!is_linux || use_x11) {
|
if (!is_linux || use_x11) {
|
||||||
@@ -370,9 +369,46 @@ 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") {
|
static_library("libcef_static") {
|
||||||
sources = gypi_paths2.includes_common +
|
sources = includes_common +
|
||||||
gypi_paths.autogen_cpp_includes + [
|
gypi_paths.autogen_cpp_includes + [
|
||||||
|
"libcef/browser/audio_capturer.cc",
|
||||||
|
"libcef/browser/audio_capturer.h",
|
||||||
"libcef/browser/browser_context.cc",
|
"libcef/browser/browser_context.cc",
|
||||||
"libcef/browser/browser_context.h",
|
"libcef/browser/browser_context.h",
|
||||||
"libcef/browser/browser_context_keyed_service_factories.cc",
|
"libcef/browser/browser_context_keyed_service_factories.cc",
|
||||||
@@ -407,10 +443,14 @@ static_library("libcef_static") {
|
|||||||
"libcef/browser/context.h",
|
"libcef/browser/context.h",
|
||||||
"libcef/browser/context_menu_params_impl.cc",
|
"libcef/browser/context_menu_params_impl.cc",
|
||||||
"libcef/browser/context_menu_params_impl.h",
|
"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.cc",
|
||||||
"libcef/browser/devtools/devtools_file_manager.h",
|
"libcef/browser/devtools/devtools_file_manager.h",
|
||||||
"libcef/browser/devtools/devtools_frontend.cc",
|
"libcef/browser/devtools/devtools_frontend.cc",
|
||||||
"libcef/browser/devtools/devtools_frontend.h",
|
"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.cc",
|
||||||
"libcef/browser/devtools/devtools_manager_delegate.h",
|
"libcef/browser/devtools/devtools_manager_delegate.h",
|
||||||
"libcef/browser/download_item_impl.cc",
|
"libcef/browser/download_item_impl.cc",
|
||||||
@@ -706,17 +746,6 @@ static_library("libcef_static") {
|
|||||||
"libcef/renderer/url_loader_throttle_provider_impl.h",
|
"libcef/renderer/url_loader_throttle_provider_impl.h",
|
||||||
"libcef/renderer/v8_impl.cc",
|
"libcef/renderer/v8_impl.cc",
|
||||||
"libcef/renderer/v8_impl.h",
|
"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 += [
|
configs += [
|
||||||
@@ -745,6 +774,8 @@ static_library("libcef_static") {
|
|||||||
":cef_make_headers",
|
":cef_make_headers",
|
||||||
":cef_service_manifests",
|
":cef_service_manifests",
|
||||||
|
|
||||||
|
":libcef_static_unittested",
|
||||||
|
|
||||||
# Generate API bindings for extensions.
|
# Generate API bindings for extensions.
|
||||||
# TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
# TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||||
# libcef/common/extensions/api/README.txt for details.
|
# libcef/common/extensions/api/README.txt for details.
|
||||||
@@ -785,7 +816,6 @@ static_library("libcef_static") {
|
|||||||
"//components/safe_browsing/core/db:test_database_manager",
|
"//components/safe_browsing/core/db:test_database_manager",
|
||||||
"//components/services/print_compositor/public/cpp",
|
"//components/services/print_compositor/public/cpp",
|
||||||
"//components/services/print_compositor/public/mojom",
|
"//components/services/print_compositor/public/mojom",
|
||||||
"//components/tracing",
|
|
||||||
"//components/update_client",
|
"//components/update_client",
|
||||||
"//components/url_formatter",
|
"//components/url_formatter",
|
||||||
"//components/user_prefs",
|
"//components/user_prefs",
|
||||||
@@ -795,7 +825,7 @@ static_library("libcef_static") {
|
|||||||
"//components/visitedlink/renderer",
|
"//components/visitedlink/renderer",
|
||||||
"//components/viz/service",
|
"//components/viz/service",
|
||||||
"//components/web_cache/renderer",
|
"//components/web_cache/renderer",
|
||||||
"//content/public/app:both",
|
"//content/public/app",
|
||||||
"//content/public/browser",
|
"//content/public/browser",
|
||||||
"//content/public/child",
|
"//content/public/child",
|
||||||
"//content/public/common",
|
"//content/public/common",
|
||||||
@@ -848,7 +878,7 @@ static_library("libcef_static") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
sources += gypi_paths2.includes_win + [
|
sources += includes_win + [
|
||||||
"libcef/browser/browser_main_win.cc",
|
"libcef/browser/browser_main_win.cc",
|
||||||
"libcef/browser/native/browser_platform_delegate_native_win.cc",
|
"libcef/browser/native/browser_platform_delegate_native_win.cc",
|
||||||
"libcef/browser/native/browser_platform_delegate_native_win.h",
|
"libcef/browser/native/browser_platform_delegate_native_win.h",
|
||||||
@@ -893,7 +923,7 @@ static_library("libcef_static") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_linux) {
|
if (is_linux) {
|
||||||
sources += gypi_paths2.includes_linux + [
|
sources += includes_linux + [
|
||||||
"libcef/browser/native/browser_platform_delegate_native_linux.cc",
|
"libcef/browser/native/browser_platform_delegate_native_linux.cc",
|
||||||
"libcef/browser/native/browser_platform_delegate_native_linux.h",
|
"libcef/browser/native/browser_platform_delegate_native_linux.h",
|
||||||
"libcef/browser/native/menu_runner_linux.cc",
|
"libcef/browser/native/menu_runner_linux.cc",
|
||||||
@@ -925,7 +955,7 @@ static_library("libcef_static") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_mac) {
|
if (is_mac) {
|
||||||
sources += gypi_paths2.includes_mac + [
|
sources += includes_mac + [
|
||||||
"libcef/browser/native/browser_platform_delegate_native_mac.h",
|
"libcef/browser/native/browser_platform_delegate_native_mac.h",
|
||||||
"libcef/browser/native/browser_platform_delegate_native_mac.mm",
|
"libcef/browser/native/browser_platform_delegate_native_mac.mm",
|
||||||
"libcef/browser/native/file_dialog_runner_mac.h",
|
"libcef/browser/native/file_dialog_runner_mac.h",
|
||||||
@@ -956,7 +986,7 @@ static_library("libcef_static") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
deps += [
|
deps += [
|
||||||
"//components/crash/content/app",
|
"//components/crash/core/app",
|
||||||
"//components/crash/content/browser",
|
"//components/crash/content/browser",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -1088,8 +1118,8 @@ static_library("libcef_static") {
|
|||||||
"//ui/aura/test/aura_test_utils.cc",
|
"//ui/aura/test/aura_test_utils.cc",
|
||||||
"//ui/aura/test/aura_test_utils.h",
|
"//ui/aura/test/aura_test_utils.h",
|
||||||
# Part of //ui/events:test_support which is testingonly.
|
# Part of //ui/events:test_support which is testingonly.
|
||||||
"//ui/events/test/platform_event_waiter.cc",
|
"//ui/events/test/x11_event_waiter.cc",
|
||||||
"//ui/events/test/platform_event_waiter.h",
|
"//ui/events/test/x11_event_waiter.h",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (use_x11) {
|
if (use_x11) {
|
||||||
@@ -1139,7 +1169,7 @@ config("libcef_dll_wrapper_config") {
|
|||||||
|
|
||||||
# libcef_dll_wrapper target.
|
# libcef_dll_wrapper target.
|
||||||
static_library("libcef_dll_wrapper") {
|
static_library("libcef_dll_wrapper") {
|
||||||
sources = gypi_paths2.includes_common +
|
sources = includes_common +
|
||||||
gypi_paths.autogen_cpp_includes +
|
gypi_paths.autogen_cpp_includes +
|
||||||
gypi_paths2.includes_capi +
|
gypi_paths2.includes_capi +
|
||||||
gypi_paths.autogen_capi_includes +
|
gypi_paths.autogen_capi_includes +
|
||||||
@@ -1495,11 +1525,29 @@ 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.
|
# Generate pack files and associated CEF header files.
|
||||||
group("cef_make_headers") {
|
group("cef_make_headers") {
|
||||||
deps = [
|
deps = [
|
||||||
":make_pack_header_resources",
|
":make_pack_header_resources",
|
||||||
":make_pack_header_strings",
|
":make_pack_header_strings",
|
||||||
|
":make_api_hash_header",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1597,12 +1645,15 @@ if (is_mac) {
|
|||||||
sources = [
|
sources = [
|
||||||
"$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
|
"$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
|
||||||
"$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.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 = [
|
outputs = [
|
||||||
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
|
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
|
||||||
]
|
]
|
||||||
public_deps = [
|
public_deps = [
|
||||||
"//ui/gl:swiftshader_library_copy",
|
"//ui/gl:swiftshader_egl_library_copy",
|
||||||
|
"//ui/gl:swiftshader_vk_library_copy",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1632,8 +1683,8 @@ if (is_mac) {
|
|||||||
"Resources",
|
"Resources",
|
||||||
]
|
]
|
||||||
|
|
||||||
sources = gypi_paths2.includes_common +
|
sources = includes_common +
|
||||||
gypi_paths2.includes_mac +
|
includes_mac +
|
||||||
gypi_paths.autogen_cpp_includes +
|
gypi_paths.autogen_cpp_includes +
|
||||||
gypi_paths2.includes_capi +
|
gypi_paths2.includes_capi +
|
||||||
gypi_paths.autogen_capi_includes +
|
gypi_paths.autogen_capi_includes +
|
||||||
@@ -1676,7 +1727,7 @@ if (is_mac) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
shared_library("libcef") {
|
shared_library("libcef") {
|
||||||
sources = gypi_paths2.includes_common +
|
sources = includes_common +
|
||||||
gypi_paths.autogen_cpp_includes +
|
gypi_paths.autogen_cpp_includes +
|
||||||
gypi_paths2.includes_capi +
|
gypi_paths2.includes_capi +
|
||||||
gypi_paths.autogen_capi_includes +
|
gypi_paths.autogen_capi_includes +
|
||||||
@@ -1688,15 +1739,10 @@ if (is_mac) {
|
|||||||
]
|
]
|
||||||
|
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
sources += gypi_paths2.includes_win + [
|
sources += includes_win + [
|
||||||
"libcef_dll/libcef_dll.rc",
|
"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 += [
|
deps += [
|
||||||
# Bring in ui_unscaled_resources.rc which contains custom cursors.
|
# Bring in ui_unscaled_resources.rc which contains custom cursors.
|
||||||
# TODO(cef): Remove this once custom cursors can be loaded via
|
# TODO(cef): Remove this once custom cursors can be loaded via
|
||||||
@@ -1904,8 +1950,8 @@ if (is_mac) {
|
|||||||
|
|
||||||
cef_app("cefclient") {
|
cef_app("cefclient") {
|
||||||
helper_info_plist = "tests/cefclient/resources/mac/helper-Info.plist"
|
helper_info_plist = "tests/cefclient/resources/mac/helper-Info.plist"
|
||||||
helper_sources = gypi_paths2.includes_mac +
|
helper_sources = includes_common +
|
||||||
gypi_paths2.includes_common +
|
includes_mac +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
gypi_paths2.includes_wrapper_mac +
|
gypi_paths2.includes_wrapper_mac +
|
||||||
gypi_paths2.shared_sources_common +
|
gypi_paths2.shared_sources_common +
|
||||||
@@ -1918,8 +1964,8 @@ if (is_mac) {
|
|||||||
]
|
]
|
||||||
|
|
||||||
info_plist = "tests/cefclient/resources/mac/Info.plist"
|
info_plist = "tests/cefclient/resources/mac/Info.plist"
|
||||||
sources = gypi_paths2.includes_mac +
|
sources = includes_common +
|
||||||
gypi_paths2.includes_common +
|
includes_mac +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
gypi_paths2.includes_wrapper_mac +
|
gypi_paths2.includes_wrapper_mac +
|
||||||
gypi_paths2.shared_sources_browser +
|
gypi_paths2.shared_sources_browser +
|
||||||
@@ -1977,8 +2023,8 @@ if (is_mac) {
|
|||||||
|
|
||||||
cef_app("cefsimple") {
|
cef_app("cefsimple") {
|
||||||
helper_info_plist = "tests/cefsimple/mac/helper-Info.plist"
|
helper_info_plist = "tests/cefsimple/mac/helper-Info.plist"
|
||||||
helper_sources = gypi_paths2.includes_mac +
|
helper_sources = includes_common +
|
||||||
gypi_paths2.includes_common +
|
includes_mac +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
gypi_paths2.includes_wrapper_mac +
|
gypi_paths2.includes_wrapper_mac +
|
||||||
gypi_paths2.cefsimple_sources_mac_helper
|
gypi_paths2.cefsimple_sources_mac_helper
|
||||||
@@ -1987,8 +2033,8 @@ if (is_mac) {
|
|||||||
]
|
]
|
||||||
|
|
||||||
info_plist = "tests/cefsimple/mac/Info.plist"
|
info_plist = "tests/cefsimple/mac/Info.plist"
|
||||||
sources = gypi_paths2.includes_mac +
|
sources = includes_common +
|
||||||
gypi_paths2.includes_common +
|
includes_mac +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
gypi_paths2.includes_wrapper_mac +
|
gypi_paths2.includes_wrapper_mac +
|
||||||
gypi_paths2.cefsimple_sources_common +
|
gypi_paths2.cefsimple_sources_common +
|
||||||
@@ -2054,8 +2100,8 @@ if (is_mac) {
|
|||||||
]
|
]
|
||||||
|
|
||||||
info_plist = "tests/ceftests/resources/mac/Info.plist"
|
info_plist = "tests/ceftests/resources/mac/Info.plist"
|
||||||
sources = gypi_paths2.includes_mac +
|
sources = includes_common +
|
||||||
gypi_paths2.includes_common +
|
includes_mac +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
gypi_paths2.includes_wrapper_mac +
|
gypi_paths2.includes_wrapper_mac +
|
||||||
gypi_paths2.shared_sources_browser +
|
gypi_paths2.shared_sources_browser +
|
||||||
@@ -2123,7 +2169,7 @@ if (is_mac) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
executable("cefclient") {
|
executable("cefclient") {
|
||||||
sources = gypi_paths2.includes_common +
|
sources = includes_common +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
gypi_paths2.shared_sources_browser +
|
gypi_paths2.shared_sources_browser +
|
||||||
gypi_paths2.shared_sources_common +
|
gypi_paths2.shared_sources_common +
|
||||||
@@ -2142,7 +2188,7 @@ if (is_mac) {
|
|||||||
]
|
]
|
||||||
|
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
sources += gypi_paths2.includes_win +
|
sources += includes_win +
|
||||||
gypi_paths2.shared_sources_win +
|
gypi_paths2.shared_sources_win +
|
||||||
gypi_paths2.cefclient_sources_win
|
gypi_paths2.cefclient_sources_win
|
||||||
|
|
||||||
@@ -2177,7 +2223,7 @@ if (is_mac) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_linux) {
|
if (is_linux) {
|
||||||
sources += gypi_paths2.includes_linux +
|
sources += includes_linux +
|
||||||
gypi_paths2.shared_sources_linux +
|
gypi_paths2.shared_sources_linux +
|
||||||
gypi_paths2.cefclient_sources_linux
|
gypi_paths2.cefclient_sources_linux
|
||||||
|
|
||||||
@@ -2216,7 +2262,7 @@ if (is_mac) {
|
|||||||
#
|
#
|
||||||
|
|
||||||
executable("cefsimple") {
|
executable("cefsimple") {
|
||||||
sources = gypi_paths2.includes_common +
|
sources = includes_common +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
gypi_paths2.cefsimple_sources_common
|
gypi_paths2.cefsimple_sources_common
|
||||||
|
|
||||||
@@ -2230,7 +2276,7 @@ if (is_mac) {
|
|||||||
]
|
]
|
||||||
|
|
||||||
if (is_win) {
|
if (is_win) {
|
||||||
sources += gypi_paths2.includes_win +
|
sources += includes_win +
|
||||||
gypi_paths2.cefsimple_sources_win
|
gypi_paths2.cefsimple_sources_win
|
||||||
|
|
||||||
# Set /SUBSYSTEM:WINDOWS.
|
# Set /SUBSYSTEM:WINDOWS.
|
||||||
@@ -2250,7 +2296,7 @@ if (is_mac) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_linux) {
|
if (is_linux) {
|
||||||
sources += gypi_paths2.includes_linux +
|
sources += includes_linux +
|
||||||
gypi_paths2.cefsimple_sources_linux
|
gypi_paths2.cefsimple_sources_linux
|
||||||
|
|
||||||
if (use_x11) {
|
if (use_x11) {
|
||||||
@@ -2281,7 +2327,7 @@ if (is_mac) {
|
|||||||
executable("ceftests") {
|
executable("ceftests") {
|
||||||
testonly = true
|
testonly = true
|
||||||
|
|
||||||
sources = gypi_paths2.includes_common +
|
sources = includes_common +
|
||||||
gypi_paths2.includes_wrapper +
|
gypi_paths2.includes_wrapper +
|
||||||
gypi_paths2.shared_sources_browser +
|
gypi_paths2.shared_sources_browser +
|
||||||
gypi_paths2.shared_sources_common +
|
gypi_paths2.shared_sources_common +
|
||||||
|
@@ -7,6 +7,6 @@
|
|||||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||||
|
|
||||||
{
|
{
|
||||||
'chromium_checkout': 'refs/tags/81.0.4044.138',
|
'chromium_checkout': 'refs/tags/84.0.4147.105',
|
||||||
'depot_tools_checkout': 'ec2a6ce270'
|
'depot_tools_checkout': '233589f2e7'
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,9 @@
|
|||||||
'content/shell/renderer/shell_*',
|
'content/shell/renderer/shell_*',
|
||||||
'content/shell/utility/shell_*',
|
'content/shell/utility/shell_*',
|
||||||
'extensions/shell/*',
|
'extensions/shell/*',
|
||||||
|
'net/base/features.cc',
|
||||||
'net/cookies/cookie_store.h',
|
'net/cookies/cookie_store.h',
|
||||||
|
'services/network/public/cpp/features.cc',
|
||||||
'ui/base/ui_base_features.cc',
|
'ui/base/ui_base_features.cc',
|
||||||
],
|
],
|
||||||
# Patterns that should not be found in the chromium/src directory after
|
# Patterns that should not be found in the chromium/src directory after
|
||||||
|
@@ -12,8 +12,8 @@
|
|||||||
# distribution include:
|
# distribution include:
|
||||||
#
|
#
|
||||||
# Linux: Ninja, Unix Makefiles
|
# Linux: Ninja, Unix Makefiles
|
||||||
# Mac OS X: Ninja, Xcode 5+
|
# MacOS: Ninja, Xcode 8+
|
||||||
# Windows: Ninja, Visual Studio 2010+
|
# Windows: Ninja, Visual Studio 2015+
|
||||||
#
|
#
|
||||||
# Ninja is a cross-platform open-source tool for running fast builds using
|
# Ninja is a cross-platform open-source tool for running fast builds using
|
||||||
# pre-installed platform toolchains (GNU, clang, Xcode or MSVC). It can be
|
# pre-installed platform toolchains (GNU, clang, Xcode or MSVC). It can be
|
||||||
@@ -40,21 +40,21 @@
|
|||||||
#
|
#
|
||||||
# - Linux requirements:
|
# - Linux requirements:
|
||||||
# Currently supported distributions include Debian Wheezy, Ubuntu Precise, and
|
# Currently supported distributions include Debian Wheezy, Ubuntu Precise, and
|
||||||
# related. Ubuntu 14.04 64-bit is recommended. Newer versions will likely also
|
# related. Ubuntu 18.04 64-bit is recommended. Newer versions will likely also
|
||||||
# work but may not have been tested.
|
# work but may not have been tested.
|
||||||
# Required packages include:
|
# Required packages include:
|
||||||
# build-essential
|
# build-essential
|
||||||
# libgtk2.0-dev (required by the cefclient target only)
|
# libgtk2.0-dev (required by the cefclient target only)
|
||||||
# libgtkglext1-dev (required by the cefclient target only)
|
# libgtkglext1-dev (required by the cefclient target only)
|
||||||
#
|
#
|
||||||
# - Mac OS X requirements:
|
# - MacOS requirements:
|
||||||
# Xcode 5 or newer building on Mac OS X 10.9 (Mavericks) or newer. Xcode 8.3
|
# Xcode 8 or newer building on MacOS 10.10 (Yosemite) or newer. Xcode 11.2
|
||||||
# and OS X 10.12 are recommended. The Xcode command-line tools must also be
|
# and MacOS 10.14 are recommended. The Xcode command-line tools must also be
|
||||||
# installed. Only 64-bit builds are supported on OS X.
|
# installed. Only 64-bit builds are supported.
|
||||||
#
|
#
|
||||||
# - Windows requirements:
|
# - Windows requirements:
|
||||||
# Visual Studio 2010 or newer building on Windows 7 or newer. Visual Studio
|
# Visual Studio 2015 or newer building on Windows 7 or newer. Visual Studio
|
||||||
# 2015 Update 3 and Windows 10 64-bit are recommended.
|
# 2019 and Windows 10 64-bit are recommended.
|
||||||
#
|
#
|
||||||
# BUILD EXAMPLES
|
# BUILD EXAMPLES
|
||||||
#
|
#
|
||||||
@@ -75,7 +75,7 @@
|
|||||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
# > ninja cefclient cefsimple
|
# > ninja cefclient cefsimple
|
||||||
#
|
#
|
||||||
# To perform a Mac OS X build using a 64-bit CEF binary distribution:
|
# To perform a MacOS build using a 64-bit CEF binary distribution:
|
||||||
# Using the Xcode IDE:
|
# Using the Xcode IDE:
|
||||||
# > cmake -G "Xcode" -DPROJECT_ARCH="x86_64" ..
|
# > cmake -G "Xcode" -DPROJECT_ARCH="x86_64" ..
|
||||||
# Open build\cef.xcodeproj in Xcode and select Product > Build.
|
# Open build\cef.xcodeproj in Xcode and select Product > Build.
|
||||||
@@ -85,24 +85,24 @@
|
|||||||
# > ninja cefclient cefsimple
|
# > ninja cefclient cefsimple
|
||||||
#
|
#
|
||||||
# To perform a Windows build using a 32-bit CEF binary distribution:
|
# To perform a Windows build using a 32-bit CEF binary distribution:
|
||||||
# Using the Visual Studio 2015 IDE:
|
# Using the Visual Studio 2019 IDE:
|
||||||
# > cmake -G "Visual Studio 14" ..
|
# > cmake -G "Visual Studio 16" -A Win32 ..
|
||||||
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
||||||
#
|
#
|
||||||
# Using Ninja with Visual Studio 2015 command-line tools:
|
# Using Ninja with Visual Studio 2019 command-line tools:
|
||||||
# (this path may be different depending on your Visual Studio installation)
|
# (this path may be different depending on your Visual Studio installation)
|
||||||
# > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\vcvars32.bat"
|
# > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars32.bat"
|
||||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
# > ninja cefclient cefsimple
|
# > ninja cefclient cefsimple
|
||||||
#
|
#
|
||||||
# To perform a Windows build using a 64-bit CEF binary distribution:
|
# To perform a Windows build using a 64-bit CEF binary distribution:
|
||||||
# Using the Visual Studio 2015 IDE:
|
# Using the Visual Studio 2019 IDE:
|
||||||
# > cmake -G "Visual Studio 14 Win64" ..
|
# > cmake -G "Visual Studio 16" -A x64 ..
|
||||||
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
# Open build\cef.sln in Visual Studio and select Build > Build Solution.
|
||||||
#
|
#
|
||||||
# Using Ninja with Visual Studio 2015 command-line tools:
|
# Using Ninja with Visual Studio 2019 command-line tools:
|
||||||
# (this path may be different depending on your Visual Studio installation)
|
# (this path may be different depending on your Visual Studio installation)
|
||||||
# > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\vcvars64.bat"
|
# > "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Auxiliary\Build\vcvars64.bat"
|
||||||
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
# > cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
# > ninja cefclient cefsimple
|
# > ninja cefclient cefsimple
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
# by hand. See the translator.README.txt file in the tools directory for
|
# by hand. See the translator.README.txt file in the tools directory for
|
||||||
# more information.
|
# more information.
|
||||||
#
|
#
|
||||||
# $hash=578c0aef11c3c7840679e480069fc9031c628e25$
|
# $hash=72268a78a76d7d91b8ad47f6b6e9f6d9cb04d9cf$
|
||||||
#
|
#
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
'autogen_cpp_includes': [
|
'autogen_cpp_includes': [
|
||||||
'include/cef_accessibility_handler.h',
|
'include/cef_accessibility_handler.h',
|
||||||
'include/cef_app.h',
|
'include/cef_app.h',
|
||||||
|
'include/cef_audio_handler.h',
|
||||||
'include/cef_auth_callback.h',
|
'include/cef_auth_callback.h',
|
||||||
'include/cef_browser.h',
|
'include/cef_browser.h',
|
||||||
'include/cef_browser_process_handler.h',
|
'include/cef_browser_process_handler.h',
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
'include/cef_context_menu_handler.h',
|
'include/cef_context_menu_handler.h',
|
||||||
'include/cef_cookie.h',
|
'include/cef_cookie.h',
|
||||||
'include/cef_crash_util.h',
|
'include/cef_crash_util.h',
|
||||||
|
'include/cef_devtools_message_observer.h',
|
||||||
'include/cef_dialog_handler.h',
|
'include/cef_dialog_handler.h',
|
||||||
'include/cef_display_handler.h',
|
'include/cef_display_handler.h',
|
||||||
'include/cef_dom.h',
|
'include/cef_dom.h',
|
||||||
@@ -111,6 +113,7 @@
|
|||||||
'autogen_capi_includes': [
|
'autogen_capi_includes': [
|
||||||
'include/capi/cef_accessibility_handler_capi.h',
|
'include/capi/cef_accessibility_handler_capi.h',
|
||||||
'include/capi/cef_app_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_auth_callback_capi.h',
|
||||||
'include/capi/cef_browser_capi.h',
|
'include/capi/cef_browser_capi.h',
|
||||||
'include/capi/cef_browser_process_handler_capi.h',
|
'include/capi/cef_browser_process_handler_capi.h',
|
||||||
@@ -120,6 +123,7 @@
|
|||||||
'include/capi/cef_context_menu_handler_capi.h',
|
'include/capi/cef_context_menu_handler_capi.h',
|
||||||
'include/capi/cef_cookie_capi.h',
|
'include/capi/cef_cookie_capi.h',
|
||||||
'include/capi/cef_crash_util_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_dialog_handler_capi.h',
|
||||||
'include/capi/cef_display_handler_capi.h',
|
'include/capi/cef_display_handler_capi.h',
|
||||||
'include/capi/cef_dom_capi.h',
|
'include/capi/cef_dom_capi.h',
|
||||||
@@ -208,6 +212,8 @@
|
|||||||
'libcef_dll/ctocpp/accessibility_handler_ctocpp.h',
|
'libcef_dll/ctocpp/accessibility_handler_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/app_ctocpp.cc',
|
'libcef_dll/ctocpp/app_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/app_ctocpp.h',
|
'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.cc',
|
||||||
'libcef_dll/cpptoc/auth_callback_cpptoc.h',
|
'libcef_dll/cpptoc/auth_callback_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/before_download_callback_cpptoc.cc',
|
'libcef_dll/cpptoc/before_download_callback_cpptoc.cc',
|
||||||
@@ -256,6 +262,8 @@
|
|||||||
'libcef_dll/ctocpp/domvisitor_ctocpp.h',
|
'libcef_dll/ctocpp/domvisitor_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.cc',
|
'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.h',
|
'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.cc',
|
||||||
'libcef_dll/ctocpp/dialog_handler_ctocpp.h',
|
'libcef_dll/ctocpp/dialog_handler_ctocpp.h',
|
||||||
'libcef_dll/cpptoc/dictionary_value_cpptoc.cc',
|
'libcef_dll/cpptoc/dictionary_value_cpptoc.cc',
|
||||||
@@ -322,6 +330,8 @@
|
|||||||
'libcef_dll/cpptoc/media_router_cpptoc.h',
|
'libcef_dll/cpptoc/media_router_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/media_sink_cpptoc.cc',
|
'libcef_dll/cpptoc/media_sink_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/media_sink_cpptoc.h',
|
'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.cc',
|
||||||
'libcef_dll/cpptoc/media_source_cpptoc.h',
|
'libcef_dll/cpptoc/media_source_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/views/menu_button_cpptoc.cc',
|
'libcef_dll/cpptoc/views/menu_button_cpptoc.cc',
|
||||||
@@ -512,6 +522,8 @@
|
|||||||
'libcef_dll/cpptoc/accessibility_handler_cpptoc.h',
|
'libcef_dll/cpptoc/accessibility_handler_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/app_cpptoc.cc',
|
'libcef_dll/cpptoc/app_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/app_cpptoc.h',
|
'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.cc',
|
||||||
'libcef_dll/ctocpp/auth_callback_ctocpp.h',
|
'libcef_dll/ctocpp/auth_callback_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/before_download_callback_ctocpp.cc',
|
'libcef_dll/ctocpp/before_download_callback_ctocpp.cc',
|
||||||
@@ -560,6 +572,8 @@
|
|||||||
'libcef_dll/cpptoc/domvisitor_cpptoc.h',
|
'libcef_dll/cpptoc/domvisitor_cpptoc.h',
|
||||||
'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.cc',
|
'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.cc',
|
||||||
'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.h',
|
'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.cc',
|
||||||
'libcef_dll/cpptoc/dialog_handler_cpptoc.h',
|
'libcef_dll/cpptoc/dialog_handler_cpptoc.h',
|
||||||
'libcef_dll/ctocpp/dictionary_value_ctocpp.cc',
|
'libcef_dll/ctocpp/dictionary_value_ctocpp.cc',
|
||||||
@@ -626,6 +640,8 @@
|
|||||||
'libcef_dll/ctocpp/media_router_ctocpp.h',
|
'libcef_dll/ctocpp/media_router_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/media_sink_ctocpp.cc',
|
'libcef_dll/ctocpp/media_sink_ctocpp.cc',
|
||||||
'libcef_dll/ctocpp/media_sink_ctocpp.h',
|
'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.cc',
|
||||||
'libcef_dll/ctocpp/media_source_ctocpp.h',
|
'libcef_dll/ctocpp/media_source_ctocpp.h',
|
||||||
'libcef_dll/ctocpp/views/menu_button_ctocpp.cc',
|
'libcef_dll/ctocpp/views/menu_button_ctocpp.cc',
|
||||||
|
@@ -39,19 +39,21 @@
|
|||||||
'include/cef_config.h',
|
'include/cef_config.h',
|
||||||
'include/cef_version.h',
|
'include/cef_version.h',
|
||||||
'include/internal/cef_export.h',
|
'include/internal/cef_export.h',
|
||||||
'include/internal/cef_logging_internal.h',
|
|
||||||
'include/internal/cef_ptr.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_string.h',
|
'include/internal/cef_string.h',
|
||||||
'include/internal/cef_string_list.h',
|
'include/internal/cef_string_list.h',
|
||||||
'include/internal/cef_string_map.h',
|
'include/internal/cef_string_map.h',
|
||||||
'include/internal/cef_string_multimap.h',
|
'include/internal/cef_string_multimap.h',
|
||||||
'include/internal/cef_string_types.h',
|
'include/internal/cef_string_types.h',
|
||||||
'include/internal/cef_string_wrappers.h',
|
|
||||||
'include/internal/cef_thread_internal.h',
|
'include/internal/cef_thread_internal.h',
|
||||||
'include/internal/cef_time.h',
|
'include/internal/cef_time.h',
|
||||||
'include/internal/cef_trace_event_internal.h',
|
'include/internal/cef_trace_event_internal.h',
|
||||||
'include/internal/cef_types.h',
|
'include/internal/cef_types.h',
|
||||||
'include/internal/cef_types_wrappers.h',
|
|
||||||
],
|
],
|
||||||
'includes_capi': [
|
'includes_capi': [
|
||||||
'include/capi/cef_base_capi.h',
|
'include/capi/cef_base_capi.h',
|
||||||
@@ -75,15 +77,19 @@
|
|||||||
'include/base/internal/cef_atomicops_x86_msvc.h',
|
'include/base/internal/cef_atomicops_x86_msvc.h',
|
||||||
'include/base/internal/cef_bind_internal_win.h',
|
'include/base/internal/cef_bind_internal_win.h',
|
||||||
'include/cef_sandbox_win.h',
|
'include/cef_sandbox_win.h',
|
||||||
'include/internal/cef_types_win.h',
|
|
||||||
'include/internal/cef_win.h',
|
'include/internal/cef_win.h',
|
||||||
],
|
],
|
||||||
|
'includes_win_capi': [
|
||||||
|
'include/internal/cef_types_win.h',
|
||||||
|
],
|
||||||
'includes_mac': [
|
'includes_mac': [
|
||||||
'include/base/internal/cef_atomicops_atomicword_compat.h',
|
'include/base/internal/cef_atomicops_atomicword_compat.h',
|
||||||
'include/base/internal/cef_atomicops_mac.h',
|
'include/base/internal/cef_atomicops_mac.h',
|
||||||
'include/cef_application_mac.h',
|
'include/cef_application_mac.h',
|
||||||
'include/cef_sandbox_mac.h',
|
'include/cef_sandbox_mac.h',
|
||||||
'include/internal/cef_mac.h',
|
'include/internal/cef_mac.h',
|
||||||
|
],
|
||||||
|
'includes_mac_capi': [
|
||||||
'include/internal/cef_types_mac.h',
|
'include/internal/cef_types_mac.h',
|
||||||
],
|
],
|
||||||
'includes_linux': [
|
'includes_linux': [
|
||||||
@@ -92,6 +98,8 @@
|
|||||||
'include/base/internal/cef_atomicops_arm64_gcc.h',
|
'include/base/internal/cef_atomicops_arm64_gcc.h',
|
||||||
'include/base/internal/cef_atomicops_x86_gcc.h',
|
'include/base/internal/cef_atomicops_x86_gcc.h',
|
||||||
'include/internal/cef_linux.h',
|
'include/internal/cef_linux.h',
|
||||||
|
],
|
||||||
|
'includes_linux_capi': [
|
||||||
'include/internal/cef_types_linux.h',
|
'include/internal/cef_types_linux.h',
|
||||||
],
|
],
|
||||||
'libcef_sources_common': [
|
'libcef_sources_common': [
|
||||||
@@ -458,9 +466,11 @@
|
|||||||
'tests/cefsimple/simple_handler_linux.cc',
|
'tests/cefsimple/simple_handler_linux.cc',
|
||||||
],
|
],
|
||||||
'ceftests_sources_common': [
|
'ceftests_sources_common': [
|
||||||
|
'tests/ceftests/audio_output_unittest.cc',
|
||||||
'tests/ceftests/browser_info_map_unittest.cc',
|
'tests/ceftests/browser_info_map_unittest.cc',
|
||||||
'tests/ceftests/command_line_unittest.cc',
|
'tests/ceftests/command_line_unittest.cc',
|
||||||
'tests/ceftests/cookie_unittest.cc',
|
'tests/ceftests/cookie_unittest.cc',
|
||||||
|
'tests/ceftests/devtools_message_unittest.cc',
|
||||||
'tests/ceftests/dialog_unittest.cc',
|
'tests/ceftests/dialog_unittest.cc',
|
||||||
'tests/ceftests/display_unittest.cc',
|
'tests/ceftests/display_unittest.cc',
|
||||||
'tests/ceftests/dom_unittest.cc',
|
'tests/ceftests/dom_unittest.cc',
|
||||||
@@ -557,6 +567,7 @@
|
|||||||
'tests/shared/browser/resource_util.h',
|
'tests/shared/browser/resource_util.h',
|
||||||
'tests/shared/browser/resource_util_mac.mm',
|
'tests/shared/browser/resource_util_mac.mm',
|
||||||
'tests/shared/browser/resource_util_posix.cc',
|
'tests/shared/browser/resource_util_posix.cc',
|
||||||
|
'tests/ceftests/audio_output_unittest.cc',
|
||||||
'tests/ceftests/client_app_delegates.cc',
|
'tests/ceftests/client_app_delegates.cc',
|
||||||
'tests/ceftests/cookie_unittest.cc',
|
'tests/ceftests/cookie_unittest.cc',
|
||||||
'tests/ceftests/dom_unittest.cc',
|
'tests/ceftests/dom_unittest.cc',
|
||||||
|
@@ -310,7 +310,7 @@ if(OS_MACOSX)
|
|||||||
|
|
||||||
# Find the newest available base SDK.
|
# Find the newest available base SDK.
|
||||||
execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
execute_process(COMMAND xcode-select --print-path OUTPUT_VARIABLE XCODE_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
foreach(OS_VERSION 10.11 10.10 10.9)
|
foreach(OS_VERSION 10.15 10.14 10.13 10.12 10.11 10.10)
|
||||||
set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
|
set(SDK "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${OS_VERSION}.sdk")
|
||||||
if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
|
if(NOT "${CMAKE_OSX_SYSROOT}" AND EXISTS "${SDK}" AND IS_DIRECTORY "${SDK}")
|
||||||
set(CMAKE_OSX_SYSROOT ${SDK})
|
set(CMAKE_OSX_SYSROOT ${SDK})
|
||||||
@@ -318,7 +318,7 @@ if(OS_MACOSX)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
# Target SDK.
|
# Target SDK.
|
||||||
set(CEF_TARGET_SDK "10.9")
|
set(CEF_TARGET_SDK "10.10")
|
||||||
list(APPEND CEF_COMPILER_FLAGS
|
list(APPEND CEF_COMPILER_FLAGS
|
||||||
-mmacosx-version-min=${CEF_TARGET_SDK}
|
-mmacosx-version-min=${CEF_TARGET_SDK}
|
||||||
)
|
)
|
||||||
@@ -375,25 +375,8 @@ if(OS_WINDOWS)
|
|||||||
|
|
||||||
if(USE_SANDBOX)
|
if(USE_SANDBOX)
|
||||||
# Check if the current MSVC version is compatible with the cef_sandbox.lib
|
# Check if the current MSVC version is compatible with the cef_sandbox.lib
|
||||||
# static library. For a list of all version numbers see
|
# static library. We require VS2015 or newer.
|
||||||
# https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Internal_version_numbering
|
if(MSVC_VERSION LESS 1900)
|
||||||
list(APPEND supported_msvc_versions
|
|
||||||
1900 # VS2015 and updates 1, 2, & 3
|
|
||||||
1910 # VS2017 version 15.1 & 15.2
|
|
||||||
1911 # VS2017 version 15.3 & 15.4
|
|
||||||
1912 # VS2017 version 15.5
|
|
||||||
1913 # VS2017 version 15.6
|
|
||||||
1914 # VS2017 version 15.7
|
|
||||||
1915 # VS2017 version 15.8
|
|
||||||
1916 # VS2017 version 15.9
|
|
||||||
1920 # VS2019 version 16.0
|
|
||||||
1921 # VS2019 version 16.1
|
|
||||||
1922 # VS2019 version 16.2
|
|
||||||
1923 # VS2019 version 16.3
|
|
||||||
1924 # VS2019 version 16.4
|
|
||||||
)
|
|
||||||
list(FIND supported_msvc_versions ${MSVC_VERSION} _index)
|
|
||||||
if (${_index} EQUAL -1)
|
|
||||||
message(WARNING "CEF sandbox is not compatible with the current MSVC version (${MSVC_VERSION})")
|
message(WARNING "CEF sandbox is not compatible with the current MSVC version (${MSVC_VERSION})")
|
||||||
set(USE_SANDBOX OFF)
|
set(USE_SANDBOX OFF)
|
||||||
endif()
|
endif()
|
||||||
|
121
include/capi/cef_audio_handler_capi.h
Normal file
121
include/capi/cef_audio_handler_capi.h
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
// 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
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=ba4033eaf40a8ee24408b89b78496bf1381e7e6b$
|
// $hash=6cb00a0fa3631a46903abb3a783f315895511db2$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||||
@@ -41,10 +41,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/capi/cef_base_capi.h"
|
#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_drag_data_capi.h"
|
||||||
#include "include/capi/cef_frame_capi.h"
|
#include "include/capi/cef_frame_capi.h"
|
||||||
#include "include/capi/cef_image_capi.h"
|
#include "include/capi/cef_image_capi.h"
|
||||||
#include "include/capi/cef_navigation_entry_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"
|
#include "include/capi/cef_request_context_capi.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
@@ -484,6 +486,71 @@ typedef struct _cef_browser_host_t {
|
|||||||
///
|
///
|
||||||
int(CEF_CALLBACK* has_dev_tools)(struct _cef_browser_host_t* self);
|
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
|
// Retrieve a snapshot of current navigation entries as values sent to the
|
||||||
// specified visitor. If |current_only| is true (1) only the current
|
// specified visitor. If |current_only| is true (1) only the current
|
||||||
|
@@ -33,13 +33,14 @@
|
|||||||
// by hand. See the translator.README.txt file in the tools directory for
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=6a0312765614a697d56e87c8503afba8404bb08b$
|
// $hash=8d4cb3e0bbf230804c93898daa4a8b2866a2c1ce$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
||||||
#define CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
#define CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/capi/cef_audio_handler_capi.h"
|
||||||
#include "include/capi/cef_base_capi.h"
|
#include "include/capi/cef_base_capi.h"
|
||||||
#include "include/capi/cef_context_menu_handler_capi.h"
|
#include "include/capi/cef_context_menu_handler_capi.h"
|
||||||
#include "include/capi/cef_dialog_handler_capi.h"
|
#include "include/capi/cef_dialog_handler_capi.h"
|
||||||
@@ -69,6 +70,12 @@ typedef struct _cef_client_t {
|
|||||||
///
|
///
|
||||||
cef_base_ref_counted_t base;
|
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
|
// Return the handler for context menus. If no handler is provided the default
|
||||||
// implementation will be used.
|
// implementation will be used.
|
||||||
|
147
include/capi/cef_devtools_message_observer_capi.h
Normal file
147
include/capi/cef_devtools_message_observer_capi.h
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
// 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
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=aa1310919932145744d5347d449d6ee10a3a0813$
|
// $hash=9d5077fdb3fe7fa0ff1141f839988ac821eba4bf$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||||
@@ -50,6 +50,7 @@ extern "C" {
|
|||||||
struct _cef_media_observer_t;
|
struct _cef_media_observer_t;
|
||||||
struct _cef_media_route_create_callback_t;
|
struct _cef_media_route_create_callback_t;
|
||||||
struct _cef_media_route_t;
|
struct _cef_media_route_t;
|
||||||
|
struct _cef_media_sink_device_info_callback_t;
|
||||||
struct _cef_media_sink_t;
|
struct _cef_media_sink_t;
|
||||||
struct _cef_media_source_t;
|
struct _cef_media_source_t;
|
||||||
|
|
||||||
@@ -270,6 +271,13 @@ typedef struct _cef_media_sink_t {
|
|||||||
cef_media_sink_icon_type_t(CEF_CALLBACK* get_icon_type)(
|
cef_media_sink_icon_type_t(CEF_CALLBACK* get_icon_type)(
|
||||||
struct _cef_media_sink_t* self);
|
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.
|
// Returns true (1) if this sink accepts content via Cast.
|
||||||
///
|
///
|
||||||
@@ -287,6 +295,25 @@ typedef struct _cef_media_sink_t {
|
|||||||
struct _cef_media_source_t* source);
|
struct _cef_media_source_t* source);
|
||||||
} cef_media_sink_t;
|
} 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
|
// 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
|
// 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
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=3bc4225f43428d8a3a24dcac1830dafac18b0caf$
|
// $hash=14cf03e02d8ca3416e65f756470afd8185c7bc78$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_PARSER_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_PARSER_CAPI_H_
|
||||||
@@ -140,6 +140,16 @@ CEF_EXPORT struct _cef_value_t* cef_parse_json(
|
|||||||
const cef_string_t* json_string,
|
const cef_string_t* json_string,
|
||||||
cef_json_parser_options_t options);
|
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
|
// Parses the specified |json_string| and returns a dictionary or list
|
||||||
// representation. If JSON parsing fails this function returns NULL and
|
// 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
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=a28219cc8c1cb53faacaf236374c3cf2c0c45bef$
|
// $hash=0167eb1abe614bd6391d273a8085fa3e53e7c217$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||||
@@ -253,6 +253,14 @@ typedef struct _cef_request_handler_t {
|
|||||||
struct _cef_request_handler_t* self,
|
struct _cef_request_handler_t* self,
|
||||||
struct _cef_browser_t* browser,
|
struct _cef_browser_t* browser,
|
||||||
cef_termination_status_t status);
|
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;
|
} cef_request_handler_t;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
// by hand. See the translator.README.txt file in the tools directory for
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=b9577b495df3990284d4e4a3db2824196175dc91$
|
// $hash=b0e2b63b467c6d4e990405d948908da3546ea1c7$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_CAPI_H_
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/capi/cef_base_capi.h"
|
#include "include/capi/cef_base_capi.h"
|
||||||
|
#include "include/capi/cef_values_capi.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -70,34 +71,25 @@ typedef struct _cef_resource_bundle_t {
|
|||||||
int string_id);
|
int string_id);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Retrieves the contents of the specified scale independent |resource_id|. If
|
// Returns a cef_binary_value_t containing the decompressed contents of the
|
||||||
// the value is found then |data| and |data_size| will be populated and this
|
// specified scale independent |resource_id| or NULL if not found. Include
|
||||||
// function will return true (1). If the value is not found then this function
|
// cef_pack_resources.h for a listing of valid resource ID values.
|
||||||
// will return false (0). The returned |data| pointer will remain resident in
|
|
||||||
// memory and should not be freed. Include cef_pack_resources.h for a listing
|
|
||||||
// of valid resource ID values.
|
|
||||||
///
|
///
|
||||||
int(CEF_CALLBACK* get_data_resource)(struct _cef_resource_bundle_t* self,
|
struct _cef_binary_value_t*(CEF_CALLBACK* get_data_resource)(
|
||||||
int resource_id,
|
struct _cef_resource_bundle_t* self,
|
||||||
void** data,
|
int resource_id);
|
||||||
size_t* data_size);
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Retrieves the contents of the specified |resource_id| nearest the scale
|
// Returns a cef_binary_value_t containing the decompressed contents of the
|
||||||
// factor |scale_factor|. Use a |scale_factor| value of SCALE_FACTOR_NONE for
|
// specified |resource_id| nearest the scale factor |scale_factor| or NULL if
|
||||||
// scale independent resources or call GetDataResource instead. If the value
|
// not found. Use a |scale_factor| value of SCALE_FACTOR_NONE for scale
|
||||||
// is found then |data| and |data_size| will be populated and this function
|
// independent resources or call GetDataResource instead.Include
|
||||||
// will return true (1). If the value is not found then this function will
|
// cef_pack_resources.h for a listing of valid resource ID values.
|
||||||
// return false (0). The returned |data| pointer will remain resident in
|
|
||||||
// memory and should not be freed. Include cef_pack_resources.h for a listing
|
|
||||||
// of valid resource ID values.
|
|
||||||
///
|
///
|
||||||
int(CEF_CALLBACK* get_data_resource_for_scale)(
|
struct _cef_binary_value_t*(CEF_CALLBACK* get_data_resource_for_scale)(
|
||||||
struct _cef_resource_bundle_t* self,
|
struct _cef_resource_bundle_t* self,
|
||||||
int resource_id,
|
int resource_id,
|
||||||
cef_scale_factor_t scale_factor,
|
cef_scale_factor_t scale_factor);
|
||||||
void** data,
|
|
||||||
size_t* data_size);
|
|
||||||
} cef_resource_bundle_t;
|
} cef_resource_bundle_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
// by hand. See the translator.README.txt file in the tools directory for
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
// more information.
|
// more information.
|
||||||
//
|
//
|
||||||
// $hash=71ba0e5714400e2bea3ca564cab4527d95e4b52c$
|
// $hash=06f1c03ba824052122c6217c1227931f15dadd08$
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_TEXTFIELD_CAPI_H_
|
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_TEXTFIELD_CAPI_H_
|
||||||
@@ -219,16 +219,13 @@ typedef struct _cef_textfield_t {
|
|||||||
// enabled. See additional comments on execute_command().
|
// enabled. See additional comments on execute_command().
|
||||||
///
|
///
|
||||||
int(CEF_CALLBACK* is_command_enabled)(struct _cef_textfield_t* self,
|
int(CEF_CALLBACK* is_command_enabled)(struct _cef_textfield_t* self,
|
||||||
int command_id);
|
cef_text_field_commands_t command_id);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Performs the action associated with the specified command id. Valid values
|
// Performs the action associated with the specified command id.
|
||||||
// include IDS_APP_UNDO, IDS_APP_REDO, IDS_APP_CUT, IDS_APP_COPY,
|
|
||||||
// IDS_APP_PASTE, IDS_APP_DELETE, IDS_APP_SELECT_ALL, IDS_DELETE_* and
|
|
||||||
// IDS_MOVE_*. See include/cef_pack_strings.h for definitions.
|
|
||||||
///
|
///
|
||||||
void(CEF_CALLBACK* execute_command)(struct _cef_textfield_t* self,
|
void(CEF_CALLBACK* execute_command)(struct _cef_textfield_t* self,
|
||||||
int command_id);
|
cef_text_field_commands_t command_id);
|
||||||
|
|
||||||
///
|
///
|
||||||
// Clears Edit history.
|
// Clears Edit history.
|
||||||
|
@@ -29,12 +29,7 @@
|
|||||||
//
|
//
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// This file was generated by the CEF translator tool. If making changes by
|
// This file was generated by the make_api_hash_header.py tool.
|
||||||
// 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=fd013f5bdcf2333b1f0fb452442d300dffe598e5$
|
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef CEF_INCLUDE_API_HASH_H_
|
#ifndef CEF_INCLUDE_API_HASH_H_
|
||||||
@@ -47,13 +42,13 @@
|
|||||||
// way that may cause binary incompatibility with other builds. The universal
|
// way that may cause binary incompatibility with other builds. The universal
|
||||||
// hash value will change if any platform is affected whereas the platform hash
|
// hash value will change if any platform is affected whereas the platform hash
|
||||||
// values will change only if that particular platform is affected.
|
// values will change only if that particular platform is affected.
|
||||||
#define CEF_API_HASH_UNIVERSAL "c80d4c5f1dc72279ac7a44d7b174fb80cf728abc"
|
#define CEF_API_HASH_UNIVERSAL "63365efe2e93a4e7cc789cbb8f618d61c92c1b6d"
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#define CEF_API_HASH_PLATFORM "bde71fdc88914ed7353ee7308d060cd6b4f8c8af"
|
#define CEF_API_HASH_PLATFORM "726d42ca7d92188542b433d88d17a87af5b53c05"
|
||||||
#elif defined(OS_MACOSX)
|
#elif defined(OS_MACOSX)
|
||||||
#define CEF_API_HASH_PLATFORM "2fb3e42a6d2e594aa55792b5852d7f57524ab011"
|
#define CEF_API_HASH_PLATFORM "1c8a413434b592d388446e66b54a3f0bfc0d6fff"
|
||||||
#elif defined(OS_LINUX)
|
#elif defined(OS_LINUX)
|
||||||
#define CEF_API_HASH_PLATFORM "222824f83536a111c6480dba64833251c01cd6fd"
|
#define CEF_API_HASH_PLATFORM "13f7e0e86daab3b1a08d8a31103fc93e45cc508f"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
111
include/cef_audio_handler.h
Normal file
111
include/cef_audio_handler.h
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
// 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,10 +40,12 @@
|
|||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
|
#include "include/cef_devtools_message_observer.h"
|
||||||
#include "include/cef_drag_data.h"
|
#include "include/cef_drag_data.h"
|
||||||
#include "include/cef_frame.h"
|
#include "include/cef_frame.h"
|
||||||
#include "include/cef_image.h"
|
#include "include/cef_image.h"
|
||||||
#include "include/cef_navigation_entry.h"
|
#include "include/cef_navigation_entry.h"
|
||||||
|
#include "include/cef_registration.h"
|
||||||
#include "include/cef_request_context.h"
|
#include "include/cef_request_context.h"
|
||||||
|
|
||||||
class CefBrowserHost;
|
class CefBrowserHost;
|
||||||
@@ -517,6 +519,69 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
|||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual bool HasDevTools() = 0;
|
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
|
// Retrieve a snapshot of current navigation entries as values sent to the
|
||||||
// specified visitor. If |current_only| is true only the current navigation
|
// specified visitor. If |current_only| is true only the current navigation
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
#define CEF_INCLUDE_CEF_CLIENT_H_
|
#define CEF_INCLUDE_CEF_CLIENT_H_
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "include/cef_audio_handler.h"
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
#include "include/cef_context_menu_handler.h"
|
#include "include/cef_context_menu_handler.h"
|
||||||
#include "include/cef_dialog_handler.h"
|
#include "include/cef_dialog_handler.h"
|
||||||
@@ -60,6 +61,12 @@
|
|||||||
/*--cef(source=client,no_debugct_check)--*/
|
/*--cef(source=client,no_debugct_check)--*/
|
||||||
class CefClient : public virtual CefBaseRefCounted {
|
class CefClient : public virtual CefBaseRefCounted {
|
||||||
public:
|
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
|
// Return the handler for context menus. If no handler is provided the default
|
||||||
// implementation will be used.
|
// implementation will be used.
|
||||||
|
130
include/cef_devtools_message_observer.h
Normal file
130
include/cef_devtools_message_observer.h
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
// 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,6 +46,7 @@ class CefMediaObserver;
|
|||||||
class CefMediaRoute;
|
class CefMediaRoute;
|
||||||
class CefMediaRouteCreateCallback;
|
class CefMediaRouteCreateCallback;
|
||||||
class CefMediaSink;
|
class CefMediaSink;
|
||||||
|
class CefMediaSinkDeviceInfoCallback;
|
||||||
class CefMediaSource;
|
class CefMediaSource;
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -253,6 +254,13 @@ class CefMediaSink : public virtual CefBaseRefCounted {
|
|||||||
/*--cef(default_retval=CEF_MSIT_GENERIC)--*/
|
/*--cef(default_retval=CEF_MSIT_GENERIC)--*/
|
||||||
virtual IconType GetIconType() = 0;
|
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.
|
// Returns true if this sink accepts content via Cast.
|
||||||
///
|
///
|
||||||
@@ -272,6 +280,22 @@ class CefMediaSink : public virtual CefBaseRefCounted {
|
|||||||
virtual bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) = 0;
|
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
|
// 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
|
// are retrieved via CefMediaRouter::GetSource. The methods of this class may be
|
||||||
|
@@ -133,6 +133,16 @@ CefString CefURIDecode(const CefString& text,
|
|||||||
CefRefPtr<CefValue> CefParseJSON(const CefString& json_string,
|
CefRefPtr<CefValue> CefParseJSON(const CefString& json_string,
|
||||||
cef_json_parser_options_t options);
|
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
|
// Parses the specified |json_string| and returns a dictionary or list
|
||||||
// representation. If JSON parsing fails this method returns NULL and populates
|
// representation. If JSON parsing fails this method returns NULL and populates
|
||||||
|
@@ -252,6 +252,13 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
|
|||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||||
TerminationStatus status) {}
|
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_
|
#endif // CEF_INCLUDE_CEF_REQUEST_HANDLER_H_
|
||||||
|
@@ -39,6 +39,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "include/cef_base.h"
|
#include "include/cef_base.h"
|
||||||
|
#include "include/cef_values.h"
|
||||||
|
|
||||||
///
|
///
|
||||||
// Class used for retrieving resources from the resource bundle (*.pak) files
|
// Class used for retrieving resources from the resource bundle (*.pak) files
|
||||||
@@ -67,33 +68,24 @@ class CefResourceBundle : public virtual CefBaseRefCounted {
|
|||||||
virtual CefString GetLocalizedString(int string_id) = 0;
|
virtual CefString GetLocalizedString(int string_id) = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Retrieves the contents of the specified scale independent |resource_id|.
|
// Returns a CefBinaryValue containing the decompressed contents of the
|
||||||
// If the value is found then |data| and |data_size| will be populated and
|
// specified scale independent |resource_id| or NULL if not found. Include
|
||||||
// this method will return true. If the value is not found then this method
|
// cef_pack_resources.h for a listing of valid resource ID values.
|
||||||
// will return false. The returned |data| pointer will remain resident in
|
|
||||||
// memory and should not be freed. Include cef_pack_resources.h for a listing
|
|
||||||
// of valid resource ID values.
|
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual bool GetDataResource(int resource_id,
|
virtual CefRefPtr<CefBinaryValue> GetDataResource(int resource_id) = 0;
|
||||||
void*& data,
|
|
||||||
size_t& data_size) = 0;
|
|
||||||
|
|
||||||
///
|
///
|
||||||
// Retrieves the contents of the specified |resource_id| nearest the scale
|
// Returns a CefBinaryValue containing the decompressed contents of the
|
||||||
// factor |scale_factor|. Use a |scale_factor| value of SCALE_FACTOR_NONE for
|
// specified |resource_id| nearest the scale factor |scale_factor| or NULL if
|
||||||
// scale independent resources or call GetDataResource instead. If the value
|
// not found. Use a |scale_factor| value of SCALE_FACTOR_NONE for scale
|
||||||
// is found then |data| and |data_size| will be populated and this method will
|
// independent resources or call GetDataResource instead.Include
|
||||||
// return true. If the value is not found then this method will return false.
|
// cef_pack_resources.h for a listing of valid resource ID values.
|
||||||
// The returned |data| pointer will remain resident in memory and should not
|
|
||||||
// be freed. Include cef_pack_resources.h for a listing of valid resource ID
|
|
||||||
// values.
|
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual bool GetDataResourceForScale(int resource_id,
|
virtual CefRefPtr<CefBinaryValue> GetDataResourceForScale(
|
||||||
ScaleFactor scale_factor,
|
int resource_id,
|
||||||
void*& data,
|
ScaleFactor scale_factor) = 0;
|
||||||
size_t& data_size) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CEF_INCLUDE_CEF_RESOURCE_BUNDLE_H_
|
#endif // CEF_INCLUDE_CEF_RESOURCE_BUNDLE_H_
|
||||||
|
@@ -170,23 +170,25 @@ typedef struct _cef_settings_t {
|
|||||||
// will be used. If this value is empty on macOS then a helper executable must
|
// 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"
|
// exist at "Contents/Frameworks/<app> Helper.app/Contents/MacOS/<app> Helper"
|
||||||
// in the top-level app bundle. See the comments on CefExecuteProcess() for
|
// in the top-level app bundle. See the comments on CefExecuteProcess() for
|
||||||
// details. Also configurable using the "browser-subprocess-path" command-line
|
// details. If this value is non-empty then it must be an absolute path. Also
|
||||||
// switch.
|
// configurable using the "browser-subprocess-path" command-line switch.
|
||||||
///
|
///
|
||||||
cef_string_t browser_subprocess_path;
|
cef_string_t browser_subprocess_path;
|
||||||
|
|
||||||
///
|
///
|
||||||
// The path to the CEF framework directory on macOS. If this value is empty
|
// The path to the CEF framework directory on macOS. If this value is empty
|
||||||
// then the framework must exist at "Contents/Frameworks/Chromium Embedded
|
// then the framework must exist at "Contents/Frameworks/Chromium Embedded
|
||||||
// Framework.framework" in the top-level app bundle. Also configurable using
|
// Framework.framework" in the top-level app bundle. If this value is
|
||||||
// the "framework-dir-path" command-line switch.
|
// non-empty then it must be an absolute path. Also configurable using the
|
||||||
|
// "framework-dir-path" command-line switch.
|
||||||
///
|
///
|
||||||
cef_string_t framework_dir_path;
|
cef_string_t framework_dir_path;
|
||||||
|
|
||||||
///
|
///
|
||||||
// The path to the main bundle on macOS. If this value is empty then it
|
// The path to the main bundle on macOS. If this value is empty then it
|
||||||
// defaults to the top-level app bundle. Also configurable using
|
// defaults to the top-level app bundle. If this value is non-empty then it
|
||||||
// the "main-bundle-path" command-line switch.
|
// must be an absolute path. Also configurable using the "main-bundle-path"
|
||||||
|
// command-line switch.
|
||||||
///
|
///
|
||||||
cef_string_t main_bundle_path;
|
cef_string_t main_bundle_path;
|
||||||
|
|
||||||
@@ -227,33 +229,35 @@ typedef struct _cef_settings_t {
|
|||||||
|
|
||||||
///
|
///
|
||||||
// The location where data for the global browser cache will be stored on
|
// The location where data for the global browser cache will be stored on
|
||||||
// disk. If non-empty this must be either equal to or a child directory of
|
// disk. If this value is non-empty then it must be an absolute path that is
|
||||||
// CefSettings.root_cache_path. If empty then browsers will be created in
|
// either equal to or a child directory of CefSettings.root_cache_path. If
|
||||||
// "incognito mode" where in-memory caches are used for storage and no data is
|
// this value is empty then browsers will be created in "incognito mode" where
|
||||||
// persisted to disk. HTML5 databases such as localStorage will only persist
|
// in-memory caches are used for storage and no data is persisted to disk.
|
||||||
// across sessions if a cache path is specified. Can be overridden for
|
// HTML5 databases such as localStorage will only persist across sessions if a
|
||||||
// individual CefRequestContext instances via the
|
// cache path is specified. Can be overridden for individual CefRequestContext
|
||||||
// CefRequestContextSettings.cache_path value.
|
// instances via the CefRequestContextSettings.cache_path value.
|
||||||
///
|
///
|
||||||
cef_string_t cache_path;
|
cef_string_t cache_path;
|
||||||
|
|
||||||
///
|
///
|
||||||
// The root directory that all CefSettings.cache_path and
|
// The root directory that all CefSettings.cache_path and
|
||||||
// CefRequestContextSettings.cache_path values must have in common. If this
|
// CefRequestContextSettings.cache_path values must have in common. If this
|
||||||
// value is empty and CefSettings.cache_path is non-empty then this value will
|
// value is empty and CefSettings.cache_path is non-empty then it will
|
||||||
// default to the CefSettings.cache_path value. Failure to set this value
|
// default to the CefSettings.cache_path value. If this value is non-empty
|
||||||
// correctly may result in the sandbox blocking read/write access to the
|
// then it must be an absolute path. Failure to set this value correctly may
|
||||||
// cache_path directory.
|
// result in the sandbox blocking read/write access to the cache_path
|
||||||
|
// directory.
|
||||||
///
|
///
|
||||||
cef_string_t root_cache_path;
|
cef_string_t root_cache_path;
|
||||||
|
|
||||||
///
|
///
|
||||||
// The location where user data such as spell checking dictionary files will
|
// The location where user data such as spell checking dictionary files will
|
||||||
// be stored on disk. If empty then the default platform-specific user data
|
// be stored on disk. If this value is empty then the default
|
||||||
// directory will be used ("~/.cef_user_data" directory on Linux,
|
// platform-specific user data directory will be used ("~/.cef_user_data"
|
||||||
// "~/Library/Application Support/CEF/User Data" directory on Mac OS X,
|
// directory on Linux, "~/Library/Application Support/CEF/User Data" directory
|
||||||
// "Local Settings\Application Data\CEF\User Data" directory under the user
|
// on Mac OS X, "Local Settings\Application Data\CEF\User Data" directory
|
||||||
// profile directory on Windows).
|
// under the user profile directory on Windows). If this value is non-empty
|
||||||
|
// then it must be an absolute path.
|
||||||
///
|
///
|
||||||
cef_string_t user_data_path;
|
cef_string_t user_data_path;
|
||||||
|
|
||||||
@@ -333,16 +337,17 @@ typedef struct _cef_settings_t {
|
|||||||
// The fully qualified path for the resources directory. If this value is
|
// 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
|
// 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
|
// the module directory on Windows/Linux or the app bundle Resources directory
|
||||||
// on Mac OS X. Also configurable using the "resources-dir-path" command-line
|
// on Mac OS X. If this value is non-empty then it must be an absolute path.
|
||||||
// switch.
|
// Also configurable using the "resources-dir-path" command-line switch.
|
||||||
///
|
///
|
||||||
cef_string_t resources_dir_path;
|
cef_string_t resources_dir_path;
|
||||||
|
|
||||||
///
|
///
|
||||||
// The fully qualified path for the locales directory. If this value is empty
|
// The fully qualified path for the locales directory. If this value is empty
|
||||||
// the locales directory must be located in the module directory. This value
|
// the locales directory must be located in the module directory. If this
|
||||||
// is ignored on Mac OS X where pack files are always loaded from the app
|
// value is non-empty then it must be an absolute path. This value is ignored
|
||||||
// bundle Resources directory. Also configurable using the "locales-dir-path"
|
// 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.
|
// command-line switch.
|
||||||
///
|
///
|
||||||
cef_string_t locales_dir_path;
|
cef_string_t locales_dir_path;
|
||||||
@@ -428,13 +433,13 @@ typedef struct _cef_request_context_settings_t {
|
|||||||
|
|
||||||
///
|
///
|
||||||
// The location where cache data for this request context will be stored on
|
// The location where cache data for this request context will be stored on
|
||||||
// disk. If non-empty this must be either equal to or a child directory of
|
// disk. If this value is non-empty then it must be an absolute path that is
|
||||||
// CefSettings.root_cache_path. If empty then browsers will be created in
|
// either equal to or a child directory of CefSettings.root_cache_path. If
|
||||||
// "incognito mode" where in-memory caches are used for storage and no data is
|
// this value is empty then browsers will be created in "incognito mode" where
|
||||||
// persisted to disk. HTML5 databases such as localStorage will only persist
|
// in-memory caches are used for storage and no data is persisted to disk.
|
||||||
// across sessions if a cache path is specified. To share the global browser
|
// HTML5 databases such as localStorage will only persist across sessions if a
|
||||||
// cache and related configuration set this value to match the
|
// cache path is specified. To share the global browser cache and related
|
||||||
// CefSettings.cache_path value.
|
// configuration set this value to match the CefSettings.cache_path value.
|
||||||
///
|
///
|
||||||
cef_string_t cache_path;
|
cef_string_t cache_path;
|
||||||
|
|
||||||
@@ -732,6 +737,25 @@ typedef struct _cef_urlparts_t {
|
|||||||
cef_string_t fragment;
|
cef_string_t fragment;
|
||||||
} cef_urlparts_t;
|
} 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.
|
// Cookie information.
|
||||||
///
|
///
|
||||||
@@ -786,6 +810,16 @@ typedef struct _cef_cookie_t {
|
|||||||
///
|
///
|
||||||
int has_expires;
|
int has_expires;
|
||||||
cef_time_t expires;
|
cef_time_t expires;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Same site.
|
||||||
|
///
|
||||||
|
cef_cookie_same_site_t same_site;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Priority.
|
||||||
|
///
|
||||||
|
cef_cookie_priority_t priority;
|
||||||
} cef_cookie_t;
|
} cef_cookie_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -1097,16 +1131,6 @@ typedef enum {
|
|||||||
// A resource that a plugin requested.
|
// A resource that a plugin requested.
|
||||||
///
|
///
|
||||||
RT_PLUGIN_RESOURCE,
|
RT_PLUGIN_RESOURCE,
|
||||||
|
|
||||||
///
|
|
||||||
// A main-frame service worker navigation preload request.
|
|
||||||
///
|
|
||||||
RT_NAVIGATION_PRELOAD_MAIN_FRAME = 19,
|
|
||||||
|
|
||||||
///
|
|
||||||
// A sub-frame service worker navigation preload request.
|
|
||||||
///
|
|
||||||
RT_NAVIGATION_PRELOAD_SUB_FRAME,
|
|
||||||
} cef_resource_type_t;
|
} cef_resource_type_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -2248,7 +2272,13 @@ typedef enum {
|
|||||||
CT_ZOOMOUT,
|
CT_ZOOMOUT,
|
||||||
CT_GRAB,
|
CT_GRAB,
|
||||||
CT_GRABBING,
|
CT_GRABBING,
|
||||||
|
CT_MIDDLE_PANNING_VERTICAL,
|
||||||
|
CT_MIDDLE_PANNING_HORIZONTAL,
|
||||||
CT_CUSTOM,
|
CT_CUSTOM,
|
||||||
|
CT_DND_NONE,
|
||||||
|
CT_DND_MOVE,
|
||||||
|
CT_DND_COPY,
|
||||||
|
CT_DND_LINK,
|
||||||
} cef_cursor_type_t;
|
} cef_cursor_type_t;
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -2973,6 +3003,137 @@ typedef struct _cef_composition_underline_t {
|
|||||||
cef_composition_underline_style_t style;
|
cef_composition_underline_style_t style;
|
||||||
} cef_composition_underline_t;
|
} 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
|
// Result codes for CefMediaRouter::CreateRoute. Should be kept in sync with
|
||||||
// Chromium's media_router::RouteRequestResult::ResultCode type.
|
// Chromium's media_router::RouteRequestResult::ResultCode type.
|
||||||
@@ -3019,6 +3180,27 @@ typedef enum {
|
|||||||
CEF_MSIT_TOTAL_COUNT, // The total number of values.
|
CEF_MSIT_TOTAL_COUNT, // The total number of values.
|
||||||
} cef_media_sink_icon_type_t;
|
} 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;
|
||||||
|
|
||||||
|
///
|
||||||
|
// Represents commands available to TextField.
|
||||||
|
///
|
||||||
|
typedef enum {
|
||||||
|
CEF_TFC_CUT = 1,
|
||||||
|
CEF_TFC_COPY,
|
||||||
|
CEF_TFC_PASTE,
|
||||||
|
CEF_TFC_UNDO,
|
||||||
|
CEF_TFC_DELETE,
|
||||||
|
CEF_TFC_SELECT_ALL,
|
||||||
|
} cef_text_field_commands_t;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -851,6 +851,8 @@ struct CefCookieTraits {
|
|||||||
target->last_access = src->last_access;
|
target->last_access = src->last_access;
|
||||||
target->has_expires = src->has_expires;
|
target->has_expires = src->has_expires;
|
||||||
target->expires = src->expires;
|
target->expires = src->expires;
|
||||||
|
target->same_site = src->same_site;
|
||||||
|
target->priority = src->priority;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -958,4 +960,49 @@ struct CefCompositionUnderlineTraits {
|
|||||||
///
|
///
|
||||||
typedef CefStructBase<CefCompositionUnderlineTraits> CefCompositionUnderline;
|
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_
|
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_
|
||||||
|
@@ -224,16 +224,13 @@ class CefTextfield : public CefView {
|
|||||||
// enabled. See additional comments on ExecuteCommand().
|
// enabled. See additional comments on ExecuteCommand().
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual bool IsCommandEnabled(int command_id) = 0;
|
virtual bool IsCommandEnabled(cef_text_field_commands_t command_id) = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Performs the action associated with the specified command id. Valid values
|
// Performs the action associated with the specified command id.
|
||||||
// include IDS_APP_UNDO, IDS_APP_REDO, IDS_APP_CUT, IDS_APP_COPY,
|
|
||||||
// IDS_APP_PASTE, IDS_APP_DELETE, IDS_APP_SELECT_ALL, IDS_DELETE_* and
|
|
||||||
// IDS_MOVE_*. See include/cef_pack_strings.h for definitions.
|
|
||||||
///
|
///
|
||||||
/*--cef()--*/
|
/*--cef()--*/
|
||||||
virtual void ExecuteCommand(int command_id) = 0;
|
virtual void ExecuteCommand(cef_text_field_commands_t command_id) = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
// Clears Edit history.
|
// Clears Edit history.
|
||||||
|
125
libcef/browser/audio_capturer.cc
Normal file
125
libcef/browser/audio_capturer.cc
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
// 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));
|
||||||
|
},
|
||||||
|
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;
|
||||||
|
}
|
53
libcef/browser/audio_capturer.h
Normal file
53
libcef/browser/audio_capturer.h
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
// 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,7 +8,6 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "libcef/browser/content_browser_client.h"
|
#include "libcef/browser/content_browser_client.h"
|
||||||
#include "libcef/browser/context.h"
|
|
||||||
#include "libcef/browser/download_manager_delegate.h"
|
#include "libcef/browser/download_manager_delegate.h"
|
||||||
#include "libcef/browser/extensions/extension_system.h"
|
#include "libcef/browser/extensions/extension_system.h"
|
||||||
#include "libcef/browser/media_router/media_router_manager.h"
|
#include "libcef/browser/media_router/media_router_manager.h"
|
||||||
@@ -48,7 +47,6 @@
|
|||||||
#include "extensions/browser/process_manager.h"
|
#include "extensions/browser/process_manager.h"
|
||||||
#include "extensions/common/constants.h"
|
#include "extensions/common/constants.h"
|
||||||
#include "net/proxy_resolution/proxy_config_service.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"
|
#include "services/network/public/mojom/cors_origin_pattern.mojom.h"
|
||||||
|
|
||||||
using content::BrowserThread;
|
using content::BrowserThread;
|
||||||
@@ -293,37 +291,22 @@ CefBrowserContext::~CefBrowserContext() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserContext::Initialize() {
|
void CefBrowserContext::Initialize() {
|
||||||
CefContext* context = CefContext::Get();
|
|
||||||
|
|
||||||
cache_path_ = base::FilePath(CefString(&settings_.cache_path));
|
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())
|
if (!cache_path_.empty())
|
||||||
g_manager.Get().SetImplPath(this, cache_path_);
|
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) {
|
if (!!settings_.persist_session_cookies) {
|
||||||
set_should_persist_session_cookies(true);
|
set_should_persist_session_cookies(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
key_ = std::make_unique<ProfileKey>(GetPath());
|
key_ = std::make_unique<ProfileKey>(cache_path_);
|
||||||
SimpleKeyMap::GetInstance()->Associate(this, key_.get());
|
SimpleKeyMap::GetInstance()->Associate(this, key_.get());
|
||||||
|
|
||||||
// Initialize the PrefService object.
|
// Initialize the PrefService object.
|
||||||
pref_service_ = browser_prefs::CreatePrefService(
|
pref_service_ = browser_prefs::CreatePrefService(
|
||||||
this, cache_path_, !!settings_.persist_user_preferences);
|
this, cache_path_, !!settings_.persist_user_preferences);
|
||||||
|
|
||||||
content::BrowserContext::Initialize(this, GetPath());
|
|
||||||
|
|
||||||
resource_context_.reset(new CefResourceContext(IsOffTheRecord()));
|
resource_context_.reset(new CefResourceContext(IsOffTheRecord()));
|
||||||
|
|
||||||
// This must be called before creating any services to avoid hitting
|
// This must be called before creating any services to avoid hitting
|
||||||
@@ -575,7 +558,7 @@ HostContentSettingsMap* CefBrowserContext::GetHostContentSettingsMap() {
|
|||||||
// that can be stored in the settings map (for example, default values set
|
// that can be stored in the settings map (for example, default values set
|
||||||
// via DefaultProvider::SetWebsiteSetting).
|
// via DefaultProvider::SetWebsiteSetting).
|
||||||
host_content_settings_map_ =
|
host_content_settings_map_ =
|
||||||
new HostContentSettingsMap(GetPrefs(), false, false, false);
|
new HostContentSettingsMap(GetPrefs(), false, false, false, false);
|
||||||
|
|
||||||
// Change the default plugin policy.
|
// Change the default plugin policy.
|
||||||
const base::CommandLine* command_line =
|
const base::CommandLine* command_line =
|
||||||
|
@@ -296,7 +296,7 @@ class CefBrowserContext : public ChromeProfileStub,
|
|||||||
~CefBrowserContext() override;
|
~CefBrowserContext() override;
|
||||||
|
|
||||||
// Members initialized during construction are safe to access from any thread.
|
// Members initialized during construction are safe to access from any thread.
|
||||||
CefRequestContextSettings settings_;
|
const CefRequestContextSettings settings_;
|
||||||
base::FilePath cache_path_;
|
base::FilePath cache_path_;
|
||||||
|
|
||||||
// CefRequestContextImpl objects referencing this object.
|
// CefRequestContextImpl objects referencing this object.
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
|
#include "libcef/browser/audio_capturer.h"
|
||||||
#include "libcef/browser/browser_context.h"
|
#include "libcef/browser/browser_context.h"
|
||||||
#include "libcef/browser/browser_info.h"
|
#include "libcef/browser/browser_info.h"
|
||||||
#include "libcef/browser/browser_info_manager.h"
|
#include "libcef/browser/browser_info_manager.h"
|
||||||
@@ -15,8 +16,7 @@
|
|||||||
#include "libcef/browser/browser_util.h"
|
#include "libcef/browser/browser_util.h"
|
||||||
#include "libcef/browser/content_browser_client.h"
|
#include "libcef/browser/content_browser_client.h"
|
||||||
#include "libcef/browser/context.h"
|
#include "libcef/browser/context.h"
|
||||||
#include "libcef/browser/devtools/devtools_frontend.h"
|
#include "libcef/browser/devtools/devtools_manager.h"
|
||||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
|
||||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||||
#include "libcef/browser/extensions/extension_background_host.h"
|
#include "libcef/browser/extensions/extension_background_host.h"
|
||||||
#include "libcef/browser/extensions/extension_system.h"
|
#include "libcef/browser/extensions/extension_system.h"
|
||||||
@@ -47,6 +47,8 @@
|
|||||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||||
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
||||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.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 "components/zoom/zoom_controller.h"
|
||||||
#include "content/browser/gpu/compositor_util.h"
|
#include "content/browser/gpu/compositor_util.h"
|
||||||
#include "content/browser/web_contents/web_contents_impl.h"
|
#include "content/browser/web_contents/web_contents_impl.h"
|
||||||
@@ -68,11 +70,12 @@
|
|||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "content/public/browser/render_view_host.h"
|
#include "content/public/browser/render_view_host.h"
|
||||||
#include "content/public/browser/render_widget_host.h"
|
#include "content/public/browser/render_widget_host.h"
|
||||||
|
#include "content/public/browser/render_widget_host_observer.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/common/favicon_url.h"
|
|
||||||
#include "extensions/browser/process_manager.h"
|
#include "extensions/browser/process_manager.h"
|
||||||
#include "net/base/net_errors.h"
|
#include "net/base/net_errors.h"
|
||||||
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
|
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
|
||||||
|
#include "third_party/blink/public/mojom/page/widget.mojom-test-utils.h"
|
||||||
#include "ui/events/base_event_utils.h"
|
#include "ui/events/base_event_utils.h"
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
@@ -193,6 +196,49 @@ void OnDownloadImage(uint32 max_image_size,
|
|||||||
image_impl.get());
|
image_impl.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class CefWidgetHostInterceptor
|
||||||
|
: public blink::mojom::WidgetHostInterceptorForTesting,
|
||||||
|
public content::RenderWidgetHostObserver {
|
||||||
|
public:
|
||||||
|
CefWidgetHostInterceptor(CefBrowserHostImpl* browser,
|
||||||
|
content::RenderViewHost* render_view_host)
|
||||||
|
: browser_(browser),
|
||||||
|
render_widget_host_(
|
||||||
|
content::RenderWidgetHostImpl::From(render_view_host->GetWidget())),
|
||||||
|
impl_(render_widget_host_->widget_host_receiver_for_testing()
|
||||||
|
.SwapImplForTesting(this)) {
|
||||||
|
render_widget_host_->AddObserver(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
blink::mojom::WidgetHost* GetForwardingInterface() override { return impl_; }
|
||||||
|
|
||||||
|
// WidgetHostInterceptorForTesting method:
|
||||||
|
void SetCursor(const ui::Cursor& cursor) override {
|
||||||
|
if (browser_->IsMouseCursorChangeDisabled()) {
|
||||||
|
// Don't change the cursor.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GetForwardingInterface()->SetCursor(cursor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// RenderWidgetHostObserver method:
|
||||||
|
void RenderWidgetHostDestroyed(
|
||||||
|
content::RenderWidgetHost* widget_host) override {
|
||||||
|
widget_host->RemoveObserver(this);
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CefBrowserHostImpl* const browser_;
|
||||||
|
content::RenderWidgetHostImpl* const render_widget_host_;
|
||||||
|
blink::mojom::WidgetHost* const impl_;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(CefWidgetHostInterceptor);
|
||||||
|
};
|
||||||
|
|
||||||
|
static constexpr base::TimeDelta kRecentlyAudibleTimeout =
|
||||||
|
base::TimeDelta::FromSeconds(2);
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
// CefBrowserHost static methods.
|
// CefBrowserHost static methods.
|
||||||
@@ -547,26 +593,6 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::GetBrowserForFrameRoute(
|
|||||||
// CefBrowserHostImpl methods.
|
// 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() {}
|
CefBrowserHostImpl::~CefBrowserHostImpl() {}
|
||||||
|
|
||||||
CefRefPtr<CefBrowser> CefBrowserHostImpl::GetBrowser() {
|
CefRefPtr<CefBrowser> CefBrowserHostImpl::GetBrowser() {
|
||||||
@@ -859,39 +885,29 @@ void CefBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo,
|
|||||||
CefRefPtr<CefClient> client,
|
CefRefPtr<CefClient> client,
|
||||||
const CefBrowserSettings& settings,
|
const CefBrowserSettings& settings,
|
||||||
const CefPoint& inspect_element_at) {
|
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(
|
ShowDevToolsHelper* helper = new ShowDevToolsHelper(
|
||||||
this, windowInfo, client, settings, inspect_element_at);
|
this, windowInfo, client, settings, inspect_element_at);
|
||||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(ShowDevToolsWithHelper, helper));
|
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() {
|
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,
|
CEF_POST_TASK(CEF_UIT,
|
||||||
base::BindOnce(&CefBrowserHostImpl::CloseDevTools, this));
|
base::BindOnce(&CefBrowserHostImpl::CloseDevTools, this));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!devtools_manager_)
|
||||||
|
return;
|
||||||
|
devtools_manager_->CloseDevTools();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefBrowserHostImpl::HasDevTools() {
|
bool CefBrowserHostImpl::HasDevTools() {
|
||||||
@@ -900,7 +916,84 @@ bool CefBrowserHostImpl::HasDevTools() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (devtools_frontend_ != nullptr);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserHostImpl::GetNavigationEntries(
|
void CefBrowserHostImpl::GetNavigationEntries(
|
||||||
@@ -1021,6 +1114,8 @@ bool CefBrowserHostImpl::IsBackgroundHost() {
|
|||||||
|
|
||||||
void CefBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) {
|
void CefBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) {
|
||||||
base::AutoLock lock_scope(state_lock_);
|
base::AutoLock lock_scope(state_lock_);
|
||||||
|
if (mouse_cursor_change_disabled_ == disabled)
|
||||||
|
return;
|
||||||
mouse_cursor_change_disabled_ = disabled;
|
mouse_cursor_change_disabled_ = disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1056,16 +1151,18 @@ void CefBrowserHostImpl::AddWordToDictionary(const CefString& word) {
|
|||||||
if (!web_contents())
|
if (!web_contents())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
SpellcheckService* spellcheck = nullptr;
|
||||||
content::BrowserContext* browser_context =
|
content::BrowserContext* browser_context =
|
||||||
web_contents()->GetBrowserContext();
|
web_contents()->GetBrowserContext();
|
||||||
if (browser_context) {
|
if (browser_context) {
|
||||||
SpellcheckService* spellcheck =
|
spellcheck = SpellcheckServiceFactory::GetForContext(browser_context);
|
||||||
SpellcheckServiceFactory::GetForContext(browser_context);
|
|
||||||
if (spellcheck)
|
if (spellcheck)
|
||||||
spellcheck->GetCustomDictionary()->AddWord(word);
|
spellcheck->GetCustomDictionary()->AddWord(word);
|
||||||
}
|
}
|
||||||
#if defined(OS_MACOSX)
|
#if defined(OS_MACOSX)
|
||||||
spellcheck_platform::AddWord(word);
|
if (spellcheck && spellcheck::UseBrowserSpellChecker()) {
|
||||||
|
spellcheck_platform::AddWord(spellcheck->platform_spell_checker(), word);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1556,6 +1653,12 @@ void CefBrowserHostImpl::DestroyBrowser() {
|
|||||||
javascript_dialog_manager_.reset(nullptr);
|
javascript_dialog_manager_.reset(nullptr);
|
||||||
menu_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.
|
// Delete the platform delegate.
|
||||||
platform_delegate_.reset(nullptr);
|
platform_delegate_.reset(nullptr);
|
||||||
|
|
||||||
@@ -2033,6 +2136,7 @@ bool CefBrowserHostImpl::ShouldTransferNavigation(
|
|||||||
void CefBrowserHostImpl::AddNewContents(
|
void CefBrowserHostImpl::AddNewContents(
|
||||||
content::WebContents* source,
|
content::WebContents* source,
|
||||||
std::unique_ptr<content::WebContents> new_contents,
|
std::unique_ptr<content::WebContents> new_contents,
|
||||||
|
const GURL& target_url,
|
||||||
WindowOpenDisposition disposition,
|
WindowOpenDisposition disposition,
|
||||||
const gfx::Rect& initial_rect,
|
const gfx::Rect& initial_rect,
|
||||||
bool user_gesture,
|
bool user_gesture,
|
||||||
@@ -2046,7 +2150,7 @@ void CefBrowserHostImpl::AddNewContents(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (extension_host_) {
|
if (extension_host_) {
|
||||||
extension_host_->AddNewContents(source, std::move(new_contents),
|
extension_host_->AddNewContents(source, std::move(new_contents), target_url,
|
||||||
disposition, initial_rect, user_gesture,
|
disposition, initial_rect, user_gesture,
|
||||||
was_blocked);
|
was_blocked);
|
||||||
}
|
}
|
||||||
@@ -2278,8 +2382,10 @@ bool CefBrowserHostImpl::PreHandleGestureEvent(
|
|||||||
bool CefBrowserHostImpl::CanDragEnter(content::WebContents* source,
|
bool CefBrowserHostImpl::CanDragEnter(content::WebContents* source,
|
||||||
const content::DropData& data,
|
const content::DropData& data,
|
||||||
blink::WebDragOperationsMask mask) {
|
blink::WebDragOperationsMask mask) {
|
||||||
CefRefPtr<CefDragHandler> handler = client_->GetDragHandler();
|
CefRefPtr<CefDragHandler> handler;
|
||||||
if (handler.get()) {
|
if (client_)
|
||||||
|
handler = client_->GetDragHandler();
|
||||||
|
if (handler) {
|
||||||
CefRefPtr<CefDragDataImpl> drag_data(new CefDragDataImpl(data));
|
CefRefPtr<CefDragDataImpl> drag_data(new CefDragDataImpl(data));
|
||||||
drag_data->SetReadOnly(true);
|
drag_data->SetReadOnly(true);
|
||||||
if (handler->OnDragEnter(
|
if (handler->OnDragEnter(
|
||||||
@@ -2530,14 +2636,9 @@ void CefBrowserHostImpl::RenderViewCreated(
|
|||||||
// RenderFrameCreated is otherwise not called for new popup browsers.
|
// RenderFrameCreated is otherwise not called for new popup browsers.
|
||||||
RenderFrameCreated(render_view_host->GetMainFrame());
|
RenderFrameCreated(render_view_host->GetMainFrame());
|
||||||
|
|
||||||
platform_delegate_->RenderViewCreated(render_view_host);
|
new CefWidgetHostInterceptor(this, render_view_host);
|
||||||
|
|
||||||
// Make sure the background color is set on the WebView and the Widget.
|
platform_delegate_->RenderViewCreated(render_view_host);
|
||||||
render_view_host->OnWebkitPreferencesChanged();
|
|
||||||
if (render_view_host->GetWidget()->GetView()) {
|
|
||||||
render_view_host->GetWidget()->GetView()->SetBackgroundColor(
|
|
||||||
GetBackgroundColor());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserHostImpl::RenderViewDeleted(
|
void CefBrowserHostImpl::RenderViewDeleted(
|
||||||
@@ -2651,16 +2752,24 @@ void CefBrowserHostImpl::DidStopLoading() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserHostImpl::DocumentAvailableInMainFrame() {
|
void CefBrowserHostImpl::DocumentAvailableInMainFrame() {
|
||||||
base::AutoLock lock_scope(state_lock_);
|
{
|
||||||
has_document_ = true;
|
base::AutoLock lock_scope(state_lock_);
|
||||||
|
has_document_ = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (client_) {
|
||||||
|
CefRefPtr<CefRequestHandler> handler = client_->GetRequestHandler();
|
||||||
|
if (handler)
|
||||||
|
handler->OnDocumentAvailableInMainFrame(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserHostImpl::DidFailLoad(
|
void CefBrowserHostImpl::DidFailLoad(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const GURL& validated_url,
|
const GURL& validated_url,
|
||||||
int error_code) {
|
int error_code) {
|
||||||
// The navigation failed after commit. OnLoadStart was called so we also call
|
// The navigation failed after commit. OnLoadStart was called so we also
|
||||||
// OnLoadEnd.
|
// call OnLoadEnd.
|
||||||
auto frame = browser_info_->GetFrameForHost(render_frame_host);
|
auto frame = browser_info_->GetFrameForHost(render_frame_host);
|
||||||
frame->RefreshAttributes();
|
frame->RefreshAttributes();
|
||||||
OnLoadError(frame, validated_url, error_code);
|
OnLoadError(frame, validated_url, error_code);
|
||||||
@@ -2686,15 +2795,14 @@ void CefBrowserHostImpl::PluginCrashed(const base::FilePath& plugin_path,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserHostImpl::DidUpdateFaviconURL(
|
void CefBrowserHostImpl::DidUpdateFaviconURL(
|
||||||
const std::vector<content::FaviconURL>& candidates) {
|
const std::vector<blink::mojom::FaviconURLPtr>& candidates) {
|
||||||
if (client_.get()) {
|
if (client_.get()) {
|
||||||
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
||||||
if (handler.get()) {
|
if (handler.get()) {
|
||||||
std::vector<CefString> icon_urls;
|
std::vector<CefString> icon_urls;
|
||||||
std::vector<content::FaviconURL>::const_iterator it = candidates.begin();
|
for (const auto& icon : candidates) {
|
||||||
for (; it != candidates.end(); ++it) {
|
if (icon->icon_type == blink::mojom::FaviconIconType::kFavicon)
|
||||||
if (it->icon_type == content::FaviconURL::IconType::kFavicon)
|
icon_urls.push_back(icon->icon_url.spec());
|
||||||
icon_urls.push_back(it->icon_url.spec());
|
|
||||||
}
|
}
|
||||||
if (!icon_urls.empty())
|
if (!icon_urls.empty())
|
||||||
handler->OnFaviconURLChange(this, icon_urls);
|
handler->OnFaviconURLChange(this, icon_urls);
|
||||||
@@ -2702,13 +2810,23 @@ void CefBrowserHostImpl::DidUpdateFaviconURL(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefBrowserHostImpl::OnMessageReceived(const IPC::Message& message) {
|
void CefBrowserHostImpl::OnAudioStateChanged(bool audible) {
|
||||||
// Handle the cursor message here if mouse cursor change is disabled instead
|
if (audible) {
|
||||||
// of propegating the message to the normal handler.
|
recently_audible_timer_.Stop();
|
||||||
if (message.type() == WidgetHostMsg_SetCursor::ID)
|
StartAudioCapturer();
|
||||||
return IsMouseCursorChangeDisabled();
|
} 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
void CefBrowserHostImpl::OnRecentlyAudibleTimerFired() {
|
||||||
|
audio_capturer_.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefBrowserHostImpl::OnMessageReceived(
|
bool CefBrowserHostImpl::OnMessageReceived(
|
||||||
@@ -2797,6 +2915,25 @@ bool CefBrowserHostImpl::HasObserver(Observer* observer) const {
|
|||||||
return observers_.HasObserver(observer);
|
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(
|
CefBrowserHostImpl::NavigationLock::NavigationLock(
|
||||||
CefRefPtr<CefBrowserHostImpl> browser)
|
CefRefPtr<CefBrowserHostImpl> browser)
|
||||||
: browser_(browser) {
|
: browser_(browser) {
|
||||||
@@ -2868,18 +3005,6 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
|||||||
platform_delegate_(std::move(platform_delegate)),
|
platform_delegate_(std::move(platform_delegate)),
|
||||||
is_windowless_(platform_delegate_->IsWindowless()),
|
is_windowless_(platform_delegate_->IsWindowless()),
|
||||||
is_views_hosted_(platform_delegate_->IsViewsHosted()),
|
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) {
|
extension_(extension) {
|
||||||
if (opener.get() && !platform_delegate_->IsViewsHosted()) {
|
if (opener.get() && !platform_delegate_->IsViewsHosted()) {
|
||||||
// GetOpenerWindowHandle() only returns a value for non-views-hosted
|
// GetOpenerWindowHandle() only returns a value for non-views-hosted
|
||||||
@@ -3090,11 +3215,6 @@ void CefBrowserHostImpl::OnTitleChange(const base::string16& title) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefBrowserHostImpl::OnDevToolsWebContentsDestroyed() {
|
|
||||||
devtools_observer_.reset();
|
|
||||||
devtools_frontend_ = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CefBrowserHostImpl::EnsureFileDialogManager() {
|
void CefBrowserHostImpl::EnsureFileDialogManager() {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
if (!file_dialog_manager_.get() && platform_delegate_) {
|
if (!file_dialog_manager_.get() && platform_delegate_) {
|
||||||
|
@@ -48,9 +48,10 @@ class Widget;
|
|||||||
}
|
}
|
||||||
#endif // defined(USE_AURA)
|
#endif // defined(USE_AURA)
|
||||||
|
|
||||||
|
class CefAudioCapturer;
|
||||||
class CefBrowserInfo;
|
class CefBrowserInfo;
|
||||||
class CefBrowserPlatformDelegate;
|
class CefBrowserPlatformDelegate;
|
||||||
class CefDevToolsFrontend;
|
class CefDevToolsManager;
|
||||||
class SiteInstance;
|
class SiteInstance;
|
||||||
|
|
||||||
// Implementation of CefBrowser.
|
// Implementation of CefBrowser.
|
||||||
@@ -191,6 +192,12 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
const CefPoint& inspect_element_at) override;
|
const CefPoint& inspect_element_at) override;
|
||||||
void CloseDevTools() override;
|
void CloseDevTools() override;
|
||||||
bool HasDevTools() 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,
|
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
|
||||||
bool current_only) override;
|
bool current_only) override;
|
||||||
void SetMouseCursorChangeDisabled(bool disabled) override;
|
void SetMouseCursorChangeDisabled(bool disabled) override;
|
||||||
@@ -378,6 +385,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
|
bool ShouldTransferNavigation(bool is_main_frame_navigation) override;
|
||||||
void AddNewContents(content::WebContents* source,
|
void AddNewContents(content::WebContents* source,
|
||||||
std::unique_ptr<content::WebContents> new_contents,
|
std::unique_ptr<content::WebContents> new_contents,
|
||||||
|
const GURL& target_url,
|
||||||
WindowOpenDisposition disposition,
|
WindowOpenDisposition disposition,
|
||||||
const gfx::Rect& initial_rect,
|
const gfx::Rect& initial_rect,
|
||||||
bool user_gesture,
|
bool user_gesture,
|
||||||
@@ -485,8 +493,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
void PluginCrashed(const base::FilePath& plugin_path,
|
void PluginCrashed(const base::FilePath& plugin_path,
|
||||||
base::ProcessId plugin_pid) override;
|
base::ProcessId plugin_pid) override;
|
||||||
void DidUpdateFaviconURL(
|
void DidUpdateFaviconURL(
|
||||||
const std::vector<content::FaviconURL>& candidates) override;
|
const std::vector<blink::mojom::FaviconURLPtr>& candidates) override;
|
||||||
bool OnMessageReceived(const IPC::Message& message) override;
|
void OnAudioStateChanged(bool audible) override;
|
||||||
bool OnMessageReceived(const IPC::Message& message,
|
bool OnMessageReceived(const IPC::Message& message,
|
||||||
content::RenderFrameHost* render_frame_host) override;
|
content::RenderFrameHost* render_frame_host) override;
|
||||||
void OnFrameFocused(content::RenderFrameHost* render_frame_host) override;
|
void OnFrameFocused(content::RenderFrameHost* render_frame_host) override;
|
||||||
@@ -505,6 +513,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
void AddObserver(Observer* observer);
|
void AddObserver(Observer* observer);
|
||||||
void RemoveObserver(Observer* observer);
|
void RemoveObserver(Observer* observer);
|
||||||
bool HasObserver(Observer* observer) const;
|
bool HasObserver(Observer* observer) const;
|
||||||
|
|
||||||
class NavigationLock final {
|
class NavigationLock final {
|
||||||
private:
|
private:
|
||||||
friend class CefBrowserHostImpl;
|
friend class CefBrowserHostImpl;
|
||||||
@@ -520,8 +529,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
std::unique_ptr<NavigationLock> CreateNavigationLock();
|
std::unique_ptr<NavigationLock> CreateNavigationLock();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class DevToolsWebContentsObserver;
|
|
||||||
|
|
||||||
static CefRefPtr<CefBrowserHostImpl> CreateInternal(
|
static CefRefPtr<CefBrowserHostImpl> CreateInternal(
|
||||||
const CefBrowserSettings& settings,
|
const CefBrowserSettings& settings,
|
||||||
CefRefPtr<CefClient> client,
|
CefRefPtr<CefClient> client,
|
||||||
@@ -578,13 +585,18 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
void OnFullscreenModeChange(bool fullscreen);
|
void OnFullscreenModeChange(bool fullscreen);
|
||||||
void OnTitleChange(const base::string16& title);
|
void OnTitleChange(const base::string16& title);
|
||||||
|
|
||||||
void OnDevToolsWebContentsDestroyed();
|
|
||||||
|
|
||||||
// Create the CefFileDialogManager if it doesn't already exist.
|
// Create the CefFileDialogManager if it doesn't already exist.
|
||||||
void EnsureFileDialogManager();
|
void EnsureFileDialogManager();
|
||||||
|
|
||||||
void ConfigureAutoResize();
|
void ConfigureAutoResize();
|
||||||
|
|
||||||
|
void StartAudioCapturer();
|
||||||
|
void OnRecentlyAudibleTimerFired();
|
||||||
|
|
||||||
|
bool EnsureDevToolsManager();
|
||||||
|
void InitializeDevToolsRegistrationOnUIThread(
|
||||||
|
CefRefPtr<CefRegistration> registration);
|
||||||
|
|
||||||
CefBrowserSettings settings_;
|
CefBrowserSettings settings_;
|
||||||
CefRefPtr<CefClient> client_;
|
CefRefPtr<CefClient> client_;
|
||||||
scoped_refptr<CefBrowserInfo> browser_info_;
|
scoped_refptr<CefBrowserInfo> browser_info_;
|
||||||
@@ -593,7 +605,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate_;
|
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate_;
|
||||||
const bool is_windowless_;
|
const bool is_windowless_;
|
||||||
const bool is_views_hosted_;
|
const bool is_views_hosted_;
|
||||||
CefWindowHandle host_window_handle_;
|
CefWindowHandle host_window_handle_ = kNullWindowHandle;
|
||||||
|
|
||||||
// Non-nullptr if this object owns the WebContents. Will be nullptr for popup
|
// Non-nullptr if this object owns the WebContents. Will be nullptr for popup
|
||||||
// browsers between the calls to WebContentsCreated() and AddNewContents(),
|
// browsers between the calls to WebContentsCreated() and AddNewContents(),
|
||||||
@@ -603,18 +615,18 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
|
|
||||||
// Volatile state information. All access must be protected by the state lock.
|
// Volatile state information. All access must be protected by the state lock.
|
||||||
base::Lock state_lock_;
|
base::Lock state_lock_;
|
||||||
bool is_loading_;
|
bool is_loading_ = false;
|
||||||
bool can_go_back_;
|
bool can_go_back_ = false;
|
||||||
bool can_go_forward_;
|
bool can_go_forward_ = false;
|
||||||
bool has_document_;
|
bool has_document_ = false;
|
||||||
bool is_fullscreen_;
|
bool is_fullscreen_ = false;
|
||||||
|
|
||||||
// The currently focused frame, or nullptr if the main frame is focused.
|
// The currently focused frame, or nullptr if the main frame is focused.
|
||||||
CefRefPtr<CefFrameHostImpl> focused_frame_;
|
CefRefPtr<CefFrameHostImpl> focused_frame_;
|
||||||
|
|
||||||
// Represents the current browser destruction state. Only accessed on the UI
|
// Represents the current browser destruction state. Only accessed on the UI
|
||||||
// thread.
|
// thread.
|
||||||
DestructionState destruction_state_;
|
DestructionState destruction_state_ = DESTRUCTION_STATE_NONE;
|
||||||
|
|
||||||
// Navigation will not occur while |navigation_lock_count_| > 0.
|
// Navigation will not occur while |navigation_lock_count_| > 0.
|
||||||
// |pending_navigation_action_| will be executed when the lock is released.
|
// |pending_navigation_action_| will be executed when the lock is released.
|
||||||
@@ -624,18 +636,18 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
|
|
||||||
// True if the OS window hosting the browser has been destroyed. Only accessed
|
// True if the OS window hosting the browser has been destroyed. Only accessed
|
||||||
// on the UI thread.
|
// on the UI thread.
|
||||||
bool window_destroyed_;
|
bool window_destroyed_ = false;
|
||||||
|
|
||||||
// True if currently in the OnSetFocus callback. Only accessed on the UI
|
// True if currently in the OnSetFocus callback. Only accessed on the UI
|
||||||
// thread.
|
// thread.
|
||||||
bool is_in_onsetfocus_;
|
bool is_in_onsetfocus_ = false;
|
||||||
|
|
||||||
// True if the focus is currently on an editable field on the page. Only
|
// True if the focus is currently on an editable field on the page. Only
|
||||||
// accessed on the UI thread.
|
// accessed on the UI thread.
|
||||||
bool focus_on_editable_field_;
|
bool focus_on_editable_field_ = false;
|
||||||
|
|
||||||
// True if mouse cursor change is disabled.
|
// True if mouse cursor change is disabled.
|
||||||
bool mouse_cursor_change_disabled_;
|
bool mouse_cursor_change_disabled_ = false;
|
||||||
|
|
||||||
// Used for managing notification subscriptions.
|
// Used for managing notification subscriptions.
|
||||||
std::unique_ptr<content::NotificationRegistrar> registrar_;
|
std::unique_ptr<content::NotificationRegistrar> registrar_;
|
||||||
@@ -649,12 +661,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
// Used for creating and managing context menus.
|
// Used for creating and managing context menus.
|
||||||
std::unique_ptr<CefMenuManager> menu_manager_;
|
std::unique_ptr<CefMenuManager> menu_manager_;
|
||||||
|
|
||||||
// Track the lifespan of the frontend WebContents associated with this
|
// Used for creating and managing DevTools instances.
|
||||||
// browser.
|
std::unique_ptr<CefDevToolsManager> devtools_manager_;
|
||||||
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.
|
// Observers that want to be notified of changes to this object.
|
||||||
base::ObserverList<Observer>::Unchecked observers_;
|
base::ObserverList<Observer>::Unchecked observers_;
|
||||||
@@ -667,6 +675,14 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
|||||||
CefRefPtr<CefExtension> extension_;
|
CefRefPtr<CefExtension> extension_;
|
||||||
bool is_background_host_ = false;
|
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.
|
// Used with auto-resize.
|
||||||
bool auto_resize_enabled_ = false;
|
bool auto_resize_enabled_ = false;
|
||||||
gfx::Size auto_resize_min_;
|
gfx::Size auto_resize_min_;
|
||||||
|
@@ -22,6 +22,8 @@
|
|||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "content/public/browser/web_contents.h"
|
#include "content/public/browser/web_contents.h"
|
||||||
#include "content/public/common/child_process_host.h"
|
#include "content/public/common/child_process_host.h"
|
||||||
|
#include "content/public/common/url_constants.h"
|
||||||
|
#include "extensions/common/constants.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -115,26 +117,13 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
|||||||
bool* no_javascript_access) {
|
bool* no_javascript_access) {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
|
|
||||||
bool is_guest_view = false;
|
content::OpenURLParams params(target_url, referrer, disposition,
|
||||||
CefRefPtr<CefBrowserHostImpl> browser =
|
ui::PAGE_TRANSITION_LINK,
|
||||||
extensions::GetOwnerBrowserForHost(opener, &is_guest_view);
|
/*is_renderer_initiated=*/true);
|
||||||
DCHECK(browser.get());
|
params.user_gesture = user_gesture;
|
||||||
if (!browser.get()) {
|
|
||||||
// Cancel the popup.
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_guest_view) {
|
|
||||||
content::OpenURLParams params(target_url, referrer, disposition,
|
|
||||||
ui::PAGE_TRANSITION_LINK, true);
|
|
||||||
params.user_gesture = user_gesture;
|
|
||||||
|
|
||||||
// Pass navigation to the owner browser.
|
|
||||||
CEF_POST_TASK(
|
|
||||||
CEF_UIT,
|
|
||||||
base::Bind(base::IgnoreResult(&CefBrowserHostImpl::OpenURLFromTab),
|
|
||||||
browser.get(), nullptr, params));
|
|
||||||
|
|
||||||
|
CefRefPtr<CefBrowserHostImpl> browser;
|
||||||
|
if (!MaybeAllowNavigation(opener, params, browser) || !browser) {
|
||||||
// Cancel the popup.
|
// Cancel the popup.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -369,6 +358,38 @@ CefBrowserInfoManager::GetBrowserInfoForFrameRoute(int render_process_id,
|
|||||||
return GetBrowserInfo(render_process_id, render_routing_id, is_guest_view);
|
return GetBrowserInfo(render_process_id, render_routing_id, is_guest_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CefBrowserInfoManager::MaybeAllowNavigation(
|
||||||
|
content::RenderFrameHost* opener,
|
||||||
|
const content::OpenURLParams& params,
|
||||||
|
CefRefPtr<CefBrowserHostImpl>& browser_out) const {
|
||||||
|
CEF_REQUIRE_UIT();
|
||||||
|
|
||||||
|
bool is_guest_view = false;
|
||||||
|
CefRefPtr<CefBrowserHostImpl> browser =
|
||||||
|
extensions::GetOwnerBrowserForHost(opener, &is_guest_view);
|
||||||
|
if (!browser) {
|
||||||
|
// Print preview uses a modal dialog where we don't own the WebContents.
|
||||||
|
// Allow that navigation to proceed.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_guest_view && !params.url.SchemeIs(extensions::kExtensionScheme) &&
|
||||||
|
!params.url.SchemeIs(content::kChromeUIScheme)) {
|
||||||
|
// The PDF viewer will load the PDF extension in the guest view, and print
|
||||||
|
// preview will load chrome://print in the guest view. All other navigations
|
||||||
|
// are passed to the owner browser.
|
||||||
|
CEF_POST_TASK(
|
||||||
|
CEF_UIT,
|
||||||
|
base::Bind(base::IgnoreResult(&CefBrowserHostImpl::OpenURLFromTab),
|
||||||
|
browser.get(), nullptr, params));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
browser_out = browser;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
scoped_refptr<CefBrowserInfo>
|
scoped_refptr<CefBrowserInfo>
|
||||||
CefBrowserInfoManager::GetBrowserInfoForFrameTreeNode(int frame_tree_node_id,
|
CefBrowserInfoManager::GetBrowserInfoForFrameTreeNode(int frame_tree_node_id,
|
||||||
bool* is_guest_view) {
|
bool* is_guest_view) {
|
||||||
|
@@ -25,6 +25,7 @@ struct WebWindowFeatures;
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
|
struct OpenURLParams;
|
||||||
struct Referrer;
|
struct Referrer;
|
||||||
class RenderFrameHost;
|
class RenderFrameHost;
|
||||||
class RenderViewHostDelegateView;
|
class RenderViewHostDelegateView;
|
||||||
@@ -138,6 +139,13 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
|||||||
typedef std::list<scoped_refptr<CefBrowserInfo>> BrowserInfoList;
|
typedef std::list<scoped_refptr<CefBrowserInfo>> BrowserInfoList;
|
||||||
BrowserInfoList GetBrowserInfoList();
|
BrowserInfoList GetBrowserInfoList();
|
||||||
|
|
||||||
|
// Returns true if the navigation should be allowed to proceed, or false if
|
||||||
|
// the navigation will instead be sent via OpenURLFromTab. If allowed,
|
||||||
|
// |browser| will be set to the target browser if any.
|
||||||
|
bool MaybeAllowNavigation(content::RenderFrameHost* opener,
|
||||||
|
const content::OpenURLParams& params,
|
||||||
|
CefRefPtr<CefBrowserHostImpl>& browser) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// RenderProcessHostObserver methods:
|
// RenderProcessHostObserver methods:
|
||||||
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
|
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
|
||||||
|
@@ -32,11 +32,11 @@
|
|||||||
#include "chrome/browser/plugins/plugin_finder.h"
|
#include "chrome/browser/plugins/plugin_finder.h"
|
||||||
#include "components/constrained_window/constrained_window_views.h"
|
#include "components/constrained_window/constrained_window_views.h"
|
||||||
#include "content/public/browser/gpu_data_manager.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/browser/extension_system.h"
|
||||||
#include "extensions/common/constants.h"
|
#include "extensions/common/constants.h"
|
||||||
#include "net/base/net_module.h"
|
#include "net/base/net_module.h"
|
||||||
#include "services/service_manager/embedder/result_codes.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"
|
#include "ui/base/resource/resource_bundle.h"
|
||||||
|
|
||||||
#if defined(USE_AURA) && defined(USE_X11)
|
#if defined(USE_AURA) && defined(USE_X11)
|
||||||
@@ -51,6 +51,7 @@
|
|||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "chrome/browser/chrome_browser_main_win.h"
|
#include "chrome/browser/chrome_browser_main_win.h"
|
||||||
|
#include "chrome/browser/win/parental_controls.h"
|
||||||
#include "components/os_crypt/os_crypt.h"
|
#include "components/os_crypt/os_crypt.h"
|
||||||
#include "ui/base/cursor/cursor_loader_win.h"
|
#include "ui/base/cursor/cursor_loader_win.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -161,8 +162,6 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
|||||||
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
|
display::Screen::SetScreenInstance(views::CreateDesktopScreen());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ui::MaterialDesignController::Initialize();
|
|
||||||
|
|
||||||
if (extensions::ExtensionsEnabled()) {
|
if (extensions::ExtensionsEnabled()) {
|
||||||
// Initialize extension global objects before creating the global
|
// Initialize extension global objects before creating the global
|
||||||
// BrowserContext.
|
// BrowserContext.
|
||||||
@@ -192,7 +191,7 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
|||||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||||
|
|
||||||
CefRequestContextSettings settings;
|
CefRequestContextSettings settings;
|
||||||
CefContext::Get()->PopulateRequestContextSettings(&settings);
|
CefContext::Get()->PopulateGlobalRequestContextSettings(&settings);
|
||||||
|
|
||||||
// Create the global RequestContext.
|
// Create the global RequestContext.
|
||||||
global_request_context_ =
|
global_request_context_ =
|
||||||
@@ -202,6 +201,12 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
|||||||
|
|
||||||
CefDevToolsManagerDelegate::StartHttpHandler(browser_context);
|
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.
|
// Triggers initialization of the singleton instance on UI thread.
|
||||||
PluginFinder::GetInstance()->Init();
|
PluginFinder::GetInstance()->Init();
|
||||||
|
|
||||||
|
@@ -34,11 +34,17 @@ class MessagePumpExternal : public base::MessagePumpForUI {
|
|||||||
base::mac::ScopedNSAutoreleasePool autorelease_pool;
|
base::mac::ScopedNSAutoreleasePool autorelease_pool;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const bool has_more_work = DirectRunWork(delegate);
|
base::TimeTicks next_run_time; // is_null()
|
||||||
|
const bool has_more_work = DirectRunWork(delegate, &next_run_time);
|
||||||
if (!has_more_work)
|
if (!has_more_work)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
const base::TimeDelta& delta = base::TimeTicks::Now() - start;
|
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;
|
||||||
if (delta.InSecondsF() > max_time_slice_)
|
if (delta.InSecondsF() > max_time_slice_)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -54,26 +60,33 @@ class MessagePumpExternal : public base::MessagePumpForUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool DirectRunWork(Delegate* delegate) {
|
static bool DirectRunWork(Delegate* delegate,
|
||||||
bool did_work = false;
|
base::TimeTicks* next_run_time) {
|
||||||
bool did_delayed_work = false;
|
bool more_immediate_work = false;
|
||||||
bool did_idle_work = false;
|
bool more_idle_work = false;
|
||||||
|
bool more_delayed_work = false;
|
||||||
|
|
||||||
// Perform work & delayed work.
|
Delegate::NextWorkInfo next_work_info = delegate->DoWork();
|
||||||
// If no work was found, then perform idle work.
|
|
||||||
|
|
||||||
did_work = delegate->DoWork();
|
// is_immediate() returns true if the next task is ready right away.
|
||||||
|
more_immediate_work = next_work_info.is_immediate();
|
||||||
// We are using an external timer, so we don't have any action based on the
|
if (!more_immediate_work) {
|
||||||
// returned next delayed work time.
|
// Check the next PendingTask's |delayed_run_time|.
|
||||||
base::TimeTicks next_time;
|
// is_max() returns true if there are no more immediate nor delayed tasks.
|
||||||
did_delayed_work = delegate->DoDelayedWork(&next_time);
|
more_delayed_work = !next_work_info.delayed_run_time.is_max();
|
||||||
|
if (more_delayed_work) {
|
||||||
if (!did_work && !did_delayed_work) {
|
// The only remaining work that we know about is the PendingTask.
|
||||||
did_idle_work = delegate->DoIdleWork();
|
// Consider the run time for that task in the time slice calculation.
|
||||||
|
*next_run_time = next_work_info.delayed_run_time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return did_work || did_delayed_work || did_idle_work;
|
if (!more_immediate_work && !more_delayed_work) {
|
||||||
|
// DoIdleWork() returns true if idle work was all done.
|
||||||
|
more_idle_work = !delegate->DoIdleWork();
|
||||||
|
}
|
||||||
|
|
||||||
|
return more_immediate_work || more_idle_work || more_delayed_work;
|
||||||
}
|
}
|
||||||
|
|
||||||
const float max_time_slice_;
|
const float max_time_slice_;
|
||||||
|
@@ -11,16 +11,16 @@ namespace browser_util {
|
|||||||
bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event,
|
bool GetCefKeyEvent(const content::NativeWebKeyboardEvent& event,
|
||||||
CefKeyEvent& cef_event) {
|
CefKeyEvent& cef_event) {
|
||||||
switch (event.GetType()) {
|
switch (event.GetType()) {
|
||||||
case blink::WebKeyboardEvent::kRawKeyDown:
|
case blink::WebKeyboardEvent::Type::kRawKeyDown:
|
||||||
cef_event.type = KEYEVENT_RAWKEYDOWN;
|
cef_event.type = KEYEVENT_RAWKEYDOWN;
|
||||||
break;
|
break;
|
||||||
case blink::WebKeyboardEvent::kKeyDown:
|
case blink::WebKeyboardEvent::Type::kKeyDown:
|
||||||
cef_event.type = KEYEVENT_KEYDOWN;
|
cef_event.type = KEYEVENT_KEYDOWN;
|
||||||
break;
|
break;
|
||||||
case blink::WebKeyboardEvent::kKeyUp:
|
case blink::WebKeyboardEvent::Type::kKeyUp:
|
||||||
cef_event.type = KEYEVENT_KEYUP;
|
cef_event.type = KEYEVENT_KEYUP;
|
||||||
break;
|
break;
|
||||||
case blink::WebKeyboardEvent::kChar:
|
case blink::WebKeyboardEvent::Type::kChar:
|
||||||
cef_event.type = KEYEVENT_CHAR;
|
cef_event.type = KEYEVENT_CHAR;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@@ -309,12 +309,6 @@ ChromeBrowserProcessStub::safe_browsing_service() {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
safe_browsing::ClientSideDetectionService*
|
|
||||||
ChromeBrowserProcessStub::safe_browsing_detection_service() {
|
|
||||||
NOTREACHED();
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
subresource_filter::RulesetService*
|
subresource_filter::RulesetService*
|
||||||
ChromeBrowserProcessStub::subresource_filter_ruleset_service() {
|
ChromeBrowserProcessStub::subresource_filter_ruleset_service() {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
@@ -374,3 +368,8 @@ ChromeBrowserProcessStub::resource_coordinator_parts() {
|
|||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BuildState* ChromeBrowserProcessStub::GetBuildState() {
|
||||||
|
NOTREACHED();
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
@@ -78,8 +78,6 @@ class ChromeBrowserProcessStub : public BrowserProcess {
|
|||||||
std::unique_ptr<BackgroundModeManager> manager) override;
|
std::unique_ptr<BackgroundModeManager> manager) override;
|
||||||
StatusTray* status_tray() override;
|
StatusTray* status_tray() override;
|
||||||
safe_browsing::SafeBrowsingService* safe_browsing_service() override;
|
safe_browsing::SafeBrowsingService* safe_browsing_service() override;
|
||||||
safe_browsing::ClientSideDetectionService* safe_browsing_detection_service()
|
|
||||||
override;
|
|
||||||
subresource_filter::RulesetService* subresource_filter_ruleset_service()
|
subresource_filter::RulesetService* subresource_filter_ruleset_service()
|
||||||
override;
|
override;
|
||||||
optimization_guide::OptimizationGuideService* optimization_guide_service()
|
optimization_guide::OptimizationGuideService* optimization_guide_service()
|
||||||
@@ -98,6 +96,7 @@ class ChromeBrowserProcessStub : public BrowserProcess {
|
|||||||
resource_coordinator::TabManager* GetTabManager() override;
|
resource_coordinator::TabManager* GetTabManager() override;
|
||||||
resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
|
resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
|
||||||
override;
|
override;
|
||||||
|
BuildState* GetBuildState() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool initialized_;
|
bool initialized_;
|
||||||
|
@@ -5,9 +5,35 @@
|
|||||||
|
|
||||||
#include "libcef/browser/chrome_profile_stub.h"
|
#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 "content/public/browser/resource_context.h"
|
||||||
#include "net/url_request/url_request_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() {}
|
||||||
|
|
||||||
ChromeProfileStub::~ChromeProfileStub() {}
|
ChromeProfileStub::~ChromeProfileStub() {}
|
||||||
@@ -20,6 +46,19 @@ bool ChromeProfileStub::IsOffTheRecord() const {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Profile::OTRProfileID& ChromeProfileStub::GetOTRProfileID() const {
|
||||||
|
NOTREACHED();
|
||||||
|
static base::NoDestructor<Profile::OTRProfileID> otr_profile_id(
|
||||||
|
"ProfileImp::NoOTRProfileID");
|
||||||
|
return *otr_profile_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
variations::VariationsClient* ChromeProfileStub::GetVariationsClient() {
|
||||||
|
if (!variations_client_)
|
||||||
|
variations_client_ = std::make_unique<CefVariationsClient>(this);
|
||||||
|
return variations_client_.get();
|
||||||
|
}
|
||||||
|
|
||||||
scoped_refptr<base::SequencedTaskRunner> ChromeProfileStub::GetIOTaskRunner() {
|
scoped_refptr<base::SequencedTaskRunner> ChromeProfileStub::GetIOTaskRunner() {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return scoped_refptr<base::SequencedTaskRunner>();
|
return scoped_refptr<base::SequencedTaskRunner>();
|
||||||
@@ -34,16 +73,27 @@ Profile::ProfileType ChromeProfileStub::GetProfileType() const {
|
|||||||
return REGULAR_PROFILE;
|
return REGULAR_PROFILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Profile* ChromeProfileStub::GetOffTheRecordProfile() {
|
Profile* ChromeProfileStub::GetOffTheRecordProfile(
|
||||||
|
const Profile::OTRProfileID& otr_profile_id) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChromeProfileStub::DestroyOffTheRecordProfile() {
|
std::vector<Profile*> ChromeProfileStub::GetAllOffTheRecordProfiles() {
|
||||||
|
NOTREACHED();
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
void ChromeProfileStub::DestroyOffTheRecordProfile(Profile* otr_profile) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChromeProfileStub::HasOffTheRecordProfile() {
|
bool ChromeProfileStub::HasOffTheRecordProfile(
|
||||||
|
const Profile::OTRProfileID& otr_profile_id) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ChromeProfileStub::HasAnyOffTheRecordProfile() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,10 +158,6 @@ bool ChromeProfileStub::WasCreatedByVersionOrLater(const std::string& version) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChromeProfileStub::IsIndependentOffTheRecordProfile() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChromeProfileStub::SetExitType(ExitType exit_type) {
|
void ChromeProfileStub::SetExitType(ExitType exit_type) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
@@ -22,12 +22,18 @@ class ChromeProfileStub : public Profile {
|
|||||||
// Profile methods.
|
// Profile methods.
|
||||||
bool IsOffTheRecord() override;
|
bool IsOffTheRecord() override;
|
||||||
bool IsOffTheRecord() const override;
|
bool IsOffTheRecord() const override;
|
||||||
|
const OTRProfileID& GetOTRProfileID() const override;
|
||||||
|
variations::VariationsClient* GetVariationsClient() override;
|
||||||
scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override;
|
scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() override;
|
||||||
std::string GetProfileUserName() const override;
|
std::string GetProfileUserName() const override;
|
||||||
ProfileType GetProfileType() const override;
|
ProfileType GetProfileType() const override;
|
||||||
Profile* GetOffTheRecordProfile() override;
|
Profile* GetOffTheRecordProfile(
|
||||||
void DestroyOffTheRecordProfile() override;
|
const Profile::OTRProfileID& otr_profile_id) override;
|
||||||
bool HasOffTheRecordProfile() override;
|
std::vector<Profile*> GetAllOffTheRecordProfiles() override;
|
||||||
|
void DestroyOffTheRecordProfile(Profile* otr_profile) override;
|
||||||
|
bool HasOffTheRecordProfile(
|
||||||
|
const Profile::OTRProfileID& otr_profile_id) override;
|
||||||
|
bool HasAnyOffTheRecordProfile() override;
|
||||||
Profile* GetOriginalProfile() override;
|
Profile* GetOriginalProfile() override;
|
||||||
const Profile* GetOriginalProfile() const override;
|
const Profile* GetOriginalProfile() const override;
|
||||||
bool IsSupervised() const override;
|
bool IsSupervised() const override;
|
||||||
@@ -41,13 +47,14 @@ class ChromeProfileStub : public Profile {
|
|||||||
void set_last_selected_directory(const base::FilePath& path) override;
|
void set_last_selected_directory(const base::FilePath& path) override;
|
||||||
GURL GetHomePage() override;
|
GURL GetHomePage() override;
|
||||||
bool WasCreatedByVersionOrLater(const std::string& version) override;
|
bool WasCreatedByVersionOrLater(const std::string& version) override;
|
||||||
bool IsIndependentOffTheRecordProfile() override;
|
|
||||||
void SetExitType(ExitType exit_type) override;
|
void SetExitType(ExitType exit_type) override;
|
||||||
ExitType GetLastSessionExitType() override;
|
ExitType GetLastSessionExitType() override;
|
||||||
base::Time GetCreationTime() const override;
|
base::Time GetCreationTime() const override;
|
||||||
void SetCreationTimeForTesting(base::Time creation_time) override;
|
void SetCreationTimeForTesting(base::Time creation_time) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::unique_ptr<variations::VariationsClient> variations_client_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(ChromeProfileStub);
|
DISALLOW_COPY_AND_ASSIGN(ChromeProfileStub);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -59,6 +59,7 @@
|
|||||||
#include "chrome/browser/profiles/renderer_updater_factory.h"
|
#include "chrome/browser/profiles/renderer_updater_factory.h"
|
||||||
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
||||||
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
|
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
|
||||||
|
#include "chrome/common/chrome_content_client.h"
|
||||||
#include "chrome/common/chrome_paths.h"
|
#include "chrome/common/chrome_paths.h"
|
||||||
#include "chrome/common/chrome_switches.h"
|
#include "chrome/common/chrome_switches.h"
|
||||||
#include "chrome/common/google_url_loader_throttle.h"
|
#include "chrome/common/google_url_loader_throttle.h"
|
||||||
@@ -115,6 +116,8 @@
|
|||||||
#include "services/service_manager/public/mojom/connector.mojom.h"
|
#include "services/service_manager/public/mojom/connector.mojom.h"
|
||||||
#include "services/service_manager/sandbox/switches.h"
|
#include "services/service_manager/sandbox/switches.h"
|
||||||
#include "storage/browser/quota/quota_settings.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/blink/public/web/web_window_features.h"
|
||||||
#include "third_party/widevine/cdm/buildflags.h"
|
#include "third_party/widevine/cdm/buildflags.h"
|
||||||
#include "ui/base/l10n/l10n_util.h"
|
#include "ui/base/l10n/l10n_util.h"
|
||||||
@@ -129,8 +132,8 @@
|
|||||||
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
||||||
#include "base/debug/leak_annotations.h"
|
#include "base/debug/leak_annotations.h"
|
||||||
#include "chrome/common/chrome_paths.h"
|
#include "chrome/common/chrome_paths.h"
|
||||||
#include "components/crash/content/app/breakpad_linux.h"
|
|
||||||
#include "components/crash/content/browser/crash_handler_host_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"
|
#include "content/public/common/content_descriptors.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -446,10 +449,20 @@ bool NavigationOnUIThread(
|
|||||||
const navigation_interception::NavigationParams& params) {
|
const navigation_interception::NavigationParams& params) {
|
||||||
CEF_REQUIRE_UIT();
|
CEF_REQUIRE_UIT();
|
||||||
|
|
||||||
|
content::OpenURLParams open_params(
|
||||||
|
params.url(), params.referrer(), WindowOpenDisposition::CURRENT_TAB,
|
||||||
|
params.transition_type(), params.is_renderer_initiated());
|
||||||
|
open_params.user_gesture = params.has_user_gesture();
|
||||||
|
|
||||||
|
CefRefPtr<CefBrowserHostImpl> browser;
|
||||||
|
if (!CefBrowserInfoManager::GetInstance()->MaybeAllowNavigation(
|
||||||
|
source->GetMainFrame(), open_params, browser)) {
|
||||||
|
// Cancel the navigation.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool ignore_navigation = false;
|
bool ignore_navigation = false;
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHostImpl> browser =
|
|
||||||
CefBrowserHostImpl::GetBrowserForContents(source);
|
|
||||||
if (browser.get()) {
|
if (browser.get()) {
|
||||||
CefRefPtr<CefClient> client = browser->GetClient();
|
CefRefPtr<CefClient> client = browser->GetClient();
|
||||||
if (client.get()) {
|
if (client.get()) {
|
||||||
@@ -505,6 +518,30 @@ void BindPluginInfoHost(
|
|||||||
std::move(receiver));
|
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(
|
||||||
|
mojo::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
|
} // namespace
|
||||||
|
|
||||||
CefContentBrowserClient::CefContentBrowserClient()
|
CefContentBrowserClient::CefContentBrowserClient()
|
||||||
@@ -1024,6 +1061,11 @@ void CefContentBrowserClient::OverrideWebkitPrefs(
|
|||||||
// Using RVH instead of RFH here because rvh->GetMainFrame() may be nullptr
|
// Using RVH instead of RFH here because rvh->GetMainFrame() may be nullptr
|
||||||
// when this method is called.
|
// when this method is called.
|
||||||
renderer_prefs::PopulateWebPreferences(rvh, *prefs);
|
renderer_prefs::PopulateWebPreferences(rvh, *prefs);
|
||||||
|
|
||||||
|
if (rvh->GetWidget()->GetView()) {
|
||||||
|
rvh->GetWidget()->GetView()->SetBackgroundColor(
|
||||||
|
prefs->base_background_color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefContentBrowserClient::BrowserURLHandlerCreated(
|
void CefContentBrowserClient::BrowserURLHandlerCreated(
|
||||||
@@ -1094,16 +1136,13 @@ CefContentBrowserClient::CreateURLLoaderThrottles(
|
|||||||
request.resource_type, frame_tree_node_id));
|
request.resource_type, frame_tree_node_id));
|
||||||
|
|
||||||
Profile* profile = Profile::FromBrowserContext(browser_context);
|
Profile* profile = Profile::FromBrowserContext(browser_context);
|
||||||
bool is_off_the_record = profile->IsOffTheRecord();
|
|
||||||
|
|
||||||
chrome::mojom::DynamicParams dynamic_params = {
|
chrome::mojom::DynamicParams dynamic_params = {
|
||||||
profile->GetPrefs()->GetBoolean(prefs::kForceGoogleSafeSearch),
|
profile->GetPrefs()->GetBoolean(prefs::kForceGoogleSafeSearch),
|
||||||
profile->GetPrefs()->GetInteger(prefs::kForceYouTubeRestrict),
|
profile->GetPrefs()->GetInteger(prefs::kForceYouTubeRestrict),
|
||||||
profile->GetPrefs()->GetString(prefs::kAllowedDomainsForApps),
|
profile->GetPrefs()->GetString(prefs::kAllowedDomainsForApps)};
|
||||||
variations::VariationsHttpHeaderProvider::GetInstance()
|
result.push_back(
|
||||||
->GetClientDataHeader(false /* is_signed_in */)};
|
std::make_unique<GoogleURLLoaderThrottle>(std::move(dynamic_params)));
|
||||||
result.push_back(std::make_unique<GoogleURLLoaderThrottle>(
|
|
||||||
is_off_the_record, std::move(dynamic_params)));
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -1284,18 +1323,28 @@ void CefContentBrowserClient::OnNetworkServiceCreated(
|
|||||||
network_service);
|
network_service);
|
||||||
}
|
}
|
||||||
|
|
||||||
mojo::Remote<network::mojom::NetworkContext>
|
void CefContentBrowserClient::ConfigureNetworkContextParams(
|
||||||
CefContentBrowserClient::CreateNetworkContext(
|
|
||||||
content::BrowserContext* context,
|
content::BrowserContext* context,
|
||||||
bool in_memory,
|
bool in_memory,
|
||||||
const base::FilePath& relative_partition_path) {
|
const base::FilePath& relative_partition_path,
|
||||||
|
network::mojom::NetworkContextParams* network_context_params,
|
||||||
|
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params) {
|
||||||
// This method may be called during shutdown when using multi-threaded
|
// This method may be called during shutdown when using multi-threaded
|
||||||
// message loop mode. In that case exit early to avoid crashes.
|
// message loop mode. In that case exit early to avoid crashes.
|
||||||
if (!SystemNetworkContextManager::GetInstance())
|
if (!SystemNetworkContextManager::GetInstance()) {
|
||||||
return mojo::Remote<network::mojom::NetworkContext>();
|
// This must match the value expected in
|
||||||
|
// StoragePartitionImpl::InitNetworkContext.
|
||||||
|
network_context_params->context_name = "magic_shutting_down";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Profile* profile = Profile::FromBrowserContext(context);
|
Profile* profile = Profile::FromBrowserContext(context);
|
||||||
return profile->CreateNetworkContext(in_memory, relative_partition_path);
|
profile->ConfigureNetworkContextParams(in_memory, relative_partition_path,
|
||||||
|
network_context_params,
|
||||||
|
cert_verifier_creation_params);
|
||||||
|
// TODO(cef): Remove this and add required NetworkIsolationKeys,
|
||||||
|
// this is currently not the case and this was not required pre M84.
|
||||||
|
network_context_params->require_network_isolation_key = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The sandbox may block read/write access from the NetworkService to
|
// The sandbox may block read/write access from the NetworkService to
|
||||||
@@ -1306,10 +1355,7 @@ CefContentBrowserClient::GetNetworkContextsParentDirectory() {
|
|||||||
base::PathService::Get(chrome::DIR_USER_DATA, &user_data_path);
|
base::PathService::Get(chrome::DIR_USER_DATA, &user_data_path);
|
||||||
DCHECK(!user_data_path.empty());
|
DCHECK(!user_data_path.empty());
|
||||||
|
|
||||||
// The CefContext::ValidateCachePath method enforces the requirement that all
|
const auto& root_cache_path = GetRootCachePath();
|
||||||
// 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
|
// root_cache_path may sometimes be empty or a child of user_data_path, so
|
||||||
// only return the one path in that case.
|
// only return the one path in that case.
|
||||||
@@ -1385,7 +1431,9 @@ CefContentBrowserClient::CreateWindowForPictureInPicture(
|
|||||||
|
|
||||||
void CefContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
void CefContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
||||||
|
PopulateChromeFrameBinders(map);
|
||||||
|
|
||||||
if (!extensions::ExtensionsEnabled())
|
if (!extensions::ExtensionsEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1410,6 +1458,11 @@ void CefContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
|||||||
extension);
|
extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base::FilePath
|
||||||
|
CefContentBrowserClient::GetSandboxedStorageServiceDataDirectory() {
|
||||||
|
return GetRootCachePath();
|
||||||
|
}
|
||||||
|
|
||||||
std::string CefContentBrowserClient::GetProduct() {
|
std::string CefContentBrowserClient::GetProduct() {
|
||||||
// Match the logic in chrome_content_browser_client.cc GetProduct().
|
// Match the logic in chrome_content_browser_client.cc GetProduct().
|
||||||
return ::GetProduct();
|
return ::GetProduct();
|
||||||
@@ -1427,7 +1480,8 @@ std::string CefContentBrowserClient::GetUserAgent() {
|
|||||||
blink::UserAgentMetadata CefContentBrowserClient::GetUserAgentMetadata() {
|
blink::UserAgentMetadata CefContentBrowserClient::GetUserAgentMetadata() {
|
||||||
blink::UserAgentMetadata metadata;
|
blink::UserAgentMetadata metadata;
|
||||||
|
|
||||||
metadata.brand = version_info::GetProductName();
|
metadata.brand_version_list = {blink::UserAgentBrandVersion{
|
||||||
|
version_info::GetProductName(), version_info::GetMajorVersionNumber()}};
|
||||||
metadata.full_version = version_info::GetVersionNumber();
|
metadata.full_version = version_info::GetVersionNumber();
|
||||||
metadata.platform = version_info::GetOSType();
|
metadata.platform = version_info::GetOSType();
|
||||||
|
|
||||||
@@ -1448,6 +1502,31 @@ CefContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
|
|||||||
return mime_types;
|
return mime_types;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CefContentBrowserClient::ShouldAllowPluginCreation(
|
||||||
|
const url::Origin& embedder_origin,
|
||||||
|
const content::PepperPluginInfo& plugin_info) {
|
||||||
|
if (plugin_info.name == ChromeContentClient::kPDFInternalPluginName) {
|
||||||
|
// Allow embedding the internal PDF plugin in the built-in PDF extension.
|
||||||
|
if (embedder_origin.scheme() == extensions::kExtensionScheme &&
|
||||||
|
embedder_origin.host() == extension_misc::kPdfExtensionId) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow embedding the internal PDF plugin in chrome://print.
|
||||||
|
if (embedder_origin ==
|
||||||
|
url::Origin::Create(GURL(chrome::kChromeUIPrintURL))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only allow the PDF plugin in the known, trustworthy origins that are
|
||||||
|
// allowlisted above. See also https://crbug.com/520422 and
|
||||||
|
// https://crbug.com/1027173.
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
CefRefPtr<CefRequestContextImpl> CefContentBrowserClient::request_context()
|
CefRefPtr<CefRequestContextImpl> CefContentBrowserClient::request_context()
|
||||||
const {
|
const {
|
||||||
return browser_main_parts_->request_context();
|
return browser_main_parts_->request_context();
|
||||||
|
@@ -173,10 +173,13 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
network::mojom::URLLoaderFactoryOverridePtr* factory_override) override;
|
network::mojom::URLLoaderFactoryOverridePtr* factory_override) override;
|
||||||
void OnNetworkServiceCreated(
|
void OnNetworkServiceCreated(
|
||||||
network::mojom::NetworkService* network_service) override;
|
network::mojom::NetworkService* network_service) override;
|
||||||
mojo::Remote<network::mojom::NetworkContext> CreateNetworkContext(
|
void ConfigureNetworkContextParams(
|
||||||
content::BrowserContext* context,
|
content::BrowserContext* context,
|
||||||
bool in_memory,
|
bool in_memory,
|
||||||
const base::FilePath& relative_partition_path) override;
|
const base::FilePath& relative_partition_path,
|
||||||
|
network::mojom::NetworkContextParams* network_context_params,
|
||||||
|
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params)
|
||||||
|
override;
|
||||||
std::vector<base::FilePath> GetNetworkContextsParentDirectory() override;
|
std::vector<base::FilePath> GetNetworkContextsParentDirectory() override;
|
||||||
bool HandleExternalProtocol(
|
bool HandleExternalProtocol(
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
@@ -200,15 +203,17 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
|||||||
content::PictureInPictureWindowController* controller) override;
|
content::PictureInPictureWindowController* controller) override;
|
||||||
void RegisterBrowserInterfaceBindersForFrame(
|
void RegisterBrowserInterfaceBindersForFrame(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map)
|
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) override;
|
||||||
override;
|
base::FilePath GetSandboxedStorageServiceDataDirectory() override;
|
||||||
|
|
||||||
std::string GetProduct() override;
|
std::string GetProduct() override;
|
||||||
std::string GetChromeProduct() override;
|
std::string GetChromeProduct() override;
|
||||||
std::string GetUserAgent() override;
|
std::string GetUserAgent() override;
|
||||||
blink::UserAgentMetadata GetUserAgentMetadata() override;
|
blink::UserAgentMetadata GetUserAgentMetadata() override;
|
||||||
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(
|
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(
|
||||||
content::BrowserContext* browser_context) override;
|
content::BrowserContext* browser_context) override;
|
||||||
|
bool ShouldAllowPluginCreation(
|
||||||
|
const url::Origin& embedder_origin,
|
||||||
|
const content::PepperPluginInfo& plugin_info) override;
|
||||||
|
|
||||||
CefRefPtr<CefRequestContextImpl> request_context() const;
|
CefRefPtr<CefRequestContextImpl> request_context() const;
|
||||||
CefDevToolsDelegate* devtools_delegate() const;
|
CefDevToolsDelegate* devtools_delegate() const;
|
||||||
|
@@ -37,13 +37,13 @@
|
|||||||
#include "base/strings/utf_string_conversions.h"
|
#include "base/strings/utf_string_conversions.h"
|
||||||
#include "chrome/chrome_elf/chrome_elf_main.h"
|
#include "chrome/chrome_elf/chrome_elf_main.h"
|
||||||
#include "chrome/install_static/initialize_from_primary_module.h"
|
#include "chrome/install_static/initialize_from_primary_module.h"
|
||||||
#include "components/crash/content/app/crashpad.h"
|
#include "components/crash/core/app/crashpad.h"
|
||||||
#include "content/public/app/sandbox_helper_win.h"
|
#include "content/public/app/sandbox_helper_win.h"
|
||||||
#include "sandbox/win/src/sandbox_types.h"
|
#include "sandbox/win/src/sandbox_types.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||||
#include "components/crash/content/app/crash_switches.h"
|
#include "components/crash/core/app/crash_switches.h"
|
||||||
#include "third_party/crashpad/crashpad/handler/handler_main.h"
|
#include "third_party/crashpad/crashpad/handler/handler_main.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -97,12 +97,12 @@ void InitCrashReporter() {
|
|||||||
|
|
||||||
#if defined(OS_MACOSX) || defined(OS_WIN)
|
#if defined(OS_MACOSX) || defined(OS_WIN)
|
||||||
|
|
||||||
// Based on components/crash/content/app/run_as_crashpad_handler_win.cc
|
// Based on components/crash/core/app/run_as_crashpad_handler_win.cc
|
||||||
// Remove the "--type=crashpad-handler" command-line flag that will otherwise
|
// Remove the "--type=crashpad-handler" command-line flag that will otherwise
|
||||||
// confuse the crashpad handler.
|
// confuse the crashpad handler.
|
||||||
// Chrome uses an embedded crashpad handler on Windows only and imports this
|
// Chrome uses an embedded crashpad handler on Windows only and imports this
|
||||||
// function via the existing "run_as_crashpad_handler" target defined in
|
// function via the existing "run_as_crashpad_handler" target defined in
|
||||||
// components/crash/content/app/BUILD.gn. CEF uses an embedded handler on both
|
// components/crash/core/app/BUILD.gn. CEF uses an embedded handler on both
|
||||||
// Windows and macOS so we define the function here instead of using the
|
// Windows and macOS so we define the function here instead of using the
|
||||||
// existing target (because we can't use that target on macOS).
|
// existing target (because we can't use that target on macOS).
|
||||||
int RunAsCrashpadHandler(const base::CommandLine& command_line) {
|
int RunAsCrashpadHandler(const base::CommandLine& command_line) {
|
||||||
@@ -160,6 +160,85 @@ bool GetColor(const cef_color_t cef_in, bool is_windowless, SkColor* sk_out) {
|
|||||||
return true;
|
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
|
} // namespace
|
||||||
|
|
||||||
int CefExecuteProcess(const CefMainArgs& args,
|
int CefExecuteProcess(const CefMainArgs& args,
|
||||||
@@ -370,18 +449,23 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
|||||||
SignalChromeElf();
|
SignalChromeElf();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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 =
|
const base::FilePath& root_cache_path =
|
||||||
base::FilePath(CefString(&settings_.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()) {
|
if (root_cache_path.empty() && !cache_path.empty()) {
|
||||||
CefString(&settings_.root_cache_path) = CefString(&settings_.cache_path);
|
CefString(&settings_.root_cache_path) = cache_path.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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));
|
main_delegate_.reset(new CefMainDelegate(application));
|
||||||
browser_info_manager_.reset(new CefBrowserInfoManager);
|
browser_info_manager_.reset(new CefBrowserInfoManager);
|
||||||
|
|
||||||
@@ -518,11 +602,14 @@ CefTraceSubscriber* CefContext::GetTraceSubscriber() {
|
|||||||
return trace_subscriber_.get();
|
return trace_subscriber_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefContext::PopulateRequestContextSettings(
|
void CefContext::PopulateGlobalRequestContextSettings(
|
||||||
CefRequestContextSettings* settings) {
|
CefRequestContextSettings* settings) {
|
||||||
CefRefPtr<CefCommandLine> command_line =
|
CefRefPtr<CefCommandLine> command_line =
|
||||||
CefCommandLine::GetGlobalCommandLine();
|
CefCommandLine::GetGlobalCommandLine();
|
||||||
|
|
||||||
|
// This value was already normalized in Initialize.
|
||||||
CefString(&settings->cache_path) = CefString(&settings_.cache_path);
|
CefString(&settings->cache_path) = CefString(&settings_.cache_path);
|
||||||
|
|
||||||
settings->persist_session_cookies =
|
settings->persist_session_cookies =
|
||||||
settings_.persist_session_cookies ||
|
settings_.persist_session_cookies ||
|
||||||
command_line->HasSwitch(switches::kPersistSessionCookies);
|
command_line->HasSwitch(switches::kPersistSessionCookies);
|
||||||
@@ -536,29 +623,17 @@ void CefContext::PopulateRequestContextSettings(
|
|||||||
CefString(&settings_.accept_language_list);
|
CefString(&settings_.accept_language_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefContext::ValidateCachePath(const base::FilePath& cache_path) {
|
void CefContext::NormalizeRequestContextSettings(
|
||||||
if (cache_path.empty())
|
CefRequestContextSettings* settings) {
|
||||||
return true;
|
// 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);
|
||||||
|
|
||||||
const base::FilePath& root_cache_path =
|
if (settings->accept_language_list.length == 0) {
|
||||||
base::FilePath(CefString(&settings_.root_cache_path));
|
// Use the global language list setting.
|
||||||
if (!root_cache_path.empty() && root_cache_path != cache_path &&
|
CefString(&settings->accept_language_list) =
|
||||||
!root_cache_path.IsParent(cache_path)) {
|
CefString(&settings_.accept_language_list);
|
||||||
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) {
|
void CefContext::AddObserver(Observer* observer) {
|
||||||
|
@@ -87,10 +87,11 @@ class CefContext {
|
|||||||
|
|
||||||
// Populate request context settings for the global system context based on
|
// Populate request context settings for the global system context based on
|
||||||
// CefSettings and command-line flags.
|
// CefSettings and command-line flags.
|
||||||
void PopulateRequestContextSettings(CefRequestContextSettings* settings);
|
void PopulateGlobalRequestContextSettings(
|
||||||
|
CefRequestContextSettings* settings);
|
||||||
|
|
||||||
// Verify that |cache_path| is valid and create it if necessary.
|
// Normalize and validate request context settings for user-created contexts.
|
||||||
bool ValidateCachePath(const base::FilePath& cache_path);
|
void NormalizeRequestContextSettings(CefRequestContextSettings* settings);
|
||||||
|
|
||||||
// Manage observer objects. The observer must either outlive this object or
|
// Manage observer objects. The observer must either outlive this object or
|
||||||
// remove itself before destruction. These methods can only be called on the
|
// remove itself before destruction. These methods can only be called on the
|
||||||
|
@@ -9,7 +9,7 @@
|
|||||||
#include "include/cef_context_menu_handler.h"
|
#include "include/cef_context_menu_handler.h"
|
||||||
#include "libcef/common/value_base.h"
|
#include "libcef/common/value_base.h"
|
||||||
|
|
||||||
#include "content/public/common/context_menu_params.h"
|
#include "content/public/browser/context_menu_params.h"
|
||||||
|
|
||||||
// CefContextMenuParams implementation. This class is not thread safe.
|
// CefContextMenuParams implementation. This class is not thread safe.
|
||||||
class CefContextMenuParamsImpl
|
class CefContextMenuParamsImpl
|
||||||
|
137
libcef/browser/devtools/devtools_controller.cc
Normal file
137
libcef/browser/devtools/devtools_controller.cc
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
// 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_;
|
||||||
|
}
|
79
libcef/browser/devtools/devtools_controller.h
Normal file
79
libcef/browser/devtools/devtools_controller.h
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
// 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,13 +6,18 @@
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#include <iomanip>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "libcef/browser/browser_context.h"
|
#include "libcef/browser/browser_context.h"
|
||||||
|
#include "libcef/browser/content_browser_client.h"
|
||||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||||
#include "libcef/browser/net/devtools_scheme_handler.h"
|
#include "libcef/browser/net/devtools_scheme_handler.h"
|
||||||
|
#include "libcef/common/cef_switches.h"
|
||||||
|
|
||||||
#include "base/base64.h"
|
#include "base/base64.h"
|
||||||
|
#include "base/command_line.h"
|
||||||
|
#include "base/files/file_util.h"
|
||||||
#include "base/guid.h"
|
#include "base/guid.h"
|
||||||
#include "base/json/json_reader.h"
|
#include "base/json/json_reader.h"
|
||||||
#include "base/json/json_writer.h"
|
#include "base/json/json_writer.h"
|
||||||
@@ -48,6 +53,13 @@
|
|||||||
#include "services/network/public/cpp/simple_url_loader.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/cpp/simple_url_loader_stream_consumer.h"
|
||||||
#include "services/network/public/mojom/url_response_head.mojom.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 {
|
namespace {
|
||||||
|
|
||||||
@@ -86,6 +98,71 @@ std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
|
|||||||
return response;
|
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
|
} // namespace
|
||||||
|
|
||||||
class CefDevToolsFrontend::NetworkResourceLoader
|
class CefDevToolsFrontend::NetworkResourceLoader
|
||||||
@@ -156,11 +233,12 @@ const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||||
CefRefPtr<CefBrowserHostImpl> inspected_browser,
|
CefBrowserHostImpl* inspected_browser,
|
||||||
const CefWindowInfo& windowInfo,
|
const CefWindowInfo& windowInfo,
|
||||||
CefRefPtr<CefClient> client,
|
CefRefPtr<CefClient> client,
|
||||||
const CefBrowserSettings& settings,
|
const CefBrowserSettings& settings,
|
||||||
const CefPoint& inspect_element_at) {
|
const CefPoint& inspect_element_at,
|
||||||
|
base::OnceClosure frontend_destroyed_callback) {
|
||||||
CefBrowserSettings new_settings = settings;
|
CefBrowserSettings new_settings = settings;
|
||||||
if (!windowInfo.windowless_rendering_enabled &&
|
if (!windowInfo.windowless_rendering_enabled &&
|
||||||
CefColorGetA(new_settings.background_color) != SK_AlphaOPAQUE) {
|
CefColorGetA(new_settings.background_color) != SK_AlphaOPAQUE) {
|
||||||
@@ -187,7 +265,8 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
|||||||
// destroyed.
|
// destroyed.
|
||||||
CefDevToolsFrontend* devtools_frontend = new CefDevToolsFrontend(
|
CefDevToolsFrontend* devtools_frontend = new CefDevToolsFrontend(
|
||||||
static_cast<CefBrowserHostImpl*>(frontend_browser.get()),
|
static_cast<CefBrowserHostImpl*>(frontend_browser.get()),
|
||||||
inspected_contents, inspect_element_at);
|
inspected_contents, inspect_element_at,
|
||||||
|
std::move(frontend_destroyed_callback));
|
||||||
|
|
||||||
// Need to load the URL after creating the DevTools objects.
|
// Need to load the URL after creating the DevTools objects.
|
||||||
frontend_browser->GetMainFrame()->LoadURL(GetFrontendURL());
|
frontend_browser->GetMainFrame()->LoadURL(GetFrontendURL());
|
||||||
@@ -216,23 +295,23 @@ void CefDevToolsFrontend::Close() {
|
|||||||
frontend_browser_.get(), true));
|
frontend_browser_.get(), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefDevToolsFrontend::DisconnectFromTarget() {
|
|
||||||
if (!agent_host_)
|
|
||||||
return;
|
|
||||||
agent_host_->DetachClient(this);
|
|
||||||
agent_host_ = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
CefDevToolsFrontend::CefDevToolsFrontend(
|
CefDevToolsFrontend::CefDevToolsFrontend(
|
||||||
CefRefPtr<CefBrowserHostImpl> frontend_browser,
|
CefBrowserHostImpl* frontend_browser,
|
||||||
content::WebContents* inspected_contents,
|
content::WebContents* inspected_contents,
|
||||||
const CefPoint& inspect_element_at)
|
const CefPoint& inspect_element_at,
|
||||||
|
base::OnceClosure frontend_destroyed_callback)
|
||||||
: content::WebContentsObserver(frontend_browser->web_contents()),
|
: content::WebContentsObserver(frontend_browser->web_contents()),
|
||||||
frontend_browser_(frontend_browser),
|
frontend_browser_(frontend_browser),
|
||||||
inspected_contents_(inspected_contents),
|
inspected_contents_(inspected_contents),
|
||||||
inspect_element_at_(inspect_element_at),
|
inspect_element_at_(inspect_element_at),
|
||||||
file_manager_(frontend_browser.get(), GetPrefs()),
|
frontend_destroyed_callback_(std::move(frontend_destroyed_callback)),
|
||||||
weak_factory_(this) {}
|
file_manager_(frontend_browser, GetPrefs()),
|
||||||
|
protocol_log_file_(
|
||||||
|
base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
|
||||||
|
switches::kDevToolsProtocolLogFile)),
|
||||||
|
weak_factory_(this) {
|
||||||
|
DCHECK(!frontend_destroyed_callback_.is_null());
|
||||||
|
}
|
||||||
|
|
||||||
CefDevToolsFrontend::~CefDevToolsFrontend() {}
|
CefDevToolsFrontend::~CefDevToolsFrontend() {}
|
||||||
|
|
||||||
@@ -279,6 +358,7 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
|
|||||||
agent_host_->DetachClient(this);
|
agent_host_->DetachClient(this);
|
||||||
agent_host_ = nullptr;
|
agent_host_ = nullptr;
|
||||||
}
|
}
|
||||||
|
std::move(frontend_destroyed_callback_).Run();
|
||||||
delete this;
|
delete this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,6 +380,9 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
|||||||
std::string protocol_message;
|
std::string protocol_message;
|
||||||
if (!agent_host_ || !params->GetString(0, &protocol_message))
|
if (!agent_host_ || !params->GetString(0, &protocol_message))
|
||||||
return;
|
return;
|
||||||
|
if (ProtocolLoggingEnabled()) {
|
||||||
|
LogProtocolMessage(ProtocolMessageType::METHOD, protocol_message);
|
||||||
|
}
|
||||||
agent_host_->DispatchProtocolMessage(
|
agent_host_->DispatchProtocolMessage(
|
||||||
this, base::as_bytes(base::make_span(protocol_message)));
|
this, base::as_bytes(base::make_span(protocol_message)));
|
||||||
} else if (method == "loadCompleted") {
|
} else if (method == "loadCompleted") {
|
||||||
@@ -451,6 +534,14 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
|||||||
base::span<const uint8_t> message) {
|
base::span<const uint8_t> message) {
|
||||||
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
||||||
message.size());
|
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) {
|
if (str_message.length() < kMaxMessageChunkSize) {
|
||||||
std::string param;
|
std::string param;
|
||||||
base::EscapeJSONString(str_message, true, ¶m);
|
base::EscapeJSONString(str_message, true, ¶m);
|
||||||
@@ -504,6 +595,23 @@ void CefDevToolsFrontend::SendMessageAck(int request_id,
|
|||||||
CallClientFunction("DevToolsAPI.embedderMessageAck", &id_value, arg, nullptr);
|
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(
|
void CefDevToolsFrontend::AgentHostClosed(
|
||||||
content::DevToolsAgentHost* agent_host) {
|
content::DevToolsAgentHost* agent_host) {
|
||||||
DCHECK(agent_host == agent_host_.get());
|
DCHECK(agent_host == agent_host_.get());
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
#include "libcef/browser/devtools/devtools_file_manager.h"
|
#include "libcef/browser/devtools/devtools_file_manager.h"
|
||||||
|
|
||||||
#include "base/compiler_specific.h"
|
#include "base/compiler_specific.h"
|
||||||
|
#include "base/files/file_path.h"
|
||||||
#include "base/macros.h"
|
#include "base/macros.h"
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
@@ -31,36 +32,38 @@ class WebContents;
|
|||||||
|
|
||||||
class PrefService;
|
class PrefService;
|
||||||
|
|
||||||
|
enum class ProtocolMessageType {
|
||||||
|
METHOD,
|
||||||
|
RESULT,
|
||||||
|
EVENT,
|
||||||
|
};
|
||||||
|
|
||||||
class CefDevToolsFrontend : public content::WebContentsObserver,
|
class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||||
public content::DevToolsAgentHostClient {
|
public content::DevToolsAgentHostClient {
|
||||||
public:
|
public:
|
||||||
static CefDevToolsFrontend* Show(
|
static CefDevToolsFrontend* Show(
|
||||||
CefRefPtr<CefBrowserHostImpl> inspected_browser,
|
CefBrowserHostImpl* inspected_browser,
|
||||||
const CefWindowInfo& windowInfo,
|
const CefWindowInfo& windowInfo,
|
||||||
CefRefPtr<CefClient> client,
|
CefRefPtr<CefClient> client,
|
||||||
const CefBrowserSettings& settings,
|
const CefBrowserSettings& settings,
|
||||||
const CefPoint& inspect_element_at);
|
const CefPoint& inspect_element_at,
|
||||||
|
base::OnceClosure frontend_destroyed_callback);
|
||||||
|
|
||||||
void Activate();
|
void Activate();
|
||||||
void Focus();
|
void Focus();
|
||||||
void InspectElementAt(int x, int y);
|
void InspectElementAt(int x, int y);
|
||||||
void Close();
|
void Close();
|
||||||
|
|
||||||
void DisconnectFromTarget();
|
|
||||||
|
|
||||||
void CallClientFunction(const std::string& function_name,
|
void CallClientFunction(const std::string& function_name,
|
||||||
const base::Value* arg1,
|
const base::Value* arg1,
|
||||||
const base::Value* arg2,
|
const base::Value* arg2,
|
||||||
const base::Value* arg3);
|
const base::Value* arg3);
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHostImpl> frontend_browser() const {
|
|
||||||
return frontend_browser_;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser,
|
CefDevToolsFrontend(CefBrowserHostImpl* frontend_browser,
|
||||||
content::WebContents* inspected_contents,
|
content::WebContents* inspected_contents,
|
||||||
const CefPoint& inspect_element_at);
|
const CefPoint& inspect_element_at,
|
||||||
|
base::OnceClosure destroyed_callback);
|
||||||
~CefDevToolsFrontend() override;
|
~CefDevToolsFrontend() override;
|
||||||
|
|
||||||
// content::DevToolsAgentHostClient implementation.
|
// content::DevToolsAgentHostClient implementation.
|
||||||
@@ -78,12 +81,17 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
|||||||
|
|
||||||
void SendMessageAck(int request_id, const base::Value* arg1);
|
void SendMessageAck(int request_id, const base::Value* arg1);
|
||||||
|
|
||||||
|
bool ProtocolLoggingEnabled() const;
|
||||||
|
void LogProtocolMessage(ProtocolMessageType type,
|
||||||
|
const base::StringPiece& message);
|
||||||
|
|
||||||
PrefService* GetPrefs() const;
|
PrefService* GetPrefs() const;
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHostImpl> frontend_browser_;
|
CefRefPtr<CefBrowserHostImpl> frontend_browser_;
|
||||||
content::WebContents* inspected_contents_;
|
content::WebContents* inspected_contents_;
|
||||||
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
||||||
CefPoint inspect_element_at_;
|
CefPoint inspect_element_at_;
|
||||||
|
base::OnceClosure frontend_destroyed_callback_;
|
||||||
std::unique_ptr<content::DevToolsFrontendHost> frontend_host_;
|
std::unique_ptr<content::DevToolsFrontendHost> frontend_host_;
|
||||||
|
|
||||||
class NetworkResourceLoader;
|
class NetworkResourceLoader;
|
||||||
@@ -93,6 +101,9 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
|||||||
using ExtensionsAPIs = std::map<std::string, std::string>;
|
using ExtensionsAPIs = std::map<std::string, std::string>;
|
||||||
ExtensionsAPIs extensions_api_;
|
ExtensionsAPIs extensions_api_;
|
||||||
CefDevToolsFileManager file_manager_;
|
CefDevToolsFileManager file_manager_;
|
||||||
|
|
||||||
|
const base::FilePath protocol_log_file_;
|
||||||
|
|
||||||
base::WeakPtrFactory<CefDevToolsFrontend> weak_factory_;
|
base::WeakPtrFactory<CefDevToolsFrontend> weak_factory_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsFrontend);
|
DISALLOW_COPY_AND_ASSIGN(CefDevToolsFrontend);
|
||||||
|
200
libcef/browser/devtools/devtools_manager.cc
Normal file
200
libcef/browser/devtools/devtools_manager.cc
Normal file
@@ -0,0 +1,200 @@
|
|||||||
|
// 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;
|
||||||
|
}
|
69
libcef/browser/devtools/devtools_manager.h
Normal file
69
libcef/browser/devtools/devtools_manager.h
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
// 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_
|
@@ -132,9 +132,8 @@ CefDevToolsManagerDelegate::CreateNewTarget(const GURL& url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string CefDevToolsManagerDelegate::GetDiscoveryPageHTML() {
|
std::string CefDevToolsManagerDelegate::GetDiscoveryPageHTML() {
|
||||||
return ui::ResourceBundle::GetSharedInstance()
|
return ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||||
.GetRawDataResource(IDR_CEF_DEVTOOLS_DISCOVERY_PAGE)
|
IDR_CEF_DEVTOOLS_DISCOVERY_PAGE);
|
||||||
.as_string();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefDevToolsManagerDelegate::HasBundledFrontendResources() {
|
bool CefDevToolsManagerDelegate::HasBundledFrontendResources() {
|
||||||
|
131
libcef/browser/devtools/devtools_util.cc
Normal file
131
libcef/browser/devtools/devtools_util.cc
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
// 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
|
72
libcef/browser/devtools/devtools_util.h
Normal file
72
libcef/browser/devtools/devtools_util.h
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
// 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_
|
204
libcef/browser/devtools/devtools_util_unittest.cc
Normal file
204
libcef/browser/devtools/devtools_util_unittest.cc
Normal file
@@ -0,0 +1,204 @@
|
|||||||
|
// 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());
|
||||||
|
}
|
@@ -423,8 +423,8 @@ std::unique_ptr<api::tabs::Tab> CefExtensionFunctionDetails::CreateTabObject(
|
|||||||
tab_object->id = std::make_unique<int>(new_browser->GetIdentifier());
|
tab_object->id = std::make_unique<int>(new_browser->GetIdentifier());
|
||||||
tab_object->index = index;
|
tab_object->index = index;
|
||||||
tab_object->window_id = *tab_object->id;
|
tab_object->window_id = *tab_object->id;
|
||||||
tab_object->status = std::make_unique<std::string>(
|
tab_object->status = is_loading ? api::tabs::TAB_STATUS_LOADING
|
||||||
is_loading ? keys::kStatusValueLoading : keys::kStatusValueComplete);
|
: api::tabs::TAB_STATUS_COMPLETE;
|
||||||
tab_object->active = active;
|
tab_object->active = active;
|
||||||
tab_object->selected = true;
|
tab_object->selected = true;
|
||||||
tab_object->highlighted = true;
|
tab_object->highlighted = true;
|
||||||
|
@@ -492,6 +492,12 @@ void CefExtensionSystem::InstallUpdate(
|
|||||||
base::DeleteFile(temp_dir, true /* recursive */);
|
base::DeleteFile(temp_dir, true /* recursive */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefExtensionSystem::PerformActionBasedOnOmahaAttributes(
|
||||||
|
const std::string& extension_id,
|
||||||
|
const base::Value& attributes) {
|
||||||
|
NOTREACHED();
|
||||||
|
}
|
||||||
|
|
||||||
bool CefExtensionSystem::FinishDelayedInstallationIfReady(
|
bool CefExtensionSystem::FinishDelayedInstallationIfReady(
|
||||||
const std::string& extension_id,
|
const std::string& extension_id,
|
||||||
bool install_immediately) {
|
bool install_immediately) {
|
||||||
|
@@ -115,6 +115,9 @@ class CefExtensionSystem : public ExtensionSystem {
|
|||||||
const base::FilePath& temp_dir,
|
const base::FilePath& temp_dir,
|
||||||
bool install_immediately,
|
bool install_immediately,
|
||||||
InstallUpdateCallback install_update_callback) override;
|
InstallUpdateCallback install_update_callback) override;
|
||||||
|
void PerformActionBasedOnOmahaAttributes(
|
||||||
|
const std::string& extension_id,
|
||||||
|
const base::Value& attributes) override;
|
||||||
bool FinishDelayedInstallationIfReady(const std::string& extension_id,
|
bool FinishDelayedInstallationIfReady(const std::string& extension_id,
|
||||||
bool install_immediately) override;
|
bool install_immediately) override;
|
||||||
|
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
#include "extensions/browser/extension_host_delegate.h"
|
#include "extensions/browser/extension_host_delegate.h"
|
||||||
#include "extensions/browser/extensions_browser_interface_binders.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/guest_view/mime_handler_view/mime_handler_view_guest.h"
|
||||||
|
#include "extensions/browser/kiosk/kiosk_delegate.h"
|
||||||
#include "extensions/browser/url_request_util.h"
|
#include "extensions/browser/url_request_util.h"
|
||||||
#include "extensions/common/api/mime_handler.mojom.h"
|
#include "extensions/common/api/mime_handler.mojom.h"
|
||||||
#include "extensions/common/constants.h"
|
#include "extensions/common/constants.h"
|
||||||
@@ -74,6 +75,18 @@ void BindBeforeUnloadControl(
|
|||||||
guest_view->FuseBeforeUnloadControl(std::move(receiver));
|
guest_view->FuseBeforeUnloadControl(std::move(receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Dummy KiosDelegate that always returns false
|
||||||
|
class CefKioskDelegate : public extensions::KioskDelegate {
|
||||||
|
public:
|
||||||
|
CefKioskDelegate() = default;
|
||||||
|
~CefKioskDelegate() override = default;
|
||||||
|
|
||||||
|
// KioskDelegate overrides:
|
||||||
|
bool IsAutoLaunchedKioskApp(const ExtensionId& id) const override {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
CefExtensionsBrowserClient::CefExtensionsBrowserClient()
|
CefExtensionsBrowserClient::CefExtensionsBrowserClient()
|
||||||
@@ -167,7 +180,7 @@ void CefExtensionsBrowserClient::LoadResourceFromResourceBundle(
|
|||||||
|
|
||||||
bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
bool CefExtensionsBrowserClient::AllowCrossRendererResourceLoad(
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
content::ResourceType resource_type,
|
blink::mojom::ResourceType resource_type,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
int child_id,
|
int child_id,
|
||||||
bool is_incognito,
|
bool is_incognito,
|
||||||
@@ -295,7 +308,7 @@ CefExtensionsBrowserClient::GetExtensionSystemFactory() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefExtensionsBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
void CefExtensionsBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map,
|
mojo::BinderMapWithContext<content::RenderFrameHost*>* map,
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const Extension* extension) const {
|
const Extension* extension) const {
|
||||||
PopulateExtensionFrameBinders(map, render_frame_host, extension);
|
PopulateExtensionFrameBinders(map, render_frame_host, extension);
|
||||||
@@ -351,8 +364,9 @@ CefExtensionsBrowserClient::GetExtensionWebContentsObserver(
|
|||||||
}
|
}
|
||||||
|
|
||||||
KioskDelegate* CefExtensionsBrowserClient::GetKioskDelegate() {
|
KioskDelegate* CefExtensionsBrowserClient::GetKioskDelegate() {
|
||||||
NOTREACHED();
|
if (!kiosk_delegate_)
|
||||||
return nullptr;
|
kiosk_delegate_.reset(new CefKioskDelegate());
|
||||||
|
return kiosk_delegate_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefExtensionsBrowserClient::IsLockScreenContext(
|
bool CefExtensionsBrowserClient::IsLockScreenContext(
|
||||||
|
@@ -55,7 +55,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
|||||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||||
bool send_cors_header) override;
|
bool send_cors_header) override;
|
||||||
bool AllowCrossRendererResourceLoad(const GURL& url,
|
bool AllowCrossRendererResourceLoad(const GURL& url,
|
||||||
content::ResourceType resource_type,
|
blink::mojom::ResourceType resource_type,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
int child_id,
|
int child_id,
|
||||||
bool is_incognito,
|
bool is_incognito,
|
||||||
@@ -82,8 +82,7 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
|||||||
bool IsLoggedInAsPublicAccount() override;
|
bool IsLoggedInAsPublicAccount() override;
|
||||||
ExtensionSystemProvider* GetExtensionSystemFactory() override;
|
ExtensionSystemProvider* GetExtensionSystemFactory() override;
|
||||||
void RegisterBrowserInterfaceBindersForFrame(
|
void RegisterBrowserInterfaceBindersForFrame(
|
||||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>*
|
mojo::BinderMapWithContext<content::RenderFrameHost*>* binder_map,
|
||||||
binder_map,
|
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const Extension* extension) const override;
|
const Extension* extension) const override;
|
||||||
std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
|
std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
|
||||||
@@ -111,6 +110,8 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
|||||||
// Resource manager used to supply resources from pak files.
|
// Resource manager used to supply resources from pak files.
|
||||||
std::unique_ptr<ComponentExtensionResourceManager> resource_manager_;
|
std::unique_ptr<ComponentExtensionResourceManager> resource_manager_;
|
||||||
|
|
||||||
|
std::unique_ptr<KioskDelegate> kiosk_delegate_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CefExtensionsBrowserClient);
|
DISALLOW_COPY_AND_ASSIGN(CefExtensionsBrowserClient);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -32,9 +32,9 @@ const char kPdfResourceIdentifier[] = "chromium-pdf";
|
|||||||
const char kPdfPluginName[] = "Chrome PDF Viewer";
|
const char kPdfPluginName[] = "Chrome PDF Viewer";
|
||||||
|
|
||||||
std::string GetManifest() {
|
std::string GetManifest() {
|
||||||
std::string manifest_contents = ui::ResourceBundle::GetSharedInstance()
|
std::string manifest_contents =
|
||||||
.GetRawDataResource(IDR_PDF_MANIFEST)
|
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||||
.as_string();
|
IDR_PDF_MANIFEST);
|
||||||
DCHECK(manifest_contents.find(kNameTag) != std::string::npos);
|
DCHECK(manifest_contents.find(kNameTag) != std::string::npos);
|
||||||
base::ReplaceFirstSubstringAfterOffset(&manifest_contents, 0, kNameTag,
|
base::ReplaceFirstSubstringAfterOffset(&manifest_contents, 0, kNameTag,
|
||||||
kPdfPluginName);
|
kPdfPluginName);
|
||||||
|
@@ -4,6 +4,84 @@
|
|||||||
|
|
||||||
#include "libcef/browser/media_router/media_sink_impl.h"
|
#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)
|
CefMediaSinkImpl::CefMediaSinkImpl(const media_router::MediaSink& sink)
|
||||||
: sink_(sink) {}
|
: sink_(sink) {}
|
||||||
|
|
||||||
@@ -36,6 +114,11 @@ CefMediaSink::IconType CefMediaSinkImpl::GetIconType() {
|
|||||||
return static_cast<CefMediaSink::IconType>(sink_.icon_type());
|
return static_cast<CefMediaSink::IconType>(sink_.icon_type());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefMediaSinkImpl::GetDeviceInfo(
|
||||||
|
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||||
|
::GetDeviceInfo(sink_.id(), callback);
|
||||||
|
}
|
||||||
|
|
||||||
bool CefMediaSinkImpl::IsCastSink() {
|
bool CefMediaSinkImpl::IsCastSink() {
|
||||||
return sink_.provider_id() == media_router::CAST;
|
return sink_.provider_id() == media_router::CAST;
|
||||||
}
|
}
|
||||||
|
@@ -23,6 +23,8 @@ class CefMediaSinkImpl : public CefMediaSink {
|
|||||||
CefString GetName() override;
|
CefString GetName() override;
|
||||||
CefString GetDescription() override;
|
CefString GetDescription() override;
|
||||||
IconType GetIconType() override;
|
IconType GetIconType() override;
|
||||||
|
void GetDeviceInfo(
|
||||||
|
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) override;
|
||||||
bool IsCastSink() override;
|
bool IsCastSink() override;
|
||||||
bool IsDialSink() override;
|
bool IsDialSink() override;
|
||||||
bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) override;
|
bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) override;
|
||||||
|
@@ -11,8 +11,8 @@
|
|||||||
#include "libcef/browser/menu_runner.h"
|
#include "libcef/browser/menu_runner.h"
|
||||||
|
|
||||||
#include "base/memory/weak_ptr.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/browser/web_contents_observer.h"
|
||||||
#include "content/public/common/context_menu_params.h"
|
|
||||||
|
|
||||||
namespace content {
|
namespace content {
|
||||||
class RenderFrameHost;
|
class RenderFrameHost;
|
||||||
|
@@ -15,7 +15,9 @@
|
|||||||
#include "base/message_loop/message_loop.h"
|
#include "base/message_loop/message_loop.h"
|
||||||
#include "content/public/common/menu_item.h"
|
#include "content/public/common/menu_item.h"
|
||||||
#include "ui/base/accelerators/accelerator.h"
|
#include "ui/base/accelerators/accelerator.h"
|
||||||
|
#include "ui/base/models/image_model.h"
|
||||||
#include "ui/gfx/geometry/point.h"
|
#include "ui/gfx/geometry/point.h"
|
||||||
|
#include "ui/gfx/image/image.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -104,7 +106,9 @@ class CefSimpleMenuModel : public ui::MenuModel {
|
|||||||
return impl_->GetGroupIdAt(index);
|
return impl_->GetGroupIdAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GetIconAt(int index, gfx::Image* icon) const override { return false; }
|
ui::ImageModel GetIconAt(int index) const override {
|
||||||
|
return ui::ImageModel();
|
||||||
|
}
|
||||||
|
|
||||||
ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const override {
|
ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const override {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@@ -258,10 +258,10 @@ void CefBrowserPlatformDelegate::HandleExternalProtocol(const GURL& url) {}
|
|||||||
|
|
||||||
CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle(
|
CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle(
|
||||||
const content::NativeWebKeyboardEvent& event) const {
|
const content::NativeWebKeyboardEvent& event) const {
|
||||||
if (!event.os_event)
|
// TODO(cef): We need to return an XEvent* from this method, but
|
||||||
return nullptr;
|
// |event.os_event->native_event()| now returns a ui::Event* instead.
|
||||||
return const_cast<CefEventHandle>(
|
// See https://crbug.com/965991.
|
||||||
static_cast<CefEventHandle>(event.os_event->native_event()));
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<CefMenuRunner>
|
std::unique_ptr<CefMenuRunner>
|
||||||
|
@@ -394,9 +394,9 @@ gfx::Size CefBrowserPlatformDelegateNativeMac::GetMaximumDialogSize() {
|
|||||||
content::NativeWebKeyboardEvent
|
content::NativeWebKeyboardEvent
|
||||||
CefBrowserPlatformDelegateNativeMac::TranslateWebKeyEvent(
|
CefBrowserPlatformDelegateNativeMac::TranslateWebKeyEvent(
|
||||||
const CefKeyEvent& key_event) const {
|
const CefKeyEvent& key_event) const {
|
||||||
content::NativeWebKeyboardEvent result(blink::WebInputEvent::kUndefined,
|
content::NativeWebKeyboardEvent result(
|
||||||
blink::WebInputEvent::kNoModifiers,
|
blink::WebInputEvent::Type::kUndefined,
|
||||||
ui::EventTimeForNow());
|
blink::WebInputEvent::Modifiers::kNoModifiers, ui::EventTimeForNow());
|
||||||
|
|
||||||
// Use a synthetic NSEvent in order to obtain the windowsKeyCode member from
|
// Use a synthetic NSEvent in order to obtain the windowsKeyCode member from
|
||||||
// the NativeWebKeyboardEvent constructor. This is the only member which can
|
// the NativeWebKeyboardEvent constructor. This is the only member which can
|
||||||
@@ -444,7 +444,7 @@ CefBrowserPlatformDelegateNativeMac::TranslateWebKeyEvent(
|
|||||||
|
|
||||||
result = content::NativeWebKeyboardEvent(synthetic_event);
|
result = content::NativeWebKeyboardEvent(synthetic_event);
|
||||||
if (key_event.type == KEYEVENT_CHAR)
|
if (key_event.type == KEYEVENT_CHAR)
|
||||||
result.SetType(blink::WebInputEvent::kChar);
|
result.SetType(blink::WebInputEvent::Type::kChar);
|
||||||
|
|
||||||
result.is_system_key = key_event.is_system_key;
|
result.is_system_key = key_event.is_system_key;
|
||||||
|
|
||||||
@@ -462,18 +462,18 @@ CefBrowserPlatformDelegateNativeMac::TranslateWebClickEvent(
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MBT_LEFT:
|
case MBT_LEFT:
|
||||||
result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp
|
result.SetType(mouseUp ? blink::WebInputEvent::Type::kMouseUp
|
||||||
: blink::WebInputEvent::kMouseDown);
|
: blink::WebInputEvent::Type::kMouseDown);
|
||||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||||
break;
|
break;
|
||||||
case MBT_MIDDLE:
|
case MBT_MIDDLE:
|
||||||
result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp
|
result.SetType(mouseUp ? blink::WebInputEvent::Type::kMouseUp
|
||||||
: blink::WebInputEvent::kMouseDown);
|
: blink::WebInputEvent::Type::kMouseDown);
|
||||||
result.button = blink::WebMouseEvent::Button::kMiddle;
|
result.button = blink::WebMouseEvent::Button::kMiddle;
|
||||||
break;
|
break;
|
||||||
case MBT_RIGHT:
|
case MBT_RIGHT:
|
||||||
result.SetType(mouseUp ? blink::WebInputEvent::kMouseUp
|
result.SetType(mouseUp ? blink::WebInputEvent::Type::kMouseUp
|
||||||
: blink::WebInputEvent::kMouseDown);
|
: blink::WebInputEvent::Type::kMouseDown);
|
||||||
result.button = blink::WebMouseEvent::Button::kRight;
|
result.button = blink::WebMouseEvent::Button::kRight;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -492,7 +492,7 @@ blink::WebMouseEvent CefBrowserPlatformDelegateNativeMac::TranslateWebMoveEvent(
|
|||||||
TranslateWebMouseEvent(result, mouse_event);
|
TranslateWebMouseEvent(result, mouse_event);
|
||||||
|
|
||||||
if (!mouseLeave) {
|
if (!mouseLeave) {
|
||||||
result.SetType(blink::WebInputEvent::kMouseMove);
|
result.SetType(blink::WebInputEvent::Type::kMouseMove);
|
||||||
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||||
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
|
else if (mouse_event.modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
|
||||||
@@ -502,7 +502,7 @@ blink::WebMouseEvent CefBrowserPlatformDelegateNativeMac::TranslateWebMoveEvent(
|
|||||||
else
|
else
|
||||||
result.button = blink::WebMouseEvent::Button::kNoButton;
|
result.button = blink::WebMouseEvent::Button::kNoButton;
|
||||||
} else {
|
} else {
|
||||||
result.SetType(blink::WebInputEvent::kMouseLeave);
|
result.SetType(blink::WebInputEvent::Type::kMouseLeave);
|
||||||
result.button = blink::WebMouseEvent::Button::kNoButton;
|
result.button = blink::WebMouseEvent::Button::kNoButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,15 +519,14 @@ CefBrowserPlatformDelegateNativeMac::TranslateWebWheelEvent(
|
|||||||
blink::WebMouseWheelEvent result;
|
blink::WebMouseWheelEvent result;
|
||||||
TranslateWebMouseEvent(result, mouse_event);
|
TranslateWebMouseEvent(result, mouse_event);
|
||||||
|
|
||||||
result.SetType(blink::WebInputEvent::kMouseWheel);
|
result.SetType(blink::WebInputEvent::Type::kMouseWheel);
|
||||||
|
|
||||||
static const double scrollbarPixelsPerCocoaTick = 40.0;
|
static const double scrollbarPixelsPerCocoaTick = 40.0;
|
||||||
result.delta_x = deltaX;
|
result.delta_x = deltaX;
|
||||||
result.delta_y = deltaY;
|
result.delta_y = deltaY;
|
||||||
result.wheel_ticks_x = deltaX / scrollbarPixelsPerCocoaTick;
|
result.wheel_ticks_x = deltaX / scrollbarPixelsPerCocoaTick;
|
||||||
result.wheel_ticks_y = deltaY / scrollbarPixelsPerCocoaTick;
|
result.wheel_ticks_y = deltaY / scrollbarPixelsPerCocoaTick;
|
||||||
result.delta_units =
|
result.delta_units = ui::ScrollGranularity::kScrollByPrecisePixel;
|
||||||
ui::input_types::ScrollGranularity::kScrollByPrecisePixel;
|
|
||||||
|
|
||||||
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
if (mouse_event.modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||||
result.button = blink::WebMouseEvent::Button::kLeft;
|
result.button = blink::WebMouseEvent::Button::kLeft;
|
||||||
|
@@ -374,13 +374,13 @@ bool CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch (event.GetType()) {
|
switch (event.GetType()) {
|
||||||
case blink::WebInputEvent::kRawKeyDown:
|
case blink::WebInputEvent::Type::kRawKeyDown:
|
||||||
msg.message = event.is_system_key ? WM_SYSKEYDOWN : WM_KEYDOWN;
|
msg.message = event.is_system_key ? WM_SYSKEYDOWN : WM_KEYDOWN;
|
||||||
break;
|
break;
|
||||||
case blink::WebInputEvent::kKeyUp:
|
case blink::WebInputEvent::Type::kKeyUp:
|
||||||
msg.message = event.is_system_key ? WM_SYSKEYUP : WM_KEYUP;
|
msg.message = event.is_system_key ? WM_SYSKEYUP : WM_KEYUP;
|
||||||
break;
|
break;
|
||||||
case blink::WebInputEvent::kChar:
|
case blink::WebInputEvent::Type::kChar:
|
||||||
msg.message = event.is_system_key ? WM_SYSCHAR : WM_CHAR;
|
msg.message = event.is_system_key ? WM_SYSCHAR : WM_CHAR;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@@ -79,6 +79,31 @@ std::wstring FormatFilterForExtensions(
|
|||||||
|
|
||||||
std::wstring result;
|
std::wstring result;
|
||||||
|
|
||||||
|
// Create all supported .ext filter if more than one filter.
|
||||||
|
if (file_ext.size() > 1) {
|
||||||
|
std::set<base::WStringPiece> unique_exts;
|
||||||
|
for (const auto& exts : file_ext) {
|
||||||
|
for (const auto& ext : base::SplitStringPiece(
|
||||||
|
exts, L";", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY)) {
|
||||||
|
unique_exts.insert(ext);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unique_exts.size() > 1) {
|
||||||
|
std::wstring ext;
|
||||||
|
auto it = unique_exts.cbegin();
|
||||||
|
ext = it->as_string();
|
||||||
|
for (++it; it != unique_exts.cend(); ++it) {
|
||||||
|
ext += L";" + it->as_string();
|
||||||
|
}
|
||||||
|
std::wstring desc =
|
||||||
|
l10n_util::GetStringUTF16(IDS_CUSTOM_FILES) + L" (" + ext + L")";
|
||||||
|
|
||||||
|
result.append(desc.c_str(), desc.size() + 1); // Append NULL too.
|
||||||
|
result.append(ext.c_str(), ext.size() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < file_ext.size(); ++i) {
|
for (size_t i = 0; i < file_ext.size(); ++i) {
|
||||||
std::wstring ext = file_ext[i];
|
std::wstring ext = file_ext[i];
|
||||||
std::wstring desc;
|
std::wstring desc;
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#include "ui/base/accelerators/accelerator.h"
|
#include "ui/base/accelerators/accelerator.h"
|
||||||
#include "ui/base/l10n/l10n_util.h"
|
#include "ui/base/l10n/l10n_util.h"
|
||||||
#include "ui/base/l10n/l10n_util_win.h"
|
#include "ui/base/l10n/l10n_util_win.h"
|
||||||
|
#include "ui/base/models/image_model.h"
|
||||||
#include "ui/base/models/menu_model.h"
|
#include "ui/base/models/menu_model.h"
|
||||||
#include "ui/events/keycodes/keyboard_codes.h"
|
#include "ui/events/keycodes/keyboard_codes.h"
|
||||||
#include "ui/gfx/canvas.h"
|
#include "ui/gfx/canvas.h"
|
||||||
@@ -30,6 +31,7 @@
|
|||||||
#include "ui/gfx/text_utils.h"
|
#include "ui/gfx/text_utils.h"
|
||||||
#include "ui/gfx/win/hwnd_util.h"
|
#include "ui/gfx/win/hwnd_util.h"
|
||||||
#include "ui/native_theme/native_theme.h"
|
#include "ui/native_theme/native_theme.h"
|
||||||
|
#include "ui/native_theme/themed_vector_icon.h"
|
||||||
#include "ui/views/controls/menu/menu_config.h"
|
#include "ui/views/controls/menu/menu_config.h"
|
||||||
#include "ui/views/controls/menu/menu_insertion_delegate_win.h"
|
#include "ui/views/controls/menu/menu_insertion_delegate_win.h"
|
||||||
|
|
||||||
@@ -288,10 +290,18 @@ class CefNativeMenuWin::MenuHostWindow {
|
|||||||
|
|
||||||
// Draw the icon after the label, otherwise it would be covered
|
// Draw the icon after the label, otherwise it would be covered
|
||||||
// by the label.
|
// by the label.
|
||||||
gfx::Image icon;
|
ui::ImageModel icon =
|
||||||
if (data->native_menu_win->model_->GetIconAt(data->model_index, &icon)) {
|
data->native_menu_win->model_->GetIconAt(data->model_index);
|
||||||
|
if (icon.IsImage() || icon.IsVectorIcon()) {
|
||||||
|
ui::NativeTheme* native_theme =
|
||||||
|
ui::NativeTheme::GetInstanceForNativeUi();
|
||||||
|
|
||||||
// We currently don't support items with both icons and checkboxes.
|
// We currently don't support items with both icons and checkboxes.
|
||||||
const gfx::ImageSkia skia_icon = icon.AsImageSkia();
|
const gfx::ImageSkia skia_icon =
|
||||||
|
icon.IsImage() ? icon.GetImage().AsImageSkia()
|
||||||
|
: ui::ThemedVectorIcon(icon.GetVectorIcon())
|
||||||
|
.GetImageSkia(native_theme, 16);
|
||||||
|
|
||||||
DCHECK(type != ui::MenuModel::TYPE_CHECK);
|
DCHECK(type != ui::MenuModel::TYPE_CHECK);
|
||||||
std::unique_ptr<SkCanvas> canvas = skia::CreatePlatformCanvas(
|
std::unique_ptr<SkCanvas> canvas = skia::CreatePlatformCanvas(
|
||||||
skia_icon.width(), skia_icon.height(), false);
|
skia_icon.width(), skia_icon.height(), false);
|
||||||
|
@@ -8,8 +8,9 @@
|
|||||||
|
|
||||||
#include "ui/base/x/x11_util.h"
|
#include "ui/base/x/x11_util.h"
|
||||||
#include "ui/events/platform/platform_event_source.h"
|
#include "ui/events/platform/platform_event_source.h"
|
||||||
|
#include "ui/events/x/x11_event_translation.h"
|
||||||
|
#include "ui/platform_window/x11/x11_topmost_window_finder.h"
|
||||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
|
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
|
||||||
#include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h"
|
|
||||||
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
@@ -28,13 +29,6 @@ const char kNetWMState[] = "_NET_WM_STATE";
|
|||||||
const char kXdndProxy[] = "XdndProxy";
|
const char kXdndProxy[] = "XdndProxy";
|
||||||
const char kUTF8String[] = "UTF8_STRING";
|
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 FindChild(::Display* display, ::Window window) {
|
||||||
::Window root;
|
::Window root;
|
||||||
::Window parent;
|
::Window parent;
|
||||||
@@ -109,8 +103,8 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
|||||||
CWBackPixmap | CWOverrideRedirect, &swa);
|
CWBackPixmap | CWOverrideRedirect, &swa);
|
||||||
CHECK(xwindow_);
|
CHECK(xwindow_);
|
||||||
|
|
||||||
if (ui::PlatformEventSource::GetInstance())
|
DCHECK(ui::X11EventSource::HasInstance());
|
||||||
ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
ui::X11EventSource::GetInstance()->AddXEventDispatcher(this);
|
||||||
|
|
||||||
long event_mask = FocusChangeMask | StructureNotifyMask | PropertyChangeMask;
|
long event_mask = FocusChangeMask | StructureNotifyMask | PropertyChangeMask;
|
||||||
XSelectInput(xdisplay_, xwindow_, event_mask);
|
XSelectInput(xdisplay_, xwindow_, event_mask);
|
||||||
@@ -148,8 +142,8 @@ CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
|||||||
|
|
||||||
CefWindowX11::~CefWindowX11() {
|
CefWindowX11::~CefWindowX11() {
|
||||||
DCHECK(!xwindow_);
|
DCHECK(!xwindow_);
|
||||||
if (ui::PlatformEventSource::GetInstance())
|
DCHECK(ui::X11EventSource::HasInstance());
|
||||||
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
ui::X11EventSource::GetInstance()->RemoveXEventDispatcher(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefWindowX11::Close() {
|
void CefWindowX11::Close() {
|
||||||
@@ -288,12 +282,88 @@ views::DesktopWindowTreeHostX11* CefWindowX11::GetHost() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CefWindowX11::CanDispatchEvent(const ui::PlatformEvent& event) {
|
bool CefWindowX11::CanDispatchEvent(const ui::PlatformEvent& event) {
|
||||||
::Window target = FindEventTarget(event);
|
DCHECK_NE(xwindow_, x11::None);
|
||||||
return target == xwindow_;
|
return !!current_xevent_;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
||||||
XEvent* xev = 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) {
|
||||||
switch (xev->type) {
|
switch (xev->type) {
|
||||||
case ConfigureNotify: {
|
case ConfigureNotify: {
|
||||||
DCHECK_EQ(xwindow_, xev->xconfigure.event);
|
DCHECK_EQ(xwindow_, xev->xconfigure.event);
|
||||||
@@ -402,45 +472,4 @@ uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
|
|||||||
break;
|
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,6 +16,7 @@ typedef struct _XDisplay Display;
|
|||||||
|
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "ui/events/platform/platform_event_dispatcher.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/geometry/rect.h"
|
||||||
#include "ui/gfx/x/x11_atom_cache.h"
|
#include "ui/gfx/x/x11_atom_cache.h"
|
||||||
|
|
||||||
@@ -25,7 +26,8 @@ class DesktopWindowTreeHostX11;
|
|||||||
|
|
||||||
// Object wrapper for an X11 Window.
|
// Object wrapper for an X11 Window.
|
||||||
// Based on WindowTreeHostX11 and DesktopWindowTreeHostX11.
|
// Based on WindowTreeHostX11 and DesktopWindowTreeHostX11.
|
||||||
class CefWindowX11 : public ui::PlatformEventDispatcher {
|
class CefWindowX11 : public ui::PlatformEventDispatcher,
|
||||||
|
public ui::XEventDispatcher {
|
||||||
public:
|
public:
|
||||||
CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
CefWindowX11(CefRefPtr<CefBrowserHostImpl> browser,
|
||||||
::Window parent_xwindow,
|
::Window parent_xwindow,
|
||||||
@@ -50,6 +52,12 @@ class CefWindowX11 : public ui::PlatformEventDispatcher {
|
|||||||
bool CanDispatchEvent(const ui::PlatformEvent& event) override;
|
bool CanDispatchEvent(const ui::PlatformEvent& event) override;
|
||||||
uint32_t DispatchEvent(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_; }
|
::Window xwindow() const { return xwindow_; }
|
||||||
gfx::Rect bounds() const { return bounds_; }
|
gfx::Rect bounds() const { return bounds_; }
|
||||||
|
|
||||||
@@ -58,6 +66,9 @@ class CefWindowX11 : public ui::PlatformEventDispatcher {
|
|||||||
private:
|
private:
|
||||||
void ContinueFocus();
|
void ContinueFocus();
|
||||||
|
|
||||||
|
bool IsTargetedBy(const XEvent& xev) const;
|
||||||
|
void ProcessXEvent(XEvent* xev);
|
||||||
|
|
||||||
CefRefPtr<CefBrowserHostImpl> browser_;
|
CefRefPtr<CefBrowserHostImpl> browser_;
|
||||||
|
|
||||||
// The display and the native X window hosting the root window.
|
// The display and the native X window hosting the root window.
|
||||||
@@ -73,6 +84,11 @@ class CefWindowX11 : public ui::PlatformEventDispatcher {
|
|||||||
|
|
||||||
bool focus_pending_;
|
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.
|
// Must always be the last member.
|
||||||
base::WeakPtrFactory<CefWindowX11> weak_ptr_factory_;
|
base::WeakPtrFactory<CefWindowX11> weak_ptr_factory_;
|
||||||
|
|
||||||
|
@@ -43,6 +43,7 @@
|
|||||||
#include "content/public/common/url_utils.h"
|
#include "content/public/common/url_utils.h"
|
||||||
#include "content/public/common/user_agent.h"
|
#include "content/public/common/user_agent.h"
|
||||||
#include "ipc/ipc_channel.h"
|
#include "ipc/ipc_channel.h"
|
||||||
|
#include "ui/base/resource/resource_bundle.h"
|
||||||
#include "v8/include/v8.h"
|
#include "v8/include/v8.h"
|
||||||
|
|
||||||
using extensions::api::cef::kSupportedAPIs;
|
using extensions::api::cef::kSupportedAPIs;
|
||||||
@@ -74,6 +75,7 @@ const char* kAllowedWebUIHosts[] = {
|
|||||||
content::kChromeUIAppCacheInternalsHost,
|
content::kChromeUIAppCacheInternalsHost,
|
||||||
chrome::kChromeUIAccessibilityHost,
|
chrome::kChromeUIAccessibilityHost,
|
||||||
content::kChromeUIBlobInternalsHost,
|
content::kChromeUIBlobInternalsHost,
|
||||||
|
chrome::kChromeUIChromeURLsHost,
|
||||||
chrome::kChromeUICreditsHost,
|
chrome::kChromeUICreditsHost,
|
||||||
kChromeUIExtensionsSupportHost,
|
kChromeUIExtensionsSupportHost,
|
||||||
content::kChromeUIGpuHost,
|
content::kChromeUIGpuHost,
|
||||||
@@ -118,6 +120,7 @@ const struct {
|
|||||||
const char* host;
|
const char* host;
|
||||||
ChromeHostId host_id;
|
ChromeHostId host_id;
|
||||||
} kAllowedCefHosts[] = {
|
} kAllowedCefHosts[] = {
|
||||||
|
{chrome::kChromeUIChromeURLsHost, CHROME_WEBUI_HOSTS},
|
||||||
{kChromeUIExtensionsSupportHost, CHROME_EXTENSIONS_SUPPORT},
|
{kChromeUIExtensionsSupportHost, CHROME_EXTENSIONS_SUPPORT},
|
||||||
{kChromeUILicenseHost, CHROME_LICENSE},
|
{kChromeUILicenseHost, CHROME_LICENSE},
|
||||||
{chrome::kChromeUIVersionHost, CHROME_VERSION},
|
{chrome::kChromeUIVersionHost, CHROME_VERSION},
|
||||||
@@ -341,16 +344,17 @@ bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
||||||
base::StringPiece piece = CefContentClient::Get()->GetDataResource(
|
std::string piece =
|
||||||
IDR_CEF_LICENSE_TXT, ui::SCALE_FACTOR_NONE);
|
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||||
|
IDR_CEF_LICENSE_TXT);
|
||||||
if (piece.empty()) {
|
if (piece.empty()) {
|
||||||
NOTREACHED() << "Failed to load license txt resource.";
|
NOTREACHED() << "Failed to load license txt resource.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*mime_type = "text/html";
|
*mime_type = "text/html";
|
||||||
*output = "<html><head><title>License</title></head><body><pre>" +
|
*output = "<html><head><title>License</title></head><body><pre>" + piece +
|
||||||
piece.as_string() + "</pre></body></html>";
|
"</pre></body></html>";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -358,9 +362,10 @@ bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
|||||||
bool OnVersionUI(Profile* profile,
|
bool OnVersionUI(Profile* profile,
|
||||||
std::string* mime_type,
|
std::string* mime_type,
|
||||||
std::string* output) {
|
std::string* output) {
|
||||||
base::StringPiece piece = CefContentClient::Get()->GetDataResource(
|
std::string tmpl =
|
||||||
IDR_CEF_VERSION_HTML, ui::SCALE_FACTOR_NONE);
|
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||||
if (piece.empty()) {
|
IDR_CEF_VERSION_HTML);
|
||||||
|
if (tmpl.empty()) {
|
||||||
NOTREACHED() << "Failed to load version html resource.";
|
NOTREACHED() << "Failed to load version html resource.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -381,7 +386,6 @@ bool OnVersionUI(Profile* profile,
|
|||||||
parser.Add("MODULEPATH", GetModulePath());
|
parser.Add("MODULEPATH", GetModulePath());
|
||||||
parser.Add("CACHEPATH", CefString(profile->GetPath().value()));
|
parser.Add("CACHEPATH", CefString(profile->GetPath().value()));
|
||||||
|
|
||||||
std::string tmpl = piece.as_string();
|
|
||||||
parser.Parse(&tmpl);
|
parser.Parse(&tmpl);
|
||||||
|
|
||||||
*mime_type = "text/html";
|
*mime_type = "text/html";
|
||||||
@@ -392,8 +396,8 @@ bool OnVersionUI(Profile* profile,
|
|||||||
|
|
||||||
bool OnWebUIHostsUI(std::string* mime_type, std::string* output) {
|
bool OnWebUIHostsUI(std::string* mime_type, std::string* output) {
|
||||||
std::string html =
|
std::string html =
|
||||||
"<html>\n<head><title>WebUI Hosts</title></head>\n"
|
"<html>\n<head><title>Chrome URLs</title></head>\n"
|
||||||
"<body bgcolor=\"white\"><h3>WebUI Hosts</h3>\n<ul>\n";
|
"<body bgcolor=\"white\"><h3>List of Chrome URLs</h3>\n<ul>\n";
|
||||||
|
|
||||||
std::vector<std::string> list;
|
std::vector<std::string> list;
|
||||||
GetAllowedHosts(&list);
|
GetAllowedHosts(&list);
|
||||||
|
@@ -158,13 +158,15 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory {
|
|||||||
action.mime_type = GetMimeType(url.path());
|
action.mime_type = GetMimeType(url.path());
|
||||||
|
|
||||||
if (!action.bytes && action.resource_id >= 0) {
|
if (!action.bytes && action.resource_id >= 0) {
|
||||||
action.bytes =
|
std::string str =
|
||||||
CefContentClient::Get()->GetDataResourceBytes(action.resource_id);
|
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||||
if (!action.bytes) {
|
action.resource_id);
|
||||||
|
if (str.empty()) {
|
||||||
NOTREACHED() << "Failed to load internal resource for id: "
|
NOTREACHED() << "Failed to load internal resource for id: "
|
||||||
<< action.resource_id << " URL: " << url.spec().c_str();
|
<< action.resource_id << " URL: " << url.spec().c_str();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
action.bytes = base::RefCountedString::TakeString(&str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action.bytes) {
|
if (action.bytes) {
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
#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.h"
|
||||||
#include "services/network/public/cpp/simple_url_loader_stream_consumer.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 {
|
namespace {
|
||||||
|
|
||||||
@@ -254,6 +255,21 @@ class CefBrowserURLRequest::Context
|
|||||||
|
|
||||||
resource_request->render_frame_id = render_frame_id;
|
resource_request->render_frame_id = render_frame_id;
|
||||||
|
|
||||||
|
// Behave the same as a subresource load.
|
||||||
|
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->force_ignore_site_for_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
|
// SimpleURLLoader is picky about the body contents. Try to populate them
|
||||||
// correctly below.
|
// correctly below.
|
||||||
auto request_body = resource_request->request_body;
|
auto request_body = resource_request->request_body;
|
||||||
|
@@ -125,7 +125,7 @@ void SaveCookiesOnUIThread(content::BrowserContext* browser_context,
|
|||||||
for (const auto& cookie : cookies) {
|
for (const auto& cookie : cookies) {
|
||||||
progress->num_cookie_lines_left_++;
|
progress->num_cookie_lines_left_++;
|
||||||
cookie_manager->SetCanonicalCookie(
|
cookie_manager->SetCanonicalCookie(
|
||||||
cookie, url.scheme(), options,
|
cookie, url, options,
|
||||||
base::BindOnce(&SetCanonicalCookieCallback, base::Unretained(progress),
|
base::BindOnce(&SetCanonicalCookieCallback, base::Unretained(progress),
|
||||||
cookie));
|
cookie));
|
||||||
}
|
}
|
||||||
@@ -158,7 +158,7 @@ void LoadCookies(content::BrowserContext* browser_context,
|
|||||||
options.set_same_site_cookie_context(
|
options.set_same_site_cookie_context(
|
||||||
net::cookie_util::ComputeSameSiteContextForRequest(
|
net::cookie_util::ComputeSameSiteContextForRequest(
|
||||||
request.method, request.url, request.site_for_cookies,
|
request.method, request.url, request.site_for_cookies,
|
||||||
request.request_initiator, request.attach_same_site_cookies));
|
request.request_initiator, request.force_ignore_site_for_cookies));
|
||||||
|
|
||||||
CEF_POST_TASK(
|
CEF_POST_TASK(
|
||||||
CEF_UIT,
|
CEF_UIT,
|
||||||
@@ -192,7 +192,7 @@ void SaveCookies(content::BrowserContext* browser_context,
|
|||||||
options.set_same_site_cookie_context(
|
options.set_same_site_cookie_context(
|
||||||
net::cookie_util::ComputeSameSiteContextForRequest(
|
net::cookie_util::ComputeSameSiteContextForRequest(
|
||||||
request.method, request.url, request.site_for_cookies,
|
request.method, request.url, request.site_for_cookies,
|
||||||
request.request_initiator, request.attach_same_site_cookies));
|
request.request_initiator, request.force_ignore_site_for_cookies));
|
||||||
|
|
||||||
const base::StringPiece name(net_service::kHTTPSetCookieHeaderName);
|
const base::StringPiece name(net_service::kHTTPSetCookieHeaderName);
|
||||||
std::string cookie_string;
|
std::string cookie_string;
|
||||||
|
@@ -47,6 +47,9 @@ void SetCookieCallbackImpl(CefRefPtr<CefSetCookieCallback> callback,
|
|||||||
net::CanonicalCookie::CookieInclusionStatus status) {
|
net::CanonicalCookie::CookieInclusionStatus status) {
|
||||||
if (!callback.get())
|
if (!callback.get())
|
||||||
return;
|
return;
|
||||||
|
if (!status.IsInclude()) {
|
||||||
|
LOG(WARNING) << "SetCookie failed with reason: " << status.GetDebugString();
|
||||||
|
}
|
||||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefSetCookieCallback::OnComplete,
|
CEF_POST_TASK(CEF_UIT, base::Bind(&CefSetCookieCallback::OnComplete,
|
||||||
callback.get(), status.IsInclude()));
|
callback.get(), status.IsInclude()));
|
||||||
}
|
}
|
||||||
@@ -203,6 +206,8 @@ bool CefCookieManagerImpl::VisitUrlCookies(
|
|||||||
net::CookieOptions options;
|
net::CookieOptions options;
|
||||||
if (includeHttpOnly)
|
if (includeHttpOnly)
|
||||||
options.set_include_httponly();
|
options.set_include_httponly();
|
||||||
|
options.set_same_site_cookie_context(
|
||||||
|
net::CookieOptions::SameSiteCookieContext::MakeInclusive());
|
||||||
|
|
||||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||||
if (!browser_context)
|
if (!browser_context)
|
||||||
@@ -239,13 +244,18 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url,
|
|||||||
if (cookie.has_expires)
|
if (cookie.has_expires)
|
||||||
cef_time_to_basetime(cookie.expires, expiration_time);
|
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(
|
auto canonical_cookie = net::CanonicalCookie::CreateSanitizedCookie(
|
||||||
gurl, name, value, domain, path,
|
gurl, name, value, domain, path,
|
||||||
base::Time(), // Creation time.
|
base::Time(), // Creation time.
|
||||||
expiration_time,
|
expiration_time,
|
||||||
base::Time(), // Last access time.
|
base::Time(), // Last access time.
|
||||||
cookie.secure ? true : false, cookie.httponly ? true : false,
|
cookie.secure ? true : false, cookie.httponly ? true : false, same_site,
|
||||||
net::CookieSameSite::UNSPECIFIED, net::COOKIE_PRIORITY_DEFAULT);
|
priority);
|
||||||
|
|
||||||
if (!canonical_cookie) {
|
if (!canonical_cookie) {
|
||||||
SetCookieCallbackImpl(callback,
|
SetCookieCallbackImpl(callback,
|
||||||
@@ -258,13 +268,15 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url,
|
|||||||
net::CookieOptions options;
|
net::CookieOptions options;
|
||||||
if (cookie.httponly)
|
if (cookie.httponly)
|
||||||
options.set_include_httponly();
|
options.set_include_httponly();
|
||||||
|
options.set_same_site_cookie_context(
|
||||||
|
net::CookieOptions::SameSiteCookieContext::MakeInclusive());
|
||||||
|
|
||||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||||
if (!browser_context)
|
if (!browser_context)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
GetCookieManager(browser_context)
|
GetCookieManager(browser_context)
|
||||||
->SetCanonicalCookie(*canonical_cookie, gurl.scheme(), options,
|
->SetCanonicalCookie(*canonical_cookie, gurl, options,
|
||||||
base::Bind(SetCookieCallbackImpl, callback));
|
base::Bind(SetCookieCallbackImpl, callback));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -158,9 +158,11 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
|||||||
void OnComplete(const network::URLLoaderCompletionStatus& status) override;
|
void OnComplete(const network::URLLoaderCompletionStatus& status) override;
|
||||||
|
|
||||||
// mojom::URLLoader methods:
|
// mojom::URLLoader methods:
|
||||||
void FollowRedirect(const std::vector<std::string>& removed_headers,
|
void FollowRedirect(
|
||||||
const net::HttpRequestHeaders& modified_headers,
|
const std::vector<std::string>& removed_headers,
|
||||||
const base::Optional<GURL>& new_url) override;
|
const net::HttpRequestHeaders& modified_headers,
|
||||||
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||||
|
const base::Optional<GURL>& new_url) override;
|
||||||
void SetPriority(net::RequestPriority priority,
|
void SetPriority(net::RequestPriority priority,
|
||||||
int32_t intra_priority_value) override;
|
int32_t intra_priority_value) override;
|
||||||
void PauseReadingBodyFromNet() override;
|
void PauseReadingBodyFromNet() override;
|
||||||
@@ -227,6 +229,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
|||||||
const uint32_t options_;
|
const uint32_t options_;
|
||||||
bool input_stream_previously_failed_ = false;
|
bool input_stream_previously_failed_ = false;
|
||||||
bool request_was_redirected_ = false;
|
bool request_was_redirected_ = false;
|
||||||
|
int redirect_limit_ = net::URLRequest::kMaxRedirects;
|
||||||
|
|
||||||
// To avoid sending multiple OnReceivedError callbacks.
|
// To avoid sending multiple OnReceivedError callbacks.
|
||||||
bool sent_error_callback_ = false;
|
bool sent_error_callback_ = false;
|
||||||
@@ -483,6 +486,11 @@ void InterceptedRequest::OnReceiveRedirect(
|
|||||||
needs_callback = true;
|
needs_callback = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (--redirect_limit_ == 0) {
|
||||||
|
SendErrorAndCompleteImmediately(net::ERR_TOO_MANY_REDIRECTS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
net::RedirectInfo new_redirect_info;
|
net::RedirectInfo new_redirect_info;
|
||||||
|
|
||||||
// When we redirect via ContinueToHandleOverrideHeaders the |redirect_info|
|
// When we redirect via ContinueToHandleOverrideHeaders the |redirect_info|
|
||||||
@@ -561,6 +569,7 @@ void InterceptedRequest::OnComplete(
|
|||||||
void InterceptedRequest::FollowRedirect(
|
void InterceptedRequest::FollowRedirect(
|
||||||
const std::vector<std::string>& removed_headers_ext,
|
const std::vector<std::string>& removed_headers_ext,
|
||||||
const net::HttpRequestHeaders& modified_headers_ext,
|
const net::HttpRequestHeaders& modified_headers_ext,
|
||||||
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||||
const base::Optional<GURL>& new_url) {
|
const base::Optional<GURL>& new_url) {
|
||||||
std::vector<std::string> removed_headers = removed_headers_ext;
|
std::vector<std::string> removed_headers = removed_headers_ext;
|
||||||
net::HttpRequestHeaders modified_headers = modified_headers_ext;
|
net::HttpRequestHeaders modified_headers = modified_headers_ext;
|
||||||
@@ -642,14 +651,14 @@ void InterceptedRequest::InterceptResponseReceived(
|
|||||||
if (request_.headers.GetHeader(net::HttpRequestHeaders::kOrigin, &origin) &&
|
if (request_.headers.GetHeader(net::HttpRequestHeaders::kOrigin, &origin) &&
|
||||||
origin != url::Origin().Serialize()) {
|
origin != url::Origin().Serialize()) {
|
||||||
// Allow redirects of cross-origin resource loads.
|
// Allow redirects of cross-origin resource loads.
|
||||||
headers->AddHeader(MakeHeader(
|
headers->AddHeader(network::cors::header_names::kAccessControlAllowOrigin,
|
||||||
network::cors::header_names::kAccessControlAllowOrigin, origin));
|
origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (request_.credentials_mode ==
|
if (request_.credentials_mode ==
|
||||||
network::mojom::CredentialsMode::kInclude) {
|
network::mojom::CredentialsMode::kInclude) {
|
||||||
headers->AddHeader(MakeHeader(
|
headers->AddHeader(
|
||||||
network::cors::header_names::kAccessControlAllowCredentials, "true"));
|
network::cors::header_names::kAccessControlAllowCredentials, "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
const net::RedirectInfo& redirect_info =
|
const net::RedirectInfo& redirect_info =
|
||||||
@@ -941,7 +950,7 @@ void InterceptedRequest::OnURLLoaderClientError() {
|
|||||||
void InterceptedRequest::OnURLLoaderError(uint32_t custom_reason,
|
void InterceptedRequest::OnURLLoaderError(uint32_t custom_reason,
|
||||||
const std::string& description) {
|
const std::string& description) {
|
||||||
if (custom_reason == network::mojom::URLLoader::kClientDisconnectReason)
|
if (custom_reason == network::mojom::URLLoader::kClientDisconnectReason)
|
||||||
SendErrorCallback(safe_browsing::GetNetErrorCodeForSafeBrowsing(), true);
|
SendErrorCallback(safe_browsing::kNetErrorCodeForSafeBrowsing, true);
|
||||||
|
|
||||||
got_loader_error_ = true;
|
got_loader_error_ = true;
|
||||||
|
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "net/base/load_flags.h"
|
#include "net/base/load_flags.h"
|
||||||
#include "net/http/http_status_code.h"
|
#include "net/http/http_status_code.h"
|
||||||
#include "net/http/http_util.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 "ui/base/page_transition_types.h"
|
||||||
#include "url/origin.h"
|
#include "url/origin.h"
|
||||||
|
|
||||||
@@ -1202,8 +1203,8 @@ void InitOnUIThread(
|
|||||||
if (request.render_frame_id >= 0) {
|
if (request.render_frame_id >= 0) {
|
||||||
// TODO(network): Are these main frame checks equivalent?
|
// TODO(network): Are these main frame checks equivalent?
|
||||||
if (request.is_main_frame ||
|
if (request.is_main_frame ||
|
||||||
static_cast<content::ResourceType>(request.resource_type) ==
|
static_cast<blink::mojom::ResourceType>(request.resource_type) ==
|
||||||
content::ResourceType::kMainFrame) {
|
blink::mojom::ResourceType::kMainFrame) {
|
||||||
frame = web_contents->GetMainFrame();
|
frame = web_contents->GetMainFrame();
|
||||||
DCHECK(frame);
|
DCHECK(frame);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -557,6 +557,7 @@ void StreamReaderURLLoader::ContinueWithRequestHeaders(
|
|||||||
void StreamReaderURLLoader::FollowRedirect(
|
void StreamReaderURLLoader::FollowRedirect(
|
||||||
const std::vector<std::string>& removed_headers,
|
const std::vector<std::string>& removed_headers,
|
||||||
const net::HttpRequestHeaders& modified_headers,
|
const net::HttpRequestHeaders& modified_headers,
|
||||||
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||||
const base::Optional<GURL>& new_url) {
|
const base::Optional<GURL>& new_url) {
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
}
|
}
|
||||||
|
@@ -171,9 +171,11 @@ class StreamReaderURLLoader : public network::mojom::URLLoader {
|
|||||||
void ContinueResponse(bool was_redirected);
|
void ContinueResponse(bool was_redirected);
|
||||||
|
|
||||||
// network::mojom::URLLoader methods:
|
// network::mojom::URLLoader methods:
|
||||||
void FollowRedirect(const std::vector<std::string>& removed_headers,
|
void FollowRedirect(
|
||||||
const net::HttpRequestHeaders& modified_headers,
|
const std::vector<std::string>& removed_headers,
|
||||||
const base::Optional<GURL>& new_url) override;
|
const net::HttpRequestHeaders& modified_headers,
|
||||||
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||||
|
const base::Optional<GURL>& new_url) override;
|
||||||
void SetPriority(net::RequestPriority priority,
|
void SetPriority(net::RequestPriority priority,
|
||||||
int intra_priority_value) override;
|
int intra_priority_value) override;
|
||||||
void PauseReadingBodyFromNet() override;
|
void PauseReadingBodyFromNet() override;
|
||||||
|
@@ -55,7 +55,7 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
|
|||||||
content::devtools_instrumentation::WillCreateURLLoaderFactory(
|
content::devtools_instrumentation::WillCreateURLLoaderFactory(
|
||||||
static_cast<content::RenderFrameHostImpl*>(render_frame_host),
|
static_cast<content::RenderFrameHostImpl*>(render_frame_host),
|
||||||
false /* is_navigation */, false /* is_download */,
|
false /* is_navigation */, false /* is_download */,
|
||||||
&maybe_proxy_factory_request);
|
&maybe_proxy_factory_request, nullptr /* factory_override */);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow the Content embedder to inject itself if it wants to.
|
// Allow the Content embedder to inject itself if it wants to.
|
||||||
|
@@ -66,6 +66,20 @@ void CefBrowserPlatformDelegateOsr::BrowserCreated(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefBrowserPlatformDelegateOsr::NotifyBrowserDestroyed() {
|
||||||
|
content::WebContents* web_contents = browser_->web_contents();
|
||||||
|
content::RenderViewHost* host = web_contents->GetRenderViewHost();
|
||||||
|
if (host) {
|
||||||
|
CefRenderWidgetHostViewOSR* view =
|
||||||
|
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
|
||||||
|
if (view) {
|
||||||
|
view->ReleaseCompositor();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CefBrowserPlatformDelegate::NotifyBrowserDestroyed();
|
||||||
|
}
|
||||||
|
|
||||||
void CefBrowserPlatformDelegateOsr::BrowserDestroyed(
|
void CefBrowserPlatformDelegateOsr::BrowserDestroyed(
|
||||||
CefBrowserHostImpl* browser) {
|
CefBrowserHostImpl* browser) {
|
||||||
CefBrowserPlatformDelegate::BrowserDestroyed(browser);
|
CefBrowserPlatformDelegate::BrowserDestroyed(browser);
|
||||||
|
@@ -26,6 +26,7 @@ class CefBrowserPlatformDelegateOsr
|
|||||||
content::RenderViewHostDelegateView** delegate_view) override;
|
content::RenderViewHostDelegateView** delegate_view) override;
|
||||||
void WebContentsCreated(content::WebContents* web_contents) override;
|
void WebContentsCreated(content::WebContents* web_contents) override;
|
||||||
void BrowserCreated(CefBrowserHostImpl* browser) override;
|
void BrowserCreated(CefBrowserHostImpl* browser) override;
|
||||||
|
void NotifyBrowserDestroyed() override;
|
||||||
void BrowserDestroyed(CefBrowserHostImpl* browser) override;
|
void BrowserDestroyed(CefBrowserHostImpl* browser) override;
|
||||||
SkColor GetBackgroundColor() const override;
|
SkColor GetBackgroundColor() const override;
|
||||||
bool CanUseSharedTexture() const override;
|
bool CanUseSharedTexture() const override;
|
||||||
|
@@ -123,11 +123,11 @@ void CefMotionEventOSR::MarkUnchangedTouchPointsAsStationary(
|
|||||||
blink::WebTouchEvent* event,
|
blink::WebTouchEvent* event,
|
||||||
const CefTouchEvent& cef_event) {
|
const CefTouchEvent& cef_event) {
|
||||||
int id = LookupId(cef_event.id);
|
int id = LookupId(cef_event.id);
|
||||||
if (event->GetType() == blink::WebInputEvent::kTouchMove ||
|
if (event->GetType() == blink::WebInputEvent::Type::kTouchMove ||
|
||||||
event->GetType() == blink::WebInputEvent::kTouchCancel) {
|
event->GetType() == blink::WebInputEvent::Type::kTouchCancel) {
|
||||||
for (size_t i = 0; i < event->touches_length; ++i) {
|
for (size_t i = 0; i < event->touches_length; ++i) {
|
||||||
if (event->touches[i].id != id)
|
if (event->touches[i].id != id)
|
||||||
event->touches[i].state = blink::WebTouchPoint::kStateStationary;
|
event->touches[i].state = blink::WebTouchPoint::State::kStateStationary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -118,7 +118,7 @@ struct PopulateAxNodeAttributes {
|
|||||||
case ax::mojom::IntAttribute::kDefaultActionVerb:
|
case ax::mojom::IntAttribute::kDefaultActionVerb:
|
||||||
attributes->SetString(
|
attributes->SetString(
|
||||||
ToString(attr.first),
|
ToString(attr.first),
|
||||||
ui::ActionVerbToUnlocalizedString(
|
ui::ToString(
|
||||||
static_cast<ax::mojom::DefaultActionVerb>(attr.second)));
|
static_cast<ax::mojom::DefaultActionVerb>(attr.second)));
|
||||||
break;
|
break;
|
||||||
case ax::mojom::IntAttribute::kInvalidState: {
|
case ax::mojom::IntAttribute::kInvalidState: {
|
||||||
|
@@ -25,10 +25,9 @@
|
|||||||
#include "components/viz/common/frame_sinks/begin_frame_args.h"
|
#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/copy_output_request.h"
|
||||||
#include "components/viz/common/frame_sinks/delay_based_time_source.h"
|
#include "components/viz/common/frame_sinks/delay_based_time_source.h"
|
||||||
#include "components/viz/common/gl_helper.h"
|
#include "components/viz/common/surfaces/frame_sink_id_allocator.h"
|
||||||
#include "components/viz/common/switches.h"
|
#include "components/viz/common/switches.h"
|
||||||
#include "content/browser/bad_message.h"
|
#include "content/browser/bad_message.h"
|
||||||
#include "content/browser/compositor/image_transport_factory.h"
|
|
||||||
#include "content/browser/gpu/gpu_data_manager_impl.h"
|
#include "content/browser/gpu/gpu_data_manager_impl.h"
|
||||||
#include "content/browser/renderer_host/cursor_manager.h"
|
#include "content/browser/renderer_host/cursor_manager.h"
|
||||||
#include "content/browser/renderer_host/delegated_frame_host.h"
|
#include "content/browser/renderer_host/delegated_frame_host.h"
|
||||||
@@ -48,7 +47,6 @@
|
|||||||
#include "content/public/browser/render_view_host.h"
|
#include "content/public/browser/render_view_host.h"
|
||||||
#include "content/public/common/content_switches.h"
|
#include "content/public/common/content_switches.h"
|
||||||
#include "media/base/video_frame.h"
|
#include "media/base/video_frame.h"
|
||||||
#include "ui/base/cursor/types/cursor_types.h"
|
|
||||||
#include "ui/compositor/compositor.h"
|
#include "ui/compositor/compositor.h"
|
||||||
#include "ui/events/blink/blink_event_util.h"
|
#include "ui/events/blink/blink_event_util.h"
|
||||||
#include "ui/events/gesture_detection/gesture_provider_config_helper.h"
|
#include "ui/events/gesture_detection/gesture_provider_config_helper.h"
|
||||||
@@ -236,15 +234,11 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
|||||||
|
|
||||||
external_begin_frame_enabled_ = use_external_begin_frame;
|
external_begin_frame_enabled_ = use_external_begin_frame;
|
||||||
|
|
||||||
content::ImageTransportFactory* factory =
|
auto context_factory = content::GetContextFactory();
|
||||||
content::ImageTransportFactory::GetInstance();
|
|
||||||
ui::ContextFactoryPrivate* context_factory_private =
|
|
||||||
factory->GetContextFactoryPrivate();
|
|
||||||
|
|
||||||
// Matching the attributes from RecyclableCompositorMac.
|
// Matching the attributes from RecyclableCompositorMac.
|
||||||
compositor_.reset(new ui::Compositor(
|
compositor_.reset(new ui::Compositor(
|
||||||
context_factory_private->AllocateFrameSinkId(),
|
context_factory->AllocateFrameSinkId(), context_factory,
|
||||||
content::GetContextFactory(), context_factory_private,
|
|
||||||
base::ThreadTaskRunnerHandle::Get(), false /* enable_pixel_canvas */,
|
base::ThreadTaskRunnerHandle::Get(), false /* enable_pixel_canvas */,
|
||||||
use_external_begin_frame));
|
use_external_begin_frame));
|
||||||
compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
|
compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
|
||||||
@@ -282,6 +276,23 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
|
|||||||
}
|
}
|
||||||
|
|
||||||
CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
|
CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
|
||||||
|
ReleaseCompositor();
|
||||||
|
root_layer_.reset(nullptr);
|
||||||
|
|
||||||
|
DCHECK(!parent_host_view_);
|
||||||
|
DCHECK(!popup_host_view_);
|
||||||
|
DCHECK(!child_host_view_);
|
||||||
|
DCHECK(guest_host_views_.empty());
|
||||||
|
|
||||||
|
if (text_input_manager_)
|
||||||
|
text_input_manager_->RemoveObserver(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefRenderWidgetHostViewOSR::ReleaseCompositor() {
|
||||||
|
if (!compositor_) {
|
||||||
|
return; // already released
|
||||||
|
}
|
||||||
|
|
||||||
// Marking the DelegatedFrameHost as removed from the window hierarchy is
|
// Marking the DelegatedFrameHost as removed from the window hierarchy is
|
||||||
// necessary to remove all connections to its old ui::Compositor.
|
// necessary to remove all connections to its old ui::Compositor.
|
||||||
if (is_showing_) {
|
if (is_showing_) {
|
||||||
@@ -292,15 +303,6 @@ CefRenderWidgetHostViewOSR::~CefRenderWidgetHostViewOSR() {
|
|||||||
|
|
||||||
delegated_frame_host_.reset(nullptr);
|
delegated_frame_host_.reset(nullptr);
|
||||||
compositor_.reset(nullptr);
|
compositor_.reset(nullptr);
|
||||||
root_layer_.reset(nullptr);
|
|
||||||
|
|
||||||
DCHECK(!parent_host_view_);
|
|
||||||
DCHECK(!popup_host_view_);
|
|
||||||
DCHECK(!child_host_view_);
|
|
||||||
DCHECK(guest_host_views_.empty());
|
|
||||||
|
|
||||||
if (text_input_manager_)
|
|
||||||
text_input_manager_->RemoveObserver(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called for full-screen widgets.
|
// Called for full-screen widgets.
|
||||||
@@ -342,7 +344,9 @@ bool CefRenderWidgetHostViewOSR::HasFocus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CefRenderWidgetHostViewOSR::IsSurfaceAvailableForCopy() {
|
bool CefRenderWidgetHostViewOSR::IsSurfaceAvailableForCopy() {
|
||||||
return delegated_frame_host_->CanCopyFromCompositingSurface();
|
return delegated_frame_host_
|
||||||
|
? delegated_frame_host_->CanCopyFromCompositingSurface()
|
||||||
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::Show() {
|
void CefRenderWidgetHostViewOSR::Show() {
|
||||||
@@ -371,10 +375,12 @@ void CefRenderWidgetHostViewOSR::Show() {
|
|||||||
base::nullopt /* record_tab_switch_time_request */);
|
base::nullopt /* record_tab_switch_time_request */);
|
||||||
}
|
}
|
||||||
|
|
||||||
delegated_frame_host_->AttachToCompositor(compositor_.get());
|
if (delegated_frame_host_) {
|
||||||
delegated_frame_host_->WasShown(
|
delegated_frame_host_->AttachToCompositor(compositor_.get());
|
||||||
GetLocalSurfaceIdAllocation().local_surface_id(), GetViewBounds().size(),
|
delegated_frame_host_->WasShown(
|
||||||
base::nullopt);
|
GetLocalSurfaceIdAllocation().local_surface_id(),
|
||||||
|
GetViewBounds().size(), base::nullopt);
|
||||||
|
}
|
||||||
|
|
||||||
if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled()) {
|
if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled()) {
|
||||||
// Start generating frames when we're visible and at the correct size.
|
// Start generating frames when we're visible and at the correct size.
|
||||||
@@ -409,9 +415,11 @@ void CefRenderWidgetHostViewOSR::Hide() {
|
|||||||
if (render_widget_host_)
|
if (render_widget_host_)
|
||||||
render_widget_host_->WasHidden();
|
render_widget_host_->WasHidden();
|
||||||
|
|
||||||
delegated_frame_host_->WasHidden(
|
if (delegated_frame_host_) {
|
||||||
content::DelegatedFrameHost::HiddenCause::kOther);
|
delegated_frame_host_->WasHidden(
|
||||||
delegated_frame_host_->DetachFromCompositor();
|
content::DelegatedFrameHost::HiddenCause::kOther);
|
||||||
|
delegated_frame_host_->DetachFromCompositor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CefRenderWidgetHostViewOSR::IsShowing() {
|
bool CefRenderWidgetHostViewOSR::IsShowing() {
|
||||||
@@ -447,8 +455,14 @@ base::Optional<SkColor> CefRenderWidgetHostViewOSR::GetBackgroundColor() {
|
|||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::UpdateBackgroundColor() {}
|
void CefRenderWidgetHostViewOSR::UpdateBackgroundColor() {}
|
||||||
|
|
||||||
bool CefRenderWidgetHostViewOSR::LockMouse(bool request_unadjusted_movement) {
|
blink::mojom::PointerLockResult CefRenderWidgetHostViewOSR::LockMouse(
|
||||||
return false;
|
bool request_unadjusted_movement) {
|
||||||
|
return blink::mojom::PointerLockResult::kPermissionDenied;
|
||||||
|
}
|
||||||
|
|
||||||
|
blink::mojom::PointerLockResult CefRenderWidgetHostViewOSR::ChangeMouseLock(
|
||||||
|
bool request_unadjusted_movement) {
|
||||||
|
return blink::mojom::PointerLockResult::kPermissionDenied;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::UnlockMouse() {}
|
void CefRenderWidgetHostViewOSR::UnlockMouse() {}
|
||||||
@@ -539,7 +553,9 @@ void CefRenderWidgetHostViewOSR::AddDamageRect(uint32_t sequence,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() {
|
void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() {
|
||||||
delegated_frame_host_->ResetFallbackToFirstNavigationSurface();
|
if (delegated_frame_host_) {
|
||||||
|
delegated_frame_host_->ResetFallbackToFirstNavigationSurface();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::InitAsPopup(
|
void CefRenderWidgetHostViewOSR::InitAsPopup(
|
||||||
@@ -595,39 +611,29 @@ void CefRenderWidgetHostViewOSR::UpdateCursor(
|
|||||||
browser_impl_->GetClient()->GetRenderHandler();
|
browser_impl_->GetClient()->GetRenderHandler();
|
||||||
CHECK(handler);
|
CHECK(handler);
|
||||||
|
|
||||||
const content::CursorInfo& cursor_info = cursor.info();
|
const auto& ui_cursor = cursor.cursor();
|
||||||
|
|
||||||
const cef_cursor_type_t cursor_type =
|
const cef_cursor_type_t cursor_type =
|
||||||
static_cast<cef_cursor_type_t>(cursor_info.type);
|
static_cast<cef_cursor_type_t>(ui_cursor.type());
|
||||||
CefCursorInfo custom_cursor_info;
|
CefCursorInfo custom_cursor_info;
|
||||||
if (cursor_info.type == ui::CursorType::kCustom) {
|
if (ui_cursor.type() == ui::mojom::CursorType::kCustom) {
|
||||||
custom_cursor_info.hotspot.x = cursor_info.hotspot.x();
|
custom_cursor_info.hotspot.x = ui_cursor.custom_hotspot().x();
|
||||||
custom_cursor_info.hotspot.y = cursor_info.hotspot.y();
|
custom_cursor_info.hotspot.y = ui_cursor.custom_hotspot().y();
|
||||||
custom_cursor_info.image_scale_factor = cursor_info.image_scale_factor;
|
custom_cursor_info.image_scale_factor = ui_cursor.image_scale_factor();
|
||||||
custom_cursor_info.buffer = cursor_info.custom_image.getPixels();
|
custom_cursor_info.buffer = ui_cursor.custom_bitmap().getPixels();
|
||||||
custom_cursor_info.size.width = cursor_info.custom_image.width();
|
custom_cursor_info.size.width = ui_cursor.custom_bitmap().width();
|
||||||
custom_cursor_info.size.height = cursor_info.custom_image.height();
|
custom_cursor_info.size.height = ui_cursor.custom_bitmap().height();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_AURA)
|
#if defined(USE_AURA)
|
||||||
content::WebCursor web_cursor(cursor_info);
|
content::WebCursor web_cursor(ui_cursor);
|
||||||
|
|
||||||
ui::PlatformCursor platform_cursor;
|
ui::PlatformCursor platform_cursor;
|
||||||
if (cursor_info.type == ui::CursorType::kCustom) {
|
if (ui_cursor.type() == ui::mojom::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|.
|
// |web_cursor| owns the resulting |platform_cursor|.
|
||||||
platform_cursor = web_cursor.GetPlatformCursor(ui_cursor);
|
platform_cursor = web_cursor.GetPlatformCursor(ui_cursor);
|
||||||
} else {
|
} else {
|
||||||
platform_cursor = GetPlatformCursor(cursor_info.type);
|
platform_cursor = GetPlatformCursor(ui_cursor.type());
|
||||||
}
|
}
|
||||||
|
|
||||||
handler->OnCursorChange(browser_impl_.get(), platform_cursor, cursor_type,
|
handler->OnCursorChange(browser_impl_.get(), platform_cursor, cursor_type,
|
||||||
@@ -713,8 +719,10 @@ void CefRenderWidgetHostViewOSR::CopyFromSurface(
|
|||||||
const gfx::Rect& src_rect,
|
const gfx::Rect& src_rect,
|
||||||
const gfx::Size& output_size,
|
const gfx::Size& output_size,
|
||||||
base::OnceCallback<void(const SkBitmap&)> callback) {
|
base::OnceCallback<void(const SkBitmap&)> callback) {
|
||||||
delegated_frame_host_->CopyFromCompositingSurface(src_rect, output_size,
|
if (delegated_frame_host_) {
|
||||||
std::move(callback));
|
delegated_frame_host_->CopyFromCompositingSurface(src_rect, output_size,
|
||||||
|
std::move(callback));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::GetScreenInfo(content::ScreenInfo* results) {
|
void CefRenderWidgetHostViewOSR::GetScreenInfo(content::ScreenInfo* results) {
|
||||||
@@ -889,11 +897,13 @@ CefRenderWidgetHostViewOSR::GetLocalSurfaceIdAllocation() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const viz::FrameSinkId& CefRenderWidgetHostViewOSR::GetFrameSinkId() const {
|
const viz::FrameSinkId& CefRenderWidgetHostViewOSR::GetFrameSinkId() const {
|
||||||
return delegated_frame_host_->frame_sink_id();
|
return delegated_frame_host_
|
||||||
|
? delegated_frame_host_->frame_sink_id()
|
||||||
|
: viz::FrameSinkIdAllocator::InvalidFrameSinkId();
|
||||||
}
|
}
|
||||||
|
|
||||||
viz::FrameSinkId CefRenderWidgetHostViewOSR::GetRootFrameSinkId() {
|
viz::FrameSinkId CefRenderWidgetHostViewOSR::GetRootFrameSinkId() {
|
||||||
return compositor_->frame_sink_id();
|
return compositor_ ? compositor_->frame_sink_id() : viz::FrameSinkId();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::OnRenderFrameMetadataChangedAfterActivation() {
|
void CefRenderWidgetHostViewOSR::OnRenderFrameMetadataChangedAfterActivation() {
|
||||||
@@ -1072,10 +1082,12 @@ void CefRenderWidgetHostViewOSR::SendExternalBeginFrame() {
|
|||||||
if (render_widget_host_)
|
if (render_widget_host_)
|
||||||
render_widget_host_->ProgressFlingIfNeeded(frame_time);
|
render_widget_host_->ProgressFlingIfNeeded(frame_time);
|
||||||
|
|
||||||
compositor_->context_factory_private()->IssueExternalBeginFrame(
|
if (compositor_) {
|
||||||
compositor_.get(), begin_frame_args, /* force= */ true,
|
compositor_->IssueExternalBeginFrame(
|
||||||
base::BindOnce(&CefRenderWidgetHostViewOSR::OnFrameComplete,
|
begin_frame_args, /* force= */ true,
|
||||||
weak_ptr_factory_.GetWeakPtr()));
|
base::BindOnce(&CefRenderWidgetHostViewOSR::OnFrameComplete,
|
||||||
|
weak_ptr_factory_.GetWeakPtr()));
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsPopupWidget() && popup_host_view_) {
|
if (!IsPopupWidget() && popup_host_view_) {
|
||||||
popup_host_view_->SendExternalBeginFrame();
|
popup_host_view_->SendExternalBeginFrame();
|
||||||
@@ -1097,11 +1109,12 @@ void CefRenderWidgetHostViewOSR::SendKeyEvent(
|
|||||||
if (target_host && target_host->GetView()) {
|
if (target_host && target_host->GetView()) {
|
||||||
// Direct routing requires that events go directly to the View.
|
// Direct routing requires that events go directly to the View.
|
||||||
target_host->ForwardKeyboardEventWithLatencyInfo(
|
target_host->ForwardKeyboardEventWithLatencyInfo(
|
||||||
event, ui::LatencyInfo(event.GetType() == blink::WebInputEvent::kChar ||
|
event,
|
||||||
event.GetType() ==
|
ui::LatencyInfo(event.GetType() == blink::WebInputEvent::Type::kChar ||
|
||||||
blink::WebInputEvent::kRawKeyDown
|
event.GetType() ==
|
||||||
? ui::SourceEventType::KEY_PRESS
|
blink::WebInputEvent::Type::kRawKeyDown
|
||||||
: ui::SourceEventType::OTHER));
|
? ui::SourceEventType::KEY_PRESS
|
||||||
|
: ui::SourceEventType::OTHER));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1110,7 +1123,7 @@ void CefRenderWidgetHostViewOSR::SendMouseEvent(
|
|||||||
TRACE_EVENT0("cef", "CefRenderWidgetHostViewOSR::SendMouseEvent");
|
TRACE_EVENT0("cef", "CefRenderWidgetHostViewOSR::SendMouseEvent");
|
||||||
if (!IsPopupWidget()) {
|
if (!IsPopupWidget()) {
|
||||||
if (browser_impl_.get() &&
|
if (browser_impl_.get() &&
|
||||||
event.GetType() == blink::WebMouseEvent::kMouseDown) {
|
event.GetType() == blink::WebMouseEvent::Type::kMouseDown) {
|
||||||
browser_impl_->CancelContextMenu();
|
browser_impl_->CancelContextMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1293,8 +1306,9 @@ void CefRenderWidgetHostViewOSR::SendTouchEvent(const CefTouchEvent& event) {
|
|||||||
latency_info);
|
latency_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool touch_end = touch_event.GetType() == blink::WebInputEvent::kTouchEnd ||
|
bool touch_end =
|
||||||
touch_event.GetType() == blink::WebInputEvent::kTouchCancel;
|
touch_event.GetType() == blink::WebInputEvent::Type::kTouchEnd ||
|
||||||
|
touch_event.GetType() == blink::WebInputEvent::Type::kTouchCancel;
|
||||||
|
|
||||||
if (touch_end && IsPopupWidget() && parent_host_view_ &&
|
if (touch_end && IsPopupWidget() && parent_host_view_ &&
|
||||||
parent_host_view_->popup_host_view_ == this) {
|
parent_host_view_->popup_host_view_ == this) {
|
||||||
@@ -1362,9 +1376,9 @@ void CefRenderWidgetHostViewOSR::OnUpdateTextInputStateCalled(
|
|||||||
|
|
||||||
void CefRenderWidgetHostViewOSR::ProcessAckedTouchEvent(
|
void CefRenderWidgetHostViewOSR::ProcessAckedTouchEvent(
|
||||||
const content::TouchEventWithLatencyInfo& touch,
|
const content::TouchEventWithLatencyInfo& touch,
|
||||||
content::InputEventAckState ack_result) {
|
blink::mojom::InputEventResultState ack_result) {
|
||||||
const bool event_consumed =
|
const bool event_consumed =
|
||||||
ack_result == content::INPUT_EVENT_ACK_STATE_CONSUMED;
|
ack_result == blink::mojom::InputEventResultState::kConsumed;
|
||||||
gesture_provider_.OnTouchEventAck(touch.event.unique_touch_event_id,
|
gesture_provider_.OnTouchEventAck(touch.event.unique_touch_event_id,
|
||||||
event_consumed, false);
|
event_consumed, false);
|
||||||
}
|
}
|
||||||
@@ -1382,7 +1396,7 @@ void CefRenderWidgetHostViewOSR::OnGestureEvent(
|
|||||||
ui::CreateWebGestureEventFromGestureEventData(gesture);
|
ui::CreateWebGestureEventFromGestureEventData(gesture);
|
||||||
|
|
||||||
// without this check, forwarding gestures does not work!
|
// without this check, forwarding gestures does not work!
|
||||||
if (web_event.GetType() == blink::WebInputEvent::kUndefined)
|
if (web_event.GetType() == blink::WebInputEvent::Type::kUndefined)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ui::LatencyInfo latency_info = CreateLatencyInfo(web_event);
|
ui::LatencyInfo latency_info = CreateLatencyInfo(web_event);
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
#include "content/browser/renderer_host/render_widget_host_view_base.h"
|
||||||
#include "content/browser/renderer_host/text_input_manager.h"
|
#include "content/browser/renderer_host/text_input_manager.h"
|
||||||
#include "content/public/common/widget_type.h"
|
#include "content/public/common/widget_type.h"
|
||||||
#include "ui/base/cursor/types/cursor_types.h"
|
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
|
||||||
#include "ui/compositor/compositor.h"
|
#include "ui/compositor/compositor.h"
|
||||||
#include "ui/events/base_event_utils.h"
|
#include "ui/events/base_event_utils.h"
|
||||||
#include "ui/events/gesture_detection/filtered_gesture_provider.h"
|
#include "ui/events/gesture_detection/filtered_gesture_provider.h"
|
||||||
@@ -49,7 +49,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_AURA)
|
#if defined(USE_AURA)
|
||||||
#include "third_party/blink/public/platform/web_cursor_info.h"
|
|
||||||
#include "ui/base/cursor/cursor.h"
|
#include "ui/base/cursor/cursor.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -124,7 +123,10 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
|||||||
void SetBackgroundColor(SkColor color) override;
|
void SetBackgroundColor(SkColor color) override;
|
||||||
base::Optional<SkColor> GetBackgroundColor() override;
|
base::Optional<SkColor> GetBackgroundColor() override;
|
||||||
void UpdateBackgroundColor() override;
|
void UpdateBackgroundColor() override;
|
||||||
bool LockMouse(bool request_unadjusted_movement) override;
|
blink::mojom::PointerLockResult LockMouse(
|
||||||
|
bool request_unadjusted_movement) override;
|
||||||
|
blink::mojom::PointerLockResult ChangeMouseLock(
|
||||||
|
bool request_unadjusted_movement) override;
|
||||||
void UnlockMouse() override;
|
void UnlockMouse() override;
|
||||||
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
|
void TakeFallbackContentFrom(content::RenderWidgetHostView* view) override;
|
||||||
|
|
||||||
@@ -195,8 +197,9 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
|||||||
bool did_update_state) override;
|
bool did_update_state) override;
|
||||||
|
|
||||||
// ui::GestureProviderClient implementation.
|
// ui::GestureProviderClient implementation.
|
||||||
void ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo& touch,
|
void ProcessAckedTouchEvent(
|
||||||
content::InputEventAckState ack_result) override;
|
const content::TouchEventWithLatencyInfo& touch,
|
||||||
|
blink::mojom::InputEventResultState ack_result) override;
|
||||||
void OnGestureEvent(const ui::GestureEventData& gesture) override;
|
void OnGestureEvent(const ui::GestureEventData& gesture) override;
|
||||||
|
|
||||||
bool InstallTransparency();
|
bool InstallTransparency();
|
||||||
@@ -262,6 +265,8 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
|||||||
void OnDidUpdateVisualPropertiesComplete(
|
void OnDidUpdateVisualPropertiesComplete(
|
||||||
const cc::RenderFrameMetadata& metadata);
|
const cc::RenderFrameMetadata& metadata);
|
||||||
|
|
||||||
|
void ReleaseCompositor();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void SetFrameRate();
|
void SetFrameRate();
|
||||||
bool SetDeviceScaleFactor();
|
bool SetDeviceScaleFactor();
|
||||||
@@ -321,7 +326,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
|
|||||||
void UpdateBackgroundColorFromRenderer(SkColor color);
|
void UpdateBackgroundColorFromRenderer(SkColor color);
|
||||||
|
|
||||||
#if defined(USE_AURA)
|
#if defined(USE_AURA)
|
||||||
ui::PlatformCursor GetPlatformCursor(ui::CursorType type);
|
ui::PlatformCursor GetPlatformCursor(ui::mojom::CursorType type);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The background color of the web content.
|
// The background color of the web content.
|
||||||
|
@@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include "libcef/browser/osr/render_widget_host_view_osr.h"
|
#include "libcef/browser/osr/render_widget_host_view_osr.h"
|
||||||
|
|
||||||
#include "third_party/blink/public/platform/web_cursor_info.h"
|
|
||||||
|
|
||||||
#if defined(USE_X11)
|
#if defined(USE_X11)
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/cursorfont.h>
|
#include <X11/cursorfont.h>
|
||||||
@@ -23,110 +21,108 @@ namespace {
|
|||||||
|
|
||||||
// Based on ui/base/cursor/cursor_loader_x11.cc.
|
// Based on ui/base/cursor/cursor_loader_x11.cc.
|
||||||
|
|
||||||
using blink::WebCursorInfo;
|
int ToCursorID(ui::mojom::CursorType type) {
|
||||||
|
|
||||||
int ToCursorID(ui::CursorType type) {
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ui::CursorType::kPointer:
|
case ui::mojom::CursorType::kPointer:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kCross:
|
case ui::mojom::CursorType::kCross:
|
||||||
return XC_crosshair;
|
return XC_crosshair;
|
||||||
case ui::CursorType::kHand:
|
case ui::mojom::CursorType::kHand:
|
||||||
return XC_hand2;
|
return XC_hand2;
|
||||||
case ui::CursorType::kIBeam:
|
case ui::mojom::CursorType::kIBeam:
|
||||||
return XC_xterm;
|
return XC_xterm;
|
||||||
case ui::CursorType::kWait:
|
case ui::mojom::CursorType::kWait:
|
||||||
return XC_watch;
|
return XC_watch;
|
||||||
case ui::CursorType::kHelp:
|
case ui::mojom::CursorType::kHelp:
|
||||||
return XC_question_arrow;
|
return XC_question_arrow;
|
||||||
case ui::CursorType::kEastResize:
|
case ui::mojom::CursorType::kEastResize:
|
||||||
return XC_right_side;
|
return XC_right_side;
|
||||||
case ui::CursorType::kNorthResize:
|
case ui::mojom::CursorType::kNorthResize:
|
||||||
return XC_top_side;
|
return XC_top_side;
|
||||||
case ui::CursorType::kNorthEastResize:
|
case ui::mojom::CursorType::kNorthEastResize:
|
||||||
return XC_top_right_corner;
|
return XC_top_right_corner;
|
||||||
case ui::CursorType::kNorthWestResize:
|
case ui::mojom::CursorType::kNorthWestResize:
|
||||||
return XC_top_left_corner;
|
return XC_top_left_corner;
|
||||||
case ui::CursorType::kSouthResize:
|
case ui::mojom::CursorType::kSouthResize:
|
||||||
return XC_bottom_side;
|
return XC_bottom_side;
|
||||||
case ui::CursorType::kSouthEastResize:
|
case ui::mojom::CursorType::kSouthEastResize:
|
||||||
return XC_bottom_right_corner;
|
return XC_bottom_right_corner;
|
||||||
case ui::CursorType::kSouthWestResize:
|
case ui::mojom::CursorType::kSouthWestResize:
|
||||||
return XC_bottom_left_corner;
|
return XC_bottom_left_corner;
|
||||||
case ui::CursorType::kWestResize:
|
case ui::mojom::CursorType::kWestResize:
|
||||||
return XC_left_side;
|
return XC_left_side;
|
||||||
case ui::CursorType::kNorthSouthResize:
|
case ui::mojom::CursorType::kNorthSouthResize:
|
||||||
return XC_sb_v_double_arrow;
|
return XC_sb_v_double_arrow;
|
||||||
case ui::CursorType::kEastWestResize:
|
case ui::mojom::CursorType::kEastWestResize:
|
||||||
return XC_sb_h_double_arrow;
|
return XC_sb_h_double_arrow;
|
||||||
case ui::CursorType::kNorthEastSouthWestResize:
|
case ui::mojom::CursorType::kNorthEastSouthWestResize:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kNorthWestSouthEastResize:
|
case ui::mojom::CursorType::kNorthWestSouthEastResize:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kColumnResize:
|
case ui::mojom::CursorType::kColumnResize:
|
||||||
return XC_sb_h_double_arrow;
|
return XC_sb_h_double_arrow;
|
||||||
case ui::CursorType::kRowResize:
|
case ui::mojom::CursorType::kRowResize:
|
||||||
return XC_sb_v_double_arrow;
|
return XC_sb_v_double_arrow;
|
||||||
case ui::CursorType::kMiddlePanning:
|
case ui::mojom::CursorType::kMiddlePanning:
|
||||||
return XC_fleur;
|
return XC_fleur;
|
||||||
case ui::CursorType::kEastPanning:
|
case ui::mojom::CursorType::kEastPanning:
|
||||||
return XC_sb_right_arrow;
|
return XC_sb_right_arrow;
|
||||||
case ui::CursorType::kNorthPanning:
|
case ui::mojom::CursorType::kNorthPanning:
|
||||||
return XC_sb_up_arrow;
|
return XC_sb_up_arrow;
|
||||||
case ui::CursorType::kNorthEastPanning:
|
case ui::mojom::CursorType::kNorthEastPanning:
|
||||||
return XC_top_right_corner;
|
return XC_top_right_corner;
|
||||||
case ui::CursorType::kNorthWestPanning:
|
case ui::mojom::CursorType::kNorthWestPanning:
|
||||||
return XC_top_left_corner;
|
return XC_top_left_corner;
|
||||||
case ui::CursorType::kSouthPanning:
|
case ui::mojom::CursorType::kSouthPanning:
|
||||||
return XC_sb_down_arrow;
|
return XC_sb_down_arrow;
|
||||||
case ui::CursorType::kSouthEastPanning:
|
case ui::mojom::CursorType::kSouthEastPanning:
|
||||||
return XC_bottom_right_corner;
|
return XC_bottom_right_corner;
|
||||||
case ui::CursorType::kSouthWestPanning:
|
case ui::mojom::CursorType::kSouthWestPanning:
|
||||||
return XC_bottom_left_corner;
|
return XC_bottom_left_corner;
|
||||||
case ui::CursorType::kWestPanning:
|
case ui::mojom::CursorType::kWestPanning:
|
||||||
return XC_sb_left_arrow;
|
return XC_sb_left_arrow;
|
||||||
case ui::CursorType::kMove:
|
case ui::mojom::CursorType::kMove:
|
||||||
return XC_fleur;
|
return XC_fleur;
|
||||||
case ui::CursorType::kVerticalText:
|
case ui::mojom::CursorType::kVerticalText:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kCell:
|
case ui::mojom::CursorType::kCell:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kContextMenu:
|
case ui::mojom::CursorType::kContextMenu:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kAlias:
|
case ui::mojom::CursorType::kAlias:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kProgress:
|
case ui::mojom::CursorType::kProgress:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kNoDrop:
|
case ui::mojom::CursorType::kNoDrop:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kCopy:
|
case ui::mojom::CursorType::kCopy:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kNotAllowed:
|
case ui::mojom::CursorType::kNotAllowed:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kZoomIn:
|
case ui::mojom::CursorType::kZoomIn:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kZoomOut:
|
case ui::mojom::CursorType::kZoomOut:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kGrab:
|
case ui::mojom::CursorType::kGrab:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kGrabbing:
|
case ui::mojom::CursorType::kGrabbing:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kMiddlePanningVertical:
|
case ui::mojom::CursorType::kMiddlePanningVertical:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kMiddlePanningHorizontal:
|
case ui::mojom::CursorType::kMiddlePanningHorizontal:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kDndNone:
|
case ui::mojom::CursorType::kDndNone:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kDndMove:
|
case ui::mojom::CursorType::kDndMove:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kDndCopy:
|
case ui::mojom::CursorType::kDndCopy:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kDndLink:
|
case ui::mojom::CursorType::kDndLink:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kNull:
|
case ui::mojom::CursorType::kNull:
|
||||||
return XC_left_ptr;
|
return XC_left_ptr;
|
||||||
case ui::CursorType::kCustom:
|
case ui::mojom::CursorType::kCustom:
|
||||||
case ui::CursorType::kNone:
|
case ui::mojom::CursorType::kNone:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
@@ -184,9 +180,9 @@ XCursorCache* cursor_cache = nullptr;
|
|||||||
#endif // defined(USE_X11)
|
#endif // defined(USE_X11)
|
||||||
|
|
||||||
ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor(
|
ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor(
|
||||||
ui::CursorType type) {
|
ui::mojom::CursorType type) {
|
||||||
#if defined(USE_X11)
|
#if defined(USE_X11)
|
||||||
if (type == ui::CursorType::kNone) {
|
if (type == ui::mojom::CursorType::kNone) {
|
||||||
if (!invisible_cursor_) {
|
if (!invisible_cursor_) {
|
||||||
invisible_cursor_.reset(new ui::XScopedCursor(ui::CreateInvisibleCursor(),
|
invisible_cursor_.reset(new ui::XScopedCursor(ui::CreateInvisibleCursor(),
|
||||||
gfx::GetXDisplay()));
|
gfx::GetXDisplay()));
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
#include "libcef/browser/browser_host_impl.h"
|
#include "libcef/browser/browser_host_impl.h"
|
||||||
#include "libcef/browser/content_browser_client.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"
|
#include "ui/resources/grit/ui_unscaled_resources.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@@ -39,113 +38,110 @@ class CefCompositorHostWin : public gfx::WindowImpl {
|
|||||||
|
|
||||||
// From content/common/cursors/webcursor_win.cc.
|
// From content/common/cursors/webcursor_win.cc.
|
||||||
|
|
||||||
using blink::WebCursorInfo;
|
LPCWSTR ToCursorID(ui::mojom::CursorType type) {
|
||||||
|
|
||||||
LPCWSTR ToCursorID(ui::CursorType type) {
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ui::CursorType::kPointer:
|
case ui::mojom::CursorType::kPointer:
|
||||||
return IDC_ARROW;
|
return IDC_ARROW;
|
||||||
case ui::CursorType::kCross:
|
case ui::mojom::CursorType::kCross:
|
||||||
return IDC_CROSS;
|
return IDC_CROSS;
|
||||||
case ui::CursorType::kHand:
|
case ui::mojom::CursorType::kHand:
|
||||||
return IDC_HAND;
|
return IDC_HAND;
|
||||||
case ui::CursorType::kIBeam:
|
case ui::mojom::CursorType::kIBeam:
|
||||||
return IDC_IBEAM;
|
return IDC_IBEAM;
|
||||||
case ui::CursorType::kWait:
|
case ui::mojom::CursorType::kWait:
|
||||||
return IDC_WAIT;
|
return IDC_WAIT;
|
||||||
case ui::CursorType::kHelp:
|
case ui::mojom::CursorType::kHelp:
|
||||||
return IDC_HELP;
|
return IDC_HELP;
|
||||||
case ui::CursorType::kEastResize:
|
case ui::mojom::CursorType::kEastResize:
|
||||||
return IDC_SIZEWE;
|
return IDC_SIZEWE;
|
||||||
case ui::CursorType::kNorthResize:
|
case ui::mojom::CursorType::kNorthResize:
|
||||||
return IDC_SIZENS;
|
return IDC_SIZENS;
|
||||||
case ui::CursorType::kNorthEastResize:
|
case ui::mojom::CursorType::kNorthEastResize:
|
||||||
return IDC_SIZENESW;
|
return IDC_SIZENESW;
|
||||||
case ui::CursorType::kNorthWestResize:
|
case ui::mojom::CursorType::kNorthWestResize:
|
||||||
return IDC_SIZENWSE;
|
return IDC_SIZENWSE;
|
||||||
case ui::CursorType::kSouthResize:
|
case ui::mojom::CursorType::kSouthResize:
|
||||||
return IDC_SIZENS;
|
return IDC_SIZENS;
|
||||||
case ui::CursorType::kSouthEastResize:
|
case ui::mojom::CursorType::kSouthEastResize:
|
||||||
return IDC_SIZENWSE;
|
return IDC_SIZENWSE;
|
||||||
case ui::CursorType::kSouthWestResize:
|
case ui::mojom::CursorType::kSouthWestResize:
|
||||||
return IDC_SIZENESW;
|
return IDC_SIZENESW;
|
||||||
case ui::CursorType::kWestResize:
|
case ui::mojom::CursorType::kWestResize:
|
||||||
return IDC_SIZEWE;
|
return IDC_SIZEWE;
|
||||||
case ui::CursorType::kNorthSouthResize:
|
case ui::mojom::CursorType::kNorthSouthResize:
|
||||||
return IDC_SIZENS;
|
return IDC_SIZENS;
|
||||||
case ui::CursorType::kEastWestResize:
|
case ui::mojom::CursorType::kEastWestResize:
|
||||||
return IDC_SIZEWE;
|
return IDC_SIZEWE;
|
||||||
case ui::CursorType::kNorthEastSouthWestResize:
|
case ui::mojom::CursorType::kNorthEastSouthWestResize:
|
||||||
return IDC_SIZENESW;
|
return IDC_SIZENESW;
|
||||||
case ui::CursorType::kNorthWestSouthEastResize:
|
case ui::mojom::CursorType::kNorthWestSouthEastResize:
|
||||||
return IDC_SIZENWSE;
|
return IDC_SIZENWSE;
|
||||||
case ui::CursorType::kColumnResize:
|
case ui::mojom::CursorType::kColumnResize:
|
||||||
return MAKEINTRESOURCE(IDC_COLRESIZE);
|
return MAKEINTRESOURCE(IDC_COLRESIZE);
|
||||||
case ui::CursorType::kRowResize:
|
case ui::mojom::CursorType::kRowResize:
|
||||||
return MAKEINTRESOURCE(IDC_ROWRESIZE);
|
return MAKEINTRESOURCE(IDC_ROWRESIZE);
|
||||||
case ui::CursorType::kMiddlePanning:
|
case ui::mojom::CursorType::kMiddlePanning:
|
||||||
return MAKEINTRESOURCE(IDC_PAN_MIDDLE);
|
return MAKEINTRESOURCE(IDC_PAN_MIDDLE);
|
||||||
case ui::CursorType::kEastPanning:
|
case ui::mojom::CursorType::kEastPanning:
|
||||||
return MAKEINTRESOURCE(IDC_PAN_EAST);
|
return MAKEINTRESOURCE(IDC_PAN_EAST);
|
||||||
case ui::CursorType::kNorthPanning:
|
case ui::mojom::CursorType::kNorthPanning:
|
||||||
return MAKEINTRESOURCE(IDC_PAN_NORTH);
|
return MAKEINTRESOURCE(IDC_PAN_NORTH);
|
||||||
case ui::CursorType::kNorthEastPanning:
|
case ui::mojom::CursorType::kNorthEastPanning:
|
||||||
return MAKEINTRESOURCE(IDC_PAN_NORTH_EAST);
|
return MAKEINTRESOURCE(IDC_PAN_NORTH_EAST);
|
||||||
case ui::CursorType::kNorthWestPanning:
|
case ui::mojom::CursorType::kNorthWestPanning:
|
||||||
return MAKEINTRESOURCE(IDC_PAN_NORTH_WEST);
|
return MAKEINTRESOURCE(IDC_PAN_NORTH_WEST);
|
||||||
case ui::CursorType::kSouthPanning:
|
case ui::mojom::CursorType::kSouthPanning:
|
||||||
return MAKEINTRESOURCE(IDC_PAN_SOUTH);
|
return MAKEINTRESOURCE(IDC_PAN_SOUTH);
|
||||||
case ui::CursorType::kSouthEastPanning:
|
case ui::mojom::CursorType::kSouthEastPanning:
|
||||||
return MAKEINTRESOURCE(IDC_PAN_SOUTH_EAST);
|
return MAKEINTRESOURCE(IDC_PAN_SOUTH_EAST);
|
||||||
case ui::CursorType::kSouthWestPanning:
|
case ui::mojom::CursorType::kSouthWestPanning:
|
||||||
return MAKEINTRESOURCE(IDC_PAN_SOUTH_WEST);
|
return MAKEINTRESOURCE(IDC_PAN_SOUTH_WEST);
|
||||||
case ui::CursorType::kWestPanning:
|
case ui::mojom::CursorType::kWestPanning:
|
||||||
return MAKEINTRESOURCE(IDC_PAN_WEST);
|
return MAKEINTRESOURCE(IDC_PAN_WEST);
|
||||||
case ui::CursorType::kMove:
|
case ui::mojom::CursorType::kMove:
|
||||||
return IDC_SIZEALL;
|
return IDC_SIZEALL;
|
||||||
case ui::CursorType::kVerticalText:
|
case ui::mojom::CursorType::kVerticalText:
|
||||||
return MAKEINTRESOURCE(IDC_VERTICALTEXT);
|
return MAKEINTRESOURCE(IDC_VERTICALTEXT);
|
||||||
case ui::CursorType::kCell:
|
case ui::mojom::CursorType::kCell:
|
||||||
return MAKEINTRESOURCE(IDC_CELL);
|
return MAKEINTRESOURCE(IDC_CELL);
|
||||||
case ui::CursorType::kContextMenu:
|
case ui::mojom::CursorType::kAlias:
|
||||||
return IDC_ARROW;
|
|
||||||
case ui::CursorType::kAlias:
|
|
||||||
return MAKEINTRESOURCE(IDC_ALIAS);
|
return MAKEINTRESOURCE(IDC_ALIAS);
|
||||||
case ui::CursorType::kProgress:
|
case ui::mojom::CursorType::kProgress:
|
||||||
return IDC_APPSTARTING;
|
return IDC_APPSTARTING;
|
||||||
case ui::CursorType::kNoDrop:
|
case ui::mojom::CursorType::kNoDrop:
|
||||||
return IDC_NO;
|
return IDC_NO;
|
||||||
case ui::CursorType::kCopy:
|
case ui::mojom::CursorType::kCopy:
|
||||||
return MAKEINTRESOURCE(IDC_COPYCUR);
|
return MAKEINTRESOURCE(IDC_COPYCUR);
|
||||||
case ui::CursorType::kNone:
|
case ui::mojom::CursorType::kNotAllowed:
|
||||||
return MAKEINTRESOURCE(IDC_CURSOR_NONE);
|
|
||||||
case ui::CursorType::kNotAllowed:
|
|
||||||
return IDC_NO;
|
return IDC_NO;
|
||||||
case ui::CursorType::kZoomIn:
|
case ui::mojom::CursorType::kZoomIn:
|
||||||
return MAKEINTRESOURCE(IDC_ZOOMIN);
|
return MAKEINTRESOURCE(IDC_ZOOMIN);
|
||||||
case ui::CursorType::kZoomOut:
|
case ui::mojom::CursorType::kZoomOut:
|
||||||
return MAKEINTRESOURCE(IDC_ZOOMOUT);
|
return MAKEINTRESOURCE(IDC_ZOOMOUT);
|
||||||
case ui::CursorType::kGrab:
|
case ui::mojom::CursorType::kGrab:
|
||||||
return MAKEINTRESOURCE(IDC_HAND_GRAB);
|
return MAKEINTRESOURCE(IDC_HAND_GRAB);
|
||||||
case ui::CursorType::kGrabbing:
|
case ui::mojom::CursorType::kGrabbing:
|
||||||
return MAKEINTRESOURCE(IDC_HAND_GRABBING);
|
return MAKEINTRESOURCE(IDC_HAND_GRABBING);
|
||||||
case ui::CursorType::kNull:
|
case ui::mojom::CursorType::kNull:
|
||||||
return IDC_NO;
|
return IDC_NO;
|
||||||
case ui::CursorType::kMiddlePanningVertical:
|
case ui::mojom::CursorType::kMiddlePanningVertical:
|
||||||
return MAKEINTRESOURCE(IDC_PAN_MIDDLE_VERTICAL);
|
return MAKEINTRESOURCE(IDC_PAN_MIDDLE_VERTICAL);
|
||||||
case ui::CursorType::kMiddlePanningHorizontal:
|
case ui::mojom::CursorType::kMiddlePanningHorizontal:
|
||||||
return MAKEINTRESOURCE(IDC_PAN_MIDDLE_HORIZONTAL);
|
return MAKEINTRESOURCE(IDC_PAN_MIDDLE_HORIZONTAL);
|
||||||
// TODO(cef): Find better cursors for these things
|
// TODO(cef): Find better cursors for these things
|
||||||
case ui::CursorType::kDndNone:
|
case ui::mojom::CursorType::kDndNone:
|
||||||
return IDC_ARROW;
|
return IDC_ARROW;
|
||||||
case ui::CursorType::kDndMove:
|
case ui::mojom::CursorType::kDndMove:
|
||||||
return IDC_ARROW;
|
return IDC_ARROW;
|
||||||
case ui::CursorType::kDndCopy:
|
case ui::mojom::CursorType::kDndCopy:
|
||||||
return IDC_ARROW;
|
return IDC_ARROW;
|
||||||
case ui::CursorType::kDndLink:
|
case ui::mojom::CursorType::kDndLink:
|
||||||
|
return IDC_ARROW;
|
||||||
|
case ui::mojom::CursorType::kContextMenu:
|
||||||
|
case ui::mojom::CursorType::kCustom:
|
||||||
|
case ui::mojom::CursorType::kNone:
|
||||||
|
NOTIMPLEMENTED();
|
||||||
return IDC_ARROW;
|
return IDC_ARROW;
|
||||||
case ui::CursorType::kCustom:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
NOTREACHED();
|
NOTREACHED();
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -158,7 +154,14 @@ bool IsSystemCursorID(LPCWSTR cursor_id) {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor(
|
ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor(
|
||||||
ui::CursorType type) {
|
ui::mojom::CursorType type) {
|
||||||
|
// Using a dark 1x1 bit bmp kNone cursor may still cause DWM to do composition
|
||||||
|
// work unnecessarily. Better to totally remove it from the screen.
|
||||||
|
// crbug.com/1069698
|
||||||
|
if (type == ui::mojom::CursorType::kNone) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
HMODULE module_handle = NULL;
|
HMODULE module_handle = NULL;
|
||||||
const wchar_t* cursor_id = ToCursorID(type);
|
const wchar_t* cursor_id = ToCursorID(type);
|
||||||
if (!IsSystemCursorID(cursor_id)) {
|
if (!IsSystemCursorID(cursor_id)) {
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
#include "base/memory/shared_memory_mapping.h"
|
#include "base/memory/shared_memory_mapping.h"
|
||||||
#include "base/trace_event/trace_event.h"
|
#include "base/trace_event/trace_event.h"
|
||||||
#include "components/viz/common/resources/resource_sizes.h"
|
#include "components/viz/common/resources/resource_sizes.h"
|
||||||
#include "mojo/public/cpp/base/shared_memory_utils.h"
|
|
||||||
#include "mojo/public/cpp/system/platform_handle.h"
|
#include "mojo/public/cpp/system/platform_handle.h"
|
||||||
#include "skia/ext/platform_canvas.h"
|
#include "skia/ext/platform_canvas.h"
|
||||||
#include "third_party/skia/include/core/SkCanvas.h"
|
#include "third_party/skia/include/core/SkCanvas.h"
|
||||||
@@ -74,7 +73,7 @@ void SoftwareOutputDeviceProxy::Resize(const gfx::Size& viewport_pixel_size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(OS_WIN)
|
#if !defined(OS_WIN)
|
||||||
auto shm = mojo::CreateReadOnlySharedMemoryRegion(required_bytes);
|
auto shm = base::ReadOnlySharedMemoryRegion::Create(required_bytes);
|
||||||
if (!shm.IsValid()) {
|
if (!shm.IsValid()) {
|
||||||
DLOG(ERROR) << "Failed to allocate " << required_bytes << " bytes";
|
DLOG(ERROR) << "Failed to allocate " << required_bytes << " bytes";
|
||||||
return;
|
return;
|
||||||
|
@@ -134,3 +134,5 @@ void CefVideoConsumerOSR::OnFrameCaptured(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CefVideoConsumerOSR::OnStopped() {}
|
void CefVideoConsumerOSR::OnStopped() {}
|
||||||
|
|
||||||
|
void CefVideoConsumerOSR::OnLog(const std::string& message) {}
|
||||||
|
@@ -27,7 +27,7 @@ class CefVideoConsumerOSR : public viz::mojom::FrameSinkVideoConsumer {
|
|||||||
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
|
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
|
||||||
callbacks) override;
|
callbacks) override;
|
||||||
void OnStopped() override;
|
void OnStopped() override;
|
||||||
void OnLog(const std::string& message) override {}
|
void OnLog(const std::string& message) override;
|
||||||
|
|
||||||
CefRenderWidgetHostViewOSR* const view_;
|
CefRenderWidgetHostViewOSR* const view_;
|
||||||
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
|
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
|
||||||
|
@@ -29,8 +29,7 @@ void CefWebContentsViewOSR::WebContentsCreated(
|
|||||||
DCHECK(!web_contents_);
|
DCHECK(!web_contents_);
|
||||||
web_contents_ = web_contents;
|
web_contents_ = web_contents;
|
||||||
|
|
||||||
// Call this again for popup browsers now that the view should exist.
|
RenderViewReady();
|
||||||
RenderViewCreated(web_contents_->GetRenderViewHost());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gfx::NativeView CefWebContentsViewOSR::GetNativeView() const {
|
gfx::NativeView CefWebContentsViewOSR::GetNativeView() const {
|
||||||
@@ -49,8 +48,6 @@ void CefWebContentsViewOSR::GetContainerBounds(gfx::Rect* out) const {
|
|||||||
*out = GetViewBounds();
|
*out = GetViewBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefWebContentsViewOSR::SizeContents(const gfx::Size& size) {}
|
|
||||||
|
|
||||||
void CefWebContentsViewOSR::Focus() {}
|
void CefWebContentsViewOSR::Focus() {}
|
||||||
|
|
||||||
void CefWebContentsViewOSR::SetInitialFocus() {}
|
void CefWebContentsViewOSR::SetInitialFocus() {}
|
||||||
@@ -123,17 +120,16 @@ CefWebContentsViewOSR::CreateViewForChildWidget(
|
|||||||
|
|
||||||
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {}
|
void CefWebContentsViewOSR::SetPageTitle(const base::string16& title) {}
|
||||||
|
|
||||||
void CefWebContentsViewOSR::RenderViewCreated(content::RenderViewHost* host) {
|
void CefWebContentsViewOSR::RenderViewReady() {
|
||||||
if (!host)
|
if (web_contents_) {
|
||||||
return;
|
auto host = web_contents_->GetRenderViewHost();
|
||||||
CefRenderWidgetHostViewOSR* view =
|
CefRenderWidgetHostViewOSR* view =
|
||||||
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
|
static_cast<CefRenderWidgetHostViewOSR*>(host->GetWidget()->GetView());
|
||||||
if (view)
|
if (view)
|
||||||
view->InstallTransparency();
|
view->InstallTransparency();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CefWebContentsViewOSR::RenderViewReady() {}
|
|
||||||
|
|
||||||
void CefWebContentsViewOSR::RenderViewHostChanged(
|
void CefWebContentsViewOSR::RenderViewHostChanged(
|
||||||
content::RenderViewHost* old_host,
|
content::RenderViewHost* old_host,
|
||||||
content::RenderViewHost* new_host) {}
|
content::RenderViewHost* new_host) {}
|
||||||
|
@@ -36,7 +36,6 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
|||||||
gfx::NativeView GetContentNativeView() const override;
|
gfx::NativeView GetContentNativeView() const override;
|
||||||
gfx::NativeWindow GetTopLevelNativeWindow() const override;
|
gfx::NativeWindow GetTopLevelNativeWindow() const override;
|
||||||
void GetContainerBounds(gfx::Rect* out) const override;
|
void GetContainerBounds(gfx::Rect* out) const override;
|
||||||
void SizeContents(const gfx::Size& size) override;
|
|
||||||
void Focus() override;
|
void Focus() override;
|
||||||
void SetInitialFocus() override;
|
void SetInitialFocus() override;
|
||||||
void StoreFocus() override;
|
void StoreFocus() override;
|
||||||
@@ -50,7 +49,6 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
|||||||
content::RenderWidgetHostViewBase* CreateViewForChildWidget(
|
content::RenderWidgetHostViewBase* CreateViewForChildWidget(
|
||||||
content::RenderWidgetHost* render_widget_host) override;
|
content::RenderWidgetHost* render_widget_host) override;
|
||||||
void SetPageTitle(const base::string16& title) override;
|
void SetPageTitle(const base::string16& title) override;
|
||||||
void RenderViewCreated(content::RenderViewHost* host) override;
|
|
||||||
void RenderViewReady() override;
|
void RenderViewReady() override;
|
||||||
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
||||||
content::RenderViewHost* new_host) override;
|
content::RenderViewHost* new_host) override;
|
||||||
|
@@ -65,6 +65,11 @@ void CefPrefStore::SetValueSilently(const std::string& key,
|
|||||||
committed_ = false;
|
committed_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CefPrefStore::RemoveValuesByPrefixSilently(const std::string& prefix) {
|
||||||
|
prefs_.ClearWithPrefix(prefix);
|
||||||
|
committed_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
void CefPrefStore::RemoveValue(const std::string& key, uint32_t flags) {
|
void CefPrefStore::RemoveValue(const std::string& key, uint32_t flags) {
|
||||||
if (prefs_.RemoveValue(key)) {
|
if (prefs_.RemoveValue(key)) {
|
||||||
committed_ = false;
|
committed_ = false;
|
||||||
|
@@ -40,6 +40,7 @@ class CefPrefStore : public PersistentPrefStore {
|
|||||||
void SetValueSilently(const std::string& key,
|
void SetValueSilently(const std::string& key,
|
||||||
std::unique_ptr<base::Value> value,
|
std::unique_ptr<base::Value> value,
|
||||||
uint32_t flags) override;
|
uint32_t flags) override;
|
||||||
|
void RemoveValuesByPrefixSilently(const std::string& prefix) override;
|
||||||
void RemoveValue(const std::string& key, uint32_t flags) override;
|
void RemoveValue(const std::string& key, uint32_t flags) override;
|
||||||
bool ReadOnly() const override;
|
bool ReadOnly() const override;
|
||||||
PrefReadError GetReadError() const override;
|
PrefReadError GetReadError() const override;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user