Compare commits

...

38 Commits

Author SHA1 Message Date
Marshall Greenblatt
4180781f54 alloy: Fix crashes related to permissions checks (fixes issue #3379, fixes issue #3381) 2022-08-26 16:04:32 -04:00
Marshall Greenblatt
d80d4671c3 Fix same-site calculation for saving cookies from intercepted responses
This fixes an issue where authentication cookies from SAML responses were not
being saved.
2022-08-19 12:40:15 -04:00
Marshall Greenblatt
df482f6b12 Fix crashes with PrintToPDF (fixes issue #3373)
- Configure the DPI setting (see https://crrev.com/40e28bcba3)
- Call StopWorker on the UI thread (see https://crrev.com/564fa1d8a4)
2022-08-18 12:34:05 -04:00
Marshall Greenblatt
46ae630452 Update to Chromium version 104.0.5112.102 2022-08-17 15:37:25 +00:00
Marshall Greenblatt
181df42df2 alloy: Fix flaky OnDraggableRegionsChanged behavior (fixes issue #3374)
Disable BackForwardCache globally for the Alloy runtime so that
blink::RuntimeEnabledFeatures::BackForwardCacheEnabled reports the
correct value in the renderer process.
2022-08-11 17:39:13 -04:00
Marshall Greenblatt
69bf4a73da Fix DisplayTest.AutoResize failure 2022-08-11 17:39:07 -04:00
Marshall Greenblatt
bdfed81c70 Fix DOMTest failure related to device scaling 2022-08-11 17:39:01 -04:00
Marshall Greenblatt
47dab09c5e Fix browser focus assignment on mouse click (fixes issue #3306)
DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set before
the associated call to WebContents::Focus. In the case of mouse click events,
this means ::SetFocus needs to be called explicitly. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.
2022-08-10 14:39:20 -04:00
Marshall Greenblatt
2587cf23c5 Fix issues with browser focus assignment (fixes issue #3306, fixes issue #3166, see issue #3040)
DesktopWindowTreeHostWin ("Chrome_WidgetWin_0") focus needs to be set
synchronously in response to the parent window WM_SETFOCUS message and
before the associated call to WebContents::Focus. See updated comments in
CefBrowserPlatformDelegateNativeWin::SetFocus.
2022-08-05 15:25:10 -04:00
Marshall Greenblatt
75c6895fb5 windows: cefclient: Fix crash when triggering IME popup (see issue #3313) 2022-08-05 15:25:04 -04:00
Marshall Greenblatt
e4239b9373 Update to Chromium version 104.0.5112.81 2022-08-02 13:39:39 +00:00
Marshall Greenblatt
12fbff866e Update to Chromium version 104.0.5112.65 2022-07-28 14:00:24 +00:00
Marshall Greenblatt
8c9bbb1a73 windows: Fix Views test failures (fixes issue #3365) 2022-07-27 14:24:53 -04:00
Marshall Greenblatt
44748db484 windows: Fix ARM64 v8:run_mksnapshot_default build failure (see https://crbug.com/1344759) 2022-07-21 10:56:24 -04:00
Marshall Greenblatt
269879747d Update to Chromium version 104.0.5112.57 2022-07-21 13:33:42 +00:00
Marshall Greenblatt
43181176cf windows: Fix warning C4267 conversion from 'size_t' to 'int' (see issue #3126) 2022-07-19 10:11:10 -04:00
Marshall Greenblatt
5d82749377 Add missing newline at end of file (see issue #3126) 2022-07-19 10:11:02 -04:00
Nik Pavlov
8c5d64ce83 Fix compilation errors from shared message unit tests (see issue #3126) 2022-07-19 10:10:56 -04:00
Marshall Greenblatt
418ae98476 alloy: win: Focus the browser after dismissal of a modal dialog (fixes issue #3361) 2022-07-15 14:08:12 +03:00
Marshall Greenblatt
dac76df7e3 Update to Chromium version 104.0.5112.48 2022-07-14 07:58:07 +00:00
Marshall Greenblatt
ca90a945cc Don't copy dbghelp.dll/dbgcore.dll from the Windows SDK (fixes issue #3356) 2022-07-13 13:47:48 +03:00
Marshall Greenblatt
3f98be4c95 Increase frame reconnect timeout to 10 seconds (see issue #3260) 2022-07-13 12:18:16 +03:00
Marshall Greenblatt
b195ddd4a8 alloy: Mac: Fix crash related to geolocation permissions (see issue #3352) 2022-07-08 14:45:01 +03:00
Marshall Greenblatt
1724b57845 Update libcef_dll_dylib.cc for compiler deduce types 2022-07-08 14:44:52 +03:00
Sergey Markelov
f8ce93ba3c libcef_dll/wrapper: Let the compiler deduce types of func ptr 2022-07-08 14:44:46 +03:00
Marshall Greenblatt
64a5754959 chrome: Add support for OnRequestMediaAccessPermission callback (see issue #2582) 2022-07-08 10:42:36 +03:00
Marshall Greenblatt
d9a7422346 Add CefPermissionHandler callbacks for permission prompts (see issue #3352) 2022-07-08 10:42:35 +03:00
Marshall Greenblatt
4a7583d5d3 Update to Chromium version 104.0.5112.39 2022-07-08 07:32:27 +00:00
Nik Pavlov
3dc9464583 Add a shared memory variant of CefProcessMessage (fixes issue #3126)
CefSharedProcessMessageBuilder supports creation of a CefProcessMessage
backed by a CefSharedMemoryRegion.

Performance tests comparing the existing ArgumentList approach and the new
SharedMemoryRegion approach have been added to cefclient at
http://tests/ipc_performance.

CefMessageRouter has been updated to use SharedMemoryRegion as transport
for larger message payloads. The threshold is configurable via
|CefMessageRouterConfig.message_size_threshold|.

To test:
run `ceftests --gtest_filter=SendSharedProcessMessageTest.*:SharedProcessMessageTest.*:MessageRouterTest.Threshold*`
2022-07-04 12:55:03 +03:00
Jelle Bleyaert
608df0a86d Fix duplicate symbol error on MakeVisibleOnScreenRect (fixes issue #3353) 2022-07-01 17:16:27 +03:00
Marshall Greenblatt
521546d6b7 Add OnMediaAccessChange notification (fixes issue #3310) 2022-06-30 16:02:18 +03:00
Nik Pavlov
e34e9142ee Use nothrow new when allocating memory for zip file data 2022-06-30 16:02:18 +03:00
Marshall Greenblatt
85bda40d95 Add CefPermissionHandler callback for media access (fixes issue #2582) 2022-06-30 16:02:18 +03:00
Nik Pavlov
c05cb73de1 alloy: mac: Fix default popup window positioning (see issue #3244)
Popup windows will be created on the display that best matches the requested
coordinates. The requested size will apply to the content area (as required by
JS documentation) and window size will be reduced if necessary to fit within the
target display. The requested origin will apply to the window (including frame)
and will be modified if necessary so that the window is fully visible on the
target display.

This change does not implement popup positioning for cefclient which uses an
application-created parent window.

This change grants access to the getScreenDetails JS API without user prompt.
2022-06-30 16:02:18 +03:00
Marshall Greenblatt
fb71a32356 Update to Chromium version 104.0.5112.29 2022-06-30 07:30:08 +00:00
Marshall Greenblatt
6250f07099 Update to Chromium version 104.0.5112.20 2022-06-29 10:39:50 +00:00
Marshall Greenblatt
1eff0baf94 Windows: Fix AssertBlockingAllowed failure in GetAzureADJoinStateStorage (fixes issue #3342) 2022-06-23 14:00:21 +03:00
Marshall Greenblatt
335922b64d Update to Chromium version 104.0.5112.12 2022-06-23 11:22:04 +03:00
147 changed files with 8768 additions and 2035 deletions

View File

@@ -373,6 +373,8 @@ source_set("libcef_static_unittested") {
sources = [
"libcef/browser/devtools/devtools_util.cc",
"libcef/browser/devtools/devtools_util.h",
"libcef/browser/screen_util.h",
"libcef/browser/screen_util.cc",
]
deps = [
@@ -389,6 +391,7 @@ source_set("libcef_static_unittested") {
test("libcef_static_unittests") {
sources = [
"libcef/browser/devtools/devtools_util_unittest.cc",
"libcef/browser/screen_util_unittest.cc",
]
deps = [
@@ -572,6 +575,8 @@ static_library("libcef_static") {
"libcef/browser/javascript_dialog_manager.h",
"libcef/browser/main_runner.cc",
"libcef/browser/main_runner.h",
"libcef/browser/media_access_query.cc",
"libcef/browser/media_access_query.h",
"libcef/browser/media_capture_devices_dispatcher.cc",
"libcef/browser/media_capture_devices_dispatcher.h",
"libcef/browser/media_router/media_route_impl.cc",
@@ -584,6 +589,8 @@ static_library("libcef_static") {
"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/media_stream_registrar.cc",
"libcef/browser/media_stream_registrar.h",
"libcef/browser/menu_manager.cc",
"libcef/browser/menu_manager.h",
"libcef/browser/menu_model_impl.cc",
@@ -653,6 +660,8 @@ static_library("libcef_static") {
"libcef/browser/osr/web_contents_view_osr.cc",
"libcef/browser/osr/web_contents_view_osr.h",
"libcef/browser/path_util_impl.cc",
"libcef/browser/permission_prompt.cc",
"libcef/browser/permission_prompt.h",
"libcef/browser/prefs/browser_prefs.cc",
"libcef/browser/prefs/browser_prefs.h",
"libcef/browser/prefs/pref_store.cc",
@@ -805,6 +814,8 @@ static_library("libcef_static") {
"libcef/common/parser_impl.cc",
"libcef/common/process_message_impl.cc",
"libcef/common/process_message_impl.h",
"libcef/common/process_message_smr_impl.cc",
"libcef/common/process_message_smr_impl.h",
"libcef/common/request_impl.cc",
"libcef/common/request_impl.h",
"libcef/common/resource_bundle_delegate.cc",
@@ -1645,7 +1656,7 @@ if (is_mac) {
"libcef_dll/libcef_dll.rc",
]
deps += [
deps += [
# Bring in ui_unscaled_resources.rc which contains custom cursors.
# TODO(cef): Remove this once custom cursors can be loaded via
# ResourceBundle. See crbug.com/147663.
@@ -2249,7 +2260,7 @@ if (is_mac) {
#
# ceftests targets.
#
if (is_linux) {
copy("copy_ceftests_files") {
sources = gypi_paths2.shared_sources_resources

View File

@@ -7,5 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/104.0.5112.0'
'chromium_checkout': 'refs/tags/104.0.5112.102',
'depot_tools_checkout': '350d210871'
}

View File

@@ -8,7 +8,7 @@
# by hand. See the translator.README.txt file in the tools directory for
# more information.
#
# $hash=7ee0c6a789cc0574798332fe7c7cc10f862280af$
# $hash=3ed1afd1b5f881884e6cfd0186fe41bb7b19fd38$
#
{
@@ -55,6 +55,7 @@
'include/cef_origin_whitelist.h',
'include/cef_parser.h',
'include/cef_path_util.h',
'include/cef_permission_handler.h',
'include/cef_print_handler.h',
'include/cef_print_settings.h',
'include/cef_process_message.h',
@@ -74,6 +75,8 @@
'include/cef_response_filter.h',
'include/cef_scheme.h',
'include/cef_server.h',
'include/cef_shared_memory_region.h',
'include/cef_shared_process_message_builder.h',
'include/cef_ssl_info.h',
'include/cef_ssl_status.h',
'include/cef_stream.h',
@@ -154,6 +157,7 @@
'include/capi/cef_origin_whitelist_capi.h',
'include/capi/cef_parser_capi.h',
'include/capi/cef_path_util_capi.h',
'include/capi/cef_permission_handler_capi.h',
'include/capi/cef_print_handler_capi.h',
'include/capi/cef_print_settings_capi.h',
'include/capi/cef_process_message_capi.h',
@@ -173,6 +177,8 @@
'include/capi/cef_response_filter_capi.h',
'include/capi/cef_scheme_capi.h',
'include/capi/cef_server_capi.h',
'include/capi/cef_shared_memory_region_capi.h',
'include/capi/cef_shared_process_message_builder_capi.h',
'include/capi/cef_ssl_info_capi.h',
'include/capi/cef_ssl_status_capi.h',
'include/capi/cef_stream_capi.h',
@@ -328,6 +334,8 @@
'libcef_dll/cpptoc/list_value_cpptoc.h',
'libcef_dll/ctocpp/load_handler_ctocpp.cc',
'libcef_dll/ctocpp/load_handler_ctocpp.h',
'libcef_dll/cpptoc/media_access_callback_cpptoc.cc',
'libcef_dll/cpptoc/media_access_callback_cpptoc.h',
'libcef_dll/ctocpp/media_observer_ctocpp.cc',
'libcef_dll/ctocpp/media_observer_ctocpp.h',
'libcef_dll/cpptoc/media_route_cpptoc.cc',
@@ -364,6 +372,10 @@
'libcef_dll/ctocpp/views/panel_delegate_ctocpp.h',
'libcef_dll/ctocpp/pdf_print_callback_ctocpp.cc',
'libcef_dll/ctocpp/pdf_print_callback_ctocpp.h',
'libcef_dll/ctocpp/permission_handler_ctocpp.cc',
'libcef_dll/ctocpp/permission_handler_ctocpp.h',
'libcef_dll/cpptoc/permission_prompt_callback_cpptoc.cc',
'libcef_dll/cpptoc/permission_prompt_callback_cpptoc.h',
'libcef_dll/cpptoc/post_data_cpptoc.cc',
'libcef_dll/cpptoc/post_data_cpptoc.h',
'libcef_dll/cpptoc/post_data_element_cpptoc.cc',
@@ -436,6 +448,10 @@
'libcef_dll/ctocpp/server_handler_ctocpp.h',
'libcef_dll/ctocpp/set_cookie_callback_ctocpp.cc',
'libcef_dll/ctocpp/set_cookie_callback_ctocpp.h',
'libcef_dll/cpptoc/shared_memory_region_cpptoc.cc',
'libcef_dll/cpptoc/shared_memory_region_cpptoc.h',
'libcef_dll/cpptoc/shared_process_message_builder_cpptoc.cc',
'libcef_dll/cpptoc/shared_process_message_builder_cpptoc.h',
'libcef_dll/cpptoc/stream_reader_cpptoc.cc',
'libcef_dll/cpptoc/stream_reader_cpptoc.h',
'libcef_dll/cpptoc/stream_writer_cpptoc.cc',
@@ -636,6 +652,8 @@
'libcef_dll/ctocpp/list_value_ctocpp.h',
'libcef_dll/cpptoc/load_handler_cpptoc.cc',
'libcef_dll/cpptoc/load_handler_cpptoc.h',
'libcef_dll/ctocpp/media_access_callback_ctocpp.cc',
'libcef_dll/ctocpp/media_access_callback_ctocpp.h',
'libcef_dll/cpptoc/media_observer_cpptoc.cc',
'libcef_dll/cpptoc/media_observer_cpptoc.h',
'libcef_dll/ctocpp/media_route_ctocpp.cc',
@@ -672,6 +690,10 @@
'libcef_dll/cpptoc/views/panel_delegate_cpptoc.h',
'libcef_dll/cpptoc/pdf_print_callback_cpptoc.cc',
'libcef_dll/cpptoc/pdf_print_callback_cpptoc.h',
'libcef_dll/cpptoc/permission_handler_cpptoc.cc',
'libcef_dll/cpptoc/permission_handler_cpptoc.h',
'libcef_dll/ctocpp/permission_prompt_callback_ctocpp.cc',
'libcef_dll/ctocpp/permission_prompt_callback_ctocpp.h',
'libcef_dll/ctocpp/post_data_ctocpp.cc',
'libcef_dll/ctocpp/post_data_ctocpp.h',
'libcef_dll/ctocpp/post_data_element_ctocpp.cc',
@@ -744,6 +766,10 @@
'libcef_dll/cpptoc/server_handler_cpptoc.h',
'libcef_dll/cpptoc/set_cookie_callback_cpptoc.cc',
'libcef_dll/cpptoc/set_cookie_callback_cpptoc.h',
'libcef_dll/ctocpp/shared_memory_region_ctocpp.cc',
'libcef_dll/ctocpp/shared_memory_region_ctocpp.h',
'libcef_dll/ctocpp/shared_process_message_builder_ctocpp.cc',
'libcef_dll/ctocpp/shared_process_message_builder_ctocpp.h',
'libcef_dll/ctocpp/stream_reader_ctocpp.cc',
'libcef_dll/ctocpp/stream_reader_ctocpp.h',
'libcef_dll/ctocpp/stream_writer_ctocpp.cc',

View File

@@ -177,6 +177,8 @@
'tests/shared/browser/resource_util.h',
],
'shared_sources_common': [
'tests/shared/common/binary_value_utils.cc',
'tests/shared/common/binary_value_utils.h',
'tests/shared/common/client_app.cc',
'tests/shared/common/client_app.h',
'tests/shared/common/client_app_other.cc',
@@ -289,6 +291,8 @@
'tests/cefclient/renderer/client_app_delegates_renderer.cc',
'tests/cefclient/renderer/client_renderer.cc',
'tests/cefclient/renderer/client_renderer.h',
'tests/cefclient/renderer/ipc_performance_test.cc',
'tests/cefclient/renderer/ipc_performance_test.h',
'tests/cefclient/renderer/performance_test.cc',
'tests/cefclient/renderer/performance_test.h',
'tests/cefclient/renderer/performance_test_setup.h',
@@ -298,6 +302,7 @@
'tests/cefclient/resources/binding.html',
'tests/cefclient/resources/dialogs.html',
'tests/cefclient/resources/draggable.html',
'tests/cefclient/resources/ipc_performance.html',
'tests/cefclient/resources/localstorage.html',
'tests/cefclient/resources/logo.png',
'tests/cefclient/resources/media_router.html',
@@ -475,13 +480,20 @@
'tests/ceftests/image_util.h',
'tests/ceftests/jsdialog_unittest.cc',
'tests/ceftests/life_span_unittest.cc',
'tests/ceftests/message_router_unittest.cc',
'tests/ceftests/media_access_unittest.cc',
'tests/ceftests/message_router_harness_unittest.cc',
'tests/ceftests/message_router_multi_query_unittest.cc',
'tests/ceftests/message_router_single_query_unittest.cc',
'tests/ceftests/message_router_threshold_unittest.cc',
'tests/ceftests/message_router_unittest_utils.cc',
'tests/ceftests/message_router_unittest_utils.h',
'tests/ceftests/navigation_unittest.cc',
'tests/ceftests/os_rendering_unittest.cc',
'tests/ceftests/osr_accessibility_unittest.cc',
'tests/ceftests/osr_display_unittest.cc',
'tests/ceftests/parser_unittest.cc',
'tests/ceftests/pdf_viewer_unittest.cc',
'tests/ceftests/permission_prompt_unittest.cc',
'tests/ceftests/preference_unittest.cc',
'tests/ceftests/print_unittest.cc',
'tests/ceftests/process_message_unittest.cc',
@@ -498,6 +510,8 @@
'tests/ceftests/scheme_handler_unittest.cc',
'tests/ceftests/scoped_temp_dir_unittest.cc',
'tests/ceftests/server_unittest.cc',
'tests/ceftests/send_shared_process_message_unittest.cc',
"tests/ceftests/shared_process_message_unittest.cc",
'tests/ceftests/stream_unittest.cc',
'tests/ceftests/stream_resource_handler_unittest.cc',
'tests/ceftests/string_unittest.cc',
@@ -562,9 +576,16 @@
'tests/ceftests/cors_unittest.cc',
'tests/ceftests/dom_unittest.cc',
'tests/ceftests/frame_unittest.cc',
'tests/ceftests/message_router_unittest.cc',
'tests/ceftests/media_access_unittest.cc',
'tests/ceftests/message_router_harness_unittest.cc',
'tests/ceftests/message_router_multi_query_unittest.cc',
'tests/ceftests/message_router_single_query_unittest.cc',
'tests/ceftests/message_router_threshold_unittest.cc',
'tests/ceftests/message_router_unittest_utils.cc',
'tests/ceftests/message_router_unittest_utils.h',
'tests/ceftests/navigation_unittest.cc',
'tests/ceftests/pdf_viewer_unittest.cc',
'tests/ceftests/permission_prompt_unittest.cc',
'tests/ceftests/preference_unittest.cc',
'tests/ceftests/process_message_unittest.cc',
'tests/ceftests/request_handler_unittest.cc',
@@ -574,6 +595,8 @@
'tests/ceftests/routing_test_handler.cc',
'tests/ceftests/routing_test_handler.h',
'tests/ceftests/scheme_handler_unittest.cc',
'tests/ceftests/send_shared_process_message_unittest.cc',
"tests/ceftests/shared_process_message_unittest.cc",
'tests/ceftests/urlrequest_unittest.cc',
'tests/ceftests/test_handler.cc',
'tests/ceftests/test_handler.h',

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=7df3c13b75072c2ad5061cd3a344811222798903$
// $hash=03ae4ba9762510e2b0c19ea29322c20ebaf2e683$
//
#ifndef CEF_INCLUDE_CAPI_CEF_CLIENT_CAPI_H_
@@ -55,6 +55,7 @@
#include "include/capi/cef_keyboard_handler_capi.h"
#include "include/capi/cef_life_span_handler_capi.h"
#include "include/capi/cef_load_handler_capi.h"
#include "include/capi/cef_permission_handler_capi.h"
#include "include/capi/cef_print_handler_capi.h"
#include "include/capi/cef_process_message_capi.h"
#include "include/capi/cef_render_handler_capi.h"
@@ -139,6 +140,12 @@ typedef struct _cef_client_t {
struct _cef_frame_handler_t*(CEF_CALLBACK* get_frame_handler)(
struct _cef_client_t* self);
///
// Return the handler for permission requests.
///
struct _cef_permission_handler_t*(CEF_CALLBACK* get_permission_handler)(
struct _cef_client_t* self);
///
// Return the handler for JavaScript dialogs. If no handler is provided the
// default implementation will be used.

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=142637539a094a03adc71d2f3f5b711ba64918b1$
// $hash=5e52ae520b7eda3595683d428aa578bbc776956b$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_
@@ -154,6 +154,16 @@ typedef struct _cef_display_handler_t {
cef_cursor_handle_t cursor,
cef_cursor_type_t type,
const struct _cef_cursor_info_t* custom_cursor_info);
///
// Called when the browser's access to an audio and/or video source has
// changed.
///
void(CEF_CALLBACK* on_media_access_change)(
struct _cef_display_handler_t* self,
struct _cef_browser_t* browser,
int has_video_access,
int has_audio_access);
} cef_display_handler_t;
#ifdef __cplusplus

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=c6de3fb4d64a2b2ad06a4b9c5e9d7625d40b5bb6$
// $hash=ddff4ad975fc26d0abfe05799aedb597b8274ffd$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_
@@ -335,7 +335,8 @@ typedef struct _cef_domnode_t {
struct _cef_domnode_t* self);
///
// Returns the bounds of the element.
// Returns the bounds of the element in device pixels. Use
// "window.devicePixelRatio" to convert to/from CSS pixels.
///
cef_rect_t(CEF_CALLBACK* get_element_bounds)(struct _cef_domnode_t* self);
} cef_domnode_t;

View File

@@ -0,0 +1,108 @@
// Copyright (c) 2022 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=91101808168ec0faf1f39b1924579e31478a6616$
//
#ifndef CEF_INCLUDE_CAPI_CEF_MEDIA_ACCESS_HANDLER_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_MEDIA_ACCESS_HANDLER_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_browser_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Callback structure used for asynchronous continuation of media access
// permission requests.
///
typedef struct _cef_media_access_callback_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Call to allow or deny media access. If this callback was initiated in
// response to a getUserMedia (indicated by
// CEF_MEDIA_PERMISSION_DEVICE_AUDIO_CAPTURE and/or
// CEF_MEDIA_PERMISSION_DEVICE_VIDEO_CAPTURE being set) the
// |allowed_permissions| are required to match those given in
// |required_permissions| in the OnRequestMediaAccessPermission.
///
void(CEF_CALLBACK* cont)(struct _cef_media_access_callback_t* self,
int allowed_permissions);
///
// Cancel the media access request.
///
void(CEF_CALLBACK* cancel)(struct _cef_media_access_callback_t* self);
} cef_media_access_callback_t;
///
// Implement this structure to handle events related to media access permission
// requests. The functions of this structure will be called on the browser
// process UI thread.
///
typedef struct _cef_media_access_handler_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Called when a page requests permission to access media. |requesting_url| is
// the URL requesting permission. Return true (1) and call
// cef_media_access_callback_t::cont() either in this function or at a later
// time to continue or cancel the request. Return false (0) to cancel the
// request immediately.
///
int(CEF_CALLBACK* on_request_media_access_permission)(
struct _cef_media_access_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame,
const cef_string_t* requesting_url,
int32_t requested_permissions,
struct _cef_media_access_callback_t* callback);
} cef_media_access_handler_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_MEDIA_ACCESS_HANDLER_CAPI_H_

View File

@@ -0,0 +1,162 @@
// Copyright (c) 2022 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=e902fe011f8667b64989e57ad9e72aec74b22015$
//
#ifndef CEF_INCLUDE_CAPI_CEF_PERMISSION_HANDLER_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_PERMISSION_HANDLER_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_browser_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Callback structure used for asynchronous continuation of media access
// permission requests.
///
typedef struct _cef_media_access_callback_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Call to allow or deny media access. If this callback was initiated in
// response to a getUserMedia (indicated by
// CEF_MEDIA_PERMISSION_DEVICE_AUDIO_CAPTURE and/or
// CEF_MEDIA_PERMISSION_DEVICE_VIDEO_CAPTURE being set) then
// |allowed_permissions| must match |required_permissions| passed to
// OnRequestMediaAccessPermission.
///
void(CEF_CALLBACK* cont)(struct _cef_media_access_callback_t* self,
uint32 allowed_permissions);
///
// Cancel the media access request.
///
void(CEF_CALLBACK* cancel)(struct _cef_media_access_callback_t* self);
} cef_media_access_callback_t;
///
// Callback structure used for asynchronous continuation of permission prompts.
///
typedef struct _cef_permission_prompt_callback_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Complete the permissions request with the specified |result|.
///
void(CEF_CALLBACK* cont)(struct _cef_permission_prompt_callback_t* self,
cef_permission_request_result_t result);
} cef_permission_prompt_callback_t;
///
// Implement this structure to handle events related to permission requests. The
// functions of this structure will be called on the browser process UI thread.
///
typedef struct _cef_permission_handler_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Called when a page requests permission to access media. |requesting_origin|
// is the URL origin requesting permission. |requested_permissions| is a
// combination of values from cef_media_access_permission_types_t that
// represent the requested permissions. Return true (1) and call
// cef_media_access_callback_t functions either in this function or at a later
// time to continue or cancel the request. Return false (0) to proceed with
// default handling. With the Chrome runtime, default handling will display
// the permission request UI. With the Alloy runtime, default handling will
// deny the request. This function will not be called if the "--enable-media-
// stream" command-line switch is used to grant all permissions.
///
int(CEF_CALLBACK* on_request_media_access_permission)(
struct _cef_permission_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_frame_t* frame,
const cef_string_t* requesting_origin,
uint32 requested_permissions,
struct _cef_media_access_callback_t* callback);
///
// Called when a page should show a permission prompt. |prompt_id| uniquely
// identifies the prompt. |requesting_origin| is the URL origin requesting
// permission. |requested_permissions| is a combination of values from
// cef_permission_request_types_t that represent the requested permissions.
// Return true (1) and call cef_permission_prompt_callback_t::Continue either
// in this function or at a later time to continue or cancel the request.
// Return false (0) to proceed with default handling. With the Chrome runtime,
// default handling will display the permission prompt UI. With the Alloy
// runtime, default handling is CEF_PERMISSION_RESULT_IGNORE.
///
int(CEF_CALLBACK* on_show_permission_prompt)(
struct _cef_permission_handler_t* self,
struct _cef_browser_t* browser,
uint64 prompt_id,
const cef_string_t* requesting_origin,
uint32 requested_permissions,
struct _cef_permission_prompt_callback_t* callback);
///
// Called when a permission prompt handled via OnShowPermissionPrompt is
// dismissed. |prompt_id| will match the value that was passed to
// OnShowPermissionPrompt. |result| will be the value passed to
// cef_permission_prompt_callback_t::Continue or CEF_PERMISSION_RESULT_IGNORE
// if the dialog was dismissed for other reasons such as navigation, browser
// closure, etc. This function will not be called if OnShowPermissionPrompt
// returned false (0) for |prompt_id|.
///
void(CEF_CALLBACK* on_dismiss_permission_prompt)(
struct _cef_permission_handler_t* self,
struct _cef_browser_t* browser,
uint64 prompt_id,
cef_permission_request_result_t result);
} cef_permission_handler_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_PERMISSION_HANDLER_CAPI_H_

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=2549ea10cd3a41bc04ab81bad24eb12787de68b9$
// $hash=026a7f827962222a1df8b62a8e7bdfbf4dce27e0$
//
#ifndef CEF_INCLUDE_CAPI_CEF_PROCESS_MESSAGE_CAPI_H_
@@ -41,6 +41,7 @@
#pragma once
#include "include/capi/cef_base_capi.h"
#include "include/capi/cef_shared_memory_region_capi.h"
#include "include/capi/cef_values_capi.h"
#ifdef __cplusplus
@@ -69,7 +70,8 @@ typedef struct _cef_process_message_t {
int(CEF_CALLBACK* is_read_only)(struct _cef_process_message_t* self);
///
// Returns a writable copy of this object.
// Returns a writable copy of this object. Returns nullptr when message
// contains a shared memory region.
///
struct _cef_process_message_t*(CEF_CALLBACK* copy)(
struct _cef_process_message_t* self);
@@ -82,10 +84,18 @@ typedef struct _cef_process_message_t {
struct _cef_process_message_t* self);
///
// Returns the list of arguments.
// Returns the list of arguments. Returns nullptr when message contains a
// shared memory region.
///
struct _cef_list_value_t*(CEF_CALLBACK* get_argument_list)(
struct _cef_process_message_t* self);
///
// Returns the shared memory region. Returns nullptr when message contains an
// argument list.
///
struct _cef_shared_memory_region_t*(CEF_CALLBACK* get_shared_memory_region)(
struct _cef_process_message_t* self);
} cef_process_message_t;
///

View File

@@ -0,0 +1,79 @@
// Copyright (c) 2022 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=212f13ac6baeeefb86f1648d1e18ccba95fd5f79$
//
#ifndef CEF_INCLUDE_CAPI_CEF_SHARED_MEMORY_REGION_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_SHARED_MEMORY_REGION_CAPI_H_
#pragma once
#include "include/capi/cef_base_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Structure that wraps platform-dependent share memory region mapping.
///
typedef struct _cef_shared_memory_region_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Returns true (1) if the mapping is valid.
///
int(CEF_CALLBACK* is_valid)(struct _cef_shared_memory_region_t* self);
///
// Returns the size of the mapping in bytes. Returns 0 for invalid instances.
///
size_t(CEF_CALLBACK* size)(struct _cef_shared_memory_region_t* self);
///
// Returns the pointer to the memory. Returns nullptr for invalid instances.
// The returned pointer is only valid for the life span of this object.
///
const void*(CEF_CALLBACK* memory)(struct _cef_shared_memory_region_t* self);
} cef_shared_memory_region_t;
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_SHARED_MEMORY_REGION_CAPI_H_

View File

@@ -0,0 +1,101 @@
// Copyright (c) 2022 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=0ed88d26dab045ebef0f4f4ae209e7f11206a242$
//
#ifndef CEF_INCLUDE_CAPI_CEF_SHARED_PROCESS_MESSAGE_BUILDER_CAPI_H_
#define CEF_INCLUDE_CAPI_CEF_SHARED_PROCESS_MESSAGE_BUILDER_CAPI_H_
#pragma once
#include "include/capi/cef_process_message_capi.h"
#ifdef __cplusplus
extern "C" {
#endif
///
// Structure that builds a cef_process_message_t containing a shared memory
// region. This structure is not thread-safe but may be used exclusively on a
// different thread from the one which constructed it.
///
typedef struct _cef_shared_process_message_builder_t {
///
// Base structure.
///
cef_base_ref_counted_t base;
///
// Returns true (1) if the builder is valid.
///
int(CEF_CALLBACK* is_valid)(
struct _cef_shared_process_message_builder_t* self);
///
// Returns the size of the shared memory region in bytes. Returns 0 for
// invalid instances.
///
size_t(CEF_CALLBACK* size)(
struct _cef_shared_process_message_builder_t* self);
///
// Returns the pointer to the writable memory. Returns nullptr for invalid
// instances. The returned pointer is only valid for the life span of this
// object.
///
void*(CEF_CALLBACK* memory)(
struct _cef_shared_process_message_builder_t* self);
///
// Creates a new cef_process_message_t from the data provided to the builder.
// Returns nullptr for invalid instances. Invalidates the builder instance.
///
struct _cef_process_message_t*(CEF_CALLBACK* build)(
struct _cef_shared_process_message_builder_t* self);
} cef_shared_process_message_builder_t;
///
// Creates a new cef_shared_process_message_builder_t with the specified |name|
// and shared memory region of specified |byte_size|.
///
CEF_EXPORT cef_shared_process_message_builder_t*
cef_shared_process_message_builder_create(const cef_string_t* name,
size_t byte_size);
#ifdef __cplusplus
}
#endif
#endif // CEF_INCLUDE_CAPI_CEF_SHARED_PROCESS_MESSAGE_BUILDER_CAPI_H_

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=6a8166eca76513b59a4f6355f4f765dc1d77e4ee$
// $hash=a75487288913e4646f67ee8aded4bc9ef328bb79$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_VIEW_DELEGATE_CAPI_H_
@@ -49,9 +49,10 @@ extern "C" {
struct _cef_view_t;
///
// Implement this structure to handle view events. The functions of this
// structure will be called on the browser process UI thread unless otherwise
// indicated.
// Implement this structure to handle view events. All size and position values
// are in density independent pixels (DIP) unless otherwise indicated. The
// functions of this structure will be called on the browser process UI thread
// unless otherwise indicated.
///
typedef struct _cef_view_delegate_t {
///

View File

@@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "eb7cc5b2fb5c87d0f580e8df1bb609729fc731d0"
#define CEF_API_HASH_UNIVERSAL "1f35577ebd00c5e6cc03a172bb41e3c0d820f3d1"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "b61f8f06751ed7231b2036b71d714d074feadf5b"
#define CEF_API_HASH_PLATFORM "99f91193dce6b93011526269c4dc5d0c32569b70"
#elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "d4ac1390d4c202e26633a0c95a560171ad05e4fe"
#define CEF_API_HASH_PLATFORM "316e120c0bf151de8145ee3b45ef3451e1ff60dc"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "0d9fe8afb1b67a6098e08f7fe6d0ac7e70ce29e6"
#define CEF_API_HASH_PLATFORM "e061aecbfbf09b9068391bdfcd80c9d5ed1faece"
#endif
#ifdef __cplusplus

View File

@@ -53,6 +53,7 @@
#include "include/cef_keyboard_handler.h"
#include "include/cef_life_span_handler.h"
#include "include/cef_load_handler.h"
#include "include/cef_permission_handler.h"
#include "include/cef_print_handler.h"
#include "include/cef_process_message.h"
#include "include/cef_render_handler.h"
@@ -132,6 +133,14 @@ class CefClient : public virtual CefBaseRefCounted {
/*--cef()--*/
virtual CefRefPtr<CefFrameHandler> GetFrameHandler() { return nullptr; }
///
// Return the handler for permission requests.
///
/*--cef()--*/
virtual CefRefPtr<CefPermissionHandler> GetPermissionHandler() {
return nullptr;
}
///
// Return the handler for JavaScript dialogs. If no handler is provided the
// default implementation will be used.

View File

@@ -148,6 +148,15 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
const CefCursorInfo& custom_cursor_info) {
return false;
}
///
// Called when the browser's access to an audio and/or video source has
// changed.
///
/*--cef()--*/
virtual void OnMediaAccessChange(CefRefPtr<CefBrowser> browser,
bool has_video_access,
bool has_audio_access) {}
};
#endif // CEF_INCLUDE_CEF_DISPLAY_HANDLER_H_

View File

@@ -323,7 +323,8 @@ class CefDOMNode : public virtual CefBaseRefCounted {
virtual CefString GetElementInnerText() = 0;
///
// Returns the bounds of the element.
// Returns the bounds of the element in device pixels. Use
// "window.devicePixelRatio" to convert to/from CSS pixels.
///
/*--cef()--*/
virtual CefRect GetElementBounds() = 0;

View File

@@ -0,0 +1,148 @@
// Copyright (c) 2022 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_PERMISSION_HANDLER_H_
#define CEF_INCLUDE_CEF_PERMISSION_HANDLER_H_
#pragma once
#include "include/cef_base.h"
#include "include/cef_browser.h"
///
// Callback interface used for asynchronous continuation of media access
// permission requests.
///
/*--cef(source=library)--*/
class CefMediaAccessCallback : public virtual CefBaseRefCounted {
public:
///
// Call to allow or deny media access. If this callback was initiated in
// response to a getUserMedia (indicated by
// CEF_MEDIA_PERMISSION_DEVICE_AUDIO_CAPTURE and/or
// CEF_MEDIA_PERMISSION_DEVICE_VIDEO_CAPTURE being set) then
// |allowed_permissions| must match |required_permissions| passed to
// OnRequestMediaAccessPermission.
///
/*--cef(capi_name=cont)--*/
virtual void Continue(uint32 allowed_permissions) = 0;
///
// Cancel the media access request.
///
/*--cef()--*/
virtual void Cancel() = 0;
};
///
// Callback interface used for asynchronous continuation of permission prompts.
///
/*--cef(source=library)--*/
class CefPermissionPromptCallback : public virtual CefBaseRefCounted {
public:
///
// Complete the permissions request with the specified |result|.
///
/*--cef(capi_name=cont)--*/
virtual void Continue(cef_permission_request_result_t result) = 0;
};
///
// Implement this interface to handle events related to permission requests. The
// methods of this class will be called on the browser process UI thread.
///
/*--cef(source=client)--*/
class CefPermissionHandler : public virtual CefBaseRefCounted {
public:
///
// Called when a page requests permission to access media. |requesting_origin|
// is the URL origin requesting permission. |requested_permissions| is a
// combination of values from cef_media_access_permission_types_t that
// represent the requested permissions. Return true and call
// CefMediaAccessCallback methods either in this method or at a later time to
// continue or cancel the request. Return false to proceed with default
// handling. With the Chrome runtime, default handling will display the
// permission request UI. With the Alloy runtime, default handling will deny
// the request. This method will not be called if the "--enable-media-stream"
// command-line switch is used to grant all permissions.
///
/*--cef()--*/
virtual bool OnRequestMediaAccessPermission(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& requesting_origin,
uint32 requested_permissions,
CefRefPtr<CefMediaAccessCallback> callback) {
return false;
}
///
// Called when a page should show a permission prompt. |prompt_id| uniquely
// identifies the prompt. |requesting_origin| is the URL origin requesting
// permission. |requested_permissions| is a combination of values from
// cef_permission_request_types_t that represent the requested permissions.
// Return true and call CefPermissionPromptCallback::Continue either in this
// method or at a later time to continue or cancel the request. Return false
// to proceed with default handling. With the Chrome runtime, default handling
// will display the permission prompt UI. With the Alloy runtime, default
// handling is CEF_PERMISSION_RESULT_IGNORE.
///
/*--cef()--*/
virtual bool OnShowPermissionPrompt(
CefRefPtr<CefBrowser> browser,
uint64 prompt_id,
const CefString& requesting_origin,
uint32 requested_permissions,
CefRefPtr<CefPermissionPromptCallback> callback) {
return false;
}
///
// Called when a permission prompt handled via OnShowPermissionPrompt is
// dismissed. |prompt_id| will match the value that was passed to
// OnShowPermissionPrompt. |result| will be the value passed to
// CefPermissionPromptCallback::Continue or CEF_PERMISSION_RESULT_IGNORE if
// the dialog was dismissed for other reasons such as navigation, browser
// closure, etc. This method will not be called if OnShowPermissionPrompt
// returned false for |prompt_id|.
///
/*--cef()--*/
virtual void OnDismissPermissionPrompt(
CefRefPtr<CefBrowser> browser,
uint64 prompt_id,
cef_permission_request_result_t result) {}
};
#endif // CEF_INCLUDE_CEF_PERMISSION_HANDLER_H_

View File

@@ -39,6 +39,7 @@
#pragma once
#include "include/cef_base.h"
#include "include/cef_shared_memory_region.h"
#include "include/cef_values.h"
typedef cef_process_id_t CefProcessId;
@@ -71,6 +72,7 @@ class CefProcessMessage : public virtual CefBaseRefCounted {
///
// Returns a writable copy of this object.
// Returns nullptr when message contains a shared memory region.
///
/*--cef()--*/
virtual CefRefPtr<CefProcessMessage> Copy() = 0;
@@ -83,9 +85,17 @@ class CefProcessMessage : public virtual CefBaseRefCounted {
///
// Returns the list of arguments.
// Returns nullptr when message contains a shared memory region.
///
/*--cef()--*/
virtual CefRefPtr<CefListValue> GetArgumentList() = 0;
///
// Returns the shared memory region.
// Returns nullptr when message contains an argument list.
///
/*--cef()--*/
virtual CefRefPtr<CefSharedMemoryRegion> GetSharedMemoryRegion() = 0;
};
#endif // CEF_INCLUDE_CEF_MESSAGE_H_

View File

@@ -0,0 +1,69 @@
// Copyright (c) 2022 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_SHARED_MEMORY_REGION_H_
#define CEF_INCLUDE_CEF_SHARED_MEMORY_REGION_H_
#pragma once
#include "include/cef_base.h"
///
// Class that wraps platform-dependent share memory region mapping.
///
/*--cef(source=library)--*/
class CefSharedMemoryRegion : public virtual CefBaseRefCounted {
public:
///
// Returns true if the mapping is valid.
///
/*--cef()--*/
virtual bool IsValid() = 0;
///
// Returns the size of the mapping in bytes. Returns 0 for invalid instances.
///
/*--cef()--*/
virtual size_t Size() = 0;
///
// Returns the pointer to the memory. Returns nullptr for invalid instances.
// The returned pointer is only valid for the life span of this object.
///
/*--cef()--*/
virtual const void* Memory() = 0;
};
#endif // CEF_INCLUDE_CEF_SHARED_MEMORY_REGION_H_

View File

@@ -0,0 +1,87 @@
// Copyright (c) 2022 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_SHARED_PROCESS_MESSAGE_BUILDER_H_
#define CEF_INCLUDE_CEF_SHARED_PROCESS_MESSAGE_BUILDER_H_
#pragma once
#include "include/cef_process_message.h"
///
// Class that builds a CefProcessMessage containing a shared memory region.
// This class is not thread-safe but may be used exclusively on a different
// thread from the one which constructed it.
///
/*--cef(source=library)--*/
class CefSharedProcessMessageBuilder : public virtual CefBaseRefCounted {
public:
///
// Creates a new CefSharedProcessMessageBuilder with the specified |name| and
// shared memory region of specified |byte_size|.
///
/*--cef()--*/
static CefRefPtr<CefSharedProcessMessageBuilder> Create(const CefString& name,
size_t byte_size);
///
// Returns true if the builder is valid.
///
/*--cef()--*/
virtual bool IsValid() = 0;
///
// Returns the size of the shared memory region in bytes. Returns 0 for
// invalid instances.
///
/*--cef()--*/
virtual size_t Size() = 0;
///
// Returns the pointer to the writable memory. Returns nullptr for invalid
// instances. The returned pointer is only valid for the life span of this
// object.
///
/*--cef()--*/
virtual void* Memory() = 0;
///
// Creates a new CefProcessMessage from the data provided to the builder.
// Returns nullptr for invalid instances. Invalidates the builder instance.
///
/*--cef()--*/
virtual CefRefPtr<CefProcessMessage> Build() = 0;
};
#endif // CEF_INCLUDE_CEF_SHARED_PROCESS_MESSAGE_BUILDER_H_

View File

@@ -3262,7 +3262,7 @@ typedef struct _cef_touch_handle_state_t {
// Combination of cef_touch_handle_state_flags_t values indicating what state
// is set.
///
uint32_t flags;
uint32 flags;
///
// Enabled state. Only set if |flags| contains CEF_THS_FLAG_ENABLED.
@@ -3287,6 +3287,92 @@ typedef struct _cef_touch_handle_state_t {
float alpha;
} cef_touch_handle_state_t;
///
// Media access permissions used by OnRequestMediaAccessPermission.
///
typedef enum {
///
// No permission.
///
CEF_MEDIA_PERMISSION_NONE = 0,
///
// Device audio capture permission.
///
CEF_MEDIA_PERMISSION_DEVICE_AUDIO_CAPTURE = 1 << 0,
///
// Device video capture permission.
///
CEF_MEDIA_PERMISSION_DEVICE_VIDEO_CAPTURE = 1 << 1,
///
// Desktop audio capture permission.
///
CEF_MEDIA_PERMISSION_DESKTOP_AUDIO_CAPTURE = 1 << 2,
///
// Desktop video capture permission.
///
CEF_MEDIA_PERMISSION_DESKTOP_VIDEO_CAPTURE = 1 << 3,
} cef_media_access_permission_types_t;
///
// Permission types used with OnShowPermissionPrompt. Some types are
// platform-specific or only supported with the Chrome runtime. Should be kept
// in sync with Chromium's permissions::RequestType type.
///
typedef enum {
CEF_PERMISSION_TYPE_NONE = 0,
CEF_PERMISSION_TYPE_ACCESSIBILITY_EVENTS = 1 << 0,
CEF_PERMISSION_TYPE_AR_SESSION = 1 << 1,
CEF_PERMISSION_TYPE_CAMERA_PAN_TILT_ZOOM = 1 << 2,
CEF_PERMISSION_TYPE_CAMERA_STREAM = 1 << 3,
CEF_PERMISSION_TYPE_CLIPBOARD = 1 << 4,
CEF_PERMISSION_TYPE_DISK_QUOTA = 1 << 5,
CEF_PERMISSION_TYPE_LOCAL_FONTS = 1 << 6,
CEF_PERMISSION_TYPE_GEOLOCATION = 1 << 7,
CEF_PERMISSION_TYPE_IDLE_DETECTION = 1 << 8,
CEF_PERMISSION_TYPE_MIC_STREAM = 1 << 9,
CEF_PERMISSION_TYPE_MIDI_SYSEX = 1 << 10,
CEF_PERMISSION_TYPE_MULTIPLE_DOWNLOADS = 1 << 11,
CEF_PERMISSION_TYPE_NOTIFICATIONS = 1 << 12,
CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER = 1 << 13,
CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER = 1 << 14,
CEF_PERMISSION_TYPE_SECURITY_ATTESTATION = 1 << 15,
CEF_PERMISSION_TYPE_STORAGE_ACCESS = 1 << 16,
CEF_PERMISSION_TYPE_U2F_API_REQUEST = 1 << 17,
CEF_PERMISSION_TYPE_VR_SESSION = 1 << 18,
CEF_PERMISSION_TYPE_WINDOW_PLACEMENT = 1 << 19,
} cef_permission_request_types_t;
///
// Permission request results.
///
typedef enum {
///
// Accept the permission request as an explicit user action.
///
CEF_PERMISSION_RESULT_ACCEPT,
///
// Deny the permission request as an explicit user action.
///
CEF_PERMISSION_RESULT_DENY,
///
// Dismiss the permission request as an explicit user action.
///
CEF_PERMISSION_RESULT_DISMISS,
///
// Ignore the permission request. If the prompt remains unhandled (e.g.
// OnShowPermissionPrompt returns false and there is no default permissions
// UI) then any related promises may remain unresolved.
///
CEF_PERMISSION_RESULT_IGNORE,
} cef_permission_request_result_t;
#ifdef __cplusplus
}
#endif

View File

@@ -43,8 +43,10 @@
class CefView;
///
// Implement this interface to handle view events. The methods of this class
// will be called on the browser process UI thread unless otherwise indicated.
// Implement this interface to handle view events. All size and position values
// are in density independent pixels (DIP) unless otherwise indicated. The
// methods of this class will be called on the browser process UI thread unless
// otherwise indicated.
///
/*--cef(source=client)--*/
class CefViewDelegate : public virtual CefBaseRefCounted {

View File

@@ -207,6 +207,10 @@ struct CefMessageRouterConfig {
// Name of the JavaScript function that will be added to the 'window' object
// for canceling a pending query. The default value is "cefQueryCancel".
CefString js_cancel_function;
// Messages of size (in bytes) larger than this threshold will be sent via
// shared memory region.
size_t message_size_threshold;
};
///

View File

@@ -22,6 +22,7 @@
#include "base/strings/string_util.h"
#include "chrome/browser/font_family_cache.h"
#include "chrome/browser/media/media_device_id_salt.h"
#include "chrome/browser/permissions/permission_manager_factory.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"
@@ -30,6 +31,7 @@
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/keyed_service/core/simple_dependency_manager.h"
#include "components/keyed_service/core/simple_key_map.h"
#include "components/permissions/permission_manager.h"
#include "components/prefs/pref_service.h"
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
#include "components/user_prefs/user_prefs.h"
@@ -380,7 +382,7 @@ content::SSLHostStateDelegate* AlloyBrowserContext::GetSSLHostStateDelegate() {
content::PermissionControllerDelegate*
AlloyBrowserContext::GetPermissionControllerDelegate() {
return nullptr;
return PermissionManagerFactory::GetForProfile(this);
}
content::BackgroundFetchDelegate*

View File

@@ -17,7 +17,7 @@
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/context.h"
#include "libcef/browser/devtools/devtools_manager.h"
#include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/media_access_query.h"
#include "libcef/browser/osr/osr_util.h"
#include "libcef/browser/request_context_impl.h"
#include "libcef/browser/thread_util.h"
@@ -51,7 +51,6 @@
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "net/base/net_errors.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"
#include "ui/events/base_event_utils.h"
using content::KeyboardEventProcessingResult;
@@ -1299,82 +1298,18 @@ void AlloyBrowserHostImpl::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) {
CEF_REQUIRE_UIT();
blink::MediaStreamDevices audio_devices;
blink::MediaStreamDevices video_devices;
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
if (!command_line->HasSwitch(switches::kEnableMediaStream)) {
// Cancel the request.
std::move(callback).Run(
blink::mojom::StreamDevicesSet(),
blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED,
std::unique_ptr<content::MediaStreamUI>());
return;
}
// Based on chrome/browser/media/media_stream_devices_controller.cc
bool microphone_requested =
(request.audio_type ==
blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE);
bool webcam_requested = (request.video_type ==
blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE);
bool screen_requested =
(request.video_type ==
blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE);
if (microphone_requested || webcam_requested || screen_requested) {
// Pick the desired device or fall back to the first available of the
// given type.
if (microphone_requested) {
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
request.requested_audio_device_id, true, false, &audio_devices);
}
if (webcam_requested) {
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
request.requested_video_device_id, false, true, &video_devices);
}
if (screen_requested) {
content::DesktopMediaID media_id;
if (request.requested_video_device_id.empty()) {
media_id =
content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
-1 /* webrtc::kFullDesktopScreenId */);
} else {
media_id =
content::DesktopMediaID::Parse(request.requested_video_device_id);
}
video_devices.push_back(blink::MediaStreamDevice(
blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE,
media_id.ToString(), "Screen"));
}
}
blink::mojom::StreamDevicesSet stream_devices_set;
stream_devices_set.stream_devices.emplace_back(
blink::mojom::StreamDevices::New());
blink::mojom::StreamDevices& devices = *stream_devices_set.stream_devices[0];
// At most one audio device and one video device can be used in a stream.
if (!audio_devices.empty())
devices.audio_device = audio_devices.front();
if (!video_devices.empty())
devices.video_device = video_devices.front();
std::move(callback).Run(stream_devices_set,
blink::mojom::MediaStreamRequestResult::OK,
std::unique_ptr<content::MediaStreamUI>());
auto returned_callback = media_access_query::RequestMediaAccessPermission(
this, request, std::move(callback), /*default_disallow=*/true);
// Callback should not be returned.
DCHECK(returned_callback.is_null());
}
bool AlloyBrowserHostImpl::CheckMediaAccessPermission(
content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
blink::mojom::MediaStreamType type) {
// Check media access permission without prompting the user.
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
return command_line->HasSwitch(switches::kEnableMediaStream);
return media_access_query::CheckMediaAccessPermission(this, render_frame_host,
security_origin, type);
}
bool AlloyBrowserHostImpl::IsNeverComposited(

View File

@@ -16,6 +16,7 @@
#include "libcef/browser/extensions/extension_system_factory.h"
#include "libcef/browser/file_dialog_runner.h"
#include "libcef/browser/net/chrome_scheme_handler.h"
#include "libcef/browser/permission_prompt.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/app_manager.h"
#include "libcef/common/extensions/extensions_util.h"
@@ -55,6 +56,7 @@
#include "ui/wm/core/wm_state.h"
#if BUILDFLAG(IS_WIN)
#include "base/enterprise_util.h"
#include "chrome/browser/chrome_browser_main_win.h"
#include "chrome/browser/win/parental_controls.h"
#endif
@@ -308,13 +310,20 @@ int AlloyBrowserMainParts::PreMainMessageLoopRun() {
// Windows parental controls calls can be slow, so we do an early init here
// that calculates this value off of the UI thread.
InitializeWinParentalControls();
#endif
// These methods may call LoadLibrary and could trigger
// AssertBlockingAllowed() failures if executed at a later time on the UI
// thread.
base::IsManagedDevice();
base::IsEnterpriseDevice();
#endif // BUILDFLAG(IS_WIN)
// Triggers initialization of the singleton instance on UI thread.
PluginFinder::GetInstance();
scheme::RegisterWebUIControllerFactory();
file_dialog_runner::RegisterFactory();
permission_prompt::RegisterCreateCallback();
#if BUILDFLAG(ENABLE_MEDIA_FOUNDATION_WIDEVINE_CDM) || \
BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT)

View File

@@ -23,6 +23,7 @@
#include "components/find_in_page/find_tab_helper.h"
#include "components/find_in_page/find_types.h"
#include "components/javascript_dialogs/tab_modal_dialog_manager.h"
#include "components/permissions/permission_request_manager.h"
#include "components/zoom/zoom_controller.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
@@ -178,6 +179,7 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
DCHECK(!web_contents_->GetDelegate());
web_contents_->SetDelegate(static_cast<AlloyBrowserHostImpl*>(browser));
permissions::PermissionRequestManager::CreateForWebContents(web_contents_);
PrefsTabHelper::CreateForWebContents(web_contents_);
printing::CefPrintViewManager::CreateForWebContents(web_contents_);

View File

@@ -18,6 +18,7 @@
#include "base/command_line.h"
#include "chrome/browser/component_updater/chrome_component_updater_configurator.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/permissions/chrome_permissions_client.h"
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/browser/printing/background_printing_manager.h"
#include "chrome/browser/printing/print_job_manager.h"
@@ -67,6 +68,9 @@ void ChromeBrowserProcessAlloy::Initialize() {
extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
}
// Make sure permissions client has been set.
ChromePermissionsClient::GetInstance();
initialized_ = true;
}

View File

@@ -42,6 +42,16 @@ void CefBrowserFrame::SendMessage(const std::string& name,
}
}
void CefBrowserFrame::SendSharedMemoryRegion(
const std::string& name,
base::ReadOnlySharedMemoryRegion region) {
// Always send to the newly created RFH, which may be speculative when
// navigating cross-origin.
if (auto host = GetFrameHost(/*prefer_speculative=*/true)) {
host->SendSharedMemoryRegion(name, std::move(region));
}
}
void CefBrowserFrame::FrameAttached(
mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,
bool reattached) {

View File

@@ -36,6 +36,8 @@ class CefBrowserFrame
private:
// cef::mojom::BrowserFrame methods:
void SendMessage(const std::string& name, base::Value arguments) override;
void SendSharedMemoryRegion(const std::string& name,
base::ReadOnlySharedMemoryRegion region) override;
void FrameAttached(mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,
bool reattached) override;
void DidFinishFrameLoad(const GURL& validated_url,

View File

@@ -204,9 +204,10 @@ void CefBrowserHostBase::InitializeBrowser() {
void CefBrowserHostBase::DestroyBrowser() {
CEF_REQUIRE_UIT();
devtools_manager_.reset(nullptr);
devtools_manager_.reset();
media_stream_registrar_.reset();
platform_delegate_.reset(nullptr);
platform_delegate_.reset();
contents_delegate_->RemoveObserver(this);
contents_delegate_->ObserveWebContents(nullptr);
@@ -232,13 +233,12 @@ bool CefBrowserHostBase::HasView() {
}
void CefBrowserHostBase::SetFocus(bool focus) {
// Always execute asynchronously to work around issue #3040.
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostBase::SetFocusInternal,
this, focus));
}
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostBase::SetFocus, this, focus));
return;
}
void CefBrowserHostBase::SetFocusInternal(bool focus) {
CEF_REQUIRE_UIT();
if (focus)
OnSetFocus(FOCUS_SOURCE_SYSTEM);
else if (platform_delegate_)
@@ -972,6 +972,14 @@ content::BrowserContext* CefBrowserHostBase::GetBrowserContext() const {
return nullptr;
}
CefMediaStreamRegistrar* CefBrowserHostBase::GetMediaStreamRegistrar() {
CEF_REQUIRE_UIT();
if (!media_stream_registrar_) {
media_stream_registrar_ = std::make_unique<CefMediaStreamRegistrar>(this);
}
return media_stream_registrar_.get();
}
views::Widget* CefBrowserHostBase::GetWindowWidget() const {
CEF_REQUIRE_UIT();
if (!platform_delegate_)

View File

@@ -15,6 +15,7 @@
#include "libcef/browser/devtools/devtools_manager.h"
#include "libcef/browser/file_dialog_manager.h"
#include "libcef/browser/frame_host_impl.h"
#include "libcef/browser/media_stream_registrar.h"
#include "libcef/browser/request_context_impl.h"
#include "base/observer_list.h"
@@ -301,6 +302,7 @@ class CefBrowserHostBase : public CefBrowserHost,
CefBrowserContentsDelegate* contents_delegate() const {
return contents_delegate_.get();
}
CefMediaStreamRegistrar* GetMediaStreamRegistrar();
// Returns the Widget owner for the browser window. Only used with windowed
// browsers.
@@ -335,8 +337,6 @@ class CefBrowserHostBase : public CefBrowserHost,
// Called from LoadMainFrameURL to perform the actual navigation.
virtual bool Navigate(const content::OpenURLParams& params);
void SetFocusInternal(bool focus);
// Create the CefFileDialogManager if it doesn't already exist.
bool EnsureFileDialogManager();
@@ -371,6 +371,8 @@ class CefBrowserHostBase : public CefBrowserHost,
// Used for creating and managing DevTools instances.
std::unique_ptr<CefDevToolsManager> devtools_manager_;
std::unique_ptr<CefMediaStreamRegistrar> media_stream_registrar_;
private:
IMPLEMENT_REFCOUNTING(CefBrowserHostBase);
};

View File

@@ -154,7 +154,6 @@ bool CefBrowserInfoManager::CanCreateWindow(
CefPopupFeatures cef_features;
TranslatePopupFeatures(features, cef_features);
#if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC))
// Default to the size from the popup features.
if (cef_features.xSet)
window_info.bounds.x = cef_features.x;
@@ -164,7 +163,6 @@ bool CefBrowserInfoManager::CanCreateWindow(
window_info.bounds.width = cef_features.width;
if (cef_features.heightSet)
window_info.bounds.height = cef_features.height;
#endif
allow = !handler->OnBeforePopup(
browser.get(), opener_frame, pending_popup->target_url.spec(),

View File

@@ -55,6 +55,15 @@ class BrowserDelegate : public content::WebContentsDelegate {
WindowOpenDisposition disposition) {
return false;
}
// Same as RequestMediaAccessPermission but returning |callback| if the
// request is unhandled.
[[nodiscard]] virtual content::MediaResponseCallback
RequestMediaAccessPermissionEx(content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) {
return callback;
}
};
} // namespace cef

View File

@@ -11,6 +11,7 @@
#include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
#include "libcef/browser/media_access_query.h"
#include "libcef/browser/request_context_impl.h"
#include "libcef/common/app_manager.h"
#include "libcef/common/frame_util.h"
@@ -102,6 +103,19 @@ bool ChromeBrowserDelegate::HandleCommand(int command_id,
return false;
}
content::MediaResponseCallback
ChromeBrowserDelegate::RequestMediaAccessPermissionEx(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) {
if (auto browser = ChromeBrowserHostImpl::GetBrowserForBrowser(browser_)) {
return media_access_query::RequestMediaAccessPermission(
browser.get(), request, std::move(callback),
/*default_disallow=*/false);
}
return callback;
}
void ChromeBrowserDelegate::WebContentsCreated(
content::WebContents* source_contents,
int opener_render_process_id,

View File

@@ -54,6 +54,10 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
bool ShowStatusBubble(bool show_by_default) override;
bool HandleCommand(int command_id,
WindowOpenDisposition disposition) override;
[[nodiscard]] content::MediaResponseCallback RequestMediaAccessPermissionEx(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) override;
// WebContentsDelegate methods:
void WebContentsCreated(content::WebContents* source_contents,

View File

@@ -8,6 +8,7 @@
#include "libcef/browser/context.h"
#include "libcef/browser/file_dialog_runner.h"
#include "libcef/browser/net/chrome_scheme_handler.h"
#include "libcef/browser/permission_prompt.h"
#include "base/task/thread_pool.h"
@@ -42,4 +43,5 @@ void ChromeBrowserMainExtraPartsCef::PreMainMessageLoopRun() {
scheme::RegisterWebUIControllerFactory();
context_menu::RegisterMenuCreatedCallback();
file_dialog_runner::RegisterFactory();
permission_prompt::RegisterCreateCallback();
}

View File

@@ -13,6 +13,7 @@
#include "libcef/common/frame_util.h"
#include "libcef/common/net/url_util.h"
#include "libcef/common/process_message_impl.h"
#include "libcef/common/process_message_smr_impl.h"
#include "libcef/common/request_impl.h"
#include "libcef/common/string_util.h"
#include "libcef/common/task_runner_impl.h"
@@ -238,18 +239,31 @@ void CefFrameHostImpl::SendProcessMessage(
if (!message || !message->IsValid())
return;
// Invalidate the message object immediately by taking the argument list.
auto argument_list =
static_cast<CefProcessMessageImpl*>(message.get())->TakeArgumentList();
if (message->GetArgumentList() != nullptr) {
// Invalidate the message object immediately by taking the argument list.
auto argument_list =
static_cast<CefProcessMessageImpl*>(message.get())->TakeArgumentList();
SendToRenderFrame(__FUNCTION__,
base::BindOnce(
[](const CefString& name, base::ListValue argument_list,
const RenderFrameType& render_frame) {
render_frame->SendMessage(name,
std::move(argument_list));
},
message->GetName(), std::move(argument_list)));
SendToRenderFrame(
__FUNCTION__,
base::BindOnce(
[](const CefString& name, base::ListValue argument_list,
const RenderFrameType& render_frame) {
render_frame->SendMessage(name, std::move(argument_list));
},
message->GetName(), std::move(argument_list)));
} else {
auto region =
static_cast<CefProcessMessageSMRImpl*>(message.get())->TakeRegion();
SendToRenderFrame(
__FUNCTION__,
base::BindOnce(
[](const CefString& name, base::ReadOnlySharedMemoryRegion region,
const RenderFrameType& render_frame) {
render_frame->SendSharedMemoryRegion(name, std::move(region));
},
message->GetName(), std::move(region)));
}
}
void CefFrameHostImpl::SetFocused(bool focused) {
@@ -564,6 +578,19 @@ void CefFrameHostImpl::SendMessage(const std::string& name,
}
}
void CefFrameHostImpl::SendSharedMemoryRegion(
const std::string& name,
base::ReadOnlySharedMemoryRegion region) {
if (auto browser = GetBrowserHostBase()) {
if (auto client = browser->GetClient()) {
CefRefPtr<CefProcessMessage> message(
new CefProcessMessageSMRImpl(name, std::move(region)));
browser->GetClient()->OnProcessMessageReceived(browser.get(), this,
PID_RENDERER, message);
}
}
}
void CefFrameHostImpl::FrameAttached(
mojo::PendingRemote<cef::mojom::RenderFrame> render_frame_remote,
bool reattached) {

View File

@@ -126,6 +126,8 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
// cef::mojom::BrowserFrame methods forwarded from CefBrowserFrame.
void SendMessage(const std::string& name, base::Value arguments) override;
void SendSharedMemoryRegion(const std::string& name,
base::ReadOnlySharedMemoryRegion region) override;
void FrameAttached(mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,
bool reattached) override;
void DidFinishFrameLoad(const GURL& validated_url,

View File

@@ -0,0 +1,356 @@
// Copyright 2022 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_access_query.h"
#include "include/cef_permission_handler.h"
#include "libcef/browser/browser_host_base.h"
#include "libcef/browser/media_capture_devices_dispatcher.h"
#include "libcef/browser/media_stream_registrar.h"
#include "libcef/common/cef_switches.h"
#include "base/callback_helpers.h"
#include "base/command_line.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"
namespace media_access_query {
namespace {
class CefMediaAccessQuery {
public:
using CallbackType = content::MediaResponseCallback;
CefMediaAccessQuery(CefBrowserHostBase* const browser,
const content::MediaStreamRequest& request,
CallbackType&& callback)
: browser_(browser), request_(request), callback_(std::move(callback)) {}
CefMediaAccessQuery(CefMediaAccessQuery&& query)
: browser_(query.browser_),
request_(query.request_),
callback_(std::move(query.callback_)) {}
CefMediaAccessQuery& operator=(CefMediaAccessQuery&& query) {
browser_ = query.browser_;
request_ = query.request_;
callback_ = std::move(query.callback_);
return *this;
}
CefMediaAccessQuery(const CefMediaAccessQuery&) = delete;
CefMediaAccessQuery& operator=(const CefMediaAccessQuery&) = delete;
bool is_null() const { return callback_.is_null(); }
uint32_t requested_permissions() const {
int requested_permissions = CEF_MEDIA_PERMISSION_NONE;
if (device_audio_requested()) {
requested_permissions |= CEF_MEDIA_PERMISSION_DEVICE_AUDIO_CAPTURE;
}
if (device_video_requested()) {
requested_permissions |= CEF_MEDIA_PERMISSION_DEVICE_VIDEO_CAPTURE;
}
if (desktop_audio_requested()) {
requested_permissions |= CEF_MEDIA_PERMISSION_DESKTOP_AUDIO_CAPTURE;
}
if (desktop_video_requested()) {
requested_permissions |= CEF_MEDIA_PERMISSION_DESKTOP_VIDEO_CAPTURE;
}
return requested_permissions;
}
[[nodiscard]] CallbackType DisconnectCallback() {
return std::move(callback_);
}
void ExecuteCallback(uint32_t allowed_permissions) {
CEF_REQUIRE_UIT();
blink::mojom::MediaStreamRequestResult result;
blink::mojom::StreamDevicesSetPtr stream_devices_set;
if (allowed_permissions == CEF_MEDIA_PERMISSION_NONE) {
result = blink::mojom::MediaStreamRequestResult::PERMISSION_DENIED;
stream_devices_set = blink::mojom::StreamDevicesSet::New();
} else {
bool error = false;
if (allowed_permissions == requested_permissions()) {
stream_devices_set = GetRequestedMediaDevices();
} else {
stream_devices_set = GetAllowedMediaDevices(allowed_permissions, error);
}
result = error ? blink::mojom::MediaStreamRequestResult::INVALID_STATE
: blink::mojom::MediaStreamRequestResult::OK;
}
bool has_video = false;
bool has_audio = false;
if (!stream_devices_set->stream_devices.empty()) {
blink::mojom::StreamDevices& devices =
*stream_devices_set->stream_devices[0];
has_video = devices.video_device.has_value();
has_audio = devices.audio_device.has_value();
}
auto media_stream_ui =
browser_->GetMediaStreamRegistrar()->MaybeCreateMediaStreamUI(
has_video, has_audio);
std::move(callback_).Run(*stream_devices_set, result,
std::move(media_stream_ui));
}
private:
bool device_audio_requested() const {
return request_.audio_type ==
blink::mojom::MediaStreamType::DEVICE_AUDIO_CAPTURE;
}
bool device_video_requested() const {
return request_.video_type ==
blink::mojom::MediaStreamType::DEVICE_VIDEO_CAPTURE;
}
bool desktop_audio_requested() const {
return (request_.audio_type ==
blink::mojom::MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE) ||
(request_.audio_type ==
blink::mojom::MediaStreamType::DISPLAY_AUDIO_CAPTURE);
}
bool desktop_video_requested() const {
return (request_.video_type ==
blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE) ||
(request_.video_type ==
blink::mojom::MediaStreamType::DISPLAY_VIDEO_CAPTURE);
}
blink::mojom::StreamDevicesSetPtr GetRequestedMediaDevices() const {
CEF_REQUIRE_UIT();
blink::MediaStreamDevices audio_devices;
blink::MediaStreamDevices video_devices;
if (device_audio_requested()) {
// Pick the desired device or fall back to the first available of the
// given type.
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
request_.requested_audio_device_id, true, false, &audio_devices);
}
if (device_video_requested()) {
// Pick the desired device or fall back to the first available of the
// given type.
CefMediaCaptureDevicesDispatcher::GetInstance()->GetRequestedDevice(
request_.requested_video_device_id, false, true, &video_devices);
}
if (desktop_audio_requested()) {
audio_devices.push_back(blink::MediaStreamDevice(
request_.audio_type, "loopback", "System Audio"));
}
if (desktop_video_requested()) {
content::DesktopMediaID media_id;
if (request_.requested_video_device_id.empty()) {
media_id =
content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
-1 /* webrtc::kFullDesktopScreenId */);
} else {
media_id =
content::DesktopMediaID::Parse(request_.requested_video_device_id);
}
video_devices.push_back(blink::MediaStreamDevice(
request_.video_type, media_id.ToString(), "Screen"));
}
blink::mojom::StreamDevicesSetPtr stream_devices_set =
blink::mojom::StreamDevicesSet::New();
stream_devices_set->stream_devices.emplace_back(
blink::mojom::StreamDevices::New());
blink::mojom::StreamDevices& devices =
*stream_devices_set->stream_devices[0];
// At most one audio device and one video device can be used in a stream.
if (!audio_devices.empty())
devices.audio_device = audio_devices.front();
if (!video_devices.empty())
devices.video_device = video_devices.front();
return stream_devices_set;
}
blink::mojom::StreamDevicesSetPtr GetAllowedMediaDevices(
uint32_t allowed_permissions,
bool& error) {
error = false;
const auto req_permissions = requested_permissions();
const bool device_audio_allowed =
allowed_permissions & CEF_MEDIA_PERMISSION_DEVICE_AUDIO_CAPTURE;
const bool device_video_allowed =
allowed_permissions & CEF_MEDIA_PERMISSION_DEVICE_VIDEO_CAPTURE;
const bool desktop_audio_allowed =
allowed_permissions & CEF_MEDIA_PERMISSION_DESKTOP_AUDIO_CAPTURE;
const bool desktop_video_allowed =
allowed_permissions & CEF_MEDIA_PERMISSION_DESKTOP_VIDEO_CAPTURE;
blink::mojom::StreamDevicesSetPtr stream_devices_set;
// getDisplayMedia must always request video
if (desktop_video_requested() &&
(!desktop_video_allowed && desktop_audio_allowed)) {
LOG(WARNING) << "Response to getDisplayMedia is not allowed to only "
"return Audio";
error = true;
} else if (!desktop_video_requested() &&
req_permissions != allowed_permissions) {
LOG(WARNING)
<< "Response to getUserMedia must match requested permissions ("
<< req_permissions << " vs " << allowed_permissions << ")";
error = true;
}
if (error) {
stream_devices_set = blink::mojom::StreamDevicesSet::New();
} else {
if (!device_audio_allowed && !desktop_audio_allowed) {
request_.audio_type = blink::mojom::MediaStreamType::NO_SERVICE;
}
if (!device_video_allowed && !desktop_video_allowed) {
request_.video_type = blink::mojom::MediaStreamType::NO_SERVICE;
}
stream_devices_set = GetRequestedMediaDevices();
}
return stream_devices_set;
}
CefRefPtr<CefBrowserHostBase> browser_;
content::MediaStreamRequest request_;
CallbackType callback_;
};
class CefMediaAccessCallbackImpl : public CefMediaAccessCallback {
public:
using CallbackType = CefMediaAccessQuery;
explicit CefMediaAccessCallbackImpl(CallbackType&& callback)
: callback_(std::move(callback)) {}
CefMediaAccessCallbackImpl(const CefMediaAccessCallbackImpl&) = delete;
CefMediaAccessCallbackImpl& operator=(const CefMediaAccessCallbackImpl&) =
delete;
~CefMediaAccessCallbackImpl() override {
if (!callback_.is_null()) {
// The callback is still pending. Cancel it now.
if (CEF_CURRENTLY_ON_UIT()) {
RunNow(std::move(callback_), CEF_MEDIA_PERMISSION_NONE);
} else {
CEF_POST_TASK(
CEF_UIT,
base::BindOnce(&CefMediaAccessCallbackImpl::RunNow,
std::move(callback_), CEF_MEDIA_PERMISSION_NONE));
}
}
}
void Continue(uint32_t allowed_permissions) override {
if (CEF_CURRENTLY_ON_UIT()) {
if (!callback_.is_null()) {
RunNow(std::move(callback_), allowed_permissions);
}
} else {
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefMediaAccessCallbackImpl::Continue, this,
allowed_permissions));
}
}
void Cancel() override { Continue(CEF_MEDIA_PERMISSION_NONE); }
[[nodiscard]] CallbackType Disconnect() { return std::move(callback_); }
bool IsDisconnected() const { return callback_.is_null(); }
private:
static void RunNow(CallbackType callback, uint32_t allowed_permissions) {
callback.ExecuteCallback(allowed_permissions);
}
CallbackType callback_;
IMPLEMENT_REFCOUNTING(CefMediaAccessCallbackImpl);
};
bool CheckCommandLinePermission() {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
return command_line->HasSwitch(switches::kEnableMediaStream);
}
} // namespace
bool CheckMediaAccessPermission(CefBrowserHostBase* browser,
content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
blink::mojom::MediaStreamType type) {
// Always allowed here. RequestMediaAccessPermission will be called.
return true;
}
content::MediaResponseCallback RequestMediaAccessPermission(
CefBrowserHostBase* browser,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback,
bool default_disallow) {
CEF_REQUIRE_UIT();
CefMediaAccessQuery query(browser, request, std::move(callback));
if (CheckCommandLinePermission()) {
// Allow all requested permissions.
query.ExecuteCallback(query.requested_permissions());
return base::NullCallback();
}
bool handled = false;
if (auto client = browser->GetClient()) {
if (auto handler = client->GetPermissionHandler()) {
const auto requested_permissions = query.requested_permissions();
CefRefPtr<CefMediaAccessCallbackImpl> callbackImpl(
new CefMediaAccessCallbackImpl(std::move(query)));
auto frame =
browser->GetFrameForGlobalId(content::GlobalRenderFrameHostId(
request.render_process_id, request.render_frame_id));
if (!frame)
frame = browser->GetMainFrame();
handled = handler->OnRequestMediaAccessPermission(
browser, frame, request.security_origin.spec(), requested_permissions,
callbackImpl.get());
if (!handled) {
LOG_IF(ERROR, callbackImpl->IsDisconnected())
<< "Should return true from OnRequestMediaAccessPermission when "
"executing the callback";
query = callbackImpl->Disconnect();
}
}
}
if (!query.is_null()) {
if (default_disallow && !handled) {
// Disallow access by default.
query.ExecuteCallback(CEF_MEDIA_PERMISSION_NONE);
} else {
// Proceed with default handling.
return query.DisconnectCallback();
}
}
return base::NullCallback();
}
} // namespace media_access_query

View File

@@ -0,0 +1,37 @@
// Copyright 2022 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_ACCESS_QUERY_H_
#define CEF_LIBCEF_BROWSER_MEDIA_ACCESS_QUERY_H_
#pragma once
#include "content/public/browser/media_stream_request.h"
namespace content {
class RenderFrameHost;
}
class CefBrowserHostBase;
class GURL;
namespace media_access_query {
// Called from WebContentsDelegate::CheckMediaAccessPermission.
bool CheckMediaAccessPermission(CefBrowserHostBase* browser,
content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
blink::mojom::MediaStreamType type);
// Called from WebContentsDelegate::RequestMediaAccessPermission.
// |callback| will be returned if the request is unhandled and
// |default_disallow| is false.
[[nodiscard]] content::MediaResponseCallback RequestMediaAccessPermission(
CefBrowserHostBase* browser,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback,
bool default_disallow);
} // namespace media_access_query
#endif // CEF_LIBCEF_BROWSER_MEDIA_ACCESS_QUERY_H_

View File

@@ -0,0 +1,108 @@
// Copyright 2022 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_stream_registrar.h"
#include "libcef/browser/browser_host_base.h"
#include "libcef/browser/thread_util.h"
class CefMediaStreamUI : public content::MediaStreamUI {
public:
CefMediaStreamUI(base::WeakPtr<CefMediaStreamRegistrar> registrar,
bool has_video,
bool has_audio)
: registrar_(registrar), has_video_(has_video), has_audio_(has_audio) {}
~CefMediaStreamUI() override {
if (registrar_) {
registrar_->UnregisterMediaStream(label_);
}
}
CefMediaStreamUI(const CefMediaStreamUI&) = delete;
CefMediaStreamUI& operator=(const CefMediaStreamUI&) = delete;
gfx::NativeViewId OnStarted(
base::RepeatingClosure stop,
SourceCallback source,
const std::string& label,
std::vector<content::DesktopMediaID> screen_capture_ids,
StateChangeCallback state_change) override {
if (registrar_) {
label_ = label;
registrar_->RegisterMediaStream(label, has_video_, has_audio_);
}
return 0;
}
void OnDeviceStoppedForSourceChange(
const std::string& label,
const content::DesktopMediaID& old_media_id,
const content::DesktopMediaID& new_media_id) override {}
void OnDeviceStopped(const std::string& label,
const content::DesktopMediaID& media_id) override {}
private:
base::WeakPtr<CefMediaStreamRegistrar> registrar_;
const bool has_video_;
const bool has_audio_;
std::string label_;
};
CefMediaStreamRegistrar::CefMediaStreamRegistrar(CefBrowserHostBase* browser)
: browser_(browser) {}
std::unique_ptr<content::MediaStreamUI>
CefMediaStreamRegistrar::MaybeCreateMediaStreamUI(bool has_video,
bool has_audio) const {
// Only create the object if the callback will be executed.
if (auto client = browser_->GetClient()) {
if (auto handler = client->GetDisplayHandler()) {
return std::make_unique<CefMediaStreamUI>(weak_ptr_factory_.GetWeakPtr(),
has_video, has_audio);
}
}
return nullptr;
}
void CefMediaStreamRegistrar::RegisterMediaStream(const std::string& label,
bool video,
bool audio) {
CEF_REQUIRE_UIT();
MediaStreamInfo info = {video, audio};
registered_streams_.insert(std::make_pair(label, info));
NotifyMediaStreamChange();
}
void CefMediaStreamRegistrar::UnregisterMediaStream(const std::string& label) {
CEF_REQUIRE_UIT();
registered_streams_.erase(label);
NotifyMediaStreamChange();
}
void CefMediaStreamRegistrar::NotifyMediaStreamChange() {
bool video = false;
bool audio = false;
for (const auto& media_stream : registered_streams_) {
const auto& info = media_stream.second;
if (!video)
video = info.video;
if (!audio)
audio = info.audio;
}
if (audio == last_notified_info_.audio &&
video == last_notified_info_.video) {
return;
}
last_notified_info_ = {video, audio};
if (auto client = browser_->GetClient()) {
if (auto handler = client->GetDisplayHandler()) {
handler->OnMediaAccessChange(browser_, video, audio);
}
}
}

View File

@@ -0,0 +1,56 @@
// Copyright 2022 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_STREAM_REGISTRAR_H_
#define CEF_LIBCEF_BROWSER_MEDIA_STREAM_REGISTRAR_H_
#pragma once
#include <map>
#include <memory>
#include <string>
#include "base/memory/weak_ptr.h"
#include "content/public/browser/media_stream_request.h"
class CefBrowserHostBase;
class CefMediaStreamUI;
class CefMediaStreamRegistrar {
public:
explicit CefMediaStreamRegistrar(CefBrowserHostBase* browser);
CefMediaStreamRegistrar(const CefMediaStreamRegistrar&) = delete;
CefMediaStreamRegistrar& operator=(const CefMediaStreamRegistrar&) = delete;
std::unique_ptr<content::MediaStreamUI> MaybeCreateMediaStreamUI(
bool has_video,
bool has_audio) const;
private:
friend class CefMediaStreamUI;
// Called from CefMediaStreamUI.
void RegisterMediaStream(const std::string& label, bool video, bool audio);
void UnregisterMediaStream(const std::string& label);
void NotifyMediaStreamChange();
// Guaranteed to outlive this object.
CefBrowserHostBase* const browser_;
struct MediaStreamInfo {
bool video;
bool audio;
};
// Current in use media streams.
std::map<std::string, MediaStreamInfo> registered_streams_;
// Last notified media stream info.
MediaStreamInfo last_notified_info_{};
base::WeakPtrFactory<CefMediaStreamRegistrar> weak_ptr_factory_{this};
};
#endif // CEF_LIBCEF_BROWSER_MEDIA_STREAM_REGISTRAR_H_

View File

@@ -140,6 +140,13 @@ NSUInteger NativeModifiers(int cef_modifiers) {
return native_modifiers;
}
constexpr int kDefaultHeight = 750;
constexpr int kDefaultWidth = 750;
constexpr NSWindowStyleMask kDefaultStyleMask =
NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable |
NSWindowStyleMaskUnifiedTitleAndToolbar;
} // namespace
CefBrowserPlatformDelegateNativeMac::CefBrowserPlatformDelegateNativeMac(
@@ -176,19 +183,15 @@ bool CefBrowserPlatformDelegateNativeMac::CreateHostWindow() {
// Create a new window.
NSRect window_rect = {{x, y}, {width, height}};
if (window_rect.size.width == 0)
window_rect.size.width = 750;
window_rect.size.width = kDefaultWidth;
if (window_rect.size.height == 0)
window_rect.size.height = 750;
window_rect.size.height = kDefaultHeight;
content_rect = {{0, 0}, {window_rect.size.width, window_rect.size.height}};
newWnd = [[UnderlayOpenGLHostingWindow alloc]
initWithContentRect:window_rect
styleMask:(NSWindowStyleMaskTitled |
NSWindowStyleMaskClosable |
NSWindowStyleMaskMiniaturizable |
NSWindowStyleMaskResizable |
NSWindowStyleMaskUnifiedTitleAndToolbar)
styleMask:kDefaultStyleMask
backing:NSBackingStoreBuffered
defer:NO];

View File

@@ -11,6 +11,7 @@
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/context.h"
#include "libcef/browser/native/window_delegate_view.h"
#include "libcef/browser/screen_util.h"
#include "libcef/browser/thread_util.h"
#include "base/base_paths_win.h"
@@ -146,6 +147,61 @@ float GetWindowScaleFactor(HWND hwnd) {
.device_scale_factor();
}
struct ScreenInfo {
float scale_factor;
CefRect rect;
};
ScreenInfo GetScreenInfo(int x, int y) {
const auto display =
display::Screen::GetScreen()->GetDisplayNearestPoint(gfx::Point(x, y));
const auto rect = display.work_area();
return ScreenInfo{display.device_scale_factor(),
CefRect(rect.x(), rect.y(), rect.width(), rect.height())};
}
CefRect GetFrameRectFromLogicalContentRect(CefRect content,
DWORD style,
DWORD ex_style,
bool has_menu,
float scale) {
const auto scaled_rect = gfx::ScaleToRoundedRect(
gfx::Rect(content.x, content.y, content.width, content.height), scale);
RECT rect = {0, 0, scaled_rect.width(), scaled_rect.height()};
AdjustWindowRectEx(&rect, style, has_menu, ex_style);
return CefRect(scaled_rect.x(), scaled_rect.y(), rect.right - rect.left,
rect.bottom - rect.top);
}
CefRect GetAdjustedWindowRect(CefRect content,
DWORD style,
DWORD ex_style,
bool has_menu) {
// If height or width is not provided, let OS determine position and size,
// similarly to Chromium behavior
if (content.width == CW_USEDEFAULT || content.height == CW_USEDEFAULT) {
return CefRect(CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT);
}
if (content.x == CW_USEDEFAULT) {
content.x = 0;
}
if (content.y == CW_USEDEFAULT) {
content.y = 0;
}
const ScreenInfo screen = GetScreenInfo(content.x, content.y);
const CefRect rect = MakeVisibleOnScreenRect(content, screen.rect);
return GetFrameRectFromLogicalContentRect(rect, style, ex_style, has_menu,
screen.scale_factor);
}
} // namespace
CefBrowserPlatformDelegateNativeWin::CefBrowserPlatformDelegateNativeWin(
@@ -182,14 +238,23 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
has_frame_ = !(window_info_.style & WS_CHILD);
std::wstring windowName(CefString(&window_info_.window_name));
const std::wstring windowName(CefString(&window_info_.window_name));
CefRect window_rect = window_info_.bounds;
if (!window_info_.parent_window) {
const bool has_menu =
!(window_info_.style & WS_CHILD) && (window_info_.menu != NULL);
window_rect = GetAdjustedWindowRect(window_rect, window_info_.style,
window_info_.ex_style, has_menu);
}
// Create the new browser window.
CreateWindowEx(window_info_.ex_style, GetWndClass(), windowName.c_str(),
window_info_.style, window_info_.bounds.x,
window_info_.bounds.y, window_info_.bounds.width,
window_info_.bounds.height, window_info_.parent_window,
window_info_.menu, ::GetModuleHandle(NULL), this);
window_info_.style, window_rect.x, window_rect.y,
window_rect.width, window_rect.height,
window_info_.parent_window, window_info_.menu,
::GetModuleHandle(NULL), this);
// It's possible for CreateWindowEx to fail if the parent window was
// destroyed between the call to CreateBrowser and the above one.
@@ -285,28 +350,43 @@ void CefBrowserPlatformDelegateNativeWin::SetFocus(bool setFocus) {
if (!setFocus)
return;
if (web_contents_) {
// Give logical focus to the RenderWidgetHostViewAura in the views
// hierarchy. This does not change the native keyboard focus.
web_contents_->Focus();
}
if (window_widget_) {
// Give native focus to the DesktopWindowTreeHostWin associated with the
// root window.
// Give native focus to the DesktopWindowTreeHostWin ("Chrome_WidgetWin_0")
// associated with the root window. The currently focused HWND may be
// "CefBrowserWindow" if we're called in response to our WndProc receiving
// the WM_SETFOCUS event (possibly due to "CefBrowserWindow" recieving the
// top-level WM_ACTIVATE event), or some other HWND if the client calls
// CefBrowserHost::SetFocus(true) directly. DesktopWindowTreeHostWin may
// also receive focus/blur and mouse click events from the OS directly, in
// which case this method will not be called but the below discussion still
// applies.
//
// The DesktopWindowTreeHostWin HandleNativeFocus/HandleNativeBlur methods
// The DesktopWindowTreeHostWin::HandleNativeFocus/HandleNativeBlur methods
// are called in response to WM_SETFOCUS/WM_KILLFOCUS respectively. The
// implementation has been patched to call HandleActivationChanged which
// results in the following behaviors:
// DesktopWindowTreeHostWin::HandleMouseEvent method is called if the user
// clicks on the WebContents. These methods have all been patched to call
// HandleActivationChanged (indirectly via ::SetFocus in the case of mouse
// clicks). HandleActivationChanged will then trigger the following
// behaviors:
// 1. Update focus/activation state of the aura::Window indirectly via
// wm::FocusController. This allows focus-related behaviors (e.g. focus
// rings, flashing caret, onFocus/onBlur JS events, etc.) to work as
// expected (see issue #1677).
// expected (see issue #1677) and also triggers an initial call to
// WebContents::Focus which gives logical focus to the
// RenderWidgetHostViewAura in the views hierarchy (see issue #3306).
// 2. Update focus state of the ui::InputMethod. If this does not occur
// then InputMethodBase::GetTextInputClient will return NULL and
// InputMethodWin::OnChar will fail to sent character events to the
// renderer (see issue #1700).
// then:
// (a) InputMethodBase::GetTextInputClient will return NULL and
// InputMethodWin::OnChar will fail to send character events to the
// renderer (see issue #1700); and
// (b) InputMethodWinBase::IsWindowFocused will return false due to
// ::GetFocus() returning the currently focused HWND (e.g.
// "CefBrowserWindow") instead of the expected "Chrome_WidgetWin_0" HWND,
// causing TSF not to handle IME events (see issue #3306). For this same
// reason, ::SetFocus needs to be called before WebContents::Focus which
// sends the InputMethod OnWillChangeFocusedClient notification that then
// calls IsWindowFocused (e.g. WebContents::Focus is intentionally called
// multiple times).
//
// This differs from activation in Chrome which is handled via
// HWNDMessageHandler::PostProcessActivateMessage (Widget::Show indirectly
@@ -322,6 +402,15 @@ void CefBrowserPlatformDelegateNativeWin::SetFocus(bool setFocus) {
// discovered.
::SetFocus(HWNDForWidget(window_widget_));
}
if (web_contents_) {
// Give logical focus to the RenderWidgetHostViewAura in the views
// hierarchy. This does not change the native keyboard focus. When
// |window_widget_| exists this additional Focus() call is necessary to
// correctly assign focus/input state after native focus resulting from
// window activation (see the InputMethod discussion above).
web_contents_->Focus();
}
}
void CefBrowserPlatformDelegateNativeWin::NotifyMoveOrResizeStarted() {
@@ -348,18 +437,17 @@ void CefBrowserPlatformDelegateNativeWin::NotifyMoveOrResizeStarted() {
void CefBrowserPlatformDelegateNativeWin::SizeTo(int width, int height) {
HWND window = window_info_.window;
RECT rect = {0, 0, width, height};
DWORD style = GetWindowLong(window, GWL_STYLE);
DWORD ex_style = GetWindowLong(window, GWL_EXSTYLE);
bool has_menu = !(style & WS_CHILD) && (GetMenu(window) != NULL);
const DWORD style = GetWindowLong(window, GWL_STYLE);
const DWORD ex_style = GetWindowLong(window, GWL_EXSTYLE);
const bool has_menu = !(style & WS_CHILD) && (GetMenu(window) != NULL);
const float scale = GetWindowScaleFactor(window);
// The size value is for the client area. Calculate the whole window size
// based on the current style.
AdjustWindowRectEx(&rect, style, has_menu, ex_style);
const CefRect content_rect(0, 0, width, height);
const CefRect frame_rect = GetFrameRectFromLogicalContentRect(
content_rect, style, ex_style, has_menu, scale);
// Size the window. The left/top values may be negative.
SetWindowPos(window, NULL, 0, 0, rect.right - rect.left,
rect.bottom - rect.top,
SetWindowPos(window, NULL, 0, 0, frame_rect.width, frame_rect.height,
SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
}
@@ -613,7 +701,16 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
rect->bottom - rect->top, SWP_NOZORDER | SWP_NOACTIVATE);
}
break;
case WM_ENABLE:
if (wParam == TRUE && browser) {
// Give focus to the browser after EnableWindow enables this window
// (e.g. after a modal dialog is dismissed).
browser->SetFocus(true);
return 0;
}
break;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
}

View File

@@ -39,7 +39,8 @@ network::mojom::CookieManager* GetCookieManager(
->GetCookieManagerForBrowserProcess();
}
net::CookieOptions GetCookieOptions(const network::ResourceRequest& request) {
net::CookieOptions GetCookieOptions(const network::ResourceRequest& request,
bool for_loading_cookies) {
// Match the logic from InterceptionJob::FetchCookies and
// ChromeContentBrowserClient::ShouldIgnoreSameSiteCookieRestrictionsWhenTopLevel.
bool should_treat_as_first_party =
@@ -50,14 +51,33 @@ net::CookieOptions GetCookieOptions(const network::ResourceRequest& request) {
request.trusted_params->isolation_info.request_type() ==
net::IsolationInfo::RequestType::kMainFrame;
// Match the logic from URLRequestHttpJob::AddCookieHeaderAndStart.
// Match the logic from URLRequest::SetURLChain.
std::vector<GURL> url_chain{request.url};
if (request.navigation_redirect_chain.size() >= 2) {
// Keep |request.url| as the final entry in the chain.
url_chain.insert(url_chain.begin(),
request.navigation_redirect_chain.begin(),
request.navigation_redirect_chain.begin() +
request.navigation_redirect_chain.size() - 1);
}
net::CookieOptions options;
options.set_include_httponly();
options.set_same_site_cookie_context(
net::cookie_util::ComputeSameSiteContextForRequest(
request.method, {request.url}, request.site_for_cookies,
request.request_initiator, is_main_frame_navigation,
should_treat_as_first_party));
if (for_loading_cookies) {
// Match the logic from URLRequestHttpJob::AddCookieHeaderAndStart.
options.set_same_site_cookie_context(
net::cookie_util::ComputeSameSiteContextForRequest(
request.method, url_chain, request.site_for_cookies,
request.request_initiator, is_main_frame_navigation,
should_treat_as_first_party));
} else {
// Match the logic from
// URLRequestHttpJob::SaveCookiesAndNotifyHeadersComplete.
options.set_same_site_cookie_context(
net::cookie_util::ComputeSameSiteContextForResponse(
url_chain, request.site_for_cookies, request.request_initiator,
is_main_frame_navigation, should_treat_as_first_party));
}
return options;
}
@@ -227,10 +247,11 @@ void LoadCookies(const CefBrowserContext::Getter& browser_context_getter,
}
CEF_POST_TASK(
CEF_UIT, base::BindOnce(LoadCookiesOnUIThread, browser_context_getter,
request.url, GetCookieOptions(request),
net::CookiePartitionKeyCollection(),
allow_cookie_callback, std::move(done_callback)));
CEF_UIT,
base::BindOnce(LoadCookiesOnUIThread, browser_context_getter, request.url,
GetCookieOptions(request, /*for_loading_cookies=*/true),
net::CookiePartitionKeyCollection(), allow_cookie_callback,
std::move(done_callback)));
}
void SaveCookies(const CefBrowserContext::Getter& browser_context_getter,
@@ -281,9 +302,10 @@ void SaveCookies(const CefBrowserContext::Getter& browser_context_getter,
if (!allowed_cookies.empty()) {
CEF_POST_TASK(
CEF_UIT,
base::BindOnce(SaveCookiesOnUIThread, browser_context_getter,
request.url, GetCookieOptions(request), total_count,
std::move(allowed_cookies), std::move(done_callback)));
base::BindOnce(
SaveCookiesOnUIThread, browser_context_getter, request.url,
GetCookieOptions(request, /*for_loading_cookies=*/false),
total_count, std::move(allowed_cookies), std::move(done_callback)));
} else {
std::move(done_callback).Run(total_count, std::move(allowed_cookies));

View File

@@ -0,0 +1,296 @@
// Copyright 2022 The Chromium Embedded Framework Authors. Portions copyright
// 2016 The Chromium Authors. All rights reserved. Use of this source code is
// governed by a BSD-style license that can be found in the LICENSE file.
#include "libcef/browser/permission_prompt.h"
#include "libcef/browser/browser_host_base.h"
#include "libcef/features/runtime.h"
#include "base/logging.h"
#include "base/memory/weak_ptr.h"
#include "base/notreached.h"
#include "chrome/browser/ui/permission_bubble/permission_prompt.h"
namespace permission_prompt {
namespace {
uint64_t g_next_prompt_id = 0;
using DelegateCallback =
base::OnceCallback<void(cef_permission_request_result_t)>;
class CefPermissionPromptCallbackImpl : public CefPermissionPromptCallback {
public:
using CallbackType = base::OnceCallback<void(cef_permission_request_result_t,
bool /*notify_delegate*/)>;
explicit CefPermissionPromptCallbackImpl(CallbackType&& callback)
: callback_(std::move(callback)) {}
CefPermissionPromptCallbackImpl(const CefPermissionPromptCallbackImpl&) =
delete;
CefPermissionPromptCallbackImpl& operator=(
const CefPermissionPromptCallbackImpl&) = delete;
// Don't need to execute the callback in this destructor because this object
// will always be kept alive until after the CefPermissionPrompt is destroyed,
// and that object will disconnect/execute the callback in its destructor.
~CefPermissionPromptCallbackImpl() override = default;
void Continue(cef_permission_request_result_t result) override {
if (CEF_CURRENTLY_ON_UIT()) {
if (!callback_.is_null()) {
auto callback = base::BindOnce(std::move(callback_), result,
/*notify_delegate=*/true);
if (safe_to_run_sync_) {
std::move(callback).Run();
} else {
CEF_POST_TASK(CEF_UIT, std::move(callback));
}
}
} else {
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefPermissionPromptCallbackImpl::Continue,
this, result));
}
}
[[nodiscard]] CallbackType Disconnect() { return std::move(callback_); }
bool IsDisconnected() const { return callback_.is_null(); }
void MarkSafeToRunSync() { safe_to_run_sync_ = true; }
private:
// Callback execution from inside CreatePermissionPromptImpl must be async,
// otherwise PermissionRequestManager state will be incorrect.
bool safe_to_run_sync_ = false;
CallbackType callback_;
IMPLEMENT_REFCOUNTING(CefPermissionPromptCallbackImpl);
};
// Implementation based on PermissionPromptAndroid.
class CefPermissionPrompt : public permissions::PermissionPrompt {
public:
explicit CefPermissionPrompt(Delegate* delegate) : delegate_(delegate) {
DCHECK(delegate_);
}
CefPermissionPrompt(const CefPermissionPrompt&) = delete;
CefPermissionPrompt& operator=(const CefPermissionPrompt&) = delete;
// Expect to be destroyed (and the UI needs to go) when:
// 1. A navigation happens, tab/webcontents is being closed; with the current
// GetTabSwitchingBehavior() implementation, this instance survives the tab
// being backgrounded.
// 2. The permission request is resolved (accept, deny, dismiss).
// 3. A higher priority request comes in.
~CefPermissionPrompt() override {
CEF_REQUIRE_UIT();
if (callback_) {
// If the callback is non-null at this point then we still need to execute
// it in order to notify the client.
auto callback = callback_->Disconnect();
if (!callback.is_null()) {
std::move(callback).Run(CEF_PERMISSION_RESULT_IGNORE,
/*notify_delegate=*/false);
}
}
}
// Used to associate the client callback when OnShowPermissionPrompt is
// handled.
void AttachClientCallback(
CefRefPtr<CefPermissionPromptCallbackImpl> callback) {
DCHECK(callback);
callback_ = callback;
callback_->MarkSafeToRunSync();
}
// Used to tie Delegate access to this object's lifespan.
DelegateCallback MakeDelegateCallback() const {
return base::BindOnce(&CefPermissionPrompt::NotifyDelegate,
weak_ptr_factory_.GetWeakPtr());
}
// PermissionPrompt methods:
void UpdateAnchor() override { NOTIMPLEMENTED(); }
TabSwitchingBehavior GetTabSwitchingBehavior() override {
return TabSwitchingBehavior::kKeepPromptAlive;
}
permissions::PermissionPromptDisposition GetPromptDisposition()
const override {
return permissions::PermissionPromptDisposition::CUSTOM_MODAL_DIALOG;
}
private:
// We don't expose AcceptThisTime() because it's a special case for
// Geolocation (see DCHECK in PrefProvider::SetWebsiteSetting).
void NotifyDelegate(cef_permission_request_result_t result) {
switch (result) {
case CEF_PERMISSION_RESULT_ACCEPT:
delegate_->Accept();
break;
case CEF_PERMISSION_RESULT_DENY:
delegate_->Deny();
break;
case CEF_PERMISSION_RESULT_DISMISS:
delegate_->Dismiss();
break;
case CEF_PERMISSION_RESULT_IGNORE:
delegate_->Ignore();
break;
}
}
// |delegate_| is the PermissionRequestManager, which owns this object.
const raw_ptr<Delegate> delegate_;
CefRefPtr<CefPermissionPromptCallbackImpl> callback_;
base::WeakPtrFactory<CefPermissionPrompt> weak_ptr_factory_{this};
};
// |notify_delegate| will be false if called from the CefPermissionPrompt
// destructor.
void ExecuteResult(CefRefPtr<CefBrowserHostBase> browser,
uint64_t prompt_id,
DelegateCallback delegate_callback,
cef_permission_request_result_t result,
bool notify_delegate) {
CEF_REQUIRE_UIT();
if (auto client = browser->GetClient()) {
if (auto handler = client->GetPermissionHandler()) {
handler->OnDismissPermissionPrompt(browser, prompt_id, result);
}
}
if (notify_delegate) {
// Will be a no-op if this executes after the CefPermissionPrompt was
// destroyed.
std::move(delegate_callback).Run(result);
}
}
cef_permission_request_types_t GetCefRequestType(
permissions::RequestType type) {
switch (type) {
case permissions::RequestType::kAccessibilityEvents:
return CEF_PERMISSION_TYPE_ACCESSIBILITY_EVENTS;
case permissions::RequestType::kArSession:
return CEF_PERMISSION_TYPE_AR_SESSION;
case permissions::RequestType::kCameraPanTiltZoom:
return CEF_PERMISSION_TYPE_CAMERA_PAN_TILT_ZOOM;
case permissions::RequestType::kCameraStream:
return CEF_PERMISSION_TYPE_CAMERA_STREAM;
case permissions::RequestType::kClipboard:
return CEF_PERMISSION_TYPE_CLIPBOARD;
case permissions::RequestType::kDiskQuota:
return CEF_PERMISSION_TYPE_DISK_QUOTA;
case permissions::RequestType::kLocalFonts:
return CEF_PERMISSION_TYPE_LOCAL_FONTS;
case permissions::RequestType::kGeolocation:
return CEF_PERMISSION_TYPE_GEOLOCATION;
case permissions::RequestType::kIdleDetection:
return CEF_PERMISSION_TYPE_IDLE_DETECTION;
case permissions::RequestType::kMicStream:
return CEF_PERMISSION_TYPE_MIC_STREAM;
case permissions::RequestType::kMidiSysex:
return CEF_PERMISSION_TYPE_MIDI_SYSEX;
case permissions::RequestType::kMultipleDownloads:
return CEF_PERMISSION_TYPE_MULTIPLE_DOWNLOADS;
case permissions::RequestType::kNotifications:
return CEF_PERMISSION_TYPE_NOTIFICATIONS;
#if BUILDFLAG(IS_WIN)
case permissions::RequestType::kProtectedMediaIdentifier:
return CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER;
#endif
case permissions::RequestType::kRegisterProtocolHandler:
return CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER;
case permissions::RequestType::kSecurityAttestation:
return CEF_PERMISSION_TYPE_SECURITY_ATTESTATION;
case permissions::RequestType::kStorageAccess:
return CEF_PERMISSION_TYPE_STORAGE_ACCESS;
case permissions::RequestType::kU2fApiRequest:
return CEF_PERMISSION_TYPE_U2F_API_REQUEST;
case permissions::RequestType::kVrSession:
return CEF_PERMISSION_TYPE_VR_SESSION;
case permissions::RequestType::kWindowPlacement:
return CEF_PERMISSION_TYPE_WINDOW_PLACEMENT;
}
NOTREACHED();
return CEF_PERMISSION_TYPE_NONE;
}
uint32_t GetRequestedPermissions(
permissions::PermissionPrompt::Delegate* delegate) {
uint32_t permissions = CEF_PERMISSION_TYPE_NONE;
for (const auto* request : delegate->Requests()) {
permissions |= GetCefRequestType(request->request_type());
}
return permissions;
}
std::unique_ptr<permissions::PermissionPrompt> CreatePermissionPromptImpl(
content::WebContents* web_contents,
permissions::PermissionPrompt::Delegate* delegate,
bool* default_handling) {
CEF_REQUIRE_UIT();
if (auto browser = CefBrowserHostBase::GetBrowserForContents(web_contents)) {
if (auto client = browser->GetClient()) {
if (auto handler = client->GetPermissionHandler()) {
auto permission_prompt =
std::make_unique<CefPermissionPrompt>(delegate);
const auto prompt_id = ++g_next_prompt_id;
auto callback =
base::BindOnce(&ExecuteResult, browser, prompt_id,
permission_prompt->MakeDelegateCallback());
CefRefPtr<CefPermissionPromptCallbackImpl> callbackImpl(
new CefPermissionPromptCallbackImpl(std::move(callback)));
bool handled = handler->OnShowPermissionPrompt(
browser, prompt_id, delegate->GetRequestingOrigin().spec(),
GetRequestedPermissions(delegate), callbackImpl.get());
if (callbackImpl->IsDisconnected() || handled) {
// Callback execution will be async.
LOG_IF(ERROR, !handled)
<< "Should return true from OnShowPermissionPrompt when "
"executing the callback";
*default_handling = false;
permission_prompt->AttachClientCallback(callbackImpl);
return permission_prompt;
} else {
// Proceed with default handling. |callback| is discarded without
// execution.
callback = callbackImpl->Disconnect();
}
}
}
}
if (cef::IsAlloyRuntimeEnabled()) {
LOG(INFO) << "Implement OnShowPermissionPrompt to override default IGNORE "
"handling of permission prompts.";
}
// Proceed with default handling. This will be IGNORE with the Alloy runtime
// and default UI prompt with the Chrome runtime.
*default_handling = true;
return nullptr;
}
} // namespace
void RegisterCreateCallback() {
SetCreatePermissionPromptFunction(&CreatePermissionPromptImpl);
}
} // namespace permission_prompt

View File

@@ -0,0 +1,15 @@
// Copyright 2022 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_PERMISSION_PROMPT_H_
#define CEF_LIBCEF_BROWSER_PERMISSION_PROMPT_H_
#pragma once
namespace permission_prompt {
void RegisterCreateCallback();
} // namespace permission_prompt
#endif // CEF_LIBCEF_BROWSER_PERMISSION_PROMPT_H_

View File

@@ -23,6 +23,7 @@
#include "chrome/browser/first_party_sets/first_party_sets_pref_names.h"
#include "chrome/browser/media/media_device_id_salt.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/media/webrtc/permission_bubble_media_access_handler.h"
#include "chrome/browser/net/profile_network_context_service.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/plugins/plugin_info_host_impl.h"
@@ -46,6 +47,7 @@
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "components/language/core/browser/language_prefs.h"
#include "components/language/core/browser/pref_names.h"
#include "components/permissions/permission_actions_history.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/json_pref_store.h"
#include "components/prefs/pref_filter.h"
@@ -224,6 +226,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
certificate_transparency::prefs::RegisterPrefs(registry.get());
flags_ui::PrefServiceFlagsStorage::RegisterPrefs(registry.get());
media_router::RegisterLocalStatePrefs(registry.get());
permissions::PermissionActionsHistory::RegisterProfilePrefs(registry.get());
PluginInfoHostImpl::RegisterUserPrefs(registry.get());
PrefProxyConfigTrackerImpl::RegisterPrefs(registry.get());
ProfileNetworkContextService::RegisterLocalStatePrefs(registry.get());
@@ -269,6 +272,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
language::LanguagePrefs::RegisterProfilePrefs(registry.get());
media_router::RegisterProfilePrefs(registry.get());
MediaDeviceIDSalt::RegisterProfilePrefs(registry.get());
PermissionBubbleMediaAccessHandler::RegisterProfilePrefs(registry.get());
prefetch::RegisterPredictionOptionsProfilePrefs(registry.get());
ProfileNetworkContextService::RegisterProfilePrefs(registry.get());
safe_browsing::RegisterProfilePrefs(registry.get());

View File

@@ -37,6 +37,7 @@
#include "content/public/browser/web_contents_observer.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "printing/metafile_skia.h"
#include "printing/units.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#if BUILDFLAG(IS_LINUX)
@@ -67,8 +68,8 @@ void FillInDictionaryFromPdfPrintSettings(
print_settings.Set(kSettingDeviceName, "");
print_settings.Set(kSettingRasterizePdf, false);
print_settings.Set(kSettingPreviewModifiable, false);
print_settings.Set(kSettingDpiHorizontal, 0);
print_settings.Set(kSettingDpiVertical, 0);
print_settings.Set(kSettingDpiHorizontal, printing::kDefaultPdfDpi);
print_settings.Set(kSettingDpiVertical, printing::kDefaultPdfDpi);
print_settings.Set(kSettingPagesPerSheet, 1);
// User defined settings.
@@ -137,9 +138,7 @@ void StopWorker(int document_cookie) {
std::unique_ptr<PrinterQuery> printer_query =
queue->PopPrinterQuery(document_cookie);
if (printer_query.get()) {
content::GetIOThreadTaskRunner({})->PostTask(
FROM_HERE,
base::BindOnce(&PrinterQuery::StopWorker, std::move(printer_query)));
printer_query->StopWorker();
}
}

View File

@@ -0,0 +1,39 @@
// Copyright (c) 2022 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/screen_util.h"
#include <algorithm>
namespace {
constexpr int kMinWidth = 0;
constexpr int kMinHeight = 0;
// Makes sure that line segment lies entirely between min and max.
int clamp_segment_start(int start, int len, int min, int max) {
start = std::clamp(start, min, max);
const int end = start + len;
const int excess = end - max;
if (excess > 0)
start = start - excess;
return start;
}
} // namespace
CefRect MakeVisibleOnScreenRect(const CefRect& rect, const CefRect& screen) {
const int width = std::clamp(rect.width, kMinWidth, screen.width);
const int height = std::clamp(rect.height, kMinHeight, screen.height);
const int right_border = screen.x + screen.width;
const int x = clamp_segment_start(rect.x, width, screen.x, right_border);
const int bottom_border = screen.y + screen.height;
const int y = clamp_segment_start(rect.y, height, screen.y, bottom_border);
return CefRect(x, y, width, height);
}

View File

@@ -0,0 +1,17 @@
// Copyright (c) 2022 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_SCREEN_UTIL_H_
#define CEF_LIBCEF_BROWSER_SCREEN_UTIL_H_
#pragma once
#include "include/internal/cef_types_wrappers.h"
// Create a new rectangle from the input |rect| rectangle that is fully visible
// on provided |screen_rect| screen. The width and height of the resulting
// rectangle are clamped to the screen width and height respectively if they
// would overflow.
CefRect MakeVisibleOnScreenRect(const CefRect& rect, const CefRect& screen);
#endif // CEF_LIBCEF_BROWSER_SCREEN_UTIL_H_

View File

@@ -0,0 +1,81 @@
// Copyright (c) 2022 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 "cef/libcef/browser/screen_util.h"
#include "tests/gtest/include/gtest/gtest.h"
namespace {
constexpr int kScreenWidth = 1024;
constexpr int kScreenHeight = 768;
const CefRect kMainScreen(0, 0, kScreenWidth, kScreenHeight);
const CefRect kLeftScreen(-1024, 0, kScreenWidth, kScreenHeight);
} // namespace
TEST(MakeVisibleOnScreenRect, RectSizeIsBiggerThanScreen) {
const CefRect rect{400, 500, 1500, 800};
auto result = MakeVisibleOnScreenRect(rect, kMainScreen);
EXPECT_EQ(result.x, 0);
EXPECT_EQ(result.width, kMainScreen.width);
EXPECT_EQ(result.y, 0);
EXPECT_EQ(result.height, kMainScreen.height);
}
TEST(MakeVisibleOnScreenRect, RightBorderIsOutsideTheScreen) {
const CefRect rect{600, 400, 500, 300};
auto result = MakeVisibleOnScreenRect(rect, kMainScreen);
EXPECT_EQ(result.x, 524);
EXPECT_EQ(result.width, rect.width);
EXPECT_EQ(result.y, rect.y);
EXPECT_EQ(result.height, rect.height);
}
TEST(MakeVisibleOnScreenRect, LeftBorderIsOutsideTheScreen) {
const CefRect rect{-400, 400, 500, 300};
auto result = MakeVisibleOnScreenRect(rect, kMainScreen);
EXPECT_EQ(result.x, 0);
EXPECT_EQ(result.width, rect.width);
EXPECT_EQ(result.y, rect.y);
EXPECT_EQ(result.height, rect.height);
}
TEST(MakeVisibleOnScreenRect, BottomBorderIsOutsideTheScreen) {
const CefRect rect{600, 500, 300, 300};
auto result = MakeVisibleOnScreenRect(rect, kMainScreen);
EXPECT_EQ(result.x, 600);
EXPECT_EQ(result.width, rect.width);
EXPECT_EQ(result.y, 468);
EXPECT_EQ(result.height, rect.height);
}
TEST(MakeVisibleOnScreenRect, RectIsVisibleOnTheLeftScreen) {
const CefRect rect{-500, 300, 300, 300};
auto result = MakeVisibleOnScreenRect(rect, kLeftScreen);
EXPECT_EQ(result.x, rect.x);
EXPECT_EQ(result.width, rect.width);
EXPECT_EQ(result.y, rect.y);
EXPECT_EQ(result.height, rect.height);
}
TEST(MakeVisibleOnScreenRect, RectSizeIsBiggerThanLeftScreen) {
const CefRect rect{-500, 300, 3000, 3000};
auto result = MakeVisibleOnScreenRect(rect, kLeftScreen);
EXPECT_EQ(result.x, kLeftScreen.x);
EXPECT_EQ(result.width, kLeftScreen.width);
EXPECT_EQ(result.y, kLeftScreen.y);
EXPECT_EQ(result.height, kLeftScreen.height);
}

View File

@@ -552,12 +552,8 @@ void CefWindowImpl::SendMouseMove(int screen_x, int screen_y) {
CEF_REQUIRE_VALID_RETURN_VOID();
InitializeUITesting();
// Converts to pixel coordinates internally on Windows.
gfx::Point point(screen_x, screen_y);
#if BUILDFLAG(IS_WIN)
// Windows expects pixel coordinates.
point = display::win::ScreenWin::DIPToScreenPoint(point);
#endif
ui_controls::SendMouseMove(point.x(), point.y());
}

View File

@@ -246,9 +246,9 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
base::NumberToString(settings_->uncaught_exception_stack_size));
}
#if BUILDFLAG(IS_WIN)
std::vector<std::string> disable_features;
#if BUILDFLAG(IS_WIN)
if (features::kCalculateNativeWinOcclusion.default_state ==
base::FEATURE_ENABLED_BY_DEFAULT) {
// TODO: Add support for occlusion detection in combination with native
@@ -261,6 +261,15 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
// TODO: Add support for windows spellcheck service (see issue #3055).
disable_features.push_back(spellcheck::kWinUseBrowserSpellChecker.name);
}
#endif // BUILDFLAG(IS_WIN)
if (features::kBackForwardCache.default_state ==
base::FEATURE_ENABLED_BY_DEFAULT) {
// Disable BackForwardCache globally so that
// blink::RuntimeEnabledFeatures::BackForwardCacheEnabled reports the
// correct value in the renderer process (see issue #3374).
disable_features.push_back(features::kBackForwardCache.name);
}
if (!disable_features.empty()) {
DCHECK(!base::FeatureList::GetInstance());
@@ -274,7 +283,6 @@ bool AlloyMainDelegate::BasicStartupComplete(int* exit_code) {
command_line->AppendSwitchASCII(switches::kDisableFeatures,
disable_features_str);
}
#endif // BUILDFLAG(IS_WIN)
}
if (application_) {

View File

@@ -55,6 +55,9 @@ interface RenderFrame {
// Send a message to the render process.
SendMessage(string name, mojo_base.mojom.Value arguments);
// Send a shared memory region to the render process.
SendSharedMemoryRegion(string name, mojo_base.mojom.ReadOnlySharedMemoryRegion region);
// Send a command.
SendCommand(string command);
@@ -80,6 +83,9 @@ interface BrowserFrame {
// Send a message to the browser process.
SendMessage(string name, mojo_base.mojom.Value arguments);
// Send a shared memory region to the browser process.
SendSharedMemoryRegion(string name, mojo_base.mojom.ReadOnlySharedMemoryRegion region);
// The render frame is ready to begin handling actions.
FrameAttached(pending_remote<RenderFrame> render_frame,
bool reattached);

View File

@@ -42,6 +42,9 @@ class CefProcessMessageImpl : public CefProcessMessage {
CefRefPtr<CefProcessMessage> Copy() override;
CefString GetName() override;
CefRefPtr<CefListValue> GetArgumentList() override;
CefRefPtr<CefSharedMemoryRegion> GetSharedMemoryRegion() override {
return nullptr;
}
private:
const CefString name_;

View File

@@ -0,0 +1,90 @@
// Copyright (c) 2022 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/common/process_message_smr_impl.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/shared_memory_mapping.h"
namespace {
class CefSharedMemoryRegionImpl final : public CefSharedMemoryRegion {
public:
CefSharedMemoryRegionImpl(base::ReadOnlySharedMemoryMapping&& mapping)
: mapping_(std::move(mapping)) {}
CefSharedMemoryRegionImpl(const CefSharedMemoryRegionImpl&) = delete;
CefSharedMemoryRegionImpl& operator=(const CefSharedMemoryRegionImpl&) =
delete;
// CefSharedMemoryRegion methods
bool IsValid() override { return mapping_.IsValid(); }
size_t Size() override { return IsValid() ? mapping_.size() : 0; }
const void* Memory() override { return mapping_.memory(); }
private:
base::ReadOnlySharedMemoryMapping mapping_;
IMPLEMENT_REFCOUNTING(CefSharedMemoryRegionImpl);
};
} // namespace
CefProcessMessageSMRImpl::CefProcessMessageSMRImpl(
const CefString& name,
base::ReadOnlySharedMemoryRegion&& region)
: name_(name), region_(std::move(region)) {
DCHECK(!name_.empty());
DCHECK(region_.IsValid());
}
CefProcessMessageSMRImpl::~CefProcessMessageSMRImpl() = default;
bool CefProcessMessageSMRImpl::IsValid() {
return region_.IsValid();
}
CefString CefProcessMessageSMRImpl::GetName() {
return name_;
}
CefRefPtr<CefSharedMemoryRegion>
CefProcessMessageSMRImpl::GetSharedMemoryRegion() {
return new CefSharedMemoryRegionImpl(region_.Map());
}
base::ReadOnlySharedMemoryRegion CefProcessMessageSMRImpl::TakeRegion() {
return std::move(region_);
};
// static
CefRefPtr<CefSharedProcessMessageBuilder>
CefSharedProcessMessageBuilder::Create(const CefString& name,
size_t byte_size) {
return new CefSharedProcessMessageBuilderImpl(name, byte_size);
}
CefSharedProcessMessageBuilderImpl::CefSharedProcessMessageBuilderImpl(
const CefString& name,
size_t byte_size)
: name_(name),
region_(base::ReadOnlySharedMemoryRegion::Create(byte_size)) {}
bool CefSharedProcessMessageBuilderImpl::IsValid() {
return region_.region.IsValid() && region_.mapping.IsValid();
}
size_t CefSharedProcessMessageBuilderImpl::Size() {
return !IsValid() ? 0 : region_.mapping.size();
}
void* CefSharedProcessMessageBuilderImpl::Memory() {
return !IsValid() ? nullptr : region_.mapping.memory();
}
CefRefPtr<CefProcessMessage> CefSharedProcessMessageBuilderImpl::Build() {
if (!IsValid()) {
return nullptr;
}
return new CefProcessMessageSMRImpl(name_, std::move(region_.region));
}

View File

@@ -0,0 +1,58 @@
// Copyright (c) 2022 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_COMMON_PROCESS_MESSAGE_SMR_IMPL_H_
#define CEF_LIBCEF_COMMON_PROCESS_MESSAGE_SMR_IMPL_H_
#pragma once
#include "include/cef_process_message.h"
#include "include/cef_shared_process_message_builder.h"
#include "base/memory/read_only_shared_memory_region.h"
class CefProcessMessageSMRImpl final : public CefProcessMessage {
public:
CefProcessMessageSMRImpl(const CefString& name,
base::ReadOnlySharedMemoryRegion&& region);
CefProcessMessageSMRImpl(const CefProcessMessageSMRImpl&) = delete;
CefProcessMessageSMRImpl& operator=(const CefProcessMessageSMRImpl&) = delete;
~CefProcessMessageSMRImpl() override;
// CefProcessMessage methods.
bool IsValid() override;
bool IsReadOnly() override { return true; }
CefRefPtr<CefProcessMessage> Copy() override { return nullptr; }
CefString GetName() override;
CefRefPtr<CefListValue> GetArgumentList() override { return nullptr; };
CefRefPtr<CefSharedMemoryRegion> GetSharedMemoryRegion() override;
[[nodiscard]] base::ReadOnlySharedMemoryRegion TakeRegion();
private:
const CefString name_;
base::ReadOnlySharedMemoryRegion region_;
IMPLEMENT_REFCOUNTING(CefProcessMessageSMRImpl);
};
class CefSharedProcessMessageBuilderImpl final
: public CefSharedProcessMessageBuilder {
public:
CefSharedProcessMessageBuilderImpl(const CefString& name, size_t byte_size);
CefSharedProcessMessageBuilderImpl(const CefProcessMessageSMRImpl&) = delete;
CefSharedProcessMessageBuilderImpl& operator=(
const CefSharedProcessMessageBuilderImpl&) = delete;
bool IsValid() override;
size_t Size() override;
void* Memory() override;
CefRefPtr<CefProcessMessage> Build() override;
private:
const CefString name_;
base::MappedReadOnlyRegion region_;
IMPLEMENT_REFCOUNTING(CefSharedProcessMessageBuilderImpl);
};
#endif // CEF_LIBCEF_COMMON_PROCESS_MESSAGE_SMR_IMPL_H_

View File

@@ -21,6 +21,7 @@
#include "libcef/common/frame_util.h"
#include "libcef/common/net/http_header_utils.h"
#include "libcef/common/process_message_impl.h"
#include "libcef/common/process_message_smr_impl.h"
#include "libcef/common/request_impl.h"
#include "libcef/common/string_util.h"
#include "libcef/renderer/blink_glue.h"
@@ -60,7 +61,7 @@ constexpr size_t kConnectionRetryMaxCt = 3U;
constexpr auto kConnectionRetryDelay = base::Seconds(1);
// Length of time to wait for the browser connection ACK before timing out.
constexpr auto kConnectionTimeout = base::Seconds(4);
constexpr auto kConnectionTimeout = base::Seconds(10);
} // namespace
@@ -270,16 +271,30 @@ void CefFrameImpl::SendProcessMessage(CefProcessId target_process,
if (!message || !message->IsValid())
return;
SendToBrowserFrame(
__FUNCTION__,
base::BindOnce(
[](CefRefPtr<CefProcessMessage> message,
const BrowserFrameType& browser_frame) {
auto impl = static_cast<CefProcessMessageImpl*>(message.get());
browser_frame->SendMessage(impl->GetName(),
impl->TakeArgumentList());
},
message));
if (message->GetArgumentList() != nullptr) {
// Invalidate the message object immediately by taking the argument list.
auto argument_list =
static_cast<CefProcessMessageImpl*>(message.get())->TakeArgumentList();
SendToBrowserFrame(
__FUNCTION__,
base::BindOnce(
[](const CefString& name, base::ListValue argument_list,
const BrowserFrameType& render_frame) {
render_frame->SendMessage(name, std::move(argument_list));
},
message->GetName(), std::move(argument_list)));
} else {
auto region =
static_cast<CefProcessMessageSMRImpl*>(message.get())->TakeRegion();
SendToBrowserFrame(
__FUNCTION__,
base::BindOnce(
[](const CefString& name, base::ReadOnlySharedMemoryRegion region,
const BrowserFrameType& render_frame) {
render_frame->SendSharedMemoryRegion(name, std::move(region));
},
message->GetName(), std::move(region)));
}
}
std::unique_ptr<blink::WebURLLoader> CefFrameImpl::CreateURLLoader() {
@@ -654,6 +669,18 @@ void CefFrameImpl::SendMessage(const std::string& name, base::Value arguments) {
}
}
void CefFrameImpl::SendSharedMemoryRegion(
const std::string& name,
base::ReadOnlySharedMemoryRegion region) {
if (auto app = CefAppManager::Get()->GetApplication()) {
if (auto handler = app->GetRenderProcessHandler()) {
CefRefPtr<CefProcessMessage> message(
new CefProcessMessageSMRImpl(name, std::move(region)));
handler->OnProcessMessageReceived(browser_, this, PID_BROWSER, message);
}
}
}
void CefFrameImpl::SendCommand(const std::string& command) {
ExecuteOnLocalFrame(
__FUNCTION__,

View File

@@ -135,6 +135,8 @@ class CefFrameImpl
// cef::mojom::RenderFrame methods:
void FrameAttachedAck() override;
void SendMessage(const std::string& name, base::Value arguments) override;
void SendSharedMemoryRegion(const std::string& name,
base::ReadOnlySharedMemoryRegion region) override;
void SendCommand(const std::string& command) override;
void SendCommandWithResponse(
const std::string& command,

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=b299c22d4f97022efefefeb17a7848b0b44d4af3$
// $hash=6af3f901e4429197d0e47b15a68e980ea574b256$
//
#include "libcef_dll/cpptoc/client_cpptoc.h"
@@ -27,6 +27,7 @@
#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h"
#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h"
#include "libcef_dll/cpptoc/load_handler_cpptoc.h"
#include "libcef_dll/cpptoc/permission_handler_cpptoc.h"
#include "libcef_dll/cpptoc/print_handler_cpptoc.h"
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
#include "libcef_dll/cpptoc/request_handler_cpptoc.h"
@@ -198,6 +199,22 @@ client_get_frame_handler(struct _cef_client_t* self) {
return CefFrameHandlerCppToC::Wrap(_retval);
}
struct _cef_permission_handler_t* CEF_CALLBACK
client_get_permission_handler(struct _cef_client_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefPermissionHandler> _retval =
CefClientCppToC::Get(self)->GetPermissionHandler();
// Return type: refptr_same
return CefPermissionHandlerCppToC::Wrap(_retval);
}
struct _cef_jsdialog_handler_t* CEF_CALLBACK
client_get_jsdialog_handler(struct _cef_client_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@@ -358,6 +375,7 @@ CefClientCppToC::CefClientCppToC() {
GetStruct()->get_find_handler = client_get_find_handler;
GetStruct()->get_focus_handler = client_get_focus_handler;
GetStruct()->get_frame_handler = client_get_frame_handler;
GetStruct()->get_permission_handler = client_get_permission_handler;
GetStruct()->get_jsdialog_handler = client_get_jsdialog_handler;
GetStruct()->get_keyboard_handler = client_get_keyboard_handler;
GetStruct()->get_life_span_handler = client_get_life_span_handler;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=5bcef102e9ae42a32b551c3af3decbae11b8b37d$
// $hash=b492dccf2a5ddb50f50fe1783d8cacd3080714a5$
//
#include "libcef_dll/cpptoc/display_handler_cpptoc.h"
@@ -292,6 +292,29 @@ int CEF_CALLBACK display_handler_on_cursor_change(
return _retval;
}
void CEF_CALLBACK
display_handler_on_media_access_change(struct _cef_display_handler_t* self,
cef_browser_t* browser,
int has_video_access,
int has_audio_access) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return;
// Execute
CefDisplayHandlerCppToC::Get(self)->OnMediaAccessChange(
CefBrowserCToCpp::Wrap(browser), has_video_access ? true : false,
has_audio_access ? true : false);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
@@ -309,6 +332,7 @@ CefDisplayHandlerCppToC::CefDisplayHandlerCppToC() {
GetStruct()->on_loading_progress_change =
display_handler_on_loading_progress_change;
GetStruct()->on_cursor_change = display_handler_on_cursor_change;
GetStruct()->on_media_access_change = display_handler_on_media_access_change;
}
// DESTRUCTOR - Do not edit by hand.

View File

@@ -0,0 +1,81 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=dd3f62153541c74c294da2a33265a96491d17f2b$
//
#include "libcef_dll/cpptoc/media_access_callback_cpptoc.h"
#include "libcef_dll/shutdown_checker.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK
media_access_callback_cont(struct _cef_media_access_callback_t* self,
uint32 allowed_permissions) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefMediaAccessCallbackCppToC::Get(self)->Continue(allowed_permissions);
}
void CEF_CALLBACK
media_access_callback_cancel(struct _cef_media_access_callback_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefMediaAccessCallbackCppToC::Get(self)->Cancel();
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefMediaAccessCallbackCppToC::CefMediaAccessCallbackCppToC() {
GetStruct()->cont = media_access_callback_cont;
GetStruct()->cancel = media_access_callback_cancel;
}
// DESTRUCTOR - Do not edit by hand.
CefMediaAccessCallbackCppToC::~CefMediaAccessCallbackCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefMediaAccessCallback> CefCppToCRefCounted<
CefMediaAccessCallbackCppToC,
CefMediaAccessCallback,
cef_media_access_callback_t>::UnwrapDerived(CefWrapperType type,
cef_media_access_callback_t*
s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCppToCRefCounted<CefMediaAccessCallbackCppToC,
CefMediaAccessCallback,
cef_media_access_callback_t>::kWrapperType =
WT_MEDIA_ACCESS_CALLBACK;

View File

@@ -0,0 +1,38 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=0adf2c32c67b7480fa4c544c5c570674d6917f7f$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_MEDIA_ACCESS_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_MEDIA_ACCESS_CALLBACK_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/capi/cef_permission_handler_capi.h"
#include "include/cef_permission_handler.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefMediaAccessCallbackCppToC
: public CefCppToCRefCounted<CefMediaAccessCallbackCppToC,
CefMediaAccessCallback,
cef_media_access_callback_t> {
public:
CefMediaAccessCallbackCppToC();
virtual ~CefMediaAccessCallbackCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_MEDIA_ACCESS_CALLBACK_CPPTOC_H_

View File

@@ -0,0 +1,159 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=f137c0d7ae5fef1a6478f9416f6fe3d12a66d975$
//
#include "libcef_dll/cpptoc/permission_handler_cpptoc.h"
#include "libcef_dll/ctocpp/browser_ctocpp.h"
#include "libcef_dll/ctocpp/frame_ctocpp.h"
#include "libcef_dll/ctocpp/media_access_callback_ctocpp.h"
#include "libcef_dll/ctocpp/permission_prompt_callback_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK permission_handler_on_request_media_access_permission(
struct _cef_permission_handler_t* self,
cef_browser_t* browser,
cef_frame_t* frame,
const cef_string_t* requesting_origin,
uint32 requested_permissions,
cef_media_access_callback_t* callback) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: frame; type: refptr_diff
DCHECK(frame);
if (!frame)
return 0;
// Verify param: requesting_origin; type: string_byref_const
DCHECK(requesting_origin);
if (!requesting_origin)
return 0;
// Verify param: callback; type: refptr_diff
DCHECK(callback);
if (!callback)
return 0;
// Execute
bool _retval =
CefPermissionHandlerCppToC::Get(self)->OnRequestMediaAccessPermission(
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
CefString(requesting_origin), requested_permissions,
CefMediaAccessCallbackCToCpp::Wrap(callback));
// Return type: bool
return _retval;
}
int CEF_CALLBACK permission_handler_on_show_permission_prompt(
struct _cef_permission_handler_t* self,
cef_browser_t* browser,
uint64 prompt_id,
const cef_string_t* requesting_origin,
uint32 requested_permissions,
cef_permission_prompt_callback_t* callback) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: requesting_origin; type: string_byref_const
DCHECK(requesting_origin);
if (!requesting_origin)
return 0;
// Verify param: callback; type: refptr_diff
DCHECK(callback);
if (!callback)
return 0;
// Execute
bool _retval = CefPermissionHandlerCppToC::Get(self)->OnShowPermissionPrompt(
CefBrowserCToCpp::Wrap(browser), prompt_id, CefString(requesting_origin),
requested_permissions, CefPermissionPromptCallbackCToCpp::Wrap(callback));
// Return type: bool
return _retval;
}
void CEF_CALLBACK permission_handler_on_dismiss_permission_prompt(
struct _cef_permission_handler_t* self,
cef_browser_t* browser,
uint64 prompt_id,
cef_permission_request_result_t result) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return;
// Execute
CefPermissionHandlerCppToC::Get(self)->OnDismissPermissionPrompt(
CefBrowserCToCpp::Wrap(browser), prompt_id, result);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefPermissionHandlerCppToC::CefPermissionHandlerCppToC() {
GetStruct()->on_request_media_access_permission =
permission_handler_on_request_media_access_permission;
GetStruct()->on_show_permission_prompt =
permission_handler_on_show_permission_prompt;
GetStruct()->on_dismiss_permission_prompt =
permission_handler_on_dismiss_permission_prompt;
}
// DESTRUCTOR - Do not edit by hand.
CefPermissionHandlerCppToC::~CefPermissionHandlerCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefPermissionHandler> CefCppToCRefCounted<
CefPermissionHandlerCppToC,
CefPermissionHandler,
cef_permission_handler_t>::UnwrapDerived(CefWrapperType type,
cef_permission_handler_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCppToCRefCounted<CefPermissionHandlerCppToC,
CefPermissionHandler,
cef_permission_handler_t>::kWrapperType =
WT_PERMISSION_HANDLER;

View File

@@ -0,0 +1,38 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=0f90cfade714209df150953eabed70bc7b264122$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_PERMISSION_HANDLER_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_PERMISSION_HANDLER_CPPTOC_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_permission_handler_capi.h"
#include "include/cef_permission_handler.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefPermissionHandlerCppToC
: public CefCppToCRefCounted<CefPermissionHandlerCppToC,
CefPermissionHandler,
cef_permission_handler_t> {
public:
CefPermissionHandlerCppToC();
virtual ~CefPermissionHandlerCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_PERMISSION_HANDLER_CPPTOC_H_

View File

@@ -0,0 +1,66 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=e2297d672c66d4530e85d4c4761d1adeabe7134c$
//
#include "libcef_dll/cpptoc/permission_prompt_callback_cpptoc.h"
#include "libcef_dll/shutdown_checker.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK
permission_prompt_callback_cont(struct _cef_permission_prompt_callback_t* self,
cef_permission_request_result_t result) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefPermissionPromptCallbackCppToC::Get(self)->Continue(result);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefPermissionPromptCallbackCppToC::CefPermissionPromptCallbackCppToC() {
GetStruct()->cont = permission_prompt_callback_cont;
}
// DESTRUCTOR - Do not edit by hand.
CefPermissionPromptCallbackCppToC::~CefPermissionPromptCallbackCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefPermissionPromptCallback>
CefCppToCRefCounted<CefPermissionPromptCallbackCppToC,
CefPermissionPromptCallback,
cef_permission_prompt_callback_t>::
UnwrapDerived(CefWrapperType type, cef_permission_prompt_callback_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType
CefCppToCRefCounted<CefPermissionPromptCallbackCppToC,
CefPermissionPromptCallback,
cef_permission_prompt_callback_t>::kWrapperType =
WT_PERMISSION_PROMPT_CALLBACK;

View File

@@ -0,0 +1,38 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=03956400a2d9931dd114105e8512b8e87d31f305$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_PERMISSION_PROMPT_CALLBACK_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_PERMISSION_PROMPT_CALLBACK_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/capi/cef_permission_handler_capi.h"
#include "include/cef_permission_handler.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefPermissionPromptCallbackCppToC
: public CefCppToCRefCounted<CefPermissionPromptCallbackCppToC,
CefPermissionPromptCallback,
cef_permission_prompt_callback_t> {
public:
CefPermissionPromptCallbackCppToC();
virtual ~CefPermissionPromptCallbackCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_PERMISSION_PROMPT_CALLBACK_CPPTOC_H_

View File

@@ -9,11 +9,12 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=b63f665e68e4dc6269c3e88b81068190ea90abb3$
// $hash=5d331596c0425f145a19d8de6a866841d9ed8a87$
//
#include "libcef_dll/cpptoc/process_message_cpptoc.h"
#include "libcef_dll/cpptoc/list_value_cpptoc.h"
#include "libcef_dll/cpptoc/shared_memory_region_cpptoc.h"
#include "libcef_dll/shutdown_checker.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
@@ -127,6 +128,24 @@ process_message_get_argument_list(struct _cef_process_message_t* self) {
return CefListValueCppToC::Wrap(_retval);
}
struct _cef_shared_memory_region_t* CEF_CALLBACK
process_message_get_shared_memory_region(struct _cef_process_message_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefSharedMemoryRegion> _retval =
CefProcessMessageCppToC::Get(self)->GetSharedMemoryRegion();
// Return type: refptr_same
return CefSharedMemoryRegionCppToC::Wrap(_retval);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
@@ -137,6 +156,8 @@ CefProcessMessageCppToC::CefProcessMessageCppToC() {
GetStruct()->copy = process_message_copy;
GetStruct()->get_name = process_message_get_name;
GetStruct()->get_argument_list = process_message_get_argument_list;
GetStruct()->get_shared_memory_region =
process_message_get_shared_memory_region;
}
// DESTRUCTOR - Do not edit by hand.

View File

@@ -0,0 +1,105 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=b8c6bf91bf16cb696121e7d304c21fbcdc927ffd$
//
#include "libcef_dll/cpptoc/shared_memory_region_cpptoc.h"
#include "libcef_dll/shutdown_checker.h"
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK
shared_memory_region_is_valid(struct _cef_shared_memory_region_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefSharedMemoryRegionCppToC::Get(self)->IsValid();
// Return type: bool
return _retval;
}
size_t CEF_CALLBACK
shared_memory_region_size(struct _cef_shared_memory_region_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
size_t _retval = CefSharedMemoryRegionCppToC::Get(self)->Size();
// Return type: simple
return _retval;
}
const void* CEF_CALLBACK
shared_memory_region_memory(struct _cef_shared_memory_region_t* self) {
shutdown_checker::AssertNotShutdown();
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
const void* _retval = CefSharedMemoryRegionCppToC::Get(self)->Memory();
// Return type: simple
return _retval;
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefSharedMemoryRegionCppToC::CefSharedMemoryRegionCppToC() {
GetStruct()->is_valid = shared_memory_region_is_valid;
GetStruct()->size = shared_memory_region_size;
GetStruct()->memory = shared_memory_region_memory;
}
// DESTRUCTOR - Do not edit by hand.
CefSharedMemoryRegionCppToC::~CefSharedMemoryRegionCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefSharedMemoryRegion> CefCppToCRefCounted<
CefSharedMemoryRegionCppToC,
CefSharedMemoryRegion,
cef_shared_memory_region_t>::UnwrapDerived(CefWrapperType type,
cef_shared_memory_region_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCppToCRefCounted<CefSharedMemoryRegionCppToC,
CefSharedMemoryRegion,
cef_shared_memory_region_t>::kWrapperType =
WT_SHARED_MEMORY_REGION;

View File

@@ -0,0 +1,38 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=77de7d9d9e62fa5075ff6e76e4647639c51a7f05$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_SHARED_MEMORY_REGION_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_SHARED_MEMORY_REGION_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/capi/cef_shared_memory_region_capi.h"
#include "include/cef_shared_memory_region.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefSharedMemoryRegionCppToC
: public CefCppToCRefCounted<CefSharedMemoryRegionCppToC,
CefSharedMemoryRegion,
cef_shared_memory_region_t> {
public:
CefSharedMemoryRegionCppToC();
virtual ~CefSharedMemoryRegionCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_SHARED_MEMORY_REGION_CPPTOC_H_

View File

@@ -0,0 +1,145 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=b3c3551c52baf66ab3cd4ee485313ef41a29313b$
//
#include "libcef_dll/cpptoc/shared_process_message_builder_cpptoc.h"
#include "libcef_dll/cpptoc/process_message_cpptoc.h"
#include "libcef_dll/shutdown_checker.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_shared_process_message_builder_t*
cef_shared_process_message_builder_create(const cef_string_t* name,
size_t byte_size) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: name; type: string_byref_const
DCHECK(name);
if (!name)
return NULL;
// Execute
CefRefPtr<CefSharedProcessMessageBuilder> _retval =
CefSharedProcessMessageBuilder::Create(CefString(name), byte_size);
// Return type: refptr_same
return CefSharedProcessMessageBuilderCppToC::Wrap(_retval);
}
namespace {
// MEMBER FUNCTIONS - Body may be edited by hand.
int CEF_CALLBACK shared_process_message_builder_is_valid(
struct _cef_shared_process_message_builder_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
bool _retval = CefSharedProcessMessageBuilderCppToC::Get(self)->IsValid();
// Return type: bool
return _retval;
}
size_t CEF_CALLBACK shared_process_message_builder_size(
struct _cef_shared_process_message_builder_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Execute
size_t _retval = CefSharedProcessMessageBuilderCppToC::Get(self)->Size();
// Return type: simple
return _retval;
}
void* CEF_CALLBACK shared_process_message_builder_memory(
struct _cef_shared_process_message_builder_t* self) {
shutdown_checker::AssertNotShutdown();
DCHECK(self);
if (!self)
return 0;
// Execute
void* _retval = CefSharedProcessMessageBuilderCppToC::Get(self)->Memory();
// Return type: simple
return _retval;
}
cef_process_message_t* CEF_CALLBACK shared_process_message_builder_build(
struct _cef_shared_process_message_builder_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefProcessMessage> _retval =
CefSharedProcessMessageBuilderCppToC::Get(self)->Build();
// Return type: refptr_same
return CefProcessMessageCppToC::Wrap(_retval);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
CefSharedProcessMessageBuilderCppToC::CefSharedProcessMessageBuilderCppToC() {
GetStruct()->is_valid = shared_process_message_builder_is_valid;
GetStruct()->size = shared_process_message_builder_size;
GetStruct()->memory = shared_process_message_builder_memory;
GetStruct()->build = shared_process_message_builder_build;
}
// DESTRUCTOR - Do not edit by hand.
CefSharedProcessMessageBuilderCppToC::~CefSharedProcessMessageBuilderCppToC() {
shutdown_checker::AssertNotShutdown();
}
template <>
CefRefPtr<CefSharedProcessMessageBuilder>
CefCppToCRefCounted<CefSharedProcessMessageBuilderCppToC,
CefSharedProcessMessageBuilder,
cef_shared_process_message_builder_t>::
UnwrapDerived(CefWrapperType type,
cef_shared_process_message_builder_t* s) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType
CefCppToCRefCounted<CefSharedProcessMessageBuilderCppToC,
CefSharedProcessMessageBuilder,
cef_shared_process_message_builder_t>::kWrapperType =
WT_SHARED_PROCESS_MESSAGE_BUILDER;

View File

@@ -0,0 +1,38 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=a3ec0a78d1e092d99780b6ec87d345a20c081be6$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_SHARED_PROCESS_MESSAGE_BUILDER_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_SHARED_PROCESS_MESSAGE_BUILDER_CPPTOC_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/capi/cef_shared_process_message_builder_capi.h"
#include "include/cef_shared_process_message_builder.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefSharedProcessMessageBuilderCppToC
: public CefCppToCRefCounted<CefSharedProcessMessageBuilderCppToC,
CefSharedProcessMessageBuilder,
cef_shared_process_message_builder_t> {
public:
CefSharedProcessMessageBuilderCppToC();
virtual ~CefSharedProcessMessageBuilderCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_SHARED_PROCESS_MESSAGE_BUILDER_CPPTOC_H_

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=8e158f3ea54211b95f0b716b1eeec2ff475f1245$
// $hash=71c2e9dd248276daa80be557773fe86bdc2bcb99$
//
#include "libcef_dll/ctocpp/client_ctocpp.h"
@@ -30,6 +30,7 @@
#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h"
#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h"
#include "libcef_dll/ctocpp/load_handler_ctocpp.h"
#include "libcef_dll/ctocpp/permission_handler_ctocpp.h"
#include "libcef_dll/ctocpp/print_handler_ctocpp.h"
#include "libcef_dll/ctocpp/render_handler_ctocpp.h"
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
@@ -187,6 +188,21 @@ CefRefPtr<CefFrameHandler> CefClientCToCpp::GetFrameHandler() {
return CefFrameHandlerCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefPermissionHandler> CefClientCToCpp::GetPermissionHandler() {
cef_client_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_permission_handler))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_permission_handler_t* _retval = _struct->get_permission_handler(_struct);
// Return type: refptr_same
return CefPermissionHandlerCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefJSDialogHandler> CefClientCToCpp::GetJSDialogHandler() {
cef_client_t* _struct = GetStruct();

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=69f82ee575779deaf1d3581dbedcf8aa75f35710$
// $hash=821429d4e38b03407a1e6cf73a67e479810f0c21$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_CLIENT_CTOCPP_H_
@@ -43,6 +43,7 @@ class CefClientCToCpp
CefRefPtr<CefFindHandler> GetFindHandler() override;
CefRefPtr<CefFocusHandler> GetFocusHandler() override;
CefRefPtr<CefFrameHandler> GetFrameHandler() override;
CefRefPtr<CefPermissionHandler> GetPermissionHandler() override;
CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() override;
CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() override;
CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=f40564d59c337fede5e8c3121ed735166d5e05a3$
// $hash=ab688c32624070704507d10dc27d430d90f04dd2$
//
#include "libcef_dll/ctocpp/display_handler_ctocpp.h"
@@ -277,6 +277,28 @@ bool CefDisplayHandlerCToCpp::OnCursorChange(
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
void CefDisplayHandlerCToCpp::OnMediaAccessChange(CefRefPtr<CefBrowser> browser,
bool has_video_access,
bool has_audio_access) {
shutdown_checker::AssertNotShutdown();
cef_display_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_media_access_change))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return;
// Execute
_struct->on_media_access_change(_struct, CefBrowserCppToC::Wrap(browser),
has_video_access, has_audio_access);
}
// CONSTRUCTOR - Do not edit by hand.
CefDisplayHandlerCToCpp::CefDisplayHandlerCToCpp() {}

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=f6769db4bda5143d4e42a2e68788b58c68292c1d$
// $hash=ca2ef5029377f07f196011a3ec686049d3623cce$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_DISPLAY_HANDLER_CTOCPP_H_
@@ -61,6 +61,9 @@ class CefDisplayHandlerCToCpp
CefCursorHandle cursor,
cef_cursor_type_t type,
const CefCursorInfo& custom_cursor_info) override;
void OnMediaAccessChange(CefRefPtr<CefBrowser> browser,
bool has_video_access,
bool has_audio_access) override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_DISPLAY_HANDLER_CTOCPP_H_

View File

@@ -0,0 +1,71 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=bfd836add2381882b8c0408181621ebf24cddce1$
//
#include "libcef_dll/ctocpp/media_access_callback_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
void CefMediaAccessCallbackCToCpp::Continue(uint32 allowed_permissions) {
shutdown_checker::AssertNotShutdown();
cef_media_access_callback_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, cont))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->cont(_struct, allowed_permissions);
}
NO_SANITIZE("cfi-icall") void CefMediaAccessCallbackCToCpp::Cancel() {
shutdown_checker::AssertNotShutdown();
cef_media_access_callback_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, cancel))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->cancel(_struct);
}
// CONSTRUCTOR - Do not edit by hand.
CefMediaAccessCallbackCToCpp::CefMediaAccessCallbackCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefMediaAccessCallbackCToCpp::~CefMediaAccessCallbackCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_media_access_callback_t* CefCToCppRefCounted<
CefMediaAccessCallbackCToCpp,
CefMediaAccessCallback,
cef_media_access_callback_t>::UnwrapDerived(CefWrapperType type,
CefMediaAccessCallback* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCToCppRefCounted<CefMediaAccessCallbackCToCpp,
CefMediaAccessCallback,
cef_media_access_callback_t>::kWrapperType =
WT_MEDIA_ACCESS_CALLBACK;

View File

@@ -0,0 +1,42 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=1b4c8da03ff2853b057860369bdb5dd1b48cf046$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_MEDIA_ACCESS_CALLBACK_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_MEDIA_ACCESS_CALLBACK_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_permission_handler_capi.h"
#include "include/cef_permission_handler.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefMediaAccessCallbackCToCpp
: public CefCToCppRefCounted<CefMediaAccessCallbackCToCpp,
CefMediaAccessCallback,
cef_media_access_callback_t> {
public:
CefMediaAccessCallbackCToCpp();
virtual ~CefMediaAccessCallbackCToCpp();
// CefMediaAccessCallback methods.
void Continue(uint32 allowed_permissions) override;
void Cancel() override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_MEDIA_ACCESS_CALLBACK_CTOCPP_H_

View File

@@ -0,0 +1,151 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=d7ce736678ba0f43fa3f556d22b8afa2409221fb$
//
#include "libcef_dll/ctocpp/permission_handler_ctocpp.h"
#include "libcef_dll/cpptoc/browser_cpptoc.h"
#include "libcef_dll/cpptoc/frame_cpptoc.h"
#include "libcef_dll/cpptoc/media_access_callback_cpptoc.h"
#include "libcef_dll/cpptoc/permission_prompt_callback_cpptoc.h"
#include "libcef_dll/shutdown_checker.h"
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
bool CefPermissionHandlerCToCpp::OnRequestMediaAccessPermission(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& requesting_origin,
uint32 requested_permissions,
CefRefPtr<CefMediaAccessCallback> callback) {
shutdown_checker::AssertNotShutdown();
cef_permission_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_request_media_access_permission))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return false;
// Verify param: frame; type: refptr_diff
DCHECK(frame.get());
if (!frame.get())
return false;
// Verify param: requesting_origin; type: string_byref_const
DCHECK(!requesting_origin.empty());
if (requesting_origin.empty())
return false;
// Verify param: callback; type: refptr_diff
DCHECK(callback.get());
if (!callback.get())
return false;
// Execute
int _retval = _struct->on_request_media_access_permission(
_struct, CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
requesting_origin.GetStruct(), requested_permissions,
CefMediaAccessCallbackCppToC::Wrap(callback));
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
bool CefPermissionHandlerCToCpp::OnShowPermissionPrompt(
CefRefPtr<CefBrowser> browser,
uint64 prompt_id,
const CefString& requesting_origin,
uint32 requested_permissions,
CefRefPtr<CefPermissionPromptCallback> callback) {
shutdown_checker::AssertNotShutdown();
cef_permission_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_show_permission_prompt))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return false;
// Verify param: requesting_origin; type: string_byref_const
DCHECK(!requesting_origin.empty());
if (requesting_origin.empty())
return false;
// Verify param: callback; type: refptr_diff
DCHECK(callback.get());
if (!callback.get())
return false;
// Execute
int _retval = _struct->on_show_permission_prompt(
_struct, CefBrowserCppToC::Wrap(browser), prompt_id,
requesting_origin.GetStruct(), requested_permissions,
CefPermissionPromptCallbackCppToC::Wrap(callback));
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
void CefPermissionHandlerCToCpp::OnDismissPermissionPrompt(
CefRefPtr<CefBrowser> browser,
uint64 prompt_id,
cef_permission_request_result_t result) {
shutdown_checker::AssertNotShutdown();
cef_permission_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_dismiss_permission_prompt))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return;
// Execute
_struct->on_dismiss_permission_prompt(
_struct, CefBrowserCppToC::Wrap(browser), prompt_id, result);
}
// CONSTRUCTOR - Do not edit by hand.
CefPermissionHandlerCToCpp::CefPermissionHandlerCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefPermissionHandlerCToCpp::~CefPermissionHandlerCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_permission_handler_t* CefCToCppRefCounted<
CefPermissionHandlerCToCpp,
CefPermissionHandler,
cef_permission_handler_t>::UnwrapDerived(CefWrapperType type,
CefPermissionHandler* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCToCppRefCounted<CefPermissionHandlerCToCpp,
CefPermissionHandler,
cef_permission_handler_t>::kWrapperType =
WT_PERMISSION_HANDLER;

View File

@@ -0,0 +1,56 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=5a55c2f36920a4ab385570e9be0f146d99477edb$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_PERMISSION_HANDLER_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_PERMISSION_HANDLER_CTOCPP_H_
#pragma once
#if !defined(BUILDING_CEF_SHARED)
#error This file can be included DLL-side only
#endif
#include "include/capi/cef_permission_handler_capi.h"
#include "include/cef_permission_handler.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed DLL-side only.
class CefPermissionHandlerCToCpp
: public CefCToCppRefCounted<CefPermissionHandlerCToCpp,
CefPermissionHandler,
cef_permission_handler_t> {
public:
CefPermissionHandlerCToCpp();
virtual ~CefPermissionHandlerCToCpp();
// CefPermissionHandler methods.
bool OnRequestMediaAccessPermission(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
const CefString& requesting_origin,
uint32 requested_permissions,
CefRefPtr<CefMediaAccessCallback> callback) override;
bool OnShowPermissionPrompt(
CefRefPtr<CefBrowser> browser,
uint64 prompt_id,
const CefString& requesting_origin,
uint32 requested_permissions,
CefRefPtr<CefPermissionPromptCallback> callback) override;
void OnDismissPermissionPrompt(
CefRefPtr<CefBrowser> browser,
uint64 prompt_id,
cef_permission_request_result_t result) override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_PERMISSION_HANDLER_CTOCPP_H_

View File

@@ -0,0 +1,60 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=b149d327d3972d670f974dc92900acfbdfffff87$
//
#include "libcef_dll/ctocpp/permission_prompt_callback_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
void CefPermissionPromptCallbackCToCpp::Continue(
cef_permission_request_result_t result) {
shutdown_checker::AssertNotShutdown();
cef_permission_prompt_callback_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, cont))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->cont(_struct, result);
}
// CONSTRUCTOR - Do not edit by hand.
CefPermissionPromptCallbackCToCpp::CefPermissionPromptCallbackCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefPermissionPromptCallbackCToCpp::~CefPermissionPromptCallbackCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_permission_prompt_callback_t*
CefCToCppRefCounted<CefPermissionPromptCallbackCToCpp,
CefPermissionPromptCallback,
cef_permission_prompt_callback_t>::
UnwrapDerived(CefWrapperType type, CefPermissionPromptCallback* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType
CefCToCppRefCounted<CefPermissionPromptCallbackCToCpp,
CefPermissionPromptCallback,
cef_permission_prompt_callback_t>::kWrapperType =
WT_PERMISSION_PROMPT_CALLBACK;

View File

@@ -0,0 +1,41 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=bdf5b8df2a3d5555f42982cd741ae13f3d1a67d1$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_PERMISSION_PROMPT_CALLBACK_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_PERMISSION_PROMPT_CALLBACK_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_permission_handler_capi.h"
#include "include/cef_permission_handler.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefPermissionPromptCallbackCToCpp
: public CefCToCppRefCounted<CefPermissionPromptCallbackCToCpp,
CefPermissionPromptCallback,
cef_permission_prompt_callback_t> {
public:
CefPermissionPromptCallbackCToCpp();
virtual ~CefPermissionPromptCallbackCToCpp();
// CefPermissionPromptCallback methods.
void Continue(cef_permission_request_result_t result) override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_PERMISSION_PROMPT_CALLBACK_CTOCPP_H_

View File

@@ -9,11 +9,12 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=7ab779c6c98a1bd2385f14d514304a28ef58717f$
// $hash=0f16a0f4711caf0b3761bf6480622de2e75b72ef$
//
#include "libcef_dll/ctocpp/process_message_ctocpp.h"
#include "libcef_dll/ctocpp/list_value_ctocpp.h"
#include "libcef_dll/ctocpp/shared_memory_region_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// STATIC METHODS - Body may be edited by hand.
@@ -122,6 +123,25 @@ CefRefPtr<CefListValue> CefProcessMessageCToCpp::GetArgumentList() {
return CefListValueCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefSharedMemoryRegion>
CefProcessMessageCToCpp::GetSharedMemoryRegion() {
shutdown_checker::AssertNotShutdown();
cef_process_message_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_shared_memory_region))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_shared_memory_region_t* _retval =
_struct->get_shared_memory_region(_struct);
// Return type: refptr_same
return CefSharedMemoryRegionCToCpp::Wrap(_retval);
}
// CONSTRUCTOR - Do not edit by hand.
CefProcessMessageCToCpp::CefProcessMessageCToCpp() {}

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=39bf2321370b32cf02bf502529568e935b303550$
// $hash=f52b0dfcee0d432a334166fce348234d0d239b85$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_PROCESS_MESSAGE_CTOCPP_H_
@@ -40,6 +40,7 @@ class CefProcessMessageCToCpp
CefRefPtr<CefProcessMessage> Copy() override;
CefString GetName() override;
CefRefPtr<CefListValue> GetArgumentList() override;
CefRefPtr<CefSharedMemoryRegion> GetSharedMemoryRegion() override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_PROCESS_MESSAGE_CTOCPP_H_

View File

@@ -0,0 +1,90 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=fd0a4c1bd80a53778d6e40e4ebcd9d4484f91269$
//
#include "libcef_dll/ctocpp/shared_memory_region_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall") bool CefSharedMemoryRegionCToCpp::IsValid() {
shutdown_checker::AssertNotShutdown();
cef_shared_memory_region_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_valid))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_valid(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall") size_t CefSharedMemoryRegionCToCpp::Size() {
shutdown_checker::AssertNotShutdown();
cef_shared_memory_region_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, size))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
size_t _retval = _struct->size(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") const void* CefSharedMemoryRegionCToCpp::Memory() {
shutdown_checker::AssertNotShutdown();
cef_shared_memory_region_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, memory))
return nullptr;
// Execute
const void* _retval = _struct->memory(_struct);
// Return type: simple
return _retval;
}
// CONSTRUCTOR - Do not edit by hand.
CefSharedMemoryRegionCToCpp::CefSharedMemoryRegionCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefSharedMemoryRegionCToCpp::~CefSharedMemoryRegionCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_shared_memory_region_t* CefCToCppRefCounted<
CefSharedMemoryRegionCToCpp,
CefSharedMemoryRegion,
cef_shared_memory_region_t>::UnwrapDerived(CefWrapperType type,
CefSharedMemoryRegion* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType CefCToCppRefCounted<CefSharedMemoryRegionCToCpp,
CefSharedMemoryRegion,
cef_shared_memory_region_t>::kWrapperType =
WT_SHARED_MEMORY_REGION;

View File

@@ -0,0 +1,43 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=d477b2660e271bbdc4d6e8f866f006b84f13e50d$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_SHARED_MEMORY_REGION_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_SHARED_MEMORY_REGION_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_shared_memory_region_capi.h"
#include "include/cef_shared_memory_region.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefSharedMemoryRegionCToCpp
: public CefCToCppRefCounted<CefSharedMemoryRegionCToCpp,
CefSharedMemoryRegion,
cef_shared_memory_region_t> {
public:
CefSharedMemoryRegionCToCpp();
virtual ~CefSharedMemoryRegionCToCpp();
// CefSharedMemoryRegion methods.
bool IsValid() override;
size_t Size() override;
const void* Memory() override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_SHARED_MEMORY_REGION_CTOCPP_H_

View File

@@ -0,0 +1,132 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=a20e093efb07503fe9e64c97c14091e3921544cd$
//
#include "libcef_dll/ctocpp/shared_process_message_builder_ctocpp.h"
#include "libcef_dll/ctocpp/process_message_ctocpp.h"
#include "libcef_dll/shutdown_checker.h"
// STATIC METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall")
CefRefPtr<CefSharedProcessMessageBuilder>
CefSharedProcessMessageBuilder::Create(const CefString& name,
size_t byte_size) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: name; type: string_byref_const
DCHECK(!name.empty());
if (name.empty())
return nullptr;
// Execute
cef_shared_process_message_builder_t* _retval =
cef_shared_process_message_builder_create(name.GetStruct(), byte_size);
// Return type: refptr_same
return CefSharedProcessMessageBuilderCToCpp::Wrap(_retval);
}
// VIRTUAL METHODS - Body may be edited by hand.
NO_SANITIZE("cfi-icall") bool CefSharedProcessMessageBuilderCToCpp::IsValid() {
shutdown_checker::AssertNotShutdown();
cef_shared_process_message_builder_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_valid))
return false;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_valid(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall") size_t CefSharedProcessMessageBuilderCToCpp::Size() {
shutdown_checker::AssertNotShutdown();
cef_shared_process_message_builder_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, size))
return 0;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
size_t _retval = _struct->size(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") void* CefSharedProcessMessageBuilderCToCpp::Memory() {
shutdown_checker::AssertNotShutdown();
cef_shared_process_message_builder_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, memory))
return nullptr;
// Execute
void* _retval = _struct->memory(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefProcessMessage> CefSharedProcessMessageBuilderCToCpp::Build() {
shutdown_checker::AssertNotShutdown();
cef_shared_process_message_builder_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, build))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_process_message_t* _retval = _struct->build(_struct);
// Return type: refptr_same
return CefProcessMessageCToCpp::Wrap(_retval);
}
// CONSTRUCTOR - Do not edit by hand.
CefSharedProcessMessageBuilderCToCpp::CefSharedProcessMessageBuilderCToCpp() {}
// DESTRUCTOR - Do not edit by hand.
CefSharedProcessMessageBuilderCToCpp::~CefSharedProcessMessageBuilderCToCpp() {
shutdown_checker::AssertNotShutdown();
}
template <>
cef_shared_process_message_builder_t*
CefCToCppRefCounted<CefSharedProcessMessageBuilderCToCpp,
CefSharedProcessMessageBuilder,
cef_shared_process_message_builder_t>::
UnwrapDerived(CefWrapperType type, CefSharedProcessMessageBuilder* c) {
NOTREACHED() << "Unexpected class type: " << type;
return nullptr;
}
template <>
CefWrapperType
CefCToCppRefCounted<CefSharedProcessMessageBuilderCToCpp,
CefSharedProcessMessageBuilder,
cef_shared_process_message_builder_t>::kWrapperType =
WT_SHARED_PROCESS_MESSAGE_BUILDER;

View File

@@ -0,0 +1,44 @@
// Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=0a8bf76a2347d7afc98e1cbeb61b88be4bc7e789$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_SHARED_PROCESS_MESSAGE_BUILDER_CTOCPP_H_
#define CEF_LIBCEF_DLL_CTOCPP_SHARED_PROCESS_MESSAGE_BUILDER_CTOCPP_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_shared_process_message_builder_capi.h"
#include "include/cef_shared_process_message_builder.h"
#include "libcef_dll/ctocpp/ctocpp_ref_counted.h"
// Wrap a C structure with a C++ class.
// This class may be instantiated and accessed wrapper-side only.
class CefSharedProcessMessageBuilderCToCpp
: public CefCToCppRefCounted<CefSharedProcessMessageBuilderCToCpp,
CefSharedProcessMessageBuilder,
cef_shared_process_message_builder_t> {
public:
CefSharedProcessMessageBuilderCToCpp();
virtual ~CefSharedProcessMessageBuilderCToCpp();
// CefSharedProcessMessageBuilder methods.
bool IsValid() override;
size_t Size() override;
void* Memory() override;
CefRefPtr<CefProcessMessage> Build() override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_SHARED_PROCESS_MESSAGE_BUILDER_CTOCPP_H_

View File

@@ -8,6 +8,7 @@
#include <set>
#include "include/base/cef_callback.h"
#include "include/cef_shared_process_message_builder.h"
#include "include/cef_task.h"
#include "include/wrapper/cef_closure_task.h"
#include "include/wrapper/cef_helpers.h"
@@ -31,6 +32,10 @@ const char kMemberPersistent[] = "persistent";
const int kCanceledErrorCode = -1;
const char kCanceledErrorMessage[] = "The query has been canceled";
// Value of 16KB is chosen as a result of performance tests available at
// http://tests/ipc_performance
constexpr size_t kResponseSizeThreshold = 16384;
// Validate configuration settings.
bool ValidateConfig(CefMessageRouterConfig& config) {
// Must specify function names.
@@ -41,6 +46,124 @@ bool ValidateConfig(CefMessageRouterConfig& config) {
return true;
}
struct MessageHeader {
int context_id;
int request_id;
bool is_success;
};
struct ParsedMessage {
int context_id;
int request_id;
bool success;
int error_code;
CefString message;
};
size_t GetMessageSize(const CefString& response) {
return sizeof(MessageHeader) +
(response.size() * sizeof(CefString::char_type));
}
void CopyResponseIntoMemory(void* memory, const CefString& response) {
const size_t bytes = response.size() * sizeof(CefString::char_type);
void* dest = static_cast<uint8_t*>(memory) + sizeof(MessageHeader);
memcpy(dest, response.c_str(), bytes);
}
CefString GetStringFromMemory(const void* memory, size_t size) {
const size_t bytes = size - sizeof(MessageHeader);
const size_t string_len = bytes / sizeof(CefString::char_type);
const CefString::char_type* src =
reinterpret_cast<const CefString::char_type*>(
static_cast<const uint8_t*>(memory) + sizeof(MessageHeader));
constexpr bool copy = true;
CefString result;
result.FromString(src, string_len, copy);
return result;
}
CefRefPtr<CefProcessMessage> BuildListMessage(const std::string& message_name,
int context_id,
int request_id,
const CefString& response) {
auto message = CefProcessMessage::Create(message_name);
CefRefPtr<CefListValue> args = message->GetArgumentList();
args->SetInt(0, context_id);
args->SetInt(1, request_id);
args->SetBool(2, true); // Indicates a success result.
args->SetString(3, response);
return message;
}
CefRefPtr<CefProcessMessage> BuildBinaryMessage(const std::string& message_name,
int context_id,
int request_id,
const CefString& response) {
const size_t message_size = GetMessageSize(response);
auto builder =
CefSharedProcessMessageBuilder::Create(message_name, message_size);
if (!builder->IsValid()) {
LOG(ERROR) << "Failed to allocate shared memory region of size "
<< message_size;
// Use list message as a fallback
return BuildListMessage(message_name, context_id, request_id, response);
}
auto header = static_cast<MessageHeader*>(builder->Memory());
header->context_id = context_id;
header->request_id = request_id;
header->is_success = true;
CopyResponseIntoMemory(builder->Memory(), response);
return builder->Build();
}
CefRefPtr<CefProcessMessage> BuildMessage(size_t threshold,
const std::string& message_name,
int context_id,
int request_id,
const CefString& response) {
if (response.size() <= threshold) {
return BuildListMessage(message_name, context_id, request_id, response);
} else {
return BuildBinaryMessage(message_name, context_id, request_id, response);
}
}
ParsedMessage ParseMessage(const CefRefPtr<CefProcessMessage>& message) {
if (auto args = message->GetArgumentList()) {
DCHECK_GT(args->GetSize(), 3U);
const int context_id = args->GetInt(0);
const int request_id = args->GetInt(1);
const bool is_success = args->GetBool(2);
if (is_success) {
return ParsedMessage{context_id, request_id, is_success, 0,
args->GetString(3)};
}
DCHECK_EQ(args->GetSize(), 5U);
return ParsedMessage{context_id, request_id, is_success, args->GetInt(3),
args->GetString(4)};
}
if (const auto region = message->GetSharedMemoryRegion()) {
if (region->IsValid()) {
DCHECK_GE(region->Size(), sizeof(MessageHeader));
auto header = static_cast<const MessageHeader*>(region->Memory());
DCHECK(header->is_success);
return ParsedMessage{
header->context_id, header->request_id, header->is_success, 0,
GetStringFromMemory(region->Memory(), region->Size())};
}
}
return ParsedMessage{};
}
// Helper template for generated ID values.
template <typename T>
class IdGenerator {
@@ -428,14 +551,11 @@ class CefMessageRouterBrowserSideImpl : public CefMessageRouterBrowserSide {
int context_id,
int request_id,
const CefString& response) {
CefRefPtr<CefProcessMessage> message =
CefProcessMessage::Create(query_message_name_);
CefRefPtr<CefListValue> args = message->GetArgumentList();
args->SetInt(0, context_id);
args->SetInt(1, request_id);
args->SetBool(2, true); // Indicates a success result.
args->SetString(3, response);
frame->SendProcessMessage(PID_RENDERER, message);
if (auto message =
BuildMessage(config_.message_size_threshold, query_message_name_,
context_id, request_id, response)) {
frame->SendProcessMessage(PID_RENDERER, message);
}
}
void SendQueryFailure(QueryInfo* info,
@@ -817,31 +937,21 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
const std::string& message_name = message->GetName();
if (message_name == query_message_name_) {
CefRefPtr<CefListValue> args = message->GetArgumentList();
DCHECK_GT(args->GetSize(), 3U);
const int context_id = args->GetInt(0);
const int request_id = args->GetInt(1);
bool is_success = args->GetBool(2);
if (is_success) {
DCHECK_EQ(args->GetSize(), 4U);
const CefString& response = args->GetString(3);
auto content = ParseMessage(message);
if (content.success) {
CefPostTask(
TID_RENDERER,
base::BindOnce(
&CefMessageRouterRendererSideImpl::ExecuteSuccessCallback, this,
browser->GetIdentifier(), context_id, request_id, response));
browser->GetIdentifier(), content.context_id,
content.request_id, content.message));
} else {
DCHECK_EQ(args->GetSize(), 5U);
int error_code = args->GetInt(3);
const CefString& error_message = args->GetString(4);
CefPostTask(
TID_RENDERER,
base::BindOnce(
&CefMessageRouterRendererSideImpl::ExecuteFailureCallback, this,
browser->GetIdentifier(), context_id, request_id, error_code,
error_message));
browser->GetIdentifier(), content.context_id,
content.request_id, content.error_code, content.message));
}
return true;
@@ -913,10 +1023,9 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
const int request_id = request_id_generator_.GetNextId();
RequestInfo* info = new RequestInfo;
info->persistent = persistent;
info->success_callback = success_callback;
info->failure_callback = failure_callback;
auto* info =
new RequestInfo{persistent, success_callback, failure_callback};
browser_request_info_map_.Add(browser->GetIdentifier(),
std::make_pair(context_id, request_id), info);
@@ -1117,7 +1226,9 @@ class CefMessageRouterRendererSideImpl : public CefMessageRouterRendererSide {
} // namespace
CefMessageRouterConfig::CefMessageRouterConfig()
: js_query_function("cefQuery"), js_cancel_function("cefQueryCancel") {}
: js_query_function("cefQuery"),
js_cancel_function("cefQueryCancel"),
message_size_threshold(kResponseSizeThreshold) {}
// static
CefRefPtr<CefMessageRouterBrowserSide> CefMessageRouterBrowserSide::Create(

View File

@@ -33,7 +33,7 @@ class CefZipFile : public CefZipArchive::File {
CefZipFile& operator=(const CefZipFile&) = delete;
bool Initialize(size_t data_size) {
data_.reset(new unsigned char[data_size]);
data_.reset(new (std::nothrow) unsigned char[data_size]);
if (data_) {
data_size_ = data_size;
return true;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=5bf495a6015a7c0937225685bfbe8e0163e67583$
// $hash=8faeb658bc18088c0fb3160fb354574592a17f37$
//
#include <dlfcn.h>
@@ -39,6 +39,7 @@
#include "include/capi/cef_response_capi.h"
#include "include/capi/cef_scheme_capi.h"
#include "include/capi/cef_server_capi.h"
#include "include/capi/cef_shared_process_message_builder_capi.h"
#include "include/capi/cef_ssl_info_capi.h"
#include "include/capi/cef_stream_capi.h"
#include "include/capi/cef_task_capi.h"
@@ -86,638 +87,234 @@ void* libcef_get_ptr(const char* path, const char* name) {
return ptr;
}
typedef int (*cef_execute_process_ptr)(const struct _cef_main_args_t*,
struct _cef_app_t*,
void*);
typedef int (*cef_initialize_ptr)(const struct _cef_main_args_t*,
const struct _cef_settings_t*,
struct _cef_app_t*,
void*);
typedef void (*cef_shutdown_ptr)();
typedef void (*cef_do_message_loop_work_ptr)();
typedef void (*cef_run_message_loop_ptr)();
typedef void (*cef_quit_message_loop_ptr)();
typedef void (*cef_set_osmodal_loop_ptr)(int);
typedef void (*cef_enable_highdpi_support_ptr)();
typedef int (*cef_crash_reporting_enabled_ptr)();
typedef void (*cef_set_crash_key_value_ptr)(const cef_string_t*,
const cef_string_t*);
typedef int (*cef_create_directory_ptr)(const cef_string_t*);
typedef int (*cef_get_temp_directory_ptr)(cef_string_t*);
typedef int (*cef_create_new_temp_directory_ptr)(const cef_string_t*,
cef_string_t*);
typedef int (*cef_create_temp_directory_in_directory_ptr)(const cef_string_t*,
const cef_string_t*,
cef_string_t*);
typedef int (*cef_directory_exists_ptr)(const cef_string_t*);
typedef int (*cef_delete_file_ptr)(const cef_string_t*, int);
typedef int (*cef_zip_directory_ptr)(const cef_string_t*,
const cef_string_t*,
int);
typedef void (*cef_load_crlsets_file_ptr)(const cef_string_t*);
typedef int (*cef_is_rtl_ptr)();
typedef int (*cef_add_cross_origin_whitelist_entry_ptr)(const cef_string_t*,
const cef_string_t*,
const cef_string_t*,
int);
typedef int (*cef_remove_cross_origin_whitelist_entry_ptr)(const cef_string_t*,
const cef_string_t*,
const cef_string_t*,
int);
typedef int (*cef_clear_cross_origin_whitelist_ptr)();
typedef int (*cef_parse_url_ptr)(const cef_string_t*, struct _cef_urlparts_t*);
typedef int (*cef_create_url_ptr)(const struct _cef_urlparts_t*, cef_string_t*);
typedef cef_string_userfree_t (*cef_format_url_for_security_display_ptr)(
const cef_string_t*);
typedef cef_string_userfree_t (*cef_get_mime_type_ptr)(const cef_string_t*);
typedef void (*cef_get_extensions_for_mime_type_ptr)(const cef_string_t*,
cef_string_list_t);
typedef cef_string_userfree_t (*cef_base64encode_ptr)(const void*, size_t);
typedef struct _cef_binary_value_t* (*cef_base64decode_ptr)(
const cef_string_t*);
typedef cef_string_userfree_t (*cef_uriencode_ptr)(const cef_string_t*, int);
typedef cef_string_userfree_t (*cef_uridecode_ptr)(const cef_string_t*,
int,
cef_uri_unescape_rule_t);
typedef struct _cef_value_t* (*cef_parse_json_ptr)(const cef_string_t*,
cef_json_parser_options_t);
typedef struct _cef_value_t* (
*cef_parse_json_buffer_ptr)(const void*, size_t, cef_json_parser_options_t);
typedef struct _cef_value_t* (*cef_parse_jsonand_return_error_ptr)(
const cef_string_t*,
cef_json_parser_options_t,
cef_string_t*);
typedef cef_string_userfree_t (*cef_write_json_ptr)(struct _cef_value_t*,
cef_json_writer_options_t);
typedef int (*cef_get_path_ptr)(cef_path_key_t, cef_string_t*);
typedef int (*cef_launch_process_ptr)(struct _cef_command_line_t*);
typedef int (*cef_register_scheme_handler_factory_ptr)(
const cef_string_t*,
const cef_string_t*,
struct _cef_scheme_handler_factory_t*);
typedef int (*cef_clear_scheme_handler_factories_ptr)();
typedef int (*cef_is_cert_status_error_ptr)(cef_cert_status_t);
typedef int (*cef_currently_on_ptr)(cef_thread_id_t);
typedef int (*cef_post_task_ptr)(cef_thread_id_t, struct _cef_task_t*);
typedef int (*cef_post_delayed_task_ptr)(cef_thread_id_t,
struct _cef_task_t*,
int64);
typedef int (*cef_begin_tracing_ptr)(const cef_string_t*,
struct _cef_completion_callback_t*);
typedef int (*cef_end_tracing_ptr)(const cef_string_t*,
struct _cef_end_tracing_callback_t*);
typedef int64 (*cef_now_from_system_trace_time_ptr)();
typedef int (*cef_register_extension_ptr)(const cef_string_t*,
const cef_string_t*,
struct _cef_v8handler_t*);
typedef void (*cef_execute_java_script_with_user_gesture_for_tests_ptr)(
struct _cef_frame_t*,
const cef_string_t*);
typedef int (*cef_browser_host_create_browser_ptr)(
const struct _cef_window_info_t*,
struct _cef_client_t*,
const cef_string_t*,
const struct _cef_browser_settings_t*,
struct _cef_dictionary_value_t*,
struct _cef_request_context_t*);
typedef struct _cef_browser_t* (*cef_browser_host_create_browser_sync_ptr)(
const struct _cef_window_info_t*,
struct _cef_client_t*,
const cef_string_t*,
const struct _cef_browser_settings_t*,
struct _cef_dictionary_value_t*,
struct _cef_request_context_t*);
typedef struct _cef_command_line_t* (*cef_command_line_create_ptr)();
typedef struct _cef_command_line_t* (*cef_command_line_get_global_ptr)();
typedef struct _cef_cookie_manager_t* (
*cef_cookie_manager_get_global_manager_ptr)(
struct _cef_completion_callback_t*);
typedef struct _cef_drag_data_t* (*cef_drag_data_create_ptr)();
typedef struct _cef_image_t* (*cef_image_create_ptr)();
typedef struct _cef_media_router_t* (*cef_media_router_get_global_ptr)(
struct _cef_completion_callback_t*);
typedef struct _cef_menu_model_t* (*cef_menu_model_create_ptr)(
struct _cef_menu_model_delegate_t*);
typedef struct _cef_print_settings_t* (*cef_print_settings_create_ptr)();
typedef struct _cef_process_message_t* (*cef_process_message_create_ptr)(
const cef_string_t*);
typedef struct _cef_request_t* (*cef_request_create_ptr)();
typedef struct _cef_post_data_t* (*cef_post_data_create_ptr)();
typedef struct _cef_post_data_element_t* (*cef_post_data_element_create_ptr)();
typedef struct _cef_request_context_t* (
*cef_request_context_get_global_context_ptr)();
typedef struct _cef_request_context_t* (
*cef_request_context_create_context_ptr)(
const struct _cef_request_context_settings_t*,
struct _cef_request_context_handler_t*);
typedef struct _cef_request_context_t* (*cef_create_context_shared_ptr)(
struct _cef_request_context_t*,
struct _cef_request_context_handler_t*);
typedef struct _cef_resource_bundle_t* (*cef_resource_bundle_get_global_ptr)();
typedef struct _cef_response_t* (*cef_response_create_ptr)();
typedef void (*cef_server_create_ptr)(const cef_string_t*,
uint16,
int,
struct _cef_server_handler_t*);
typedef struct _cef_stream_reader_t* (*cef_stream_reader_create_for_file_ptr)(
const cef_string_t*);
typedef struct _cef_stream_reader_t* (
*cef_stream_reader_create_for_data_ptr)(void*, size_t);
typedef struct _cef_stream_reader_t* (
*cef_stream_reader_create_for_handler_ptr)(struct _cef_read_handler_t*);
typedef struct _cef_stream_writer_t* (*cef_stream_writer_create_for_file_ptr)(
const cef_string_t*);
typedef struct _cef_stream_writer_t* (
*cef_stream_writer_create_for_handler_ptr)(struct _cef_write_handler_t*);
typedef struct _cef_task_runner_t* (
*cef_task_runner_get_for_current_thread_ptr)();
typedef struct _cef_task_runner_t* (*cef_task_runner_get_for_thread_ptr)(
cef_thread_id_t);
typedef struct _cef_thread_t* (*cef_thread_create_ptr)(const cef_string_t*,
cef_thread_priority_t,
cef_message_loop_type_t,
int,
cef_com_init_mode_t);
typedef struct _cef_urlrequest_t* (*cef_urlrequest_create_ptr)(
struct _cef_request_t*,
struct _cef_urlrequest_client_t*,
struct _cef_request_context_t*);
typedef struct _cef_v8context_t* (*cef_v8context_get_current_context_ptr)();
typedef struct _cef_v8context_t* (*cef_v8context_get_entered_context_ptr)();
typedef int (*cef_v8context_in_context_ptr)();
typedef struct _cef_v8value_t* (*cef_v8value_create_undefined_ptr)();
typedef struct _cef_v8value_t* (*cef_v8value_create_null_ptr)();
typedef struct _cef_v8value_t* (*cef_v8value_create_bool_ptr)(int);
typedef struct _cef_v8value_t* (*cef_v8value_create_int_ptr)(int32);
typedef struct _cef_v8value_t* (*cef_v8value_create_uint_ptr)(uint32);
typedef struct _cef_v8value_t* (*cef_v8value_create_double_ptr)(double);
typedef struct _cef_v8value_t* (*cef_v8value_create_date_ptr)(
const cef_time_t*);
typedef struct _cef_v8value_t* (*cef_v8value_create_string_ptr)(
const cef_string_t*);
typedef struct _cef_v8value_t* (*cef_v8value_create_object_ptr)(
struct _cef_v8accessor_t*,
struct _cef_v8interceptor_t*);
typedef struct _cef_v8value_t* (*cef_v8value_create_array_ptr)(int);
typedef struct _cef_v8value_t* (*cef_v8value_create_array_buffer_ptr)(
void*,
size_t,
struct _cef_v8array_buffer_release_callback_t*);
typedef struct _cef_v8value_t* (*cef_v8value_create_function_ptr)(
const cef_string_t*,
struct _cef_v8handler_t*);
typedef struct _cef_v8stack_trace_t* (*cef_v8stack_trace_get_current_ptr)(int);
typedef struct _cef_value_t* (*cef_value_create_ptr)();
typedef struct _cef_binary_value_t* (*cef_binary_value_create_ptr)(const void*,
size_t);
typedef struct _cef_dictionary_value_t* (*cef_dictionary_value_create_ptr)();
typedef struct _cef_list_value_t* (*cef_list_value_create_ptr)();
typedef struct _cef_waitable_event_t* (*cef_waitable_event_create_ptr)(int,
int);
typedef struct _cef_xml_reader_t* (*cef_xml_reader_create_ptr)(
struct _cef_stream_reader_t*,
cef_xml_encoding_type_t,
const cef_string_t*);
typedef struct _cef_zip_reader_t* (*cef_zip_reader_create_ptr)(
struct _cef_stream_reader_t*);
typedef struct _cef_translator_test_t* (*cef_translator_test_create_ptr)();
typedef struct _cef_translator_test_ref_ptr_library_t* (
*cef_translator_test_ref_ptr_library_create_ptr)(int);
typedef struct _cef_translator_test_ref_ptr_library_child_t* (
*cef_translator_test_ref_ptr_library_child_create_ptr)(int, int);
typedef struct _cef_translator_test_ref_ptr_library_child_child_t* (
*cef_translator_test_ref_ptr_library_child_child_create_ptr)(int, int, int);
typedef struct _cef_translator_test_scoped_library_t* (
*cef_translator_test_scoped_library_create_ptr)(int);
typedef struct _cef_translator_test_scoped_library_child_t* (
*cef_translator_test_scoped_library_child_create_ptr)(int, int);
typedef struct _cef_translator_test_scoped_library_child_child_t* (
*cef_translator_test_scoped_library_child_child_create_ptr)(int, int, int);
typedef struct _cef_browser_view_t* (*cef_browser_view_create_ptr)(
struct _cef_client_t*,
const cef_string_t*,
const struct _cef_browser_settings_t*,
struct _cef_dictionary_value_t*,
struct _cef_request_context_t*,
struct _cef_browser_view_delegate_t*);
typedef struct _cef_browser_view_t* (*cef_browser_view_get_for_browser_ptr)(
struct _cef_browser_t*);
typedef struct _cef_display_t* (*cef_display_get_primary_ptr)();
typedef struct _cef_display_t* (
*cef_display_get_nearest_point_ptr)(const cef_point_t*, int);
typedef struct _cef_display_t* (
*cef_display_get_matching_bounds_ptr)(const cef_rect_t*, int);
typedef size_t (*cef_display_get_count_ptr)();
typedef void (*cef_display_get_alls_ptr)(size_t*, struct _cef_display_t**);
typedef struct _cef_label_button_t* (*cef_label_button_create_ptr)(
struct _cef_button_delegate_t*,
const cef_string_t*);
typedef struct _cef_menu_button_t* (*cef_menu_button_create_ptr)(
struct _cef_menu_button_delegate_t*,
const cef_string_t*);
typedef struct _cef_panel_t* (*cef_panel_create_ptr)(
struct _cef_panel_delegate_t*);
typedef struct _cef_scroll_view_t* (*cef_scroll_view_create_ptr)(
struct _cef_view_delegate_t*);
typedef struct _cef_textfield_t* (*cef_textfield_create_ptr)(
struct _cef_textfield_delegate_t*);
typedef struct _cef_window_t* (*cef_window_create_top_level_ptr)(
struct _cef_window_delegate_t*);
typedef const char* (*cef_api_hash_ptr)(int);
typedef int (*cef_version_info_ptr)(int);
typedef int (*cef_get_min_log_level_ptr)();
typedef int (*cef_get_vlog_level_ptr)(const char*, size_t);
typedef void (*cef_log_ptr)(const char*, int, int, const char*);
typedef cef_string_list_t (*cef_string_list_alloc_ptr)();
typedef size_t (*cef_string_list_size_ptr)(cef_string_list_t);
typedef int (*cef_string_list_value_ptr)(cef_string_list_t,
size_t,
cef_string_t*);
typedef void (*cef_string_list_append_ptr)(cef_string_list_t,
const cef_string_t*);
typedef void (*cef_string_list_clear_ptr)(cef_string_list_t);
typedef void (*cef_string_list_free_ptr)(cef_string_list_t);
typedef cef_string_list_t (*cef_string_list_copy_ptr)(cef_string_list_t);
typedef cef_string_map_t (*cef_string_map_alloc_ptr)();
typedef size_t (*cef_string_map_size_ptr)(cef_string_map_t);
typedef int (*cef_string_map_find_ptr)(cef_string_map_t,
const cef_string_t*,
cef_string_t*);
typedef int (*cef_string_map_key_ptr)(cef_string_map_t, size_t, cef_string_t*);
typedef int (*cef_string_map_value_ptr)(cef_string_map_t,
size_t,
cef_string_t*);
typedef int (*cef_string_map_append_ptr)(cef_string_map_t,
const cef_string_t*,
const cef_string_t*);
typedef void (*cef_string_map_clear_ptr)(cef_string_map_t);
typedef void (*cef_string_map_free_ptr)(cef_string_map_t);
typedef cef_string_multimap_t (*cef_string_multimap_alloc_ptr)();
typedef size_t (*cef_string_multimap_size_ptr)(cef_string_multimap_t);
typedef size_t (*cef_string_multimap_find_count_ptr)(cef_string_multimap_t,
const cef_string_t*);
typedef int (*cef_string_multimap_enumerate_ptr)(cef_string_multimap_t,
const cef_string_t*,
size_t,
cef_string_t*);
typedef int (*cef_string_multimap_key_ptr)(cef_string_multimap_t,
size_t,
cef_string_t*);
typedef int (*cef_string_multimap_value_ptr)(cef_string_multimap_t,
size_t,
cef_string_t*);
typedef int (*cef_string_multimap_append_ptr)(cef_string_multimap_t,
const cef_string_t*,
const cef_string_t*);
typedef void (*cef_string_multimap_clear_ptr)(cef_string_multimap_t);
typedef void (*cef_string_multimap_free_ptr)(cef_string_multimap_t);
typedef int (*cef_string_wide_set_ptr)(const wchar_t*,
size_t,
cef_string_wide_t*,
int);
typedef int (*cef_string_utf8_set_ptr)(const char*,
size_t,
cef_string_utf8_t*,
int);
typedef int (*cef_string_utf16_set_ptr)(const char16*,
size_t,
cef_string_utf16_t*,
int);
typedef void (*cef_string_wide_clear_ptr)(cef_string_wide_t*);
typedef void (*cef_string_utf8_clear_ptr)(cef_string_utf8_t*);
typedef void (*cef_string_utf16_clear_ptr)(cef_string_utf16_t*);
typedef int (*cef_string_wide_cmp_ptr)(const cef_string_wide_t*,
const cef_string_wide_t*);
typedef int (*cef_string_utf8_cmp_ptr)(const cef_string_utf8_t*,
const cef_string_utf8_t*);
typedef int (*cef_string_utf16_cmp_ptr)(const cef_string_utf16_t*,
const cef_string_utf16_t*);
typedef int (*cef_string_wide_to_utf8_ptr)(const wchar_t*,
size_t,
cef_string_utf8_t*);
typedef int (*cef_string_utf8_to_wide_ptr)(const char*,
size_t,
cef_string_wide_t*);
typedef int (*cef_string_wide_to_utf16_ptr)(const wchar_t*,
size_t,
cef_string_utf16_t*);
typedef int (*cef_string_utf16_to_wide_ptr)(const char16*,
size_t,
cef_string_wide_t*);
typedef int (*cef_string_utf8_to_utf16_ptr)(const char*,
size_t,
cef_string_utf16_t*);
typedef int (*cef_string_utf16_to_utf8_ptr)(const char16*,
size_t,
cef_string_utf8_t*);
typedef int (*cef_string_ascii_to_wide_ptr)(const char*,
size_t,
cef_string_wide_t*);
typedef int (*cef_string_ascii_to_utf16_ptr)(const char*,
size_t,
cef_string_utf16_t*);
typedef cef_string_userfree_wide_t (*cef_string_userfree_wide_alloc_ptr)();
typedef cef_string_userfree_utf8_t (*cef_string_userfree_utf8_alloc_ptr)();
typedef cef_string_userfree_utf16_t (*cef_string_userfree_utf16_alloc_ptr)();
typedef void (*cef_string_userfree_wide_free_ptr)(cef_string_userfree_wide_t);
typedef void (*cef_string_userfree_utf8_free_ptr)(cef_string_userfree_utf8_t);
typedef void (*cef_string_userfree_utf16_free_ptr)(cef_string_userfree_utf16_t);
typedef int (*cef_string_utf16_to_lower_ptr)(const char16*,
size_t,
cef_string_utf16_t*);
typedef int (*cef_string_utf16_to_upper_ptr)(const char16*,
size_t,
cef_string_utf16_t*);
typedef cef_platform_thread_id_t (*cef_get_current_platform_thread_id_ptr)();
typedef cef_platform_thread_handle_t (
*cef_get_current_platform_thread_handle_ptr)();
typedef int (*cef_time_to_timet_ptr)(const cef_time_t*, time_t*);
typedef int (*cef_time_from_timet_ptr)(time_t, cef_time_t*);
typedef int (*cef_time_to_doublet_ptr)(const cef_time_t*, double*);
typedef int (*cef_time_from_doublet_ptr)(double, cef_time_t*);
typedef int (*cef_time_now_ptr)(cef_time_t*);
typedef int (*cef_time_delta_ptr)(const cef_time_t*,
const cef_time_t*,
long long*);
typedef void (*cef_trace_event_instant_ptr)(const char*,
const char*,
const char*,
uint64,
const char*,
uint64,
int);
typedef void (*cef_trace_event_begin_ptr)(const char*,
const char*,
const char*,
uint64,
const char*,
uint64,
int);
typedef void (*cef_trace_event_end_ptr)(const char*,
const char*,
const char*,
uint64,
const char*,
uint64,
int);
typedef void (*cef_trace_counter_ptr)(const char*,
const char*,
const char*,
uint64,
const char*,
uint64,
int);
typedef void (*cef_trace_counter_id_ptr)(const char*,
const char*,
uint64,
const char*,
uint64,
const char*,
uint64,
int);
typedef void (*cef_trace_event_async_begin_ptr)(const char*,
const char*,
uint64,
const char*,
uint64,
const char*,
uint64,
int);
typedef void (*cef_trace_event_async_step_into_ptr)(const char*,
const char*,
uint64,
uint64,
const char*,
uint64,
int);
typedef void (*cef_trace_event_async_step_past_ptr)(const char*,
const char*,
uint64,
uint64,
const char*,
uint64,
int);
typedef void (*cef_trace_event_async_end_ptr)(const char*,
const char*,
uint64,
const char*,
uint64,
const char*,
uint64,
int);
struct libcef_pointers {
cef_execute_process_ptr cef_execute_process;
cef_initialize_ptr cef_initialize;
cef_shutdown_ptr cef_shutdown;
cef_do_message_loop_work_ptr cef_do_message_loop_work;
cef_run_message_loop_ptr cef_run_message_loop;
cef_quit_message_loop_ptr cef_quit_message_loop;
cef_set_osmodal_loop_ptr cef_set_osmodal_loop;
cef_enable_highdpi_support_ptr cef_enable_highdpi_support;
cef_crash_reporting_enabled_ptr cef_crash_reporting_enabled;
cef_set_crash_key_value_ptr cef_set_crash_key_value;
cef_create_directory_ptr cef_create_directory;
cef_get_temp_directory_ptr cef_get_temp_directory;
cef_create_new_temp_directory_ptr cef_create_new_temp_directory;
cef_create_temp_directory_in_directory_ptr
decltype(&cef_execute_process) cef_execute_process;
decltype(&cef_initialize) cef_initialize;
decltype(&cef_shutdown) cef_shutdown;
decltype(&cef_do_message_loop_work) cef_do_message_loop_work;
decltype(&cef_run_message_loop) cef_run_message_loop;
decltype(&cef_quit_message_loop) cef_quit_message_loop;
decltype(&cef_set_osmodal_loop) cef_set_osmodal_loop;
decltype(&cef_enable_highdpi_support) cef_enable_highdpi_support;
decltype(&cef_crash_reporting_enabled) cef_crash_reporting_enabled;
decltype(&cef_set_crash_key_value) cef_set_crash_key_value;
decltype(&cef_create_directory) cef_create_directory;
decltype(&cef_get_temp_directory) cef_get_temp_directory;
decltype(&cef_create_new_temp_directory) cef_create_new_temp_directory;
decltype(&cef_create_temp_directory_in_directory)
cef_create_temp_directory_in_directory;
cef_directory_exists_ptr cef_directory_exists;
cef_delete_file_ptr cef_delete_file;
cef_zip_directory_ptr cef_zip_directory;
cef_load_crlsets_file_ptr cef_load_crlsets_file;
cef_is_rtl_ptr cef_is_rtl;
cef_add_cross_origin_whitelist_entry_ptr cef_add_cross_origin_whitelist_entry;
cef_remove_cross_origin_whitelist_entry_ptr
decltype(&cef_directory_exists) cef_directory_exists;
decltype(&cef_delete_file) cef_delete_file;
decltype(&cef_zip_directory) cef_zip_directory;
decltype(&cef_load_crlsets_file) cef_load_crlsets_file;
decltype(&cef_is_rtl) cef_is_rtl;
decltype(&cef_add_cross_origin_whitelist_entry)
cef_add_cross_origin_whitelist_entry;
decltype(&cef_remove_cross_origin_whitelist_entry)
cef_remove_cross_origin_whitelist_entry;
cef_clear_cross_origin_whitelist_ptr cef_clear_cross_origin_whitelist;
cef_parse_url_ptr cef_parse_url;
cef_create_url_ptr cef_create_url;
cef_format_url_for_security_display_ptr cef_format_url_for_security_display;
cef_get_mime_type_ptr cef_get_mime_type;
cef_get_extensions_for_mime_type_ptr cef_get_extensions_for_mime_type;
cef_base64encode_ptr cef_base64encode;
cef_base64decode_ptr cef_base64decode;
cef_uriencode_ptr cef_uriencode;
cef_uridecode_ptr cef_uridecode;
cef_parse_json_ptr cef_parse_json;
cef_parse_json_buffer_ptr cef_parse_json_buffer;
cef_parse_jsonand_return_error_ptr cef_parse_jsonand_return_error;
cef_write_json_ptr cef_write_json;
cef_get_path_ptr cef_get_path;
cef_launch_process_ptr cef_launch_process;
cef_register_scheme_handler_factory_ptr cef_register_scheme_handler_factory;
cef_clear_scheme_handler_factories_ptr cef_clear_scheme_handler_factories;
cef_is_cert_status_error_ptr cef_is_cert_status_error;
cef_currently_on_ptr cef_currently_on;
cef_post_task_ptr cef_post_task;
cef_post_delayed_task_ptr cef_post_delayed_task;
cef_begin_tracing_ptr cef_begin_tracing;
cef_end_tracing_ptr cef_end_tracing;
cef_now_from_system_trace_time_ptr cef_now_from_system_trace_time;
cef_register_extension_ptr cef_register_extension;
cef_execute_java_script_with_user_gesture_for_tests_ptr
decltype(&cef_clear_cross_origin_whitelist) cef_clear_cross_origin_whitelist;
decltype(&cef_parse_url) cef_parse_url;
decltype(&cef_create_url) cef_create_url;
decltype(&cef_format_url_for_security_display)
cef_format_url_for_security_display;
decltype(&cef_get_mime_type) cef_get_mime_type;
decltype(&cef_get_extensions_for_mime_type) cef_get_extensions_for_mime_type;
decltype(&cef_base64encode) cef_base64encode;
decltype(&cef_base64decode) cef_base64decode;
decltype(&cef_uriencode) cef_uriencode;
decltype(&cef_uridecode) cef_uridecode;
decltype(&cef_parse_json) cef_parse_json;
decltype(&cef_parse_json_buffer) cef_parse_json_buffer;
decltype(&cef_parse_jsonand_return_error) cef_parse_jsonand_return_error;
decltype(&cef_write_json) cef_write_json;
decltype(&cef_get_path) cef_get_path;
decltype(&cef_launch_process) cef_launch_process;
decltype(&cef_register_scheme_handler_factory)
cef_register_scheme_handler_factory;
decltype(&cef_clear_scheme_handler_factories)
cef_clear_scheme_handler_factories;
decltype(&cef_is_cert_status_error) cef_is_cert_status_error;
decltype(&cef_currently_on) cef_currently_on;
decltype(&cef_post_task) cef_post_task;
decltype(&cef_post_delayed_task) cef_post_delayed_task;
decltype(&cef_begin_tracing) cef_begin_tracing;
decltype(&cef_end_tracing) cef_end_tracing;
decltype(&cef_now_from_system_trace_time) cef_now_from_system_trace_time;
decltype(&cef_register_extension) cef_register_extension;
decltype(&cef_execute_java_script_with_user_gesture_for_tests)
cef_execute_java_script_with_user_gesture_for_tests;
cef_browser_host_create_browser_ptr cef_browser_host_create_browser;
cef_browser_host_create_browser_sync_ptr cef_browser_host_create_browser_sync;
cef_command_line_create_ptr cef_command_line_create;
cef_command_line_get_global_ptr cef_command_line_get_global;
cef_cookie_manager_get_global_manager_ptr
decltype(&cef_browser_host_create_browser) cef_browser_host_create_browser;
decltype(&cef_browser_host_create_browser_sync)
cef_browser_host_create_browser_sync;
decltype(&cef_command_line_create) cef_command_line_create;
decltype(&cef_command_line_get_global) cef_command_line_get_global;
decltype(&cef_cookie_manager_get_global_manager)
cef_cookie_manager_get_global_manager;
cef_drag_data_create_ptr cef_drag_data_create;
cef_image_create_ptr cef_image_create;
cef_media_router_get_global_ptr cef_media_router_get_global;
cef_menu_model_create_ptr cef_menu_model_create;
cef_print_settings_create_ptr cef_print_settings_create;
cef_process_message_create_ptr cef_process_message_create;
cef_request_create_ptr cef_request_create;
cef_post_data_create_ptr cef_post_data_create;
cef_post_data_element_create_ptr cef_post_data_element_create;
cef_request_context_get_global_context_ptr
decltype(&cef_drag_data_create) cef_drag_data_create;
decltype(&cef_image_create) cef_image_create;
decltype(&cef_media_router_get_global) cef_media_router_get_global;
decltype(&cef_menu_model_create) cef_menu_model_create;
decltype(&cef_print_settings_create) cef_print_settings_create;
decltype(&cef_process_message_create) cef_process_message_create;
decltype(&cef_request_create) cef_request_create;
decltype(&cef_post_data_create) cef_post_data_create;
decltype(&cef_post_data_element_create) cef_post_data_element_create;
decltype(&cef_request_context_get_global_context)
cef_request_context_get_global_context;
cef_request_context_create_context_ptr cef_request_context_create_context;
cef_create_context_shared_ptr cef_create_context_shared;
cef_resource_bundle_get_global_ptr cef_resource_bundle_get_global;
cef_response_create_ptr cef_response_create;
cef_server_create_ptr cef_server_create;
cef_stream_reader_create_for_file_ptr cef_stream_reader_create_for_file;
cef_stream_reader_create_for_data_ptr cef_stream_reader_create_for_data;
cef_stream_reader_create_for_handler_ptr cef_stream_reader_create_for_handler;
cef_stream_writer_create_for_file_ptr cef_stream_writer_create_for_file;
cef_stream_writer_create_for_handler_ptr cef_stream_writer_create_for_handler;
cef_task_runner_get_for_current_thread_ptr
decltype(&cef_request_context_create_context)
cef_request_context_create_context;
decltype(&cef_create_context_shared) cef_create_context_shared;
decltype(&cef_resource_bundle_get_global) cef_resource_bundle_get_global;
decltype(&cef_response_create) cef_response_create;
decltype(&cef_server_create) cef_server_create;
decltype(&cef_shared_process_message_builder_create)
cef_shared_process_message_builder_create;
decltype(&cef_stream_reader_create_for_file)
cef_stream_reader_create_for_file;
decltype(&cef_stream_reader_create_for_data)
cef_stream_reader_create_for_data;
decltype(&cef_stream_reader_create_for_handler)
cef_stream_reader_create_for_handler;
decltype(&cef_stream_writer_create_for_file)
cef_stream_writer_create_for_file;
decltype(&cef_stream_writer_create_for_handler)
cef_stream_writer_create_for_handler;
decltype(&cef_task_runner_get_for_current_thread)
cef_task_runner_get_for_current_thread;
cef_task_runner_get_for_thread_ptr cef_task_runner_get_for_thread;
cef_thread_create_ptr cef_thread_create;
cef_urlrequest_create_ptr cef_urlrequest_create;
cef_v8context_get_current_context_ptr cef_v8context_get_current_context;
cef_v8context_get_entered_context_ptr cef_v8context_get_entered_context;
cef_v8context_in_context_ptr cef_v8context_in_context;
cef_v8value_create_undefined_ptr cef_v8value_create_undefined;
cef_v8value_create_null_ptr cef_v8value_create_null;
cef_v8value_create_bool_ptr cef_v8value_create_bool;
cef_v8value_create_int_ptr cef_v8value_create_int;
cef_v8value_create_uint_ptr cef_v8value_create_uint;
cef_v8value_create_double_ptr cef_v8value_create_double;
cef_v8value_create_date_ptr cef_v8value_create_date;
cef_v8value_create_string_ptr cef_v8value_create_string;
cef_v8value_create_object_ptr cef_v8value_create_object;
cef_v8value_create_array_ptr cef_v8value_create_array;
cef_v8value_create_array_buffer_ptr cef_v8value_create_array_buffer;
cef_v8value_create_function_ptr cef_v8value_create_function;
cef_v8stack_trace_get_current_ptr cef_v8stack_trace_get_current;
cef_value_create_ptr cef_value_create;
cef_binary_value_create_ptr cef_binary_value_create;
cef_dictionary_value_create_ptr cef_dictionary_value_create;
cef_list_value_create_ptr cef_list_value_create;
cef_waitable_event_create_ptr cef_waitable_event_create;
cef_xml_reader_create_ptr cef_xml_reader_create;
cef_zip_reader_create_ptr cef_zip_reader_create;
cef_translator_test_create_ptr cef_translator_test_create;
cef_translator_test_ref_ptr_library_create_ptr
decltype(&cef_task_runner_get_for_thread) cef_task_runner_get_for_thread;
decltype(&cef_thread_create) cef_thread_create;
decltype(&cef_urlrequest_create) cef_urlrequest_create;
decltype(&cef_v8context_get_current_context)
cef_v8context_get_current_context;
decltype(&cef_v8context_get_entered_context)
cef_v8context_get_entered_context;
decltype(&cef_v8context_in_context) cef_v8context_in_context;
decltype(&cef_v8value_create_undefined) cef_v8value_create_undefined;
decltype(&cef_v8value_create_null) cef_v8value_create_null;
decltype(&cef_v8value_create_bool) cef_v8value_create_bool;
decltype(&cef_v8value_create_int) cef_v8value_create_int;
decltype(&cef_v8value_create_uint) cef_v8value_create_uint;
decltype(&cef_v8value_create_double) cef_v8value_create_double;
decltype(&cef_v8value_create_date) cef_v8value_create_date;
decltype(&cef_v8value_create_string) cef_v8value_create_string;
decltype(&cef_v8value_create_object) cef_v8value_create_object;
decltype(&cef_v8value_create_array) cef_v8value_create_array;
decltype(&cef_v8value_create_array_buffer) cef_v8value_create_array_buffer;
decltype(&cef_v8value_create_function) cef_v8value_create_function;
decltype(&cef_v8stack_trace_get_current) cef_v8stack_trace_get_current;
decltype(&cef_value_create) cef_value_create;
decltype(&cef_binary_value_create) cef_binary_value_create;
decltype(&cef_dictionary_value_create) cef_dictionary_value_create;
decltype(&cef_list_value_create) cef_list_value_create;
decltype(&cef_waitable_event_create) cef_waitable_event_create;
decltype(&cef_xml_reader_create) cef_xml_reader_create;
decltype(&cef_zip_reader_create) cef_zip_reader_create;
decltype(&cef_translator_test_create) cef_translator_test_create;
decltype(&cef_translator_test_ref_ptr_library_create)
cef_translator_test_ref_ptr_library_create;
cef_translator_test_ref_ptr_library_child_create_ptr
decltype(&cef_translator_test_ref_ptr_library_child_create)
cef_translator_test_ref_ptr_library_child_create;
cef_translator_test_ref_ptr_library_child_child_create_ptr
decltype(&cef_translator_test_ref_ptr_library_child_child_create)
cef_translator_test_ref_ptr_library_child_child_create;
cef_translator_test_scoped_library_create_ptr
decltype(&cef_translator_test_scoped_library_create)
cef_translator_test_scoped_library_create;
cef_translator_test_scoped_library_child_create_ptr
decltype(&cef_translator_test_scoped_library_child_create)
cef_translator_test_scoped_library_child_create;
cef_translator_test_scoped_library_child_child_create_ptr
decltype(&cef_translator_test_scoped_library_child_child_create)
cef_translator_test_scoped_library_child_child_create;
cef_browser_view_create_ptr cef_browser_view_create;
cef_browser_view_get_for_browser_ptr cef_browser_view_get_for_browser;
cef_display_get_primary_ptr cef_display_get_primary;
cef_display_get_nearest_point_ptr cef_display_get_nearest_point;
cef_display_get_matching_bounds_ptr cef_display_get_matching_bounds;
cef_display_get_count_ptr cef_display_get_count;
cef_display_get_alls_ptr cef_display_get_alls;
cef_label_button_create_ptr cef_label_button_create;
cef_menu_button_create_ptr cef_menu_button_create;
cef_panel_create_ptr cef_panel_create;
cef_scroll_view_create_ptr cef_scroll_view_create;
cef_textfield_create_ptr cef_textfield_create;
cef_window_create_top_level_ptr cef_window_create_top_level;
cef_api_hash_ptr cef_api_hash;
cef_version_info_ptr cef_version_info;
cef_get_min_log_level_ptr cef_get_min_log_level;
cef_get_vlog_level_ptr cef_get_vlog_level;
cef_log_ptr cef_log;
cef_string_list_alloc_ptr cef_string_list_alloc;
cef_string_list_size_ptr cef_string_list_size;
cef_string_list_value_ptr cef_string_list_value;
cef_string_list_append_ptr cef_string_list_append;
cef_string_list_clear_ptr cef_string_list_clear;
cef_string_list_free_ptr cef_string_list_free;
cef_string_list_copy_ptr cef_string_list_copy;
cef_string_map_alloc_ptr cef_string_map_alloc;
cef_string_map_size_ptr cef_string_map_size;
cef_string_map_find_ptr cef_string_map_find;
cef_string_map_key_ptr cef_string_map_key;
cef_string_map_value_ptr cef_string_map_value;
cef_string_map_append_ptr cef_string_map_append;
cef_string_map_clear_ptr cef_string_map_clear;
cef_string_map_free_ptr cef_string_map_free;
cef_string_multimap_alloc_ptr cef_string_multimap_alloc;
cef_string_multimap_size_ptr cef_string_multimap_size;
cef_string_multimap_find_count_ptr cef_string_multimap_find_count;
cef_string_multimap_enumerate_ptr cef_string_multimap_enumerate;
cef_string_multimap_key_ptr cef_string_multimap_key;
cef_string_multimap_value_ptr cef_string_multimap_value;
cef_string_multimap_append_ptr cef_string_multimap_append;
cef_string_multimap_clear_ptr cef_string_multimap_clear;
cef_string_multimap_free_ptr cef_string_multimap_free;
cef_string_wide_set_ptr cef_string_wide_set;
cef_string_utf8_set_ptr cef_string_utf8_set;
cef_string_utf16_set_ptr cef_string_utf16_set;
cef_string_wide_clear_ptr cef_string_wide_clear;
cef_string_utf8_clear_ptr cef_string_utf8_clear;
cef_string_utf16_clear_ptr cef_string_utf16_clear;
cef_string_wide_cmp_ptr cef_string_wide_cmp;
cef_string_utf8_cmp_ptr cef_string_utf8_cmp;
cef_string_utf16_cmp_ptr cef_string_utf16_cmp;
cef_string_wide_to_utf8_ptr cef_string_wide_to_utf8;
cef_string_utf8_to_wide_ptr cef_string_utf8_to_wide;
cef_string_wide_to_utf16_ptr cef_string_wide_to_utf16;
cef_string_utf16_to_wide_ptr cef_string_utf16_to_wide;
cef_string_utf8_to_utf16_ptr cef_string_utf8_to_utf16;
cef_string_utf16_to_utf8_ptr cef_string_utf16_to_utf8;
cef_string_ascii_to_wide_ptr cef_string_ascii_to_wide;
cef_string_ascii_to_utf16_ptr cef_string_ascii_to_utf16;
cef_string_userfree_wide_alloc_ptr cef_string_userfree_wide_alloc;
cef_string_userfree_utf8_alloc_ptr cef_string_userfree_utf8_alloc;
cef_string_userfree_utf16_alloc_ptr cef_string_userfree_utf16_alloc;
cef_string_userfree_wide_free_ptr cef_string_userfree_wide_free;
cef_string_userfree_utf8_free_ptr cef_string_userfree_utf8_free;
cef_string_userfree_utf16_free_ptr cef_string_userfree_utf16_free;
cef_string_utf16_to_lower_ptr cef_string_utf16_to_lower;
cef_string_utf16_to_upper_ptr cef_string_utf16_to_upper;
cef_get_current_platform_thread_id_ptr cef_get_current_platform_thread_id;
cef_get_current_platform_thread_handle_ptr
decltype(&cef_browser_view_create) cef_browser_view_create;
decltype(&cef_browser_view_get_for_browser) cef_browser_view_get_for_browser;
decltype(&cef_display_get_primary) cef_display_get_primary;
decltype(&cef_display_get_nearest_point) cef_display_get_nearest_point;
decltype(&cef_display_get_matching_bounds) cef_display_get_matching_bounds;
decltype(&cef_display_get_count) cef_display_get_count;
decltype(&cef_display_get_alls) cef_display_get_alls;
decltype(&cef_label_button_create) cef_label_button_create;
decltype(&cef_menu_button_create) cef_menu_button_create;
decltype(&cef_panel_create) cef_panel_create;
decltype(&cef_scroll_view_create) cef_scroll_view_create;
decltype(&cef_textfield_create) cef_textfield_create;
decltype(&cef_window_create_top_level) cef_window_create_top_level;
decltype(&cef_api_hash) cef_api_hash;
decltype(&cef_version_info) cef_version_info;
decltype(&cef_get_min_log_level) cef_get_min_log_level;
decltype(&cef_get_vlog_level) cef_get_vlog_level;
decltype(&cef_log) cef_log;
decltype(&cef_string_list_alloc) cef_string_list_alloc;
decltype(&cef_string_list_size) cef_string_list_size;
decltype(&cef_string_list_value) cef_string_list_value;
decltype(&cef_string_list_append) cef_string_list_append;
decltype(&cef_string_list_clear) cef_string_list_clear;
decltype(&cef_string_list_free) cef_string_list_free;
decltype(&cef_string_list_copy) cef_string_list_copy;
decltype(&cef_string_map_alloc) cef_string_map_alloc;
decltype(&cef_string_map_size) cef_string_map_size;
decltype(&cef_string_map_find) cef_string_map_find;
decltype(&cef_string_map_key) cef_string_map_key;
decltype(&cef_string_map_value) cef_string_map_value;
decltype(&cef_string_map_append) cef_string_map_append;
decltype(&cef_string_map_clear) cef_string_map_clear;
decltype(&cef_string_map_free) cef_string_map_free;
decltype(&cef_string_multimap_alloc) cef_string_multimap_alloc;
decltype(&cef_string_multimap_size) cef_string_multimap_size;
decltype(&cef_string_multimap_find_count) cef_string_multimap_find_count;
decltype(&cef_string_multimap_enumerate) cef_string_multimap_enumerate;
decltype(&cef_string_multimap_key) cef_string_multimap_key;
decltype(&cef_string_multimap_value) cef_string_multimap_value;
decltype(&cef_string_multimap_append) cef_string_multimap_append;
decltype(&cef_string_multimap_clear) cef_string_multimap_clear;
decltype(&cef_string_multimap_free) cef_string_multimap_free;
decltype(&cef_string_wide_set) cef_string_wide_set;
decltype(&cef_string_utf8_set) cef_string_utf8_set;
decltype(&cef_string_utf16_set) cef_string_utf16_set;
decltype(&cef_string_wide_clear) cef_string_wide_clear;
decltype(&cef_string_utf8_clear) cef_string_utf8_clear;
decltype(&cef_string_utf16_clear) cef_string_utf16_clear;
decltype(&cef_string_wide_cmp) cef_string_wide_cmp;
decltype(&cef_string_utf8_cmp) cef_string_utf8_cmp;
decltype(&cef_string_utf16_cmp) cef_string_utf16_cmp;
decltype(&cef_string_wide_to_utf8) cef_string_wide_to_utf8;
decltype(&cef_string_utf8_to_wide) cef_string_utf8_to_wide;
decltype(&cef_string_wide_to_utf16) cef_string_wide_to_utf16;
decltype(&cef_string_utf16_to_wide) cef_string_utf16_to_wide;
decltype(&cef_string_utf8_to_utf16) cef_string_utf8_to_utf16;
decltype(&cef_string_utf16_to_utf8) cef_string_utf16_to_utf8;
decltype(&cef_string_ascii_to_wide) cef_string_ascii_to_wide;
decltype(&cef_string_ascii_to_utf16) cef_string_ascii_to_utf16;
decltype(&cef_string_userfree_wide_alloc) cef_string_userfree_wide_alloc;
decltype(&cef_string_userfree_utf8_alloc) cef_string_userfree_utf8_alloc;
decltype(&cef_string_userfree_utf16_alloc) cef_string_userfree_utf16_alloc;
decltype(&cef_string_userfree_wide_free) cef_string_userfree_wide_free;
decltype(&cef_string_userfree_utf8_free) cef_string_userfree_utf8_free;
decltype(&cef_string_userfree_utf16_free) cef_string_userfree_utf16_free;
decltype(&cef_string_utf16_to_lower) cef_string_utf16_to_lower;
decltype(&cef_string_utf16_to_upper) cef_string_utf16_to_upper;
decltype(&cef_get_current_platform_thread_id)
cef_get_current_platform_thread_id;
decltype(&cef_get_current_platform_thread_handle)
cef_get_current_platform_thread_handle;
cef_time_to_timet_ptr cef_time_to_timet;
cef_time_from_timet_ptr cef_time_from_timet;
cef_time_to_doublet_ptr cef_time_to_doublet;
cef_time_from_doublet_ptr cef_time_from_doublet;
cef_time_now_ptr cef_time_now;
cef_time_delta_ptr cef_time_delta;
cef_trace_event_instant_ptr cef_trace_event_instant;
cef_trace_event_begin_ptr cef_trace_event_begin;
cef_trace_event_end_ptr cef_trace_event_end;
cef_trace_counter_ptr cef_trace_counter;
cef_trace_counter_id_ptr cef_trace_counter_id;
cef_trace_event_async_begin_ptr cef_trace_event_async_begin;
cef_trace_event_async_step_into_ptr cef_trace_event_async_step_into;
cef_trace_event_async_step_past_ptr cef_trace_event_async_step_past;
cef_trace_event_async_end_ptr cef_trace_event_async_end;
decltype(&cef_time_to_timet) cef_time_to_timet;
decltype(&cef_time_from_timet) cef_time_from_timet;
decltype(&cef_time_to_doublet) cef_time_to_doublet;
decltype(&cef_time_from_doublet) cef_time_from_doublet;
decltype(&cef_time_now) cef_time_now;
decltype(&cef_time_delta) cef_time_delta;
decltype(&cef_trace_event_instant) cef_trace_event_instant;
decltype(&cef_trace_event_begin) cef_trace_event_begin;
decltype(&cef_trace_event_end) cef_trace_event_end;
decltype(&cef_trace_counter) cef_trace_counter;
decltype(&cef_trace_counter_id) cef_trace_counter_id;
decltype(&cef_trace_event_async_begin) cef_trace_event_async_begin;
decltype(&cef_trace_event_async_step_into) cef_trace_event_async_step_into;
decltype(&cef_trace_event_async_step_past) cef_trace_event_async_step_past;
decltype(&cef_trace_event_async_end) cef_trace_event_async_end;
} g_libcef_pointers = {0};
#define INIT_ENTRY(name) \
g_libcef_pointers.name = (name##_ptr)libcef_get_ptr(path, #name); \
if (!g_libcef_pointers.name) { \
return 0; \
#define INIT_ENTRY(name) \
g_libcef_pointers.name = (decltype(&name))libcef_get_ptr(path, #name); \
if (!g_libcef_pointers.name) { \
return 0; \
}
int libcef_init_pointers(const char* path) {
@@ -789,6 +386,7 @@ int libcef_init_pointers(const char* path) {
INIT_ENTRY(cef_resource_bundle_get_global);
INIT_ENTRY(cef_response_create);
INIT_ENTRY(cef_server_create);
INIT_ENTRY(cef_shared_process_message_builder_create);
INIT_ENTRY(cef_stream_reader_create_for_file);
INIT_ENTRY(cef_stream_reader_create_for_data);
INIT_ENTRY(cef_stream_reader_create_for_handler);
@@ -1079,8 +677,8 @@ int cef_create_url(const struct _cef_urlparts_t* parts, cef_string_t* url) {
}
NO_SANITIZE("cfi-icall")
cef_string_userfree_t cef_format_url_for_security_display(
const cef_string_t* origin_url) {
cef_string_userfree_t
cef_format_url_for_security_display(const cef_string_t* origin_url) {
return g_libcef_pointers.cef_format_url_for_security_display(origin_url);
}
@@ -1341,6 +939,15 @@ void cef_server_create(const cef_string_t* address,
g_libcef_pointers.cef_server_create(address, port, backlog, handler);
}
NO_SANITIZE("cfi-icall")
struct
_cef_shared_process_message_builder_t* cef_shared_process_message_builder_create(
const cef_string_t* name,
size_t byte_size) {
return g_libcef_pointers.cef_shared_process_message_builder_create(name,
byte_size);
}
NO_SANITIZE("cfi-icall")
struct _cef_stream_reader_t* cef_stream_reader_create_for_file(
const cef_string_t* fileName) {
@@ -1534,46 +1141,54 @@ struct _cef_translator_test_t* cef_translator_test_create() {
}
NO_SANITIZE("cfi-icall")
struct _cef_translator_test_ref_ptr_library_t*
cef_translator_test_ref_ptr_library_create(int value) {
struct
_cef_translator_test_ref_ptr_library_t* cef_translator_test_ref_ptr_library_create(
int value) {
return g_libcef_pointers.cef_translator_test_ref_ptr_library_create(value);
}
NO_SANITIZE("cfi-icall")
struct _cef_translator_test_ref_ptr_library_child_t*
cef_translator_test_ref_ptr_library_child_create(int value, int other_value) {
struct
_cef_translator_test_ref_ptr_library_child_t* cef_translator_test_ref_ptr_library_child_create(
int value,
int other_value) {
return g_libcef_pointers.cef_translator_test_ref_ptr_library_child_create(
value, other_value);
}
NO_SANITIZE("cfi-icall")
struct _cef_translator_test_ref_ptr_library_child_child_t*
cef_translator_test_ref_ptr_library_child_child_create(int value,
int other_value,
int other_other_value) {
struct
_cef_translator_test_ref_ptr_library_child_child_t* cef_translator_test_ref_ptr_library_child_child_create(
int value,
int other_value,
int other_other_value) {
return g_libcef_pointers
.cef_translator_test_ref_ptr_library_child_child_create(
value, other_value, other_other_value);
}
NO_SANITIZE("cfi-icall")
struct _cef_translator_test_scoped_library_t*
cef_translator_test_scoped_library_create(int value) {
struct
_cef_translator_test_scoped_library_t* cef_translator_test_scoped_library_create(
int value) {
return g_libcef_pointers.cef_translator_test_scoped_library_create(value);
}
NO_SANITIZE("cfi-icall")
struct _cef_translator_test_scoped_library_child_t*
cef_translator_test_scoped_library_child_create(int value, int other_value) {
struct
_cef_translator_test_scoped_library_child_t* cef_translator_test_scoped_library_child_create(
int value,
int other_value) {
return g_libcef_pointers.cef_translator_test_scoped_library_child_create(
value, other_value);
}
NO_SANITIZE("cfi-icall")
struct _cef_translator_test_scoped_library_child_child_t*
cef_translator_test_scoped_library_child_child_create(int value,
int other_value,
int other_other_value) {
struct
_cef_translator_test_scoped_library_child_child_t* cef_translator_test_scoped_library_child_child_create(
int value,
int other_value,
int other_other_value) {
return g_libcef_pointers
.cef_translator_test_scoped_library_child_child_create(value, other_value,
other_other_value);

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=98d509772d772e85d47d53e3df21f7317799c19e$
// $hash=5e9ff0d723683c16009ad0c7c697ea461b653aaf$
//
#ifndef CEF_LIBCEF_DLL_WRAPPER_TYPES_H_
@@ -77,6 +77,7 @@ enum CefWrapperType {
WT_LIFE_SPAN_HANDLER,
WT_LIST_VALUE,
WT_LOAD_HANDLER,
WT_MEDIA_ACCESS_CALLBACK,
WT_MEDIA_OBSERVER,
WT_MEDIA_ROUTE,
WT_MEDIA_ROUTE_CREATE_CALLBACK,
@@ -95,6 +96,8 @@ enum CefWrapperType {
WT_PANEL,
WT_PANEL_DELEGATE,
WT_PDF_PRINT_CALLBACK,
WT_PERMISSION_HANDLER,
WT_PERMISSION_PROMPT_CALLBACK,
WT_POST_DATA,
WT_POST_DATA_ELEMENT,
WT_PRINT_DIALOG_CALLBACK,
@@ -131,6 +134,8 @@ enum CefWrapperType {
WT_SERVER,
WT_SERVER_HANDLER,
WT_SET_COOKIE_CALLBACK,
WT_SHARED_MEMORY_REGION,
WT_SHARED_PROCESS_MESSAGE_BUILDER,
WT_STREAM_READER,
WT_STREAM_WRITER,
WT_STRING_VISITOR,

View File

@@ -39,6 +39,9 @@ patches = [
#
# Support custom VS toolchain on Windows.
# https://bugs.chromium.org/p/chromium/issues/detail?id=623342
#
# Don't copy dbghelp.dll/dbgcore.dll from the Windows SDK.
# https://bitbucket.org/chromiumembedded/cef/issues/3356
'name': 'runhooks',
},
{
@@ -253,6 +256,11 @@ patches = [
# https://bitbucket.org/chromiumembedded/cef/issues/2830
'name': 'chrome_browser_net_proxy',
},
{
# Support override of CreatePermissionPrompt.
# https://bitbucket.org/chromiumembedded/cef/issues/3352
'name': 'chrome_browser_permission_prompt',
},
{
# alloy: Don't initialize ExtensionSystemFactory when extensions are
# disabled.
@@ -583,5 +591,11 @@ patches = [
# Windows: Fix time_win.cc compile error with cef_sandbox.
# https://chromium-review.googlesource.com/c/chromium/src/+/3718022
'name': 'base_time_3718022',
},
{
# Windows: Fix ARM64 v8:run_mksnapshot_default fails
# https://bugs.chromium.org/p/chromium/issues/detail?id=1344759
'name': 'win_v8_mksnapshot_1344759',
'path': 'v8',
}
]

View File

@@ -1,5 +1,5 @@
diff --git base/BUILD.gn base/BUILD.gn
index 3d13052ffc51f..808aa7607c890 100644
index 2b1a93670de43..aab1938cd69ec 100644
--- base/BUILD.gn
+++ base/BUILD.gn
@@ -37,6 +37,7 @@ import("//build/nocompile.gni")
@@ -10,7 +10,7 @@ index 3d13052ffc51f..808aa7607c890 100644
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
@@ -1903,7 +1904,11 @@ mixed_component("base") {
@@ -1905,7 +1906,11 @@ mixed_component("base") {
"hash/md5_constexpr_internal.h",
"hash/sha1.h",
]
@@ -23,7 +23,7 @@ index 3d13052ffc51f..808aa7607c890 100644
sources += [
"hash/md5_nacl.cc",
"hash/md5_nacl.h",
@@ -2056,6 +2061,12 @@ mixed_component("base") {
@@ -2058,6 +2063,12 @@ mixed_component("base") {
defines += [ "COM_INIT_CHECK_HOOK_DISABLED" ]
}

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
index f4f1725e5a0ed..59ce489a635c3 100644
index bbe8847b3da8d..44e19cab0aab6 100644
--- chrome/browser/BUILD.gn
+++ chrome/browser/BUILD.gn
@@ -11,6 +11,7 @@ import("//build/config/compiler/pgo/pgo.gni")
@@ -10,7 +10,7 @@ index f4f1725e5a0ed..59ce489a635c3 100644
import("//chrome/browser/buildflags.gni")
import("//chrome/browser/downgrade/buildflags.gni")
import("//chrome/common/features.gni")
@@ -1946,6 +1947,7 @@ static_library("browser") {
@@ -1950,6 +1951,7 @@ static_library("browser") {
"//build:chromeos_buildflags",
"//build/config/compiler:compiler_buildflags",
"//cc",
@@ -18,7 +18,7 @@ index f4f1725e5a0ed..59ce489a635c3 100644
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -2482,6 +2484,10 @@ static_library("browser") {
@@ -2488,6 +2490,10 @@ static_library("browser") {
]
}

View File

@@ -13,7 +13,7 @@ index 3285e422f76c1..5f35b91897b75 100644
return false;
}
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
index 66bece3638bf5..87e059da1256c 100644
index 583a685cd125a..bef2272570eb1 100644
--- chrome/browser/ui/BUILD.gn
+++ chrome/browser/ui/BUILD.gn
@@ -9,6 +9,7 @@ import("//build/config/compiler/compiler.gni")
@@ -43,7 +43,7 @@ index 66bece3638bf5..87e059da1256c 100644
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -5461,6 +5467,7 @@ static_library("ui") {
@@ -5463,6 +5469,7 @@ static_library("ui") {
if (enable_basic_printing) {
deps += [
"//components/printing/browser",
@@ -52,7 +52,7 @@ index 66bece3638bf5..87e059da1256c 100644
]
}
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
index 63d64acc72318..fd3cb52daf611 100644
index 63d64acc72318..21f0a0b81f996 100644
--- chrome/browser/ui/browser.cc
+++ chrome/browser/ui/browser.cc
@@ -264,6 +264,25 @@
@@ -254,7 +254,23 @@ index 63d64acc72318..fd3cb52daf611 100644
}
bool Browser::IsFullscreenForTabOrPending(const WebContents* web_contents) {
@@ -2664,13 +2763,20 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
@@ -2127,6 +2226,15 @@ void Browser::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) {
+#if BUILDFLAG(ENABLE_CEF)
+ if (cef_browser_delegate_) {
+ callback = cef_browser_delegate_->RequestMediaAccessPermissionEx(
+ web_contents, request, std::move(callback));
+ if (callback.is_null())
+ return;
+ }
+#endif
+
const extensions::Extension* extension =
GetExtensionForOrigin(profile_, request.security_origin);
MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
@@ -2664,13 +2772,20 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
// Browser, Getters for UI (private):
StatusBubble* Browser::GetStatusBubble() {
@@ -276,7 +292,7 @@ index 63d64acc72318..fd3cb52daf611 100644
return window_ ? window_->GetStatusBubble() : nullptr;
}
@@ -2797,6 +2903,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
@@ -2797,6 +2912,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
content_translate_driver->RemoveTranslationObserver(this);
BookmarkTabHelper::FromWebContents(web_contents)->RemoveObserver(this);
}

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/renderer_context_menu/render_view_context_menu.cc chrome/browser/renderer_context_menu/render_view_context_menu.cc
index 95a75d011f33e..cc5dc818152f8 100644
index 36e5cc38f09ff..645278d32d1e4 100644
--- chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -301,6 +301,13 @@ base::OnceCallback<void(RenderViewContextMenu*)>* GetMenuShownCallback() {
@@ -55,7 +55,7 @@ index 95a75d011f33e..cc5dc818152f8 100644
}
Profile* RenderViewContextMenu::GetProfile() const {
@@ -2902,6 +2927,12 @@ void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
@@ -2914,6 +2939,12 @@ void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
execute_plugin_action_callback_ = std::move(cb);
}

Some files were not shown because too many files have changed in this diff Show More