Compare commits

...

25 Commits
6778 ... 5563

Author SHA1 Message Date
Marshall Greenblatt
ebf5d6ab43 Update to Chromium version 111.0.5563.148 2023-03-30 14:17:12 +00:00
Nik Pavlov
491d2383ef views: mac: Support dynamic resize of title bar height (see #3189)
This is intended for usage with frameless windows that show the standard window
buttons, where resizing the title bar height changes the button offset. Returning a
different value from CefWindowDelegate::GetTitlebarHeight and forcing a resize of
the NSWindow's theme frame (see ViewsWindow::NudgeWindow) will update the
title bar height.

To test:
1. Run `cefclient --use-views --hide-frame --show-window-buttons --url=http://tests/window`
2. Enter a new value for title bar height and click the "Set Titlebar Height" button
2023-03-16 13:23:55 -04:00
Nik Pavlov
4eb0508671 views: mac: Enable WindowTestRunnerViews 2023-03-16 13:23:49 -04:00
Marshall Greenblatt
49cae3707a chrome: Move ThreadProfiler initialization to the UI thread (fixes #3465)
ThreadProfiler::CreateAndStartOnMainThread and SetMainThreadTaskRunnerImpl
should be called on the same thread.
2023-03-14 15:12:06 -04:00
Marshall Greenblatt
3215aaebef Rewrite issue links to GitHub (see #3464) 2023-03-13 13:55:43 -04:00
Marshall Greenblatt
1b83ff6471 Update to Chromium version 111.0.5563.65 2023-03-09 14:44:44 +00:00
Nik Pavlov
870da3087f views: mac: Show standard window buttons with frame by default (see issue #3189)
This restores the previous default behavior for framed windows.
2023-03-08 12:57:04 -05:00
Nik Pavlov
f6de0344cb views: mac: Fix frameless window behavior (fixes issue #3189)
Frameless windows now display as expected. Default traffic light buttons can
optionally be shown at configurable vertical position. Layout respects text
direction.
2023-03-08 12:56:45 -05:00
Marshall Greenblatt
6926287894 Update to Chromium version 111.0.5563.64 2023-03-07 14:33:24 +00:00
Marshall Greenblatt
0d4c466645 chrome: Don't show gray background during browser load (fixes issue #3459) 2023-03-06 15:42:12 -05:00
Marshall Greenblatt
1b930decca Update API hash for commit 80b61f0417 2023-03-06 15:41:39 -05:00
Sergey Markelov
80b61f0417 Fix compile error: this function declaration is not a prototype
`cef_basetime_now()` failed to compile if `-Wstrict-prototypes` is set in clang
or gcc.
2023-03-06 11:53:07 -05:00
梅迎朝
a7a5eee369 cefclient: Fix incorrect logic in PassThruResponseFilter 2023-03-06 11:53:07 -05:00
Marshall Greenblatt
e9397c53ff tools: mac: Add missing README.sandbox.txt (fixes issue #3453) 2023-03-06 11:53:07 -05:00
Marshall Greenblatt
eb023d18e0 Update to Chromium version 111.0.5563.50 2023-03-02 14:36:13 +00:00
Marshall Greenblatt
f98481d327 Update to Chromium version 111.0.5563.41 2023-02-24 16:14:25 +00:00
Marshall Greenblatt
0d82c3ffc0 alloy: Fix theme configuration on startup (fixes issue #3449) 2023-02-22 17:13:37 -05:00
Marshall Greenblatt
fb44f128e9 Update to Chromium version 111.0.5563.33 2023-02-18 17:08:43 +00:00
Marshall Greenblatt
565ad7bb99 chrome: cefclient: Add default handler for request tests (see issue #3444)
Support loading of request tests (e.g. http://tests/other_tests) inside default
browsers created via "New window" and "New incognito window" commands.
2023-02-17 16:04:44 -05:00
Marshall Greenblatt
d4c8104ca8 chrome: Fix request interception with active extension (fixes issue #3444)
Support chaining of proxies in WillCreateURLLoaderFactory.
2023-02-17 16:04:35 -05:00
Marshall Greenblatt
b7ba0b9a66 chrome: Make primary user profile the default global context (see issue #3444)
Chrome is always loading the primary user profile by default, so with this
change the CEF behavior more accurately reflects reality. Incognito contexts
can still be created explicitly via CefRequestContext::CreateContext.

Prior to this change, the default for the global context was an Incognito
profile based on the primary user profile. That caused request interception
to be bypassed in WillCreateURLLoaderFactory for profiles associated with
the "New window" and "New incognito window" commands. Those profiles, while
also being (or based on) the primary user profile, did not match the specific
Incognito profile assigned to the default global context.

After this change, the "New window" and "New incognito window" commands will
match the default global context when executed on a browser that was created
using the primary user profile.
2023-02-17 16:04:28 -05:00
Marshall Greenblatt
719fe7691b chrome: Fix crash on display of browser via "New window" command 2023-02-17 16:04:20 -05:00
Marshall Greenblatt
82dc13a870 chrome: Use default Browser creation for picture-in-picture popups (see issue #3448) 2023-02-10 14:35:18 -05:00
Marshall Greenblatt
371f7f3409 Update to Chromium version 111.0.5563.19 2023-02-10 16:26:06 +00:00
Marshall Greenblatt
01fe00c6fd Update to Chromium version 111.0.5563.12 2023-02-07 10:46:41 -05:00
78 changed files with 1270 additions and 344 deletions

View File

@@ -1145,6 +1145,10 @@ source_set("libcef_static") {
"libcef/browser/native/menu_runner_mac.mm",
"libcef/browser/osr/browser_platform_delegate_osr_mac.h",
"libcef/browser/osr/browser_platform_delegate_osr_mac.mm",
"libcef/browser/views/native_widget_mac.h",
"libcef/browser/views/native_widget_mac.mm",
"libcef/browser/views/ns_window.h",
"libcef/browser/views/ns_window.mm",
"libcef/browser/views/view_util_mac.mm",
"libcef/common/util_mac.h",
"libcef/common/util_mac.mm",

View File

@@ -7,5 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/111.0.5563.0'
'chromium_checkout': 'refs/tags/111.0.5563.148',
'depot_tools_checkout': '963e01c76c'
}

View File

@@ -9,6 +9,7 @@ The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromi
* Branches and Building - https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
* Announcements - https://groups.google.com/forum/#!forum/cef-announce
* Support Forum - http://www.magpcss.org/ceforum/
* Issue Tracker - https://github.com/chromiumembedded/cef/issues
* C++ API Docs - [Stable release docs](https://cef-builds.spotifycdn.com/docs/stable.html) / [Beta release docs](https://cef-builds.spotifycdn.com/docs/beta.html)
* Downloads - https://cef-builds.spotifycdn.com/index.html
* Donations - http://www.magpcss.org/ceforum/donate.php
@@ -57,7 +58,7 @@ If you're the maintainer of a project not listed above and would like your proje
CEF is still very much a work in progress. Some ways that you can help out:
\- Vote for issues in the [CEF issue tracker](https://bitbucket.org/chromiumembedded/cef/issues?status=new&status=open) that are important to you. This helps with development prioritization.
\- Vote for issues in the [CEF issue tracker](https://github.com/chromiumembedded/cef/issues) that are important to you. This helps with development prioritization.
\- Report any bugs that you find or feature requests that are important to you. Make sure to first search for existing issues before creating new ones. Please use the [CEF Forum](http://magpcss.org/ceforum) and not the issue tracker for usage questions. Each CEF issue should:
@@ -68,7 +69,7 @@ CEF is still very much a work in progress. Some ways that you can help out:
\- Write unit tests for new or existing functionality.
\- Pull requests and patches are welcome. View open issues in the [CEF issue tracker](https://bitbucket.org/chromiumembedded/cef/issues?status=new&status=open) or search for TODO(cef) in the source code for ideas.
\- Pull requests and patches are welcome. View open issues in the [CEF issue tracker](https://github.com/chromiumembedded/cef/issues) or search for TODO(cef) in the source code for ideas.
If you would like to contribute source code changes to CEF please follow the below guidelines:

View File

@@ -237,6 +237,8 @@
'tests/cefclient/browser/client_prefs.cc',
'tests/cefclient/browser/client_prefs.h',
'tests/cefclient/browser/client_types.h',
'tests/cefclient/browser/default_client_handler.cc',
'tests/cefclient/browser/default_client_handler.h',
'tests/cefclient/browser/dialog_test.cc',
'tests/cefclient/browser/dialog_test.h',
'tests/cefclient/browser/image_cache.cc',
@@ -391,6 +393,7 @@
'tests/cefclient/browser/temp_window_mac.mm',
'tests/cefclient/browser/text_input_client_osr_mac.h',
'tests/cefclient/browser/text_input_client_osr_mac.mm',
'tests/cefclient/browser/views_window_mac.mm',
'tests/cefclient/browser/window_test_runner_mac.h',
'tests/cefclient/browser/window_test_runner_mac.mm',
'tests/cefclient/cefclient_mac.mm',

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=019abf16be4e151d31181a6bdcb1ad8dfef03d00$
// $hash=9f0389a439e6787282880d53375369829adb6a3d$
//
#ifndef CEF_INCLUDE_CAPI_VIEWS_CEF_WINDOW_DELEGATE_CAPI_H_
@@ -137,6 +137,25 @@ typedef struct _cef_window_delegate_t {
int(CEF_CALLBACK* is_frameless)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window);
///
/// Return true (1) if |window| should be created with standard window buttons
/// like close, minimize and zoom.
///
int(CEF_CALLBACK* with_standard_window_buttons)(
struct _cef_window_delegate_t* self,
struct _cef_window_t* window);
///
/// Return whether the titlebar height should be overridden, and sets the
/// height of the titlebar in |titlebar_height|. On macOS, it can also be used
/// to adjust the vertical position of the traffic light buttons in frameless
/// windows. The buttons will be positioned halfway down the titlebar at a
/// height of |titlebar_height| / 2.
///
int(CEF_CALLBACK* get_titlebar_height)(struct _cef_window_delegate_t* self,
struct _cef_window_t* window,
float* titlebar_height);
///
/// Return true (1) if |window| can be resized.
///

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 "ec5797fa2a4dabdcf61183905db6b8ff2b79f9f0"
#define CEF_API_HASH_UNIVERSAL "1d8347d8e06dc0dd17f882ca253e1c7bf43d5863"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "011499a93a394bf5fa92ebf0047de5ee1a4e5841"
#define CEF_API_HASH_PLATFORM "b6865f1992a10dcefc0bbc450cf296b648003271"
#elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "8f276dfddb7341168f9ce0f705df212f08e2f08c"
#define CEF_API_HASH_PLATFORM "d04c2a5ab471493c185eb7c7aa894bc4a79d5a7c"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "3c239fa16f5a3f9f452b185c750c7145fc305274"
#define CEF_API_HASH_PLATFORM "d7d4cbffa4a798fea97e7b9f3610b5cb803d949e"
#endif
#ifdef __cplusplus

View File

@@ -122,7 +122,7 @@ CEF_EXPORT int cef_time_now(cef_time_t* cef_time);
///
/// Retrieve the current system time.
///
CEF_EXPORT cef_basetime_t cef_basetime_now();
CEF_EXPORT cef_basetime_t cef_basetime_now(void);
///
/// Retrieve the delta in milliseconds between two time values. Returns true (1)

View File

@@ -81,7 +81,7 @@ class CefBrowserViewDelegate : public CefViewDelegate {
/// popup will be a DevTools browser. Return the delegate that will be used
/// for the new popup BrowserView.
///
/*--cef()--*/
/*--cef(optional_param=client)--*/
virtual CefRefPtr<CefBrowserViewDelegate> GetDelegateForPopupBrowserView(
CefRefPtr<CefBrowserView> browser_view,
const CefBrowserSettings& settings,

View File

@@ -128,6 +128,29 @@ class CefWindowDelegate : public CefPanelDelegate {
/*--cef()--*/
virtual bool IsFrameless(CefRefPtr<CefWindow> window) { return false; }
///
/// Return true if |window| should be created with standard window buttons
/// like close, minimize and zoom.
///
/*--cef()--*/
virtual bool WithStandardWindowButtons(CefRefPtr<CefWindow> window) {
return !IsFrameless(window);
}
///
/// Return whether the titlebar height should be overridden,
/// and sets the height of the titlebar in |titlebar_height|.
/// On macOS, it can also be used to adjust the vertical position
/// of the traffic light buttons in frameless windows.
/// The buttons will be positioned halfway down the titlebar
/// at a height of |titlebar_height| / 2.
///
/*--cef()--*/
virtual bool GetTitlebarHeight(CefRefPtr<CefWindow> window,
float* titlebar_height) {
return false;
}
///
/// Return true if |window| can be resized.
///

View File

@@ -1227,7 +1227,7 @@ void AlloyBrowserHostImpl::WebContentsCreated(
target_url,
frame_util::MakeGlobalId(opener_render_process_id,
opener_render_frame_id),
settings, client, platform_delegate, extra_info);
settings, client, platform_delegate, extra_info, new_contents);
scoped_refptr<CefBrowserInfo> info =
CefBrowserInfoManager::GetInstance()->CreatePopupBrowserInfo(

View File

@@ -41,6 +41,7 @@
#include "net/base/net_module.h"
#include "third_party/widevine/cdm/buildflags.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/native_theme/native_theme.h"
#if BUILDFLAG(IS_LINUX)
#include "ui/ozone/buildflags.h"
@@ -308,6 +309,9 @@ int AlloyBrowserMainParts::PreMainMessageLoopRun() {
file_dialog_runner::RegisterFactory();
permission_prompt::RegisterCreateCallback();
// Initialize theme configuration (high contrast, dark mode, etc).
ui::NativeTheme::GetInstanceForNativeUi();
#if BUILDFLAG(ENABLE_MEDIA_FOUNDATION_WIDEVINE_CDM) || \
BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT)
const base::CommandLine* command_line =

View File

@@ -313,8 +313,11 @@ void CefBrowserContentsDelegate::RenderFrameCreated(
web_contents()->SetPageBaseBackgroundColor(SkColor());
web_contents()->SetPageBaseBackgroundColor(base_background_color);
}
render_view_host->GetWidget()->GetView()->SetBackgroundColor(
base_background_color);
if (render_view_host->GetWidget() &&
render_view_host->GetWidget()->GetView()) {
render_view_host->GetWidget()->GetView()->SetBackgroundColor(
base_background_color);
}
platform_delegate()->RenderViewCreated(render_view_host);
}

View File

@@ -125,6 +125,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
CefRefPtr<CefClient> client = browser->GetClient();
bool allow = true;
bool handled = false;
CefWindowInfo window_info;
@@ -133,7 +134,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
#endif
auto pending_popup = std::make_unique<CefBrowserInfoManager::PendingPopup>();
pending_popup->step = CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW;
pending_popup->step = PendingPopup::CAN_CREATE_WINDOW;
pending_popup->opener_global_id = opener->GetGlobalId();
pending_popup->target_url = target_url;
pending_popup->target_frame_name = frame_name;
@@ -142,6 +143,11 @@ bool CefBrowserInfoManager::CanCreateWindow(
pending_popup->client = client;
pending_popup->settings = browser->settings();
// With the Chrome runtime, we want to use default popup Browser creation
// for document picture-in-picture.
pending_popup->use_default_browser_creation =
disposition == WindowOpenDisposition::NEW_PICTURE_IN_PICTURE;
if (client.get()) {
CefRefPtr<CefLifeSpanHandler> handler = client->GetLifeSpanHandler();
if (handler.get()) {
@@ -172,6 +178,7 @@ bool CefBrowserInfoManager::CanCreateWindow(
cef_features, window_info, pending_popup->client,
pending_popup->settings, pending_popup->extra_info,
no_javascript_access);
handled = true;
}
}
@@ -179,14 +186,21 @@ bool CefBrowserInfoManager::CanCreateWindow(
CefBrowserCreateParams create_params;
create_params.MaybeSetWindowInfo(window_info);
if (!handled) {
// Use default Browser creation if OnBeforePopup was unhandled.
// TODO(chrome): Expose a mechanism for the client to choose default
// creation.
pending_popup->use_default_browser_creation = true;
}
// In most cases, Views-hosted browsers should create Views-hosted popups
// and native browsers should use default popup handling. The one exception
// is with the Chrome runtime where a Views-hosted browser may have an
// external parent. In that case we want to use default popup handling even
// though the parent is (technically) Views-hosted.
// and native browsers should use default popup handling. With the Chrome
// runtime, we should additionally use default handling (a) when using an
// external parent and (b) when using default Browser creation.
create_params.popup_with_views_hosted_opener =
browser->HasView() &&
!browser->platform_delegate()->HasExternalParent();
!browser->platform_delegate()->HasExternalParent() &&
!pending_popup->use_default_browser_creation;
create_params.settings = pending_popup->settings;
create_params.client = pending_popup->client;
@@ -217,9 +231,8 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
CEF_REQUIRE_UIT();
REQUIRE_ALLOY_RUNTIME();
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
PopPendingPopup(CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW,
opener_global_id, target_url);
auto pending_popup = PopPendingPopup(PendingPopup::CAN_CREATE_WINDOW,
opener_global_id, target_url);
DCHECK(pending_popup.get());
DCHECK(pending_popup->platform_delegate.get());
@@ -228,8 +241,7 @@ void CefBrowserInfoManager::GetCustomWebContentsView(
delegate_view);
}
pending_popup->step =
CefBrowserInfoManager::PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW;
pending_popup->step = PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW;
PushPendingPopup(std::move(pending_popup));
}
@@ -239,16 +251,16 @@ void CefBrowserInfoManager::WebContentsCreated(
CefBrowserSettings& settings,
CefRefPtr<CefClient>& client,
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate,
CefRefPtr<CefDictionaryValue>& extra_info) {
CefRefPtr<CefDictionaryValue>& extra_info,
content::WebContents* new_contents) {
CEF_REQUIRE_UIT();
// GET_CUSTOM_WEB_CONTENTS_VIEW is only used with the alloy runtime.
const auto previous_step =
cef::IsAlloyRuntimeEnabled()
? CefBrowserInfoManager::PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW
: CefBrowserInfoManager::PendingPopup::CAN_CREATE_WINDOW;
const auto previous_step = cef::IsAlloyRuntimeEnabled()
? PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW
: PendingPopup::CAN_CREATE_WINDOW;
std::unique_ptr<CefBrowserInfoManager::PendingPopup> pending_popup =
auto pending_popup =
PopPendingPopup(previous_step, opener_global_id, target_url);
DCHECK(pending_popup.get());
DCHECK(pending_popup->platform_delegate.get());
@@ -257,6 +269,30 @@ void CefBrowserInfoManager::WebContentsCreated(
client = pending_popup->client;
platform_delegate = std::move(pending_popup->platform_delegate);
extra_info = pending_popup->extra_info;
// AddWebContents (the next step) is only used with the Chrome runtime.
if (cef::IsChromeRuntimeEnabled()) {
pending_popup->step = PendingPopup::WEB_CONTENTS_CREATED;
pending_popup->new_contents = new_contents;
PushPendingPopup(std::move(pending_popup));
}
}
bool CefBrowserInfoManager::AddWebContents(content::WebContents* new_contents) {
CEF_REQUIRE_UIT();
DCHECK(cef::IsChromeRuntimeEnabled());
// Pending popup information may be missing in cases where
// chrome::AddWebContents is called directly from the Chrome UI (profile
// settings, etc).
auto pending_popup =
PopPendingPopup(PendingPopup::WEB_CONTENTS_CREATED, new_contents);
if (pending_popup) {
return !pending_popup->use_default_browser_creation;
}
// Proceed with default handling.
return false;
}
void CefBrowserInfoManager::OnGetNewBrowserInfo(
@@ -297,7 +333,9 @@ void CefBrowserInfoManager::OnGetNewBrowserInfo(
std::make_pair(global_id, std::move(pending)));
// Register a timeout for the pending response so that the renderer process
// doesn't hang forever.
// doesn't hang forever. With the Chrome runtime, timeouts may occur in cases
// where chrome::AddWebContents or WebContents::Create are called directly
// from the Chrome UI (profile settings, etc).
if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableNewBrowserInfoTimeout)) {
CEF_POST_DELAYED_TASK(
@@ -438,16 +476,18 @@ void CefBrowserInfoManager::PushPendingPopup(
std::unique_ptr<CefBrowserInfoManager::PendingPopup>
CefBrowserInfoManager::PopPendingPopup(
PendingPopup::Step step,
PendingPopup::Step previous_step,
const content::GlobalRenderFrameHostId& opener_global_id,
const GURL& target_url) {
CEF_REQUIRE_UIT();
DCHECK(frame_util::IsValidGlobalId(opener_global_id));
DCHECK_LE(previous_step, PendingPopup::GET_CUSTOM_WEB_CONTENTS_VIEW);
PendingPopupList::iterator it = pending_popup_list_.begin();
for (; it != pending_popup_list_.end(); ++it) {
PendingPopup* popup = it->get();
if (popup->step == step && popup->opener_global_id == opener_global_id &&
if (popup->step == previous_step &&
popup->opener_global_id == opener_global_id &&
popup->target_url == target_url) {
// Transfer ownership of the pointer.
it->release();
@@ -459,6 +499,26 @@ CefBrowserInfoManager::PopPendingPopup(
return nullptr;
}
std::unique_ptr<CefBrowserInfoManager::PendingPopup>
CefBrowserInfoManager::PopPendingPopup(PendingPopup::Step previous_step,
content::WebContents* new_contents) {
CEF_REQUIRE_UIT();
DCHECK_GE(previous_step, PendingPopup::WEB_CONTENTS_CREATED);
PendingPopupList::iterator it = pending_popup_list_.begin();
for (; it != pending_popup_list_.end(); ++it) {
PendingPopup* popup = it->get();
if (popup->step == previous_step && popup->new_contents == new_contents) {
// Transfer ownership of the pointer.
it->release();
pending_popup_list_.erase(it);
return base::WrapUnique(popup);
}
}
return nullptr;
}
scoped_refptr<CefBrowserInfo> CefBrowserInfoManager::GetBrowserInfoInternal(
const content::GlobalRenderFrameHostId& global_id,
bool* is_guest_view) {

View File

@@ -97,7 +97,12 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
CefBrowserSettings& settings,
CefRefPtr<CefClient>& client,
std::unique_ptr<CefBrowserPlatformDelegate>& platform_delegate,
CefRefPtr<CefDictionaryValue>& extra_info);
CefRefPtr<CefDictionaryValue>& extra_info,
content::WebContents* new_contents);
// Called from ChromeBrowserDelegate::AddWebContents. See comments on
// PendingPopup for more information. Returns true for custom handling.
bool AddWebContents(content::WebContents* source_contents);
// Called from CefBrowserManager::GetNewBrowserInfo for delivering
// browser info to the renderer process. If the browser info already exists
@@ -154,6 +159,8 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// Creates the OSR views for windowless popups.
// - WebContentsCreated (UIT):
// Creates the CefBrowserHost representation for the popup.
// - AddWebContents (UIT) (chrome runtime only):
// Creates the Browser or tab representation for the popup.
// - CefBrowserManager::GetNewBrowserInfo (IOT)
// Passes information about the popup to the renderer process.
struct PendingPopup {
@@ -163,6 +170,7 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
enum Step {
CAN_CREATE_WINDOW,
GET_CUSTOM_WEB_CONTENTS_VIEW,
WEB_CONTENTS_CREATED,
} step;
// Initial state from ViewHostMsg_CreateWindow.
@@ -179,15 +187,29 @@ class CefBrowserInfoManager : public content::RenderProcessHostObserver {
// Platform delegate specific to the new popup.
std::unique_ptr<CefBrowserPlatformDelegate> platform_delegate;
// True if default Browser or tab creation should proceed from
// AddWebContents (chrome runtime only).
bool use_default_browser_creation = false;
// The newly created WebContents (set in WebContentsCreated).
content::WebContents* new_contents = nullptr;
};
// Manage pending popups. Only called on the UI thread.
void PushPendingPopup(std::unique_ptr<PendingPopup> popup);
// Used after CanCreateWindow is called.
std::unique_ptr<PendingPopup> PopPendingPopup(
PendingPopup::Step step,
PendingPopup::Step previous_step,
const content::GlobalRenderFrameHostId& opener_global_id,
const GURL& target_url);
// Used after WebContentsCreated is called.
std::unique_ptr<PendingPopup> PopPendingPopup(
PendingPopup::Step previous_step,
content::WebContents* new_contents);
// Retrieves the BrowserInfo matching the specified ID.
scoped_refptr<CefBrowserInfo> GetBrowserInfoInternal(
const content::GlobalRenderFrameHostId& global_id,

View File

@@ -36,7 +36,16 @@ class BrowserDelegate : public content::WebContentsDelegate {
~BrowserDelegate() override {}
// Called immediately after |new_contents| is created.
// Optionally override chrome::AddWebContents behavior. This is most often
// called via Browser::AddNewContents for new popup browsers and provides an
// opportunity for CEF to create a new Browser instead of proceeding with
// default Browser or tab creation.
virtual std::unique_ptr<content::WebContents> AddWebContents(
std::unique_ptr<content::WebContents> new_contents) = 0;
// Called immediately after |new_contents| is created via chrome::Navigate.
// This is most often called for navigations targeting a new tab without a
// pre-existing WebContents.
virtual void OnWebContentsCreated(content::WebContents* new_contents) = 0;
// Add or remove ownership of the WebContents.

View File

@@ -34,6 +34,25 @@ ChromeBrowserDelegate::ChromeBrowserDelegate(
ChromeBrowserDelegate::~ChromeBrowserDelegate() = default;
std::unique_ptr<content::WebContents> ChromeBrowserDelegate::AddWebContents(
std::unique_ptr<content::WebContents> new_contents) {
if (CefBrowserInfoManager::GetInstance()->AddWebContents(
new_contents.get())) {
// The browser host should have been created in WebContentsCreated().
auto new_browser =
ChromeBrowserHostImpl::GetBrowserForContents(new_contents.get());
if (new_browser) {
// Create a new Browser and give it ownership of the new WebContents.
new_browser->AddNewContents(std::move(new_contents));
} else {
LOG(ERROR) << "No host found for chrome popup browser";
}
}
// Proceed with default chrome::AddWebContents behavior.
return new_contents;
}
void ChromeBrowserDelegate::OnWebContentsCreated(
content::WebContents* new_contents) {
// Necessary to receive LoadingStateChanged calls during initial navigation.
@@ -132,7 +151,7 @@ void ChromeBrowserDelegate::WebContentsCreated(
target_url,
frame_util::MakeGlobalId(opener_render_process_id,
opener_render_frame_id),
settings, client, platform_delegate, extra_info);
settings, client, platform_delegate, extra_info, new_contents);
auto opener = ChromeBrowserHostImpl::GetBrowserForContents(source_contents);
if (!opener) {
@@ -155,27 +174,6 @@ void ChromeBrowserDelegate::WebContentsCreated(
browser_info, opener, request_context_impl);
}
void ChromeBrowserDelegate::AddNewContents(
content::WebContents* source_contents,
std::unique_ptr<content::WebContents> new_contents,
const GURL& target_url,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& window_features,
bool user_gesture,
bool* was_blocked) {
auto new_browser =
ChromeBrowserHostImpl::GetBrowserForContents(new_contents.get());
if (new_browser) {
// Create a new Browser and give it ownership of the WebContents.
new_browser->AddNewContents(std::move(new_contents));
return;
}
// Fall back to default behavior from Browser::AddNewContents.
chrome::AddWebContents(browser_, source_contents, std::move(new_contents),
target_url, disposition, window_features);
}
content::WebContents* ChromeBrowserDelegate::OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) {

View File

@@ -48,6 +48,8 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
~ChromeBrowserDelegate() override;
// cef::BrowserDelegate methods:
std::unique_ptr<content::WebContents> AddWebContents(
std::unique_ptr<content::WebContents> new_contents) override;
void OnWebContentsCreated(content::WebContents* new_contents) override;
void SetAsDelegate(content::WebContents* web_contents,
bool set_delegate) override;
@@ -66,13 +68,6 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
const std::string& frame_name,
const GURL& target_url,
content::WebContents* new_contents) override;
void AddNewContents(content::WebContents* source_contents,
std::unique_ptr<content::WebContents> new_contents,
const GURL& target_url,
WindowOpenDisposition disposition,
const blink::mojom::WindowFeatures& window_features,
bool user_gesture,
bool* was_blocked) override;
content::WebContents* OpenURLFromTab(
content::WebContents* source,
const content::OpenURLParams& params) override;

View File

@@ -20,6 +20,7 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/frame/contents_web_view.h"
#include "chrome/common/pref_names.h"
#include "libcef/browser/chrome/views/chrome_browser_frame.h"
#include "libcef/browser/chrome/views/chrome_browser_view.h"
@@ -435,6 +436,9 @@ Browser* ChromeBrowserHostImpl::CreateBrowser(
chrome_browser_view->InitBrowser(base::WrapUnique(browser),
params.browser_view);
// Don't set theme colors in ContentsWebView::UpdateBackgroundColor.
chrome_browser_view->contents_web_view()->SetBackgroundVisible(false);
// Don't show the browser by default.
show_browser = false;
}

View File

@@ -11,6 +11,7 @@
#include "libcef/browser/permission_prompt.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/profiles/profile.h"
ChromeBrowserMainExtraPartsCef::ChromeBrowserMainExtraPartsCef() = default;
@@ -25,6 +26,9 @@ void ChromeBrowserMainExtraPartsCef::PostProfileInit(Profile* profile,
CefRequestContextSettings settings;
CefContext::Get()->PopulateGlobalRequestContextSettings(&settings);
// Use the existing path for the initial profile.
CefString(&settings.cache_path) = profile->GetPath().value();
// Create the global RequestContext.
global_request_context_ =
CefRequestContextImpl::CreateGlobalRequestContext(settings);

View File

@@ -241,21 +241,65 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
bool* bypass_redirect_checks,
bool* disable_secure_dns,
network::mojom::URLLoaderFactoryOverridePtr* factory_override) {
bool use_proxy = ChromeContentBrowserClient::WillCreateURLLoaderFactory(
browser_context, frame, render_process_id, type, request_initiator,
navigation_id, ukm_source_id, factory_receiver, header_client,
bypass_redirect_checks, disable_secure_dns, factory_override);
if (use_proxy) {
// The chrome layer will handle the request.
return use_proxy;
}
// Don't intercept requests for Profiles that were not created by CEF.
// For example, the User Manager profile created via
// profiles::CreateSystemProfileForUserManager.
auto profile = Profile::FromBrowserContext(browser_context);
if (!CefBrowserContext::FromProfile(profile)) {
return false;
return ChromeContentBrowserClient::WillCreateURLLoaderFactory(
browser_context, frame, render_process_id, type, request_initiator,
navigation_id, ukm_source_id, factory_receiver, header_client,
bypass_redirect_checks, disable_secure_dns, factory_override);
}
// Based on content/browser/devtools/devtools_instrumentation.cc
// WillCreateURLLoaderFactoryInternal.
network::mojom::URLLoaderFactoryOverridePtr cef_override(
network::mojom::URLLoaderFactoryOverride::New());
// If caller passed some existing overrides, use those.
// Otherwise, use our local var, then if handlers actually
// decide to intercept, move it to |factory_override|.
network::mojom::URLLoaderFactoryOverridePtr* handler_override =
factory_override && *factory_override ? factory_override : &cef_override;
network::mojom::URLLoaderFactoryOverride* intercepting_factory =
handler_override->get();
// If we're the first interceptor to install an override, make a
// remote/receiver pair, then handle this similarly to appending
// a proxy to existing override.
if (!intercepting_factory->overriding_factory) {
DCHECK(!intercepting_factory->overridden_factory_receiver);
intercepting_factory->overridden_factory_receiver =
intercepting_factory->overriding_factory
.InitWithNewPipeAndPassReceiver();
}
// TODO(chrome): Is it necessary to proxy |header_client| callbacks?
bool use_proxy = ChromeContentBrowserClient::WillCreateURLLoaderFactory(
browser_context, frame, render_process_id, type, request_initiator,
navigation_id, ukm_source_id,
&(intercepting_factory->overridden_factory_receiver),
/*header_client=*/nullptr, bypass_redirect_checks, disable_secure_dns,
handler_override);
if (use_proxy) {
DCHECK(intercepting_factory->overriding_factory);
DCHECK(intercepting_factory->overridden_factory_receiver);
if (!factory_override) {
// Not a subresource navigation, so just override the target receiver.
mojo::FusePipes(std::move(*factory_receiver),
std::move(cef_override->overriding_factory));
*factory_receiver = std::move(cef_override->overridden_factory_receiver);
} else if (!*factory_override) {
// No other overrides, so just returns ours as is.
*factory_override = network::mojom::URLLoaderFactoryOverride::New(
std::move(cef_override->overriding_factory),
std::move(cef_override->overridden_factory_receiver), false);
}
// ... else things are already taken care of, as handler_override was
// pointing to factory override and we've done all magic in-place.
DCHECK(!cef_override->overriding_factory);
DCHECK(!cef_override->overridden_factory_receiver);
}
auto request_handler = net_service::CreateInterceptedRequestHandler(
@@ -266,6 +310,7 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
net_service::ProxyURLLoaderFactory::CreateProxy(
browser_context, factory_receiver, header_client,
std::move(request_handler));
return true;
}

View File

@@ -394,6 +394,7 @@ bool CefMainRunner::ContentMainRun(bool* initialized,
if (!CreateUIThread(base::BindOnce(
[](CefMainRunner* runner, base::WaitableEvent* event) {
runner->main_delegate_->BeforeUIThreadInitialize();
content::ContentMainRun(runner->main_runner_.get());
event->Signal();
},
@@ -408,6 +409,7 @@ bool CefMainRunner::ContentMainRun(bool* initialized,
uithread_startup_event.Wait();
} else {
*initialized = true;
main_delegate_->BeforeUIThreadInitialize();
content::ContentMainRun(main_runner_.get());
}

View File

@@ -314,7 +314,7 @@ bool OnExtensionsSupportUI(std::string* mime_type, std::string* output) {
"<html>\n<head><title>Extensions Support</title></head>\n"
"<body bgcolor=\"white\"><h3>Supported Chrome Extensions "
"APIs</h3>\nFollow <a "
"href=\"https://bitbucket.org/chromiumembedded/cef/issues/1947\" "
"href=\"https://github.com/chromiumembedded/cef/issues/1947\" "
"target=\"new\">issue #1947</a> for development progress.\n<ul>\n";
bool has_top_level_name = false;

View File

@@ -1541,7 +1541,7 @@ void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
const void* pixels) {
TRACE_EVENT0("cef", "CefRenderWidgetHostViewOSR::OnPaint");
// Workaround for https://bitbucket.org/chromiumembedded/cef/issues/2817
// Workaround for https://github.com/chromiumembedded/cef/issues/2817
if (!is_showing_) {
return;
}

View File

@@ -0,0 +1,39 @@
// Copyright 2023 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_VIEWS_NATIVE_WIDGET_MAC_H_
#define CEF_LIBCEF_BROWSER_VIEWS_NATIVE_WIDGET_MAC_H_
#pragma once
#include "include/internal/cef_ptr.h"
#include "ui/views/widget/native_widget_mac.h"
class CefWindow;
class CefWindowDelegate;
class CefNativeWidgetMac : public views::NativeWidgetMac {
public:
CefNativeWidgetMac(views::internal::NativeWidgetDelegate* delegate,
CefRefPtr<CefWindow> window,
CefWindowDelegate* window_delegate);
~CefNativeWidgetMac() override = default;
CefNativeWidgetMac(const CefNativeWidgetMac&) = delete;
CefNativeWidgetMac& operator=(const CefNativeWidgetMac&) = delete;
protected:
// NativeWidgetMac:
NativeWidgetMacNSWindow* CreateNSWindow(
const remote_cocoa::mojom::CreateWindowParams* params) override;
void GetWindowFrameTitlebarHeight(bool* override_titlebar_height,
float* titlebar_height) override;
private:
const CefRefPtr<CefWindow> window_;
CefWindowDelegate* const window_delegate_;
};
#endif // CEF_LIBCEF_BROWSER_VIEWS_NATIVE_WIDGET_MAC_H_

View File

@@ -0,0 +1,54 @@
// Copyright 2023 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/views/native_widget_mac.h"
#include "include/views/cef_window.h"
#include "include/views/cef_window_delegate.h"
#include "libcef/browser/views/ns_window.h"
CefNativeWidgetMac::CefNativeWidgetMac(
views::internal::NativeWidgetDelegate* delegate,
CefRefPtr<CefWindow> window,
CefWindowDelegate* window_delegate)
: views::NativeWidgetMac(delegate),
window_(window),
window_delegate_(window_delegate) {}
NativeWidgetMacNSWindow* CefNativeWidgetMac::CreateNSWindow(
const remote_cocoa::mojom::CreateWindowParams* params) {
NSUInteger style_mask =
NSWindowStyleMaskTitled | NSWindowStyleMaskMiniaturizable |
NSWindowStyleMaskClosable | NSWindowStyleMaskResizable |
NSWindowStyleMaskTexturedBackground;
bool is_frameless = window_delegate_->IsFrameless(window_);
auto window = [[CefNSWindow alloc] initWithStyle:style_mask
isFrameless:is_frameless];
if (is_frameless) {
[window setTitlebarAppearsTransparent:YES];
[window setTitleVisibility:NSWindowTitleHidden];
}
if (!window_delegate_->WithStandardWindowButtons(window_)) {
[[window standardWindowButton:NSWindowCloseButton] setHidden:YES];
[[window standardWindowButton:NSWindowMiniaturizeButton] setHidden:YES];
[[window standardWindowButton:NSWindowZoomButton] setHidden:YES];
}
return window;
}
void CefNativeWidgetMac::GetWindowFrameTitlebarHeight(
bool* override_titlebar_height,
float* titlebar_height) {
if (window_delegate_->GetTitlebarHeight(window_, titlebar_height)) {
*override_titlebar_height = true;
} else {
views::NativeWidgetMac::GetWindowFrameTitlebarHeight(
override_titlebar_height, titlebar_height);
}
}

View File

@@ -0,0 +1,20 @@
// Copyright 2023 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_VIEWS_NS_WINDOW_H_
#define CEF_LIBCEF_BROWSER_VIEWS_NS_WINDOW_H_
#pragma once
#include "components/remote_cocoa/app_shim/native_widget_mac_nswindow.h"
@interface CefNSWindow : NativeWidgetMacNSWindow {
@private
bool is_frameless_;
}
- (id)initWithStyle:(NSUInteger)style_mask isFrameless:(bool)is_frameless;
- (BOOL)shouldCenterTrafficLights;
@end
#endif // CEF_LIBCEF_BROWSER_VIEWS_NS_WINDOW_H_

View File

@@ -0,0 +1,104 @@
// Copyright 2023 The Chromium Embedded Framework Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
#include "libcef/browser/views/ns_window.h"
#include "base/i18n/rtl.h"
#include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
#include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h"
#include "ui/base/cocoa/window_size_constants.h"
@interface CefThemeFrame : NativeWidgetMacNSWindowTitledFrame
@end
// NSThemeFrame (PrivateAPI) definitions.
@interface NSThemeFrame (PrivateAPI)
- (void)setStyleMask:(NSUInteger)styleMask;
- (CGFloat)_titlebarHeight;
- (BOOL)_shouldCenterTrafficLights;
@end
@implementation CefThemeFrame {
bool in_full_screen_;
}
// NSThemeFrame (PrivateAPI) overrides.
- (void)setStyleMask:(NSUInteger)styleMask {
in_full_screen_ = (styleMask & NSWindowStyleMaskFullScreen) != 0;
[super setStyleMask:styleMask];
}
- (CGFloat)_titlebarHeight {
if (!in_full_screen_) {
bool override_titlebar_height = false;
float titlebar_height = 0;
auto* window = base::mac::ObjCCast<CefNSWindow>([self window]);
if (auto* bridge = [window bridge]) {
bridge->host()->GetWindowFrameTitlebarHeight(&override_titlebar_height,
&titlebar_height);
if (override_titlebar_height)
return titlebar_height;
}
}
return [super _titlebarHeight];
}
- (BOOL)_shouldCenterTrafficLights {
auto* window = base::mac::ObjCCast<CefNSWindow>([self window]);
return [window shouldCenterTrafficLights];
}
- (BOOL)_shouldFlipTrafficLightsForRTL {
return base::i18n::IsRTL() ? YES : NO;
}
@end
@interface NSWindow (PrivateAPI)
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
@end
@implementation CefNSWindow
- (id)initWithStyle:(NSUInteger)style_mask isFrameless:(bool)is_frameless {
if ((self = [super initWithContentRect:ui::kWindowSizeDeterminedLater
styleMask:style_mask
backing:NSBackingStoreBuffered
defer:NO])) {
is_frameless_ = is_frameless;
}
return self;
}
- (BOOL)shouldCenterTrafficLights {
return is_frameless_ ? YES : NO;
}
// NSWindow overrides.
- (NSRect)contentRectForFrameRect:(NSRect)frameRect {
if (is_frameless_) {
return frameRect;
}
return [super contentRectForFrameRect:frameRect];
}
- (NSRect)frameRectForContentRect:(NSRect)contentRect {
if (is_frameless_) {
return contentRect;
}
return [super frameRectForContentRect:contentRect];
}
// NSWindow (PrivateAPI) overrides.
+ (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
if (Class custom_frame = [CefThemeFrame class]) {
return custom_frame;
}
return [super frameViewClassForStyleMask:windowStyle];
}
@end

View File

@@ -21,8 +21,14 @@ class Point;
}
namespace views {
class NativeWidget;
class Widget;
namespace internal {
class NativeWidgetDelegate;
}
} // namespace views
class CefWindowDelegate;
#define CEF_REQUIRE_VALID_RETURN(ret) \
if (!ParentClass::IsValid()) \
@@ -141,6 +147,11 @@ CefWindowHandle GetWindowHandle(views::Widget* widget);
// Returns the platform window handle for |window|. May return nullptr.
CefWindowHandle GetWindowHandle(gfx::NativeWindow window);
views::NativeWidget* CreateNativeWidget(
views::internal::NativeWidgetDelegate* delegate,
CefRefPtr<CefWindow> window,
CefWindowDelegate* window_delegate);
} // namespace view_util
#endif // CEF_LIBCEF_BROWSER_VIEWS_VIEW_UTIL_H_

View File

@@ -6,6 +6,8 @@
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/views/widget/native_widget.h"
#include "ui/views/widget/native_widget_delegate.h"
#include "ui/views/widget/widget.h"
namespace view_util {
@@ -40,4 +42,11 @@ CefWindowHandle GetWindowHandle(gfx::NativeWindow window) {
return kNullWindowHandle;
}
views::NativeWidget* CreateNativeWidget(
views::internal::NativeWidgetDelegate* delegate,
CefRefPtr<CefWindow> window,
CefWindowDelegate* window_delegate) {
return nullptr;
}
} // namespace view_util

View File

@@ -7,6 +7,7 @@
#import <Cocoa/Cocoa.h>
#include "include/internal/cef_types_mac.h"
#include "libcef/browser/views/native_widget_mac.h"
#include "ui/views/widget/widget.h"
@@ -44,4 +45,10 @@ CefWindowHandle GetWindowHandle(gfx::NativeWindow window) {
return kNullWindowHandle;
}
views::NativeWidget* CreateNativeWidget(
views::internal::NativeWidgetDelegate* delegate,
CefRefPtr<CefWindow> window,
CefWindowDelegate* window_delegate) {
return new CefNativeWidgetMac(delegate, window, window_delegate);
}
} // namespace view_util

View File

@@ -312,6 +312,10 @@ void CefWindowView::CreateWidget(gfx::AcceleratedWidget parent_widget) {
DCHECK(!params.bounds.IsEmpty());
} else {
is_frameless_ = cef_delegate()->IsFrameless(cef_window);
params.native_widget =
view_util::CreateNativeWidget(widget, cef_window, cef_delegate());
can_resize = cef_delegate()->CanResize(cef_window);
const auto show_state = cef_delegate()->GetInitialShowState(cef_window);

View File

@@ -40,8 +40,6 @@ void ChromeMainRunnerDelegate::BeforeMainThreadInitialize(
#else
base::CommandLine::Init(args.argc, args.argv);
#endif
sampling_profiler_ = std::make_unique<MainThreadStackSamplingProfiler>();
}
void ChromeMainRunnerDelegate::BeforeMainMessageLoopRun(
@@ -70,14 +68,16 @@ bool ChromeMainRunnerDelegate::HandleMainMessageLoopQuit() {
return true;
}
void ChromeMainRunnerDelegate::BeforeUIThreadInitialize() {
sampling_profiler_ = std::make_unique<MainThreadStackSamplingProfiler>();
}
void ChromeMainRunnerDelegate::AfterUIThreadShutdown() {
static_cast<ChromeContentBrowserClient*>(
CefAppManager::Get()->GetContentClient()->browser())
->CleanupOnUIThread();
main_delegate_->CleanupOnUIThread();
}
void ChromeMainRunnerDelegate::AfterMainThreadShutdown() {
sampling_profiler_.reset();
}

View File

@@ -35,8 +35,8 @@ class ChromeMainRunnerDelegate : public CefMainRunnerDelegate {
void BeforeMainThreadInitialize(const CefMainArgs& args) override;
void BeforeMainMessageLoopRun(base::RunLoop* run_loop) override;
bool HandleMainMessageLoopQuit() override;
void BeforeUIThreadInitialize() override;
void AfterUIThreadShutdown() override;
void AfterMainThreadShutdown() override;
void BeforeExecuteProcess(const CefMainArgs& args) override;
void AfterExecuteProcess() override;

View File

@@ -24,6 +24,7 @@ class CefMainRunnerDelegate {
virtual void BeforeMainThreadRun() {}
virtual void BeforeMainMessageLoopRun(base::RunLoop* run_loop) {}
virtual bool HandleMainMessageLoopQuit() { return false; }
virtual void BeforeUIThreadInitialize() {}
virtual void AfterUIThreadInitialize() {}
virtual void AfterUIThreadShutdown() {}
virtual void BeforeMainThreadShutdown() {}

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=499cb70269cbe05c9bba4b0672a26116f7436f76$
// $hash=8b92c198857b0ca5c3ddc9b2c8a82febe7ed8cde$
//
#include "libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h"
@@ -111,11 +111,7 @@ browser_view_delegate_get_delegate_for_popup_browser_view(
NOTREACHED() << "invalid settings->[base.]size";
return NULL;
}
// Verify param: client; type: refptr_same
DCHECK(client);
if (!client) {
return NULL;
}
// Unverified params: client
// Translate param: settings; type: struct_byref_const
CefBrowserSettings settingsObj;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=af80a36cdcb47a18eb1ac8bc3315dfd322f4e96e$
// $hash=18f715de465689a4e8484bbced8ad92d9434438a$
//
#include "libcef_dll/cpptoc/views/window_delegate_cpptoc.h"
@@ -270,6 +270,62 @@ window_delegate_is_frameless(struct _cef_window_delegate_t* self,
return _retval;
}
int CEF_CALLBACK window_delegate_with_standard_window_buttons(
struct _cef_window_delegate_t* self,
cef_window_t* window) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
}
// Verify param: window; type: refptr_diff
DCHECK(window);
if (!window) {
return 0;
}
// Execute
bool _retval = CefWindowDelegateCppToC::Get(self)->WithStandardWindowButtons(
CefWindowCToCpp::Wrap(window));
// Return type: bool
return _retval;
}
int CEF_CALLBACK
window_delegate_get_titlebar_height(struct _cef_window_delegate_t* self,
cef_window_t* window,
float* titlebar_height) {
shutdown_checker::AssertNotShutdown();
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return 0;
}
// Verify param: window; type: refptr_diff
DCHECK(window);
if (!window) {
return 0;
}
// Verify param: titlebar_height; type: simple_byaddr
DCHECK(titlebar_height);
if (!titlebar_height) {
return 0;
}
// Execute
bool _retval = CefWindowDelegateCppToC::Get(self)->GetTitlebarHeight(
CefWindowCToCpp::Wrap(window), titlebar_height);
// Return type: bool
return _retval;
}
int CEF_CALLBACK window_delegate_can_resize(struct _cef_window_delegate_t* self,
cef_window_t* window) {
shutdown_checker::AssertNotShutdown();
@@ -705,6 +761,9 @@ CefWindowDelegateCppToC::CefWindowDelegateCppToC() {
GetStruct()->get_initial_bounds = window_delegate_get_initial_bounds;
GetStruct()->get_initial_show_state = window_delegate_get_initial_show_state;
GetStruct()->is_frameless = window_delegate_is_frameless;
GetStruct()->with_standard_window_buttons =
window_delegate_with_standard_window_buttons;
GetStruct()->get_titlebar_height = window_delegate_get_titlebar_height;
GetStruct()->can_resize = window_delegate_can_resize;
GetStruct()->can_maximize = window_delegate_can_maximize;
GetStruct()->can_minimize = window_delegate_can_minimize;

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=4f26a1968e558512fa9894106f0bc9f6b9d8a10f$
// $hash=7301ce9c063a7ff4ab88b6382f6441ba314b20c0$
//
#include "libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.h"
@@ -101,11 +101,7 @@ CefBrowserViewDelegateCToCpp::GetDelegateForPopupBrowserView(
if (!browser_view.get()) {
return nullptr;
}
// Verify param: client; type: refptr_same
DCHECK(client.get());
if (!client.get()) {
return nullptr;
}
// Unverified params: client
// Execute
cef_browser_view_delegate_t* _retval =

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=18f601c8e152c39928595e1f02c9274f0dc6ce8a$
// $hash=40aea12873a3c8803c9d2d6c06a0270197ead58e$
//
#include "libcef_dll/ctocpp/views/window_delegate_ctocpp.h"
@@ -257,6 +257,63 @@ bool CefWindowDelegateCToCpp::IsFrameless(CefRefPtr<CefWindow> window) {
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
bool CefWindowDelegateCToCpp::WithStandardWindowButtons(
CefRefPtr<CefWindow> window) {
shutdown_checker::AssertNotShutdown();
cef_window_delegate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, with_standard_window_buttons)) {
return false;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: window; type: refptr_diff
DCHECK(window.get());
if (!window.get()) {
return false;
}
// Execute
int _retval = _struct->with_standard_window_buttons(
_struct, CefWindowCppToC::Wrap(window));
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
bool CefWindowDelegateCToCpp::GetTitlebarHeight(CefRefPtr<CefWindow> window,
float* titlebar_height) {
shutdown_checker::AssertNotShutdown();
cef_window_delegate_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_titlebar_height)) {
return false;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: window; type: refptr_diff
DCHECK(window.get());
if (!window.get()) {
return false;
}
// Verify param: titlebar_height; type: simple_byaddr
DCHECK(titlebar_height);
if (!titlebar_height) {
return false;
}
// Execute
int _retval = _struct->get_titlebar_height(
_struct, CefWindowCppToC::Wrap(window), titlebar_height);
// Return type: bool
return _retval ? true : false;
}
NO_SANITIZE("cfi-icall")
bool CefWindowDelegateCToCpp::CanResize(CefRefPtr<CefWindow> window) {
shutdown_checker::AssertNotShutdown();

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=1a923e68b1e07234f97d3c219cc70cc91c118a77$
// $hash=d100d8866a7eab2a163d4ddb3cacd00141f65757$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_VIEWS_WINDOW_DELEGATE_CTOCPP_H_
@@ -50,6 +50,9 @@ class CefWindowDelegateCToCpp
CefRect GetInitialBounds(CefRefPtr<CefWindow> window) override;
cef_show_state_t GetInitialShowState(CefRefPtr<CefWindow> window) override;
bool IsFrameless(CefRefPtr<CefWindow> window) override;
bool WithStandardWindowButtons(CefRefPtr<CefWindow> window) override;
bool GetTitlebarHeight(CefRefPtr<CefWindow> window,
float* titlebar_height) override;
bool CanResize(CefRefPtr<CefWindow> window) override;
bool CanMaximize(CefRefPtr<CefWindow> window) override;
bool CanMinimize(CefRefPtr<CefWindow> window) override;

View File

@@ -30,8 +30,8 @@ patches = [
# https://bugs.chromium.org/p/chromium/issues/detail?id=634788
#
# Windows: Add cc_wrapper support for sccache builds.
# https://bitbucket.org/chromiumembedded/cef/issues/2432
'name': 'gn_config',
# https://github.com/chromiumembedded/cef/issues/2432
'name': 'gn_config',
},
{
# Patches that must be applied after `gclient sync --nohooks` and before
@@ -41,12 +41,12 @@ patches = [
# https://bugs.chromium.org/p/chromium/issues/detail?id=623342
#
# Don't copy dbghelp.dll/dbgcore.dll from the Windows SDK.
# https://bitbucket.org/chromiumembedded/cef/issues/3356
# https://github.com/chromiumembedded/cef/issues/3356
'name': 'runhooks',
},
{
# Support component builds (GN is_component_build=true).
# https://bitbucket.org/chromiumembedded/cef/issues/1617
# https://github.com/chromiumembedded/cef/issues/1617
'name': 'component_build',
},
{
@@ -58,7 +58,7 @@ patches = [
#
# Add MessageLoop::ReleasePump to fix crashes during shutdown with multi-
# threaded message loop mode.
# https://bitbucket.org/chromiumembedded/cef/issues/2362
# https://github.com/chromiumembedded/cef/issues/2362
'name': 'message_loop',
},
{
@@ -77,27 +77,27 @@ patches = [
},
{
# Fix export of UnderlayOpenGLHostingWindow for 64-bit MacOS builds.
# https://bitbucket.org/chromiumembedded/cef/issues/1051
# https://github.com/chromiumembedded/cef/issues/1051
'name': 'underlay_1051',
},
{
# Allow specification of a parent window handle for Widget creation.
# https://bitbucket.org/chromiumembedded/cef/issues/180
# https://github.com/chromiumembedded/cef/issues/180
#
# Fix multiple handling of WM_MOUSEWHEEL messages on Windows.
# https://bitbucket.org/chromiumembedded/cef/issues/1481
# https://github.com/chromiumembedded/cef/issues/1481
#
# Support custom RenderWidgetHostViewOSR for BrowserPluginGuest.
# https://bitbucket.org/chromiumembedded/cef/issues/1565
# https://github.com/chromiumembedded/cef/issues/1565
#
# Fix focus/activation handling and keyboard input on Windows and Linux.
# https://bitbucket.org/chromiumembedded/cef/issues/1677
# https://bitbucket.org/chromiumembedded/cef/issues/1679
# https://bitbucket.org/chromiumembedded/cef/issues/1700
# https://bitbucket.org/chromiumembedded/cef/issues/3316
# https://github.com/chromiumembedded/cef/issues/1677
# https://github.com/chromiumembedded/cef/issues/1679
# https://github.com/chromiumembedded/cef/issues/1700
# https://github.com/chromiumembedded/cef/issues/3316
#
# Support creation of captionless windows with resizable borders.
# https://bitbucket.org/chromiumembedded/cef/issues/1749
# https://github.com/chromiumembedded/cef/issues/1749
#
# Windows: When |params.remove_standard_frame| is true remove WS_CAPTION
# and WS_SYSMENU styles. Otherwise Windows 10 enforces a minimum window
@@ -105,13 +105,13 @@ patches = [
# Linux: Allow creation of activatable menu windows.
# Linux: Support CefWindowDelegate::CanResize restriction by specifying
# min/max Widget size values.
# https://bitbucket.org/chromiumembedded/cef/issues/1947
# https://github.com/chromiumembedded/cef/issues/1947
#
# Support configuration of RWHVGuest device scale factor.
# https://bitbucket.org/chromiumembedded/cef/issues/2078
# https://github.com/chromiumembedded/cef/issues/2078
#
# Windows: Fix focus assignment when clicking WebView with external parent.
# https://bitbucket.org/chromiumembedded/cef/issues/3031
# https://github.com/chromiumembedded/cef/issues/3031
#
# Fix minimize & fullscreen behavior on initial Widget creation.
#
@@ -121,27 +121,27 @@ patches = [
#
# Windows: Fix incorrect DIPToScreenRect usage in DesktopWindowTreeHostWin
# when |has_external_parent_| is true.
# https://bitbucket.org/chromiumembedded/cef/issues/3359
# https://github.com/chromiumembedded/cef/issues/3359
'name': 'views_widget',
},
{
# Allow specification of a custom WebContentsView.
# https://bitbucket.org/chromiumembedded/cef/issues/1257
# https://github.com/chromiumembedded/cef/issues/1257
#
# Support custom RenderWidgetHostViewOSR for BrowserPluginGuest.
# https://bitbucket.org/chromiumembedded/cef/issues/1565
# https://github.com/chromiumembedded/cef/issues/1565
#
# Add WebContentsObserver::OnFrameFocused.
#
# Add WebContentsObserver::RenderWidgetCreated.
# https://bitbucket.org/chromiumembedded/cef/issues/3308
# https://github.com/chromiumembedded/cef/issues/3308
'name': 'web_contents_1257_1565',
},
{
# Support custom RenderWidgetHostViewOSR for MimeHandlerViewGuest and
# expose OnGuestAttached/Detached notifications.
# https://bitbucket.org/chromiumembedded/cef/issues/1565
# https://bitbucket.org/chromiumembedded/cef/issues/2727
# https://github.com/chromiumembedded/cef/issues/1565
# https://github.com/chromiumembedded/cef/issues/2727
'name': 'mime_handler_view_guest_1565_2727',
},
{
@@ -154,21 +154,21 @@ patches = [
# https://bugs.chromium.org/p/chromium/issues/detail?id=654986#c17
#
# Remove DCHECK on Linux when initialized CEF from a non-main thread.
# https://bitbucket.org/chromiumembedded/cef/issue/1639
# https://github.com/chromiumembedded/cef/issues/1639
#
# Fix DiscardableSharedMemoryManager crash on shutdown with multi-threaded
# message loop.
# https://bitbucket.org/chromiumembedded/cef/issues/2798
# https://github.com/chromiumembedded/cef/issues/2798
'name': 'content_main_654986',
},
{
# Expose the FontFamilyCache UserData key.
# https://bitbucket.org/chromiumembedded/cef/issues/1501
# https://github.com/chromiumembedded/cef/issues/1501
'name': 'font_family_cache_1501',
},
{
# Modify views::View to extend SupportsUserData.
# https://bitbucket.org/chromiumembedded/cef/issues/1749
# https://github.com/chromiumembedded/cef/issues/1749
#
# Don't add TestDesktopScreenOzone dependency on Linux.
# Reverts ui_controls_factory_desktop_aurax11.cc (now
@@ -185,10 +185,10 @@ patches = [
#
# Expose callbacks for mouse/keyboard events that trigger menu switching.
# Add accelerator display support to Label.
# https://bitbucket.org/chromiumembedded/cef/issues/2102
# https://github.com/chromiumembedded/cef/issues/2102
#
# Route |parent_widget| to MenuHost for OSR context menu Widget creation.
# https://bitbucket.org/chromiumembedded/cef/issues/3330
# https://github.com/chromiumembedded/cef/issues/3330
'name': 'views_1749_2102_3330',
},
{
@@ -204,19 +204,19 @@ patches = [
},
{
# Changes to support the Chrome runtime in CEF.
# https://bitbucket.org/chromiumembedded/cef/issues/2969
# https://github.com/chromiumembedded/cef/issues/2969
'name': 'chrome_runtime',
},
{
# Changes to support Chrome runtime integration with CEF Views.
# See related documentation in
# libcef/browser/chrome/views/chrome_browser_frame.h.
# https://bitbucket.org/chromiumembedded/cef/issues/2969
# https://github.com/chromiumembedded/cef/issues/2969
'name': 'chrome_runtime_views',
},
{
# Changes to support the Chrome runtime in CEF.
# https://bitbucket.org/chromiumembedded/cef/issues/2969
# https://github.com/chromiumembedded/cef/issues/2969
#
# Fix fatal error: 'components/printing/common/print.mojom.h' file not found
# From chrome/browser/ui/browser_commands.cc via
@@ -225,7 +225,7 @@ patches = [
},
{
# Don't initialize ExtensionSystemFactory when extensions are disabled.
# https://bitbucket.org/chromiumembedded/cef/issues/2359
# https://github.com/chromiumembedded/cef/issues/2359
#
# Remove NOTREACHED() in GetContentSettingFromRulesImpl triggered by
# NavigationTest.LoadCrossOriginLoadURL with the chrome runtime.
@@ -233,7 +233,7 @@ patches = [
},
{
# chrome: Support custom handling of context menus.
# https://bitbucket.org/chromiumembedded/cef/issues/2969
# https://github.com/chromiumembedded/cef/issues/2969
'name': 'chrome_browser_context_menus',
},
{
@@ -241,7 +241,7 @@ patches = [
# - Adds support for FileSelectHelper and SelectFileDialog interception.
# - Adds additional type filters for dialogs created via FileSelectHelper.
# - Adds support for chaining PrintingContextLinux callbacks.
# https://bitbucket.org/chromiumembedded/cef/issues/3314
# https://github.com/chromiumembedded/cef/issues/3314
'name': 'chrome_browser_dialogs_native',
},
{
@@ -250,44 +250,44 @@ patches = [
# DialogDelegate::CreateDialogWidget for CEF windowless rendering.
# - Support nullptr gfx::NativeWindow/gfx::NativeView dialog parent for CEF
# windowless rendering.
# https://bitbucket.org/chromiumembedded/cef/issues/3316
# https://github.com/chromiumembedded/cef/issues/3316
'name': 'chrome_browser_dialogs_widget',
},
{
# chrome: Support override of ChromeMimeHandlerViewGuestDelegate.
# https://bitbucket.org/chromiumembedded/cef/issues/2969
# https://github.com/chromiumembedded/cef/issues/2969
'name': 'chrome_browser_extensions',
},
{
# alloy: Disable ProxyErrorClient callbacks when extensions are disabled.
# https://bitbucket.org/chromiumembedded/cef/issues/2830
# https://github.com/chromiumembedded/cef/issues/2830
'name': 'chrome_browser_net_proxy',
},
{
# Support override of CreatePermissionPrompt.
# https://bitbucket.org/chromiumembedded/cef/issues/3352
# https://github.com/chromiumembedded/cef/issues/3352
'name': 'chrome_browser_permission_prompt',
},
{
# alloy: Don't initialize ExtensionSystemFactory when extensions are
# disabled.
# https://bitbucket.org/chromiumembedded/cef/issues/2852
# https://github.com/chromiumembedded/cef/issues/2852
'name': 'chrome_browser_themes',
},
{
# Make some methods of ProfileManager virtual.
#
# Don't create IdentityManager in RendererUpdater.
# https://bitbucket.org/chromiumembedded/cef/issues/1917
# https://github.com/chromiumembedded/cef/issues/1917
#
# chrome: Support CEF incognito Profiles that allow Browser creation.
# chrome: Allow CEF to delay OffTheRecordProfileImpl initialization.
# https://bitbucket.org/chromiumembedded/cef/issues/2969
# https://github.com/chromiumembedded/cef/issues/2969
'name': 'chrome_browser_profiles',
},
{
# chrome: Fix assertion when clicking the incognito profile button.
# https://bitbucket.org/chromiumembedded/cef/issues/2969
# https://github.com/chromiumembedded/cef/issues/2969
'name': 'chrome_browser_profile_menu',
},
{
@@ -298,7 +298,7 @@ patches = [
{
# Support override of the User-Agent product component when NetworkService
# is enabled.
# https://bitbucket.org/chromiumembedded/cef/issues/2622
# https://github.com/chromiumembedded/cef/issues/2622
'name': 'embedder_product_override',
},
{
@@ -314,17 +314,17 @@ patches = [
{
# Don't create databases, blob_storage or VideoDecodeStats directories when
# cache_path is empty.
# https://bitbucket.org/chromiumembedded/cef/issues/2289
# https://github.com/chromiumembedded/cef/issues/2289
'name': 'storage_incognito_2289',
},
{
# Support WebUI by removing dependency on non-NULL IOThread* object.
# https://bitbucket.org/chromiumembedded/cef/issues/2037
# https://github.com/chromiumembedded/cef/issues/2037
'name': 'webui_2037',
},
{
# Implement breakpad/crashpad customization required by CEF.
# https://bitbucket.org/chromiumembedded/cef/issues/1995
# https://github.com/chromiumembedded/cef/issues/1995
'name': 'crashpad_1995',
},
{
@@ -337,7 +337,7 @@ patches = [
},
{
# Fix white flash during browser creation.
# https://bitbucket.org/chromiumembedded/cef/issues/1984
# https://github.com/chromiumembedded/cef/issues/1984
#
# Windows: Fix crash during window creation.
# https://bugs.chromium.org/p/chromium/issues/detail?id=761389
@@ -354,15 +354,15 @@ patches = [
# Add ContentRendererClient::DevToolsAgent[Attached|Detached] methods.
#
# Always return the Chrome product value for DevTools.
# https://bitbucket.org/chromiumembedded/cef/issues/2300
# https://github.com/chromiumembedded/cef/issues/2300
#
# Add new ContentBrowserClient::HandleExternalProtocol variant for use with
# the NetworkService.
# https://bitbucket.org/chromiumembedded/cef/issues/2622
# https://github.com/chromiumembedded/cef/issues/2622
#
# Change ContentBrowserClient::ConfigureNetworkContextParams return type to
# bool to support cancellation of NetworkContext creation during shutdown.
# https://bitbucket.org/chromiumembedded/cef/issues/2985
# https://github.com/chromiumembedded/cef/issues/2985
'name': 'content_2015',
},
{
@@ -371,18 +371,18 @@ patches = [
},
{
# Linux: Attach routing IDs to PrintingContext.
# https://bitbucket.org/chromiumembedded/cef/issues/2196
# https://github.com/chromiumembedded/cef/issues/2196
'name': 'printing_context_2196',
},
{
# Windows: Remove llvmlibthin as the combine_libs.py can't handle those.
# https://bitbucket.org/chromiumembedded/cef/issues/2470
# https://github.com/chromiumembedded/cef/issues/2470
'name': 'build',
},
{
# Changes necessary to support chrome extensions. Add a new
# ExtensionHost constructor that allows CEF to create the WebContents.
# https://bitbucket.org/chromiumembedded/cef/issues/1947
# https://github.com/chromiumembedded/cef/issues/1947
#
# Don't initialize PrerenderContents object in StreamsPrivateAPI.
#
@@ -392,7 +392,7 @@ patches = [
},
{
# macOS: Fix undesirable switch to discrete GPU during startup.
# https://bitbucket.org/chromiumembedded/cef/issues/2398
# https://github.com/chromiumembedded/cef/issues/2398
#
# macOS: Rely on symlinks to find the Libraries directory.
# https://bugs.chromium.org/p/chromium/issues/detail?id=757974#c23
@@ -400,28 +400,28 @@ patches = [
},
{
# macOS: Make the NativeEventProcessor protocol dependency optional.
# https://bitbucket.org/chromiumembedded/cef/issues/2539
# https://github.com/chromiumembedded/cef/issues/2539
'name': 'mac_event_observer_2539',
},
{
# macOS: Fix crash when scrolling in OSR mode.
# https://bitbucket.org/chromiumembedded/cef/issues/2540
# https://github.com/chromiumembedded/cef/issues/2540
'name': 'mac_fling_scheduler_2540',
},
{
# Allow ResourceBundle creation/destruction on the main thread and usage on
# the UI thread.
# https://bitbucket.org/chromiumembedded/cef/issues/2398
# https://github.com/chromiumembedded/cef/issues/2398
'name': 'resource_bundle_2512',
},
{
# macOS: Fix crash when showing a select popup with CefDoMessageLoopWork.
# https://bitbucket.org/chromiumembedded/cef/issues/2495
# https://github.com/chromiumembedded/cef/issues/2495
'name': 'message_pump_mac_2495',
},
{
# Linux: Load binaries from DIR_ASSETS.
# https://bitbucket.org/chromiumembedded/cef/issues/1936
# https://github.com/chromiumembedded/cef/issues/1936
'name': 'linux_assets_path_1936',
},
{
@@ -432,7 +432,7 @@ patches = [
},
{
# Linux: Avoid usage of chrome::FILE_COMPONENT_WIDEVINE_CDM_HINT.
# https://bitbucket.org/chromiumembedded/cef/issues/3149
# https://github.com/chromiumembedded/cef/issues/3149
'name': 'linux_chrome_widevine_3149',
},
{
@@ -440,21 +440,21 @@ patches = [
# - Add support for calling CookieMonster::SetCookieableSchemes.
# - Fix cache directory structure ("C:\temp\cache\cache\Cache" should be
# "C:\temp\cache\Cache").
# https://bitbucket.org/chromiumembedded/cef/issues/2622
# https://github.com/chromiumembedded/cef/issues/2622
#
# alloy: Avoid initialization of privacy sandbox and identity manager.
# https://bitbucket.org/chromiumembedded/cef/issues/3434
# https://github.com/chromiumembedded/cef/issues/3434
'name': 'services_network_2622',
},
{
# Enhancements to NetworkService:
# - Remove the non-nullptr WebContents requirement from
# NetworkServiceClient::OnAuthRequired.
# https://bitbucket.org/chromiumembedded/cef/issues/2718
# https://github.com/chromiumembedded/cef/issues/2718
#
# Change ContentBrowserClient::ConfigureNetworkContextParams return type to
# bool to support cancellation of NetworkContext creation during shutdown.
# https://bitbucket.org/chromiumembedded/cef/issues/2985
# https://github.com/chromiumembedded/cef/issues/2985
#
# Compute correct default quota when cache_path is unspecified.
'name': 'services_network_2718',
@@ -503,7 +503,7 @@ patches = [
},
{
# Add support for OSR rendering with Viz.
# https://bitbucket.org/chromiumembedded/cef/issues/2575
# https://github.com/chromiumembedded/cef/issues/2575
'name': 'viz_osr_2575',
},
{
@@ -513,17 +513,17 @@ patches = [
# - Remove unsupported print preview UI options.
# - macOS: Fix error: no member named 'kCloudPrinterHandler' in namespace
# 'printing::features',
# https://bitbucket.org/chromiumembedded/cef/issues/123
# https://github.com/chromiumembedded/cef/issues/123
'name': 'print_preview_123',
},
{
# Store command-line switch names as lower-case ASCII on all platforms.
# https://bitbucket.org/chromiumembedded/cef/issues/1872
# https://github.com/chromiumembedded/cef/issues/1872
'name': 'base_command_line_1872',
},
{
# Remove cef_sandbox dependency on boringssl functions.
# https://bitbucket.org/chromiumembedded/cef/issues/2743
# https://github.com/chromiumembedded/cef/issues/2743
#
# Enable the VS 2015 Update 2 fix when building with the MSVC standard
# library.
@@ -537,13 +537,13 @@ patches = [
{
# Add RenderWidgetHostImpl::SetCompositorForFlingScheduler to fix fling
# scrolling in OSR mode.
# https://bitbucket.org/chromiumembedded/cef/issues/2745
# https://github.com/chromiumembedded/cef/issues/2745
'name': 'osr_fling_2745',
},
{
# Windows: Build targets as C++17 to avoid export of std::is_integral
# templates in cef_sandbox that should be inlined.
# https://bitbucket.org/chromiumembedded/cef/issues/2819
# https://github.com/chromiumembedded/cef/issues/2819
'name': 'win_cpp17_msvc_sandbox_2819',
},
{
@@ -563,7 +563,7 @@ patches = [
#
# Fix crash in NavigationRequest::GetOriginForURLLoaderFactory() when
# navigating to an unregistered (e.g. non-standard) scheme.
# https://bitbucket.org/chromiumembedded/cef/issues/3105
# https://github.com/chromiumembedded/cef/issues/3105
'name': 'browser_security_policy_1081397',
},
{
@@ -571,7 +571,7 @@ patches = [
# https://bugs.chromium.org/p/chromium/issues/detail?id=1100085
#
# Changes to support the Chrome runtime in CEF (app_controller_mac.mm).
# https://bitbucket.org/chromiumembedded/cef/issues/2969
# https://github.com/chromiumembedded/cef/issues/2969
'name': 'chrome_browser_background_mode_1100085',
},
{
@@ -581,12 +581,12 @@ patches = [
},
{
# Windows: Fix crash when |sandbox_info| parameter is nullptr.
# https://bitbucket.org/chromiumembedded/cef/issues/3210
# https://github.com/chromiumembedded/cef/issues/3210
'name': 'win_sandbox_3210',
},
{
# Windows: Always use the root window as the owner for shell dialogs.
# https://bitbucket.org/chromiumembedded/cef/issues/3294
# https://github.com/chromiumembedded/cef/issues/3294
'name': 'win_shell_dialogs_3294',
},
{
@@ -596,7 +596,7 @@ patches = [
},
{
# Linux: Support chaining of PrintingContextLinux callbacks.
# https://bitbucket.org/chromiumembedded/cef/issues/3314
# https://github.com/chromiumembedded/cef/issues/3314
# Also reverts the changes from https://crrev.com/db245883e1
'name': 'linux_printing_context',
},

View File

@@ -20,10 +20,10 @@ index 4dbf8a2811c9e..917b6a2e7b56f 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 76c8470dfd3e5..9ab6ce0759c9a 100644
index 4b552797303b8..0e39c982b5803 100644
--- content/browser/renderer_host/navigation_request.cc
+++ content/browser/renderer_host/navigation_request.cc
@@ -6936,10 +6936,22 @@ NavigationRequest::GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(
@@ -6942,10 +6942,22 @@ NavigationRequest::GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(
bool use_opaque_origin =
(sandbox_flags & network::mojom::WebSandboxFlags::kOrigin) ==
network::mojom::WebSandboxFlags::kOrigin;
@@ -47,7 +47,7 @@ index 76c8470dfd3e5..9ab6ce0759c9a 100644
}
return origin_and_debug_info;
@@ -6969,6 +6981,15 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
@@ -6975,6 +6987,15 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(
SandboxFlagsToCommit());

View File

@@ -70,7 +70,7 @@ index 03a6d3a2ee5e8..a19224279243c 100644
]
}
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
index 08ac5f0afd874..480986df48aa6 100644
index 13a07ce16ad4f..66ae1d0afba7d 100644
--- chrome/browser/ui/browser.cc
+++ chrome/browser/ui/browser.cc
@@ -264,6 +264,25 @@
@@ -113,7 +113,7 @@ index 08ac5f0afd874..480986df48aa6 100644
location_bar_model_ = std::make_unique<LocationBarModelImpl>(
location_bar_model_delegate_.get(), content::kMaxURLDisplayChars);
@@ -650,6 +676,12 @@ Browser::~Browser() {
@@ -649,6 +675,12 @@ Browser::~Browser() {
// away so they don't try and call back to us.
if (select_file_dialog_.get())
select_file_dialog_->ListenerDestroyed();
@@ -126,7 +126,7 @@ index 08ac5f0afd874..480986df48aa6 100644
}
///////////////////////////////////////////////////////////////////////////////
@@ -1359,6 +1391,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
@@ -1358,6 +1390,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
if (exclusive_access_manager_->HandleUserKeyEvent(event))
return content::KeyboardEventProcessingResult::HANDLED;
@@ -141,7 +141,7 @@ index 08ac5f0afd874..480986df48aa6 100644
return window()->PreHandleKeyboardEvent(event);
}
@@ -1366,8 +1406,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
@@ -1365,8 +1405,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
const NativeWebKeyboardEvent& event) {
DevToolsWindow* devtools_window =
DevToolsWindow::GetInstanceForInspectedWebContents(source);
@@ -162,7 +162,7 @@ index 08ac5f0afd874..480986df48aa6 100644
}
bool Browser::TabsNeedBeforeUnloadFired() {
@@ -1575,6 +1625,14 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
@@ -1574,6 +1624,14 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
return window->OpenURLFromTab(source, params);
}
@@ -177,23 +177,7 @@ index 08ac5f0afd874..480986df48aa6 100644
NavigateParams nav_params(this, params.url, params.transition);
nav_params.FillNavigateParamsFromOpenURLParams(params);
nav_params.source_contents = source;
@@ -1712,6 +1770,15 @@ void Browser::AddNewContents(
return;
}
+#if BUILDFLAG(ENABLE_CEF)
+ if (cef_browser_delegate_) {
+ cef_browser_delegate_->AddNewContents(
+ source, std::move(new_contents), target_url, disposition,
+ window_features, user_gesture, was_blocked);
+ return;
+ }
+#endif
+
chrome::AddWebContents(this, source, std::move(new_contents), target_url,
disposition, window_features, window_action);
}
@@ -1730,6 +1797,8 @@ void Browser::LoadingStateChanged(WebContents* source,
@@ -1729,6 +1787,8 @@ void Browser::LoadingStateChanged(WebContents* source,
bool should_show_loading_ui) {
ScheduleUIUpdate(source, content::INVALIDATE_TYPE_LOAD);
UpdateWindowForLoadingStateChanged(source, should_show_loading_ui);
@@ -202,7 +186,7 @@ index 08ac5f0afd874..480986df48aa6 100644
}
void Browser::CloseContents(WebContents* source) {
@@ -1757,6 +1826,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
@@ -1756,6 +1816,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
}
void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -211,7 +195,7 @@ index 08ac5f0afd874..480986df48aa6 100644
if (!GetStatusBubble())
return;
@@ -1764,6 +1835,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -1763,6 +1825,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
GetStatusBubble()->SetURL(url);
}
@@ -229,7 +213,7 @@ index 08ac5f0afd874..480986df48aa6 100644
void Browser::ContentsMouseEvent(WebContents* source,
bool motion,
bool exited) {
@@ -1788,6 +1870,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
@@ -1787,6 +1860,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
return false;
}
@@ -249,7 +233,7 @@ index 08ac5f0afd874..480986df48aa6 100644
void Browser::BeforeUnloadFired(WebContents* web_contents,
bool proceed,
bool* proceed_to_fire_unload) {
@@ -1880,6 +1975,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
@@ -1879,6 +1965,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
// Make the tab show up in the task manager.
task_manager::WebContentsTags::CreateForTabContents(new_contents);
@@ -260,7 +244,7 @@ index 08ac5f0afd874..480986df48aa6 100644
}
void Browser::PortalWebContentsCreated(WebContents* portal_web_contents) {
@@ -1991,11 +2090,15 @@ void Browser::EnterFullscreenModeForTab(
@@ -1990,11 +2080,15 @@ void Browser::EnterFullscreenModeForTab(
const blink::mojom::FullscreenOptions& options) {
exclusive_access_manager_->fullscreen_controller()->EnterFullscreenModeForTab(
requesting_frame, options.display_id);
@@ -276,7 +260,7 @@ index 08ac5f0afd874..480986df48aa6 100644
}
bool Browser::IsFullscreenForTabOrPending(const WebContents* web_contents) {
@@ -2189,6 +2292,15 @@ void Browser::RequestMediaAccessPermission(
@@ -2188,6 +2282,15 @@ void Browser::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) {
@@ -292,7 +276,7 @@ index 08ac5f0afd874..480986df48aa6 100644
const extensions::Extension* extension =
GetExtensionForOrigin(profile_, request.security_origin);
MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
@@ -2725,13 +2837,20 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
@@ -2724,13 +2827,20 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
// Browser, Getters for UI (private):
StatusBubble* Browser::GetStatusBubble() {
@@ -314,7 +298,7 @@ index 08ac5f0afd874..480986df48aa6 100644
return window_ ? window_->GetStatusBubble() : nullptr;
}
@@ -2863,6 +2982,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
@@ -2862,6 +2972,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
BookmarkTabHelper::FromWebContents(web_contents)->RemoveObserver(this);
web_contents_collection_.StopObserving(web_contents);
}
@@ -324,7 +308,7 @@ index 08ac5f0afd874..480986df48aa6 100644
void Browser::TabDetachedAtImpl(content::WebContents* contents,
diff --git chrome/browser/ui/browser.h chrome/browser/ui/browser.h
index 08879ac2f134a..cdd6615f72db4 100644
index 10105dd979aa4..9277cd507ae8e 100644
--- chrome/browser/ui/browser.h
+++ chrome/browser/ui/browser.h
@@ -22,6 +22,7 @@
@@ -347,7 +331,7 @@ index 08879ac2f134a..cdd6615f72db4 100644
#error This file should only be included on desktop.
#endif
@@ -315,6 +320,11 @@ class Browser : public TabStripModelObserver,
float initial_aspect_ratio = 1.0f;
double initial_aspect_ratio = 1.0;
bool lock_aspect_ratio = false;
+#if BUILDFLAG(ENABLE_CEF)
@@ -426,10 +410,10 @@ index 08879ac2f134a..cdd6615f72db4 100644
// The opener browser of the document picture-in-picture browser. Null if the
diff --git chrome/browser/ui/browser_navigator.cc chrome/browser/ui/browser_navigator.cc
index f6df2d49dc719..01e5e7a42fa96 100644
index dda3f5ba7f9a3..67b0eaaddfd3b 100644
--- chrome/browser/ui/browser_navigator.cc
+++ chrome/browser/ui/browser_navigator.cc
@@ -565,6 +565,13 @@ std::unique_ptr<content::WebContents> CreateTargetContents(
@@ -534,6 +534,13 @@ std::unique_ptr<content::WebContents> CreateTargetContents(
std::unique_ptr<WebContents> target_contents =
WebContents::Create(create_params);
@@ -444,7 +428,7 @@ index f6df2d49dc719..01e5e7a42fa96 100644
// tab helpers, so the entire set of tab helpers needs to be set up
// immediately.
diff --git chrome/browser/ui/browser_tabstrip.cc chrome/browser/ui/browser_tabstrip.cc
index a3dbf97b6f943..6d8e521e9f189 100644
index a3dbf97b6f943..799a64e17fca5 100644
--- chrome/browser/ui/browser_tabstrip.cc
+++ chrome/browser/ui/browser_tabstrip.cc
@@ -33,9 +33,13 @@ void AddTabAt(Browser* browser,
@@ -462,3 +446,20 @@ index a3dbf97b6f943..6d8e521e9f189 100644
params.disposition = foreground ? WindowOpenDisposition::NEW_FOREGROUND_TAB
: WindowOpenDisposition::NEW_BACKGROUND_TAB;
params.tabstrip_index = idx;
@@ -71,6 +75,16 @@ void AddWebContents(Browser* browser,
// Can't create a new contents for the current tab - invalid case.
DCHECK(disposition != WindowOpenDisposition::CURRENT_TAB);
+#if BUILDFLAG(ENABLE_CEF)
+ if (browser && browser->cef_delegate() && new_contents) {
+ new_contents = browser->cef_delegate()->AddWebContents(
+ std::move(new_contents));
+ if (!new_contents) {
+ return;
+ }
+ }
+#endif
+
NavigateParams params(browser, std::move(new_contents));
params.source_contents = source_contents;
params.url = target_url;

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/renderer_context_menu/render_view_context_menu.cc chrome/browser/renderer_context_menu/render_view_context_menu.cc
index c3350ad6f9d34..851eb1cfed65b 100644
index 320f0cbcd14f9..b199f7a33e6d1 100644
--- chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -313,6 +313,13 @@ base::OnceCallback<void(RenderViewContextMenu*)>* GetMenuShownCallback() {

View File

@@ -44,7 +44,7 @@ index 16107572d4d0d..409e9ea870482 100644
base::FeatureList::IsEnabled(
features::kPeriodicSyncPermissionForDefaultSearchEngine) &&
diff --git chrome/browser/permissions/chrome_permissions_client.cc chrome/browser/permissions/chrome_permissions_client.cc
index faa6ee8eb3dbc..4cf7c6959c7e6 100644
index d0d4fd4f7925b..0755927b00e2c 100644
--- chrome/browser/permissions/chrome_permissions_client.cc
+++ chrome/browser/permissions/chrome_permissions_client.cc
@@ -14,6 +14,7 @@
@@ -65,7 +65,7 @@ index faa6ee8eb3dbc..4cf7c6959c7e6 100644
return site_engagement::SiteEngagementService::Get(
Profile::FromBrowserContext(browser_context))
->GetScore(origin);
@@ -320,8 +324,10 @@ ChromePermissionsClient::CreatePermissionUiSelectors(
@@ -321,8 +325,10 @@ ChromePermissionsClient::CreatePermissionUiSelectors(
std::make_unique<ContextualNotificationPermissionUiSelector>());
selectors.emplace_back(std::make_unique<PrefNotificationPermissionUiSelector>(
Profile::FromBrowserContext(browser_context)));

View File

@@ -211,7 +211,7 @@ index 194833d0bae43..21564d96466c0 100644
+#endif
}
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
index 95fc727fe36b7..06e56e9525a84 100644
index 6170a5656eb83..8d4ae07b4fd58 100644
--- chrome/browser/chrome_content_browser_client.cc
+++ chrome/browser/chrome_content_browser_client.cc
@@ -36,6 +36,7 @@
@@ -255,7 +255,7 @@ index 95fc727fe36b7..06e56e9525a84 100644
}
base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() {
@@ -6157,7 +6167,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
@@ -6159,7 +6169,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
network_service);
}
@@ -264,7 +264,7 @@ index 95fc727fe36b7..06e56e9525a84 100644
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -6175,6 +6185,8 @@ void ChromeContentBrowserClient::ConfigureNetworkContextParams(
@@ -6177,6 +6187,8 @@ void ChromeContentBrowserClient::ConfigureNetworkContextParams(
network_context_params->user_agent = GetUserAgentBasedOnPolicy(context);
network_context_params->accept_language = GetApplicationLocale();
}
@@ -273,7 +273,7 @@ index 95fc727fe36b7..06e56e9525a84 100644
}
std::vector<base::FilePath>
@@ -7081,10 +7093,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
@@ -7083,10 +7095,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
const auto now = base::TimeTicks::Now();
const auto timeout = GetKeepaliveTimerTimeout(context);
keepalive_deadline_ = std::max(keepalive_deadline_, now + timeout);
@@ -286,7 +286,7 @@ index 95fc727fe36b7..06e56e9525a84 100644
FROM_HERE, keepalive_deadline_ - now,
base::BindOnce(
&ChromeContentBrowserClient::OnKeepaliveTimerFired,
@@ -7103,7 +7115,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
@@ -7105,7 +7117,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
--num_keepalive_requests_;
if (num_keepalive_requests_ == 0) {
DVLOG(1) << "Stopping the keepalive timer";
@@ -296,7 +296,7 @@ index 95fc727fe36b7..06e56e9525a84 100644
// This deletes the keep alive handle attached to the timer function and
// unblock the shutdown sequence.
}
@@ -7239,7 +7252,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
@@ -7241,7 +7254,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
const auto now = base::TimeTicks::Now();
const auto then = keepalive_deadline_;
if (now < then) {

View File

@@ -173,7 +173,7 @@ index 28085aa32d7d8..312911b8a4564 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 bc22da820add3..04798b83011e2 100644
index 8d1be7ef7470a..0a38b76e20597 100644
--- chrome/browser/ui/views/frame/browser_view.cc
+++ chrome/browser/ui/views/frame/browser_view.cc
@@ -307,11 +307,10 @@ using content::NativeWebKeyboardEvent;
@@ -241,7 +241,7 @@ index bc22da820add3..04798b83011e2 100644
contents_separator_ =
top_container_->AddChildView(std::make_unique<ContentsSeparator>());
@@ -1839,6 +1855,8 @@ bool BrowserView::ShouldHideUIForFullscreen() const {
@@ -1841,6 +1857,8 @@ bool BrowserView::ShouldHideUIForFullscreen() const {
if (immersive_mode_controller_->IsEnabled())
return false;
@@ -250,7 +250,7 @@ index bc22da820add3..04798b83011e2 100644
return frame_->GetFrameView()->ShouldHideTopUIForFullscreen();
}
@@ -2734,7 +2752,8 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
@@ -2736,7 +2754,8 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
}
DownloadBubbleUIController* BrowserView::GetDownloadBubbleUIController() {
@@ -260,7 +260,7 @@ index bc22da820add3..04798b83011e2 100644
if (auto* download_button = toolbar_button_provider_->GetDownloadButton())
return download_button->bubble_controller();
return nullptr;
@@ -3226,7 +3245,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
@@ -3228,7 +3247,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
if (top_container()->parent() == this)
return;
@@ -270,7 +270,7 @@ index bc22da820add3..04798b83011e2 100644
top_container()->DestroyLayer();
AddChildViewAt(top_container(), 0);
EnsureFocusOrder();
@@ -3765,8 +3785,10 @@ void BrowserView::Layout() {
@@ -3767,8 +3787,10 @@ void BrowserView::Layout() {
// TODO(jamescook): Why was this in the middle of layout code?
toolbar_->location_bar()->omnibox_view()->SetFocusBehavior(
@@ -283,7 +283,7 @@ index bc22da820add3..04798b83011e2 100644
// Some of the situations when the BrowserView is laid out are:
// - Enter/exit immersive fullscreen mode.
@@ -3832,6 +3854,11 @@ void BrowserView::AddedToWidget() {
@@ -3834,6 +3856,11 @@ void BrowserView::AddedToWidget() {
SetThemeProfileForWindow(GetNativeWindow(), browser_->profile());
#endif
@@ -295,7 +295,7 @@ index bc22da820add3..04798b83011e2 100644
toolbar_->Init();
// TODO(pbos): Manage this either inside SidePanel or the corresponding button
@@ -3887,13 +3914,9 @@ void BrowserView::AddedToWidget() {
@@ -3889,13 +3916,9 @@ void BrowserView::AddedToWidget() {
EnsureFocusOrder();
@@ -311,7 +311,7 @@ index bc22da820add3..04798b83011e2 100644
using_native_frame_ = frame_->ShouldUseNativeFrame();
MaybeInitializeWebUITabStrip();
@@ -4302,7 +4325,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
@@ -4304,7 +4327,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
// Undo our anti-jankiness hacks and force a re-layout.
in_process_fullscreen_ = false;
ToolbarSizeChanged(false);
@@ -321,7 +321,7 @@ index bc22da820add3..04798b83011e2 100644
}
bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
@@ -4650,6 +4674,8 @@ Profile* BrowserView::GetProfile() {
@@ -4652,6 +4676,8 @@ Profile* BrowserView::GetProfile() {
}
void BrowserView::UpdateUIForTabFullscreen() {
@@ -330,7 +330,7 @@ index bc22da820add3..04798b83011e2 100644
frame()->GetFrameView()->UpdateFullscreenTopUI();
}
@@ -4672,6 +4698,8 @@ void BrowserView::HideDownloadShelf() {
@@ -4674,6 +4700,8 @@ void BrowserView::HideDownloadShelf() {
}
bool BrowserView::CanUserExitFullscreen() const {

View File

@@ -1,8 +1,8 @@
diff --git content/app/content_main.cc content/app/content_main.cc
index 00c293219a70c..e68d0d3abd95e 100644
index f646abaa56f8b..59d4a1f0817e6 100644
--- content/app/content_main.cc
+++ content/app/content_main.cc
@@ -173,11 +173,8 @@ ContentMainParams::~ContentMainParams() = default;
@@ -172,11 +172,8 @@ ContentMainParams::~ContentMainParams() = default;
ContentMainParams::ContentMainParams(ContentMainParams&&) = default;
ContentMainParams& ContentMainParams::operator=(ContentMainParams&&) = default;
@@ -16,7 +16,7 @@ index 00c293219a70c..e68d0d3abd95e 100644
base::FeatureList::FailOnFeatureAccessWithoutFeatureList();
#if BUILDFLAG(IS_CHROMEOS_LACROS)
// Lacros is launched with inherited priority. Revert to normal priority
@@ -186,9 +183,6 @@ RunContentProcess(ContentMainParams params,
@@ -185,9 +182,6 @@ RunContentProcess(ContentMainParams params,
#endif
int exit_code = -1;
base::debug::GlobalActivityTracker* tracker = nullptr;
@@ -26,7 +26,7 @@ index 00c293219a70c..e68d0d3abd95e 100644
// A flag to indicate whether Main() has been called before. On Android, we
// may re-run Main() without restarting the browser process. This flag
@@ -274,12 +268,6 @@ RunContentProcess(ContentMainParams params,
@@ -273,12 +267,6 @@ RunContentProcess(ContentMainParams params,
#endif
#if BUILDFLAG(IS_MAC)
@@ -39,7 +39,7 @@ index 00c293219a70c..e68d0d3abd95e 100644
InitializeMac();
#endif
@@ -321,8 +309,18 @@ RunContentProcess(ContentMainParams params,
@@ -318,8 +306,18 @@ RunContentProcess(ContentMainParams params,
if (IsSubprocess())
CommonSubprocessInit();
@@ -59,7 +59,7 @@ index 00c293219a70c..e68d0d3abd95e 100644
if (tracker) {
if (exit_code == 0) {
tracker->SetProcessPhaseIfEnabled(
@@ -334,14 +332,41 @@ RunContentProcess(ContentMainParams params,
@@ -331,14 +329,41 @@ RunContentProcess(ContentMainParams params,
}
}

View File

@@ -1,8 +1,8 @@
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
index c4db6519acbff..03d173d9bf8fa 100644
index aea2d122faef0..df8c1858b6387 100644
--- content/browser/web_contents/web_contents_impl.cc
+++ content/browser/web_contents/web_contents_impl.cc
@@ -3182,6 +3182,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
@@ -3174,6 +3174,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
params.main_frame_name, GetOpener(), primary_main_frame_policy,
base::UnguessableToken::Create());
@@ -15,7 +15,7 @@ index c4db6519acbff..03d173d9bf8fa 100644
std::unique_ptr<WebContentsViewDelegate> delegate =
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
@@ -3192,6 +3198,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
@@ -3184,6 +3190,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
view_ = CreateWebContentsView(this, std::move(delegate),
&render_view_host_delegate_view_);
}
@@ -23,7 +23,7 @@ index c4db6519acbff..03d173d9bf8fa 100644
CHECK(render_view_host_delegate_view_);
CHECK(view_.get());
@@ -3372,6 +3379,9 @@ void WebContentsImpl::RenderWidgetCreated(
@@ -3364,6 +3371,9 @@ void WebContentsImpl::RenderWidgetCreated(
OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RenderWidgetCreated",
"render_widget_host", render_widget_host);
created_widgets_.insert(render_widget_host);
@@ -33,8 +33,8 @@ index c4db6519acbff..03d173d9bf8fa 100644
}
void WebContentsImpl::RenderWidgetDeleted(
@@ -4106,6 +4116,15 @@ FrameTree* WebContentsImpl::CreateNewWindow(
params.pip_options->lock_aspect_ratio;
@@ -4095,6 +4105,15 @@ FrameTree* WebContentsImpl::CreateNewWindow(
create_params.picture_in_picture_options = *(params.pip_options);
}
+ if (delegate_) {
@@ -49,7 +49,7 @@ index c4db6519acbff..03d173d9bf8fa 100644
// Check whether there is an available prerendered page for this navigation if
// this is not for guest. If it exists, take WebContents pre-created for
// hosting the prerendered page instead of creating new WebContents.
@@ -7996,6 +8015,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
@@ -7995,6 +8014,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
// frames).
SetFocusedFrameTree(&node->frame_tree());
}
@@ -60,10 +60,10 @@ index c4db6519acbff..03d173d9bf8fa 100644
void WebContentsImpl::DidCallFocus() {
diff --git content/public/browser/web_contents.h content/public/browser/web_contents.h
index 7778d03105273..b9b6f060201d9 100644
index 5644b0efa9a3e..da63511c87213 100644
--- content/public/browser/web_contents.h
+++ content/public/browser/web_contents.h
@@ -94,10 +94,12 @@ class BrowserContext;
@@ -95,10 +95,12 @@ class BrowserContext;
class BrowserPluginGuestDelegate;
class RenderFrameHost;
class RenderViewHost;
@@ -76,7 +76,7 @@ index 7778d03105273..b9b6f060201d9 100644
class WebUI;
struct DropData;
struct MHTMLGenerationParams;
@@ -240,6 +242,10 @@ class WebContents : public PageNavigator,
@@ -241,6 +243,10 @@ class WebContents : public PageNavigator,
network::mojom::WebSandboxFlags starting_sandbox_flags =
network::mojom::WebSandboxFlags::kNone;

View File

@@ -62,10 +62,10 @@ index ac623b8bd6c06..3e0bd1dd8ce3b 100644
gfx::Transform device_emulation_transform_;
diff --git third_party/blink/renderer/core/page/chrome_client_impl.cc third_party/blink/renderer/core/page/chrome_client_impl.cc
index c1e0b9eff83cb..333ad8c8e2990 100644
index 77260f7c32736..3958ea3f812c2 100644
--- third_party/blink/renderer/core/page/chrome_client_impl.cc
+++ third_party/blink/renderer/core/page/chrome_client_impl.cc
@@ -916,7 +916,7 @@ bool ChromeClientImpl::HasOpenedPopup() const {
@@ -913,7 +913,7 @@ bool ChromeClientImpl::HasOpenedPopup() const {
PopupMenu* ChromeClientImpl::OpenPopupMenu(LocalFrame& frame,
HTMLSelectElement& select) {
NotifyPopupOpeningObservers();

View File

@@ -1,5 +1,5 @@
diff --git sandbox/policy/win/sandbox_win.cc sandbox/policy/win/sandbox_win.cc
index 38601d04959aa..de394933d26b9 100644
index cf16e2e25fec6..541d3eca56b92 100644
--- sandbox/policy/win/sandbox_win.cc
+++ sandbox/policy/win/sandbox_win.cc
@@ -1017,6 +1017,13 @@ ResultCode SandboxWin::StartSandboxedProcess(

View File

@@ -5,10 +5,12 @@
#include "tests/cefclient/browser/client_browser.h"
#include "tests/cefclient/browser/main_context.h"
#include "include/base/cef_logging.h"
#include "include/cef_command_line.h"
#include "include/cef_crash_util.h"
#include "include/cef_file_util.h"
#include "tests/cefclient/browser/client_prefs.h"
#include "tests/cefclient/browser/default_client_handler.h"
#include "tests/shared/common/client_switches.h"
namespace client {
@@ -60,6 +62,14 @@ class ClientBrowserDelegate : public ClientAppBrowser::Delegate {
}
}
CefRefPtr<CefClient> GetDefaultClient(
CefRefPtr<ClientAppBrowser> app) override {
// Default client handler for unmanaged browser windows. Used with the
// Chrome runtime only.
LOG(INFO) << "Creating a chrome browser with the default client";
return new DefaultClientHandler();
}
private:
DISALLOW_COPY_AND_ASSIGN(ClientBrowserDelegate);
IMPLEMENT_REFCOUNTING(ClientBrowserDelegate);

View File

@@ -767,6 +767,12 @@ bool ClientHandler::OnBeforePopup(
bool* no_javascript_access) {
CEF_REQUIRE_UI_THREAD();
if (target_disposition == WOD_NEW_PICTURE_IN_PICTURE) {
// Use default handling for document picture-in-picture popups.
client = nullptr;
return false;
}
// Return true to cancel the popup window.
return !CreatePopupWindow(browser, false, popupFeatures, windowInfo, client,
settings);

View File

@@ -0,0 +1,60 @@
// Copyright (c) 2023 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "tests/cefclient/browser/default_client_handler.h"
#include "tests/cefclient/browser/test_runner.h"
namespace client {
DefaultClientHandler::DefaultClientHandler() {
resource_manager_ = new CefResourceManager();
test_runner::SetupResourceManager(resource_manager_, nullptr);
}
CefRefPtr<CefResourceRequestHandler>
DefaultClientHandler::GetResourceRequestHandler(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool is_navigation,
bool is_download,
const CefString& request_initiator,
bool& disable_default_handling) {
CEF_REQUIRE_IO_THREAD();
return this;
}
cef_return_value_t DefaultClientHandler::OnBeforeResourceLoad(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefCallback> callback) {
CEF_REQUIRE_IO_THREAD();
return resource_manager_->OnBeforeResourceLoad(browser, frame, request,
callback);
}
CefRefPtr<CefResourceHandler> DefaultClientHandler::GetResourceHandler(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request) {
CEF_REQUIRE_IO_THREAD();
return resource_manager_->GetResourceHandler(browser, frame, request);
}
CefRefPtr<CefResponseFilter> DefaultClientHandler::GetResourceResponseFilter(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefResponse> response) {
CEF_REQUIRE_IO_THREAD();
return test_runner::GetResourceResponseFilter(browser, frame, request,
response);
}
} // namespace client

View File

@@ -0,0 +1,61 @@
// Copyright (c) 2023 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#ifndef CEF_TESTS_CEFCLIENT_BROWSER_DEFAULT_CLIENT_HANDLER_H_
#define CEF_TESTS_CEFCLIENT_BROWSER_DEFAULT_CLIENT_HANDLER_H_
#pragma once
#include "include/cef_client.h"
#include "include/wrapper/cef_resource_manager.h"
namespace client {
// Default client handler for unmanaged browser windows. Used with the Chrome
// runtime only.
class DefaultClientHandler : public CefClient,
public CefRequestHandler,
public CefResourceRequestHandler {
public:
DefaultClientHandler();
// CefClient methods
CefRefPtr<CefRequestHandler> GetRequestHandler() override { return this; }
// CefRequestHandler methods
CefRefPtr<CefResourceRequestHandler> GetResourceRequestHandler(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
bool is_navigation,
bool is_download,
const CefString& request_initiator,
bool& disable_default_handling) override;
// CefResourceRequestHandler methods
cef_return_value_t OnBeforeResourceLoad(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefCallback> callback) override;
CefRefPtr<CefResourceHandler> GetResourceHandler(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request) override;
CefRefPtr<CefResponseFilter> GetResourceResponseFilter(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
CefRefPtr<CefRequest> request,
CefRefPtr<CefResponse> response) override;
private:
// Manages the registration and delivery of resources.
CefRefPtr<CefResourceManager> resource_manager_;
IMPLEMENT_REFCOUNTING(DefaultClientHandler);
DISALLOW_COPY_AND_ASSIGN(DefaultClientHandler);
};
} // namespace client
#endif // CEF_TESTS_CEFCLIENT_BROWSER_DEFAULT_CLIENT_HANDLER_H_

View File

@@ -191,11 +191,12 @@ class PassThruResponseFilter : public CefResponseFilter {
DCHECK_GT(data_out_size, 0U);
DCHECK_EQ(data_out_written, 0U);
// All data will be read.
data_in_read = data_in_size;
// Write out the contents unchanged.
data_out_written = std::min(data_in_read, data_out_size);
data_out_written = std::min(data_in_size, data_out_size);
// All data will be read.
data_in_read = data_out_written;
if (data_out_written > 0) {
memcpy(data_out, data_in, data_out_written);
}

View File

@@ -28,6 +28,12 @@ RootWindowViews::~RootWindowViews() {
REQUIRE_MAIN_THREAD();
}
void RootWindowViews::SetTitlebarHeight(const std::optional<float>& height) {
if (window_) {
window_->SetTitlebarHeight(height);
}
}
void RootWindowViews::Init(RootWindow::Delegate* delegate,
std::unique_ptr<RootWindowConfig> config,
const CefBrowserSettings& settings) {

View File

@@ -26,6 +26,8 @@ class RootWindowViews : public RootWindow,
RootWindowViews();
~RootWindowViews();
void SetTitlebarHeight(const std::optional<float>& height);
// RootWindow methods:
void Init(RootWindow::Delegate* delegate,
std::unique_ptr<RootWindowConfig> config,

View File

@@ -772,10 +772,12 @@ void SetupResourceManager(CefRefPtr<CefResourceManager> resource_manager,
string_pages.insert(kTestGetSourcePage);
string_pages.insert(kTestGetTextPage);
// Add provider for string resources.
resource_manager->AddProvider(
new StringResourceProvider(string_pages, string_resource_map), 0,
std::string());
if (string_resource_map) {
// Add provider for string resources.
resource_manager->AddProvider(
new StringResourceProvider(string_pages, string_resource_map), 0,
std::string());
}
// Add provider for bundled resource files.
#if defined(OS_WIN)

View File

@@ -5,6 +5,7 @@
#include "tests/cefclient/browser/views_overlay_controls.h"
#include <algorithm>
#include <array>
#include <string>
#include "include/views/cef_box_layout.h"
@@ -34,9 +35,37 @@ std::string GetLabel(ViewsOverlayControls::Command command, bool maximized) {
return std::string();
}
std::array<ViewsOverlayControls::Command, 3> GetButtons() {
#if defined(OS_MAC)
return {ViewsOverlayControls::Command::kClose,
ViewsOverlayControls::Command::kMaximize,
ViewsOverlayControls::Command::kMinimize};
#else
return {ViewsOverlayControls::Command::kMinimize,
ViewsOverlayControls::Command::kMaximize,
ViewsOverlayControls::Command::kClose};
#endif
}
cef_docking_mode_t GetPanelDockingMode() {
#if defined(OS_MAC)
return CEF_DOCKING_MODE_TOP_LEFT;
#else
return CEF_DOCKING_MODE_TOP_RIGHT;
#endif
}
cef_docking_mode_t GetMenuDockingMode() {
#if defined(OS_MAC)
return CEF_DOCKING_MODE_TOP_RIGHT;
#else
return CEF_DOCKING_MODE_TOP_LEFT;
#endif
}
} // namespace
ViewsOverlayControls::ViewsOverlayControls() = default;
ViewsOverlayControls::ViewsOverlayControls(bool with_window_buttons)
: with_window_buttons_(with_window_buttons) {}
void ViewsOverlayControls::Initialize(CefRefPtr<CefWindow> window,
CefRefPtr<CefMenuButton> menu_button,
@@ -49,30 +78,31 @@ void ViewsOverlayControls::Initialize(CefRefPtr<CefWindow> window,
window_ = window;
window_maximized_ = window_->IsMaximized();
// Window control buttons. These controls are currently text which means that
// we can't use a transparent background because subpixel text rendering will
// break. See comments on the related DCHECK in Label::PaintText.
panel_ = CefPanel::CreatePanel(nullptr);
views_style::ApplyTo(panel_);
if (with_window_buttons_) {
// Window control buttons. These controls are currently text which means
// that we can't use a transparent background because subpixel text
// rendering will break.
// See comments on the related DCHECK in Label::PaintText.
panel_ = CefPanel::CreatePanel(nullptr);
views_style::ApplyTo(panel_);
// Use a horizontal box layout.
CefBoxLayoutSettings panel_layout_settings;
panel_layout_settings.horizontal = true;
panel_->SetToBoxLayout(panel_layout_settings);
// Use a horizontal box layout.
CefBoxLayoutSettings panel_layout_settings;
panel_layout_settings.horizontal = true;
panel_->SetToBoxLayout(panel_layout_settings);
panel_->AddChildView(CreateButton(ViewsOverlayControls::Command::kMinimize));
panel_->AddChildView(CreateButton(ViewsOverlayControls::Command::kMaximize));
panel_->AddChildView(CreateButton(ViewsOverlayControls::Command::kClose));
panel_controller_ =
window->AddOverlayView(panel_, CEF_DOCKING_MODE_TOP_RIGHT);
panel_controller_->SetVisible(true);
for (auto button : GetButtons()) {
panel_->AddChildView(CreateButton(button));
}
panel_controller_ = window->AddOverlayView(panel_, GetPanelDockingMode());
panel_controller_->SetInsets(CefInsets(kInsets, kInsets, 0, kInsets));
panel_controller_->SetVisible(true);
}
// Menu button.
menu_button->SetBackgroundColor(kBackgroundColor);
menu_controller_ =
window_->AddOverlayView(menu_button, CEF_DOCKING_MODE_TOP_LEFT);
menu_controller_->SetInsets(CefInsets(kInsets, kInsets, 0, 0));
menu_controller_ = window_->AddOverlayView(menu_button, GetMenuDockingMode());
menu_controller_->SetInsets(CefInsets(kInsets, kInsets, 0, kInsets));
menu_controller_->SetVisible(true);
// Location bar. Will be made visible in UpdateControls().
@@ -87,8 +117,10 @@ void ViewsOverlayControls::Initialize(CefRefPtr<CefWindow> window,
void ViewsOverlayControls::Destroy() {
window_ = nullptr;
panel_ = nullptr;
panel_controller_->Destroy();
panel_controller_ = nullptr;
if (panel_controller_) {
panel_controller_->Destroy();
panel_controller_ = nullptr;
}
menu_controller_->Destroy();
menu_controller_ = nullptr;
location_bar_ = nullptr;
@@ -180,7 +212,7 @@ CefRefPtr<CefLabelButton> ViewsOverlayControls::CreateButton(Command command) {
}
void ViewsOverlayControls::MaybeUpdateMaximizeButton() {
if (window_->IsMaximized() == window_maximized_) {
if (!with_window_buttons_ || window_->IsMaximized() == window_maximized_) {
return;
}
window_maximized_ = !window_maximized_;

View File

@@ -25,7 +25,7 @@ class ViewsOverlayControls : public CefButtonDelegate {
kClose,
};
ViewsOverlayControls();
explicit ViewsOverlayControls(bool with_window_buttons);
void Initialize(CefRefPtr<CefWindow> window,
CefRefPtr<CefMenuButton> menu_button,
@@ -53,6 +53,7 @@ class ViewsOverlayControls : public CefButtonDelegate {
// Window control buttons.
CefRefPtr<CefPanel> panel_;
CefRefPtr<CefOverlayController> panel_controller_;
const bool with_window_buttons_;
// Location bar.
CefRefPtr<CefView> location_bar_;

View File

@@ -34,6 +34,11 @@ const char kDefaultExtensionIcon[] = "window_icon";
constexpr int kDefaultWidth = 800;
constexpr int kDefaultHeight = 600;
#if defined(OS_MAC)
constexpr int kTitleBarHeight = 35;
constexpr int kWindowButtonsWidth = 80;
#endif
// Control IDs for Views in the top-level Window.
enum ControlIds {
ID_WINDOW = 1,
@@ -106,6 +111,22 @@ void AddFileMenuItems(CefRefPtr<CefMenuModel> file_menu) {
true);
}
CefBrowserViewDelegate::ChromeToolbarType CalculateChromeToolbarType(
const std::string& toolbar_type,
bool hide_toolbar,
bool with_overlay_controls) {
if (!MainContext::Get()->UseChromeRuntime() || toolbar_type == "none" ||
hide_toolbar) {
return CEF_CTT_NONE;
}
if (toolbar_type == "location") {
return CEF_CTT_LOCATION;
}
return with_overlay_controls ? CEF_CTT_LOCATION : CEF_CTT_NORMAL;
}
} // namespace
// static
@@ -278,17 +299,13 @@ void ViewsWindow::SetDraggableRegions(
return;
}
std::vector<CefDraggableRegion> window_regions;
// Convert the regions from BrowserView to Window coordinates.
std::vector<CefDraggableRegion>::const_iterator it = regions.begin();
for (; it != regions.end(); ++it) {
CefDraggableRegion region = *it;
std::vector<CefDraggableRegion> window_regions = regions;
for (auto& region : window_regions) {
CefPoint origin = CefPoint(region.bounds.x, region.bounds.y);
browser_view_->ConvertPointToWindow(origin);
region.bounds.x = origin.x;
region.bounds.y = origin.y;
window_regions.push_back(region);
}
if (overlay_controls_) {
@@ -382,6 +399,16 @@ bool ViewsWindow::GetWindowRestorePreferences(
return true;
}
void ViewsWindow::SetTitlebarHeight(const std::optional<float>& height) {
CEF_REQUIRE_UI_THREAD();
if (height.has_value()) {
override_titlebar_height_ = height;
} else {
override_titlebar_height_ = default_titlebar_height_;
}
NudgeWindow();
}
CefRefPtr<CefBrowserViewDelegate> ViewsWindow::GetDelegateForPopupBrowserView(
CefRefPtr<CefBrowserView> browser_view,
const CefBrowserSettings& settings,
@@ -653,6 +680,14 @@ void ViewsWindow::OnWindowBoundsChanged(CefRefPtr<CefWindow> window,
// Track the last visible bounds for window restore purposes.
last_visible_bounds_ = new_bounds;
}
#if defined(OS_MAC)
if (frameless_ && with_standard_buttons_ && top_toolbar_) {
auto insets = top_toolbar_->GetInsets();
insets.left = window->IsFullscreen() ? 0 : kWindowButtonsWidth;
top_toolbar_->SetInsets(insets);
}
#endif
}
bool ViewsWindow::CanClose(CefRefPtr<CefWindow> window) {
@@ -701,6 +736,24 @@ bool ViewsWindow::IsFrameless(CefRefPtr<CefWindow> window) {
return frameless_;
}
bool ViewsWindow::WithStandardWindowButtons(CefRefPtr<CefWindow> window) {
CEF_REQUIRE_UI_THREAD();
return with_standard_buttons_;
}
bool ViewsWindow::GetTitlebarHeight(CefRefPtr<CefWindow> window,
float* titlebar_height) {
CEF_REQUIRE_UI_THREAD();
#if defined(OS_MAC)
if (override_titlebar_height_.has_value()) {
*titlebar_height = override_titlebar_height_.value();
return true;
}
#endif
return false;
}
bool ViewsWindow::CanResize(CefRefPtr<CefWindow> window) {
CEF_REQUIRE_UI_THREAD();
// Don't allow windows hosting extensions to resize.
@@ -815,7 +868,9 @@ void ViewsWindow::OnWindowChanged(CefRefPtr<CefView> view, bool added) {
}
if (with_overlay_controls_) {
overlay_controls_ = new ViewsOverlayControls();
// Add window buttons if we don't have standard ones
const bool with_window_buttons = !with_standard_buttons_;
overlay_controls_ = new ViewsOverlayControls(with_window_buttons);
overlay_controls_->Initialize(window_, CreateMenuButton(),
CreateLocationBar(),
chrome_toolbar_type_ != CEF_CTT_NONE);
@@ -865,6 +920,10 @@ ViewsWindow::ViewsWindow(Delegate* delegate,
const bool hide_frame = command_line->HasSwitch(switches::kHideFrame);
const bool hide_overlays = command_line->HasSwitch(switches::kHideOverlays);
const bool hide_toolbar =
hide_frame && hide_overlays && !delegate_->WithControls();
const bool show_window_buttons =
command_line->HasSwitch(switches::kShowWindowButtons);
// Without a window frame.
frameless_ = hide_frame || delegate_->WithExtension();
@@ -873,20 +932,20 @@ ViewsWindow::ViewsWindow(Delegate* delegate,
with_overlay_controls_ =
hide_frame && !hide_overlays && !delegate_->WithControls();
if (MainContext::Get()->UseChromeRuntime()) {
const std::string& toolbar_type =
command_line->GetSwitchValue(switches::kShowChromeToolbar);
if (toolbar_type == "none") {
chrome_toolbar_type_ = CEF_CTT_NONE;
} else if (toolbar_type == "location") {
chrome_toolbar_type_ = CEF_CTT_LOCATION;
} else {
chrome_toolbar_type_ =
with_overlay_controls_ ? CEF_CTT_LOCATION : CEF_CTT_NORMAL;
}
} else {
chrome_toolbar_type_ = CEF_CTT_NONE;
// If window has frame or flag passed explicitly
with_standard_buttons_ = !frameless_ || show_window_buttons;
#if defined(OS_MAC)
if (frameless_ && with_standard_buttons_) {
default_titlebar_height_ = kTitleBarHeight;
override_titlebar_height_ = kTitleBarHeight;
}
#endif
const std::string& toolbar_type =
command_line->GetSwitchValue(switches::kShowChromeToolbar);
chrome_toolbar_type_ = CalculateChromeToolbarType(toolbar_type, hide_toolbar,
with_overlay_controls_);
#if !defined(OS_MAC)
// On Mac we don't show a top menu on the window. The options are available in
@@ -1025,9 +1084,8 @@ void ViewsWindow::AddControls() {
top_panel->SetToBoxLayout(top_panel_layout_settings);
// Add the buttons and URL textfield to |top_panel|.
for (size_t i = 0U; i < browse_buttons.size(); ++i) {
top_panel->AddChildView(browse_buttons[i]);
}
for (auto& browse_button : browse_buttons)
top_panel->AddChildView(browse_button);
top_panel->AddChildView(location_bar_);
UpdateExtensionControls();
@@ -1043,6 +1101,14 @@ void ViewsWindow::AddControls() {
top_toolbar_ = top_panel;
}
#if defined(OS_MAC)
if (frameless_ && with_standard_buttons_) {
auto insets = top_toolbar_->GetInsets();
insets.left = kWindowButtonsWidth;
top_toolbar_->SetInsets(insets);
}
#endif
// Add the top panel and browser view to |window|.
int top_index = 0;
if (top_menu_panel) {
@@ -1061,8 +1127,10 @@ void ViewsWindow::AddControls() {
// Lay out |window| again with the new button sizes.
window_->Layout();
const int buttons_number = static_cast<int>(browse_buttons.size());
// Minimum window width is the size of all buttons plus some extra.
min_width = browse_buttons[0]->GetBounds().width * 4 +
min_width = browse_buttons[0]->GetBounds().width * buttons_number +
menu_button_->GetBounds().width + 100;
}
@@ -1211,4 +1279,10 @@ void ViewsWindow::OnExtensionWindowClosed() {
extension_button_pressed_lock_ = nullptr;
}
#if !defined(OS_MAC)
void ViewsWindow::NudgeWindow() {
NOTIMPLEMENTED();
}
#endif
} // namespace client

View File

@@ -130,6 +130,7 @@ class ViewsWindow : public CefBrowserViewDelegate,
bool GetWindowRestorePreferences(cef_show_state_t& show_state,
std::optional<CefRect>& dip_bounds);
void SetTitlebarHeight(const std::optional<float>& height);
// CefBrowserViewDelegate methods:
CefRefPtr<CefBrowserViewDelegate> GetDelegateForPopupBrowserView(
@@ -174,6 +175,9 @@ class ViewsWindow : public CefBrowserViewDelegate,
CefRect GetInitialBounds(CefRefPtr<CefWindow> window) override;
cef_show_state_t GetInitialShowState(CefRefPtr<CefWindow> window) override;
bool IsFrameless(CefRefPtr<CefWindow> window) override;
bool WithStandardWindowButtons(CefRefPtr<CefWindow> window) override;
bool GetTitlebarHeight(CefRefPtr<CefWindow> window,
float* titlebar_height) override;
bool CanResize(CefRefPtr<CefWindow> window) override;
bool CanClose(CefRefPtr<CefWindow> window) override;
bool OnAccelerator(CefRefPtr<CefWindow> window, int command_id) override;
@@ -233,11 +237,14 @@ class ViewsWindow : public CefBrowserViewDelegate,
const ImageCache::ImageSet& images);
void OnExtensionWindowClosed();
void NudgeWindow();
Delegate* delegate_; // Not owned by this object.
CefRefPtr<CefBrowserView> browser_view_;
bool frameless_;
bool with_controls_;
bool with_overlay_controls_;
bool with_standard_buttons_;
ChromeToolbarType chrome_toolbar_type_;
CefRefPtr<CefWindow> window_;
@@ -254,6 +261,9 @@ class ViewsWindow : public CefBrowserViewDelegate,
CefRefPtr<ViewsOverlayControls> overlay_controls_;
std::optional<float> default_titlebar_height_;
std::optional<float> override_titlebar_height_;
// Structure representing an extension.
struct ExtensionInfo {
ExtensionInfo(CefRefPtr<CefExtension> extension, CefRefPtr<CefImage> image)

View File

@@ -0,0 +1,24 @@
// Copyright (c) 2023 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "tests/cefclient/browser/views_window.h"
#include <Cocoa/Cocoa.h>
namespace client {
void ViewsWindow::NudgeWindow() {
if (window_) {
auto view = CAST_CEF_WINDOW_HANDLE_TO_NSVIEW(window_->GetWindowHandle());
NSWindow* main_window = view.window;
auto theme_frame = main_window.contentView.superview;
// Nudge view frame a little to force an update.
NSSize size = theme_frame.frame.size;
[theme_frame setFrameSize:NSMakeSize(size.width - 1, size.height)];
[theme_frame setFrameSize:size];
}
}
}

View File

@@ -15,9 +15,7 @@
#include "tests/cefclient/browser/test_runner.h"
#include "tests/cefclient/browser/window_test_runner.h"
#if defined(OS_WIN) || defined(OS_LINUX)
#include "tests/cefclient/browser/window_test_runner_views.h"
#endif
#if defined(OS_WIN)
#include "tests/cefclient/browser/window_test_runner_win.h"
@@ -37,14 +35,13 @@ const char kMessagePositionName[] = "WindowTest.Position";
const char kMessageMinimizeName[] = "WindowTest.Minimize";
const char kMessageMaximizeName[] = "WindowTest.Maximize";
const char kMessageRestoreName[] = "WindowTest.Restore";
const char kMessageTitlebarHeightName[] = "WindowTest.TitlebarHeight";
// Create the appropriate platform test runner object.
std::unique_ptr<WindowTestRunner> CreateWindowTestRunner() {
#if defined(OS_WIN) || defined(OS_LINUX)
if (MainContext::Get()->UseViews()) {
return std::make_unique<WindowTestRunnerViews>();
}
#endif
#if defined(OS_WIN)
return std::make_unique<WindowTestRunnerWin>();
@@ -57,6 +54,31 @@ std::unique_ptr<WindowTestRunner> CreateWindowTestRunner() {
#endif
}
// Parse the comma-delimited list of integer values.
std::vector<int> ParsePosition(const std::string& message_name) {
std::vector<int> vec;
const std::string& vals = message_name.substr(sizeof(kMessagePositionName));
std::stringstream ss(vals);
int i;
while (ss >> i) {
vec.push_back(i);
if (ss.peek() == ',') {
ss.ignore();
}
}
return vec;
}
std::optional<float> ParseHeight(const std::string& message) {
if (message.size() > sizeof(kMessageTitlebarHeightName)) {
const std::string& val = message.substr(sizeof(kMessageTitlebarHeightName));
return std::stof(val);
} else {
return std::nullopt;
}
}
// Handle messages in the browser process.
class Handler : public CefMessageRouterBrowserSide::Handler {
public:
@@ -77,32 +99,19 @@ class Handler : public CefMessageRouterBrowserSide::Handler {
const std::string& message_name = request;
if (message_name.find(kMessagePositionName) == 0) {
// Parse the comma-delimited list of integer values.
std::vector<int> vec;
const std::string& vals =
message_name.substr(sizeof(kMessagePositionName));
std::stringstream ss(vals);
int i;
while (ss >> i) {
vec.push_back(i);
if (ss.peek() == ',') {
ss.ignore();
}
}
const auto vec = ParsePosition(message_name);
if (vec.size() == 4) {
// Execute SetPos() on the main thread.
runner_->SetPos(browser, vec[0], vec[1], vec[2], vec[3]);
}
} else if (message_name == kMessageMinimizeName) {
// Execute Minimize() on the main thread.
runner_->Minimize(browser);
} else if (message_name == kMessageMaximizeName) {
// Execute Maximize() on the main thread.
runner_->Maximize(browser);
} else if (message_name == kMessageRestoreName) {
// Execute Restore() on the main thread.
runner_->Restore(browser);
} else if (message_name.find(kMessageTitlebarHeightName) == 0) {
const auto height = ParseHeight(message_name);
runner_->SetTitleBarHeight(browser, height);
} else {
NOTREACHED();
}

View File

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

View File

@@ -8,6 +8,8 @@
#include "include/cef_browser.h"
#include <optional>
namespace client {
namespace window_test {
@@ -15,6 +17,8 @@ namespace window_test {
// the browser process UI thread unless otherwise indicated.
class WindowTestRunner {
public:
virtual ~WindowTestRunner() = default;
virtual void SetPos(CefRefPtr<CefBrowser> browser,
int x,
int y,
@@ -28,7 +32,8 @@ class WindowTestRunner {
// corner of the display.
static void ModifyBounds(const CefRect& display, CefRect& window);
virtual ~WindowTestRunner() {}
virtual void SetTitleBarHeight(CefRefPtr<CefBrowser> browser,
const std::optional<float>& height);
};
} // namespace window_test

View File

@@ -9,12 +9,15 @@
#include "include/views/cef_window.h"
#include "include/wrapper/cef_helpers.h"
#include "tests/cefclient/browser/root_window_views.h"
#include "tests/cefclient/browser/views_window.h"
namespace client {
namespace window_test {
namespace {
CefRefPtr<CefWindow> GetWindow(CefRefPtr<CefBrowser> browser) {
CefRefPtr<CefWindow> GetWindow(const CefRefPtr<CefBrowser>& browser) {
CEF_REQUIRE_UI_THREAD();
DCHECK(browser->GetHost()->HasView());
@@ -27,6 +30,16 @@ CefRefPtr<CefWindow> GetWindow(CefRefPtr<CefBrowser> browser) {
return window;
}
void SetTitlebarHeight(const CefRefPtr<CefBrowser>& browser,
const std::optional<float>& height) {
CEF_REQUIRE_UI_THREAD();
auto root_window = RootWindow::GetForBrowser(browser->GetIdentifier());
DCHECK(root_window.get());
auto root_window_views = static_cast<RootWindowViews*>(root_window.get());
root_window_views->SetTitlebarHeight(height);
}
} // namespace
WindowTestRunnerViews::WindowTestRunnerViews() {}
@@ -56,5 +69,11 @@ void WindowTestRunnerViews::Restore(CefRefPtr<CefBrowser> browser) {
GetWindow(browser)->Restore();
}
void WindowTestRunnerViews::SetTitleBarHeight(
CefRefPtr<CefBrowser> browser,
const std::optional<float>& height) {
SetTitlebarHeight(browser, height);
}
} // namespace window_test
} // namespace client

View File

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

View File

@@ -568,7 +568,7 @@ function onUnload() {
Status information and messages will be displayed in the center of the screen.
After creating a route you can send messages to the receiver app using the textarea at the bottom of the screen.
Messages are usually in JSON format with a example of Cast communication to be found
<a href="https://bitbucket.org/chromiumembedded/cef/issues/2900/add-mediarouter-support-for-cast-receiver#comment-56680326" target="_blank">here</a>.
<a href="https://github.com/chromiumembedded/cef/issues/2900#issuecomment-1465022620" target="_blank">here</a>.
</p>
</div>
<div class="route_controls">

View File

@@ -1,4 +1,5 @@
<html>
<!DOCTYPE html>
<html lang="en-US">
<head>
<title>Window Test</title>
<script>
@@ -47,6 +48,14 @@ function position() {
else
send_message('Position', x + ',' + y + ',' + width + ',' + height);
}
function setTitlebarHeight() {
const height = parseFloat(document.getElementById('title_bar_height').value);
if (isNaN(height))
send_message('TitlebarHeight');
else
send_message('TitlebarHeight', height);
}
</script>
</head>
<body bgcolor="white" onload="setup()">
@@ -60,6 +69,8 @@ X: <input type="text" size="4" id="x" value="200">
Y: <input type="text" size="4" id="y" value="100">
Width: <input type="text" size="4" id="width" value="800">
Height: <input type="text" size="4" id="height" value="600">
<br/><input type="button" onclick="setTitlebarHeight();" value="Set Titlebar Height">
<input type="number" min="0" max="100" id="title_bar_height" value="50"> (works on macOS with Views)
</form>
</body>
</html>

View File

@@ -53,7 +53,7 @@ void ClientAppBrowser::OnBeforeCommandLineProcessing(
// Use software rendering and compositing (disable GPU) for increased FPS
// and decreased CPU usage. This will also disable WebGL so remove these
// switches if you need that capability.
// See https://bitbucket.org/chromiumembedded/cef/issues/1257 for details.
// See https://github.com/chromiumembedded/cef/issues/1257 for details.
if (!command_line->HasSwitch(switches::kEnableGPU)) {
command_line->AppendSwitch("disable-gpu");
command_line->AppendSwitch("disable-gpu-compositing");
@@ -92,24 +92,21 @@ void ClientAppBrowser::OnBeforeCommandLineProcessing(
void ClientAppBrowser::OnRegisterCustomPreferences(
cef_preferences_type_t type,
CefRawPtr<CefPreferenceRegistrar> registrar) {
DelegateSet::iterator it = delegates_.begin();
for (; it != delegates_.end(); ++it) {
(*it)->OnRegisterCustomPreferences(this, type, registrar);
for (auto& delegate : delegates_) {
delegate->OnRegisterCustomPreferences(this, type, registrar);
}
}
void ClientAppBrowser::OnContextInitialized() {
DelegateSet::iterator it = delegates_.begin();
for (; it != delegates_.end(); ++it) {
(*it)->OnContextInitialized(this);
for (auto& delegate : delegates_) {
delegate->OnContextInitialized(this);
}
}
void ClientAppBrowser::OnBeforeChildProcessLaunch(
CefRefPtr<CefCommandLine> command_line) {
DelegateSet::iterator it = delegates_.begin();
for (; it != delegates_.end(); ++it) {
(*it)->OnBeforeChildProcessLaunch(this, command_line);
for (auto& delegate : delegates_) {
delegate->OnBeforeChildProcessLaunch(this, command_line);
}
}
@@ -122,4 +119,13 @@ void ClientAppBrowser::OnScheduleMessagePumpWork(int64 delay) {
}
}
CefRefPtr<CefClient> ClientAppBrowser::GetDefaultClient() {
for (auto& delegate : delegates_) {
if (auto client = delegate->GetDefaultClient(this)) {
return client;
}
}
return nullptr;
}
} // namespace client

View File

@@ -34,6 +34,11 @@ class ClientAppBrowser : public ClientApp, public CefBrowserProcessHandler {
virtual void OnBeforeChildProcessLaunch(
CefRefPtr<ClientAppBrowser> app,
CefRefPtr<CefCommandLine> command_line) {}
virtual CefRefPtr<CefClient> GetDefaultClient(
CefRefPtr<ClientAppBrowser> app) {
return nullptr;
}
};
typedef std::set<CefRefPtr<Delegate>> DelegateSet;
@@ -71,6 +76,7 @@ class ClientAppBrowser : public ClientApp, public CefBrowserProcessHandler {
void OnBeforeChildProcessLaunch(
CefRefPtr<CefCommandLine> command_line) override;
void OnScheduleMessagePumpWork(int64 delay) override;
CefRefPtr<CefClient> GetDefaultClient() override;
// Set of supported Delegates.
DelegateSet delegates_;

View File

@@ -52,6 +52,7 @@ const char kHideChromeStatusBubble[] = "hide-chrome-status-bubble";
const char kUseDefaultPopup[] = "use-default-popup";
const char kUseClientDialogs[] = "use-client-dialogs";
const char kUseTestHttpServer[] = "use-test-http-server";
const char kShowWindowButtons[] = "show-window-buttons";
} // namespace switches
} // namespace client

View File

@@ -46,6 +46,7 @@ extern const char kHideChromeStatusBubble[];
extern const char kUseDefaultPopup[];
extern const char kUseClientDialogs[];
extern const char kUseTestHttpServer[];
extern const char kShowWindowButtons[];
} // namespace switches
} // namespace client

View File

@@ -0,0 +1,14 @@
CONTENTS
--------
Debug Contains the Debug build of cef_sandbox.a.
Release Contains the Release build of cef_sandbox.a.
USAGE
-----
Please visit the CEF Website for usage information.
https://bitbucket.org/chromiumembedded/cef/

View File

@@ -110,7 +110,7 @@ if platform == 'windows':
# installed (e.g. not discoverable via the Windows registry) then
# "%GYP_MSVS_OVERRIDE_PATH%\Common7\Tools\vsdevcmd\core\winsdk.bat" must be
# patched to support discovery via SDK_ROOT as described in
# https://bitbucket.org/chromiumembedded/cef/issues/2773#comment-59687474.
# https://github.com/chromiumembedded/cef/issues/2773#issuecomment-1465019898.
#
if bool(int(os.environ.get('WIN_CUSTOM_TOOLCHAIN', '0'))):
required_vars = [

View File

@@ -225,7 +225,7 @@ def GetRecommendedDefaultArgs():
# Disable V8 sandboxed pointers to avoid crashing when using
# CefV8Value::CreateArrayBuffer with memory allocated outside of the V8
# sandbox. See https://bitbucket.org/chromiumembedded/cef/issues/3332.
# sandbox. See https://github.com/chromiumembedded/cef/issues/3332.
'v8_enable_sandbox': False,
}
@@ -237,7 +237,7 @@ def GetRecommendedDefaultArgs():
if platform != 'windows':
# Only allow non-component Debug builds on non-Windows platforms. These
# builds will fail on Windows due to linker issues (running out of memory,
# etc). See https://bitbucket.org/chromiumembedded/cef/issues/2679.
# etc). See https://github.com/chromiumembedded/cef/issues/2679.
result['forbid_non_component_debug_builds'] = False
if platform == 'linux':

View File

@@ -4,7 +4,7 @@
#
# Resort order of object files in libcef.ninja file.
#
# See: https://bitbucket.org/chromiumembedded/cef/issues/1999
# See: https://github.com/chromiumembedded/cef/issues/1999
#
# Usage:
# import issue_1999