mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
140 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
e4f25cec32 | ||
|
b223419041 | ||
|
bb98749dba | ||
|
1a0137cfb8 | ||
|
89b49aac2f | ||
|
3d028a9efa | ||
|
b547de9ee5 | ||
|
8e9984b3e3 | ||
|
072a5f5c70 | ||
|
b9282cc6f6 | ||
|
b2b49f1076 | ||
|
4e13d9991b | ||
|
3afea627b4 | ||
|
c0b313d1bf | ||
|
56f4784cae | ||
|
23f4473cca | ||
|
e864886056 | ||
|
a796f47ab6 | ||
|
3b56636993 | ||
|
b1bb21ce4b | ||
|
b382c6232d | ||
|
dacda4f675 | ||
|
e07275dc37 | ||
|
11b3194d5b | ||
|
46e4fef7e3 | ||
|
7aed8c8873 | ||
|
6a3b8bdae3 | ||
|
266704291e | ||
|
754b4eefca | ||
|
0a69d0d6e3 | ||
|
51e8afaeef | ||
|
b1789de00f | ||
|
8341771462 | ||
|
468bc37d1a | ||
|
1606b8e456 | ||
|
910a87e24d | ||
|
5633445222 | ||
|
409e14fe5a | ||
|
42583eb1a2 | ||
|
cd126463a0 | ||
|
d33bb683b3 | ||
|
33b89e9389 | ||
|
dfbb9418fc | ||
|
1ab44722e8 | ||
|
4291776473 | ||
|
06a5ef3cd8 | ||
|
9d9ee8b45f | ||
|
a22b670a00 | ||
|
8c6cc302d0 | ||
|
afcee77abe | ||
|
294eb75355 | ||
|
e472228f29 | ||
|
fb925e7aa5 | ||
|
a141082b91 | ||
|
71768ea6c3 | ||
|
ed39922f85 | ||
|
1da3f71357 | ||
|
c3d4f24720 | ||
|
9df4a54308 | ||
|
492c6c6843 | ||
|
a12c2ab3e1 | ||
|
f2f6ae4f29 | ||
|
679850a267 | ||
|
c90b65a72c | ||
|
d02d252690 | ||
|
b785d34d29 | ||
|
f5eef5390a | ||
|
97d559982e | ||
|
7a701546e1 | ||
|
ea63799c3e | ||
|
c05c3e4065 | ||
|
c629c5bb59 | ||
|
53b98a5022 | ||
|
f0347f0589 | ||
|
06a5a5bb36 | ||
|
08f6cbb675 | ||
|
1a406d079b | ||
|
3afa29d499 | ||
|
b98f142e0e | ||
|
894ac21532 | ||
|
e1132672ee | ||
|
15226b9332 | ||
|
1b85022c58 | ||
|
dbc479e490 | ||
|
5792cea985 | ||
|
16e8710a81 | ||
|
503ec7c2e6 | ||
|
11ee7e984c | ||
|
8d0ae1f894 | ||
|
95daea76fc | ||
|
8ca0b4580e | ||
|
80fc651d7e | ||
|
0f944cdc55 | ||
|
7653e9e04c | ||
|
7c866328e0 | ||
|
0d4879763a | ||
|
440dbfb6df | ||
|
875b202cbb | ||
|
beb005138a | ||
|
a94dc6a058 | ||
|
1c88c74f86 | ||
|
dfcfb51bef | ||
|
49786ccc34 | ||
|
c4284b2938 | ||
|
a90c9f9c3e | ||
|
bb006b46e6 | ||
|
f9706f260a | ||
|
319de22d89 | ||
|
115f760821 | ||
|
b9fc93955c | ||
|
f2756b5318 | ||
|
3a8778e2f8 | ||
|
58e17b3cdc | ||
|
cc6f285abd | ||
|
04c9bcd802 | ||
|
c8d0813669 | ||
|
9b9a9f359e | ||
|
b51a4de540 | ||
|
65f97a60ad | ||
|
4f07cba011 | ||
|
aad4bf2464 | ||
|
329facfbdf | ||
|
a4b6ef577e | ||
|
01e75761d3 | ||
|
737ff18498 | ||
|
d28efe8797 | ||
|
b560f04046 | ||
|
066762217f | ||
|
1a661a2d15 | ||
|
aefe9a4195 | ||
|
1d515adc22 | ||
|
9cdda243a1 | ||
|
22746985f2 | ||
|
76368bda60 | ||
|
88ecf49549 | ||
|
e7b66aa43a | ||
|
152141d7f4 | ||
|
466f5e23db | ||
|
eea1f6be63 | ||
|
5da1649653 |
@@ -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>
|
||||
|
58
BUILD.gn
58
BUILD.gn
@@ -473,6 +473,16 @@ static_library("libcef_static") {
|
||||
"libcef/browser/javascript_dialog_manager.h",
|
||||
"libcef/browser/media_capture_devices_dispatcher.cc",
|
||||
"libcef/browser/media_capture_devices_dispatcher.h",
|
||||
"libcef/browser/media_router/media_route_impl.cc",
|
||||
"libcef/browser/media_router/media_route_impl.h",
|
||||
"libcef/browser/media_router/media_router_impl.cc",
|
||||
"libcef/browser/media_router/media_router_impl.h",
|
||||
"libcef/browser/media_router/media_router_manager.cc",
|
||||
"libcef/browser/media_router/media_router_manager.h",
|
||||
"libcef/browser/media_router/media_sink_impl.cc",
|
||||
"libcef/browser/media_router/media_sink_impl.h",
|
||||
"libcef/browser/media_router/media_source_impl.cc",
|
||||
"libcef/browser/media_router/media_source_impl.h",
|
||||
"libcef/browser/menu_manager.cc",
|
||||
"libcef/browser/menu_manager.h",
|
||||
"libcef/browser/menu_model_impl.cc",
|
||||
@@ -687,8 +697,6 @@ static_library("libcef_static") {
|
||||
"libcef/renderer/render_frame_observer.h",
|
||||
"libcef/renderer/render_frame_util.cc",
|
||||
"libcef/renderer/render_frame_util.h",
|
||||
"libcef/renderer/render_message_filter.cc",
|
||||
"libcef/renderer/render_message_filter.h",
|
||||
"libcef/renderer/render_thread_observer.cc",
|
||||
"libcef/renderer/render_thread_observer.h",
|
||||
"libcef/renderer/render_urlrequest_impl.cc",
|
||||
@@ -774,9 +782,9 @@ static_library("libcef_static") {
|
||||
"//components/printing/common",
|
||||
"//components/printing/renderer",
|
||||
"//components/proxy_config",
|
||||
"//components/safe_browsing/db:test_database_manager",
|
||||
"//components/services/pdf_compositor/public/cpp",
|
||||
"//components/services/pdf_compositor/public/mojom",
|
||||
"//components/safe_browsing/core/db:test_database_manager",
|
||||
"//components/services/print_compositor/public/cpp",
|
||||
"//components/services/print_compositor/public/mojom",
|
||||
"//components/tracing",
|
||||
"//components/update_client",
|
||||
"//components/url_formatter",
|
||||
@@ -807,7 +815,6 @@ static_library("libcef_static") {
|
||||
"//media",
|
||||
"//media/blink",
|
||||
"//net",
|
||||
"//net:net_with_v8",
|
||||
"//pdf",
|
||||
"//ppapi/buildflags",
|
||||
"//printing/buildflags",
|
||||
@@ -822,7 +829,7 @@ static_library("libcef_static") {
|
||||
"//third_party/cld_3/src/src:cld_3",
|
||||
"//third_party/hunspell",
|
||||
"//third_party/leveldatabase",
|
||||
"//third_party/libxml",
|
||||
"//third_party/libxml:libxml",
|
||||
"//third_party/widevine/cdm:headers",
|
||||
"//third_party/widevine/cdm",
|
||||
"//third_party/icu",
|
||||
@@ -1098,6 +1105,13 @@ static_library("libcef_static") {
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_win || is_linux) {
|
||||
sources += [
|
||||
"libcef/browser/native/browser_platform_delegate_native_aura.cc",
|
||||
"libcef/browser/native/browser_platform_delegate_native_aura.h",
|
||||
]
|
||||
}
|
||||
} else {
|
||||
sources += [
|
||||
# Provides stub implementations for the views static methods.
|
||||
@@ -1193,7 +1207,6 @@ source_set("cef_content_browser_overlay_manifest") {
|
||||
|
||||
source_set("cef_content_renderer_overlay_manifest") {
|
||||
sources = [
|
||||
"libcef/common/service_manifests/cef_content_renderer_overlay_manifest.cc",
|
||||
"libcef/common/service_manifests/cef_content_renderer_overlay_manifest.h",
|
||||
]
|
||||
|
||||
@@ -1304,6 +1317,8 @@ repack("pak_extensions") {
|
||||
# Add associated .h files in the make_pack_header("resources") target.
|
||||
sources = [
|
||||
"$root_gen_dir/chrome/component_extension_resources.pak",
|
||||
"$root_gen_dir/content/browser/resources/media/media_internals_resources.pak",
|
||||
"$root_gen_dir/content/browser/webrtc/resources/webrtc_internals_resources.pak",
|
||||
"$root_gen_dir/extensions/extensions_renderer_resources.pak",
|
||||
"$root_gen_dir/extensions/extensions_resources.pak",
|
||||
"$root_gen_dir/mojo/public/js/mojo_bindings_resources.pak",
|
||||
@@ -1315,6 +1330,8 @@ repack("pak_extensions") {
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
"//chrome/browser/resources:component_extension_resources",
|
||||
"//content/browser/resources/media:media_internals_resources",
|
||||
"//content/browser/webrtc/resources",
|
||||
"//extensions:extensions_renderer_resources",
|
||||
"//extensions:extensions_resources_grd",
|
||||
"//mojo/public/js:resources",
|
||||
@@ -1370,13 +1387,16 @@ repack("pak") {
|
||||
# Add associated .h files in the make_pack_header("resources") target.
|
||||
sources = [
|
||||
"$root_gen_dir/chrome/browser_resources.pak",
|
||||
"$root_gen_dir/chrome/dev_ui_browser_resources.pak",
|
||||
"$root_gen_dir/chrome/net_internals_resources.pak",
|
||||
"$root_gen_dir/chrome/print_preview_resources.pak",
|
||||
"$root_gen_dir/chrome/common_resources.pak",
|
||||
"$root_gen_dir/components/components_resources.pak",
|
||||
"$root_gen_dir/components/dev_ui_components_resources.pak",
|
||||
"$root_gen_dir/cef/cef_resources.pak",
|
||||
"$root_gen_dir/content/browser/tracing/tracing_resources.pak",
|
||||
"$root_gen_dir/content/content_resources.pak",
|
||||
"$root_gen_dir/content/dev_ui_content_resources.pak",
|
||||
"$root_gen_dir/net/net_resources.pak",
|
||||
"$root_gen_dir/third_party/blink/public/resources/blink_resources.pak",
|
||||
]
|
||||
@@ -1385,14 +1405,17 @@ repack("pak") {
|
||||
# the libcef_static target. Grit deps that generate .cc files must be
|
||||
# listed both here and in the libcef_static target.
|
||||
public_deps = [
|
||||
"//chrome/browser:dev_ui_browser_resources",
|
||||
"//chrome/browser:resources",
|
||||
"//chrome/browser/resources:net_internals_resources",
|
||||
"//chrome/browser/resources/net_internals:net_internals_resources",
|
||||
"//chrome/browser/resources:print_preview_resources",
|
||||
"//chrome/common:resources",
|
||||
"//components/resources:components_resources",
|
||||
"//components/resources:dev_ui_components_resources",
|
||||
":cef_resources",
|
||||
"//content/browser/tracing:resources",
|
||||
"//content:resources",
|
||||
"//content:content_resources",
|
||||
"//content:dev_ui_content_resources",
|
||||
"//net:net_resources",
|
||||
"//third_party/blink/public:resources",
|
||||
]
|
||||
@@ -1435,12 +1458,15 @@ make_pack_header("resources") {
|
||||
"$root_gen_dir/chrome/grit/browser_resources.h",
|
||||
"$root_gen_dir/chrome/grit/common_resources.h",
|
||||
"$root_gen_dir/chrome/grit/component_extension_resources.h",
|
||||
"$root_gen_dir/chrome/grit/dev_ui_browser_resources.h",
|
||||
"$root_gen_dir/chrome/grit/net_internals_resources.h",
|
||||
"$root_gen_dir/chrome/grit/renderer_resources.h",
|
||||
"$root_gen_dir/components/grit/components_resources.h",
|
||||
"$root_gen_dir/components/grit/dev_ui_components_resources.h",
|
||||
"$root_gen_dir/content/browser/devtools/grit/devtools_resources.h",
|
||||
"$root_gen_dir/content/browser/tracing/grit/tracing_resources.h",
|
||||
"$root_gen_dir/content/grit/content_resources.h",
|
||||
"$root_gen_dir/content/grit/dev_ui_content_resources.h",
|
||||
"$root_gen_dir/extensions/grit/extensions_browser_resources.h",
|
||||
"$root_gen_dir/extensions/grit/extensions_renderer_resources.h",
|
||||
"$root_gen_dir/extensions/grit/extensions_resources.h",
|
||||
@@ -1462,9 +1488,9 @@ make_pack_header("strings") {
|
||||
"$root_gen_dir/chrome/grit/locale_settings.h",
|
||||
"$root_gen_dir/chrome/grit/platform_locale_settings.h",
|
||||
"$root_gen_dir/components/strings/grit/components_strings.h",
|
||||
"$root_gen_dir/content/app/strings/grit/content_strings.h",
|
||||
"$root_gen_dir/extensions/strings/grit/extensions_strings.h",
|
||||
"$root_gen_dir/services/strings/grit/services_strings.h",
|
||||
"$root_gen_dir/third_party/blink/public/strings/grit/blink_strings.h",
|
||||
"$root_gen_dir/ui/strings/grit/ui_strings.h",
|
||||
]
|
||||
}
|
||||
@@ -1537,7 +1563,6 @@ if (is_mac) {
|
||||
|
||||
if (v8_use_external_startup_data) {
|
||||
sources += [
|
||||
"$root_out_dir/natives_blob.bin",
|
||||
"$root_out_dir/snapshot_blob.bin",
|
||||
]
|
||||
public_deps += [ "//v8" ]
|
||||
@@ -2137,13 +2162,18 @@ if (is_mac) {
|
||||
libs = [
|
||||
"comctl32.lib",
|
||||
"d3d11.lib",
|
||||
"glu32.lib",
|
||||
"imm32.lib",
|
||||
"oleacc.lib",
|
||||
"opengl32.lib",
|
||||
"rpcrt4.lib",
|
||||
"shlwapi.lib",
|
||||
]
|
||||
|
||||
if (target_cpu != "arm64") {
|
||||
libs += [
|
||||
"opengl32.lib",
|
||||
"glu32.lib"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
if (is_linux) {
|
||||
|
@@ -7,5 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/78.0.3904.108'
|
||||
'chromium_checkout': 'refs/tags/81.0.4044.138',
|
||||
'depot_tools_checkout': 'ec2a6ce270'
|
||||
}
|
||||
|
@@ -58,6 +58,7 @@
|
||||
'content/shell/utility/shell_*',
|
||||
'extensions/shell/*',
|
||||
'net/cookies/cookie_store.h',
|
||||
'ui/base/ui_base_features.cc',
|
||||
],
|
||||
# Patterns that should not be found in the chromium/src directory after
|
||||
# applying patch files.
|
||||
|
@@ -8,7 +8,7 @@
|
||||
# by hand. See the translator.README.txt file in the tools directory for
|
||||
# more information.
|
||||
#
|
||||
# $hash=98198bc4243deb46c848735f0d5499aa4891e535$
|
||||
# $hash=578c0aef11c3c7840679e480069fc9031c628e25$
|
||||
#
|
||||
|
||||
{
|
||||
@@ -43,6 +43,7 @@
|
||||
'include/cef_keyboard_handler.h',
|
||||
'include/cef_life_span_handler.h',
|
||||
'include/cef_load_handler.h',
|
||||
'include/cef_media_router.h',
|
||||
'include/cef_menu_model.h',
|
||||
'include/cef_menu_model_delegate.h',
|
||||
'include/cef_navigation_entry.h',
|
||||
@@ -53,6 +54,7 @@
|
||||
'include/cef_print_settings.h',
|
||||
'include/cef_process_message.h',
|
||||
'include/cef_process_util.h',
|
||||
'include/cef_registration.h',
|
||||
'include/cef_render_handler.h',
|
||||
'include/cef_render_process_handler.h',
|
||||
'include/cef_request.h',
|
||||
@@ -136,6 +138,7 @@
|
||||
'include/capi/cef_keyboard_handler_capi.h',
|
||||
'include/capi/cef_life_span_handler_capi.h',
|
||||
'include/capi/cef_load_handler_capi.h',
|
||||
'include/capi/cef_media_router_capi.h',
|
||||
'include/capi/cef_menu_model_capi.h',
|
||||
'include/capi/cef_menu_model_delegate_capi.h',
|
||||
'include/capi/cef_navigation_entry_capi.h',
|
||||
@@ -146,6 +149,7 @@
|
||||
'include/capi/cef_print_settings_capi.h',
|
||||
'include/capi/cef_process_message_capi.h',
|
||||
'include/capi/cef_process_util_capi.h',
|
||||
'include/capi/cef_registration_capi.h',
|
||||
'include/capi/cef_render_handler_capi.h',
|
||||
'include/capi/cef_render_process_handler_capi.h',
|
||||
'include/capi/cef_request_capi.h',
|
||||
@@ -308,6 +312,18 @@
|
||||
'libcef_dll/cpptoc/list_value_cpptoc.h',
|
||||
'libcef_dll/ctocpp/load_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/load_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/media_observer_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_observer_ctocpp.h',
|
||||
'libcef_dll/cpptoc/media_route_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_route_cpptoc.h',
|
||||
'libcef_dll/ctocpp/media_route_create_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_route_create_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/media_router_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_router_cpptoc.h',
|
||||
'libcef_dll/cpptoc/media_sink_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_sink_cpptoc.h',
|
||||
'libcef_dll/cpptoc/media_source_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_source_cpptoc.h',
|
||||
'libcef_dll/cpptoc/views/menu_button_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/views/menu_button_cpptoc.h',
|
||||
'libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.cc',
|
||||
@@ -346,6 +362,8 @@
|
||||
'libcef_dll/ctocpp/read_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/register_cdm_callback_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/register_cdm_callback_ctocpp.h',
|
||||
'libcef_dll/cpptoc/registration_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/registration_cpptoc.h',
|
||||
'libcef_dll/ctocpp/render_handler_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/render_handler_ctocpp.h',
|
||||
'libcef_dll/ctocpp/render_process_handler_ctocpp.cc',
|
||||
@@ -598,6 +616,18 @@
|
||||
'libcef_dll/ctocpp/list_value_ctocpp.h',
|
||||
'libcef_dll/cpptoc/load_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/load_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/media_observer_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_observer_cpptoc.h',
|
||||
'libcef_dll/ctocpp/media_route_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_route_ctocpp.h',
|
||||
'libcef_dll/cpptoc/media_route_create_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/media_route_create_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/media_router_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_router_ctocpp.h',
|
||||
'libcef_dll/ctocpp/media_sink_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_sink_ctocpp.h',
|
||||
'libcef_dll/ctocpp/media_source_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/media_source_ctocpp.h',
|
||||
'libcef_dll/ctocpp/views/menu_button_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/views/menu_button_ctocpp.h',
|
||||
'libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.cc',
|
||||
@@ -636,6 +666,8 @@
|
||||
'libcef_dll/cpptoc/read_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/register_cdm_callback_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/register_cdm_callback_cpptoc.h',
|
||||
'libcef_dll/ctocpp/registration_ctocpp.cc',
|
||||
'libcef_dll/ctocpp/registration_ctocpp.h',
|
||||
'libcef_dll/cpptoc/render_handler_cpptoc.cc',
|
||||
'libcef_dll/cpptoc/render_handler_cpptoc.h',
|
||||
'libcef_dll/cpptoc/render_process_handler_cpptoc.cc',
|
||||
|
@@ -238,6 +238,8 @@
|
||||
'tests/cefclient/browser/main_context.h',
|
||||
'tests/cefclient/browser/main_context_impl.cc',
|
||||
'tests/cefclient/browser/main_context_impl.h',
|
||||
'tests/cefclient/browser/media_router_test.cc',
|
||||
'tests/cefclient/browser/media_router_test.h',
|
||||
'tests/cefclient/browser/osr_dragdrop_events.h',
|
||||
'tests/cefclient/browser/osr_renderer.h',
|
||||
'tests/cefclient/browser/osr_renderer.cc',
|
||||
@@ -287,6 +289,7 @@
|
||||
'tests/cefclient/resources/drm.html',
|
||||
'tests/cefclient/resources/localstorage.html',
|
||||
'tests/cefclient/resources/logo.png',
|
||||
'tests/cefclient/resources/media_router.html',
|
||||
'tests/cefclient/resources/menu_icon.1x.png',
|
||||
'tests/cefclient/resources/menu_icon.2x.png',
|
||||
'tests/cefclient/resources/other_tests.html',
|
||||
|
@@ -36,9 +36,9 @@ template("_repack_one_locale") {
|
||||
"${root_gen_dir}/chrome/platform_locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/components/strings/components_locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/components/strings/components_strings_${locale}.pak",
|
||||
"${root_gen_dir}/content/app/strings/content_strings_${locale}.pak",
|
||||
"${root_gen_dir}/extensions/strings/extensions_strings_${locale}.pak",
|
||||
"${root_gen_dir}/services/strings/services_strings_${locale}.pak",
|
||||
"${root_gen_dir}/third_party/blink/public/strings/blink_strings_${locale}.pak",
|
||||
"${root_gen_dir}/ui/strings/app_locale_settings_${locale}.pak",
|
||||
"${root_gen_dir}/ui/strings/ui_strings_${locale}.pak",
|
||||
]
|
||||
@@ -54,9 +54,9 @@ template("_repack_one_locale") {
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//components/strings:components_locale_settings",
|
||||
"//components/strings:components_strings",
|
||||
"//content/app/strings",
|
||||
"//extensions/strings",
|
||||
"//services/strings",
|
||||
"//third_party/blink/public/strings",
|
||||
"//ui/strings:app_locale_settings",
|
||||
"//ui/strings:ui_strings",
|
||||
]
|
||||
|
@@ -218,7 +218,6 @@ if(OS_LINUX)
|
||||
libcef.so
|
||||
libEGL.so
|
||||
libGLESv2.so
|
||||
natives_blob.bin
|
||||
snapshot_blob.bin
|
||||
v8_context_snapshot.bin
|
||||
swiftshader
|
||||
@@ -391,6 +390,7 @@ if(OS_WINDOWS)
|
||||
1921 # VS2019 version 16.1
|
||||
1922 # VS2019 version 16.2
|
||||
1923 # VS2019 version 16.3
|
||||
1924 # VS2019 version 16.4
|
||||
)
|
||||
list(FIND supported_msvc_versions ${MSVC_VERSION} _index)
|
||||
if (${_index} EQUAL -1)
|
||||
@@ -480,7 +480,6 @@ if(OS_WINDOWS)
|
||||
libcef.dll
|
||||
libEGL.dll
|
||||
libGLESv2.dll
|
||||
natives_blob.bin
|
||||
snapshot_blob.bin
|
||||
v8_context_snapshot.bin
|
||||
swiftshader
|
||||
|
@@ -178,7 +178,7 @@ Atomic64 Release_Load(volatile const Atomic64* ptr);
|
||||
// Include our platform specific implementation.
|
||||
#if defined(OS_WIN) && defined(COMPILER_MSVC) && defined(ARCH_CPU_X86_FAMILY)
|
||||
#include "include/base/internal/cef_atomicops_x86_msvc.h"
|
||||
#elif defined(OS_WIN) && defined(__ARM_ARCH_ISA_A64)
|
||||
#elif defined(OS_WIN) && (defined(__ARM_ARCH_ISA_A64) || defined(_M_ARM64))
|
||||
#include "include/base/internal/cef_atomicops_arm64_msvc.h"
|
||||
#elif defined(OS_MACOSX)
|
||||
#include "include/base/internal/cef_atomicops_mac.h"
|
||||
|
@@ -95,7 +95,7 @@
|
||||
#define ARCH_CPU_ARMEL 1
|
||||
#define ARCH_CPU_32_BITS 1
|
||||
#define ARCH_CPU_LITTLE_ENDIAN 1
|
||||
#elif defined(__aarch64__)
|
||||
#elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
#define ARCH_CPU_ARM_FAMILY 1
|
||||
#define ARCH_CPU_ARM64 1
|
||||
#define ARCH_CPU_64_BITS 1
|
||||
|
@@ -144,9 +144,9 @@
|
||||
|
||||
// Always define the DCHECK_IS_ON macro which is used from other CEF headers.
|
||||
#if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON)
|
||||
#define DCHECK_IS_ON() 0
|
||||
#define DCHECK_IS_ON() false
|
||||
#else
|
||||
#define DCHECK_IS_ON() 1
|
||||
#define DCHECK_IS_ON() true
|
||||
#endif
|
||||
|
||||
#elif defined(USING_CHROMIUM_INCLUDES)
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=85c1114638668d2b663a74844840ef50e2efa9f6$
|
||||
// $hash=ba4033eaf40a8ee24408b89b78496bf1381e7e6b$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||
@@ -829,7 +829,7 @@ typedef struct _cef_browser_host_t {
|
||||
|
||||
///
|
||||
// Returns the extension hosted in this browser or NULL if no extension is
|
||||
// hosted. See cef_request_tContext::LoadExtension for details.
|
||||
// hosted. See cef_request_context_t::LoadExtension for details.
|
||||
///
|
||||
struct _cef_extension_t*(CEF_CALLBACK* get_extension)(
|
||||
struct _cef_browser_host_t* self);
|
||||
@@ -837,7 +837,7 @@ typedef struct _cef_browser_host_t {
|
||||
///
|
||||
// Returns true (1) if this browser is hosting an extension background script.
|
||||
// Background hosts do not have a window and are not displayable. See
|
||||
// cef_request_tContext::LoadExtension for details.
|
||||
// cef_request_context_t::LoadExtension for details.
|
||||
///
|
||||
int(CEF_CALLBACK* is_background_host)(struct _cef_browser_host_t* self);
|
||||
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=c18e084ad06a04096b1ce50e488cf2276211a66c$
|
||||
// $hash=2f5721138da26a9d7cce300a635b58dae9f51a4a$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_COOKIE_CAPI_H_
|
||||
@@ -141,8 +141,8 @@ typedef struct _cef_cookie_manager_t {
|
||||
// CefSettings.cache_path if specified or in memory otherwise. If |callback| is
|
||||
// non-NULL it will be executed asnychronously on the UI thread after the
|
||||
// manager's storage has been initialized. Using this function is equivalent to
|
||||
// calling cef_request_tContext::cef_request_context_get_global_context()->GetDe
|
||||
// faultCookieManager().
|
||||
// calling cef_request_context_t::cef_request_context_get_global_context()->GetD
|
||||
// efaultCookieManager().
|
||||
///
|
||||
CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
|
||||
struct _cef_completion_callback_t* callback);
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=36cf362d97cf6f68692f9d8e060cc9306b1d64b1$
|
||||
// $hash=b50087959cb679e4132f0fccfd23f01f76079018$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_CAPI_H_
|
||||
@@ -72,7 +72,7 @@ typedef struct _cef_extension_t {
|
||||
///
|
||||
// Returns the absolute path to the extension directory on disk. This value
|
||||
// will be prefixed with PK_DIR_RESOURCES if a relative path was passed to
|
||||
// cef_request_tContext::LoadExtension.
|
||||
// cef_request_context_t::LoadExtension.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_path)(struct _cef_extension_t* self);
|
||||
@@ -95,7 +95,7 @@ typedef struct _cef_extension_t {
|
||||
///
|
||||
// Returns the handler for this extension. Will return NULL for internal
|
||||
// extensions or if no handler was passed to
|
||||
// cef_request_tContext::LoadExtension.
|
||||
// cef_request_context_t::LoadExtension.
|
||||
///
|
||||
struct _cef_extension_handler_t*(CEF_CALLBACK* get_handler)(
|
||||
struct _cef_extension_t* self);
|
||||
@@ -103,7 +103,7 @@ typedef struct _cef_extension_t {
|
||||
///
|
||||
// Returns the request context that loaded this extension. Will return NULL
|
||||
// for internal extensions or if the extension has been unloaded. See the
|
||||
// cef_request_tContext::LoadExtension documentation for more information
|
||||
// cef_request_context_t::LoadExtension documentation for more information
|
||||
// about loader contexts. Must be called on the browser process UI thread.
|
||||
///
|
||||
struct _cef_request_context_t*(CEF_CALLBACK* get_loader_context)(
|
||||
@@ -118,7 +118,7 @@ typedef struct _cef_extension_t {
|
||||
///
|
||||
// Unload this extension if it is not an internal extension and is currently
|
||||
// loaded. Will result in a call to
|
||||
// cef_extension_tHandler::OnExtensionUnloaded on success.
|
||||
// cef_extension_handler_t::OnExtensionUnloaded on success.
|
||||
///
|
||||
void(CEF_CALLBACK* unload)(struct _cef_extension_t* self);
|
||||
} cef_extension_t;
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=af959ada2c76d9868fa43b1b61a299a90b205949$
|
||||
// $hash=a13b5b607d5a2108fac5fe75f5ebd2ede7eaef6a$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_EXTENSION_HANDLER_CAPI_H_
|
||||
@@ -53,7 +53,7 @@ struct _cef_client_t;
|
||||
|
||||
///
|
||||
// Callback structure used for asynchronous continuation of
|
||||
// cef_extension_tHandler::GetExtensionResource.
|
||||
// cef_extension_handler_t::GetExtensionResource.
|
||||
///
|
||||
typedef struct _cef_get_extension_resource_callback_t {
|
||||
///
|
||||
@@ -77,7 +77,7 @@ typedef struct _cef_get_extension_resource_callback_t {
|
||||
///
|
||||
// Implement this structure to handle events related to browser extensions. The
|
||||
// functions of this structure will be called on the UI thread. See
|
||||
// cef_request_tContext::LoadExtension for information about extension loading.
|
||||
// cef_request_context_t::LoadExtension for information about extension loading.
|
||||
///
|
||||
typedef struct _cef_extension_handler_t {
|
||||
///
|
||||
@@ -86,7 +86,7 @@ typedef struct _cef_extension_handler_t {
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Called if the cef_request_tContext::LoadExtension request fails. |result|
|
||||
// Called if the cef_request_context_t::LoadExtension request fails. |result|
|
||||
// will be the error code.
|
||||
///
|
||||
void(CEF_CALLBACK* on_extension_load_failed)(
|
||||
@@ -94,7 +94,7 @@ typedef struct _cef_extension_handler_t {
|
||||
cef_errorcode_t result);
|
||||
|
||||
///
|
||||
// Called if the cef_request_tContext::LoadExtension request succeeds.
|
||||
// Called if the cef_request_context_t::LoadExtension request succeeds.
|
||||
// |extension| is the loaded extension.
|
||||
///
|
||||
void(CEF_CALLBACK* on_extension_loaded)(struct _cef_extension_handler_t* self,
|
||||
@@ -161,7 +161,7 @@ typedef struct _cef_extension_handler_t {
|
||||
// tabId parameter (e.g. chrome.tabs.*). |extension| and |browser| are the
|
||||
// source of the API call. Return the browser that will be acted on by the API
|
||||
// call or return NULL to act on |browser|. The returned browser must share
|
||||
// the same cef_request_tContext as |browser|. Incognito browsers should not
|
||||
// the same cef_request_context_t as |browser|. Incognito browsers should not
|
||||
// be considered unless the source extension has incognito access enabled, in
|
||||
// which case |include_incognito| will be true (1).
|
||||
///
|
||||
|
328
include/capi/cef_media_router_capi.h
Normal file
328
include/capi/cef_media_router_capi.h
Normal file
@@ -0,0 +1,328 @@
|
||||
// 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=aa1310919932145744d5347d449d6ee10a3a0813$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
#include "include/capi/cef_registration_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _cef_media_observer_t;
|
||||
struct _cef_media_route_create_callback_t;
|
||||
struct _cef_media_route_t;
|
||||
struct _cef_media_sink_t;
|
||||
struct _cef_media_source_t;
|
||||
|
||||
///
|
||||
// Supports discovery of and communication with media devices on the local
|
||||
// network via the Cast and DIAL protocols. The functions of this structure may
|
||||
// be called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_media_router_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Add an observer for MediaRouter events. The observer will remain registered
|
||||
// until the returned Registration object is destroyed.
|
||||
///
|
||||
struct _cef_registration_t*(CEF_CALLBACK* add_observer)(
|
||||
struct _cef_media_router_t* self,
|
||||
struct _cef_media_observer_t* observer);
|
||||
|
||||
///
|
||||
// Returns a MediaSource object for the specified media source URN. Supported
|
||||
// URN schemes include "cast:" and "dial:", and will be already known by the
|
||||
// client application (e.g. "cast:<appId>?clientId=<clientId>").
|
||||
///
|
||||
struct _cef_media_source_t*(CEF_CALLBACK* get_source)(
|
||||
struct _cef_media_router_t* self,
|
||||
const cef_string_t* urn);
|
||||
|
||||
///
|
||||
// Trigger an asynchronous call to cef_media_observer_t::OnSinks on all
|
||||
// registered observers.
|
||||
///
|
||||
void(CEF_CALLBACK* notify_current_sinks)(struct _cef_media_router_t* self);
|
||||
|
||||
///
|
||||
// Create a new route between |source| and |sink|. Source and sink must be
|
||||
// valid, compatible (as reported by cef_media_sink_t::IsCompatibleWith), and
|
||||
// a route between them must not already exist. |callback| will be executed on
|
||||
// success or failure. If route creation succeeds it will also trigger an
|
||||
// asynchronous call to cef_media_observer_t::OnRoutes on all registered
|
||||
// observers.
|
||||
///
|
||||
void(CEF_CALLBACK* create_route)(
|
||||
struct _cef_media_router_t* self,
|
||||
struct _cef_media_source_t* source,
|
||||
struct _cef_media_sink_t* sink,
|
||||
struct _cef_media_route_create_callback_t* callback);
|
||||
|
||||
///
|
||||
// Trigger an asynchronous call to cef_media_observer_t::OnRoutes on all
|
||||
// registered observers.
|
||||
///
|
||||
void(CEF_CALLBACK* notify_current_routes)(struct _cef_media_router_t* self);
|
||||
} cef_media_router_t;
|
||||
|
||||
///
|
||||
// Returns the MediaRouter object associated with the global request context.
|
||||
// Equivalent to calling cef_request_context_t::cef_request_context_get_global_c
|
||||
// ontext()->get_media_router().
|
||||
///
|
||||
CEF_EXPORT cef_media_router_t* cef_media_router_get_global();
|
||||
|
||||
///
|
||||
// Implemented by the client to observe MediaRouter events and registered via
|
||||
// cef_media_router_t::AddObserver. The functions of this structure will be
|
||||
// called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_media_observer_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// The list of available media sinks has changed or
|
||||
// cef_media_router_t::NotifyCurrentSinks was called.
|
||||
///
|
||||
void(CEF_CALLBACK* on_sinks)(struct _cef_media_observer_t* self,
|
||||
size_t sinksCount,
|
||||
struct _cef_media_sink_t* const* sinks);
|
||||
|
||||
///
|
||||
// The list of available media routes has changed or
|
||||
// cef_media_router_t::NotifyCurrentRoutes was called.
|
||||
///
|
||||
void(CEF_CALLBACK* on_routes)(struct _cef_media_observer_t* self,
|
||||
size_t routesCount,
|
||||
struct _cef_media_route_t* const* routes);
|
||||
|
||||
///
|
||||
// The connection state of |route| has changed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_route_state_changed)(
|
||||
struct _cef_media_observer_t* self,
|
||||
struct _cef_media_route_t* route,
|
||||
cef_media_route_connection_state_t state);
|
||||
|
||||
///
|
||||
// A message was recieved over |route|. |message| is only valid for the scope
|
||||
// of this callback and should be copied if necessary.
|
||||
///
|
||||
void(CEF_CALLBACK* on_route_message_received)(
|
||||
struct _cef_media_observer_t* self,
|
||||
struct _cef_media_route_t* route,
|
||||
const void* message,
|
||||
size_t message_size);
|
||||
} cef_media_observer_t;
|
||||
|
||||
///
|
||||
// Represents the route between a media source and sink. Instances of this
|
||||
// object are created via cef_media_router_t::CreateRoute and retrieved via
|
||||
// cef_media_observer_t::OnRoutes. Contains the status and metadata of a routing
|
||||
// operation. The functions of this structure may be called on any browser
|
||||
// process thread unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_media_route_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Returns the ID for this route.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_id)(struct _cef_media_route_t* self);
|
||||
|
||||
///
|
||||
// Returns the source associated with this route.
|
||||
///
|
||||
struct _cef_media_source_t*(CEF_CALLBACK* get_source)(
|
||||
struct _cef_media_route_t* self);
|
||||
|
||||
///
|
||||
// Returns the sink associated with this route.
|
||||
///
|
||||
struct _cef_media_sink_t*(CEF_CALLBACK* get_sink)(
|
||||
struct _cef_media_route_t* self);
|
||||
|
||||
///
|
||||
// Send a message over this route. |message| will be copied if necessary.
|
||||
///
|
||||
void(CEF_CALLBACK* send_route_message)(struct _cef_media_route_t* self,
|
||||
const void* message,
|
||||
size_t message_size);
|
||||
|
||||
///
|
||||
// Terminate this route. Will result in an asynchronous call to
|
||||
// cef_media_observer_t::OnRoutes on all registered observers.
|
||||
///
|
||||
void(CEF_CALLBACK* terminate)(struct _cef_media_route_t* self);
|
||||
} cef_media_route_t;
|
||||
|
||||
///
|
||||
// Callback structure for cef_media_router_t::CreateRoute. The functions of this
|
||||
// structure will be called on the browser process UI thread.
|
||||
///
|
||||
typedef struct _cef_media_route_create_callback_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Method that will be executed when the route creation has finished. |result|
|
||||
// will be CEF_MRCR_OK if the route creation succeeded. |error| will be a
|
||||
// description of the error if the route creation failed. |route| is the
|
||||
// resulting route, or NULL if the route creation failed.
|
||||
///
|
||||
void(CEF_CALLBACK* on_media_route_create_finished)(
|
||||
struct _cef_media_route_create_callback_t* self,
|
||||
cef_media_route_create_result_t result,
|
||||
const cef_string_t* error,
|
||||
struct _cef_media_route_t* route);
|
||||
} cef_media_route_create_callback_t;
|
||||
|
||||
///
|
||||
// Represents a sink to which media can be routed. Instances of this object are
|
||||
// retrieved via cef_media_observer_t::OnSinks. The functions of this structure
|
||||
// may be called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
typedef struct _cef_media_sink_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Returns the ID for this sink.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_id)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this sink is valid.
|
||||
///
|
||||
int(CEF_CALLBACK* is_valid)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns the name of this sink.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_name)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns the description of this sink.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
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);
|
||||
|
||||
///
|
||||
// Returns true (1) if this sink accepts content via Cast.
|
||||
///
|
||||
int(CEF_CALLBACK* is_cast_sink)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this sink accepts content via DIAL.
|
||||
///
|
||||
int(CEF_CALLBACK* is_dial_sink)(struct _cef_media_sink_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this sink is compatible with |source|.
|
||||
///
|
||||
int(CEF_CALLBACK* is_compatible_with)(struct _cef_media_sink_t* self,
|
||||
struct _cef_media_source_t* source);
|
||||
} cef_media_sink_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
|
||||
// structure may be called on any browser process thread unless otherwise
|
||||
// indicated.
|
||||
///
|
||||
typedef struct _cef_media_source_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Returns the ID (media source URN or URL) for this source.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_id)(struct _cef_media_source_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this source is valid.
|
||||
///
|
||||
int(CEF_CALLBACK* is_valid)(struct _cef_media_source_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this source outputs its content via Cast.
|
||||
///
|
||||
int(CEF_CALLBACK* is_cast_source)(struct _cef_media_source_t* self);
|
||||
|
||||
///
|
||||
// Returns true (1) if this source outputs its content via DIAL.
|
||||
///
|
||||
int(CEF_CALLBACK* is_dial_source)(struct _cef_media_source_t* self);
|
||||
} cef_media_source_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_MEDIA_ROUTER_CAPI_H_
|
63
include/capi/cef_registration_capi.h
Normal file
63
include/capi/cef_registration_capi.h
Normal file
@@ -0,0 +1,63 @@
|
||||
// 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=029e237cf80f94a25453bac5a9b1e0765bb56f37$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REGISTRATION_CAPI_H_
|
||||
#define CEF_INCLUDE_CAPI_CEF_REGISTRATION_CAPI_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/capi/cef_base_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///
|
||||
// Generic callback structure used for managing the lifespan of a registration.
|
||||
///
|
||||
typedef struct _cef_registration_t {
|
||||
///
|
||||
// Base structure.
|
||||
///
|
||||
cef_base_ref_counted_t base;
|
||||
} cef_registration_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // CEF_INCLUDE_CAPI_CEF_REGISTRATION_CAPI_H_
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=451a33c751f88091d9421fd499f2e32d4a227fcc$
|
||||
// $hash=7ce0953f069204a4dd2037c4a05ac9454c5e66a6$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_CAPI_H_
|
||||
@@ -44,6 +44,7 @@
|
||||
#include "include/capi/cef_cookie_capi.h"
|
||||
#include "include/capi/cef_extension_capi.h"
|
||||
#include "include/capi/cef_extension_handler_capi.h"
|
||||
#include "include/capi/cef_media_router_capi.h"
|
||||
#include "include/capi/cef_values_capi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -54,7 +55,7 @@ struct _cef_request_context_handler_t;
|
||||
struct _cef_scheme_handler_factory_t;
|
||||
|
||||
///
|
||||
// Callback structure for cef_request_tContext::ResolveHost.
|
||||
// Callback structure for cef_request_context_t::ResolveHost.
|
||||
///
|
||||
typedef struct _cef_resolve_callback_t {
|
||||
///
|
||||
@@ -168,7 +169,7 @@ typedef struct _cef_request_context_t {
|
||||
// Tells all renderer processes associated with this context to throw away
|
||||
// their plugin list cache. If |reload_pages| is true (1) they will also
|
||||
// reload all pages with plugins.
|
||||
// cef_request_tContextHandler::OnBeforePluginLoad may be called to rebuild
|
||||
// cef_request_context_handler_t::OnBeforePluginLoad may be called to rebuild
|
||||
// the plugin list cache.
|
||||
///
|
||||
void(CEF_CALLBACK* purge_plugin_list_cache)(
|
||||
@@ -228,7 +229,7 @@ typedef struct _cef_request_context_t {
|
||||
|
||||
///
|
||||
// Clears all certificate exceptions that were added as part of handling
|
||||
// cef_request_tHandler::on_certificate_error(). If you call this it is
|
||||
// cef_request_handler_t::on_certificate_error(). If you call this it is
|
||||
// recommended that you also call close_all_connections() or you risk not
|
||||
// being prompted again for server certificates if you reconnect quickly. If
|
||||
// |callback| is non-NULL it will be executed on the UI thread after
|
||||
@@ -250,7 +251,7 @@ typedef struct _cef_request_context_t {
|
||||
///
|
||||
// Clears all active and idle connections that Chromium currently has. This is
|
||||
// only recommended if you have released all other CEF objects but don't yet
|
||||
// want to call Cefshutdown(). If |callback| is non-NULL it will be executed
|
||||
// want to call cef_shutdown(). If |callback| is non-NULL it will be executed
|
||||
// on the UI thread after completion.
|
||||
///
|
||||
void(CEF_CALLBACK* close_all_connections)(
|
||||
@@ -271,8 +272,8 @@ typedef struct _cef_request_context_t {
|
||||
// If extension resources will be read from disk using the default load
|
||||
// implementation then |root_directory| should be the absolute path to the
|
||||
// extension resources directory and |manifest| should be NULL. If extension
|
||||
// resources will be provided by the client (e.g. via cef_request_tHandler
|
||||
// and/or cef_extension_tHandler) then |root_directory| should be a path
|
||||
// resources will be provided by the client (e.g. via cef_request_handler_t
|
||||
// and/or cef_extension_handler_t) then |root_directory| should be a path
|
||||
// component unique to the extension (if not absolute this will be internally
|
||||
// prefixed with the PK_DIR_RESOURCES path) and |manifest| should contain the
|
||||
// contents that would otherwise be read from the "manifest.json" file on
|
||||
@@ -281,17 +282,17 @@ typedef struct _cef_request_context_t {
|
||||
// The loaded extension will be accessible in all contexts sharing the same
|
||||
// storage (HasExtension returns true (1)). However, only the context on which
|
||||
// this function was called is considered the loader (DidLoadExtension returns
|
||||
// true (1)) and only the loader will receive cef_request_tContextHandler
|
||||
// true (1)) and only the loader will receive cef_request_context_handler_t
|
||||
// callbacks for the extension.
|
||||
//
|
||||
// cef_extension_tHandler::OnExtensionLoaded will be called on load success or
|
||||
// cef_extension_tHandler::OnExtensionLoadFailed will be called on load
|
||||
// cef_extension_handler_t::OnExtensionLoaded will be called on load success
|
||||
// or cef_extension_handler_t::OnExtensionLoadFailed will be called on load
|
||||
// failure.
|
||||
//
|
||||
// If the extension specifies a background script via the "background"
|
||||
// manifest key then cef_extension_tHandler::OnBeforeBackgroundBrowser will be
|
||||
// called to create the background browser. See that function for additional
|
||||
// information about background scripts.
|
||||
// manifest key then cef_extension_handler_t::OnBeforeBackgroundBrowser will
|
||||
// be called to create the background browser. See that function for
|
||||
// additional information about background scripts.
|
||||
//
|
||||
// For visible extension views the client application should evaluate the
|
||||
// manifest to determine the correct extension URL to load and then pass that
|
||||
@@ -353,6 +354,12 @@ typedef struct _cef_request_context_t {
|
||||
struct _cef_extension_t*(CEF_CALLBACK* get_extension)(
|
||||
struct _cef_request_context_t* self,
|
||||
const cef_string_t* extension_id);
|
||||
|
||||
///
|
||||
// Returns the MediaRouter object associated with this context.
|
||||
///
|
||||
struct _cef_media_router_t*(CEF_CALLBACK* get_media_router)(
|
||||
struct _cef_request_context_t* self);
|
||||
} cef_request_context_t;
|
||||
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=fe927e3bff2650b45332e053b63fb61d712313db$
|
||||
// $hash=e758d8c53334b91bce818cc6e9f84915778d7827$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CONTEXT_HANDLER_CAPI_H_
|
||||
@@ -87,7 +87,7 @@ typedef struct _cef_request_context_handler_t {
|
||||
// |plugin_policy| to PLUGIN_POLICY_DISABLED may be cached when
|
||||
// |top_origin_url| is NULL. To purge the plugin list cache and potentially
|
||||
// trigger new calls to this function call
|
||||
// cef_request_tContext::PurgePluginListCache.
|
||||
// cef_request_context_t::PurgePluginListCache.
|
||||
///
|
||||
int(CEF_CALLBACK* on_before_plugin_load)(
|
||||
struct _cef_request_context_handler_t* self,
|
||||
@@ -113,7 +113,7 @@ typedef struct _cef_request_context_handler_t {
|
||||
// handling return NULL. To specify a handler for the resource return a
|
||||
// cef_resource_request_handler_t object. This function will not be called if
|
||||
// the client associated with |browser| returns a non-NULL value from
|
||||
// cef_request_tHandler::GetResourceRequestHandler for the same request
|
||||
// cef_request_handler_t::GetResourceRequestHandler for the same request
|
||||
// (identified by cef_request_t::GetIdentifier).
|
||||
///
|
||||
struct _cef_resource_request_handler_t*(
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=f0543a081b43ad33a0e02bdf8b59207d4352ef36$
|
||||
// $hash=a28219cc8c1cb53faacaf236374c3cf2c0c45bef$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_HANDLER_CAPI_H_
|
||||
@@ -138,8 +138,8 @@ typedef struct _cef_request_handler_t {
|
||||
// be canceled. To allow the resource load to proceed with default handling
|
||||
// return NULL. To specify a handler for the resource return a
|
||||
// cef_resource_request_handler_t object. If this callback returns NULL the
|
||||
// same function will be called on the associated cef_request_tContextHandler,
|
||||
// if any.
|
||||
// same function will be called on the associated
|
||||
// cef_request_context_handler_t, if any.
|
||||
///
|
||||
struct _cef_resource_request_handler_t*(
|
||||
CEF_CALLBACK* get_resource_request_handler)(
|
||||
@@ -180,8 +180,8 @@ typedef struct _cef_request_handler_t {
|
||||
// size via the webkitStorageInfo.requestQuota function. |origin_url| is the
|
||||
// origin of the page making the request. |new_size| is the requested quota
|
||||
// size in bytes. Return true (1) to continue the request and call
|
||||
// cef_request_tCallback::cont() either in this function or at a later time to
|
||||
// grant or deny the request. Return false (0) to cancel the request
|
||||
// cef_request_callback_t::cont() either in this function or at a later time
|
||||
// to grant or deny the request. Return false (0) to cancel the request
|
||||
// immediately.
|
||||
///
|
||||
int(CEF_CALLBACK* on_quota_request)(struct _cef_request_handler_t* self,
|
||||
@@ -192,7 +192,7 @@ typedef struct _cef_request_handler_t {
|
||||
|
||||
///
|
||||
// Called on the UI thread to handle requests for URLs with an invalid SSL
|
||||
// certificate. Return true (1) and call cef_request_tCallback::cont() either
|
||||
// certificate. Return true (1) and call cef_request_callback_t::cont() either
|
||||
// in this function or at a later time to continue or cancel the request.
|
||||
// Return false (0) to cancel the request immediately. If
|
||||
// CefSettings.ignore_certificate_errors is set all invalid certificates will
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=a2203cb5bfab20cd4128a11557915c22f21033b8$
|
||||
// $hash=b9577b495df3990284d4e4a3db2824196175dc91$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_BUNDLE_CAPI_H_
|
||||
@@ -48,7 +48,7 @@ extern "C" {
|
||||
|
||||
///
|
||||
// Structure used for retrieving resources from the resource bundle (*.pak)
|
||||
// files loaded by CEF during startup or via the cef_resource_bundle_tHandler
|
||||
// files loaded by CEF during startup or via the cef_resource_bundle_handler_t
|
||||
// returned from cef_app_t::GetResourceBundleHandler. See CefSettings for
|
||||
// additional options related to resource bundle loading. The functions of this
|
||||
// structure may be called on any thread unless otherwise indicated.
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=67463808f6bacde8afd0c0af6c4459a8981adfa2$
|
||||
// $hash=afc96f188710bd336d09ce479a650aaa3a55357a$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_RESOURCE_REQUEST_HANDLER_CAPI_H_
|
||||
@@ -87,7 +87,7 @@ typedef struct _cef_resource_request_handler_t {
|
||||
// or change the resource load optionally modify |request|. Modification of
|
||||
// the request URL will be treated as a redirect. Return RV_CONTINUE to
|
||||
// continue the request immediately. Return RV_CONTINUE_ASYNC and call
|
||||
// cef_request_tCallback:: cont() at a later time to continue or cancel the
|
||||
// cef_request_callback_t:: cont() at a later time to continue or cancel the
|
||||
// request asynchronously. Return RV_CANCEL to cancel the request immediately.
|
||||
//
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=324e2fd030633115fb8f788da1d07496821a6f58$
|
||||
// $hash=d93b4ad0b71ffe0a05326b39c3ed0bdb26a73fac$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_SCHEME_CAPI_H_
|
||||
@@ -115,9 +115,9 @@ typedef struct _cef_scheme_handler_factory_t {
|
||||
// function may be called multiple times to change or remove the factory that
|
||||
// matches the specified |scheme_name| and optional |domain_name|. Returns false
|
||||
// (0) if an error occurs. This function may be called on any thread in the
|
||||
// browser process. Using this function is equivalent to calling cef_request_tCo
|
||||
// ntext::cef_request_context_get_global_context()->register_scheme_handler_fact
|
||||
// ory().
|
||||
// browser process. Using this function is equivalent to calling cef_request_con
|
||||
// text_t::cef_request_context_get_global_context()->register_scheme_handler_fac
|
||||
// tory().
|
||||
///
|
||||
CEF_EXPORT int cef_register_scheme_handler_factory(
|
||||
const cef_string_t* scheme_name,
|
||||
@@ -128,8 +128,8 @@ CEF_EXPORT int cef_register_scheme_handler_factory(
|
||||
// Clear all scheme handler factories registered with the global request
|
||||
// context. Returns false (0) on error. This function may be called on any
|
||||
// thread in the browser process. Using this function is equivalent to calling c
|
||||
// ef_request_tContext::cef_request_context_get_global_context()->clear_scheme_h
|
||||
// andler_factories().
|
||||
// ef_request_context_t::cef_request_context_get_global_context()->clear_scheme_
|
||||
// handler_factories().
|
||||
///
|
||||
CEF_EXPORT int cef_clear_scheme_handler_factories();
|
||||
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=3ecfe39286ee3579eb38415ab36d3fec83712abc$
|
||||
// $hash=025daa5db3bf16029953da7703e3e5968bd97fe2$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_TASK_CAPI_H_
|
||||
@@ -132,19 +132,19 @@ CEF_EXPORT cef_task_runner_t* cef_task_runner_get_for_thread(
|
||||
|
||||
///
|
||||
// Returns true (1) if called on the specified thread. Equivalent to using
|
||||
// cef_task_tRunner::GetForThread(threadId)->belongs_to_current_thread().
|
||||
// cef_task_runner_t::GetForThread(threadId)->belongs_to_current_thread().
|
||||
///
|
||||
CEF_EXPORT int cef_currently_on(cef_thread_id_t threadId);
|
||||
|
||||
///
|
||||
// Post a task for execution on the specified thread. Equivalent to using
|
||||
// cef_task_tRunner::GetForThread(threadId)->PostTask(task).
|
||||
// cef_task_runner_t::GetForThread(threadId)->PostTask(task).
|
||||
///
|
||||
CEF_EXPORT int cef_post_task(cef_thread_id_t threadId, cef_task_t* task);
|
||||
|
||||
///
|
||||
// Post a task for delayed execution on the specified thread. Equivalent to
|
||||
// using cef_task_tRunner::GetForThread(threadId)->PostDelayedTask(task,
|
||||
// using cef_task_runner_t::GetForThread(threadId)->PostDelayedTask(task,
|
||||
// delay_ms).
|
||||
///
|
||||
CEF_EXPORT int cef_post_delayed_task(cef_thread_id_t threadId,
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=1f462f42bf69d259b876c1ad8245a3e0484b3804$
|
||||
// $hash=370cdeaa3252a9ed0e1a627d858dcab23af24ee1$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_THREAD_CAPI_H_
|
||||
@@ -49,7 +49,7 @@ extern "C" {
|
||||
|
||||
///
|
||||
// A simple thread abstraction that establishes a message loop on a new thread.
|
||||
// The consumer uses cef_task_tRunner to execute code on the thread's message
|
||||
// The consumer uses cef_task_runner_t to execute code on the thread's message
|
||||
// loop. The thread is terminated when the cef_thread_t object is destroyed or
|
||||
// stop() is called. All pending tasks queued on the thread's message loop will
|
||||
// run to completion before the thread is terminated. cef_thread_create() can be
|
||||
@@ -65,7 +65,7 @@ typedef struct _cef_thread_t {
|
||||
cef_base_ref_counted_t base;
|
||||
|
||||
///
|
||||
// Returns the cef_task_tRunner that will execute code on this thread's
|
||||
// Returns the cef_task_runner_t that will execute code on this thread's
|
||||
// message loop. This function is safe to call from any thread.
|
||||
///
|
||||
struct _cef_task_runner_t*(CEF_CALLBACK* get_task_runner)(
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=e40cee272e6edd3789896bef6b43e05cc517c424$
|
||||
// $hash=63d875f5a922dd2c2e1efaaf0ddaa20475f79ef8$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_URLREQUEST_CAPI_H_
|
||||
@@ -195,7 +195,7 @@ typedef struct _cef_urlrequest_client_t {
|
||||
// the request and call cef_auth_callback_t::cont() when the authentication
|
||||
// information is available. If the request has an associated browser/frame
|
||||
// then returning false (0) will result in a call to GetAuthCredentials on the
|
||||
// cef_request_tHandler associated with that browser, if any. Otherwise,
|
||||
// cef_request_handler_t associated with that browser, if any. Otherwise,
|
||||
// returning false (0) will cancel the request immediately. This function will
|
||||
// only be called for requests initiated from the browser process.
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=deae5180f995f35ff2db04b2c5396577300c315b$
|
||||
// $hash=a5d8033127cf2d21f1cb0c87f76d2d59ec3eace0$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_TEST_CEF_TRANSLATOR_TEST_CAPI_H_
|
||||
@@ -323,7 +323,7 @@ typedef struct _cef_translator_test_t {
|
||||
|
||||
///
|
||||
// Set an object. Returns the value from
|
||||
// cef_translator_test_tRefPtrClient::get_value(). This tests input and
|
||||
// cef_translator_test_ref_ptr_client_t::get_value(). This tests input and
|
||||
// execution of a client-side object type.
|
||||
///
|
||||
int(CEF_CALLBACK* set_ref_ptr_client)(
|
||||
@@ -341,7 +341,7 @@ typedef struct _cef_translator_test_t {
|
||||
|
||||
///
|
||||
// Set a child object. Returns the value from
|
||||
// cef_translator_test_tRefPtrClient::get_value(). This tests input of a
|
||||
// cef_translator_test_ref_ptr_client_t::get_value(). This tests input of a
|
||||
// client- side child object type and execution as the parent type.
|
||||
///
|
||||
int(CEF_CALLBACK* set_child_ref_ptr_client)(
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=72d10c0974ced675d89aa54db60de845978f6319$
|
||||
// $hash=3b9789f2149c3e6d6a2e671e5427c19654442ede$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_SCROLL_VIEW_CAPI_H_
|
||||
@@ -59,7 +59,7 @@ typedef struct _cef_scroll_view_t {
|
||||
|
||||
///
|
||||
// Set the content View. The content View must have a specified size (e.g. via
|
||||
// cef_view_t::SetBounds or cef_view_tDelegate::GetPreferredSize).
|
||||
// cef_view_t::SetBounds or cef_view_delegate_t::GetPreferredSize).
|
||||
///
|
||||
void(CEF_CALLBACK* set_content_view)(struct _cef_scroll_view_t* self,
|
||||
struct _cef_view_t* view);
|
||||
|
@@ -34,7 +34,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=06d0c1ccfa43926a01cbeb3ec95ff2a001fd0b45$
|
||||
// $hash=fd013f5bdcf2333b1f0fb452442d300dffe598e5$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_API_HASH_H_
|
||||
@@ -47,13 +47,13 @@
|
||||
// way that may cause binary incompatibility with other builds. The universal
|
||||
// hash value will change if any platform is affected whereas the platform hash
|
||||
// values will change only if that particular platform is affected.
|
||||
#define CEF_API_HASH_UNIVERSAL "3ad9591f7024619a1e2fd796c7ad51ae3a34abbb"
|
||||
#define CEF_API_HASH_UNIVERSAL "c80d4c5f1dc72279ac7a44d7b174fb80cf728abc"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "3b8e38ae40c1a930227c6277c39dbc24081ccec1"
|
||||
#define CEF_API_HASH_PLATFORM "bde71fdc88914ed7353ee7308d060cd6b4f8c8af"
|
||||
#elif defined(OS_MACOSX)
|
||||
#define CEF_API_HASH_PLATFORM "4a77f1908fabccdb01a2d3bdbede5ca09fbaa394"
|
||||
#define CEF_API_HASH_PLATFORM "2fb3e42a6d2e594aa55792b5852d7f57524ab011"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "434da6be7db70fd90c4265118ac47ace4073c6ae"
|
||||
#define CEF_API_HASH_PLATFORM "222824f83536a111c6480dba64833251c01cd6fd"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -178,7 +178,7 @@ class CefApp : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefResourceBundleHandler> GetResourceBundleHandler() {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -187,7 +187,7 @@ class CefApp : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler() {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -196,7 +196,7 @@ class CefApp : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler() {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -84,7 +84,7 @@ class CefBrowserProcessHandler : public virtual CefBaseRefCounted {
|
||||
// provided then printing will not be supported on the Linux platform.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefPrintHandler> GetPrintHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefPrintHandler> GetPrintHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Called from any thread when work has been scheduled for the browser process
|
||||
|
@@ -66,7 +66,7 @@ class CefClient : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -74,75 +74,75 @@ class CefClient : public virtual CefBaseRefCounted {
|
||||
// implementation will be used.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDialogHandler> GetDialogHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefDialogHandler> GetDialogHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for browser display state events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for download events. If no handler is returned downloads
|
||||
// will not be allowed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDownloadHandler> GetDownloadHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefDownloadHandler> GetDownloadHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for drag events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefDragHandler> GetDragHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefDragHandler> GetDragHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for find result events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefFindHandler> GetFindHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefFindHandler> GetFindHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for focus events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefFocusHandler> GetFocusHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefFocusHandler> GetFocusHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for JavaScript dialogs. If no handler is provided the
|
||||
// default implementation will be used.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for keyboard events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for browser life span events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for browser load status events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for off-screen rendering events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefRenderHandler> GetRenderHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefRenderHandler> GetRenderHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Return the handler for browser request events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefRequestHandler> GetRequestHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefRequestHandler> GetRequestHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Called when a new message is received from a different process. Return true
|
||||
|
@@ -157,7 +157,7 @@ class CefExtensionHandler : public virtual CefBaseRefCounted {
|
||||
CefRefPtr<CefExtension> extension,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
bool include_incognito) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
///
|
||||
|
308
include/cef_media_router.h
Normal file
308
include/cef_media_router.h
Normal file
@@ -0,0 +1,308 @@
|
||||
// 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_MEDIA_ROUTER_H_
|
||||
#define CEF_INCLUDE_CEF_MEDIA_ROUTER_H_
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_registration.h"
|
||||
|
||||
class CefMediaObserver;
|
||||
class CefMediaRoute;
|
||||
class CefMediaRouteCreateCallback;
|
||||
class CefMediaSink;
|
||||
class CefMediaSource;
|
||||
|
||||
///
|
||||
// Supports discovery of and communication with media devices on the local
|
||||
// network via the Cast and DIAL protocols. The methods of this class may be
|
||||
// called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefMediaRouter : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Returns the MediaRouter object associated with the global request context.
|
||||
// Equivalent to calling
|
||||
// CefRequestContext::GetGlobalContext()->GetMediaRouter().
|
||||
///
|
||||
/*--cef()--*/
|
||||
static CefRefPtr<CefMediaRouter> GetGlobalMediaRouter();
|
||||
|
||||
///
|
||||
// Add an observer for MediaRouter events. The observer will remain registered
|
||||
// until the returned Registration object is destroyed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefRegistration> AddObserver(
|
||||
CefRefPtr<CefMediaObserver> observer) = 0;
|
||||
|
||||
///
|
||||
// Returns a MediaSource object for the specified media source URN. Supported
|
||||
// URN schemes include "cast:" and "dial:", and will be already known by the
|
||||
// client application (e.g. "cast:<appId>?clientId=<clientId>").
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefMediaSource> GetSource(const CefString& urn) = 0;
|
||||
|
||||
///
|
||||
// Trigger an asynchronous call to CefMediaObserver::OnSinks on all
|
||||
// registered observers.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void NotifyCurrentSinks() = 0;
|
||||
|
||||
///
|
||||
// Create a new route between |source| and |sink|. Source and sink must be
|
||||
// valid, compatible (as reported by CefMediaSink::IsCompatibleWith), and a
|
||||
// route between them must not already exist. |callback| will be executed
|
||||
// on success or failure. If route creation succeeds it will also trigger an
|
||||
// asynchronous call to CefMediaObserver::OnRoutes on all registered
|
||||
// observers.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void CreateRoute(CefRefPtr<CefMediaSource> source,
|
||||
CefRefPtr<CefMediaSink> sink,
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback) = 0;
|
||||
|
||||
///
|
||||
// Trigger an asynchronous call to CefMediaObserver::OnRoutes on all
|
||||
// registered observers.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void NotifyCurrentRoutes() = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Implemented by the client to observe MediaRouter events and registered via
|
||||
// CefMediaRouter::AddObserver. The methods of this class will be called on the
|
||||
// browser process UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefMediaObserver : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
typedef cef_media_route_connection_state_t ConnectionState;
|
||||
|
||||
///
|
||||
// The list of available media sinks has changed or
|
||||
// CefMediaRouter::NotifyCurrentSinks was called.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnSinks(const std::vector<CefRefPtr<CefMediaSink>>& sinks) = 0;
|
||||
|
||||
///
|
||||
// The list of available media routes has changed or
|
||||
// CefMediaRouter::NotifyCurrentRoutes was called.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnRoutes(
|
||||
const std::vector<CefRefPtr<CefMediaRoute>>& routes) = 0;
|
||||
|
||||
///
|
||||
// The connection state of |route| has changed.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnRouteStateChanged(CefRefPtr<CefMediaRoute> route,
|
||||
ConnectionState state) = 0;
|
||||
|
||||
///
|
||||
// A message was recieved over |route|. |message| is only valid for
|
||||
// the scope of this callback and should be copied if necessary.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnRouteMessageReceived(CefRefPtr<CefMediaRoute> route,
|
||||
const void* message,
|
||||
size_t message_size) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Represents the route between a media source and sink. Instances of this
|
||||
// object are created via CefMediaRouter::CreateRoute and retrieved via
|
||||
// CefMediaObserver::OnRoutes. Contains the status and metadata of a
|
||||
// routing operation. The methods of this class may be called on any browser
|
||||
// process thread unless otherwise indicated.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefMediaRoute : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Returns the ID for this route.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetId() = 0;
|
||||
|
||||
///
|
||||
// Returns the source associated with this route.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefMediaSource> GetSource() = 0;
|
||||
|
||||
///
|
||||
// Returns the sink associated with this route.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefMediaSink> GetSink() = 0;
|
||||
|
||||
///
|
||||
// Send a message over this route. |message| will be copied if necessary.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SendRouteMessage(const void* message, size_t message_size) = 0;
|
||||
|
||||
///
|
||||
// Terminate this route. Will result in an asynchronous call to
|
||||
// CefMediaObserver::OnRoutes on all registered observers.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void Terminate() = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Callback interface for CefMediaRouter::CreateRoute. The methods of this
|
||||
// class will be called on the browser process UI thread.
|
||||
///
|
||||
/*--cef(source=client)--*/
|
||||
class CefMediaRouteCreateCallback : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
typedef cef_media_route_create_result_t RouteCreateResult;
|
||||
|
||||
///
|
||||
// Method that will be executed when the route creation has finished. |result|
|
||||
// will be CEF_MRCR_OK if the route creation succeeded. |error| will be a
|
||||
// description of the error if the route creation failed. |route| is the
|
||||
// resulting route, or empty if the route creation failed.
|
||||
///
|
||||
/*--cef(optional_param=error,optional_param=route)--*/
|
||||
virtual void OnMediaRouteCreateFinished(RouteCreateResult result,
|
||||
const CefString& error,
|
||||
CefRefPtr<CefMediaRoute> route) = 0;
|
||||
};
|
||||
|
||||
///
|
||||
// Represents a sink to which media can be routed. Instances of this object are
|
||||
// retrieved via CefMediaObserver::OnSinks. The methods of this class may
|
||||
// be called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefMediaSink : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
typedef cef_media_sink_icon_type_t IconType;
|
||||
|
||||
///
|
||||
// Returns the ID for this sink.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetId() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this sink is valid.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsValid() = 0;
|
||||
|
||||
///
|
||||
// Returns the name of this sink.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetName() = 0;
|
||||
|
||||
///
|
||||
// Returns the description of this sink.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetDescription() = 0;
|
||||
|
||||
///
|
||||
// Returns the icon type for this sink.
|
||||
///
|
||||
/*--cef(default_retval=CEF_MSIT_GENERIC)--*/
|
||||
virtual IconType GetIconType() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this sink accepts content via Cast.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsCastSink() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this sink accepts content via DIAL.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsDialSink() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this sink is compatible with |source|.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsCompatibleWith(CefRefPtr<CefMediaSource> source) = 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
|
||||
// called on any browser process thread unless otherwise indicated.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefMediaSource : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
// Returns the ID (media source URN or URL) for this source.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetId() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this source is valid.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsValid() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this source outputs its content via Cast.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsCastSource() = 0;
|
||||
|
||||
///
|
||||
// Returns true if this source outputs its content via DIAL.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsDialSource() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_MEDIA_ROUTER_H_
|
49
include/cef_registration.h
Normal file
49
include/cef_registration.h
Normal file
@@ -0,0 +1,49 @@
|
||||
// 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_REGISTRATION_H_
|
||||
#define CEF_INCLUDE_CEF_REGISTRATION_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
///
|
||||
// Generic callback interface used for managing the lifespan of a registration.
|
||||
///
|
||||
/*--cef(source=library)--*/
|
||||
class CefRegistration : public virtual CefBaseRefCounted {};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REGISTRATION_H_
|
@@ -65,7 +65,7 @@ class CefRenderHandler : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefAccessibilityHandler> GetAccessibilityHandler() {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
///
|
||||
|
@@ -93,7 +93,7 @@ class CefRenderProcessHandler : public virtual CefBaseRefCounted {
|
||||
// Return the handler for browser load status events.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() { return NULL; }
|
||||
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() { return nullptr; }
|
||||
|
||||
///
|
||||
// Called immediately after the V8 context for a frame has been created. To
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include "include/cef_cookie.h"
|
||||
#include "include/cef_extension.h"
|
||||
#include "include/cef_extension_handler.h"
|
||||
#include "include/cef_media_router.h"
|
||||
#include "include/cef_values.h"
|
||||
|
||||
class CefRequestContextHandler;
|
||||
@@ -361,6 +362,12 @@ class CefRequestContext : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefExtension> GetExtension(
|
||||
const CefString& extension_id) = 0;
|
||||
|
||||
///
|
||||
// Returns the MediaRouter object associated with this context.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefMediaRouter> GetMediaRouter() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_REQUEST_CONTEXT_H_
|
||||
|
@@ -119,7 +119,7 @@ class CefRequestContextHandler : public virtual CefBaseRefCounted {
|
||||
bool is_download,
|
||||
const CefString& request_initiator,
|
||||
bool& disable_default_handling) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -145,7 +145,7 @@ class CefRequestHandler : public virtual CefBaseRefCounted {
|
||||
bool is_download,
|
||||
const CefString& request_initiator,
|
||||
bool& disable_default_handling) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
///
|
||||
|
@@ -72,7 +72,7 @@ class CefResourceRequestHandler : public virtual CefBaseRefCounted {
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -109,7 +109,7 @@ class CefResourceRequestHandler : public virtual CefBaseRefCounted {
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
///
|
||||
@@ -163,7 +163,7 @@ class CefResourceRequestHandler : public virtual CefBaseRefCounted {
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefResponse> response) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
///
|
||||
|
@@ -725,6 +725,11 @@ typedef struct _cef_urlparts_t {
|
||||
// Query string component (i.e., everything following the '?').
|
||||
///
|
||||
cef_string_t query;
|
||||
|
||||
///
|
||||
// Fragment (hash) identifier component (i.e., the string following the '#').
|
||||
///
|
||||
cef_string_t fragment;
|
||||
} cef_urlparts_t;
|
||||
|
||||
///
|
||||
@@ -1092,6 +1097,16 @@ typedef enum {
|
||||
// A resource that a plugin requested.
|
||||
///
|
||||
RT_PLUGIN_RESOURCE,
|
||||
|
||||
///
|
||||
// A main-frame service worker navigation preload request.
|
||||
///
|
||||
RT_NAVIGATION_PRELOAD_MAIN_FRAME = 19,
|
||||
|
||||
///
|
||||
// A sub-frame service worker navigation preload request.
|
||||
///
|
||||
RT_NAVIGATION_PRELOAD_SUB_FRAME,
|
||||
} cef_resource_type_t;
|
||||
|
||||
///
|
||||
@@ -1107,9 +1122,8 @@ typedef enum {
|
||||
TT_LINK = 0,
|
||||
|
||||
///
|
||||
// Source is some other "explicit" navigation action such as creating a new
|
||||
// browser or using the LoadURL function. This is also the default value
|
||||
// for navigations where the actual type is unknown.
|
||||
// Source is some other "explicit" navigation. This is the default value for
|
||||
// navigations where the actual type is unknown. See also TT_DIRECT_LOAD_FLAG.
|
||||
///
|
||||
TT_EXPLICIT = 1,
|
||||
|
||||
@@ -1161,9 +1175,15 @@ typedef enum {
|
||||
|
||||
///
|
||||
// Used the Forward or Back function to navigate among browsing history.
|
||||
// Will be ORed to the transition type for the original load.
|
||||
///
|
||||
TT_FORWARD_BACK_FLAG = 0x01000000,
|
||||
|
||||
///
|
||||
// Loaded a URL directly via CreateBrowser, LoadURL or LoadRequest.
|
||||
///
|
||||
TT_DIRECT_LOAD_FLAG = 0x02000000,
|
||||
|
||||
///
|
||||
// The beginning of a navigation chain.
|
||||
///
|
||||
@@ -1770,6 +1790,7 @@ typedef enum {
|
||||
EVENTFLAG_IS_KEY_PAD = 1 << 9,
|
||||
EVENTFLAG_IS_LEFT = 1 << 10,
|
||||
EVENTFLAG_IS_RIGHT = 1 << 11,
|
||||
EVENTFLAG_ALTGR_DOWN = 1 << 12,
|
||||
} cef_event_flags_t;
|
||||
|
||||
///
|
||||
@@ -2287,21 +2308,10 @@ typedef enum {
|
||||
///
|
||||
UU_URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS = 1 << 3,
|
||||
|
||||
///
|
||||
// Unescapes characters that can be used in spoofing attempts (such as LOCK)
|
||||
// and control characters (such as BiDi control characters and %01). This
|
||||
// INCLUDES NULLs. This is used for rare cases such as data: URL decoding
|
||||
// where the result is binary data.
|
||||
//
|
||||
// DO NOT use UU_SPOOFING_AND_CONTROL_CHARS if the URL is going to be
|
||||
// displayed in the UI for security reasons.
|
||||
///
|
||||
UU_SPOOFING_AND_CONTROL_CHARS = 1 << 4,
|
||||
|
||||
///
|
||||
// URL queries use "+" for space. This flag controls that replacement.
|
||||
///
|
||||
UU_REPLACE_PLUS_WITH_SPACE = 1 << 5,
|
||||
UU_REPLACE_PLUS_WITH_SPACE = 1 << 4,
|
||||
} cef_uri_unescape_rule_t;
|
||||
|
||||
///
|
||||
@@ -2424,13 +2434,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.
|
||||
@@ -2921,6 +2931,16 @@ typedef enum {
|
||||
CEF_CDM_REGISTRATION_ERROR_NOT_SUPPORTED,
|
||||
} cef_cdm_registration_error_t;
|
||||
|
||||
///
|
||||
// Composition underline style.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_CUS_SOLID,
|
||||
CEF_CUS_DOT,
|
||||
CEF_CUS_DASH,
|
||||
CEF_CUS_NONE,
|
||||
} cef_composition_underline_style_t;
|
||||
|
||||
///
|
||||
// Structure representing IME composition underline information. This is a thin
|
||||
// wrapper around Blink's WebCompositionUnderline class and should be kept in
|
||||
@@ -2946,8 +2966,59 @@ typedef struct _cef_composition_underline_t {
|
||||
// Set to true (1) for thick underline.
|
||||
///
|
||||
int thick;
|
||||
|
||||
///
|
||||
// Style.
|
||||
///
|
||||
cef_composition_underline_style_t style;
|
||||
} cef_composition_underline_t;
|
||||
|
||||
///
|
||||
// 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,
|
||||
CEF_MRCR_OK = 1,
|
||||
CEF_MRCR_TIMED_OUT = 2,
|
||||
CEF_MRCR_ROUTE_NOT_FOUND = 3,
|
||||
CEF_MRCR_SINK_NOT_FOUND = 4,
|
||||
CEF_MRCR_INVALID_ORIGIN = 5,
|
||||
CEF_MRCR_NO_SUPPORTED_PROVIDER = 7,
|
||||
CEF_MRCR_CANCELLED = 8,
|
||||
CEF_MRCR_ROUTE_ALREADY_EXISTS = 9,
|
||||
|
||||
CEF_MRCR_TOTAL_COUNT = 11 // The total number of values.
|
||||
} cef_media_route_create_result_t;
|
||||
|
||||
///
|
||||
// Connection state for a MediaRoute object.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_MRCS_UNKNOWN,
|
||||
CEF_MRCS_CONNECTING,
|
||||
CEF_MRCS_CONNECTED,
|
||||
CEF_MRCS_CLOSED,
|
||||
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;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -743,6 +743,7 @@ struct CefURLPartsTraits {
|
||||
cef_string_clear(&s->origin);
|
||||
cef_string_clear(&s->path);
|
||||
cef_string_clear(&s->query);
|
||||
cef_string_clear(&s->fragment);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
@@ -759,6 +760,8 @@ struct CefURLPartsTraits {
|
||||
cef_string_set(src->origin.str, src->origin.length, &target->origin, copy);
|
||||
cef_string_set(src->path.str, src->path.length, &target->path, copy);
|
||||
cef_string_set(src->query.str, src->query.length, &target->query, copy);
|
||||
cef_string_set(src->fragment.str, src->fragment.length, &target->fragment,
|
||||
copy);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -866,10 +869,7 @@ struct CefCursorInfoTraits {
|
||||
static inline void set(const struct_type* src,
|
||||
struct_type* target,
|
||||
bool copy) {
|
||||
target->hotspot = src->hotspot;
|
||||
target->image_scale_factor = src->image_scale_factor;
|
||||
target->buffer = src->buffer;
|
||||
target->size = src->size;
|
||||
*target = *src;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -942,23 +942,14 @@ typedef CefStructBase<CefBoxLayoutSettingsTraits> CefBoxLayoutSettings;
|
||||
struct CefCompositionUnderlineTraits {
|
||||
typedef cef_composition_underline_t struct_type;
|
||||
|
||||
static inline void init(struct_type* s) {
|
||||
s->range.from = 0;
|
||||
s->range.to = 0;
|
||||
s->color = 0;
|
||||
s->background_color = 0;
|
||||
s->thick = 0;
|
||||
}
|
||||
static inline void 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->range = src->range;
|
||||
target->color = src->color;
|
||||
target->background_color = src->background_color;
|
||||
target->thick = src->thick;
|
||||
*target = *src;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -75,7 +75,7 @@ class CefWindowDelegate : public CefPanelDelegate {
|
||||
virtual CefRefPtr<CefWindow> GetParentWindow(CefRefPtr<CefWindow> window,
|
||||
bool* is_menu,
|
||||
bool* can_activate_menu) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
///
|
||||
|
@@ -37,14 +37,10 @@
|
||||
#define CEF_INCLUDE_WRAPPER_CEF_STREAM_RESOURCE_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/base/cef_logging.h"
|
||||
#include "include/base/cef_macros.h"
|
||||
#include "include/base/cef_scoped_ptr.h"
|
||||
#include "include/cef_base.h"
|
||||
#include "include/cef_resource_handler.h"
|
||||
#include "include/cef_response.h"
|
||||
|
||||
class CefStreamReader;
|
||||
#include "include/cef_stream.h"
|
||||
|
||||
///
|
||||
// Implementation of the CefResourceHandler class for reading from a CefStream.
|
||||
@@ -65,37 +61,25 @@ class CefStreamResourceHandler : public CefResourceHandler {
|
||||
CefResponse::HeaderMap header_map,
|
||||
CefRefPtr<CefStreamReader> stream);
|
||||
|
||||
virtual ~CefStreamResourceHandler();
|
||||
|
||||
// CefResourceHandler methods.
|
||||
virtual bool ProcessRequest(CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefCallback> callback) OVERRIDE;
|
||||
virtual void GetResponseHeaders(CefRefPtr<CefResponse> response,
|
||||
int64& response_length,
|
||||
CefString& redirectUrl) OVERRIDE;
|
||||
virtual bool ReadResponse(void* data_out,
|
||||
int bytes_to_read,
|
||||
int& bytes_read,
|
||||
CefRefPtr<CefCallback> callback) OVERRIDE;
|
||||
virtual void Cancel() OVERRIDE;
|
||||
bool Open(CefRefPtr<CefRequest> request,
|
||||
bool& handle_request,
|
||||
CefRefPtr<CefCallback> callback) OVERRIDE;
|
||||
void GetResponseHeaders(CefRefPtr<CefResponse> response,
|
||||
int64& response_length,
|
||||
CefString& redirectUrl) OVERRIDE;
|
||||
bool Read(void* data_out,
|
||||
int bytes_to_read,
|
||||
int& bytes_read,
|
||||
CefRefPtr<CefResourceReadCallback> callback) OVERRIDE;
|
||||
void Cancel() OVERRIDE;
|
||||
|
||||
private:
|
||||
void ReadOnFileThread(int bytes_to_read, CefRefPtr<CefCallback> callback);
|
||||
|
||||
const int status_code_;
|
||||
const CefString status_text_;
|
||||
const CefString mime_type_;
|
||||
const CefResponse::HeaderMap header_map_;
|
||||
const CefRefPtr<CefStreamReader> stream_;
|
||||
bool read_on_file_thread_;
|
||||
|
||||
class Buffer;
|
||||
scoped_ptr<Buffer> buffer_;
|
||||
#if DCHECK_IS_ON()
|
||||
// Used in debug builds to verify that |buffer_| isn't being accessed on
|
||||
// multiple threads at the same time.
|
||||
bool buffer_owned_by_file_thread_;
|
||||
#endif
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefStreamResourceHandler);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefStreamResourceHandler);
|
||||
|
@@ -11,6 +11,7 @@
|
||||
#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"
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/ssl_host_state_delegate.h"
|
||||
@@ -25,6 +26,7 @@
|
||||
#include "base/strings/string_util.h"
|
||||
#include "chrome/browser/font_family_cache.h"
|
||||
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
|
||||
#include "chrome/browser/profiles/profile_key.h"
|
||||
#include "chrome/browser/ui/zoom/chrome_zoom_level_prefs.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
@@ -36,7 +38,7 @@
|
||||
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
|
||||
#include "components/user_prefs/user_prefs.h"
|
||||
#include "components/visitedlink/browser/visitedlink_event_listener.h"
|
||||
#include "components/visitedlink/browser/visitedlink_master.h"
|
||||
#include "components/visitedlink/browser/visitedlink_writer.h"
|
||||
#include "components/zoom/zoom_event_manager.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
@@ -47,6 +49,7 @@
|
||||
#include "extensions/common/constants.h"
|
||||
#include "net/proxy_resolution/proxy_config_service.h"
|
||||
#include "net/proxy_resolution/proxy_resolution_service.h"
|
||||
#include "services/network/public/mojom/cors_origin_pattern.mojom.h"
|
||||
|
||||
using content::BrowserThread;
|
||||
|
||||
@@ -162,11 +165,16 @@ base::LazyInstance<ImplManager>::DestructorAtExit g_manager =
|
||||
base::LazyInstance<ImplManager>::Leaky g_manager = LAZY_INSTANCE_INITIALIZER;
|
||||
#endif
|
||||
|
||||
CefBrowserContext* GetSelf(base::WeakPtr<CefBrowserContext> self) {
|
||||
CEF_REQUIRE_UIT();
|
||||
return self.get();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// Creates and manages VisitedLinkEventListener objects for each
|
||||
// CefBrowserContext sharing the same VisitedLinkMaster.
|
||||
class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener {
|
||||
// CefBrowserContext sharing the same VisitedLinkWriter.
|
||||
class CefVisitedLinkListener : public visitedlink::VisitedLinkWriter::Listener {
|
||||
public:
|
||||
CefVisitedLinkListener() { DCHECK(listener_map_.empty()); }
|
||||
|
||||
@@ -184,7 +192,7 @@ class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener {
|
||||
listener_map_.erase(it);
|
||||
}
|
||||
|
||||
// visitedlink::VisitedLinkMaster::Listener methods.
|
||||
// visitedlink::VisitedLinkWriter::Listener methods.
|
||||
|
||||
void NewTable(base::ReadOnlySharedMemoryRegion* table_region) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -218,8 +226,9 @@ class CefVisitedLinkListener : public visitedlink::VisitedLinkMaster::Listener {
|
||||
};
|
||||
|
||||
CefBrowserContext::CefBrowserContext(const CefRequestContextSettings& settings)
|
||||
: settings_(settings) {
|
||||
: settings_(settings), weak_ptr_factory_(this) {
|
||||
g_manager.Get().AddImpl(this);
|
||||
getter_ = base::BindRepeating(GetSelf, weak_ptr_factory_.GetWeakPtr());
|
||||
}
|
||||
|
||||
CefBrowserContext::~CefBrowserContext() {
|
||||
@@ -231,6 +240,9 @@ CefBrowserContext::~CefBrowserContext() {
|
||||
// Unregister the context first to avoid re-entrancy during shutdown.
|
||||
g_manager.Get().RemoveImpl(this, cache_path_);
|
||||
|
||||
// Destroy objects that may hold references to the MediaRouter.
|
||||
media_router_manager_.reset();
|
||||
|
||||
// Send notifications to clean up objects associated with this Profile.
|
||||
MaybeSendDestroyedNotification();
|
||||
|
||||
@@ -339,7 +351,7 @@ void CefBrowserContext::Initialize() {
|
||||
if (!cache_path_.empty())
|
||||
visited_link_path = cache_path_.Append(FILE_PATH_LITERAL("Visited Links"));
|
||||
visitedlink_listener_ = new CefVisitedLinkListener;
|
||||
visitedlink_master_.reset(new visitedlink::VisitedLinkMaster(
|
||||
visitedlink_master_.reset(new visitedlink::VisitedLinkWriter(
|
||||
visitedlink_listener_, this, !visited_link_path.empty(), false,
|
||||
visited_link_path, 0));
|
||||
visitedlink_listener_->CreateListenerForContext(this);
|
||||
@@ -485,6 +497,11 @@ content::PushMessagingService* CefBrowserContext::GetPushMessagingService() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::StorageNotificationService*
|
||||
CefBrowserContext::GetStorageNotificationService() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::SSLHostStateDelegate* CefBrowserContext::GetSSLHostStateDelegate() {
|
||||
if (!ssl_host_state_delegate_.get())
|
||||
ssl_host_state_delegate_.reset(new CefSSLHostStateDelegate());
|
||||
@@ -575,7 +592,7 @@ HostContentSettingsMap* CefBrowserContext::GetHostContentSettingsMap() {
|
||||
plugin_policy = CONTENT_SETTING_BLOCK;
|
||||
}
|
||||
host_content_settings_map_->SetDefaultContentSetting(
|
||||
CONTENT_SETTINGS_TYPE_PLUGINS, plugin_policy);
|
||||
ContentSettingsType::PLUGINS, plugin_policy);
|
||||
}
|
||||
}
|
||||
return host_content_settings_map_.get();
|
||||
@@ -805,3 +822,11 @@ bool CefBrowserContext::IsPrintPreviewSupported() const {
|
||||
|
||||
return !GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled);
|
||||
}
|
||||
|
||||
CefMediaRouterManager* CefBrowserContext::GetMediaRouterManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!media_router_manager_) {
|
||||
media_router_manager_.reset(new CefMediaRouterManager(this));
|
||||
}
|
||||
return media_router_manager_.get();
|
||||
}
|
||||
|
@@ -13,8 +13,10 @@
|
||||
#include "libcef/browser/request_context_handler_map.h"
|
||||
#include "libcef/browser/resource_context.h"
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "chrome/browser/download/download_prefs.h"
|
||||
#include "chrome/common/plugin.mojom.h"
|
||||
#include "components/proxy_config/pref_proxy_config_tracker.h"
|
||||
@@ -84,6 +86,7 @@
|
||||
*/
|
||||
|
||||
class CefDownloadManagerDelegate;
|
||||
class CefMediaRouterManager;
|
||||
class CefRequestContextImpl;
|
||||
class CefSSLHostStateDelegate;
|
||||
class CefVisitedLinkListener;
|
||||
@@ -95,7 +98,7 @@ class CefExtensionSystem;
|
||||
}
|
||||
|
||||
namespace visitedlink {
|
||||
class VisitedLinkMaster;
|
||||
class VisitedLinkWriter;
|
||||
}
|
||||
|
||||
// Main entry point for configuring behavior on a per-browser basis. An instance
|
||||
@@ -149,6 +152,7 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
content::BrowserPluginGuestManager* GetGuestManager() override;
|
||||
storage::SpecialStoragePolicy* GetSpecialStoragePolicy() override;
|
||||
content::PushMessagingService* GetPushMessagingService() override;
|
||||
content::StorageNotificationService* GetStorageNotificationService() override;
|
||||
content::SSLHostStateDelegate* GetSSLHostStateDelegate() override;
|
||||
content::PermissionControllerDelegate* GetPermissionControllerDelegate()
|
||||
override;
|
||||
@@ -278,6 +282,13 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
// Returns true if this context supports print preview.
|
||||
bool IsPrintPreviewSupported() const;
|
||||
|
||||
CefMediaRouterManager* GetMediaRouterManager();
|
||||
|
||||
// Returns the BrowserContext, or nullptr if the BrowserContext has already
|
||||
// been destroyed.
|
||||
using Getter = base::RepeatingCallback<CefBrowserContext*()>;
|
||||
Getter getter() const { return getter_; }
|
||||
|
||||
private:
|
||||
// Allow deletion via std::unique_ptr().
|
||||
friend std::default_delete<CefBrowserContext>;
|
||||
@@ -297,7 +308,7 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
std::unique_ptr<CefDownloadManagerDelegate> download_manager_delegate_;
|
||||
std::unique_ptr<CefSSLHostStateDelegate> ssl_host_state_delegate_;
|
||||
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;
|
||||
std::unique_ptr<visitedlink::VisitedLinkMaster> visitedlink_master_;
|
||||
std::unique_ptr<visitedlink::VisitedLinkWriter> visitedlink_master_;
|
||||
// |visitedlink_listener_| is owned by visitedlink_master_.
|
||||
CefVisitedLinkListener* visitedlink_listener_;
|
||||
bool should_persist_session_cookies_ = false;
|
||||
@@ -314,6 +325,8 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
|
||||
std::unique_ptr<DownloadPrefs> download_prefs_;
|
||||
|
||||
std::unique_ptr<CefMediaRouterManager> media_router_manager_;
|
||||
|
||||
// Map IDs to CefRequestContextHandler objects.
|
||||
CefRequestContextHandlerMap handler_map_;
|
||||
|
||||
@@ -337,6 +350,9 @@ class CefBrowserContext : public ChromeProfileStub,
|
||||
typedef std::set<int> NodeIdSet;
|
||||
NodeIdSet node_id_set_;
|
||||
|
||||
Getter getter_;
|
||||
base::WeakPtrFactory<CefBrowserContext> weak_ptr_factory_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserContext);
|
||||
};
|
||||
|
||||
|
@@ -381,7 +381,8 @@ CefRefPtr<CefBrowserHostImpl> CefBrowserHostImpl::Create(
|
||||
create_params.extension_host_type);
|
||||
} else if (!create_params.url.is_empty()) {
|
||||
browser->LoadMainFrameURL(create_params.url.spec(), content::Referrer(),
|
||||
ui::PAGE_TRANSITION_TYPED, std::string());
|
||||
CefFrameHostImpl::kPageTransitionExplicit,
|
||||
std::string());
|
||||
}
|
||||
|
||||
return browser.get();
|
||||
@@ -591,7 +592,7 @@ void CefBrowserHostImpl::CloseBrowser(bool force_close) {
|
||||
}
|
||||
|
||||
content::WebContents* contents = web_contents();
|
||||
if (contents && contents->NeedToFireBeforeUnload()) {
|
||||
if (contents && contents->NeedToFireBeforeUnloadOrUnload()) {
|
||||
// Will result in a call to BeforeUnloadFired() and, if the close isn't
|
||||
// canceled, CloseContents().
|
||||
contents->DispatchBeforeUnload(false /* auto_cancel */);
|
||||
@@ -763,8 +764,9 @@ void CefBrowserHostImpl::DownloadImage(
|
||||
return;
|
||||
|
||||
web_contents()->DownloadImage(
|
||||
gurl, is_favicon, max_image_size * gfx::ImageSkia::GetMaxSupportedScale(),
|
||||
bypass_cache, base::BindOnce(OnDownloadImage, max_image_size, callback));
|
||||
gurl, is_favicon, max_image_size,
|
||||
max_image_size * gfx::ImageSkia::GetMaxSupportedScale(), bypass_cache,
|
||||
base::BindOnce(OnDownloadImage, max_image_size, callback));
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::Print() {
|
||||
@@ -927,7 +929,7 @@ void CefBrowserHostImpl::GetNavigationEntries(
|
||||
CefRefPtr<CefNavigationEntryImpl> entry =
|
||||
new CefNavigationEntryImpl(controller.GetEntryAtIndex(current));
|
||||
visitor->Visit(entry.get(), true, current, total);
|
||||
entry->Detach(NULL);
|
||||
entry->Detach(nullptr);
|
||||
} else {
|
||||
// Visit all entries.
|
||||
bool cont = true;
|
||||
@@ -935,7 +937,7 @@ void CefBrowserHostImpl::GetNavigationEntries(
|
||||
CefRefPtr<CefNavigationEntryImpl> entry =
|
||||
new CefNavigationEntryImpl(controller.GetEntryAtIndex(i));
|
||||
cont = visitor->Visit(entry.get(), (i == current), i, total);
|
||||
entry->Detach(NULL);
|
||||
entry->Detach(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1077,7 +1079,7 @@ void CefBrowserHostImpl::WasResized() {
|
||||
if (!web_contents() || !platform_delegate_)
|
||||
return;
|
||||
|
||||
platform_delegate_->SynchronizeVisualProperties();
|
||||
platform_delegate_->WasResized();
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::WasHidden(bool hidden) {
|
||||
@@ -1163,11 +1165,7 @@ void CefBrowserHostImpl::SendKeyEvent(const CefKeyEvent& event) {
|
||||
if (!web_contents() || !platform_delegate_)
|
||||
return;
|
||||
|
||||
content::NativeWebKeyboardEvent web_event(blink::WebInputEvent::kUndefined,
|
||||
blink::WebInputEvent::kNoModifiers,
|
||||
ui::EventTimeForNow());
|
||||
platform_delegate_->TranslateKeyEvent(web_event, event);
|
||||
platform_delegate_->SendKeyEvent(web_event);
|
||||
platform_delegate_->SendKeyEvent(event);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::SendMouseClickEvent(const CefMouseEvent& event,
|
||||
@@ -1184,10 +1182,7 @@ void CefBrowserHostImpl::SendMouseClickEvent(const CefMouseEvent& event,
|
||||
if (!web_contents() || !platform_delegate_)
|
||||
return;
|
||||
|
||||
blink::WebMouseEvent web_event;
|
||||
platform_delegate_->TranslateClickEvent(web_event, event, type, mouseUp,
|
||||
clickCount);
|
||||
platform_delegate_->SendMouseEvent(web_event);
|
||||
platform_delegate_->SendMouseClickEvent(event, type, mouseUp, clickCount);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::SendMouseMoveEvent(const CefMouseEvent& event,
|
||||
@@ -1202,9 +1197,7 @@ void CefBrowserHostImpl::SendMouseMoveEvent(const CefMouseEvent& event,
|
||||
if (!web_contents() || !platform_delegate_)
|
||||
return;
|
||||
|
||||
blink::WebMouseEvent web_event;
|
||||
platform_delegate_->TranslateMoveEvent(web_event, event, mouseLeave);
|
||||
platform_delegate_->SendMouseEvent(web_event);
|
||||
platform_delegate_->SendMouseMoveEvent(event, mouseLeave);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event,
|
||||
@@ -1225,9 +1218,7 @@ void CefBrowserHostImpl::SendMouseWheelEvent(const CefMouseEvent& event,
|
||||
if (!web_contents() || !platform_delegate_)
|
||||
return;
|
||||
|
||||
blink::WebMouseWheelEvent web_event;
|
||||
platform_delegate_->TranslateWheelEvent(web_event, event, deltaX, deltaY);
|
||||
platform_delegate_->SendMouseWheelEvent(web_event);
|
||||
platform_delegate_->SendMouseWheelEvent(event, deltaX, deltaY);
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::SendFocusEvent(bool setFocus) {
|
||||
@@ -1554,19 +1545,19 @@ void CefBrowserHostImpl::DestroyBrowser() {
|
||||
// Disassociate the platform delegate from this browser.
|
||||
platform_delegate_->BrowserDestroyed(this);
|
||||
|
||||
registrar_.reset(NULL);
|
||||
content::WebContentsObserver::Observe(NULL);
|
||||
registrar_.reset(nullptr);
|
||||
content::WebContentsObserver::Observe(nullptr);
|
||||
if (owned_web_contents_)
|
||||
owned_web_contents_.reset(NULL);
|
||||
owned_web_contents_.reset(nullptr);
|
||||
|
||||
// Delete objects created by the platform delegate that may be referenced by
|
||||
// the WebContents.
|
||||
file_dialog_manager_.reset(NULL);
|
||||
javascript_dialog_manager_.reset(NULL);
|
||||
menu_manager_.reset(NULL);
|
||||
file_dialog_manager_.reset(nullptr);
|
||||
javascript_dialog_manager_.reset(nullptr);
|
||||
menu_manager_.reset(nullptr);
|
||||
|
||||
// Delete the platform delegate.
|
||||
platform_delegate_.reset(NULL);
|
||||
platform_delegate_.reset(nullptr);
|
||||
|
||||
CefBrowserInfoManager::GetInstance()->RemoveBrowserInfo(browser_info_);
|
||||
browser_info_->SetBrowser(nullptr);
|
||||
@@ -1650,30 +1641,6 @@ void CefBrowserHostImpl::LoadMainFrameURL(const std::string& url,
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnFrameFocused(CefRefPtr<CefFrameHostImpl> frame) {
|
||||
DCHECK(frame);
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> previous_frame;
|
||||
{
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
previous_frame = focused_frame_;
|
||||
if (frame->IsMain())
|
||||
focused_frame_ = nullptr;
|
||||
else
|
||||
focused_frame_ = frame;
|
||||
}
|
||||
|
||||
if (!previous_frame) {
|
||||
// The main frame is focused by default.
|
||||
previous_frame = browser_info_->GetMainFrame();
|
||||
}
|
||||
|
||||
if (previous_frame->GetIdentifier() != frame->GetIdentifier()) {
|
||||
previous_frame->SetFocused(false);
|
||||
frame->SetFocused(true);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnDidFinishLoad(CefRefPtr<CefFrameHostImpl> frame,
|
||||
const GURL& validated_url,
|
||||
int http_status_code) {
|
||||
@@ -1741,9 +1708,9 @@ void CefBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
|
||||
|
||||
void CefBrowserHostImpl::RunFileChooser(
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback) {
|
||||
CefFileDialogRunner::RunFileChooserCallback callback) {
|
||||
EnsureFileDialogManager();
|
||||
file_dialog_manager_->RunFileChooser(params, callback);
|
||||
file_dialog_manager_->RunFileChooser(params, std::move(callback));
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::EmbedsFullscreenWidget() {
|
||||
@@ -1755,7 +1722,7 @@ bool CefBrowserHostImpl::EmbedsFullscreenWidget() {
|
||||
void CefBrowserHostImpl::EnterFullscreenModeForTab(
|
||||
content::WebContents* web_contents,
|
||||
const GURL& origin,
|
||||
const blink::WebFullscreenOptions& options) {
|
||||
const blink::mojom::FullscreenOptions& options) {
|
||||
OnFullscreenModeChange(true);
|
||||
}
|
||||
|
||||
@@ -1769,10 +1736,10 @@ bool CefBrowserHostImpl::IsFullscreenForTabOrPending(
|
||||
return is_fullscreen_;
|
||||
}
|
||||
|
||||
blink::WebDisplayMode CefBrowserHostImpl::GetDisplayMode(
|
||||
blink::mojom::DisplayMode CefBrowserHostImpl::GetDisplayMode(
|
||||
const content::WebContents* web_contents) {
|
||||
return is_fullscreen_ ? blink::kWebDisplayModeFullscreen
|
||||
: blink::kWebDisplayModeBrowser;
|
||||
return is_fullscreen_ ? blink::mojom::DisplayMode::kFullscreen
|
||||
: blink::mojom::DisplayMode::kBrowser;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::FindReply(content::WebContents* web_contents,
|
||||
@@ -2119,8 +2086,7 @@ void CefBrowserHostImpl::LoadingStateChanged(content::WebContents* source,
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::LoadProgressChanged(content::WebContents* source,
|
||||
double progress) {
|
||||
void CefBrowserHostImpl::LoadProgressChanged(double progress) {
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefDisplayHandler> handler = client_->GetDisplayHandler();
|
||||
if (handler.get()) {
|
||||
@@ -2501,9 +2467,9 @@ bool CefBrowserHostImpl::CheckMediaAccessPermission(
|
||||
return command_line->HasSwitch(switches::kEnableMediaStream);
|
||||
}
|
||||
|
||||
bool CefBrowserHostImpl::IsNeverVisible(content::WebContents* web_contents) {
|
||||
bool CefBrowserHostImpl::IsNeverComposited(content::WebContents* web_contents) {
|
||||
if (extension_host_)
|
||||
return extension_host_->IsNeverVisible(web_contents);
|
||||
return extension_host_->IsNeverComposited(web_contents);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2565,6 +2531,13 @@ void CefBrowserHostImpl::RenderViewCreated(
|
||||
RenderFrameCreated(render_view_host->GetMainFrame());
|
||||
|
||||
platform_delegate_->RenderViewCreated(render_view_host);
|
||||
|
||||
// Make sure the background color is set on the WebView and the Widget.
|
||||
render_view_host->OnWebkitPreferencesChanged();
|
||||
if (render_view_host->GetWidget()->GetView()) {
|
||||
render_view_host->GetWidget()->GetView()->SetBackgroundColor(
|
||||
GetBackgroundColor());
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::RenderViewDeleted(
|
||||
@@ -2621,8 +2594,18 @@ void CefBrowserHostImpl::DidFinishNavigation(
|
||||
const GURL& url =
|
||||
(error_code == net::OK ? navigation_handle->GetURL() : GURL());
|
||||
|
||||
// May return NULL when starting a new navigation if the previous navigation
|
||||
// caused the renderer process to crash during load.
|
||||
CefRefPtr<CefFrameHostImpl> frame = browser_info_->GetFrameForFrameTreeNode(
|
||||
navigation_handle->GetFrameTreeNodeId());
|
||||
if (!frame) {
|
||||
if (is_main_frame) {
|
||||
frame = browser_info_->GetMainFrame();
|
||||
} else {
|
||||
frame =
|
||||
browser_info_->CreateTempSubFrame(CefFrameHostImpl::kInvalidFrameId);
|
||||
}
|
||||
}
|
||||
frame->RefreshAttributes();
|
||||
|
||||
if (error_code == net::OK) {
|
||||
@@ -2675,8 +2658,7 @@ void CefBrowserHostImpl::DocumentAvailableInMainFrame() {
|
||||
void CefBrowserHostImpl::DidFailLoad(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url,
|
||||
int error_code,
|
||||
const base::string16& error_description) {
|
||||
int error_code) {
|
||||
// The navigation failed after commit. OnLoadStart was called so we also call
|
||||
// OnLoadEnd.
|
||||
auto frame = browser_info_->GetFrameForHost(render_frame_host);
|
||||
@@ -2741,6 +2723,34 @@ bool CefBrowserHostImpl::OnMessageReceived(
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::OnFrameFocused(
|
||||
content::RenderFrameHost* render_frame_host) {
|
||||
CefRefPtr<CefFrameHostImpl> frame =
|
||||
static_cast<CefFrameHostImpl*>(GetFrameForHost(render_frame_host).get());
|
||||
if (!frame || frame->IsFocused())
|
||||
return;
|
||||
|
||||
CefRefPtr<CefFrameHostImpl> previous_frame;
|
||||
{
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
previous_frame = focused_frame_;
|
||||
if (frame->IsMain())
|
||||
focused_frame_ = nullptr;
|
||||
else
|
||||
focused_frame_ = frame;
|
||||
}
|
||||
|
||||
if (!previous_frame) {
|
||||
// The main frame is focused by default.
|
||||
previous_frame = browser_info_->GetMainFrame();
|
||||
}
|
||||
|
||||
if (previous_frame->GetIdentifier() != frame->GetIdentifier()) {
|
||||
previous_frame->SetFocused(false);
|
||||
frame->SetFocused(true);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::AccessibilityEventReceived(
|
||||
const content::AXEventNotificationDetails& content_event_bundle) {
|
||||
// Only needed in windowless mode.
|
||||
@@ -2869,7 +2879,7 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
||||
is_in_onsetfocus_(false),
|
||||
focus_on_editable_field_(false),
|
||||
mouse_cursor_change_disabled_(false),
|
||||
devtools_frontend_(NULL),
|
||||
devtools_frontend_(nullptr),
|
||||
extension_(extension) {
|
||||
if (opener.get() && !platform_delegate_->IsViewsHosted()) {
|
||||
// GetOpenerWindowHandle() only returns a value for non-views-hosted
|
||||
@@ -3082,7 +3092,7 @@ void CefBrowserHostImpl::OnTitleChange(const base::string16& title) {
|
||||
|
||||
void CefBrowserHostImpl::OnDevToolsWebContentsDestroyed() {
|
||||
devtools_observer_.reset();
|
||||
devtools_frontend_ = NULL;
|
||||
devtools_frontend_ = nullptr;
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::EnsureFileDialogManager() {
|
||||
|
@@ -313,7 +313,6 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
const std::string& extra_headers);
|
||||
|
||||
// Called from CefFrameHostImpl.
|
||||
void OnFrameFocused(CefRefPtr<CefFrameHostImpl> frame);
|
||||
void OnDidFinishLoad(CefRefPtr<CefFrameHostImpl> frame,
|
||||
const GURL& validated_url,
|
||||
int http_status_code);
|
||||
@@ -352,9 +351,8 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
// Run the file chooser dialog specified by |params|. Only a single dialog may
|
||||
// be pending at any given time. |callback| will be executed asynchronously
|
||||
// after the dialog is dismissed or if another dialog is already pending.
|
||||
void RunFileChooser(
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback);
|
||||
void RunFileChooser(const CefFileDialogRunner::FileChooserParams& params,
|
||||
CefFileDialogRunner::RunFileChooserCallback callback);
|
||||
|
||||
bool HandleContextMenu(content::WebContents* web_contents,
|
||||
const content::ContextMenuParams& params);
|
||||
@@ -386,8 +384,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
bool* was_blocked) override;
|
||||
void LoadingStateChanged(content::WebContents* source,
|
||||
bool to_different_document) override;
|
||||
void LoadProgressChanged(content::WebContents* source,
|
||||
double progress) override;
|
||||
void LoadProgressChanged(double progress) override;
|
||||
void CloseContents(content::WebContents* source) override;
|
||||
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
|
||||
bool DidAddMessageToConsole(content::WebContents* source,
|
||||
@@ -437,11 +434,11 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void EnterFullscreenModeForTab(
|
||||
content::WebContents* web_contents,
|
||||
const GURL& origin,
|
||||
const blink::WebFullscreenOptions& options) override;
|
||||
const blink::mojom::FullscreenOptions& options) override;
|
||||
void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
|
||||
bool IsFullscreenForTabOrPending(
|
||||
const content::WebContents* web_contents) override;
|
||||
blink::WebDisplayMode GetDisplayMode(
|
||||
blink::mojom::DisplayMode GetDisplayMode(
|
||||
const content::WebContents* web_contents) override;
|
||||
void FindReply(content::WebContents* web_contents,
|
||||
int request_id,
|
||||
@@ -460,7 +457,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
|
||||
const GURL& security_origin,
|
||||
blink::mojom::MediaStreamType type) override;
|
||||
bool IsNeverVisible(content::WebContents* web_contents) override;
|
||||
bool IsNeverComposited(content::WebContents* web_contents) override;
|
||||
content::PictureInPictureResult EnterPictureInPicture(
|
||||
content::WebContents* web_contents,
|
||||
const viz::SurfaceId& surface_id,
|
||||
@@ -483,8 +480,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
void DocumentAvailableInMainFrame() override;
|
||||
void DidFailLoad(content::RenderFrameHost* render_frame_host,
|
||||
const GURL& validated_url,
|
||||
int error_code,
|
||||
const base::string16& error_description) override;
|
||||
int error_code) override;
|
||||
void TitleWasSet(content::NavigationEntry* entry) override;
|
||||
void PluginCrashed(const base::FilePath& plugin_path,
|
||||
base::ProcessId plugin_pid) override;
|
||||
@@ -493,6 +489,7 @@ class CefBrowserHostImpl : public CefBrowserHost,
|
||||
bool OnMessageReceived(const IPC::Message& message) override;
|
||||
bool OnMessageReceived(const IPC::Message& message,
|
||||
content::RenderFrameHost* render_frame_host) override;
|
||||
void OnFrameFocused(content::RenderFrameHost* render_frame_host) override;
|
||||
void AccessibilityEventReceived(
|
||||
const content::AXEventNotificationDetails& content_event_bundle) override;
|
||||
void AccessibilityLocationChangesReceived(
|
||||
|
@@ -11,9 +11,11 @@
|
||||
#include "libcef/browser/extensions/browser_extensions_util.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/common/cef_messages.h"
|
||||
#include "libcef/common/cef_switches.h"
|
||||
#include "libcef/common/extensions/extensions_util.h"
|
||||
#include "libcef/common/values_impl.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/logging.h"
|
||||
#include "content/common/view_messages.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
@@ -23,6 +25,9 @@
|
||||
|
||||
namespace {
|
||||
|
||||
// Timeout delay for new browser info responses.
|
||||
const int64_t kNewBrowserInfoResponseTimeoutMs = 2000;
|
||||
|
||||
void TranslatePopupFeatures(const blink::mojom::WindowFeatures& webKitFeatures,
|
||||
CefPopupFeatures& features) {
|
||||
features.x = static_cast<int>(webKitFeatures.x);
|
||||
@@ -44,7 +49,7 @@ CefBrowserInfoManager* g_info_manager = nullptr;
|
||||
|
||||
} // namespace
|
||||
|
||||
CefBrowserInfoManager::CefBrowserInfoManager() : next_browser_id_(0) {
|
||||
CefBrowserInfoManager::CefBrowserInfoManager() {
|
||||
DCHECK(!g_info_manager);
|
||||
g_info_manager = this;
|
||||
}
|
||||
@@ -86,10 +91,11 @@ scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::CreatePopupBrowserInfo(
|
||||
new CefBrowserInfo(++next_browser_id_, true, is_windowless, extra_info);
|
||||
browser_info_list_.push_back(browser_info);
|
||||
|
||||
// Continue any pending NewBrowserInfo requests.
|
||||
// Continue any pending NewBrowserInfo request.
|
||||
auto it = pending_new_browser_info_map_.find(frame_id);
|
||||
if (it != pending_new_browser_info_map_.end()) {
|
||||
SendNewBrowserInfoResponse(render_process_id, browser_info, false,
|
||||
SendNewBrowserInfoResponse(render_process_id, browser_info,
|
||||
false /* is_guest_view */,
|
||||
it->second->reply_msg);
|
||||
pending_new_browser_info_map_.erase(it);
|
||||
}
|
||||
@@ -139,7 +145,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
std::unique_ptr<CefWindowInfo> window_info(new CefWindowInfo);
|
||||
|
||||
#if defined(OS_WIN)
|
||||
window_info->SetAsPopup(NULL, CefString());
|
||||
window_info->SetAsPopup(nullptr, CefString());
|
||||
#endif
|
||||
|
||||
auto pending_popup = std::make_unique<CefBrowserInfoManager::PendingPopup>();
|
||||
@@ -287,13 +293,27 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(int render_process_id,
|
||||
DCHECK(pending_new_browser_info_map_.find(frame_id) ==
|
||||
pending_new_browser_info_map_.end());
|
||||
|
||||
const int timeout_id = ++next_timeout_id_;
|
||||
|
||||
// Queue the request.
|
||||
std::unique_ptr<PendingNewBrowserInfo> pending(new PendingNewBrowserInfo());
|
||||
pending->render_process_id = render_process_id;
|
||||
pending->render_routing_id = render_routing_id;
|
||||
pending->timeout_id = timeout_id;
|
||||
pending->reply_msg = reply_msg;
|
||||
pending_new_browser_info_map_.insert(
|
||||
std::make_pair(frame_id, std::move(pending)));
|
||||
|
||||
// Register a timeout for the pending response so that the renderer process
|
||||
// doesn't hang forever.
|
||||
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kDisableNewBrowserInfoTimeout)) {
|
||||
CEF_POST_DELAYED_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefBrowserInfoManager::TimeoutNewBrowserInfoResponse,
|
||||
frame_id, timeout_id),
|
||||
kNewBrowserInfoResponseTimeoutMs);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserInfoManager::RemoveBrowserInfo(
|
||||
@@ -498,19 +518,52 @@ void CefBrowserInfoManager::SendNewBrowserInfoResponse(
|
||||
}
|
||||
|
||||
CefProcessHostMsg_GetNewBrowserInfo_Params params;
|
||||
params.browser_id = browser_info->browser_id();
|
||||
params.is_windowless = browser_info->is_windowless();
|
||||
params.is_popup = browser_info->is_popup();
|
||||
params.is_guest_view = is_guest_view;
|
||||
|
||||
auto extra_info = browser_info->extra_info();
|
||||
if (extra_info) {
|
||||
auto extra_info_impl =
|
||||
static_cast<CefDictionaryValueImpl*>(extra_info.get());
|
||||
auto extra_info_value = extra_info_impl->CopyValue();
|
||||
extra_info_value->Swap(¶ms.extra_info);
|
||||
if (browser_info) {
|
||||
params.browser_id = browser_info->browser_id();
|
||||
params.is_windowless = browser_info->is_windowless();
|
||||
params.is_popup = browser_info->is_popup();
|
||||
|
||||
auto extra_info = browser_info->extra_info();
|
||||
if (extra_info) {
|
||||
auto extra_info_impl =
|
||||
static_cast<CefDictionaryValueImpl*>(extra_info.get());
|
||||
auto extra_info_value = extra_info_impl->CopyValue();
|
||||
extra_info_value->Swap(¶ms.extra_info);
|
||||
}
|
||||
} else {
|
||||
// The new browser info response has timed out.
|
||||
params.browser_id = -1;
|
||||
}
|
||||
|
||||
CefProcessHostMsg_GetNewBrowserInfo::WriteReplyParams(reply_msg, params);
|
||||
host->Send(reply_msg);
|
||||
}
|
||||
|
||||
// static
|
||||
void CefBrowserInfoManager::TimeoutNewBrowserInfoResponse(int64_t frame_id,
|
||||
int timeout_id) {
|
||||
if (!g_info_manager)
|
||||
return;
|
||||
|
||||
base::AutoLock lock_scope(g_info_manager->browser_info_lock_);
|
||||
|
||||
// Continue the NewBrowserInfo request if it's still pending.
|
||||
auto it = g_info_manager->pending_new_browser_info_map_.find(frame_id);
|
||||
if (it != g_info_manager->pending_new_browser_info_map_.end()) {
|
||||
const auto& pending_info = it->second;
|
||||
// Don't accidentally timeout a new request for the same frame.
|
||||
if (pending_info->timeout_id != timeout_id)
|
||||
return;
|
||||
|
||||
LOG(ERROR) << "Timeout of new browser info response for frame process id "
|
||||
<< pending_info->render_process_id << " and routing id "
|
||||
<< pending_info->render_routing_id;
|
||||
|
||||
SendNewBrowserInfoResponse(pending_info->render_process_id, nullptr,
|
||||
false /* is_guest_view */,
|
||||
pending_info->reply_msg);
|
||||
g_info_manager->pending_new_browser_info_map_.erase(it);
|
||||
}
|
||||
}
|
||||
|
@@ -201,10 +201,14 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
bool is_guest_view,
|
||||
IPC::Message* reply_msg);
|
||||
|
||||
// Time out a response if it's still pending.
|
||||
static void TimeoutNewBrowserInfoResponse(int64_t frame_id, int timeout_id);
|
||||
|
||||
// Pending request for OnGetNewBrowserInfo.
|
||||
struct PendingNewBrowserInfo {
|
||||
int render_process_id;
|
||||
int render_routing_id;
|
||||
int timeout_id;
|
||||
IPC::Message* reply_msg;
|
||||
};
|
||||
|
||||
@@ -213,7 +217,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
// Access to the below members must be protected by |browser_info_lock_|.
|
||||
|
||||
BrowserInfoList browser_info_list_;
|
||||
int next_browser_id_;
|
||||
int next_browser_id_ = 0;
|
||||
|
||||
// Map of frame ID to info.
|
||||
using PendingNewBrowserInfoMap =
|
||||
@@ -224,6 +228,8 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
using PendingPopupList = std::vector<std::unique_ptr<PendingPopup>>;
|
||||
PendingPopupList pending_popup_list_;
|
||||
|
||||
int next_timeout_id_ = 0;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserInfoManager);
|
||||
};
|
||||
|
||||
|
@@ -50,6 +50,8 @@
|
||||
#include "ui/wm/core/wm_state.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "chrome/browser/chrome_browser_main_win.h"
|
||||
#include "components/os_crypt/os_crypt.h"
|
||||
#include "ui/base/cursor/cursor_loader_win.h"
|
||||
#endif
|
||||
#endif // defined(USE_AURA)
|
||||
@@ -71,14 +73,9 @@
|
||||
#include "libcef/browser/printing/print_dialog_linux.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "components/os_crypt/os_crypt.h"
|
||||
#endif
|
||||
|
||||
CefBrowserMainParts::CefBrowserMainParts(
|
||||
const content::MainFunctionParams& parameters)
|
||||
: BrowserMainParts(), devtools_delegate_(NULL) {}
|
||||
: BrowserMainParts(), devtools_delegate_(nullptr) {}
|
||||
|
||||
CefBrowserMainParts::~CefBrowserMainParts() {
|
||||
constrained_window::SetConstrainedWindowViewsClient(nullptr);
|
||||
@@ -122,12 +119,17 @@ void CefBrowserMainParts::PreMainMessageLoopStart() {
|
||||
ui::TouchFactory::SetTouchDeviceListFromCommandLine();
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#if defined(OS_WIN)
|
||||
// Initialize the OSCrypt.
|
||||
PrefService* local_state = g_browser_process->local_state();
|
||||
DCHECK(local_state);
|
||||
OSCrypt::Init(local_state);
|
||||
#endif
|
||||
bool os_crypt_init = OSCrypt::Init(local_state);
|
||||
DCHECK(os_crypt_init);
|
||||
|
||||
// installer_util references strings that are normally compiled into
|
||||
// setup.exe. In Chrome, these strings are in the locale files.
|
||||
ChromeBrowserMainPartsWin::SetupInstallerUtilStrings();
|
||||
#endif // defined(OS_WIN)
|
||||
}
|
||||
|
||||
void CefBrowserMainParts::PostMainMessageLoopStart() {
|
||||
@@ -213,12 +215,12 @@ void CefBrowserMainParts::PostMainMessageLoopRun() {
|
||||
// There should be no additional references to the global CefRequestContext
|
||||
// during shutdown. Did you forget to release a CefBrowser reference?
|
||||
DCHECK(global_request_context_->HasOneRef());
|
||||
global_request_context_ = NULL;
|
||||
global_request_context_ = nullptr;
|
||||
}
|
||||
|
||||
void CefBrowserMainParts::PostDestroyThreads() {
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
extensions::ExtensionsBrowserClient::Set(NULL);
|
||||
extensions::ExtensionsBrowserClient::Set(nullptr);
|
||||
extensions_browser_client_.reset();
|
||||
}
|
||||
|
||||
|
@@ -14,7 +14,7 @@ void CefBrowserMainParts::PlatformInitialize() {
|
||||
HRESULT res;
|
||||
|
||||
// Initialize common controls.
|
||||
res = CoInitialize(NULL);
|
||||
res = CoInitialize(nullptr);
|
||||
DCHECK(SUCCEEDED(res));
|
||||
INITCOMMONCONTROLSEX InitCtrlEx;
|
||||
InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
|
||||
@@ -22,6 +22,6 @@ void CefBrowserMainParts::PlatformInitialize() {
|
||||
InitCommonControlsEx(&InitCtrlEx);
|
||||
|
||||
// Start COM stuff.
|
||||
res = OleInitialize(NULL);
|
||||
res = OleInitialize(nullptr);
|
||||
DCHECK(SUCCEEDED(res));
|
||||
}
|
||||
|
@@ -51,7 +51,7 @@ void CefBrowserMessageFilter::OnGetNewRenderThreadInfo(
|
||||
CefRefPtr<CefListValueImpl> listValuePtr(
|
||||
new CefListValueImpl(¶ms->extra_info, false, false));
|
||||
handler->OnRenderProcessThreadCreated(listValuePtr.get());
|
||||
listValuePtr->Detach(NULL);
|
||||
listValuePtr->Detach(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -14,7 +14,7 @@
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
|
||||
CefBrowserPlatformDelegate::CefBrowserPlatformDelegate() : browser_(nullptr) {}
|
||||
CefBrowserPlatformDelegate::CefBrowserPlatformDelegate() {}
|
||||
|
||||
CefBrowserPlatformDelegate::~CefBrowserPlatformDelegate() {
|
||||
DCHECK(!browser_);
|
||||
@@ -237,32 +237,33 @@ base::RepeatingClosure CefBrowserPlatformDelegate::GetBoundsChangedCallback() {
|
||||
}
|
||||
|
||||
// static
|
||||
int CefBrowserPlatformDelegate::TranslateModifiers(uint32 cef_modifiers) {
|
||||
int webkit_modifiers = 0;
|
||||
int CefBrowserPlatformDelegate::TranslateWebEventModifiers(
|
||||
uint32 cef_modifiers) {
|
||||
int result = 0;
|
||||
// Set modifiers based on key state.
|
||||
if (cef_modifiers & EVENTFLAG_SHIFT_DOWN)
|
||||
webkit_modifiers |= blink::WebInputEvent::kShiftKey;
|
||||
result |= blink::WebInputEvent::kShiftKey;
|
||||
if (cef_modifiers & EVENTFLAG_CONTROL_DOWN)
|
||||
webkit_modifiers |= blink::WebInputEvent::kControlKey;
|
||||
result |= blink::WebInputEvent::kControlKey;
|
||||
if (cef_modifiers & EVENTFLAG_ALT_DOWN)
|
||||
webkit_modifiers |= blink::WebInputEvent::kAltKey;
|
||||
result |= blink::WebInputEvent::kAltKey;
|
||||
if (cef_modifiers & EVENTFLAG_COMMAND_DOWN)
|
||||
webkit_modifiers |= blink::WebInputEvent::kMetaKey;
|
||||
result |= blink::WebInputEvent::kMetaKey;
|
||||
if (cef_modifiers & EVENTFLAG_LEFT_MOUSE_BUTTON)
|
||||
webkit_modifiers |= blink::WebInputEvent::kLeftButtonDown;
|
||||
result |= blink::WebInputEvent::kLeftButtonDown;
|
||||
if (cef_modifiers & EVENTFLAG_MIDDLE_MOUSE_BUTTON)
|
||||
webkit_modifiers |= blink::WebInputEvent::kMiddleButtonDown;
|
||||
result |= blink::WebInputEvent::kMiddleButtonDown;
|
||||
if (cef_modifiers & EVENTFLAG_RIGHT_MOUSE_BUTTON)
|
||||
webkit_modifiers |= blink::WebInputEvent::kRightButtonDown;
|
||||
result |= blink::WebInputEvent::kRightButtonDown;
|
||||
if (cef_modifiers & EVENTFLAG_CAPS_LOCK_ON)
|
||||
webkit_modifiers |= blink::WebInputEvent::kCapsLockOn;
|
||||
result |= blink::WebInputEvent::kCapsLockOn;
|
||||
if (cef_modifiers & EVENTFLAG_NUM_LOCK_ON)
|
||||
webkit_modifiers |= blink::WebInputEvent::kNumLockOn;
|
||||
result |= blink::WebInputEvent::kNumLockOn;
|
||||
if (cef_modifiers & EVENTFLAG_IS_LEFT)
|
||||
webkit_modifiers |= blink::WebInputEvent::kIsLeft;
|
||||
result |= blink::WebInputEvent::kIsLeft;
|
||||
if (cef_modifiers & EVENTFLAG_IS_RIGHT)
|
||||
webkit_modifiers |= blink::WebInputEvent::kIsRight;
|
||||
result |= blink::WebInputEvent::kIsRight;
|
||||
if (cef_modifiers & EVENTFLAG_IS_KEY_PAD)
|
||||
webkit_modifiers |= blink::WebInputEvent::kIsKeyPad;
|
||||
return webkit_modifiers;
|
||||
result |= blink::WebInputEvent::kIsKeyPad;
|
||||
return result;
|
||||
}
|
||||
|
@@ -145,14 +145,19 @@ class CefBrowserPlatformDelegate {
|
||||
virtual bool CanUseExternalBeginFrame() const = 0;
|
||||
|
||||
// Notify the window that it was resized.
|
||||
virtual void SynchronizeVisualProperties() = 0;
|
||||
virtual void WasResized() = 0;
|
||||
|
||||
// Send input events.
|
||||
virtual void SendKeyEvent(const content::NativeWebKeyboardEvent& event) = 0;
|
||||
virtual void SendMouseEvent(const blink::WebMouseEvent& event) = 0;
|
||||
virtual void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) = 0;
|
||||
|
||||
// Send touch events.
|
||||
virtual void SendKeyEvent(const CefKeyEvent& event) = 0;
|
||||
virtual void SendMouseClickEvent(const CefMouseEvent& event,
|
||||
CefBrowserHost::MouseButtonType type,
|
||||
bool mouseUp,
|
||||
int clickCount) = 0;
|
||||
virtual void SendMouseMoveEvent(const CefMouseEvent& event,
|
||||
bool mouseLeave) = 0;
|
||||
virtual void SendMouseWheelEvent(const CefMouseEvent& event,
|
||||
int deltaX,
|
||||
int deltaY) = 0;
|
||||
virtual void SendTouchEvent(const CefTouchEvent& event) = 0;
|
||||
|
||||
// Send focus event. The browser's WebContents may be NULL when this method is
|
||||
@@ -187,22 +192,6 @@ class CefBrowserPlatformDelegate {
|
||||
// Invoke platform specific handling for the external protocol.
|
||||
static void HandleExternalProtocol(const GURL& url);
|
||||
|
||||
// Translate CEF events to Chromium/Blink events.
|
||||
virtual void TranslateKeyEvent(content::NativeWebKeyboardEvent& result,
|
||||
const CefKeyEvent& key_event) const = 0;
|
||||
virtual void TranslateClickEvent(blink::WebMouseEvent& result,
|
||||
const CefMouseEvent& mouse_event,
|
||||
CefBrowserHost::MouseButtonType type,
|
||||
bool mouseUp,
|
||||
int clickCount) const = 0;
|
||||
virtual void TranslateMoveEvent(blink::WebMouseEvent& result,
|
||||
const CefMouseEvent& mouse_event,
|
||||
bool mouseLeave) const = 0;
|
||||
virtual void TranslateWheelEvent(blink::WebMouseWheelEvent& result,
|
||||
const CefMouseEvent& mouse_event,
|
||||
int deltaX,
|
||||
int deltaY) const = 0;
|
||||
|
||||
// Returns the OS event handle, if any, associated with |event|.
|
||||
virtual CefEventHandle GetEventHandle(
|
||||
const content::NativeWebKeyboardEvent& event) const = 0;
|
||||
@@ -287,9 +276,9 @@ class CefBrowserPlatformDelegate {
|
||||
|
||||
base::RepeatingClosure GetBoundsChangedCallback();
|
||||
|
||||
static int TranslateModifiers(uint32 cef_modifiers);
|
||||
static int TranslateWebEventModifiers(uint32 cef_modifiers);
|
||||
|
||||
CefBrowserHostImpl* browser_; // Not owned by this object.
|
||||
CefBrowserHostImpl* browser_ = nullptr; // Not owned by this object.
|
||||
|
||||
private:
|
||||
// Used for the print preview dialog.
|
||||
|
@@ -72,8 +72,8 @@ void ChromeBrowserProcessStub::Shutdown() {
|
||||
// this might cause a nested message loop to run, and we don't want pending
|
||||
// tasks to run once teardown has started.
|
||||
print_job_manager_->Shutdown();
|
||||
print_job_manager_.reset(NULL);
|
||||
print_preview_dialog_controller_ = NULL;
|
||||
print_job_manager_.reset(nullptr);
|
||||
print_preview_dialog_controller_ = nullptr;
|
||||
|
||||
profile_manager_.reset();
|
||||
event_router_forwarder_ = nullptr;
|
||||
@@ -119,17 +119,17 @@ void ChromeBrowserProcessStub::FlushLocalStateAndReply(
|
||||
metrics_services_manager::MetricsServicesManager*
|
||||
ChromeBrowserProcessStub::GetMetricsServicesManager() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
metrics::MetricsService* ChromeBrowserProcessStub::metrics_service() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rappor::RapporServiceImpl* ChromeBrowserProcessStub::rappor_service() {
|
||||
// Called from PluginInfoHostImpl::ReportMetrics.
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SystemNetworkContextManager*
|
||||
@@ -141,12 +141,12 @@ ChromeBrowserProcessStub::system_network_context_manager() {
|
||||
network::NetworkQualityTracker*
|
||||
ChromeBrowserProcessStub::network_quality_tracker() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WatchDogThread* ChromeBrowserProcessStub::watchdog_thread() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ProfileManager* ChromeBrowserProcessStub::profile_manager() {
|
||||
@@ -157,13 +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.
|
||||
local_state_ = browser_prefs::CreatePrefService(
|
||||
nullptr, cache_path, !!settings.persist_user_preferences);
|
||||
// Always persist preferences for this PrefService if possible because it
|
||||
// contains the cookie encryption key on Windows.
|
||||
local_state_ =
|
||||
browser_prefs::CreatePrefService(nullptr /* profile */, root_cache_path,
|
||||
true /* persist_user_preferences */);
|
||||
}
|
||||
return local_state_.get();
|
||||
}
|
||||
@@ -171,17 +175,17 @@ PrefService* ChromeBrowserProcessStub::local_state() {
|
||||
scoped_refptr<network::SharedURLLoaderFactory>
|
||||
ChromeBrowserProcessStub::shared_url_loader_factory() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
variations::VariationsService* ChromeBrowserProcessStub::variations_service() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BrowserProcessPlatformPart* ChromeBrowserProcessStub::platform_part() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
extensions::EventRouterForwarder*
|
||||
@@ -192,13 +196,13 @@ ChromeBrowserProcessStub::extension_event_router_forwarder() {
|
||||
|
||||
NotificationUIManager* ChromeBrowserProcessStub::notification_ui_manager() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NotificationPlatformBridge*
|
||||
ChromeBrowserProcessStub::notification_platform_bridge() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
policy::ChromeBrowserPolicyConnector*
|
||||
@@ -216,12 +220,12 @@ policy::PolicyService* ChromeBrowserProcessStub::policy_service() {
|
||||
|
||||
IconManager* ChromeBrowserProcessStub::icon_manager() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GpuModeManager* ChromeBrowserProcessStub::gpu_mode_manager() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ChromeBrowserProcessStub::CreateDevToolsProtocolHandler() {
|
||||
@@ -263,7 +267,7 @@ ChromeBrowserProcessStub::background_printing_manager() {
|
||||
IntranetRedirectDetector*
|
||||
ChromeBrowserProcessStub::intranet_redirect_detector() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const std::string& ChromeBrowserProcessStub::GetApplicationLocale() {
|
||||
@@ -277,17 +281,17 @@ void ChromeBrowserProcessStub::SetApplicationLocale(const std::string& locale) {
|
||||
|
||||
DownloadStatusUpdater* ChromeBrowserProcessStub::download_status_updater() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DownloadRequestLimiter* ChromeBrowserProcessStub::download_request_limiter() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BackgroundModeManager* ChromeBrowserProcessStub::background_mode_manager() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ChromeBrowserProcessStub::set_background_mode_manager_for_test(
|
||||
@@ -297,35 +301,35 @@ void ChromeBrowserProcessStub::set_background_mode_manager_for_test(
|
||||
|
||||
StatusTray* ChromeBrowserProcessStub::status_tray() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
safe_browsing::SafeBrowsingService*
|
||||
ChromeBrowserProcessStub::safe_browsing_service() {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
safe_browsing::ClientSideDetectionService*
|
||||
ChromeBrowserProcessStub::safe_browsing_detection_service() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
subresource_filter::RulesetService*
|
||||
ChromeBrowserProcessStub::subresource_filter_ruleset_service() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
optimization_guide::OptimizationGuideService*
|
||||
ChromeBrowserProcessStub::optimization_guide_service() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
StartupData* ChromeBrowserProcessStub::startup_data() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
|
||||
@@ -335,44 +339,38 @@ void ChromeBrowserProcessStub::StartAutoupdateTimer() {}
|
||||
component_updater::ComponentUpdateService*
|
||||
ChromeBrowserProcessStub::component_updater() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
MediaFileSystemRegistry*
|
||||
ChromeBrowserProcessStub::media_file_system_registry() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WebRtcLogUploader* ChromeBrowserProcessStub::webrtc_log_uploader() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
network_time::NetworkTimeTracker*
|
||||
ChromeBrowserProcessStub::network_time_tracker() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gcm::GCMDriver* ChromeBrowserProcessStub::gcm_driver() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
shell_integration::DefaultWebClientState
|
||||
ChromeBrowserProcessStub::CachedDefaultWebClientState() {
|
||||
NOTREACHED();
|
||||
return shell_integration::UNKNOWN_DEFAULT;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
resource_coordinator::TabManager* ChromeBrowserProcessStub::GetTabManager() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
resource_coordinator::ResourceCoordinatorParts*
|
||||
ChromeBrowserProcessStub::resource_coordinator_parts() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -95,8 +95,6 @@ class ChromeBrowserProcessStub : public BrowserProcess {
|
||||
WebRtcLogUploader* webrtc_log_uploader() override;
|
||||
network_time::NetworkTimeTracker* network_time_tracker() override;
|
||||
gcm::GCMDriver* gcm_driver() override;
|
||||
shell_integration::DefaultWebClientState CachedDefaultWebClientState()
|
||||
override;
|
||||
resource_coordinator::TabManager* GetTabManager() override;
|
||||
resource_coordinator::ResourceCoordinatorParts* resource_coordinator_parts()
|
||||
override;
|
||||
|
@@ -36,7 +36,7 @@ Profile::ProfileType ChromeProfileStub::GetProfileType() const {
|
||||
|
||||
Profile* ChromeProfileStub::GetOffTheRecordProfile() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ChromeProfileStub::DestroyOffTheRecordProfile() {
|
||||
@@ -70,12 +70,12 @@ bool ChromeProfileStub::IsLegacySupervised() const {
|
||||
ExtensionSpecialStoragePolicy*
|
||||
ChromeProfileStub::GetExtensionSpecialStoragePolicy() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PrefService* ChromeProfileStub::GetOffTheRecordPrefs() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool ChromeProfileStub::IsSameProfile(Profile* profile) {
|
||||
|
@@ -39,7 +39,6 @@
|
||||
#include "libcef/common/net/scheme_registration.h"
|
||||
#include "libcef/common/request_impl.h"
|
||||
#include "libcef/common/service_manifests/cef_content_browser_overlay_manifest.h"
|
||||
#include "libcef/common/service_manifests/cef_content_renderer_overlay_manifest.h"
|
||||
|
||||
#include "base/base_switches.h"
|
||||
#include "base/command_line.h"
|
||||
@@ -73,15 +72,14 @@
|
||||
#include "components/spellcheck/common/spellcheck.mojom.h"
|
||||
#include "components/variations/variations_http_header_provider.h"
|
||||
#include "components/version_info/version_info.h"
|
||||
#include "content/browser/frame_host/navigation_handle_impl.h"
|
||||
#include "content/browser/frame_host/render_frame_host_impl.h"
|
||||
#include "content/browser/plugin_service_impl.h"
|
||||
#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"
|
||||
#include "content/public/browser/page_navigator.h"
|
||||
#include "content/public/browser/quota_permission_context.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
@@ -103,11 +101,11 @@
|
||||
#include "extensions/browser/extensions_browser_client.h"
|
||||
#include "extensions/browser/guest_view/extensions_guest_view_message_filter.h"
|
||||
#include "extensions/browser/guest_view/web_view/web_view_guest.h"
|
||||
#include "extensions/browser/io_thread_extension_message_filter.h"
|
||||
#include "extensions/browser/url_loader_factory_manager.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/switches.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
#include "mojo/public/cpp/bindings/strong_associated_binding.h"
|
||||
#include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
|
||||
#include "net/base/auth.h"
|
||||
#include "net/ssl/ssl_cert_request_info.h"
|
||||
#include "ppapi/host/ppapi_host.h"
|
||||
@@ -137,14 +135,19 @@
|
||||
#endif
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
#include "services/audio/public/mojom/constants.mojom.h"
|
||||
#include "net/ssl/client_cert_store_mac.h"
|
||||
#include "services/video_capture/public/mojom/constants.mojom.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "net/ssl/client_cert_store_win.h"
|
||||
#include "sandbox/win/src/sandbox_policy.h"
|
||||
#endif
|
||||
|
||||
#if defined(USE_NSS_CERTS)
|
||||
#include "net/ssl/client_cert_store_nss.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(HAS_SPELLCHECK_PANEL)
|
||||
#include "chrome/browser/spellchecker/spell_check_panel_host_impl.h"
|
||||
#endif
|
||||
@@ -153,18 +156,19 @@ namespace {
|
||||
|
||||
class CefQuotaCallbackImpl : public CefRequestCallback {
|
||||
public:
|
||||
explicit CefQuotaCallbackImpl(
|
||||
const content::QuotaPermissionContext::PermissionCallback& callback)
|
||||
: callback_(callback) {}
|
||||
using CallbackType = content::QuotaPermissionContext::PermissionCallback;
|
||||
|
||||
explicit CefQuotaCallbackImpl(CallbackType callback)
|
||||
: callback_(std::move(callback)) {}
|
||||
|
||||
~CefQuotaCallbackImpl() {
|
||||
if (!callback_.is_null()) {
|
||||
// The callback is still pending. Cancel it now.
|
||||
if (CEF_CURRENTLY_ON_IOT()) {
|
||||
RunNow(callback_, false);
|
||||
RunNow(std::move(callback_), false);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_IOT, base::Bind(&CefQuotaCallbackImpl::RunNow,
|
||||
callback_, false));
|
||||
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefQuotaCallbackImpl::RunNow,
|
||||
std::move(callback_), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -172,31 +176,28 @@ class CefQuotaCallbackImpl : public CefRequestCallback {
|
||||
void Continue(bool allow) override {
|
||||
if (CEF_CURRENTLY_ON_IOT()) {
|
||||
if (!callback_.is_null()) {
|
||||
RunNow(callback_, allow);
|
||||
callback_.Reset();
|
||||
RunNow(std::move(callback_), allow);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::Bind(&CefQuotaCallbackImpl::Continue, this, allow));
|
||||
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefQuotaCallbackImpl::Continue,
|
||||
this, allow));
|
||||
}
|
||||
}
|
||||
|
||||
void Cancel() override { Continue(false); }
|
||||
|
||||
void Disconnect() { callback_.Reset(); }
|
||||
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
|
||||
private:
|
||||
static void RunNow(
|
||||
const content::QuotaPermissionContext::PermissionCallback& callback,
|
||||
bool allow) {
|
||||
static void RunNow(CallbackType callback, bool allow) {
|
||||
CEF_REQUIRE_IOT();
|
||||
callback.Run(
|
||||
std::move(callback).Run(
|
||||
allow ? content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_ALLOW
|
||||
: content::QuotaPermissionContext::
|
||||
QUOTA_PERMISSION_RESPONSE_DISALLOW);
|
||||
}
|
||||
|
||||
content::QuotaPermissionContext::PermissionCallback callback_;
|
||||
CallbackType callback_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefQuotaCallbackImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefQuotaCallbackImpl);
|
||||
@@ -204,21 +205,22 @@ class CefQuotaCallbackImpl : public CefRequestCallback {
|
||||
|
||||
class CefAllowCertificateErrorCallbackImpl : public CefRequestCallback {
|
||||
public:
|
||||
typedef base::Callback<void(content::CertificateRequestResultType)>
|
||||
typedef base::OnceCallback<void(content::CertificateRequestResultType)>
|
||||
CallbackType;
|
||||
|
||||
explicit CefAllowCertificateErrorCallbackImpl(const CallbackType& callback)
|
||||
: callback_(callback) {}
|
||||
explicit CefAllowCertificateErrorCallbackImpl(CallbackType callback)
|
||||
: callback_(std::move(callback)) {}
|
||||
|
||||
~CefAllowCertificateErrorCallbackImpl() {
|
||||
if (!callback_.is_null()) {
|
||||
// The callback is still pending. Cancel it now.
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
RunNow(callback_, false);
|
||||
RunNow(std::move(callback_), false);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefAllowCertificateErrorCallbackImpl::RunNow,
|
||||
callback_, false));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefAllowCertificateErrorCallbackImpl::RunNow,
|
||||
std::move(callback_), false));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -226,8 +228,7 @@ class CefAllowCertificateErrorCallbackImpl : public CefRequestCallback {
|
||||
void Continue(bool allow) override {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!callback_.is_null()) {
|
||||
RunNow(callback_, allow);
|
||||
callback_.Reset();
|
||||
RunNow(std::move(callback_), allow);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
@@ -238,13 +239,14 @@ class CefAllowCertificateErrorCallbackImpl : public CefRequestCallback {
|
||||
|
||||
void Cancel() override { Continue(false); }
|
||||
|
||||
void Disconnect() { callback_.Reset(); }
|
||||
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
|
||||
private:
|
||||
static void RunNow(const CallbackType& callback, bool allow) {
|
||||
static void RunNow(CallbackType callback, bool allow) {
|
||||
CEF_REQUIRE_UIT();
|
||||
callback.Run(allow ? content::CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE
|
||||
: content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL);
|
||||
std::move(callback).Run(
|
||||
allow ? content::CERTIFICATE_REQUEST_RESULT_TYPE_CONTINUE
|
||||
: content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL);
|
||||
}
|
||||
|
||||
CallbackType callback_;
|
||||
@@ -264,7 +266,7 @@ class CefSelectClientCertificateCallbackImpl
|
||||
// If Select has not been called, call it with NULL to continue without any
|
||||
// client certificate.
|
||||
if (delegate_)
|
||||
DoSelect(NULL);
|
||||
DoSelect(nullptr);
|
||||
}
|
||||
|
||||
void Select(CefRefPtr<CefX509Certificate> cert) override {
|
||||
@@ -277,9 +279,10 @@ class CefSelectClientCertificateCallbackImpl
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
RunNow(std::move(delegate_), cert);
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefSelectClientCertificateCallbackImpl::RunNow,
|
||||
base::Passed(std::move(delegate_)), cert));
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefSelectClientCertificateCallbackImpl::RunNow,
|
||||
std::move(delegate_), cert));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,9 +294,9 @@ class CefSelectClientCertificateCallbackImpl
|
||||
if (cert) {
|
||||
CefX509CertificateImpl* certImpl =
|
||||
static_cast<CefX509CertificateImpl*>(cert.get());
|
||||
certImpl->AcquirePrivateKey(
|
||||
base::Bind(&CefSelectClientCertificateCallbackImpl::RunWithPrivateKey,
|
||||
base::Passed(std::move(delegate)), cert));
|
||||
certImpl->AcquirePrivateKey(base::BindOnce(
|
||||
&CefSelectClientCertificateCallbackImpl::RunWithPrivateKey,
|
||||
std::move(delegate), cert));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -329,11 +332,11 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||
// The callback will be dispatched on the IO thread.
|
||||
void RequestQuotaPermission(const content::StorageQuotaParams& params,
|
||||
int render_process_id,
|
||||
const PermissionCallback& callback) override {
|
||||
PermissionCallback callback) override {
|
||||
if (params.storage_type != blink::mojom::StorageType::kPersistent) {
|
||||
// To match Chrome behavior we only support requesting quota with this
|
||||
// interface for Persistent storage type.
|
||||
callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
|
||||
std::move(callback).Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -348,19 +351,22 @@ class CefQuotaPermissionContext : public content::QuotaPermissionContext {
|
||||
CefRefPtr<CefRequestHandler> handler = client->GetRequestHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefQuotaCallbackImpl> callbackImpl(
|
||||
new CefQuotaCallbackImpl(callback));
|
||||
new CefQuotaCallbackImpl(std::move(callback)));
|
||||
handled = handler->OnQuotaRequest(
|
||||
browser.get(), params.origin_url.spec(), params.requested_size,
|
||||
callbackImpl.get());
|
||||
if (!handled)
|
||||
callbackImpl->Disconnect();
|
||||
if (!handled) {
|
||||
// May return nullptr if the client has already executed the
|
||||
// callback.
|
||||
callback = callbackImpl->Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
if (!handled && !callback.is_null()) {
|
||||
// Disallow the request by default.
|
||||
callback.Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
|
||||
std::move(callback).Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -393,7 +399,7 @@ int GetCrashSignalFD(const base::CommandLine& command_line) {
|
||||
|
||||
// Extensions have the same process type as renderers.
|
||||
if (command_line.HasSwitch(extensions::switches::kExtensionProcess)) {
|
||||
static breakpad::CrashHandlerHostLinux* crash_handler = NULL;
|
||||
static breakpad::CrashHandlerHostLinux* crash_handler = nullptr;
|
||||
if (!crash_handler)
|
||||
crash_handler = CreateCrashHandlerHost("extension");
|
||||
return crash_handler->GetDeathSignalSocket();
|
||||
@@ -403,21 +409,21 @@ int GetCrashSignalFD(const base::CommandLine& command_line) {
|
||||
command_line.GetSwitchValueASCII(switches::kProcessType);
|
||||
|
||||
if (process_type == switches::kRendererProcess) {
|
||||
static breakpad::CrashHandlerHostLinux* crash_handler = NULL;
|
||||
static breakpad::CrashHandlerHostLinux* crash_handler = nullptr;
|
||||
if (!crash_handler)
|
||||
crash_handler = CreateCrashHandlerHost(process_type);
|
||||
return crash_handler->GetDeathSignalSocket();
|
||||
}
|
||||
|
||||
if (process_type == switches::kPpapiPluginProcess) {
|
||||
static breakpad::CrashHandlerHostLinux* crash_handler = NULL;
|
||||
static breakpad::CrashHandlerHostLinux* crash_handler = nullptr;
|
||||
if (!crash_handler)
|
||||
crash_handler = CreateCrashHandlerHost(process_type);
|
||||
return crash_handler->GetDeathSignalSocket();
|
||||
}
|
||||
|
||||
if (process_type == switches::kGpuProcess) {
|
||||
static breakpad::CrashHandlerHostLinux* crash_handler = NULL;
|
||||
static breakpad::CrashHandlerHostLinux* crash_handler = nullptr;
|
||||
if (!crash_handler)
|
||||
crash_handler = CreateCrashHandlerHost(process_type);
|
||||
return crash_handler->GetDeathSignalSocket();
|
||||
@@ -486,7 +492,7 @@ bool NavigationOnUIThread(
|
||||
// From chrome/browser/plugins/chrome_content_browser_client_plugins_part.cc.
|
||||
void BindPluginInfoHost(
|
||||
int render_process_id,
|
||||
chrome::mojom::PluginInfoHostAssociatedRequest request) {
|
||||
mojo::PendingAssociatedReceiver<chrome::mojom::PluginInfoHost> receiver) {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
content::RenderProcessHost* host =
|
||||
content::RenderProcessHost::FromID(render_process_id);
|
||||
@@ -494,14 +500,15 @@ void BindPluginInfoHost(
|
||||
return;
|
||||
|
||||
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
|
||||
mojo::MakeStrongAssociatedBinding(
|
||||
mojo::MakeSelfOwnedAssociatedReceiver(
|
||||
std::make_unique<PluginInfoHostImpl>(render_process_id, profile),
|
||||
std::move(request));
|
||||
std::move(receiver));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefContentBrowserClient::CefContentBrowserClient() : browser_main_parts_(NULL) {
|
||||
CefContentBrowserClient::CefContentBrowserClient()
|
||||
: browser_main_parts_(nullptr) {
|
||||
plugin_service_filter_.reset(new CefPluginServiceFilter);
|
||||
content::PluginServiceImpl::GetInstance()->SetFilter(
|
||||
plugin_service_filter_.get());
|
||||
@@ -534,7 +541,6 @@ void CefContentBrowserClient::RenderProcessWillLaunch(
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
host->AddFilter(new extensions::ExtensionMessageFilter(id, profile));
|
||||
host->AddFilter(new extensions::IOThreadExtensionMessageFilter());
|
||||
host->AddFilter(
|
||||
new extensions::ExtensionsGuestViewMessageFilter(id, profile));
|
||||
}
|
||||
@@ -594,6 +600,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
|
||||
@@ -712,8 +729,6 @@ base::Optional<service_manager::Manifest>
|
||||
CefContentBrowserClient::GetServiceManifestOverlay(base::StringPiece name) {
|
||||
if (name == content::mojom::kBrowserServiceName) {
|
||||
return GetCefContentBrowserOverlayManifest();
|
||||
} else if (name == content::mojom::kRendererServiceName) {
|
||||
return GetCefContentRendererOverlayManifest();
|
||||
}
|
||||
|
||||
return base::nullopt;
|
||||
@@ -835,23 +850,11 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
CefRefPtr<CefCommandLineImpl> commandLinePtr(
|
||||
new CefCommandLineImpl(command_line, false, false));
|
||||
handler->OnBeforeChildProcessLaunch(commandLinePtr.get());
|
||||
commandLinePtr->Detach(NULL);
|
||||
commandLinePtr->Detach(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::AdjustUtilityServiceProcessCommandLine(
|
||||
const service_manager::Identity& identity,
|
||||
base::CommandLine* command_line) {
|
||||
#if defined(OS_MACOSX)
|
||||
// On Mac, the video-capture and audio services require a CFRunLoop, provided
|
||||
// by a UI message loop, to run AVFoundation and CoreAudio code.
|
||||
// See https://crbug.com/834581
|
||||
if (identity.name() == audio::mojom::kServiceName)
|
||||
command_line->AppendSwitch(switches::kMessageLoopTypeUi);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string CefContentBrowserClient::GetApplicationLocale() {
|
||||
return g_browser_process->GetApplicationLocale();
|
||||
}
|
||||
@@ -881,16 +884,6 @@ CefContentBrowserClient::CreateQuotaPermissionContext() {
|
||||
return new CefQuotaPermissionContext();
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::GetQuotaSettings(
|
||||
content::BrowserContext* context,
|
||||
content::StoragePartition* partition,
|
||||
storage::OptionalQuotaSettingsCallback callback) {
|
||||
const base::FilePath& cache_path = partition->GetPath();
|
||||
storage::GetNominalDynamicSettings(
|
||||
cache_path, cache_path.empty() /* is_incognito */,
|
||||
storage::GetDefaultDiskInfoHelper(), std::move(callback));
|
||||
}
|
||||
|
||||
content::MediaObserver* CefContentBrowserClient::GetMediaObserver() {
|
||||
return CefMediaCaptureDevicesDispatcher::GetInstance();
|
||||
}
|
||||
@@ -902,7 +895,7 @@ CefContentBrowserClient::CreateSpeechRecognitionManagerDelegate() {
|
||||
if (command_line->HasSwitch(switches::kEnableSpeechInput))
|
||||
return new CefSpeechRecognitionManagerDelegate();
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
content::GeneratedCodeCacheSettings
|
||||
@@ -923,15 +916,14 @@ void CefContentBrowserClient::AllowCertificateError(
|
||||
const GURL& request_url,
|
||||
bool is_main_frame_request,
|
||||
bool strict_enforcement,
|
||||
const base::Callback<void(content::CertificateRequestResultType)>&
|
||||
callback) {
|
||||
base::OnceCallback<void(content::CertificateRequestResultType)> callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (!is_main_frame_request) {
|
||||
// A sub-resource has a certificate error. The user doesn't really
|
||||
// have a context for making the right decision, so block the request
|
||||
// hard.
|
||||
callback.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL);
|
||||
std::move(callback).Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -949,14 +941,17 @@ void CefContentBrowserClient::AllowCertificateError(
|
||||
CefRefPtr<CefSSLInfo> cef_ssl_info = new CefSSLInfoImpl(ssl_info);
|
||||
|
||||
CefRefPtr<CefAllowCertificateErrorCallbackImpl> callbackImpl(
|
||||
new CefAllowCertificateErrorCallbackImpl(callback));
|
||||
new CefAllowCertificateErrorCallbackImpl(std::move(callback)));
|
||||
|
||||
bool proceed = handler->OnCertificateError(
|
||||
browser.get(), static_cast<cef_errorcode_t>(cert_error),
|
||||
request_url.spec(), cef_ssl_info, callbackImpl.get());
|
||||
if (!proceed) {
|
||||
callbackImpl->Disconnect();
|
||||
callback.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL);
|
||||
// |callback| may be null if the user executed it despite returning false.
|
||||
callback = callbackImpl->Disconnect();
|
||||
if (!callback.is_null()) {
|
||||
std::move(callback).Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1029,11 +1024,6 @@ void CefContentBrowserClient::OverrideWebkitPrefs(
|
||||
// Using RVH instead of RFH here because rvh->GetMainFrame() may be nullptr
|
||||
// when this method is called.
|
||||
renderer_prefs::PopulateWebPreferences(rvh, *prefs);
|
||||
|
||||
if (rvh->GetWidget()->GetView()) {
|
||||
rvh->GetWidget()->GetView()->SetBackgroundColor(
|
||||
prefs->base_background_color);
|
||||
}
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::BrowserURLHandlerCreated(
|
||||
@@ -1163,11 +1153,19 @@ void CefContentBrowserClient::ExposeInterfacesToRenderer(
|
||||
|
||||
std::unique_ptr<net::ClientCertStore>
|
||||
CefContentBrowserClient::CreateClientCertStore(
|
||||
content::ResourceContext* resource_context) {
|
||||
if (!resource_context)
|
||||
return nullptr;
|
||||
return static_cast<CefResourceContext*>(resource_context)
|
||||
->CreateClientCertStore();
|
||||
content::BrowserContext* browser_context) {
|
||||
// Match the logic in ProfileNetworkContextService::CreateClientCertStore.
|
||||
#if defined(USE_NSS_CERTS)
|
||||
// TODO: Add support for client implementation of crypto password dialog.
|
||||
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(
|
||||
net::ClientCertStoreNSS::PasswordDelegateFactory()));
|
||||
#elif defined(OS_WIN)
|
||||
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreWin());
|
||||
#elif defined(OS_MACOSX)
|
||||
return std::unique_ptr<net::ClientCertStore>(new net::ClientCertStoreMac());
|
||||
#else
|
||||
#error Unknown platform.
|
||||
#endif
|
||||
}
|
||||
|
||||
std::unique_ptr<content::LoginDelegate>
|
||||
@@ -1256,10 +1254,13 @@ bool CefContentBrowserClient::WillCreateURLLoaderFactory(
|
||||
int render_process_id,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
base::Optional<int64_t> navigation_id,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
bool* bypass_redirect_checks) {
|
||||
bool* bypass_redirect_checks,
|
||||
bool* disable_secure_dns,
|
||||
network::mojom::URLLoaderFactoryOverridePtr* factory_override) {
|
||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||
browser_context, frame, render_process_id,
|
||||
type == URLLoaderFactoryType::kNavigation,
|
||||
@@ -1283,14 +1284,15 @@ void CefContentBrowserClient::OnNetworkServiceCreated(
|
||||
network_service);
|
||||
}
|
||||
|
||||
network::mojom::NetworkContextPtr CefContentBrowserClient::CreateNetworkContext(
|
||||
mojo::Remote<network::mojom::NetworkContext>
|
||||
CefContentBrowserClient::CreateNetworkContext(
|
||||
content::BrowserContext* context,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path) {
|
||||
// This method may be called during shutdown when using multi-threaded
|
||||
// message loop mode. In that case exit early to avoid crashes.
|
||||
if (!SystemNetworkContextManager::GetInstance())
|
||||
return network::mojom::NetworkContextPtr();
|
||||
return mojo::Remote<network::mojom::NetworkContext>();
|
||||
|
||||
Profile* profile = Profile::FromBrowserContext(context);
|
||||
return profile->CreateNetworkContext(in_memory, relative_partition_path);
|
||||
@@ -1320,13 +1322,14 @@ CefContentBrowserClient::GetNetworkContextsParentDirectory() {
|
||||
|
||||
bool CefContentBrowserClient::HandleExternalProtocol(
|
||||
const GURL& url,
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
base::OnceCallback<content::WebContents*()> web_contents_getter,
|
||||
int child_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
bool is_main_frame,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
network::mojom::URLLoaderFactoryPtr* out_factory) {
|
||||
const base::Optional<url::Origin>& initiating_origin,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
||||
// Call the other HandleExternalProtocol variant.
|
||||
return false;
|
||||
}
|
||||
@@ -1336,33 +1339,34 @@ bool CefContentBrowserClient::HandleExternalProtocol(
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
const network::ResourceRequest& resource_request,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
network::mojom::URLLoaderFactoryPtr* out_factory) {
|
||||
auto request = mojo::MakeRequest(out_factory);
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver =
|
||||
out_factory->InitWithNewPipeAndPassReceiver();
|
||||
// CefBrowserPlatformDelegate::HandleExternalProtocol may be called if
|
||||
// nothing handles the request.
|
||||
if (CEF_CURRENTLY_ON_IOT()) {
|
||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||
web_contents_getter, frame_tree_node_id, resource_request);
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
web_contents_getter, std::move(request), std::move(request_handler));
|
||||
web_contents_getter, std::move(receiver), std::move(request_handler));
|
||||
} else {
|
||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||
web_contents_getter, frame_tree_node_id, resource_request);
|
||||
CEF_POST_TASK(CEF_IOT,
|
||||
base::BindOnce(
|
||||
[](network::mojom::URLLoaderFactoryRequest request,
|
||||
std::unique_ptr<net_service::InterceptedRequestHandler>
|
||||
request_handler,
|
||||
content::WebContents::Getter web_contents_getter) {
|
||||
// Manages its own lifetime.
|
||||
CEF_POST_TASK(
|
||||
CEF_IOT,
|
||||
base::BindOnce(
|
||||
[](mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver,
|
||||
std::unique_ptr<net_service::InterceptedRequestHandler>
|
||||
request_handler,
|
||||
content::WebContents::Getter web_contents_getter) {
|
||||
// Manages its own lifetime.
|
||||
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
web_contents_getter, std::move(request),
|
||||
std::move(request_handler));
|
||||
},
|
||||
std::move(request), std::move(request_handler),
|
||||
std::move(web_contents_getter)));
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
web_contents_getter, std::move(receiver),
|
||||
std::move(request_handler));
|
||||
},
|
||||
std::move(receiver), std::move(request_handler),
|
||||
std::move(web_contents_getter)));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1379,6 +1383,33 @@ CefContentBrowserClient::CreateWindowForPictureInPicture(
|
||||
return content::OverlayWindow::Create(controller);
|
||||
}
|
||||
|
||||
void CefContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
return;
|
||||
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(render_frame_host);
|
||||
if (!web_contents)
|
||||
return;
|
||||
|
||||
const GURL& site = render_frame_host->GetSiteInstance()->GetSiteURL();
|
||||
if (!site.SchemeIs(extensions::kExtensionScheme))
|
||||
return;
|
||||
|
||||
content::BrowserContext* browser_context =
|
||||
render_frame_host->GetProcess()->GetBrowserContext();
|
||||
auto* extension = extensions::ExtensionRegistry::Get(browser_context)
|
||||
->enabled_extensions()
|
||||
.GetByID(site.host());
|
||||
if (!extension)
|
||||
return;
|
||||
extensions::ExtensionsBrowserClient::Get()
|
||||
->RegisterBrowserInterfaceBindersForFrame(map, render_frame_host,
|
||||
extension);
|
||||
}
|
||||
|
||||
std::string CefContentBrowserClient::GetProduct() {
|
||||
// Match the logic in chrome_content_browser_client.cc GetProduct().
|
||||
return ::GetProduct();
|
||||
@@ -1417,16 +1448,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(
|
||||
@@ -63,19 +68,12 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
base::StringPiece name) override;
|
||||
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
||||
int child_process_id) override;
|
||||
void AdjustUtilityServiceProcessCommandLine(
|
||||
const service_manager::Identity& identity,
|
||||
base::CommandLine* command_line) override;
|
||||
std::string GetApplicationLocale() override;
|
||||
scoped_refptr<network::SharedURLLoaderFactory>
|
||||
GetSystemSharedURLLoaderFactory() override;
|
||||
network::mojom::NetworkContext* GetSystemNetworkContext() override;
|
||||
scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext()
|
||||
override;
|
||||
void GetQuotaSettings(
|
||||
content::BrowserContext* context,
|
||||
content::StoragePartition* partition,
|
||||
storage::OptionalQuotaSettingsCallback callback) override;
|
||||
content::MediaObserver* GetMediaObserver() override;
|
||||
content::SpeechRecognitionManagerDelegate*
|
||||
CreateSpeechRecognitionManagerDelegate() override;
|
||||
@@ -88,8 +86,8 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
const GURL& request_url,
|
||||
bool is_main_frame_request,
|
||||
bool strict_enforcement,
|
||||
const base::Callback<void(content::CertificateRequestResultType)>&
|
||||
callback) override;
|
||||
base::OnceCallback<void(content::CertificateRequestResultType)> callback)
|
||||
override;
|
||||
base::OnceClosure SelectClientCertificate(
|
||||
content::WebContents* web_contents,
|
||||
net::SSLCertRequestInfo* cert_request_info,
|
||||
@@ -143,7 +141,7 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
blink::AssociatedInterfaceRegistry* associated_registry,
|
||||
content::RenderProcessHost* render_process_host) override;
|
||||
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
|
||||
content::ResourceContext* resource_context) override;
|
||||
content::BrowserContext* browser_context) override;
|
||||
std::unique_ptr<content::LoginDelegate> CreateLoginDelegate(
|
||||
const net::AuthChallengeInfo& auth_info,
|
||||
content::WebContents* web_contents,
|
||||
@@ -166,35 +164,44 @@ class CefContentBrowserClient : public content::ContentBrowserClient {
|
||||
int render_process_id,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
base::Optional<int64_t> navigation_id,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
header_client,
|
||||
bool* bypass_redirect_checks) override;
|
||||
bool* bypass_redirect_checks,
|
||||
bool* disable_secure_dns,
|
||||
network::mojom::URLLoaderFactoryOverridePtr* factory_override) override;
|
||||
void OnNetworkServiceCreated(
|
||||
network::mojom::NetworkService* network_service) override;
|
||||
network::mojom::NetworkContextPtr CreateNetworkContext(
|
||||
mojo::Remote<network::mojom::NetworkContext> CreateNetworkContext(
|
||||
content::BrowserContext* context,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path) override;
|
||||
std::vector<base::FilePath> GetNetworkContextsParentDirectory() override;
|
||||
bool HandleExternalProtocol(
|
||||
const GURL& url,
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
base::OnceCallback<content::WebContents*()> web_contents_getter,
|
||||
int child_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
bool is_main_frame,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
network::mojom::URLLoaderFactoryPtr* out_factory) override;
|
||||
const base::Optional<url::Origin>& initiating_origin,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||
override;
|
||||
bool HandleExternalProtocol(
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
int frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
const network::ResourceRequest& request,
|
||||
network::mojom::URLLoaderFactoryRequest* factory_request,
|
||||
network::mojom::URLLoaderFactoryPtr* out_factory) override;
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||
override;
|
||||
std::unique_ptr<content::OverlayWindow> CreateWindowForPictureInPicture(
|
||||
content::PictureInPictureWindowController* controller) override;
|
||||
void RegisterBrowserInterfaceBindersForFrame(
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map)
|
||||
override;
|
||||
|
||||
std::string GetProduct() override;
|
||||
std::string GetChromeProduct() override;
|
||||
@@ -203,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;
|
||||
|
||||
|
@@ -49,7 +49,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
CefContext* g_context = NULL;
|
||||
CefContext* g_context = nullptr;
|
||||
|
||||
#if DCHECK_IS_ON()
|
||||
// When the process terminates check if CefShutdown() has been called.
|
||||
@@ -201,7 +201,7 @@ int CefExecuteProcess(const CefMainArgs& args,
|
||||
// Execute the secondary process.
|
||||
#if defined(OS_WIN)
|
||||
sandbox::SandboxInterfaceInfo sandbox_info = {0};
|
||||
if (windows_sandbox_info == NULL) {
|
||||
if (windows_sandbox_info == nullptr) {
|
||||
content::InitializeSandboxInfo(&sandbox_info);
|
||||
windows_sandbox_info = &sandbox_info;
|
||||
}
|
||||
@@ -270,7 +270,7 @@ void CefShutdown() {
|
||||
|
||||
// Delete the global context object.
|
||||
delete g_context;
|
||||
g_context = NULL;
|
||||
g_context = nullptr;
|
||||
}
|
||||
|
||||
void CefDoMessageLoopWork() {
|
||||
@@ -391,8 +391,7 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
content::ContentMainParams params(main_delegate_.get());
|
||||
#if defined(OS_WIN)
|
||||
sandbox::SandboxInterfaceInfo sandbox_info = {0};
|
||||
if (windows_sandbox_info == NULL) {
|
||||
content::InitializeSandboxInfo(&sandbox_info);
|
||||
if (windows_sandbox_info == nullptr) {
|
||||
windows_sandbox_info = &sandbox_info;
|
||||
settings_.no_sandbox = true;
|
||||
}
|
||||
@@ -481,7 +480,7 @@ void CefContext::Shutdown() {
|
||||
FinalizeShutdown();
|
||||
} else {
|
||||
// Finish shutdown on the current thread, which should be the UI thread.
|
||||
FinishShutdownOnUIThread(NULL);
|
||||
FinishShutdownOnUIThread(nullptr);
|
||||
|
||||
FinalizeShutdown();
|
||||
}
|
||||
@@ -513,7 +512,7 @@ SkColor CefContext::GetBackgroundColor(
|
||||
CefTraceSubscriber* CefContext::GetTraceSubscriber() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (shutting_down_)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
if (!trace_subscriber_.get())
|
||||
trace_subscriber_.reset(new CefTraceSubscriber());
|
||||
return trace_subscriber_.get();
|
||||
@@ -607,7 +606,7 @@ void CefContext::FinishShutdownOnUIThread(
|
||||
observer.OnContextDestroyed();
|
||||
|
||||
if (trace_subscriber_.get())
|
||||
trace_subscriber_.reset(NULL);
|
||||
trace_subscriber_.reset(nullptr);
|
||||
|
||||
static_cast<ChromeBrowserProcessStub*>(g_browser_process)->Shutdown();
|
||||
|
||||
@@ -631,11 +630,11 @@ void CefContext::FinalizeShutdown() {
|
||||
// Shut down the content runner.
|
||||
service_manager::MainShutdown(*sm_main_params_);
|
||||
|
||||
browser_info_manager_.reset(NULL);
|
||||
sm_main_params_.reset(NULL);
|
||||
sm_main_delegate_.reset(NULL);
|
||||
main_delegate_.reset(NULL);
|
||||
browser_info_manager_.reset(nullptr);
|
||||
sm_main_params_.reset(nullptr);
|
||||
sm_main_delegate_.reset(nullptr);
|
||||
main_delegate_.reset(nullptr);
|
||||
|
||||
delete g_browser_process;
|
||||
g_browser_process = NULL;
|
||||
g_browser_process = nullptr;
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ CefContextMenuParamsImpl::CefContextMenuParamsImpl(
|
||||
content::ContextMenuParams* value)
|
||||
: CefValueBase<CefContextMenuParams, content::ContextMenuParams>(
|
||||
value,
|
||||
NULL,
|
||||
nullptr,
|
||||
kOwnerNoDelete,
|
||||
true,
|
||||
new CefValueControllerNonThreadSafe()) {
|
||||
@@ -38,7 +38,7 @@ CefContextMenuParamsImpl::TypeFlags CefContextMenuParamsImpl::GetTypeFlags() {
|
||||
type_flags |= CM_TYPEFLAG_FRAME;
|
||||
if (!params.link_url.is_empty())
|
||||
type_flags |= CM_TYPEFLAG_LINK;
|
||||
if (params.media_type != blink::WebContextMenuData::kMediaTypeNone)
|
||||
if (params.media_type != blink::ContextMenuDataMediaType::kNone)
|
||||
type_flags |= CM_TYPEFLAG_MEDIA;
|
||||
if (!params.selection_text.empty())
|
||||
type_flags |= CM_TYPEFLAG_SELECTION;
|
||||
|
@@ -154,12 +154,13 @@ void CefDevToolsFileManager::FileSavedAs(const std::string& url,
|
||||
base::Value url_value(url);
|
||||
base::Value file_system_path_value(file_system_path);
|
||||
CallClientFunction("DevToolsAPI.savedURL", &url_value,
|
||||
&file_system_path_value, NULL);
|
||||
&file_system_path_value, nullptr);
|
||||
}
|
||||
|
||||
void CefDevToolsFileManager::CanceledFileSaveAs(const std::string& url) {
|
||||
base::Value url_value(url);
|
||||
CallClientFunction("DevToolsAPI.canceledSaveURL", &url_value, NULL, NULL);
|
||||
CallClientFunction("DevToolsAPI.canceledSaveURL", &url_value, nullptr,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void CefDevToolsFileManager::Append(const std::string& url,
|
||||
@@ -175,7 +176,7 @@ void CefDevToolsFileManager::Append(const std::string& url,
|
||||
|
||||
void CefDevToolsFileManager::AppendedTo(const std::string& url) {
|
||||
base::Value url_value(url);
|
||||
CallClientFunction("DevToolsAPI.appendedToURL", &url_value, NULL, NULL);
|
||||
CallClientFunction("DevToolsAPI.appendedToURL", &url_value, nullptr, nullptr);
|
||||
}
|
||||
|
||||
void CefDevToolsFileManager::CallClientFunction(
|
||||
|
@@ -47,6 +47,7 @@
|
||||
#include "net/traffic_annotation/network_traffic_annotation.h"
|
||||
#include "services/network/public/cpp/simple_url_loader.h"
|
||||
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
|
||||
#include "services/network/public/mojom/url_response_head.mojom.h"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -57,9 +58,20 @@ static std::string GetFrontendURL() {
|
||||
}
|
||||
|
||||
std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(
|
||||
const net::HttpResponseHeaders* rh) {
|
||||
const net::HttpResponseHeaders* rh,
|
||||
bool success,
|
||||
int net_error) {
|
||||
auto response = std::make_unique<base::DictionaryValue>();
|
||||
response->SetInteger("statusCode", rh ? rh->response_code() : 200);
|
||||
int responseCode = 200;
|
||||
if (rh) {
|
||||
responseCode = rh->response_code();
|
||||
} else if (!success) {
|
||||
// In case of no headers, assume file:// URL and failed to load
|
||||
responseCode = 404;
|
||||
}
|
||||
response->SetInteger("statusCode", responseCode);
|
||||
response->SetInteger("netError", net_error);
|
||||
response->SetString("netErrorName", net::ErrorToString(net_error));
|
||||
|
||||
auto headers = std::make_unique<base::DictionaryValue>();
|
||||
size_t iterator = 0;
|
||||
@@ -95,7 +107,7 @@ class CefDevToolsFrontend::NetworkResourceLoader
|
||||
|
||||
private:
|
||||
void OnResponseStarted(const GURL& final_url,
|
||||
const network::ResourceResponseHead& response_head) {
|
||||
const network::mojom::URLResponseHead& response_head) {
|
||||
response_headers_ = response_head.headers;
|
||||
}
|
||||
|
||||
@@ -120,7 +132,8 @@ class CefDevToolsFrontend::NetworkResourceLoader
|
||||
}
|
||||
|
||||
void OnComplete(bool success) override {
|
||||
auto response = BuildObjectForResponse(response_headers_.get());
|
||||
auto response = BuildObjectForResponse(response_headers_.get(), success,
|
||||
loader_->NetError());
|
||||
bindings_->SendMessageAck(request_id_, response.get());
|
||||
|
||||
bindings_->loaders_.erase(bindings_->loaders_.find(this));
|
||||
@@ -207,7 +220,7 @@ void CefDevToolsFrontend::DisconnectFromTarget() {
|
||||
if (!agent_host_)
|
||||
return;
|
||||
agent_host_->DetachClient(this);
|
||||
agent_host_ = NULL;
|
||||
agent_host_ = nullptr;
|
||||
}
|
||||
|
||||
CefDevToolsFrontend::CefDevToolsFrontend(
|
||||
@@ -272,8 +285,8 @@ void CefDevToolsFrontend::WebContentsDestroyed() {
|
||||
void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
const std::string& message) {
|
||||
std::string method;
|
||||
base::ListValue* params = NULL;
|
||||
base::DictionaryValue* dict = NULL;
|
||||
base::ListValue* params = nullptr;
|
||||
base::DictionaryValue* dict = nullptr;
|
||||
base::Optional<base::Value> parsed_message = base::JSONReader::Read(message);
|
||||
if (!parsed_message || !parsed_message->GetAsDictionary(&dict) ||
|
||||
!dict->GetString("method", &method)) {
|
||||
@@ -287,7 +300,8 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
std::string protocol_message;
|
||||
if (!agent_host_ || !params->GetString(0, &protocol_message))
|
||||
return;
|
||||
agent_host_->DispatchProtocolMessage(this, protocol_message);
|
||||
agent_host_->DispatchProtocolMessage(
|
||||
this, base::as_bytes(base::make_span(protocol_message)));
|
||||
} else if (method == "loadCompleted") {
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
base::ASCIIToUTF16("DevToolsAPI.setUseSoftMenu(true);"),
|
||||
@@ -306,6 +320,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
if (!gurl.is_valid()) {
|
||||
base::DictionaryValue response;
|
||||
response.SetInteger("statusCode", 404);
|
||||
response.SetBoolean("urlValid", false);
|
||||
SendMessageAck(request_id, &response);
|
||||
return;
|
||||
}
|
||||
@@ -342,7 +357,7 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
// TODO(caseq): this preserves behavior of URLFetcher-based
|
||||
// implementation. We really need to pass proper first party origin from
|
||||
// the front-end.
|
||||
resource_request->site_for_cookies = gurl;
|
||||
resource_request->site_for_cookies = net::SiteForCookies::FromUrl(gurl);
|
||||
resource_request->headers.AddHeadersFromString(headers);
|
||||
|
||||
std::unique_ptr<network::mojom::URLLoaderFactory> file_url_loader_factory;
|
||||
@@ -433,10 +448,12 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
|
||||
|
||||
void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
content::DevToolsAgentHost* agent_host,
|
||||
const std::string& message) {
|
||||
if (message.length() < kMaxMessageChunkSize) {
|
||||
base::span<const uint8_t> message) {
|
||||
base::StringPiece str_message(reinterpret_cast<const char*>(message.data()),
|
||||
message.size());
|
||||
if (str_message.length() < kMaxMessageChunkSize) {
|
||||
std::string param;
|
||||
base::EscapeJSONString(message, true, ¶m);
|
||||
base::EscapeJSONString(str_message, true, ¶m);
|
||||
std::string code = "DevToolsAPI.dispatchMessage(" + param + ");";
|
||||
base::string16 javascript = base::UTF8ToUTF16(code);
|
||||
web_contents()->GetMainFrame()->ExecuteJavaScriptForTests(
|
||||
@@ -444,10 +461,11 @@ void CefDevToolsFrontend::DispatchProtocolMessage(
|
||||
return;
|
||||
}
|
||||
|
||||
size_t total_size = message.length();
|
||||
for (size_t pos = 0; pos < message.length(); pos += kMaxMessageChunkSize) {
|
||||
size_t total_size = str_message.length();
|
||||
for (size_t pos = 0; pos < str_message.length();
|
||||
pos += kMaxMessageChunkSize) {
|
||||
std::string param;
|
||||
base::EscapeJSONString(message.substr(pos, kMaxMessageChunkSize), true,
|
||||
base::EscapeJSONString(str_message.substr(pos, kMaxMessageChunkSize), true,
|
||||
¶m);
|
||||
std::string code = "DevToolsAPI.dispatchMessageChunk(" + param + "," +
|
||||
std::to_string(pos ? 0 : total_size) + ");";
|
||||
|
@@ -66,7 +66,7 @@ class CefDevToolsFrontend : public content::WebContentsObserver,
|
||||
// content::DevToolsAgentHostClient implementation.
|
||||
void AgentHostClosed(content::DevToolsAgentHost* agent_host) override;
|
||||
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host,
|
||||
const std::string& message) override;
|
||||
base::span<const uint8_t> message) override;
|
||||
void HandleMessageFromDevToolsFrontend(const std::string& message);
|
||||
|
||||
private:
|
||||
|
@@ -12,7 +12,7 @@
|
||||
CefDownloadItemImpl::CefDownloadItemImpl(download::DownloadItem* value)
|
||||
: CefValueBase<CefDownloadItem, download::DownloadItem>(
|
||||
value,
|
||||
NULL,
|
||||
nullptr,
|
||||
kOwnerNoDelete,
|
||||
true,
|
||||
new CefValueControllerNonThreadSafe()) {
|
||||
|
@@ -34,7 +34,7 @@ CefRefPtr<CefDownloadHandler> GetDownloadHandler(
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get())
|
||||
return client->GetDownloadHandler();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// CefBeforeDownloadCallback implementation.
|
||||
@@ -43,11 +43,11 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
CefBeforeDownloadCallbackImpl(const base::WeakPtr<DownloadManager>& manager,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_name,
|
||||
const content::DownloadTargetCallback& callback)
|
||||
content::DownloadTargetCallback callback)
|
||||
: manager_(manager),
|
||||
download_id_(download_id),
|
||||
suggested_name_(suggested_name),
|
||||
callback_(callback) {}
|
||||
callback_(std::move(callback)) {}
|
||||
|
||||
void Continue(const CefString& download_path, bool show_dialog) override {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
@@ -56,28 +56,27 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
|
||||
if (manager_) {
|
||||
base::FilePath path = base::FilePath(download_path);
|
||||
CEF_POST_USER_VISIBLE_TASK(base::Bind(
|
||||
&CefBeforeDownloadCallbackImpl::GenerateFilename, manager_,
|
||||
download_id_, suggested_name_, path, show_dialog, callback_));
|
||||
CEF_POST_USER_VISIBLE_TASK(
|
||||
base::BindOnce(&CefBeforeDownloadCallbackImpl::GenerateFilename,
|
||||
manager_, download_id_, suggested_name_, path,
|
||||
show_dialog, std::move(callback_)));
|
||||
}
|
||||
|
||||
download_id_ = 0;
|
||||
callback_.Reset();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBeforeDownloadCallbackImpl::Continue, this,
|
||||
download_path, show_dialog));
|
||||
base::BindOnce(&CefBeforeDownloadCallbackImpl::Continue,
|
||||
this, download_path, show_dialog));
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static void GenerateFilename(
|
||||
base::WeakPtr<DownloadManager> manager,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_name,
|
||||
const base::FilePath& download_path,
|
||||
bool show_dialog,
|
||||
const content::DownloadTargetCallback& callback) {
|
||||
static void GenerateFilename(base::WeakPtr<DownloadManager> manager,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_name,
|
||||
const base::FilePath& download_path,
|
||||
bool show_dialog,
|
||||
content::DownloadTargetCallback callback) {
|
||||
CEF_REQUIRE_BLOCKING();
|
||||
|
||||
base::FilePath suggested_path = download_path;
|
||||
@@ -103,16 +102,16 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::Bind(&CefBeforeDownloadCallbackImpl::ChooseDownloadPath, manager,
|
||||
download_id, suggested_path, show_dialog, callback));
|
||||
base::BindOnce(&CefBeforeDownloadCallbackImpl::ChooseDownloadPath,
|
||||
manager, download_id, suggested_path, show_dialog,
|
||||
std::move(callback)));
|
||||
}
|
||||
|
||||
static void ChooseDownloadPath(
|
||||
base::WeakPtr<DownloadManager> manager,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_path,
|
||||
bool show_dialog,
|
||||
const content::DownloadTargetCallback& callback) {
|
||||
static void ChooseDownloadPath(base::WeakPtr<DownloadManager> manager,
|
||||
uint32 download_id,
|
||||
const base::FilePath& suggested_path,
|
||||
bool show_dialog,
|
||||
content::DownloadTargetCallback callback) {
|
||||
if (!manager)
|
||||
return;
|
||||
|
||||
@@ -142,21 +141,23 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
|
||||
browser->RunFileChooser(
|
||||
params,
|
||||
base::Bind(
|
||||
base::BindOnce(
|
||||
&CefBeforeDownloadCallbackImpl::ChooseDownloadPathCallback,
|
||||
callback));
|
||||
std::move(callback)));
|
||||
}
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
callback.Run(suggested_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, suggested_path,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
std::move(callback).Run(
|
||||
suggested_path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download::DownloadItem::MixedContentStatus::UNKNOWN, suggested_path,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
static void ChooseDownloadPathCallback(
|
||||
const content::DownloadTargetCallback& callback,
|
||||
content::DownloadTargetCallback callback,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths) {
|
||||
DCHECK_LE(file_paths.size(), (size_t)1);
|
||||
@@ -166,9 +167,10 @@ class CefBeforeDownloadCallbackImpl : public CefBeforeDownloadCallback {
|
||||
path = file_paths.front();
|
||||
|
||||
// The download will be cancelled if |path| is empty.
|
||||
callback.Run(path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
std::move(callback).Run(path, DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download::DownloadItem::MixedContentStatus::UNKNOWN,
|
||||
path, download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
}
|
||||
|
||||
base::WeakPtr<DownloadManager> manager_;
|
||||
@@ -262,7 +264,7 @@ CefDownloadManagerDelegate::CefDownloadManagerDelegate(DownloadManager* manager)
|
||||
|
||||
CefDownloadManagerDelegate::~CefDownloadManagerDelegate() {
|
||||
if (manager_) {
|
||||
manager_->SetDelegate(NULL);
|
||||
manager_->SetDelegate(nullptr);
|
||||
manager_->RemoveObserver(this);
|
||||
}
|
||||
|
||||
@@ -284,7 +286,7 @@ void CefDownloadManagerDelegate::OnDownloadUpdated(DownloadItem* download) {
|
||||
|
||||
handler->OnDownloadUpdated(browser.get(), download_item.get(), callback);
|
||||
|
||||
download_item->Detach(NULL);
|
||||
download_item->Detach(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,20 +341,21 @@ void CefDownloadManagerDelegate::OnDownloadCreated(DownloadManager* manager,
|
||||
|
||||
void CefDownloadManagerDelegate::ManagerGoingDown(DownloadManager* manager) {
|
||||
DCHECK_EQ(manager, manager_);
|
||||
manager->SetDelegate(NULL);
|
||||
manager->SetDelegate(nullptr);
|
||||
manager->RemoveObserver(this);
|
||||
manager_ptr_factory_.InvalidateWeakPtrs();
|
||||
manager_ = NULL;
|
||||
manager_ = nullptr;
|
||||
}
|
||||
|
||||
bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
||||
DownloadItem* item,
|
||||
const content::DownloadTargetCallback& callback) {
|
||||
content::DownloadTargetCallback* callback) {
|
||||
if (!item->GetForcedFilePath().empty()) {
|
||||
callback.Run(
|
||||
std::move(*callback).Run(
|
||||
item->GetForcedFilePath(), DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, item->GetForcedFilePath(),
|
||||
download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||
download::DownloadItem::MixedContentStatus::UNKNOWN,
|
||||
item->GetForcedFilePath(), download::DOWNLOAD_INTERRUPT_REASON_NONE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -372,21 +375,21 @@ bool CefDownloadManagerDelegate::DetermineDownloadTarget(
|
||||
CefRefPtr<CefBeforeDownloadCallback> callbackObj(
|
||||
new CefBeforeDownloadCallbackImpl(manager_ptr_factory_.GetWeakPtr(),
|
||||
item->GetId(), suggested_name,
|
||||
callback));
|
||||
std::move(*callback)));
|
||||
|
||||
handler->OnBeforeDownload(browser.get(), download_item.get(),
|
||||
suggested_name.value(), callbackObj);
|
||||
|
||||
download_item->Detach(NULL);
|
||||
download_item->Detach(nullptr);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefDownloadManagerDelegate::GetNextId(
|
||||
const content::DownloadIdCallback& callback) {
|
||||
content::DownloadIdCallback callback) {
|
||||
static uint32 next_id = DownloadItem::kInvalidId + 1;
|
||||
callback.Run(next_id++);
|
||||
std::move(callback).Run(next_id++);
|
||||
}
|
||||
|
||||
std::string CefDownloadManagerDelegate::ApplicationClientIdForFileScanning() {
|
||||
|
@@ -37,8 +37,8 @@ class CefDownloadManagerDelegate : public download::DownloadItem::Observer,
|
||||
// DownloadManagerDelegate methods.
|
||||
bool DetermineDownloadTarget(
|
||||
download::DownloadItem* item,
|
||||
const content::DownloadTargetCallback& callback) override;
|
||||
void GetNextId(const content::DownloadIdCallback& callback) override;
|
||||
content::DownloadTargetCallback* callback) override;
|
||||
void GetNextId(content::DownloadIdCallback callback) override;
|
||||
std::string ApplicationClientIdForFileScanning() override;
|
||||
|
||||
// CefBrowserHostImpl::Observer methods.
|
||||
|
@@ -10,12 +10,12 @@
|
||||
#include "chrome/browser/extensions/api/tabs/tabs_constants.h"
|
||||
#include "components/zoom/zoom_controller.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "content/public/common/page_zoom.h"
|
||||
#include "extensions/browser/extension_api_frame_id_map.h"
|
||||
#include "extensions/browser/extension_zoom_request_client.h"
|
||||
#include "extensions/common/error_utils.h"
|
||||
#include "extensions/common/manifest_constants.h"
|
||||
#include "extensions/common/permissions/permissions_data.h"
|
||||
#include "third_party/blink/public/common/page/page_zoom.h"
|
||||
|
||||
namespace extensions {
|
||||
namespace cef {
|
||||
@@ -110,7 +110,7 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
|
||||
return set_init_result(VALIDATION_FAILURE);
|
||||
|
||||
// |details| are not optional.
|
||||
base::DictionaryValue* details_value = NULL;
|
||||
base::DictionaryValue* details_value = nullptr;
|
||||
if (!args_->GetDictionary(1, &details_value))
|
||||
return set_init_result(VALIDATION_FAILURE);
|
||||
std::unique_ptr<InjectDetails> details(new InjectDetails());
|
||||
@@ -282,9 +282,10 @@ bool TabsSetZoomFunction::RunAsync() {
|
||||
|
||||
zoom::ZoomController* zoom_controller =
|
||||
zoom::ZoomController::FromWebContents(web_contents);
|
||||
double zoom_level = params->zoom_factor > 0
|
||||
? content::ZoomFactorToZoomLevel(params->zoom_factor)
|
||||
: zoom_controller->GetDefaultZoomLevel();
|
||||
double zoom_level =
|
||||
params->zoom_factor > 0
|
||||
? blink::PageZoomFactorToZoomLevel(params->zoom_factor)
|
||||
: zoom_controller->GetDefaultZoomLevel();
|
||||
|
||||
scoped_refptr<extensions::ExtensionZoomRequestClient> client(
|
||||
new extensions::ExtensionZoomRequestClient(extension()));
|
||||
@@ -310,7 +311,7 @@ bool TabsGetZoomFunction::RunAsync() {
|
||||
|
||||
double zoom_level =
|
||||
zoom::ZoomController::FromWebContents(web_contents)->GetZoomLevel();
|
||||
double zoom_factor = content::ZoomLevelToZoomFactor(zoom_level);
|
||||
double zoom_factor = blink::PageZoomLevelToZoomFactor(zoom_level);
|
||||
results_ = tabs::GetZoom::Results::Create(zoom_factor);
|
||||
SendResponse(true);
|
||||
return true;
|
||||
@@ -384,8 +385,9 @@ bool TabsGetZoomSettingsFunction::RunAsync() {
|
||||
zoom::ZoomController::ZoomMode zoom_mode = zoom_controller->zoom_mode();
|
||||
api::tabs::ZoomSettings zoom_settings;
|
||||
ZoomModeToZoomSettings(zoom_mode, &zoom_settings);
|
||||
zoom_settings.default_zoom_factor.reset(new double(
|
||||
content::ZoomLevelToZoomFactor(zoom_controller->GetDefaultZoomLevel())));
|
||||
zoom_settings.default_zoom_factor.reset(
|
||||
new double(blink::PageZoomLevelToZoomFactor(
|
||||
zoom_controller->GetDefaultZoomLevel())));
|
||||
|
||||
results_ = api::tabs::GetZoomSettings::Results::Create(zoom_settings);
|
||||
SendResponse(true);
|
||||
|
@@ -42,7 +42,7 @@ content::WebContents* GetFullPageGuestForOwnerContents(
|
||||
if (plugin_guest)
|
||||
return plugin_guest->web_contents();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GetAllGuestsForOwnerContents(content::WebContents* owner,
|
||||
@@ -58,8 +58,10 @@ content::WebContents* GetOwnerForGuestContents(content::WebContents* guest) {
|
||||
static_cast<content::WebContentsImpl*>(guest);
|
||||
content::BrowserPluginGuest* plugin_guest =
|
||||
guest_impl->GetBrowserPluginGuest();
|
||||
if (plugin_guest)
|
||||
return plugin_guest->embedder_web_contents();
|
||||
if (plugin_guest) {
|
||||
return content::WebContents::FromRenderFrameHost(
|
||||
plugin_guest->GetEmbedderFrame());
|
||||
}
|
||||
|
||||
// Maybe it's a print preview dialog.
|
||||
auto print_preview_controller =
|
||||
@@ -77,7 +79,7 @@ CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForFrameRoute(
|
||||
content::RenderFrameHost::FromID(render_process_id, render_routing_id);
|
||||
if (host)
|
||||
return GetOwnerBrowserForHost(host, is_guest_view);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
} else {
|
||||
// Use the thread-safe approach.
|
||||
scoped_refptr<CefBrowserInfo> info =
|
||||
@@ -93,7 +95,7 @@ CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForFrameRoute(
|
||||
}
|
||||
return browser;
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -47,22 +47,33 @@ SkColor CefBrowserPlatformDelegateBackground::GetBackgroundColor() const {
|
||||
return native_delegate_->GetBackgroundColor();
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::SynchronizeVisualProperties() {
|
||||
void CefBrowserPlatformDelegateBackground::WasResized() {
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::SendKeyEvent(
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
const CefKeyEvent& event) {
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::SendMouseEvent(
|
||||
const blink::WebMouseEvent& event) {
|
||||
void CefBrowserPlatformDelegateBackground::SendMouseClickEvent(
|
||||
const CefMouseEvent& event,
|
||||
CefBrowserHost::MouseButtonType type,
|
||||
bool mouseUp,
|
||||
int clickCount) {
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::SendMouseMoveEvent(
|
||||
const CefMouseEvent& event,
|
||||
bool mouseLeave) {
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::SendMouseWheelEvent(
|
||||
const blink::WebMouseWheelEvent& event) {
|
||||
const CefMouseEvent& event,
|
||||
int deltaX,
|
||||
int deltaY) {
|
||||
// Nothing to do here.
|
||||
}
|
||||
|
||||
@@ -91,37 +102,6 @@ bool CefBrowserPlatformDelegateBackground::HandleKeyboardEvent(
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::TranslateKeyEvent(
|
||||
content::NativeWebKeyboardEvent& result,
|
||||
const CefKeyEvent& key_event) const {
|
||||
native_delegate_->TranslateKeyEvent(result, key_event);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::TranslateClickEvent(
|
||||
blink::WebMouseEvent& result,
|
||||
const CefMouseEvent& mouse_event,
|
||||
CefBrowserHost::MouseButtonType type,
|
||||
bool mouseUp,
|
||||
int clickCount) const {
|
||||
native_delegate_->TranslateClickEvent(result, mouse_event, type, mouseUp,
|
||||
clickCount);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::TranslateMoveEvent(
|
||||
blink::WebMouseEvent& result,
|
||||
const CefMouseEvent& mouse_event,
|
||||
bool mouseLeave) const {
|
||||
native_delegate_->TranslateMoveEvent(result, mouse_event, mouseLeave);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateBackground::TranslateWheelEvent(
|
||||
blink::WebMouseWheelEvent& result,
|
||||
const CefMouseEvent& mouse_event,
|
||||
int deltaX,
|
||||
int deltaY) const {
|
||||
native_delegate_->TranslateWheelEvent(result, mouse_event, deltaX, deltaY);
|
||||
}
|
||||
|
||||
CefEventHandle CefBrowserPlatformDelegateBackground::GetEventHandle(
|
||||
const content::NativeWebKeyboardEvent& event) const {
|
||||
return native_delegate_->GetEventHandle(event);
|
||||
|
@@ -24,30 +24,22 @@ class CefBrowserPlatformDelegateBackground
|
||||
SkColor GetBackgroundColor() const override;
|
||||
bool CanUseSharedTexture() const override;
|
||||
bool CanUseExternalBeginFrame() const override;
|
||||
void SynchronizeVisualProperties() override;
|
||||
void SendKeyEvent(const content::NativeWebKeyboardEvent& event) override;
|
||||
void SendMouseEvent(const blink::WebMouseEvent& event) override;
|
||||
void SendMouseWheelEvent(const blink::WebMouseWheelEvent& event) override;
|
||||
void WasResized() override;
|
||||
void SendKeyEvent(const CefKeyEvent& event) override;
|
||||
void SendMouseClickEvent(const CefMouseEvent& event,
|
||||
CefBrowserHost::MouseButtonType type,
|
||||
bool mouseUp,
|
||||
int clickCount) override;
|
||||
void SendMouseMoveEvent(const CefMouseEvent& event, bool mouseLeave) override;
|
||||
void SendMouseWheelEvent(const CefMouseEvent& event,
|
||||
int deltaX,
|
||||
int deltaY) override;
|
||||
void SendTouchEvent(const CefTouchEvent& event) override;
|
||||
void SendFocusEvent(bool setFocus) override;
|
||||
gfx::Point GetScreenPoint(const gfx::Point& view) const override;
|
||||
void ViewText(const std::string& text) override;
|
||||
bool HandleKeyboardEvent(
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
void TranslateKeyEvent(content::NativeWebKeyboardEvent& result,
|
||||
const CefKeyEvent& key_event) const override;
|
||||
void TranslateClickEvent(blink::WebMouseEvent& result,
|
||||
const CefMouseEvent& mouse_event,
|
||||
CefBrowserHost::MouseButtonType type,
|
||||
bool mouseUp,
|
||||
int clickCount) const override;
|
||||
void TranslateMoveEvent(blink::WebMouseEvent& result,
|
||||
const CefMouseEvent& mouse_event,
|
||||
bool mouseLeave) const override;
|
||||
void TranslateWheelEvent(blink::WebMouseWheelEvent& result,
|
||||
const CefMouseEvent& mouse_event,
|
||||
int deltaX,
|
||||
int deltaY) const override;
|
||||
CefEventHandle GetEventHandle(
|
||||
const content::NativeWebKeyboardEvent& event) const override;
|
||||
std::unique_ptr<CefFileDialogRunner> CreateFileDialogRunner() override;
|
||||
|
@@ -50,13 +50,28 @@ CefComponentExtensionResourceManager::GetTemplateReplacementsForExtension(
|
||||
void CefComponentExtensionResourceManager::AddComponentResourceEntries(
|
||||
const GritResourceMap* entries,
|
||||
size_t size) {
|
||||
base::FilePath gen_folder_path = base::FilePath().AppendASCII(
|
||||
"@out_folder@/gen/chrome/browser/resources/");
|
||||
gen_folder_path = gen_folder_path.NormalizePathSeparators();
|
||||
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
base::FilePath resource_path =
|
||||
base::FilePath().AppendASCII(entries[i].name);
|
||||
resource_path = resource_path.NormalizePathSeparators();
|
||||
|
||||
DCHECK(!base::Contains(path_to_resource_info_, resource_path));
|
||||
path_to_resource_info_[resource_path] = entries[i].value;
|
||||
if (!gen_folder_path.IsParent(resource_path)) {
|
||||
DCHECK(!base::Contains(path_to_resource_info_, resource_path));
|
||||
path_to_resource_info_[resource_path] = entries[i].value;
|
||||
} else {
|
||||
// If the resource is a generated file, strip the generated folder's path,
|
||||
// so that it can be served from a normal URL (as if it were not
|
||||
// generated).
|
||||
base::FilePath effective_path =
|
||||
base::FilePath().AppendASCII(resource_path.AsUTF8Unsafe().substr(
|
||||
gen_folder_path.value().length()));
|
||||
DCHECK(!base::Contains(path_to_resource_info_, effective_path));
|
||||
path_to_resource_info_[effective_path] = entries[i].value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -44,10 +44,9 @@ class CefGetExtensionLoadFileCallbackImpl
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
RunNow(file_, std::move(callback_), nullptr);
|
||||
} else {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefGetExtensionLoadFileCallbackImpl::RunNow, file_,
|
||||
base::Passed(std::move(callback_)), nullptr));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(
|
||||
&CefGetExtensionLoadFileCallbackImpl::RunNow,
|
||||
file_, std::move(callback_), nullptr));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,10 +55,9 @@ class CefGetExtensionLoadFileCallbackImpl
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!callback_.is_null()) {
|
||||
// Always continue asynchronously.
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefGetExtensionLoadFileCallbackImpl::RunNow, file_,
|
||||
base::Passed(std::move(callback_)), stream));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(
|
||||
&CefGetExtensionLoadFileCallbackImpl::RunNow,
|
||||
file_, std::move(callback_), stream));
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(
|
||||
@@ -373,7 +371,7 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab(
|
||||
create_params.window_info.reset(new CefWindowInfo);
|
||||
|
||||
#if defined(OS_WIN)
|
||||
create_params.window_info->SetAsPopup(NULL, CefString());
|
||||
create_params.window_info->SetAsPopup(nullptr, CefString());
|
||||
#endif
|
||||
|
||||
// Start with the active browser's settings.
|
||||
@@ -408,11 +406,8 @@ base::DictionaryValue* CefExtensionFunctionDetails::OpenTab(
|
||||
auto scrub_tab_behavior = ExtensionTabUtil::GetScrubTabBehavior(
|
||||
extension, extensions::Feature::Context::UNSPECIFIED_CONTEXT,
|
||||
web_contents);
|
||||
if (scrub_tab_behavior != ExtensionTabUtil::kDontScrubTab) {
|
||||
ExtensionTabUtil::ScrubTabForExtension(extension, web_contents,
|
||||
result.get(), scrub_tab_behavior);
|
||||
}
|
||||
|
||||
ExtensionTabUtil::ScrubTabForExtension(extension, web_contents, result.get(),
|
||||
scrub_tab_behavior);
|
||||
return result->ToValue().release();
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ content::JavaScriptDialogManager*
|
||||
CefExtensionHostDelegate::GetJavaScriptDialogManager() {
|
||||
// Never routed here from CefBrowserHostImpl.
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefExtensionHostDelegate::CreateTab(
|
||||
@@ -59,10 +59,6 @@ bool CefExtensionHostDelegate::CheckMediaAccessPermission(
|
||||
return false;
|
||||
}
|
||||
|
||||
ExtensionHostQueue* CefExtensionHostDelegate::GetExtensionHostQueue() const {
|
||||
return CefExtensionsBrowserClient::Get()->GetExtensionHostQueue();
|
||||
}
|
||||
|
||||
content::PictureInPictureResult CefExtensionHostDelegate::EnterPictureInPicture(
|
||||
content::WebContents* web_contents,
|
||||
const viz::SurfaceId& surface_id,
|
||||
|
@@ -34,7 +34,6 @@ class CefExtensionHostDelegate : public ExtensionHostDelegate {
|
||||
const GURL& security_origin,
|
||||
blink::mojom::MediaStreamType type,
|
||||
const Extension* extension) override;
|
||||
ExtensionHostQueue* GetExtensionHostQueue() const override;
|
||||
content::PictureInPictureResult EnterPictureInPicture(
|
||||
content::WebContents* web_contents,
|
||||
const viz::SurfaceId& surface_id,
|
||||
|
@@ -44,6 +44,7 @@
|
||||
#include "extensions/browser/runtime_data.h"
|
||||
#include "extensions/browser/service_worker_manager.h"
|
||||
#include "extensions/browser/state_store.h"
|
||||
#include "extensions/browser/unloaded_extension_reason.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/extension_messages.h"
|
||||
#include "extensions/common/file_util.h"
|
||||
@@ -63,11 +64,12 @@ namespace {
|
||||
std::unique_ptr<base::DictionaryValue> ParseManifest(
|
||||
const std::string& manifest_contents) {
|
||||
JSONStringValueDeserializer deserializer(manifest_contents);
|
||||
std::unique_ptr<base::Value> manifest(deserializer.Deserialize(NULL, NULL));
|
||||
std::unique_ptr<base::Value> manifest(
|
||||
deserializer.Deserialize(nullptr, nullptr));
|
||||
|
||||
if (!manifest.get() || !manifest->is_dict()) {
|
||||
LOG(ERROR) << "Failed to parse extension manifest.";
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
// Transfer ownership to the caller.
|
||||
return base::WrapUnique(
|
||||
@@ -95,9 +97,8 @@ void LoadExtensionOnUIThread(base::WeakPtr<CefExtensionSystem> context,
|
||||
CefRefPtr<CefExtensionHandler> handler) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(LoadExtensionOnUIThread, context,
|
||||
base::Passed(std::move(manifest)),
|
||||
root_directory, internal,
|
||||
loader_context, handler));
|
||||
std::move(manifest), root_directory,
|
||||
internal, loader_context, handler));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -184,48 +185,78 @@ void CefExtensionSystem::Init() {
|
||||
content::NotificationService::NoDetails());
|
||||
|
||||
// Add the internal PDF extension. PDF loading works as follows:
|
||||
// 1. PDF PPAPI plugin is registered to handle kPDFPluginOutOfProcessMimeType
|
||||
// in libcef/common/content_client.cc ComputeBuiltInPlugins.
|
||||
// 2. PDF extension is registered and associated with the "application/pdf"
|
||||
// mime type by the below call to AddExtension.
|
||||
// 3. A page requests a resource with the "application/pdf" mime type. For
|
||||
// example, by loading a PDF file.
|
||||
// 1. The PDF PPAPI plugin is registered in libcef/common/content_client.cc
|
||||
// ComputeBuiltInPlugins to handle the kPDFPluginOutOfProcessMimeType.
|
||||
// 2. The PDF extension is registered by the below call to AddExtension and
|
||||
// associated with the "application/pdf" mime type.
|
||||
// 3. Web content running in the owner CefBrowser requests to load a PDF file
|
||||
// resource with the "application/pdf" mime type. This can be via a frame
|
||||
// (main frame/iframe) or object/embed tag.
|
||||
// 4. PluginResponseInterceptorURLLoaderThrottle intercepts the PDF resource
|
||||
// load in the browser process, generates a
|
||||
// unique View ID that is associated with the resource request for later
|
||||
// retrieval via MimeHandlerStreamManager and the
|
||||
// chrome.mimeHandlerPrivate JS API (extensions/common/api/
|
||||
// mime_handler_private.idl), and returns the unique View ID via the
|
||||
// |payload| argument.
|
||||
// 5. The unique View ID arrives in the renderer process via
|
||||
// ResourceLoader::DidReceiveData and triggers creation of a new Document.
|
||||
// DOMImplementation::createDocument indirectly calls
|
||||
// RendererBlinkPlatformImpl::getPluginList to retrieve the list of
|
||||
// supported plugins from the browser process. If a plugin supports the
|
||||
// "application/pdf" mime type then a PluginDocument is created and
|
||||
// CefContentRendererClient::OverrideCreatePlugin is called. This then
|
||||
// indirectly calls CefContentRendererClient::CreateBrowserPluginDelegate
|
||||
// to create a MimeHandlerViewContainer.
|
||||
// 6. A MimeHandlerViewGuest and CefMimeHandlerViewGuestDelegate is created in
|
||||
// the browser process.
|
||||
// 7. MimeHandlerViewGuest navigates to the PDF extension URL.
|
||||
// 8. Access to PDF extension resources is checked by
|
||||
// CefExtensionsBrowserClient::AllowCrossRendererResourceLoad.
|
||||
// 9. PDF extension resources are provided from bundle via
|
||||
// CefExtensionsBrowserClient::LoadResourceFromResourceBundle,
|
||||
// CefContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories
|
||||
// and CefComponentExtensionResourceManager.
|
||||
// 10.The PDF extension (chrome/browser/resources/pdf/browser_api.js) calls
|
||||
// chrome.mimeHandlerPrivate.getStreamInfo to retrieve the PDF resource
|
||||
// stream. This API is implemented using Mojo as described in
|
||||
// libcef/common/extensions/api/README.txt.
|
||||
// 11.The PDF extension requests a plugin to handle
|
||||
// kPDFPluginOutOfProcessMimeType which loads the PDF PPAPI plugin.
|
||||
// 12.Routing of print-related commands are handled by ChromePDFPrintClient
|
||||
// and CefPrintRenderFrameHelperDelegate in the renderer process.
|
||||
// 13.The PDF extension is granted access to chrome://resources via
|
||||
// CefExtensionWebContentsObserver::RenderViewCreated in the browser
|
||||
// load in the browser process and registers the PDF resource as a stream
|
||||
// via MimeHandlerStreamManager::AddStream.
|
||||
// 5. PluginResponseInterceptorURLLoaderThrottle::WillProcessResponse triggers
|
||||
// creation of a MimeHandlerViewEmbedder in the browser process via
|
||||
// MimeHandlerViewAttachHelper::OverrideBodyForInterceptedResponse.
|
||||
// 6. MimeHandlerViewEmbedder::ReadyToCommitNavigation is called and sends a
|
||||
// Mojo message to MimeHandlerViewContainerManager::SetInternalId in the
|
||||
// owner renderer process.
|
||||
// 7. The MimeHandlerViewContainerManager is created in the owner renderer
|
||||
// process via MimeHandlerViewContainerManager::BindReceiver and the
|
||||
// SetInternalId call arrives.
|
||||
// 8. HTMLPlugInElement::RequestObject is called in the owner renderer process
|
||||
// to handle the PDF file frame/object/embed tag. This results in calls to
|
||||
// ContentBrowserClient::GetPluginMimeTypesWithExternalHandlers (browser
|
||||
// process) and ContentRendererClient::IsPluginHandledExternally (owner
|
||||
// renderer process), and determines that the plugin should be handled
|
||||
// externally (handled_externally=true).
|
||||
// 9. MimeHandlerViewContainerManager::IsManagedByContainerManager sends a
|
||||
// Mojo message to MimeHandlerViewEmbedder::ReadyToCreateMimeHandlerView
|
||||
// in the browser process.
|
||||
// 10.MimeHandlerViewEmbedder::RenderFrameCreated triggers creation of a
|
||||
// MimeHandlerViewGuest and CefMimeHandlerViewGuestDelegate in the browser
|
||||
// process.
|
||||
// 11.MimeHandlerViewGuest::CreateWebContents creates a new guest WebContents
|
||||
// (is_guest_view=true) to host the PDF extension and the PDF resource
|
||||
// stream is retrieved via MimeHandlerStreamManager::ReleaseStream.
|
||||
// 12.MimeHandlerViewGuest::DidAttachToEmbedder calls
|
||||
// CefMimeHandlerViewGuestDelegate::OnGuestAttached to associate the guest
|
||||
// WebContents routing IDs with the owner CefBrowser. MimeHandlerViewGuest
|
||||
// then loads the extension URL (index.html) in the guest WebContents.
|
||||
// 13.Creation of the RenderFrame in the guest renderer process triggers a
|
||||
// sync IPC call from CefContentRendererClient::MaybeCreateBrowser to
|
||||
// CefBrowserInfoManager::GetBrowserInfo in the browser process to retrieve
|
||||
// the CefBrowser information, which will be immediately available due to
|
||||
// step 12.
|
||||
// 14.The PDF extension begins to load. Extension resource requests are
|
||||
// handled via ExtensionURLLoaderFactory::CreateLoaderAndStart in the
|
||||
// browser process. Access to PDF extension resources is checked by
|
||||
// CefExtensionsBrowserClient::AllowCrossRendererResourceLoad and
|
||||
// PDF extension resources are provided from bundle via
|
||||
// CefExtensionsBrowserClient::LoadResourceFromResourceBundle
|
||||
// and CefComponentExtensionResourceManager. Access to chrome://resources
|
||||
// is granted via CefExtensionWebContentsObserver::RenderViewCreated.
|
||||
// 15.The PDF extension calls chrome.mimeHandlerPrivate.getStreamInfo
|
||||
// (chrome/browser/resources/pdf/browser_api.js) to retrieve the PDF
|
||||
// resource stream. This API is implemented using Mojo as described in
|
||||
// libcef/common/extensions/api/README.txt.
|
||||
// 16.The PDF extension requests the PDF PPAPI plugin to handle
|
||||
// kPDFPluginOutOfProcessMimeType. Approval arrives in the guest renderer
|
||||
// process via ExtensionFrameHelper::OnExtensionResponse which calls
|
||||
// NativeExtensionBindingsSystem::HandleResponse. This triggers creation of
|
||||
// an HTMLPlugInElement via native V8 bindings to host the PDF plugin.
|
||||
// 17.HTMLPlugInElement::RequestObject is called in the guest renderer process
|
||||
// and determines that the PDF PPAPI plugin should be handled internally
|
||||
// (handled_externally=false). A PluginDocument is created and
|
||||
// CefContentRendererClient::OverrideCreatePlugin is called to create a
|
||||
// WebPlugin.
|
||||
// 18.The PDF extension and PDF plugin are now loaded. Print commands, if
|
||||
// any, are handled in the guest renderer process by ChromePDFPrintClient
|
||||
// and CefPrintRenderFrameHelperDelegate.
|
||||
// 19.When navigating away from the PDF file or closing the owner CefBrowser
|
||||
// the guest WebContents will be destroyed. This triggers a call to
|
||||
// CefMimeHandlerViewGuestDelegate::OnGuestDetached which removes the
|
||||
// routing ID association with the owner CefBrowser.
|
||||
if (PdfExtensionEnabled()) {
|
||||
LoadExtension(ParseManifest(pdf_extension_util::GetManifest()),
|
||||
base::FilePath(FILE_PATH_LITERAL("pdf")), true /* internal */,
|
||||
@@ -416,7 +447,7 @@ AppSorting* CefExtensionSystem::app_sorting() {
|
||||
// ExtensionSystemImpl::RegisterExtensionWithRequestContexts.
|
||||
void CefExtensionSystem::RegisterExtensionWithRequestContexts(
|
||||
const Extension* extension,
|
||||
const base::Closure& callback) {
|
||||
base::OnceClosure callback) {
|
||||
// TODO(extensions): The |incognito_enabled| value should be set based on
|
||||
// manifest settings.
|
||||
base::PostTaskAndReply(
|
||||
@@ -425,7 +456,7 @@ void CefExtensionSystem::RegisterExtensionWithRequestContexts(
|
||||
base::RetainedRef(extension), base::Time::Now(),
|
||||
true, // incognito_enabled
|
||||
false), // notifications_disabled
|
||||
callback);
|
||||
std::move(callback));
|
||||
}
|
||||
|
||||
// Implementation based on
|
||||
|
@@ -102,7 +102,7 @@ class CefExtensionSystem : public ExtensionSystem {
|
||||
AppSorting* app_sorting() override;
|
||||
void RegisterExtensionWithRequestContexts(
|
||||
const Extension* extension,
|
||||
const base::Closure& callback) override;
|
||||
base::OnceClosure callback) override;
|
||||
void UnregisterExtensionWithRequestContexts(
|
||||
const std::string& extension_id,
|
||||
const UnloadedExtensionReason reason) override;
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include "extensions/browser/extension_system.h"
|
||||
#include "extensions/browser/notification_types.h"
|
||||
#include "extensions/browser/runtime_data.h"
|
||||
#include "third_party/blink/public/platform/web_gesture_event.h"
|
||||
#include "third_party/blink/public/common/input/web_gesture_event.h"
|
||||
|
||||
using content::NativeWebKeyboardEvent;
|
||||
using content::OpenURLParams;
|
||||
|
@@ -27,7 +27,7 @@ AppViewGuestDelegate* CefExtensionsAPIClient::CreateAppViewGuestDelegate()
|
||||
const {
|
||||
// TODO(extensions): Implement to support Apps.
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<guest_view::GuestViewManagerDelegate>
|
||||
|
@@ -24,14 +24,16 @@
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
#include "extensions/browser/api/extensions_api_client.h"
|
||||
#include "extensions/browser/api/mime_handler_private/mime_handler_private.h"
|
||||
#include "extensions/browser/api/runtime/runtime_api_delegate.h"
|
||||
#include "extensions/browser/app_sorting.h"
|
||||
#include "extensions/browser/core_extensions_browser_api_provider.h"
|
||||
#include "extensions/browser/event_router.h"
|
||||
#include "extensions/browser/extension_host_delegate.h"
|
||||
#include "extensions/browser/mojo/interface_registration.h"
|
||||
#include "extensions/browser/serial_extension_host_queue.h"
|
||||
#include "extensions/browser/extensions_browser_interface_binders.h"
|
||||
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
|
||||
#include "extensions/browser/url_request_util.h"
|
||||
#include "extensions/common/api/mime_handler.mojom.h"
|
||||
#include "extensions/common/constants.h"
|
||||
|
||||
using content::BrowserContext;
|
||||
@@ -39,6 +41,41 @@ using content::BrowserThread;
|
||||
|
||||
namespace extensions {
|
||||
|
||||
namespace {
|
||||
|
||||
void BindMimeHandlerService(
|
||||
content::RenderFrameHost* frame_host,
|
||||
mojo::PendingReceiver<extensions::mime_handler::MimeHandlerService>
|
||||
receiver) {
|
||||
auto* web_contents = content::WebContents::FromRenderFrameHost(frame_host);
|
||||
if (!web_contents)
|
||||
return;
|
||||
|
||||
auto* guest_view =
|
||||
extensions::MimeHandlerViewGuest::FromWebContents(web_contents);
|
||||
if (!guest_view)
|
||||
return;
|
||||
extensions::MimeHandlerServiceImpl::Create(guest_view->GetStreamWeakPtr(),
|
||||
std::move(receiver));
|
||||
}
|
||||
|
||||
void BindBeforeUnloadControl(
|
||||
content::RenderFrameHost* frame_host,
|
||||
mojo::PendingReceiver<extensions::mime_handler::BeforeUnloadControl>
|
||||
receiver) {
|
||||
auto* web_contents = content::WebContents::FromRenderFrameHost(frame_host);
|
||||
if (!web_contents)
|
||||
return;
|
||||
|
||||
auto* guest_view =
|
||||
extensions::MimeHandlerViewGuest::FromWebContents(web_contents);
|
||||
if (!guest_view)
|
||||
return;
|
||||
guest_view->FuseBeforeUnloadControl(std::move(receiver));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefExtensionsBrowserClient::CefExtensionsBrowserClient()
|
||||
: api_client_(new CefExtensionsAPIClient),
|
||||
resource_manager_(new CefComponentExtensionResourceManager) {
|
||||
@@ -65,7 +102,7 @@ bool CefExtensionsBrowserClient::AreExtensionsDisabled(
|
||||
}
|
||||
|
||||
bool CefExtensionsBrowserClient::IsValidContext(BrowserContext* context) {
|
||||
return GetOriginalContext(context) != NULL;
|
||||
return GetOriginalContext(context) != nullptr;
|
||||
}
|
||||
|
||||
bool CefExtensionsBrowserClient::IsSameContext(BrowserContext* first,
|
||||
@@ -83,7 +120,7 @@ bool CefExtensionsBrowserClient::HasOffTheRecordContext(
|
||||
|
||||
BrowserContext* CefExtensionsBrowserClient::GetOffTheRecordContext(
|
||||
BrowserContext* context) {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BrowserContext* CefExtensionsBrowserClient::GetOriginalContext(
|
||||
@@ -117,11 +154,11 @@ base::FilePath CefExtensionsBrowserClient::GetBundleResourcePath(
|
||||
|
||||
void CefExtensionsBrowserClient::LoadResourceFromResourceBundle(
|
||||
const network::ResourceRequest& request,
|
||||
network::mojom::URLLoaderRequest loader,
|
||||
mojo::PendingReceiver<network::mojom::URLLoader> loader,
|
||||
const base::FilePath& resource_relative_path,
|
||||
const int resource_id,
|
||||
const std::string& content_security_policy,
|
||||
network::mojom::URLLoaderClientPtr client,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||
bool send_cors_header) {
|
||||
chrome_url_request_util::LoadResourceFromResourceBundle(
|
||||
request, std::move(loader), resource_relative_path, resource_id,
|
||||
@@ -159,7 +196,7 @@ void CefExtensionsBrowserClient::GetEarlyExtensionPrefsObservers(
|
||||
|
||||
ProcessManagerDelegate* CefExtensionsBrowserClient::GetProcessManagerDelegate()
|
||||
const {
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<ExtensionHostDelegate>
|
||||
@@ -257,12 +294,16 @@ CefExtensionsBrowserClient::GetExtensionSystemFactory() {
|
||||
return CefExtensionSystemFactory::GetInstance();
|
||||
}
|
||||
|
||||
void CefExtensionsBrowserClient::RegisterExtensionInterfaces(
|
||||
service_manager::BinderRegistryWithArgs<content::RenderFrameHost*>*
|
||||
registry,
|
||||
void CefExtensionsBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const Extension* extension) const {
|
||||
RegisterInterfacesForExtension(registry, render_frame_host, extension);
|
||||
PopulateExtensionFrameBinders(map, render_frame_host, extension);
|
||||
|
||||
map->Add<extensions::mime_handler::MimeHandlerService>(
|
||||
base::BindRepeating(&BindMimeHandlerService));
|
||||
map->Add<extensions::mime_handler::BeforeUnloadControl>(
|
||||
base::BindRepeating(&BindBeforeUnloadControl));
|
||||
}
|
||||
|
||||
std::unique_ptr<RuntimeAPIDelegate>
|
||||
@@ -291,7 +332,7 @@ void CefExtensionsBrowserClient::BroadcastEventToRenderers(
|
||||
ExtensionCache* CefExtensionsBrowserClient::GetExtensionCache() {
|
||||
// Only used by Chrome via ExtensionService.
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CefExtensionsBrowserClient::IsBackgroundUpdateAllowed() {
|
||||
@@ -311,7 +352,7 @@ CefExtensionsBrowserClient::GetExtensionWebContentsObserver(
|
||||
|
||||
KioskDelegate* CefExtensionsBrowserClient::GetKioskDelegate() {
|
||||
NOTREACHED();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool CefExtensionsBrowserClient::IsLockScreenContext(
|
||||
@@ -323,10 +364,4 @@ std::string CefExtensionsBrowserClient::GetApplicationLocale() {
|
||||
return g_browser_process->GetApplicationLocale();
|
||||
}
|
||||
|
||||
ExtensionHostQueue* CefExtensionsBrowserClient::GetExtensionHostQueue() {
|
||||
if (!extension_host_queue_)
|
||||
extension_host_queue_.reset(new SerialExtensionHostQueue);
|
||||
return extension_host_queue_.get();
|
||||
}
|
||||
|
||||
} // namespace extensions
|
||||
|
@@ -11,7 +11,6 @@
|
||||
|
||||
namespace extensions {
|
||||
|
||||
class ExtensionHostQueue;
|
||||
class ExtensionsAPIClient;
|
||||
|
||||
// An ExtensionsBrowserClient that supports a single content::BrowserContent
|
||||
@@ -49,11 +48,11 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
int* resource_id) const override;
|
||||
void LoadResourceFromResourceBundle(
|
||||
const network::ResourceRequest& request,
|
||||
network::mojom::URLLoaderRequest loader,
|
||||
mojo::PendingReceiver<network::mojom::URLLoader> loader,
|
||||
const base::FilePath& resource_relative_path,
|
||||
const int resource_id,
|
||||
const std::string& content_security_policy,
|
||||
network::mojom::URLLoaderClientPtr client,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||
bool send_cors_header) override;
|
||||
bool AllowCrossRendererResourceLoad(const GURL& url,
|
||||
content::ResourceType resource_type,
|
||||
@@ -82,10 +81,11 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
bool IsAppModeForcedForApp(const ExtensionId& extension_id) override;
|
||||
bool IsLoggedInAsPublicAccount() override;
|
||||
ExtensionSystemProvider* GetExtensionSystemFactory() override;
|
||||
void RegisterExtensionInterfaces(service_manager::BinderRegistryWithArgs<
|
||||
content::RenderFrameHost*>* registry,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const Extension* extension) const override;
|
||||
void RegisterBrowserInterfaceBindersForFrame(
|
||||
service_manager::BinderMapWithContext<content::RenderFrameHost*>*
|
||||
binder_map,
|
||||
content::RenderFrameHost* render_frame_host,
|
||||
const Extension* extension) const override;
|
||||
std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
|
||||
content::BrowserContext* context) const override;
|
||||
const ComponentExtensionResourceManager*
|
||||
@@ -104,8 +104,6 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
bool IsLockScreenContext(content::BrowserContext* context) override;
|
||||
std::string GetApplicationLocale() override;
|
||||
|
||||
ExtensionHostQueue* GetExtensionHostQueue();
|
||||
|
||||
private:
|
||||
// Support for extension APIs.
|
||||
std::unique_ptr<ExtensionsAPIClient> api_client_;
|
||||
@@ -113,9 +111,6 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
|
||||
// Resource manager used to supply resources from pak files.
|
||||
std::unique_ptr<ComponentExtensionResourceManager> resource_manager_;
|
||||
|
||||
// Used to create deferred RenderViews for extensions.
|
||||
std::unique_ptr<ExtensionHostQueue> extension_host_queue_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefExtensionsBrowserClient);
|
||||
};
|
||||
|
||||
|
@@ -17,22 +17,9 @@
|
||||
|
||||
namespace extensions {
|
||||
|
||||
namespace {
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> GetOwnerBrowser(
|
||||
extensions::MimeHandlerViewGuest* guest) {
|
||||
content::WebContents* owner_web_contents = guest->owner_web_contents();
|
||||
CefRefPtr<CefBrowserHostImpl> owner_browser =
|
||||
CefBrowserHostImpl::GetBrowserForContents(owner_web_contents);
|
||||
DCHECK(owner_browser);
|
||||
return owner_browser;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefMimeHandlerViewGuestDelegate::CefMimeHandlerViewGuestDelegate(
|
||||
MimeHandlerViewGuest* guest)
|
||||
: guest_(guest) {}
|
||||
: guest_(guest), owner_web_contents_(guest_->owner_web_contents()) {}
|
||||
|
||||
CefMimeHandlerViewGuestDelegate::~CefMimeHandlerViewGuestDelegate() {}
|
||||
|
||||
@@ -40,7 +27,10 @@ void CefMimeHandlerViewGuestDelegate::OverrideWebContentsCreateParams(
|
||||
content::WebContents::CreateParams* params) {
|
||||
DCHECK(params->guest_delegate);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> owner_browser = GetOwnerBrowser(guest_);
|
||||
CefRefPtr<CefBrowserHostImpl> owner_browser =
|
||||
CefBrowserHostImpl::GetBrowserForContents(owner_web_contents_);
|
||||
DCHECK(owner_browser);
|
||||
|
||||
if (owner_browser->IsWindowless()) {
|
||||
CefWebContentsViewOSR* view_osr = new CefWebContentsViewOSR(
|
||||
owner_browser->GetBackgroundColor(), false, false);
|
||||
@@ -49,24 +39,29 @@ void CefMimeHandlerViewGuestDelegate::OverrideWebContentsCreateParams(
|
||||
}
|
||||
}
|
||||
|
||||
void CefMimeHandlerViewGuestDelegate::OnGuestAttached(
|
||||
content::WebContentsView* parent_view) {
|
||||
void CefMimeHandlerViewGuestDelegate::OnGuestAttached() {
|
||||
content::WebContents* web_contents = guest_->web_contents();
|
||||
DCHECK(web_contents);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> owner_browser =
|
||||
CefBrowserHostImpl::GetBrowserForContents(owner_web_contents_);
|
||||
DCHECK(owner_browser);
|
||||
|
||||
// Associate guest state information with the owner browser.
|
||||
GetOwnerBrowser(guest_)->browser_info()->MaybeCreateFrame(
|
||||
web_contents->GetMainFrame(), true /* is_guest_view */);
|
||||
owner_browser->browser_info()->MaybeCreateFrame(web_contents->GetMainFrame(),
|
||||
true /* is_guest_view */);
|
||||
}
|
||||
|
||||
void CefMimeHandlerViewGuestDelegate::OnGuestDetached(
|
||||
content::WebContentsView* parent_view) {
|
||||
void CefMimeHandlerViewGuestDelegate::OnGuestDetached() {
|
||||
content::WebContents* web_contents = guest_->web_contents();
|
||||
DCHECK(web_contents);
|
||||
|
||||
CefRefPtr<CefBrowserHostImpl> owner_browser =
|
||||
CefBrowserHostImpl::GetBrowserForContents(owner_web_contents_);
|
||||
DCHECK(owner_browser);
|
||||
|
||||
// Disassociate guest state information with the owner browser.
|
||||
GetOwnerBrowser(guest_)->browser_info()->RemoveFrame(
|
||||
web_contents->GetMainFrame());
|
||||
owner_browser->browser_info()->RemoveFrame(web_contents->GetMainFrame());
|
||||
}
|
||||
|
||||
bool CefMimeHandlerViewGuestDelegate::HandleContextMenu(
|
||||
@@ -83,7 +78,11 @@ bool CefMimeHandlerViewGuestDelegate::HandleContextMenu(
|
||||
new_params.x += guest_coordinates.x();
|
||||
new_params.y += guest_coordinates.y();
|
||||
|
||||
return GetOwnerBrowser(guest_)->HandleContextMenu(web_contents, new_params);
|
||||
CefRefPtr<CefBrowserHostImpl> owner_browser =
|
||||
CefBrowserHostImpl::GetBrowserForContents(owner_web_contents_);
|
||||
DCHECK(owner_browser);
|
||||
|
||||
return owner_browser->HandleContextMenu(web_contents, new_params);
|
||||
}
|
||||
|
||||
} // namespace extensions
|
||||
|
@@ -23,13 +23,14 @@ class CefMimeHandlerViewGuestDelegate : public MimeHandlerViewGuestDelegate {
|
||||
// MimeHandlerViewGuestDelegate methods.
|
||||
void OverrideWebContentsCreateParams(
|
||||
content::WebContents::CreateParams* params) override;
|
||||
void OnGuestAttached(content::WebContentsView* parent_view) override;
|
||||
void OnGuestDetached(content::WebContentsView* parent_view) override;
|
||||
void OnGuestAttached() override;
|
||||
void OnGuestDetached() override;
|
||||
bool HandleContextMenu(content::WebContents* web_contents,
|
||||
const content::ContextMenuParams& params) override;
|
||||
|
||||
private:
|
||||
MimeHandlerViewGuest* guest_; // Owns us.
|
||||
content::WebContents* owner_web_contents_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefMimeHandlerViewGuestDelegate);
|
||||
};
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "libcef/browser/extensions/pdf_web_contents_helper_client.h"
|
||||
|
||||
#include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
CefPDFWebContentsHelperClient::CefPDFWebContentsHelperClient() {}
|
||||
@@ -21,6 +23,11 @@ void CefPDFWebContentsHelperClient::OnSaveURL(content::WebContents* contents) {}
|
||||
|
||||
void CefPDFWebContentsHelperClient::SetPluginCanSave(
|
||||
content::WebContents* contents,
|
||||
bool can_save) {}
|
||||
bool can_save) {
|
||||
auto* guest_view =
|
||||
extensions::MimeHandlerViewGuest::FromWebContents(contents);
|
||||
if (guest_view)
|
||||
guest_view->SetPluginCanSave(can_save);
|
||||
}
|
||||
|
||||
} // namespace extensions
|
||||
|
@@ -61,7 +61,7 @@ ValueStore::ReadResult CefValueStore::Get(
|
||||
auto settings = std::make_unique<base::DictionaryValue>();
|
||||
for (std::vector<std::string>::const_iterator it = keys.begin();
|
||||
it != keys.end(); ++it) {
|
||||
base::Value* value = NULL;
|
||||
base::Value* value = nullptr;
|
||||
if (storage_.GetWithoutPathExpansion(*it, &value)) {
|
||||
settings->SetWithoutPathExpansion(*it, value->CreateDeepCopy());
|
||||
}
|
||||
@@ -94,7 +94,7 @@ ValueStore::WriteResult CefValueStore::Set(
|
||||
std::unique_ptr<ValueStoreChangeList> changes(new ValueStoreChangeList());
|
||||
for (base::DictionaryValue::Iterator it(settings); !it.IsAtEnd();
|
||||
it.Advance()) {
|
||||
base::Value* old_value = NULL;
|
||||
base::Value* old_value = nullptr;
|
||||
if (!storage_.GetWithoutPathExpansion(it.key(), &old_value) ||
|
||||
!old_value->Equals(&it.value())) {
|
||||
changes->push_back(ValueStoreChange(
|
||||
|
@@ -20,17 +20,20 @@ namespace {
|
||||
|
||||
class CefFileDialogCallbackImpl : public CefFileDialogCallback {
|
||||
public:
|
||||
explicit CefFileDialogCallbackImpl(
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback)
|
||||
: callback_(callback) {}
|
||||
using CallbackType = CefFileDialogRunner::RunFileChooserCallback;
|
||||
|
||||
explicit CefFileDialogCallbackImpl(CallbackType callback)
|
||||
: callback_(std::move(callback)) {}
|
||||
|
||||
~CefFileDialogCallbackImpl() override {
|
||||
if (!callback_.is_null()) {
|
||||
// The callback is still pending. Cancel it now.
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
CancelNow(callback_);
|
||||
CancelNow(std::move(callback_));
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefFileDialogCallbackImpl::CancelNow,
|
||||
callback_));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefFileDialogCallbackImpl::CancelNow,
|
||||
std::move(callback_)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,41 +48,36 @@ class CefFileDialogCallbackImpl : public CefFileDialogCallback {
|
||||
for (; it != file_paths.end(); ++it)
|
||||
vec.push_back(base::FilePath(*it));
|
||||
}
|
||||
callback_.Run(selected_accept_filter, vec);
|
||||
callback_.Reset();
|
||||
std::move(callback_).Run(selected_accept_filter, vec);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefFileDialogCallbackImpl::Continue, this,
|
||||
selected_accept_filter, file_paths));
|
||||
base::BindOnce(&CefFileDialogCallbackImpl::Continue, this,
|
||||
selected_accept_filter, file_paths));
|
||||
}
|
||||
}
|
||||
|
||||
void Cancel() override {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!callback_.is_null()) {
|
||||
CancelNow(callback_);
|
||||
callback_.Reset();
|
||||
CancelNow(std::move(callback_));
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefFileDialogCallbackImpl::Cancel, this));
|
||||
base::BindOnce(&CefFileDialogCallbackImpl::Cancel, this));
|
||||
}
|
||||
}
|
||||
|
||||
bool IsConnected() { return !callback_.is_null(); }
|
||||
|
||||
void Disconnect() { callback_.Reset(); }
|
||||
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
|
||||
private:
|
||||
static void CancelNow(
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback) {
|
||||
static void CancelNow(CallbackType callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
std::vector<base::FilePath> file_paths;
|
||||
callback.Run(0, file_paths);
|
||||
std::move(callback).Run(0, file_paths);
|
||||
}
|
||||
|
||||
CefFileDialogRunner::RunFileChooserCallback callback_;
|
||||
CallbackType callback_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefFileDialogCallbackImpl);
|
||||
};
|
||||
@@ -99,16 +97,16 @@ class UploadFolderHelper
|
||||
: public net::DirectoryLister::DirectoryListerDelegate {
|
||||
public:
|
||||
explicit UploadFolderHelper(
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback)
|
||||
: callback_(callback) {}
|
||||
CefFileDialogRunner::RunFileChooserCallback callback)
|
||||
: callback_(std::move(callback)) {}
|
||||
|
||||
~UploadFolderHelper() override {
|
||||
if (!callback_.is_null()) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
CancelNow(callback_);
|
||||
CancelNow(std::move(callback_));
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&UploadFolderHelper::CancelNow, callback_));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&UploadFolderHelper::CancelNow,
|
||||
std::move(callback_)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -123,17 +121,15 @@ class UploadFolderHelper
|
||||
void OnListDone(int error) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!callback_.is_null()) {
|
||||
callback_.Run(0, select_files_);
|
||||
callback_.Reset();
|
||||
std::move(callback_).Run(0, select_files_);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static void CancelNow(
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback) {
|
||||
static void CancelNow(CefFileDialogRunner::RunFileChooserCallback callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
std::vector<base::FilePath> file_paths;
|
||||
callback.Run(0, file_paths);
|
||||
std::move(callback).Run(0, file_paths);
|
||||
}
|
||||
|
||||
CefFileDialogRunner::RunFileChooserCallback callback_;
|
||||
@@ -156,7 +152,7 @@ CefFileDialogManager::~CefFileDialogManager() {}
|
||||
|
||||
void CefFileDialogManager::Destroy() {
|
||||
DCHECK(!file_chooser_pending_);
|
||||
runner_.reset(NULL);
|
||||
runner_.reset(nullptr);
|
||||
}
|
||||
|
||||
void CefFileDialogManager::RunFileDialog(
|
||||
@@ -215,37 +211,35 @@ void CefFileDialogManager::RunFileChooser(
|
||||
|
||||
CefFileDialogRunner::RunFileChooserCallback callback;
|
||||
if (params.mode == blink::mojom::FileChooserParams::Mode::kUploadFolder) {
|
||||
callback = base::Bind(
|
||||
callback = base::BindOnce(
|
||||
&CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode,
|
||||
base::Passed(std::move(listener)));
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode, std::move(listener));
|
||||
} else {
|
||||
callback =
|
||||
base::Bind(&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode,
|
||||
base::Passed(std::move(listener)));
|
||||
callback = base::BindOnce(
|
||||
&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), params.mode, std::move(listener));
|
||||
}
|
||||
|
||||
RunFileChooserInternal(cef_params, callback);
|
||||
RunFileChooserInternal(cef_params, std::move(callback));
|
||||
}
|
||||
|
||||
void CefFileDialogManager::RunFileChooser(
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback) {
|
||||
const CefFileDialogRunner::RunFileChooserCallback& host_callback =
|
||||
base::Bind(&CefFileDialogManager::OnRunFileChooserCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), callback);
|
||||
RunFileChooserInternal(params, host_callback);
|
||||
CefFileDialogRunner::RunFileChooserCallback callback) {
|
||||
CefFileDialogRunner::RunFileChooserCallback host_callback =
|
||||
base::BindOnce(&CefFileDialogManager::OnRunFileChooserCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback));
|
||||
RunFileChooserInternal(params, std::move(host_callback));
|
||||
}
|
||||
|
||||
void CefFileDialogManager::RunFileChooserInternal(
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback) {
|
||||
CefFileDialogRunner::RunFileChooserCallback callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (file_chooser_pending_) {
|
||||
// Dismiss the new dialog immediately.
|
||||
callback.Run(0, std::vector<base::FilePath>());
|
||||
std::move(callback).Run(0, std::vector<base::FilePath>());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -289,35 +283,30 @@ void CefFileDialogManager::RunFileChooserInternal(
|
||||
accept_filters.push_back(*it);
|
||||
|
||||
CefRefPtr<CefFileDialogCallbackImpl> callbackImpl(
|
||||
new CefFileDialogCallbackImpl(callback));
|
||||
new CefFileDialogCallbackImpl(std::move(callback)));
|
||||
handled = handler->OnFileDialog(
|
||||
browser_, static_cast<cef_file_dialog_mode_t>(mode), params.title,
|
||||
params.default_file_name.value(), accept_filters,
|
||||
params.selected_accept_filter, callbackImpl.get());
|
||||
if (!handled) {
|
||||
if (callbackImpl->IsConnected()) {
|
||||
callbackImpl->Disconnect();
|
||||
} else {
|
||||
// User executed the callback even though they returned false.
|
||||
NOTREACHED();
|
||||
handled = true;
|
||||
}
|
||||
// May return nullptr if the client has already executed the callback.
|
||||
callback = callbackImpl->Disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
if (!handled && !callback.is_null()) {
|
||||
if (runner_.get()) {
|
||||
runner_->Run(browser_, params, callback);
|
||||
runner_->Run(browser_, params, std::move(callback));
|
||||
} else {
|
||||
LOG(WARNING) << "No file dialog runner available for this platform";
|
||||
callback.Run(0, std::vector<base::FilePath>());
|
||||
std::move(callback).Run(0, std::vector<base::FilePath>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefFileDialogManager::OnRunFileChooserCallback(
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback,
|
||||
CefFileDialogRunner::RunFileChooserCallback callback,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths) {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -325,8 +314,8 @@ void CefFileDialogManager::OnRunFileChooserCallback(
|
||||
Cleanup();
|
||||
|
||||
// Execute the callback asynchronously.
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(callback, selected_accept_filter, file_paths));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(std::move(callback),
|
||||
selected_accept_filter, file_paths));
|
||||
}
|
||||
|
||||
void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback(
|
||||
@@ -344,10 +333,9 @@ void CefFileDialogManager::OnRunFileChooserUploadFolderDelegateCallback(
|
||||
} else {
|
||||
lister_.reset(new net::DirectoryLister(
|
||||
file_paths[0], net::DirectoryLister::NO_SORT_RECURSIVE,
|
||||
new UploadFolderHelper(
|
||||
base::Bind(&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), mode,
|
||||
base::Passed(std::move(listener))))));
|
||||
new UploadFolderHelper(base::BindOnce(
|
||||
&CefFileDialogManager::OnRunFileChooserDelegateCallback,
|
||||
weak_ptr_factory_.GetWeakPtr(), mode, std::move(listener)))));
|
||||
lister_->Start();
|
||||
}
|
||||
}
|
||||
|
@@ -52,19 +52,18 @@ class CefFileDialogManager {
|
||||
// Run the file chooser dialog specified by |params|. Only a single dialog may
|
||||
// be pending at any given time. |callback| will be executed asynchronously
|
||||
// after the dialog is dismissed or if another dialog is already pending.
|
||||
void RunFileChooser(
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback);
|
||||
void RunFileChooser(const CefFileDialogRunner::FileChooserParams& params,
|
||||
CefFileDialogRunner::RunFileChooserCallback callback);
|
||||
|
||||
private:
|
||||
void RunFileChooserInternal(
|
||||
const CefFileDialogRunner::FileChooserParams& params,
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback);
|
||||
CefFileDialogRunner::RunFileChooserCallback callback);
|
||||
|
||||
// Used with the RunFileChooser variant where the caller specifies a callback
|
||||
// (no associated RenderFrameHost).
|
||||
void OnRunFileChooserCallback(
|
||||
const CefFileDialogRunner::RunFileChooserCallback& callback,
|
||||
CefFileDialogRunner::RunFileChooserCallback callback,
|
||||
int selected_accept_filter,
|
||||
const std::vector<base::FilePath>& file_paths);
|
||||
|
||||
|
@@ -30,7 +30,7 @@ class CefFileDialogRunner {
|
||||
};
|
||||
|
||||
// The argument vector will be empty if the dialog was canceled.
|
||||
typedef base::Callback<void(int, const std::vector<base::FilePath>&)>
|
||||
typedef base::OnceCallback<void(int, const std::vector<base::FilePath>&)>
|
||||
RunFileChooserCallback;
|
||||
|
||||
// Display the file chooser dialog. Execute |callback| on completion.
|
||||
|
@@ -158,13 +158,13 @@ void CefFrameHostImpl::GetText(CefRefPtr<CefStringVisitor> visitor) {
|
||||
}
|
||||
|
||||
void CefFrameHostImpl::LoadRequest(CefRefPtr<CefRequest> request) {
|
||||
CefNavigateParams params(GURL(), ui::PAGE_TRANSITION_TYPED);
|
||||
CefNavigateParams params(GURL(), kPageTransitionExplicit);
|
||||
static_cast<CefRequestImpl*>(request.get())->Get(params);
|
||||
Navigate(params);
|
||||
}
|
||||
|
||||
void CefFrameHostImpl::LoadURL(const CefString& url) {
|
||||
LoadURLWithExtras(url, content::Referrer(), ui::PAGE_TRANSITION_TYPED,
|
||||
LoadURLWithExtras(url, content::Referrer(), kPageTransitionExplicit,
|
||||
std::string());
|
||||
}
|
||||
|
||||
@@ -367,6 +367,11 @@ void CefFrameHostImpl::SendCommand(
|
||||
if (frame_id < CefFrameHostImpl::kMainFrameId)
|
||||
return;
|
||||
|
||||
if (!render_frame_host_ || !response_manager_) {
|
||||
// detached frame has no response_manager_
|
||||
return;
|
||||
}
|
||||
|
||||
TRACE_EVENT2("cef", "CefFrameHostImpl::SendCommand", "frame_id", frame_id,
|
||||
"needsResponse", responseHandler.get() ? 1 : 0);
|
||||
Cef_Request_Params params;
|
||||
@@ -407,6 +412,11 @@ void CefFrameHostImpl::SendCode(
|
||||
if (frame_id < CefFrameHostImpl::kMainFrameId)
|
||||
return;
|
||||
|
||||
if (!render_frame_host_ || !response_manager_) {
|
||||
// detached frame has no response_manager_
|
||||
return;
|
||||
}
|
||||
|
||||
TRACE_EVENT2("cef", "CefFrameHostImpl::SendCommand", "frame_id", frame_id,
|
||||
"needsResponse", responseHandler.get() ? 1 : 0);
|
||||
Cef_Request_Params params;
|
||||
@@ -464,7 +474,6 @@ bool CefFrameHostImpl::OnMessageReceived(const IPC::Message& message) {
|
||||
bool handled = true;
|
||||
IPC_BEGIN_MESSAGE_MAP(CefFrameHostImpl, message)
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_FrameAttached, OnAttached)
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_FrameFocused, OnFocused)
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_DidFinishLoad, OnDidFinishLoad)
|
||||
IPC_MESSAGE_HANDLER(CefHostMsg_UpdateDraggableRegions,
|
||||
OnUpdateDraggableRegions)
|
||||
@@ -534,6 +543,11 @@ const int64_t CefFrameHostImpl::kFocusedFrameId = -2;
|
||||
const int64_t CefFrameHostImpl::kUnspecifiedFrameId = -3;
|
||||
const int64_t CefFrameHostImpl::kInvalidFrameId = -4;
|
||||
|
||||
// This equates to (TT_EXPLICIT | TT_DIRECT_LOAD_FLAG).
|
||||
const ui::PageTransition CefFrameHostImpl::kPageTransitionExplicit =
|
||||
static_cast<ui::PageTransition>(ui::PAGE_TRANSITION_TYPED |
|
||||
ui::PAGE_TRANSITION_FROM_ADDRESS_BAR);
|
||||
|
||||
int64 CefFrameHostImpl::GetFrameId() const {
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
return is_main_frame_ ? kMainFrameId : frame_id_;
|
||||
@@ -556,16 +570,6 @@ void CefFrameHostImpl::OnAttached() {
|
||||
}
|
||||
}
|
||||
|
||||
void CefFrameHostImpl::OnFocused() {
|
||||
if (!IsFocused()) {
|
||||
// Calls back to SetFocused(true) after updating state on the previously
|
||||
// focused frame.
|
||||
auto browser = GetBrowserHostImpl();
|
||||
if (browser)
|
||||
browser->OnFrameFocused(this);
|
||||
}
|
||||
}
|
||||
|
||||
void CefFrameHostImpl::OnDidFinishLoad(const GURL& validated_url,
|
||||
int http_status_code) {
|
||||
auto browser = GetBrowserHostImpl();
|
||||
|
@@ -138,13 +138,17 @@ class CefFrameHostImpl : public CefFrame {
|
||||
static const int64_t kUnspecifiedFrameId;
|
||||
static const int64_t kInvalidFrameId;
|
||||
|
||||
// PageTransition type for explicit navigations. This must pass the check in
|
||||
// ContentBrowserClient::IsExplicitNavigation for debug URLs (HandleDebugURL)
|
||||
// to work as expected.
|
||||
static const ui::PageTransition kPageTransitionExplicit;
|
||||
|
||||
private:
|
||||
int64 GetFrameId() const;
|
||||
CefRefPtr<CefBrowserHostImpl> GetBrowserHostImpl() const;
|
||||
|
||||
// OnMessageReceived message handlers.
|
||||
void OnAttached();
|
||||
void OnFocused();
|
||||
void OnDidFinishLoad(const GURL& validated_url, int http_status_code);
|
||||
void OnUpdateDraggableRegions(
|
||||
const std::vector<Cef_DraggableRegion_Params>& regions);
|
||||
|
@@ -19,17 +19,19 @@ namespace {
|
||||
|
||||
class CefJSDialogCallbackImpl : public CefJSDialogCallback {
|
||||
public:
|
||||
using Callback = content::JavaScriptDialogManager::DialogClosedCallback;
|
||||
using CallbackType = content::JavaScriptDialogManager::DialogClosedCallback;
|
||||
|
||||
CefJSDialogCallbackImpl(Callback callback) : callback_(std::move(callback)) {}
|
||||
CefJSDialogCallbackImpl(CallbackType callback)
|
||||
: callback_(std::move(callback)) {}
|
||||
~CefJSDialogCallbackImpl() override {
|
||||
if (!callback_.is_null()) {
|
||||
// The callback is still pending. Cancel it now.
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
CancelNow(std::move(callback_));
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefJSDialogCallbackImpl::CancelNow,
|
||||
base::Passed(std::move(callback_))));
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefJSDialogCallbackImpl::CancelNow,
|
||||
std::move(callback_)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,20 +42,20 @@ class CefJSDialogCallbackImpl : public CefJSDialogCallback {
|
||||
std::move(callback_).Run(success, user_input);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::Bind(&CefJSDialogCallbackImpl::Continue,
|
||||
this, success, user_input));
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefJSDialogCallbackImpl::Continue,
|
||||
this, success, user_input));
|
||||
}
|
||||
}
|
||||
|
||||
Callback Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
CallbackType Disconnect() WARN_UNUSED_RESULT { return std::move(callback_); }
|
||||
|
||||
private:
|
||||
static void CancelNow(Callback callback) {
|
||||
static void CancelNow(CallbackType callback) {
|
||||
CEF_REQUIRE_UIT();
|
||||
std::move(callback).Run(false, base::string16());
|
||||
}
|
||||
|
||||
Callback callback_;
|
||||
CallbackType callback_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefJSDialogCallbackImpl);
|
||||
};
|
||||
@@ -72,7 +74,7 @@ CefJavaScriptDialogManager::~CefJavaScriptDialogManager() {}
|
||||
|
||||
void CefJavaScriptDialogManager::Destroy() {
|
||||
if (runner_.get()) {
|
||||
runner_.reset(NULL);
|
||||
runner_.reset(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,11 +132,10 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
|
||||
url_formatter::FormatUrlForSecurityDisplay(origin_url);
|
||||
|
||||
DCHECK(!callback.is_null());
|
||||
runner_->Run(browser_, message_type, display_url, message_text,
|
||||
default_prompt_text,
|
||||
base::Bind(&CefJavaScriptDialogManager::DialogClosed,
|
||||
weak_ptr_factory_.GetWeakPtr(),
|
||||
base::Passed(std::move(callback))));
|
||||
runner_->Run(
|
||||
browser_, message_type, display_url, message_text, default_prompt_text,
|
||||
base::BindOnce(&CefJavaScriptDialogManager::DialogClosed,
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
|
||||
}
|
||||
|
||||
void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
|
||||
@@ -185,13 +186,13 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
|
||||
dialog_running_ = true;
|
||||
|
||||
DCHECK(!callback.is_null());
|
||||
runner_->Run(browser_, content::JAVASCRIPT_DIALOG_TYPE_CONFIRM,
|
||||
base::string16(), // display_url
|
||||
message_text,
|
||||
base::string16(), // default_prompt_text
|
||||
base::Bind(&CefJavaScriptDialogManager::DialogClosed,
|
||||
weak_ptr_factory_.GetWeakPtr(),
|
||||
base::Passed(std::move(callback))));
|
||||
runner_->Run(
|
||||
browser_, content::JAVASCRIPT_DIALOG_TYPE_CONFIRM,
|
||||
base::string16(), // display_url
|
||||
message_text,
|
||||
base::string16(), // default_prompt_text
|
||||
base::BindOnce(&CefJavaScriptDialogManager::DialogClosed,
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback)));
|
||||
}
|
||||
|
||||
void CefJavaScriptDialogManager::CancelDialogs(
|
||||
|
@@ -15,8 +15,8 @@ class CefBrowserHostImpl;
|
||||
|
||||
class CefJavaScriptDialogRunner {
|
||||
public:
|
||||
typedef base::Callback<void(bool /* success */,
|
||||
const base::string16& /* user_input */)>
|
||||
typedef base::OnceCallback<void(bool /* success */,
|
||||
const base::string16& /* user_input */)>
|
||||
DialogClosedCallback;
|
||||
|
||||
// Run the dialog. Execute |callback| on completion.
|
||||
@@ -25,7 +25,7 @@ class CefJavaScriptDialogRunner {
|
||||
const base::string16& display_url,
|
||||
const base::string16& message_text,
|
||||
const base::string16& default_prompt_text,
|
||||
const DialogClosedCallback& callback) = 0;
|
||||
DialogClosedCallback callback) = 0;
|
||||
|
||||
// Cancel a dialog mid-flight.
|
||||
virtual void Cancel() = 0;
|
||||
|
@@ -19,7 +19,7 @@ const blink::MediaStreamDevice* FindDefaultDeviceWithId(
|
||||
const blink::MediaStreamDevices& devices,
|
||||
const std::string& device_id) {
|
||||
if (devices.empty())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
blink::MediaStreamDevices::const_iterator iter = devices.begin();
|
||||
for (; iter != devices.end(); ++iter) {
|
||||
|
83
libcef/browser/media_router/media_route_impl.cc
Normal file
83
libcef/browser/media_router/media_route_impl.cc
Normal file
@@ -0,0 +1,83 @@
|
||||
// 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/media_router/media_route_impl.h"
|
||||
|
||||
#include "libcef/browser/media_router/media_router_manager.h"
|
||||
#include "libcef/browser/media_router/media_sink_impl.h"
|
||||
#include "libcef/browser/media_router/media_source_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Do not keep a reference to the object returned by this method.
|
||||
CefBrowserContext* GetBrowserContext(const CefBrowserContext::Getter& getter) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!getter.is_null());
|
||||
|
||||
// Will return nullptr if the BrowserContext has been destroyed.
|
||||
return getter.Run();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefMediaRouteImpl::CefMediaRouteImpl(
|
||||
const media_router::MediaRoute& route,
|
||||
const CefBrowserContext::Getter& browser_context_getter)
|
||||
: route_(route), browser_context_getter_(browser_context_getter) {
|
||||
CEF_REQUIRE_UIT();
|
||||
}
|
||||
|
||||
CefString CefMediaRouteImpl::GetId() {
|
||||
return route_.media_route_id();
|
||||
}
|
||||
|
||||
CefRefPtr<CefMediaSource> CefMediaRouteImpl::GetSource() {
|
||||
return new CefMediaSourceImpl(route_.media_source().id());
|
||||
}
|
||||
|
||||
CefRefPtr<CefMediaSink> CefMediaRouteImpl::GetSink() {
|
||||
return new CefMediaSinkImpl(route_.media_sink_id(), route_.media_sink_name());
|
||||
}
|
||||
|
||||
void CefMediaRouteImpl::SendRouteMessage(const void* message,
|
||||
size_t message_size) {
|
||||
std::string message_str(reinterpret_cast<const char*>(message), message_size);
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(
|
||||
[](CefRefPtr<CefMediaRouteImpl> self, std::string message_str) {
|
||||
self->SendRouteMessageInternal(std::move(message_str));
|
||||
},
|
||||
CefRefPtr<CefMediaRouteImpl>(this), std::move(message_str)));
|
||||
return;
|
||||
}
|
||||
|
||||
SendRouteMessageInternal(std::move(message_str));
|
||||
}
|
||||
|
||||
void CefMediaRouteImpl::Terminate() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefMediaRouteImpl::Terminate, this));
|
||||
return;
|
||||
}
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->GetMediaRouterManager()->TerminateRoute(
|
||||
route_.media_route_id());
|
||||
}
|
||||
|
||||
void CefMediaRouteImpl::SendRouteMessageInternal(std::string message) {
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->GetMediaRouterManager()->SendRouteMessage(
|
||||
route_.media_route_id(), message);
|
||||
}
|
40
libcef/browser/media_router/media_route_impl.h
Normal file
40
libcef/browser/media_router/media_route_impl.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.
|
||||
|
||||
#ifndef CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
|
||||
#include "chrome/common/media_router/media_route.h"
|
||||
|
||||
// Implementation of the CefMediaRoute interface. Only created on the UI thread.
|
||||
class CefMediaRouteImpl : public CefMediaRoute {
|
||||
public:
|
||||
CefMediaRouteImpl(const media_router::MediaRoute& route,
|
||||
const CefBrowserContext::Getter& browser_context_getter);
|
||||
|
||||
// CefMediaRoute methods.
|
||||
CefString GetId() override;
|
||||
CefRefPtr<CefMediaSource> GetSource() override;
|
||||
CefRefPtr<CefMediaSink> GetSink() override;
|
||||
void SendRouteMessage(const void* message, size_t message_size) override;
|
||||
void Terminate() override;
|
||||
|
||||
const media_router::MediaRoute& route() const { return route_; }
|
||||
|
||||
private:
|
||||
void SendRouteMessageInternal(std::string message);
|
||||
|
||||
// Read-only after creation.
|
||||
const media_router::MediaRoute route_;
|
||||
const CefBrowserContext::Getter browser_context_getter_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefMediaRouteImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefMediaRouteImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTE_IMPL_H_
|
290
libcef/browser/media_router/media_router_impl.cc
Normal file
290
libcef/browser/media_router/media_router_impl.cc
Normal file
@@ -0,0 +1,290 @@
|
||||
// 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/media_router/media_router_impl.h"
|
||||
|
||||
#include "libcef/browser/media_router/media_route_impl.h"
|
||||
#include "libcef/browser/media_router/media_router_manager.h"
|
||||
#include "libcef/browser/media_router/media_sink_impl.h"
|
||||
#include "libcef/browser/media_router/media_source_impl.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Do not keep a reference to the object returned by this method.
|
||||
CefBrowserContext* GetBrowserContext(const CefBrowserContext::Getter& getter) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!getter.is_null());
|
||||
|
||||
// Will return nullptr if the BrowserContext has been destroyed.
|
||||
return getter.Run();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
class CefRegistrationImpl : public CefRegistration,
|
||||
public CefMediaRouterManager::Observer {
|
||||
public:
|
||||
explicit CefRegistrationImpl(CefRefPtr<CefMediaObserver> observer)
|
||||
: observer_(observer) {
|
||||
DCHECK(observer_);
|
||||
}
|
||||
|
||||
~CefRegistrationImpl() override {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// May be null if OnMediaRouterDestroyed was called.
|
||||
if (browser_context_getter_.is_null())
|
||||
return;
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->GetMediaRouterManager()->RemoveObserver(this);
|
||||
}
|
||||
|
||||
void Initialize(const CefBrowserContext::Getter& browser_context_getter) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!browser_context_getter.is_null());
|
||||
DCHECK(browser_context_getter_.is_null());
|
||||
browser_context_getter_ = browser_context_getter;
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->GetMediaRouterManager()->AddObserver(this);
|
||||
}
|
||||
|
||||
private:
|
||||
// CefMediaRouterManager::Observer methods:
|
||||
void OnMediaRouterDestroyed() override { browser_context_getter_.Reset(); }
|
||||
|
||||
void OnMediaSinks(
|
||||
const CefMediaRouterManager::MediaSinkVector& sinks) override {
|
||||
std::vector<CefRefPtr<CefMediaSink>> cef_sinks;
|
||||
for (const auto& sink : sinks) {
|
||||
cef_sinks.push_back(new CefMediaSinkImpl(sink.sink));
|
||||
}
|
||||
observer_->OnSinks(cef_sinks);
|
||||
}
|
||||
|
||||
void OnMediaRoutes(
|
||||
const CefMediaRouterManager::MediaRouteVector& routes) override {
|
||||
std::vector<CefRefPtr<CefMediaRoute>> cef_routes;
|
||||
for (const auto& route : routes) {
|
||||
cef_routes.push_back(MakeCefRoute(route));
|
||||
}
|
||||
observer_->OnRoutes(cef_routes);
|
||||
}
|
||||
|
||||
void OnMediaRouteMessages(
|
||||
const media_router::MediaRoute& route,
|
||||
const CefMediaRouterManager::MediaMessageVector& messages) override {
|
||||
CefRefPtr<CefMediaRoute> cef_route = MakeCefRoute(route);
|
||||
for (const auto& message : messages) {
|
||||
if (message->type == media_router::mojom::RouteMessage::Type::TEXT) {
|
||||
if (message->message.has_value()) {
|
||||
const std::string& str = *(message->message);
|
||||
observer_->OnRouteMessageReceived(cef_route, str.c_str(), str.size());
|
||||
}
|
||||
} else if (message->type ==
|
||||
media_router::mojom::RouteMessage::Type::BINARY) {
|
||||
if (message->data.has_value()) {
|
||||
const std::vector<uint8_t>& data = *(message->data);
|
||||
observer_->OnRouteMessageReceived(cef_route, data.data(),
|
||||
data.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnMediaRouteStateChange(
|
||||
const media_router::MediaRoute& route,
|
||||
const content::PresentationConnectionStateChangeInfo& info) override {
|
||||
observer_->OnRouteStateChanged(MakeCefRoute(route),
|
||||
ToConnectionState(info.state));
|
||||
}
|
||||
|
||||
CefRefPtr<CefMediaRoute> MakeCefRoute(const media_router::MediaRoute& route) {
|
||||
return new CefMediaRouteImpl(route, browser_context_getter_);
|
||||
}
|
||||
|
||||
static CefMediaObserver::ConnectionState ToConnectionState(
|
||||
blink::mojom::PresentationConnectionState state) {
|
||||
switch (state) {
|
||||
case blink::mojom::PresentationConnectionState::CONNECTING:
|
||||
return CEF_MRCS_CONNECTING;
|
||||
case blink::mojom::PresentationConnectionState::CONNECTED:
|
||||
return CEF_MRCS_CONNECTED;
|
||||
case blink::mojom::PresentationConnectionState::CLOSED:
|
||||
return CEF_MRCS_CLOSED;
|
||||
case blink::mojom::PresentationConnectionState::TERMINATED:
|
||||
return CEF_MRCS_TERMINATED;
|
||||
}
|
||||
NOTREACHED();
|
||||
return CEF_MRCS_UNKNOWN;
|
||||
}
|
||||
|
||||
CefRefPtr<CefMediaObserver> observer_;
|
||||
CefBrowserContext::Getter browser_context_getter_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING_DELETE_ON_UIT(CefRegistrationImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefRegistrationImpl);
|
||||
};
|
||||
|
||||
CefMediaRouterImpl::CefMediaRouterImpl() {
|
||||
// Verify that our enum matches Chromium's values.
|
||||
static_assert(
|
||||
static_cast<int>(CEF_MRCR_TOTAL_COUNT) ==
|
||||
static_cast<int>(media_router::RouteRequestResult::TOTAL_COUNT),
|
||||
"enum mismatch");
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::Initialize(
|
||||
const CefBrowserContext::Getter& browser_context_getter) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!browser_context_getter.is_null());
|
||||
DCHECK(browser_context_getter_.is_null());
|
||||
browser_context_getter_ = browser_context_getter;
|
||||
}
|
||||
|
||||
CefRefPtr<CefRegistration> CefMediaRouterImpl::AddObserver(
|
||||
CefRefPtr<CefMediaObserver> observer) {
|
||||
if (!observer)
|
||||
return nullptr;
|
||||
CefRefPtr<CefRegistrationImpl> registration =
|
||||
new CefRegistrationImpl(observer);
|
||||
InitializeRegistrationOnUIThread(registration);
|
||||
return registration.get();
|
||||
}
|
||||
|
||||
CefRefPtr<CefMediaSource> CefMediaRouterImpl::GetSource(const CefString& urn) {
|
||||
if (urn.empty())
|
||||
return nullptr;
|
||||
|
||||
// Check for a valid URL and supported Cast/DIAL schemes.
|
||||
GURL presentation_url(urn.ToString());
|
||||
if (!media_router::IsValidPresentationUrl(presentation_url)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (presentation_url.SchemeIsHTTPOrHTTPS()) {
|
||||
// We don't support tab/desktop mirroring, which is what Cast uses for
|
||||
// arbitrary HTTP/HTTPS URLs (see CastMediaSource).
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return new CefMediaSourceImpl(presentation_url);
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::NotifyCurrentSinks() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT, base::BindOnce(&CefMediaRouterImpl::NotifyCurrentSinks, this));
|
||||
return;
|
||||
}
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->GetMediaRouterManager()->NotifyCurrentSinks();
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::CreateRoute(
|
||||
CefRefPtr<CefMediaSource> source,
|
||||
CefRefPtr<CefMediaSink> sink,
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefMediaRouterImpl::CreateRoute,
|
||||
this, source, sink, callback));
|
||||
return;
|
||||
}
|
||||
|
||||
std::string error;
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context) {
|
||||
error = "Context has already been destroyed";
|
||||
} else if (!source || !source->IsValid()) {
|
||||
error = "Source is empty or invalid";
|
||||
} else if (!sink || !sink->IsValid()) {
|
||||
error = "Sink is empty or invalid";
|
||||
} else if (!sink->IsCompatibleWith(source)) {
|
||||
error = "Sink is not compatible with source";
|
||||
}
|
||||
|
||||
if (!error.empty()) {
|
||||
LOG(WARNING) << "Media route creation failed: " << error;
|
||||
if (callback) {
|
||||
callback->OnMediaRouteCreateFinished(CEF_MRCR_UNKNOWN_ERROR, error,
|
||||
nullptr);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
auto source_impl = static_cast<CefMediaSourceImpl*>(source.get());
|
||||
auto sink_impl = static_cast<CefMediaSinkImpl*>(sink.get());
|
||||
|
||||
browser_context->GetMediaRouterManager()->CreateRoute(
|
||||
source_impl->source().id(), sink_impl->sink().id(), url::Origin(),
|
||||
base::BindOnce(&CefMediaRouterImpl::CreateRouteCallback, this, callback));
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::NotifyCurrentRoutes() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(
|
||||
&CefMediaRouterImpl::NotifyCurrentRoutes, this));
|
||||
return;
|
||||
}
|
||||
|
||||
auto browser_context = GetBrowserContext(browser_context_getter_);
|
||||
if (!browser_context)
|
||||
return;
|
||||
|
||||
browser_context->GetMediaRouterManager()->NotifyCurrentRoutes();
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::InitializeRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistrationImpl> registration) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefMediaRouterImpl::InitializeRegistrationOnUIThread,
|
||||
this, registration));
|
||||
return;
|
||||
}
|
||||
registration->Initialize(browser_context_getter_);
|
||||
}
|
||||
|
||||
void CefMediaRouterImpl::CreateRouteCallback(
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback,
|
||||
const media_router::RouteRequestResult& result) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (result.result_code() != media_router::RouteRequestResult::OK) {
|
||||
LOG(WARNING) << "Media route creation failed: " << result.error() << " ("
|
||||
<< result.result_code() << ")";
|
||||
}
|
||||
|
||||
if (!callback)
|
||||
return;
|
||||
|
||||
CefRefPtr<CefMediaRoute> route;
|
||||
if (result.result_code() == media_router::RouteRequestResult::OK &&
|
||||
result.route()) {
|
||||
route = new CefMediaRouteImpl(*result.route(), browser_context_getter_);
|
||||
}
|
||||
|
||||
callback->OnMediaRouteCreateFinished(
|
||||
static_cast<cef_media_route_create_result_t>(result.result_code()),
|
||||
result.error(), route);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefMediaRouter> CefMediaRouter::GetGlobalMediaRouter() {
|
||||
return CefRequestContext::GetGlobalContext()->GetMediaRouter();
|
||||
}
|
49
libcef/browser/media_router/media_router_impl.h
Normal file
49
libcef/browser/media_router/media_router_impl.h
Normal file
@@ -0,0 +1,49 @@
|
||||
// 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_MEDIA_ROUTER_MEDIA_ROUTER_IMPL_H_
|
||||
#define CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_IMPL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_media_router.h"
|
||||
#include "libcef/browser/browser_context.h"
|
||||
|
||||
#include "chrome/common/media_router/mojom/media_router.mojom.h"
|
||||
|
||||
class CefRegistrationImpl;
|
||||
|
||||
// Implementation of the CefMediaRouter interface. May be created on any thread.
|
||||
class CefMediaRouterImpl : public CefMediaRouter {
|
||||
public:
|
||||
CefMediaRouterImpl();
|
||||
|
||||
// Called on the UI thread after object creation and before any other object
|
||||
// methods are executed on the UI thread.
|
||||
void Initialize(const CefBrowserContext::Getter& browser_context_getter);
|
||||
|
||||
// CefMediaRouter methods.
|
||||
CefRefPtr<CefRegistration> AddObserver(
|
||||
CefRefPtr<CefMediaObserver> observer) override;
|
||||
CefRefPtr<CefMediaSource> GetSource(const CefString& urn) override;
|
||||
void NotifyCurrentSinks() override;
|
||||
void CreateRoute(CefRefPtr<CefMediaSource> source,
|
||||
CefRefPtr<CefMediaSink> sink,
|
||||
CefRefPtr<CefMediaRouteCreateCallback> callback) override;
|
||||
void NotifyCurrentRoutes() override;
|
||||
|
||||
private:
|
||||
void InitializeRegistrationOnUIThread(
|
||||
CefRefPtr<CefRegistrationImpl> registration);
|
||||
|
||||
void CreateRouteCallback(CefRefPtr<CefMediaRouteCreateCallback> callback,
|
||||
const media_router::RouteRequestResult& result);
|
||||
|
||||
// Only accessed on the UI thread. Will be non-null after Initialize().
|
||||
CefBrowserContext::Getter browser_context_getter_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefMediaRouterImpl);
|
||||
DISALLOW_COPY_AND_ASSIGN(CefMediaRouterImpl);
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_MEDIA_ROUTER_MEDIA_ROUTER_IMPL_H_
|
292
libcef/browser/media_router/media_router_manager.cc
Normal file
292
libcef/browser/media_router/media_router_manager.cc
Normal file
@@ -0,0 +1,292 @@
|
||||
// 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/media_router/media_router_manager.h"
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "chrome/browser/media/router/media_router_factory.h"
|
||||
#include "chrome/browser/media/router/media_routes_observer.h"
|
||||
#include "chrome/browser/media/router/route_message_observer.h"
|
||||
#include "chrome/browser/media/router/route_message_util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const int kTimeoutMs = 5 * 1000;
|
||||
const char kDefaultPresentationUrl[] = "https://google.com";
|
||||
|
||||
} // namespace
|
||||
|
||||
class CefMediaRoutesObserver : public media_router::MediaRoutesObserver {
|
||||
public:
|
||||
explicit CefMediaRoutesObserver(CefMediaRouterManager* manager)
|
||||
: media_router::MediaRoutesObserver(manager->GetMediaRouter()),
|
||||
manager_(manager) {}
|
||||
|
||||
void OnRoutesUpdated(const std::vector<media_router::MediaRoute>& routes,
|
||||
const std::vector<media_router::MediaRoute::Id>&
|
||||
joinable_route_ids) override {
|
||||
manager_->routes_ = routes;
|
||||
manager_->NotifyCurrentRoutes();
|
||||
}
|
||||
|
||||
private:
|
||||
CefMediaRouterManager* const manager_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefMediaRoutesObserver);
|
||||
};
|
||||
|
||||
// Used to receive messages if PresentationConnection is not supported.
|
||||
class CefRouteMessageObserver : public media_router::RouteMessageObserver {
|
||||
public:
|
||||
CefRouteMessageObserver(CefMediaRouterManager* manager,
|
||||
const media_router::MediaRoute& route)
|
||||
: media_router::RouteMessageObserver(manager->GetMediaRouter(),
|
||||
route.media_route_id()),
|
||||
manager_(manager),
|
||||
route_(route) {}
|
||||
|
||||
void OnMessagesReceived(
|
||||
CefMediaRouterManager::MediaMessageVector messages) override {
|
||||
manager_->OnMessagesReceived(route_, messages);
|
||||
}
|
||||
|
||||
private:
|
||||
CefMediaRouterManager* const manager_;
|
||||
const media_router::MediaRoute route_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefRouteMessageObserver);
|
||||
};
|
||||
|
||||
// Used for messaging and route status notifications with Cast.
|
||||
class CefPresentationConnection : public blink::mojom::PresentationConnection {
|
||||
public:
|
||||
explicit CefPresentationConnection(
|
||||
CefMediaRouterManager* manager,
|
||||
const media_router::MediaRoute& route,
|
||||
media_router::mojom::RoutePresentationConnectionPtr connections)
|
||||
: manager_(manager),
|
||||
route_(route),
|
||||
connection_receiver_(this, std::move(connections->connection_receiver)),
|
||||
connection_remote_(std::move(connections->connection_remote)) {}
|
||||
|
||||
void OnMessage(
|
||||
blink::mojom::PresentationConnectionMessagePtr message) override {
|
||||
CefMediaRouterManager::MediaMessageVector messages;
|
||||
if (message->is_message()) {
|
||||
messages.push_back(media_router::message_util::RouteMessageFromString(
|
||||
message->get_message()));
|
||||
} else if (message->is_data()) {
|
||||
messages.push_back(media_router::message_util::RouteMessageFromData(
|
||||
message->get_data()));
|
||||
}
|
||||
if (!messages.empty()) {
|
||||
manager_->OnMessagesReceived(route_, messages);
|
||||
}
|
||||
}
|
||||
|
||||
void DidChangeState(
|
||||
blink::mojom::PresentationConnectionState state) override {
|
||||
// May result in |this| being deleted, so post async and allow the call
|
||||
// stack to unwind.
|
||||
CEF_POST_TASK(
|
||||
CEF_UIT,
|
||||
base::BindOnce(&CefMediaRouterManager::OnRouteStateChange,
|
||||
manager_->weak_ptr_factory_.GetWeakPtr(), route_,
|
||||
content::PresentationConnectionStateChangeInfo(state)));
|
||||
}
|
||||
|
||||
void DidClose(
|
||||
blink::mojom::PresentationConnectionCloseReason reason) override {
|
||||
DidChangeState(blink::mojom::PresentationConnectionState::CLOSED);
|
||||
}
|
||||
|
||||
void SendRouteMessage(const std::string& message) {
|
||||
connection_remote_->OnMessage(
|
||||
blink::mojom::PresentationConnectionMessage::NewMessage(message));
|
||||
}
|
||||
|
||||
private:
|
||||
CefMediaRouterManager* const manager_;
|
||||
const media_router::MediaRoute route_;
|
||||
|
||||
// Used to receive messages from the MRP.
|
||||
mojo::Receiver<blink::mojom::PresentationConnection> connection_receiver_;
|
||||
|
||||
// Used to send messages to the MRP.
|
||||
mojo::Remote<blink::mojom::PresentationConnection> connection_remote_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefPresentationConnection);
|
||||
};
|
||||
|
||||
CefMediaRouterManager::CefMediaRouterManager(CefBrowserContext* browser_context)
|
||||
: browser_context_(browser_context),
|
||||
query_result_manager_(GetMediaRouter()),
|
||||
weak_ptr_factory_(this) {
|
||||
// Perform initialization.
|
||||
GetMediaRouter()->OnUserGesture();
|
||||
|
||||
query_result_manager_.AddObserver(this);
|
||||
|
||||
// A non-empty presentation URL to required for discovery of Cast devices.
|
||||
query_result_manager_.SetSourcesForCastMode(
|
||||
media_router::MediaCastMode::PRESENTATION,
|
||||
{media_router::MediaSource::ForPresentationUrl(
|
||||
GURL(kDefaultPresentationUrl))},
|
||||
url::Origin());
|
||||
|
||||
routes_observer_ = std::make_unique<CefMediaRoutesObserver>(this);
|
||||
}
|
||||
|
||||
CefMediaRouterManager::~CefMediaRouterManager() {
|
||||
CEF_REQUIRE_UIT();
|
||||
for (auto& observer : observers_) {
|
||||
observers_.RemoveObserver(&observer);
|
||||
observer.OnMediaRouterDestroyed();
|
||||
}
|
||||
|
||||
query_result_manager_.RemoveObserver(this);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::AddObserver(Observer* observer) {
|
||||
CEF_REQUIRE_UIT();
|
||||
observers_.AddObserver(observer);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::RemoveObserver(Observer* observer) {
|
||||
CEF_REQUIRE_UIT();
|
||||
observers_.RemoveObserver(observer);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::NotifyCurrentSinks() {
|
||||
CEF_REQUIRE_UIT();
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnMediaSinks(sinks_);
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::NotifyCurrentRoutes() {
|
||||
CEF_REQUIRE_UIT();
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnMediaRoutes(routes_);
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::CreateRoute(
|
||||
const media_router::MediaSource::Id& source_id,
|
||||
const media_router::MediaSink::Id& sink_id,
|
||||
const url::Origin& origin,
|
||||
CreateRouteResultCallback callback) {
|
||||
GetMediaRouter()->CreateRoute(
|
||||
source_id, sink_id, origin, nullptr /* web_contents */,
|
||||
base::BindOnce(&CefMediaRouterManager::OnCreateRoute,
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback)),
|
||||
base::TimeDelta::FromMilliseconds(kTimeoutMs), false /* incognito */);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::SendRouteMessage(
|
||||
const media_router::MediaRoute::Id& route_id,
|
||||
const std::string& message) {
|
||||
// Must use PresentationConnection to send messages if it exists.
|
||||
auto state = GetRouteState(route_id);
|
||||
if (state && state->presentation_connection_) {
|
||||
state->presentation_connection_->SendRouteMessage(message);
|
||||
return;
|
||||
}
|
||||
|
||||
GetMediaRouter()->SendRouteMessage(route_id, message);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::TerminateRoute(
|
||||
const media_router::MediaRoute::Id& route_id) {
|
||||
GetMediaRouter()->TerminateRoute(route_id);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::OnResultsUpdated(const MediaSinkVector& sinks) {
|
||||
sinks_ = sinks;
|
||||
NotifyCurrentSinks();
|
||||
}
|
||||
|
||||
media_router::MediaRouter* CefMediaRouterManager::GetMediaRouter() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
return media_router::MediaRouterFactory::GetApiForBrowserContext(
|
||||
browser_context_);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::OnCreateRoute(
|
||||
CreateRouteResultCallback callback,
|
||||
media_router::mojom::RoutePresentationConnectionPtr connection,
|
||||
const media_router::RouteRequestResult& result) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (result.route()) {
|
||||
CreateRouteState(*result.route(), std::move(connection));
|
||||
}
|
||||
|
||||
std::move(callback).Run(result);
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::OnRouteStateChange(
|
||||
const media_router::MediaRoute& route,
|
||||
const content::PresentationConnectionStateChangeInfo& info) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (info.state == blink::mojom::PresentationConnectionState::CLOSED ||
|
||||
info.state == blink::mojom::PresentationConnectionState::TERMINATED) {
|
||||
RemoveRouteState(route.media_route_id());
|
||||
}
|
||||
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnMediaRouteStateChange(route, info);
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::OnMessagesReceived(
|
||||
const media_router::MediaRoute& route,
|
||||
const MediaMessageVector& messages) {
|
||||
CEF_REQUIRE_UIT();
|
||||
for (auto& observer : observers_) {
|
||||
observer.OnMediaRouteMessages(route, messages);
|
||||
}
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::CreateRouteState(
|
||||
const media_router::MediaRoute& route,
|
||||
media_router::mojom::RoutePresentationConnectionPtr connection) {
|
||||
const auto route_id = route.media_route_id();
|
||||
auto state = std::make_unique<RouteState>();
|
||||
|
||||
if (!connection.is_null()) {
|
||||
// PresentationConnection must be used for messaging and status
|
||||
// notifications if it exists.
|
||||
state->presentation_connection_ =
|
||||
std::make_unique<CefPresentationConnection>(this, route,
|
||||
std::move(connection));
|
||||
} else {
|
||||
// Fallback if PresentationConnection is not supported.
|
||||
state->message_observer_ =
|
||||
std::make_unique<CefRouteMessageObserver>(this, route);
|
||||
state->state_subscription_ =
|
||||
GetMediaRouter()->AddPresentationConnectionStateChangedCallback(
|
||||
route_id,
|
||||
base::BindRepeating(&CefMediaRouterManager::OnRouteStateChange,
|
||||
weak_ptr_factory_.GetWeakPtr(), route));
|
||||
}
|
||||
|
||||
route_state_map_.insert(std::make_pair(route_id, std::move(state)));
|
||||
}
|
||||
|
||||
CefMediaRouterManager::RouteState* CefMediaRouterManager::GetRouteState(
|
||||
const media_router::MediaRoute::Id& route_id) {
|
||||
const auto it = route_state_map_.find(route_id);
|
||||
if (it != route_state_map_.end())
|
||||
return it->second.get();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::RemoveRouteState(
|
||||
const media_router::MediaRoute::Id& route_id) {
|
||||
auto it = route_state_map_.find(route_id);
|
||||
if (it != route_state_map_.end())
|
||||
route_state_map_.erase(it);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user