mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
49 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
55e15c8dee | ||
|
9d567e22ba | ||
|
848712f89e | ||
|
5d1e039e05 | ||
|
c76a3b9f2e | ||
|
2d7731bda2 | ||
|
ae23bbc63c | ||
|
81e35b9277 | ||
|
f768881e64 | ||
|
9499fd03b6 | ||
|
f2646ea38e | ||
|
c49b21c407 | ||
|
fe622e7aa0 | ||
|
26778307c8 | ||
|
ef03e9636e | ||
|
612d63af73 | ||
|
e8fb169bed | ||
|
1b74ac5124 | ||
|
b2274f534d | ||
|
3476199bc5 | ||
|
6651523d86 | ||
|
f594ca3785 | ||
|
15caa9858d | ||
|
e6a96e2bec | ||
|
90aea56de6 | ||
|
a2a1b66ea5 | ||
|
8d7001adc3 | ||
|
f3e92b45fc | ||
|
64c2dc13ca | ||
|
a8a96235a8 | ||
|
29938f9cb0 | ||
|
d8ea7363f5 | ||
|
f8dd0dbfb4 | ||
|
bdec92caf8 | ||
|
4ae030fec1 | ||
|
c7d4d9690c | ||
|
39e64d8cc9 | ||
|
262ed72348 | ||
|
27c6a4eabc | ||
|
4df2933516 | ||
|
57d7d89b53 | ||
|
cab404578d | ||
|
ef6ae3071d | ||
|
b064ba08f3 | ||
|
f808926fbd | ||
|
f4ecc23213 | ||
|
0a633e361b | ||
|
2133d8f5b3 | ||
|
445da33efe |
8
BUILD.gn
8
BUILD.gn
@@ -1403,12 +1403,12 @@ make_pack_header("strings") {
|
||||
header = "$root_out_dir/includes/include/cef_pack_strings.h"
|
||||
inputs = [
|
||||
"$root_gen_dir/cef/grit/cef_strings.h",
|
||||
"$root_gen_dir/chrome/grit/chromium_strings.h",
|
||||
"$root_gen_dir/chrome/grit/branded_strings.h",
|
||||
"$root_gen_dir/chrome/grit/generated_resources.h",
|
||||
"$root_gen_dir/chrome/grit/locale_settings.h",
|
||||
"$root_gen_dir/chrome/grit/platform_locale_settings.h",
|
||||
"$root_gen_dir/components/omnibox/resources/grit/omnibox_pedal_synonyms.h",
|
||||
"$root_gen_dir/components/strings/grit/components_chromium_strings.h",
|
||||
"$root_gen_dir/components/strings/grit/components_branded_strings.h",
|
||||
"$root_gen_dir/components/strings/grit/components_strings.h",
|
||||
"$root_gen_dir/extensions/strings/grit/extensions_strings.h",
|
||||
"$root_gen_dir/services/strings/grit/services_strings.h",
|
||||
@@ -1419,12 +1419,12 @@ make_pack_header("strings") {
|
||||
|
||||
deps = [
|
||||
":cef_strings",
|
||||
"//chrome/app:chromium_strings",
|
||||
"//chrome/app:branded_strings",
|
||||
"//chrome/app:generated_resources",
|
||||
"//chrome/app/resources:locale_settings",
|
||||
"//chrome/app/resources:platform_locale_settings",
|
||||
"//components/omnibox/resources:omnibox_pedal_synonyms",
|
||||
"//components/strings:components_chromium_strings",
|
||||
"//components/strings:components_branded_strings",
|
||||
"//components/strings:components_locale_settings",
|
||||
"//components/strings:components_strings",
|
||||
"//extensions/strings",
|
||||
|
@@ -7,6 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/117.0.5938.152',
|
||||
'depot_tools_checkout': 'd9011c559b'
|
||||
'chromium_checkout': 'refs/tags/119.0.6045.199',
|
||||
'depot_tools_checkout': '744bfd2a7b'
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@
|
||||
# distribution include:
|
||||
#
|
||||
# Linux: Ninja, GCC 7.5.0+, Unix Makefiles
|
||||
# MacOS: Ninja, Xcode 12.2 to 13.0
|
||||
# MacOS: Ninja, Xcode 12.2 to 15.0
|
||||
# Windows: Ninja, Visual Studio 2022
|
||||
#
|
||||
# Ninja is a cross-platform open-source tool for running fast builds using
|
||||
@@ -36,7 +36,7 @@
|
||||
#
|
||||
# The below requirements must be met to build this CEF binary distribution.
|
||||
#
|
||||
# - CMake version 3.19 or newer.
|
||||
# - CMake version 3.21 or newer.
|
||||
#
|
||||
# - Linux requirements:
|
||||
# Currently supported distributions include Debian 10 (Buster), Ubuntu 18
|
||||
@@ -48,7 +48,7 @@
|
||||
# libgtk3.0-dev (required by the cefclient target only)
|
||||
#
|
||||
# - MacOS requirements:
|
||||
# Xcode 12.2 to 13.4 building on MacOS 10.15.4 (Catalina) or newer. Only
|
||||
# Xcode 12.2 to 15.0 building on MacOS 10.15.4 (Catalina) or newer. Only
|
||||
# 64-bit builds are supported. The Xcode command-line tools must also be
|
||||
# installed. Newer Xcode versions may not have been been tested and are not
|
||||
# recommended.
|
||||
|
@@ -49,6 +49,7 @@ The base CEF framework includes support for the C and C++ programming languages.
|
||||
* Delphi - https://github.com/hgourvest/dcef3
|
||||
* Delphi - https://github.com/salvadordf/CEF4Delphi
|
||||
* Go - https://github.com/CzarekTomczak/cef2go
|
||||
* Go - https://github.com/energye/energy
|
||||
* Java - https://bitbucket.org/chromiumembedded/java-cef
|
||||
* Python - http://code.google.com/p/cefpython/
|
||||
|
||||
|
@@ -147,6 +147,8 @@
|
||||
'libcef_dll/wrapper/cef_byte_read_handler.cc',
|
||||
'libcef_dll/wrapper/cef_closure_task.cc',
|
||||
'libcef_dll/wrapper/cef_message_router.cc',
|
||||
'libcef_dll/wrapper/cef_message_router_utils.cc',
|
||||
'libcef_dll/wrapper/cef_message_router_utils.h',
|
||||
'libcef_dll/wrapper/cef_resource_manager.cc',
|
||||
'libcef_dll/wrapper/cef_scoped_temp_dir.cc',
|
||||
'libcef_dll/wrapper/cef_stream_resource_handler.cc',
|
||||
@@ -218,6 +220,8 @@
|
||||
'tests/shared/browser/util_win.h',
|
||||
],
|
||||
'cefclient_sources_browser': [
|
||||
'tests/cefclient/browser/binary_transfer_test.cc',
|
||||
'tests/cefclient/browser/binary_transfer_test.h',
|
||||
'tests/cefclient/browser/binding_test.cc',
|
||||
'tests/cefclient/browser/binding_test.h',
|
||||
'tests/cefclient/browser/browser_window.cc',
|
||||
@@ -309,6 +313,7 @@
|
||||
'tests/cefclient/resources/dialogs.html',
|
||||
'tests/cefclient/resources/draggable.html',
|
||||
'tests/cefclient/resources/ipc_performance.html',
|
||||
'tests/cefclient/resources/binary_transfer.html',
|
||||
'tests/cefclient/resources/localstorage.html',
|
||||
'tests/cefclient/resources/logo.png',
|
||||
'tests/cefclient/resources/media_router.html',
|
||||
@@ -496,6 +501,7 @@
|
||||
'tests/ceftests/jsdialog_unittest.cc',
|
||||
'tests/ceftests/life_span_unittest.cc',
|
||||
'tests/ceftests/media_access_unittest.cc',
|
||||
'tests/ceftests/message_router_binary_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',
|
||||
@@ -603,6 +609,7 @@
|
||||
'tests/ceftests/dom_unittest.cc',
|
||||
'tests/ceftests/frame_unittest.cc',
|
||||
'tests/ceftests/media_access_unittest.cc',
|
||||
'tests/ceftests/message_router_binary_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',
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=683d7bff8da04826eee83c7e23cf9c5a701ae265$
|
||||
// $hash=eed525e9abcbf8e8b959067e0056ca470c5210c7$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_CAPI_H_
|
||||
@@ -365,16 +365,39 @@ typedef struct _cef_browser_host_t {
|
||||
struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
/// Get the current zoom level. The default zoom level is 0.0. This function
|
||||
/// can only be called on the UI thread.
|
||||
/// Returns true (1) if this browser can execute the specified zoom command.
|
||||
/// This function can only be called on the UI thread.
|
||||
///
|
||||
int(CEF_CALLBACK* can_zoom)(struct _cef_browser_host_t* self,
|
||||
cef_zoom_command_t command);
|
||||
|
||||
///
|
||||
/// Execute a zoom command in this browser. If called on the UI thread the
|
||||
/// change will be applied immediately. Otherwise, the change will be applied
|
||||
/// asynchronously on the UI thread.
|
||||
///
|
||||
void(CEF_CALLBACK* zoom)(struct _cef_browser_host_t* self,
|
||||
cef_zoom_command_t command);
|
||||
|
||||
///
|
||||
/// Get the default zoom level. This value will be 0.0 by default but can be
|
||||
/// configured with the Chrome runtime. This function can only be called on
|
||||
/// the UI thread.
|
||||
///
|
||||
double(CEF_CALLBACK* get_default_zoom_level)(
|
||||
struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
/// Get the current zoom level. This function can only be called on the UI
|
||||
/// thread.
|
||||
///
|
||||
double(CEF_CALLBACK* get_zoom_level)(struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
/// Change the zoom level to the specified value. Specify 0.0 to reset the
|
||||
/// zoom level. If called on the UI thread the change will be applied
|
||||
/// immediately. Otherwise, the change will be applied asynchronously on the
|
||||
/// UI thread.
|
||||
/// zoom level to the default. If called on the UI thread the change will be
|
||||
/// applied immediately. Otherwise, the change will be applied asynchronously
|
||||
/// on the UI thread.
|
||||
///
|
||||
void(CEF_CALLBACK* set_zoom_level)(struct _cef_browser_host_t* self,
|
||||
double zoomLevel);
|
||||
@@ -909,6 +932,48 @@ typedef struct _cef_browser_host_t {
|
||||
/// be called on the UI thread.
|
||||
///
|
||||
int(CEF_CALLBACK* is_audio_muted)(struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
/// Returns true (1) if the renderer is currently in browser fullscreen. This
|
||||
/// differs from window fullscreen in that browser fullscreen is entered using
|
||||
/// the JavaScript Fullscreen API and modifies CSS attributes such as the
|
||||
/// ::backdrop pseudo-element and :fullscreen pseudo-structure. This function
|
||||
/// can only be called on the UI thread.
|
||||
///
|
||||
int(CEF_CALLBACK* is_fullscreen)(struct _cef_browser_host_t* self);
|
||||
|
||||
///
|
||||
/// Requests the renderer to exit browser fullscreen. In most cases exiting
|
||||
/// window fullscreen should also exit browser fullscreen. With the Alloy
|
||||
/// runtime this function should be called in response to a user action such
|
||||
/// as clicking the green traffic light button on MacOS
|
||||
/// (cef_window_delegate_t::OnWindowFullscreenTransition callback) or pressing
|
||||
/// the "ESC" key (cef_keyboard_handler_t::OnPreKeyEvent callback). With the
|
||||
/// Chrome runtime these standard exit actions are handled internally but
|
||||
/// new/additional user actions can use this function. Set |will_cause_resize|
|
||||
/// to true (1) if exiting browser fullscreen will cause a view resize.
|
||||
///
|
||||
void(CEF_CALLBACK* exit_fullscreen)(struct _cef_browser_host_t* self,
|
||||
int will_cause_resize);
|
||||
|
||||
///
|
||||
/// Returns true (1) if a Chrome command is supported and enabled. Values for
|
||||
/// |command_id| can be found in the cef_command_ids.h file. This function can
|
||||
/// only be called on the UI thread. Only used with the Chrome runtime.
|
||||
///
|
||||
int(CEF_CALLBACK* can_execute_chrome_command)(
|
||||
struct _cef_browser_host_t* self,
|
||||
int command_id);
|
||||
|
||||
///
|
||||
/// Execute a Chrome command. Values for |command_id| can be found in the
|
||||
/// cef_command_ids.h file. |disposition| provides information about the
|
||||
/// intended command target. Only used with the Chrome runtime.
|
||||
///
|
||||
void(CEF_CALLBACK* execute_chrome_command)(
|
||||
struct _cef_browser_host_t* self,
|
||||
int command_id,
|
||||
cef_window_open_disposition_t disposition);
|
||||
} cef_browser_host_t;
|
||||
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=d703b8af664ed9dfac8ad935616ef43fafc062e2$
|
||||
// $hash=f18407bec715e682d5745aeb155a0113473723dd$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DOM_CAPI_H_
|
||||
@@ -209,8 +209,7 @@ typedef struct _cef_domnode_t {
|
||||
///
|
||||
/// Returns the type of this form control element node.
|
||||
///
|
||||
// The resulting string must be freed by calling cef_string_userfree_free().
|
||||
cef_string_userfree_t(CEF_CALLBACK* get_form_control_element_type)(
|
||||
cef_dom_form_control_type_t(CEF_CALLBACK* get_form_control_element_type)(
|
||||
struct _cef_domnode_t* self);
|
||||
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=a1ce746f0dd97d21973d4c80d8ef46391c0fd463$
|
||||
// $hash=8d00465ba004758f464cdb8b1fbd02cd26323ace$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_DRAG_DATA_CAPI_H_
|
||||
@@ -149,6 +149,13 @@ typedef struct _cef_drag_data_t {
|
||||
int(CEF_CALLBACK* get_file_names)(struct _cef_drag_data_t* self,
|
||||
cef_string_list_t names);
|
||||
|
||||
///
|
||||
/// Retrieve the list of file paths that are being dragged into the browser
|
||||
/// window.
|
||||
///
|
||||
int(CEF_CALLBACK* get_file_paths)(struct _cef_drag_data_t* self,
|
||||
cef_string_list_t paths);
|
||||
|
||||
///
|
||||
/// Set the link URL that is being dragged.
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=1c807597b96889f44a1e5199e860e8db4948b473$
|
||||
// $hash=32a0c21a71aa7137fa9660b942f597705bc8b05e$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_LIFE_SPAN_HANDLER_CAPI_H_
|
||||
@@ -100,6 +100,34 @@ typedef struct _cef_life_span_handler_t {
|
||||
struct _cef_dictionary_value_t** extra_info,
|
||||
int* no_javascript_access);
|
||||
|
||||
///
|
||||
/// Called on the UI thread before a new DevTools popup browser is created.
|
||||
/// The |browser| value represents the source of the popup request. Optionally
|
||||
/// modify |windowInfo|, |client|, |settings| and |extra_info| values. The
|
||||
/// |client|, |settings| and |extra_info| values will default to the source
|
||||
/// browser's values. Any modifications to |windowInfo| will be ignored if the
|
||||
/// parent browser is Views-hosted (wrapped in a cef_browser_view_t).
|
||||
///
|
||||
/// The |extra_info| parameter provides an opportunity to specify extra
|
||||
/// information specific to the created popup browser that will be passed to
|
||||
/// cef_render_process_handler_t::on_browser_created() in the render process.
|
||||
/// The existing |extra_info| object, if any, will be read-only but may be
|
||||
/// replaced with a new object.
|
||||
///
|
||||
/// Views-hosted source browsers will create Views-hosted DevTools popups
|
||||
/// unless |use_default_window| is set to to true (1). DevTools popups can be
|
||||
/// blocked by returning true (1) from cef_command_handler_t::OnChromeCommand
|
||||
/// for IDC_DEV_TOOLS. Only used with the Chrome runtime.
|
||||
///
|
||||
void(CEF_CALLBACK* on_before_dev_tools_popup)(
|
||||
struct _cef_life_span_handler_t* self,
|
||||
struct _cef_browser_t* browser,
|
||||
struct _cef_window_info_t* windowInfo,
|
||||
struct _cef_client_t** client,
|
||||
struct _cef_browser_settings_t* settings,
|
||||
struct _cef_dictionary_value_t** extra_info,
|
||||
int* use_default_window);
|
||||
|
||||
///
|
||||
/// Called after a new browser is created. It is now safe to begin performing
|
||||
/// actions with |browser|. cef_frame_handler_t callbacks related to initial
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=08f64795d78bdad29a45222a7263e795ce77a52d$
|
||||
// $hash=dfa2f2d57339e05592d7ee5f4c4c54dd0932cd94$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_SHARED_MEMORY_REGION_CAPI_H_
|
||||
@@ -69,7 +69,7 @@ typedef struct _cef_shared_memory_region_t {
|
||||
/// 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);
|
||||
void*(CEF_CALLBACK* memory)(struct _cef_shared_memory_region_t* self);
|
||||
} cef_shared_memory_region_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=42de7c0e6f5ec529d9182fe4cbf2c1edfacd7392$
|
||||
// $hash=865ca5bff4a0867d0c25cb41bd2aa808cf3fddbd$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_
|
||||
@@ -679,6 +679,19 @@ typedef struct _cef_v8value_t {
|
||||
///
|
||||
int(CEF_CALLBACK* neuter_array_buffer)(struct _cef_v8value_t* self);
|
||||
|
||||
///
|
||||
/// Returns the length (in bytes) of the ArrayBuffer.
|
||||
///
|
||||
size_t(CEF_CALLBACK* get_array_buffer_byte_length)(
|
||||
struct _cef_v8value_t* self);
|
||||
|
||||
///
|
||||
/// Returns a pointer to the beginning of the memory block for this
|
||||
/// ArrayBuffer backing store. The returned pointer is valid as long as the
|
||||
/// cef_v8value_t is alive.
|
||||
///
|
||||
void*(CEF_CALLBACK* get_array_buffer_data)(struct _cef_v8value_t* self);
|
||||
|
||||
///
|
||||
/// Returns the function name.
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=1b8f7f620685c30b91c8fa656e1a01d182684ae6$
|
||||
// $hash=7b8fee9d4a0530782ed62f5741820708f110e24e$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_CEF_VALUES_CAPI_H_
|
||||
@@ -265,6 +265,12 @@ typedef struct _cef_binary_value_t {
|
||||
struct _cef_binary_value_t*(CEF_CALLBACK* copy)(
|
||||
struct _cef_binary_value_t* self);
|
||||
|
||||
///
|
||||
/// Returns a pointer to the beginning of the memory block. The returned
|
||||
/// pointer is valid as long as the cef_binary_value_t is alive.
|
||||
///
|
||||
const void*(CEF_CALLBACK* get_raw_data)(struct _cef_binary_value_t* self);
|
||||
|
||||
///
|
||||
/// Returns the data size.
|
||||
///
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=f72e94f6bd63b6ea623c4d3170b5ad4333c136d6$
|
||||
// $hash=bc80e7f1e467a4e0943dcbf7ea6d08366817d5ca$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_BROWSER_VIEW_CAPI_H_
|
||||
@@ -77,13 +77,19 @@ typedef struct _cef_browser_view_t {
|
||||
struct _cef_browser_view_t* self);
|
||||
|
||||
///
|
||||
/// Sets whether accelerators registered with cef_window_t::SetAccelerator are
|
||||
/// triggered before or after the event is sent to the cef_browser_t. If
|
||||
/// |prefer_accelerators| is true (1) then the matching accelerator will be
|
||||
/// triggered immediately and the event will not be sent to the cef_browser_t.
|
||||
/// If |prefer_accelerators| is false (0) then the matching accelerator will
|
||||
/// only be triggered if the event is not handled by web content or by
|
||||
/// cef_keyboard_handler_t. The default value is false (0).
|
||||
/// Sets whether normal priority accelerators are first forwarded to the web
|
||||
/// content (`keydown` event handler) or cef_keyboard_handler_t. Normal
|
||||
/// priority accelerators can be registered via cef_window_t::SetAccelerator
|
||||
/// (with |high_priority|=false (0)) or internally for standard accelerators
|
||||
/// supported by the Chrome runtime. If |prefer_accelerators| is true (1) then
|
||||
/// the matching accelerator will be triggered immediately (calling
|
||||
/// cef_window_delegate_t::OnAccelerator or
|
||||
/// cef_command_handler_t::OnChromeCommand respectively) and the event will
|
||||
/// not be forwarded to the web content or cef_keyboard_handler_t first. If
|
||||
/// |prefer_accelerators| is false (0) then the matching accelerator will only
|
||||
/// be triggered if the event is not handled by web content (`keydown` event
|
||||
/// handler that calls `event.preventDefault()`) or by cef_keyboard_handler_t.
|
||||
/// The default value is false (0).
|
||||
///
|
||||
void(CEF_CALLBACK* set_prefer_accelerators)(struct _cef_browser_view_t* self,
|
||||
int prefer_accelerators);
|
||||
|
@@ -33,7 +33,7 @@
|
||||
// by hand. See the translator.README.txt file in the tools directory for
|
||||
// more information.
|
||||
//
|
||||
// $hash=4b43fe0b493d860e8b28d7a6d892db49d1135b34$
|
||||
// $hash=a48904fcd0f6be07e27839922d8feb07271ed2b5$
|
||||
//
|
||||
|
||||
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
|
||||
@@ -332,16 +332,25 @@ typedef struct _cef_window_t {
|
||||
|
||||
///
|
||||
/// Set the keyboard accelerator for the specified |command_id|. |key_code|
|
||||
/// can be any virtual key or character value.
|
||||
/// can be any virtual key or character value. Required modifier keys are
|
||||
/// specified by |shift_pressed|, |ctrl_pressed| and/or |alt_pressed|.
|
||||
/// cef_window_delegate_t::OnAccelerator will be called if the keyboard
|
||||
/// combination is triggered while this window has focus.
|
||||
///
|
||||
/// The |high_priority| value will be considered if a child cef_browser_view_t
|
||||
/// has focus when the keyboard combination is triggered. If |high_priority|
|
||||
/// is true (1) then the key event will not be forwarded to the web content
|
||||
/// (`keydown` event handler) or cef_keyboard_handler_t first. If
|
||||
/// |high_priority| is false (0) then the behavior will depend on the
|
||||
/// cef_browser_view_t::SetPreferAccelerators configuration.
|
||||
///
|
||||
void(CEF_CALLBACK* set_accelerator)(struct _cef_window_t* self,
|
||||
int command_id,
|
||||
int key_code,
|
||||
int shift_pressed,
|
||||
int ctrl_pressed,
|
||||
int alt_pressed);
|
||||
int alt_pressed,
|
||||
int high_priority);
|
||||
|
||||
///
|
||||
/// Remove the keyboard accelerator for the specified |command_id|.
|
||||
|
@@ -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 "133bd59744d82162591d93434cb6ff146717a3f7"
|
||||
#define CEF_API_HASH_UNIVERSAL "ce9401699c6753553cba867b1f5c329f759d2c67"
|
||||
#if defined(OS_WIN)
|
||||
#define CEF_API_HASH_PLATFORM "a39ec0ef3643f91abe7dc529def454336016478d"
|
||||
#define CEF_API_HASH_PLATFORM "e094f42b7a60d2c8c9bcb3db51907a3b42f51d04"
|
||||
#elif defined(OS_MAC)
|
||||
#define CEF_API_HASH_PLATFORM "35b5f3657fe9f203a7852235b85b5f2a7501d59e"
|
||||
#define CEF_API_HASH_PLATFORM "6ce44bd7182aa7e9544f5ca33c310f2a096ab638"
|
||||
#elif defined(OS_LINUX)
|
||||
#define CEF_API_HASH_PLATFORM "5623b2222e7b39b014c821d941c280e29b8693d3"
|
||||
#define CEF_API_HASH_PLATFORM "8e9886cd490aefc89283d65f5f7d104a51e2d289"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@@ -396,17 +396,40 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
||||
virtual CefRefPtr<CefRequestContext> GetRequestContext() = 0;
|
||||
|
||||
///
|
||||
/// Get the current zoom level. The default zoom level is 0.0. This method can
|
||||
/// only be called on the UI thread.
|
||||
/// Returns true if this browser can execute the specified zoom command. This
|
||||
/// method can only be called on the UI thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool CanZoom(cef_zoom_command_t command) = 0;
|
||||
|
||||
///
|
||||
/// Execute a zoom command in this browser. If called on the UI thread the
|
||||
/// change will be applied immediately. Otherwise, the change will be applied
|
||||
/// asynchronously on the UI thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void Zoom(cef_zoom_command_t command) = 0;
|
||||
|
||||
///
|
||||
/// Get the default zoom level. This value will be 0.0 by default but can be
|
||||
/// configured with the Chrome runtime. This method can only be called on the
|
||||
/// UI thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual double GetDefaultZoomLevel() = 0;
|
||||
|
||||
///
|
||||
/// Get the current zoom level. This method can only be called on the UI
|
||||
/// thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual double GetZoomLevel() = 0;
|
||||
|
||||
///
|
||||
/// Change the zoom level to the specified value. Specify 0.0 to reset the
|
||||
/// zoom level. If called on the UI thread the change will be applied
|
||||
/// immediately. Otherwise, the change will be applied asynchronously on the
|
||||
/// UI thread.
|
||||
/// zoom level to the default. If called on the UI thread the change will be
|
||||
/// applied immediately. Otherwise, the change will be applied asynchronously
|
||||
/// on the UI thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetZoomLevel(double zoomLevel) = 0;
|
||||
@@ -941,6 +964,48 @@ class CefBrowserHost : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsAudioMuted() = 0;
|
||||
|
||||
///
|
||||
/// Returns true if the renderer is currently in browser fullscreen. This
|
||||
/// differs from window fullscreen in that browser fullscreen is entered using
|
||||
/// the JavaScript Fullscreen API and modifies CSS attributes such as the
|
||||
/// ::backdrop pseudo-element and :fullscreen pseudo-class. This method can
|
||||
/// only be called on the UI thread.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool IsFullscreen() = 0;
|
||||
|
||||
///
|
||||
/// Requests the renderer to exit browser fullscreen. In most cases exiting
|
||||
/// window fullscreen should also exit browser fullscreen. With the Alloy
|
||||
/// runtime this method should be called in response to a user action such as
|
||||
/// clicking the green traffic light button on MacOS
|
||||
/// (CefWindowDelegate::OnWindowFullscreenTransition callback) or pressing the
|
||||
/// "ESC" key (CefKeyboardHandler::OnPreKeyEvent callback). With the Chrome
|
||||
/// runtime these standard exit actions are handled internally but
|
||||
/// new/additional user actions can use this method. Set |will_cause_resize|
|
||||
/// to true if exiting browser fullscreen will cause a view resize.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void ExitFullscreen(bool will_cause_resize) = 0;
|
||||
|
||||
///
|
||||
/// Returns true if a Chrome command is supported and enabled. Values for
|
||||
/// |command_id| can be found in the cef_command_ids.h file. This method can
|
||||
/// only be called on the UI thread. Only used with the Chrome runtime.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool CanExecuteChromeCommand(int command_id) = 0;
|
||||
|
||||
///
|
||||
/// Execute a Chrome command. Values for |command_id| can be found in the
|
||||
/// cef_command_ids.h file. |disposition| provides information about the
|
||||
/// intended command target. Only used with the Chrome runtime.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void ExecuteChromeCommand(
|
||||
int command_id,
|
||||
cef_window_open_disposition_t disposition) = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_BROWSER_H_
|
||||
|
@@ -166,6 +166,7 @@ class CefDOMNode : public virtual CefBaseRefCounted {
|
||||
public:
|
||||
typedef std::map<CefString, CefString> AttributeMap;
|
||||
typedef cef_dom_node_type_t Type;
|
||||
typedef cef_dom_form_control_type_t FormControlType;
|
||||
|
||||
///
|
||||
/// Returns the type for this node.
|
||||
@@ -194,14 +195,14 @@ class CefDOMNode : public virtual CefBaseRefCounted {
|
||||
///
|
||||
/// Returns true if this is a form control element node.
|
||||
///
|
||||
/*--cef()--*/
|
||||
/*--cef(default_retval=DOM_NODE_TYPE_UNSUPPORTED)--*/
|
||||
virtual bool IsFormControlElement() = 0;
|
||||
|
||||
///
|
||||
/// Returns the type of this form control element node.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual CefString GetFormControlElementType() = 0;
|
||||
/*--cef(default_retval=DOM_FORM_CONTROL_TYPE_UNSUPPORTED)--*/
|
||||
virtual FormControlType GetFormControlElementType() = 0;
|
||||
|
||||
///
|
||||
/// Returns true if this object is pointing to the same handle as |that|
|
||||
|
@@ -145,6 +145,13 @@ class CefDragData : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual bool GetFileNames(std::vector<CefString>& names) = 0;
|
||||
|
||||
///
|
||||
/// Retrieve the list of file paths that are being dragged into the browser
|
||||
/// window.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual bool GetFilePaths(std::vector<CefString>& paths) = 0;
|
||||
|
||||
///
|
||||
/// Set the link URL that is being dragged.
|
||||
///
|
||||
|
@@ -94,6 +94,33 @@ class CefLifeSpanHandler : public virtual CefBaseRefCounted {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Called on the UI thread before a new DevTools popup browser is created.
|
||||
/// The |browser| value represents the source of the popup request. Optionally
|
||||
/// modify |windowInfo|, |client|, |settings| and |extra_info| values. The
|
||||
/// |client|, |settings| and |extra_info| values will default to the source
|
||||
/// browser's values. Any modifications to |windowInfo| will be ignored if the
|
||||
/// parent browser is Views-hosted (wrapped in a CefBrowserView).
|
||||
///
|
||||
/// The |extra_info| parameter provides an opportunity to specify extra
|
||||
/// information specific to the created popup browser that will be passed to
|
||||
/// CefRenderProcessHandler::OnBrowserCreated() in the render process. The
|
||||
/// existing |extra_info| object, if any, will be read-only but may be
|
||||
/// replaced with a new object.
|
||||
///
|
||||
/// Views-hosted source browsers will create Views-hosted DevTools popups
|
||||
/// unless |use_default_window| is set to to true. DevTools popups can be
|
||||
/// blocked by returning true from CefCommandHandler::OnChromeCommand for
|
||||
/// IDC_DEV_TOOLS. Only used with the Chrome runtime.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void OnBeforeDevToolsPopup(CefRefPtr<CefBrowser> browser,
|
||||
CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient>& client,
|
||||
CefBrowserSettings& settings,
|
||||
CefRefPtr<CefDictionaryValue>& extra_info,
|
||||
bool* use_default_window) {}
|
||||
|
||||
///
|
||||
/// Called after a new browser is created. It is now safe to begin performing
|
||||
/// actions with |browser|. CefFrameHandler callbacks related to initial main
|
||||
|
@@ -63,7 +63,7 @@ class CefSharedMemoryRegion : public virtual CefBaseRefCounted {
|
||||
/// The returned pointer is only valid for the life span of this object.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual const void* Memory() = 0;
|
||||
virtual void* Memory() = 0;
|
||||
};
|
||||
|
||||
#endif // CEF_INCLUDE_CEF_SHARED_MEMORY_REGION_H_
|
||||
|
@@ -520,7 +520,7 @@ class CefV8Value : public virtual CefBaseRefCounted {
|
||||
/// or CefV8Accessor callback, or in combination with calling Enter() and
|
||||
/// Exit() on a stored CefV8Context reference.
|
||||
///
|
||||
/*--cef()--*/
|
||||
/*--cef(optional_param=buffer)--*/
|
||||
static CefRefPtr<CefV8Value> CreateArrayBuffer(
|
||||
void* buffer,
|
||||
size_t length,
|
||||
@@ -866,6 +866,20 @@ class CefV8Value : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual bool NeuterArrayBuffer() = 0;
|
||||
|
||||
///
|
||||
/// Returns the length (in bytes) of the ArrayBuffer.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual size_t GetArrayBufferByteLength() = 0;
|
||||
|
||||
///
|
||||
/// Returns a pointer to the beginning of the memory block for this
|
||||
/// ArrayBuffer backing store. The returned pointer is valid as long as the
|
||||
/// CefV8Value is alive.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void* GetArrayBufferData() = 0;
|
||||
|
||||
// FUNCTION METHODS - These methods are only available on functions.
|
||||
|
||||
///
|
||||
|
@@ -278,6 +278,13 @@ class CefBinaryValue : public virtual CefBaseRefCounted {
|
||||
/*--cef()--*/
|
||||
virtual CefRefPtr<CefBinaryValue> Copy() = 0;
|
||||
|
||||
///
|
||||
/// Returns a pointer to the beginning of the memory block.
|
||||
/// The returned pointer is valid as long as the CefBinaryValue is alive.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual const void* GetRawData() = 0;
|
||||
|
||||
///
|
||||
/// Returns the data size.
|
||||
///
|
||||
|
@@ -353,7 +353,7 @@ struct CefStringTraitsUTF16 {
|
||||
/// modifying CEF strings from multiple threads.
|
||||
///
|
||||
template <class traits>
|
||||
class CefStringBase {
|
||||
class CefStringBase final {
|
||||
public:
|
||||
typedef typename traits::char_type char_type;
|
||||
typedef typename traits::struct_type struct_type;
|
||||
@@ -442,7 +442,7 @@ class CefStringBase {
|
||||
Attach(const_cast<struct_type*>(src), false);
|
||||
}
|
||||
|
||||
virtual ~CefStringBase() { ClearAndFree(); }
|
||||
~CefStringBase() { ClearAndFree(); }
|
||||
|
||||
/// The following methods are named for compatibility with the standard
|
||||
/// library string template types.
|
||||
|
@@ -449,10 +449,9 @@ typedef struct _cef_settings_t {
|
||||
|
||||
///
|
||||
/// Comma delimited ordered list of language codes without any whitespace that
|
||||
/// will be used in the "Accept-Language" HTTP header. May be overridden on a
|
||||
/// per-browser basis using the CefBrowserSettings.accept_language_list value.
|
||||
/// If both values are empty then "en-US,en" will be used. Can be overridden
|
||||
/// for individual CefRequestContext instances via the
|
||||
/// will be used in the "Accept-Language" HTTP request header and
|
||||
/// "navigator.language" JS attribute. Can be overridden for individual
|
||||
/// CefRequestContext instances via the
|
||||
/// CefRequestContextSettings.accept_language_list value.
|
||||
///
|
||||
cef_string_t accept_language_list;
|
||||
@@ -470,6 +469,21 @@ typedef struct _cef_settings_t {
|
||||
///
|
||||
cef_string_t cookieable_schemes_list;
|
||||
int cookieable_schemes_exclude_defaults;
|
||||
|
||||
///
|
||||
/// Specify an ID to enable Chrome policy management via Platform and OS-user
|
||||
/// policies. On Windows, this is a registry key like
|
||||
/// "SOFTWARE\\Policies\\Google\\Chrome". On MacOS, this is a bundle ID like
|
||||
/// "com.google.Chrome". On Linux, this is an absolute directory path like
|
||||
/// "/etc/opt/chrome/policies". Only supported with the Chrome runtime. See
|
||||
/// https://support.google.com/chrome/a/answer/9037717 for details.
|
||||
///
|
||||
/// Chrome Browser Cloud Management integration, when enabled via the
|
||||
/// "enable-chrome-browser-cloud-management" command-line flag, will also use
|
||||
/// the specified ID. See https://support.google.com/chrome/a/answer/9116814
|
||||
/// for details.
|
||||
///
|
||||
cef_string_t chrome_policy_id;
|
||||
} cef_settings_t;
|
||||
|
||||
///
|
||||
@@ -515,11 +529,11 @@ typedef struct _cef_request_context_settings_t {
|
||||
|
||||
///
|
||||
/// Comma delimited ordered list of language codes without any whitespace that
|
||||
/// will be used in the "Accept-Language" HTTP header. Can be set globally
|
||||
/// using the CefSettings.accept_language_list value or overridden on a per-
|
||||
/// browser basis using the CefBrowserSettings.accept_language_list value. If
|
||||
/// all values are empty then "en-US,en" will be used. This value will be
|
||||
/// ignored if |cache_path| matches the CefSettings.cache_path value.
|
||||
/// will be used in the "Accept-Language" HTTP request header and
|
||||
/// "navigator.language" JS attribute. Can be set globally using the
|
||||
/// CefSettings.accept_language_list value. If all values are empty then
|
||||
/// "en-US,en" will be used. This value will be ignored if |cache_path|
|
||||
/// matches the CefSettings.cache_path value.
|
||||
///
|
||||
cef_string_t accept_language_list;
|
||||
|
||||
@@ -673,20 +687,18 @@ typedef struct _cef_browser_settings_t {
|
||||
///
|
||||
cef_color_t background_color;
|
||||
|
||||
///
|
||||
/// Comma delimited ordered list of language codes without any whitespace that
|
||||
/// will be used in the "Accept-Language" HTTP header. May be set globally
|
||||
/// using the CefSettings.accept_language_list value. If both values are
|
||||
/// empty then "en-US,en" will be used.
|
||||
///
|
||||
cef_string_t accept_language_list;
|
||||
|
||||
///
|
||||
/// Controls whether the Chrome status bubble will be used. Only supported
|
||||
/// with the Chrome runtime. For details about the status bubble see
|
||||
/// https://www.chromium.org/user-experience/status-bubble/
|
||||
///
|
||||
cef_state_t chrome_status_bubble;
|
||||
|
||||
///
|
||||
/// Controls whether the Chrome zoom bubble will be shown when zooming. Only
|
||||
/// supported with the Chrome runtime.
|
||||
///
|
||||
cef_state_t chrome_zoom_bubble;
|
||||
} cef_browser_settings_t;
|
||||
|
||||
///
|
||||
@@ -992,52 +1004,52 @@ typedef enum {
|
||||
/// renumbered.
|
||||
///
|
||||
typedef enum {
|
||||
WOD_UNKNOWN,
|
||||
CEF_WOD_UNKNOWN,
|
||||
|
||||
///
|
||||
/// Current tab. This is the default in most cases.
|
||||
///
|
||||
WOD_CURRENT_TAB,
|
||||
CEF_WOD_CURRENT_TAB,
|
||||
|
||||
///
|
||||
/// Indicates that only one tab with the url should exist in the same window.
|
||||
///
|
||||
WOD_SINGLETON_TAB,
|
||||
CEF_WOD_SINGLETON_TAB,
|
||||
|
||||
///
|
||||
/// Shift key + Middle mouse button or meta/ctrl key while clicking.
|
||||
///
|
||||
WOD_NEW_FOREGROUND_TAB,
|
||||
CEF_WOD_NEW_FOREGROUND_TAB,
|
||||
|
||||
///
|
||||
/// Middle mouse button or meta/ctrl key while clicking.
|
||||
///
|
||||
WOD_NEW_BACKGROUND_TAB,
|
||||
CEF_WOD_NEW_BACKGROUND_TAB,
|
||||
|
||||
///
|
||||
/// New popup window.
|
||||
///
|
||||
WOD_NEW_POPUP,
|
||||
CEF_WOD_NEW_POPUP,
|
||||
|
||||
///
|
||||
/// Shift key while clicking.
|
||||
///
|
||||
WOD_NEW_WINDOW,
|
||||
CEF_WOD_NEW_WINDOW,
|
||||
|
||||
///
|
||||
/// Alt key while clicking.
|
||||
///
|
||||
WOD_SAVE_TO_DISK,
|
||||
CEF_WOD_SAVE_TO_DISK,
|
||||
|
||||
///
|
||||
/// New off-the-record (incognito) window.
|
||||
///
|
||||
WOD_OFF_THE_RECORD,
|
||||
CEF_WOD_OFF_THE_RECORD,
|
||||
|
||||
///
|
||||
/// Special case error condition from the renderer.
|
||||
///
|
||||
WOD_IGNORE_ACTION,
|
||||
CEF_WOD_IGNORE_ACTION,
|
||||
|
||||
///
|
||||
/// Activates an existing tab containing the url, rather than navigating.
|
||||
@@ -1047,12 +1059,14 @@ typedef enum {
|
||||
/// no session history; and behaves like CURRENT_TAB instead of
|
||||
/// NEW_FOREGROUND_TAB when no existing tab is found.
|
||||
///
|
||||
WOD_SWITCH_TO_TAB,
|
||||
CEF_WOD_SWITCH_TO_TAB,
|
||||
|
||||
///
|
||||
/// Creates a new document picture-in-picture window showing a child WebView.
|
||||
///
|
||||
WOD_NEW_PICTURE_IN_PICTURE,
|
||||
CEF_WOD_NEW_PICTURE_IN_PICTURE,
|
||||
|
||||
CEF_WOD_MAX_VALUE = CEF_WOD_NEW_PICTURE_IN_PICTURE,
|
||||
} cef_window_open_disposition_t;
|
||||
|
||||
///
|
||||
@@ -2283,6 +2297,46 @@ typedef enum {
|
||||
DOM_NODE_TYPE_DOCUMENT_FRAGMENT,
|
||||
} cef_dom_node_type_t;
|
||||
|
||||
///
|
||||
/// DOM form control types. Should be kept in sync with Chromium's
|
||||
/// blink::mojom::FormControlType type.
|
||||
///
|
||||
typedef enum {
|
||||
DOM_FORM_CONTROL_TYPE_UNSUPPORTED = 0,
|
||||
DOM_FORM_CONTROL_TYPE_BUTTON_BUTTON,
|
||||
DOM_FORM_CONTROL_TYPE_BUTTON_SUBMIT,
|
||||
DOM_FORM_CONTROL_TYPE_BUTTON_RESET,
|
||||
DOM_FORM_CONTROL_TYPE_BUTTON_SELECT_LIST,
|
||||
DOM_FORM_CONTROL_TYPE_FIELDSET,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_BUTTON,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_CHECKBOX,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_COLOR,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_DATE,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_DATETIME_LOCAL,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_EMAIL,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_FILE,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_HIDDEN,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_IMAGE,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_MONTH,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_NUMBER,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_PASSWORD,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_RADIO,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_RANGE,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_RESET,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_SEARCH,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_SUBMIT,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_TELEPHONE,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_TEXT,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_TIME,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_URL,
|
||||
DOM_FORM_CONTROL_TYPE_INPUT_WEEK,
|
||||
DOM_FORM_CONTROL_TYPE_OUTPUT,
|
||||
DOM_FORM_CONTROL_TYPE_SELECT_ONE,
|
||||
DOM_FORM_CONTROL_TYPE_SELECT_MULTIPLE,
|
||||
DOM_FORM_CONTROL_TYPE_SELECT_LIST,
|
||||
DOM_FORM_CONTROL_TYPE_TEXT_AREA,
|
||||
} cef_dom_form_control_type_t;
|
||||
|
||||
///
|
||||
/// Supported file dialog modes.
|
||||
///
|
||||
@@ -3660,6 +3714,15 @@ typedef enum {
|
||||
CEF_GESTURE_COMMAND_FORWARD,
|
||||
} cef_gesture_command_t;
|
||||
|
||||
///
|
||||
/// Specifies the zoom commands supported by CefBrowserHost::Zoom.
|
||||
///
|
||||
typedef enum {
|
||||
CEF_ZOOM_COMMAND_OUT,
|
||||
CEF_ZOOM_COMMAND_RESET,
|
||||
CEF_ZOOM_COMMAND_IN,
|
||||
} cef_zoom_command_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -41,6 +41,10 @@ extern "C" {
|
||||
/// ContentSettingsType type.
|
||||
///
|
||||
typedef enum {
|
||||
// This setting governs whether cookies are enabled by the user in the
|
||||
/// provided context. However, it may be overridden by other settings. This
|
||||
/// enum should NOT be read directly to determine whether cookies are enabled;
|
||||
/// the client should instead rely on the CookieSettings API.
|
||||
CEF_CONTENT_SETTING_TYPE_COOKIES = 0,
|
||||
CEF_CONTENT_SETTING_TYPE_IMAGES,
|
||||
CEF_CONTENT_SETTING_TYPE_JAVASCRIPT,
|
||||
@@ -58,7 +62,12 @@ typedef enum {
|
||||
CEF_CONTENT_SETTING_TYPE_PROTOCOL_HANDLERS,
|
||||
CEF_CONTENT_SETTING_TYPE_DEPRECATED_PPAPI_BROKER,
|
||||
CEF_CONTENT_SETTING_TYPE_AUTOMATIC_DOWNLOADS,
|
||||
|
||||
/// Advanced device-specific functions on MIDI devices. MIDI-SysEx
|
||||
/// communications can be used for changing the MIDI device's persistent state
|
||||
/// such as firmware.
|
||||
CEF_CONTENT_SETTING_TYPE_MIDI_SYSEX,
|
||||
|
||||
CEF_CONTENT_SETTING_TYPE_SSL_CERT_DECISIONS,
|
||||
CEF_CONTENT_SETTING_TYPE_PROTECTED_MEDIA_IDENTIFIER,
|
||||
CEF_CONTENT_SETTING_TYPE_APP_BANNER,
|
||||
@@ -76,8 +85,9 @@ typedef enum {
|
||||
/// decisions for whether or not to show the UI.
|
||||
CEF_CONTENT_SETTING_TYPE_ADS_DATA,
|
||||
|
||||
/// This is special-cased in the permissions layer to always allow, and as
|
||||
/// such doesn't have associated prefs data.
|
||||
/// MIDI stands for Musical Instrument Digital Interface. It is a standard
|
||||
/// that allows electronic musical instruments, computers, and other devices
|
||||
/// to communicate with each other.
|
||||
CEF_CONTENT_SETTING_TYPE_MIDI,
|
||||
|
||||
/// This content setting type is for caching password protection service's
|
||||
@@ -132,9 +142,6 @@ typedef enum {
|
||||
/// Used to store whether to allow a website to detect user active/idle state.
|
||||
CEF_CONTENT_SETTING_TYPE_IDLE_DETECTION,
|
||||
|
||||
/// Setting for enabling auto-select of all screens for getDisplayMediaSet.
|
||||
CEF_CONTENT_SETTING_TYPE_GET_DISPLAY_MEDIA_SET_SELECT_ALL_SCREENS,
|
||||
|
||||
/// Content settings for access to serial ports. The "guard" content setting
|
||||
/// stores whether to allow sites to ask for permission to access a port. The
|
||||
/// permissions granted to access particular ports are stored in the "chooser
|
||||
@@ -226,10 +233,11 @@ typedef enum {
|
||||
/// screens. See also: https://w3c.github.io/window-placement
|
||||
CEF_CONTENT_SETTING_TYPE_WINDOW_MANAGEMENT,
|
||||
|
||||
/// Stores whether to allow insecure websites to make local network requests.
|
||||
/// See also: https://wicg.github.io/local-network-access
|
||||
/// Stores whether to allow insecure websites to make private network
|
||||
/// requests.
|
||||
/// See also: https://wicg.github.io/cors-rfc1918
|
||||
/// Set through enterprise policies only.
|
||||
CEF_CONTENT_SETTING_TYPE_INSECURE_LOCAL_NETWORK,
|
||||
CEF_CONTENT_SETTING_TYPE_INSECURE_PRIVATE_NETWORK,
|
||||
|
||||
/// Content setting which stores whether or not a site can access low-level
|
||||
/// locally installed font data using the Local Fonts Access API.
|
||||
@@ -249,7 +257,11 @@ typedef enum {
|
||||
|
||||
/// Website setting to store permissions metadata granted to paths on the
|
||||
/// local file system via the File System Access API.
|
||||
/// |FILE_SYSTEM_WRITE_GUARD| is the corresponding "guard" setting.
|
||||
/// |FILE_SYSTEM_WRITE_GUARD| is the corresponding "guard" setting. The stored
|
||||
/// data represents valid permission only if
|
||||
/// |FILE_SYSTEM_ACCESS_EXTENDED_PERMISSION| is enabled via user opt-in.
|
||||
/// Otherwise, they represent "recently granted but revoked permission", which
|
||||
/// are used to restore the permission.
|
||||
CEF_CONTENT_SETTING_TYPE_FILE_SYSTEM_ACCESS_CHOOSER_DATA,
|
||||
|
||||
/// Stores a grant that allows a relying party to send a request for identity
|
||||
@@ -343,12 +355,31 @@ typedef enum {
|
||||
/// Used to indicate whether HTTPS-First Mode is enabled on the hostname.
|
||||
CEF_CONTENT_SETTING_TYPE_HTTPS_ENFORCED,
|
||||
|
||||
/// Setting for enabling the `getAllScreensMedia` API. Spec link:
|
||||
/// https://github.com/screen-share/capture-all-screens
|
||||
CEF_CONTENT_SETTING_TYPE_ALL_SCREEN_CAPTURE,
|
||||
|
||||
/// Stores per origin metadata for cookie controls.
|
||||
CEF_CONTENT_SETTING_TYPE_COOKIE_CONTROLS_METADATA,
|
||||
|
||||
/// Setting for supporting 3PCD.
|
||||
/// Content Setting for 3PC accesses granted via 3PC deprecation trial.
|
||||
CEF_CONTENT_SETTING_TYPE_TPCD_SUPPORT,
|
||||
|
||||
/// Content setting used to indicate whether entering picture-in-picture
|
||||
/// automatically should be enabled.
|
||||
CEF_CONTENT_SETTING_TYPE_AUTO_PICTURE_IN_PICTURE,
|
||||
|
||||
/// Content Setting for 3PC accesses granted by metadata delivered via the
|
||||
/// component updater service. This type will only be used when
|
||||
/// `net::features::kTpcdMetadataGrants` is enabled.
|
||||
CEF_CONTENT_SETTING_TYPE_TPCD_METADATA_GRANTS,
|
||||
|
||||
/// Whether user has opted into keeping file/directory permissions persistent
|
||||
/// between visits for a given origin. When enabled, permission metadata
|
||||
/// stored under |FILE_SYSTEM_ACCESS_CHOOSER_DATA| can auto-grant incoming
|
||||
/// permission request.
|
||||
CEF_CONTENT_SETTING_TYPE_FILE_SYSTEM_ACCESS_EXTENDED_PERMISSION,
|
||||
|
||||
CEF_CONTENT_SETTING_TYPE_NUM_TYPES,
|
||||
} cef_content_setting_types_t;
|
||||
|
||||
|
@@ -373,6 +373,7 @@ struct CefSettingsTraits {
|
||||
cef_string_clear(&s->locales_dir_path);
|
||||
cef_string_clear(&s->accept_language_list);
|
||||
cef_string_clear(&s->cookieable_schemes_list);
|
||||
cef_string_clear(&s->chrome_policy_id);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
@@ -430,6 +431,9 @@ struct CefSettingsTraits {
|
||||
&target->cookieable_schemes_list, copy);
|
||||
target->cookieable_schemes_exclude_defaults =
|
||||
src->cookieable_schemes_exclude_defaults;
|
||||
|
||||
cef_string_set(src->chrome_policy_id.str, src->chrome_policy_id.length,
|
||||
&target->chrome_policy_id, copy);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -487,7 +491,6 @@ struct CefBrowserSettingsTraits {
|
||||
cef_string_clear(&s->cursive_font_family);
|
||||
cef_string_clear(&s->fantasy_font_family);
|
||||
cef_string_clear(&s->default_encoding);
|
||||
cef_string_clear(&s->accept_language_list);
|
||||
}
|
||||
|
||||
static inline void set(const struct_type* src,
|
||||
@@ -536,11 +539,8 @@ struct CefBrowserSettingsTraits {
|
||||
|
||||
target->background_color = src->background_color;
|
||||
|
||||
cef_string_set(src->accept_language_list.str,
|
||||
src->accept_language_list.length,
|
||||
&target->accept_language_list, copy);
|
||||
|
||||
target->chrome_status_bubble = src->chrome_status_bubble;
|
||||
target->chrome_zoom_bubble = src->chrome_zoom_bubble;
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -92,13 +92,18 @@ class CefBrowserView : public CefView {
|
||||
virtual CefRefPtr<CefView> GetChromeToolbar() = 0;
|
||||
|
||||
///
|
||||
/// Sets whether accelerators registered with CefWindow::SetAccelerator are
|
||||
/// triggered before or after the event is sent to the CefBrowser. If
|
||||
/// |prefer_accelerators| is true then the matching accelerator will be
|
||||
/// triggered immediately and the event will not be sent to the CefBrowser. If
|
||||
/// |prefer_accelerators| is false then the matching accelerator will only be
|
||||
/// triggered if the event is not handled by web content or by
|
||||
/// CefKeyboardHandler. The default value is false.
|
||||
/// Sets whether normal priority accelerators are first forwarded to the web
|
||||
/// content (`keydown` event handler) or CefKeyboardHandler. Normal priority
|
||||
/// accelerators can be registered via CefWindow::SetAccelerator (with
|
||||
/// |high_priority|=false) or internally for standard accelerators supported
|
||||
/// by the Chrome runtime. If |prefer_accelerators| is true then the matching
|
||||
/// accelerator will be triggered immediately (calling
|
||||
/// CefWindowDelegate::OnAccelerator or CefCommandHandler::OnChromeCommand
|
||||
/// respectively) and the event will not be forwarded to the web content or
|
||||
/// CefKeyboardHandler first. If |prefer_accelerators| is false then the
|
||||
/// matching accelerator will only be triggered if the event is not handled by
|
||||
/// web content (`keydown` event handler that calls `event.preventDefault()`)
|
||||
/// or by CefKeyboardHandler. The default value is false.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetPreferAccelerators(bool prefer_accelerators) = 0;
|
||||
|
@@ -344,16 +344,25 @@ class CefWindow : public CefPanel {
|
||||
|
||||
///
|
||||
/// Set the keyboard accelerator for the specified |command_id|. |key_code|
|
||||
/// can be any virtual key or character value.
|
||||
/// can be any virtual key or character value. Required modifier keys are
|
||||
/// specified by |shift_pressed|, |ctrl_pressed| and/or |alt_pressed|.
|
||||
/// CefWindowDelegate::OnAccelerator will be called if the keyboard
|
||||
/// combination is triggered while this window has focus.
|
||||
///
|
||||
/// The |high_priority| value will be considered if a child CefBrowserView has
|
||||
/// focus when the keyboard combination is triggered. If |high_priority| is
|
||||
/// true then the key event will not be forwarded to the web content
|
||||
/// (`keydown` event handler) or CefKeyboardHandler first. If |high_priority|
|
||||
/// is false then the behavior will depend on the
|
||||
/// CefBrowserView::SetPreferAccelerators configuration.
|
||||
///
|
||||
/*--cef()--*/
|
||||
virtual void SetAccelerator(int command_id,
|
||||
int key_code,
|
||||
bool shift_pressed,
|
||||
bool ctrl_pressed,
|
||||
bool alt_pressed) = 0;
|
||||
bool alt_pressed,
|
||||
bool high_priority) = 0;
|
||||
|
||||
///
|
||||
/// Remove the keyboard accelerator for the specified |command_id|.
|
||||
|
@@ -219,6 +219,38 @@ struct CefMessageRouterConfig {
|
||||
size_t message_size_threshold;
|
||||
};
|
||||
|
||||
///
|
||||
/// This class acts as a container for managing binary data. It retains
|
||||
/// references to the underlying backing store, ensuring it is valid as long as
|
||||
/// the CefBinaryBuffer exists. This allows efficient, zero-copy access to data
|
||||
/// received from another process.
|
||||
///
|
||||
/// This class is not designed to be thread-safe, and it is the user's
|
||||
/// responsibility to synchronize access from multiple threads to ensure data
|
||||
/// integrity.
|
||||
///
|
||||
class CefBinaryBuffer : public CefBaseRefCounted {
|
||||
public:
|
||||
///
|
||||
/// Returns the read-only pointer to the memory. Returns nullptr if
|
||||
/// |GetSize()| returns zero. The returned pointer is only valid for the life
|
||||
/// span of this object.
|
||||
///
|
||||
virtual const void* GetData() const = 0;
|
||||
|
||||
///
|
||||
/// Returns the writable pointer to the memory. Returns nullptr if
|
||||
/// |GetSize()| returns zero. The returned pointer is only valid for the life
|
||||
/// span of this object.
|
||||
///
|
||||
virtual void* GetData() = 0;
|
||||
|
||||
///
|
||||
/// Returns the size of the data.
|
||||
///
|
||||
virtual size_t GetSize() const = 0;
|
||||
};
|
||||
|
||||
///
|
||||
/// Implements the browser side of query routing. The methods of this class may
|
||||
/// be called on any browser process thread unless otherwise indicated.
|
||||
@@ -238,10 +270,17 @@ class CefMessageRouterBrowserSide
|
||||
public:
|
||||
///
|
||||
/// Notify the associated JavaScript onSuccess callback that the query has
|
||||
/// completed successfully with the specified |response|.
|
||||
/// completed successfully with the specified string |response|.
|
||||
///
|
||||
virtual void Success(const CefString& response) = 0;
|
||||
|
||||
///
|
||||
/// Notify the associated JavaScript onSuccess callback that the query has
|
||||
/// completed successfully with binary data. A |data| pointer to the binary
|
||||
/// data can be nullptr only if the |size| is 0.
|
||||
///
|
||||
virtual void Success(const void* data, size_t size) = 0;
|
||||
|
||||
///
|
||||
/// Notify the associated JavaScript onFailure callback that the query has
|
||||
/// failed with the specified |error_code| and |error_message|.
|
||||
@@ -276,6 +315,25 @@ class CefMessageRouterBrowserSide
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Executed when a new query is received. |query_id| uniquely identifies
|
||||
/// the query for the life span of the router. Return true to handle the
|
||||
/// query or false to propagate the query to other registered handlers, if
|
||||
/// any. If no handlers return true from this method then the query will be
|
||||
/// automatically canceled with an error code of -1 delivered to the
|
||||
/// JavaScript onFailure callback. If this method returns true then a
|
||||
/// Callback method must be executed either in this method or asynchronously
|
||||
/// to complete the query.
|
||||
///
|
||||
virtual bool OnQuery(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int64_t query_id,
|
||||
CefRefPtr<const CefBinaryBuffer> request,
|
||||
bool persistent,
|
||||
CefRefPtr<Callback> callback) {
|
||||
return false;
|
||||
}
|
||||
|
||||
///
|
||||
/// Executed when a query has been canceled either explicitly using the
|
||||
/// JavaScript cancel function or implicitly due to browser destruction,
|
||||
|
@@ -34,12 +34,11 @@
|
||||
#include "base/functional/callback_helpers.h"
|
||||
#include "chrome/browser/file_select_helper.h"
|
||||
#include "chrome/browser/picture_in_picture/picture_in_picture_window_manager.h"
|
||||
#include "components/zoom/page_zoom.h"
|
||||
#include "content/browser/gpu/compositor_util.h"
|
||||
#include "content/public/browser/desktop_media_id.h"
|
||||
#include "content/public/browser/file_select_listener.h"
|
||||
#include "content/public/browser/host_zoom_map.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/navigation_controller.h"
|
||||
#include "content/public/browser/navigation_handle.h"
|
||||
#include "content/public/browser/render_frame_host.h"
|
||||
@@ -47,6 +46,7 @@
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "content/public/common/url_constants.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "extensions/common/extension.h"
|
||||
@@ -57,33 +57,6 @@ using content::KeyboardEventProcessingResult;
|
||||
|
||||
namespace {
|
||||
|
||||
class ShowDevToolsHelper {
|
||||
public:
|
||||
ShowDevToolsHelper(CefRefPtr<AlloyBrowserHostImpl> browser,
|
||||
const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at)
|
||||
: browser_(browser),
|
||||
window_info_(windowInfo),
|
||||
client_(client),
|
||||
settings_(settings),
|
||||
inspect_element_at_(inspect_element_at) {}
|
||||
|
||||
CefRefPtr<AlloyBrowserHostImpl> browser_;
|
||||
CefWindowInfo window_info_;
|
||||
CefRefPtr<CefClient> client_;
|
||||
CefBrowserSettings settings_;
|
||||
CefPoint inspect_element_at_;
|
||||
};
|
||||
|
||||
void ShowDevToolsWithHelper(ShowDevToolsHelper* helper) {
|
||||
helper->browser_->ShowDevTools(helper->window_info_, helper->client_,
|
||||
helper->settings_,
|
||||
helper->inspect_element_at_);
|
||||
delete helper;
|
||||
}
|
||||
|
||||
static constexpr base::TimeDelta kRecentlyAudibleTimeout = base::Seconds(2);
|
||||
|
||||
} // namespace
|
||||
@@ -330,31 +303,6 @@ CefWindowHandle AlloyBrowserHostImpl::GetOpenerWindowHandle() {
|
||||
return opener_;
|
||||
}
|
||||
|
||||
double AlloyBrowserHostImpl::GetZoomLevel() {
|
||||
// Verify that this method is being called on the UI thread.
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (web_contents()) {
|
||||
return content::HostZoomMap::GetZoomLevel(web_contents());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SetZoomLevel(double zoomLevel) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (web_contents()) {
|
||||
content::HostZoomMap::SetZoomLevel(web_contents(), zoomLevel);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SetZoomLevel,
|
||||
this, zoomLevel));
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::Find(const CefString& searchText,
|
||||
bool forward,
|
||||
bool matchCase,
|
||||
@@ -383,22 +331,15 @@ void AlloyBrowserHostImpl::StopFinding(bool clearSelection) {
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
ShowDevToolsHelper* helper = new ShowDevToolsHelper(
|
||||
this, windowInfo, client, settings, inspect_element_at);
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(ShowDevToolsWithHelper, helper));
|
||||
return;
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::ShowDevToolsOnUIThread(
|
||||
std::unique_ptr<CefShowDevToolsParams> params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!EnsureDevToolsManager()) {
|
||||
return;
|
||||
}
|
||||
devtools_manager_->ShowDevTools(windowInfo, client, settings,
|
||||
inspect_element_at);
|
||||
devtools_manager_->ShowDevTools(params->window_info_, params->client_,
|
||||
params->settings_,
|
||||
params->inspect_element_at_);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::CloseDevTools() {
|
||||
@@ -463,6 +404,16 @@ bool AlloyBrowserHostImpl::IsBackgroundHost() {
|
||||
return is_background_host_;
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::CanExecuteChromeCommand(int command_id) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::ExecuteChromeCommand(
|
||||
int command_id,
|
||||
cef_window_open_disposition_t disposition) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::IsWindowRenderingDisabled() {
|
||||
return IsWindowless();
|
||||
}
|
||||
@@ -1118,6 +1069,11 @@ bool AlloyBrowserHostImpl::DidAddMessageToConsole(
|
||||
line_no, source_id);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::ContentsZoomChange(bool zoom_in) {
|
||||
zoom::PageZoom::Zoom(
|
||||
web_contents(), zoom_in ? content::PAGE_ZOOM_IN : content::PAGE_ZOOM_OUT);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::BeforeUnloadFired(content::WebContents* source,
|
||||
bool proceed,
|
||||
bool* proceed_to_fire_unload) {
|
||||
@@ -1158,7 +1114,7 @@ bool AlloyBrowserHostImpl::HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
// Check to see if event should be ignored.
|
||||
if (event.skip_in_browser) {
|
||||
if (event.skip_if_unhandled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1520,9 +1476,11 @@ void AlloyBrowserHostImpl::StartDragging(
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::UpdateDragCursor(
|
||||
ui::mojom::DragOperation operation) {
|
||||
void AlloyBrowserHostImpl::UpdateDragOperation(
|
||||
ui::mojom::DragOperation operation,
|
||||
bool document_is_handling_drag) {
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->UpdateDragCursor(operation);
|
||||
platform_delegate_->UpdateDragOperation(operation,
|
||||
document_is_handling_drag);
|
||||
}
|
||||
}
|
||||
|
@@ -80,17 +80,11 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
bool TryCloseBrowser() override;
|
||||
CefWindowHandle GetWindowHandle() override;
|
||||
CefWindowHandle GetOpenerWindowHandle() override;
|
||||
double GetZoomLevel() override;
|
||||
void SetZoomLevel(double zoomLevel) override;
|
||||
void Find(const CefString& searchText,
|
||||
bool forward,
|
||||
bool matchCase,
|
||||
bool findNext) override;
|
||||
void StopFinding(bool clearSelection) override;
|
||||
void ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) override;
|
||||
void CloseDevTools() override;
|
||||
bool HasDevTools() override;
|
||||
bool IsWindowRenderingDisabled() override;
|
||||
@@ -129,6 +123,9 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
const CefSize& max_size) override;
|
||||
CefRefPtr<CefExtension> GetExtension() override;
|
||||
bool IsBackgroundHost() override;
|
||||
bool CanExecuteChromeCommand(int command_id) override;
|
||||
void ExecuteChromeCommand(int command_id,
|
||||
cef_window_open_disposition_t disposition) override;
|
||||
|
||||
// Returns true if windowless rendering is enabled.
|
||||
bool IsWindowless() const override;
|
||||
@@ -165,7 +162,8 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
const gfx::Vector2d& image_offset,
|
||||
const blink::mojom::DragEventSourceInfo& event_info,
|
||||
content::RenderWidgetHostImpl* source_rwh);
|
||||
void UpdateDragCursor(ui::mojom::DragOperation operation);
|
||||
void UpdateDragOperation(ui::mojom::DragOperation operation,
|
||||
bool document_is_handling_drag);
|
||||
|
||||
// Accessors that must be called on the UI thread.
|
||||
extensions::ExtensionHost* GetExtensionHost() const;
|
||||
@@ -204,6 +202,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
const std::u16string& message,
|
||||
int32_t line_no,
|
||||
const std::u16string& source_id) override;
|
||||
void ContentsZoomChange(bool zoom_in) override;
|
||||
void BeforeUnloadFired(content::WebContents* source,
|
||||
bool proceed,
|
||||
bool* proceed_to_fire_unload) override;
|
||||
@@ -285,6 +284,10 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
override;
|
||||
void WebContentsDestroyed() override;
|
||||
|
||||
protected:
|
||||
void ShowDevToolsOnUIThread(
|
||||
std::unique_ptr<CefShowDevToolsParams> params) override;
|
||||
|
||||
private:
|
||||
friend class CefBrowserPlatformDelegateAlloy;
|
||||
|
||||
|
@@ -85,7 +85,7 @@
|
||||
#include "base/path_service.h"
|
||||
#include "chrome/browser/themes/theme_service_aura_linux.h"
|
||||
#include "chrome/browser/ui/views/theme_profile_key.h"
|
||||
#include "chrome/grit/chromium_strings.h"
|
||||
#include "chrome/grit/branded_strings.h"
|
||||
#include "components/os_crypt/sync/key_storage_config_linux.h"
|
||||
#include "libcef/browser/printing/print_dialog_linux.h"
|
||||
#include "ui/base/cursor/cursor_factory.h"
|
||||
|
@@ -72,6 +72,7 @@
|
||||
#include "chrome/browser/renderer_host/pepper/chrome_browser_pepper_host_factory.h"
|
||||
#include "chrome/browser/spellchecker/spell_check_host_chrome_impl.h"
|
||||
#include "chrome/browser/ui/chrome_select_file_policy.h"
|
||||
#include "chrome/browser/ui/pdf/chrome_pdf_document_helper_client.h"
|
||||
#include "chrome/common/chrome_content_client.h"
|
||||
#include "chrome/common/chrome_paths.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
@@ -87,9 +88,9 @@
|
||||
#include "components/embedder_support/switches.h"
|
||||
#include "components/embedder_support/user_agent_utils.h"
|
||||
#include "components/media_device_salt/media_device_salt_service.h"
|
||||
#include "components/pdf/browser/pdf_document_helper.h"
|
||||
#include "components/pdf/browser/pdf_navigation_throttle.h"
|
||||
#include "components/pdf/browser/pdf_url_loader_request_interceptor.h"
|
||||
#include "components/pdf/browser/pdf_web_contents_helper.h"
|
||||
#include "components/pdf/common/internal_plugin_helpers.h"
|
||||
#include "components/policy/core/common/policy_pref_names.h"
|
||||
#include "components/spellcheck/common/spellcheck.mojom.h"
|
||||
@@ -868,8 +869,9 @@ void AlloyContentBrowserClient::
|
||||
associated_registry.AddInterface<pdf::mojom::PdfService>(base::BindRepeating(
|
||||
[](content::RenderFrameHost* render_frame_host,
|
||||
mojo::PendingAssociatedReceiver<pdf::mojom::PdfService> receiver) {
|
||||
pdf::PDFWebContentsHelper::BindPdfService(std::move(receiver),
|
||||
render_frame_host);
|
||||
pdf::PDFDocumentHelper::BindPdfService(
|
||||
std::move(receiver), render_frame_host,
|
||||
std::make_unique<ChromePDFDocumentHelperClient>());
|
||||
},
|
||||
&render_frame_host));
|
||||
}
|
||||
@@ -1302,6 +1304,31 @@ AlloyContentBrowserClient::GetSandboxedStorageServiceDataDirectory() {
|
||||
return GetUserDataPath();
|
||||
}
|
||||
|
||||
base::FilePath AlloyContentBrowserClient::GetShaderDiskCacheDirectory() {
|
||||
return GetUserDataPath().Append(FILE_PATH_LITERAL("ShaderCache"));
|
||||
}
|
||||
|
||||
base::FilePath AlloyContentBrowserClient::GetGrShaderDiskCacheDirectory() {
|
||||
return GetUserDataPath().Append(FILE_PATH_LITERAL("GrShaderCache"));
|
||||
}
|
||||
|
||||
base::FilePath AlloyContentBrowserClient::GetGraphiteDawnDiskCacheDirectory() {
|
||||
return GetUserDataPath().Append(FILE_PATH_LITERAL("GraphiteDawnCache"));
|
||||
}
|
||||
|
||||
base::FilePath AlloyContentBrowserClient::GetNetLogDefaultDirectory() {
|
||||
return GetUserDataPath();
|
||||
}
|
||||
|
||||
base::FilePath AlloyContentBrowserClient::GetFirstPartySetsDirectory() {
|
||||
return GetUserDataPath();
|
||||
}
|
||||
|
||||
absl::optional<base::FilePath>
|
||||
AlloyContentBrowserClient::GetLocalTracesDirectory() {
|
||||
return GetUserDataPath();
|
||||
}
|
||||
|
||||
std::string AlloyContentBrowserClient::GetProduct() {
|
||||
return GetChromeProduct();
|
||||
}
|
||||
|
@@ -239,6 +239,12 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
|
||||
mojo::BinderMapWithContext<const content::ServiceWorkerVersionBaseInfo&>*
|
||||
map) override;
|
||||
base::FilePath GetSandboxedStorageServiceDataDirectory() override;
|
||||
base::FilePath GetShaderDiskCacheDirectory() override;
|
||||
base::FilePath GetGrShaderDiskCacheDirectory() override;
|
||||
base::FilePath GetGraphiteDawnDiskCacheDirectory() override;
|
||||
base::FilePath GetNetLogDefaultDirectory() override;
|
||||
base::FilePath GetFirstPartySetsDirectory() override;
|
||||
absl::optional<base::FilePath> GetLocalTracesDirectory() override;
|
||||
std::string GetProduct() override;
|
||||
std::string GetChromeProduct() override;
|
||||
std::string GetUserAgent() override;
|
||||
|
@@ -39,20 +39,15 @@ content::WebContents* CefBrowserPlatformDelegateAlloy::CreateWebContents(
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
DCHECK(primary_);
|
||||
|
||||
// Get or create the request context and browser context.
|
||||
CefRefPtr<CefRequestContextImpl> request_context_impl =
|
||||
CefRequestContextImpl::GetOrCreateForRequestContext(
|
||||
create_params.request_context);
|
||||
CHECK(request_context_impl);
|
||||
auto cef_browser_context = request_context_impl->GetBrowserContext();
|
||||
CHECK(cef_browser_context);
|
||||
auto browser_context = cef_browser_context->AsBrowserContext();
|
||||
|
||||
if (!create_params.request_context) {
|
||||
// Using the global request context.
|
||||
create_params.request_context = request_context_impl.get();
|
||||
create_params.request_context = CefRequestContext::GetGlobalContext();
|
||||
}
|
||||
|
||||
auto* browser_context =
|
||||
CefRequestContextImpl::GetBrowserContext(create_params.request_context);
|
||||
CHECK(browser_context);
|
||||
|
||||
scoped_refptr<content::SiteInstance> site_instance;
|
||||
if (extensions::ExtensionsEnabled() && !create_params.url.empty()) {
|
||||
GURL gurl = url_util::MakeGURL(create_params.url, /*fixup=*/true);
|
||||
@@ -171,11 +166,7 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
|
||||
permissions::PermissionRequestManager::CreateForWebContents(web_contents_);
|
||||
PrefsTabHelper::CreateForWebContents(web_contents_);
|
||||
printing::PrintViewManager::CreateForWebContents(web_contents_);
|
||||
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
// Used by the tabs extension API.
|
||||
zoom::ZoomController::CreateForWebContents(web_contents_);
|
||||
}
|
||||
|
||||
javascript_dialogs::TabModalDialogManager::CreateForWebContents(
|
||||
web_contents_,
|
||||
|
@@ -43,7 +43,7 @@ AlloyWebContentsDialogHelper::GetWebContentsModalDialogHost() {
|
||||
}
|
||||
|
||||
gfx::NativeView AlloyWebContentsDialogHelper::GetHostView() const {
|
||||
// Windowless rendering uses GetHostWidget() instead.
|
||||
// Windowless rendering uses GetAcceleratedWidget() instead.
|
||||
if (browser_delegate_->IsWindowless()) {
|
||||
return gfx::NativeView();
|
||||
}
|
||||
@@ -55,7 +55,8 @@ gfx::NativeView AlloyWebContentsDialogHelper::GetHostView() const {
|
||||
return gfx::NativeView();
|
||||
}
|
||||
|
||||
gfx::AcceleratedWidget AlloyWebContentsDialogHelper::GetHostWidget() const {
|
||||
gfx::AcceleratedWidget AlloyWebContentsDialogHelper::GetAcceleratedWidget()
|
||||
const {
|
||||
#if defined(USE_AURA)
|
||||
// Windowed rendering uses GetHostView() instead.
|
||||
if (!browser_delegate_->IsWindowless()) {
|
||||
|
@@ -31,7 +31,7 @@ class AlloyWebContentsDialogHelper
|
||||
|
||||
// web_modal::WebContentsModalDialogHost methods:
|
||||
gfx::NativeView GetHostView() const override;
|
||||
gfx::AcceleratedWidget GetHostWidget() const override;
|
||||
gfx::AcceleratedWidget GetAcceleratedWidget() const override;
|
||||
gfx::Point GetDialogPosition(const gfx::Size& size) override;
|
||||
gfx::Size GetMaximumDialogSize() override;
|
||||
void AddObserver(web_modal::ModalDialogHostObserver* observer) override;
|
||||
|
@@ -13,7 +13,6 @@
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/public/browser/focused_node_details.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/navigation_entry.h"
|
||||
#include "content/public/browser/navigation_handle.h"
|
||||
#include "content/public/browser/notification_details.h"
|
||||
@@ -23,6 +22,7 @@
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/render_widget_host_observer.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
|
||||
#include "third_party/blink/public/mojom/input/focus_type.mojom-blink.h"
|
||||
#include "third_party/blink/public/mojom/widget/platform_widget.mojom-test-utils.h"
|
||||
@@ -278,7 +278,7 @@ bool CefBrowserContentsDelegate::HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
// Check to see if event should be ignored.
|
||||
if (event.skip_in_browser) {
|
||||
if (event.skip_if_unhandled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -44,7 +44,7 @@ void CefBrowserFrame::SendMessage(const std::string& name,
|
||||
|
||||
void CefBrowserFrame::SendSharedMemoryRegion(
|
||||
const std::string& name,
|
||||
base::ReadOnlySharedMemoryRegion region) {
|
||||
base::WritableSharedMemoryRegion region) {
|
||||
// Always send to the newly created RFH, which may be speculative when
|
||||
// navigating cross-origin.
|
||||
if (auto host = GetFrameHost(/*prefer_speculative=*/true)) {
|
||||
|
@@ -38,7 +38,7 @@ class CefBrowserFrame
|
||||
void SendMessage(const std::string& name,
|
||||
base::Value::List arguments) override;
|
||||
void SendSharedMemoryRegion(const std::string& name,
|
||||
base::ReadOnlySharedMemoryRegion region) override;
|
||||
base::WritableSharedMemoryRegion region) override;
|
||||
void FrameAttached(mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,
|
||||
bool reattached) override;
|
||||
void UpdateDraggableRegions(
|
||||
|
@@ -20,8 +20,11 @@
|
||||
#include "chrome/browser/platform_util.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
||||
#include "chrome/browser/ui/browser_commands.h"
|
||||
#include "components/favicon/core/favicon_url.h"
|
||||
#include "components/spellcheck/common/spellcheck_features.h"
|
||||
#include "components/zoom/page_zoom.h"
|
||||
#include "components/zoom/zoom_controller.h"
|
||||
#include "content/browser/renderer_host/render_frame_host_impl.h"
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "content/public/browser/download_manager.h"
|
||||
@@ -236,6 +239,109 @@ CefRefPtr<CefRequestContext> CefBrowserHostBase::GetRequestContext() {
|
||||
return request_context_;
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::CanZoom(cef_zoom_command_t command) {
|
||||
// Verify that this method is being called on the UI thread.
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (auto web_contents = GetWebContents()) {
|
||||
switch (command) {
|
||||
case CEF_ZOOM_COMMAND_OUT:
|
||||
return chrome::CanZoomOut(web_contents);
|
||||
case CEF_ZOOM_COMMAND_RESET:
|
||||
return chrome::CanResetZoom(web_contents);
|
||||
case CEF_ZOOM_COMMAND_IN:
|
||||
return chrome::CanZoomIn(web_contents);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::Zoom(cef_zoom_command_t command) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostBase::Zoom, this, command));
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto web_contents = GetWebContents()) {
|
||||
const content::PageZoom page_zoom = [command]() {
|
||||
switch (command) {
|
||||
case CEF_ZOOM_COMMAND_OUT:
|
||||
return content::PAGE_ZOOM_OUT;
|
||||
case CEF_ZOOM_COMMAND_RESET:
|
||||
return content::PAGE_ZOOM_RESET;
|
||||
case CEF_ZOOM_COMMAND_IN:
|
||||
return content::PAGE_ZOOM_IN;
|
||||
}
|
||||
}();
|
||||
|
||||
// Same implementation as chrome::Zoom(), but explicitly specifying the
|
||||
// WebContents.
|
||||
zoom::PageZoom::Zoom(web_contents, page_zoom);
|
||||
}
|
||||
}
|
||||
|
||||
double CefBrowserHostBase::GetDefaultZoomLevel() {
|
||||
// Verify that this method is being called on the UI thread.
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if (auto web_contents = GetWebContents()) {
|
||||
zoom::ZoomController* zoom_controller =
|
||||
zoom::ZoomController::FromWebContents(web_contents);
|
||||
if (zoom_controller) {
|
||||
return zoom_controller->GetDefaultZoomLevel();
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
double CefBrowserHostBase::GetZoomLevel() {
|
||||
// Verify that this method is being called on the UI thread.
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
if (auto web_contents = GetWebContents()) {
|
||||
zoom::ZoomController* zoom_controller =
|
||||
zoom::ZoomController::FromWebContents(web_contents);
|
||||
if (zoom_controller) {
|
||||
return zoom_controller->GetZoomLevel();
|
||||
}
|
||||
}
|
||||
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::SetZoomLevel(double zoomLevel) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostBase::SetZoomLevel,
|
||||
this, zoomLevel));
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto web_contents = GetWebContents()) {
|
||||
zoom::ZoomController* zoom_controller =
|
||||
zoom::ZoomController::FromWebContents(web_contents);
|
||||
if (zoom_controller) {
|
||||
if (zoomLevel == 0.0) {
|
||||
// Same logic as PageZoom::Zoom(PAGE_ZOOM_RESET).
|
||||
zoomLevel = zoom_controller->GetDefaultZoomLevel();
|
||||
web_contents->SetPageScale(1.f);
|
||||
}
|
||||
zoom_controller->SetZoomLevel(zoomLevel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::HasView() {
|
||||
return is_views_hosted_;
|
||||
}
|
||||
@@ -399,6 +505,22 @@ void CefBrowserHostBase::PrintToPDF(const CefString& path,
|
||||
print_util::PrintToPDF(web_contents, path, settings, callback);
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
auto params = std::make_unique<CefShowDevToolsParams>(
|
||||
windowInfo, client, settings, inspect_element_at);
|
||||
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&CefBrowserHostBase::ShowDevToolsOnUIThread,
|
||||
this, std::move(params)));
|
||||
} else {
|
||||
ShowDevToolsOnUIThread(std::move(params));
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::SendDevToolsMessage(const void* message,
|
||||
size_t message_size) {
|
||||
if (!message || message_size == 0) {
|
||||
@@ -527,6 +649,31 @@ void CefBrowserHostBase::NotifyMoveOrResizeStarted() {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::IsFullscreen() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (auto web_contents = GetWebContents()) {
|
||||
return web_contents->IsFullscreen();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::ExitFullscreen(bool will_cause_resize) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostBase::ExitFullscreen,
|
||||
this, will_cause_resize));
|
||||
return;
|
||||
}
|
||||
|
||||
auto web_contents = GetWebContents();
|
||||
if (web_contents && web_contents->IsFullscreen()) {
|
||||
web_contents->ExitFullscreen(will_cause_resize);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::ReplaceMisspelling(const CefString& word) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(
|
||||
|
@@ -94,6 +94,23 @@ struct CefBrowserCreateParams {
|
||||
extensions::mojom::ViewType::kInvalid;
|
||||
};
|
||||
|
||||
// Parameters passed to ShowDevToolsOnUIThread().
|
||||
struct CefShowDevToolsParams {
|
||||
CefShowDevToolsParams(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at)
|
||||
: window_info_(windowInfo),
|
||||
client_(client),
|
||||
settings_(settings),
|
||||
inspect_element_at_(inspect_element_at) {}
|
||||
|
||||
CefWindowInfo window_info_;
|
||||
CefRefPtr<CefClient> client_;
|
||||
CefBrowserSettings settings_;
|
||||
CefPoint inspect_element_at_;
|
||||
};
|
||||
|
||||
// Base class for CefBrowserHost implementations. Includes functionality that is
|
||||
// shared by the alloy and chrome runtimes. All methods are thread-safe unless
|
||||
// otherwise indicated.
|
||||
@@ -169,6 +186,11 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
CefRefPtr<CefBrowser> GetBrowser() override;
|
||||
CefRefPtr<CefClient> GetClient() override;
|
||||
CefRefPtr<CefRequestContext> GetRequestContext() override;
|
||||
bool CanZoom(cef_zoom_command_t command) override;
|
||||
void Zoom(cef_zoom_command_t command) override;
|
||||
double GetDefaultZoomLevel() override;
|
||||
double GetZoomLevel() override;
|
||||
void SetZoomLevel(double zoomLevel) override;
|
||||
bool HasView() override;
|
||||
void SetFocus(bool focus) override;
|
||||
void RunFileDialog(FileDialogMode mode,
|
||||
@@ -186,6 +208,10 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
void PrintToPDF(const CefString& path,
|
||||
const CefPdfPrintSettings& settings,
|
||||
CefRefPtr<CefPdfPrintCallback> callback) override;
|
||||
void ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) override;
|
||||
void ReplaceMisspelling(const CefString& word) override;
|
||||
void AddWordToDictionary(const CefString& word) override;
|
||||
void SendKeyEvent(const CefKeyEvent& event) override;
|
||||
@@ -207,6 +233,8 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
bool current_only) override;
|
||||
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
bool IsFullscreen() override;
|
||||
void ExitFullscreen(bool will_cause_resize) override;
|
||||
|
||||
// CefBrowser methods:
|
||||
bool IsValid() override;
|
||||
@@ -339,6 +367,10 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
// Called from LoadMainFrameURL to perform the actual navigation.
|
||||
virtual bool Navigate(const content::OpenURLParams& params);
|
||||
|
||||
// Called from ShowDevTools to perform the actual show.
|
||||
virtual void ShowDevToolsOnUIThread(
|
||||
std::unique_ptr<CefShowDevToolsParams> params) = 0;
|
||||
|
||||
// Create the CefFileDialogManager if it doesn't already exist.
|
||||
bool EnsureFileDialogManager();
|
||||
|
||||
|
@@ -33,6 +33,16 @@ CefBrowserInfo::CefBrowserInfo(int browser_id,
|
||||
is_windowless_(is_windowless),
|
||||
extra_info_(extra_info) {
|
||||
DCHECK_GT(browser_id, 0);
|
||||
|
||||
if (extra_info_ && !extra_info_->IsReadOnly()) {
|
||||
// |extra_info_| should always be read-only to avoid accidental future
|
||||
// modification. Take a copy instead of modifying the passed-in object for
|
||||
// backwards compatibility.
|
||||
extra_info_ = extra_info_->Copy(/*exclude_empty_children=*/false);
|
||||
auto extra_info_impl =
|
||||
static_cast<CefDictionaryValueImpl*>(extra_info_.get());
|
||||
extra_info_impl->MarkReadOnly();
|
||||
}
|
||||
}
|
||||
|
||||
CefBrowserInfo::~CefBrowserInfo() {
|
||||
|
@@ -193,15 +193,8 @@ bool CefBrowserInfoManager::CanCreateWindow(
|
||||
pending_popup->use_default_browser_creation = true;
|
||||
}
|
||||
|
||||
// In most cases, Views-hosted browsers should create Views-hosted popups
|
||||
// and native browsers should use default popup handling. With the Chrome
|
||||
// runtime, we should additionally use default handling (a) when using an
|
||||
// external parent and (b) when using default Browser creation.
|
||||
create_params.popup_with_views_hosted_opener =
|
||||
browser->HasView() &&
|
||||
!browser->platform_delegate()->HasExternalParent() &&
|
||||
!pending_popup->use_default_browser_creation;
|
||||
|
||||
create_params.popup_with_views_hosted_opener = ShouldCreateViewsHostedPopup(
|
||||
browser, pending_popup->use_default_browser_creation);
|
||||
create_params.settings = pending_popup->settings;
|
||||
create_params.client = pending_popup->client;
|
||||
create_params.extra_info = pending_popup->extra_info;
|
||||
@@ -420,6 +413,19 @@ bool CefBrowserInfoManager::MaybeAllowNavigation(
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool CefBrowserInfoManager::ShouldCreateViewsHostedPopup(
|
||||
CefRefPtr<CefBrowserHostBase> opener,
|
||||
bool use_default_browser_creation) {
|
||||
// In most cases, Views-hosted browsers should create Views-hosted popups
|
||||
// and native browsers should use default popup handling. With the Chrome
|
||||
// runtime, we should additionally use default handling (a) when using an
|
||||
// external parent and (b) when using default Browser creation.
|
||||
return opener->HasView() &&
|
||||
!opener->platform_delegate()->HasExternalParent() &&
|
||||
!use_default_browser_creation;
|
||||
}
|
||||
|
||||
CefBrowserInfoManager::BrowserInfoList
|
||||
CefBrowserInfoManager::GetBrowserInfoList() {
|
||||
base::AutoLock lock_scope(browser_info_lock_);
|
||||
|
@@ -143,6 +143,9 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
|
||||
const content::OpenURLParams& params,
|
||||
CefRefPtr<CefBrowserHostBase>& browser) const;
|
||||
|
||||
static bool ShouldCreateViewsHostedPopup(CefRefPtr<CefBrowserHostBase> opener,
|
||||
bool use_default_browser_creation);
|
||||
|
||||
private:
|
||||
// RenderProcessHostObserver methods:
|
||||
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
|
||||
|
@@ -10,8 +10,8 @@
|
||||
#include "base/message_loop/message_pump_for_ui.h"
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
#include "base/mac/scoped_nsautorelease_pool.h"
|
||||
#include "base/message_loop/message_pump_mac.h"
|
||||
#include "base/apple/scoped_nsautorelease_pool.h"
|
||||
#include "base/message_loop/message_pump_apple.h"
|
||||
#endif
|
||||
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
@@ -30,7 +30,7 @@ class MessagePumpExternal : public base::MessagePumpForUI {
|
||||
base::TimeTicks start = base::TimeTicks::Now();
|
||||
while (true) {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
base::mac::ScopedNSAutoreleasePool autorelease_pool;
|
||||
base::apple::ScopedNSAutoreleasePool autorelease_pool;
|
||||
#endif
|
||||
|
||||
base::TimeTicks next_run_time; // is_null()
|
||||
@@ -115,7 +115,7 @@ std::unique_ptr<base::MessagePump> MessagePumpFactoryForUI() {
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
return base::message_pump_mac::Create();
|
||||
return base::message_pump_apple::Create();
|
||||
#else
|
||||
return std::make_unique<base::MessagePumpForUI>();
|
||||
#endif
|
||||
|
@@ -360,8 +360,9 @@ void CefBrowserPlatformDelegate::StartDragging(
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegate::UpdateDragCursor(
|
||||
ui::mojom::DragOperation operation) {
|
||||
void CefBrowserPlatformDelegate::UpdateDragOperation(
|
||||
ui::mojom::DragOperation operation,
|
||||
bool document_is_handling_drag) {
|
||||
DCHECK(false);
|
||||
}
|
||||
|
||||
|
@@ -350,7 +350,8 @@ class CefBrowserPlatformDelegate {
|
||||
const gfx::Vector2d& image_offset,
|
||||
const blink::mojom::DragEventSourceInfo& event_info,
|
||||
content::RenderWidgetHostImpl* source_rwh);
|
||||
virtual void UpdateDragCursor(ui::mojom::DragOperation operation);
|
||||
virtual void UpdateDragOperation(ui::mojom::DragOperation operation,
|
||||
bool document_is_handling_drag);
|
||||
virtual void DragSourceEndedAt(int x, int y, cef_drag_operations_mask_t op);
|
||||
virtual void DragSourceSystemDragEnded();
|
||||
virtual void AccessibilityEventReceived(
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "libcef/browser/browser_util.h"
|
||||
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
|
||||
namespace browser_util {
|
||||
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#include "ui/base/window_open_disposition.h"
|
||||
|
||||
class Browser;
|
||||
class Profile;
|
||||
|
||||
namespace cef {
|
||||
|
||||
@@ -40,6 +41,14 @@ class BrowserDelegate : public content::WebContentsDelegate {
|
||||
|
||||
~BrowserDelegate() override {}
|
||||
|
||||
// Optionally override Browser creation in
|
||||
// DevToolsWindow::CreateDevToolsBrowser. The returned Browser, if any, will
|
||||
// take ownership of |devtools_contents|.
|
||||
virtual Browser* CreateDevToolsBrowser(
|
||||
Profile* profile,
|
||||
Browser* opener,
|
||||
std::unique_ptr<content::WebContents>& devtools_contents) = 0;
|
||||
|
||||
// Optionally override chrome::AddWebContents behavior. This is most often
|
||||
// called via Browser::AddNewContents for new popup browsers and provides an
|
||||
// opportunity for CEF to create a new Browser instead of proceeding with
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
|
||||
#include "libcef/browser/chrome/views/chrome_browser_view.h"
|
||||
#include "libcef/browser/chrome/views/chrome_child_window.h"
|
||||
#include "libcef/browser/media_access_query.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/views/browser_view_impl.h"
|
||||
@@ -24,7 +25,9 @@
|
||||
#include "chrome/browser/ui/browser_tabstrip.h"
|
||||
#include "content/public/browser/global_routing_id.h"
|
||||
#include "content/public/browser/keyboard_event_processing_result.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/render_widget_host.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
|
||||
using content::KeyboardEventProcessingResult;
|
||||
|
||||
@@ -36,7 +39,8 @@ ChromeBrowserDelegate::ChromeBrowserDelegate(
|
||||
DCHECK(browser_);
|
||||
|
||||
if (opener) {
|
||||
DCHECK(browser->is_type_picture_in_picture());
|
||||
DCHECK(browser->is_type_picture_in_picture() ||
|
||||
browser->is_type_devtools());
|
||||
auto opener_host = ChromeBrowserHostImpl::GetBrowserForBrowser(opener);
|
||||
DCHECK(opener_host);
|
||||
if (opener_host) {
|
||||
@@ -47,6 +51,134 @@ ChromeBrowserDelegate::ChromeBrowserDelegate(
|
||||
|
||||
ChromeBrowserDelegate::~ChromeBrowserDelegate() = default;
|
||||
|
||||
Browser* ChromeBrowserDelegate::CreateDevToolsBrowser(
|
||||
Profile* profile,
|
||||
Browser* opener,
|
||||
std::unique_ptr<content::WebContents>& devtools_contents) {
|
||||
// |opener| is the same value that will be passed to the ChromeBrowserDelegate
|
||||
// constructor for the new popup Browser. It may be nullptr in certain rare
|
||||
// situations (e.g. if DevTools is launched for a WebContents that is not a
|
||||
// Browser Tab). In that case, the popup browser host will instead be created
|
||||
// via SetAsDelegate.
|
||||
auto opener_browser_host =
|
||||
opener ? ChromeBrowserHostImpl::GetBrowserForBrowser(opener) : nullptr;
|
||||
if (!opener_browser_host) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// We expect openers and popups to have the same Profile.
|
||||
CHECK_EQ(
|
||||
CefRequestContextImpl::GetProfile(opener_browser_host->request_context()),
|
||||
profile);
|
||||
|
||||
//
|
||||
// 1. Get configuration settings from the user and create the new platform
|
||||
// delegate. Logical equivalent of CefBrowserInfoManager::CanCreateWindow()
|
||||
// for normal popups.
|
||||
//
|
||||
|
||||
auto opener_client = opener_browser_host->GetClient();
|
||||
auto life_span_handler =
|
||||
opener_client ? opener_client->GetLifeSpanHandler() : nullptr;
|
||||
|
||||
CefBrowserCreateParams create_params;
|
||||
CefWindowInfo window_info;
|
||||
|
||||
// If |client| is empty, or if the user clears |client| in
|
||||
// OnBeforeDevToolsPopup, we'll use the result of GetDefaultClient() later on
|
||||
// in CreateBrowserHost().
|
||||
if (pending_show_devtools_params_) {
|
||||
// Start with the params passed to CefBrowserHost::ShowDevTools().
|
||||
create_params.client = pending_show_devtools_params_->client_;
|
||||
create_params.settings = pending_show_devtools_params_->settings_;
|
||||
window_info = pending_show_devtools_params_->window_info_;
|
||||
|
||||
// Pending params are only used a single time.
|
||||
pending_show_devtools_params_.reset();
|
||||
} else {
|
||||
// Start with the same client and settings as the opener.
|
||||
create_params.client = opener_client;
|
||||
create_params.settings = opener_browser_host->settings();
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
window_info.SetAsPopup(nullptr, CefString());
|
||||
#endif
|
||||
}
|
||||
|
||||
// Start with the same extra info as the opener, for consistency with
|
||||
// current Alloy runtime behavior (see CefDevToolsFrontend::Show). This
|
||||
// value, if non-empty, will be read-only.
|
||||
create_params.extra_info = opener_browser_host->browser_info()->extra_info();
|
||||
DCHECK(!create_params.extra_info || create_params.extra_info->IsReadOnly());
|
||||
|
||||
// Use default (non-Views-hosted) window if OnBeforeDevToolsPopup is
|
||||
// unhandled.
|
||||
bool use_default_window = !life_span_handler;
|
||||
|
||||
if (life_span_handler) {
|
||||
life_span_handler->OnBeforeDevToolsPopup(
|
||||
opener_browser_host.get(), window_info, create_params.client,
|
||||
create_params.settings, create_params.extra_info, &use_default_window);
|
||||
}
|
||||
|
||||
if (opener_browser_host->platform_delegate()->HasExternalParent()) {
|
||||
// A parent window handle for DevTools creation is only supported if the
|
||||
// opener also has an external parent.
|
||||
create_params.MaybeSetWindowInfo(window_info);
|
||||
} else if (chrome_child_window::HasParentHandle(window_info)) {
|
||||
LOG(ERROR) << "Parent window handle not supported for this DevTools window";
|
||||
}
|
||||
|
||||
create_params.popup_with_views_hosted_opener =
|
||||
CefBrowserInfoManager::ShouldCreateViewsHostedPopup(opener_browser_host,
|
||||
use_default_window);
|
||||
|
||||
auto platform_delegate = CefBrowserPlatformDelegate::Create(create_params);
|
||||
CHECK(platform_delegate);
|
||||
|
||||
//
|
||||
// 2. Create the new browser host. Logical equivalent of WebContentsCreated()
|
||||
// for normal popups.
|
||||
//
|
||||
|
||||
// Create a new browser host that remains alive until the associated
|
||||
// WebContents is destroyed. Associate that browser host with the WebContents
|
||||
// and execute initial client callbacks. Deliver required information to the
|
||||
// renderer process.
|
||||
auto browser_host = CreateBrowserHostForPopup(
|
||||
devtools_contents.get(), create_params.settings, create_params.client,
|
||||
create_params.extra_info, std::move(platform_delegate),
|
||||
/*is_devtools_popup=*/true, opener_browser_host);
|
||||
|
||||
//
|
||||
// 3. Create the new Browser. Logical equivalent of AddWebContents() for
|
||||
// normal popups.
|
||||
//
|
||||
|
||||
// Use Browser creation params specific to DevTools popups.
|
||||
auto chrome_params = Browser::CreateParams::CreateForDevTools(profile);
|
||||
|
||||
// Pass |opener| to the ChromeBrowserDelegate constructor for the new popup
|
||||
// Browser.
|
||||
chrome_params.opener = opener;
|
||||
|
||||
// Create a new Browser and give it ownership of the new WebContents.
|
||||
// Results in a call to SetAsDelegate to associate the Browser with the
|
||||
// browser host.
|
||||
browser_host->AddNewContents(std::move(devtools_contents),
|
||||
std::move(chrome_params));
|
||||
|
||||
// Give the opener browser a reference to the new DevTools browser. Do this
|
||||
// last because don't want the client to attempt access to the DevTools
|
||||
// browser via opener browser methods (e.g. ShowDevTools, CloseDevTools, etc)
|
||||
// while creation is still in progress.
|
||||
opener_browser_host->SetDevToolsBrowserHost(browser_host->GetWeakPtr());
|
||||
|
||||
auto browser = browser_host->browser();
|
||||
CHECK(browser);
|
||||
return browser;
|
||||
}
|
||||
|
||||
std::unique_ptr<content::WebContents> ChromeBrowserDelegate::AddWebContents(
|
||||
std::unique_ptr<content::WebContents> new_contents) {
|
||||
if (CefBrowserInfoManager::GetInstance()->AddWebContents(
|
||||
@@ -56,7 +188,9 @@ std::unique_ptr<content::WebContents> ChromeBrowserDelegate::AddWebContents(
|
||||
ChromeBrowserHostImpl::GetBrowserForContents(new_contents.get());
|
||||
if (new_browser) {
|
||||
// Create a new Browser and give it ownership of the new WebContents.
|
||||
new_browser->AddNewContents(std::move(new_contents));
|
||||
// Results in a call to SetAsDelegate to associate the Browser with the
|
||||
// browser host.
|
||||
new_browser->AddNewContents(std::move(new_contents), std::nullopt);
|
||||
} else {
|
||||
LOG(ERROR) << "No host found for chrome popup browser";
|
||||
}
|
||||
@@ -90,18 +224,25 @@ void ChromeBrowserDelegate::SetAsDelegate(content::WebContents* web_contents,
|
||||
return;
|
||||
}
|
||||
|
||||
const bool is_devtools_popup = browser_->is_type_devtools();
|
||||
|
||||
// We should never reach here for DevTools popups that have an opener, as
|
||||
// CreateDevToolsBrowser should have already created the browser host.
|
||||
DCHECK(!is_devtools_popup || !opener_host_);
|
||||
|
||||
auto platform_delegate = CefBrowserPlatformDelegate::Create(create_params_);
|
||||
CHECK(platform_delegate);
|
||||
|
||||
auto browser_info = CefBrowserInfoManager::GetInstance()->CreateBrowserInfo(
|
||||
/*is_popup=*/false, /*is_windowless=*/false, create_params_.extra_info);
|
||||
is_devtools_popup, /*is_windowless=*/false, create_params_.extra_info);
|
||||
|
||||
auto request_context_impl =
|
||||
CefRequestContextImpl::GetOrCreateForRequestContext(
|
||||
create_params_.request_context);
|
||||
|
||||
CreateBrowser(web_contents, create_params_.settings, create_params_.client,
|
||||
std::move(platform_delegate), browser_info, /*opener=*/nullptr,
|
||||
CreateBrowserHost(web_contents, create_params_.settings,
|
||||
create_params_.client, std::move(platform_delegate),
|
||||
browser_info, is_devtools_popup, /*opener=*/nullptr,
|
||||
request_context_impl);
|
||||
}
|
||||
|
||||
@@ -123,6 +264,11 @@ bool ChromeBrowserDelegate::ShowStatusBubble(bool show_by_default) {
|
||||
|
||||
bool ChromeBrowserDelegate::HandleCommand(int command_id,
|
||||
WindowOpenDisposition disposition) {
|
||||
// Verify that our enum matches Chromium's values.
|
||||
static_assert(static_cast<int>(CEF_WOD_MAX_VALUE) ==
|
||||
static_cast<int>(WindowOpenDisposition::MAX_VALUE),
|
||||
"enum mismatch");
|
||||
|
||||
if (auto browser = ChromeBrowserHostImpl::GetBrowserForBrowser(browser_)) {
|
||||
if (auto client = browser->GetClient()) {
|
||||
if (auto handler = client->GetCommandHandler()) {
|
||||
@@ -299,19 +445,13 @@ void ChromeBrowserDelegate::WebContentsCreated(
|
||||
return;
|
||||
}
|
||||
|
||||
auto browser_info =
|
||||
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
|
||||
new_contents, /*is_windowless=*/false, extra_info);
|
||||
CHECK(browser_info->is_popup());
|
||||
|
||||
// Popups must share the same RequestContext as the parent.
|
||||
auto request_context_impl = opener->request_context();
|
||||
CHECK(request_context_impl);
|
||||
|
||||
// We don't officially own |new_contents| until AddNewContents() is called.
|
||||
// However, we need to install observers/delegates here.
|
||||
CreateBrowser(new_contents, settings, client, std::move(platform_delegate),
|
||||
browser_info, opener, request_context_impl);
|
||||
// Create a new browser host that remains alive until the associated
|
||||
// WebContents is destroyed. Associate that browser host with the WebContents
|
||||
// and execute initial client callbacks. Deliver required information to the
|
||||
// renderer process.
|
||||
CreateBrowserHostForPopup(new_contents, settings, client, extra_info,
|
||||
std::move(platform_delegate),
|
||||
/*is_devtools_popup=*/false, opener);
|
||||
}
|
||||
|
||||
content::WebContents* ChromeBrowserDelegate::OpenURLFromTab(
|
||||
@@ -379,6 +519,14 @@ void ChromeBrowserDelegate::ExitFullscreenModeForTab(
|
||||
if (auto delegate = GetDelegateForWebContents(web_contents)) {
|
||||
delegate->ExitFullscreenModeForTab(web_contents);
|
||||
}
|
||||
|
||||
// Workaround for https://crbug.com/1500371. Ensure WebContents exits
|
||||
// fullscreen state by explicitly sending a resize message.
|
||||
if (auto* rwhv = web_contents->GetRenderWidgetHostView()) {
|
||||
if (auto* render_widget_host = rwhv->GetRenderWidgetHost()) {
|
||||
render_widget_host->SynchronizeVisualProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::CanDownload(
|
||||
@@ -413,12 +561,19 @@ bool ChromeBrowserDelegate::HandleKeyboardEvent(
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::CreateBrowser(
|
||||
void ChromeBrowserDelegate::SetPendingShowDevToolsParams(
|
||||
std::unique_ptr<CefShowDevToolsParams> params) {
|
||||
DCHECK(!pending_show_devtools_params_);
|
||||
pending_show_devtools_params_ = std::move(params);
|
||||
}
|
||||
|
||||
CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserDelegate::CreateBrowserHost(
|
||||
content::WebContents* web_contents,
|
||||
CefBrowserSettings settings,
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
bool is_devtools_popup,
|
||||
CefRefPtr<ChromeBrowserHostImpl> opener,
|
||||
CefRefPtr<CefRequestContextImpl> request_context_impl) {
|
||||
CEF_REQUIRE_UIT();
|
||||
@@ -454,12 +609,40 @@ void ChromeBrowserDelegate::CreateBrowser(
|
||||
CefRefPtr<ChromeBrowserHostImpl> browser_host =
|
||||
new ChromeBrowserHostImpl(settings, client, std::move(platform_delegate),
|
||||
browser_info, request_context_impl);
|
||||
browser_host->Attach(web_contents, opener);
|
||||
browser_host->Attach(web_contents, is_devtools_popup, opener);
|
||||
|
||||
// The Chrome browser for a popup won't be created until AddNewContents().
|
||||
// The Chrome browser for a normal popup won't be created until
|
||||
// AddNewContents().
|
||||
if (!opener) {
|
||||
browser_host->SetBrowser(browser_);
|
||||
}
|
||||
|
||||
return browser_host;
|
||||
}
|
||||
|
||||
CefRefPtr<ChromeBrowserHostImpl>
|
||||
ChromeBrowserDelegate::CreateBrowserHostForPopup(
|
||||
content::WebContents* web_contents,
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
CefRefPtr<CefDictionaryValue> extra_info,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
bool is_devtools_popup,
|
||||
CefRefPtr<ChromeBrowserHostImpl> opener) {
|
||||
auto browser_info =
|
||||
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(
|
||||
web_contents, /*is_windowless=*/false, extra_info);
|
||||
CHECK(browser_info->is_popup());
|
||||
|
||||
// Popups must share the same RequestContext as the parent.
|
||||
auto request_context_impl = opener->request_context();
|
||||
CHECK(request_context_impl);
|
||||
|
||||
// We don't officially own |web_contents| until AddNewContents() is called.
|
||||
// However, we need to install observers/delegates here.
|
||||
return CreateBrowserHost(web_contents, settings, client,
|
||||
std::move(platform_delegate), browser_info,
|
||||
is_devtools_popup, opener, request_context_impl);
|
||||
}
|
||||
|
||||
CefBrowserContentsDelegate* ChromeBrowserDelegate::GetDelegateForWebContents(
|
||||
|
@@ -39,6 +39,9 @@ class ChromeBrowserHostImpl;
|
||||
// but the Browser object will change when the tab is dragged between windows.
|
||||
class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
public:
|
||||
// The |create_params| and |opener| values are specified via the
|
||||
// Browser::CreateParams passed to Browser::Create. |opener| will only be
|
||||
// specified for certain special Browser types.
|
||||
ChromeBrowserDelegate(Browser* browser,
|
||||
const CefBrowserCreateParams& create_params,
|
||||
const Browser* opener);
|
||||
@@ -49,6 +52,10 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
~ChromeBrowserDelegate() override;
|
||||
|
||||
// cef::BrowserDelegate methods:
|
||||
Browser* CreateDevToolsBrowser(
|
||||
Profile* profile,
|
||||
Browser* opener,
|
||||
std::unique_ptr<content::WebContents>& devtools_contents) override;
|
||||
std::unique_ptr<content::WebContents> AddWebContents(
|
||||
std::unique_ptr<content::WebContents> new_contents) override;
|
||||
void OnWebContentsCreated(content::WebContents* new_contents) override;
|
||||
@@ -104,18 +111,31 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) override;
|
||||
|
||||
void SetPendingShowDevToolsParams(
|
||||
std::unique_ptr<CefShowDevToolsParams> params);
|
||||
|
||||
Browser* browser() const { return browser_; }
|
||||
|
||||
private:
|
||||
void CreateBrowser(
|
||||
CefRefPtr<ChromeBrowserHostImpl> CreateBrowserHost(
|
||||
content::WebContents* web_contents,
|
||||
CefBrowserSettings settings,
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
scoped_refptr<CefBrowserInfo> browser_info,
|
||||
bool is_devtools_popup,
|
||||
CefRefPtr<ChromeBrowserHostImpl> opener,
|
||||
CefRefPtr<CefRequestContextImpl> request_context_impl);
|
||||
|
||||
CefRefPtr<ChromeBrowserHostImpl> CreateBrowserHostForPopup(
|
||||
content::WebContents* web_contents,
|
||||
const CefBrowserSettings& settings,
|
||||
CefRefPtr<CefClient> client,
|
||||
CefRefPtr<CefDictionaryValue> extra_info,
|
||||
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate,
|
||||
bool is_devtools_popup,
|
||||
CefRefPtr<ChromeBrowserHostImpl> opener);
|
||||
|
||||
CefBrowserContentsDelegate* GetDelegateForWebContents(
|
||||
content::WebContents* web_contents);
|
||||
|
||||
@@ -130,6 +150,8 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
absl::optional<bool> show_status_bubble_;
|
||||
absl::optional<SkRegion> draggable_region_;
|
||||
mutable absl::optional<bool> frameless_pip_;
|
||||
|
||||
std::unique_ptr<CefShowDevToolsParams> pending_show_devtools_params_;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_BROWSER_DELEGATE_H_
|
||||
|
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "libcef/browser/browser_platform_delegate.h"
|
||||
#include "libcef/browser/chrome/browser_platform_delegate_chrome.h"
|
||||
#include "libcef/browser/chrome/chrome_browser_delegate.h"
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/views/browser_view_impl.h"
|
||||
#include "libcef/common/net/url_util.h"
|
||||
@@ -13,8 +14,8 @@
|
||||
|
||||
#include "base/logging.h"
|
||||
#include "base/notreached.h"
|
||||
#include "chrome/browser/devtools/devtools_window.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/browser_commands.h"
|
||||
#include "chrome/browser/ui/browser_navigator.h"
|
||||
#include "chrome/browser/ui/browser_tabstrip.h"
|
||||
@@ -28,7 +29,7 @@
|
||||
// static
|
||||
CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::Create(
|
||||
const CefBrowserCreateParams& params) {
|
||||
auto browser = CreateBrowser(params);
|
||||
auto browser = CreateBrowser(params, std::nullopt);
|
||||
|
||||
GURL url = url_util::MakeGURL(params.url, /*fixup=*/true);
|
||||
if (url.is_empty()) {
|
||||
@@ -99,7 +100,8 @@ CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserHostImpl::GetBrowserForBrowser(
|
||||
ChromeBrowserHostImpl::~ChromeBrowserHostImpl() = default;
|
||||
|
||||
void ChromeBrowserHostImpl::AddNewContents(
|
||||
std::unique_ptr<content::WebContents> contents) {
|
||||
std::unique_ptr<content::WebContents> contents,
|
||||
std::optional<Browser::CreateParams> browser_create_params) {
|
||||
DCHECK(contents);
|
||||
DCHECK(!browser_);
|
||||
|
||||
@@ -111,7 +113,7 @@ void ChromeBrowserHostImpl::AddNewContents(
|
||||
params.browser_view = GetBrowserView();
|
||||
|
||||
// Create the new Browser representation.
|
||||
auto browser = CreateBrowser(params);
|
||||
auto browser = CreateBrowser(params, std::move(browser_create_params));
|
||||
|
||||
// Add the WebContents to the Browser.
|
||||
browser->tab_strip_model()->AddWebContents(
|
||||
@@ -124,9 +126,18 @@ void ChromeBrowserHostImpl::AddNewContents(
|
||||
|
||||
void ChromeBrowserHostImpl::OnWebContentsDestroyed(
|
||||
content::WebContents* web_contents) {
|
||||
// GetWebContents() should return nullptr at this point.
|
||||
DCHECK(!GetWebContents());
|
||||
|
||||
// In most cases WebContents destruction will trigger browser destruction.
|
||||
// The exception is if the browser still exists at CefShutdown, in which
|
||||
// case DestroyBrowser() will be called first via
|
||||
// CefBrowserInfoManager::DestroyAllBrowsers().
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->WebContentsDestroyed(web_contents);
|
||||
DestroyBrowser();
|
||||
}
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
@@ -179,15 +190,6 @@ CefWindowHandle ChromeBrowserHostImpl::GetOpenerWindowHandle() {
|
||||
return kNullWindowHandle;
|
||||
}
|
||||
|
||||
double ChromeBrowserHostImpl::GetZoomLevel() {
|
||||
NOTIMPLEMENTED();
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::SetZoomLevel(double zoomLevel) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::Find(const CefString& searchText,
|
||||
bool forward,
|
||||
bool matchCase,
|
||||
@@ -199,22 +201,68 @@ void ChromeBrowserHostImpl::StopFinding(bool clearSelection) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) {
|
||||
NOTIMPLEMENTED();
|
||||
void ChromeBrowserHostImpl::ShowDevToolsOnUIThread(
|
||||
std::unique_ptr<CefShowDevToolsParams> params) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (!browser_) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* web_contents = GetWebContents();
|
||||
if (!web_contents) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* profile = CefRequestContextImpl::GetProfile(request_context());
|
||||
if (!DevToolsWindow::AllowDevToolsFor(profile, web_contents)) {
|
||||
LOG(WARNING) << "DevTools is not allowed for this browser";
|
||||
return;
|
||||
}
|
||||
|
||||
auto inspect_element_at = params->inspect_element_at_;
|
||||
|
||||
if (!devtools_browser_host_) {
|
||||
// Configure parameters for ChromeBrowserDelegate::CreateDevToolsBrowser
|
||||
// which will be called indirectly to create the DevTools window.
|
||||
auto chrome_browser_delegate =
|
||||
static_cast<ChromeBrowserDelegate*>(browser_->cef_delegate());
|
||||
chrome_browser_delegate->SetPendingShowDevToolsParams(std::move(params));
|
||||
}
|
||||
|
||||
// Focus the existing DevTools window or create a new one.
|
||||
if (!inspect_element_at.IsEmpty()) {
|
||||
DevToolsWindow::InspectElement(web_contents->GetPrimaryMainFrame(),
|
||||
inspect_element_at.x, inspect_element_at.y);
|
||||
} else {
|
||||
DevToolsWindow::OpenDevToolsWindow(web_contents, profile);
|
||||
}
|
||||
|
||||
// The DevTools browser host should now exist.
|
||||
DCHECK(devtools_browser_host_);
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::CloseDevTools() {
|
||||
NOTIMPLEMENTED();
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&ChromeBrowserHostImpl::CloseDevTools, this));
|
||||
return;
|
||||
}
|
||||
|
||||
if (devtools_browser_host_) {
|
||||
devtools_browser_host_->TryCloseBrowser();
|
||||
}
|
||||
}
|
||||
|
||||
bool ChromeBrowserHostImpl::HasDevTools() {
|
||||
NOTIMPLEMENTED();
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
|
||||
return !!devtools_browser_host_;
|
||||
}
|
||||
|
||||
bool ChromeBrowserHostImpl::IsWindowRenderingDisabled() {
|
||||
return false;
|
||||
}
|
||||
@@ -332,6 +380,36 @@ bool ChromeBrowserHostImpl::IsBackgroundHost() {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChromeBrowserHostImpl::CanExecuteChromeCommand(int command_id) {
|
||||
// Verify that this method is being called on the UI thread.
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (browser_) {
|
||||
return chrome::SupportsCommand(browser_, command_id) &&
|
||||
chrome::IsCommandEnabled(browser_, command_id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::ExecuteChromeCommand(
|
||||
int command_id,
|
||||
cef_window_open_disposition_t disposition) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::BindOnce(&ChromeBrowserHostImpl::ExecuteChromeCommand,
|
||||
this, command_id, disposition));
|
||||
return;
|
||||
}
|
||||
|
||||
if (browser_) {
|
||||
chrome::ExecuteCommandWithDisposition(
|
||||
browser_, command_id, static_cast<WindowOpenDisposition>(disposition));
|
||||
}
|
||||
}
|
||||
|
||||
ChromeBrowserView* ChromeBrowserHostImpl::chrome_browser_view() const {
|
||||
if (browser_ && is_views_hosted_) {
|
||||
return static_cast<ChromeBrowserView*>(browser_->window());
|
||||
@@ -389,19 +467,16 @@ ChromeBrowserHostImpl::ChromeBrowserHostImpl(
|
||||
|
||||
// static
|
||||
Browser* ChromeBrowserHostImpl::CreateBrowser(
|
||||
const CefBrowserCreateParams& params) {
|
||||
// Get or create the request context and profile.
|
||||
CefRefPtr<CefRequestContextImpl> request_context_impl =
|
||||
CefRequestContextImpl::GetOrCreateForRequestContext(
|
||||
params.request_context);
|
||||
CHECK(request_context_impl);
|
||||
auto cef_browser_context = request_context_impl->GetBrowserContext();
|
||||
CHECK(cef_browser_context);
|
||||
auto profile = cef_browser_context->AsProfile();
|
||||
CHECK(profile);
|
||||
|
||||
Browser::CreateParams chrome_params =
|
||||
Browser::CreateParams(profile, /*user_gesture=*/false);
|
||||
const CefBrowserCreateParams& params,
|
||||
std::optional<Browser::CreateParams> browser_create_params) {
|
||||
Browser::CreateParams chrome_params = [¶ms, &browser_create_params]() {
|
||||
if (!browser_create_params.has_value()) {
|
||||
auto* profile = CefRequestContextImpl::GetProfile(params.request_context);
|
||||
return Browser::CreateParams(profile, /*user_gesture=*/false);
|
||||
} else {
|
||||
return std::move(*browser_create_params);
|
||||
}
|
||||
}();
|
||||
|
||||
// Pass |params| to cef::BrowserDelegate::Create from the Browser constructor.
|
||||
chrome_params.cef_params = base::MakeRefCounted<DelegateCreateParams>(params);
|
||||
@@ -412,10 +487,12 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
|
||||
// documentation.
|
||||
ChromeBrowserView* chrome_browser_view = nullptr;
|
||||
if (params.browser_view) {
|
||||
if (chrome_params.type == Browser::TYPE_NORMAL) {
|
||||
// Don't show most controls.
|
||||
chrome_params.type = Browser::TYPE_POPUP;
|
||||
// Don't show title bar or address.
|
||||
chrome_params.trusted_source = true;
|
||||
}
|
||||
|
||||
auto view_impl =
|
||||
static_cast<CefBrowserViewImpl*>(params.browser_view.get());
|
||||
@@ -456,6 +533,7 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::Attach(content::WebContents* web_contents,
|
||||
bool is_devtools_popup,
|
||||
CefRefPtr<ChromeBrowserHostImpl> opener) {
|
||||
DCHECK(web_contents);
|
||||
|
||||
@@ -464,7 +542,7 @@ void ChromeBrowserHostImpl::Attach(content::WebContents* web_contents,
|
||||
// new browser's platform delegate.
|
||||
opener->platform_delegate_->PopupWebContentsCreated(
|
||||
settings_, client_, web_contents, platform_delegate_.get(),
|
||||
/*is_devtools_popup=*/false);
|
||||
is_devtools_popup);
|
||||
}
|
||||
|
||||
platform_delegate_->WebContentsCreated(web_contents,
|
||||
@@ -480,7 +558,7 @@ void ChromeBrowserHostImpl::Attach(content::WebContents* web_contents,
|
||||
// Notify that the browser has been created. These must be delivered in the
|
||||
// expected order.
|
||||
|
||||
if (opener && opener->platform_delegate_) {
|
||||
if (opener) {
|
||||
// 1. Notify the opener browser's platform delegate. With Views this will
|
||||
// result in a call to CefBrowserViewDelegate::OnPopupBrowserViewCreated().
|
||||
// We want to call this method first because the implementation will often
|
||||
@@ -488,9 +566,7 @@ void ChromeBrowserHostImpl::Attach(content::WebContents* web_contents,
|
||||
// CefBrowserHost::GetWindowHandle() will return kNullWindowHandle in
|
||||
// OnAfterCreated(), which breaks client expectations (e.g. clients expect
|
||||
// everything about the browser to be valid at that time).
|
||||
opener->platform_delegate_->PopupBrowserCreated(
|
||||
this,
|
||||
/*is_devtools_popup=*/false);
|
||||
opener->platform_delegate_->PopupBrowserCreated(this, is_devtools_popup);
|
||||
}
|
||||
|
||||
// 2. Notify the browser's LifeSpanHandler. This must always be the first
|
||||
@@ -509,14 +585,27 @@ void ChromeBrowserHostImpl::Attach(content::WebContents* web_contents,
|
||||
|
||||
void ChromeBrowserHostImpl::SetBrowser(Browser* browser) {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (browser == browser_) {
|
||||
return;
|
||||
}
|
||||
|
||||
browser_ = browser;
|
||||
static_cast<CefBrowserPlatformDelegateChrome*>(platform_delegate_.get())
|
||||
->set_chrome_browser(browser);
|
||||
if (browser_) {
|
||||
host_window_handle_ = platform_delegate_->GetHostWindowHandle();
|
||||
} else {
|
||||
host_window_handle_ = kNullWindowHandle;
|
||||
}
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::SetDevToolsBrowserHost(
|
||||
base::WeakPtr<ChromeBrowserHostImpl> devtools_browser_host) {
|
||||
CEF_REQUIRE_UIT();
|
||||
DCHECK(!devtools_browser_host_);
|
||||
devtools_browser_host_ = devtools_browser_host;
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::WindowDestroyed() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (auto view = chrome_browser_view()) {
|
||||
@@ -534,15 +623,34 @@ bool ChromeBrowserHostImpl::WillBeDestroyed() const {
|
||||
|
||||
void ChromeBrowserHostImpl::DestroyBrowser() {
|
||||
CEF_REQUIRE_UIT();
|
||||
browser_ = nullptr;
|
||||
weak_ptr_factory_.InvalidateWeakPtrs();
|
||||
|
||||
// Notify that this browser has been destroyed. These must be delivered in
|
||||
// the expected order.
|
||||
|
||||
// 1. Notify the platform delegate. With Views this will result in a call to
|
||||
// CefBrowserViewDelegate::OnBrowserDestroyed().
|
||||
platform_delegate_->NotifyBrowserDestroyed();
|
||||
|
||||
// 2. Notify the browser's LifeSpanHandler. This must always be the last
|
||||
// notification for this browser.
|
||||
OnBeforeClose();
|
||||
|
||||
// Notify any observers that may have state associated with this browser.
|
||||
OnBrowserDestroyed();
|
||||
|
||||
// If the WebContents still exists at this point, signal destruction before
|
||||
// browser destruction.
|
||||
if (auto web_contents = GetWebContents()) {
|
||||
platform_delegate_->WebContentsDestroyed(web_contents);
|
||||
}
|
||||
|
||||
// Disassociate the platform delegate from this browser.
|
||||
platform_delegate_->BrowserDestroyed(this);
|
||||
|
||||
// Clean up UI thread state.
|
||||
browser_ = nullptr;
|
||||
weak_ptr_factory_.InvalidateWeakPtrs();
|
||||
|
||||
CefBrowserHostBase::DestroyBrowser();
|
||||
}
|
||||
|
||||
|
@@ -12,8 +12,8 @@
|
||||
#include "libcef/browser/chrome/browser_delegate.h"
|
||||
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
|
||||
class Browser;
|
||||
class ChromeBrowserDelegate;
|
||||
class ChromeBrowserView;
|
||||
|
||||
@@ -67,17 +67,11 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
bool TryCloseBrowser() override;
|
||||
CefWindowHandle GetWindowHandle() override;
|
||||
CefWindowHandle GetOpenerWindowHandle() override;
|
||||
double GetZoomLevel() override;
|
||||
void SetZoomLevel(double zoomLevel) override;
|
||||
void Find(const CefString& searchText,
|
||||
bool forward,
|
||||
bool matchCase,
|
||||
bool findNext) override;
|
||||
void StopFinding(bool clearSelection) override;
|
||||
void ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
CefRefPtr<CefClient> client,
|
||||
const CefBrowserSettings& settings,
|
||||
const CefPoint& inspect_element_at) override;
|
||||
void CloseDevTools() override;
|
||||
bool HasDevTools() override;
|
||||
bool IsWindowRenderingDisabled() override;
|
||||
@@ -116,6 +110,9 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
const CefSize& max_size) override;
|
||||
CefRefPtr<CefExtension> GetExtension() override;
|
||||
bool IsBackgroundHost() override;
|
||||
bool CanExecuteChromeCommand(int command_id) override;
|
||||
void ExecuteChromeCommand(int command_id,
|
||||
cef_window_open_disposition_t disposition) override;
|
||||
|
||||
Browser* browser() const { return browser_; }
|
||||
|
||||
@@ -128,6 +125,8 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
|
||||
protected:
|
||||
bool Navigate(const content::OpenURLParams& params) override;
|
||||
void ShowDevToolsOnUIThread(
|
||||
std::unique_ptr<CefShowDevToolsParams> params) override;
|
||||
|
||||
private:
|
||||
friend class ChromeBrowserDelegate;
|
||||
@@ -140,22 +139,32 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
CefRefPtr<CefRequestContextImpl> request_context);
|
||||
|
||||
// Create a new Browser without initializing the WebContents.
|
||||
static Browser* CreateBrowser(const CefBrowserCreateParams& params);
|
||||
// |browser_create_params| may be empty for default Browser creation behavior.
|
||||
static Browser* CreateBrowser(
|
||||
const CefBrowserCreateParams& params,
|
||||
std::optional<Browser::CreateParams> browser_create_params);
|
||||
|
||||
// Called from ChromeBrowserDelegate::CreateBrowser when this object is first
|
||||
// created. Must be called on the UI thread.
|
||||
void Attach(content::WebContents* web_contents,
|
||||
bool is_devtools_popup,
|
||||
CefRefPtr<ChromeBrowserHostImpl> opener);
|
||||
|
||||
// Called from ChromeBrowserDelegate::AddNewContents to take ownership of a
|
||||
// popup WebContents.
|
||||
void AddNewContents(std::unique_ptr<content::WebContents> contents);
|
||||
// popup WebContents. |browser_create_params| may be empty for default Browser
|
||||
// creation behavior.
|
||||
void AddNewContents(
|
||||
std::unique_ptr<content::WebContents> contents,
|
||||
std::optional<Browser::CreateParams> browser_create_params);
|
||||
|
||||
// Called when this object changes Browser ownership (e.g. initially created,
|
||||
// dragging between windows, etc). The old Browser, if any, will be cleared
|
||||
// before the new Browser is added. Must be called on the UI thread.
|
||||
void SetBrowser(Browser* browser);
|
||||
|
||||
void SetDevToolsBrowserHost(
|
||||
base::WeakPtr<ChromeBrowserHostImpl> devtools_browser_host);
|
||||
|
||||
// CefBrowserHostBase methods:
|
||||
void WindowDestroyed() override;
|
||||
bool WillBeDestroyed() const override;
|
||||
@@ -170,6 +179,8 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
Browser* browser_ = nullptr;
|
||||
CefWindowHandle host_window_handle_ = kNullWindowHandle;
|
||||
|
||||
base::WeakPtr<ChromeBrowserHostImpl> devtools_browser_host_;
|
||||
|
||||
base::WeakPtrFactory<ChromeBrowserHostImpl> weak_ptr_factory_{this};
|
||||
};
|
||||
|
||||
|
@@ -7,7 +7,9 @@
|
||||
#include "include/views/cef_window.h"
|
||||
#include "libcef/browser/views/window_impl.h"
|
||||
|
||||
#include "chrome/browser/devtools/devtools_window.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "components/zoom/zoom_controller.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
|
||||
namespace {
|
||||
@@ -77,8 +79,30 @@ void CefBrowserPlatformDelegateChromeViews::BrowserCreated(
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::NotifyBrowserCreated() {
|
||||
if (browser_view_->delegate()) {
|
||||
browser_view_->delegate()->OnBrowserCreated(browser_view_, browser_);
|
||||
if (auto delegate = browser_view_->delegate()) {
|
||||
delegate->OnBrowserCreated(browser_view_, browser_);
|
||||
|
||||
// DevTools windows hide the notification bubble by default. However, we
|
||||
// don't currently have the ability to intercept WebContents creation via
|
||||
// DevToolsWindow::Create(), so |show_by_default| will always be true here.
|
||||
const bool show_by_default =
|
||||
!DevToolsWindow::IsDevToolsWindow(web_contents_);
|
||||
|
||||
bool show_zoom_bubble = show_by_default;
|
||||
const auto& state = browser_->settings().chrome_zoom_bubble;
|
||||
if (show_by_default && state == STATE_DISABLED) {
|
||||
show_zoom_bubble = false;
|
||||
} else if (!show_by_default && state == STATE_ENABLED) {
|
||||
show_zoom_bubble = true;
|
||||
}
|
||||
|
||||
if (show_zoom_bubble != show_by_default) {
|
||||
// We may be called before TabHelpers::AttachTabHelpers(), so create
|
||||
// the ZoomController if necessary.
|
||||
zoom::ZoomController::CreateForWebContents(web_contents_);
|
||||
zoom::ZoomController::FromWebContents(web_contents_)
|
||||
->SetShowsNotificationBubble(show_zoom_bubble);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "libcef/browser/chrome/views/chrome_browser_frame.h"
|
||||
|
||||
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
|
||||
|
||||
#include "chrome/browser/themes/theme_service.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/browser_commands.h"
|
||||
@@ -57,3 +59,24 @@ ChromeBrowserFrame::CreateNonClientFrameView() {
|
||||
// Bypass the BrowserFrame implementation.
|
||||
return views::Widget::CreateNonClientFrameView();
|
||||
}
|
||||
|
||||
void ChromeBrowserFrame::Activate() {
|
||||
if (browser_view_ && browser_view_->browser() &&
|
||||
browser_view_->browser()->is_type_devtools()) {
|
||||
if (auto browser_host = ChromeBrowserHostImpl::GetBrowserForBrowser(
|
||||
browser_view_->browser())) {
|
||||
if (browser_host->platform_delegate()->HasExternalParent()) {
|
||||
// Handle activation of DevTools with external parent via the platform
|
||||
// delegate. On Windows the default platform implementation
|
||||
// (HWNDMessageHandler::Activate) will call SetForegroundWindow but that
|
||||
// doesn't seem to work for DevTools windows when activated via the
|
||||
// right-click context menu.
|
||||
browser_host->SetFocus(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Proceed with default handling.
|
||||
BrowserFrame::Activate();
|
||||
}
|
||||
|
@@ -103,6 +103,7 @@ class ChromeBrowserFrame : public BrowserFrame {
|
||||
views::internal::RootView* CreateRootView() override;
|
||||
std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView()
|
||||
override;
|
||||
void Activate() override;
|
||||
|
||||
BrowserView* browser_view() const { return browser_view_; }
|
||||
|
||||
|
@@ -126,8 +126,6 @@ class ChildBrowserViewDelegate : public CefBrowserViewDelegate {
|
||||
bool OnPopupBrowserViewCreated(CefRefPtr<CefBrowserView> browser_view,
|
||||
CefRefPtr<CefBrowserView> popup_browser_view,
|
||||
bool is_devtools) override {
|
||||
DCHECK(!is_devtools);
|
||||
|
||||
auto new_browser = static_cast<CefBrowserHostBase*>(
|
||||
popup_browser_view->GetBrowser().get());
|
||||
auto new_platform_delegate = new_browser->platform_delegate();
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include "extensions/browser/api/app_runtime/app_runtime_api.h"
|
||||
#include "extensions/browser/extension_prefs.h"
|
||||
#include "extensions/browser/extension_registry.h"
|
||||
#include "extensions/browser/notification_types.h"
|
||||
#include "extensions/browser/null_app_sorting.h"
|
||||
#include "extensions/browser/quota_service.h"
|
||||
#include "extensions/browser/renderer_startup_helper.h"
|
||||
|
@@ -37,9 +37,10 @@ CefExtensionSystemFactory::CefExtensionSystemFactory()
|
||||
|
||||
CefExtensionSystemFactory::~CefExtensionSystemFactory() {}
|
||||
|
||||
KeyedService* CefExtensionSystemFactory::BuildServiceInstanceFor(
|
||||
std::unique_ptr<KeyedService>
|
||||
CefExtensionSystemFactory::BuildServiceInstanceForBrowserContext(
|
||||
BrowserContext* context) const {
|
||||
return new CefExtensionSystem(context);
|
||||
return std::make_unique<CefExtensionSystem>(context);
|
||||
}
|
||||
|
||||
BrowserContext* CefExtensionSystemFactory::GetBrowserContextToUse(
|
||||
|
@@ -30,7 +30,7 @@ class CefExtensionSystemFactory : public ExtensionSystemProvider {
|
||||
~CefExtensionSystemFactory() override;
|
||||
|
||||
// BrowserContextKeyedServiceFactory implementation:
|
||||
KeyedService* BuildServiceInstanceFor(
|
||||
std::unique_ptr<KeyedService> BuildServiceInstanceForBrowserContext(
|
||||
content::BrowserContext* context) const override;
|
||||
content::BrowserContext* GetBrowserContextToUse(
|
||||
content::BrowserContext* context) const override;
|
||||
|
@@ -14,9 +14,7 @@
|
||||
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "chrome/browser/printing/print_view_manager.h"
|
||||
#include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
|
||||
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
|
||||
#include "components/pdf/browser/pdf_web_contents_helper.h"
|
||||
#include "components/zoom/zoom_controller.h"
|
||||
#include "extensions/browser/guest_view/extensions_guest_view_manager_delegate.h"
|
||||
#include "printing/mojom/print.mojom.h"
|
||||
@@ -51,11 +49,6 @@ void CefExtensionsAPIClient::AttachWebContentsHelpers(
|
||||
PrefsTabHelper::CreateForWebContents(web_contents);
|
||||
printing::PrintViewManager::CreateForWebContents(web_contents);
|
||||
|
||||
// Used by the PDF extension.
|
||||
pdf::PDFWebContentsHelper::CreateForWebContentsWithClient(
|
||||
web_contents, std::unique_ptr<pdf::PDFWebContentsHelperClient>(
|
||||
new ChromePDFWebContentsHelperClient()));
|
||||
|
||||
// Used by the tabs extension API.
|
||||
zoom::ZoomController::CreateForWebContents(web_contents);
|
||||
}
|
||||
|
@@ -289,7 +289,7 @@ void CefFrameHostImpl::SendProcessMessage(
|
||||
SendToRenderFrame(
|
||||
__FUNCTION__,
|
||||
base::BindOnce(
|
||||
[](const CefString& name, base::ReadOnlySharedMemoryRegion region,
|
||||
[](const CefString& name, base::WritableSharedMemoryRegion region,
|
||||
const RenderFrameType& render_frame) {
|
||||
render_frame->SendSharedMemoryRegion(name, std::move(region));
|
||||
},
|
||||
@@ -644,7 +644,7 @@ void CefFrameHostImpl::SendMessage(const std::string& name,
|
||||
|
||||
void CefFrameHostImpl::SendSharedMemoryRegion(
|
||||
const std::string& name,
|
||||
base::ReadOnlySharedMemoryRegion region) {
|
||||
base::WritableSharedMemoryRegion region) {
|
||||
if (auto browser = GetBrowserHostBase()) {
|
||||
if (auto client = browser->GetClient()) {
|
||||
CefRefPtr<CefProcessMessage> message(
|
||||
|
@@ -138,7 +138,7 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
|
||||
void SendMessage(const std::string& name,
|
||||
base::Value::List arguments) override;
|
||||
void SendSharedMemoryRegion(const std::string& name,
|
||||
base::ReadOnlySharedMemoryRegion region) override;
|
||||
base::WritableSharedMemoryRegion region) override;
|
||||
void FrameAttached(mojo::PendingRemote<cef::mojom::RenderFrame> render_frame,
|
||||
bool reattached) override;
|
||||
void UpdateDraggableRegions(
|
||||
|
@@ -189,10 +189,10 @@ void CefMediaRouterManager::CreateRoute(
|
||||
const url::Origin& origin,
|
||||
CreateRouteResultCallback callback) {
|
||||
GetMediaRouter()->CreateRoute(
|
||||
source_id, sink_id, origin, nullptr /* web_contents */,
|
||||
source_id, sink_id, origin, /*web_contents=*/nullptr,
|
||||
base::BindOnce(&CefMediaRouterManager::OnCreateRoute,
|
||||
weak_ptr_factory_.GetWeakPtr(), std::move(callback)),
|
||||
base::Milliseconds(kTimeoutMs), false /* incognito */);
|
||||
base::Milliseconds(kTimeoutMs));
|
||||
}
|
||||
|
||||
void CefMediaRouterManager::SendRouteMessage(
|
||||
|
@@ -11,8 +11,8 @@
|
||||
|
||||
#include "base/no_destructor.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_impl.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/render_view_host.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
|
||||
#include "ui/events/keycodes/dom/dom_key.h"
|
||||
#include "ui/events/keycodes/dom/keycode_converter.h"
|
||||
|
@@ -15,13 +15,13 @@
|
||||
#include "libcef/browser/thread_util.h"
|
||||
|
||||
#include "base/apple/owned_objc.h"
|
||||
#include "base/mac/scoped_nsautorelease_pool.h"
|
||||
#include "base/apple/scoped_nsautorelease_pool.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "content/browser/renderer_host/render_widget_host_view_mac.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "content/public/browser/web_contents.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "third_party/blink/public/common/input/web_input_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
|
||||
@@ -254,7 +254,7 @@ void CefBrowserPlatformDelegateNativeMac::BrowserDestroyed(
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateNativeMac::CreateHostWindow() {
|
||||
base::mac::ScopedNSAutoreleasePool autorelease_pool;
|
||||
base::apple::ScopedNSAutoreleasePool autorelease_pool;
|
||||
|
||||
NSWindow* new_window = nil;
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/win/win_util.h"
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_event.h"
|
||||
#include "third_party/blink/public/common/input/web_mouse_wheel_event.h"
|
||||
#include "ui/aura/window.h"
|
||||
|
@@ -202,14 +202,8 @@ class CefBrowserURLRequest::Context
|
||||
scoped_refptr<base::SequencedTaskRunner> task_runner) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
// Get or create the request context and browser context.
|
||||
CefRefPtr<CefRequestContextImpl> request_context_impl =
|
||||
CefRequestContextImpl::GetOrCreateForRequestContext(request_context);
|
||||
CHECK(request_context_impl);
|
||||
CefBrowserContext* cef_browser_context =
|
||||
request_context_impl->GetBrowserContext();
|
||||
CHECK(cef_browser_context);
|
||||
auto browser_context = cef_browser_context->AsBrowserContext();
|
||||
auto* browser_context =
|
||||
CefRequestContextImpl::GetBrowserContext(request_context);
|
||||
CHECK(browser_context);
|
||||
|
||||
scoped_refptr<net_service::URLLoaderFactoryGetter> loader_factory_getter;
|
||||
|
@@ -292,7 +292,7 @@ void SaveCookies(const CefBrowserContext::Getter& browser_context_getter,
|
||||
std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create(
|
||||
request.url, cookie_string, base::Time::Now(),
|
||||
absl::make_optional(response_date), /*partition_key=*/absl::nullopt,
|
||||
&returned_status);
|
||||
/*block_truncated_cookies=*/true, &returned_status);
|
||||
if (!returned_status.IsInclude()) {
|
||||
continue;
|
||||
}
|
||||
|
@@ -274,8 +274,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
unhandled_request_callback_ = unhandled_request_callback;
|
||||
|
||||
// Default values for standard headers.
|
||||
accept_language_ = browser_prefs::GetAcceptLanguageList(
|
||||
cef_browser_context, browser.get());
|
||||
accept_language_ = browser_prefs::GetAcceptLanguageList(profile);
|
||||
DCHECK(!accept_language_.empty());
|
||||
user_agent_ =
|
||||
CefAppManager::Get()->GetContentClient()->browser()->GetUserAgent();
|
||||
|
@@ -347,6 +347,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
|
||||
CefDragDataImpl* data_impl = static_cast<CefDragDataImpl*>(drag_data.get());
|
||||
base::AutoLock lock_scope(data_impl->lock());
|
||||
content::DropData* drop_data = data_impl->drop_data();
|
||||
drop_data->document_is_handling_drag = document_is_handling_drag_;
|
||||
const gfx::Point& screen_pt =
|
||||
GetScreenPoint(client_pt, /*want_dip_coords=*/false);
|
||||
blink::DragOperationsMask ops =
|
||||
@@ -494,6 +495,7 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
|
||||
static_cast<CefDragDataImpl*>(drag_data_.get());
|
||||
base::AutoLock lock_scope(data_impl->lock());
|
||||
content::DropData* drop_data = data_impl->drop_data();
|
||||
drop_data->document_is_handling_drag = document_is_handling_drag_;
|
||||
int modifiers = TranslateWebEventModifiers(event.modifiers);
|
||||
|
||||
target_rwh->DragTargetDrop(*drop_data, transformed_pt,
|
||||
@@ -535,8 +537,11 @@ void CefBrowserPlatformDelegateOsr::StartDragging(
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateOsr::UpdateDragCursor(
|
||||
ui::mojom::DragOperation operation) {
|
||||
void CefBrowserPlatformDelegateOsr::UpdateDragOperation(
|
||||
ui::mojom::DragOperation operation,
|
||||
bool document_is_handling_drag) {
|
||||
document_is_handling_drag_ = document_is_handling_drag;
|
||||
|
||||
CefRefPtr<CefRenderHandler> handler =
|
||||
browser_->GetClient()->GetRenderHandler();
|
||||
if (handler.get()) {
|
||||
|
@@ -82,7 +82,8 @@ class CefBrowserPlatformDelegateOsr
|
||||
const gfx::Vector2d& image_offset,
|
||||
const blink::mojom::DragEventSourceInfo& event_info,
|
||||
content::RenderWidgetHostImpl* source_rwh) override;
|
||||
void UpdateDragCursor(ui::mojom::DragOperation operation) override;
|
||||
void UpdateDragOperation(ui::mojom::DragOperation operation,
|
||||
bool document_is_handling_drag) override;
|
||||
void DragSourceEndedAt(int x, int y, cef_drag_operations_mask_t op) override;
|
||||
void DragSourceSystemDragEnded() override;
|
||||
void AccessibilityEventReceived(
|
||||
@@ -125,11 +126,16 @@ class CefBrowserPlatformDelegateOsr
|
||||
// We also keep track of the RenderViewHost we're dragging over to avoid
|
||||
// sending the drag exited message after leaving the current
|
||||
// view. |current_rvh_for_drag_| should not be dereferenced.
|
||||
void* current_rvh_for_drag_;
|
||||
void* current_rvh_for_drag_ = nullptr;
|
||||
|
||||
// We keep track of the RenderWidgetHost from which the current drag started,
|
||||
// in order to properly route the drag end message to it.
|
||||
base::WeakPtr<content::RenderWidgetHostImpl> drag_start_rwh_;
|
||||
|
||||
// Set to true when the document is handling the drag. This means that the
|
||||
// document has registered an interest in the dropped data and the renderer
|
||||
// process should pass the data to the document on drop.
|
||||
bool document_is_handling_drag_ = false;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_BROWSER_OSR_BROWSER_PLATFORM_DELEGATE_OSR_H_
|
||||
|
@@ -108,7 +108,7 @@ struct PopulateAxNodeAttributes {
|
||||
case ax::mojom::IntAttribute::kInPageLinkTargetId:
|
||||
case ax::mojom::IntAttribute::kErrormessageIdDeprecated:
|
||||
case ax::mojom::IntAttribute::kDOMNodeId:
|
||||
case ax::mojom::IntAttribute::kDropeffect:
|
||||
case ax::mojom::IntAttribute::kDropeffectDeprecated:
|
||||
case ax::mojom::IntAttribute::kMemberOfId:
|
||||
case ax::mojom::IntAttribute::kNextFocusId:
|
||||
case ax::mojom::IntAttribute::kNextWindowFocusId:
|
||||
|
@@ -588,6 +588,17 @@ void CefRenderWidgetHostViewOSR::AddDamageRect(uint32_t sequence,
|
||||
damage_rects_[sequence] = rect;
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::InvalidateLocalSurfaceIdAndAllocationGroup() {
|
||||
InvalidateLocalSurfaceId();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ClearFallbackSurfaceForCommitPending() {
|
||||
if (delegated_frame_host_) {
|
||||
delegated_frame_host_->ClearFallbackSurfaceForCommitPending();
|
||||
}
|
||||
InvalidateLocalSurfaceId();
|
||||
}
|
||||
|
||||
void CefRenderWidgetHostViewOSR::ResetFallbackToFirstNavigationSurface() {
|
||||
if (delegated_frame_host_) {
|
||||
delegated_frame_host_->ResetFallbackToFirstNavigationSurface();
|
||||
|
@@ -154,6 +154,8 @@ class CefRenderWidgetHostViewOSR
|
||||
#endif // BUILDFLAG(IS_MAC)
|
||||
|
||||
// RenderWidgetHostViewBase implementation.
|
||||
void InvalidateLocalSurfaceIdAndAllocationGroup() override;
|
||||
void ClearFallbackSurfaceForCommitPending() override;
|
||||
void ResetFallbackToFirstNavigationSurface() override;
|
||||
void InitAsPopup(content::RenderWidgetHostView* parent_host_view,
|
||||
const gfx::Rect& bounds,
|
||||
|
@@ -44,32 +44,10 @@ void CefWebContentsViewOSR::RenderViewCreated() {
|
||||
}
|
||||
}
|
||||
|
||||
gfx::NativeView CefWebContentsViewOSR::GetNativeView() const {
|
||||
return gfx::NativeView();
|
||||
}
|
||||
|
||||
gfx::NativeView CefWebContentsViewOSR::GetContentNativeView() const {
|
||||
return gfx::NativeView();
|
||||
}
|
||||
|
||||
gfx::NativeWindow CefWebContentsViewOSR::GetTopLevelNativeWindow() const {
|
||||
return gfx::NativeWindow();
|
||||
}
|
||||
|
||||
gfx::Rect CefWebContentsViewOSR::GetContainerBounds() const {
|
||||
return GetViewBounds();
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::Focus() {}
|
||||
|
||||
void CefWebContentsViewOSR::SetInitialFocus() {}
|
||||
|
||||
void CefWebContentsViewOSR::StoreFocus() {}
|
||||
|
||||
void CefWebContentsViewOSR::RestoreFocus() {}
|
||||
|
||||
void CefWebContentsViewOSR::FocusThroughTabTraversal(bool reverse) {}
|
||||
|
||||
void CefWebContentsViewOSR::GotFocus(
|
||||
content::RenderWidgetHostImpl* render_widget_host) {
|
||||
if (web_contents_) {
|
||||
@@ -98,19 +76,11 @@ void CefWebContentsViewOSR::TakeFocus(bool reverse) {
|
||||
}
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::FullscreenStateChanged(bool is_fullscreen) {}
|
||||
|
||||
content::DropData* CefWebContentsViewOSR::GetDropData() const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
gfx::Rect CefWebContentsViewOSR::GetViewBounds() const {
|
||||
CefRenderWidgetHostViewOSR* view = GetView();
|
||||
return view ? view->GetViewBounds() : gfx::Rect();
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::CreateView(gfx::NativeView context) {}
|
||||
|
||||
content::RenderWidgetHostViewBase* CefWebContentsViewOSR::CreateViewForWidget(
|
||||
content::RenderWidgetHost* render_widget_host) {
|
||||
if (render_widget_host->GetView()) {
|
||||
@@ -135,29 +105,6 @@ CefWebContentsViewOSR::CreateViewForChildWidget(
|
||||
render_widget_host, view);
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::SetPageTitle(const std::u16string& title) {}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewReady() {
|
||||
RenderViewCreated();
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::RenderViewHostChanged(
|
||||
content::RenderViewHost* old_host,
|
||||
content::RenderViewHost* new_host) {}
|
||||
|
||||
void CefWebContentsViewOSR::SetOverscrollControllerEnabled(bool enabled) {}
|
||||
|
||||
void CefWebContentsViewOSR::OnCapturerCountChanged() {}
|
||||
|
||||
void CefWebContentsViewOSR::UpdateWindowControlsOverlay(
|
||||
const gfx::Rect& bounding_rect) {}
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
bool CefWebContentsViewOSR::CloseTabAfterEventTrackingIfNeeded() {
|
||||
return false;
|
||||
}
|
||||
#endif // BUILDFLAG(IS_MAC)
|
||||
|
||||
void CefWebContentsViewOSR::ShowContextMenu(
|
||||
content::RenderFrameHost& render_frame_host,
|
||||
const content::ContextMenuParams& params) {
|
||||
@@ -176,6 +123,7 @@ void CefWebContentsViewOSR::ShowContextMenu(
|
||||
|
||||
void CefWebContentsViewOSR::StartDragging(
|
||||
const content::DropData& drop_data,
|
||||
const url::Origin& source_origin,
|
||||
blink::DragOperationsMask allowed_ops,
|
||||
const gfx::ImageSkia& image,
|
||||
const gfx::Vector2d& cursor_offset,
|
||||
@@ -192,11 +140,12 @@ void CefWebContentsViewOSR::StartDragging(
|
||||
}
|
||||
}
|
||||
|
||||
void CefWebContentsViewOSR::UpdateDragCursor(
|
||||
ui::mojom::DragOperation operation) {
|
||||
void CefWebContentsViewOSR::UpdateDragOperation(
|
||||
ui::mojom::DragOperation operation,
|
||||
bool document_is_handling_drag) {
|
||||
CefRefPtr<AlloyBrowserHostImpl> browser = GetBrowser();
|
||||
if (browser.get()) {
|
||||
browser->UpdateDragCursor(operation);
|
||||
browser->UpdateDragOperation(operation, document_is_handling_drag);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -39,51 +39,58 @@ class CefWebContentsViewOSR : public content::WebContentsView,
|
||||
void RenderViewCreated();
|
||||
|
||||
// WebContentsView methods.
|
||||
gfx::NativeView GetNativeView() const override;
|
||||
gfx::NativeView GetContentNativeView() const override;
|
||||
gfx::NativeWindow GetTopLevelNativeWindow() const override;
|
||||
gfx::NativeView GetNativeView() const override { return gfx::NativeView(); }
|
||||
gfx::NativeView GetContentNativeView() const override {
|
||||
return gfx::NativeView();
|
||||
}
|
||||
gfx::NativeWindow GetTopLevelNativeWindow() const override {
|
||||
return gfx::NativeWindow();
|
||||
}
|
||||
gfx::Rect GetContainerBounds() const override;
|
||||
void Focus() override;
|
||||
void SetInitialFocus() override;
|
||||
void StoreFocus() override;
|
||||
void RestoreFocus() override;
|
||||
void FocusThroughTabTraversal(bool reverse) override;
|
||||
content::DropData* GetDropData() const override;
|
||||
void Focus() override {}
|
||||
void SetInitialFocus() override {}
|
||||
void StoreFocus() override {}
|
||||
void RestoreFocus() override {}
|
||||
void FocusThroughTabTraversal(bool reverse) override {}
|
||||
content::DropData* GetDropData() const override { return nullptr; }
|
||||
gfx::Rect GetViewBounds() const override;
|
||||
void CreateView(gfx::NativeView context) override;
|
||||
void CreateView(gfx::NativeView context) override {}
|
||||
content::RenderWidgetHostViewBase* CreateViewForWidget(
|
||||
content::RenderWidgetHost* render_widget_host) override;
|
||||
content::RenderWidgetHostViewBase* CreateViewForChildWidget(
|
||||
content::RenderWidgetHost* render_widget_host) override;
|
||||
void SetPageTitle(const std::u16string& title) override;
|
||||
void RenderViewReady() override;
|
||||
void SetPageTitle(const std::u16string& title) override {}
|
||||
void RenderViewReady() override {}
|
||||
void RenderViewHostChanged(content::RenderViewHost* old_host,
|
||||
content::RenderViewHost* new_host) override;
|
||||
void SetOverscrollControllerEnabled(bool enabled) override;
|
||||
void OnCapturerCountChanged() override;
|
||||
void UpdateWindowControlsOverlay(const gfx::Rect& bounding_rect) override;
|
||||
content::RenderViewHost* new_host) override {}
|
||||
void SetOverscrollControllerEnabled(bool enabled) override {}
|
||||
void OnCapturerCountChanged() override {}
|
||||
void UpdateWindowControlsOverlay(const gfx::Rect& bounding_rect) override {}
|
||||
void CancelDragDropForPortalActivation() override {}
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
bool CloseTabAfterEventTrackingIfNeeded() override;
|
||||
bool CloseTabAfterEventTrackingIfNeeded() override { return false; }
|
||||
#endif
|
||||
|
||||
// RenderViewHostDelegateView methods.
|
||||
void ShowContextMenu(content::RenderFrameHost& render_frame_host,
|
||||
const content::ContextMenuParams& params) override;
|
||||
void StartDragging(const content::DropData& drop_data,
|
||||
const url::Origin& source_origin,
|
||||
blink::DragOperationsMask allowed_ops,
|
||||
const gfx::ImageSkia& image,
|
||||
const gfx::Vector2d& cursor_offset,
|
||||
const gfx::Rect& drag_obj_rect,
|
||||
const blink::mojom::DragEventSourceInfo& event_info,
|
||||
content::RenderWidgetHostImpl* source_rwh) override;
|
||||
void UpdateDragCursor(ui::mojom::DragOperation operation) override;
|
||||
void UpdateDragOperation(ui::mojom::DragOperation operation,
|
||||
bool document_is_handling_drag) override;
|
||||
virtual void GotFocus(
|
||||
content::RenderWidgetHostImpl* render_widget_host) override;
|
||||
virtual void LostFocus(
|
||||
content::RenderWidgetHostImpl* render_widget_host) override;
|
||||
virtual void TakeFocus(bool reverse) override;
|
||||
virtual void FullscreenStateChanged(bool is_fullscreen) override;
|
||||
virtual void FullscreenStateChanged(bool is_fullscreen) override {}
|
||||
|
||||
private:
|
||||
CefRenderWidgetHostViewOSR* GetView() const;
|
||||
|
@@ -5,7 +5,6 @@
|
||||
#include "libcef/browser/prefs/browser_prefs.h"
|
||||
|
||||
#include "libcef/browser/browser_context.h"
|
||||
#include "libcef/browser/browser_host_base.h"
|
||||
#include "libcef/browser/context.h"
|
||||
#include "libcef/browser/media_capture_devices_dispatcher.h"
|
||||
#include "libcef/browser/prefs/pref_registrar.h"
|
||||
@@ -26,8 +25,8 @@
|
||||
#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/prefetch/prefetch_prefs.h"
|
||||
#include "chrome/browser/prefs/chrome_command_line_pref_store.h"
|
||||
#include "chrome/browser/preloading/preloading_prefs.h"
|
||||
#include "chrome/browser/printing/print_preview_sticky_settings.h"
|
||||
#include "chrome/browser/profiles/profile.h"
|
||||
#include "chrome/browser/ssl/ssl_config_service_manager.h"
|
||||
@@ -41,6 +40,7 @@
|
||||
#include "components/component_updater/component_updater_service.h"
|
||||
#include "components/content_settings/core/browser/cookie_settings.h"
|
||||
#include "components/content_settings/core/browser/host_content_settings_map.h"
|
||||
#include "components/content_settings/core/common/pref_names.h"
|
||||
#include "components/domain_reliability/domain_reliability_prefs.h"
|
||||
#include "components/flags_ui/pref_service_flags_storage.h"
|
||||
#include "components/keyed_service/content/browser_context_dependency_manager.h"
|
||||
@@ -55,7 +55,7 @@
|
||||
#include "components/prefs/pref_filter.h"
|
||||
#include "components/prefs/pref_registry_simple.h"
|
||||
#include "components/prefs/pref_service.h"
|
||||
#include "components/privacy_sandbox/privacy_sandbox_prefs.h"
|
||||
#include "components/privacy_sandbox/tracking_protection_prefs.h"
|
||||
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
|
||||
#include "components/proxy_config/proxy_config_dictionary.h"
|
||||
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
|
||||
@@ -94,17 +94,9 @@ std::string ComputeAcceptLanguageFromPref(const std::string& language_pref) {
|
||||
return net::HttpUtil::GenerateAcceptLanguageHeader(accept_languages_str);
|
||||
}
|
||||
|
||||
// Return the most relevant setting based on |browser_context| and |browser|.
|
||||
std::string GetAcceptLanguageListSetting(CefBrowserContext* browser_context,
|
||||
CefBrowserHostBase* browser) {
|
||||
if (browser) {
|
||||
const auto& settings = browser->settings();
|
||||
if (settings.accept_language_list.length > 0) {
|
||||
return CefString(&settings.accept_language_list);
|
||||
}
|
||||
}
|
||||
|
||||
if (browser_context) {
|
||||
// Return the most relevant setting based on |profile|.
|
||||
std::string GetAcceptLanguageListSetting(Profile* profile) {
|
||||
if (auto* browser_context = CefBrowserContext::FromProfile(profile)) {
|
||||
const auto& settings = browser_context->settings();
|
||||
if (settings.accept_language_list.length > 0) {
|
||||
return CefString(&settings.accept_language_list);
|
||||
@@ -277,7 +269,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
permissions::PermissionHatsTriggerHelper::RegisterProfilePrefs(
|
||||
registry.get());
|
||||
prefetch::RegisterPredictionOptionsProfilePrefs(registry.get());
|
||||
privacy_sandbox::RegisterProfilePrefs(registry.get());
|
||||
privacy_sandbox::tracking_protection::RegisterProfilePrefs(registry.get());
|
||||
ProfileNetworkContextService::RegisterProfilePrefs(registry.get());
|
||||
safe_browsing::RegisterProfilePrefs(registry.get());
|
||||
unified_consent::UnifiedConsentService::RegisterPrefs(registry.get());
|
||||
@@ -299,7 +291,6 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
!extensions::PrintPreviewEnabled());
|
||||
registry->RegisterStringPref(
|
||||
prefs::kPrintPreviewDefaultDestinationSelectionRules, std::string());
|
||||
registry->RegisterBooleanPref(prefs::kCloudPrintSubmitEnabled, false);
|
||||
registry->RegisterBooleanPref(prefs::kEnableMediaRouter, true);
|
||||
printing::PolicySettings::RegisterProfilePrefs(registry.get());
|
||||
printing::PrintPreviewStickySettings::RegisterProfilePrefs(registry.get());
|
||||
@@ -321,6 +312,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
// Based on browser_prefs::RegisterProfilePrefs.
|
||||
registry->RegisterBooleanPref(prefs::kAccessibilityPdfOcrAlwaysActive,
|
||||
false);
|
||||
registry->RegisterBooleanPref(prefs::kBlockTruncatedCookies, true);
|
||||
|
||||
// Spell checking preferences.
|
||||
// Modify defaults from SpellcheckServiceFactory::RegisterProfilePrefs.
|
||||
@@ -345,8 +337,8 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
|
||||
// Language preferences. Used by ProfileNetworkContextService and
|
||||
// InterceptedRequestHandlerWrapper.
|
||||
const std::string& accept_language_list = GetAcceptLanguageListSetting(
|
||||
CefBrowserContext::FromProfile(profile), /*browser=*/nullptr);
|
||||
const std::string& accept_language_list =
|
||||
GetAcceptLanguageListSetting(profile);
|
||||
if (!accept_language_list.empty()) {
|
||||
registry->SetDefaultPrefValue(language::prefs::kAcceptLanguages,
|
||||
base::Value(accept_language_list));
|
||||
@@ -364,19 +356,17 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
return factory.CreateSyncable(registry.get());
|
||||
}
|
||||
|
||||
std::string GetAcceptLanguageList(CefBrowserContext* browser_context,
|
||||
CefBrowserHostBase* browser) {
|
||||
std::string GetAcceptLanguageList(Profile* profile) {
|
||||
// Always prefer to the CEF settings configuration, if specified.
|
||||
std::string accept_language_list =
|
||||
GetAcceptLanguageListSetting(browser_context, browser);
|
||||
if (accept_language_list.empty() && browser_context) {
|
||||
std::string accept_language_list = GetAcceptLanguageListSetting(profile);
|
||||
if (accept_language_list.empty() && profile) {
|
||||
// Fall back to the preference value. For the Alloy runtime the default
|
||||
// value comes from browser_prefs::CreatePrefService() above. For the Chrome
|
||||
// runtime the default value comes from the configured locale
|
||||
// (IDS_ACCEPT_LANGUAGES) which is then overridden by the user preference in
|
||||
// chrome://settings/languages, all managed by language::LanguagePrefs.
|
||||
auto prefs = browser_context->AsProfile()->GetPrefs();
|
||||
accept_language_list = prefs->GetString(language::prefs::kAcceptLanguages);
|
||||
accept_language_list =
|
||||
profile->GetPrefs()->GetString(language::prefs::kAcceptLanguages);
|
||||
}
|
||||
|
||||
if (!accept_language_list.empty()) {
|
||||
@@ -389,8 +379,8 @@ void SetInitialProfilePrefs(Profile* profile) {
|
||||
auto* prefs = profile->GetPrefs();
|
||||
|
||||
// Language preferences.
|
||||
const std::string& accept_language_list = GetAcceptLanguageListSetting(
|
||||
CefBrowserContext::FromProfile(profile), /*browser=*/nullptr);
|
||||
const std::string& accept_language_list =
|
||||
GetAcceptLanguageListSetting(profile);
|
||||
if (!accept_language_list.empty()) {
|
||||
// Used by ProfileNetworkContextService and InterceptedRequestHandlerWrapper
|
||||
// (via GetAcceptLanguageList) for request headers, and
|
||||
|
@@ -11,8 +11,6 @@ namespace base {
|
||||
class FilePath;
|
||||
}
|
||||
|
||||
class CefBrowserContext;
|
||||
class CefBrowserHostBase;
|
||||
class PrefRegistrySimple;
|
||||
class PrefService;
|
||||
class Profile;
|
||||
@@ -36,8 +34,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
|
||||
// Returns the value for populating the accept-language HTTP request header.
|
||||
// |browser_context| and/or |browser| may be nullptr. If |expand| is true then
|
||||
// base languages and Q values may be added.
|
||||
std::string GetAcceptLanguageList(CefBrowserContext* browser_context,
|
||||
CefBrowserHostBase* browser);
|
||||
std::string GetAcceptLanguageList(Profile* profile);
|
||||
|
||||
// Set preferences for a newly initialized Profile.
|
||||
void SetInitialProfilePrefs(Profile* profile);
|
||||
|
@@ -103,7 +103,7 @@ void SetChromePrefs(Profile* profile, blink::web_pref::WebPreferences& web) {
|
||||
web.allow_running_insecure_content =
|
||||
prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent);
|
||||
|
||||
web.password_echo_enabled = browser_defaults::kPasswordEchoEnabled;
|
||||
web.password_echo_enabled = false;
|
||||
|
||||
web.text_areas_are_resizable =
|
||||
prefs->GetBoolean(prefs::kWebKitTextAreasAreResizable);
|
||||
@@ -347,9 +347,6 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
|
||||
RegisterAnimationPolicyPrefs(registry);
|
||||
|
||||
// From chrome/browser/ui/browser_ui_prefs.cc RegisterBrowserUserPrefs.
|
||||
registry->RegisterBooleanPref(
|
||||
prefs::kEnableDoNotTrack, false,
|
||||
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
|
||||
registry->RegisterBooleanPref(prefs::kCaretBrowsingEnabled, false);
|
||||
|
||||
registry->RegisterStringPref(prefs::kWebRTCIPHandlingPolicy,
|
||||
|
@@ -229,6 +229,14 @@ void CefPrintDialogLinux::UpdateSettings(
|
||||
UpdateSettings(std::move(settings), false);
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_OOP_PRINTING_NO_OOP_BASIC_PRINT_DIALOG)
|
||||
void CefPrintDialogLinux::LoadPrintSettings(
|
||||
const printing::PrintSettings& settings) {
|
||||
// TODO(linux): Need to read data from |settings.system_print_dialog_data()|?
|
||||
UseDefaultSettings();
|
||||
}
|
||||
#endif
|
||||
|
||||
void CefPrintDialogLinux::ShowDialog(
|
||||
gfx::NativeView parent_view,
|
||||
bool has_selection,
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "base/task/sequenced_task_runner_helpers.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
#include "printing/print_dialog_linux_interface.h"
|
||||
#include "ui/linux/linux_ui.h"
|
||||
|
||||
@@ -56,6 +57,9 @@ class CefPrintDialogLinux : public printing::PrintDialogLinuxInterface,
|
||||
void UseDefaultSettings() override;
|
||||
void UpdateSettings(
|
||||
std::unique_ptr<printing::PrintSettings> settings) override;
|
||||
#if BUILDFLAG(ENABLE_OOP_PRINTING_NO_OOP_BASIC_PRINT_DIALOG)
|
||||
void LoadPrintSettings(const printing::PrintSettings& settings) override;
|
||||
#endif
|
||||
void ShowDialog(
|
||||
gfx::NativeView parent_view,
|
||||
bool has_selection,
|
||||
|
@@ -89,6 +89,17 @@ class ResolveHostHelper : public network::ResolveHostClientBase {
|
||||
mojo::Receiver<network::mojom::ResolveHostClient> receiver_{this};
|
||||
};
|
||||
|
||||
CefBrowserContext* GetCefBrowserContext(
|
||||
CefRefPtr<CefRequestContext> request_context) {
|
||||
CEF_REQUIRE_UIT();
|
||||
CefRefPtr<CefRequestContextImpl> request_context_impl =
|
||||
CefRequestContextImpl::GetOrCreateForRequestContext(request_context);
|
||||
CHECK(request_context_impl);
|
||||
auto* cef_browser_context = request_context_impl->GetBrowserContext();
|
||||
CHECK(cef_browser_context);
|
||||
return cef_browser_context;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
// CefBrowserContext
|
||||
@@ -184,6 +195,21 @@ CefRequestContextImpl::GetOrCreateForRequestContext(
|
||||
return CefRequestContextImpl::GetOrCreateRequestContext(config);
|
||||
}
|
||||
|
||||
content::BrowserContext* CefRequestContextImpl::GetBrowserContext(
|
||||
CefRefPtr<CefRequestContext> request_context) {
|
||||
auto* browser_context =
|
||||
GetCefBrowserContext(request_context)->AsBrowserContext();
|
||||
CHECK(browser_context);
|
||||
return browser_context;
|
||||
}
|
||||
|
||||
Profile* CefRequestContextImpl::GetProfile(
|
||||
CefRefPtr<CefRequestContext> request_context) {
|
||||
auto* profile = GetCefBrowserContext(request_context)->AsProfile();
|
||||
CHECK(profile);
|
||||
return profile;
|
||||
}
|
||||
|
||||
bool CefRequestContextImpl::VerifyBrowserContext() const {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
|
@@ -38,6 +38,15 @@ class CefRequestContextImpl : public CefRequestContext {
|
||||
static CefRefPtr<CefRequestContextImpl> GetOrCreateForRequestContext(
|
||||
CefRefPtr<CefRequestContext> request_context);
|
||||
|
||||
// Returns the BrowserContext for the specified |request_context|. Will return
|
||||
// the global BrowserContext if |request_context| is NULL.
|
||||
static content::BrowserContext* GetBrowserContext(
|
||||
CefRefPtr<CefRequestContext> request_context);
|
||||
|
||||
// Returns the Profile for the specified |request_context|. Will return the
|
||||
// global Profile if |request_context| is NULL.
|
||||
static Profile* GetProfile(CefRefPtr<CefRequestContext> request_context);
|
||||
|
||||
// Verify that the browser context can be directly accessed (e.g. on the UI
|
||||
// thread and initialized).
|
||||
bool VerifyBrowserContext() const;
|
||||
|
@@ -12,7 +12,7 @@
|
||||
#include "libcef/browser/thread_util.h"
|
||||
#include "libcef/browser/views/window_impl.h"
|
||||
|
||||
#include "content/public/browser/native_web_keyboard_event.h"
|
||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/content_accelerators/accelerator_util.h"
|
||||
|
||||
|
@@ -121,12 +121,18 @@ void CefNativeWidgetMac::OnWindowFullscreenTransitionStart() {
|
||||
views::NativeWidgetMac::OnWindowFullscreenTransitionStart();
|
||||
if (IsCefWindowInitialized()) {
|
||||
window_delegate_->OnWindowFullscreenTransition(window_, false);
|
||||
if (browser_view_) {
|
||||
browser_view_->FullscreenStateChanging();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CefNativeWidgetMac::OnWindowFullscreenTransitionComplete() {
|
||||
views::NativeWidgetMac::OnWindowFullscreenTransitionComplete();
|
||||
if (IsCefWindowInitialized()) {
|
||||
if (browser_view_) {
|
||||
browser_view_->FullscreenStateChanged();
|
||||
}
|
||||
window_delegate_->OnWindowFullscreenTransition(window_, true);
|
||||
}
|
||||
}
|
||||
|
@@ -33,21 +33,22 @@
|
||||
if (!in_full_screen_) {
|
||||
bool override_titlebar_height = false;
|
||||
float titlebar_height = 0;
|
||||
auto* window = base::mac::ObjCCast<CefNSWindow>([self window]);
|
||||
auto* window = base::apple::ObjCCast<CefNSWindow>([self window]);
|
||||
if (auto* bridge = [window bridge]) {
|
||||
bridge->host()->GetWindowFrameTitlebarHeight(&override_titlebar_height,
|
||||
&titlebar_height);
|
||||
|
||||
if (override_titlebar_height)
|
||||
if (override_titlebar_height) {
|
||||
return titlebar_height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [super _titlebarHeight];
|
||||
}
|
||||
|
||||
- (BOOL)_shouldCenterTrafficLights {
|
||||
auto* window = base::mac::ObjCCast<CefNSWindow>([self window]);
|
||||
auto* window = base::apple::ObjCCast<CefNSWindow>([self window]);
|
||||
return [window shouldCenterTrafficLights];
|
||||
}
|
||||
|
||||
|
@@ -669,7 +669,8 @@ void CefWindowImpl::SetAccelerator(int command_id,
|
||||
int key_code,
|
||||
bool shift_pressed,
|
||||
bool ctrl_pressed,
|
||||
bool alt_pressed) {
|
||||
bool alt_pressed,
|
||||
bool high_priority) {
|
||||
CEF_REQUIRE_VALID_RETURN_VOID();
|
||||
if (!widget_) {
|
||||
return;
|
||||
@@ -698,7 +699,10 @@ void CefWindowImpl::SetAccelerator(int command_id,
|
||||
views::FocusManager* focus_manager = widget_->GetFocusManager();
|
||||
DCHECK(focus_manager);
|
||||
focus_manager->RegisterAccelerator(
|
||||
accelerator, ui::AcceleratorManager::kNormalPriority, this);
|
||||
accelerator,
|
||||
high_priority ? ui::AcceleratorManager::kHighPriority
|
||||
: ui::AcceleratorManager::kNormalPriority,
|
||||
this);
|
||||
}
|
||||
|
||||
void CefWindowImpl::RemoveAccelerator(int command_id) {
|
||||
|
@@ -86,7 +86,8 @@ class CefWindowImpl
|
||||
int key_code,
|
||||
bool shift_pressed,
|
||||
bool ctrl_pressed,
|
||||
bool alt_pressed) override;
|
||||
bool alt_pressed,
|
||||
bool high_priority) override;
|
||||
void RemoveAccelerator(int command_id) override;
|
||||
void RemoveAllAccelerators() override;
|
||||
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "base/lazy_instance.h"
|
||||
#include "base/threading/threading_features.h"
|
||||
#include "chrome/browser/metrics/chrome_feature_list_creator.h"
|
||||
#include "chrome/browser/policy/chrome_browser_policy_connector.h"
|
||||
#include "chrome/common/chrome_switches.h"
|
||||
#include "chrome/common/pref_names.h"
|
||||
#include "components/embedder_support/switches.h"
|
||||
@@ -208,6 +209,13 @@ absl::optional<int> ChromeMainDelegateCef::PreBrowserMain() {
|
||||
|
||||
absl::optional<int> ChromeMainDelegateCef::PostEarlyInitialization(
|
||||
InvokedIn invoked_in) {
|
||||
// Configure this before ChromeMainDelegate::PostEarlyInitialization triggers
|
||||
// ChromeBrowserPolicyConnector creation.
|
||||
if (settings_ && settings_->chrome_policy_id.length > 0) {
|
||||
policy::ChromeBrowserPolicyConnector::EnablePlatformPolicySupport(
|
||||
CefString(&settings_->chrome_policy_id).ToString());
|
||||
}
|
||||
|
||||
const auto result = ChromeMainDelegate::PostEarlyInitialization(invoked_in);
|
||||
if (!result) {
|
||||
const auto* invoked_in_browser =
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#include "content/public/common/content_switches.h"
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
#include "base/mac/foundation_util.h"
|
||||
#include "base/apple/foundation_util.h"
|
||||
#include "components/crash/core/common/crash_keys.h"
|
||||
#include "content/public/common/content_paths.h"
|
||||
#endif
|
||||
@@ -103,18 +103,18 @@ void InitCrashReporter(const base::CommandLine& command_line,
|
||||
// framework dylib is even loaded, to catch potential early crashes.
|
||||
crash_reporter::InitializeCrashpad(process_type.empty(), process_type);
|
||||
|
||||
if (base::mac::AmIBundled()) {
|
||||
if (base::apple::AmIBundled()) {
|
||||
// Mac Chrome is packaged with a main app bundle and a helper app bundle.
|
||||
// The main app bundle should only be used for the browser process, so it
|
||||
// should never see a --type switch (switches::kProcessType). Likewise,
|
||||
// the helper should always have a --type switch.
|
||||
//
|
||||
// This check is done this late so there is already a call to
|
||||
// base::mac::IsBackgroundOnlyProcess(), so there is no change in
|
||||
// base::apple::IsBackgroundOnlyProcess(), so there is no change in
|
||||
// startup/initialization order.
|
||||
|
||||
// The helper's Info.plist marks it as a background only app.
|
||||
if (base::mac::IsBackgroundOnlyProcess()) {
|
||||
if (base::apple::IsBackgroundOnlyProcess()) {
|
||||
CHECK(command_line.HasSwitch(switches::kProcessType) &&
|
||||
!process_type.empty())
|
||||
<< "Helper application requires --type.";
|
||||
|
@@ -126,7 +126,7 @@ bool CefDragDataImpl::GetFileNames(std::vector<CefString>& names) {
|
||||
for (; it != data_.filenames.end(); ++it) {
|
||||
auto name = it->display_name.value();
|
||||
if (name.empty()) {
|
||||
name = it->path.value();
|
||||
name = it->path.BaseName().value();
|
||||
}
|
||||
names.push_back(name);
|
||||
}
|
||||
@@ -134,6 +134,21 @@ bool CefDragDataImpl::GetFileNames(std::vector<CefString>& names) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CefDragDataImpl::GetFilePaths(std::vector<CefString>& paths) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
if (data_.filenames.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<ui::FileInfo>::const_iterator it = data_.filenames.begin();
|
||||
for (; it != data_.filenames.end(); ++it) {
|
||||
auto path = it->path.value();
|
||||
paths.push_back(path);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CefDragDataImpl::SetLinkURL(const CefString& url) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
CHECK_READONLY_RETURN_VOID();
|
||||
|
@@ -37,6 +37,7 @@ class CefDragDataImpl : public CefDragData {
|
||||
CefString GetFileName() override;
|
||||
size_t GetFileContents(CefRefPtr<CefStreamWriter> writer) override;
|
||||
bool GetFileNames(std::vector<CefString>& names) override;
|
||||
bool GetFilePaths(std::vector<CefString>& paths) override;
|
||||
void SetLinkURL(const CefString& url) override;
|
||||
void SetLinkTitle(const CefString& title) override;
|
||||
void SetLinkMetadata(const CefString& data) override;
|
||||
|
@@ -59,7 +59,7 @@ interface RenderFrame {
|
||||
SendMessage(string name, mojo_base.mojom.ListValue arguments);
|
||||
|
||||
// Send a shared memory region to the render process.
|
||||
SendSharedMemoryRegion(string name, mojo_base.mojom.ReadOnlySharedMemoryRegion region);
|
||||
SendSharedMemoryRegion(string name, mojo_base.mojom.WritableSharedMemoryRegion region);
|
||||
|
||||
// Send a command.
|
||||
SendCommand(string command);
|
||||
@@ -91,7 +91,7 @@ interface BrowserFrame {
|
||||
SendMessage(string name, mojo_base.mojom.ListValue arguments);
|
||||
|
||||
// Send a shared memory region to the browser process.
|
||||
SendSharedMemoryRegion(string name, mojo_base.mojom.ReadOnlySharedMemoryRegion region);
|
||||
SendSharedMemoryRegion(string name, mojo_base.mojom.WritableSharedMemoryRegion region);
|
||||
|
||||
// The render frame is ready to begin handling actions.
|
||||
FrameAttached(pending_remote<RenderFrame> render_frame,
|
||||
|
@@ -12,7 +12,7 @@ namespace {
|
||||
|
||||
class CefSharedMemoryRegionImpl final : public CefSharedMemoryRegion {
|
||||
public:
|
||||
CefSharedMemoryRegionImpl(base::ReadOnlySharedMemoryMapping&& mapping)
|
||||
CefSharedMemoryRegionImpl(base::WritableSharedMemoryMapping&& mapping)
|
||||
: mapping_(std::move(mapping)) {}
|
||||
CefSharedMemoryRegionImpl(const CefSharedMemoryRegionImpl&) = delete;
|
||||
CefSharedMemoryRegionImpl& operator=(const CefSharedMemoryRegionImpl&) =
|
||||
@@ -21,10 +21,10 @@ class CefSharedMemoryRegionImpl final : public CefSharedMemoryRegion {
|
||||
// CefSharedMemoryRegion methods
|
||||
bool IsValid() override { return mapping_.IsValid(); }
|
||||
size_t Size() override { return IsValid() ? mapping_.size() : 0; }
|
||||
const void* Memory() override { return mapping_.memory(); }
|
||||
void* Memory() override { return mapping_.memory(); }
|
||||
|
||||
private:
|
||||
base::ReadOnlySharedMemoryMapping mapping_;
|
||||
base::WritableSharedMemoryMapping mapping_;
|
||||
IMPLEMENT_REFCOUNTING(CefSharedMemoryRegionImpl);
|
||||
};
|
||||
|
||||
@@ -32,7 +32,7 @@ class CefSharedMemoryRegionImpl final : public CefSharedMemoryRegion {
|
||||
|
||||
CefProcessMessageSMRImpl::CefProcessMessageSMRImpl(
|
||||
const CefString& name,
|
||||
base::ReadOnlySharedMemoryRegion&& region)
|
||||
base::WritableSharedMemoryRegion&& region)
|
||||
: name_(name), region_(std::move(region)) {
|
||||
DCHECK(!name_.empty());
|
||||
DCHECK(region_.IsValid());
|
||||
@@ -53,7 +53,7 @@ CefProcessMessageSMRImpl::GetSharedMemoryRegion() {
|
||||
return new CefSharedMemoryRegionImpl(region_.Map());
|
||||
}
|
||||
|
||||
base::ReadOnlySharedMemoryRegion CefProcessMessageSMRImpl::TakeRegion() {
|
||||
base::WritableSharedMemoryRegion CefProcessMessageSMRImpl::TakeRegion() {
|
||||
return std::move(region_);
|
||||
}
|
||||
|
||||
@@ -68,23 +68,27 @@ CefSharedProcessMessageBuilderImpl::CefSharedProcessMessageBuilderImpl(
|
||||
const CefString& name,
|
||||
size_t byte_size)
|
||||
: name_(name),
|
||||
region_(base::ReadOnlySharedMemoryRegion::Create(byte_size)) {}
|
||||
region_(base::WritableSharedMemoryRegion::Create(byte_size)),
|
||||
mapping_(region_.Map()) {}
|
||||
|
||||
bool CefSharedProcessMessageBuilderImpl::IsValid() {
|
||||
return region_.region.IsValid() && region_.mapping.IsValid();
|
||||
return region_.IsValid() && mapping_.IsValid();
|
||||
}
|
||||
|
||||
size_t CefSharedProcessMessageBuilderImpl::Size() {
|
||||
return !IsValid() ? 0 : region_.mapping.size();
|
||||
return !IsValid() ? 0 : region_.GetSize();
|
||||
}
|
||||
|
||||
void* CefSharedProcessMessageBuilderImpl::Memory() {
|
||||
return !IsValid() ? nullptr : region_.mapping.memory();
|
||||
return !IsValid() ? nullptr : mapping_.memory();
|
||||
}
|
||||
|
||||
CefRefPtr<CefProcessMessage> CefSharedProcessMessageBuilderImpl::Build() {
|
||||
if (!IsValid()) {
|
||||
return nullptr;
|
||||
}
|
||||
return new CefProcessMessageSMRImpl(name_, std::move(region_.region));
|
||||
|
||||
// Invalidate mappping
|
||||
mapping_ = base::WritableSharedMemoryMapping();
|
||||
return new CefProcessMessageSMRImpl(name_, std::move(region_));
|
||||
}
|
@@ -9,12 +9,12 @@
|
||||
#include "include/cef_process_message.h"
|
||||
#include "include/cef_shared_process_message_builder.h"
|
||||
|
||||
#include "base/memory/read_only_shared_memory_region.h"
|
||||
#include "base/memory/writable_shared_memory_region.h"
|
||||
|
||||
class CefProcessMessageSMRImpl final : public CefProcessMessage {
|
||||
public:
|
||||
CefProcessMessageSMRImpl(const CefString& name,
|
||||
base::ReadOnlySharedMemoryRegion&& region);
|
||||
base::WritableSharedMemoryRegion&& region);
|
||||
CefProcessMessageSMRImpl(const CefProcessMessageSMRImpl&) = delete;
|
||||
CefProcessMessageSMRImpl& operator=(const CefProcessMessageSMRImpl&) = delete;
|
||||
~CefProcessMessageSMRImpl() override;
|
||||
@@ -26,11 +26,11 @@ class CefProcessMessageSMRImpl final : public CefProcessMessage {
|
||||
CefString GetName() override;
|
||||
CefRefPtr<CefListValue> GetArgumentList() override { return nullptr; }
|
||||
CefRefPtr<CefSharedMemoryRegion> GetSharedMemoryRegion() override;
|
||||
[[nodiscard]] base::ReadOnlySharedMemoryRegion TakeRegion();
|
||||
[[nodiscard]] base::WritableSharedMemoryRegion TakeRegion();
|
||||
|
||||
private:
|
||||
const CefString name_;
|
||||
base::ReadOnlySharedMemoryRegion region_;
|
||||
base::WritableSharedMemoryRegion region_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefProcessMessageSMRImpl);
|
||||
};
|
||||
@@ -50,7 +50,8 @@ class CefSharedProcessMessageBuilderImpl final
|
||||
|
||||
private:
|
||||
const CefString name_;
|
||||
base::MappedReadOnlyRegion region_;
|
||||
base::WritableSharedMemoryRegion region_;
|
||||
base::WritableSharedMemoryMapping mapping_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(CefSharedProcessMessageBuilderImpl);
|
||||
};
|
||||
|
@@ -170,9 +170,6 @@ void GetHeaderMap(const CefRequest::HeaderMap& source,
|
||||
return; \
|
||||
}
|
||||
|
||||
#define SETBOOLFLAG(obj, flags, method, FLAG) \
|
||||
obj.method((flags & (FLAG)) == (FLAG))
|
||||
|
||||
// CefRequest -----------------------------------------------------------------
|
||||
|
||||
// static
|
||||
@@ -611,9 +608,11 @@ void CefRequestImpl::Get(const cef::mojom::RequestParamsPtr& params,
|
||||
}
|
||||
request.SetCacheMode(GetFetchCacheMode(flags));
|
||||
|
||||
SETBOOLFLAG(request, params->load_flags, SetAllowStoredCredentials,
|
||||
UR_FLAG_ALLOW_STORED_CREDENTIALS);
|
||||
SETBOOLFLAG(request, params->load_flags, SetReportUploadProgress,
|
||||
request.SetCredentialsMode(
|
||||
(params->load_flags & UR_FLAG_ALLOW_STORED_CREDENTIALS)
|
||||
? network::mojom::CredentialsMode::kInclude
|
||||
: network::mojom::CredentialsMode::kOmit);
|
||||
request.SetReportUploadProgress(params->load_flags &
|
||||
UR_FLAG_REPORT_UPLOAD_PROGRESS);
|
||||
}
|
||||
|
||||
|
@@ -22,7 +22,7 @@
|
||||
#include "ui/base/layout.h"
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
#include "base/mac/foundation_util.h"
|
||||
#include "base/apple/foundation_util.h"
|
||||
#include "libcef/common/util_mac.h"
|
||||
#endif
|
||||
|
||||
@@ -166,7 +166,7 @@ base::FilePath GetResourcesDir() {
|
||||
// of the running executable.
|
||||
base::FilePath GetDefaultLogFilePath() {
|
||||
std::string exe_name = util_mac::GetMainProcessPath().BaseName().value();
|
||||
return base::mac::GetUserLibraryPath()
|
||||
return base::apple::GetUserLibraryPath()
|
||||
.Append(FILE_PATH_LITERAL("Logs"))
|
||||
.Append(FILE_PATH_LITERAL(exe_name + "_debug.log"));
|
||||
}
|
||||
|
@@ -7,10 +7,10 @@
|
||||
#include "libcef/common/cef_switches.h"
|
||||
|
||||
#include "base/apple/bundle_locations.h"
|
||||
#include "base/apple/foundation_util.h"
|
||||
#include "base/base_paths.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/mac/foundation_util.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "content/public/common/content_paths.h"
|
||||
@@ -49,7 +49,7 @@ void OverrideBaseBundleID() {
|
||||
std::string bundle_id = GetMainBundleID();
|
||||
DCHECK(!bundle_id.empty());
|
||||
|
||||
base::mac::SetBaseBundleID(bundle_id.c_str());
|
||||
base::apple::SetBaseBundleID(bundle_id.c_str());
|
||||
}
|
||||
|
||||
base::FilePath GetNormalChildProcessPath() {
|
||||
@@ -84,7 +84,7 @@ void OverrideChildProcessPath() {
|
||||
} // namespace
|
||||
|
||||
bool GetLocalLibraryDirectory(base::FilePath* result) {
|
||||
return base::mac::GetLocalDirectory(NSLibraryDirectory, result);
|
||||
return base::apple::GetLocalDirectory(NSLibraryDirectory, result);
|
||||
}
|
||||
|
||||
base::FilePath::StringType GetFrameworkName() {
|
||||
@@ -132,7 +132,7 @@ base::FilePath GetMainBundlePath() {
|
||||
return main_bundle_path;
|
||||
}
|
||||
|
||||
return base::mac::GetAppBundlePath(GetMainProcessPath());
|
||||
return base::apple::GetAppBundlePath(GetMainProcessPath());
|
||||
}
|
||||
|
||||
std::string GetMainBundleID() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user