Compare commits

...

22 Commits
7049 ... 6261

Author SHA1 Message Date
Marshall Greenblatt
de5b72441b Update to Chromium version 122.0.6261.130 2024-03-14 14:36:31 +00:00
Marshall Greenblatt
6e69d20878 Improve crash reporting of frame connection retry failures (see #3664)
Introduce different call stacks for different types of disconnects,
and log additional state information in the FATAL message.
2024-03-08 14:51:30 -05:00
qqqqqqqqq
46f5c48410 Replace non-standard memory.h with cstring (fixes #3665)
cef_string_wrappers.h uses a non-standard header memory.h, which breaks
the build on UCRT environments. Replace <memory.h> include with <cstring>,
which is guaranteed to contain strlen.
2024-03-08 14:51:29 -05:00
Marshall Greenblatt
c902316ee9 Update to Chromium version 122.0.6261.112 2024-03-06 16:13:50 +00:00
Marshall Greenblatt
d14e0517a1 Update to Chromium version 122.0.6261.94 2024-02-28 16:28:20 +00:00
Marshall Greenblatt
40272b5bc5 Update to Chromium version 122.0.6261.69 2024-02-22 17:24:43 -05:00
Marshall Greenblatt
dd187af001 mac: Add fallback for unsupported --lang values (fixes #3653) 2024-02-20 13:34:39 -05:00
Nik Pavlov
8b7af53124 chrome: Add SetAccessibilityState support (fixes #3649) 2024-02-20 13:34:33 -05:00
Marshall Greenblatt
f09a9bc0b1 win: distrib: Add DirectX compiler binaries for WebGPU (fixes #3646) 2024-02-15 17:02:59 -05:00
Marshall Greenblatt
2fa5949d07 alloy: Allow --remote-debugging-port=0 (fixes #3619) 2024-02-15 16:16:19 -05:00
Marshall Greenblatt
b919ac4739 alloy: Fix crash on JS dialog from PDF viewer (fixes #3644) 2024-02-15 15:36:25 -05:00
Marshall Greenblatt
a485dc81e0 chrome: win: Disable taskbar decoration for PiP and DevTools windows (fixes #3645) 2024-02-15 14:19:31 -05:00
Marshall Greenblatt
1082b30c0e chrome: win: Fix crash on ShowProfileErrorDialog (fixes #3648) 2024-02-15 12:26:08 -05:00
Marshall Greenblatt
1a6f3c337f chrome: Enforce matching context for new user and incognito profiles
Selecting a new user or incognito profile via Chrome UI may result in
the creation of a new Profile object. If that occurs, we should find
or create a matching CefBrowserContext and CefRequestContext instead
of reusing an existing mismatched context (e.g. using the original
context for an incognito window would be a mismatch). If a new
CefRequestContext will be created the client can now implement
CefBrowserProcessHandler::GetDefaultRequestContextHandler() to
provide the handler for that context.

To test with a new user profile:
1. Click "Profile" icon, select "Add". Now you have 2+ profiles.
2. Click "Profile" icon, select the other user name to create a new
   window using the other user profile.
3. The new window should launch successfully.

To test with a new incognito profile:
1. Select "New Incognito window" from the 3-dot menu.
2. The new window should launch successfully.

To test DevTools window creation for the new profile:
1. Right-click in the new window, select Inspect.
2. The DevTools window should launch successfully.
2024-02-14 19:58:29 -05:00
Marshall Greenblatt
b7e35d2878 chrome: cefclient: Add support for --request-context-per-browser
Wait for the OnRequestContextInitialized callback before using a
non-global CefRequestContext.

Use default handling of --load-extension for Chrome runtime (fixes #3529).
2024-02-14 19:58:29 -05:00
Marshall Greenblatt
36e4ef1673 alloy: Fix crash when accessing FirstPartySets (fixes #3643)
Initialize FirstPartySets without PrivacySandbox or IdentityManager
dependencies.
2024-02-13 16:03:16 -05:00
Marshall Greenblatt
56f1033fd9 Update to Chromium version 122.0.6261.29 2024-02-08 15:01:12 +00:00
Marshall Greenblatt
1bfee76f5f chrome: win: Fix taskbar grouping of PiP and DevTools windows (fixes #3641) 2024-02-06 13:56:27 -05:00
Marshall Greenblatt
7dbf26919a views: win: Fix occlusion tracking of initially-minimized windows (fixes #3638)
Chromium considers initially-minimized windows to be visible at
creation time in the Aura layer. This confuses the native occlusion
detector which knows that the OS window is initially hidden due to
IsIconic returning true. Start occlusion tracking with consistent
state by delaying enablement until the initially-minimized window is
restored for the first time.
2024-02-05 16:49:59 -05:00
Shezan Baig
114665f178 Always assign |is_guest_view| in CefBrowserInfo::GetFrameForGlobalToken 2024-02-05 11:33:01 -05:00
Marshall Greenblatt
3d83c932f1 Update to Chromium version 122.0.6261.18 2024-02-01 14:28:51 +00:00
Marshall Greenblatt
f3f83ff8cf Update to Chromium version 122.0.6261.6 2024-01-30 19:11:36 -05:00
61 changed files with 892 additions and 372 deletions

View File

@@ -7,5 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/122.0.6261.0'
'chromium_checkout': 'refs/tags/122.0.6261.130',
'depot_tools_checkout': '10bd39fd47'
}

View File

@@ -554,6 +554,13 @@ if(OS_WINDOWS)
vulkan-1.dll
)
if(PROJECT_ARCH STREQUAL "x86_64")
list(APPEND CEF_BINARY_FILES
dxil.dll
dxcompiler.dll
)
endif()
# List of CEF resource files.
set(CEF_RESOURCE_FILES
chrome_100_percent.pak

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=f844d2a1e39d822129d0733f33c14d27481c36b7$
// $hash=d958d5bed7f909f6313facef3440fb8ba07a5c01$
//
#ifndef CEF_INCLUDE_CAPI_CEF_BROWSER_PROCESS_HANDLER_CAPI_H_
@@ -44,6 +44,7 @@
#include "include/capi/cef_client_capi.h"
#include "include/capi/cef_command_line_capi.h"
#include "include/capi/cef_preference_capi.h"
#include "include/capi/cef_request_context_handler_capi.h"
#include "include/capi/cef_values_capi.h"
#ifdef __cplusplus
@@ -147,14 +148,26 @@ typedef struct _cef_browser_process_handler_t {
int64_t delay_ms);
///
/// Return the default client for use with a newly created browser window. If
/// null is returned the browser will be unmanaged (no callbacks will be
/// executed for that browser) and application shutdown will be blocked until
/// the browser window is closed manually. This function is currently only
/// used with the chrome runtime.
/// Return the default client for use with a newly created browser window
/// (cef_browser_t object). If null is returned the cef_browser_t will be
/// unmanaged (no callbacks will be executed for that cef_browser_t) and
/// application shutdown will be blocked until the browser window is closed
/// manually. This function is currently only used with the Chrome runtime
/// when creating new browser windows via Chrome UI.
///
struct _cef_client_t*(CEF_CALLBACK* get_default_client)(
struct _cef_browser_process_handler_t* self);
///
/// Return the default handler for use with a new user or incognito profile
/// (cef_request_context_t object). If null is returned the
/// cef_request_context_t will be unmanaged (no callbacks will be executed for
/// that cef_request_context_t). This function is currently only used with the
/// Chrome runtime when creating new browser windows via Chrome UI.
///
struct _cef_request_context_handler_t*(
CEF_CALLBACK* get_default_request_context_handler)(
struct _cef_browser_process_handler_t* self);
} cef_browser_process_handler_t;
#ifdef __cplusplus

View File

@@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "60ecc3c751154b2b2b41e5d3ac0ccbeba588918d"
#define CEF_API_HASH_UNIVERSAL "afb63c581ad6ef9b3d3ebed472cc66f75ce4647f"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "7819cee8508a9b048ccfa80acea7351a5b549c45"
#define CEF_API_HASH_PLATFORM "504dbb53deeebd11a16ea01533c5d9ecfa6be555"
#elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "f2bb2e5a9d14dcad463fd3fc8ed4af16b6fe6196"
#define CEF_API_HASH_PLATFORM "dc3cf1d007fec844ab287dac384c8b00366d46fc"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "bcf76490ddea85c12ea8feeee9190ffe24dedcc6"
#define CEF_API_HASH_PLATFORM "2b47d389c64db81913818b708b78868a22e65b66"
#endif
#ifdef __cplusplus

View File

@@ -42,6 +42,7 @@
#include "include/cef_client.h"
#include "include/cef_command_line.h"
#include "include/cef_preference.h"
#include "include/cef_request_context_handler.h"
#include "include/cef_values.h"
///
@@ -139,14 +140,28 @@ class CefBrowserProcessHandler : public virtual CefBaseRefCounted {
virtual void OnScheduleMessagePumpWork(int64_t delay_ms) {}
///
/// Return the default client for use with a newly created browser window. If
/// null is returned the browser will be unmanaged (no callbacks will be
/// executed for that browser) and application shutdown will be blocked until
/// the browser window is closed manually. This method is currently only used
/// with the chrome runtime.
/// Return the default client for use with a newly created browser window
/// (CefBrowser object). If null is returned the CefBrowser will be unmanaged
/// (no callbacks will be executed for that CefBrowser) and application
/// shutdown will be blocked until the browser window is closed manually. This
/// method is currently only used with the Chrome runtime when creating new
/// browser windows via Chrome UI.
///
/*--cef()--*/
virtual CefRefPtr<CefClient> GetDefaultClient() { return nullptr; }
///
/// Return the default handler for use with a new user or incognito profile
/// (CefRequestContext object). If null is returned the CefRequestContext will
/// be unmanaged (no callbacks will be executed for that CefRequestContext).
/// This method is currently only used with the Chrome runtime when creating
/// new browser windows via Chrome UI.
///
/*--cef()--*/
virtual CefRefPtr<CefRequestContextHandler>
GetDefaultRequestContextHandler() {
return nullptr;
}
};
#endif // CEF_INCLUDE_CEF_BROWSER_PROCESS_HANDLER_H_

View File

@@ -31,7 +31,7 @@
#define CEF_INCLUDE_INTERNAL_CEF_STRING_WRAPPERS_H_
#pragma once
#include <memory.h>
#include <cstring>
#include <string>
#include "include/internal/cef_string_types.h"

View File

@@ -433,10 +433,14 @@ typedef struct _cef_settings_t {
///
/// Set to a value between 1024 and 65535 to enable remote debugging on the
/// specified port. Also configurable using the "remote-debugging-port"
/// command-line switch. Remote debugging can be accessed by loading the
/// chrome://inspect page in Google Chrome. Port numbers 9222 and 9229 are
/// discoverable by default. Other port numbers may need to be configured via
/// "Discover network targets" on the Devices tab.
/// command-line switch. Specifying 0 via the command-line switch will result
/// in the selection of an ephemeral port and the port number will be printed
/// as part of the WebSocket endpoint URL to stderr. If a cache directory path
/// is provided the port will also be written to the
/// <cache-dir>/DevToolsActivePort file. Remote debugging can be accessed by
/// loading the chrome://inspect page in Google Chrome. Port numbers 9222 and
/// 9229 are discoverable by default. Other port numbers may need to be
/// configured via "Discover network targets" on the Devices tab.
///
int remote_debugging_port;

View File

@@ -368,20 +368,6 @@ bool AlloyBrowserHostImpl::HasDevTools() {
return devtools_manager_->HasDevTools();
}
void AlloyBrowserHostImpl::SetAccessibilityState(
cef_state_t accessibility_state) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&AlloyBrowserHostImpl::SetAccessibilityState,
this, accessibility_state));
return;
}
if (platform_delegate_) {
platform_delegate_->SetAccessibilityState(accessibility_state);
}
}
void AlloyBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) {

View File

@@ -117,7 +117,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
void SetAudioMuted(bool mute) override;
bool IsAudioMuted() override;
void SetAccessibilityState(cef_state_t accessibility_state) override;
void SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) override;

View File

@@ -26,7 +26,6 @@
#include "components/permissions/permission_request_manager.h"
#include "components/zoom/zoom_controller.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/render_view_host.h"
#include "extensions/browser/process_manager.h"
#include "pdf/pdf_features.h"
@@ -313,31 +312,6 @@ void CefBrowserPlatformDelegateAlloy::ConfigureAutoResize() {
}
}
void CefBrowserPlatformDelegateAlloy::SetAccessibilityState(
cef_state_t accessibility_state) {
// Do nothing if state is set to default. It'll be disabled by default and
// controlled by the commmand-line flags "force-renderer-accessibility" and
// "disable-renderer-accessibility".
if (accessibility_state == STATE_DEFAULT) {
return;
}
content::WebContentsImpl* web_contents_impl =
static_cast<content::WebContentsImpl*>(web_contents_);
if (!web_contents_impl) {
return;
}
ui::AXMode accMode;
// In windowless mode set accessibility to TreeOnly mode. Else native
// accessibility APIs, specific to each platform, are also created.
if (accessibility_state == STATE_ENABLED) {
accMode = IsWindowless() ? ui::kAXModeWebContentsOnly : ui::kAXModeComplete;
}
web_contents_impl->SetAccessibilityMode(accMode);
}
bool CefBrowserPlatformDelegateAlloy::IsPrintPreviewSupported() const {
REQUIRE_ALLOY_RUNTIME();

View File

@@ -54,7 +54,6 @@ class CefBrowserPlatformDelegateAlloy : public CefBrowserPlatformDelegate {
void SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) override;
void SetAccessibilityState(cef_state_t accessibility_state) override;
bool IsPrintPreviewSupported() const override;
void Find(const CefString& searchText,
bool forward,

View File

@@ -273,22 +273,7 @@ CefBrowserContext* CefBrowserContext::FromBrowserContext(
// static
CefBrowserContext* CefBrowserContext::FromProfile(const Profile* profile) {
auto* cef_context = FromBrowserContext(profile);
if (cef_context) {
return cef_context;
}
if (cef::IsChromeRuntimeEnabled()) {
auto* original_profile = profile->GetOriginalProfile();
if (original_profile != profile) {
// With the Chrome runtime if the user launches an incognito window via
// the UI we might be associated with the original Profile instead of the
// (current) incognito profile.
return FromBrowserContext(original_profile);
}
}
return nullptr;
return FromBrowserContext(profile);
}
// static
@@ -430,6 +415,24 @@ CefMediaRouterManager* CefBrowserContext::GetMediaRouterManager() {
return media_router_manager_.get();
}
CefRefPtr<CefRequestContextImpl> CefBrowserContext::GetAnyRequestContext(
bool prefer_no_handler) const {
CEF_REQUIRE_UIT();
if (request_context_set_.empty()) {
return nullptr;
}
if (prefer_no_handler) {
for (const auto& request_context : request_context_set_) {
if (!request_context->GetHandler()) {
return request_context;
}
}
}
return *request_context_set_.begin();
}
CefBrowserContext::CookieableSchemes CefBrowserContext::GetCookieableSchemes()
const {
CEF_REQUIRE_UIT();

View File

@@ -104,7 +104,7 @@ class CefBrowserContext {
const content::GlobalRenderFrameHostId& global_id,
bool require_frame_match);
// Returns the underlying CefBrowserContext if any.
// Returns the underlying CefBrowserContext, if any.
static CefBrowserContext* FromBrowserContext(
const content::BrowserContext* context);
static CefBrowserContext* FromProfile(const Profile* profile);
@@ -179,6 +179,14 @@ class CefBrowserContext {
CefMediaRouterManager* GetMediaRouterManager();
// Returns any CefRequestContext associated with this object, or nullptr if
// none exist. If |prefer_no_handler| is true this method will try to return a
// context without an associated CefRequestContextHandler. Use
// CefRequestContextImpl::GetOrCreateForBrowserContext() instead of calling
// this method directly.
CefRefPtr<CefRequestContextImpl> GetAnyRequestContext(
bool prefer_no_handler) const;
using CookieableSchemes = absl::optional<std::vector<std::string>>;
// Returns the schemes associated with this context specifically, or the

View File

@@ -7,6 +7,7 @@
#include "base/feature_list.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/first_party_sets/first_party_sets_policy_service_factory.h"
#include "chrome/browser/media/router/chrome_media_router_factory.h"
#include "chrome/browser/media/webrtc/media_device_salt_service_factory.h"
#include "chrome/browser/plugins/plugin_prefs_factory.h"
@@ -25,6 +26,7 @@ namespace cef {
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
CookieSettingsFactory::GetInstance();
first_party_sets::FirstPartySetsPolicyServiceFactory::GetInstance();
MediaDeviceSaltServiceFactory::GetInstance();
media_router::ChromeMediaRouterFactory::GetInstance();
PluginPrefsFactory::GetInstance();

View File

@@ -1009,6 +1009,20 @@ void CefBrowserHostBase::GetFrameNames(std::vector<CefString>& names) {
}
}
void CefBrowserHostBase::SetAccessibilityState(
cef_state_t accessibility_state) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT,
base::BindOnce(&CefBrowserHostBase::SetAccessibilityState,
this, accessibility_state));
return;
}
if (platform_delegate_) {
platform_delegate_->SetAccessibilityState(accessibility_state);
}
}
void CefBrowserHostBase::OnStateChanged(CefBrowserContentsState state_changed) {
// Make sure that CefBrowser state is consistent before the associated
// CefClient callback is executed.

View File

@@ -262,6 +262,7 @@ class CefBrowserHostBase : public CefBrowserHost,
size_t GetFrameCount() override;
void GetFrameIdentifiers(std::vector<CefString>& identifiers) override;
void GetFrameNames(std::vector<CefString>& names) override;
void SetAccessibilityState(cef_state_t accessibility_state) override;
// CefBrowserContentsDelegate::Observer methods:
void OnStateChanged(CefBrowserContentsState state_changed) override;

View File

@@ -340,6 +340,10 @@ CefRefPtr<CefFrameHostImpl> CefBrowserInfo::GetFrameForGlobalToken(
const content::GlobalRenderFrameHostToken& global_token,
bool* is_guest_view,
bool prefer_speculative) const {
if (is_guest_view) {
*is_guest_view = false;
}
if (!frame_util::IsValidGlobalToken(global_token)) {
return nullptr;
}

View File

@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/shell_integration.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
@@ -409,7 +410,27 @@ void CefBrowserPlatformDelegate::SetAutoResizeEnabled(bool enabled,
void CefBrowserPlatformDelegate::SetAccessibilityState(
cef_state_t accessibility_state) {
NOTIMPLEMENTED();
// Do nothing if state is set to default. It'll be disabled by default and
// controlled by the command-line flags "force-renderer-accessibility" and
// "disable-renderer-accessibility".
if (accessibility_state == STATE_DEFAULT) {
return;
}
content::WebContentsImpl* web_contents_impl =
static_cast<content::WebContentsImpl*>(web_contents_);
if (!web_contents_impl) {
return;
}
ui::AXMode accMode;
// In windowless mode set accessibility to TreeOnly mode. Else native
// accessibility APIs, specific to each platform, are also created.
if (accessibility_state == STATE_ENABLED) {
accMode = IsWindowless() ? ui::kAXModeWebContentsOnly : ui::kAXModeComplete;
}
web_contents_impl->SetAccessibilityMode(accMode);
}
bool CefBrowserPlatformDelegate::IsPrintPreviewSupported() const {

View File

@@ -141,6 +141,10 @@ class BrowserDelegate : public content::WebContentsDelegate {
// Called at the end of a fullscreen transition.
virtual void WindowFullscreenStateChanged() {}
// Returns true if this browser has a Views-hosted opener. Only
// applicable for Browsers of type picture_in_picture and devtools.
virtual bool HasViewsHostedOpener() const { return false; }
};
} // namespace cef

View File

@@ -38,6 +38,28 @@ ChromeBrowserContext::ChromeBrowserContext(
ChromeBrowserContext::~ChromeBrowserContext() = default;
// static
ChromeBrowserContext* ChromeBrowserContext::GetOrCreateForProfile(
Profile* profile) {
DCHECK(profile);
if (auto existing_context = FromProfile(profile)) {
return static_cast<ChromeBrowserContext*>(existing_context);
}
CefRequestContextSettings settings;
if (!profile->IsOffTheRecord()) {
// Become the primary context associated with |cache_path|.
CefString(&settings.cache_path) = profile->GetPath().value();
}
auto* new_context = new ChromeBrowserContext(settings);
new_context->Initialize();
new_context->ProfileCreated(Profile::CreateStatus::CREATE_STATUS_INITIALIZED,
profile);
return new_context;
}
content::BrowserContext* ChromeBrowserContext::AsBrowserContext() {
CHECK(!destroyed_);
return profile_;
@@ -146,8 +168,10 @@ void ChromeBrowserContext::ProfileCreated(Profile::CreateStatus status,
// exists.
profile_ = profile;
profile_->AddObserver(this);
profile_keep_alive_ = std::make_unique<ScopedProfileKeepAlive>(
profile_, ProfileKeepAliveOrigin::kAppWindow);
if (!profile_->IsOffTheRecord()) {
profile_keep_alive_ = std::make_unique<ScopedProfileKeepAlive>(
profile_, ProfileKeepAliveOrigin::kAppWindow);
}
}
if (status == Profile::CreateStatus::CREATE_STATUS_INITIALIZED) {

View File

@@ -23,6 +23,9 @@ class ChromeBrowserContext : public CefBrowserContext, public ProfileObserver {
ChromeBrowserContext(const ChromeBrowserContext&) = delete;
ChromeBrowserContext& operator=(const ChromeBrowserContext&) = delete;
// Returns a ChromeBrowserContext for the specified |profile|.
static ChromeBrowserContext* GetOrCreateForProfile(Profile* profile);
void InitializeAsync(base::OnceClosure initialized_cb);
// CefBrowserContext overrides.

View File

@@ -10,6 +10,7 @@
#include "libcef/browser/browser_host_base.h"
#include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/browser_platform_delegate.h"
#include "libcef/browser/chrome/chrome_browser_context.h"
#include "libcef/browser/chrome/chrome_browser_host_impl.h"
#include "libcef/browser/chrome/views/chrome_browser_view.h"
#include "libcef/browser/chrome/views/chrome_child_window.h"
@@ -67,9 +68,7 @@ Browser* ChromeBrowserDelegate::CreateDevToolsBrowser(
}
// We expect openers and popups to have the same Profile.
CHECK_EQ(
CefRequestContextImpl::GetProfile(opener_browser_host->request_context()),
profile);
CHECK_EQ(opener->profile(), profile);
//
// 1. Get configuration settings from the user and create the new platform
@@ -426,6 +425,12 @@ void ChromeBrowserDelegate::WindowFullscreenStateChanged() {
#endif
}
bool ChromeBrowserDelegate::HasViewsHostedOpener() const {
DCHECK(browser_->is_type_picture_in_picture() ||
browser_->is_type_devtools());
return opener_host_ && opener_host_->is_views_hosted();
}
void ChromeBrowserDelegate::WebContentsCreated(
content::WebContents* source_contents,
int opener_render_process_id,
@@ -602,12 +607,25 @@ CefRefPtr<ChromeBrowserHostImpl> ChromeBrowserDelegate::CreateBrowserHost(
LOG(WARNING) << "Creating a chrome browser without a client";
}
// Check if chrome and CEF are using the same browser context.
// TODO(chrome-runtime): Verify if/when this might occur.
// Get or create a ChromeBrowserContext for the browser Profile. Creation may
// be necessary when selecting a new or incognito Profile for the first time
// via the Chrome UI.
auto chrome_browser_context =
CefBrowserContext::FromBrowserContext(browser_->create_params().profile);
ChromeBrowserContext::GetOrCreateForProfile(browser_->profile());
// If the provided CefRequestContext matches the ChromeBrowserContext then use
// the provided one, as it will have the preferred CefRequestContextHandler.
// Otherwise, get or create a CefRequestContext that matches.
if (chrome_browser_context != request_context_impl->GetBrowserContext()) {
LOG(WARNING) << "Creating a chrome browser with mismatched context";
CefRefPtr<CefRequestContextHandler> handler;
if (auto app = CefAppManager::Get()->GetApplication()) {
if (auto bph = app->GetBrowserProcessHandler()) {
handler = bph->GetDefaultRequestContextHandler();
}
}
request_context_impl = CefRequestContextImpl::GetOrCreateForBrowserContext(
chrome_browser_context, handler);
}
// Remains alive until the associated WebContents is destroyed.

View File

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

View File

@@ -369,11 +369,6 @@ bool ChromeBrowserHostImpl::IsAudioMuted() {
return false;
}
void ChromeBrowserHostImpl::SetAccessibilityState(
cef_state_t accessibility_state) {
NOTIMPLEMENTED();
}
void ChromeBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) {
@@ -601,6 +596,10 @@ void ChromeBrowserHostImpl::SetBrowser(Browser* browser) {
static_cast<CefBrowserPlatformDelegateChrome*>(platform_delegate_.get())
->set_chrome_browser(browser);
if (browser_) {
// We expect the Browser and CefRequestContext to have the same Profile.
CHECK_EQ(browser_->profile(),
request_context()->GetBrowserContext()->AsProfile());
host_window_handle_ = platform_delegate_->GetHostWindowHandle();
} else {
host_window_handle_ = kNullWindowHandle;

View File

@@ -104,7 +104,6 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
void SetAudioMuted(bool mute) override;
bool IsAudioMuted() override;
void SetAccessibilityState(cef_state_t accessibility_state) override;
void SetAutoResizeEnabled(bool enabled,
const CefSize& min_size,
const CefSize& max_size) override;

View File

@@ -70,28 +70,29 @@ class TCPServerSocketFactory : public content::DevToolsSocketFactory {
std::unique_ptr<content::DevToolsSocketFactory> CreateSocketFactory() {
const base::CommandLine& command_line =
*base::CommandLine::ForCurrentProcess();
// See if the user specified a port on the command line. Specifying 0 would
// result in the selection of an ephemeral port but that doesn't make sense
// for CEF where the URL is otherwise undiscoverable. Also, don't allow
// binding of ports between 0 and 1024 exclusive because they're normally
// restricted to root on Posix-based systems.
uint16_t port = 0;
// See if the user specified a port on the command line. Specifying 0 will
// result in the selection of an ephemeral port and the port number will be
// printed as part of the WebSocket endpoint URL to stderr. If a cache
// directory path is provided the port will also be written to the
// <cache-dir>/DevToolsActivePort file.
//
// It's not allowed to bind ports between 0 and 1024 exclusive because
// they're normally restricted to root on Posix-based systems.
if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) {
int temp_port;
int port = 0;
std::string port_str =
command_line.GetSwitchValueASCII(switches::kRemoteDebuggingPort);
if (base::StringToInt(port_str, &temp_port) && temp_port >= 1024 &&
temp_port < 65535) {
port = static_cast<uint16_t>(temp_port);
if (base::StringToInt(port_str, &port) &&
(0 == port || (port >= 1024 && port < 65535))) {
return std::unique_ptr<content::DevToolsSocketFactory>(
new TCPServerSocketFactory("127.0.0.1", port));
} else {
DLOG(WARNING) << "Invalid http debugger port number " << temp_port;
DLOG(WARNING) << "Invalid http debugger port number '" << port_str << "'";
}
}
if (port == 0) {
return nullptr;
}
return std::unique_ptr<content::DevToolsSocketFactory>(
new TCPServerSocketFactory("127.0.0.1", port));
return nullptr;
}
} // namespace

View File

@@ -8,7 +8,9 @@
#include <utility>
#include "libcef/browser/browser_host_base.h"
#include "libcef/browser/extensions/browser_extensions_util.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/extensions/extensions_util.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
@@ -62,8 +64,23 @@ class CefJSDialogCallbackImpl : public CefJSDialogCallback {
javascript_dialogs::TabModalDialogManager* GetTabModalDialogManager(
content::WebContents* web_contents) {
return javascript_dialogs::TabModalDialogManager::FromWebContents(
web_contents);
if (auto* manager =
javascript_dialogs::TabModalDialogManager::FromWebContents(
web_contents)) {
return manager;
}
// Try the owner WebContents if the dialog originates from a guest view such
// as the PDF viewer or Print Preview.
if (extensions::ExtensionsEnabled()) {
if (auto* owner_contents =
extensions::GetOwnerForGuestContents(web_contents)) {
return javascript_dialogs::TabModalDialogManager::FromWebContents(
owner_contents);
}
}
return nullptr;
}
} // namespace
@@ -152,6 +169,12 @@ void CefJavaScriptDialogManager::RunJavaScriptDialog(
}
auto manager = GetTabModalDialogManager(web_contents);
if (!manager) {
// Dismiss the dialog.
std::move(callback).Run(false, std::u16string());
return;
}
manager->RunJavaScriptDialog(web_contents, render_frame_host, message_type,
message_text, default_prompt_text,
std::move(callback), did_suppress_message);
@@ -219,6 +242,12 @@ void CefJavaScriptDialogManager::RunBeforeUnloadDialog(
}
auto manager = GetTabModalDialogManager(web_contents);
if (!manager) {
// Accept the unload without showing the prompt.
std::move(callback).Run(true, std::u16string());
return;
}
manager->RunBeforeUnloadDialog(web_contents, render_frame_host, is_reload,
std::move(callback));
}
@@ -243,6 +272,10 @@ bool CefJavaScriptDialogManager::HandleJavaScriptDialog(
}
auto manager = GetTabModalDialogManager(web_contents);
if (!manager) {
return true;
}
return manager->HandleJavaScriptDialog(web_contents, accept, prompt_override);
}
@@ -272,6 +305,10 @@ void CefJavaScriptDialogManager::CancelDialogs(
}
auto manager = GetTabModalDialogManager(web_contents);
if (!manager) {
return;
}
manager->CancelDialogs(web_contents, reset_state);
}

View File

@@ -20,7 +20,6 @@
#include "base/values.h"
#include "chrome/browser/accessibility/accessibility_ui.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/first_party_sets/first_party_sets_pref_names.h"
#include "chrome/browser/media/router/discovery/access_code/access_code_cast_feature.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/media/webrtc/permission_bubble_media_access_handler.h"
@@ -346,11 +345,6 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
}
registry->RegisterListPref(prefs::kWebRtcLocalIpsAllowedUrls);
// First party sets preferences.
// Based on FirstPartySetsPolicyServiceFactory::RegisterProfilePrefs.
registry->RegisterDictionaryPref(
first_party_sets::kRelatedWebsiteSetsOverrides);
// Always do this after all other profile prefs.
RegisterProfilePrefs(registry.get());
} else {

View File

@@ -115,7 +115,7 @@ CefRefPtr<CefRequestContext> CefRequestContext::GetGlobalContext() {
CefRequestContextImpl::Config config;
config.is_global = true;
return CefRequestContextImpl::GetOrCreateRequestContext(config);
return CefRequestContextImpl::GetOrCreateRequestContext(std::move(config));
}
// static
@@ -132,7 +132,7 @@ CefRefPtr<CefRequestContext> CefRequestContext::CreateContext(
config.settings = settings;
config.handler = handler;
config.unique_id = g_next_id.GetNext();
return CefRequestContextImpl::GetOrCreateRequestContext(config);
return CefRequestContextImpl::GetOrCreateRequestContext(std::move(config));
}
// static
@@ -153,7 +153,7 @@ CefRefPtr<CefRequestContext> CefRequestContext::CreateContext(
config.other = static_cast<CefRequestContextImpl*>(other.get());
config.handler = handler;
config.unique_id = g_next_id.GetNext();
return CefRequestContextImpl::GetOrCreateRequestContext(config);
return CefRequestContextImpl::GetOrCreateRequestContext(std::move(config));
}
// CefRequestContextImpl
@@ -176,7 +176,8 @@ CefRequestContextImpl::CreateGlobalRequestContext(
Config config;
config.is_global = true;
config.settings = settings;
CefRefPtr<CefRequestContextImpl> impl = new CefRequestContextImpl(config);
CefRefPtr<CefRequestContextImpl> impl =
new CefRequestContextImpl(std::move(config));
impl->Initialize();
return impl;
}
@@ -193,7 +194,21 @@ CefRequestContextImpl::GetOrCreateForRequestContext(
// Use the global context.
Config config;
config.is_global = true;
return CefRequestContextImpl::GetOrCreateRequestContext(config);
return CefRequestContextImpl::GetOrCreateRequestContext(std::move(config));
}
// static
CefRefPtr<CefRequestContextImpl>
CefRequestContextImpl::GetOrCreateForBrowserContext(
CefBrowserContext* browser_context,
CefRefPtr<CefRequestContextHandler> handler) {
DCHECK(browser_context);
Config config;
config.browser_context = browser_context;
config.handler = handler;
config.unique_id = g_next_id.GetNext();
return CefRequestContextImpl::GetOrCreateRequestContext(std::move(config));
}
content::BrowserContext* CefRequestContextImpl::GetBrowserContext(
@@ -241,7 +256,6 @@ void CefRequestContextImpl::ExecuteWhenBrowserContextInitialized(
return;
}
EnsureBrowserContext();
browser_context()->StoreOrTriggerInitCallback(std::move(callback));
}
@@ -638,7 +652,32 @@ void CefRequestContextImpl::OnRenderFrameDeleted(
// static
CefRefPtr<CefRequestContextImpl>
CefRequestContextImpl::GetOrCreateRequestContext(const Config& config) {
CefRequestContextImpl::GetOrCreateRequestContext(Config&& config) {
if (config.browser_context) {
// CefBrowserContext is only accessed on the UI thread.
CEF_REQUIRE_UIT();
DCHECK(!config.is_global);
DCHECK(!config.other);
// Retrieve any request context that currently exists for the browser
// context. If |config.handler| is nullptr, and the returned request context
// does not have a handler, then we can just return that existing context.
// Otherwise, we'll need to create a new request context with
// |config.handler|.
if (auto other = config.browser_context->GetAnyRequestContext(
/*prefer_no_handler=*/!config.handler)) {
if (!config.handler && !other->GetHandler()) {
// Safe to return the existing context.
return other;
}
// Use the existing request context as a starting point. It may be the
// global context. This is functionally equivalent to calling
// `CefRequestContext::CreateContext(other, handler)`.
config.other = other;
}
}
if (config.is_global ||
(config.other && config.other->IsGlobal() && !config.handler)) {
// Return the singleton global context.
@@ -646,8 +685,8 @@ CefRequestContextImpl::GetOrCreateRequestContext(const Config& config) {
CefAppManager::Get()->GetGlobalRequestContext().get());
}
// The new context will be initialized later by EnsureBrowserContext().
CefRefPtr<CefRequestContextImpl> context = new CefRequestContextImpl(config);
CefRefPtr<CefRequestContextImpl> context =
new CefRequestContextImpl(std::move(config));
// Initialize ASAP so that any tasks blocked on initialization will execute.
if (CEF_CURRENTLY_ON_UIT()) {
@@ -661,8 +700,8 @@ CefRequestContextImpl::GetOrCreateRequestContext(const Config& config) {
}
CefRequestContextImpl::CefRequestContextImpl(
const CefRequestContextImpl::Config& config)
: config_(config) {}
CefRequestContextImpl::Config&& config)
: config_(std::move(config)) {}
void CefRequestContextImpl::Initialize() {
CEF_REQUIRE_UIT();
@@ -673,6 +712,9 @@ void CefRequestContextImpl::Initialize() {
// Share storage with |config_.other|.
browser_context_ = config_.other->browser_context();
CHECK(browser_context_);
} else if (config_.browser_context) {
browser_context_ = config_.browser_context;
config_.browser_context = nullptr;
}
if (!browser_context_) {
@@ -710,9 +752,10 @@ void CefRequestContextImpl::Initialize() {
browser_context_->AddCefRequestContext(this);
if (config_.other) {
// Clear the reference to |config_.other| after setting
// |request_context_getter_|. This is the reverse order of checks in
// IsSharedWith().
// Clear the reference to |config_.other| after adding the new assocation
// with |browser_context_| as this may result in |other| being released
// and we don't want the browser context to be destroyed prematurely.
// This is the also the reverse order of checks in IsSharingWith().
config_.other = nullptr;
}
}
@@ -727,14 +770,6 @@ void CefRequestContextImpl::BrowserContextInitialized() {
}
}
void CefRequestContextImpl::EnsureBrowserContext() {
CEF_REQUIRE_UIT();
if (!browser_context()) {
Initialize();
}
DCHECK(browser_context());
}
void CefRequestContextImpl::ClearCertificateExceptionsInternal(
CefRefPtr<CefCompletionCallback> callback,
CefBrowserContext::Getter browser_context_getter) {

View File

@@ -38,6 +38,16 @@ class CefRequestContextImpl : public CefRequestContext {
static CefRefPtr<CefRequestContextImpl> GetOrCreateForRequestContext(
CefRefPtr<CefRequestContext> request_context);
// Returns a CefRequestContextImpl for the specified |browser_context| and
// optional |handler|. If |handler| is nullptr, and a CefRequestContextImpl
// without a handler currently exists for |browser_context|, then that
// existing CefRequestContextImpl will be returned. Otherwise, a new
// CefRequestContextImpl will be created with the specified |handler|. Must be
// called on the UI thread.
static CefRefPtr<CefRequestContextImpl> GetOrCreateForBrowserContext(
CefBrowserContext* browser_context,
CefRefPtr<CefRequestContextHandler> handler);
// Returns the BrowserContext for the specified |request_context|. Will return
// the global BrowserContext if |request_context| is NULL.
static content::BrowserContext* GetBrowserContext(
@@ -145,10 +155,12 @@ class CefRequestContextImpl : public CefRequestContext {
// True if wrapping the global context.
bool is_global = false;
// Wrap an existing (non-global) browser context. When specifying this value
// GetOrCreateRequestContext() must be called on the UI thread.
CefBrowserContext* browser_context = nullptr;
// |settings| or |other| will be set when creating a new CefRequestContext
// via the API. When wrapping an existing CefBrowserContext* both will be
// empty and Initialize(CefBrowserContext*) will be called immediately after
// CefRequestContextImpl construction.
// via the API.
CefRequestContextSettings settings;
CefRefPtr<CefRequestContextImpl> other;
@@ -156,22 +168,19 @@ class CefRequestContextImpl : public CefRequestContext {
CefRefPtr<CefRequestContextHandler> handler;
// Used to uniquely identify CefRequestContext objects before an associated
// CefBrowserContext has been created. Should be set when a new
// CefBrowserContext has been created. Should be set when creating a new
// CefRequestContext via the API.
int unique_id = -1;
};
static CefRefPtr<CefRequestContextImpl> GetOrCreateRequestContext(
const Config& config);
Config&& config);
explicit CefRequestContextImpl(const Config& config);
explicit CefRequestContextImpl(Config&& config);
void Initialize();
void BrowserContextInitialized();
// Make sure the browser context exists. Only called on the UI thread.
void EnsureBrowserContext();
void ClearCertificateExceptionsInternal(
CefRefPtr<CefCompletionCallback> callback,
CefBrowserContext::Getter browser_context_getter);

View File

@@ -417,7 +417,7 @@ void CefFrameImpl::OnDetached() {
browser_->FrameDetached(frame_);
frame_ = nullptr;
OnDisconnect(DisconnectReason::DETACHED);
OnDisconnect(DisconnectReason::DETACHED, std::string());
browser_ = nullptr;
@@ -506,9 +506,8 @@ void CefFrameImpl::ConnectBrowserFrame(ConnectReason reason) {
// connection.
browser_frame->FrameAttached(receiver_.BindNewPipeAndPassRemote(),
reattached);
receiver_.set_disconnect_handler(
base::BindOnce(&CefFrameImpl::OnDisconnect, this,
DisconnectReason::RENDER_FRAME_DISCONNECT));
receiver_.set_disconnect_with_reason_handler(
base::BindOnce(&CefFrameImpl::OnRenderFrameDisconnect, this));
}
const mojo::Remote<cef::mojom::BrowserFrame>& CefFrameImpl::GetBrowserFrame(
@@ -522,9 +521,8 @@ const mojo::Remote<cef::mojom::BrowserFrame>& CefFrameImpl::GetBrowserFrame(
// Triggers creation of a CefBrowserFrame in the browser process.
render_frame->GetBrowserInterfaceBroker()->GetInterface(
browser_frame_.BindNewPipeAndPassReceiver());
browser_frame_.set_disconnect_handler(
base::BindOnce(&CefFrameImpl::OnDisconnect, this,
DisconnectReason::BROWSER_FRAME_DISCONNECT));
browser_frame_.set_disconnect_with_reason_handler(
base::BindOnce(&CefFrameImpl::OnBrowserFrameDisconnect, this));
}
}
return browser_frame_;
@@ -532,10 +530,73 @@ const mojo::Remote<cef::mojom::BrowserFrame>& CefFrameImpl::GetBrowserFrame(
void CefFrameImpl::OnBrowserFrameTimeout() {
LOG(ERROR) << frame_debug_str_ << " connection timeout";
OnDisconnect(DisconnectReason::CONNECT_TIMEOUT);
OnDisconnect(DisconnectReason::CONNECT_TIMEOUT, std::string());
}
void CefFrameImpl::OnDisconnect(DisconnectReason reason) {
void CefFrameImpl::OnBrowserFrameDisconnect(uint32_t custom_reason,
const std::string& description) {
OnDisconnect(DisconnectReason::BROWSER_FRAME_DISCONNECT, description);
}
void CefFrameImpl::OnRenderFrameDisconnect(uint32_t custom_reason,
const std::string& description) {
OnDisconnect(DisconnectReason::RENDER_FRAME_DISCONNECT, description);
}
// static
std::string CefFrameImpl::GetDisconnectDebugString(
ConnectionState connection_state,
bool frame_is_valid,
DisconnectReason reason,
const std::string& description) {
std::string reason_str;
switch (reason) {
case DisconnectReason::DETACHED:
reason_str = "DETACHED";
break;
case DisconnectReason::BROWSER_FRAME_DETACHED:
reason_str = "BROWSER_FRAME_DETACHED";
break;
case DisconnectReason::CONNECT_TIMEOUT:
reason_str = "CONNECT_TIMEOUT";
break;
case DisconnectReason::RENDER_FRAME_DISCONNECT:
reason_str = "RENDER_FRAME_DISCONNECT";
break;
case DisconnectReason::BROWSER_FRAME_DISCONNECT:
reason_str = "BROWSER_FRAME_DISCONNECT";
break;
};
std::string state_str;
switch (connection_state) {
case ConnectionState::DISCONNECTED:
state_str = "DISCONNECTED";
break;
case ConnectionState::CONNECTION_PENDING:
state_str = "CONNECTION_PENDING";
break;
case ConnectionState::CONNECTION_ACKED:
state_str = "CONNECTION_ACKED";
break;
case ConnectionState::RECONNECT_PENDING:
state_str = "RECONNECT_PENDING";
break;
}
if (!frame_is_valid) {
state_str += ", FRAME_INVALID";
}
if (!description.empty()) {
state_str += ", " + description;
}
return "(reason=" + reason_str + ", current_state=" + state_str + ")";
}
void CefFrameImpl::OnDisconnect(DisconnectReason reason,
const std::string& description) {
// Ignore multiple calls in close proximity (which may occur if both
// |browser_frame_| and |receiver_| disconnect). |frame_| will be nullptr
// when called from/after OnDetached().
@@ -544,49 +605,11 @@ void CefFrameImpl::OnDisconnect(DisconnectReason reason) {
return;
}
if (VLOG_IS_ON(1)) {
std::string reason_str;
switch (reason) {
case DisconnectReason::DETACHED:
reason_str = "DETACHED";
break;
case DisconnectReason::BROWSER_FRAME_DETACHED:
reason_str = "BROWSER_FRAME_DETACHED";
break;
case DisconnectReason::CONNECT_TIMEOUT:
reason_str = "CONNECT_TIMEOUT";
break;
case DisconnectReason::RENDER_FRAME_DISCONNECT:
reason_str = "RENDER_FRAME_DISCONNECT";
break;
case DisconnectReason::BROWSER_FRAME_DISCONNECT:
reason_str = "BROWSER_FRAME_DISCONNECT";
break;
};
std::string state_str;
switch (browser_connection_state_) {
case ConnectionState::DISCONNECTED:
state_str = "DISCONNECTED";
break;
case ConnectionState::CONNECTION_PENDING:
state_str = "CONNECTION_PENDING";
break;
case ConnectionState::CONNECTION_ACKED:
state_str = "CONNECTION_ACKED";
break;
case ConnectionState::RECONNECT_PENDING:
state_str = "RECONNECT_PENDING";
break;
}
if (!frame_) {
state_str += ", FRAME_INVALID";
}
VLOG(1) << frame_debug_str_ << " disconnected (reason=" << reason_str
<< ", current_state=" << state_str << ")";
}
const auto connection_state = browser_connection_state_;
const bool frame_is_valid = !!frame_;
VLOG(1) << frame_debug_str_ << " disconnected "
<< GetDisconnectDebugString(connection_state, frame_is_valid,
reason, description);
browser_frame_.reset();
receiver_.reset();
@@ -612,7 +635,9 @@ void CefFrameImpl::OnDisconnect(DisconnectReason reason) {
ConnectReason::RETRY));
} else {
// Trigger a crash in official builds.
LOG(FATAL) << frame_debug_str_ << " connection retry failed";
LOG(FATAL) << frame_debug_str_ << " connection retry failed "
<< GetDisconnectDebugString(connection_state, frame_is_valid,
reason, description);
}
}
}
@@ -685,7 +710,7 @@ void CefFrameImpl::FrameAttachedAck() {
void CefFrameImpl::FrameDetached() {
// Sent from the browser process in response to CefFrameHostImpl::Detach().
CHECK_EQ(ConnectionState::CONNECTION_ACKED, browser_connection_state_);
OnDisconnect(DisconnectReason::BROWSER_FRAME_DETACHED);
OnDisconnect(DisconnectReason::BROWSER_FRAME_DETACHED, std::string());
}
void CefFrameImpl::SendMessage(const std::string& name,

View File

@@ -116,6 +116,13 @@ class CefFrameImpl
// Called if the BrowserFrame connection attempt times out.
void OnBrowserFrameTimeout();
// Called if the BrowserFrame connection is disconnected.
void OnBrowserFrameDisconnect(uint32_t custom_reason,
const std::string& description);
// Called if the RenderFrame connection is disconnected.
void OnRenderFrameDisconnect(uint32_t custom_reason,
const std::string& description);
enum class DisconnectReason {
DETACHED,
BROWSER_FRAME_DETACHED,
@@ -127,7 +134,7 @@ class CefFrameImpl
// Called if/when a disconnect occurs. This may occur due to frame navigation,
// destruction, or insertion into the bfcache (when the browser-side frame
// representation is destroyed and closes the connection).
void OnDisconnect(DisconnectReason reason);
void OnDisconnect(DisconnectReason reason, const std::string& description);
// Send an action to the remote BrowserFrame. This will queue the action if
// the remote frame is not yet attached.
@@ -181,6 +188,11 @@ class CefFrameImpl
RECONNECT_PENDING,
} browser_connection_state_ = ConnectionState::DISCONNECTED;
static std::string GetDisconnectDebugString(ConnectionState connection_state,
bool frame_is_valid,
DisconnectReason reason,
const std::string& description);
base::OneShotTimer browser_connect_timer_;
std::queue<std::pair<std::string, BrowserFrameAction>>

View File

@@ -9,11 +9,12 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=11604cc40431cd047990f92e86495c9ccd7ded29$
// $hash=5703528ee112474079bd5d04f5ca9f2f290238fa$
//
#include "libcef_dll/cpptoc/browser_process_handler_cpptoc.h"
#include "libcef_dll/cpptoc/client_cpptoc.h"
#include "libcef_dll/cpptoc/request_context_handler_cpptoc.h"
#include "libcef_dll/ctocpp/command_line_ctocpp.h"
#include "libcef_dll/ctocpp/preference_registrar_ctocpp.h"
@@ -138,6 +139,25 @@ struct _cef_client_t* CEF_CALLBACK browser_process_handler_get_default_client(
return CefClientCppToC::Wrap(_retval);
}
struct _cef_request_context_handler_t* CEF_CALLBACK
browser_process_handler_get_default_request_context_handler(
struct _cef_browser_process_handler_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self) {
return NULL;
}
// Execute
CefRefPtr<CefRequestContextHandler> _retval =
CefBrowserProcessHandlerCppToC::Get(self)
->GetDefaultRequestContextHandler();
// Return type: refptr_same
return CefRequestContextHandlerCppToC::Wrap(_retval);
}
} // namespace
// CONSTRUCTOR - Do not edit by hand.
@@ -154,6 +174,8 @@ CefBrowserProcessHandlerCppToC::CefBrowserProcessHandlerCppToC() {
GetStruct()->on_schedule_message_pump_work =
browser_process_handler_on_schedule_message_pump_work;
GetStruct()->get_default_client = browser_process_handler_get_default_client;
GetStruct()->get_default_request_context_handler =
browser_process_handler_get_default_request_context_handler;
}
// DESTRUCTOR - Do not edit by hand.

View File

@@ -9,13 +9,14 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=1d072dd56acd042383f193e1986606ebb2bb9ee1$
// $hash=1487ab43138b7c4bee2b05064a91ed051ff2533e$
//
#include "libcef_dll/ctocpp/browser_process_handler_ctocpp.h"
#include "libcef_dll/cpptoc/command_line_cpptoc.h"
#include "libcef_dll/cpptoc/preference_registrar_cpptoc.h"
#include "libcef_dll/ctocpp/client_ctocpp.h"
#include "libcef_dll/ctocpp/request_context_handler_ctocpp.h"
// VIRTUAL METHODS - Body may be edited by hand.
@@ -136,6 +137,24 @@ CefRefPtr<CefClient> CefBrowserProcessHandlerCToCpp::GetDefaultClient() {
return CefClientCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefRequestContextHandler>
CefBrowserProcessHandlerCToCpp::GetDefaultRequestContextHandler() {
cef_browser_process_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_default_request_context_handler)) {
return nullptr;
}
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_request_context_handler_t* _retval =
_struct->get_default_request_context_handler(_struct);
// Return type: refptr_same
return CefRequestContextHandlerCToCpp::Wrap(_retval);
}
// CONSTRUCTOR - Do not edit by hand.
CefBrowserProcessHandlerCToCpp::CefBrowserProcessHandlerCToCpp() {}

View File

@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=adc863edb83f2bb42719a92c410289ee338acb0f$
// $hash=1212f57d4d21fbb85deba5fc02bfe0a38a6d1a04$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_PROCESS_HANDLER_CTOCPP_H_
@@ -45,6 +45,8 @@ class CefBrowserProcessHandlerCToCpp
const CefString& current_directory) override;
void OnScheduleMessagePumpWork(int64_t delay_ms) override;
CefRefPtr<CefClient> GetDefaultClient() override;
CefRefPtr<CefRequestContextHandler> GetDefaultRequestContextHandler()
override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_BROWSER_PROCESS_HANDLER_CTOCPP_H_

View File

@@ -124,6 +124,10 @@ patches = [
#
# mac: Add support for ui::SHOW_STATE_HIDDEN.
# https://github.com/chromiumembedded/cef/issues/3630
#
# win: Delay enablement of native occlusion tracking until the initially-
# minimized window is restored for the first time.
# https://github.com/chromiumembedded/cef/issues/3638
'name': 'views_widget',
},
{
@@ -459,9 +463,8 @@ patches = [
# "C:\temp\cache\Cache").
# https://github.com/chromiumembedded/cef/issues/2622
#
# alloy: Avoid initialization of privacy sandbox, identity manager and
# first party sets policy.
# https://github.com/chromiumembedded/cef/issues/3434
# alloy: Avoid initialization of privacy sandbox and identity manager.
# https://github.com/chromiumembedded/cef/issues/3643
'name': 'services_network_2622',
},
{
@@ -702,11 +705,24 @@ patches = [
{
# chrome: mac: Support locale configuration.
# https://github.com/chromiumembedded/cef/issues/3623
#
# mac: Add fallback for unsupported --lang values.
# https://github.com/chromiumembedded/cef/issues/3653
'name': 'mac_chrome_locale_3623'
},
{
# alloy: Don't create GPUCache directory when cache_path is empty.
# https://github.com/chromiumembedded/cef/issues/3617
'name': 'content_renderer_host_3617'
}
},
{
# chrome: win: Fix taskbar grouping of PiP and DevTools windows.
# https://github.com/chromiumembedded/cef/issues/3641
'name': 'win_taskbar_group_3641'
},
{
# chrome: win: Disable taskbar decoration for PiP and DevTools windows.
# https://github.com/chromiumembedded/cef/issues/3645
'name': 'win_taskbar_decorator_3645'
},
]

View File

@@ -13,7 +13,7 @@ index 9cd08e8b26410..d2dca33bdc62e 100644
// Returns true if the element's contenteditable attribute is in the true
// state or in the plaintext-only state:
diff --git third_party/blink/renderer/core/exported/web_element.cc third_party/blink/renderer/core/exported/web_element.cc
index 0c2400696ecbc..3dd6e5574eb39 100644
index 5cc36b7dccab4..05c9a46e3db69 100644
--- third_party/blink/renderer/core/exported/web_element.cc
+++ third_party/blink/renderer/core/exported/web_element.cc
@@ -116,6 +116,24 @@ void WebElement::SetAttribute(const WebString& attr_name,

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
index 81dceec0b449c..ca76a507bb657 100644
index 0811d62fd215d..78d10d7f1e658 100644
--- chrome/browser/BUILD.gn
+++ chrome/browser/BUILD.gn
@@ -11,6 +11,7 @@ import("//build/config/compiler/pgo/pgo.gni")
@@ -10,7 +10,7 @@ index 81dceec0b449c..ca76a507bb657 100644
import("//chrome/browser/buildflags.gni")
import("//chrome/browser/downgrade/buildflags.gni")
import("//chrome/common/features.gni")
@@ -2025,6 +2026,7 @@ static_library("browser") {
@@ -2029,6 +2030,7 @@ static_library("browser") {
"//build/config/chromebox_for_meetings:buildflags",
"//build/config/compiler:compiler_buildflags",
"//cc",
@@ -18,7 +18,7 @@ index 81dceec0b449c..ca76a507bb657 100644
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -2679,6 +2681,10 @@ static_library("browser") {
@@ -2683,6 +2685,10 @@ static_library("browser") {
]
}

View File

@@ -12,7 +12,7 @@ index b169371e4d42f..509e4bda85b47 100644
// on the screen, we can't actually attach to it.
parent_window = nullptr;
diff --git components/constrained_window/constrained_window_views.cc components/constrained_window/constrained_window_views.cc
index 3daf40d463e32..dc3712bf6dc89 100644
index 7eda0c852bb51..744452bf6c00c 100644
--- components/constrained_window/constrained_window_views.cc
+++ components/constrained_window/constrained_window_views.cc
@@ -105,15 +105,24 @@ void UpdateModalDialogPosition(views::Widget* widget,
@@ -41,37 +41,45 @@ index 3daf40d463e32..dc3712bf6dc89 100644
return;
}
@@ -123,36 +132,22 @@ void UpdateModalDialogPosition(views::Widget* widget,
@@ -123,44 +132,22 @@ void UpdateModalDialogPosition(views::Widget* widget,
position.set_y(position.y() -
widget->non_client_view()->frame_view()->GetInsets().top());
- gfx::Rect dialog_bounds(position, size);
-
if (widget->is_top_level() && SupportsGlobalScreenCoordinates()) {
- const gfx::Rect initial_dialog_bounds =
- gfx::Rect dialog_screen_bounds =
- dialog_bounds +
- host_widget->GetClientAreaBoundsInScreen().OffsetFromOrigin();
- const gfx::Rect initial_host_bounds =
- host_widget->GetWindowBoundsInScreen();
- const gfx::Rect host_screen_bounds = host_widget->GetWindowBoundsInScreen();
-
- // TODO(crbug.com/1341530): The requested dialog bounds should never fall
- // outside the bounds of the transient parent.
- DCHECK(initial_dialog_bounds.Intersects(initial_host_bounds));
- DCHECK(dialog_screen_bounds.Intersects(host_screen_bounds));
-
- // We should not show a window-modal dialog for a window that exists outside
- // the bounds of the screen. This risks the modal window becoming
- // effectively deadlocked as controls to dismiss the dialog may become
- // inaccessible.
- // It is also insufficient to reposition only the dialog but not the host
- // window as many systems will clip child dialogs to their transient
- // parents. Further, if the window-constrained dialog is visually
- // disassociated with its parent window it may be difficult to discern which
- // window the dialog is modal to.
- host_widget->SetBoundsConstrained(initial_host_bounds);
- const gfx::Rect adjusted_host_bounds =
- host_widget->GetClientAreaBoundsInScreen();
- dialog_bounds += adjusted_host_bounds.OffsetFromOrigin();
- dialog_bounds.AdjustToFit(adjusted_host_bounds);
- // Adjust the dialog bound to ensure it remains visible on the display.
- const gfx::Rect display_work_area =
- display::Screen::GetScreen()
- ->GetDisplayNearestView(dialog_host->GetHostView())
- .work_area();
- if (!display_work_area.Contains(dialog_screen_bounds)) {
- dialog_screen_bounds.AdjustToFit(display_work_area);
- }
-
- // For platforms that clip transient children to the viewport we must
- // maximize its bounds on the display whilst keeping it within the host
- // bounds to avoid viewport clipping.
- // In the case that the host window bounds do not have sufficient overlap
- // with the display, and the dialog cannot be shown in its entirety, this is
- // a recoverable state as users are still able to reposition the host window
- // back onto the display.
- if (PlatformClipsChildrenToViewport() &&
- !host_screen_bounds.Contains(dialog_screen_bounds)) {
- dialog_screen_bounds.AdjustToFit(host_screen_bounds);
- }
-
- // Readjust the position of the dialog.
- dialog_bounds.set_origin(dialog_screen_bounds.origin());
+ position += host_widget->GetClientAreaBoundsInScreen().OffsetFromOrigin();
+ // If the dialog extends partially off any display, clamp its position to
+ // be fully visible within that display. If the dialog doesn't intersect
@@ -91,7 +99,7 @@ index 3daf40d463e32..dc3712bf6dc89 100644
}
} // namespace
@@ -234,7 +229,8 @@ views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog,
@@ -242,7 +229,8 @@ views::Widget* CreateWebModalDialogViews(views::WidgetDelegate* dialog,
views::Widget* widget = views::DialogDelegate::CreateDialogWidget(
dialog, nullptr,
@@ -101,14 +109,14 @@ index 3daf40d463e32..dc3712bf6dc89 100644
widget->SetNativeWindowProperty(
views::kWidgetIdentifierKey,
const_cast<void*>(kConstrainedWindowWidgetIdentifier));
@@ -256,8 +252,13 @@ views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog,
@@ -264,8 +252,13 @@ views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog,
gfx::NativeView parent_view =
parent ? CurrentClient()->GetDialogHostView(parent) : nullptr;
+ // Use with CEF windowless rendering.
+ gfx::AcceleratedWidget parent_widget =
+ parent ? gfx::kNullAcceleratedWidget :
+ CurrentClient()->GetModalDialogHost(parent)->GetAcceleratedWidget();
+ gfx::AcceleratedWidget parent_widget = parent ?
+ CurrentClient()->GetModalDialogHost(parent)->GetAcceleratedWidget() :
+ gfx::kNullAcceleratedWidget;
views::Widget* widget =
- views::DialogDelegate::CreateDialogWidget(dialog, nullptr, parent_view);
+ views::DialogDelegate::CreateDialogWidget(dialog, nullptr, parent_view,
@@ -116,7 +124,7 @@ index 3daf40d463e32..dc3712bf6dc89 100644
widget->SetNativeWindowProperty(
views::kWidgetIdentifierKey,
const_cast<void*>(kConstrainedWindowWidgetIdentifier));
@@ -273,8 +274,7 @@ views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog,
@@ -281,8 +274,7 @@ views::Widget* CreateBrowserModalDialogViews(views::DialogDelegate* dialog,
if (!requires_positioning)
return widget;

View File

@@ -14,7 +14,7 @@ index 9bba6cea235e0..9dc5b40559207 100644
}
diff --git chrome/browser/profiles/profile.cc chrome/browser/profiles/profile.cc
index 28b166f4f499c..5892638bb43c8 100644
index de0a5e38ca13f..ec2f4d194afd1 100644
--- chrome/browser/profiles/profile.cc
+++ chrome/browser/profiles/profile.cc
@@ -87,6 +87,7 @@ base::LazyInstance<std::set<content::BrowserContext*>>::Leaky
@@ -84,10 +84,10 @@ index 4bf4b36f01890..b8a966db377db 100644
// Returns whether the user has signed in this profile to an account.
diff --git chrome/browser/profiles/profile_impl.cc chrome/browser/profiles/profile_impl.cc
index c70593cc14b9d..df5ba6a9432da 100644
index 2053d5f674454..a5b4acf5f764a 100644
--- chrome/browser/profiles/profile_impl.cc
+++ chrome/browser/profiles/profile_impl.cc
@@ -1020,7 +1020,9 @@ Profile* ProfileImpl::GetOffTheRecordProfile(const OTRProfileID& otr_profile_id,
@@ -1023,7 +1023,9 @@ Profile* ProfileImpl::GetOffTheRecordProfile(const OTRProfileID& otr_profile_id,
otr_profiles_[otr_profile_id] = std::move(otr_profile);

View File

@@ -384,7 +384,7 @@ index 7c438a75e086c..f3088e0e6d564 100644
+#endif
}
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
index c8f705069d25b..aa9e0fd6efd0e 100644
index 8e21b0a1e691a..e524270db738a 100644
--- chrome/browser/chrome_content_browser_client.cc
+++ chrome/browser/chrome_content_browser_client.cc
@@ -46,6 +46,7 @@
@@ -446,7 +446,7 @@ index c8f705069d25b..aa9e0fd6efd0e 100644
}
std::vector<base::FilePath>
@@ -7535,10 +7547,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
@@ -7539,10 +7551,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
const auto now = base::TimeTicks::Now();
const auto timeout = GetKeepaliveTimerTimeout(context);
keepalive_deadline_ = std::max(keepalive_deadline_, now + timeout);
@@ -459,7 +459,7 @@ index c8f705069d25b..aa9e0fd6efd0e 100644
FROM_HERE, keepalive_deadline_ - now,
base::BindOnce(
&ChromeContentBrowserClient::OnKeepaliveTimerFired,
@@ -7557,7 +7569,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
@@ -7561,7 +7573,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
--num_keepalive_requests_;
if (num_keepalive_requests_ == 0) {
DVLOG(1) << "Stopping the keepalive timer";
@@ -469,7 +469,7 @@ index c8f705069d25b..aa9e0fd6efd0e 100644
// This deletes the keep alive handle attached to the timer function and
// unblock the shutdown sequence.
}
@@ -7699,7 +7712,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
@@ -7703,7 +7716,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
const auto now = base::TimeTicks::Now();
const auto then = keepalive_deadline_;
if (now < then) {

View File

@@ -363,7 +363,7 @@ index 2e973c9e279b0..12b62efb8071f 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 e2827eb98518f..3e33205a91f1b 100644
index a3090da2ca8b4..463a07929734e 100644
--- chrome/browser/ui/views/frame/browser_view.cc
+++ chrome/browser/ui/views/frame/browser_view.cc
@@ -346,11 +346,10 @@ using content::NativeWebKeyboardEvent;
@@ -488,7 +488,7 @@ index e2827eb98518f..3e33205a91f1b 100644
return frame_->GetFrameView()->ShouldHideTopUIForFullscreen();
}
@@ -3083,7 +3118,8 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
@@ -3086,7 +3121,8 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
}
DownloadBubbleUIController* BrowserView::GetDownloadBubbleUIController() {
@@ -498,7 +498,7 @@ index e2827eb98518f..3e33205a91f1b 100644
if (auto* download_button = toolbar_button_provider_->GetDownloadButton())
return download_button->bubble_controller();
return nullptr;
@@ -3642,7 +3678,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
@@ -3645,7 +3681,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
if (top_container()->parent() == this)
return;
@@ -508,7 +508,7 @@ index e2827eb98518f..3e33205a91f1b 100644
top_container()->DestroyLayer();
AddChildViewAt(top_container(), 0);
EnsureFocusOrder();
@@ -4123,11 +4160,38 @@ void BrowserView::GetAccessiblePanes(std::vector<views::View*>* panes) {
@@ -4126,11 +4163,38 @@ void BrowserView::GetAccessiblePanes(std::vector<views::View*>* panes) {
bool BrowserView::ShouldDescendIntoChildForEventHandling(
gfx::NativeView child,
const gfx::Point& location) {
@@ -549,7 +549,7 @@ index e2827eb98518f..3e33205a91f1b 100644
// Draggable regions are defined relative to the web contents.
gfx::Point point_in_contents_web_view_coords(location);
views::View::ConvertPointToTarget(GetWidget()->GetRootView(),
@@ -4136,7 +4200,7 @@ bool BrowserView::ShouldDescendIntoChildForEventHandling(
@@ -4139,7 +4203,7 @@ bool BrowserView::ShouldDescendIntoChildForEventHandling(
// Draggable regions should be ignored for clicks into any browser view's
// owned widgets, for example alerts, permission prompts or find bar.
@@ -558,7 +558,7 @@ index e2827eb98518f..3e33205a91f1b 100644
point_in_contents_web_view_coords.x(),
point_in_contents_web_view_coords.y()) ||
WidgetOwnedByAnchorContainsPoint(point_in_contents_web_view_coords);
@@ -4247,8 +4311,10 @@ void BrowserView::Layout() {
@@ -4250,8 +4314,10 @@ void BrowserView::Layout() {
// TODO(jamescook): Why was this in the middle of layout code?
toolbar_->location_bar()->omnibox_view()->SetFocusBehavior(
@@ -571,7 +571,7 @@ index e2827eb98518f..3e33205a91f1b 100644
// Some of the situations when the BrowserView is laid out are:
// - Enter/exit immersive fullscreen mode.
@@ -4314,6 +4380,11 @@ void BrowserView::AddedToWidget() {
@@ -4317,6 +4383,11 @@ void BrowserView::AddedToWidget() {
SetThemeProfileForWindow(GetNativeWindow(), browser_->profile());
#endif
@@ -583,7 +583,7 @@ index e2827eb98518f..3e33205a91f1b 100644
toolbar_->Init();
// TODO(pbos): Investigate whether the side panels should be creatable when
@@ -4362,13 +4433,9 @@ void BrowserView::AddedToWidget() {
@@ -4365,13 +4436,9 @@ void BrowserView::AddedToWidget() {
EnsureFocusOrder();
@@ -599,7 +599,7 @@ index e2827eb98518f..3e33205a91f1b 100644
using_native_frame_ = frame_->ShouldUseNativeFrame();
MaybeInitializeWebUITabStrip();
@@ -4793,7 +4860,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
@@ -4796,7 +4863,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
// Undo our anti-jankiness hacks and force a re-layout.
in_process_fullscreen_ = false;
ToolbarSizeChanged(false);
@@ -609,7 +609,7 @@ index e2827eb98518f..3e33205a91f1b 100644
}
bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
@@ -5191,6 +5259,8 @@ Profile* BrowserView::GetProfile() {
@@ -5194,6 +5262,8 @@ Profile* BrowserView::GetProfile() {
}
void BrowserView::UpdateUIForTabFullscreen() {
@@ -618,7 +618,7 @@ index e2827eb98518f..3e33205a91f1b 100644
frame()->GetFrameView()->UpdateFullscreenTopUI();
}
@@ -5213,6 +5283,8 @@ void BrowserView::HideDownloadShelf() {
@@ -5216,6 +5286,8 @@ void BrowserView::HideDownloadShelf() {
}
bool BrowserView::CanUserExitFullscreen() const {
@@ -941,10 +941,10 @@ index c592f23b0c972..adca2e8db1cc6 100644
}
diff --git chrome/browser/ui/views/toolbar/toolbar_view.cc chrome/browser/ui/views/toolbar/toolbar_view.cc
index 0cf2fbd962501..ccdc0a92ccde1 100644
index e6aca6cbb09e8..7e16d8b75fd39 100644
--- chrome/browser/ui/views/toolbar/toolbar_view.cc
+++ chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -191,7 +191,7 @@ class TabstripLikeBackground : public views::Background {
@@ -192,7 +192,7 @@ class TabstripLikeBackground : public views::Background {
void Paint(gfx::Canvas* canvas, views::View* view) const override {
bool painted = TopContainerBackground::PaintThemeCustomImage(canvas, view,
browser_view_);
@@ -953,7 +953,7 @@ index 0cf2fbd962501..ccdc0a92ccde1 100644
SkColor frame_color =
browser_view_->frame()->GetFrameView()->GetFrameColor(
BrowserFrameActiveState::kUseCurrent);
@@ -220,12 +220,13 @@ END_METADATA
@@ -221,12 +221,13 @@ END_METADATA
////////////////////////////////////////////////////////////////////////////////
// ToolbarView, public:
@@ -969,7 +969,7 @@ index 0cf2fbd962501..ccdc0a92ccde1 100644
SetID(VIEW_ID_TOOLBAR);
container_view_ = AddChildView(std::make_unique<ContainerView>());
@@ -250,6 +251,19 @@ ToolbarView::~ToolbarView() {
@@ -251,6 +252,19 @@ ToolbarView::~ToolbarView() {
}
void ToolbarView::Init() {
@@ -989,7 +989,7 @@ index 0cf2fbd962501..ccdc0a92ccde1 100644
#if defined(USE_AURA)
// Avoid generating too many occlusion tracking calculation events before this
// function returns. The occlusion status will be computed only once once this
@@ -274,12 +288,12 @@ void ToolbarView::Init() {
@@ -275,12 +289,12 @@ void ToolbarView::Init() {
auto location_bar = std::make_unique<LocationBarView>(
browser_, browser_->profile(), browser_->command_controller(), this,
@@ -1004,7 +1004,7 @@ index 0cf2fbd962501..ccdc0a92ccde1 100644
download_button =
std::make_unique<DownloadToolbarButtonView>(browser_view_);
}
@@ -361,8 +375,10 @@ void ToolbarView::Init() {
@@ -362,8 +376,10 @@ void ToolbarView::Init() {
}
}
std::unique_ptr<media_router::CastToolbarButton> cast;
@@ -1016,7 +1016,7 @@ index 0cf2fbd962501..ccdc0a92ccde1 100644
std::unique_ptr<MediaToolbarButtonView> media_button;
if (base::FeatureList::IsEnabled(media::kGlobalMediaControls)) {
@@ -372,7 +388,8 @@ void ToolbarView::Init() {
@@ -373,7 +389,8 @@ void ToolbarView::Init() {
std::unique_ptr<send_tab_to_self::SendTabToSelfToolbarIconView>
send_tab_to_self_button;
@@ -1026,7 +1026,7 @@ index 0cf2fbd962501..ccdc0a92ccde1 100644
send_tab_to_self_button =
std::make_unique<send_tab_to_self::SendTabToSelfToolbarIconView>(
browser_view_);
@@ -451,7 +468,7 @@ void ToolbarView::Init() {
@@ -452,7 +469,7 @@ void ToolbarView::Init() {
send_tab_to_self_button_ =
container_view_->AddChildView(std::move(send_tab_to_self_button));

View File

@@ -12,10 +12,10 @@ index b7430b7d7027f..721144dde86d8 100644
version.Set("V8-Version", V8_VERSION_STRING);
std::string host = info.GetHeaderValue("host");
diff --git content/browser/loader/navigation_url_loader_impl.cc content/browser/loader/navigation_url_loader_impl.cc
index 5da07b9eff248..72fc63ba456c5 100644
index ce2f6dd6cf971..f97e9f4b1acb3 100644
--- content/browser/loader/navigation_url_loader_impl.cc
+++ content/browser/loader/navigation_url_loader_impl.cc
@@ -751,6 +751,22 @@ NavigationURLLoaderImpl::PrepareForNonInterceptedRequest() {
@@ -757,6 +757,22 @@ NavigationURLLoaderImpl::PrepareForNonInterceptedRequest() {
: nullptr,
&loader_factory);

View File

@@ -1,5 +1,5 @@
diff --git content/browser/renderer_host/render_process_host_impl.cc content/browser/renderer_host/render_process_host_impl.cc
index b656054d342f5..7889656173b0e 100644
index 545c860afff13..a0e0aea27431e 100644
--- content/browser/renderer_host/render_process_host_impl.cc
+++ content/browser/renderer_host/render_process_host_impl.cc
@@ -1629,7 +1629,8 @@ bool RenderProcessHostImpl::Init() {

View File

@@ -32,7 +32,7 @@ index 6b9d2c180c904..3570ef071ba07 100644
return (dark_mode_support.allow_dark_mode_for_app ||
dark_mode_support.set_preferred_app_mode) &&
diff --git ui/native_theme/native_theme_mac.mm ui/native_theme/native_theme_mac.mm
index be2f769afe2d1..51bcf353b8797 100644
index b9feac1c87c51..f424127723c1a 100644
--- ui/native_theme/native_theme_mac.mm
+++ ui/native_theme/native_theme_mac.mm
@@ -50,6 +50,13 @@ bool InvertedColors() {
@@ -49,7 +49,7 @@ index be2f769afe2d1..51bcf353b8797 100644
} // namespace
// Helper object to respond to light mode/dark mode changeovers.
@@ -594,11 +601,15 @@ void NativeThemeMac::PaintSelectedMenuItem(
@@ -577,11 +584,15 @@ void NativeThemeMac::PaintSelectedMenuItem(
void NativeThemeMac::InitializeDarkModeStateAndObserver() {
__block auto theme = this;
@@ -68,10 +68,10 @@ index be2f769afe2d1..51bcf353b8797 100644
theme->NotifyOnNativeThemeUpdated();
}];
diff --git ui/native_theme/native_theme_win.cc ui/native_theme/native_theme_win.cc
index 6af4df92820d5..c2ae96510d011 100644
index 50647269ec84f..c947bd2717d04 100644
--- ui/native_theme/native_theme_win.cc
+++ ui/native_theme/native_theme_win.cc
@@ -653,14 +653,17 @@ bool NativeThemeWin::ShouldUseDarkColors() const {
@@ -662,14 +662,17 @@ bool NativeThemeWin::ShouldUseDarkColors() const {
// Windows high contrast modes are entirely different themes,
// so let them take priority over dark mode.
// ...unless --force-dark-mode was specified in which case caveat emptor.
@@ -91,7 +91,7 @@ index 6af4df92820d5..c2ae96510d011 100644
return NativeTheme::CalculatePreferredColorScheme();
// According to the spec, the preferred color scheme for web content is 'dark'
@@ -1651,8 +1654,9 @@ void NativeThemeWin::RegisterColorFilteringRegkeyObserver() {
@@ -1660,8 +1663,9 @@ void NativeThemeWin::RegisterColorFilteringRegkeyObserver() {
}
void NativeThemeWin::UpdateDarkModeStatus() {

View File

@@ -38,3 +38,50 @@ index aa43742055b04..e84f21ab963cc 100644
// Note: The call below is necessary even if |preferred_locale| is empty, as
// it will get the locale that should be used potentially from other sources,
// depending on the platform (e.g. the OS locale on Mac).
diff --git ui/base/l10n/l10n_util.cc ui/base/l10n/l10n_util.cc
index efb5dd2cfe061..965106e026fa3 100644
--- ui/base/l10n/l10n_util.cc
+++ ui/base/l10n/l10n_util.cc
@@ -501,25 +501,7 @@ bool CheckAndResolveLocale(const std::string& locale,
return CheckAndResolveLocale(locale, resolved_locale, /*perform_io=*/true);
}
-#if BUILDFLAG(IS_APPLE)
-std::string GetApplicationLocaleInternalMac(const std::string& pref_locale) {
- // Use any override (Cocoa for the browser), otherwise use the preference
- // passed to the function.
- std::string app_locale = l10n_util::GetLocaleOverride();
- if (app_locale.empty())
- app_locale = pref_locale;
-
- // The above should handle all of the cases Chrome normally hits, but for some
- // unit tests, we need something to fall back too.
- if (app_locale.empty())
- app_locale = "en-US";
-
- return app_locale;
-}
-#endif
-
-#if !BUILDFLAG(IS_APPLE)
-std::string GetApplicationLocaleInternalNonMac(const std::string& pref_locale) {
+std::string GetApplicationLocaleInternal(const std::string& pref_locale) {
std::string resolved_locale;
std::vector<std::string> candidates;
@@ -584,15 +566,6 @@ std::string GetApplicationLocaleInternalNonMac(const std::string& pref_locale) {
return std::string();
}
-#endif // !BUILDFLAG(IS_APPLE)
-
-std::string GetApplicationLocaleInternal(const std::string& pref_locale) {
-#if BUILDFLAG(IS_APPLE)
- return GetApplicationLocaleInternalMac(pref_locale);
-#else
- return GetApplicationLocaleInternalNonMac(pref_locale);
-#endif
-}
std::string GetApplicationLocale(const std::string& pref_locale,
bool set_icu_locale) {

View File

@@ -10,10 +10,10 @@ index 0e563dbb253ca..891b2bbc3785c 100644
+// This load will not send any cookies. For CEF usage.
+LOAD_FLAG(DO_NOT_SEND_COOKIES, 1 << 20)
diff --git net/url_request/url_request_http_job.cc net/url_request/url_request_http_job.cc
index 6eeea59318bbc..6e46770ca0f74 100644
index 3afc5526490ed..096d171e93edc 100644
--- net/url_request/url_request_http_job.cc
+++ net/url_request/url_request_http_job.cc
@@ -1850,7 +1850,8 @@ bool URLRequestHttpJob::ShouldAddCookieHeader() const {
@@ -1890,7 +1890,8 @@ bool URLRequestHttpJob::ShouldAddCookieHeader() const {
// Read cookies whenever allow_credentials() is true, even if the PrivacyMode
// is being overridden by NetworkDelegate and will eventually block them, as
// blocked cookies still need to be logged in that case.

View File

@@ -20,8 +20,25 @@ index 101044d12aa89..795fb5f2d0738 100644
auto* service = ConnectorsServiceFactory::GetForBrowserContext(profile);
// If the corresponding Connector policy isn't set, don't perform scans.
if (!service || !service->IsConnectorEnabled(connector))
diff --git chrome/browser/first_party_sets/first_party_sets_policy_service.cc chrome/browser/first_party_sets/first_party_sets_policy_service.cc
index 0509dabf8f421..35a0046a03c6c 100644
--- chrome/browser/first_party_sets/first_party_sets_policy_service.cc
+++ chrome/browser/first_party_sets/first_party_sets_policy_service.cc
@@ -275,6 +275,12 @@ void FirstPartySetsPolicyService::OnProfileConfigReady(
// Representation of the current profile to be persisted on disk.
const std::string browser_context_id = profile->GetBaseName().AsUTF8Unsafe();
+ if (browser_context_id.empty()) {
+ // CEF/Alloy incognito profiles have empty cache path.
+ OnReadyToNotifyDelegates(std::move(config),
+ net::FirstPartySetsCacheFilter());
+ return;
+ }
base::RepeatingCallback<content::BrowserContext*()> browser_context_getter =
base::BindRepeating(
diff --git chrome/browser/net/profile_network_context_service.cc chrome/browser/net/profile_network_context_service.cc
index 62d54608cfe39..b0c5e3970de03 100644
index 62d54608cfe39..f6edd65789aa2 100644
--- chrome/browser/net/profile_network_context_service.cc
+++ chrome/browser/net/profile_network_context_service.cc
@@ -23,6 +23,7 @@
@@ -45,17 +62,7 @@ index 62d54608cfe39..b0c5e3970de03 100644
DisableQuicIfNotAllowed();
@@ -468,6 +471,9 @@ void ProfileNetworkContextService::OnTruncatedCookieBlockingChanged() {
void ProfileNetworkContextService::OnFirstPartySetsEnabledChanged(
bool enabled) {
+ if (cef::IsAlloyRuntimeEnabled()) {
+ return;
+ }
// Update all FPS Access Delegates on the FPS service to be `enabled`.
first_party_sets::FirstPartySetsPolicyServiceFactory::GetForBrowserContext(
profile_)
@@ -913,9 +919,26 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
@@ -913,9 +916,26 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
network_context_params->cookie_manager_params =
CreateCookieManagerParams(profile_, *cookie_settings_);
@@ -83,7 +90,7 @@ index 62d54608cfe39..b0c5e3970de03 100644
PrefService* local_state = g_browser_process->local_state();
// Configure the HTTP cache path and size.
base::FilePath base_cache_path;
@@ -924,15 +947,14 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
@@ -924,15 +944,14 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
local_state->GetFilePath(prefs::kDiskCacheDir);
if (!disk_cache_dir.empty())
base_cache_path = disk_cache_dir.Append(base_cache_path.BaseName());
@@ -103,24 +110,16 @@ index 62d54608cfe39..b0c5e3970de03 100644
network_context_params->file_paths->data_directory =
path.Append(chrome::kNetworkDataDirname);
network_context_params->file_paths->unsandboxed_data_path = path;
@@ -1104,6 +1126,7 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
network_context_params->block_trust_tokens =
anti_abuse_content_setting == CONTENT_SETTING_BLOCK;
+ if (!cef::IsAlloyRuntimeEnabled()) {
@@ -1107,6 +1126,7 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
network_context_params->first_party_sets_access_delegate_params =
network::mojom::FirstPartySetsAccessDelegateParams::New();
network_context_params->first_party_sets_access_delegate_params->enabled =
@@ -1120,6 +1143,7 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
GetForBrowserContext(profile_);
DCHECK(fps_service);
fps_service->AddRemoteAccessDelegate(std::move(fps_access_delegate_remote));
+ }
+ cef::IsAlloyRuntimeEnabled() ? false :
PrivacySandboxSettingsFactory::GetForProfile(profile_)
->AreRelatedWebsiteSetsEnabled();
network_context_params->acam_preflight_spec_conformant =
profile_->GetPrefs()->GetBoolean(
diff --git chrome/browser/net/profile_network_context_service_factory.cc chrome/browser/net/profile_network_context_service_factory.cc
index 14ac2ce8b90c5..99297094beea2 100644
index 14ac2ce8b90c5..66431eface762 100644
--- chrome/browser/net/profile_network_context_service_factory.cc
+++ chrome/browser/net/profile_network_context_service_factory.cc
@@ -6,6 +6,7 @@
@@ -131,18 +130,16 @@ index 14ac2ce8b90c5..99297094beea2 100644
#include "chrome/browser/first_party_sets/first_party_sets_policy_service_factory.h"
#include "chrome/browser/net/profile_network_context_service.h"
#include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h"
@@ -53,9 +54,11 @@ ProfileNetworkContextServiceFactory::ProfileNetworkContextServiceFactory()
@@ -53,7 +54,9 @@ ProfileNetworkContextServiceFactory::ProfileNetworkContextServiceFactory()
#if BUILDFLAG(IS_CHROMEOS_ASH)
DependsOn(chromeos::CertificateProviderServiceFactory::GetInstance());
#endif
+ if (!cef::IsAlloyRuntimeEnabled()) {
DependsOn(PrivacySandboxSettingsFactory::GetInstance());
+ }
DependsOn(
first_party_sets::FirstPartySetsPolicyServiceFactory::GetInstance());
+ }
}
ProfileNetworkContextServiceFactory::~ProfileNetworkContextServiceFactory() =
diff --git chrome/browser/signin/identity_manager_factory.cc chrome/browser/signin/identity_manager_factory.cc
index 77522f65b7b6e..51cc2d60d4b8d 100644
--- chrome/browser/signin/identity_manager_factory.cc

View File

@@ -1,5 +1,5 @@
diff --git ui/views/controls/webview/webview.cc ui/views/controls/webview/webview.cc
index 8df4e98500b1e..f649d016e1e5a 100644
index 25ee101d5e164..edd2bc8ae9a4f 100644
--- ui/views/controls/webview/webview.cc
+++ ui/views/controls/webview/webview.cc
@@ -159,6 +159,10 @@ void WebView::EnableSizingFromWebContents(const gfx::Size& min_size,
@@ -14,7 +14,7 @@ index 8df4e98500b1e..f649d016e1e5a 100644
if (crashed_overlay_view_.view() == crashed_overlay_view) {
return;
diff --git ui/views/controls/webview/webview.h ui/views/controls/webview/webview.h
index 3b829d69e4254..6d58b64600c58 100644
index 23ddefe2a75b7..5a7eea658ed28 100644
--- ui/views/controls/webview/webview.h
+++ ui/views/controls/webview/webview.h
@@ -93,6 +93,10 @@ class WEBVIEW_EXPORT WebView : public View,

View File

@@ -213,6 +213,24 @@ index b3acdceb83879..7a2de7e7d0678 100644
#if BUILDFLAG(IS_MAC)
// Set the view's active state (i.e., tint state of controls).
virtual void SetActive(bool active) = 0;
diff --git ui/aura/native_window_occlusion_tracker_win.cc ui/aura/native_window_occlusion_tracker_win.cc
index 41c3d067b72d4..8463204012290 100644
--- ui/aura/native_window_occlusion_tracker_win.cc
+++ ui/aura/native_window_occlusion_tracker_win.cc
@@ -102,6 +102,13 @@ void NativeWindowOcclusionTrackerWin::Enable(Window* window) {
// when it's no longer true that all windows are minimized, and when the
// window is destroyed.
HWND root_window_hwnd = window->GetHost()->GetAcceleratedWidget();
+
+ // Delay occlusion tracking for initially-minimized windows.
+ // See CEF issue #3638.
+ if (IsIconic(root_window_hwnd)) {
+ return;
+ }
+
window->AddObserver(this);
// Remember this mapping from hwnd to Window*.
hwnd_root_window_map_[root_window_hwnd] = window;
diff --git ui/base/mojom/ui_base_types_mojom_traits.h ui/base/mojom/ui_base_types_mojom_traits.h
index 1d79fc2dc34cc..ce5bf0ebf531f 100644
--- ui/base/mojom/ui_base_types_mojom_traits.h
@@ -240,19 +258,19 @@ index 8bfbd2d675db6..ee90ad2884db7 100644
// Specifies which edges of the window are tiled.
diff --git ui/ozone/platform/x11/x11_window.cc ui/ozone/platform/x11/x11_window.cc
index 449f721727fb1..ab549b482bc36 100644
index 986611404dd69..abefa63d5c2b8 100644
--- ui/ozone/platform/x11/x11_window.cc
+++ ui/ozone/platform/x11/x11_window.cc
@@ -1846,7 +1846,8 @@ void X11Window::CreateXWindow(const PlatformWindowInitProperties& properties) {
@@ -1868,7 +1868,8 @@ void X11Window::CreateXWindow(const PlatformWindowInitProperties& properties) {
req.border_pixel = 0;
last_set_bounds_px_ = SanitizeBounds(bounds);
bounds_in_pixels_ = SanitizeBounds(bounds);
- req.parent = x_root_window_;
+ req.parent = properties.parent_widget == gfx::kNullAcceleratedWidget ?
+ x_root_window_ : static_cast<x11::Window>(properties.parent_widget);
req.x = last_set_bounds_px_.x();
req.y = last_set_bounds_px_.y();
req.width = last_set_bounds_px_.width();
req.x = bounds_in_pixels_.x();
req.y = bounds_in_pixels_.y();
req.width = bounds_in_pixels_.width();
diff --git ui/views/widget/desktop_aura/desktop_screen_win.cc ui/views/widget/desktop_aura/desktop_screen_win.cc
index e4e6d3104da9e..bb372b0cd2960 100644
--- ui/views/widget/desktop_aura/desktop_screen_win.cc
@@ -346,10 +364,18 @@ index f841bc5750537..aa2d4720c8152 100644
// Calculate initial bounds.
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
index d877d237b2c16..95ee3dd3253fd 100644
index d877d237b2c16..479f3bc1ac019 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -181,16 +181,29 @@ void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) {
@@ -21,6 +21,7 @@
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/client/focus_client.h"
+#include "ui/aura/native_window_occlusion_tracker.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/class_property.h"
#include "ui/base/cursor/cursor.h"
@@ -181,22 +182,42 @@ void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) {
native_widget_delegate_.get());
HWND parent_hwnd = nullptr;
@@ -383,7 +409,46 @@ index d877d237b2c16..95ee3dd3253fd 100644
message_handler_->Init(parent_hwnd, pixel_bounds);
CreateCompositor(params.force_software_compositing);
OnAcceleratedWidgetAvailable();
@@ -1043,11 +1056,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
InitHost();
window()->Show();
+ if (params.show_state == ui::SHOW_STATE_MINIMIZED) {
+ // Delay enablement of native occlusion tracking until the
+ // initially-minimized window is restored for the first time.
+ // See CEF issue #3638.
+ initially_minimized_first_restore_pending_ = true;
+ }
+
if (base::FeatureList::IsEnabled(views::features::kWidgetLayering)) {
// Stack immedately above its parent so that it does not cover other
// root-level windows.
@@ -1023,10 +1044,23 @@ void DesktopWindowTreeHostWin::HandleWindowMinimizedOrRestored(bool restored) {
if (!native_widget_delegate_->IsNativeWidgetInitialized())
return;
- if (restored)
+ if (restored) {
window()->Show();
- else
+
+ if (initially_minimized_first_restore_pending_) {
+ initially_minimized_first_restore_pending_ = false;
+
+ // Enable native occlusion tracking for initially-minimized windows here
+ // to avoid incorrect hidden state after restore. See CEF issue #3638.
+ if (aura::NativeWindowOcclusionTracker::
+ IsNativeWindowOcclusionTrackingAlwaysEnabled(this)) {
+ aura::NativeWindowOcclusionTracker::
+ EnableNativeWindowOcclusionTracking(this);
+ }
+ }
+ } else {
window()->Hide();
+ }
}
void DesktopWindowTreeHostWin::HandleClientSizeChanged(
@@ -1043,11 +1077,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
}
void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
@@ -401,7 +466,7 @@ index d877d237b2c16..95ee3dd3253fd 100644
}
bool DesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) {
@@ -1055,6 +1072,12 @@ bool DesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) {
@@ -1055,6 +1093,12 @@ bool DesktopWindowTreeHostWin::HandleMouseEvent(ui::MouseEvent* event) {
if (ui::PlatformEventSource::ShouldIgnoreNativePlatformEvents())
return true;
@@ -414,7 +479,7 @@ index d877d237b2c16..95ee3dd3253fd 100644
SendEventToSink(event);
return event->handled();
}
@@ -1233,8 +1256,16 @@ void DesktopWindowTreeHostWin::SetBoundsInDIP(const gfx::Rect& bounds) {
@@ -1233,8 +1277,16 @@ void DesktopWindowTreeHostWin::SetBoundsInDIP(const gfx::Rect& bounds) {
// positions in variable-DPI situations. See https://crbug.com/1224715 for
// details.
aura::Window* root = nullptr;
@@ -433,16 +498,20 @@ index d877d237b2c16..95ee3dd3253fd 100644
}
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
index e963c861f7099..6bc0ac23db5e9 100644
index e963c861f7099..68c6e02f2bbe5 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
@@ -322,6 +322,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
@@ -322,6 +322,14 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
// True if the window should have the frame removed.
bool remove_standard_frame_;
+ // True if the widget has a external parent view/window outside of the
+ // Chromium-controlled view/window hierarchy.
+ bool has_external_parent_ = false;
+
+ // True if the first call to HandleWindowMinimizedOrRestored for an initially-
+ // minimized window is pending.
+ bool initially_minimized_first_restore_pending_ = false;
+
// Visibility of the cursor. On Windows we can have multiple root windows and
// the implementation of ::ShowCursor() is based on a counter, so making this

View File

@@ -0,0 +1,41 @@
diff --git chrome/browser/taskbar/taskbar_decorator_win.cc chrome/browser/taskbar/taskbar_decorator_win.cc
index 20f37cf8b31ee..85569f9a9694c 100644
--- chrome/browser/taskbar/taskbar_decorator_win.cc
+++ chrome/browser/taskbar/taskbar_decorator_win.cc
@@ -18,12 +18,14 @@
#include "base/strings/utf_string_conversions.h"
#include "base/task/thread_pool.h"
#include "base/win/scoped_gdi_object.h"
+#include "cef/libcef/features/features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/avatar_menu.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/browser/ui/views/frame/browser_view.h"
#include "skia/ext/font_utils.h"
#include "skia/ext/image_operations.h"
#include "skia/ext/legacy_display_globals.h"
@@ -201,6 +203,21 @@ void UpdateTaskbarDecoration(Profile* profile, gfx::NativeWindow window) {
return;
}
+#if BUILDFLAG(ENABLE_CEF)
+ if (auto browser_view = BrowserView::GetBrowserViewForNativeWindow(window)) {
+ if (auto browser = browser_view->browser()) {
+ if (browser->cef_delegate() &&
+ (browser->is_type_picture_in_picture() ||
+ browser->is_type_devtools()) &&
+ browser->cef_delegate()->HasViewsHostedOpener()) {
+ // Don't add taskbar decoration.
+ taskbar::DrawTaskbarDecoration(window, nullptr);
+ return;
+ }
+ }
+ }
+#endif // BUILDFLAG(ENABLE_CEF)
+
// We need to draw the taskbar decoration. Even though we have an icon on the
// window's relaunch details, we draw over it because the user may have
// pinned the badge-less Chrome shortcut which will cause Windows to ignore

View File

@@ -0,0 +1,29 @@
diff --git chrome/browser/ui/views/frame/browser_window_property_manager_win.cc chrome/browser/ui/views/frame/browser_window_property_manager_win.cc
index 1a62480aee22c..9da572856c03b 100644
--- chrome/browser/ui/views/frame/browser_window_property_manager_win.cc
+++ chrome/browser/ui/views/frame/browser_window_property_manager_win.cc
@@ -8,6 +8,7 @@
#include "base/functional/bind.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/windows_version.h"
+#include "cef/libcef/features/features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -49,6 +50,16 @@ void BrowserWindowPropertyManager::UpdateWindowProperties() {
const Browser* browser = view_->browser();
Profile* profile = browser->profile();
+#if BUILDFLAG(ENABLE_CEF)
+ if (browser->cef_delegate() &&
+ (browser->is_type_picture_in_picture() ||
+ browser->is_type_devtools()) &&
+ browser->cef_delegate()->HasViewsHostedOpener()) {
+ // Don't create a separate taskbar group.
+ return;
+ }
+#endif
+
// Set the app user model id for this application to that of the application
// name. See http://crbug.com/7028.
std::wstring app_id =

View File

@@ -96,10 +96,21 @@ class RootWindow
// of this class will be called on the main thread.
class Delegate {
public:
// Called to retrieve the CefRequestContext for browser. Only called for
// non-popup browsers. May return nullptr.
virtual CefRefPtr<CefRequestContext> GetRequestContext(
RootWindow* root_window) = 0;
// Called to synchronously retrieve the CefRequestContext for browser. Only
// called for non-popup browsers. Must be called on the main thread. With
// the Chrome runtime this method is only safe when using the global request
// context.
// TODO: Delete this method and use the async version instead.
virtual CefRefPtr<CefRequestContext> GetRequestContext() = 0;
using RequestContextCallback =
base::OnceCallback<void(CefRefPtr<CefRequestContext>)>;
// Called to asynchronously retrieve the CefRequestContext for browser. Only
// called for non-popup browsers. Save to call on any thread. |callback|
// will be executed on the UI thread after the request context is
// initialized.
virtual void GetRequestContext(RequestContextCallback callback) = 0;
// Returns the ImageCache.
virtual scoped_refptr<ImageCache> GetImageCache() = 0;

View File

@@ -443,7 +443,7 @@ void RootWindowGtk::CreateRootWindow(const CefBrowserSettings& settings,
if (!is_popup_) {
// Create the browser window.
browser_window_->CreateBrowser(parent, browser_bounds_, settings, nullptr,
delegate_->GetRequestContext(this));
delegate_->GetRequestContext());
} else {
// With popups we already have a browser window. Parent the browser window
// to the root window and show it in the correct location.

View File

@@ -620,8 +620,7 @@ void RootWindowMacImpl::CreateRootWindow(const CefBrowserSettings& settings,
browser_window_->CreateBrowser(
CAST_NSVIEW_TO_CEF_WINDOW_HANDLE(contentView),
CefRect(0, 0, contentBounds.size.width, contentBounds.size.height),
settings, nullptr,
root_window_.delegate_->GetRequestContext(&root_window_));
settings, nullptr, root_window_.delegate_->GetRequestContext());
} else {
// With popups we already have a browser window. Parent the browser window
// to the root window and show it in the correct location.

View File

@@ -8,6 +8,7 @@
#include "include/base/cef_callback.h"
#include "include/base/cef_logging.h"
#include "include/wrapper/cef_closure_task.h"
#include "include/wrapper/cef_helpers.h"
#include "tests/cefclient/browser/client_handler_std.h"
#include "tests/cefclient/browser/main_context.h"
@@ -24,36 +25,41 @@ namespace {
class ClientRequestContextHandler : public CefRequestContextHandler,
public CefExtensionHandler {
public:
ClientRequestContextHandler() = default;
using CreateCallback = RootWindow::Delegate::RequestContextCallback;
explicit ClientRequestContextHandler(CreateCallback callback)
: create_callback_(std::move(callback)) {}
// CefRequestContextHandler methods:
void OnRequestContextInitialized(
CefRefPtr<CefRequestContext> request_context) override {
CEF_REQUIRE_UI_THREAD();
const auto main_context = MainContext::Get();
CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine();
if (command_line->HasSwitch(switches::kLoadExtension)) {
if (MainContext::Get()
->GetRootWindowManager()
->request_context_per_browser()) {
if (!main_context->UseChromeRuntime() &&
command_line->HasSwitch(switches::kLoadExtension)) {
// Alloy implementation for loading extensions. Chrome runtime handles
// this internally.
if (main_context->GetRootWindowManager()->request_context_per_browser()) {
// The example extension loading implementation requires all browsers to
// share the same request context.
LOG(ERROR)
<< "Cannot mix --load-extension and --request-context-per-browser";
return;
}
// Load one or more extension paths specified on the command-line and
// delimited with semicolon.
const std::string& extension_path =
command_line->GetSwitchValue(switches::kLoadExtension);
if (!extension_path.empty()) {
std::string part;
std::istringstream f(extension_path);
while (getline(f, part, ';')) {
if (!part.empty()) {
extension_util::LoadExtension(request_context, part, this);
} else {
// Load one or more extension paths specified on the command-line and
// delimited with semicolon.
const std::string& extension_path =
command_line->GetSwitchValue(switches::kLoadExtension);
if (!extension_path.empty()) {
std::string part;
std::istringstream f(extension_path);
while (getline(f, part, ';')) {
if (!part.empty()) {
extension_util::LoadExtension(request_context, part, this);
}
}
}
}
@@ -67,6 +73,12 @@ class ClientRequestContextHandler : public CefRequestContextHandler,
request_context->SetContentSetting(startup_url, startup_url,
CEF_CONTENT_SETTING_TYPE_POPUPS,
CEF_CONTENT_SETTING_VALUE_ALLOW);
if (!create_callback_.is_null()) {
// Execute the callback asynchronously.
CefPostTask(TID_UI,
base::BindOnce(std::move(create_callback_), request_context));
}
}
// CefExtensionHandler methods:
@@ -95,6 +107,8 @@ class ClientRequestContextHandler : public CefRequestContextHandler,
}
private:
CreateCallback create_callback_;
IMPLEMENT_REFCOUNTING(ClientRequestContextHandler);
DISALLOW_COPY_AND_ASSIGN(ClientRequestContextHandler);
};
@@ -324,11 +338,33 @@ void RootWindowManager::NotifyExtensionsChanged() {
}
}
CefRefPtr<CefRequestContext> RootWindowManager::GetRequestContext(
RootWindow* root_window) {
CefRefPtr<CefRequestContext> RootWindowManager::GetRequestContext() {
REQUIRE_MAIN_THREAD();
return CreateRequestContext(RequestContextCallback());
}
void RootWindowManager::GetRequestContext(RequestContextCallback callback) {
DCHECK(!callback.is_null());
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute on the main thread.
MAIN_POST_CLOSURE(base::BindOnce(
base::IgnoreResult(&RootWindowManager::CreateRequestContext),
base::Unretained(this), std::move(callback)));
} else {
CreateRequestContext(std::move(callback));
}
}
CefRefPtr<CefRequestContext> RootWindowManager::CreateRequestContext(
RequestContextCallback callback) {
REQUIRE_MAIN_THREAD();
if (request_context_per_browser_) {
// Synchronous use of non-global request contexts is not safe with the
// Chrome runtime.
CHECK(!callback.is_null() || !MainContext::Get()->UseChromeRuntime());
// Create a new request context for each browser.
CefRequestContextSettings settings;
@@ -350,15 +386,21 @@ CefRefPtr<CefRequestContext> RootWindowManager::GetRequestContext(
}
}
return CefRequestContext::CreateContext(settings,
new ClientRequestContextHandler);
return CefRequestContext::CreateContext(
settings, new ClientRequestContextHandler(std::move(callback)));
}
// All browsers will share the global request context.
if (!shared_request_context_.get()) {
if (!shared_request_context_) {
shared_request_context_ = CefRequestContext::CreateContext(
CefRequestContext::GetGlobalContext(), new ClientRequestContextHandler);
CefRequestContext::GetGlobalContext(),
new ClientRequestContextHandler(std::move(callback)));
} else if (!callback.is_null()) {
// Execute the callback on the UI thread.
CefPostTask(TID_UI,
base::BindOnce(std::move(callback), shared_request_context_));
}
return shared_request_context_;
}

View File

@@ -94,8 +94,8 @@ class RootWindowManager : public RootWindow::Delegate {
void NotifyExtensionsChanged();
// RootWindow::Delegate methods.
CefRefPtr<CefRequestContext> GetRequestContext(
RootWindow* root_window) override;
CefRefPtr<CefRequestContext> GetRequestContext() override;
void GetRequestContext(RequestContextCallback callback) override;
scoped_refptr<ImageCache> GetImageCache() override;
void OnTest(RootWindow* root_window, int test_id) override;
void OnExit(RootWindow* root_window) override;
@@ -109,6 +109,10 @@ class RootWindowManager : public RootWindow::Delegate {
base::OnceClosure close_callback,
bool with_osr) override;
// |callback| may be nullptr. Must be called on the main thread.
CefRefPtr<CefRequestContext> CreateRequestContext(
RequestContextCallback callback);
void CleanupOnUIThread();
const bool terminate_when_all_windows_closed_;

View File

@@ -58,20 +58,14 @@ void RootWindowViews::Init(RootWindow::Delegate* delegate,
CreateClientHandler(config_->url);
initialized_ = true;
if (!CURRENTLY_ON_MAIN_THREAD()) {
// Execute GetRequestContext() on the main thread.
MAIN_POST_CLOSURE(base::BindOnce(
[](scoped_refptr<RootWindowViews> self,
const CefBrowserSettings& settings) {
// Continue initialization on the UI thread.
self->InitOnUIThread(settings,
self->delegate_->GetRequestContext(self.get()));
},
scoped_refptr<RootWindowViews>(this), settings));
} else {
// Continue initialization on the UI thread.
InitOnUIThread(settings, delegate_->GetRequestContext(this));
}
delegate_->GetRequestContext(base::BindOnce(
[](scoped_refptr<RootWindowViews> self,
const CefBrowserSettings& settings,
CefRefPtr<CefRequestContext> request_context) {
// Continue initialization on the UI thread.
self->InitOnUIThread(settings, request_context);
},
scoped_refptr<RootWindowViews>(this), settings));
}
void RootWindowViews::InitAsPopup(RootWindow::Delegate* delegate,

View File

@@ -1015,7 +1015,7 @@ void RootWindowWin::OnCreate(LPCREATESTRUCT lpCreateStruct) {
CefRect cef_rect(rect.left, rect.top, rect.right - rect.left,
rect.bottom - rect.top);
browser_window_->CreateBrowser(hwnd_, cef_rect, browser_settings_, nullptr,
delegate_->GetRequestContext(this));
delegate_->GetRequestContext());
} else {
// With popups we already have a browser window. Parent the browser window
// to the root window and show it in the correct location.

View File

@@ -56,6 +56,12 @@ run but any related functionality may become broken or disabled.
is recommended instead of relying on the possibly old and untested system
installed version.
* DirectX compiler support (x64 only).
* dxil.dll
* dxcompiler.dll
Support for DirectX rendering of WebGPU. Without these files the
aforementioned capabilities may fail.
* ANGLE support.
* libEGL.dll
* libGLESv2.dll

View File

@@ -890,6 +890,8 @@ if platform == 'windows':
binaries = [
{'path': 'chrome_elf.dll'},
{'path': 'd3dcompiler_47.dll'},
{'path': 'dxcompiler.dll', 'conditional': True},
{'path': 'dxil.dll', 'conditional': True},
{'path': libcef_dll},
{'path': 'libEGL.dll'},
{'path': 'libGLESv2.dll'},