Compare commits

...

27 Commits
7204 ... 5993

Author SHA1 Message Date
Marshall Greenblatt
99817d2d3e Add workaround for https://crbug.com/1500371 (see #3597) 2023-11-07 18:18:18 -05:00
Marshall Greenblatt
9d1cdd020f mac: Update CSS on fullscreen window exit (fixes #3597) 2023-11-07 18:18:07 -05:00
Marshall Greenblatt
38848f1780 chrome: Hit-test PiP draggable regions before resize border (see #3566) 2023-11-06 16:26:26 -05:00
Marshall Greenblatt
7e736457a0 Update to Chromium version 118.0.5993.119 2023-10-27 17:20:56 +00:00
Marshall Greenblatt
e44bee14d7 Update to Chromium version 118.0.5993.117 2023-10-25 14:25:21 +00:00
Marshall Greenblatt
7b7a3d79cb ceftests: More cleanup of TestHandler::OnTestTimeout 2023-10-23 15:44:29 -04:00
Marshall Greenblatt
3cffa57544 Update to Chromium version 118.0.5993.96 2023-10-20 16:16:04 +00:00
Marshall Greenblatt
3edd46ec8c ceftests: Simplify completion for tests that don't just create browsers
Some test cases don't create browsers at all, or require additional signals
such as request context destruction.

To test: Run `ceftests --gtest_filter=URLRequestTest.*`
2023-10-18 15:44:38 -04:00
Marshall Greenblatt
4d25f5dc55 ceftests: Fix flaky URLRequestTest due to server response timing
In some cases the browser may be closed before the server response is sent.
2023-10-18 15:44:29 -04:00
Nik Pavlov
8121d5ce4a Update ipc_performance_test to compare similar transfers (see #3502) 2023-10-18 15:44:22 -04:00
Marshall Greenblatt
781b53f5d6 chrome: views: Fix close of popup windows when parent is destroyed
When running ceftests with Views enabled always close the CefWindow
when the browser is destroyed and wait for both CefBrowser and
CefWindow destruction before signaling test completion.

To test:
Run `ceftests --enable-chrome-runtime --use-views
     --gtest_filter=FrameHandlerTest.OrderMainPopup*:RequestContextTest.PopupNavDestroyParent*`
2023-10-17 11:51:36 -04:00
Marshall Greenblatt
acc7a9429e ceftests: Change CreateTestRequestContext to async usage
With Chrome runtime, custom request contexts may be initialized asynchronously.
Wait for that initialization before using the request context.

This also removes TEST_RC_MODE_CUSTOM (uses TEST_RC_MODE_CUSTOM_WITH_HANDLER
instead) since we always need a handler to get the initialization callback.
2023-10-17 11:51:26 -04:00
Marshall Greenblatt
3280fe289b chrome: Support configuration of Chrome policy management (fixes #3581)
Disable Chrome policy management by default. Add CefSettings.chrome_policy_id
which, when configured, enables Chrome policy management. See
https://support.google.com/chrome/a/answer/9037717 for background.

To test:
- Start with a machine where Google Chrome is managed.
- Run `cefclient --enable-chrome-runtime --url=chrome://policy/`
  There should be no configured policies.
- Run `cefclient --enable-chrome-runtime --url=chrome://policy/
       --enable-chrome-policy`
  Configured Platform properties should match Google Chrome.
- Run `cefclient --enable-chrome-runtime --url=chrome://policy/
       --enable-chrome-policy --enable-chrome-browser-cloud-management`
  Configured Platform and Cloud properties should match Google Chrome.
2023-10-17 11:51:19 -04:00
Nik Pavlov
e798bbfe5d Replace ReadOnlySharedMemoryRegion with WritableSharedMemoryRegion (see #3502)
Write access to the shared memory region is required because JavaScript lacks
the capability to create read-only ArrayBuffers. When a user attempts to modify
an ArrayBuffer that utilizes a ReadOnlySharedMemoryRegion as its BackingStore
it triggers an access violation.

Note that this pull request may be reverted in the future if JavaScript adds
read-only ArrayBuffer support.
2023-10-17 11:51:10 -04:00
Marshall Greenblatt
3dd6078497 Fix incorrect includes (see #3284) 2023-10-09 13:17:22 -04:00
Marshall Greenblatt
17a5eaab75 Remove CefBrowserSettings.accept_language_list (fixes #3555)
Chromium does not support configuration of this value on a per-Browser basis.
2023-10-05 18:44:17 -04:00
Marshall Greenblatt
4ae2ce0a99 chrome: Set prefs for accept_language_list on Profile init (fixes #3579) 2023-10-05 18:44:09 -04:00
Marshall Greenblatt
721b365c10 Add new CanZoom/Zoom API (fixes #3284)
Add a simpler CanZoom/Zoom API as an alternative to the more error-prone
SetZoomLevel/GetZoomLevel API. Both APIs are now implemented for both runtimes.
With the Chrome runtime a zoom notification bubble will be displayed unless
CefBrowserSettings.chrome_zoom_bubble is set to STATE_DISABLED.

To test:
- Run cefclient and select zoom entries from the Tests menu.
- chrome: Run cefclient with `--hide-chrome-bubbles` command-line flag to hide
  the zoom notification bubble.
2023-10-05 13:33:49 -04:00
Nik Pavlov
238aa32bc2 Remove unnecessary copy during CefBinaryValue creation (see #3502) 2023-10-05 13:33:42 -04:00
Nik Pavlov
afab3ea942 Avoid signed integer overflow UB in IdGenerator 2023-10-05 13:33:35 -04:00
Cristian Amarie
adbbeab600 Add CefDragData::GetFilePaths to return file paths (fixes #3568)
GetFileNames now returns just the display names with a fallback to
path.BaseName() if the display name is empty.
2023-10-05 13:33:28 -04:00
Marshall Greenblatt
240f1b5b46 Update to Chromium version 118.0.5993.54 2023-10-05 13:36:41 +00:00
Marshall Greenblatt
d6ce292260 Add missing media router prefs registration (fixes #3570) 2023-09-29 16:02:29 -04:00
Marshall Greenblatt
7a4669ad49 chrome: Standardize fullscreen transition behavor/callbacks (fixes #3571)
Use the same code path for all fullscreen transitions so that Chrome UI updates
correctly. All user-initiated fullscreen transitions now result in
CefWindowDelegate::OnWindowFullscreenTransition callbacks.
2023-09-29 16:00:29 -04:00
Marshall Greenblatt
4ac1d370e1 cefclient: Use HTTPS for test URLs
Some features that we wish to test require HTTPS. Also, Chrome runtime is
redirecting HTTP URLs to HTTPS due to HSTS.
2023-09-29 16:00:23 -04:00
Marshall Greenblatt
13557bb259 Update to Chromium version 118.0.5993.32 2023-09-29 16:00:37 +00:00
Marshall Greenblatt
81813f3a21 Update to Chromium version 118.0.5993.22 2023-09-21 14:11:46 -04:00
123 changed files with 2666 additions and 900 deletions

View File

@@ -7,5 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/118.0.5993.0'
'chromium_checkout': 'refs/tags/118.0.5993.119',
'depot_tools_checkout': 'a45d2d4c90'
}

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=683d7bff8da04826eee83c7e23cf9c5a701ae265$
// $hash=13ba2d807f2c1ac3adfc65f2bdb269baecba57ec$
//
#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,29 @@ 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);
} cef_browser_host_t;
///

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=1de3354bd0a042cc28199f1f56753b1df9e279a2$
// $hash=5374127458a7cac3ee9b4d2b4ad8a6f5ca81ec52$
//
#ifndef CEF_INCLUDE_CAPI_CEF_DISPLAY_HANDLER_CAPI_H_
@@ -84,8 +84,13 @@ typedef struct _cef_display_handler_t {
/// Called when web content in the page has toggled fullscreen mode. If
/// |fullscreen| is true (1) the content will automatically be sized to fill
/// the browser content area. If |fullscreen| is false (0) the content will
/// automatically return to its original size and position. The client is
/// responsible for resizing the browser if desired.
/// automatically return to its original size and position. With the Alloy
/// runtime the client is responsible for triggering the fullscreen transition
/// (for example, by calling cef_window_t::SetFullscreen when using Views).
/// With the Chrome runtime the fullscreen transition will be triggered
/// automatically. The cef_window_delegate_t::OnWindowFullscreenTransition
/// function will be called during the fullscreen transition for notification
/// purposes.
///
void(CEF_CALLBACK* on_fullscreen_mode_change)(
struct _cef_display_handler_t* self,

View File

@@ -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.
///

View File

@@ -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

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=d53c4a0a7e731a56a0edcb9d705c76b0a2770155$
// $hash=4b43fe0b493d860e8b28d7a6d892db49d1135b34$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_CAPI_H_
@@ -155,7 +155,9 @@ typedef struct _cef_window_t {
void(CEF_CALLBACK* restore)(struct _cef_window_t* self);
///
/// Set fullscreen Window state.
/// Set fullscreen Window state. The
/// cef_window_delegate_t::OnWindowFullscreenTransition function will be
/// called during the fullscreen transition for notification purposes.
///
void(CEF_CALLBACK* set_fullscreen)(struct _cef_window_t* self,
int fullscreen);

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=61099a1ba8b16a5e46f5a80d326d1f9bfc99317d$
// $hash=456f00f7afbac910cf36feecd38399a2fb16960d$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
@@ -96,6 +96,20 @@ typedef struct _cef_window_delegate_t {
struct _cef_window_t* window,
const cef_rect_t* new_bounds);
///
/// Called when |window| is transitioning to or from fullscreen mode. On MacOS
/// the transition occurs asynchronously with |is_competed| set to false (0)
/// when the transition starts and true (1) after the transition completes. On
/// other platforms the transition occurs synchronously with |is_completed|
/// set to true (1) after the transition completes. With the Alloy runtime you
/// must also implement cef_display_handler_t::OnFullscreenModeChange to
/// handle fullscreen transitions initiated by browser content.
///
void(CEF_CALLBACK* on_window_fullscreen_transition)(
struct _cef_window_delegate_t* self,
struct _cef_window_t* window,
int is_completed);
///
/// Return the parent for |window| or NULL if the |window| does not have a
/// parent. Windows with parents will not get a taskbar button. Set |is_menu|
@@ -210,17 +224,6 @@ typedef struct _cef_window_delegate_t {
int(CEF_CALLBACK* on_key_event)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window,
const cef_key_event_t* event);
///
/// Called when the |window| is transitioning to or from fullscreen mode. The
/// transition occurs in two stages, with |is_competed| set to false (0) when
/// the transition starts and true (1) when the transition completes. This
/// function is only supported on macOS.
///
void(CEF_CALLBACK* on_window_fullscreen_transition)(
struct _cef_window_delegate_t* self,
struct _cef_window_t* window,
int is_completed);
} cef_window_delegate_t;
#ifdef __cplusplus

View File

@@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "8aa786740cdcadf7b4f6dd3554343abae09ffdfd"
#define CEF_API_HASH_UNIVERSAL "87db318fb26ee0debfcb686433bd334ea7b9923d"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "f241d73d66f3b7f99aae58a0cc99be36beda4f4f"
#define CEF_API_HASH_PLATFORM "aee3b3f687dce72a3370f98309bb43f722596b83"
#elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "3708f34f956e6306d09989a88ff1dee9c8f7a2b5"
#define CEF_API_HASH_PLATFORM "1cc534c1000bf82e8db52b8635272bb18daec4c2"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "cf413edb4edeb80d7d5c1173e342231b26808fce"
#define CEF_API_HASH_PLATFORM "47f4af678148110cb790fb48a957fb522446ecf2"
#endif
#ifdef __cplusplus

View File

@@ -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,30 @@ 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;
};
#endif // CEF_INCLUDE_CEF_BROWSER_H_

View File

@@ -75,8 +75,12 @@ class CefDisplayHandler : public virtual CefBaseRefCounted {
/// Called when web content in the page has toggled fullscreen mode. If
/// |fullscreen| is true the content will automatically be sized to fill the
/// browser content area. If |fullscreen| is false the content will
/// automatically return to its original size and position. The client is
/// responsible for resizing the browser if desired.
/// automatically return to its original size and position. With the Alloy
/// runtime the client is responsible for triggering the fullscreen transition
/// (for example, by calling CefWindow::SetFullscreen when using Views). With
/// the Chrome runtime the fullscreen transition will be triggered
/// automatically. The CefWindowDelegate::OnWindowFullscreenTransition method
/// will be called during the fullscreen transition for notification purposes.
///
/*--cef()--*/
virtual void OnFullscreenModeChange(CefRefPtr<CefBrowser> browser,

View File

@@ -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.
///

View File

@@ -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_

View File

@@ -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;
///
@@ -3660,6 +3672,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

View File

@@ -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;
}
};

View File

@@ -165,7 +165,9 @@ class CefWindow : public CefPanel {
virtual void Restore() = 0;
///
/// Set fullscreen Window state.
/// Set fullscreen Window state. The
/// CefWindowDelegate::OnWindowFullscreenTransition method will be called
/// during the fullscreen transition for notification purposes.
///
/*--cef()--*/
virtual void SetFullscreen(bool fullscreen) = 0;

View File

@@ -84,6 +84,19 @@ class CefWindowDelegate : public CefPanelDelegate {
virtual void OnWindowBoundsChanged(CefRefPtr<CefWindow> window,
const CefRect& new_bounds) {}
///
/// Called when |window| is transitioning to or from fullscreen mode. On MacOS
/// the transition occurs asynchronously with |is_competed| set to false when
/// the transition starts and true after the transition completes. On other
/// platforms the transition occurs synchronously with |is_completed| set to
/// true after the transition completes. With the Alloy runtime you must also
/// implement CefDisplayHandler::OnFullscreenModeChange to handle fullscreen
/// transitions initiated by browser content.
///
/*--cef()--*/
virtual void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
bool is_completed) {}
///
/// Return the parent for |window| or NULL if the |window| does not have a
/// parent. Windows with parents will not get a taskbar button. Set |is_menu|
@@ -209,16 +222,6 @@ class CefWindowDelegate : public CefPanelDelegate {
const CefKeyEvent& event) {
return false;
}
///
/// Called when the |window| is transitioning to or from fullscreen mode. The
/// transition occurs in two stages, with |is_competed| set to false when the
/// transition starts and true when the transition completes.
/// This method is only supported on macOS.
///
/*--cef()--*/
virtual void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
bool is_completed) {}
};
#endif // CEF_INCLUDE_VIEWS_CEF_WINDOW_DELEGATE_H_

View File

@@ -34,10 +34,10 @@
#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/navigation_controller.h"
#include "content/public/browser/navigation_handle.h"
@@ -330,31 +330,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,
@@ -1118,6 +1093,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) {

View File

@@ -80,8 +80,6 @@ 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,
@@ -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;

View File

@@ -171,11 +171,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_);
}
zoom::ZoomController::CreateForWebContents(web_contents_);
javascript_dialogs::TabModalDialogManager::CreateForWebContents(
web_contents_,

View File

@@ -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)) {

View File

@@ -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(

View File

@@ -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_;
}
@@ -527,6 +633,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(

View File

@@ -169,6 +169,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,
@@ -207,6 +212,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;

View File

@@ -126,6 +126,9 @@ class BrowserDelegate : public content::WebContentsDelegate {
// Set the draggable region relative to web contents.
// Called from DraggableRegionsHostImpl::UpdateDraggableRegions.
virtual void UpdateDraggableRegion(const SkRegion& region) {}
// Called at the end of a fullscreen transition.
virtual void WindowFullscreenStateChanged() {}
};
} // namespace cef

View File

@@ -4,6 +4,7 @@
#include "libcef/browser/chrome/chrome_browser_context.h"
#include "libcef/browser/prefs/browser_prefs.h"
#include "libcef/browser/thread_util.h"
#include "base/threading/thread_restrictions.h"
@@ -167,6 +168,8 @@ void ChromeBrowserContext::ProfileCreated(Profile::CreateStatus status,
: SessionStartupPref::kPrefValueNewTab);
}
browser_prefs::SetInitialProfilePrefs(profile_);
if (!init_callbacks_.empty()) {
for (auto& callback : init_callbacks_) {
std::move(callback).Run();

View File

@@ -15,6 +15,7 @@
#include "libcef/browser/media_access_query.h"
#include "libcef/browser/request_context_impl.h"
#include "libcef/browser/views/browser_view_impl.h"
#include "libcef/browser/views/window_impl.h"
#include "libcef/common/app_manager.h"
#include "libcef/common/frame_util.h"
@@ -23,6 +24,8 @@
#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/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;
@@ -257,6 +260,23 @@ void ChromeBrowserDelegate::UpdateDraggableRegion(const SkRegion& region) {
draggable_region_ = region;
}
void ChromeBrowserDelegate::WindowFullscreenStateChanged() {
// Use a synchronous callback for notification on Windows/Linux. MacOS gets
// notified asynchronously via CefNativeWidgetMac callbacks.
#if !BUILDFLAG(IS_MAC)
if (auto browser = ChromeBrowserHostImpl::GetBrowserForBrowser(browser_)) {
if (auto chrome_browser_view = browser->chrome_browser_view()) {
auto* cef_window = chrome_browser_view->cef_browser_view()->cef_window();
if (auto* delegate = cef_window->delegate()) {
// Give the CefWindowDelegate a chance to handle the event.
delegate->OnWindowFullscreenTransition(cef_window,
/*is_completed=*/true);
}
}
}
#endif
}
void ChromeBrowserDelegate::WebContentsCreated(
content::WebContents* source_contents,
int opener_render_process_id,
@@ -361,6 +381,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(

View File

@@ -70,6 +70,7 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
bool SupportsDraggableRegion() const override;
const absl::optional<SkRegion> GetDraggableRegion() const override;
void UpdateDraggableRegion(const SkRegion& region) override;
void WindowFullscreenStateChanged() override;
// WebContentsDelegate methods:
void WebContentsCreated(content::WebContents* source_contents,

View File

@@ -124,8 +124,17 @@ void ChromeBrowserHostImpl::AddNewContents(
void ChromeBrowserHostImpl::OnWebContentsDestroyed(
content::WebContents* web_contents) {
platform_delegate_->WebContentsDestroyed(web_contents);
DestroyBrowser();
// 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) {
@@ -179,15 +188,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,
@@ -534,15 +534,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();
}

View File

@@ -67,8 +67,6 @@ 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,

View File

@@ -411,17 +411,6 @@ bool ChromeContentBrowserClientCef::ConfigureNetworkContextParams(
cef_context ? cef_context->GetCookieableSchemes()
: CefBrowserContext::GetGlobalCookieableSchemes();
// Prefer the CEF settings configuration, if specified, instead of the
// kAcceptLanguages preference which is controlled by the
// chrome://settings/languages configuration.
const std::string& accept_language_list =
browser_prefs::GetAcceptLanguageList(cef_context, /*browser=*/nullptr,
/*expand=*/true);
if (!accept_language_list.empty() &&
accept_language_list != network_context_params->accept_language) {
network_context_params->accept_language = accept_language_list;
}
return true;
}

View File

@@ -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);
}
}
}

View File

@@ -6,6 +6,7 @@
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#if BUILDFLAG(IS_MAC)
@@ -17,10 +18,10 @@
void ChromeBrowserFrame::Init(BrowserView* browser_view,
std::unique_ptr<Browser> browser) {
DCHECK(browser_view);
DCHECK(browser);
DCHECK(!browser_);
browser_ = browser.get();
DCHECK(browser_);
DCHECK(!browser_view_);
browser_view_ = browser_view;
// Initialize BrowserFrame state.
InitBrowserView(browser_view);
@@ -42,6 +43,10 @@ void ChromeBrowserFrame::Init(BrowserView* browser_view,
#endif // BUILDFLAG(IS_MAC)
}
void ChromeBrowserFrame::ToggleFullscreenMode() {
chrome::ToggleFullscreenMode(browser_view_->browser());
}
views::internal::RootView* ChromeBrowserFrame::CreateRootView() {
// Bypass the BrowserFrame implementation.
return views::Widget::CreateRootView();

View File

@@ -97,13 +97,17 @@ class ChromeBrowserFrame : public BrowserFrame {
void Init(BrowserView* browser_view, std::unique_ptr<Browser> browser);
void ToggleFullscreenMode();
// views::Widget methods:
views::internal::RootView* CreateRootView() override;
std::unique_ptr<views::NonClientFrameView> CreateNonClientFrameView()
override;
BrowserView* browser_view() const { return browser_view_; }
private:
Browser* browser_ = nullptr;
BrowserView* browser_view_ = nullptr;
};
#endif // CEF_LIBCEF_BROWSER_CHROME_VIEWS_CHROME_BROWSER_FRAME_H_

View File

@@ -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(

View File

@@ -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(

View File

@@ -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(), /*expand=*/true);
accept_language_ = browser_prefs::GetAcceptLanguageList(profile);
DCHECK(!accept_language_.empty());
user_agent_ =
CefAppManager::Get()->GetContentClient()->browser()->GetUserAgent();

View File

@@ -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"
@@ -21,6 +20,7 @@
#include "base/values.h"
#include "chrome/browser/accessibility/accessibility_ui.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_feature.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/media/webrtc/permission_bubble_media_access_handler.h"
#include "chrome/browser/net/profile_network_context_service.h"
@@ -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);
@@ -269,6 +261,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
extensions::ExtensionPrefs::RegisterProfilePrefs(registry.get());
HostContentSettingsMap::RegisterProfilePrefs(registry.get());
language::LanguagePrefs::RegisterProfilePrefs(registry.get());
media_router::RegisterAccessCodeProfilePrefs(registry.get());
media_router::RegisterProfilePrefs(registry.get());
media_device_salt::MediaDeviceIDSalt::RegisterProfilePrefs(registry.get());
PermissionBubbleMediaAccessHandler::RegisterProfilePrefs(registry.get());
@@ -344,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));
@@ -363,26 +356,42 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
return factory.CreateSyncable(registry.get());
}
std::string GetAcceptLanguageList(CefBrowserContext* browser_context,
CefBrowserHostBase* browser,
bool expand) {
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() && expand) {
if (!accept_language_list.empty()) {
return ComputeAcceptLanguageFromPref(accept_language_list);
}
return std::string();
}
void SetInitialProfilePrefs(Profile* profile) {
auto* prefs = profile->GetPrefs();
// Language preferences.
const std::string& accept_language_list =
GetAcceptLanguageListSetting(profile);
if (!accept_language_list.empty()) {
// Used by ProfileNetworkContextService and InterceptedRequestHandlerWrapper
// (via GetAcceptLanguageList) for request headers, and
// renderer_preferences_util::UpdateFromSystemSettings() for
// `navigator.language`.
prefs->SetString(language::prefs::kAcceptLanguages, accept_language_list);
// Necessary to avoid a reset of the kAcceptLanguages value in
// LanguagePrefs::UpdateAcceptLanguagesPref().
prefs->SetString(language::prefs::kSelectedLanguages, accept_language_list);
}
}
} // namespace browser_prefs

View File

@@ -11,8 +11,6 @@ namespace base {
class FilePath;
}
class CefBrowserContext;
class CefBrowserHostBase;
class PrefRegistrySimple;
class PrefService;
class Profile;
@@ -36,9 +34,10 @@ 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,
bool expand);
std::string GetAcceptLanguageList(Profile* profile);
// Set preferences for a newly initialized Profile.
void SetInitialProfilePrefs(Profile* profile);
} // namespace browser_prefs

View File

@@ -141,10 +141,7 @@ bool CefBrowserViewImpl::HandleKeyboardEvent(
}
// Give the CefWindowDelegate a chance to handle the event.
CefRefPtr<CefWindow> window =
view_util::GetWindowFor(root_view()->GetWidget());
CefWindowImpl* window_impl = static_cast<CefWindowImpl*>(window.get());
if (window_impl) {
if (auto* window_impl = cef_window()) {
CefKeyEvent cef_event;
if (browser_util::GetCefKeyEvent(event, cef_event) &&
window_impl->OnKeyEvent(cef_event)) {
@@ -319,6 +316,12 @@ ChromeBrowserView* CefBrowserViewImpl::chrome_browser_view() const {
return static_cast<ChromeBrowserView*>(root_view());
}
CefWindowImpl* CefBrowserViewImpl::cef_window() const {
CefRefPtr<CefWindow> window =
view_util::GetWindowFor(root_view()->GetWidget());
return static_cast<CefWindowImpl*>(window.get());
}
bool CefBrowserViewImpl::HandleAccelerator(
const content::NativeWebKeyboardEvent& event,
views::FocusManager* focus_manager) {

View File

@@ -18,6 +18,7 @@
#include "ui/views/controls/webview/unhandled_keyboard_event_handler.h"
class CefBrowserHostBase;
class CefWindowImpl;
class ChromeBrowserView;
class CefBrowserViewImpl
@@ -83,6 +84,9 @@ class CefBrowserViewImpl
// Return the CEF specialization of BrowserView.
ChromeBrowserView* chrome_browser_view() const;
// Return the CefWindowImpl hosting this object.
CefWindowImpl* cef_window() const;
private:
// Create a new implementation object.
// Always call Initialize() after creation.

View File

@@ -48,6 +48,9 @@ class CefNativeWidgetMac : public views::NativeWidgetMac {
const CefRefPtr<CefWindow> window_;
CefWindowDelegate* const window_delegate_;
// Returns true if the CefWindow is fully initialized.
bool IsCefWindowInitialized() const;
BrowserView* browser_view_ = nullptr;
};

View File

@@ -7,6 +7,7 @@
#include "include/views/cef_window.h"
#include "include/views/cef_window_delegate.h"
#include "libcef/browser/views/ns_window.h"
#include "libcef/browser/views/window_impl.h"
#include "chrome/browser/apps/app_shim/app_shim_host_mac.h"
#include "chrome/browser/apps/app_shim/app_shim_manager_mac.h"
@@ -118,12 +119,22 @@ void CefNativeWidgetMac::GetWindowFrameTitlebarHeight(
void CefNativeWidgetMac::OnWindowFullscreenTransitionStart() {
views::NativeWidgetMac::OnWindowFullscreenTransitionStart();
window_delegate_->OnWindowFullscreenTransition(window_, false);
if (IsCefWindowInitialized()) {
window_delegate_->OnWindowFullscreenTransition(window_, false);
if (browser_view_) {
browser_view_->FullscreenStateChanging();
}
}
}
void CefNativeWidgetMac::OnWindowFullscreenTransitionComplete() {
views::NativeWidgetMac::OnWindowFullscreenTransitionComplete();
window_delegate_->OnWindowFullscreenTransition(window_, true);
if (IsCefWindowInitialized()) {
if (browser_view_) {
browser_view_->FullscreenStateChanged();
}
window_delegate_->OnWindowFullscreenTransition(window_, true);
}
}
void CefNativeWidgetMac::OnWindowInitialized() {
@@ -142,3 +153,7 @@ void CefNativeWidgetMac::OnWindowInitialized() {
}
}
}
bool CefNativeWidgetMac::IsCefWindowInitialized() const {
return static_cast<CefWindowImpl*>(window_.get())->initialized();
}

View File

@@ -5,6 +5,7 @@
#include "libcef/browser/views/window_impl.h"
#include "libcef/browser/browser_util.h"
#include "libcef/browser/chrome/views/chrome_browser_frame.h"
#include "libcef/browser/thread_util.h"
#include "libcef/browser/views/browser_view_impl.h"
#include "libcef/browser/views/display_impl.h"
@@ -12,6 +13,7 @@
#include "libcef/browser/views/layout_util.h"
#include "libcef/browser/views/view_util.h"
#include "libcef/browser/views/window_view.h"
#include "libcef/features/runtime.h"
#include "base/i18n/rtl.h"
#include "components/constrained_window/constrained_window_views.h"
@@ -116,9 +118,6 @@ CefRefPtr<CefWindowImpl> CefWindowImpl::Create(
CefRefPtr<CefWindowImpl> window = new CefWindowImpl(delegate);
window->Initialize();
window->CreateWidget(parent_widget);
if (delegate) {
delegate->OnWindowCreated(window.get());
}
return window;
}
@@ -253,7 +252,29 @@ void CefWindowImpl::Restore() {
void CefWindowImpl::SetFullscreen(bool fullscreen) {
CEF_REQUIRE_VALID_RETURN_VOID();
if (widget_ && fullscreen != widget_->IsFullscreen()) {
if (cef::IsChromeRuntimeEnabled()) {
// If a BrowserView exists, toggle fullscreen mode via the Chrome command
// for consistent behavior.
auto* browser_frame = static_cast<ChromeBrowserFrame*>(widget_);
if (browser_frame->browser_view()) {
browser_frame->ToggleFullscreenMode();
return;
}
}
// Call the Widget method directly with Alloy runtime, or Chrome runtime
// when no BrowserView exists.
widget_->SetFullscreen(fullscreen);
// Use a synchronous callback notification on Windows/Linux. Chrome runtime
// on Windows/Linux gets notified synchronously via ChromeBrowserDelegate
// callbacks when a BrowserView exists. MacOS (both runtimes) gets notified
// asynchronously via CefNativeWidgetMac callbacks.
#if !BUILDFLAG(IS_MAC)
if (delegate()) {
delegate()->OnWindowFullscreenTransition(this, /*is_completed=*/true);
}
#endif
}
}
@@ -714,7 +735,7 @@ void CefWindowImpl::RemoveAllAccelerators() {
}
CefWindowImpl::CefWindowImpl(CefRefPtr<CefWindowDelegate> delegate)
: ParentClass(delegate), widget_(nullptr), destroyed_(false) {}
: ParentClass(delegate) {}
CefWindowView* CefWindowImpl::CreateRootView() {
return new CefWindowView(delegate(), this);
@@ -740,4 +761,10 @@ void CefWindowImpl::CreateWidget(gfx::AcceleratedWidget parent_widget) {
// keep an owned reference.
std::unique_ptr<views::View> view_ptr = view_util::PassOwnership(this);
[[maybe_unused]] views::View* view = view_ptr.release();
initialized_ = true;
if (delegate()) {
delegate()->OnWindowCreated(this);
}
}

View File

@@ -132,6 +132,7 @@ class CefWindowImpl
void MenuClosed();
views::Widget* widget() const { return widget_; }
bool initialized() const { return initialized_; }
private:
// Create a new implementation object.
@@ -146,10 +147,13 @@ class CefWindowImpl
// Initialize the Widget.
void CreateWidget(gfx::AcceleratedWidget parent_widget);
views::Widget* widget_;
views::Widget* widget_ = nullptr;
// True if the window has been initialized.
bool initialized_ = false;
// True if the window has been destroyed.
bool destroyed_;
bool destroyed_ = false;
// The currently active menu model and runner.
CefRefPtr<CefMenuModelImpl> menu_model_;

View File

@@ -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 =
@@ -343,4 +351,4 @@ ChromeContentRendererClientCef* ChromeMainDelegateCef::content_renderer_client()
return nullptr;
}
return g_chrome_content_renderer_client.Pointer();
}
}

View File

@@ -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();

View File

@@ -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;

View File

@@ -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,

View File

@@ -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_));
}

View File

@@ -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);
};

View File

@@ -493,8 +493,8 @@ CefRefPtr<CefBinaryValue> CefBinaryValue::Create(const void* data,
return nullptr;
}
return new CefBinaryValueImpl(static_cast<char*>(const_cast<void*>(data)),
data_size);
const auto ptr = static_cast<const uint8_t*>(data);
return new CefBinaryValueImpl(base::make_span(ptr, data_size));
}
// static
@@ -525,12 +525,11 @@ CefBinaryValueImpl::CefBinaryValueImpl(base::Value* value, bool will_delete)
will_delete ? kOwnerWillDelete : kOwnerNoDelete,
nullptr) {}
CefBinaryValueImpl::CefBinaryValueImpl(char* data, size_t data_size)
: CefBinaryValueImpl(
new base::Value(std::vector<char>(data, data + data_size)),
nullptr,
kOwnerWillDelete,
nullptr) {}
CefBinaryValueImpl::CefBinaryValueImpl(base::span<const uint8_t> value)
: CefBinaryValueImpl(new base::Value(value),
nullptr,
kOwnerWillDelete,
nullptr) {}
base::Value CefBinaryValueImpl::CopyValue() {
CEF_VALUE_VERIFY_RETURN(false, base::Value());

View File

@@ -151,7 +151,7 @@ class CefBinaryValueImpl : public CefValueBase<CefBinaryValue, base::Value> {
CefBinaryValueImpl(base::Value* value, bool will_delete);
// The data will always be copied.
CefBinaryValueImpl(char* data, size_t data_size);
explicit CefBinaryValueImpl(base::span<const uint8_t> value);
CefBinaryValueImpl(const CefBinaryValueImpl&) = delete;
CefBinaryValueImpl& operator=(const CefBinaryValueImpl&) = delete;

View File

@@ -289,7 +289,7 @@ void CefFrameImpl::SendProcessMessage(CefProcessId target_process,
SendToBrowserFrame(
__FUNCTION__,
base::BindOnce(
[](const CefString& name, base::ReadOnlySharedMemoryRegion region,
[](const CefString& name, base::WritableSharedMemoryRegion region,
const BrowserFrameType& render_frame) {
render_frame->SendSharedMemoryRegion(name, std::move(region));
},
@@ -698,7 +698,7 @@ void CefFrameImpl::SendMessage(const std::string& name,
void CefFrameImpl::SendSharedMemoryRegion(
const std::string& name,
base::ReadOnlySharedMemoryRegion region) {
base::WritableSharedMemoryRegion region) {
if (auto app = CefAppManager::Get()->GetApplication()) {
if (auto handler = app->GetRenderProcessHandler()) {
CefRefPtr<CefProcessMessage> message(

View File

@@ -145,7 +145,7 @@ class CefFrameImpl
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 SendCommand(const std::string& command) override;
void SendCommandWithResponse(
const std::string& command,

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=6a2ebf843d929371a15e34792b6900c0ab622877$
// $hash=5358aa617ebb6d7d074e2d346599fbd6777f1770$
//
#include "libcef_dll/cpptoc/browser_host_cpptoc.h"
@@ -298,6 +298,57 @@ browser_host_get_request_context(struct _cef_browser_host_t* self) {
return CefRequestContextCppToC::Wrap(_retval);
}
int CEF_CALLBACK browser_host_can_zoom(struct _cef_browser_host_t* self,
cef_zoom_command_t command) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
}
// Execute
bool _retval = CefBrowserHostCppToC::Get(self)->CanZoom(command);
// Return type: bool
return _retval;
}
void CEF_CALLBACK browser_host_zoom(struct _cef_browser_host_t* self,
cef_zoom_command_t command) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return;
}
// Execute
CefBrowserHostCppToC::Get(self)->Zoom(command);
}
double CEF_CALLBACK
browser_host_get_default_zoom_level(struct _cef_browser_host_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
}
// Execute
double _retval = CefBrowserHostCppToC::Get(self)->GetDefaultZoomLevel();
// Return type: simple
return _retval;
}
double CEF_CALLBACK
browser_host_get_zoom_level(struct _cef_browser_host_t* self) {
shutdown_checker::AssertNotShutdown();
@@ -1384,6 +1435,39 @@ int CEF_CALLBACK browser_host_is_audio_muted(struct _cef_browser_host_t* self) {
return _retval;
}
int CEF_CALLBACK browser_host_is_fullscreen(struct _cef_browser_host_t* self) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
}
// Execute
bool _retval = CefBrowserHostCppToC::Get(self)->IsFullscreen();
// Return type: bool
return _retval;
}
void CEF_CALLBACK browser_host_exit_fullscreen(struct _cef_browser_host_t* self,
int will_cause_resize) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return;
}
// Execute
CefBrowserHostCppToC::Get(self)->ExitFullscreen(will_cause_resize ? true
: false);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
@@ -1398,6 +1482,9 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
GetStruct()->has_view = browser_host_has_view;
GetStruct()->get_client = browser_host_get_client;
GetStruct()->get_request_context = browser_host_get_request_context;
GetStruct()->can_zoom = browser_host_can_zoom;
GetStruct()->zoom = browser_host_zoom;
GetStruct()->get_default_zoom_level = browser_host_get_default_zoom_level;
GetStruct()->get_zoom_level = browser_host_get_zoom_level;
GetStruct()->set_zoom_level = browser_host_set_zoom_level;
GetStruct()->run_file_dialog = browser_host_run_file_dialog;
@@ -1458,6 +1545,8 @@ CefBrowserHostCppToC::CefBrowserHostCppToC() {
GetStruct()->is_background_host = browser_host_is_background_host;
GetStruct()->set_audio_muted = browser_host_set_audio_muted;
GetStruct()->is_audio_muted = browser_host_is_audio_muted;
GetStruct()->is_fullscreen = browser_host_is_fullscreen;
GetStruct()->exit_fullscreen = browser_host_exit_fullscreen;
}
// DESTRUCTOR - Do not edit by hand.

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=dc5d0e68bdc9b8ec86dbc9b4fa0ddce6e4597006$
// $hash=14322f994bd6eb8732cef20a3a70fc8ebbf32dea$
//
#include "libcef_dll/cpptoc/drag_data_cpptoc.h"
@@ -300,6 +300,38 @@ int CEF_CALLBACK drag_data_get_file_names(struct _cef_drag_data_t* self,
return _retval;
}
int CEF_CALLBACK
drag_data_get_file_paths(struct _cef_drag_data_t* self,
cef_string_list_t paths) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
}
// Verify param: paths; type: string_vec_byref
DCHECK(paths);
if (!paths) {
return 0;
}
// Translate param: paths; type: string_vec_byref
std::vector<CefString> pathsList;
transfer_string_list_contents(paths, pathsList);
// Execute
bool _retval = CefDragDataCppToC::Get(self)->GetFilePaths(pathsList);
// Restore param: paths; type: string_vec_byref
cef_string_list_clear(paths);
transfer_string_list_contents(pathsList, paths);
// Return type: bool
return _retval;
}
void CEF_CALLBACK drag_data_set_link_url(struct _cef_drag_data_t* self,
const cef_string_t* url) {
shutdown_checker::AssertNotShutdown();
@@ -520,6 +552,7 @@ CefDragDataCppToC::CefDragDataCppToC() {
GetStruct()->get_file_name = drag_data_get_file_name;
GetStruct()->get_file_contents = drag_data_get_file_contents;
GetStruct()->get_file_names = drag_data_get_file_names;
GetStruct()->get_file_paths = drag_data_get_file_paths;
GetStruct()->set_link_url = drag_data_set_link_url;
GetStruct()->set_link_title = drag_data_set_link_title;
GetStruct()->set_link_metadata = drag_data_set_link_metadata;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=9b9187a75a85ff63f2244471af1e54f40eae5a82$
// $hash=3bc6db85e54dc87c1e592291be01820547e0989f$
//
#include "libcef_dll/cpptoc/shared_memory_region_cpptoc.h"
@@ -55,7 +55,7 @@ shared_memory_region_size(struct _cef_shared_memory_region_t* self) {
return _retval;
}
const void* CEF_CALLBACK
void* CEF_CALLBACK
shared_memory_region_memory(struct _cef_shared_memory_region_t* self) {
shutdown_checker::AssertNotShutdown();
@@ -65,9 +65,9 @@ shared_memory_region_memory(struct _cef_shared_memory_region_t* self) {
}
// Execute
const void* _retval = CefSharedMemoryRegionCppToC::Get(self)->Memory();
void* _retval = CefSharedMemoryRegionCppToC::Get(self)->Memory();
// Return type: simple
// Return type: simple_byaddr
return _retval;
}

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=10ec416d3aeba7215b08604b1a329adc1c9aaf6f$
// $hash=61afa22f2b3401bab08c3faeb872e3de7a99ca5b$
//
#include "libcef_dll/cpptoc/views/window_delegate_cpptoc.h"
@@ -141,6 +141,29 @@ window_delegate_on_window_bounds_changed(struct _cef_window_delegate_t* self,
CefWindowCToCpp::Wrap(window), new_boundsVal);
}
void CEF_CALLBACK window_delegate_on_window_fullscreen_transition(
struct _cef_window_delegate_t* self,
cef_window_t* window,
int is_completed) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return;
}
// Verify param: window; type: refptr_diff
DCHECK(window);
if (!window) {
return;
}
// Execute
CefWindowDelegateCppToC::Get(self)->OnWindowFullscreenTransition(
CefWindowCToCpp::Wrap(window), is_completed ? true : false);
}
cef_window_t* CEF_CALLBACK
window_delegate_get_parent_window(struct _cef_window_delegate_t* self,
cef_window_t* window,
@@ -509,29 +532,6 @@ window_delegate_on_key_event(struct _cef_window_delegate_t* self,
return _retval;
}
void CEF_CALLBACK window_delegate_on_window_fullscreen_transition(
struct _cef_window_delegate_t* self,
cef_window_t* window,
int is_completed) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return;
}
// Verify param: window; type: refptr_diff
DCHECK(window);
if (!window) {
return;
}
// Execute
CefWindowDelegateCppToC::Get(self)->OnWindowFullscreenTransition(
CefWindowCToCpp::Wrap(window), is_completed ? true : false);
}
cef_size_t CEF_CALLBACK
window_delegate_get_preferred_size(struct _cef_view_delegate_t* self,
cef_view_t* view) {
@@ -805,6 +805,8 @@ CefWindowDelegateCppToC::CefWindowDelegateCppToC() {
window_delegate_on_window_activation_changed;
GetStruct()->on_window_bounds_changed =
window_delegate_on_window_bounds_changed;
GetStruct()->on_window_fullscreen_transition =
window_delegate_on_window_fullscreen_transition;
GetStruct()->get_parent_window = window_delegate_get_parent_window;
GetStruct()->is_window_modal_dialog = window_delegate_is_window_modal_dialog;
GetStruct()->get_initial_bounds = window_delegate_get_initial_bounds;
@@ -819,8 +821,6 @@ CefWindowDelegateCppToC::CefWindowDelegateCppToC() {
GetStruct()->can_close = window_delegate_can_close;
GetStruct()->on_accelerator = window_delegate_on_accelerator;
GetStruct()->on_key_event = window_delegate_on_key_event;
GetStruct()->on_window_fullscreen_transition =
window_delegate_on_window_fullscreen_transition;
GetStruct()->base.base.get_preferred_size =
window_delegate_get_preferred_size;
GetStruct()->base.base.get_minimum_size = window_delegate_get_minimum_size;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=02a6c45f14489fd5548eb61210ba453de05bcd2d$
// $hash=4d51bbece0dd5773f9c97163008d6b2f4bf1ccbf$
//
#include "libcef_dll/ctocpp/browser_host_ctocpp.h"
@@ -234,6 +234,56 @@ CefRefPtr<CefRequestContext> CefBrowserHostCToCpp::GetRequestContext() {
return CefRequestContextCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
bool CefBrowserHostCToCpp::CanZoom(cef_zoom_command_t command) {
shutdown_checker::AssertNotShutdown();
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, can_zoom)) {
return false;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->can_zoom(_struct, command);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::Zoom(cef_zoom_command_t command) {
shutdown_checker::AssertNotShutdown();
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, zoom)) {
return;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->zoom(_struct, command);
}
NO_SANITIZE("cfi-icall") double CefBrowserHostCToCpp::GetDefaultZoomLevel() {
shutdown_checker::AssertNotShutdown();
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_default_zoom_level)) {
return 0;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
double _retval = _struct->get_default_zoom_level(_struct);
// Return type: simple
return _retval;
}
NO_SANITIZE("cfi-icall") double CefBrowserHostCToCpp::GetZoomLevel() {
shutdown_checker::AssertNotShutdown();
@@ -1179,6 +1229,38 @@ NO_SANITIZE("cfi-icall") bool CefBrowserHostCToCpp::IsAudioMuted() {
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall") bool CefBrowserHostCToCpp::IsFullscreen() {
shutdown_checker::AssertNotShutdown();
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, is_fullscreen)) {
return false;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
int _retval = _struct->is_fullscreen(_struct);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
void CefBrowserHostCToCpp::ExitFullscreen(bool will_cause_resize) {
shutdown_checker::AssertNotShutdown();
cef_browser_host_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, exit_fullscreen)) {
return;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->exit_fullscreen(_struct, will_cause_resize);
}
// CONSTRUCTOR - Do not edit by hand.
CefBrowserHostCToCpp::CefBrowserHostCToCpp() {}

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=4700b3b409abf624334f9f6ecf9c1c20131e4849$
// $hash=5c1df6572bffebd983970394be27397837db0b25$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_
@@ -46,6 +46,9 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp,
bool HasView() 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;
void RunFileDialog(FileDialogMode mode,
@@ -131,6 +134,8 @@ class CefBrowserHostCToCpp : public CefCToCppRefCounted<CefBrowserHostCToCpp,
bool IsBackgroundHost() override;
void SetAudioMuted(bool mute) override;
bool IsAudioMuted() override;
bool IsFullscreen() override;
void ExitFullscreen(bool will_cause_resize) override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_BROWSER_HOST_CTOCPP_H_

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=62aa3d486f9f864b4a5a68ebdf4ebb0695c017d1$
// $hash=1dadac1c1138021a5f38e52ccb8f9863f5a387b5$
//
#include "libcef_dll/ctocpp/drag_data_ctocpp.h"
@@ -305,6 +305,38 @@ bool CefDragDataCToCpp::GetFileNames(std::vector<CefString>& names) {
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
bool CefDragDataCToCpp::GetFilePaths(std::vector<CefString>& paths) {
shutdown_checker::AssertNotShutdown();
cef_drag_data_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_file_paths)) {
return false;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Translate param: paths; type: string_vec_byref
cef_string_list_t pathsList = cef_string_list_alloc();
DCHECK(pathsList);
if (pathsList) {
transfer_string_list_contents(paths, pathsList);
}
// Execute
int _retval = _struct->get_file_paths(_struct, pathsList);
// Restore param:paths; type: string_vec_byref
if (pathsList) {
paths.clear();
transfer_string_list_contents(pathsList, paths);
cef_string_list_free(pathsList);
}
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
void CefDragDataCToCpp::SetLinkURL(const CefString& url) {
shutdown_checker::AssertNotShutdown();

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=7a8ec7b7c1010725596b1a64eb325b0e75ea34b7$
// $hash=fee8d107d6baed8cb7d838613ab4b95134e04c59$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_DRAG_DATA_CTOCPP_H_
@@ -49,6 +49,7 @@ class CefDragDataCToCpp : public CefCToCppRefCounted<CefDragDataCToCpp,
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;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=79771feab6c6d60667691c826ca9d6deaa23d068$
// $hash=31516110398f9fe682988645d74ac8789b712181$
//
#include "libcef_dll/ctocpp/shared_memory_region_ctocpp.h"
@@ -51,7 +51,7 @@ NO_SANITIZE("cfi-icall") size_t CefSharedMemoryRegionCToCpp::Size() {
return _retval;
}
NO_SANITIZE("cfi-icall") const void* CefSharedMemoryRegionCToCpp::Memory() {
NO_SANITIZE("cfi-icall") void* CefSharedMemoryRegionCToCpp::Memory() {
shutdown_checker::AssertNotShutdown();
cef_shared_memory_region_t* _struct = GetStruct();
@@ -60,9 +60,9 @@ NO_SANITIZE("cfi-icall") const void* CefSharedMemoryRegionCToCpp::Memory() {
}
// Execute
const void* _retval = _struct->memory(_struct);
void* _retval = _struct->memory(_struct);
// Return type: simple
// Return type: simple_byaddr
return _retval;
}

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=f5d0285d28412c40b8e04953025294c5f0779ecd$
// $hash=a81ba6b7aca8e1f7e6e6ef41e727ddcffc06f204$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_SHARED_MEMORY_REGION_CTOCPP_H_
@@ -37,7 +37,7 @@ class CefSharedMemoryRegionCToCpp
// CefSharedMemoryRegion methods.
bool IsValid() override;
size_t Size() override;
const void* Memory() override;
void* Memory() override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_SHARED_MEMORY_REGION_CTOCPP_H_

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=12bd03a8fb7d680a4e2b1a6818313c29bf14f011$
// $hash=bb69763a25cd013a50504d762a81c0a4454ce8eb$
//
#include "libcef_dll/ctocpp/views/window_delegate_ctocpp.h"
@@ -129,6 +129,30 @@ void CefWindowDelegateCToCpp::OnWindowBoundsChanged(CefRefPtr<CefWindow> window,
&new_bounds);
}
NO_SANITIZE("cfi-icall")
void CefWindowDelegateCToCpp::OnWindowFullscreenTransition(
CefRefPtr<CefWindow> window,
bool is_completed) {
shutdown_checker::AssertNotShutdown();
cef_window_delegate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_window_fullscreen_transition)) {
return;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: window; type: refptr_diff
DCHECK(window.get());
if (!window.get()) {
return;
}
// Execute
_struct->on_window_fullscreen_transition(
_struct, CefWindowCppToC::Wrap(window), is_completed);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefWindow> CefWindowDelegateCToCpp::GetParentWindow(
CefRefPtr<CefWindow> window,
@@ -487,30 +511,6 @@ bool CefWindowDelegateCToCpp::OnKeyEvent(CefRefPtr<CefWindow> window,
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
void CefWindowDelegateCToCpp::OnWindowFullscreenTransition(
CefRefPtr<CefWindow> window,
bool is_completed) {
shutdown_checker::AssertNotShutdown();
cef_window_delegate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_window_fullscreen_transition)) {
return;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: window; type: refptr_diff
DCHECK(window.get());
if (!window.get()) {
return;
}
// Execute
_struct->on_window_fullscreen_transition(
_struct, CefWindowCppToC::Wrap(window), is_completed);
}
NO_SANITIZE("cfi-icall")
CefSize CefWindowDelegateCToCpp::GetPreferredSize(CefRefPtr<CefView> view) {
shutdown_checker::AssertNotShutdown();

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=25487f4d82069d1e4c0c7b27c1c1fcbcebbbacea$
// $hash=e1ed42bb378f9f140e006ec582c0e908f711e7fa$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_DELEGATE_CTOCPP_H_
@@ -44,6 +44,8 @@ class CefWindowDelegateCToCpp
bool active) override;
void OnWindowBoundsChanged(CefRefPtr<CefWindow> window,
const CefRect& new_bounds) override;
void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
bool is_completed) override;
CefRefPtr<CefWindow> GetParentWindow(CefRefPtr<CefWindow> window,
bool* is_menu,
bool* can_activate_menu) override;
@@ -61,8 +63,6 @@ class CefWindowDelegateCToCpp
bool OnAccelerator(CefRefPtr<CefWindow> window, int command_id) override;
bool OnKeyEvent(CefRefPtr<CefWindow> window,
const CefKeyEvent& event) override;
void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
bool is_completed) override;
// CefPanelDelegate methods.

View File

@@ -4,6 +4,7 @@
#include "include/wrapper/cef_message_router.h"
#include <limits>
#include <map>
#include <set>
@@ -60,9 +61,12 @@ struct ParsedMessage {
CefString message;
};
size_t GetByteLength(const CefString& value) {
return value.size() * sizeof(CefString::char_type);
}
size_t GetMessageSize(const CefString& response) {
return sizeof(MessageHeader) +
(response.size() * sizeof(CefString::char_type));
return sizeof(MessageHeader) + GetByteLength(response);
}
void CopyResponseIntoMemory(void* memory, const CefString& response) {
@@ -125,7 +129,7 @@ CefRefPtr<CefProcessMessage> BuildMessage(size_t threshold,
int context_id,
int request_id,
const CefString& response) {
if (response.size() <= threshold) {
if (GetByteLength(response) <= threshold) {
return BuildListMessage(message_name, context_id, request_id, response);
} else {
return BuildBinaryMessage(message_name, context_id, request_id, response);
@@ -164,7 +168,14 @@ ParsedMessage ParseMessage(const CefRefPtr<CefProcessMessage>& message) {
return ParsedMessage{};
}
// Helper template for generated ID values.
/**
* @brief A helper template for generating ID values.
*
* This class generates monotonically increasing ID values within the interval
* [kReservedId + 1, numeric_limits<T>::max()].
*
* @tparam T The data type for the ID values.
*/
template <typename T>
class IdGenerator {
public:
@@ -174,11 +185,10 @@ class IdGenerator {
IdGenerator& operator=(const IdGenerator&) = delete;
T GetNextId() {
T id = ++next_id_;
if (id == kReservedId) { // In case the integer value wraps.
id = ++next_id_;
if (next_id_ == std::numeric_limits<T>::max()) {
next_id_ = kReservedId;
}
return id;
return ++next_id_;
}
private:

View File

@@ -268,6 +268,11 @@ patches = [
# https://github.com/chromiumembedded/cef/issues/3352
'name': 'chrome_browser_permission_prompt',
},
{
# Support configuration of Chrome policy management.
# https://github.com/chromiumembedded/cef/issues/3581
'name': 'chrome_browser_policy',
},
{
# alloy: Don't initialize ExtensionSystemFactory when extensions are
# disabled.

View File

@@ -20,7 +20,7 @@ index ccc2e7da62b79..f3b31e1196988 100644
// Make an exception to allow most visited tiles to commit in
diff --git content/browser/renderer_host/navigation_request.cc content/browser/renderer_host/navigation_request.cc
index e91fb6b203b55..fdf1de970fe18 100644
index 5cf177fc73dd2..7913ef67a6a52 100644
--- content/browser/renderer_host/navigation_request.cc
+++ content/browser/renderer_host/navigation_request.cc
@@ -7414,10 +7414,22 @@ NavigationRequest::GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
index 1a9bff4a3efb7..883534be3c975 100644
index 31bf3d854d9a6..42d365c8f04fe 100644
--- chrome/browser/BUILD.gn
+++ chrome/browser/BUILD.gn
@@ -11,6 +11,7 @@ import("//build/config/compiler/pgo/pgo.gni")
@@ -10,7 +10,7 @@ index 1a9bff4a3efb7..883534be3c975 100644
import("//chrome/browser/buildflags.gni")
import("//chrome/browser/downgrade/buildflags.gni")
import("//chrome/common/features.gni")
@@ -2001,6 +2002,7 @@ static_library("browser") {
@@ -2002,6 +2003,7 @@ static_library("browser") {
"//build/config/chromebox_for_meetings:buildflags",
"//build/config/compiler:compiler_buildflags",
"//cc",
@@ -18,7 +18,7 @@ index 1a9bff4a3efb7..883534be3c975 100644
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -2630,6 +2632,10 @@ static_library("browser") {
@@ -2632,6 +2634,10 @@ static_library("browser") {
]
}

View File

@@ -13,7 +13,7 @@ index 2480282a19d12..dbd1fbf8a15b5 100644
return false;
}
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
index a521886e9eb44..4ba68bf125c94 100644
index 9da0c57372d3d..da4972e20b4f4 100644
--- chrome/browser/ui/BUILD.gn
+++ chrome/browser/ui/BUILD.gn
@@ -9,6 +9,7 @@ import("//build/config/compiler/compiler.gni")
@@ -61,7 +61,7 @@ index a521886e9eb44..4ba68bf125c94 100644
"views/apps/app_info_dialog/app_info_dialog_container.cc",
"views/apps/app_info_dialog/app_info_dialog_container.h",
"views/apps/app_info_dialog/app_info_dialog_views.cc",
@@ -6279,6 +6285,7 @@ static_library("ui") {
@@ -6281,6 +6287,7 @@ static_library("ui") {
if (enable_printing) {
deps += [
"//components/printing/browser",
@@ -70,7 +70,7 @@ index a521886e9eb44..4ba68bf125c94 100644
]
}
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
index fdb96dee05067..7719f86fd4e0e 100644
index fdb96dee05067..a188b6442b1ca 100644
--- chrome/browser/ui/browser.cc
+++ chrome/browser/ui/browser.cc
@@ -265,6 +265,25 @@
@@ -123,7 +123,16 @@ index fdb96dee05067..7719f86fd4e0e 100644
}
///////////////////////////////////////////////////////////////////////////////
@@ -1394,6 +1423,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
@@ -1055,6 +1084,8 @@ void Browser::WindowFullscreenStateChanged() {
->WindowFullscreenStateChanged();
command_controller_->FullscreenStateChanged();
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN);
+
+ CALL_CEF_DELEGATE(WindowFullscreenStateChanged);
}
void Browser::FullscreenTopUIStateChanged() {
@@ -1394,6 +1425,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
if (exclusive_access_manager_->HandleUserKeyEvent(event))
return content::KeyboardEventProcessingResult::HANDLED;
@@ -138,7 +147,7 @@ index fdb96dee05067..7719f86fd4e0e 100644
return window()->PreHandleKeyboardEvent(event);
}
@@ -1401,8 +1438,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
@@ -1401,8 +1440,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
const NativeWebKeyboardEvent& event) {
DevToolsWindow* devtools_window =
DevToolsWindow::GetInstanceForInspectedWebContents(source);
@@ -159,7 +168,7 @@ index fdb96dee05067..7719f86fd4e0e 100644
}
bool Browser::TabsNeedBeforeUnloadFired() {
@@ -1613,6 +1660,14 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
@@ -1613,6 +1662,14 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
@@ -174,7 +183,7 @@ index fdb96dee05067..7719f86fd4e0e 100644
NavigateParams nav_params(this, params.url, params.transition);
nav_params.FillNavigateParamsFromOpenURLParams(params);
nav_params.source_contents = source;
@@ -1770,6 +1825,8 @@ void Browser::LoadingStateChanged(WebContents* source,
@@ -1770,6 +1827,8 @@ void Browser::LoadingStateChanged(WebContents* source,
bool should_show_loading_ui) {
ScheduleUIUpdate(source, content::INVALIDATE_TYPE_LOAD);
UpdateWindowForLoadingStateChanged(source, should_show_loading_ui);
@@ -183,7 +192,7 @@ index fdb96dee05067..7719f86fd4e0e 100644
}
void Browser::CloseContents(WebContents* source) {
@@ -1798,6 +1855,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
@@ -1798,6 +1857,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
}
void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -192,7 +201,7 @@ index fdb96dee05067..7719f86fd4e0e 100644
if (!GetStatusBubble())
return;
@@ -1805,6 +1864,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -1805,6 +1866,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
GetStatusBubble()->SetURL(url);
}
@@ -210,7 +219,7 @@ index fdb96dee05067..7719f86fd4e0e 100644
void Browser::ContentsMouseEvent(WebContents* source,
bool motion,
bool exited) {
@@ -1829,6 +1899,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
@@ -1829,6 +1901,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
return false;
}
@@ -230,7 +239,7 @@ index fdb96dee05067..7719f86fd4e0e 100644
void Browser::BeforeUnloadFired(WebContents* web_contents,
bool proceed,
bool* proceed_to_fire_unload) {
@@ -1921,6 +2004,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
@@ -1921,6 +2006,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
// Make the tab show up in the task manager.
task_manager::WebContentsTags::CreateForTabContents(new_contents);
@@ -241,7 +250,7 @@ index fdb96dee05067..7719f86fd4e0e 100644
}
void Browser::PortalWebContentsCreated(WebContents* portal_web_contents) {
@@ -2038,11 +2125,15 @@ void Browser::EnterFullscreenModeForTab(
@@ -2038,11 +2127,15 @@ void Browser::EnterFullscreenModeForTab(
const blink::mojom::FullscreenOptions& options) {
exclusive_access_manager_->fullscreen_controller()->EnterFullscreenModeForTab(
requesting_frame, options.display_id);
@@ -257,7 +266,7 @@ index fdb96dee05067..7719f86fd4e0e 100644
}
bool Browser::IsFullscreenForTabOrPending(const WebContents* web_contents) {
@@ -2232,6 +2323,15 @@ void Browser::RequestMediaAccessPermission(
@@ -2232,6 +2325,15 @@ void Browser::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) {
@@ -273,7 +282,7 @@ index fdb96dee05067..7719f86fd4e0e 100644
const extensions::Extension* extension =
GetExtensionForOrigin(profile_, request.security_origin);
MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
@@ -2783,13 +2883,20 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
@@ -2783,13 +2885,20 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
// Browser, Getters for UI (private):
StatusBubble* Browser::GetStatusBubble() {
@@ -295,7 +304,7 @@ index fdb96dee05067..7719f86fd4e0e 100644
return window_ ? window_->GetStatusBubble() : nullptr;
}
@@ -2923,6 +3030,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
@@ -2923,6 +3032,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
BookmarkTabHelper::FromWebContents(web_contents)->RemoveObserver(this);
web_contents_collection_.StopObserving(web_contents);
}
@@ -304,7 +313,7 @@ index fdb96dee05067..7719f86fd4e0e 100644
}
void Browser::TabDetachedAtImpl(content::WebContents* contents,
@@ -3077,6 +3186,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
@@ -3077,6 +3188,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
bool Browser::SupportsWindowFeatureImpl(WindowFeature feature,
bool check_can_support) const {

View File

@@ -1,8 +1,8 @@
diff --git chrome/browser/renderer_context_menu/render_view_context_menu.cc chrome/browser/renderer_context_menu/render_view_context_menu.cc
index 81349bc10ffe9..6fce9815a6c51 100644
index 5013dafa7629e..eced2acc68f61 100644
--- chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -341,6 +341,13 @@ base::OnceCallback<void(RenderViewContextMenu*)>* GetMenuShownCallback() {
@@ -349,6 +349,13 @@ base::OnceCallback<void(RenderViewContextMenu*)>* GetMenuShownCallback() {
return callback.get();
}
@@ -16,7 +16,7 @@ index 81349bc10ffe9..6fce9815a6c51 100644
enum class UmaEnumIdLookupType {
GeneralEnumId,
ContextSpecificEnumId,
@@ -590,6 +597,10 @@ int FindUMAEnumValueForCommand(int id, UmaEnumIdLookupType type) {
@@ -598,6 +605,10 @@ int FindUMAEnumValueForCommand(int id, UmaEnumIdLookupType type) {
if (ContextMenuMatcher::IsExtensionsCustomCommandId(id))
return 1;
@@ -27,7 +27,7 @@ index 81349bc10ffe9..6fce9815a6c51 100644
id = CollapseCommandsForUMA(id);
const auto& map = GetIdcToUmaMap(type);
auto it = map.find(id);
@@ -814,6 +825,14 @@ RenderViewContextMenu::RenderViewContextMenu(
@@ -822,6 +833,14 @@ RenderViewContextMenu::RenderViewContextMenu(
pdf_ocr_submenu_model_ = std::make_unique<ui::SimpleMenuModel>(this);
#endif // BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
@@ -42,7 +42,7 @@ index 81349bc10ffe9..6fce9815a6c51 100644
observers_.AddObserver(&autofill_context_menu_manager_);
}
@@ -1252,6 +1271,12 @@ void RenderViewContextMenu::InitMenu() {
@@ -1284,6 +1303,12 @@ void RenderViewContextMenu::InitMenu() {
autofill::PopupHidingReason::kContextMenuOpened);
}
}
@@ -55,7 +55,7 @@ index 81349bc10ffe9..6fce9815a6c51 100644
}
Profile* RenderViewContextMenu::GetProfile() const {
@@ -3320,6 +3345,12 @@ void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
@@ -3377,6 +3402,12 @@ void RenderViewContextMenu::RegisterExecutePluginActionCallbackForTesting(
execute_plugin_action_callback_ = std::move(cb);
}
@@ -69,7 +69,7 @@ index 81349bc10ffe9..6fce9815a6c51 100644
RenderViewContextMenu::GetHandlersForLinkUrl() {
custom_handlers::ProtocolHandlerRegistry::ProtocolHandlerList handlers =
diff --git chrome/browser/renderer_context_menu/render_view_context_menu.h chrome/browser/renderer_context_menu/render_view_context_menu.h
index 88034ab234827..e11cde8e1663b 100644
index b74da355c7b6b..3efdaa3b25e28 100644
--- chrome/browser/renderer_context_menu/render_view_context_menu.h
+++ chrome/browser/renderer_context_menu/render_view_context_menu.h
@@ -152,6 +152,12 @@ class RenderViewContextMenu
@@ -85,7 +85,7 @@ index 88034ab234827..e11cde8e1663b 100644
protected:
Profile* GetProfile() const;
@@ -433,6 +439,9 @@ class RenderViewContextMenu
@@ -437,6 +443,9 @@ class RenderViewContextMenu
// built.
bool is_protocol_submenu_valid_ = false;

View File

@@ -12,7 +12,7 @@ index b169371e4d42f..509e4bda85b47 100644
// on the screen, we can't actually attach to it.
parent_window = nullptr;
diff --git components/constrained_window/constrained_window_views.cc components/constrained_window/constrained_window_views.cc
index 819da6b0bff94..b25a48fb2516b 100644
index 819da6b0bff94..a8e3ecd8527bd 100644
--- components/constrained_window/constrained_window_views.cc
+++ components/constrained_window/constrained_window_views.cc
@@ -105,15 +105,24 @@ void UpdateModalDialogPosition(views::Widget* widget,
@@ -105,7 +105,7 @@ index 647391095306e..bd49316ac758e 100644
OnPositionRequiresUpdate();
diff --git components/web_modal/modal_dialog_host.h components/web_modal/modal_dialog_host.h
index 51ed6bcf6b540..9ae4737e0737e 100644
index 51ed6bcf6b540..c6e1161140655 100644
--- components/web_modal/modal_dialog_host.h
+++ components/web_modal/modal_dialog_host.h
@@ -34,6 +34,10 @@ class WEB_MODAL_EXPORT ModalDialogHost {

View File

@@ -0,0 +1,429 @@
diff --git chrome/browser/policy/browser_dm_token_storage_linux.cc chrome/browser/policy/browser_dm_token_storage_linux.cc
index 10085136f52ce..ec1be9babecc2 100644
--- chrome/browser/policy/browser_dm_token_storage_linux.cc
+++ chrome/browser/policy/browser_dm_token_storage_linux.cc
@@ -22,6 +22,7 @@
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/threading/scoped_blocking_call.h"
+#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/common/chrome_paths.h"
namespace policy {
@@ -116,8 +117,8 @@ std::string BrowserDMTokenStorageLinux::InitEnrollmentToken() {
std::string enrollment_token;
base::FilePath dir_policy_files_path;
- if (!base::PathService::Get(chrome::DIR_POLICY_FILES,
- &dir_policy_files_path)) {
+ if (!ChromeBrowserPolicyConnector::GetDirPolicyFilesPath(
+ &dir_policy_files_path)) {
return std::string();
}
@@ -147,8 +148,8 @@ bool BrowserDMTokenStorageLinux::InitEnrollmentErrorOption() {
std::string options;
base::FilePath dir_policy_files_path;
- if (!base::PathService::Get(chrome::DIR_POLICY_FILES,
- &dir_policy_files_path)) {
+ if (!ChromeBrowserPolicyConnector::GetDirPolicyFilesPath(
+ &dir_policy_files_path)) {
return false;
}
diff --git chrome/browser/policy/browser_dm_token_storage_mac.mm chrome/browser/policy/browser_dm_token_storage_mac.mm
index 22fdb0efb78c7..39adc3f192ba1 100644
--- chrome/browser/policy/browser_dm_token_storage_mac.mm
+++ chrome/browser/policy/browser_dm_token_storage_mac.mm
@@ -26,6 +26,7 @@
#include "base/syslog_logging.h"
#include "base/task/thread_pool.h"
#include "base/threading/scoped_blocking_call.h"
+#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/common/chrome_paths.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
@@ -47,11 +48,6 @@ const char kEnrollmentOptionsFilePath[] = FILE_PATH_LITERAL(
"/Library/Google/Chrome/CloudManagementEnrollmentOptions");
const char kEnrollmentMandatoryOption[] = "Mandatory";
-// Explicitly access the "com.google.Chrome" bundle ID, no matter what this
-// app's bundle ID actually is. All channels of Chrome should obey the same
-// policies.
-const CFStringRef kBundleId = CFSTR("com.google.Chrome");
-
constexpr char kEnrollmentTokenMetricsName[] =
"Enterprise.CloudManagementEnrollmentTokenLocation.Mac";
@@ -104,16 +100,22 @@ bool DeleteDMTokenFromAppDataDir(const std::string& client_id) {
// Get the enrollment token from policy file: /Library/com.google.Chrome.plist.
// Return true if policy is set, otherwise false.
bool GetEnrollmentTokenFromPolicy(std::string* enrollment_token) {
+ base::apple::ScopedCFTypeRef<CFStringRef> bundle_id(
+ ChromeBrowserPolicyConnector::GetBundleId());
+ if (!bundle_id) {
+ return false;
+ }
+
// Since the configuration management infrastructure is not initialized when
// this code runs, read the policy preference directly.
base::apple::ScopedCFTypeRef<CFPropertyListRef> value(
- CFPreferencesCopyAppValue(kEnrollmentTokenPolicyName, kBundleId));
+ CFPreferencesCopyAppValue(kEnrollmentTokenPolicyName, bundle_id));
// Read the enrollment token from the new location. If that fails, try the old
// location (which will be deprecated soon). If that also fails, bail as there
// is no token set.
if (!value ||
- !CFPreferencesAppValueIsForced(kEnrollmentTokenPolicyName, kBundleId)) {
+ !CFPreferencesAppValueIsForced(kEnrollmentTokenPolicyName, bundle_id)) {
return false;
}
CFStringRef value_string = base::apple::CFCast<CFStringRef>(value);
@@ -138,12 +140,18 @@ bool GetEnrollmentTokenFromFile(std::string* enrollment_token) {
}
absl::optional<bool> IsEnrollmentMandatoryByPolicy() {
+ base::apple::ScopedCFTypeRef<CFStringRef> bundle_id(
+ ChromeBrowserPolicyConnector::GetBundleId());
+ if (!bundle_id) {
+ return absl::nullopt;
+ }
+
base::apple::ScopedCFTypeRef<CFPropertyListRef> value(
CFPreferencesCopyAppValue(kEnrollmentMandatoryOptionPolicyName,
- kBundleId));
+ bundle_id));
if (!value || !CFPreferencesAppValueIsForced(
- kEnrollmentMandatoryOptionPolicyName, kBundleId)) {
+ kEnrollmentMandatoryOptionPolicyName, bundle_id)) {
return absl::optional<bool>();
}
diff --git chrome/browser/policy/chrome_browser_policy_connector.cc chrome/browser/policy/chrome_browser_policy_connector.cc
index bf03f3d03991a..c36d26af6747c 100644
--- chrome/browser/policy/chrome_browser_policy_connector.cc
+++ chrome/browser/policy/chrome_browser_policy_connector.cc
@@ -13,11 +13,14 @@
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
+#include "base/no_destructor.h"
#include "base/path_service.h"
+#include "base/strings/utf_string_conversions.h"
#include "base/task/thread_pool.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "cef/libcef/features/features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/enterprise/browser_management/management_service_factory.h"
#include "chrome/browser/policy/configuration_policy_handler_list_factory.h"
@@ -85,6 +88,11 @@
namespace policy {
namespace {
bool command_line_enabled_for_testing = false;
+
+std::string* PlatformPolicyId() {
+ static base::NoDestructor<std::string> id;
+ return id.get();
+}
} // namespace
ChromeBrowserPolicyConnector::ChromeBrowserPolicyConnector()
@@ -239,6 +247,73 @@ void ChromeBrowserPolicyConnector::EnableCommandLineSupportForTesting() {
command_line_enabled_for_testing = true;
}
+// static
+void ChromeBrowserPolicyConnector::EnablePlatformPolicySupport(
+ const std::string& id) {
+ *PlatformPolicyId() = id;
+}
+
+#if BUILDFLAG(IS_WIN)
+
+// static
+std::wstring ChromeBrowserPolicyConnector::GetPolicyKey() {
+#if BUILDFLAG(ENABLE_CEF)
+ const std::string& policy_id = *PlatformPolicyId();
+ if (!policy_id.empty()) {
+ return base::UTF8ToWide(policy_id);
+ }
+ return std::wstring();
+#else
+ return kRegistryChromePolicyKey;
+#endif
+}
+
+#elif BUILDFLAG(IS_MAC)
+
+// static
+base::apple::ScopedCFTypeRef<CFStringRef>
+ChromeBrowserPolicyConnector::GetBundleId() {
+#if BUILDFLAG(ENABLE_CEF)
+ const std::string& policy_id = *PlatformPolicyId();
+ if (policy_id.empty()) {
+ return base::apple::ScopedCFTypeRef<CFStringRef>();
+ }
+
+ return base::SysUTF8ToCFStringRef(policy_id);
+#elif BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ // Explicitly access the "com.google.Chrome" bundle ID, no matter what this
+ // app's bundle ID actually is. All channels of Chrome should obey the same
+ // policies.
+ return CFSTR("com.google.Chrome");
+#else
+ return base::SysUTF8ToCFStringRef(base::apple::BaseBundleID());
+#endif
+}
+
+#elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
+
+// static
+bool ChromeBrowserPolicyConnector::GetDirPolicyFilesPath(base::FilePath* path) {
+#if BUILDFLAG(ENABLE_CEF)
+ const std::string& policy_id = *PlatformPolicyId();
+ if (policy_id.empty()) {
+ return false;
+ }
+
+ base::FilePath policy_path(policy_id);
+ if (!policy_path.IsAbsolute()) {
+ return false;
+ }
+
+ *path = policy_path;
+ return true;
+#else
+ return base::PathService::Get(chrome::DIR_POLICY_FILES, path);
+#endif
+}
+
+#endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
+
base::flat_set<std::string>
ChromeBrowserPolicyConnector::device_affiliation_ids() const {
#if !BUILDFLAG(IS_CHROMEOS_ASH)
@@ -310,22 +385,21 @@ ChromeBrowserPolicyConnector::CreatePolicyProviders() {
std::unique_ptr<ConfigurationPolicyProvider>
ChromeBrowserPolicyConnector::CreatePlatformProvider() {
#if BUILDFLAG(IS_WIN)
+ const std::wstring policy_key = GetPolicyKey();
+ if (policy_key.empty()) {
+ return nullptr;
+ }
std::unique_ptr<AsyncPolicyLoader> loader(PolicyLoaderWin::Create(
base::ThreadPool::CreateSequencedTaskRunner(
{base::MayBlock(), base::TaskPriority::BEST_EFFORT}),
- ManagementServiceFactory::GetForPlatform(), kRegistryChromePolicyKey));
+ ManagementServiceFactory::GetForPlatform(), policy_key));
return std::make_unique<AsyncPolicyProvider>(GetSchemaRegistry(),
std::move(loader));
#elif BUILDFLAG(IS_MAC)
-#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
- // Explicitly watch the "com.google.Chrome" bundle ID, no matter what this
- // app's bundle ID actually is. All channels of Chrome should obey the same
- // policies.
- CFStringRef bundle_id = CFSTR("com.google.Chrome");
-#else
- base::apple::ScopedCFTypeRef<CFStringRef> bundle_id(
- base::SysUTF8ToCFStringRef(base::apple::BaseBundleID()));
-#endif
+ base::apple::ScopedCFTypeRef<CFStringRef> bundle_id(GetBundleId());
+ if (!bundle_id) {
+ return nullptr;
+ }
auto loader = std::make_unique<PolicyLoaderMac>(
base::ThreadPool::CreateSequencedTaskRunner(
{base::MayBlock(), base::TaskPriority::BEST_EFFORT}),
@@ -335,7 +409,7 @@ ChromeBrowserPolicyConnector::CreatePlatformProvider() {
std::move(loader));
#elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
base::FilePath config_dir_path;
- if (base::PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) {
+ if (GetDirPolicyFilesPath(&config_dir_path)) {
#if BUILDFLAG(IS_CHROMEOS)
// If the folder containing the policy files doesn't exist, there's no need
// to have a provider for them. Note that in verified boot, the folder
diff --git chrome/browser/policy/chrome_browser_policy_connector.h chrome/browser/policy/chrome_browser_policy_connector.h
index 13b714bab7db5..f8eb85a586ce6 100644
--- chrome/browser/policy/chrome_browser_policy_connector.h
+++ chrome/browser/policy/chrome_browser_policy_connector.h
@@ -28,6 +28,10 @@
#include "components/policy/core/common/policy_loader_lacros.h"
#endif // BUILDFLAG(IS_CHROMEOS_LACROS)
+#if BUILDFLAG(IS_MAC)
+#include "base/apple/scoped_cftyperef.h"
+#endif
+
class PrefService;
namespace policy {
@@ -120,6 +124,25 @@ class ChromeBrowserPolicyConnector : public BrowserPolicyConnector {
static void EnableCommandLineSupportForTesting();
+ // Enable platform policy support with the specified retrieval |id|. Support
+ // is disabled by default, and if |id| is empty.
+ // 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 a directory path like "/etc/opt/chrome/policies".
+ static void EnablePlatformPolicySupport(const std::string& id);
+
+ // Platform-specific retrieval of the policy ID value.
+#if BUILDFLAG(IS_WIN)
+ // Replaces all direct usage of kRegistryChromePolicyKey.
+ static std::wstring GetPolicyKey();
+#elif BUILDFLAG(IS_MAC)
+ // Replaces all direct usage of CFSTR("com.google.Chrome").
+ static base::apple::ScopedCFTypeRef<CFStringRef> GetBundleId();
+#elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
+ // Replaces all direct usage of chrome::DIR_POLICY_FILES.
+ static bool GetDirPolicyFilesPath(base::FilePath* path);
+#endif
+
virtual base::flat_set<std::string> device_affiliation_ids() const;
#if BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git chrome/browser/policy/policy_path_parser_mac.mm chrome/browser/policy/policy_path_parser_mac.mm
index 44a46c9c37788..873a6469c7ab5 100644
--- chrome/browser/policy/policy_path_parser_mac.mm
+++ chrome/browser/policy/policy_path_parser_mac.mm
@@ -16,6 +16,7 @@
#include "base/logging.h"
#include "base/strings/sys_string_conversions.h"
#include "build/branding_buildflags.h"
+#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "components/policy/policy_constants.h"
namespace policy::path_parser {
@@ -97,15 +98,11 @@ base::FilePath::StringType ExpandPathVariables(
void CheckUserDataDirPolicy(base::FilePath* user_data_dir) {
// Since the configuration management infrastructure is not initialized when
// this code runs, read the policy preference directly.
-#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
- // Explicitly access the "com.google.Chrome" bundle ID, no matter what this
- // app's bundle ID actually is. All channels of Chrome should obey the same
- // policies.
- CFStringRef bundle_id = CFSTR("com.google.Chrome");
-#else
base::apple::ScopedCFTypeRef<CFStringRef> bundle_id(
- base::SysUTF8ToCFStringRef(base::apple::BaseBundleID()));
-#endif
+ policy::ChromeBrowserPolicyConnector::GetBundleId());
+ if (!bundle_id) {
+ return;
+ }
base::apple::ScopedCFTypeRef<CFStringRef> key(
base::SysUTF8ToCFStringRef(policy::key::kUserDataDir));
diff --git chrome/browser/policy/policy_path_parser_win.cc chrome/browser/policy/policy_path_parser_win.cc
index 8dbf958c189dd..6eaccc6688eca 100644
--- chrome/browser/policy/policy_path_parser_win.cc
+++ chrome/browser/policy/policy_path_parser_win.cc
@@ -12,6 +12,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h"
+#include "chrome/browser/policy/chrome_browser_policy_connector.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/install_static/policy_path_parser.h"
#include "components/policy/policy_constants.h"
@@ -22,9 +23,15 @@ namespace {
bool LoadUserDataDirPolicyFromRegistry(HKEY hive,
const char* key_name_str,
base::FilePath* dir) {
+ const std::wstring policy_key =
+ policy::ChromeBrowserPolicyConnector::GetPolicyKey();
+ if (policy_key.empty()) {
+ return false;
+ }
+
std::wstring value;
std::wstring key_name(base::ASCIIToWide(key_name_str));
- base::win::RegKey key(hive, policy::kRegistryChromePolicyKey, KEY_READ);
+ base::win::RegKey key(hive, policy_key.c_str(), KEY_READ);
if (key.ReadValue(key_name.c_str(), &value) == ERROR_SUCCESS) {
*dir = base::FilePath(policy::path_parser::ExpandPathVariables(value));
return true;
diff --git chrome/common/chrome_paths.cc chrome/common/chrome_paths.cc
index 1d75edad24781..62dda7d933828 100644
--- chrome/common/chrome_paths.cc
+++ chrome/common/chrome_paths.cc
@@ -504,7 +504,8 @@ bool PathProvider(int key, base::FilePath* result) {
return false;
}
break;
-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_OPENBSD)
+#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_OPENBSD) && \
+ !BUILDFLAG(ENABLE_CEF)
case chrome::DIR_POLICY_FILES: {
cur = base::FilePath(policy::kPolicyPath);
break;
diff --git chrome/common/chrome_paths.h chrome/common/chrome_paths.h
index ab0301b8eb26d..3ed179ccf84bf 100644
--- chrome/common/chrome_paths.h
+++ chrome/common/chrome_paths.h
@@ -8,6 +8,7 @@
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "cef/libcef/features/features.h"
#include "third_party/widevine/cdm/buildflags.h"
namespace base {
@@ -46,7 +47,7 @@ enum {
DIR_INTERNAL_PLUGINS, // Directory where internal plugins reside.
DIR_COMPONENTS, // Directory where built-in implementations of
// component-updated libraries or data reside.
-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
+#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(ENABLE_CEF)
DIR_POLICY_FILES, // Directory for system-wide read-only
// policy files that allow sys-admins
// to set policies for chrome. This directory
diff --git components/policy/tools/generate_policy_source.py components/policy/tools/generate_policy_source.py
index e9d31053cb2ea..793ceac3c7772 100755
--- components/policy/tools/generate_policy_source.py
+++ components/policy/tools/generate_policy_source.py
@@ -500,6 +500,7 @@ def _WritePolicyConstantHeader(all_policies, policy_atomic_groups,
#include <cstdint>
#include <string>
+#include "cef/libcef/features/features.h"
#include "components/policy/core/common/policy_details.h"
#include "components/policy/core/common/policy_map.h"
@@ -522,9 +523,11 @@ struct SchemaData;
''')
if target_platform == 'win':
- f.write('// The windows registry path where Chrome policy '
+ f.write('#if !BUILDFLAG(ENABLE_CEF)\n'
+ '// The windows registry path where Chrome policy '
'configuration resides.\n'
- 'extern const wchar_t kRegistryChromePolicyKey[];\n')
+ 'extern const wchar_t kRegistryChromePolicyKey[];\n'
+ '#endif\n')
f.write('''#if BUILDFLAG(IS_CHROMEOS)
// Sets default profile policies values for enterprise users.
@@ -1167,12 +1170,14 @@ namespace policy {
f.write('} // namespace\n\n')
if target_platform == 'win':
- f.write('#if BUILDFLAG(GOOGLE_CHROME_BRANDING)\n'
+ f.write('#if !BUILDFLAG(ENABLE_CEF)\n'
+ '#if BUILDFLAG(GOOGLE_CHROME_BRANDING)\n'
'const wchar_t kRegistryChromePolicyKey[] = '
'L"' + CHROME_POLICY_KEY + '";\n'
'#else\n'
'const wchar_t kRegistryChromePolicyKey[] = '
'L"' + CHROMIUM_POLICY_KEY + '";\n'
+ '#endif\n'
'#endif\n\n')
# Setting enterprise defaults code generation.

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/themes/theme_service.cc chrome/browser/themes/theme_service.cc
index 3b1af39b69a60..3f3f15c23a74f 100644
index dbd628982e216..d77a39111e254 100644
--- chrome/browser/themes/theme_service.cc
+++ chrome/browser/themes/theme_service.cc
@@ -29,6 +29,7 @@

View File

@@ -233,7 +233,7 @@ index a85dd48b0c298..11944bf767f9b 100644
+#endif
}
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
index 267387e7e079c..48376496d4895 100644
index 6f989cff781d7..ee47d6c976cb6 100644
--- chrome/browser/chrome_content_browser_client.cc
+++ chrome/browser/chrome_content_browser_client.cc
@@ -42,6 +42,7 @@
@@ -265,7 +265,7 @@ index 267387e7e079c..48376496d4895 100644
// static
void ChromeContentBrowserClient::RegisterLocalStatePrefs(
PrefRegistrySimple* registry) {
@@ -4431,9 +4439,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
@@ -4436,9 +4444,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
&search::HandleNewTabURLReverseRewrite);
#endif // BUILDFLAG(IS_ANDROID)
@@ -277,7 +277,7 @@ index 267387e7e079c..48376496d4895 100644
}
base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() {
@@ -6494,7 +6504,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
@@ -6499,7 +6509,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
#endif
}
@@ -286,7 +286,7 @@ index 267387e7e079c..48376496d4895 100644
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -6512,6 +6522,8 @@ void ChromeContentBrowserClient::ConfigureNetworkContextParams(
@@ -6517,6 +6527,8 @@ void ChromeContentBrowserClient::ConfigureNetworkContextParams(
network_context_params->user_agent = GetUserAgentBasedOnPolicy(context);
network_context_params->accept_language = GetApplicationLocale();
}
@@ -295,7 +295,7 @@ index 267387e7e079c..48376496d4895 100644
}
std::vector<base::FilePath>
@@ -7577,10 +7589,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
@@ -7582,10 +7594,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
const auto now = base::TimeTicks::Now();
const auto timeout = GetKeepaliveTimerTimeout(context);
keepalive_deadline_ = std::max(keepalive_deadline_, now + timeout);
@@ -308,7 +308,7 @@ index 267387e7e079c..48376496d4895 100644
FROM_HERE, keepalive_deadline_ - now,
base::BindOnce(
&ChromeContentBrowserClient::OnKeepaliveTimerFired,
@@ -7599,7 +7611,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
@@ -7604,7 +7616,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
--num_keepalive_requests_;
if (num_keepalive_requests_ == 0) {
DVLOG(1) << "Stopping the keepalive timer";
@@ -318,7 +318,7 @@ index 267387e7e079c..48376496d4895 100644
// This deletes the keep alive handle attached to the timer function and
// unblock the shutdown sequence.
}
@@ -7741,7 +7754,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
@@ -7746,7 +7759,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
const auto now = base::TimeTicks::Now();
const auto then = keepalive_deadline_;
if (now < then) {
@@ -359,7 +359,7 @@ index 28633d6bd4cb9..d17cbef0ae5af 100644
#endif
diff --git chrome/browser/prefs/browser_prefs.cc chrome/browser/prefs/browser_prefs.cc
index 327282bd86785..a27fb4161b70c 100644
index 3e966e183a67f..a6e2991127496 100644
--- chrome/browser/prefs/browser_prefs.cc
+++ chrome/browser/prefs/browser_prefs.cc
@@ -14,6 +14,7 @@
@@ -381,7 +381,7 @@ index 327282bd86785..a27fb4161b70c 100644
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/accessibility/animation_policy_prefs.h"
#include "chrome/browser/apps/platform_apps/shortcut_manager.h"
@@ -1531,6 +1536,11 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
@@ -1532,6 +1537,11 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
// This is intentionally last.
RegisterLocalStatePrefsForMigration(registry);
@@ -393,7 +393,7 @@ index 327282bd86785..a27fb4161b70c 100644
}
// Register prefs applicable to all profiles.
@@ -1945,6 +1955,10 @@ void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
@@ -1947,6 +1957,10 @@ void RegisterUserProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
const std::string& locale) {
RegisterProfilePrefs(registry, locale);

View File

@@ -41,7 +41,7 @@ index db31ee0b50746..2f3aebdcb6101 100644
bool BrowserCommandController::IsWebAppOrCustomTab() const {
diff --git chrome/browser/ui/toolbar/app_menu_model.cc chrome/browser/ui/toolbar/app_menu_model.cc
index 2f7825a3bdf38..8553f4293c576 100644
index 1edfddc63af51..d4ee5f2c93cc0 100644
--- chrome/browser/ui/toolbar/app_menu_model.cc
+++ chrome/browser/ui/toolbar/app_menu_model.cc
@@ -590,6 +590,57 @@ SaveAndShareSubMenuModel::SaveAndShareSubMenuModel(
@@ -102,7 +102,7 @@ index 2f7825a3bdf38..8553f4293c576 100644
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -1370,7 +1421,7 @@ bool AppMenuModel::IsCommandIdChecked(int command_id) const {
@@ -1385,7 +1436,7 @@ bool AppMenuModel::IsCommandIdChecked(int command_id) const {
return false;
}
@@ -111,7 +111,7 @@ index 2f7825a3bdf38..8553f4293c576 100644
GlobalError* error =
GlobalErrorServiceFactory::GetForProfile(browser_->profile())
->GetGlobalErrorByMenuItemCommandID(command_id);
@@ -1385,6 +1436,30 @@ bool AppMenuModel::IsCommandIdEnabled(int command_id) const {
@@ -1400,6 +1451,30 @@ bool AppMenuModel::IsCommandIdEnabled(int command_id) const {
}
}
@@ -142,7 +142,7 @@ index 2f7825a3bdf38..8553f4293c576 100644
bool AppMenuModel::IsCommandIdAlerted(int command_id) const {
if ((command_id == IDC_RECENT_TABS_MENU) ||
(command_id == AppMenuModel::kMinRecentTabsCommandId)) {
@@ -1555,11 +1630,15 @@ void AppMenuModel::Build() {
@@ -1570,11 +1645,15 @@ void AppMenuModel::Build() {
kDefaultIconSize));
}
@@ -163,7 +163,7 @@ index 2f7825a3bdf38..8553f4293c576 100644
AddItemWithStringId(IDC_PRINT, IDS_PRINT);
@@ -1640,9 +1719,13 @@ void AppMenuModel::Build() {
@@ -1655,9 +1734,13 @@ void AppMenuModel::Build() {
kMoreToolsMenuItem);
if (!features::IsChromeRefresh2023()) {
@@ -180,7 +180,7 @@ index 2f7825a3bdf38..8553f4293c576 100644
}
if (!features::IsChromeRefresh2023()) {
@@ -1724,6 +1807,11 @@ void AppMenuModel::Build() {
@@ -1739,6 +1822,11 @@ void AppMenuModel::Build() {
SetCommandIcon(this, IDC_EXIT, kExitMenuIcon);
}
@@ -193,10 +193,10 @@ index 2f7825a3bdf38..8553f4293c576 100644
}
diff --git chrome/browser/ui/toolbar/app_menu_model.h chrome/browser/ui/toolbar/app_menu_model.h
index fe6f250d169a3..606cbd2e248b3 100644
index f06cf1bf08ba4..4e89b522715fc 100644
--- chrome/browser/ui/toolbar/app_menu_model.h
+++ chrome/browser/ui/toolbar/app_menu_model.h
@@ -202,6 +202,7 @@ class AppMenuModel : public ui::SimpleMenuModel,
@@ -204,6 +204,7 @@ class AppMenuModel : public ui::SimpleMenuModel,
void ExecuteCommand(int command_id, int event_flags) override;
bool IsCommandIdChecked(int command_id) const override;
bool IsCommandIdEnabled(int command_id) const override;
@@ -204,7 +204,7 @@ index fe6f250d169a3..606cbd2e248b3 100644
bool IsCommandIdAlerted(int command_id) const override;
bool GetAcceleratorForCommandId(int command_id,
ui::Accelerator* accelerator) const override;
@@ -234,6 +235,8 @@ class AppMenuModel : public ui::SimpleMenuModel,
@@ -236,6 +237,8 @@ class AppMenuModel : public ui::SimpleMenuModel,
// took to select the command.
void LogMenuMetrics(int command_id);
@@ -231,7 +231,7 @@ index 59024587ef6b7..0c30aa71768cf 100644
void FindBarHost::RegisterAccelerators() {
diff --git chrome/browser/ui/views/frame/browser_frame.cc chrome/browser/ui/views/frame/browser_frame.cc
index c3b5d07643806..761cc6306363f 100644
index bb4b3821bcfda..9734fe4aaffcf 100644
--- chrome/browser/ui/views/frame/browser_frame.cc
+++ chrome/browser/ui/views/frame/browser_frame.cc
@@ -114,15 +114,23 @@ ui::ColorProviderKey::SchemeVariant GetSchemeVariant(
@@ -331,7 +331,7 @@ index c3b5d07643806..761cc6306363f 100644
key.app_controller = browser_view_->browser()->app_controller();
@@ -642,5 +672,8 @@ bool BrowserFrame::RegenerateFrameOnThemeChange(
@@ -632,5 +662,8 @@ bool BrowserFrame::RegenerateFrameOnThemeChange(
}
bool BrowserFrame::IsIncognitoBrowser() const {
@@ -355,7 +355,7 @@ index 0c231b6ac5b01..6b5af98e18e42 100644
BrowserFrame(const BrowserFrame&) = delete;
BrowserFrame& operator=(const BrowserFrame&) = delete;
diff --git chrome/browser/ui/views/frame/browser_view.cc chrome/browser/ui/views/frame/browser_view.cc
index 2c4cb9a1e892c..b7336650fc418 100644
index 2c4cb9a1e892c..2e38fc9d32d98 100644
--- chrome/browser/ui/views/frame/browser_view.cc
+++ chrome/browser/ui/views/frame/browser_view.cc
@@ -338,11 +338,10 @@ using content::NativeWebKeyboardEvent;
@@ -423,7 +423,42 @@ index 2c4cb9a1e892c..b7336650fc418 100644
contents_separator_ =
top_container_->AddChildView(std::make_unique<ContentsSeparator>());
@@ -1147,12 +1163,14 @@ gfx::Size BrowserView::GetWebAppFrameToolbarPreferredSize() const {
@@ -1019,7 +1035,9 @@ BrowserView::~BrowserView() {
// All the tabs should have been destroyed already. If we were closed by the
// OS with some tabs than the NativeBrowserFrame should have destroyed them.
+ if (browser_) {
DCHECK_EQ(0, browser_->tab_strip_model()->count());
+ }
// Stop the animation timer explicitly here to avoid running it in a nested
// message loop, which may run by Browser destructor.
@@ -1033,12 +1051,14 @@ BrowserView::~BrowserView() {
// child views and it is an observer for avatar toolbar button if any.
autofill_bubble_handler_.reset();
+ if (browser_) {
auto* global_registry =
extensions::ExtensionCommandsGlobalRegistry::Get(browser_->profile());
if (global_registry->registry_for_active_window() ==
extension_keybinding_registry_.get()) {
global_registry->set_registry_for_active_window(nullptr);
}
+ }
// The TabStrip attaches a listener to the model. Make sure we shut down the
// TabStrip first so that it can cleanly remove the listener.
@@ -1056,7 +1076,9 @@ BrowserView::~BrowserView() {
// `SidePanelUI::RemoveSidePanelUIForBrowser()` deletes the
// SidePanelCoordinator.
+ if (browser()) {
SidePanelUI::RemoveSidePanelUIForBrowser(browser());
+ }
}
// static
@@ -1147,12 +1169,14 @@ gfx::Size BrowserView::GetWebAppFrameToolbarPreferredSize() const {
#if BUILDFLAG(IS_MAC)
bool BrowserView::UsesImmersiveFullscreenMode() const {
@@ -440,7 +475,7 @@ index 2c4cb9a1e892c..b7336650fc418 100644
}
bool BrowserView::UsesImmersiveFullscreenTabbedMode() const {
@@ -1914,6 +1932,8 @@ bool BrowserView::ShouldHideUIForFullscreen() const {
@@ -1914,6 +1938,8 @@ bool BrowserView::ShouldHideUIForFullscreen() const {
if (immersive_mode_controller_->IsEnabled())
return false;
@@ -449,7 +484,7 @@ index 2c4cb9a1e892c..b7336650fc418 100644
return frame_->GetFrameView()->ShouldHideTopUIForFullscreen();
}
@@ -2921,7 +2941,8 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
@@ -2921,7 +2947,8 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
}
DownloadBubbleUIController* BrowserView::GetDownloadBubbleUIController() {
@@ -459,7 +494,7 @@ index 2c4cb9a1e892c..b7336650fc418 100644
if (auto* download_button = toolbar_button_provider_->GetDownloadButton())
return download_button->bubble_controller();
return nullptr;
@@ -3454,7 +3475,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
@@ -3454,7 +3481,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
if (top_container()->parent() == this)
return;
@@ -469,7 +504,7 @@ index 2c4cb9a1e892c..b7336650fc418 100644
top_container()->DestroyLayer();
AddChildViewAt(top_container(), 0);
EnsureFocusOrder();
@@ -3904,11 +3926,38 @@ void BrowserView::GetAccessiblePanes(std::vector<views::View*>* panes) {
@@ -3904,11 +3932,38 @@ void BrowserView::GetAccessiblePanes(std::vector<views::View*>* panes) {
bool BrowserView::ShouldDescendIntoChildForEventHandling(
gfx::NativeView child,
const gfx::Point& location) {
@@ -510,7 +545,7 @@ index 2c4cb9a1e892c..b7336650fc418 100644
// Draggable regions are defined relative to the web contents.
gfx::Point point_in_contents_web_view_coords(location);
views::View::ConvertPointToTarget(GetWidget()->GetRootView(),
@@ -3917,7 +3966,7 @@ bool BrowserView::ShouldDescendIntoChildForEventHandling(
@@ -3917,7 +3972,7 @@ bool BrowserView::ShouldDescendIntoChildForEventHandling(
// Draggable regions should be ignored for clicks into any browser view's
// owned widgets, for example alerts, permission prompts or find bar.
@@ -519,7 +554,7 @@ index 2c4cb9a1e892c..b7336650fc418 100644
point_in_contents_web_view_coords.x(),
point_in_contents_web_view_coords.y()) ||
WidgetOwnedByAnchorContainsPoint(point_in_contents_web_view_coords);
@@ -4025,8 +4074,10 @@ void BrowserView::Layout() {
@@ -4025,8 +4080,10 @@ void BrowserView::Layout() {
// TODO(jamescook): Why was this in the middle of layout code?
toolbar_->location_bar()->omnibox_view()->SetFocusBehavior(
@@ -532,7 +567,7 @@ index 2c4cb9a1e892c..b7336650fc418 100644
#if BUILDFLAG(IS_CHROMEOS_ASH)
// In chromeOS ash we round the bottom two corners of the browser frame by
@@ -4104,6 +4155,11 @@ void BrowserView::AddedToWidget() {
@@ -4104,6 +4161,11 @@ void BrowserView::AddedToWidget() {
SetThemeProfileForWindow(GetNativeWindow(), browser_->profile());
#endif
@@ -544,7 +579,7 @@ index 2c4cb9a1e892c..b7336650fc418 100644
toolbar_->Init();
// TODO(pbos): Investigate whether the side panels should be creatable when
@@ -4152,13 +4208,9 @@ void BrowserView::AddedToWidget() {
@@ -4152,13 +4214,9 @@ void BrowserView::AddedToWidget() {
EnsureFocusOrder();
@@ -560,7 +595,7 @@ index 2c4cb9a1e892c..b7336650fc418 100644
using_native_frame_ = frame_->ShouldUseNativeFrame();
MaybeInitializeWebUITabStrip();
@@ -4571,7 +4623,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
@@ -4571,7 +4629,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
// Undo our anti-jankiness hacks and force a re-layout.
in_process_fullscreen_ = false;
ToolbarSizeChanged(false);
@@ -570,7 +605,7 @@ index 2c4cb9a1e892c..b7336650fc418 100644
}
bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
@@ -4942,6 +4995,8 @@ Profile* BrowserView::GetProfile() {
@@ -4942,6 +5001,8 @@ Profile* BrowserView::GetProfile() {
}
void BrowserView::UpdateUIForTabFullscreen() {
@@ -579,7 +614,7 @@ index 2c4cb9a1e892c..b7336650fc418 100644
frame()->GetFrameView()->UpdateFullscreenTopUI();
}
@@ -4964,6 +5019,8 @@ void BrowserView::HideDownloadShelf() {
@@ -4964,6 +5025,8 @@ void BrowserView::HideDownloadShelf() {
}
bool BrowserView::CanUserExitFullscreen() const {
@@ -665,7 +700,7 @@ index 8267a265a8e10..ee08f18e96a34 100644
ContentsWebView::~ContentsWebView() {
diff --git chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc
index f1d303e9b7fd8..8a5935e8f10da 100644
index f1d303e9b7fd8..fa1dcef4ec63f 100644
--- chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc
+++ chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc
@@ -549,6 +549,11 @@ PictureInPictureBrowserFrameView::PictureInPictureBrowserFrameView(
@@ -680,7 +715,7 @@ index f1d303e9b7fd8..8a5935e8f10da 100644
}
PictureInPictureBrowserFrameView::~PictureInPictureBrowserFrameView() {
@@ -644,17 +649,20 @@ gfx::Rect PictureInPictureBrowserFrameView::GetWindowBoundsForClientBounds(
@@ -644,18 +649,42 @@ gfx::Rect PictureInPictureBrowserFrameView::GetWindowBoundsForClientBounds(
int PictureInPictureBrowserFrameView::NonClientHitTest(
const gfx::Point& point) {
@@ -689,18 +724,14 @@ index f1d303e9b7fd8..8a5935e8f10da 100644
- GetBackToTabControlsBounds().Contains(point) ||
- GetCloseControlsBounds().Contains(point)) {
- return HTCLIENT;
- }
-
- for (size_t i = 0; i < content_setting_views_.size(); i++) {
- if (GetContentSettingViewBounds(i).Contains(point)) {
+ const bool frameless = !top_bar_container_view_->GetVisible();
+ if (!frameless) {
+ // Allow interacting with the buttons.
+ if (GetLocationIconViewBounds().Contains(point) ||
+ GetBackToTabControlsBounds().Contains(point) ||
+ GetCloseControlsBounds().Contains(point)) {
return HTCLIENT;
}
+ return HTCLIENT;
+ }
+
+ for (size_t i = 0; i < content_setting_views_.size(); i++) {
+ if (GetContentSettingViewBounds(i).Contains(point)) {
@@ -709,11 +740,9 @@ index f1d303e9b7fd8..8a5935e8f10da 100644
+ }
}
// Allow dragging and resizing the window.
@@ -664,6 +672,27 @@ int PictureInPictureBrowserFrameView::NonClientHitTest(
if (window_component != HTNOWHERE)
return window_component;
- for (size_t i = 0; i < content_setting_views_.size(); i++) {
- if (GetContentSettingViewBounds(i).Contains(point)) {
- return HTCLIENT;
+#if BUILDFLAG(ENABLE_CEF)
+ if (frameless) {
+ // Match logic in BrowserView::ShouldDescendIntoChildForEventHandling.
@@ -731,13 +760,12 @@ index f1d303e9b7fd8..8a5935e8f10da 100644
+ point_in_contents_web_view_coords.y())) {
+ return HTCAPTION;
+ }
+ }
+ }
}
}
+#endif // BUILDFLAG(ENABLE_CEF)
+
// Allow interacting with the web contents.
int frame_component = frame()->client_view()->NonClientHitTest(point);
if (frame_component != HTNOWHERE)
// Allow dragging and resizing the window.
int window_component = GetHTComponentForFrame(
@@ -722,7 +751,8 @@ void PictureInPictureBrowserFrameView::Layout() {
gfx::Rect content_area = GetLocalBounds();
content_area.Inset(FrameBorderInsets());

View File

@@ -131,7 +131,7 @@ index 3d2108f13ea2f..261b0a42bfb21 100644
ExtensionRegistry::Get(browser_context_)->RemoveObserver(this);
diff --git extensions/browser/extension_host.h extensions/browser/extension_host.h
index dda0620251895..2b29bdef52444 100644
index dda0620251895..4014bd801f727 100644
--- extensions/browser/extension_host.h
+++ extensions/browser/extension_host.h
@@ -62,6 +62,12 @@ class ExtensionHost : public DeferredStartRenderHost,

View File

@@ -79,10 +79,10 @@ index e6078b2a45d88..bf051fb8a02f4 100644
web_instance->SetPreferredContrast(CalculatePreferredContrast());
web_instance->set_prefers_reduced_transparency(PrefersReducedTransparency());
diff --git ui/native_theme/native_theme_win.cc ui/native_theme/native_theme_win.cc
index faa15be0b3e08..a61974c495507 100644
index 595b718583212..001a8a041090e 100644
--- ui/native_theme/native_theme_win.cc
+++ ui/native_theme/native_theme_win.cc
@@ -656,14 +656,17 @@ bool NativeThemeWin::ShouldUseDarkColors() const {
@@ -661,14 +661,17 @@ bool NativeThemeWin::ShouldUseDarkColors() const {
// Windows high contrast modes are entirely different themes,
// so let them take priority over dark mode.
// ...unless --force-dark-mode was specified in which case caveat emptor.
@@ -102,7 +102,7 @@ index faa15be0b3e08..a61974c495507 100644
return NativeTheme::CalculatePreferredColorScheme();
// According to the spec, the preferred color scheme for web content is 'dark'
@@ -1652,8 +1655,9 @@ void NativeThemeWin::RegisterColorFilteringRegkeyObserver() {
@@ -1657,8 +1660,9 @@ void NativeThemeWin::RegisterColorFilteringRegkeyObserver() {
}
void NativeThemeWin::UpdateDarkModeStatus() {

View File

@@ -41,10 +41,10 @@ index afefe3cd83dee..6668463247644 100644
} // namespace content
diff --git content/browser/renderer_host/render_widget_host_impl.cc content/browser/renderer_host/render_widget_host_impl.cc
index 9e946e02bca27..220b1ffecf063 100644
index 916c3f324ed21..3e6041cfc9ee0 100644
--- content/browser/renderer_host/render_widget_host_impl.cc
+++ content/browser/renderer_host/render_widget_host_impl.cc
@@ -3255,6 +3255,11 @@ void RenderWidgetHostImpl::OnInvalidInputEventSource() {
@@ -3265,6 +3265,11 @@ void RenderWidgetHostImpl::OnInvalidInputEventSource() {
GetProcess(), bad_message::INPUT_ROUTER_INVALID_EVENT_SOURCE);
}

View File

@@ -195,10 +195,10 @@ index 6c804ec1092af..605ff3b32b0b8 100644
void CookieManager::SetForceKeepSessionState() {
diff --git services/network/network_context.cc services/network/network_context.cc
index f076c5dc62ca5..5b53652ef63df 100644
index a107e19d2aa1c..9e37a743a5548 100644
--- services/network/network_context.cc
+++ services/network/network_context.cc
@@ -2444,16 +2444,20 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
@@ -2446,16 +2446,20 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
network_service_->network_quality_estimator());
}
@@ -227,7 +227,7 @@ index f076c5dc62ca5..5b53652ef63df 100644
base::FeatureList::IsEnabled(features::kFledgePst)) {
trust_token_store_ = std::make_unique<PendingTrustTokenStore>();
diff --git services/network/public/mojom/network_context.mojom services/network/public/mojom/network_context.mojom
index 039407080ba9b..aa960e5943129 100644
index 6164ab364a404..44ab11a34eb44 100644
--- services/network/public/mojom/network_context.mojom
+++ services/network/public/mojom/network_context.mojom
@@ -377,6 +377,9 @@ struct NetworkContextParams {

View File

@@ -285,18 +285,18 @@ void OnTestSMRProcessMessageReceived(
static_cast<const bv_utils::RendererMessage*>(region->Memory());
const auto message_size =
std::max(region->Size(), sizeof(bv_utils::BrowserMessage));
const auto renderer_time = renderer_msg->start_time;
const auto duration = finish_time - renderer_time;
const auto start_time = bv_utils::Now();
std::vector<uint8_t> data(message_size);
const auto browser_msg =
reinterpret_cast<bv_utils::BrowserMessage*>(data.data());
browser_msg->test_id = renderer_msg->test_id;
browser_msg->duration = finish_time - renderer_msg->start_time;
browser_msg->start_time = bv_utils::Now();
auto builder = CefSharedProcessMessageBuilder::Create(
bv_utils::kTestSendSMRProcessMessage, message_size);
const auto browser_msg =
static_cast<bv_utils::BrowserMessage*>(builder->Memory());
browser_msg->test_id = renderer_msg->test_id;
browser_msg->duration = duration;
browser_msg->start_time = start_time;
bv_utils::CopyDataIntoMemory(data, builder->Memory());
frame->SendProcessMessage(PID_RENDERER, builder->Build());
}

View File

@@ -7,6 +7,7 @@
#include <algorithm>
#include "include/cef_parser.h"
#include "tests/cefclient/browser/test_runner.h"
#include "tests/shared/browser/client_app_browser.h"
#include "tests/shared/common/client_switches.h"
#include "tests/shared/common/string_util.h"
@@ -128,7 +129,7 @@ MainContextImpl::MainContextImpl(CefRefPtr<CefCommandLine> command_line,
if (use_views_ && command_line->HasSwitch(switches::kHideFrame) &&
!command_line_->HasSwitch(switches::kUrl)) {
// Use the draggable regions test as the default URL for frameless windows.
main_url_ = "http://tests/draggable";
main_url_ = test_runner::GetTestURL("draggable");
}
if (command_line_->HasSwitch(switches::kBackgroundColor)) {
@@ -213,6 +214,23 @@ void MainContextImpl::PopulateSettings(CefSettings* settings) {
CefString(&settings->accept_language_list) =
command_line_->GetSwitchValue("lang");
}
if (command_line_->HasSwitch("enable-chrome-policy")) {
// Enable Chrome policy management via Platform and OS-user policies.
// Use the same configuration ID as Google Chrome for testing purposes.
// If Google Chrome is managed on this machine we'll show the same
// configured policies in chrome://policy/.
CefString(&settings->chrome_policy_id) =
#if defined(OS_WIN)
"SOFTWARE\\Policies\\Google\\Chrome";
#elif defined(OS_MAC)
"com.google.Chrome";
#elif defined(OS_LINUX)
"/etc/opt/chrome/policies";
#else
"";
#endif
}
}
void MainContextImpl::PopulateBrowserSettings(CefBrowserSettings* settings) {
@@ -223,8 +241,9 @@ void MainContextImpl::PopulateBrowserSettings(CefBrowserSettings* settings) {
}
if (use_chrome_runtime_ &&
command_line_->HasSwitch(switches::kHideChromeStatusBubble)) {
command_line_->HasSwitch(switches::kHideChromeBubbles)) {
settings->chrome_status_bubble = STATE_DISABLED;
settings->chrome_zoom_bubble = STATE_DISABLED;
}
}

View File

@@ -31,9 +31,6 @@ const char kPortKey[] = "port";
const char kStatusKey[] = "status";
const char kMessageKey[] = "message";
// Required URL for cefQuery execution.
const char kTestUrl[] = "http://tests/server";
// Server default values.
const char kServerAddress[] = "127.0.0.1";
const int kServerPortDefault = 8099;
@@ -234,7 +231,7 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
// Only handle messages from the test URL.
const std::string& url = frame->GetURL();
if (url.find(kTestUrl) != 0) {
if (url.find(test_runner::GetTestURL("server")) != 0) {
return false;
}

View File

@@ -39,7 +39,7 @@ namespace {
const char kTestHost[] = "tests";
const char kLocalHost[] = "localhost";
const char kTestOrigin[] = "http://tests/";
const char kTestOrigin[] = "https://tests/";
// Pages handled via StringResourceProvider.
const char kTestGetSourcePage[] = "get_source.html";
@@ -102,18 +102,18 @@ void RunRequestTest(CefRefPtr<CefBrowser> browser) {
// Create a new request
CefRefPtr<CefRequest> request(CefRequest::Create());
if (browser->GetMainFrame()->GetURL().ToString().find("http://tests/") != 0) {
if (browser->GetMainFrame()->GetURL().ToString().find(kTestOrigin) != 0) {
// The LoadRequest method will fail with "bad IPC message" reason
// INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the
// request origin using some other mechanism (LoadURL, link click, etc).
Alert(browser,
"Please first navigate to a http://tests/ URL. "
"For example, first load Tests > Other Tests.");
Alert(browser, "Please first navigate to a " + std::string(kTestOrigin) +
" URL. "
"For example, first load Tests > Other Tests.");
return;
}
// Set the request URL
request->SetURL("http://tests/request");
request->SetURL(GetTestURL("request"));
// Add post data to the request. The correct method and content-
// type headers will be set by CEF.
@@ -160,16 +160,6 @@ void RunDialogWindowTest(CefRefPtr<CefBrowser> browser) {
std::move(config));
}
void ModifyZoom(CefRefPtr<CefBrowser> browser, double delta) {
if (!CefCurrentlyOn(TID_UI)) {
// Execute on the UI thread.
CefPostTask(TID_UI, base::BindOnce(&ModifyZoom, browser, delta));
return;
}
browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() + delta);
}
const char kPrompt[] = "Prompt.";
const char kPromptFPS[] = "FPS";
const char kPromptDSF[] = "DSF";
@@ -419,7 +409,7 @@ void MuteAudio(CefRefPtr<CefBrowser> browser, bool mute) {
}
void RunOtherTests(CefRefPtr<CefBrowser> browser) {
browser->GetMainFrame()->LoadURL("http://tests/other_tests");
browser->GetMainFrame()->LoadURL(GetTestURL("other_tests"));
}
// Provider that dumps the request contents.
@@ -569,13 +559,13 @@ void RunTest(CefRefPtr<CefBrowser> browser, int id) {
RunRequestTest(browser);
break;
case ID_TESTS_ZOOM_IN:
ModifyZoom(browser, 0.5);
browser->GetHost()->Zoom(CEF_ZOOM_COMMAND_IN);
break;
case ID_TESTS_ZOOM_OUT:
ModifyZoom(browser, -0.5);
browser->GetHost()->Zoom(CEF_ZOOM_COMMAND_OUT);
break;
case ID_TESTS_ZOOM_RESET:
browser->GetHost()->SetZoomLevel(0.0);
browser->GetHost()->Zoom(CEF_ZOOM_COMMAND_RESET);
break;
case ID_TESTS_OSR_FPS:
PromptFPS(browser);
@@ -679,7 +669,7 @@ CefRefPtr<CefStreamReader> GetDumpResponse(
}
if (!origin.empty() &&
(origin.find("http://" + std::string(kTestHost)) == 0 ||
(origin.find("https://" + std::string(kTestHost)) == 0 ||
origin.find("http://" + std::string(kLocalHost)) == 0)) {
// Allow cross-origin XMLHttpRequests from test origins.
response_headers.insert(
@@ -832,6 +822,10 @@ void Alert(CefRefPtr<CefBrowser> browser, const std::string& message) {
frame->ExecuteJavaScript("alert('" + msg + "');", frame->GetURL(), 0);
}
std::string GetTestURL(const std::string& path) {
return kTestOrigin + path;
}
bool IsTestURL(const std::string& url, const std::string& path) {
CefURLParts parts;
CefParseURL(url, parts);

View File

@@ -44,8 +44,11 @@ void SetupResourceManager(CefRefPtr<CefResourceManager> resource_manager,
// Show a JS alert message.
void Alert(CefRefPtr<CefBrowser> browser, const std::string& message);
// Returns "https://tests/<path>".
std::string GetTestURL(const std::string& path);
// Returns true if |url| is a test URL with the specified |path|. This matches
// both http://tests/<path> and http://localhost:xxxx/<path>.
// both "https://tests/<path>" and "http://localhost:xxxx/<path>".
bool IsTestURL(const std::string& url, const std::string& path);
// Create all CefMessageRouterBrowserSide::Handler objects. They will be

View File

@@ -277,12 +277,18 @@ void ViewsWindow::SetFavicon(CefRefPtr<CefImage> image) {
void ViewsWindow::SetFullscreen(bool fullscreen) {
CEF_REQUIRE_UI_THREAD();
if (window_) {
// Hide the top controls while in full-screen mode.
if (with_controls_) {
ShowTopControls(!fullscreen);
}
// For Chrome runtime we ignore this notification from
// ClientHandler::OnFullscreenModeChange(). Chrome runtime will trigger
// the fullscreen change internally and then call
// OnWindowFullscreenTransition().
if (MainContext::Get()->UseChromeRuntime()) {
return;
}
// For Alloy runtime we need to explicitly trigger the fullscreen change.
if (window_) {
// Results in a call to OnWindowFullscreenTransition().
window_->SetFullscreen(fullscreen);
}
}
@@ -404,10 +410,12 @@ bool ViewsWindow::GetWindowRestorePreferences(
show_state = CEF_SHOW_STATE_NORMAL;
if (window_->IsMinimized()) {
show_state = CEF_SHOW_STATE_MINIMIZED;
} else if (window_->IsFullscreen()) {
// On MacOS, IsMaximized() will also return true for fullscreen, so check
// IsFullscreen() first.
show_state = CEF_SHOW_STATE_FULLSCREEN;
} else if (window_->IsMaximized()) {
show_state = CEF_SHOW_STATE_MAXIMIZED;
} else if (window_->IsFullscreen()) {
show_state = CEF_SHOW_STATE_FULLSCREEN;
}
if (show_state == CEF_SHOW_STATE_NORMAL) {
@@ -626,6 +634,37 @@ bool ViewsWindow::OnKeyEvent(CefRefPtr<CefTextfield> textfield,
return false;
}
void ViewsWindow::OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
bool is_completed) {
#if defined(OS_MAC)
// On MacOS we get two asynchronous callbacks, and we want to change the UI on
// |is_completed=false| (e.g. when the fullscreen transition begins).
const bool should_change = !is_completed;
#else
// On other platforms we only get a single synchronous callback with
// |is_completed=true|.
DCHECK(is_completed);
const bool should_change = true;
#endif
// Hide the top controls while in fullscreen mode.
if (should_change && with_controls_) {
ShowTopControls(!window->IsFullscreen());
}
// With Alloy runtime we need to explicitly exit browser fullscreen when
// exiting window fullscreen. Chrome runtime handles this internally.
if (!MainContext::Get()->UseChromeRuntime() && should_change &&
!window->IsFullscreen()) {
CefRefPtr<CefBrowser> browser = browser_view_->GetBrowser();
if (browser && browser->GetHost()->IsFullscreen()) {
// Will not cause a resize because the fullscreen transition has already
// begun.
browser->GetHost()->ExitFullscreen(/*will_cause_resize=*/false);
}
}
}
void ViewsWindow::OnWindowCreated(CefRefPtr<CefWindow> window) {
CEF_REQUIRE_UI_THREAD();
DCHECK(browser_view_);

View File

@@ -188,6 +188,8 @@ class ViewsWindow : public CefBrowserViewDelegate,
bool OnAccelerator(CefRefPtr<CefWindow> window, int command_id) override;
bool OnKeyEvent(CefRefPtr<CefWindow> window,
const CefKeyEvent& event) override;
void OnWindowFullscreenTransition(CefRefPtr<CefWindow> window,
bool is_completed) override;
// CefViewDelegate methods:
CefSize GetPreferredSize(CefRefPtr<CefView> view) override;

View File

@@ -35,6 +35,7 @@ const char kMessagePositionName[] = "WindowTest.Position";
const char kMessageMinimizeName[] = "WindowTest.Minimize";
const char kMessageMaximizeName[] = "WindowTest.Maximize";
const char kMessageRestoreName[] = "WindowTest.Restore";
const char kMessageFullscreenName[] = "WindowTest.Fullscreen";
const char kMessageTitlebarHeightName[] = "WindowTest.TitlebarHeight";
// Create the appropriate platform test runner object.
@@ -109,6 +110,8 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
runner_->Maximize(browser);
} else if (message_name == kMessageRestoreName) {
runner_->Restore(browser);
} else if (message_name == kMessageFullscreenName) {
runner_->Fullscreen(browser);
} else if (message_name.find(kMessageTitlebarHeightName) == 0) {
const auto height = ParseHeight(message_name);
runner_->SetTitleBarHeight(browser, height);

View File

@@ -36,6 +36,10 @@ void WindowTestRunner::ModifyBounds(const CefRect& display, CefRect& window) {
}
}
void WindowTestRunner::Fullscreen(CefRefPtr<CefBrowser> browser) {
NOTIMPLEMENTED();
}
void WindowTestRunner::SetTitleBarHeight(CefRefPtr<CefBrowser> browser,
const std::optional<float>& height) {
NOTIMPLEMENTED();

View File

@@ -27,6 +27,7 @@ class WindowTestRunner {
virtual void Minimize(CefRefPtr<CefBrowser> browser) = 0;
virtual void Maximize(CefRefPtr<CefBrowser> browser) = 0;
virtual void Restore(CefRefPtr<CefBrowser> browser) = 0;
virtual void Fullscreen(CefRefPtr<CefBrowser> browser);
// Fit |window| inside |display|. Coordinates are relative to the upper-left
// corner of the display.

View File

@@ -69,6 +69,17 @@ void WindowTestRunnerViews::Restore(CefRefPtr<CefBrowser> browser) {
GetWindow(browser)->Restore();
}
void WindowTestRunnerViews::Fullscreen(CefRefPtr<CefBrowser> browser) {
auto window = GetWindow(browser);
// Results in a call to ViewsWindow::OnWindowFullscreenTransition().
if (window->IsFullscreen()) {
window->SetFullscreen(false);
} else {
window->SetFullscreen(true);
}
}
void WindowTestRunnerViews::SetTitleBarHeight(
CefRefPtr<CefBrowser> browser,
const std::optional<float>& height) {

View File

@@ -24,6 +24,7 @@ class WindowTestRunnerViews : public WindowTestRunner {
void Minimize(CefRefPtr<CefBrowser> browser) override;
void Maximize(CefRefPtr<CefBrowser> browser) override;
void Restore(CefRefPtr<CefBrowser> browser) override;
void Fullscreen(CefRefPtr<CefBrowser> browser) override;
void SetTitleBarHeight(CefRefPtr<CefBrowser> browser,
const std::optional<float>& height) override;
};

View File

@@ -207,15 +207,17 @@ class IpcDelegate final : public client::ClientAppRenderer::Delegate {
const auto buffer_size =
std::max(message_size, sizeof(bv_utils::RendererMessage));
const auto start_time = bv_utils::Now();
std::vector<uint8_t> buffer(buffer_size);
const auto renderer_msg =
reinterpret_cast<bv_utils::RendererMessage*>(buffer.data());
renderer_msg->test_id = test_id;
renderer_msg->start_time = bv_utils::Now();
auto builder = CefSharedProcessMessageBuilder::Create(
bv_utils::kTestSendSMRProcessMessage, buffer_size);
auto renderer_msg =
static_cast<bv_utils::RendererMessage*>(builder->Memory());
renderer_msg->test_id = test_id;
renderer_msg->start_time = start_time;
bv_utils::CopyDataIntoMemory(buffer, builder->Memory());
frame->SendProcessMessage(PID_BROWSER, builder->Build());
}
@@ -229,8 +231,8 @@ class IpcDelegate final : public client::ClientAppRenderer::Delegate {
CefString code = "testSendProcessMessageResult(" +
std::to_string(msg.test_id) + ", " +
bv_utils::ToMilliString(rendered_to_browser) + ", " +
bv_utils::ToMilliString(browser_to_rendered) + ");";
bv_utils::ToMicroSecString(rendered_to_browser) + ", " +
bv_utils::ToMicroSecString(browser_to_rendered) + ");";
frame->ExecuteJavaScript(code, frame->GetURL(), 0);
}

View File

@@ -1,8 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>IPC Performance Tests</title>
<script src="https://cdn.plot.ly/plotly-2.12.1.min.js"></script>
<script src="https://cdn.plot.ly/plotly-2.26.0.min.js"></script>
<style>
body {
font-family: Tahoma, Serif;
@@ -70,8 +71,8 @@
<td>
<p>
There is no progress indication of the tests because it
significantly influences measurements. <br />It usually takes 30
seconds (for 100 samples) to complete the tests. <br /><b>AL</b> -
significantly influences measurements. <br />It usually takes 15
seconds (for 1000 samples) to complete the tests. <br /><b>AL</b> -
ArgumentList-based process messages. <b>SM</b> -
SharedMemoryRegion-based process messages.
</p>
@@ -83,7 +84,7 @@
<input
id="sSamples"
type="text"
value="100"
value="1000"
required
pattern="[0-9]+"
/>
@@ -97,8 +98,8 @@
<thead>
<tr>
<td class="center" style="width: 8%">Message Size</td>
<td class="center" style="width: 8%">AL Round Trip Avg,&nbsp;ms</td>
<td class="center" style="width: 8%">SM Round Trip Avg,&nbsp;ms</td>
<td class="center" style="width: 8%">AL Round Trip Avg,&nbsp;μs</td>
<td class="center" style="width: 8%">SM Round Trip Avg,&nbsp;μs</td>
<td class="center" style="width: 10%">Relative Trip Difference</td>
<td class="center" style="width: 8%">AL Speed,&nbsp;MB/s</td>
<td class="center" style="width: 8%">SM Speed,&nbsp;MB/s</td>
@@ -126,27 +127,18 @@
let box_plot_test_data = [];
let round_trip_avg_plot_data = [];
function nextTest(test) {
setTimeout(() => {
execNextTest(test.index);
}, 0);
}
function testSendProcessMessageResult(
testIndex,
fromRendererToBrowser,
fromBrowserToRenderer
) {
const test = tests[testIndex];
const roundTrip = fromRendererToBrowser + fromBrowserToRenderer;
test.totalRoundTrip += roundTrip;
test.sample++;
box_plot_test_data[testIndex].x.push(roundTrip);
setTimeout(() => {
execTest(testIndex);
}, 10);
setTimeout(execTest, 0, testIndex);
}
function sendRequest(size, testIndex) {
@@ -176,10 +168,10 @@
const test = tests[testIndex];
if (test.sample >= test.totalSamples) {
return nextTest(test);
setTimeout(execNextTest, 0, testIndex);
} else {
test.func(test.messageSize, test.index);
}
test.func(test.index);
}
function column(prepared, value) {
@@ -269,8 +261,8 @@
((avgRoundTripSMR - avgRoundTrip) / avgRoundTrip) * 100;
// In MB/s
const speed = test.messageSize / (avgRoundTrip * 1000);
const speedSMR = testSMR.messageSize / (avgRoundTripSMR * 1000);
const speed = test.messageSize / avgRoundTrip;
const speedSMR = testSMR.messageSize / avgRoundTripSMR;
const relativeSpeedDiff = ((speedSMR - speed) / speed) * 100;
const stdDeviation = getStandardDeviation(
@@ -362,16 +354,16 @@
function execNextTest(testIndex) {
testIndex++;
if (tests.length <= testIndex) {
return testSuiteFinished();
testSuiteFinished();
} else {
return execTest(testIndex);
execTest(testIndex);
}
}
function execQueuedTests(totalSamples) {
prepareQueuedTests(totalSamples);
// Let the updated table render before starting the tests
setTimeout(() => execNextTest(-1), 200);
setTimeout(execNextTest, 200, -1);
}
function setSettingsState(disabled) {
@@ -401,7 +393,6 @@
function humanFileSize(bytes) {
const step = 1024;
const originalBytes = bytes;
if (Math.abs(bytes) < step) {
return bytes + " B";
@@ -432,17 +423,12 @@
};
for (let size = 512; size <= 512 * 1024; size = size * 2) {
queueTest(humanFileSize(size) + " AL", size, (testIndex) =>
sendRequest(size, testIndex)
);
queueTest(humanFileSize(size) + " SM", size, (testIndex) =>
sendSMRRequest(size, testIndex)
);
queueTest(humanFileSize(size) + " AL", size, sendRequest);
queueTest(humanFileSize(size) + " SM", size, sendSMRRequest);
}
const totalSamples = parseInt(document.getElementById("sSamples").value);
prepareQueuedTests(totalSamples);
</script>
</body>
</html>
</html>

View File

@@ -24,7 +24,7 @@ function setButtonState(start_enabled, stop_enabled) {
}
function setup() {
if (location.origin != 'http://tests') {
if (location.origin != 'https://tests') {
document.getElementById('warning').style.display = 'block';
return;
}
@@ -84,7 +84,7 @@ function openServer() {
</head>
<body bgcolor="white" onload="setup()">
<div id="warning" style="display:none;color:red;font-weight:bold;">
This page can only be run from the http://tests origin.
This page can only be run from the https://tests origin.
</div>
<p>
This page starts an HTTP/WebSocket server on localhost with the specified port number.

View File

@@ -87,7 +87,7 @@ function doSend() {
<body bgcolor="white" onload="setup()">
<div id="warning" style="display:none;color:red;font-weight:bold;">
This page is most useful when loaded from localhost.
You should first create a server using the <a href="http://tests/server">HTTP/WebSocket Server test</a>.
You should first create a server using the <a href="https://tests/server">HTTP/WebSocket Server test</a>.
</div>
<p>
This page tests a WebSocket connection.

View File

@@ -2,6 +2,12 @@
<html lang="en-US">
<head>
<title>Window Test</title>
<style>
/* Background becomes pink in fullscreen mode. */
:fullscreen {
background: pink;
}
</style>
<script>
function setup() {
if (location.hostname == 'tests' || location.hostname == 'localhost')
@@ -38,6 +44,18 @@ function restore() {
setTimeout(function() { send_message('Restore'); }, 1000);
}
function fullscreenWindow() {
send_message('Fullscreen');
}
function fullscreenBrowser() {
if (document.fullscreenElement) {
document.exitFullscreen();
} else {
document.getElementById('form').requestFullscreen();
}
}
function position() {
var x = parseInt(document.getElementById('x').value);
var y = parseInt(document.getElementById('y').value);
@@ -64,6 +82,8 @@ Click a button to perform the associated window action.
<br/><input type="button" onclick="minimize();" value="Minimize">
<br/><input type="button" onclick="maximize();" value="Maximize">
<br/><input type="button" onclick="restore();" value="Restore"> (minimizes and then restores the window as topmost)
<br/><input type="button" onclick="fullscreenWindow();" value="Toggle Window Fullscreen"> (works with Views)
<br/><input type="button" onclick="fullscreenBrowser();" value="Toggle Browser Fullscreen"> (uses <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API" target="_new">Fullscreen API</a>; background turns pink)
<br/><input type="button" onclick="position();" value="Set Position">
X: <input type="text" size="4" id="x" value="200">
Y: <input type="text" size="4" id="y" value="100">

View File

@@ -30,7 +30,7 @@ function execXMLHttpRequest()
}
</script>
<form>
URL: <input type="text" id="url" value="http://tests/request">
URL: <input type="text" id="url" value="https://tests/request">
<br/><input type="button" onclick="execXMLHttpRequest();" value="Execute XMLHttpRequest">
<br/><textarea rows="10" cols="40" id="ta"></textarea>
</form>

View File

@@ -249,8 +249,13 @@ class CertificateErrorTest : public TestHandler, public CefTestServerHandler {
EXPECT_UI_THREAD();
// Create a new in-memory context so certificate decisions aren't cached.
auto request_context = CreateTestRequestContext(
TEST_RC_MODE_CUSTOM, /*cache_path=*/std::string());
CreateTestRequestContext(
TEST_RC_MODE_CUSTOM_WITH_HANDLER, /*cache_path=*/std::string(),
base::BindOnce(&CertificateErrorTest::DoCreateBrowserContinue, this));
}
void DoCreateBrowserContinue(CefRefPtr<CefRequestContext> request_context) {
EXPECT_UI_THREAD();
CreateBrowser(GetStartURL(), request_context);
}

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