mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
36 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
bf03589c4d | ||
|
a4a78d1254 | ||
|
babcf94317 | ||
|
1a5bcf17bd | ||
|
c8d4f85687 | ||
|
7d5d193cf7 | ||
|
fd6631bd18 | ||
|
eb9a2ffa3d | ||
|
0889ff05e8 | ||
|
1fac1e551d | ||
|
124ce018e7 | ||
|
ed43e55867 | ||
|
38d22c402d | ||
|
42fc10a6cd | ||
|
52b62306e0 | ||
|
8758255ef7 | ||
|
b1d19f3c9e | ||
|
d91b677975 | ||
|
658928d5ad | ||
|
62f6ca21a1 | ||
|
04d461e032 | ||
|
6b8a2df316 | ||
|
07830a15a4 | ||
|
1f55c0d762 | ||
|
f5f5127a37 | ||
|
e22543f8d5 | ||
|
e840f2394d | ||
|
dede95c586 | ||
|
1bc50299fb | ||
|
1a0593dd6c | ||
|
9e69e29c9d | ||
|
bcc0a67cd6 | ||
|
1b5211033c | ||
|
1a852a1bc2 | ||
|
2cab6f1f6a | ||
|
56a01f713c |
@@ -1,6 +1,8 @@
|
||||
# This file is an addendum to the Chromium AUTHORS file.
|
||||
# Names should be added to this file like so:
|
||||
# Name or Organization <email address>
|
||||
# This file is an addendum to the Chromium AUTHORS file. It lists authors
|
||||
# through March 16, 2015 when Git was introduced for source code management.
|
||||
# A list of additional authors added after that date can be found by executing
|
||||
# this command on a local Git checkout:
|
||||
# git log --all --format="%aN <%aE>" | sort -u
|
||||
|
||||
Marshall Greenblatt <magreenblatt@gmail.com>
|
||||
Jamie Kirkpatrick <jkp@spotify.com>
|
||||
|
137
BUILD.gn
137
BUILD.gn
@@ -106,6 +106,7 @@ import("//media/media_options.gni")
|
||||
import("//mojo/public/tools/bindings/mojom.gni")
|
||||
import("//ppapi/buildflags/buildflags.gni")
|
||||
import("//printing/buildflags/buildflags.gni")
|
||||
import("//testing/test.gni")
|
||||
import("//third_party/icu/config.gni")
|
||||
import("//third_party/widevine/cdm/widevine.gni")
|
||||
import("//tools/grit/repack.gni")
|
||||
@@ -253,7 +254,6 @@ if (is_linux) {
|
||||
# Set ENABLE_PRINTING=1 ENABLE_BASIC_PRINTING=1.
|
||||
assert(enable_basic_printing)
|
||||
assert(enable_print_preview)
|
||||
assert(!enable_service_discovery)
|
||||
|
||||
# Enable support for Widevine CDM.
|
||||
assert(enable_widevine)
|
||||
@@ -263,12 +263,6 @@ if (is_clang) {
|
||||
assert(!clang_use_chrome_plugins)
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
# Use system fontconfig. This avoids a startup hang on Ubuntu 16.04.4 (see
|
||||
# issue #2424).
|
||||
assert(!use_bundled_fontconfig)
|
||||
}
|
||||
|
||||
if (is_mac) {
|
||||
# Always generate dSYM files. The make_distrib script will fail if
|
||||
# enable_dsyms=true is not explicitly set when is_official_build=false.
|
||||
@@ -303,6 +297,10 @@ gypi_paths2 = exec_script("//cef/tools/gypi_to_gn.py",
|
||||
"scope",
|
||||
[ "cef_paths2.gypi" ])
|
||||
|
||||
includes_common = gypi_paths2.includes_common + gypi_paths2.includes_common_capi
|
||||
includes_mac = gypi_paths2.includes_mac + gypi_paths2.includes_mac_capi
|
||||
includes_linux = gypi_paths2.includes_linux + gypi_paths2.includes_linux_capi
|
||||
includes_win = gypi_paths2.includes_win + gypi_paths2.includes_win_capi
|
||||
|
||||
#
|
||||
# Targets that will be built when depending on "//cef".
|
||||
@@ -313,6 +311,7 @@ group("cef") {
|
||||
deps = [
|
||||
":cefsimple",
|
||||
":ceftests",
|
||||
":libcef_static_unittests",
|
||||
]
|
||||
|
||||
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") {
|
||||
sources = gypi_paths2.includes_common +
|
||||
sources = includes_common +
|
||||
gypi_paths.autogen_cpp_includes + [
|
||||
"libcef/browser/audio_capturer.cc",
|
||||
"libcef/browser/audio_capturer.h",
|
||||
"libcef/browser/browser_context.cc",
|
||||
"libcef/browser/browser_context.h",
|
||||
"libcef/browser/browser_context_keyed_service_factories.cc",
|
||||
@@ -407,10 +443,14 @@ static_library("libcef_static") {
|
||||
"libcef/browser/context.h",
|
||||
"libcef/browser/context_menu_params_impl.cc",
|
||||
"libcef/browser/context_menu_params_impl.h",
|
||||
"libcef/browser/devtools/devtools_controller.cc",
|
||||
"libcef/browser/devtools/devtools_controller.h",
|
||||
"libcef/browser/devtools/devtools_file_manager.cc",
|
||||
"libcef/browser/devtools/devtools_file_manager.h",
|
||||
"libcef/browser/devtools/devtools_frontend.cc",
|
||||
"libcef/browser/devtools/devtools_frontend.h",
|
||||
"libcef/browser/devtools/devtools_manager.cc",
|
||||
"libcef/browser/devtools/devtools_manager.h",
|
||||
"libcef/browser/devtools/devtools_manager_delegate.cc",
|
||||
"libcef/browser/devtools/devtools_manager_delegate.h",
|
||||
"libcef/browser/download_item_impl.cc",
|
||||
@@ -706,17 +746,6 @@ static_library("libcef_static") {
|
||||
"libcef/renderer/url_loader_throttle_provider_impl.h",
|
||||
"libcef/renderer/v8_impl.cc",
|
||||
"libcef/renderer/v8_impl.h",
|
||||
|
||||
"//chrome/browser/local_discovery/service_discovery_device_lister.cc",
|
||||
"//chrome/browser/local_discovery/service_discovery_device_lister.h",
|
||||
"//chrome/browser/local_discovery/service_discovery_client_impl.cc",
|
||||
"//chrome/browser/local_discovery/service_discovery_client_impl.h",
|
||||
"//chrome/browser/local_discovery/service_discovery_client.cc",
|
||||
"//chrome/browser/local_discovery/service_discovery_client.h",
|
||||
"//chrome/browser/local_discovery/service_discovery_client_mdns.cc",
|
||||
"//chrome/browser/local_discovery/service_discovery_client_mdns.h",
|
||||
"//chrome/browser/local_discovery/service_discovery_shared_client.cc",
|
||||
"//chrome/browser/local_discovery/service_discovery_shared_client.h",
|
||||
]
|
||||
|
||||
configs += [
|
||||
@@ -745,6 +774,8 @@ static_library("libcef_static") {
|
||||
":cef_make_headers",
|
||||
":cef_service_manifests",
|
||||
|
||||
":libcef_static_unittested",
|
||||
|
||||
# Generate API bindings for extensions.
|
||||
# TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
|
||||
# libcef/common/extensions/api/README.txt for details.
|
||||
@@ -847,7 +878,7 @@ static_library("libcef_static") {
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
sources += gypi_paths2.includes_win + [
|
||||
sources += includes_win + [
|
||||
"libcef/browser/browser_main_win.cc",
|
||||
"libcef/browser/native/browser_platform_delegate_native_win.cc",
|
||||
"libcef/browser/native/browser_platform_delegate_native_win.h",
|
||||
@@ -892,7 +923,7 @@ static_library("libcef_static") {
|
||||
}
|
||||
|
||||
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.h",
|
||||
"libcef/browser/native/menu_runner_linux.cc",
|
||||
@@ -924,7 +955,7 @@ static_library("libcef_static") {
|
||||
}
|
||||
|
||||
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.mm",
|
||||
"libcef/browser/native/file_dialog_runner_mac.h",
|
||||
@@ -1138,7 +1169,7 @@ config("libcef_dll_wrapper_config") {
|
||||
|
||||
# libcef_dll_wrapper target.
|
||||
static_library("libcef_dll_wrapper") {
|
||||
sources = gypi_paths2.includes_common +
|
||||
sources = includes_common +
|
||||
gypi_paths.autogen_cpp_includes +
|
||||
gypi_paths2.includes_capi +
|
||||
gypi_paths.autogen_capi_includes +
|
||||
@@ -1494,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.
|
||||
group("cef_make_headers") {
|
||||
deps = [
|
||||
":make_pack_header_resources",
|
||||
":make_pack_header_strings",
|
||||
":make_api_hash_header",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1634,8 +1683,8 @@ if (is_mac) {
|
||||
"Resources",
|
||||
]
|
||||
|
||||
sources = gypi_paths2.includes_common +
|
||||
gypi_paths2.includes_mac +
|
||||
sources = includes_common +
|
||||
includes_mac +
|
||||
gypi_paths.autogen_cpp_includes +
|
||||
gypi_paths2.includes_capi +
|
||||
gypi_paths.autogen_capi_includes +
|
||||
@@ -1678,7 +1727,7 @@ if (is_mac) {
|
||||
}
|
||||
} else {
|
||||
shared_library("libcef") {
|
||||
sources = gypi_paths2.includes_common +
|
||||
sources = includes_common +
|
||||
gypi_paths.autogen_cpp_includes +
|
||||
gypi_paths2.includes_capi +
|
||||
gypi_paths.autogen_capi_includes +
|
||||
@@ -1690,7 +1739,7 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
sources += gypi_paths2.includes_win + [
|
||||
sources += includes_win + [
|
||||
"libcef_dll/libcef_dll.rc",
|
||||
]
|
||||
|
||||
@@ -1901,8 +1950,8 @@ if (is_mac) {
|
||||
|
||||
cef_app("cefclient") {
|
||||
helper_info_plist = "tests/cefclient/resources/mac/helper-Info.plist"
|
||||
helper_sources = gypi_paths2.includes_mac +
|
||||
gypi_paths2.includes_common +
|
||||
helper_sources = includes_common +
|
||||
includes_mac +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_mac +
|
||||
gypi_paths2.shared_sources_common +
|
||||
@@ -1915,8 +1964,8 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
info_plist = "tests/cefclient/resources/mac/Info.plist"
|
||||
sources = gypi_paths2.includes_mac +
|
||||
gypi_paths2.includes_common +
|
||||
sources = includes_common +
|
||||
includes_mac +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_mac +
|
||||
gypi_paths2.shared_sources_browser +
|
||||
@@ -1974,8 +2023,8 @@ if (is_mac) {
|
||||
|
||||
cef_app("cefsimple") {
|
||||
helper_info_plist = "tests/cefsimple/mac/helper-Info.plist"
|
||||
helper_sources = gypi_paths2.includes_mac +
|
||||
gypi_paths2.includes_common +
|
||||
helper_sources = includes_common +
|
||||
includes_mac +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_mac +
|
||||
gypi_paths2.cefsimple_sources_mac_helper
|
||||
@@ -1984,8 +2033,8 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
info_plist = "tests/cefsimple/mac/Info.plist"
|
||||
sources = gypi_paths2.includes_mac +
|
||||
gypi_paths2.includes_common +
|
||||
sources = includes_common +
|
||||
includes_mac +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_mac +
|
||||
gypi_paths2.cefsimple_sources_common +
|
||||
@@ -2051,8 +2100,8 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
info_plist = "tests/ceftests/resources/mac/Info.plist"
|
||||
sources = gypi_paths2.includes_mac +
|
||||
gypi_paths2.includes_common +
|
||||
sources = includes_common +
|
||||
includes_mac +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.includes_wrapper_mac +
|
||||
gypi_paths2.shared_sources_browser +
|
||||
@@ -2120,7 +2169,7 @@ if (is_mac) {
|
||||
}
|
||||
|
||||
executable("cefclient") {
|
||||
sources = gypi_paths2.includes_common +
|
||||
sources = includes_common +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.shared_sources_browser +
|
||||
gypi_paths2.shared_sources_common +
|
||||
@@ -2139,7 +2188,7 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
sources += gypi_paths2.includes_win +
|
||||
sources += includes_win +
|
||||
gypi_paths2.shared_sources_win +
|
||||
gypi_paths2.cefclient_sources_win
|
||||
|
||||
@@ -2174,7 +2223,7 @@ if (is_mac) {
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
sources += gypi_paths2.includes_linux +
|
||||
sources += includes_linux +
|
||||
gypi_paths2.shared_sources_linux +
|
||||
gypi_paths2.cefclient_sources_linux
|
||||
|
||||
@@ -2213,7 +2262,7 @@ if (is_mac) {
|
||||
#
|
||||
|
||||
executable("cefsimple") {
|
||||
sources = gypi_paths2.includes_common +
|
||||
sources = includes_common +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.cefsimple_sources_common
|
||||
|
||||
@@ -2227,7 +2276,7 @@ if (is_mac) {
|
||||
]
|
||||
|
||||
if (is_win) {
|
||||
sources += gypi_paths2.includes_win +
|
||||
sources += includes_win +
|
||||
gypi_paths2.cefsimple_sources_win
|
||||
|
||||
# Set /SUBSYSTEM:WINDOWS.
|
||||
@@ -2247,7 +2296,7 @@ if (is_mac) {
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
sources += gypi_paths2.includes_linux +
|
||||
sources += includes_linux +
|
||||
gypi_paths2.cefsimple_sources_linux
|
||||
|
||||
if (use_x11) {
|
||||
@@ -2278,7 +2327,7 @@ if (is_mac) {
|
||||
executable("ceftests") {
|
||||
testonly = true
|
||||
|
||||
sources = gypi_paths2.includes_common +
|
||||
sources = includes_common +
|
||||
gypi_paths2.includes_wrapper +
|
||||
gypi_paths2.shared_sources_browser +
|
||||
gypi_paths2.shared_sources_common +
|
||||
|
@@ -7,5 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/83.0.4103.0'
|
||||
'chromium_checkout': 'refs/tags/83.0.4103.106',
|
||||
'depot_tools_checkout': 'fc5e103221'
|
||||
}
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# by hand. See the translator.README.txt file in the tools directory for
|
||||
# more information.
|
||||
#
|
||||
# $hash=578c0aef11c3c7840679e480069fc9031c628e25$
|
||||
# $hash=72268a78a76d7d91b8ad47f6b6e9f6d9cb04d9cf$
|
||||
#
|
||||
|
||||
{
|
||||
@@ -16,6 +16,7 @@
|
||||
'autogen_cpp_includes': [
|
||||
'include/cef_accessibility_handler.h',
|
||||
'include/cef_app.h',
|
||||
'include/cef_audio_handler.h',
|
||||
'include/cef_auth_callback.h',
|
||||
'include/cef_browser.h',
|
||||
'include/cef_browser_process_handler.h',
|
||||
@@ -25,6 +26,7 @@
|
||||
'include/cef_context_menu_handler.h',
|
||||
'include/cef_cookie.h',
|
||||
'include/cef_crash_util.h',
|
||||
'include/cef_devtools_message_observer.h',
|
||||
'include/cef_dialog_handler.h',
|
||||
'include/cef_display_handler.h',
|
||||
'include/cef_dom.h',
|
||||
@@ -111,6 +113,7 @@
|
||||
'autogen_capi_includes': [
|
||||
'include/capi/cef_accessibility_handler_capi.h',
|
||||
'include/capi/cef_app_capi.h',
|
||||
'include/capi/cef_audio_handler_capi.h',
|
||||
'include/capi/cef_auth_callback_capi.h',
|
||||
'include/capi/cef_browser_capi.h',
|
||||
'include/capi/cef_browser_process_handler_capi.h',
|
||||
@@ -120,6 +123,7 @@
|
||||
'include/capi/cef_context_menu_handler_capi.h',
|
||||
'include/capi/cef_cookie_capi.h',
|
||||
'include/capi/cef_crash_util_capi.h',
|
||||
'include/capi/cef_devtools_message_observer_capi.h',
|
||||
'include/capi/cef_dialog_handler_capi.h',
|
||||
'include/capi/cef_display_handler_capi.h',
|
||||
'include/capi/cef_dom_capi.h',
|
||||
@@ -208,6 +212,8 @@
|
||||
'libcef_dll/ctocpp/accessibility_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/app_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/app_ctocpp.h',
|
||||
'libcef_dll/ctocpp/audio_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/audio_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/auth_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/auth_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/before_download_callback_cpptoc.cc',
|
||||
@@ -256,6 +262,8 @@
|
||||
'libcef_dll/ctocpp/domvisitor_ctocpp.h',
|
||||
'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/delete_cookies_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.h',
|
||||
'libcef_dll/ctocpp/dialog_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/dialog_handler_ctocpp.h',
|
||||
'libcef_dll/cpptoc/dictionary_value_cpptoc.cc',
|
||||
@@ -322,6 +330,8 @@
|
||||
'libcef_dll/cpptoc/media_router_cpptoc.h',
|
||||
'libcef_dll/cpptoc/media_sink_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_sink_cpptoc.h',
|
||||
'libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/media_source_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_source_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/menu_button_cpptoc.cc',
|
||||
@@ -512,6 +522,8 @@
|
||||
'libcef_dll/cpptoc/accessibility_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/app_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/app_cpptoc.h',
|
||||
'libcef_dll/cpptoc/audio_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/audio_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/auth_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/auth_callback_ctocpp.h',
|
||||
'libcef_dll/ctocpp/before_download_callback_ctocpp.cc',
|
||||
@@ -560,6 +572,8 @@
|
||||
'libcef_dll/cpptoc/domvisitor_cpptoc.h',
|
||||
'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/delete_cookies_callback_cpptoc.h',
|
||||
'libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.h',
|
||||
'libcef_dll/cpptoc/dialog_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/dialog_handler_cpptoc.h',
|
||||
'libcef_dll/ctocpp/dictionary_value_ctocpp.cc',
|
||||
@@ -626,6 +640,8 @@
|
||||
'libcef_dll/ctocpp/media_router_ctocpp.h',
|
||||
'libcef_dll/ctocpp/media_sink_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_sink_ctocpp.h',
|
||||
'libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/media_source_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_source_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/menu_button_ctocpp.cc',
|
||||
|
@@ -39,19 +39,21 @@
|
||||
'include/cef_config.h',
|
||||
'include/cef_version.h',
|
||||
'include/internal/cef_export.h',
|
||||
'include/internal/cef_logging_internal.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_list.h',
|
||||
'include/internal/cef_string_map.h',
|
||||
'include/internal/cef_string_multimap.h',
|
||||
'include/internal/cef_string_types.h',
|
||||
'include/internal/cef_string_wrappers.h',
|
||||
'include/internal/cef_thread_internal.h',
|
||||
'include/internal/cef_time.h',
|
||||
'include/internal/cef_trace_event_internal.h',
|
||||
'include/internal/cef_types.h',
|
||||
'include/internal/cef_types_wrappers.h',
|
||||
],
|
||||
'includes_capi': [
|
||||
'include/capi/cef_base_capi.h',
|
||||
@@ -75,15 +77,19 @@
|
||||
'include/base/internal/cef_atomicops_x86_msvc.h',
|
||||
'include/base/internal/cef_bind_internal_win.h',
|
||||
'include/cef_sandbox_win.h',
|
||||
'include/internal/cef_types_win.h',
|
||||
'include/internal/cef_win.h',
|
||||
],
|
||||
'includes_win_capi': [
|
||||
'include/internal/cef_types_win.h',
|
||||
],
|
||||
'includes_mac': [
|
||||
'include/base/internal/cef_atomicops_atomicword_compat.h',
|
||||
'include/base/internal/cef_atomicops_mac.h',
|
||||
'include/cef_application_mac.h',
|
||||
'include/cef_sandbox_mac.h',
|
||||
'include/internal/cef_mac.h',
|
||||
],
|
||||
'includes_mac_capi': [
|
||||
'include/internal/cef_types_mac.h',
|
||||
],
|
||||
'includes_linux': [
|
||||
@@ -92,6 +98,8 @@
|
||||
'include/base/internal/cef_atomicops_arm64_gcc.h',
|
||||
'include/base/internal/cef_atomicops_x86_gcc.h',
|
||||
'include/internal/cef_linux.h',
|
||||
],
|
||||
'includes_linux_capi': [
|
||||
'include/internal/cef_types_linux.h',
|
||||
],
|
||||
'libcef_sources_common': [
|
||||
@@ -458,9 +466,11 @@
|
||||
'tests/cefsimple/simple_handler_linux.cc',
|
||||
],
|
||||
'ceftests_sources_common': [
|
||||
'tests/ceftests/audio_output_unittest.cc',
|
||||
'tests/ceftests/browser_info_map_unittest.cc',
|
||||
'tests/ceftests/command_line_unittest.cc',
|
||||
'tests/ceftests/cookie_unittest.cc',
|
||||
'tests/ceftests/devtools_message_unittest.cc',
|
||||
'tests/ceftests/dialog_unittest.cc',
|
||||
'tests/ceftests/display_unittest.cc',
|
||||
'tests/ceftests/dom_unittest.cc',
|
||||
@@ -557,6 +567,7 @@
|
||||
'tests/shared/browser/resource_util.h',
|
||||
'tests/shared/browser/resource_util_mac.mm',
|
||||
'tests/shared/browser/resource_util_posix.cc',
|
||||
'tests/ceftests/audio_output_unittest.cc',
|
||||
'tests/ceftests/client_app_delegates.cc',
|
||||
'tests/ceftests/cookie_unittest.cc',
|
||||
'tests/ceftests/dom_unittest.cc',
|
||||
|
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
|
||||
// more information.
|
||||
//
|
||||
// $hash=ba4033eaf40a8ee24408b89b78496bf1381e7e6b$
|
||||
// $hash=6cb00a0fa3631a46903abb3a783f315895511db2$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||
@@ -41,10 +41,12 @@
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_devtools_message_observer_capi.h"
|
||||
#include "include/capi/cef_drag_data_capi.h"
|
||||
#include "include/capi/cef_frame_capi.h"
|
||||
#include "include/capi/cef_image_capi.h"
|
||||
#include "include/capi/cef_navigation_entry_capi.h"
|
||||
#include "include/capi/cef_registration_capi.h"
|
||||
#include "include/capi/cef_request_context_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -484,6 +486,71 @@ typedef struct _cef_browser_host_t {
|
||||
///
|
||||
int(CEF_CALLBACK* has_dev_tools)(struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
// Send a function call message over the DevTools protocol. |message| must be
|
||||
// a UTF8-encoded JSON dictionary that contains "id" (int), "function"
|
||||
// (string) and "params" (dictionary, optional) values. See the DevTools
|
||||
// protocol documentation at https://chromedevtools.github.io/devtools-
|
||||
// protocol/ for details of supported functions and the expected "params"
|
||||
// dictionary contents. |message| will be copied if necessary. This function
|
||||
// will return true (1) if called on the UI thread and the message was
|
||||
// successfully submitted for validation, otherwise false (0). Validation will
|
||||
// be applied asynchronously and any messages that fail due to formatting
|
||||
// errors or missing parameters may be discarded without notification. Prefer
|
||||
// ExecuteDevToolsMethod if a more structured approach to message formatting
|
||||
// is desired.
|
||||
//
|
||||
// Every valid function call will result in an asynchronous function result or
|
||||
// error message that references the sent message "id". Event messages are
|
||||
// received while notifications are enabled (for example, between function
|
||||
// calls for "Page.enable" and "Page.disable"). All received messages will be
|
||||
// delivered to the observer(s) registered with AddDevToolsMessageObserver.
|
||||
// See cef_dev_tools_message_observer_t::OnDevToolsMessage documentation for
|
||||
// details of received message contents.
|
||||
//
|
||||
// Usage of the SendDevToolsMessage, ExecuteDevToolsMethod and
|
||||
// AddDevToolsMessageObserver functions does not require an active DevTools
|
||||
// front-end or remote-debugging session. Other active DevTools sessions will
|
||||
// continue to function independently. However, any modification of global
|
||||
// browser state by one session may not be reflected in the UI of other
|
||||
// sessions.
|
||||
//
|
||||
// Communication with the DevTools front-end (when displayed) can be logged
|
||||
// for development purposes by passing the `--devtools-protocol-log-
|
||||
// file=<path>` command-line flag.
|
||||
///
|
||||
int(CEF_CALLBACK* send_dev_tools_message)(struct _cef_browser_host_t* self,
|
||||
const void* message,
|
||||
size_t message_size);
|
||||
|
||||
///
|
||||
// Execute a function call over the DevTools protocol. This is a more
|
||||
// structured version of SendDevToolsMessage. |message_id| is an incremental
|
||||
// number that uniquely identifies the message (pass 0 to have the next number
|
||||
// assigned automatically based on previous values). |function| is the
|
||||
// function name. |params| are the function parameters, which may be NULL. See
|
||||
// the DevTools protocol documentation (linked above) for details of supported
|
||||
// functions and the expected |params| dictionary contents. This function will
|
||||
// return the assigned message ID if called on the UI thread and the message
|
||||
// was successfully submitted for validation, otherwise 0. See the
|
||||
// SendDevToolsMessage documentation for additional usage information.
|
||||
///
|
||||
int(CEF_CALLBACK* execute_dev_tools_method)(
|
||||
struct _cef_browser_host_t* self,
|
||||
int message_id,
|
||||
const cef_string_t* method,
|
||||
struct _cef_dictionary_value_t* params);
|
||||
|
||||
///
|
||||
// Add an observer for DevTools protocol messages (function results and
|
||||
// events). The observer will remain registered until the returned
|
||||
// Registration object is destroyed. See the SendDevToolsMessage documentation
|
||||
// for additional usage information.
|
||||
///
|
||||
struct _cef_registration_t*(CEF_CALLBACK* add_dev_tools_message_observer)(
|
||||
struct _cef_browser_host_t* self,
|
||||
struct _cef_dev_tools_message_observer_t* observer);
|
||||
|
||||
///
|
||||
// Retrieve a snapshot of current navigation entries as values sent to the
|
||||
// specified visitor. If |current_only| is true (1) only the current
|
||||
|
@@ -33,13 +33,14 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=6a0312765614a697d56e87c8503afba8404bb08b$
|
||||
// $hash=8d4cb3e0bbf230804c93898daa4a8b2866a2c1ce$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_audio_handler_capi.h"
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_context_menu_handler_capi.h"
|
||||
#include "include/capi/cef_dialog_handler_capi.h"
|
||||
@@ -69,6 +70,12 @@ typedef struct _cef_client_t {
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Return the handler for audio rendering events.
|
||||
///
|
||||
struct _cef_audio_handler_t*(CEF_CALLBACK* get_audio_handler)(
|
||||
struct _cef_client_t* self);
|
||||
|
||||
///
|
||||
// Return the handler for context menus. If no handler is provided the default
|
||||
// implementation will be used.
|
||||
|
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
|
||||
// more information.
|
||||
//
|
||||
// $hash=a7070419332ec8f6d6e4df898c8eb666b988970a$
|
||||
// $hash=9d5077fdb3fe7fa0ff1141f839988ac821eba4bf$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||
@@ -50,6 +50,7 @@ extern "C" {
|
||||
struct _cef_media_observer_t;
|
||||
struct _cef_media_route_create_callback_t;
|
||||
struct _cef_media_route_t;
|
||||
struct _cef_media_sink_device_info_callback_t;
|
||||
struct _cef_media_sink_t;
|
||||
struct _cef_media_source_t;
|
||||
|
||||
@@ -264,6 +265,19 @@ typedef struct _cef_media_sink_t {
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_description)(
|
||||
struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns the icon type for this sink.
|
||||
///
|
||||
cef_media_sink_icon_type_t(CEF_CALLBACK* get_icon_type)(
|
||||
struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Asynchronously retrieves device info.
|
||||
///
|
||||
void(CEF_CALLBACK* get_device_info)(
|
||||
struct _cef_media_sink_t* self,
|
||||
struct _cef_media_sink_device_info_callback_t* callback);
|
||||
|
||||
///
|
||||
// Returns true (1) if this sink accepts content via Cast.
|
||||
///
|
||||
@@ -281,6 +295,25 @@ typedef struct _cef_media_sink_t {
|
||||
struct _cef_media_source_t* source);
|
||||
} cef_media_sink_t;
|
||||
|
||||
///
|
||||
// Callback structure for cef_media_sink_t::GetDeviceInfo. The functions of this
|
||||
// structure will be called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_media_sink_device_info_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Method that will be executed asyncronously once device information has been
|
||||
// retrieved.
|
||||
///
|
||||
void(CEF_CALLBACK* on_media_sink_device_info)(
|
||||
struct _cef_media_sink_device_info_callback_t* self,
|
||||
const struct _cef_media_sink_device_info_t* device_info);
|
||||
} cef_media_sink_device_info_callback_t;
|
||||
|
||||
///
|
||||
// Represents a source from which media can be routed. Instances of this object
|
||||
// are retrieved via cef_media_router_t::GetSource. The functions of this
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=3bc4225f43428d8a3a24dcac1830dafac18b0caf$
|
||||
// $hash=14cf03e02d8ca3416e65f756470afd8185c7bc78$
|
||||
//
|
||||
|
||||
#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,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
// Parses the specified UTF8-encoded |json| buffer of size |json_size| and
|
||||
// returns a dictionary or list representation. If JSON parsing fails this
|
||||
// function returns NULL.
|
||||
///
|
||||
CEF_EXPORT struct _cef_value_t* cef_parse_json_buffer(
|
||||
const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
// Parses the specified |json_string| and returns a dictionary or list
|
||||
// representation. If JSON parsing fails this function returns NULL and
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=a28219cc8c1cb53faacaf236374c3cf2c0c45bef$
|
||||
// $hash=0167eb1abe614bd6391d273a8085fa3e53e7c217$
|
||||
//
|
||||
|
||||
#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_browser_t* browser,
|
||||
cef_termination_status_t status);
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when the window.document object of
|
||||
// the main frame has been created.
|
||||
///
|
||||
void(CEF_CALLBACK* on_document_available_in_main_frame)(
|
||||
struct _cef_request_handler_t* self,
|
||||
struct _cef_browser_t* browser);
|
||||
} cef_request_handler_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -29,12 +29,7 @@
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=af15b08731cc133c3974ceb18002b146a53b9c9e$
|
||||
// This file was generated by the make_api_hash_header.py tool.
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_API_HASH_H_
|
||||
@@ -47,13 +42,13 @@
|
||||
// way that may cause binary incompatibility with other builds. The universal
|
||||
// hash value will change if any platform is affected whereas the platform hash
|
||||
// values will change only if that particular platform is affected.
|
||||
#define CEF_API_HASH_UNIVERSAL "f76dc8c40e454ef26318d0f83312dadaf909e4c5"
|
||||
#define CEF_API_HASH_UNIVERSAL "385d8af3c6da76f123f3aa292d3a3308ef456297"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "831ef33853bb8575bcd097ba65851d4d98a08db8"
|
||||
#define CEF_API_HASH_PLATFORM "4bb528b0bb076ed5177d6581cfca12dd7b2fee04"
|
||||
#elif defined(OS_MACOSX)
|
||||
#define CEF_API_HASH_PLATFORM "0944363458590a23d84e99eb1b81372be6784b97"
|
||||
#define CEF_API_HASH_PLATFORM "f6580fc0858f3580b7d25e1d094dd0a336132522"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "dfd012193a93782cd4b041f4cd71e1e8f2ca401e"
|
||||
#define CEF_API_HASH_PLATFORM "83f3053840abba3b83e43ade58230f10b48591dd"
|
||||
#endif
|
||||
|
||||
#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 "include/cef_base.h"
|
||||
#include "include/cef_devtools_message_observer.h"
|
||||
#include "include/cef_drag_data.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_image.h"
|
||||
#include "include/cef_navigation_entry.h"
|
||||
#include "include/cef_registration.h"
|
||||
#include "include/cef_request_context.h"
|
||||
|
||||
class CefBrowserHost;
|
||||
@@ -517,6 +519,69 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual bool HasDevTools() = 0;
|
||||
|
||||
///
|
||||
// Send a method call message over the DevTools protocol. |message| must be a
|
||||
// UTF8-encoded JSON dictionary that contains "id" (int), "method" (string)
|
||||
// and "params" (dictionary, optional) values. See the DevTools protocol
|
||||
// documentation at https://chromedevtools.github.io/devtools-protocol/ for
|
||||
// details of supported methods and the expected "params" dictionary contents.
|
||||
// |message| will be copied if necessary. This method will return true if
|
||||
// called on the UI thread and the message was successfully submitted for
|
||||
// validation, otherwise false. Validation will be applied asynchronously and
|
||||
// any messages that fail due to formatting errors or missing parameters may
|
||||
// be discarded without notification. Prefer ExecuteDevToolsMethod if a more
|
||||
// structured approach to message formatting is desired.
|
||||
//
|
||||
// Every valid method call will result in an asynchronous method result or
|
||||
// error message that references the sent message "id". Event messages are
|
||||
// received while notifications are enabled (for example, between method calls
|
||||
// for "Page.enable" and "Page.disable"). All received messages will be
|
||||
// delivered to the observer(s) registered with AddDevToolsMessageObserver.
|
||||
// See CefDevToolsMessageObserver::OnDevToolsMessage documentation for details
|
||||
// of received message contents.
|
||||
//
|
||||
// Usage of the SendDevToolsMessage, ExecuteDevToolsMethod and
|
||||
// AddDevToolsMessageObserver methods does not require an active DevTools
|
||||
// front-end or remote-debugging session. Other active DevTools sessions will
|
||||
// continue to function independently. However, any modification of global
|
||||
// browser state by one session may not be reflected in the UI of other
|
||||
// sessions.
|
||||
//
|
||||
// Communication with the DevTools front-end (when displayed) can be logged
|
||||
// for development purposes by passing the
|
||||
// `--devtools-protocol-log-file=<path>` command-line flag.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool SendDevToolsMessage(const void* message,
|
||||
size_t message_size) = 0;
|
||||
|
||||
///
|
||||
// Execute a method call over the DevTools protocol. This is a more structured
|
||||
// version of SendDevToolsMessage. |message_id| is an incremental number that
|
||||
// uniquely identifies the message (pass 0 to have the next number assigned
|
||||
// automatically based on previous values). |method| is the method name.
|
||||
// |params| are the method parameters, which may be empty. See the DevTools
|
||||
// protocol documentation (linked above) for details of supported methods and
|
||||
// the expected |params| dictionary contents. This method will return the
|
||||
// assigned message ID if called on the UI thread and the message was
|
||||
// successfully submitted for validation, otherwise 0. See the
|
||||
// SendDevToolsMessage documentation for additional usage information.
|
||||
///
|
||||
/*--cef(optional_param=params)--*/
|
||||
virtual int ExecuteDevToolsMethod(int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) = 0;
|
||||
|
||||
///
|
||||
// Add an observer for DevTools protocol messages (method results and events).
|
||||
// The observer will remain registered until the returned Registration object
|
||||
// is destroyed. See the SendDevToolsMessage documentation for additional
|
||||
// usage information.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefRegistration> AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) = 0;
|
||||
|
||||
///
|
||||
// Retrieve a snapshot of current navigation entries as values sent to the
|
||||
// specified visitor. If |current_only| is true only the current navigation
|
||||
|
@@ -38,6 +38,7 @@
|
||||
#define CEF_INCLUDE_CEF_CLIENT_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_audio_handler.h"
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_context_menu_handler.h"
|
||||
#include "include/cef_dialog_handler.h"
|
||||
@@ -60,6 +61,12 @@
|
||||
/*--cef(source=client,no_debugct_check)--*/
|
||||
class CefClient : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Return the handler for audio rendering events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefAudioHandler> GetAudioHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for context menus. If no handler is provided the default
|
||||
// implementation will be used.
|
||||
|
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 CefMediaRouteCreateCallback;
|
||||
class CefMediaSink;
|
||||
class CefMediaSinkDeviceInfoCallback;
|
||||
class CefMediaSource;
|
||||
|
||||
///
|
||||
@@ -221,6 +222,8 @@ class CefMediaRouteCreateCallback : public virtual CefBaseRefCounted {
|
||||
/*--cef(source=library)--*/
|
||||
class CefMediaSink : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
typedef cef_media_sink_icon_type_t IconType;
|
||||
|
||||
///
|
||||
// Returns the ID for this sink.
|
||||
///
|
||||
@@ -245,6 +248,19 @@ class CefMediaSink : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual CefString GetDescription() = 0;
|
||||
|
||||
///
|
||||
// Returns the icon type for this sink.
|
||||
///
|
||||
/*--cef(default_retval=CEF_MSIT_GENERIC)--*/
|
||||
virtual IconType GetIconType() = 0;
|
||||
|
||||
///
|
||||
// Asynchronously retrieves device info.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Returns true if this sink accepts content via Cast.
|
||||
///
|
||||
@@ -264,6 +280,22 @@ class CefMediaSink : public virtual CefBaseRefCounted {
|
||||
virtual bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Callback interface for CefMediaSink::GetDeviceInfo. The methods of this
|
||||
// class will be called on the browser process UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefMediaSinkDeviceInfoCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Method that will be executed asyncronously once device information has been
|
||||
// retrieved.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnMediaSinkDeviceInfo(
|
||||
const CefMediaSinkDeviceInfo& device_info) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Represents a source from which media can be routed. Instances of this object
|
||||
// are retrieved via CefMediaRouter::GetSource. The methods of this class may be
|
||||
|
@@ -133,6 +133,16 @@ CefString CefURIDecode(const CefString& text,
|
||||
CefRefPtr<CefValue> CefParseJSON(const CefString& json_string,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
// Parses the specified UTF8-encoded |json| buffer of size |json_size| and
|
||||
// returns a dictionary or list representation. If JSON parsing fails this
|
||||
// method returns NULL.
|
||||
///
|
||||
/*--cef(capi_name=cef_parse_json_buffer)--*/
|
||||
CefRefPtr<CefValue> CefParseJSON(const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options);
|
||||
|
||||
///
|
||||
// Parses the specified |json_string| and returns a dictionary or list
|
||||
// representation. If JSON parsing fails this method returns NULL and populates
|
||||
|
@@ -252,6 +252,13 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) {}
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread when the window.document object of
|
||||
// the main frame has been created.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnDocumentAvailableInMainFrame(CefRefPtr<CefBrowser> browser) {}
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REQUEST_HANDLER_H_
|
||||
|
@@ -170,23 +170,25 @@ typedef struct _cef_settings_t {
|
||||
// will be used. If this value is empty on macOS then a helper executable must
|
||||
// exist at "Contents/Frameworks/<app> Helper.app/Contents/MacOS/<app> Helper"
|
||||
// in the top-level app bundle. See the comments on CefExecuteProcess() for
|
||||
// details. Also configurable using the "browser-subprocess-path" command-line
|
||||
// switch.
|
||||
// details. If this value is non-empty then it must be an absolute path. Also
|
||||
// configurable using the "browser-subprocess-path" command-line switch.
|
||||
///
|
||||
cef_string_t browser_subprocess_path;
|
||||
|
||||
///
|
||||
// The path to the CEF framework directory on macOS. If this value is empty
|
||||
// then the framework must exist at "Contents/Frameworks/Chromium Embedded
|
||||
// Framework.framework" in the top-level app bundle. Also configurable using
|
||||
// the "framework-dir-path" command-line switch.
|
||||
// Framework.framework" in the top-level app bundle. If this value is
|
||||
// non-empty then it must be an absolute path. Also configurable using the
|
||||
// "framework-dir-path" command-line switch.
|
||||
///
|
||||
cef_string_t framework_dir_path;
|
||||
|
||||
///
|
||||
// The path to the main bundle on macOS. If this value is empty then it
|
||||
// defaults to the top-level app bundle. Also configurable using
|
||||
// the "main-bundle-path" command-line switch.
|
||||
// defaults to the top-level app bundle. If this value is non-empty then it
|
||||
// must be an absolute path. Also configurable using the "main-bundle-path"
|
||||
// command-line switch.
|
||||
///
|
||||
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
|
||||
// disk. If non-empty this must be either equal to or a child directory of
|
||||
// CefSettings.root_cache_path. If empty then browsers will be created in
|
||||
// "incognito mode" where in-memory caches are used for storage and no data is
|
||||
// persisted to disk. HTML5 databases such as localStorage will only persist
|
||||
// across sessions if a cache path is specified. Can be overridden for
|
||||
// individual CefRequestContext instances via the
|
||||
// CefRequestContextSettings.cache_path value.
|
||||
// disk. If this value is non-empty then it must be an absolute path that is
|
||||
// either equal to or a child directory of CefSettings.root_cache_path. If
|
||||
// this value is empty then browsers will be created in "incognito mode" where
|
||||
// in-memory caches are used for storage and no data is persisted to disk.
|
||||
// HTML5 databases such as localStorage will only persist across sessions if a
|
||||
// cache path is specified. Can be overridden for individual CefRequestContext
|
||||
// instances via the CefRequestContextSettings.cache_path value.
|
||||
///
|
||||
cef_string_t cache_path;
|
||||
|
||||
///
|
||||
// The root directory that all CefSettings.cache_path and
|
||||
// CefRequestContextSettings.cache_path values must have in common. If this
|
||||
// value is empty and CefSettings.cache_path is non-empty then this value will
|
||||
// default to the CefSettings.cache_path value. Failure to set this value
|
||||
// correctly may result in the sandbox blocking read/write access to the
|
||||
// cache_path directory.
|
||||
// value is empty and CefSettings.cache_path is non-empty then it will
|
||||
// default to the CefSettings.cache_path value. If this value is non-empty
|
||||
// then it must be an absolute path. Failure to set this value correctly may
|
||||
// result in the sandbox blocking read/write access to the cache_path
|
||||
// directory.
|
||||
///
|
||||
cef_string_t root_cache_path;
|
||||
|
||||
///
|
||||
// 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
|
||||
// directory will be used ("~/.cef_user_data" directory on Linux,
|
||||
// "~/Library/Application Support/CEF/User Data" directory on Mac OS X,
|
||||
// "Local Settings\Application Data\CEF\User Data" directory under the user
|
||||
// profile directory on Windows).
|
||||
// be stored on disk. If this value is empty then the default
|
||||
// platform-specific user data directory will be used ("~/.cef_user_data"
|
||||
// directory on Linux, "~/Library/Application Support/CEF/User Data" directory
|
||||
// on Mac OS X, "Local Settings\Application Data\CEF\User Data" directory
|
||||
// under the user profile directory on Windows). If this value is non-empty
|
||||
// then it must be an absolute path.
|
||||
///
|
||||
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
|
||||
// empty the cef.pak and/or devtools_resources.pak files must be located in
|
||||
// the module directory on Windows/Linux or the app bundle Resources directory
|
||||
// on Mac OS X. Also configurable using the "resources-dir-path" command-line
|
||||
// switch.
|
||||
// on Mac OS X. If this value is non-empty then it must be an absolute path.
|
||||
// Also configurable using the "resources-dir-path" command-line switch.
|
||||
///
|
||||
cef_string_t resources_dir_path;
|
||||
|
||||
///
|
||||
// The fully qualified path for the locales directory. If this value is empty
|
||||
// the locales directory must be located in the module directory. This value
|
||||
// is ignored on Mac OS X where pack files are always loaded from the app
|
||||
// bundle Resources directory. Also configurable using the "locales-dir-path"
|
||||
// the locales directory must be located in the module directory. If this
|
||||
// value is non-empty then it must be an absolute path. This value is ignored
|
||||
// on Mac OS X where pack files are always loaded from the app bundle
|
||||
// Resources directory. Also configurable using the "locales-dir-path"
|
||||
// command-line switch.
|
||||
///
|
||||
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
|
||||
// disk. If non-empty this must be either equal to or a child directory of
|
||||
// CefSettings.root_cache_path. If empty then browsers will be created in
|
||||
// "incognito mode" where in-memory caches are used for storage and no data is
|
||||
// persisted to disk. HTML5 databases such as localStorage will only persist
|
||||
// across sessions if a cache path is specified. To share the global browser
|
||||
// cache and related configuration set this value to match the
|
||||
// CefSettings.cache_path value.
|
||||
// disk. If this value is non-empty then it must be an absolute path that is
|
||||
// either equal to or a child directory of CefSettings.root_cache_path. If
|
||||
// this value is empty then browsers will be created in "incognito mode" where
|
||||
// in-memory caches are used for storage and no data is persisted to disk.
|
||||
// HTML5 databases such as localStorage will only persist across sessions if a
|
||||
// cache path is specified. To share the global browser cache and related
|
||||
// configuration set this value to match the CefSettings.cache_path value.
|
||||
///
|
||||
cef_string_t cache_path;
|
||||
|
||||
@@ -732,6 +737,25 @@ typedef struct _cef_urlparts_t {
|
||||
cef_string_t fragment;
|
||||
} cef_urlparts_t;
|
||||
|
||||
///
|
||||
// Cookie priority values.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_COOKIE_PRIORITY_LOW = -1,
|
||||
CEF_COOKIE_PRIORITY_MEDIUM = 0,
|
||||
CEF_COOKIE_PRIORITY_HIGH = 1,
|
||||
} cef_cookie_priority_t;
|
||||
|
||||
///
|
||||
// Cookie same site values.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_COOKIE_SAME_SITE_UNSPECIFIED,
|
||||
CEF_COOKIE_SAME_SITE_NO_RESTRICTION,
|
||||
CEF_COOKIE_SAME_SITE_LAX_MODE,
|
||||
CEF_COOKIE_SAME_SITE_STRICT_MODE,
|
||||
} cef_cookie_same_site_t;
|
||||
|
||||
///
|
||||
// Cookie information.
|
||||
///
|
||||
@@ -786,6 +810,16 @@ typedef struct _cef_cookie_t {
|
||||
///
|
||||
int has_expires;
|
||||
cef_time_t expires;
|
||||
|
||||
///
|
||||
// Same site.
|
||||
///
|
||||
cef_cookie_same_site_t same_site;
|
||||
|
||||
///
|
||||
// Priority.
|
||||
///
|
||||
cef_cookie_priority_t priority;
|
||||
} cef_cookie_t;
|
||||
|
||||
///
|
||||
@@ -2430,13 +2464,13 @@ typedef struct _cef_pdf_print_settings_t {
|
||||
int scale_factor;
|
||||
|
||||
///
|
||||
// Margins in millimeters. Only used if |margin_type| is set to
|
||||
// Margins in points. Only used if |margin_type| is set to
|
||||
// PDF_PRINT_MARGIN_CUSTOM.
|
||||
///
|
||||
double margin_top;
|
||||
double margin_right;
|
||||
double margin_bottom;
|
||||
double margin_left;
|
||||
int margin_top;
|
||||
int margin_right;
|
||||
int margin_bottom;
|
||||
int margin_left;
|
||||
|
||||
///
|
||||
// Margin type.
|
||||
@@ -2970,9 +3004,139 @@ typedef struct _cef_composition_underline_t {
|
||||
} cef_composition_underline_t;
|
||||
|
||||
///
|
||||
// Result codes for CefMediaRouter::CreateRoute. These constants match
|
||||
// their equivalents in Chromium's route_request_result.h and should not be
|
||||
// renumbered.
|
||||
// Enumerates the various representations of the ordering of audio channels.
|
||||
// Must be kept synchronized with media::ChannelLayout from Chromium.
|
||||
// See media\base\channel_layout.h
|
||||
///
|
||||
typedef enum {
|
||||
CEF_CHANNEL_LAYOUT_NONE = 0,
|
||||
CEF_CHANNEL_LAYOUT_UNSUPPORTED = 1,
|
||||
|
||||
// Front C
|
||||
CEF_CHANNEL_LAYOUT_MONO = 2,
|
||||
|
||||
// Front L, Front R
|
||||
CEF_CHANNEL_LAYOUT_STEREO = 3,
|
||||
|
||||
// Front L, Front R, Back C
|
||||
CEF_CHANNEL_LAYOUT_2_1 = 4,
|
||||
|
||||
// Front L, Front R, Front C
|
||||
CEF_CHANNEL_LAYOUT_SURROUND = 5,
|
||||
|
||||
// Front L, Front R, Front C, Back C
|
||||
CEF_CHANNEL_LAYOUT_4_0 = 6,
|
||||
|
||||
// Front L, Front R, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_2_2 = 7,
|
||||
|
||||
// Front L, Front R, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_QUAD = 8,
|
||||
|
||||
// Front L, Front R, Front C, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_5_0 = 9,
|
||||
|
||||
// Front L, Front R, Front C, LFE, Side L, Side R
|
||||
CEF_CHANNEL_LAYOUT_5_1 = 10,
|
||||
|
||||
// Front L, Front R, Front C, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_5_0_BACK = 11,
|
||||
|
||||
// Front L, Front R, Front C, LFE, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_5_1_BACK = 12,
|
||||
|
||||
// Front L, Front R, Front C, Side L, Side R, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_7_0 = 13,
|
||||
|
||||
// Front L, Front R, Front C, LFE, Side L, Side R, Back L, Back R
|
||||
CEF_CHANNEL_LAYOUT_7_1 = 14,
|
||||
|
||||
// Front L, Front R, Front C, LFE, Side L, Side R, Front LofC, Front RofC
|
||||
CEF_CHANNEL_LAYOUT_7_1_WIDE = 15,
|
||||
|
||||
// Stereo L, Stereo R
|
||||
CEF_CHANNEL_LAYOUT_STEREO_DOWNMIX = 16,
|
||||
|
||||
// Stereo L, Stereo R, LFE
|
||||
CEF_CHANNEL_LAYOUT_2POINT1 = 17,
|
||||
|
||||
// Stereo L, Stereo R, Front C, LFE
|
||||
CEF_CHANNEL_LAYOUT_3_1 = 18,
|
||||
|
||||
// Stereo L, Stereo R, Front C, Rear C, LFE
|
||||
CEF_CHANNEL_LAYOUT_4_1 = 19,
|
||||
|
||||
// Stereo L, Stereo R, Front C, Side L, Side R, Back C
|
||||
CEF_CHANNEL_LAYOUT_6_0 = 20,
|
||||
|
||||
// Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC
|
||||
CEF_CHANNEL_LAYOUT_6_0_FRONT = 21,
|
||||
|
||||
// Stereo L, Stereo R, Front C, Rear L, Rear R, Rear C
|
||||
CEF_CHANNEL_LAYOUT_HEXAGONAL = 22,
|
||||
|
||||
// Stereo L, Stereo R, Front C, LFE, Side L, Side R, Rear Center
|
||||
CEF_CHANNEL_LAYOUT_6_1 = 23,
|
||||
|
||||
// Stereo L, Stereo R, Front C, LFE, Back L, Back R, Rear Center
|
||||
CEF_CHANNEL_LAYOUT_6_1_BACK = 24,
|
||||
|
||||
// Stereo L, Stereo R, Side L, Side R, Front LofC, Front RofC, LFE
|
||||
CEF_CHANNEL_LAYOUT_6_1_FRONT = 25,
|
||||
|
||||
// Front L, Front R, Front C, Side L, Side R, Front LofC, Front RofC
|
||||
CEF_CHANNEL_LAYOUT_7_0_FRONT = 26,
|
||||
|
||||
// Front L, Front R, Front C, LFE, Back L, Back R, Front LofC, Front RofC
|
||||
CEF_CHANNEL_LAYOUT_7_1_WIDE_BACK = 27,
|
||||
|
||||
// Front L, Front R, Front C, Side L, Side R, Rear L, Back R, Back C.
|
||||
CEF_CHANNEL_LAYOUT_OCTAGONAL = 28,
|
||||
|
||||
// Channels are not explicitly mapped to speakers.
|
||||
CEF_CHANNEL_LAYOUT_DISCRETE = 29,
|
||||
|
||||
// Front L, Front R, Front C. Front C contains the keyboard mic audio. This
|
||||
// layout is only intended for input for WebRTC. The Front C channel
|
||||
// is stripped away in the WebRTC audio input pipeline and never seen outside
|
||||
// of that.
|
||||
CEF_CHANNEL_LAYOUT_STEREO_AND_KEYBOARD_MIC = 30,
|
||||
|
||||
// Front L, Front R, Side L, Side R, LFE
|
||||
CEF_CHANNEL_LAYOUT_4_1_QUAD_SIDE = 31,
|
||||
|
||||
// Actual channel layout is specified in the bitstream and the actual channel
|
||||
// count is unknown at Chromium media pipeline level (useful for audio
|
||||
// pass-through mode).
|
||||
CEF_CHANNEL_LAYOUT_BITSTREAM = 32,
|
||||
|
||||
// Max value, must always equal the largest entry ever logged.
|
||||
CEF_CHANNEL_LAYOUT_MAX = CEF_CHANNEL_LAYOUT_BITSTREAM
|
||||
} cef_channel_layout_t;
|
||||
|
||||
///
|
||||
// Structure representing the audio parameters for setting up the audio handler.
|
||||
///
|
||||
typedef struct _cef_audio_parameters_t {
|
||||
///
|
||||
// Layout of the audio channels
|
||||
///
|
||||
cef_channel_layout_t channel_layout;
|
||||
|
||||
///
|
||||
// Sample rate
|
||||
//
|
||||
int sample_rate;
|
||||
|
||||
///
|
||||
// Number of frames per buffer
|
||||
///
|
||||
int frames_per_buffer;
|
||||
} cef_audio_parameters_t;
|
||||
|
||||
///
|
||||
// Result codes for CefMediaRouter::CreateRoute. Should be kept in sync with
|
||||
// Chromium's media_router::RouteRequestResult::ResultCode type.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_MRCR_UNKNOWN_ERROR = 0,
|
||||
@@ -2999,6 +3163,32 @@ typedef enum {
|
||||
CEF_MRCS_TERMINATED,
|
||||
} cef_media_route_connection_state_t;
|
||||
|
||||
///
|
||||
// Icon types for a MediaSink object. Should be kept in sync with Chromium's
|
||||
// media_router::SinkIconType type.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_MSIT_CAST,
|
||||
CEF_MSIT_CAST_AUDIO_GROUP,
|
||||
CEF_MSIT_CAST_AUDIO,
|
||||
CEF_MSIT_MEETING,
|
||||
CEF_MSIT_HANGOUT,
|
||||
CEF_MSIT_EDUCATION,
|
||||
CEF_MSIT_WIRED_DISPLAY,
|
||||
CEF_MSIT_GENERIC,
|
||||
|
||||
CEF_MSIT_TOTAL_COUNT, // The total number of values.
|
||||
} cef_media_sink_icon_type_t;
|
||||
|
||||
///
|
||||
// Device information for a MediaSink object.
|
||||
///
|
||||
typedef struct _cef_media_sink_device_info_t {
|
||||
cef_string_t ip_address;
|
||||
int port;
|
||||
cef_string_t model_name;
|
||||
} cef_media_sink_device_info_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -851,6 +851,8 @@ struct CefCookieTraits {
|
||||
target->last_access = src->last_access;
|
||||
target->has_expires = src->has_expires;
|
||||
target->expires = src->expires;
|
||||
target->same_site = src->same_site;
|
||||
target->priority = src->priority;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -958,4 +960,49 @@ struct CefCompositionUnderlineTraits {
|
||||
///
|
||||
typedef CefStructBase<CefCompositionUnderlineTraits> CefCompositionUnderline;
|
||||
|
||||
struct CefAudioParametersTraits {
|
||||
typedef cef_audio_parameters_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
|
||||
static inline void clear(struct_type* s) {}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
struct_type* target,
|
||||
bool copy) {
|
||||
*target = *src;
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
// Class representing CefAudioParameters settings
|
||||
///
|
||||
typedef CefStructBase<CefAudioParametersTraits> CefAudioParameters;
|
||||
|
||||
struct CefMediaSinkDeviceInfoTraits {
|
||||
typedef cef_media_sink_device_info_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {}
|
||||
|
||||
static inline void clear(struct_type* s) {
|
||||
cef_string_clear(&s->ip_address);
|
||||
cef_string_clear(&s->model_name);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
struct_type* target,
|
||||
bool copy) {
|
||||
cef_string_set(src->ip_address.str, src->ip_address.length,
|
||||
&target->ip_address, copy);
|
||||
target->port = src->port;
|
||||
cef_string_set(src->model_name.str, src->model_name.length,
|
||||
&target->model_name, copy);
|
||||
}
|
||||
};
|
||||
|
||||
///
|
||||
// Class representing MediaSink device info.
|
||||
///
|
||||
typedef CefStructBase<CefMediaSinkDeviceInfoTraits> CefMediaSinkDeviceInfo;
|
||||
|
||||
#endif // CEF_INCLUDE_INTERNAL_CEF_TYPES_WRAPPERS_H_
|
||||
|
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), false /* initially_muted */);
|
||||
},
|
||||
base::Passed(&client)));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefAudioCapturer::CefAudioCapturer(const CefAudioParameters& params,
|
||||
CefRefPtr<CefBrowserHostImpl> browser,
|
||||
CefRefPtr<CefAudioHandler> audio_handler)
|
||||
: params_(params),
|
||||
browser_(browser),
|
||||
audio_handler_(audio_handler),
|
||||
audio_stream_creator_(content::AudioLoopbackStreamCreator::
|
||||
CreateInProcessAudioLoopbackStreamCreator()) {
|
||||
media::AudioParameters audio_params(
|
||||
media::AudioParameters::AUDIO_PCM_LINEAR,
|
||||
TranslateChannelLayout(params.channel_layout), params.sample_rate,
|
||||
params.frames_per_buffer);
|
||||
|
||||
if (!audio_params.IsValid()) {
|
||||
LOG(ERROR) << "Invalid audio parameters";
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(browser_);
|
||||
DCHECK(audio_handler_);
|
||||
DCHECK(browser_->web_contents());
|
||||
|
||||
channels_ = audio_params.channels();
|
||||
audio_input_device_ = new media::AudioInputDevice(
|
||||
std::make_unique<mirroring::CapturedAudioInput>(base::BindRepeating(
|
||||
&StreamCreatorHelper, base::Unretained(browser_->web_contents()),
|
||||
base::Unretained(audio_stream_creator_.get()))),
|
||||
media::AudioInputDevice::kLoopback);
|
||||
|
||||
audio_input_device_->Initialize(audio_params, this);
|
||||
audio_input_device_->Start();
|
||||
}
|
||||
|
||||
CefAudioCapturer::~CefAudioCapturer() {
|
||||
StopStream();
|
||||
}
|
||||
|
||||
void CefAudioCapturer::OnCaptureStarted() {
|
||||
audio_handler_->OnAudioStreamStarted(browser_, params_, channels_);
|
||||
DCHECK(!capturing_);
|
||||
capturing_ = true;
|
||||
}
|
||||
|
||||
void CefAudioCapturer::Capture(const media::AudioBus* source,
|
||||
base::TimeTicks audio_capture_time,
|
||||
double /*volume*/,
|
||||
bool /*key_pressed*/) {
|
||||
const int channels = source->channels();
|
||||
std::array<const float*, media::CHANNELS_MAX> data;
|
||||
DCHECK(channels == channels_);
|
||||
DCHECK(channels <= static_cast<int>(data.size()));
|
||||
for (int c = 0; c < channels; ++c) {
|
||||
data[c] = source->channel(c);
|
||||
}
|
||||
base::TimeDelta pts = audio_capture_time - base::TimeTicks::UnixEpoch();
|
||||
audio_handler_->OnAudioStreamPacket(browser_, data.data(), source->frames(),
|
||||
pts.InMilliseconds());
|
||||
}
|
||||
|
||||
void CefAudioCapturer::OnCaptureError(const std::string& message) {
|
||||
audio_handler_->OnAudioStreamError(browser_, message);
|
||||
StopStream();
|
||||
}
|
||||
|
||||
void CefAudioCapturer::StopStream() {
|
||||
if (audio_input_device_)
|
||||
audio_input_device_->Stop();
|
||||
if (capturing_)
|
||||
audio_handler_->OnAudioStreamStopped(browser_);
|
||||
|
||||
audio_input_device_ = nullptr;
|
||||
capturing_ = false;
|
||||
}
|
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 "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/download_manager_delegate.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
#include "libcef/browser/media_router/media_router_manager.h"
|
||||
@@ -292,36 +291,23 @@ CefBrowserContext::~CefBrowserContext() {
|
||||
}
|
||||
|
||||
void CefBrowserContext::Initialize() {
|
||||
CefContext* context = CefContext::Get();
|
||||
|
||||
cache_path_ = base::FilePath(CefString(&settings_.cache_path));
|
||||
if (!context->ValidateCachePath(cache_path_)) {
|
||||
// Reset to in-memory storage.
|
||||
CefString(&settings_.cache_path).clear();
|
||||
cache_path_ = base::FilePath();
|
||||
}
|
||||
|
||||
if (!cache_path_.empty())
|
||||
g_manager.Get().SetImplPath(this, cache_path_);
|
||||
|
||||
if (settings_.accept_language_list.length == 0) {
|
||||
// Use the global language list setting.
|
||||
CefString(&settings_.accept_language_list) =
|
||||
CefString(&context->settings().accept_language_list);
|
||||
}
|
||||
|
||||
if (!!settings_.persist_session_cookies) {
|
||||
set_should_persist_session_cookies(true);
|
||||
}
|
||||
|
||||
key_ = std::make_unique<ProfileKey>(GetPath());
|
||||
key_ = std::make_unique<ProfileKey>(cache_path_);
|
||||
SimpleKeyMap::GetInstance()->Associate(this, key_.get());
|
||||
|
||||
// Initialize the PrefService object.
|
||||
pref_service_ = browser_prefs::CreatePrefService(
|
||||
this, cache_path_, !!settings_.persist_user_preferences);
|
||||
|
||||
content::BrowserContext::Initialize(this, GetPath());
|
||||
content::BrowserContext::Initialize(this, cache_path_);
|
||||
|
||||
resource_context_.reset(new CefResourceContext(IsOffTheRecord()));
|
||||
|
||||
|
@@ -296,7 +296,7 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
~CefBrowserContext() override;
|
||||
|
||||
// Members initialized during construction are safe to access from any thread.
|
||||
CefRequestContextSettings settings_;
|
||||
const CefRequestContextSettings settings_;
|
||||
base::FilePath cache_path_;
|
||||
|
||||
// CefRequestContextImpl objects referencing this object.
|
||||
|
@@ -8,6 +8,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/audio_capturer.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_info.h"
|
||||
#include "libcef/browser/browser_info_manager.h"
|
||||
@@ -15,8 +16,7 @@
|
||||
#include "libcef/browser/browser_util.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/devtools/devtools_frontend.h"
|
||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/devtools/devtools_manager.h"
|
||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "libcef/browser/extensions/extension_background_host.h"
|
||||
#include "libcef/browser/extensions/extension_system.h"
|
||||
@@ -194,6 +194,9 @@ void OnDownloadImage(uint32 max_image_size,
|
||||
image_impl.get());
|
||||
}
|
||||
|
||||
static constexpr base::TimeDelta kRecentlyAudibleTimeout =
|
||||
base::TimeDelta::FromSeconds(2);
|
||||
|
||||
} // namespace
|
||||
|
||||
// CefBrowserHost static methods.
|
||||
@@ -548,26 +551,6 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::GetBrowserForFrameRoute(
|
||||
// CefBrowserHostImpl methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
// WebContentsObserver that will be notified when the frontend WebContents is
|
||||
// destroyed so that the inspected browser can clear its DevTools references.
|
||||
class CefBrowserHostImpl::DevToolsWebContentsObserver
|
||||
: public content::WebContentsObserver {
|
||||
public:
|
||||
DevToolsWebContentsObserver(CefBrowserHostImpl* browser,
|
||||
content::WebContents* frontend_web_contents)
|
||||
: WebContentsObserver(frontend_web_contents), browser_(browser) {}
|
||||
|
||||
// WebContentsObserver methods:
|
||||
void WebContentsDestroyed() override {
|
||||
browser_->OnDevToolsWebContentsDestroyed();
|
||||
}
|
||||
|
||||
private:
|
||||
CefBrowserHostImpl* browser_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(DevToolsWebContentsObserver);
|
||||
};
|
||||
|
||||
CefBrowserHostImpl::~CefBrowserHostImpl() {}
|
||||
|
||||
CefRefPtr<CefBrowser> CefBrowserHostImpl::GetBrowser() {
|
||||
@@ -860,39 +843,29 @@ void CefBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
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 {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
ShowDevToolsHelper* helper = new ShowDevToolsHelper(
|
||||
this, windowInfo, client, settings, inspect_element_at);
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(ShowDevToolsWithHelper, helper));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
return;
|
||||
devtools_manager_->ShowDevTools(windowInfo, client, settings,
|
||||
inspect_element_at);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::CloseDevTools() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!devtools_frontend_)
|
||||
return;
|
||||
devtools_frontend_->Close();
|
||||
} else {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostImpl::CloseDevTools, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!devtools_manager_)
|
||||
return;
|
||||
devtools_manager_->CloseDevTools();
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::HasDevTools() {
|
||||
@@ -901,7 +874,84 @@ bool CefBrowserHostImpl::HasDevTools() {
|
||||
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(
|
||||
@@ -1559,6 +1609,12 @@ void CefBrowserHostImpl::DestroyBrowser() {
|
||||
javascript_dialog_manager_.reset(nullptr);
|
||||
menu_manager_.reset(nullptr);
|
||||
|
||||
// Delete the audio capturer
|
||||
recently_audible_timer_.Stop();
|
||||
audio_capturer_.reset(nullptr);
|
||||
|
||||
devtools_manager_.reset(nullptr);
|
||||
|
||||
// Delete the platform delegate.
|
||||
platform_delegate_.reset(nullptr);
|
||||
|
||||
@@ -2647,16 +2703,24 @@ void CefBrowserHostImpl::DidStopLoading() {
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DocumentAvailableInMainFrame() {
|
||||
{
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
has_document_ = true;
|
||||
}
|
||||
|
||||
if (client_) {
|
||||
CefRefPtr<CefRequestHandler> handler = client_->GetRequestHandler();
|
||||
if (handler)
|
||||
handler->OnDocumentAvailableInMainFrame(this);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::DidFailLoad(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url,
|
||||
int error_code) {
|
||||
// The navigation failed after commit. OnLoadStart was called so we also call
|
||||
// OnLoadEnd.
|
||||
// The navigation failed after commit. OnLoadStart was called so we also
|
||||
// call OnLoadEnd.
|
||||
auto frame = browser_info_->GetFrameForHost(render_frame_host);
|
||||
frame->RefreshAttributes();
|
||||
OnLoadError(frame, validated_url, error_code);
|
||||
@@ -2697,6 +2761,25 @@ void CefBrowserHostImpl::DidUpdateFaviconURL(
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnAudioStateChanged(bool audible) {
|
||||
if (audible) {
|
||||
recently_audible_timer_.Stop();
|
||||
StartAudioCapturer();
|
||||
} else if (audio_capturer_) {
|
||||
// If you have a media playing that has a short quiet moment, web_contents
|
||||
// will immediately switch to non-audible state. We don't want to stop
|
||||
// audio stream so quickly, let's give the stream some time to resume
|
||||
// playing.
|
||||
recently_audible_timer_.Start(
|
||||
FROM_HERE, kRecentlyAudibleTimeout,
|
||||
base::BindOnce(&CefBrowserHostImpl::OnRecentlyAudibleTimerFired, this));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnRecentlyAudibleTimerFired() {
|
||||
audio_capturer_.reset();
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::OnMessageReceived(const IPC::Message& message) {
|
||||
// Handle the cursor message here if mouse cursor change is disabled instead
|
||||
// of propegating the message to the normal handler.
|
||||
@@ -2792,6 +2875,25 @@ bool CefBrowserHostImpl::HasObserver(Observer* observer) const {
|
||||
return observers_.HasObserver(observer);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::StartAudioCapturer() {
|
||||
if (!client_.get() || audio_capturer_)
|
||||
return;
|
||||
|
||||
CefRefPtr<CefAudioHandler> audio_handler = client_->GetAudioHandler();
|
||||
if (!audio_handler.get())
|
||||
return;
|
||||
|
||||
CefAudioParameters params;
|
||||
params.channel_layout = CEF_CHANNEL_LAYOUT_STEREO;
|
||||
params.sample_rate = media::AudioParameters::kAudioCDSampleRate;
|
||||
params.frames_per_buffer = 1024;
|
||||
|
||||
if (!audio_handler->GetAudioParameters(this, params))
|
||||
return;
|
||||
|
||||
audio_capturer_.reset(new CefAudioCapturer(params, this, audio_handler));
|
||||
}
|
||||
|
||||
CefBrowserHostImpl::NavigationLock::NavigationLock(
|
||||
CefRefPtr<CefBrowserHostImpl> browser)
|
||||
: browser_(browser) {
|
||||
@@ -2863,18 +2965,6 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
||||
platform_delegate_(std::move(platform_delegate)),
|
||||
is_windowless_(platform_delegate_->IsWindowless()),
|
||||
is_views_hosted_(platform_delegate_->IsViewsHosted()),
|
||||
host_window_handle_(kNullWindowHandle),
|
||||
is_loading_(false),
|
||||
can_go_back_(false),
|
||||
can_go_forward_(false),
|
||||
has_document_(false),
|
||||
is_fullscreen_(false),
|
||||
destruction_state_(DESTRUCTION_STATE_NONE),
|
||||
window_destroyed_(false),
|
||||
is_in_onsetfocus_(false),
|
||||
focus_on_editable_field_(false),
|
||||
mouse_cursor_change_disabled_(false),
|
||||
devtools_frontend_(nullptr),
|
||||
extension_(extension) {
|
||||
if (opener.get() && !platform_delegate_->IsViewsHosted()) {
|
||||
// GetOpenerWindowHandle() only returns a value for non-views-hosted
|
||||
@@ -3085,11 +3175,6 @@ void CefBrowserHostImpl::OnTitleChange(const base::string16& title) {
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnDevToolsWebContentsDestroyed() {
|
||||
devtools_observer_.reset();
|
||||
devtools_frontend_ = nullptr;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::EnsureFileDialogManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!file_dialog_manager_.get() && platform_delegate_) {
|
||||
|
@@ -48,9 +48,10 @@ class Widget;
|
||||
}
|
||||
#endif // defined(USE_AURA)
|
||||
|
||||
class CefAudioCapturer;
|
||||
class CefBrowserInfo;
|
||||
class CefBrowserPlatformDelegate;
|
||||
class CefDevToolsFrontend;
|
||||
class CefDevToolsManager;
|
||||
class SiteInstance;
|
||||
|
||||
// Implementation of CefBrowser.
|
||||
@@ -191,6 +192,12 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
const CefPoint& inspect_element_at) override;
|
||||
void CloseDevTools() override;
|
||||
bool HasDevTools() override;
|
||||
bool SendDevToolsMessage(const void* message, size_t message_size) override;
|
||||
int ExecuteDevToolsMethod(int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) override;
|
||||
CefRefPtr<CefRegistration> AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) override;
|
||||
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
|
||||
bool current_only) override;
|
||||
void SetMouseCursorChangeDisabled(bool disabled) override;
|
||||
@@ -486,6 +493,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
base::ProcessId plugin_pid) override;
|
||||
void DidUpdateFaviconURL(
|
||||
const std::vector<blink::mojom::FaviconURLPtr>& candidates) override;
|
||||
void OnAudioStateChanged(bool audible) override;
|
||||
bool OnMessageReceived(const IPC::Message& message) override;
|
||||
bool OnMessageReceived(const IPC::Message& message,
|
||||
content::RenderFrameHost* render_frame_host) override;
|
||||
@@ -505,6 +513,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void AddObserver(Observer* observer);
|
||||
void RemoveObserver(Observer* observer);
|
||||
bool HasObserver(Observer* observer) const;
|
||||
|
||||
class NavigationLock final {
|
||||
private:
|
||||
friend class CefBrowserHostImpl;
|
||||
@@ -520,8 +529,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
std::unique_ptr<NavigationLock> CreateNavigationLock();
|
||||
|
||||
private:
|
||||
class DevToolsWebContentsObserver;
|
||||
|
||||
static CefRefPtr<CefBrowserHostImpl> CreateInternal(
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
@@ -578,13 +585,19 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void OnFullscreenModeChange(bool fullscreen);
|
||||
void OnTitleChange(const base::string16& title);
|
||||
|
||||
void OnDevToolsWebContentsDestroyed();
|
||||
|
||||
// Create the CefFileDialogManager if it doesn't already exist.
|
||||
void EnsureFileDialogManager();
|
||||
|
||||
void ConfigureAutoResize();
|
||||
|
||||
void StartAudioCapturer();
|
||||
|
||||
void OnRecentlyAudibleTimerFired();
|
||||
|
||||
bool EnsureDevToolsManager();
|
||||
void InitializeDevToolsRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistration> registration);
|
||||
|
||||
CefBrowserSettings settings_;
|
||||
CefRefPtr<CefClient> client_;
|
||||
scoped_refptr<CefBrowserInfo> browser_info_;
|
||||
@@ -593,7 +606,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate_;
|
||||
const bool is_windowless_;
|
||||
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
|
||||
// browsers between the calls to WebContentsCreated() and AddNewContents(),
|
||||
@@ -603,18 +616,18 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
|
||||
// Volatile state information. All access must be protected by the state lock.
|
||||
base::Lock state_lock_;
|
||||
bool is_loading_;
|
||||
bool can_go_back_;
|
||||
bool can_go_forward_;
|
||||
bool has_document_;
|
||||
bool is_fullscreen_;
|
||||
bool is_loading_ = false;
|
||||
bool can_go_back_ = false;
|
||||
bool can_go_forward_ = false;
|
||||
bool has_document_ = false;
|
||||
bool is_fullscreen_ = false;
|
||||
|
||||
// The currently focused frame, or nullptr if the main frame is focused.
|
||||
CefRefPtr<CefFrameHostImpl> focused_frame_;
|
||||
|
||||
// Represents the current browser destruction state. Only accessed on the UI
|
||||
// thread.
|
||||
DestructionState destruction_state_;
|
||||
DestructionState destruction_state_ = DESTRUCTION_STATE_NONE;
|
||||
|
||||
// Navigation will not occur while |navigation_lock_count_| > 0.
|
||||
// |pending_navigation_action_| will be executed when the lock is released.
|
||||
@@ -624,18 +637,18 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
|
||||
// True if the OS window hosting the browser has been destroyed. Only accessed
|
||||
// on the UI thread.
|
||||
bool window_destroyed_;
|
||||
bool window_destroyed_ = false;
|
||||
|
||||
// True if currently in the OnSetFocus callback. Only accessed on the UI
|
||||
// thread.
|
||||
bool is_in_onsetfocus_;
|
||||
bool is_in_onsetfocus_ = false;
|
||||
|
||||
// True if the focus is currently on an editable field on the page. Only
|
||||
// accessed on the UI thread.
|
||||
bool focus_on_editable_field_;
|
||||
bool focus_on_editable_field_ = false;
|
||||
|
||||
// True if mouse cursor change is disabled.
|
||||
bool mouse_cursor_change_disabled_;
|
||||
bool mouse_cursor_change_disabled_ = false;
|
||||
|
||||
// Used for managing notification subscriptions.
|
||||
std::unique_ptr<content::NotificationRegistrar> registrar_;
|
||||
@@ -649,12 +662,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// Used for creating and managing context menus.
|
||||
std::unique_ptr<CefMenuManager> menu_manager_;
|
||||
|
||||
// Track the lifespan of the frontend WebContents associated with this
|
||||
// browser.
|
||||
std::unique_ptr<DevToolsWebContentsObserver> devtools_observer_;
|
||||
// CefDevToolsFrontend will delete itself when the frontend WebContents is
|
||||
// destroyed.
|
||||
CefDevToolsFrontend* devtools_frontend_;
|
||||
// Used for creating and managing DevTools instances.
|
||||
std::unique_ptr<CefDevToolsManager> devtools_manager_;
|
||||
|
||||
// Observers that want to be notified of changes to this object.
|
||||
base::ObserverList<Observer>::Unchecked observers_;
|
||||
@@ -667,6 +676,14 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
CefRefPtr<CefExtension> extension_;
|
||||
bool is_background_host_ = false;
|
||||
|
||||
// Used for capturing audio for CefAudioHandler.
|
||||
std::unique_ptr<CefAudioCapturer> audio_capturer_;
|
||||
|
||||
// Timer for determining when "recently audible" transitions to false. This
|
||||
// starts running when a tab stops being audible, and is canceled if it starts
|
||||
// being audible again before it fires.
|
||||
base::OneShotTimer recently_audible_timer_;
|
||||
|
||||
// Used with auto-resize.
|
||||
bool auto_resize_enabled_ = false;
|
||||
gfx::Size auto_resize_min_;
|
||||
|
@@ -191,7 +191,7 @@ void CefBrowserMainParts::PreMainMessageLoopRun() {
|
||||
base::TaskShutdownBehavior::BLOCK_SHUTDOWN, base::MayBlock()});
|
||||
|
||||
CefRequestContextSettings settings;
|
||||
CefContext::Get()->PopulateRequestContextSettings(&settings);
|
||||
CefContext::Get()->PopulateGlobalRequestContextSettings(&settings);
|
||||
|
||||
// Create the global RequestContext.
|
||||
global_request_context_ =
|
||||
|
@@ -157,15 +157,17 @@ ProfileManager* ChromeBrowserProcessStub::profile_manager() {
|
||||
PrefService* ChromeBrowserProcessStub::local_state() {
|
||||
DCHECK(initialized_);
|
||||
if (!local_state_) {
|
||||
// Use a location that is shared by all request contexts.
|
||||
const CefSettings& settings = CefContext::Get()->settings();
|
||||
const base::FilePath& cache_path =
|
||||
base::FilePath(CefString(&settings.cache_path));
|
||||
const base::FilePath& root_cache_path =
|
||||
base::FilePath(CefString(&settings.root_cache_path));
|
||||
|
||||
// Used for very early NetworkService initialization.
|
||||
// Always persist preferences for this PrefService if possible because it
|
||||
// contains the cookie encryption key on Windows.
|
||||
local_state_ = browser_prefs::CreatePrefService(
|
||||
nullptr /* profile */, cache_path, true /* persist_user_preferences */);
|
||||
local_state_ =
|
||||
browser_prefs::CreatePrefService(nullptr /* profile */, root_cache_path,
|
||||
true /* persist_user_preferences */);
|
||||
}
|
||||
return local_state_.get();
|
||||
}
|
||||
|
@@ -77,7 +77,6 @@
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/browser_ppapi_host.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "content/public/browser/client_certificate_delegate.h"
|
||||
#include "content/public/browser/navigation_handle.h"
|
||||
#include "content/public/browser/overlay_window.h"
|
||||
@@ -102,6 +101,7 @@
|
||||
#include "extensions/browser/extensions_browser_client.h"
|
||||
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
|
||||
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
|
||||
#include "extensions/browser/url_loader_factory_manager.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/switches.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
@@ -626,6 +626,17 @@ bool CefContentBrowserClient::DoesSiteRequireDedicatedProcess(
|
||||
return extension != nullptr;
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::OverrideURLLoaderFactoryParams(
|
||||
content::BrowserContext* browser_context,
|
||||
const url::Origin& origin,
|
||||
bool is_for_isolated_world,
|
||||
network::mojom::URLLoaderFactoryParams* factory_params) {
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extensions::URLLoaderFactoryManager::OverrideURLLoaderFactoryParams(
|
||||
browser_context, origin, is_for_isolated_world, factory_params);
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::GetAdditionalWebUISchemes(
|
||||
std::vector<std::string>* additional_schemes) {
|
||||
// Any schemes listed here are treated as WebUI schemes but do not get WebUI
|
||||
@@ -1469,16 +1480,6 @@ CefContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
|
||||
return mime_types;
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterCustomScheme(const std::string& scheme) {
|
||||
// Register as a Web-safe scheme so that requests for the scheme from a
|
||||
// render process will be allowed in resource_dispatcher_host_impl.cc
|
||||
// ShouldServiceRequest.
|
||||
content::ChildProcessSecurityPolicy* policy =
|
||||
content::ChildProcessSecurityPolicy::GetInstance();
|
||||
if (!policy->IsWebSafeScheme(scheme))
|
||||
policy->RegisterWebSafeScheme(scheme);
|
||||
}
|
||||
|
||||
CefRefPtr<CefRequestContextImpl> CefContentBrowserClient::request_context()
|
||||
const {
|
||||
return browser_main_parts_->request_context();
|
||||
|
@@ -46,6 +46,11 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
const GURL& effective_url) override;
|
||||
bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context,
|
||||
const GURL& effective_site_url) override;
|
||||
void OverrideURLLoaderFactoryParams(
|
||||
content::BrowserContext* browser_context,
|
||||
const url::Origin& origin,
|
||||
bool is_for_isolated_world,
|
||||
network::mojom::URLLoaderFactoryParams* factory_params) override;
|
||||
void GetAdditionalWebUISchemes(
|
||||
std::vector<std::string>* additional_schemes) override;
|
||||
void GetAdditionalViewSourceSchemes(
|
||||
@@ -205,9 +210,6 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(
|
||||
content::BrowserContext* browser_context) override;
|
||||
|
||||
// Perform browser process registration for the custom scheme.
|
||||
void RegisterCustomScheme(const std::string& scheme);
|
||||
|
||||
CefRefPtr<CefRequestContextImpl> request_context() const;
|
||||
CefDevToolsDelegate* devtools_delegate() const;
|
||||
|
||||
|
@@ -160,6 +160,85 @@ bool GetColor(const cef_color_t cef_in, bool is_windowless, SkColor* sk_out) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Convert |path_str| to a normalized FilePath.
|
||||
base::FilePath NormalizePath(const cef_string_t& path_str,
|
||||
const char* name,
|
||||
bool* has_error = nullptr) {
|
||||
if (has_error)
|
||||
*has_error = false;
|
||||
|
||||
base::FilePath path = base::FilePath(CefString(&path_str));
|
||||
if (path.EndsWithSeparator()) {
|
||||
// Remove the trailing separator because it will interfere with future
|
||||
// equality checks.
|
||||
path = path.StripTrailingSeparators();
|
||||
}
|
||||
|
||||
if (!path.empty() && !path.IsAbsolute()) {
|
||||
LOG(ERROR) << "The " << name << " directory (" << path.value()
|
||||
<< ") is not an absolute path. Defaulting to empty.";
|
||||
if (has_error)
|
||||
*has_error = true;
|
||||
path = base::FilePath();
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
void SetPath(cef_string_t& path_str, const base::FilePath& path) {
|
||||
#if defined(OS_WIN)
|
||||
CefString(&path_str).FromWString(path.value());
|
||||
#else
|
||||
CefString(&path_str).FromString(path.value());
|
||||
#endif
|
||||
}
|
||||
|
||||
// Convert |path_str| to a normalized FilePath and update the |path_str| value.
|
||||
base::FilePath NormalizePathAndSet(cef_string_t& path_str, const char* name) {
|
||||
const base::FilePath& path = NormalizePath(path_str, name);
|
||||
SetPath(path_str, path);
|
||||
return path;
|
||||
}
|
||||
|
||||
// Verify that |cache_path| is valid and create it if necessary.
|
||||
bool ValidateCachePath(const base::FilePath& cache_path,
|
||||
const base::FilePath& root_cache_path) {
|
||||
if (cache_path.empty())
|
||||
return true;
|
||||
|
||||
if (!root_cache_path.empty() && root_cache_path != cache_path &&
|
||||
!root_cache_path.IsParent(cache_path)) {
|
||||
LOG(ERROR) << "The cache_path directory (" << cache_path.value()
|
||||
<< ") is not a child of the root_cache_path directory ("
|
||||
<< root_cache_path.value() << ")";
|
||||
return false;
|
||||
}
|
||||
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (!base::DirectoryExists(cache_path) &&
|
||||
!base::CreateDirectory(cache_path)) {
|
||||
LOG(ERROR) << "The cache_path directory (" << cache_path.value()
|
||||
<< ") could not be created.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Like NormalizePathAndSet but with additional checks specific to the
|
||||
// cache_path value.
|
||||
base::FilePath NormalizeCachePathAndSet(cef_string_t& path_str,
|
||||
const base::FilePath& root_cache_path) {
|
||||
bool has_error = false;
|
||||
base::FilePath path = NormalizePath(path_str, "cache_path", &has_error);
|
||||
if (has_error || !ValidateCachePath(path, root_cache_path)) {
|
||||
LOG(ERROR) << "The cache_path is invalid. Defaulting to in-memory storage.";
|
||||
path = base::FilePath();
|
||||
}
|
||||
SetPath(path_str, path);
|
||||
return path;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
int CefExecuteProcess(const CefMainArgs& args,
|
||||
@@ -370,18 +449,23 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
SignalChromeElf();
|
||||
#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 =
|
||||
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()) {
|
||||
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));
|
||||
browser_info_manager_.reset(new CefBrowserInfoManager);
|
||||
|
||||
@@ -518,11 +602,14 @@ CefTraceSubscriber* CefContext::GetTraceSubscriber() {
|
||||
return trace_subscriber_.get();
|
||||
}
|
||||
|
||||
void CefContext::PopulateRequestContextSettings(
|
||||
void CefContext::PopulateGlobalRequestContextSettings(
|
||||
CefRequestContextSettings* settings) {
|
||||
CefRefPtr<CefCommandLine> command_line =
|
||||
CefCommandLine::GetGlobalCommandLine();
|
||||
|
||||
// This value was already normalized in Initialize.
|
||||
CefString(&settings->cache_path) = CefString(&settings_.cache_path);
|
||||
|
||||
settings->persist_session_cookies =
|
||||
settings_.persist_session_cookies ||
|
||||
command_line->HasSwitch(switches::kPersistSessionCookies);
|
||||
@@ -536,29 +623,17 @@ void CefContext::PopulateRequestContextSettings(
|
||||
CefString(&settings_.accept_language_list);
|
||||
}
|
||||
|
||||
bool CefContext::ValidateCachePath(const base::FilePath& cache_path) {
|
||||
if (cache_path.empty())
|
||||
return true;
|
||||
void CefContext::NormalizeRequestContextSettings(
|
||||
CefRequestContextSettings* settings) {
|
||||
// The |root_cache_path| value was already normalized in Initialize.
|
||||
const base::FilePath& root_cache_path = CefString(&settings_.root_cache_path);
|
||||
NormalizeCachePathAndSet(settings->cache_path, root_cache_path);
|
||||
|
||||
const base::FilePath& root_cache_path =
|
||||
base::FilePath(CefString(&settings_.root_cache_path));
|
||||
if (!root_cache_path.empty() && root_cache_path != cache_path &&
|
||||
!root_cache_path.IsParent(cache_path)) {
|
||||
LOG(ERROR) << "The cache_path directory (" << cache_path.value()
|
||||
<< ") is not a child of the root_cache_path directory ("
|
||||
<< root_cache_path.value() << ")";
|
||||
return false;
|
||||
if (settings->accept_language_list.length == 0) {
|
||||
// Use the global language list setting.
|
||||
CefString(&settings->accept_language_list) =
|
||||
CefString(&settings_.accept_language_list);
|
||||
}
|
||||
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
if (!base::DirectoryExists(cache_path) &&
|
||||
!base::CreateDirectory(cache_path)) {
|
||||
LOG(ERROR) << "The cache_path directory (" << cache_path.value()
|
||||
<< ") could not be created.";
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefContext::AddObserver(Observer* observer) {
|
||||
|
@@ -87,10 +87,11 @@ class CefContext {
|
||||
|
||||
// Populate request context settings for the global system context based on
|
||||
// CefSettings and command-line flags.
|
||||
void PopulateRequestContextSettings(CefRequestContextSettings* settings);
|
||||
void PopulateGlobalRequestContextSettings(
|
||||
CefRequestContextSettings* settings);
|
||||
|
||||
// Verify that |cache_path| is valid and create it if necessary.
|
||||
bool ValidateCachePath(const base::FilePath& cache_path);
|
||||
// Normalize and validate request context settings for user-created contexts.
|
||||
void NormalizeRequestContextSettings(CefRequestContextSettings* settings);
|
||||
|
||||
// Manage observer objects. The observer must either outlive this object or
|
||||
// remove itself before destruction. These methods can only be called on the
|
||||
|
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 <iomanip>
|
||||
#include <utility>
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/devtools/devtools_manager_delegate.h"
|
||||
#include "libcef/browser/net/devtools_scheme_handler.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/base64.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/guid.h"
|
||||
#include "base/json/json_reader.h"
|
||||
#include "base/json/json_writer.h"
|
||||
@@ -48,6 +53,13 @@
|
||||
#include "services/network/public/cpp/simple_url_loader.h"
|
||||
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
|
||||
#include "services/network/public/mojom/url_response_head.mojom.h"
|
||||
#include "storage/browser/file_system/native_file_util.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#elif defined(OS_POSIX)
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -86,6 +98,71 @@ std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
|
||||
return response;
|
||||
}
|
||||
|
||||
const int kMaxLogLineLength = 1024;
|
||||
|
||||
void WriteTimestamp(std::stringstream& stream) {
|
||||
#if defined(OS_WIN)
|
||||
SYSTEMTIME local_time;
|
||||
GetLocalTime(&local_time);
|
||||
stream << std::setfill('0') << std::setw(2) << local_time.wMonth
|
||||
<< std::setw(2) << local_time.wDay << '/' << std::setw(2)
|
||||
<< local_time.wHour << std::setw(2) << local_time.wMinute
|
||||
<< std::setw(2) << local_time.wSecond << '.' << std::setw(3)
|
||||
<< local_time.wMilliseconds;
|
||||
#elif defined(OS_POSIX)
|
||||
timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
time_t t = tv.tv_sec;
|
||||
struct tm local_time;
|
||||
localtime_r(&t, &local_time);
|
||||
struct tm* tm_time = &local_time;
|
||||
stream << std::setfill('0') << std::setw(2) << 1 + tm_time->tm_mon
|
||||
<< std::setw(2) << tm_time->tm_mday << '/' << std::setw(2)
|
||||
<< tm_time->tm_hour << std::setw(2) << tm_time->tm_min << std::setw(2)
|
||||
<< tm_time->tm_sec << '.' << std::setw(6) << tv.tv_usec;
|
||||
#else
|
||||
#error Unsupported platform
|
||||
#endif
|
||||
}
|
||||
|
||||
void LogProtocolMessage(const base::FilePath& log_file,
|
||||
ProtocolMessageType type,
|
||||
std::string to_log) {
|
||||
// Track if logging has failed, in which case we don't keep trying.
|
||||
static bool log_error = false;
|
||||
if (log_error)
|
||||
return;
|
||||
|
||||
if (storage::NativeFileUtil::EnsureFileExists(log_file, nullptr) !=
|
||||
base::File::FILE_OK) {
|
||||
LOG(ERROR) << "Failed to create file " << log_file.value();
|
||||
log_error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
std::string type_label;
|
||||
switch (type) {
|
||||
case ProtocolMessageType::METHOD:
|
||||
type_label = "METHOD";
|
||||
break;
|
||||
case ProtocolMessageType::RESULT:
|
||||
type_label = "RESULT";
|
||||
break;
|
||||
case ProtocolMessageType::EVENT:
|
||||
type_label = "EVENT";
|
||||
break;
|
||||
}
|
||||
|
||||
std::stringstream stream;
|
||||
WriteTimestamp(stream);
|
||||
stream << ": " << type_label << ": " << to_log << "\n";
|
||||
const std::string& str = stream.str();
|
||||
if (!base::AppendToFile(log_file, str.c_str(), str.size())) {
|
||||
LOG(ERROR) << "Failed to write file " << log_file.value();
|
||||
log_error = true;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class CefDevToolsFrontend::NetworkResourceLoader
|
||||
@@ -156,11 +233,12 @@ const size_t kMaxMessageChunkSize = IPC::Channel::kMaximumMessageSize / 4;
|
||||
|
||||
// static
|
||||
CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||
CefRefPtr<CefBrowserHostImpl> inspected_browser,
|
||||
CefBrowserHostImpl* inspected_browser,
|
||||
const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
const CefPoint& inspect_element_at,
|
||||
base::OnceClosure frontend_destroyed_callback) {
|
||||
CefBrowserSettings new_settings = settings;
|
||||
if (!windowInfo.windowless_rendering_enabled &&
|
||||
CefColorGetA(new_settings.background_color) != SK_AlphaOPAQUE) {
|
||||
@@ -187,7 +265,8 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
|
||||
// destroyed.
|
||||
CefDevToolsFrontend* devtools_frontend = new CefDevToolsFrontend(
|
||||
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.
|
||||
frontend_browser->GetMainFrame()->LoadURL(GetFrontendURL());
|
||||
@@ -216,23 +295,23 @@ void CefDevToolsFrontend::Close() {
|
||||
frontend_browser_.get(), true));
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::DisconnectFromTarget() {
|
||||
if (!agent_host_)
|
||||
return;
|
||||
agent_host_->DetachClient(this);
|
||||
agent_host_ = nullptr;
|
||||
}
|
||||
|
||||
CefDevToolsFrontend::CefDevToolsFrontend(
|
||||
CefRefPtr<CefBrowserHostImpl> frontend_browser,
|
||||
CefBrowserHostImpl* frontend_browser,
|
||||
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()),
|
||||
frontend_browser_(frontend_browser),
|
||||
inspected_contents_(inspected_contents),
|
||||
inspect_element_at_(inspect_element_at),
|
||||
file_manager_(frontend_browser.get(), GetPrefs()),
|
||||
weak_factory_(this) {}
|
||||
frontend_destroyed_callback_(std::move(frontend_destroyed_callback)),
|
||||
file_manager_(frontend_browser, GetPrefs()),
|
||||
protocol_log_file_(
|
||||
base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
|
||||
switches::kDevToolsProtocolLogFile)),
|
||||
weak_factory_(this) {
|
||||
DCHECK(!frontend_destroyed_callback_.is_null());
|
||||
}
|
||||
|
||||
CefDevToolsFrontend::~CefDevToolsFrontend() {}
|
||||
|
||||
@@ -279,6 +358,7 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
|
||||
agent_host_->DetachClient(this);
|
||||
agent_host_ = nullptr;
|
||||
}
|
||||
std::move(frontend_destroyed_callback_).Run();
|
||||
delete this;
|
||||
}
|
||||
|
||||
@@ -300,6 +380,9 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
std::string protocol_message;
|
||||
if (!agent_host_ || !params->GetString(0, &protocol_message))
|
||||
return;
|
||||
if (ProtocolLoggingEnabled()) {
|
||||
LogProtocolMessage(ProtocolMessageType::METHOD, protocol_message);
|
||||
}
|
||||
agent_host_->DispatchProtocolMessage(
|
||||
this, base::as_bytes(base::make_span(protocol_message)));
|
||||
} else if (method == "loadCompleted") {
|
||||
@@ -451,6 +534,14 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
base::span<const uint8_t> message) {
|
||||
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
||||
message.size());
|
||||
if (ProtocolLoggingEnabled()) {
|
||||
// Quick check to avoid parsing the JSON object. Events begin with a
|
||||
// "method" value whereas method results begin with an "id" value.
|
||||
LogProtocolMessage(str_message.starts_with("{\"method\":")
|
||||
? ProtocolMessageType::EVENT
|
||||
: ProtocolMessageType::RESULT,
|
||||
str_message);
|
||||
}
|
||||
if (str_message.length() < kMaxMessageChunkSize) {
|
||||
std::string param;
|
||||
base::EscapeJSONString(str_message, true, ¶m);
|
||||
@@ -504,6 +595,23 @@ void CefDevToolsFrontend::SendMessageAck(int request_id,
|
||||
CallClientFunction("DevToolsAPI.embedderMessageAck", &id_value, arg, nullptr);
|
||||
}
|
||||
|
||||
bool CefDevToolsFrontend::ProtocolLoggingEnabled() const {
|
||||
return !protocol_log_file_.empty();
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::LogProtocolMessage(ProtocolMessageType type,
|
||||
const base::StringPiece& message) {
|
||||
DCHECK(ProtocolLoggingEnabled());
|
||||
|
||||
std::string to_log = message.substr(0, kMaxLogLineLength).as_string();
|
||||
|
||||
// Execute in an ordered context that allows blocking.
|
||||
auto task_runner = CefContentBrowserClient::Get()->background_task_runner();
|
||||
task_runner->PostTask(
|
||||
FROM_HERE, base::BindOnce(::LogProtocolMessage, protocol_log_file_, type,
|
||||
std::move(to_log)));
|
||||
}
|
||||
|
||||
void CefDevToolsFrontend::AgentHostClosed(
|
||||
content::DevToolsAgentHost* agent_host) {
|
||||
DCHECK(agent_host == agent_host_.get());
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include "libcef/browser/devtools/devtools_file_manager.h"
|
||||
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/macros.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
@@ -31,36 +32,38 @@ class WebContents;
|
||||
|
||||
class PrefService;
|
||||
|
||||
enum class ProtocolMessageType {
|
||||
METHOD,
|
||||
RESULT,
|
||||
EVENT,
|
||||
};
|
||||
|
||||
class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
public content::DevToolsAgentHostClient {
|
||||
public:
|
||||
static CefDevToolsFrontend* Show(
|
||||
CefRefPtr<CefBrowserHostImpl> inspected_browser,
|
||||
CefBrowserHostImpl* inspected_browser,
|
||||
const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at);
|
||||
const CefPoint& inspect_element_at,
|
||||
base::OnceClosure frontend_destroyed_callback);
|
||||
|
||||
void Activate();
|
||||
void Focus();
|
||||
void InspectElementAt(int x, int y);
|
||||
void Close();
|
||||
|
||||
void DisconnectFromTarget();
|
||||
|
||||
void CallClientFunction(const std::string& function_name,
|
||||
const base::Value* arg1,
|
||||
const base::Value* arg2,
|
||||
const base::Value* arg3);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> frontend_browser() const {
|
||||
return frontend_browser_;
|
||||
}
|
||||
|
||||
private:
|
||||
CefDevToolsFrontend(CefRefPtr<CefBrowserHostImpl> frontend_browser,
|
||||
CefDevToolsFrontend(CefBrowserHostImpl* frontend_browser,
|
||||
content::WebContents* inspected_contents,
|
||||
const CefPoint& inspect_element_at);
|
||||
const CefPoint& inspect_element_at,
|
||||
base::OnceClosure destroyed_callback);
|
||||
~CefDevToolsFrontend() override;
|
||||
|
||||
// content::DevToolsAgentHostClient implementation.
|
||||
@@ -78,12 +81,17 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
|
||||
void SendMessageAck(int request_id, const base::Value* arg1);
|
||||
|
||||
bool ProtocolLoggingEnabled() const;
|
||||
void LogProtocolMessage(ProtocolMessageType type,
|
||||
const base::StringPiece& message);
|
||||
|
||||
PrefService* GetPrefs() const;
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> frontend_browser_;
|
||||
content::WebContents* inspected_contents_;
|
||||
scoped_refptr<content::DevToolsAgentHost> agent_host_;
|
||||
CefPoint inspect_element_at_;
|
||||
base::OnceClosure frontend_destroyed_callback_;
|
||||
std::unique_ptr<content::DevToolsFrontendHost> frontend_host_;
|
||||
|
||||
class NetworkResourceLoader;
|
||||
@@ -93,6 +101,9 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
using ExtensionsAPIs = std::map<std::string, std::string>;
|
||||
ExtensionsAPIs extensions_api_;
|
||||
CefDevToolsFileManager file_manager_;
|
||||
|
||||
const base::FilePath protocol_log_file_;
|
||||
|
||||
base::WeakPtrFactory<CefDevToolsFrontend> weak_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefDevToolsFrontend);
|
||||
|
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_
|
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());
|
||||
}
|
@@ -32,9 +32,9 @@ const char kPdfResourceIdentifier[] = "chromium-pdf";
|
||||
const char kPdfPluginName[] = "Chrome PDF Viewer";
|
||||
|
||||
std::string GetManifest() {
|
||||
std::string manifest_contents = ui::ResourceBundle::GetSharedInstance()
|
||||
.GetRawDataResource(IDR_PDF_MANIFEST)
|
||||
.as_string();
|
||||
std::string manifest_contents =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_PDF_MANIFEST);
|
||||
DCHECK(manifest_contents.find(kNameTag) != std::string::npos);
|
||||
base::ReplaceFirstSubstringAfterOffset(&manifest_contents, 0, kNameTag,
|
||||
kPdfPluginName);
|
||||
|
@@ -4,6 +4,84 @@
|
||||
|
||||
#include "libcef/browser/media_router/media_sink_impl.h"
|
||||
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.h"
|
||||
#include "chrome/browser/media/router/providers/cast/dual_media_sink_service.h"
|
||||
#include "chrome/common/media_router/discovery/media_sink_internal.h"
|
||||
#include "chrome/common/media_router/discovery/media_sink_service_base.h"
|
||||
|
||||
namespace {
|
||||
|
||||
using SinkServiceVector = std::vector<media_router::MediaSinkServiceBase*>;
|
||||
|
||||
SinkServiceVector GetSinkServices() {
|
||||
CEF_REQUIRE_UIT();
|
||||
auto sink_service = media_router::DualMediaSinkService::GetInstance();
|
||||
return {sink_service->GetCastMediaSinkServiceImpl(),
|
||||
sink_service->GetDialMediaSinkServiceImpl()};
|
||||
}
|
||||
|
||||
void GetSinkInternalAndContinue(
|
||||
SinkServiceVector services,
|
||||
const media_router::MediaSink::Id& sink_id,
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
CefMediaSinkDeviceInfo device_info;
|
||||
const media_router::MediaSinkInternal* sink_internal = nullptr;
|
||||
|
||||
for (auto service : services) {
|
||||
sink_internal = service->GetSinkById(sink_id);
|
||||
if (sink_internal)
|
||||
break;
|
||||
}
|
||||
|
||||
if (sink_internal) {
|
||||
if (sink_internal->is_cast_sink()) {
|
||||
const auto& cast_data = sink_internal->cast_data();
|
||||
CefString(&device_info.ip_address) =
|
||||
cast_data.ip_endpoint.ToStringWithoutPort();
|
||||
device_info.port = cast_data.ip_endpoint.port();
|
||||
CefString(&device_info.model_name) = cast_data.model_name;
|
||||
} else if (sink_internal->is_dial_sink()) {
|
||||
const auto& dial_data = sink_internal->dial_data();
|
||||
CefString(&device_info.ip_address) = dial_data.ip_address.ToString();
|
||||
if (dial_data.app_url.is_valid() && dial_data.app_url.has_port()) {
|
||||
base::StringToInt(dial_data.app_url.port_piece(), &device_info.port);
|
||||
}
|
||||
CefString(&device_info.model_name) = dial_data.model_name;
|
||||
}
|
||||
}
|
||||
|
||||
// Execute the callback on the UI thread.
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefMediaSinkDeviceInfoCallback::OnMediaSinkDeviceInfo,
|
||||
callback, device_info));
|
||||
}
|
||||
|
||||
void GetDeviceInfo(const media_router::MediaSink::Id& sink_id,
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
auto next_step = base::BindOnce(
|
||||
[](const media_router::MediaSink::Id& sink_id,
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::BindOnce(GetSinkInternalAndContinue,
|
||||
GetSinkServices(), sink_id, callback));
|
||||
},
|
||||
sink_id, callback);
|
||||
|
||||
if (CEF_CURRENTLY_ON(CEF_UIT)) {
|
||||
std::move(next_step).Run();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, std::move(next_step));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefMediaSinkImpl::CefMediaSinkImpl(const media_router::MediaSink& sink)
|
||||
: sink_(sink) {}
|
||||
|
||||
@@ -27,6 +105,20 @@ CefString CefMediaSinkImpl::GetDescription() {
|
||||
return sink_.description().value_or("");
|
||||
}
|
||||
|
||||
CefMediaSink::IconType CefMediaSinkImpl::GetIconType() {
|
||||
// Verify that our enum matches Chromium's values.
|
||||
static_assert(static_cast<int>(CEF_MSIT_TOTAL_COUNT) ==
|
||||
static_cast<int>(media_router::SinkIconType::TOTAL_COUNT),
|
||||
"enum mismatch");
|
||||
|
||||
return static_cast<CefMediaSink::IconType>(sink_.icon_type());
|
||||
}
|
||||
|
||||
void CefMediaSinkImpl::GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
::GetDeviceInfo(sink_.id(), callback);
|
||||
}
|
||||
|
||||
bool CefMediaSinkImpl::IsCastSink() {
|
||||
return sink_.provider_id() == media_router::CAST;
|
||||
}
|
||||
|
@@ -22,6 +22,9 @@ class CefMediaSinkImpl : public CefMediaSink {
|
||||
bool IsValid() override;
|
||||
CefString GetName() override;
|
||||
CefString GetDescription() override;
|
||||
IconType GetIconType() override;
|
||||
void GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) override;
|
||||
bool IsCastSink() override;
|
||||
bool IsDialSink() override;
|
||||
bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) override;
|
||||
|
@@ -43,6 +43,7 @@
|
||||
#include "content/public/common/url_utils.h"
|
||||
#include "content/public/common/user_agent.h"
|
||||
#include "ipc/ipc_channel.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
||||
using extensions::api::cef::kSupportedAPIs;
|
||||
@@ -74,6 +75,7 @@ const char* kAllowedWebUIHosts[] = {
|
||||
content::kChromeUIAppCacheInternalsHost,
|
||||
chrome::kChromeUIAccessibilityHost,
|
||||
content::kChromeUIBlobInternalsHost,
|
||||
chrome::kChromeUIChromeURLsHost,
|
||||
chrome::kChromeUICreditsHost,
|
||||
kChromeUIExtensionsSupportHost,
|
||||
content::kChromeUIGpuHost,
|
||||
@@ -118,6 +120,7 @@ const struct {
|
||||
const char* host;
|
||||
ChromeHostId host_id;
|
||||
} kAllowedCefHosts[] = {
|
||||
{chrome::kChromeUIChromeURLsHost, CHROME_WEBUI_HOSTS},
|
||||
{kChromeUIExtensionsSupportHost, CHROME_EXTENSIONS_SUPPORT},
|
||||
{kChromeUILicenseHost, CHROME_LICENSE},
|
||||
{chrome::kChromeUIVersionHost, CHROME_VERSION},
|
||||
@@ -341,16 +344,17 @@ bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) {
|
||||
}
|
||||
|
||||
bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
||||
base::StringPiece piece = CefContentClient::Get()->GetDataResource(
|
||||
IDR_CEF_LICENSE_TXT, ui::SCALE_FACTOR_NONE);
|
||||
std::string piece =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_CEF_LICENSE_TXT);
|
||||
if (piece.empty()) {
|
||||
NOTREACHED() << "Failed to load license txt resource.";
|
||||
return false;
|
||||
}
|
||||
|
||||
*mime_type = "text/html";
|
||||
*output = "<html><head><title>License</title></head><body><pre>" +
|
||||
piece.as_string() + "</pre></body></html>";
|
||||
*output = "<html><head><title>License</title></head><body><pre>" + piece +
|
||||
"</pre></body></html>";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -358,9 +362,10 @@ bool OnLicenseUI(std::string* mime_type, std::string* output) {
|
||||
bool OnVersionUI(Profile* profile,
|
||||
std::string* mime_type,
|
||||
std::string* output) {
|
||||
base::StringPiece piece = CefContentClient::Get()->GetDataResource(
|
||||
IDR_CEF_VERSION_HTML, ui::SCALE_FACTOR_NONE);
|
||||
if (piece.empty()) {
|
||||
std::string tmpl =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
IDR_CEF_VERSION_HTML);
|
||||
if (tmpl.empty()) {
|
||||
NOTREACHED() << "Failed to load version html resource.";
|
||||
return false;
|
||||
}
|
||||
@@ -381,7 +386,6 @@ bool OnVersionUI(Profile* profile,
|
||||
parser.Add("MODULEPATH", GetModulePath());
|
||||
parser.Add("CACHEPATH", CefString(profile->GetPath().value()));
|
||||
|
||||
std::string tmpl = piece.as_string();
|
||||
parser.Parse(&tmpl);
|
||||
|
||||
*mime_type = "text/html";
|
||||
@@ -392,8 +396,8 @@ bool OnVersionUI(Profile* profile,
|
||||
|
||||
bool OnWebUIHostsUI(std::string* mime_type, std::string* output) {
|
||||
std::string html =
|
||||
"<html>\n<head><title>WebUI Hosts</title></head>\n"
|
||||
"<body bgcolor=\"white\"><h3>WebUI Hosts</h3>\n<ul>\n";
|
||||
"<html>\n<head><title>Chrome URLs</title></head>\n"
|
||||
"<body bgcolor=\"white\"><h3>List of Chrome URLs</h3>\n<ul>\n";
|
||||
|
||||
std::vector<std::string> list;
|
||||
GetAllowedHosts(&list);
|
||||
|
@@ -158,13 +158,15 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory {
|
||||
action.mime_type = GetMimeType(url.path());
|
||||
|
||||
if (!action.bytes && action.resource_id >= 0) {
|
||||
action.bytes =
|
||||
CefContentClient::Get()->GetDataResourceBytes(action.resource_id);
|
||||
if (!action.bytes) {
|
||||
std::string str =
|
||||
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
|
||||
action.resource_id);
|
||||
if (str.empty()) {
|
||||
NOTREACHED() << "Failed to load internal resource for id: "
|
||||
<< action.resource_id << " URL: " << url.spec().c_str();
|
||||
return nullptr;
|
||||
}
|
||||
action.bytes = base::RefCountedString::TakeString(&str);
|
||||
}
|
||||
|
||||
if (action.bytes) {
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "services/network/public/cpp/shared_url_loader_factory.h"
|
||||
#include "services/network/public/cpp/simple_url_loader.h"
|
||||
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
|
||||
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -254,6 +255,23 @@ class CefBrowserURLRequest::Context
|
||||
|
||||
resource_request->render_frame_id = render_frame_id;
|
||||
|
||||
// Behave the same as a subresource load.
|
||||
resource_request->fetch_request_context_type =
|
||||
static_cast<int>(blink::mojom::RequestContextType::SUBRESOURCE);
|
||||
resource_request->resource_type =
|
||||
static_cast<int>(blink::mojom::ResourceType::kSubResource);
|
||||
|
||||
// Set the origin to match the request.
|
||||
const GURL& url = GURL(request_->GetURL().ToString());
|
||||
resource_request->request_initiator = url::Origin::Create(url);
|
||||
|
||||
if (request_flags & UR_FLAG_ALLOW_STORED_CREDENTIALS) {
|
||||
// Include SameSite cookies.
|
||||
resource_request->attach_same_site_cookies = true;
|
||||
resource_request->site_for_cookies =
|
||||
net::SiteForCookies::FromOrigin(*resource_request->request_initiator);
|
||||
}
|
||||
|
||||
// SimpleURLLoader is picky about the body contents. Try to populate them
|
||||
// correctly below.
|
||||
auto request_body = resource_request->request_body;
|
||||
|
@@ -47,6 +47,9 @@ void SetCookieCallbackImpl(CefRefPtr<CefSetCookieCallback> callback,
|
||||
net::CanonicalCookie::CookieInclusionStatus status) {
|
||||
if (!callback.get())
|
||||
return;
|
||||
if (!status.IsInclude()) {
|
||||
LOG(WARNING) << "SetCookie failed with reason: " << status.GetDebugString();
|
||||
}
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefSetCookieCallback::OnComplete,
|
||||
callback.get(), status.IsInclude()));
|
||||
}
|
||||
@@ -203,6 +206,8 @@ bool CefCookieManagerImpl::VisitUrlCookies(
|
||||
net::CookieOptions options;
|
||||
if (includeHttpOnly)
|
||||
options.set_include_httponly();
|
||||
options.set_same_site_cookie_context(
|
||||
net::CookieOptions::SameSiteCookieContext::MakeInclusive());
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
@@ -239,13 +244,18 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url,
|
||||
if (cookie.has_expires)
|
||||
cef_time_to_basetime(cookie.expires, expiration_time);
|
||||
|
||||
net::CookieSameSite same_site =
|
||||
net_service::MakeCookieSameSite(cookie.same_site);
|
||||
net::CookiePriority priority =
|
||||
net_service::MakeCookiePriority(cookie.priority);
|
||||
|
||||
auto canonical_cookie = net::CanonicalCookie::CreateSanitizedCookie(
|
||||
gurl, name, value, domain, path,
|
||||
base::Time(), // Creation time.
|
||||
expiration_time,
|
||||
base::Time(), // Last access time.
|
||||
cookie.secure ? true : false, cookie.httponly ? true : false,
|
||||
net::CookieSameSite::UNSPECIFIED, net::COOKIE_PRIORITY_DEFAULT);
|
||||
cookie.secure ? true : false, cookie.httponly ? true : false, same_site,
|
||||
priority);
|
||||
|
||||
if (!canonical_cookie) {
|
||||
SetCookieCallbackImpl(callback,
|
||||
@@ -258,6 +268,8 @@ bool CefCookieManagerImpl::SetCookie(const CefString& url,
|
||||
net::CookieOptions options;
|
||||
if (cookie.httponly)
|
||||
options.set_include_httponly();
|
||||
options.set_same_site_cookie_context(
|
||||
net::CookieOptions::SameSiteCookieContext::MakeInclusive());
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
|
@@ -475,9 +475,10 @@ void InterceptedRequest::OnReceiveRedirect(
|
||||
if (current_request_uses_header_client_) {
|
||||
// Use the headers we got from OnHeadersReceived as that'll contain
|
||||
// Set-Cookie if it existed. May be null for synthetic redirects.
|
||||
DCHECK(current_headers_);
|
||||
if (current_headers_) {
|
||||
current_response_->headers = current_headers_;
|
||||
current_headers_ = nullptr;
|
||||
}
|
||||
} else {
|
||||
needs_callback = true;
|
||||
}
|
||||
|
@@ -610,9 +610,12 @@ void StreamReaderURLLoader::OnReaderSkipCompleted(int64_t bytes_skipped) {
|
||||
HeadersComplete(net::HTTP_OK, -1);
|
||||
} else if (bytes_skipped == byte_range_.first_byte_position()) {
|
||||
// We skipped the expected number of bytes.
|
||||
int64_t expected_content_length = byte_range_.last_byte_position() -
|
||||
int64_t expected_content_length = -1;
|
||||
if (byte_range_.HasLastBytePosition()) {
|
||||
expected_content_length = byte_range_.last_byte_position() -
|
||||
byte_range_.first_byte_position() + 1;
|
||||
DCHECK_GE(expected_content_length, 0);
|
||||
}
|
||||
HeadersComplete(net::HTTP_OK, expected_content_length);
|
||||
} else {
|
||||
RequestComplete(bytes_skipped < 0 ? bytes_skipped : net::ERR_FAILED);
|
||||
|
@@ -1074,9 +1074,18 @@ void CefRenderWidgetHostViewOSR::SendExternalBeginFrame() {
|
||||
void CefRenderWidgetHostViewOSR::SendKeyEvent(
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
TRACE_EVENT0("cef", "CefRenderWidgetHostViewOSR::SendKeyEvent");
|
||||
if (render_widget_host_ && render_widget_host_->GetView()) {
|
||||
content::RenderWidgetHostImpl* target_host = render_widget_host_;
|
||||
|
||||
// If there are multiple widgets on the page (such as when there are
|
||||
// out-of-process iframes), pick the one that should process this event.
|
||||
if (render_widget_host_ && render_widget_host_->delegate()) {
|
||||
target_host = render_widget_host_->delegate()->GetFocusedRenderWidgetHost(
|
||||
render_widget_host_);
|
||||
}
|
||||
|
||||
if (target_host && target_host->GetView()) {
|
||||
// Direct routing requires that events go directly to the View.
|
||||
render_widget_host_->ForwardKeyboardEventWithLatencyInfo(
|
||||
target_host->ForwardKeyboardEventWithLatencyInfo(
|
||||
event, ui::LatencyInfo(event.GetType() == blink::WebInputEvent::kChar ||
|
||||
event.GetType() ==
|
||||
blink::WebInputEvent::kRawKeyDown
|
||||
@@ -1390,8 +1399,8 @@ void CefRenderWidgetHostViewOSR::UpdateFrameRate() {
|
||||
}
|
||||
|
||||
gfx::Size CefRenderWidgetHostViewOSR::SizeInPixels() {
|
||||
return gfx::ConvertSizeToPixel(current_device_scale_factor_,
|
||||
GetViewBounds().size());
|
||||
return gfx::ScaleToCeiledSize(GetViewBounds().size(),
|
||||
current_device_scale_factor_);
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
|
@@ -27,6 +27,7 @@ class CefVideoConsumerOSR : public viz::mojom::FrameSinkVideoConsumer {
|
||||
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumerFrameCallbacks>
|
||||
callbacks) override;
|
||||
void OnStopped() override;
|
||||
void OnLog(const std::string& message) override {}
|
||||
|
||||
CefRenderWidgetHostViewOSR* const view_;
|
||||
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
|
||||
|
@@ -203,7 +203,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
|
||||
// From Chrome::RegisterBrowserUserPrefs.
|
||||
registry->RegisterBooleanPref(prefs::kPrintPreviewUseSystemDefaultPrinter,
|
||||
true);
|
||||
false);
|
||||
|
||||
if (command_line->HasSwitch(switches::kEnablePreferenceTesting)) {
|
||||
// Preferences used with unit tests.
|
||||
|
@@ -116,10 +116,10 @@ void FillInDictionaryFromPdfPrintSettings(
|
||||
print_settings.SetInteger(kSettingMarginsType, margin_type);
|
||||
if (margin_type == CUSTOM_MARGINS) {
|
||||
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue);
|
||||
dict->SetDouble(kSettingMarginTop, pdf_settings.margin_top);
|
||||
dict->SetDouble(kSettingMarginRight, pdf_settings.margin_right);
|
||||
dict->SetDouble(kSettingMarginBottom, pdf_settings.margin_bottom);
|
||||
dict->SetDouble(kSettingMarginLeft, pdf_settings.margin_left);
|
||||
dict->SetInteger(kSettingMarginTop, pdf_settings.margin_top);
|
||||
dict->SetInteger(kSettingMarginRight, pdf_settings.margin_right);
|
||||
dict->SetInteger(kSettingMarginBottom, pdf_settings.margin_bottom);
|
||||
dict->SetInteger(kSettingMarginLeft, pdf_settings.margin_left);
|
||||
print_settings.Set(kSettingMarginsCustom, std::move(dict));
|
||||
}
|
||||
|
||||
|
@@ -645,9 +645,15 @@ void CefRequestContextImpl::Initialize() {
|
||||
// Share storage with |config_.other|.
|
||||
browser_context_ =
|
||||
CefBrowserContext::GetForContext(config_.other->GetBrowserContext());
|
||||
DCHECK(browser_context_);
|
||||
}
|
||||
|
||||
if (!browser_context_) {
|
||||
if (!config_.is_global) {
|
||||
// User-specified settings need to be normalized.
|
||||
CefContext::Get()->NormalizeRequestContextSettings(&config_.settings);
|
||||
}
|
||||
|
||||
const base::FilePath& cache_path =
|
||||
base::FilePath(CefString(&config_.settings.cache_path));
|
||||
if (!cache_path.empty()) {
|
||||
@@ -661,17 +667,17 @@ void CefRequestContextImpl::Initialize() {
|
||||
// Create a new CefBrowserContext instance. If the cache path is non-
|
||||
// empty then this new instance will become the globally registered
|
||||
// CefBrowserContext for that path. Otherwise, this new instance will
|
||||
// be a completely isolated "incongento mode" context.
|
||||
// be a completely isolated "incognito mode" context.
|
||||
browser_context_ = new CefBrowserContext(config_.settings);
|
||||
browser_context_->Initialize();
|
||||
} else {
|
||||
// Share the same settings as the existing context.
|
||||
config_.settings = browser_context_->GetSettings();
|
||||
}
|
||||
|
||||
// We'll disassociate from |browser_context_| on destruction.
|
||||
browser_context_->AddCefRequestContext(this);
|
||||
|
||||
// Force our settings to match |browser_context_|.
|
||||
config_.settings = browser_context_->GetSettings();
|
||||
|
||||
if (config_.other) {
|
||||
// Clear the reference to |config_.other| after setting
|
||||
// |request_context_getter_|. This is the reverse order of checks in
|
||||
|
@@ -114,11 +114,13 @@ const char kPluginPolicy_Block[] = "block";
|
||||
const char kEnablePreferenceTesting[] = "enable-preference-testing";
|
||||
|
||||
// Enable print preview.
|
||||
extern const char kEnablePrintPreview[] = "enable-print-preview";
|
||||
const char kEnablePrintPreview[] = "enable-print-preview";
|
||||
|
||||
// Disable the timeout for delivering new browser info to the renderer process.
|
||||
extern const char kDisableNewBrowserInfoTimeout[] =
|
||||
"disable-new-browser-info-timeout";
|
||||
const char kDisableNewBrowserInfoTimeout[] = "disable-new-browser-info-timeout";
|
||||
|
||||
// File used for logging DevTools protocol messages.
|
||||
const char kDevToolsProtocolLogFile[] = "devtools-protocol-log-file";
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
// Path to the framework directory.
|
||||
|
@@ -53,6 +53,7 @@ extern const char kPluginPolicy_Block[];
|
||||
extern const char kEnablePreferenceTesting[];
|
||||
extern const char kEnablePrintPreview[];
|
||||
extern const char kDisableNewBrowserInfoTimeout[];
|
||||
extern const char kDevToolsProtocolLogFile[];
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
extern const char kFrameworkDirPath[];
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "include/cef_stream.h"
|
||||
#include "include/cef_version.h"
|
||||
#include "libcef/browser/content_browser_client.h"
|
||||
#include "libcef/browser/extensions/pdf_extension_util.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
@@ -30,6 +29,7 @@
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/pepper_flash.h"
|
||||
#include "content/public/browser/child_process_security_policy.h"
|
||||
#include "content/public/common/content_constants.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "content/public/common/pepper_plugin_info.h"
|
||||
@@ -162,10 +162,12 @@ bool GetSystemPepperFlash(content::PepperPluginInfo* plugin) {
|
||||
std::string manifest_data;
|
||||
if (!base::ReadFileToString(manifest_path, &manifest_data))
|
||||
return false;
|
||||
std::unique_ptr<base::Value> manifest_value(base::Value::ToUniquePtrValue(
|
||||
std::move(base::JSONReader::Read(manifest_data,
|
||||
base::JSON_ALLOW_TRAILING_COMMAS)
|
||||
.value())));
|
||||
auto json_manifest_value =
|
||||
base::JSONReader::Read(manifest_data, base::JSON_ALLOW_TRAILING_COMMAS);
|
||||
if (!json_manifest_value.has_value())
|
||||
return false;
|
||||
std::unique_ptr<base::Value> manifest_value(
|
||||
base::Value::ToUniquePtrValue(std::move(json_manifest_value.value())));
|
||||
if (!manifest_value.get())
|
||||
return false;
|
||||
base::DictionaryValue* manifest = nullptr;
|
||||
@@ -292,9 +294,15 @@ void CefContentClient::AddCustomScheme(const SchemeInfo& scheme_info) {
|
||||
DCHECK(!scheme_info_list_locked_);
|
||||
scheme_info_list_.push_back(scheme_info);
|
||||
|
||||
if (CefContentBrowserClient::Get()) {
|
||||
CefContentBrowserClient::Get()->RegisterCustomScheme(
|
||||
scheme_info.scheme_name);
|
||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||
if (!command_line->HasSwitch(switches::kProcessType)) {
|
||||
// Register as a Web-safe scheme in the browser process so that requests for
|
||||
// the scheme from a render process will be allowed in
|
||||
// resource_dispatcher_host_impl.cc ShouldServiceRequest.
|
||||
content::ChildProcessSecurityPolicy* policy =
|
||||
content::ChildProcessSecurityPolicy::GetInstance();
|
||||
if (!policy->IsWebSafeScheme(scheme_info.scheme_name))
|
||||
policy->RegisterWebSafeScheme(scheme_info.scheme_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -34,8 +34,17 @@ int GetJSONWriterOptions(cef_json_writer_options_t options) {
|
||||
CefRefPtr<CefValue> CefParseJSON(const CefString& json_string,
|
||||
cef_json_parser_options_t options) {
|
||||
const std::string& json = json_string.ToString();
|
||||
base::Optional<base::Value> parse_result =
|
||||
base::JSONReader::Read(json, GetJSONReaderOptions(options));
|
||||
return CefParseJSON(json.data(), json.size(), options);
|
||||
}
|
||||
|
||||
CefRefPtr<CefValue> CefParseJSON(const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options) {
|
||||
if (!json || json_size == 0)
|
||||
return nullptr;
|
||||
base::Optional<base::Value> parse_result = base::JSONReader::Read(
|
||||
base::StringPiece(static_cast<const char*>(json), json_size),
|
||||
GetJSONReaderOptions(options));
|
||||
if (parse_result) {
|
||||
return new CefValueImpl(
|
||||
base::Value::ToUniquePtrValue(std::move(parse_result.value()))
|
||||
|
@@ -620,18 +620,6 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
|
||||
disable_features.push_back(network::features::kOutOfBlinkCors.name);
|
||||
}
|
||||
|
||||
// TODO: Add support for creating cookies with SameSite attribute (see issue
|
||||
// #2524)
|
||||
if (net::features::kSameSiteByDefaultCookies.default_state ==
|
||||
base::FEATURE_ENABLED_BY_DEFAULT) {
|
||||
disable_features.push_back(net::features::kSameSiteByDefaultCookies.name);
|
||||
}
|
||||
if (net::features::kCookiesWithoutSameSiteMustBeSecure.default_state ==
|
||||
base::FEATURE_ENABLED_BY_DEFAULT) {
|
||||
disable_features.push_back(
|
||||
net::features::kCookiesWithoutSameSiteMustBeSecure.name);
|
||||
}
|
||||
|
||||
#if defined(OS_WIN)
|
||||
if (features::kCalculateNativeWinOcclusion.default_state ==
|
||||
base::FEATURE_ENABLED_BY_DEFAULT) {
|
||||
|
@@ -38,6 +38,30 @@ bool GetCookieDomain(const GURL& url,
|
||||
result);
|
||||
}
|
||||
|
||||
cef_cookie_same_site_t MakeCefCookieSameSite(net::CookieSameSite value) {
|
||||
switch (value) {
|
||||
case net::CookieSameSite::UNSPECIFIED:
|
||||
return CEF_COOKIE_SAME_SITE_UNSPECIFIED;
|
||||
case net::CookieSameSite::NO_RESTRICTION:
|
||||
return CEF_COOKIE_SAME_SITE_NO_RESTRICTION;
|
||||
case net::CookieSameSite::LAX_MODE:
|
||||
return CEF_COOKIE_SAME_SITE_LAX_MODE;
|
||||
case net::CookieSameSite::STRICT_MODE:
|
||||
return CEF_COOKIE_SAME_SITE_STRICT_MODE;
|
||||
}
|
||||
}
|
||||
|
||||
cef_cookie_priority_t MakeCefCookiePriority(net::CookiePriority value) {
|
||||
switch (value) {
|
||||
case net::COOKIE_PRIORITY_LOW:
|
||||
return CEF_COOKIE_PRIORITY_LOW;
|
||||
case net::COOKIE_PRIORITY_MEDIUM:
|
||||
return CEF_COOKIE_PRIORITY_MEDIUM;
|
||||
case net::COOKIE_PRIORITY_HIGH:
|
||||
return CEF_COOKIE_PRIORITY_HIGH;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const char kHTTPLocationHeaderName[] = "Location";
|
||||
@@ -107,8 +131,9 @@ scoped_refptr<net::HttpResponseHeaders> MakeResponseHeaders(
|
||||
// Track the headers that have already been set. Perform all comparisons in
|
||||
// lowercase.
|
||||
std::set<std::string> set_headers_lowercase;
|
||||
|
||||
if (status_code == net::HTTP_OK) {
|
||||
if ((status_code >= 200 && status_code < 300) &&
|
||||
status_code != net::HTTP_NO_CONTENT &&
|
||||
status_code != net::HTTP_RESET_CONTENT) {
|
||||
if (!mime_type.empty()) {
|
||||
headers->AddHeader(MakeHeader(net::HttpRequestHeaders::kContentType,
|
||||
MakeContentTypeValue(mime_type, charset)));
|
||||
@@ -176,6 +201,30 @@ net::RedirectInfo MakeRedirectInfo(const network::ResourceRequest& request,
|
||||
insecure_scheme_was_upgraded);
|
||||
}
|
||||
|
||||
net::CookieSameSite MakeCookieSameSite(cef_cookie_same_site_t value) {
|
||||
switch (value) {
|
||||
case CEF_COOKIE_SAME_SITE_UNSPECIFIED:
|
||||
return net::CookieSameSite::UNSPECIFIED;
|
||||
case CEF_COOKIE_SAME_SITE_NO_RESTRICTION:
|
||||
return net::CookieSameSite::NO_RESTRICTION;
|
||||
case CEF_COOKIE_SAME_SITE_LAX_MODE:
|
||||
return net::CookieSameSite::LAX_MODE;
|
||||
case CEF_COOKIE_SAME_SITE_STRICT_MODE:
|
||||
return net::CookieSameSite::STRICT_MODE;
|
||||
}
|
||||
}
|
||||
|
||||
net::CookiePriority MakeCookiePriority(cef_cookie_priority_t value) {
|
||||
switch (value) {
|
||||
case CEF_COOKIE_PRIORITY_LOW:
|
||||
return net::COOKIE_PRIORITY_LOW;
|
||||
case CEF_COOKIE_PRIORITY_MEDIUM:
|
||||
return net::COOKIE_PRIORITY_MEDIUM;
|
||||
case CEF_COOKIE_PRIORITY_HIGH:
|
||||
return net::COOKIE_PRIORITY_HIGH;
|
||||
}
|
||||
}
|
||||
|
||||
bool MakeCefCookie(const net::CanonicalCookie& cc, CefCookie& cookie) {
|
||||
CefString(&cookie.name).FromString(cc.Name());
|
||||
CefString(&cookie.value).FromString(cc.Value());
|
||||
@@ -188,6 +237,8 @@ bool MakeCefCookie(const net::CanonicalCookie& cc, CefCookie& cookie) {
|
||||
cookie.has_expires = cc.IsPersistent();
|
||||
if (cookie.has_expires)
|
||||
cef_time_from_basetime(cc.ExpiryDate(), cookie.expires);
|
||||
cookie.same_site = MakeCefCookieSameSite(cc.SameSite());
|
||||
cookie.priority = MakeCefCookiePriority(cc.Priority());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -224,6 +275,8 @@ bool MakeCefCookie(const GURL& url,
|
||||
cookie.has_expires = !cookie_expires.is_null();
|
||||
if (cookie.has_expires)
|
||||
cef_time_from_basetime(cookie_expires, cookie.expires);
|
||||
cookie.same_site = MakeCefCookieSameSite(pc.SameSite());
|
||||
cookie.priority = MakeCefCookiePriority(pc.Priority());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#include "include/internal/cef_types_wrappers.h"
|
||||
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "net/cookies/cookie_constants.h"
|
||||
|
||||
namespace net {
|
||||
class CanonicalCookie;
|
||||
@@ -70,6 +71,9 @@ bool MakeCefCookie(const GURL& url,
|
||||
const std::string& cookie_line,
|
||||
CefCookie& cookie);
|
||||
|
||||
net::CookieSameSite MakeCookieSameSite(cef_cookie_same_site_t value);
|
||||
net::CookiePriority MakeCookiePriority(cef_cookie_priority_t value);
|
||||
|
||||
} // namespace net_service
|
||||
|
||||
#endif // CEF_LIBCEF_COMMON_NET_SERVICE_NET_SERVICE_UTIL_H_
|
||||
|
@@ -20,6 +20,16 @@ void cef_time_to_basetime(const cef_time_t& cef_time, base::Time& time) {
|
||||
}
|
||||
|
||||
void cef_time_from_basetime(const base::Time& time, cef_time_t& cef_time) {
|
||||
#if defined(OS_WIN)
|
||||
int64_t t = time.ToDeltaSinceWindowsEpoch().InMicroseconds();
|
||||
// From MSDN, FILETIME "Contains a 64-bit value representing the number of
|
||||
// 100-nanosecond intervals since January 1, 1601 (UTC)." This value must
|
||||
// be less than 0x8000000000000000. Otherwise, the function
|
||||
// FileTimeToSystemTime fails.
|
||||
if (t < 0 || static_cast<uint64_t>(t * 10) >= 0x8000000000000000)
|
||||
return;
|
||||
#endif
|
||||
|
||||
base::Time::Exploded exploded;
|
||||
time.UTCExplode(&exploded);
|
||||
cef_time.year = exploded.year;
|
||||
|
@@ -55,9 +55,6 @@ bool CefPrintRenderFrameHelperDelegate::IsPrintPreviewEnabled() {
|
||||
|
||||
bool CefPrintRenderFrameHelperDelegate::OverridePrint(
|
||||
blink::WebLocalFrame* frame) {
|
||||
if (!frame->GetDocument().IsPluginDocument())
|
||||
return false;
|
||||
|
||||
auto* post_message_support =
|
||||
extensions::PostMessageSupport::FromWebLocalFrame(frame);
|
||||
if (post_message_support) {
|
||||
|
@@ -132,6 +132,13 @@ class CefRenderURLRequest::Context
|
||||
// DCHECK'd in ResourceDispatcherHostImpl::ContinuePendingBeginRequest.
|
||||
resource_request->request_initiator = url::Origin::Create(url);
|
||||
|
||||
if (request_->GetFlags() & UR_FLAG_ALLOW_STORED_CREDENTIALS) {
|
||||
// Include SameSite cookies.
|
||||
resource_request->attach_same_site_cookies = true;
|
||||
resource_request->site_for_cookies =
|
||||
net::SiteForCookies::FromOrigin(*resource_request->request_initiator);
|
||||
}
|
||||
|
||||
if (resource_request->request_body) {
|
||||
const auto& elements = *resource_request->request_body->elements();
|
||||
if (elements.size() > 0) {
|
||||
|
@@ -23,14 +23,18 @@ set(CEF_TARGET libcef_dll_wrapper)
|
||||
'append_macro': 'LIBCEF_APPEND_PLATFORM_SOURCES',
|
||||
'includes': [
|
||||
'includes_common',
|
||||
'includes_common_capi',
|
||||
'autogen_cpp_includes',
|
||||
'includes_capi',
|
||||
'autogen_capi_includes',
|
||||
'includes_wrapper',
|
||||
'includes_wrapper_mac:MACOSX',
|
||||
'includes_win:WINDOWS',
|
||||
'includes_win_capi:WINDOWS',
|
||||
'includes_mac:MACOSX',
|
||||
'includes_mac_capi:MACOSX',
|
||||
'includes_linux:LINUX',
|
||||
'includes_linux_capi:LINUX',
|
||||
'libcef_dll_wrapper_sources_base',
|
||||
'libcef_dll_wrapper_sources_common',
|
||||
'libcef_dll_wrapper_sources_mac:MACOSX',
|
||||
|
191
libcef_dll/cpptoc/audio_handler_cpptoc.cc
Normal file
191
libcef_dll/cpptoc/audio_handler_cpptoc.cc
Normal file
@@ -0,0 +1,191 @@
|
||||
// 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=4568fbb1f264fe9a900784aa3040c406a919ad37$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/audio_handler_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
int CEF_CALLBACK
|
||||
audio_handler_get_audio_parameters(struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
cef_audio_parameters_t* params) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return 0;
|
||||
// Verify param: params; type: simple_byref
|
||||
DCHECK(params);
|
||||
if (!params)
|
||||
return 0;
|
||||
|
||||
// Translate param: params; type: simple_byref
|
||||
CefAudioParameters paramsVal = params ? *params : CefAudioParameters();
|
||||
|
||||
// Execute
|
||||
bool _retval = CefAudioHandlerCppToC::Get(self)->GetAudioParameters(
|
||||
CefBrowserCToCpp::Wrap(browser), paramsVal);
|
||||
|
||||
// Restore param: params; type: simple_byref
|
||||
if (params)
|
||||
*params = paramsVal;
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
audio_handler_on_audio_stream_started(struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_audio_parameters_t* params,
|
||||
int channels) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
// Verify param: params; type: simple_byref_const
|
||||
DCHECK(params);
|
||||
if (!params)
|
||||
return;
|
||||
|
||||
// Translate param: params; type: simple_byref_const
|
||||
CefAudioParameters paramsVal = params ? *params : CefAudioParameters();
|
||||
|
||||
// Execute
|
||||
CefAudioHandlerCppToC::Get(self)->OnAudioStreamStarted(
|
||||
CefBrowserCToCpp::Wrap(browser), paramsVal, channels);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
audio_handler_on_audio_stream_packet(struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const float** data,
|
||||
int frames,
|
||||
int64 pts) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
// Verify param: data; type: simple_byaddr
|
||||
DCHECK(data);
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefAudioHandlerCppToC::Get(self)->OnAudioStreamPacket(
|
||||
CefBrowserCToCpp::Wrap(browser), data, frames, pts);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
audio_handler_on_audio_stream_stopped(struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefAudioHandlerCppToC::Get(self)->OnAudioStreamStopped(
|
||||
CefBrowserCToCpp::Wrap(browser));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
audio_handler_on_audio_stream_error(struct _cef_audio_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
const cef_string_t* message) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
// Verify param: message; type: string_byref_const
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefAudioHandlerCppToC::Get(self)->OnAudioStreamError(
|
||||
CefBrowserCToCpp::Wrap(browser), CefString(message));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefAudioHandlerCppToC::CefAudioHandlerCppToC() {
|
||||
GetStruct()->get_audio_parameters = audio_handler_get_audio_parameters;
|
||||
GetStruct()->on_audio_stream_started = audio_handler_on_audio_stream_started;
|
||||
GetStruct()->on_audio_stream_packet = audio_handler_on_audio_stream_packet;
|
||||
GetStruct()->on_audio_stream_stopped = audio_handler_on_audio_stream_stopped;
|
||||
GetStruct()->on_audio_stream_error = audio_handler_on_audio_stream_error;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefAudioHandlerCppToC::~CefAudioHandlerCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefAudioHandler> CefCppToCRefCounted<
|
||||
CefAudioHandlerCppToC,
|
||||
CefAudioHandler,
|
||||
cef_audio_handler_t>::UnwrapDerived(CefWrapperType type,
|
||||
cef_audio_handler_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCppToCRefCounted<CefAudioHandlerCppToC,
|
||||
CefAudioHandler,
|
||||
cef_audio_handler_t>::kWrapperType =
|
||||
WT_AUDIO_HANDLER;
|
37
libcef_dll/cpptoc/audio_handler_cpptoc.h
Normal file
37
libcef_dll/cpptoc/audio_handler_cpptoc.h
Normal file
@@ -0,0 +1,37 @@
|
||||
// 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=27689a3c353f267fb650ec5b7dc095e0a6be8b13$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_AUDIO_HANDLER_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_AUDIO_HANDLER_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_audio_handler_capi.h"
|
||||
#include "include/cef_audio_handler.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefAudioHandlerCppToC : public CefCppToCRefCounted<CefAudioHandlerCppToC,
|
||||
CefAudioHandler,
|
||||
cef_audio_handler_t> {
|
||||
public:
|
||||
CefAudioHandlerCppToC();
|
||||
virtual ~CefAudioHandlerCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_AUDIO_HANDLER_CPPTOC_H_
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=a84451b4f759f2a4a0fe673d90be1fb5053bfd1a$
|
||||
// $hash=516b55b7ea53e2de2b096e85ba0eb83f2a2693f3$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/browser_host_cpptoc.h"
|
||||
@@ -18,8 +18,10 @@
|
||||
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/extension_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/navigation_entry_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/registration_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/request_context_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/client_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/download_image_callback_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/navigation_entry_visitor_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/pdf_print_callback_ctocpp.h"
|
||||
@@ -522,6 +524,81 @@ int CEF_CALLBACK browser_host_has_dev_tools(struct _cef_browser_host_t* self) {
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK
|
||||
browser_host_send_dev_tools_message(struct _cef_browser_host_t* self,
|
||||
const void* message,
|
||||
size_t message_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: message; type: simple_byaddr
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefBrowserHostCppToC::Get(self)->SendDevToolsMessage(
|
||||
message, message_size);
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
int CEF_CALLBACK
|
||||
browser_host_execute_dev_tools_method(struct _cef_browser_host_t* self,
|
||||
int message_id,
|
||||
const cef_string_t* method,
|
||||
struct _cef_dictionary_value_t* params) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: method; type: string_byref_const
|
||||
DCHECK(method);
|
||||
if (!method)
|
||||
return 0;
|
||||
// Unverified params: params
|
||||
|
||||
// Execute
|
||||
int _retval = CefBrowserHostCppToC::Get(self)->ExecuteDevToolsMethod(
|
||||
message_id, CefString(method), CefDictionaryValueCppToC::Unwrap(params));
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
struct _cef_registration_t* CEF_CALLBACK
|
||||
browser_host_add_dev_tools_message_observer(
|
||||
struct _cef_browser_host_t* self,
|
||||
struct _cef_dev_tools_message_observer_t* observer) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
// Verify param: observer; type: refptr_diff
|
||||
DCHECK(observer);
|
||||
if (!observer)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefRegistration> _retval =
|
||||
CefBrowserHostCppToC::Get(self)->AddDevToolsMessageObserver(
|
||||
CefDevToolsMessageObserverCToCpp::Wrap(observer));
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefRegistrationCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK
|
||||
browser_host_get_navigation_entries(struct _cef_browser_host_t* self,
|
||||
cef_navigation_entry_visitor_t* visitor,
|
||||
@@ -1285,6 +1362,10 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
|
||||
GetStruct()->show_dev_tools = browser_host_show_dev_tools;
|
||||
GetStruct()->close_dev_tools = browser_host_close_dev_tools;
|
||||
GetStruct()->has_dev_tools = browser_host_has_dev_tools;
|
||||
GetStruct()->send_dev_tools_message = browser_host_send_dev_tools_message;
|
||||
GetStruct()->execute_dev_tools_method = browser_host_execute_dev_tools_method;
|
||||
GetStruct()->add_dev_tools_message_observer =
|
||||
browser_host_add_dev_tools_message_observer;
|
||||
GetStruct()->get_navigation_entries = browser_host_get_navigation_entries;
|
||||
GetStruct()->set_mouse_cursor_change_disabled =
|
||||
browser_host_set_mouse_cursor_change_disabled;
|
||||
|
@@ -9,10 +9,11 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=154a21a2f4ac985eeed2d28ad9479f322c4aad07$
|
||||
// $hash=04cee2c6a1910d7084c556f1bde99ba971b354d2$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/client_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/audio_handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/context_menu_handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/dialog_handler_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/display_handler_cpptoc.h"
|
||||
@@ -34,6 +35,22 @@ namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
cef_audio_handler_t* CEF_CALLBACK
|
||||
client_get_audio_handler(struct _cef_client_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefAudioHandler> _retval =
|
||||
CefClientCppToC::Get(self)->GetAudioHandler();
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefAudioHandlerCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
struct _cef_context_menu_handler_t* CEF_CALLBACK
|
||||
client_get_context_menu_handler(struct _cef_client_t* self) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
@@ -280,6 +297,7 @@ client_on_process_message_received(struct _cef_client_t* self,
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefClientCppToC::CefClientCppToC() {
|
||||
GetStruct()->get_audio_handler = client_get_audio_handler;
|
||||
GetStruct()->get_context_menu_handler = client_get_context_menu_handler;
|
||||
GetStruct()->get_dialog_handler = client_get_dialog_handler;
|
||||
GetStruct()->get_display_handler = client_get_display_handler;
|
||||
|
184
libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.cc
Normal file
184
libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.cc
Normal file
@@ -0,0 +1,184 @@
|
||||
// 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=c4a7b4d679f1f2ed47fc31df3e2099962d5cb9d6$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
int CEF_CALLBACK dev_tools_message_observer_on_dev_tools_message(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
cef_browser_t* browser,
|
||||
const void* message,
|
||||
size_t message_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return 0;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return 0;
|
||||
// Verify param: message; type: simple_byaddr
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return 0;
|
||||
|
||||
// Execute
|
||||
bool _retval = CefDevToolsMessageObserverCppToC::Get(self)->OnDevToolsMessage(
|
||||
CefBrowserCToCpp::Wrap(browser), message, message_size);
|
||||
|
||||
// Return type: bool
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK dev_tools_message_observer_on_dev_tools_method_result(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
cef_browser_t* browser,
|
||||
int message_id,
|
||||
int success,
|
||||
const void* result,
|
||||
size_t result_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
// Unverified params: result
|
||||
|
||||
// Execute
|
||||
CefDevToolsMessageObserverCppToC::Get(self)->OnDevToolsMethodResult(
|
||||
CefBrowserCToCpp::Wrap(browser), message_id, success ? true : false,
|
||||
result, result_size);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK dev_tools_message_observer_on_dev_tools_event(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
cef_browser_t* browser,
|
||||
const cef_string_t* method,
|
||||
const void* params,
|
||||
size_t params_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
// Verify param: method; type: string_byref_const
|
||||
DCHECK(method);
|
||||
if (!method)
|
||||
return;
|
||||
// Unverified params: params
|
||||
|
||||
// Execute
|
||||
CefDevToolsMessageObserverCppToC::Get(self)->OnDevToolsEvent(
|
||||
CefBrowserCToCpp::Wrap(browser), CefString(method), params, params_size);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK dev_tools_message_observer_on_dev_tools_agent_attached(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
cef_browser_t* browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefDevToolsMessageObserverCppToC::Get(self)->OnDevToolsAgentAttached(
|
||||
CefBrowserCToCpp::Wrap(browser));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK dev_tools_message_observer_on_dev_tools_agent_detached(
|
||||
struct _cef_dev_tools_message_observer_t* self,
|
||||
cef_browser_t* browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefDevToolsMessageObserverCppToC::Get(self)->OnDevToolsAgentDetached(
|
||||
CefBrowserCToCpp::Wrap(browser));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefDevToolsMessageObserverCppToC::CefDevToolsMessageObserverCppToC() {
|
||||
GetStruct()->on_dev_tools_message =
|
||||
dev_tools_message_observer_on_dev_tools_message;
|
||||
GetStruct()->on_dev_tools_method_result =
|
||||
dev_tools_message_observer_on_dev_tools_method_result;
|
||||
GetStruct()->on_dev_tools_event =
|
||||
dev_tools_message_observer_on_dev_tools_event;
|
||||
GetStruct()->on_dev_tools_agent_attached =
|
||||
dev_tools_message_observer_on_dev_tools_agent_attached;
|
||||
GetStruct()->on_dev_tools_agent_detached =
|
||||
dev_tools_message_observer_on_dev_tools_agent_detached;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefDevToolsMessageObserverCppToC::~CefDevToolsMessageObserverCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefDevToolsMessageObserver>
|
||||
CefCppToCRefCounted<CefDevToolsMessageObserverCppToC,
|
||||
CefDevToolsMessageObserver,
|
||||
cef_dev_tools_message_observer_t>::
|
||||
UnwrapDerived(CefWrapperType type, cef_dev_tools_message_observer_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType
|
||||
CefCppToCRefCounted<CefDevToolsMessageObserverCppToC,
|
||||
CefDevToolsMessageObserver,
|
||||
cef_dev_tools_message_observer_t>::kWrapperType =
|
||||
WT_DEV_TOOLS_MESSAGE_OBSERVER;
|
40
libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.h
Normal file
40
libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.h
Normal file
@@ -0,0 +1,40 @@
|
||||
// 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=d48f93f3817dab7daf0e30a6fa94b1a173356383$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_DEV_TOOLS_MESSAGE_OBSERVER_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_DEV_TOOLS_MESSAGE_OBSERVER_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_devtools_message_observer_capi.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_devtools_message_observer.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefDevToolsMessageObserverCppToC
|
||||
: public CefCppToCRefCounted<CefDevToolsMessageObserverCppToC,
|
||||
CefDevToolsMessageObserver,
|
||||
cef_dev_tools_message_observer_t> {
|
||||
public:
|
||||
CefDevToolsMessageObserverCppToC();
|
||||
virtual ~CefDevToolsMessageObserverCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_DEV_TOOLS_MESSAGE_OBSERVER_CPPTOC_H_
|
@@ -9,11 +9,12 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=cbbac244f39cc1d644b0db80a3f7234399286368$
|
||||
// $hash=f9893b2a7c5cd519d32d06a022e503340aa66bc3$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/media_sink_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/media_source_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
@@ -87,6 +88,44 @@ media_sink_get_description(struct _cef_media_sink_t* self) {
|
||||
return _retval.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_media_sink_icon_type_t CEF_CALLBACK
|
||||
media_sink_get_icon_type(struct _cef_media_sink_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return CEF_MSIT_GENERIC;
|
||||
|
||||
// Execute
|
||||
cef_media_sink_icon_type_t _retval =
|
||||
CefMediaSinkCppToC::Get(self)->GetIconType();
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK media_sink_get_device_info(
|
||||
struct _cef_media_sink_t* self,
|
||||
struct _cef_media_sink_device_info_callback_t* callback) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback);
|
||||
if (!callback)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefMediaSinkCppToC::Get(self)->GetDeviceInfo(
|
||||
CefMediaSinkDeviceInfoCallbackCToCpp::Wrap(callback));
|
||||
}
|
||||
|
||||
int CEF_CALLBACK media_sink_is_cast_sink(struct _cef_media_sink_t* self) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
@@ -151,6 +190,8 @@ CefMediaSinkCppToC::CefMediaSinkCppToC() {
|
||||
GetStruct()->is_valid = media_sink_is_valid;
|
||||
GetStruct()->get_name = media_sink_get_name;
|
||||
GetStruct()->get_description = media_sink_get_description;
|
||||
GetStruct()->get_icon_type = media_sink_get_icon_type;
|
||||
GetStruct()->get_device_info = media_sink_get_device_info;
|
||||
GetStruct()->is_cast_sink = media_sink_is_cast_sink;
|
||||
GetStruct()->is_dial_sink = media_sink_is_dial_sink;
|
||||
GetStruct()->is_compatible_with = media_sink_is_compatible_with;
|
||||
|
78
libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.cc
Normal file
78
libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.cc
Normal file
@@ -0,0 +1,78 @@
|
||||
// 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=c22023ad9e7d7d80d72729dbebdf03f0b60f4dc9$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
void CEF_CALLBACK media_sink_device_info_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) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: device_info; type: struct_byref_const
|
||||
DCHECK(device_info);
|
||||
if (!device_info)
|
||||
return;
|
||||
|
||||
// Translate param: device_info; type: struct_byref_const
|
||||
CefMediaSinkDeviceInfo device_infoObj;
|
||||
if (device_info)
|
||||
device_infoObj.Set(*device_info, false);
|
||||
|
||||
// Execute
|
||||
CefMediaSinkDeviceInfoCallbackCppToC::Get(self)->OnMediaSinkDeviceInfo(
|
||||
device_infoObj);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSinkDeviceInfoCallbackCppToC::CefMediaSinkDeviceInfoCallbackCppToC() {
|
||||
GetStruct()->on_media_sink_device_info =
|
||||
media_sink_device_info_callback_on_media_sink_device_info;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSinkDeviceInfoCallbackCppToC::~CefMediaSinkDeviceInfoCallbackCppToC() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback>
|
||||
CefCppToCRefCounted<CefMediaSinkDeviceInfoCallbackCppToC,
|
||||
CefMediaSinkDeviceInfoCallback,
|
||||
cef_media_sink_device_info_callback_t>::
|
||||
UnwrapDerived(CefWrapperType type,
|
||||
cef_media_sink_device_info_callback_t* s) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType
|
||||
CefCppToCRefCounted<CefMediaSinkDeviceInfoCallbackCppToC,
|
||||
CefMediaSinkDeviceInfoCallback,
|
||||
cef_media_sink_device_info_callback_t>::kWrapperType =
|
||||
WT_MEDIA_SINK_DEVICE_INFO_CALLBACK;
|
38
libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.h
Normal file
38
libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.h
Normal file
@@ -0,0 +1,38 @@
|
||||
// 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=5313c2346d5db18dca956f2dac98b73e049a4995$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_SINK_DEVICE_INFO_CALLBACK_CPPTOC_H_
|
||||
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_SINK_DEVICE_INFO_CALLBACK_CPPTOC_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(WRAPPING_CEF_SHARED)
|
||||
#error This file can be included wrapper-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
|
||||
|
||||
// Wrap a C++ class with a C structure.
|
||||
// This class may be instantiated and accessed wrapper-side only.
|
||||
class CefMediaSinkDeviceInfoCallbackCppToC
|
||||
: public CefCppToCRefCounted<CefMediaSinkDeviceInfoCallbackCppToC,
|
||||
CefMediaSinkDeviceInfoCallback,
|
||||
cef_media_sink_device_info_callback_t> {
|
||||
public:
|
||||
CefMediaSinkDeviceInfoCallbackCppToC();
|
||||
virtual ~CefMediaSinkDeviceInfoCallbackCppToC();
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_SINK_DEVICE_INFO_CALLBACK_CPPTOC_H_
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=68840d18a25efe4d749e480225d7ac3caacd4723$
|
||||
// $hash=716501855da0203723eb18bfb9e518c7b155f110$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/request_handler_cpptoc.h"
|
||||
@@ -396,6 +396,26 @@ void CEF_CALLBACK request_handler_on_render_process_terminated(
|
||||
CefBrowserCToCpp::Wrap(browser), status);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_handler_on_document_available_in_main_frame(
|
||||
struct _cef_request_handler_t* self,
|
||||
cef_browser_t* browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser);
|
||||
if (!browser)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
CefRequestHandlerCppToC::Get(self)->OnDocumentAvailableInMainFrame(
|
||||
CefBrowserCToCpp::Wrap(browser));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
@@ -414,6 +434,8 @@ CefRequestHandlerCppToC::CefRequestHandlerCppToC() {
|
||||
GetStruct()->on_render_view_ready = request_handler_on_render_view_ready;
|
||||
GetStruct()->on_render_process_terminated =
|
||||
request_handler_on_render_process_terminated;
|
||||
GetStruct()->on_document_available_in_main_frame =
|
||||
request_handler_on_document_available_in_main_frame;
|
||||
}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
164
libcef_dll/ctocpp/audio_handler_ctocpp.cc
Normal file
164
libcef_dll/ctocpp/audio_handler_ctocpp.cc
Normal file
@@ -0,0 +1,164 @@
|
||||
// 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=d7f2fb8ad6fe2bd0ab928b09ab596b12e9049ddf$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/audio_handler_ctocpp.h"
|
||||
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
bool CefAudioHandlerCToCpp::GetAudioParameters(CefRefPtr<CefBrowser> browser,
|
||||
CefAudioParameters& params) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_audio_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_audio_parameters))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->get_audio_parameters(
|
||||
_struct, CefBrowserCppToC::Wrap(browser), ¶ms);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefAudioHandlerCToCpp::OnAudioStreamStarted(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const CefAudioParameters& params,
|
||||
int channels) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_audio_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_audio_stream_started))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_audio_stream_started(_struct, CefBrowserCppToC::Wrap(browser),
|
||||
¶ms, channels);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefAudioHandlerCToCpp::OnAudioStreamPacket(CefRefPtr<CefBrowser> browser,
|
||||
const float** data,
|
||||
int frames,
|
||||
int64 pts) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_audio_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_audio_stream_packet))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
// Verify param: data; type: simple_byaddr
|
||||
DCHECK(data);
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_audio_stream_packet(_struct, CefBrowserCppToC::Wrap(browser),
|
||||
data, frames, pts);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefAudioHandlerCToCpp::OnAudioStreamStopped(
|
||||
CefRefPtr<CefBrowser> browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_audio_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_audio_stream_stopped))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_audio_stream_stopped(_struct, CefBrowserCppToC::Wrap(browser));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefAudioHandlerCToCpp::OnAudioStreamError(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_audio_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_audio_stream_error))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
// Verify param: message; type: string_byref_const
|
||||
DCHECK(!message.empty());
|
||||
if (message.empty())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_audio_stream_error(_struct, CefBrowserCppToC::Wrap(browser),
|
||||
message.GetStruct());
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefAudioHandlerCToCpp::CefAudioHandlerCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefAudioHandlerCToCpp::~CefAudioHandlerCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_audio_handler_t*
|
||||
CefCToCppRefCounted<CefAudioHandlerCToCpp,
|
||||
CefAudioHandler,
|
||||
cef_audio_handler_t>::UnwrapDerived(CefWrapperType type,
|
||||
CefAudioHandler* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType CefCToCppRefCounted<CefAudioHandlerCToCpp,
|
||||
CefAudioHandler,
|
||||
cef_audio_handler_t>::kWrapperType =
|
||||
WT_AUDIO_HANDLER;
|
51
libcef_dll/ctocpp/audio_handler_ctocpp.h
Normal file
51
libcef_dll/ctocpp/audio_handler_ctocpp.h
Normal file
@@ -0,0 +1,51 @@
|
||||
// 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=e5517ccac966337ef7dc576a24eedfe1154b2813$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_AUDIO_HANDLER_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_AUDIO_HANDLER_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_audio_handler_capi.h"
|
||||
#include "include/cef_audio_handler.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefAudioHandlerCToCpp : public CefCToCppRefCounted<CefAudioHandlerCToCpp,
|
||||
CefAudioHandler,
|
||||
cef_audio_handler_t> {
|
||||
public:
|
||||
CefAudioHandlerCToCpp();
|
||||
virtual ~CefAudioHandlerCToCpp();
|
||||
|
||||
// CefAudioHandler methods.
|
||||
bool GetAudioParameters(CefRefPtr<CefBrowser> browser,
|
||||
CefAudioParameters& params) override;
|
||||
void OnAudioStreamStarted(CefRefPtr<CefBrowser> browser,
|
||||
const CefAudioParameters& params,
|
||||
int channels) override;
|
||||
void OnAudioStreamPacket(CefRefPtr<CefBrowser> browser,
|
||||
const float** data,
|
||||
int frames,
|
||||
int64 pts) override;
|
||||
void OnAudioStreamStopped(CefRefPtr<CefBrowser> browser) override;
|
||||
void OnAudioStreamError(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_AUDIO_HANDLER_CTOCPP_H_
|
@@ -9,11 +9,12 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=9073823898d373a435ccdc56f2914aad91cbba1e$
|
||||
// $hash=a362e11e85ce68488bbb0f5232b01f53cffeec1d$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/browser_host_ctocpp.h"
|
||||
#include "libcef_dll/cpptoc/client_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/dev_tools_message_observer_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/download_image_callback_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/navigation_entry_visitor_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/pdf_print_callback_cpptoc.h"
|
||||
@@ -23,6 +24,7 @@
|
||||
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/extension_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/navigation_entry_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/registration_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/request_context_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
@@ -468,6 +470,81 @@ NO_SANITIZE("cfi-icall") bool CefBrowserHostCToCpp::HasDevTools() {
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
bool CefBrowserHostCToCpp::SendDevToolsMessage(const void* message,
|
||||
size_t message_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_browser_host_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, send_dev_tools_message))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: message; type: simple_byaddr
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->send_dev_tools_message(_struct, message, message_size);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
int CefBrowserHostCToCpp::ExecuteDevToolsMethod(
|
||||
int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_browser_host_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, execute_dev_tools_method))
|
||||
return 0;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: method; type: string_byref_const
|
||||
DCHECK(!method.empty());
|
||||
if (method.empty())
|
||||
return 0;
|
||||
// Unverified params: params
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->execute_dev_tools_method(
|
||||
_struct, message_id, method.GetStruct(),
|
||||
CefDictionaryValueCToCpp::Unwrap(params));
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefRefPtr<CefRegistration> CefBrowserHostCToCpp::AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_browser_host_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, add_dev_tools_message_observer))
|
||||
return nullptr;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: observer; type: refptr_diff
|
||||
DCHECK(observer.get());
|
||||
if (!observer.get())
|
||||
return nullptr;
|
||||
|
||||
// Execute
|
||||
cef_registration_t* _retval = _struct->add_dev_tools_message_observer(
|
||||
_struct, CefDevToolsMessageObserverCppToC::Wrap(observer));
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefRegistrationCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefBrowserHostCToCpp::GetNavigationEntries(
|
||||
CefRefPtr<CefNavigationEntryVisitor> visitor,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=a9c5f9224663a0c2f2a29c35c2dea3f47973b82f$
|
||||
// $hash=c9abd1293472afbac964aac4cd7dd4cac9dd8e58$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_
|
||||
@@ -76,6 +76,12 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp,
|
||||
const CefPoint& inspect_element_at) OVERRIDE;
|
||||
void CloseDevTools() OVERRIDE;
|
||||
bool HasDevTools() OVERRIDE;
|
||||
bool SendDevToolsMessage(const void* message, size_t message_size) OVERRIDE;
|
||||
int ExecuteDevToolsMethod(int message_id,
|
||||
const CefString& method,
|
||||
CefRefPtr<CefDictionaryValue> params) OVERRIDE;
|
||||
CefRefPtr<CefRegistration> AddDevToolsMessageObserver(
|
||||
CefRefPtr<CefDevToolsMessageObserver> observer) OVERRIDE;
|
||||
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
|
||||
bool current_only) OVERRIDE;
|
||||
void SetMouseCursorChangeDisabled(bool disabled) OVERRIDE;
|
||||
|
@@ -9,13 +9,14 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=cb91642733be3dfd60a0d848c41c71bbe06a835c$
|
||||
// $hash=0e4556cf21b4d75aefbfa90963c6b5c9aba33bad$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/client_ctocpp.h"
|
||||
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/process_message_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/audio_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/context_menu_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/dialog_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/display_handler_ctocpp.h"
|
||||
@@ -32,6 +33,21 @@
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefRefPtr<CefAudioHandler> CefClientCToCpp::GetAudioHandler() {
|
||||
cef_client_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_audio_handler))
|
||||
return nullptr;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_audio_handler_t* _retval = _struct->get_audio_handler(_struct);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefAudioHandlerCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefRefPtr<CefContextMenuHandler> CefClientCToCpp::GetContextMenuHandler() {
|
||||
cef_client_t* _struct = GetStruct();
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=94a6eac6479bc8404b73ff49b581338ef198a0cc$
|
||||
// $hash=f751ee624cc3b8570cba8caa051c51bb7aeccaa7$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_CLIENT_CTOCPP_H_
|
||||
@@ -33,6 +33,7 @@ class CefClientCToCpp
|
||||
virtual ~CefClientCToCpp();
|
||||
|
||||
// CefClient methods.
|
||||
CefRefPtr<CefAudioHandler> GetAudioHandler() override;
|
||||
CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() override;
|
||||
CefRefPtr<CefDialogHandler> GetDialogHandler() override;
|
||||
CefRefPtr<CefDisplayHandler> GetDisplayHandler() override;
|
||||
|
174
libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.cc
Normal file
174
libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.cc
Normal file
@@ -0,0 +1,174 @@
|
||||
// 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=e8d1eaf4b8cdfd79a260de33fb3be05a2948c81e$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.h"
|
||||
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
bool CefDevToolsMessageObserverCToCpp::OnDevToolsMessage(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const void* message,
|
||||
size_t message_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_dev_tools_message_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_dev_tools_message))
|
||||
return false;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
// Verify param: message; type: simple_byaddr
|
||||
DCHECK(message);
|
||||
if (!message)
|
||||
return false;
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->on_dev_tools_message(
|
||||
_struct, CefBrowserCppToC::Wrap(browser), message, message_size);
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefDevToolsMessageObserverCToCpp::OnDevToolsMethodResult(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
int message_id,
|
||||
bool success,
|
||||
const void* result,
|
||||
size_t result_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_dev_tools_message_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_dev_tools_method_result))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
// Unverified params: result
|
||||
|
||||
// Execute
|
||||
_struct->on_dev_tools_method_result(_struct, CefBrowserCppToC::Wrap(browser),
|
||||
message_id, success, result, result_size);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefDevToolsMessageObserverCToCpp::OnDevToolsEvent(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const CefString& method,
|
||||
const void* params,
|
||||
size_t params_size) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_dev_tools_message_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_dev_tools_event))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
// Verify param: method; type: string_byref_const
|
||||
DCHECK(!method.empty());
|
||||
if (method.empty())
|
||||
return;
|
||||
// Unverified params: params
|
||||
|
||||
// Execute
|
||||
_struct->on_dev_tools_event(_struct, CefBrowserCppToC::Wrap(browser),
|
||||
method.GetStruct(), params, params_size);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefDevToolsMessageObserverCToCpp::OnDevToolsAgentAttached(
|
||||
CefRefPtr<CefBrowser> browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_dev_tools_message_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_dev_tools_agent_attached))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_dev_tools_agent_attached(_struct,
|
||||
CefBrowserCppToC::Wrap(browser));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefDevToolsMessageObserverCToCpp::OnDevToolsAgentDetached(
|
||||
CefRefPtr<CefBrowser> browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_dev_tools_message_observer_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_dev_tools_agent_detached))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_dev_tools_agent_detached(_struct,
|
||||
CefBrowserCppToC::Wrap(browser));
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefDevToolsMessageObserverCToCpp::CefDevToolsMessageObserverCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefDevToolsMessageObserverCToCpp::~CefDevToolsMessageObserverCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_dev_tools_message_observer_t* CefCToCppRefCounted<
|
||||
CefDevToolsMessageObserverCToCpp,
|
||||
CefDevToolsMessageObserver,
|
||||
cef_dev_tools_message_observer_t>::UnwrapDerived(CefWrapperType type,
|
||||
CefDevToolsMessageObserver*
|
||||
c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType
|
||||
CefCToCppRefCounted<CefDevToolsMessageObserverCToCpp,
|
||||
CefDevToolsMessageObserver,
|
||||
cef_dev_tools_message_observer_t>::kWrapperType =
|
||||
WT_DEV_TOOLS_MESSAGE_OBSERVER;
|
56
libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.h
Normal file
56
libcef_dll/ctocpp/dev_tools_message_observer_ctocpp.h
Normal file
@@ -0,0 +1,56 @@
|
||||
// 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=26b1ef9d351b0ce4a7ca0d61c53a8374ba21168b$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_DEV_TOOLS_MESSAGE_OBSERVER_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_DEV_TOOLS_MESSAGE_OBSERVER_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_browser_capi.h"
|
||||
#include "include/capi/cef_devtools_message_observer_capi.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_devtools_message_observer.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefDevToolsMessageObserverCToCpp
|
||||
: public CefCToCppRefCounted<CefDevToolsMessageObserverCToCpp,
|
||||
CefDevToolsMessageObserver,
|
||||
cef_dev_tools_message_observer_t> {
|
||||
public:
|
||||
CefDevToolsMessageObserverCToCpp();
|
||||
virtual ~CefDevToolsMessageObserverCToCpp();
|
||||
|
||||
// CefDevToolsMessageObserver methods.
|
||||
bool OnDevToolsMessage(CefRefPtr<CefBrowser> browser,
|
||||
const void* message,
|
||||
size_t message_size) override;
|
||||
void OnDevToolsMethodResult(CefRefPtr<CefBrowser> browser,
|
||||
int message_id,
|
||||
bool success,
|
||||
const void* result,
|
||||
size_t result_size) override;
|
||||
void OnDevToolsEvent(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& method,
|
||||
const void* params,
|
||||
size_t params_size) override;
|
||||
void OnDevToolsAgentAttached(CefRefPtr<CefBrowser> browser) override;
|
||||
void OnDevToolsAgentDetached(CefRefPtr<CefBrowser> browser) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_DEV_TOOLS_MESSAGE_OBSERVER_CTOCPP_H_
|
@@ -9,10 +9,11 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=bb39ec5e546482b707c1e01a83fc1b064d96a4e6$
|
||||
// $hash=8aa27e34aea83e91b04d21764f3ab985b04bbf9b$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/media_sink_ctocpp.h"
|
||||
#include "libcef_dll/cpptoc/media_sink_device_info_callback_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/media_source_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
@@ -88,6 +89,44 @@ NO_SANITIZE("cfi-icall") CefString CefMediaSinkCToCpp::GetDescription() {
|
||||
return _retvalStr;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CefMediaSink::IconType CefMediaSinkCToCpp::GetIconType() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_icon_type))
|
||||
return CEF_MSIT_GENERIC;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
cef_media_sink_icon_type_t _retval = _struct->get_icon_type(_struct);
|
||||
|
||||
// Return type: simple
|
||||
return _retval;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefMediaSinkCToCpp::GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_device_info))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback.get());
|
||||
if (!callback.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->get_device_info(
|
||||
_struct, CefMediaSinkDeviceInfoCallbackCppToC::Wrap(callback));
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall") bool CefMediaSinkCToCpp::IsCastSink() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=d69c0bdadc802bc7cb970c316f3a0ed8529c5f9c$
|
||||
// $hash=81437a10eeb422cf962af49b782275dd24bea500$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_CTOCPP_H_
|
||||
@@ -38,6 +38,9 @@ class CefMediaSinkCToCpp : public CefCToCppRefCounted<CefMediaSinkCToCpp,
|
||||
bool IsValid() OVERRIDE;
|
||||
CefString GetName() OVERRIDE;
|
||||
CefString GetDescription() OVERRIDE;
|
||||
IconType GetIconType() OVERRIDE;
|
||||
void GetDeviceInfo(
|
||||
CefRefPtr<CefMediaSinkDeviceInfoCallback> callback) OVERRIDE;
|
||||
bool IsCastSink() OVERRIDE;
|
||||
bool IsDialSink() OVERRIDE;
|
||||
bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) OVERRIDE;
|
||||
|
60
libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.cc
Normal file
60
libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.cc
Normal file
@@ -0,0 +1,60 @@
|
||||
// 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=c56362ea79609562dacc4bf8303f2bd920ddeada$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.h"
|
||||
#include "libcef_dll/shutdown_checker.h"
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefMediaSinkDeviceInfoCallbackCToCpp::OnMediaSinkDeviceInfo(
|
||||
const CefMediaSinkDeviceInfo& device_info) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_media_sink_device_info_callback_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_media_sink_device_info))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Execute
|
||||
_struct->on_media_sink_device_info(_struct, &device_info);
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSinkDeviceInfoCallbackCToCpp::CefMediaSinkDeviceInfoCallbackCToCpp() {}
|
||||
|
||||
// DESTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefMediaSinkDeviceInfoCallbackCToCpp::~CefMediaSinkDeviceInfoCallbackCToCpp() {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
}
|
||||
|
||||
template <>
|
||||
cef_media_sink_device_info_callback_t*
|
||||
CefCToCppRefCounted<CefMediaSinkDeviceInfoCallbackCToCpp,
|
||||
CefMediaSinkDeviceInfoCallback,
|
||||
cef_media_sink_device_info_callback_t>::
|
||||
UnwrapDerived(CefWrapperType type, CefMediaSinkDeviceInfoCallback* c) {
|
||||
NOTREACHED() << "Unexpected class type: " << type;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
CefWrapperType
|
||||
CefCToCppRefCounted<CefMediaSinkDeviceInfoCallbackCToCpp,
|
||||
CefMediaSinkDeviceInfoCallback,
|
||||
cef_media_sink_device_info_callback_t>::kWrapperType =
|
||||
WT_MEDIA_SINK_DEVICE_INFO_CALLBACK;
|
42
libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.h
Normal file
42
libcef_dll/ctocpp/media_sink_device_info_callback_ctocpp.h
Normal file
@@ -0,0 +1,42 @@
|
||||
// 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.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// This file was generated by the CEF translator tool. If making changes by
|
||||
// hand only do so within the body of existing method and function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=e48d0b8482168d355e04460ea6ea5b7662dbe4fd$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_DEVICE_INFO_CALLBACK_CTOCPP_H_
|
||||
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_DEVICE_INFO_CALLBACK_CTOCPP_H_
|
||||
#pragma once
|
||||
|
||||
#if !defined(BUILDING_CEF_SHARED)
|
||||
#error This file can be included DLL-side only
|
||||
#endif
|
||||
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
|
||||
|
||||
// Wrap a C structure with a C++ class.
|
||||
// This class may be instantiated and accessed DLL-side only.
|
||||
class CefMediaSinkDeviceInfoCallbackCToCpp
|
||||
: public CefCToCppRefCounted<CefMediaSinkDeviceInfoCallbackCToCpp,
|
||||
CefMediaSinkDeviceInfoCallback,
|
||||
cef_media_sink_device_info_callback_t> {
|
||||
public:
|
||||
CefMediaSinkDeviceInfoCallbackCToCpp();
|
||||
virtual ~CefMediaSinkDeviceInfoCallbackCToCpp();
|
||||
|
||||
// CefMediaSinkDeviceInfoCallback methods.
|
||||
void OnMediaSinkDeviceInfo(
|
||||
const CefMediaSinkDeviceInfo& device_info) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_SINK_DEVICE_INFO_CALLBACK_CTOCPP_H_
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=72e6ec9a5095a99eaa78ff867ca429f8cd28b101$
|
||||
// $hash=fdcb73f79369fe74f65f75d54f08aaec0f0e4dbf$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
|
||||
@@ -394,6 +394,27 @@ void CefRequestHandlerCToCpp::OnRenderProcessTerminated(
|
||||
_struct, CefBrowserCppToC::Wrap(browser), status);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
void CefRequestHandlerCToCpp::OnDocumentAvailableInMainFrame(
|
||||
CefRefPtr<CefBrowser> browser) {
|
||||
shutdown_checker::AssertNotShutdown();
|
||||
|
||||
cef_request_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_document_available_in_main_frame))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_document_available_in_main_frame(_struct,
|
||||
CefBrowserCppToC::Wrap(browser));
|
||||
}
|
||||
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefRequestHandlerCToCpp::CefRequestHandlerCToCpp() {}
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=0d67e24bf6d8079bcdfd8b36ba48543a05a9d2fd$
|
||||
// $hash=be2bb80e8816f0eaad34382f05e2bec59dfe7fa7$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_REQUEST_HANDLER_CTOCPP_H_
|
||||
@@ -82,6 +82,7 @@ class CefRequestHandlerCToCpp
|
||||
void OnRenderViewReady(CefRefPtr<CefBrowser> browser) override;
|
||||
void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) override;
|
||||
void OnDocumentAvailableInMainFrame(CefRefPtr<CefBrowser> browser) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_REQUEST_HANDLER_CTOCPP_H_
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=fbf992432bd4ff88bed34f803047f70b5b3400f7$
|
||||
// $hash=c42cd0225d8e4286df471fcc622f9bbf9ed977d3$
|
||||
//
|
||||
|
||||
#include "include/capi/cef_app_capi.h"
|
||||
@@ -589,6 +589,24 @@ CEF_EXPORT struct _cef_value_t* cef_parse_json(
|
||||
return CefValueCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
CEF_EXPORT struct _cef_value_t* cef_parse_json_buffer(
|
||||
const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: json; type: simple_byaddr
|
||||
DCHECK(json);
|
||||
if (!json)
|
||||
return NULL;
|
||||
|
||||
// Execute
|
||||
CefRefPtr<CefValue> _retval = CefParseJSON(json, json_size, options);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefValueCppToC::Wrap(_retval);
|
||||
}
|
||||
|
||||
CEF_EXPORT struct _cef_value_t* cef_parse_jsonand_return_error(
|
||||
const cef_string_t* json_string,
|
||||
cef_json_parser_options_t options,
|
||||
|
@@ -858,8 +858,8 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
|
||||
// if the query is non-persistent. If |removed| is true the caller is
|
||||
// responsible for deleting the returned QueryInfo object.
|
||||
RequestInfo* GetRequestInfo(int browser_id,
|
||||
int request_id,
|
||||
int context_id,
|
||||
int request_id,
|
||||
bool always_remove,
|
||||
bool* removed) {
|
||||
class Visitor : public BrowserRequestInfoMap::Visitor {
|
||||
@@ -884,7 +884,7 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
|
||||
|
||||
Visitor visitor(always_remove);
|
||||
RequestInfo* info = browser_request_info_map_.Find(
|
||||
browser_id, std::make_pair(request_id, context_id), &visitor);
|
||||
browser_id, std::make_pair(context_id, request_id), &visitor);
|
||||
if (info)
|
||||
*removed = visitor.removed();
|
||||
return info;
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=bf82965f02cafae5a1afc80ab0c976436be9712e$
|
||||
// $hash=66b734973339eb27399083e978844f7d5a6a6c44$
|
||||
//
|
||||
|
||||
#include <dlfcn.h>
|
||||
@@ -139,6 +139,8 @@ typedef cef_string_userfree_t (*cef_uridecode_ptr)(const cef_string_t*,
|
||||
cef_uri_unescape_rule_t);
|
||||
typedef struct _cef_value_t* (*cef_parse_json_ptr)(const cef_string_t*,
|
||||
cef_json_parser_options_t);
|
||||
typedef struct _cef_value_t* (
|
||||
*cef_parse_json_buffer_ptr)(const void*, size_t, cef_json_parser_options_t);
|
||||
typedef struct _cef_value_t* (*cef_parse_jsonand_return_error_ptr)(
|
||||
const cef_string_t*,
|
||||
cef_json_parser_options_t,
|
||||
@@ -547,6 +549,7 @@ struct libcef_pointers {
|
||||
cef_uriencode_ptr cef_uriencode;
|
||||
cef_uridecode_ptr cef_uridecode;
|
||||
cef_parse_json_ptr cef_parse_json;
|
||||
cef_parse_json_buffer_ptr cef_parse_json_buffer;
|
||||
cef_parse_jsonand_return_error_ptr cef_parse_jsonand_return_error;
|
||||
cef_write_json_ptr cef_write_json;
|
||||
cef_get_path_ptr cef_get_path;
|
||||
@@ -763,6 +766,7 @@ int libcef_init_pointers(const char* path) {
|
||||
INIT_ENTRY(cef_uriencode);
|
||||
INIT_ENTRY(cef_uridecode);
|
||||
INIT_ENTRY(cef_parse_json);
|
||||
INIT_ENTRY(cef_parse_json_buffer);
|
||||
INIT_ENTRY(cef_parse_jsonand_return_error);
|
||||
INIT_ENTRY(cef_write_json);
|
||||
INIT_ENTRY(cef_get_path);
|
||||
@@ -1134,6 +1138,13 @@ struct _cef_value_t* cef_parse_json(const cef_string_t* json_string,
|
||||
return g_libcef_pointers.cef_parse_json(json_string, options);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
struct _cef_value_t* cef_parse_json_buffer(const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options) {
|
||||
return g_libcef_pointers.cef_parse_json_buffer(json, json_size, options);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
struct _cef_value_t* cef_parse_jsonand_return_error(
|
||||
const cef_string_t* json_string,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=c565ea9030eeed15f24fe420b828453a23dbc6ba$
|
||||
// $hash=7db8dbe24a2510d9ae0649f1569909711017c064$
|
||||
//
|
||||
|
||||
#include "include/capi/cef_app_capi.h"
|
||||
@@ -557,6 +557,24 @@ CEF_GLOBAL CefRefPtr<CefValue> CefParseJSON(const CefString& json_string,
|
||||
return CefValueCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL CefRefPtr<CefValue> CefParseJSON(const void* json,
|
||||
size_t json_size,
|
||||
cef_json_parser_options_t options) {
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: json; type: simple_byaddr
|
||||
DCHECK(json);
|
||||
if (!json)
|
||||
return nullptr;
|
||||
|
||||
// Execute
|
||||
cef_value_t* _retval = cef_parse_json_buffer(json, json_size, options);
|
||||
|
||||
// Return type: refptr_same
|
||||
return CefValueCToCpp::Wrap(_retval);
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi-icall")
|
||||
CEF_GLOBAL CefRefPtr<CefValue> CefParseJSONAndReturnError(
|
||||
const CefString& json_string,
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=089392d929a9f7a3ca4fe7f53d63b98536505261$
|
||||
// $hash=6e7cec57ce98a10f0b0668d47c9935639963c215$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_WRAPPER_TYPES_H_
|
||||
@@ -21,6 +21,7 @@ enum CefWrapperType {
|
||||
WT_BASE_SCOPED,
|
||||
WT_ACCESSIBILITY_HANDLER,
|
||||
WT_APP,
|
||||
WT_AUDIO_HANDLER,
|
||||
WT_AUTH_CALLBACK,
|
||||
WT_BEFORE_DOWNLOAD_CALLBACK,
|
||||
WT_BINARY_VALUE,
|
||||
@@ -45,6 +46,7 @@ enum CefWrapperType {
|
||||
WT_DOMNODE,
|
||||
WT_DOMVISITOR,
|
||||
WT_DELETE_COOKIES_CALLBACK,
|
||||
WT_DEV_TOOLS_MESSAGE_OBSERVER,
|
||||
WT_DIALOG_HANDLER,
|
||||
WT_DICTIONARY_VALUE,
|
||||
WT_DISPLAY,
|
||||
@@ -78,6 +80,7 @@ enum CefWrapperType {
|
||||
WT_MEDIA_ROUTE_CREATE_CALLBACK,
|
||||
WT_MEDIA_ROUTER,
|
||||
WT_MEDIA_SINK,
|
||||
WT_MEDIA_SINK_DEVICE_INFO_CALLBACK,
|
||||
WT_MEDIA_SOURCE,
|
||||
WT_MENU_BUTTON,
|
||||
WT_MENU_BUTTON_DELEGATE,
|
||||
|
@@ -492,5 +492,17 @@ patches = [
|
||||
# Fix unbound AssociatedRemote error in SetBackgroundOpaque.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=1070713
|
||||
'name': 'renderer_host_1070713',
|
||||
},
|
||||
{
|
||||
# Allow the loading of non-standard non-local WebSafe custom schemes in
|
||||
# iframes.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=1081397#c9
|
||||
'name': 'browser_security_policy_1081397',
|
||||
},
|
||||
{
|
||||
# Linux: Fix undefined symbol: ui::GtkUiDelegate::SetInstance in
|
||||
# ChromeBrowserMainExtraPartsViewsLinux::ToolkitInitialized.
|
||||
# https://bugs.chromium.org/p/chromium/issues/detail?id=1085806
|
||||
'name': 'linux_chrome_views_1085806',
|
||||
}
|
||||
]
|
||||
|
21
patch/patches/browser_security_policy_1081397.patch
Normal file
21
patch/patches/browser_security_policy_1081397.patch
Normal file
@@ -0,0 +1,21 @@
|
||||
diff --git content/browser/child_process_security_policy_impl.cc content/browser/child_process_security_policy_impl.cc
|
||||
index bcd42e788019..6a7a164a527a 100644
|
||||
--- content/browser/child_process_security_policy_impl.cc
|
||||
+++ content/browser/child_process_security_policy_impl.cc
|
||||
@@ -1469,6 +1469,16 @@ bool ChildProcessSecurityPolicyImpl::CanAccessDataForOrigin(
|
||||
// DeclarativeApiTest.PersistRules.
|
||||
if (actual_process_lock.SchemeIs(url::kDataScheme))
|
||||
return true;
|
||||
+
|
||||
+ // Allow other schemes that are non-standard, non-local and WebSafe.
|
||||
+ if (actual_process_lock.is_valid() &&
|
||||
+ !actual_process_lock.IsStandard() &&
|
||||
+ !base::Contains(url::GetLocalSchemes(),
|
||||
+ actual_process_lock.scheme_piece()) &&
|
||||
+ base::Contains(schemes_okay_to_request_in_any_process_,
|
||||
+ actual_process_lock.scheme_piece())) {
|
||||
+ return true;
|
||||
+ }
|
||||
}
|
||||
|
||||
failure_reason = "lock_mismatch";
|
@@ -1,8 +1,8 @@
|
||||
diff --git build/config/compiler/BUILD.gn build/config/compiler/BUILD.gn
|
||||
index 3d5e4dede0ba..63dde0c70634 100644
|
||||
index 4c5e6779efda..a75448436eab 100644
|
||||
--- build/config/compiler/BUILD.gn
|
||||
+++ build/config/compiler/BUILD.gn
|
||||
@@ -163,7 +163,7 @@ declare_args() {
|
||||
@@ -172,7 +172,7 @@ declare_args() {
|
||||
!use_clang_coverage && !(is_android && use_order_profiling) &&
|
||||
(use_lld ||
|
||||
(use_gold &&
|
||||
@@ -11,7 +11,7 @@ index 3d5e4dede0ba..63dde0c70634 100644
|
||||
!(current_cpu == "x86" || current_cpu == "x64"))))
|
||||
}
|
||||
|
||||
@@ -1740,8 +1740,6 @@ config("thin_archive") {
|
||||
@@ -1755,8 +1755,6 @@ config("thin_archive") {
|
||||
# archive names to 16 characters, which is not what we want).
|
||||
if ((is_posix && !is_nacl && !is_mac && !is_ios) || is_fuchsia) {
|
||||
arflags = [ "-T" ]
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user