Compare commits

...

32 Commits
6943 ... 5481

Author SHA1 Message Date
Marshall Greenblatt
291f1df302 Update to Chromium version 110.0.5481.180 2023-03-07 14:32:52 +00:00
Marshall Greenblatt
46651e0d26 Update to Chromium version 110.0.5481.179 2023-03-02 14:35:58 +00:00
Marshall Greenblatt
3c2b68f976 Update to Chromium version 110.0.5481.178 2023-02-23 14:32:48 +00:00
Marshall Greenblatt
fde72b57a8 alloy: Fix theme configuration on startup (fixes issue #3449) 2023-02-22 17:15:34 -05:00
Marshall Greenblatt
16a215353c Update to Chromium version 110.0.5481.104 2023-02-17 17:08:55 +00:00
Marshall Greenblatt
1296c82b59 Update to Chromium version 110.0.5481.100 2023-02-15 16:40:06 +00:00
Marshall Greenblatt
732747fb99 Update to Chromium version 110.0.5481.97 2023-02-14 14:38:13 +00:00
Marshall Greenblatt
75b1c96ec1 Update to Chromium version 110.0.5481.78 2023-02-08 14:46:58 +00:00
Marshall Greenblatt
85aaba4cae Fix potential UAF of CefBPDNativeAura::window_widget_ 2023-02-07 11:33:50 -05:00
Marshall Greenblatt
59b475790b ceftests: Fix OSRTest flakyness 2023-02-07 11:33:44 -05:00
Marshall Greenblatt
b3f93d506f Update to Chromium version 110.0.5481.77 2023-02-02 14:35:19 +00:00
Marshall Greenblatt
6054757781 Use default cookie scheme settings for non-global request contexts
The CefSettings cookie scheme configuration will now only impact the global
request context. Custom behavior for other request contexts must now be
configured via CefRequestContextSettings.
2023-01-26 14:39:25 -05:00
Marshall Greenblatt
a3a017c8d8 Update to Chromium version 110.0.5481.52 2023-01-26 14:55:27 +00:00
Marshall Greenblatt
a9eaf00d40 Update to Chromium version 110.0.5481.38 2023-01-23 18:26:27 -05:00
Marshall Greenblatt
877cbe7e04 Fix patched chrome build with enable_cef=false 2023-01-23 14:20:55 -05:00
Marshall Greenblatt
4d32741e1b Fix patched chrome build with enable_cef=false 2023-01-23 14:12:47 -05:00
Marshall Greenblatt
2ad6ced9f0 chrome: Allow WebUI handling of DevTools scheme (fixes issue #3421) 2023-01-23 13:44:47 -05:00
Marshall Greenblatt
2b645e2851 Fix patched chrome build with enable_cef=false 2023-01-23 12:58:40 -05:00
Marshall Greenblatt
6eccee36d1 chrome: Don't show the profile picker on startup (fixes issue #3440) 2023-01-19 16:25:42 -05:00
Marshall Greenblatt
c12701592e ceftests: Add support for scaling default test timeout values 2023-01-17 10:31:07 -05:00
Marshall Greenblatt
7b14b637bb cmake: Set PROJECT_ARCH to the host architecture by default 2023-01-17 10:31:07 -05:00
Marshall Greenblatt
a39c50d09a Update to Chromium version 110.0.5481.30 2023-01-13 17:23:58 +00:00
e.jorge
d26cf55456 Fix edit command execution on pdf frames (fixes issue #3429) 2023-01-12 16:47:55 -05:00
Marshall Greenblatt
4e0237a1bf Fix crash calling GetUserData on a non-user V8 object (fixes issue #3438) 2023-01-12 15:59:08 -05:00
Vladimir Kharitonov
8022d433c7 mac: Fix OSR scaling behavior when switching displays (fixes issue #3423) 2023-01-12 15:59:08 -05:00
Enrique Turegano Pedruelo
ba12a2ed05 Linux: Fix build without X11 (fixes issue #3431) 2023-01-10 16:32:45 -05:00
Marshall Greenblatt
fa089408e9 win: osr: Fix context menu popup placement (fixes issue 3433) 2023-01-06 15:52:36 -05:00
Marshall Greenblatt
2567ca15a9 Revert "Fix dismissal of select popups on NotifyMoveOrResizeStarted (see issue #3294)"
This reverts commit 5f4bccd672.

Reason for revert: This change causes a native parented browser to lose focus
on move (fixes issue #3426).
2023-01-06 13:50:34 -05:00
Marshall Greenblatt
f77a7a7336 alloy: Avoid initialization of privacy sandbox and identity manager (fixes issue #3434, fixes issue #3401) 2023-01-06 12:14:02 -05:00
Marshall Greenblatt
7209750d46 alloy: Fix crashes when extensions are disabled (fixes issue #3430) 2023-01-05 14:02:01 -05:00
Marshall Greenblatt
05104b07e0 cmake: Set build target to Windows 10 2023-01-05 12:49:13 -05:00
Marshall Greenblatt
f3c7d2c89a Update to Chromium version 110.0.5481.23 2023-01-04 21:38:43 -05:00
58 changed files with 1203 additions and 939 deletions

View File

@@ -7,5 +7,6 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/110.0.5481.0'
'chromium_checkout': 'refs/tags/110.0.5481.180',
'depot_tools_checkout': '252b19866a'
}

View File

@@ -54,7 +54,7 @@
# recommended.
#
# - Windows requirements:
# Visual Studio 2019 or newer building on Windows 7 or newer. Windows 10
# Visual Studio 2019 or newer building on Windows 10 or newer. Windows 10
# 64-bit is recommended. Newer versions will likely also work but may not have
# been tested.
#

View File

@@ -26,18 +26,14 @@ endif()
# Determine the project architecture.
if(NOT DEFINED PROJECT_ARCH)
if(OS_WINDOWS AND "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "arm64")
if(("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "arm64") OR
("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM64"))
set(PROJECT_ARCH "arm64")
elseif(CMAKE_SIZEOF_VOID_P MATCHES 8)
set(PROJECT_ARCH "x86_64")
else()
set(PROJECT_ARCH "x86")
endif()
if(OS_MAC)
# PROJECT_ARCH should be specified on Mac OS X.
message(WARNING "No PROJECT_ARCH value specified, using ${PROJECT_ARCH}")
endif()
endif()
if(${CMAKE_GENERATOR} STREQUAL "Ninja")
@@ -443,7 +439,12 @@ if(OS_WINDOWS)
list(APPEND CEF_COMPILER_DEFINES
WIN32 _WIN32 _WINDOWS # Windows platform
UNICODE _UNICODE # Unicode build
WINVER=0x0601 _WIN32_WINNT=0x601 # Targeting Windows 7
# Targeting Windows 10. We can't say `=_WIN32_WINNT_WIN10` here because
# some files do `#if WINVER < 0x0600` without including windows.h before,
# and then _WIN32_WINNT_WIN10 isn't yet known to be 0x0A00.
WINVER=0x0A00
_WIN32_WINNT=0x0A00
NTDDI_VERSION=NTDDI_WIN10_FE
NOMINMAX # Use the standard's templated min/max
WIN32_LEAN_AND_MEAN # Exclude less common API declarations
_HAS_EXCEPTIONS=0 # Disable exceptions

View File

@@ -420,11 +420,11 @@ typedef struct _cef_settings_t {
/// Comma delimited list of schemes supported by the associated
/// CefCookieManager. If |cookieable_schemes_exclude_defaults| is false (0)
/// the default schemes ("http", "https", "ws" and "wss") will also be
/// supported. Specifying a |cookieable_schemes_list| value and setting
/// supported. Not specifying a |cookieable_schemes_list| value and setting
/// |cookieable_schemes_exclude_defaults| to true (1) will disable all loading
/// and saving of cookies for this manager. Can be overridden
/// for individual CefRequestContext instances via the
/// CefRequestContextSettings.cookieable_schemes_list and
/// and saving of cookies. These settings will only impact the global
/// CefRequestContext. Individual CefRequestContext instances can be
/// configured via the CefRequestContextSettings.cookieable_schemes_list and
/// CefRequestContextSettings.cookieable_schemes_exclude_defaults values.
///
cef_string_t cookieable_schemes_list;
@@ -486,10 +486,10 @@ typedef struct _cef_request_context_settings_t {
/// Comma delimited list of schemes supported by the associated
/// CefCookieManager. If |cookieable_schemes_exclude_defaults| is false (0)
/// the default schemes ("http", "https", "ws" and "wss") will also be
/// supported. Specifying a |cookieable_schemes_list| value and setting
/// supported. Not specifying a |cookieable_schemes_list| value and setting
/// |cookieable_schemes_exclude_defaults| to true (1) will disable all loading
/// and saving of cookies for this manager. These values will be ignored if
/// |cache_path| matches the CefSettings.cache_path value.
/// and saving of cookies. These values will be ignored if |cache_path|
/// matches the CefSettings.cache_path value.
///
cef_string_t cookieable_schemes_list;
int cookieable_schemes_exclude_defaults;

View File

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

View File

@@ -261,12 +261,15 @@ void CefBrowserPlatformDelegateAlloy::SendCaptureLostEvent() {
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() {
if (!web_contents_) {
if (!browser_) {
return;
}
// Dismiss any existing popups.
web_contents_->ClearFocusedElement();
auto frame = browser_->GetMainFrame();
if (frame && frame->IsValid()) {
static_cast<CefFrameHostImpl*>(frame.get())->NotifyMoveOrResizeStarted();
}
}
#endif

View File

@@ -155,6 +155,11 @@ CefBrowserContext* GetSelf(base::WeakPtr<CefBrowserContext> self) {
CefBrowserContext::CookieableSchemes MakeSupportedSchemes(
const CefString& schemes_list,
bool include_defaults) {
if (schemes_list.empty() && include_defaults) {
// No explicit registration of schemes.
return absl::nullopt;
}
std::vector<std::string> all_schemes;
if (!schemes_list.empty()) {
all_schemes =
@@ -174,6 +179,12 @@ CefBrowserContext::CookieableSchemes MakeSupportedSchemes(
return absl::make_optional(all_schemes);
}
template <typename T>
CefBrowserContext::CookieableSchemes MakeSupportedSchemes(const T& settings) {
return MakeSupportedSchemes(CefString(&settings.cookieable_schemes_list),
!settings.cookieable_schemes_exclude_defaults);
}
} // namespace
CefBrowserContext::CefBrowserContext(const CefRequestContextSettings& settings)
@@ -197,13 +208,7 @@ void CefBrowserContext::Initialize() {
}
iothread_state_ = base::MakeRefCounted<CefIOThreadState>();
if (settings_.cookieable_schemes_list.length > 0 ||
settings_.cookieable_schemes_exclude_defaults) {
cookieable_schemes_ =
MakeSupportedSchemes(CefString(&settings_.cookieable_schemes_list),
!settings_.cookieable_schemes_exclude_defaults);
}
cookieable_schemes_ = MakeSupportedSchemes(settings_);
}
void CefBrowserContext::Shutdown() {
@@ -426,11 +431,7 @@ CefMediaRouterManager* CefBrowserContext::GetMediaRouterManager() {
CefBrowserContext::CookieableSchemes CefBrowserContext::GetCookieableSchemes()
const {
CEF_REQUIRE_UIT();
if (cookieable_schemes_) {
return cookieable_schemes_;
}
return GetGlobalCookieableSchemes();
return cookieable_schemes_;
}
// static
@@ -439,15 +440,6 @@ CefBrowserContext::GetGlobalCookieableSchemes() {
CEF_REQUIRE_UIT();
static base::NoDestructor<CookieableSchemes> schemes(
[]() -> CookieableSchemes {
const auto& settings = CefContext::Get()->settings();
if (settings.cookieable_schemes_list.length > 0 ||
settings.cookieable_schemes_exclude_defaults) {
return MakeSupportedSchemes(
CefString(&settings.cookieable_schemes_list),
!settings.cookieable_schemes_exclude_defaults);
}
return absl::nullopt;
}());
[]() { return MakeSupportedSchemes(CefContext::Get()->settings()); }());
return *schemes;
}

View File

@@ -47,6 +47,32 @@ void ViewTextCallback(CefRefPtr<CefFrameHostImpl> frame,
}
}
using CefFrameHostImplCommand = void (CefFrameHostImpl::*)();
using WebContentsCommand = void (content::WebContents::*)();
void ExecWebContentsCommand(CefFrameHostImpl* fh,
CefFrameHostImplCommand fh_func,
WebContentsCommand wc_func,
const std::string& command) {
if (!CEF_CURRENTLY_ON_UIT()) {
CEF_POST_TASK(CEF_UIT, base::BindOnce(fh_func, fh));
return;
}
auto rfh = fh->GetRenderFrameHost();
if (rfh) {
auto web_contents = content::WebContents::FromRenderFrameHost(rfh);
if (web_contents) {
std::invoke(wc_func, web_contents);
return;
}
}
fh->SendCommand(command);
}
#define EXEC_WEBCONTENTS_COMMAND(name) \
ExecWebContentsCommand(this, &CefFrameHostImpl::name, \
&content::WebContents::name, #name);
} // namespace
CefFrameHostImpl::CefFrameHostImpl(scoped_refptr<CefBrowserInfo> browser_info,
@@ -93,31 +119,31 @@ bool CefFrameHostImpl::IsValid() {
}
void CefFrameHostImpl::Undo() {
SendCommand("Undo");
EXEC_WEBCONTENTS_COMMAND(Undo);
}
void CefFrameHostImpl::Redo() {
SendCommand("Redo");
EXEC_WEBCONTENTS_COMMAND(Redo);
}
void CefFrameHostImpl::Cut() {
SendCommand("Cut");
EXEC_WEBCONTENTS_COMMAND(Cut);
}
void CefFrameHostImpl::Copy() {
SendCommand("Copy");
EXEC_WEBCONTENTS_COMMAND(Copy);
}
void CefFrameHostImpl::Paste() {
SendCommand("Paste");
EXEC_WEBCONTENTS_COMMAND(Paste);
}
void CefFrameHostImpl::Delete() {
SendCommand("Delete");
EXEC_WEBCONTENTS_COMMAND(Delete);
}
void CefFrameHostImpl::SelectAll() {
SendCommand("SelectAll");
EXEC_WEBCONTENTS_COMMAND(SelectAll);
}
void CefFrameHostImpl::ViewSource() {
@@ -304,6 +330,13 @@ void CefFrameHostImpl::RefreshAttributes() {
}
}
void CefFrameHostImpl::NotifyMoveOrResizeStarted() {
SendToRenderFrame(__FUNCTION__,
base::BindOnce([](const RenderFrameType& render_frame) {
render_frame->MoveOrResizeStarted();
}));
}
void CefFrameHostImpl::LoadRequest(cef::mojom::RequestParamsPtr params) {
if (!url_util::FixupGURL(params->url)) {
return;

View File

@@ -82,6 +82,10 @@ class CefFrameHostImpl : public CefFrame, public cef::mojom::BrowserFrame {
void SetFocused(bool focused);
void RefreshAttributes();
// Notification that a move or resize of the renderer's containing window has
// started. Used on Windows and Linux with the Alloy runtime.
void NotifyMoveOrResizeStarted();
// Load the specified request.
void LoadRequest(cef::mojom::RequestParamsPtr params);

View File

@@ -216,6 +216,12 @@ gfx::Vector2d CefBrowserPlatformDelegateNativeAura::GetUiWheelEventOffset(
return gfx::Vector2d(deltaX, deltaY);
}
base::OnceClosure
CefBrowserPlatformDelegateNativeAura::GetWidgetDeleteCallback() {
return base::BindOnce(&CefBrowserPlatformDelegateNativeAura::WidgetDeleted,
weak_ptr_factory_.GetWeakPtr());
}
// static
base::TimeTicks CefBrowserPlatformDelegateNativeAura::GetEventTimeStamp() {
return base::TimeTicks::Now();
@@ -279,6 +285,11 @@ int CefBrowserPlatformDelegateNativeAura::TranslateUiChangedButtonFlags(
return result;
}
void CefBrowserPlatformDelegateNativeAura::WidgetDeleted() {
DCHECK(window_widget_);
window_widget_ = nullptr;
}
content::RenderWidgetHostViewAura*
CefBrowserPlatformDelegateNativeAura::GetHostView() const {
if (!web_contents_) {

View File

@@ -7,6 +7,7 @@
#include "libcef/browser/native/browser_platform_delegate_native.h"
#include "base/memory/weak_ptr.h"
#include "ui/events/event.h"
namespace content {
@@ -71,6 +72,8 @@ class CefBrowserPlatformDelegateNativeAura
virtual gfx::Vector2d GetUiWheelEventOffset(int deltaX, int deltaY) const;
protected:
base::OnceClosure GetWidgetDeleteCallback();
static base::TimeTicks GetEventTimeStamp();
static int TranslateUiEventModifiers(uint32 cef_modifiers);
static int TranslateUiChangedButtonFlags(uint32 cef_modifiers);
@@ -80,7 +83,14 @@ class CefBrowserPlatformDelegateNativeAura
views::Widget* window_widget_ = nullptr;
private:
// Will only be called if the Widget is deleted before
// CefBrowserHostBase::DestroyBrowser() is called.
void WidgetDeleted();
content::RenderWidgetHostViewAura* GetHostView() const;
base::WeakPtrFactory<CefBrowserPlatformDelegateNativeAura> weak_ptr_factory_{
this};
};
#endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_AURA_H_

View File

@@ -16,14 +16,14 @@
#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
#include "ui/events/keycodes/dom/dom_key.h"
#include "ui/events/keycodes/dom/keycode_converter.h"
#include "ui/events/keycodes/keyboard_code_conversion_x.h"
#include "ui/events/keycodes/keyboard_code_conversion_xkb.h"
#include "ui/events/keycodes/keysym_to_unicode.h"
#include "ui/gfx/font_render_params.h"
#include "ui/views/widget/widget.h"
#if BUILDFLAG(OZONE_PLATFORM_X11)
#include "libcef/browser/native/window_x11.h"
#include "ui/events/keycodes/keyboard_code_conversion_x.h"
#include "ui/events/keycodes/keyboard_code_conversion_xkb.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
#endif
@@ -79,7 +79,7 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
CefWindowDelegateView* delegate_view = new CefWindowDelegateView(
GetBackgroundColor(), window_x11_->TopLevelAlwaysOnTop(),
GetBoundsChangedCallback());
GetBoundsChangedCallback(), GetWidgetDeleteCallback());
delegate_view->Init(static_cast<gfx::AcceleratedWidget>(window_info_.window),
web_contents_, gfx::Rect(gfx::Point(), rect.size()));
@@ -251,9 +251,15 @@ ui::KeyEvent CefBrowserPlatformDelegateNativeLinux::TranslateUiKeyEvent(
static_cast<ui::KeyboardCode>(key_event.windows_key_code);
ui::DomCode dom_code =
ui::KeycodeConverter::NativeKeycodeToDomCode(key_event.native_key_code);
#if BUILDFLAG(OZONE_PLATFORM_X11)
int keysym = ui::XKeysymForWindowsKeyCode(
key_code, !!(key_event.modifiers & EVENTFLAG_SHIFT_DOWN));
char16_t character = ui::GetUnicodeCharacterFromXKeySym(keysym);
#else
char16_t character = key_event.character;
#endif
base::TimeTicks time_stamp = GetEventTimeStamp();
if (key_event.type == KEYEVENT_CHAR) {
@@ -273,7 +279,12 @@ ui::KeyEvent CefBrowserPlatformDelegateNativeLinux::TranslateUiKeyEvent(
NOTREACHED();
}
#if BUILDFLAG(OZONE_PLATFORM_X11)
ui::DomKey dom_key = ui::XKeySymToDomKey(keysym, character);
#else
ui::DomKey dom_key = ui::DomKey::NONE;
#endif
return ui::KeyEvent(type, key_code, dom_code, flags, dom_key, time_stamp);
}

View File

@@ -284,7 +284,8 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
(top_level_window_ex_styles & WS_EX_TOPMOST) == WS_EX_TOPMOST;
CefWindowDelegateView* delegate_view = new CefWindowDelegateView(
GetBackgroundColor(), always_on_top, GetBoundsChangedCallback());
GetBackgroundColor(), always_on_top, GetBoundsChangedCallback(),
GetWidgetDeleteCallback());
delegate_view->Init(window_info_.window, web_contents_,
gfx::Rect(0, 0, dip_rect.width(), dip_rect.height()));
@@ -702,4 +703,4 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
}

View File

@@ -15,11 +15,12 @@
CefWindowDelegateView::CefWindowDelegateView(
SkColor background_color,
bool always_on_top,
base::RepeatingClosure on_bounds_changed)
base::RepeatingClosure on_bounds_changed,
base::OnceClosure on_delete)
: background_color_(background_color),
web_view_(nullptr),
always_on_top_(always_on_top),
on_bounds_changed_(on_bounds_changed) {}
on_bounds_changed_(std::move(on_bounds_changed)),
on_delete_(std::move(on_delete)) {}
void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
content::WebContents* web_contents,
@@ -64,6 +65,10 @@ void CefWindowDelegateView::Init(gfx::AcceleratedWidget parent_widget,
DCHECK(widget->is_top_level());
// |widget| must be activatable for focus handling to work correctly.
DCHECK(widget->widget_delegate()->CanActivate());
// WidgetDelegate::DeleteDelegate() will execute the registered callback.
RegisterDeleteDelegateCallback(base::BindOnce(
&CefWindowDelegateView::DeleteDelegate, base::Unretained(this)));
}
void CefWindowDelegateView::InitContent() {
@@ -72,6 +77,12 @@ void CefWindowDelegateView::InitContent() {
AddChildView(web_view_);
}
void CefWindowDelegateView::DeleteDelegate() {
if (!on_delete_.is_null()) {
std::move(on_delete_).Run();
}
}
void CefWindowDelegateView::ViewHierarchyChanged(
const views::ViewHierarchyChangedDetails& details) {
if (details.is_add && details.child == this) {

View File

@@ -22,7 +22,8 @@ class CefWindowDelegateView : public views::WidgetDelegateView {
public:
CefWindowDelegateView(SkColor background_color,
bool always_on_top,
base::RepeatingClosure on_bounds_changed);
base::RepeatingClosure on_bounds_changed,
base::OnceClosure on_delete);
CefWindowDelegateView(const CefWindowDelegateView&) = delete;
CefWindowDelegateView& operator=(const CefWindowDelegateView&) = delete;
@@ -36,6 +37,8 @@ class CefWindowDelegateView : public views::WidgetDelegateView {
// Initialize the Widget's content.
void InitContent();
void DeleteDelegate();
// WidgetDelegateView methods:
bool CanMaximize() const override { return true; }
View* GetContentsView() override { return this; }
@@ -46,10 +49,12 @@ class CefWindowDelegateView : public views::WidgetDelegateView {
void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
private:
SkColor background_color_;
views::WebView* web_view_;
bool always_on_top_;
const SkColor background_color_;
const bool always_on_top_;
base::RepeatingClosure on_bounds_changed_;
base::OnceClosure on_delete_;
views::WebView* web_view_ = nullptr;
};
#endif // CEF_LIBCEF_BROWSER_NATIVE_WINDOW_DELEGATE_VIEW_H_

View File

@@ -30,6 +30,7 @@
#include "base/values.h"
#include "cef/grit/cef_resources.h"
#include "chrome/browser/browser_about_handler.h"
#include "chrome/browser/devtools/devtools_ui_bindings.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_untrusted_web_ui_configs.h"
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
@@ -534,6 +535,11 @@ class CefWebUIControllerFactory : public content::WebUIControllerFactory {
// Returns true if WebUI is allowed to handle the specified |url|.
static bool AllowWebUIForURL(const GURL& url) {
if (cef::IsChromeRuntimeEnabled() &&
url.SchemeIs(content::kChromeDevToolsScheme)) {
return DevToolsUIBindings::IsValidFrontendURL(url);
}
if (!url.SchemeIs(content::kChromeUIScheme) &&
!url.SchemeIs(content::kChromeUIUntrustedScheme)) {
return false;

View File

@@ -1079,6 +1079,7 @@ void CefRenderWidgetHostViewOSR::SynchronizeVisualProperties(
void CefRenderWidgetHostViewOSR::OnScreenInfoChanged() {
TRACE_EVENT0("cef", "CefRenderWidgetHostViewOSR::OnScreenInfoChanged");
InvalidateLocalSurfaceId();
if (!render_widget_host_) {
return;
}

View File

@@ -47,9 +47,9 @@ namespace {
// The following plugin-related methods are from
// chrome/common/chrome_content_client.cc
const char kPDFPluginExtension[] = "pdf";
const char kPDFPluginDescription[] = "Portable Document Format";
const uint32_t kPDFPluginPermissions =
constexpr char kPDFPluginExtension[] = "pdf";
constexpr char kPDFPluginDescription[] = "Portable Document Format";
constexpr uint32_t kPDFPluginPermissions =
ppapi::PERMISSION_PDF | ppapi::PERMISSION_DEV;
// Appends the known built-in plugins to the given vector. Some built-in
@@ -64,7 +64,7 @@ void ComputeBuiltInPlugins(std::vector<content::ContentPluginInfo>* plugins) {
pdf_info.is_out_of_process = true;
pdf_info.name = ChromeContentClient::kPDFInternalPluginName;
pdf_info.description = kPDFPluginDescription;
pdf_info.path = base::FilePath(ChromeContentClient::kPDFPluginPath);
pdf_info.path = base::FilePath(ChromeContentClient::kPDFInternalPluginPath);
content::WebPluginMimeType pdf_mime_type(pdf::kInternalPluginMimeType,
kPDFPluginExtension,
kPDFPluginDescription);

View File

@@ -19,7 +19,9 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/threading/threading_features.h"
#include "chrome/browser/metrics/chrome_feature_list_creator.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/embedder_support/switches.h"
#include "content/public/common/content_switches.h"
#include "sandbox/policy/switches.h"
@@ -204,6 +206,27 @@ absl::optional<int> ChromeMainDelegateCef::PreBrowserMain() {
return absl::nullopt;
}
absl::optional<int> ChromeMainDelegateCef::PostEarlyInitialization(
InvokedIn invoked_in) {
const auto result = ChromeMainDelegate::PostEarlyInitialization(invoked_in);
if (!result) {
const auto* invoked_in_browser =
absl::get_if<InvokedInBrowserProcess>(&invoked_in);
if (invoked_in_browser) {
// At this point local_state has been created but ownership has not yet
// been passed to BrowserProcessImpl (g_browser_process is nullptr).
auto* local_state = chrome_content_browser_client_->startup_data()
->chrome_feature_list_creator()
->local_state();
// Don't show the profile picker on startup (see issue #3440).
local_state->SetBoolean(prefs::kBrowserShowProfilePickerOnStartup, false);
}
}
return result;
}
absl::variant<int, content::MainFunctionParams>
ChromeMainDelegateCef::RunProcess(
const std::string& process_type,

View File

@@ -39,6 +39,7 @@ class ChromeMainDelegateCef : public ChromeMainDelegate,
absl::optional<int> BasicStartupComplete() override;
void PreSandboxStartup() override;
absl::optional<int> PreBrowserMain() override;
absl::optional<int> PostEarlyInitialization(InvokedIn invoked_in) override;
absl::variant<int, content::MainFunctionParams> RunProcess(
const std::string& process_type,
content::MainFunctionParams main_function_params) override;

View File

@@ -79,6 +79,10 @@ interface RenderFrame {
// Loading has stopped.
DidStopLoading();
// Move or resize of the renderer's containing window has started. Used on
// Windows and Linux with the Alloy runtime.
MoveOrResizeStarted();
};
// Interface for communicating with a frame in the browser process.

View File

@@ -832,6 +832,14 @@ void CefFrameImpl::DidStopLoading() {
}
}
void CefFrameImpl::MoveOrResizeStarted() {
if (frame_) {
auto web_view = frame_->View();
if (web_view)
web_view->CancelPagePopup();
}
}
void CefFrameImpl::ContextLifecycleStateChanged(
blink::mojom::blink::FrameLifecycleState state) {
if (state == blink::mojom::FrameLifecycleState::kFrozen && IsMain() &&

View File

@@ -162,6 +162,7 @@ class CefFrameImpl
int32_t startLine) override;
void LoadRequest(cef::mojom::RequestParamsPtr params) override;
void DidStopLoading() override;
void MoveOrResizeStarted() override;
// blink_glue::CefExecutionContextLifecycleStateObserver methods:
void ContextLifecycleStateChanged(

View File

@@ -295,7 +295,8 @@ class V8TrackObject : public CefTrackNode {
static V8TrackObject* Unwrap(v8::Local<v8::Context> context,
v8::Local<v8::Object> object) {
v8::Local<v8::Value> value;
if (GetPrivate(context, object, kCefTrackObject, &value)) {
if (GetPrivate(context, object, kCefTrackObject, &value) &&
value->IsExternal()) {
return static_cast<V8TrackObject*>(v8::External::Cast(*value)->Value());
}
@@ -351,7 +352,8 @@ class V8TrackArrayBuffer : public CefTrackNode {
static V8TrackArrayBuffer* Unwrap(v8::Local<v8::Context> context,
v8::Local<v8::Object> object) {
v8::Local<v8::Value> value;
if (GetPrivate(context, object, kCefTrackObject, &value)) {
if (GetPrivate(context, object, kCefTrackObject, &value) &&
value->IsExternal()) {
return static_cast<V8TrackArrayBuffer*>(
v8::External::Cast(*value)->Value());
}

View File

@@ -380,11 +380,14 @@ patches = [
'name': 'build',
},
{
# Changes necessary to support for chrome extensions. Add a new
# Changes necessary to support chrome extensions. Add a new
# ExtensionHost constructor that allows CEF to create the WebContents.
# https://bitbucket.org/chromiumembedded/cef/issues/1947
#
# Don't initialize PrerenderContents object in StreamsPrivateAPI.
#
# Return nullptr from ExtensionsClient::Get and ExtensionRegistry::Get
# when extensions are disabled.
'name': 'extensions_1947',
},
{
@@ -438,6 +441,9 @@ patches = [
# - Fix cache directory structure ("C:\temp\cache\cache\Cache" should be
# "C:\temp\cache\Cache").
# https://bitbucket.org/chromiumembedded/cef/issues/2622
#
# alloy: Avoid initialization of privacy sandbox and identity manager.
# https://bitbucket.org/chromiumembedded/cef/issues/3434
'name': 'services_network_2622',
},
{

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
index d7c913bdfe3b5..7443d705d634c 100644
index 21547000bf909..e3fffe5969cf5 100644
--- chrome/browser/BUILD.gn
+++ chrome/browser/BUILD.gn
@@ -11,6 +11,7 @@ import("//build/config/compiler/pgo/pgo.gni")
@@ -18,7 +18,7 @@ index d7c913bdfe3b5..7443d705d634c 100644
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -2529,6 +2531,10 @@ static_library("browser") {
@@ -2531,6 +2533,10 @@ static_library("browser") {
]
}
@@ -29,7 +29,7 @@ index d7c913bdfe3b5..7443d705d634c 100644
if (is_android) {
sources += [
"after_startup_task_utils_android.cc",
@@ -6375,8 +6381,6 @@ static_library("browser") {
@@ -6376,8 +6382,6 @@ static_library("browser") {
sources += [
"enterprise/chrome_browser_main_extra_parts_enterprise.cc",
"enterprise/chrome_browser_main_extra_parts_enterprise.h",

View File

@@ -13,7 +13,7 @@ index 2ffda8141468b..1800b34155201 100644
return false;
}
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
index 932388c328889..68103c2a8ffcf 100644
index 8a5a38442d6e3..0c2e22e17197b 100644
--- chrome/browser/ui/BUILD.gn
+++ chrome/browser/ui/BUILD.gn
@@ -9,6 +9,7 @@ import("//build/config/compiler/compiler.gni")
@@ -43,7 +43,7 @@ index 932388c328889..68103c2a8ffcf 100644
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -5727,6 +5733,7 @@ static_library("ui") {
@@ -5728,6 +5734,7 @@ static_library("ui") {
if (enable_printing) {
deps += [
"//components/printing/browser",
@@ -52,7 +52,7 @@ index 932388c328889..68103c2a8ffcf 100644
]
}
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
index a839ea0969600..b92b5a30ec2e1 100644
index 5f4092a34b160..344c890310f5d 100644
--- chrome/browser/ui/browser.cc
+++ chrome/browser/ui/browser.cc
@@ -265,6 +265,25 @@
@@ -81,7 +81,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/extension_browser_window_helper.h"
#endif
@@ -508,6 +527,13 @@ Browser::Browser(const CreateParams& params)
@@ -511,6 +530,13 @@ Browser::Browser(const CreateParams& params)
tab_strip_model_->AddObserver(this);
@@ -95,7 +95,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
location_bar_model_ = std::make_unique<LocationBarModelImpl>(
location_bar_model_delegate_.get(), content::kMaxURLDisplayChars);
@@ -645,6 +671,12 @@ Browser::~Browser() {
@@ -648,6 +674,12 @@ Browser::~Browser() {
// away so they don't try and call back to us.
if (select_file_dialog_.get())
select_file_dialog_->ListenerDestroyed();
@@ -108,7 +108,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
}
///////////////////////////////////////////////////////////////////////////////
@@ -1337,6 +1369,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
@@ -1340,6 +1372,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
if (exclusive_access_manager_->HandleUserKeyEvent(event))
return content::KeyboardEventProcessingResult::HANDLED;
@@ -123,7 +123,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
return window()->PreHandleKeyboardEvent(event);
}
@@ -1344,8 +1384,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
@@ -1347,8 +1387,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
const NativeWebKeyboardEvent& event) {
DevToolsWindow* devtools_window =
DevToolsWindow::GetInstanceForInspectedWebContents(source);
@@ -144,7 +144,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
}
bool Browser::TabsNeedBeforeUnloadFired() {
@@ -1554,6 +1604,14 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
@@ -1557,6 +1607,14 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
return window->OpenURLFromTab(source, params);
}
@@ -159,7 +159,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
NavigateParams nav_params(this, params.url, params.transition);
nav_params.FillNavigateParamsFromOpenURLParams(params);
nav_params.source_contents = source;
@@ -1684,6 +1742,15 @@ void Browser::AddNewContents(
@@ -1694,6 +1752,15 @@ void Browser::AddNewContents(
return;
}
@@ -175,7 +175,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
chrome::AddWebContents(this, source, std::move(new_contents), target_url,
disposition, window_features, window_action);
}
@@ -1702,6 +1769,8 @@ void Browser::LoadingStateChanged(WebContents* source,
@@ -1712,6 +1779,8 @@ void Browser::LoadingStateChanged(WebContents* source,
bool should_show_loading_ui) {
ScheduleUIUpdate(source, content::INVALIDATE_TYPE_LOAD);
UpdateWindowForLoadingStateChanged(source, should_show_loading_ui);
@@ -184,7 +184,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
}
void Browser::CloseContents(WebContents* source) {
@@ -1729,6 +1798,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
@@ -1739,6 +1808,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
}
void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -193,7 +193,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
if (!GetStatusBubble())
return;
@@ -1736,6 +1807,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -1746,6 +1817,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
GetStatusBubble()->SetURL(url);
}
@@ -211,7 +211,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
void Browser::ContentsMouseEvent(WebContents* source,
bool motion,
bool exited) {
@@ -1760,6 +1842,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
@@ -1770,6 +1852,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
return false;
}
@@ -231,7 +231,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
void Browser::BeforeUnloadFired(WebContents* web_contents,
bool proceed,
bool* proceed_to_fire_unload) {
@@ -1852,6 +1947,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
@@ -1862,6 +1957,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
// Make the tab show up in the task manager.
task_manager::WebContentsTags::CreateForTabContents(new_contents);
@@ -242,7 +242,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
}
void Browser::PortalWebContentsCreated(WebContents* portal_web_contents) {
@@ -1896,6 +1995,8 @@ void Browser::RendererResponsive(
@@ -1906,6 +2005,8 @@ void Browser::RendererResponsive(
void Browser::DidNavigatePrimaryMainFramePostCommit(WebContents* web_contents) {
if (web_contents == tab_strip_model_->GetActiveWebContents())
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE);
@@ -251,7 +251,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
}
content::JavaScriptDialogManager* Browser::GetJavaScriptDialogManager(
@@ -1956,11 +2057,15 @@ void Browser::EnterFullscreenModeForTab(
@@ -1966,11 +2067,15 @@ void Browser::EnterFullscreenModeForTab(
const blink::mojom::FullscreenOptions& options) {
exclusive_access_manager_->fullscreen_controller()->EnterFullscreenModeForTab(
requesting_frame, options.display_id);
@@ -267,7 +267,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
}
bool Browser::IsFullscreenForTabOrPending(const WebContents* web_contents) {
@@ -2159,6 +2264,15 @@ void Browser::RequestMediaAccessPermission(
@@ -2169,6 +2274,15 @@ void Browser::RequestMediaAccessPermission(
content::WebContents* web_contents,
const content::MediaStreamRequest& request,
content::MediaResponseCallback callback) {
@@ -283,7 +283,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
const extensions::Extension* extension =
GetExtensionForOrigin(profile_, request.security_origin);
MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
@@ -2695,13 +2809,20 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
@@ -2705,13 +2819,20 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
// Browser, Getters for UI (private):
StatusBubble* Browser::GetStatusBubble() {
@@ -305,7 +305,7 @@ index a839ea0969600..b92b5a30ec2e1 100644
return window_ ? window_->GetStatusBubble() : nullptr;
}
@@ -2831,6 +2952,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
@@ -2841,6 +2962,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
content_translate_driver->RemoveTranslationObserver(this);
BookmarkTabHelper::FromWebContents(web_contents)->RemoveObserver(this);
}

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/file_select_helper.cc chrome/browser/file_select_helper.cc
index ec9d8e38dd4ba..56ed3f097843c 100644
index d61d8e29d9015..00a923e6fda8a 100644
--- chrome/browser/file_select_helper.cc
+++ chrome/browser/file_select_helper.cc
@@ -20,6 +20,7 @@
@@ -37,7 +37,7 @@ index ec9d8e38dd4ba..56ed3f097843c 100644
#if BUILDFLAG(FULL_SAFE_BROWSING)
enterprise_connectors::ContentAnalysisDelegate::Data data;
if (enterprise_connectors::ContentAnalysisDelegate::IsEnabled(
@@ -528,7 +542,8 @@ bool FileSelectHelper::IsDirectoryEnumerationStartedForTesting() {
@@ -529,7 +543,8 @@ bool FileSelectHelper::IsDirectoryEnumerationStartedForTesting() {
std::unique_ptr<ui::SelectFileDialog::FileTypeInfo>
FileSelectHelper::GetFileTypesFromAcceptType(
@@ -47,7 +47,7 @@ index ec9d8e38dd4ba..56ed3f097843c 100644
auto base_file_type = std::make_unique<ui::SelectFileDialog::FileTypeInfo>();
if (accept_types.empty())
return base_file_type;
@@ -541,17 +556,24 @@ FileSelectHelper::GetFileTypesFromAcceptType(
@@ -542,17 +557,24 @@ FileSelectHelper::GetFileTypesFromAcceptType(
std::vector<base::FilePath::StringType>* extensions =
&file_type->extensions.back();
@@ -73,7 +73,7 @@ index ec9d8e38dd4ba..56ed3f097843c 100644
} else {
if (!base::IsStringASCII(accept_type))
continue;
@@ -562,10 +584,18 @@ FileSelectHelper::GetFileTypesFromAcceptType(
@@ -563,10 +585,18 @@ FileSelectHelper::GetFileTypesFromAcceptType(
description_id = IDS_AUDIO_FILES;
else if (ascii_type == "video/*")
description_id = IDS_VIDEO_FILES;
@@ -94,7 +94,7 @@ index ec9d8e38dd4ba..56ed3f097843c 100644
if (extensions->size() > old_extension_size)
valid_type_count++;
}
@@ -590,6 +620,15 @@ FileSelectHelper::GetFileTypesFromAcceptType(
@@ -591,6 +621,15 @@ FileSelectHelper::GetFileTypesFromAcceptType(
l10n_util::GetStringUTF16(description_id));
}
@@ -110,7 +110,7 @@ index ec9d8e38dd4ba..56ed3f097843c 100644
return file_type;
}
@@ -597,7 +636,8 @@ FileSelectHelper::GetFileTypesFromAcceptType(
@@ -598,7 +637,8 @@ FileSelectHelper::GetFileTypesFromAcceptType(
void FileSelectHelper::RunFileChooser(
content::RenderFrameHost* render_frame_host,
scoped_refptr<content::FileSelectListener> listener,
@@ -120,7 +120,7 @@ index ec9d8e38dd4ba..56ed3f097843c 100644
Profile* profile = Profile::FromBrowserContext(
render_frame_host->GetProcess()->GetBrowserContext());
@@ -616,6 +656,7 @@ void FileSelectHelper::RunFileChooser(
@@ -617,6 +657,7 @@ void FileSelectHelper::RunFileChooser(
// message.
scoped_refptr<FileSelectHelper> file_select_helper(
new FileSelectHelper(profile));
@@ -128,7 +128,7 @@ index ec9d8e38dd4ba..56ed3f097843c 100644
file_select_helper->RunFileChooser(render_frame_host, std::move(listener),
params.Clone());
}
@@ -669,7 +710,8 @@ void FileSelectHelper::RunFileChooser(
@@ -670,7 +711,8 @@ void FileSelectHelper::RunFileChooser(
}
void FileSelectHelper::GetFileTypesInThreadPool(FileChooserParamsPtr params) {
@@ -139,7 +139,7 @@ index ec9d8e38dd4ba..56ed3f097843c 100644
params->need_local_path ? ui::SelectFileDialog::FileTypeInfo::NATIVE_PATH
: ui::SelectFileDialog::FileTypeInfo::ANY_PATH;
diff --git chrome/browser/file_select_helper.h chrome/browser/file_select_helper.h
index bacd6fd957dba..eabb9b6af35a4 100644
index d4b49202f61ce..4813ec70d9b1b 100644
--- chrome/browser/file_select_helper.h
+++ chrome/browser/file_select_helper.h
@@ -65,7 +65,8 @@ class FileSelectHelper : public base::RefCountedThreadSafe<
@@ -152,7 +152,7 @@ index bacd6fd957dba..eabb9b6af35a4 100644
// Enumerates all the files in directory.
static void EnumerateDirectory(
@@ -293,7 +294,8 @@ class FileSelectHelper : public base::RefCountedThreadSafe<
@@ -296,7 +297,8 @@ class FileSelectHelper : public base::RefCountedThreadSafe<
// |accept_types| contains only valid lowercased MIME types or file extensions
// beginning with a period (.).
static std::unique_ptr<ui::SelectFileDialog::FileTypeInfo>
@@ -162,7 +162,7 @@ index bacd6fd957dba..eabb9b6af35a4 100644
// Check the accept type is valid. It is expected to be all lower case with
// no whitespace.
@@ -358,6 +360,9 @@ class FileSelectHelper : public base::RefCountedThreadSafe<
@@ -361,6 +363,9 @@ class FileSelectHelper : public base::RefCountedThreadSafe<
// Set to false in unit tests since there is no WebContents.
bool abort_on_missing_web_contents_in_tests_ = true;

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/extensions/api/chrome_extensions_api_client.cc chrome/browser/extensions/api/chrome_extensions_api_client.cc
index 2b64f15504dcb..06a70c70738cd 100644
index 2b64f15504dcb..7c65f1b0d8baa 100644
--- chrome/browser/extensions/api/chrome_extensions_api_client.cc
+++ chrome/browser/extensions/api/chrome_extensions_api_client.cc
@@ -13,6 +13,7 @@
@@ -21,13 +21,15 @@ index 2b64f15504dcb..06a70c70738cd 100644
#if BUILDFLAG(ENABLE_PDF)
#include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h"
#include "components/pdf/browser/pdf_web_contents_helper.h"
@@ -305,6 +310,9 @@ ChromeExtensionsAPIClient::CreateGuestViewManagerDelegate(
@@ -305,6 +310,11 @@ ChromeExtensionsAPIClient::CreateGuestViewManagerDelegate(
std::unique_ptr<MimeHandlerViewGuestDelegate>
ChromeExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
MimeHandlerViewGuest* guest) const {
+#if BUILDFLAG(ENABLE_CEF)
+ if (cef::IsChromeRuntimeEnabled()) {
+ return std::make_unique<ChromeMimeHandlerViewGuestDelegateCef>(guest);
+ }
+#endif
return std::make_unique<ChromeMimeHandlerViewGuestDelegate>();
}

View File

@@ -85,10 +85,10 @@ index d90969cd9478c..9cf454be330ce 100644
virtual bool IsSignedIn() = 0;
diff --git chrome/browser/profiles/profile_impl.cc chrome/browser/profiles/profile_impl.cc
index a2a12efa89104..9865a2349490a 100644
index 0e17f238a710c..7575de124de5b 100644
--- chrome/browser/profiles/profile_impl.cc
+++ chrome/browser/profiles/profile_impl.cc
@@ -1012,7 +1012,9 @@ Profile* ProfileImpl::GetOffTheRecordProfile(const OTRProfileID& otr_profile_id,
@@ -1011,7 +1011,9 @@ Profile* ProfileImpl::GetOffTheRecordProfile(const OTRProfileID& otr_profile_id,
otr_profiles_[otr_profile_id] = std::move(otr_profile);

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/safe_browsing/BUILD.gn chrome/browser/safe_browsing/BUILD.gn
index 1197ad7d00986..0174e5e2b76d5 100644
index beea11b13d215..d49a142059a0c 100644
--- chrome/browser/safe_browsing/BUILD.gn
+++ chrome/browser/safe_browsing/BUILD.gn
@@ -30,6 +30,7 @@ static_library("safe_browsing") {

View File

@@ -1,131 +1,48 @@
diff --git chrome/browser/plugins/plugin_info_host_impl.cc chrome/browser/plugins/plugin_info_host_impl.cc
index 7ceb1d7b854d9..5efcb8c09058c 100644
index 7b12e246839a4..b29450cc2285a 100644
--- chrome/browser/plugins/plugin_info_host_impl.cc
+++ chrome/browser/plugins/plugin_info_host_impl.cc
@@ -16,6 +16,7 @@
#include "base/strings/utf_string_conversions.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
+#include "cef/libcef/features/runtime.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/plugins/chrome_plugin_service_filter.h"
@@ -50,6 +51,10 @@
#include "url/gurl.h"
#include "url/origin.h"
+#if BUILDFLAG(ENABLE_CEF)
+#include "cef/libcef/common/extensions/extensions_util.h"
+#endif
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "components/guest_view/browser/guest_view_base.h"
#include "extensions/browser/extension_registry.h"
@@ -135,6 +140,9 @@ bool IsPluginLoadingAccessibleResourceInWebView(
@@ -142,6 +142,10 @@ bool IsPluginLoadingAccessibleResourceInWebView(
extensions::ExtensionRegistry* extension_registry,
int process_id,
const GURL& resource) {
+ // May be nullptr if using CEF Alloy with extensions disabled.
+ if (!extension_registry)
+ return false;
+
extensions::WebViewRendererState* renderer_state =
extensions::WebViewRendererState::GetInstance();
std::string partition_id;
@@ -163,14 +171,18 @@ bool IsPluginLoadingAccessibleResourceInWebView(
PluginInfoHostImpl::Context::Context(int render_process_id, Profile* profile)
: render_process_id_(render_process_id),
-#if BUILDFLAG(ENABLE_EXTENSIONS)
- extension_registry_(extensions::ExtensionRegistry::Get(profile)),
-#endif
host_content_settings_map_(
HostContentSettingsMapFactory::GetForProfile(profile)),
plugin_prefs_(PluginPrefs::GetForProfile(profile)) {
allow_outdated_plugins_.Init(prefs::kPluginsAllowOutdated,
profile->GetPrefs());
+
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+#if BUILDFLAG(ENABLE_CEF)
+ if (!cef::IsAlloyRuntimeEnabled() || extensions::ExtensionsEnabled())
+#endif
+ extension_registry_ = extensions::ExtensionRegistry::Get(profile);
+#endif
}
PluginInfoHostImpl::Context::~Context() {}
diff --git chrome/browser/plugins/plugin_utils.cc chrome/browser/plugins/plugin_utils.cc
index 8b3f569882aeb..ae0c4aa9a0514 100644
index 8b3f569882aeb..afc8007a6228b 100644
--- chrome/browser/plugins/plugin_utils.cc
+++ chrome/browser/plugins/plugin_utils.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/plugins/plugin_utils.h"
#include "base/values.h"
+#include "cef/libcef/features/runtime.h"
#include "chrome/browser/profiles/profile.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/content_settings/core/common/content_settings_types.h"
@@ -14,6 +15,10 @@
#include "url/gurl.h"
#include "url/origin.h"
+#if BUILDFLAG(ENABLE_CEF)
+#include "cef/libcef/common/extensions/extensions_util.h"
+#endif
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/chrome_content_browser_client_extensions_part.h"
#include "chrome/common/pref_names.h"
@@ -69,6 +74,12 @@ base::flat_map<std::string, std::string>
PluginUtils::GetMimeTypeToExtensionIdMap(
@@ -70,6 +70,13 @@ PluginUtils::GetMimeTypeToExtensionIdMap(
content::BrowserContext* browser_context) {
base::flat_map<std::string, std::string> mime_type_to_extension_id_map;
+
+#if BUILDFLAG(ENABLE_CEF)
+ if (cef::IsAlloyRuntimeEnabled() && !extensions::ExtensionsEnabled())
+ return mime_type_to_extension_id_map;
+#endif
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
+ // May be nullptr if using CEF Alloy with extensions disabled.
+ extensions::ExtensionRegistry* registry =
+ extensions::ExtensionRegistry::Get(browser_context);
+ if (!registry) {
+ return mime_type_to_extension_id_map;
+ }
+
Profile* profile = Profile::FromBrowserContext(browser_context);
if (extensions::ChromeContentBrowserClientExtensionsPart::
diff --git chrome/common/google_url_loader_throttle.cc chrome/common/google_url_loader_throttle.cc
index a29a2739af3c8..0feb1a87cef64 100644
--- chrome/common/google_url_loader_throttle.cc
+++ chrome/common/google_url_loader_throttle.cc
@@ -7,6 +7,7 @@
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "build/build_config.h"
+#include "cef/libcef/features/runtime.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/net/safe_search_util.h"
#include "components/google/core/common/google_util.h"
@@ -19,6 +20,10 @@
#include "ui/base/device_form_factor.h"
#endif
+#if BUILDFLAG(ENABLE_CEF)
+#include "cef/libcef/common/extensions/extensions_util.h"
+#endif
+
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "extensions/common/extension_urls.h"
#endif
@@ -158,6 +163,11 @@ void GoogleURLLoaderThrottle::WillProcessResponse(
const GURL& response_url,
network::mojom::URLResponseHead* response_head,
bool* defer) {
+#if BUILDFLAG(ENABLE_CEF)
+ if (cef::IsAlloyRuntimeEnabled() && !extensions::ExtensionsEnabled())
+ return;
+#endif
+
// Built-in additional protection for the chrome web store origin by ensuring
// that the X-Frame-Options protection mechanism is set to either DENY or
// SAMEORIGIN.
AreExtensionsDisabledForProfile(profile)) {
@@ -80,9 +87,6 @@ PluginUtils::GetMimeTypeToExtensionIdMap(
MimeTypesHandler::GetMIMETypeAllowlist();
// Go through the allowed extensions and try to use them to intercept
// the URL request.
- extensions::ExtensionRegistry* registry =
- extensions::ExtensionRegistry::Get(browser_context);
- DCHECK(registry);
for (const std::string& extension_id : allowlist) {
const extensions::Extension* extension =
registry->enabled_extensions().GetByID(extension_id);
diff --git chrome/renderer/chrome_content_renderer_client.cc chrome/renderer/chrome_content_renderer_client.cc
index 3d08b706ec4a0..7f4a0398e51f9 100644
index a800280bc057b..af108b1ec8c25 100644
--- chrome/renderer/chrome_content_renderer_client.cc
+++ chrome/renderer/chrome_content_renderer_client.cc
@@ -978,6 +978,7 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(

View File

@@ -102,7 +102,7 @@ index 49993fbc333f8..c39e8743e281e 100644
// content::ContentMainDelegate:
absl::optional<int> BasicStartupComplete() override;
diff --git chrome/browser/chrome_browser_main.cc chrome/browser/chrome_browser_main.cc
index 2893df3488d8f..46cd8d9643b69 100644
index 2893df3488d8f..4ad86fb7a2bb0 100644
--- chrome/browser/chrome_browser_main.cc
+++ chrome/browser/chrome_browser_main.cc
@@ -51,6 +51,7 @@
@@ -113,6 +113,24 @@ index 2893df3488d8f..46cd8d9643b69 100644
#include "chrome/browser/about_flags.h"
#include "chrome/browser/active_use_util.h"
#include "chrome/browser/after_startup_task_utils.h"
@@ -1475,7 +1476,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
}
#endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS_ASH)
-#if BUILDFLAG(ENABLE_PROCESS_SINGLETON)
+#if BUILDFLAG(ENABLE_PROCESS_SINGLETON) && !BUILDFLAG(ENABLE_CEF)
// Handle special early return paths (which couldn't be processed even earlier
// as they require the process singleton to be held) first.
@@ -1522,7 +1523,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
return content::RESULT_CODE_NORMAL_EXIT;
#endif // BUILDFLAG(IS_WIN)
}
-#endif // BUILDFLAG(ENABLE_PROCESS_SINGLETON)
+#endif // BUILDFLAG(ENABLE_PROCESS_SINGLETON) && !BUILDFLAG(ENABLE_CEF)
#if BUILDFLAG(IS_WIN)
// Check if there is any machine level Chrome installed on the current
@@ -1575,12 +1576,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
browser_process_->local_state());
}
@@ -128,37 +146,32 @@ index 2893df3488d8f..46cd8d9643b69 100644
#if BUILDFLAG(IS_ANDROID)
page_info::SetPageInfoClient(new ChromePageInfoClient());
@@ -1732,14 +1735,17 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
@@ -1729,6 +1732,10 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
}
#endif // BUILDFLAG(IS_CHROMEOS_ASH)
+ // Bypass StartupBrowserCreator and RunLoop creation with CEF.
+ // CEF with the Chrome runtime will create and manage its own RunLoop.
+#if !BUILDFLAG(ENABLE_CEF)
+
// This step is costly and is already measured in
// Startup.StartupBrowserCreator_Start.
// See the comment above for an explanation of |process_command_line|.
+ // Bypass StartupBrowserCreator with CEF where |GetMainRunLoopInstance()| is
+ // nullptr.
const bool started =
+ !GetMainRunLoopInstance() ||
#if BUILDFLAG(ENABLE_PROCESS_SINGLETON)
!process_command_line ||
#endif // BUILDFLAG(ENABLE_PROCESS_SINGLETON)
browser_creator_->Start(*base::CommandLine::ForCurrentProcess(),
base::FilePath(), profile_info,
last_opened_profiles);
- if (started) {
+ if (started && GetMainRunLoopInstance()) {
// TODO(crbug.com/1052397): Revisit the macro expression once build flag switch
// of lacros-chrome is complete.
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
@@ -1767,8 +1773,10 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
@@ -1767,11 +1774,14 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
// Create the RunLoop for MainMessageLoopRun() to use and transfer
// ownership of the browser's lifetime to the BrowserProcess.
+ // CEF with the Chrome runtime will create and manage its own RunLoop.
DCHECK(!GetMainRunLoopInstance());
- GetMainRunLoopInstance() = std::make_unique<base::RunLoop>();
+ if (!cef::IsChromeRuntimeEnabled())
+ GetMainRunLoopInstance() = std::make_unique<base::RunLoop>();
GetMainRunLoopInstance() = std::make_unique<base::RunLoop>();
browser_process_->SetQuitClosure(
GetMainRunLoopInstance()->QuitWhenIdleClosure());
}
+#endif // !BUILDFLAG(ENABLE_CEF)
+
browser_creator_.reset();
#endif // !BUILDFLAG(IS_ANDROID)
diff --git chrome/browser/chrome_browser_main_mac.mm chrome/browser/chrome_browser_main_mac.mm
index 77aaa6d46daea..e428711ec4ab3 100644
--- chrome/browser/chrome_browser_main_mac.mm
@@ -198,7 +211,7 @@ index 77aaa6d46daea..e428711ec4ab3 100644
+#endif
}
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
index 265904cb255f3..463cb5cad9713 100644
index 707b972e5ae23..8db3f4b0a0d2c 100644
--- chrome/browser/chrome_content_browser_client.cc
+++ chrome/browser/chrome_content_browser_client.cc
@@ -35,6 +35,7 @@
@@ -209,7 +222,7 @@ index 265904cb255f3..463cb5cad9713 100644
#include "chrome/browser/accessibility/accessibility_labels_service.h"
#include "chrome/browser/accessibility/accessibility_labels_service_factory.h"
#include "chrome/browser/after_startup_task_utils.h"
@@ -1503,6 +1504,8 @@ void HandleStringData(
@@ -1504,6 +1505,8 @@ void HandleStringData(
} // namespace
ChromeContentBrowserClient::ChromeContentBrowserClient() {
@@ -218,7 +231,7 @@ index 265904cb255f3..463cb5cad9713 100644
#if BUILDFLAG(ENABLE_PLUGINS)
extra_parts_.push_back(new ChromeContentBrowserClientPluginsPart);
#endif
@@ -1528,6 +1531,11 @@ ChromeContentBrowserClient::~ChromeContentBrowserClient() {
@@ -1529,6 +1532,11 @@ ChromeContentBrowserClient::~ChromeContentBrowserClient() {
extra_parts_.clear();
}
@@ -230,7 +243,7 @@ index 265904cb255f3..463cb5cad9713 100644
// static
void ChromeContentBrowserClient::RegisterLocalStatePrefs(
PrefRegistrySimple* registry) {
@@ -4242,9 +4250,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
@@ -4247,9 +4255,11 @@ void ChromeContentBrowserClient::BrowserURLHandlerCreated(
&search::HandleNewTabURLReverseRewrite);
#endif // BUILDFLAG(IS_ANDROID)
@@ -242,7 +255,7 @@ index 265904cb255f3..463cb5cad9713 100644
}
base::FilePath ChromeContentBrowserClient::GetDefaultDownloadDirectory() {
@@ -6110,7 +6120,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
@@ -6115,7 +6125,7 @@ void ChromeContentBrowserClient::OnNetworkServiceCreated(
network_service);
}
@@ -251,7 +264,7 @@ index 265904cb255f3..463cb5cad9713 100644
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -6128,6 +6138,8 @@ void ChromeContentBrowserClient::ConfigureNetworkContextParams(
@@ -6133,6 +6143,8 @@ void ChromeContentBrowserClient::ConfigureNetworkContextParams(
network_context_params->user_agent = GetUserAgentBasedOnPolicy(context);
network_context_params->accept_language = GetApplicationLocale();
}
@@ -260,7 +273,7 @@ index 265904cb255f3..463cb5cad9713 100644
}
std::vector<base::FilePath>
@@ -6991,10 +7003,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
@@ -6996,10 +7008,10 @@ void ChromeContentBrowserClient::OnKeepaliveRequestStarted(
const auto now = base::TimeTicks::Now();
const auto timeout = GetKeepaliveTimerTimeout(context);
keepalive_deadline_ = std::max(keepalive_deadline_, now + timeout);
@@ -273,7 +286,7 @@ index 265904cb255f3..463cb5cad9713 100644
FROM_HERE, keepalive_deadline_ - now,
base::BindOnce(
&ChromeContentBrowserClient::OnKeepaliveTimerFired,
@@ -7013,7 +7025,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
@@ -7018,7 +7030,8 @@ void ChromeContentBrowserClient::OnKeepaliveRequestFinished() {
--num_keepalive_requests_;
if (num_keepalive_requests_ == 0) {
DVLOG(1) << "Stopping the keepalive timer";
@@ -283,7 +296,7 @@ index 265904cb255f3..463cb5cad9713 100644
// This deletes the keep alive handle attached to the timer function and
// unblock the shutdown sequence.
}
@@ -7149,7 +7162,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
@@ -7154,7 +7167,7 @@ void ChromeContentBrowserClient::OnKeepaliveTimerFired(
const auto now = base::TimeTicks::Now();
const auto then = keepalive_deadline_;
if (now < then) {

View File

@@ -178,7 +178,7 @@ index 28085aa32d7d8..312911b8a4564 100644
BrowserFrame(const BrowserFrame&) = delete;
BrowserFrame& operator=(const BrowserFrame&) = delete;
diff --git chrome/browser/ui/views/frame/browser_view.cc chrome/browser/ui/views/frame/browser_view.cc
index 457e24dccb793..4ccb4705c2d7f 100644
index 3ed0e20a0b5d6..20b9c62847262 100644
--- chrome/browser/ui/views/frame/browser_view.cc
+++ chrome/browser/ui/views/frame/browser_view.cc
@@ -311,11 +311,10 @@ using content::NativeWebKeyboardEvent;
@@ -246,7 +246,7 @@ index 457e24dccb793..4ccb4705c2d7f 100644
contents_separator_ =
top_container_->AddChildView(std::make_unique<ContentsSeparator>());
@@ -1923,6 +1939,8 @@ bool BrowserView::ShouldHideUIForFullscreen() const {
@@ -1925,6 +1941,8 @@ bool BrowserView::ShouldHideUIForFullscreen() const {
if (immersive_mode_controller_->IsEnabled())
return false;
@@ -255,7 +255,7 @@ index 457e24dccb793..4ccb4705c2d7f 100644
return frame_->GetFrameView()->ShouldHideTopUIForFullscreen();
}
@@ -2795,7 +2813,8 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
@@ -2798,7 +2816,8 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
}
DownloadBubbleUIController* BrowserView::GetDownloadBubbleUIController() {
@@ -265,7 +265,7 @@ index 457e24dccb793..4ccb4705c2d7f 100644
if (auto* download_button = toolbar_button_provider_->GetDownloadButton())
return download_button->bubble_controller();
return nullptr;
@@ -3287,7 +3306,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
@@ -3290,7 +3309,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
if (top_container()->parent() == this)
return;
@@ -275,7 +275,7 @@ index 457e24dccb793..4ccb4705c2d7f 100644
top_container()->DestroyLayer();
AddChildViewAt(top_container(), 0);
EnsureFocusOrder();
@@ -3864,8 +3884,10 @@ void BrowserView::Layout() {
@@ -3867,8 +3887,10 @@ void BrowserView::Layout() {
// TODO(jamescook): Why was this in the middle of layout code?
toolbar_->location_bar()->omnibox_view()->SetFocusBehavior(
@@ -288,7 +288,7 @@ index 457e24dccb793..4ccb4705c2d7f 100644
// Some of the situations when the BrowserView is laid out are:
// - Enter/exit immersive fullscreen mode.
@@ -3931,6 +3953,11 @@ void BrowserView::AddedToWidget() {
@@ -3934,6 +3956,11 @@ void BrowserView::AddedToWidget() {
SetThemeProfileForWindow(GetNativeWindow(), browser_->profile());
#endif
@@ -300,7 +300,7 @@ index 457e24dccb793..4ccb4705c2d7f 100644
toolbar_->Init();
// TODO(pbos): Manage this either inside SidePanel or the corresponding button
@@ -3990,13 +4017,9 @@ void BrowserView::AddedToWidget() {
@@ -3993,13 +4020,9 @@ void BrowserView::AddedToWidget() {
EnsureFocusOrder();
@@ -316,7 +316,7 @@ index 457e24dccb793..4ccb4705c2d7f 100644
using_native_frame_ = frame_->ShouldUseNativeFrame();
MaybeInitializeWebUITabStrip();
@@ -4405,7 +4428,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
@@ -4408,7 +4431,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
// Undo our anti-jankiness hacks and force a re-layout.
in_process_fullscreen_ = false;
ToolbarSizeChanged(false);
@@ -326,7 +326,7 @@ index 457e24dccb793..4ccb4705c2d7f 100644
}
bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
@@ -4747,6 +4771,8 @@ Profile* BrowserView::GetProfile() {
@@ -4750,6 +4774,8 @@ Profile* BrowserView::GetProfile() {
}
void BrowserView::UpdateUIForTabFullscreen() {
@@ -335,7 +335,7 @@ index 457e24dccb793..4ccb4705c2d7f 100644
frame()->GetFrameView()->UpdateFullscreenTopUI();
}
@@ -4769,6 +4795,8 @@ void BrowserView::HideDownloadShelf() {
@@ -4772,6 +4798,8 @@ void BrowserView::HideDownloadShelf() {
}
bool BrowserView::CanUserExitFullscreen() const {
@@ -345,7 +345,7 @@ index 457e24dccb793..4ccb4705c2d7f 100644
}
diff --git chrome/browser/ui/views/frame/browser_view.h chrome/browser/ui/views/frame/browser_view.h
index 97f6f59322215..a71571e0d6ce9 100644
index b37a1c4e7a87b..2dc68dc29f39f 100644
--- chrome/browser/ui/views/frame/browser_view.h
+++ chrome/browser/ui/views/frame/browser_view.h
@@ -131,11 +131,16 @@ class BrowserView : public BrowserWindow,
@@ -365,7 +365,7 @@ index 97f6f59322215..a71571e0d6ce9 100644
void set_frame(BrowserFrame* frame) { frame_ = frame; }
BrowserFrame* frame() const { return frame_; }
@@ -803,6 +808,12 @@ class BrowserView : public BrowserWindow,
@@ -804,6 +809,12 @@ class BrowserView : public BrowserWindow,
void SetLoadingAnimationStateChangeClosureForTesting(
base::OnceClosure closure);
@@ -379,7 +379,7 @@ index 97f6f59322215..a71571e0d6ce9 100644
// Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
// interface to keep these two classes decoupled and testable.
diff --git chrome/browser/ui/views/frame/browser_view_layout.cc chrome/browser/ui/views/frame/browser_view_layout.cc
index e1b23142611cb..08852ecb7c129 100644
index e1b23142611cb..1c9fb04a163db 100644
--- chrome/browser/ui/views/frame/browser_view_layout.cc
+++ chrome/browser/ui/views/frame/browser_view_layout.cc
@@ -46,6 +46,10 @@
@@ -393,15 +393,17 @@ index e1b23142611cb..08852ecb7c129 100644
using views::View;
using web_modal::ModalDialogHostObserver;
using web_modal::WebContentsModalDialogHost;
@@ -472,6 +476,11 @@ int BrowserViewLayout::LayoutWebUITabStrip(int top) {
@@ -472,6 +476,13 @@ int BrowserViewLayout::LayoutWebUITabStrip(int top) {
int BrowserViewLayout::LayoutToolbar(int top) {
TRACE_EVENT0("ui", "BrowserViewLayout::LayoutToolbar");
+#if BUILDFLAG(ENABLE_CEF)
+ if (cef::IsCefView(toolbar_)) {
+ // CEF may take ownership of the toolbar. Early exit to avoid the DCHECK
+ // in LayoutManager::SetViewVisibility().
+ return top;
+ }
+#endif
int browser_view_width = vertical_layout_rect_.width();
bool toolbar_visible = delegate_->IsToolbarVisible();
int height = toolbar_visible ? toolbar_->GetPreferredSize().height() : 0;

View File

@@ -178,3 +178,37 @@ index 3ae765eea4b8f..c0fe200f0d373 100644
// Tells this platform that the renderer is locked to a site (i.e., a scheme
// plus eTLD+1, such as https://google.com), or to a more specific origin.
void SetIsLockedToSite();
diff --git headless/lib/browser/headless_content_browser_client.cc headless/lib/browser/headless_content_browser_client.cc
index 5cae59116d39d..2c6fb3e830fcd 100644
--- headless/lib/browser/headless_content_browser_client.cc
+++ headless/lib/browser/headless_content_browser_client.cc
@@ -312,7 +312,7 @@ bool HeadlessContentBrowserClient::ShouldEnableStrictSiteIsolation() {
return browser_->options()->site_per_process;
}
-void HeadlessContentBrowserClient::ConfigureNetworkContextParams(
+bool HeadlessContentBrowserClient::ConfigureNetworkContextParams(
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@@ -322,6 +322,7 @@ void HeadlessContentBrowserClient::ConfigureNetworkContextParams(
HeadlessBrowserContextImpl::From(context)->ConfigureNetworkContextParams(
in_memory, relative_partition_path, network_context_params,
cert_verifier_creation_params);
+ return true;
}
std::string HeadlessContentBrowserClient::GetProduct() {
diff --git headless/lib/browser/headless_content_browser_client.h headless/lib/browser/headless_content_browser_client.h
index 441423c66de35..97a98a41dd7e3 100644
--- headless/lib/browser/headless_content_browser_client.h
+++ headless/lib/browser/headless_content_browser_client.h
@@ -71,7 +71,7 @@ class HeadlessContentBrowserClient : public content::ContentBrowserClient {
std::unique_ptr<content::ClientCertificateDelegate> delegate) override;
bool ShouldEnableStrictSiteIsolation() override;
- void ConfigureNetworkContextParams(
+ bool ConfigureNetworkContextParams(
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,

View File

@@ -1,24 +1,37 @@
diff --git components/embedder_support/user_agent_utils.cc components/embedder_support/user_agent_utils.cc
index 40148eeaef7d1..353c6d2b37a7a 100644
index 40148eeaef7d1..9e2fae7232653 100644
--- components/embedder_support/user_agent_utils.cc
+++ components/embedder_support/user_agent_utils.cc
@@ -15,6 +15,7 @@
#include "base/version.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
+#include "cef/libcef/common/cef_switches.h"
+#include "cef/libcef/features/features.h"
#include "components/embedder_support/pref_names.h"
#include "components/embedder_support/switches.h"
#include "components/policy/core/common/policy_pref_names.h"
@@ -382,6 +383,12 @@ std::string GetMajorVersionForUserAgentString(
@@ -35,6 +36,10 @@
#include "base/win/windows_version.h"
#endif // BUILDFLAG(IS_WIN)
+#if BUILDFLAG(ENABLE_CEF)
+#include "cef/libcef/common/cef_switches.h"
+#endif
+
namespace embedder_support {
namespace {
@@ -382,6 +387,14 @@ std::string GetMajorVersionForUserAgentString(
std::string GetProductAndVersion(
ForceMajorVersionToMinorPosition force_major_to_minor,
UserAgentReductionEnterprisePolicyState user_agent_reduction) {
+#if BUILDFLAG(ENABLE_CEF)
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kUserAgentProductAndVersion)) {
+ return command_line->GetSwitchValueASCII(
+ switches::kUserAgentProductAndVersion);
+ }
+#endif
+
if (ShouldForceMajorVersionToMinorPosition(force_major_to_minor)) {
// Force major version to 99 and major version to minor version position.

View File

@@ -160,6 +160,37 @@ index 07be432f365b9..d3800886a5b5c 100644
// A pointer to the current or speculative main frame in `host_contents_`. We
// can't access this frame through the `host_contents_` directly as it does
diff --git extensions/browser/extension_registry.cc extensions/browser/extension_registry.cc
index 10d751cceab73..128af05925e07 100644
--- extensions/browser/extension_registry.cc
+++ extensions/browser/extension_registry.cc
@@ -6,9 +6,14 @@
#include "base/observer_list.h"
#include "base/strings/string_util.h"
+#include "cef/libcef/features/runtime.h"
#include "extensions/browser/extension_registry_factory.h"
#include "extensions/browser/extension_registry_observer.h"
+#if BUILDFLAG(ENABLE_CEF)
+#include "cef/libcef/common/extensions/extensions_util.h"
+#endif
+
namespace extensions {
ExtensionRegistry::ExtensionRegistry(content::BrowserContext* browser_context)
@@ -17,6 +22,11 @@ ExtensionRegistry::~ExtensionRegistry() {}
// static
ExtensionRegistry* ExtensionRegistry::Get(content::BrowserContext* context) {
+#if BUILDFLAG(ENABLE_CEF)
+ if (cef::IsAlloyRuntimeEnabled() && !extensions::ExtensionsEnabled()) {
+ return nullptr;
+ }
+#endif
return ExtensionRegistryFactory::GetForBrowserContext(context);
}
diff --git extensions/browser/extensions_browser_client.h extensions/browser/extensions_browser_client.h
index 028d6b1fec3a0..0829a24eb2879 100644
--- extensions/browser/extensions_browser_client.h
@@ -218,3 +249,16 @@ index aeee5f5a516c4..ca2079ba1b447 100644
host->SetCloseHandler(
base::BindOnce(&ProcessManager::HandleCloseExtensionHost,
weak_ptr_factory_.GetWeakPtr()));
diff --git extensions/common/extensions_client.cc extensions/common/extensions_client.cc
index 53ad0736cfbdf..c252591fa646d 100644
--- extensions/common/extensions_client.cc
+++ extensions/common/extensions_client.cc
@@ -23,7 +23,7 @@ ExtensionsClient* g_client = nullptr;
} // namespace
ExtensionsClient* ExtensionsClient::Get() {
- DCHECK(g_client);
+ // May be nullptr if using CEF Alloy with extensions disabled.
return g_client;
}

View File

@@ -1,5 +1,5 @@
diff --git chrome/browser/net/profile_network_context_service.cc chrome/browser/net/profile_network_context_service.cc
index 8221b46c59df3..56f9d584b3a50 100644
index 8221b46c59df3..736e703efa276 100644
--- chrome/browser/net/profile_network_context_service.cc
+++ chrome/browser/net/profile_network_context_service.cc
@@ -22,6 +22,7 @@
@@ -10,7 +10,31 @@ index 8221b46c59df3..56f9d584b3a50 100644
#include "chrome/browser/browser_features.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_content_browser_client.h"
@@ -796,7 +797,19 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
@@ -263,8 +264,10 @@ ProfileNetworkContextService::ProfileNetworkContextService(Profile* profile)
base::Unretained(this)));
cookie_settings_ = CookieSettingsFactory::GetForProfile(profile);
cookie_settings_observation_.Observe(cookie_settings_.get());
- privacy_sandbox_settings_observer_.Observe(
- PrivacySandboxSettingsFactory::GetForProfile(profile));
+ if (!cef::IsAlloyRuntimeEnabled()) {
+ privacy_sandbox_settings_observer_.Observe(
+ PrivacySandboxSettingsFactory::GetForProfile(profile));
+ }
DisableQuicIfNotAllowed();
@@ -304,7 +307,9 @@ ProfileNetworkContextService::ProfileNetworkContextService(Profile* profile)
base::Unretained(this)));
#if BUILDFLAG(ENABLE_EXTENSIONS)
- registry_observation_.Observe(extensions::ExtensionRegistry::Get(profile_));
+ if (auto extension_registry = extensions::ExtensionRegistry::Get(profile_)) {
+ registry_observation_.Observe(extension_registry);
+ }
#endif
}
@@ -796,7 +801,19 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
// Configure on-disk storage for non-OTR profiles. OTR profiles just use
// default behavior (in memory storage, default sizes).
@@ -31,7 +55,7 @@ index 8221b46c59df3..56f9d584b3a50 100644
PrefService* local_state = g_browser_process->local_state();
// Configure the HTTP cache path and size.
base::FilePath base_cache_path;
@@ -809,7 +822,9 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
@@ -809,7 +826,9 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
base_cache_path.Append(chrome::kCacheDirname);
network_context_params->http_cache_max_size =
local_state->GetInteger(prefs::kDiskCacheSize);
@@ -41,6 +65,34 @@ index 8221b46c59df3..56f9d584b3a50 100644
network_context_params->file_paths =
::network::mojom::NetworkContextFilePaths::New();
@@ -1009,6 +1028,7 @@ void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal(
network_context_params->require_network_isolation_key = true;
network_context_params->block_trust_tokens =
+ cef::IsAlloyRuntimeEnabled() ||
!PrivacySandboxSettingsFactory::GetForProfile(profile_)
->IsTrustTokensAllowed();
diff --git chrome/browser/signin/identity_manager_factory.cc chrome/browser/signin/identity_manager_factory.cc
index ff1d5b905b050..911e4b13f91e1 100644
--- chrome/browser/signin/identity_manager_factory.cc
+++ chrome/browser/signin/identity_manager_factory.cc
@@ -11,6 +11,7 @@
#include "base/observer_list.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
+#include "cef/libcef/features/runtime.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/image_fetcher/image_decoder_impl.h"
#include "chrome/browser/profiles/profile.h"
@@ -82,6 +83,7 @@ IdentityManagerFactory::~IdentityManagerFactory() {
// static
signin::IdentityManager* IdentityManagerFactory::GetForProfile(
Profile* profile) {
+ DCHECK(!cef::IsAlloyRuntimeEnabled());
return static_cast<signin::IdentityManager*>(
GetInstance()->GetServiceForBrowserContext(profile, true));
}
diff --git net/cookies/cookie_monster.cc net/cookies/cookie_monster.cc
index 13911f2bd786d..832308e34a303 100644
--- net/cookies/cookie_monster.cc
@@ -101,7 +153,7 @@ index f6df78d4d3878..5e4984760ba56 100644
// reset to null.
const CookieAccessDelegate* cookie_access_delegate() const {
diff --git services/network/cookie_manager.cc services/network/cookie_manager.cc
index 9da2056ddd3cf..c097bb2e8aba3 100644
index 120f304fc27db..7e665fc95a516 100644
--- services/network/cookie_manager.cc
+++ services/network/cookie_manager.cc
@@ -283,14 +283,9 @@ void CookieManager::FlushCookieStore(FlushCookieStoreCallback callback) {

View File

@@ -258,7 +258,7 @@ index a7d8b09e1d76e..e973baff291c0 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 ceee9102cf021..00e82621849ea 100644
index ceee9102cf021..60939d07e402d 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -183,16 +183,28 @@ void DesktopWindowTreeHostWin::Init(const Widget::InitParams& params) {
@@ -281,7 +281,7 @@ index ceee9102cf021..00e82621849ea 100644
- gfx::Rect pixel_bounds =
- display::win::ScreenWin::DIPToScreenRect(nullptr, params.bounds);
+ gfx::Rect pixel_bounds;
+ if (has_external_parent_) {
+ if (has_external_parent_ && params.type != Widget::InitParams::TYPE_MENU) {
+ // Scale relative to the screen that contains the parent window.
+ // Child windows always have origin (0,0).
+ pixel_bounds.set_size(display::win::ScreenWin::DIPToScreenSize(

View File

@@ -1,16 +1,8 @@
diff --git chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
index 0b3085d90332f..7b84c740aafc7 100644
index 0b3085d90332f..4fe995a31d4e8 100644
--- chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
+++ chrome/browser/feedback/system_logs/log_sources/chrome_internal_log_source.cc
@@ -10,6 +10,7 @@
#include <vector>
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/functional/callback_helpers.h"
#include "base/json/json_string_value_serializer.h"
#include "base/logging.h"
@@ -19,16 +20,19 @@
@@ -19,10 +19,12 @@
#include "base/strings/stringprintf.h"
#include "base/system/sys_info.h"
#include "base/task/thread_pool.h"
@@ -23,14 +15,7 @@ index 0b3085d90332f..7b84c740aafc7 100644
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/chrome_content_browser_client_extensions_part.h"
#include "chrome/browser/google/google_brand.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sync/sync_service_factory.h"
#include "chrome/common/channel_info.h"
+#include "chrome/common/chrome_switches.h"
#include "chromeos/ash/components/dbus/spaced/spaced_client.h"
#include "components/feedback/system_logs/system_logs_source.h"
#include "components/prefs/pref_service.h"
@@ -398,7 +402,11 @@ void ChromeInternalLogSource::Fetch(SysLogsSourceCallback callback) {
@@ -398,7 +400,11 @@ void ChromeInternalLogSource::Fetch(SysLogsSourceCallback callback) {
response->emplace(kOsVersionTag, os_version);
#endif
@@ -43,20 +28,20 @@ index 0b3085d90332f..7b84c740aafc7 100644
PopulateExtensionInfoLogs(response.get());
PopulatePowerApiLogs(response.get());
#if BUILDFLAG(IS_WIN)
@@ -472,6 +480,12 @@ void ChromeInternalLogSource::PopulateExtensionInfoLogs(
@@ -472,8 +478,12 @@ void ChromeInternalLogSource::PopulateExtensionInfoLogs(
if (!profile)
return;
+ // CEF should avoid accessing ExtensionRegistry when extensions are disabled.
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableExtensions)) {
+ return;
+ }
+
+ // May be nullptr if using CEF Alloy with extensions disabled.
extensions::ExtensionRegistry* extension_registry =
extensions::ExtensionRegistry::Get(profile);
+ if (!extension_registry)
+ return;
+
std::string extensions_list;
@@ -577,6 +591,8 @@ void ChromeInternalLogSource::PopulateOnboardingTime(
for (const scoped_refptr<const extensions::Extension>& extension :
extension_registry->enabled_extensions()) {
@@ -577,6 +587,8 @@ void ChromeInternalLogSource::PopulateOnboardingTime(
#if BUILDFLAG(IS_WIN)
void ChromeInternalLogSource::PopulateUsbKeyboardDetected(
SystemLogsResponse* response) {
@@ -66,33 +51,26 @@ index 0b3085d90332f..7b84c740aafc7 100644
bool result =
base::win::IsKeyboardPresentOnSlate(ui::GetHiddenWindow(), &reason);
diff --git chrome/browser/memory_details.cc chrome/browser/memory_details.cc
index d071ef696f441..441514f66150c 100644
index d071ef696f441..aba280943251a 100644
--- chrome/browser/memory_details.cc
+++ chrome/browser/memory_details.cc
@@ -8,6 +8,7 @@
#include <set>
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/containers/adapters.h"
#include "base/containers/cxx20_erase.h"
#include "base/file_version_info.h"
@@ -18,6 +19,7 @@
#include "base/task/thread_pool.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/chrome_switches.h"
#include "components/nacl/common/nacl_process_type.h"
#include "components/strings/grit/components_strings.h"
#include "content/public/browser/browser_child_process_host_iterator.h"
@@ -291,7 +293,9 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
// Determine if this is an extension process.
bool process_is_for_extensions = false;
const extensions::ExtensionSet* extension_set = nullptr;
- if (render_process_host) {
+ if (render_process_host &&
+ !base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableExtensions)) {
@@ -294,8 +294,11 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
if (render_process_host) {
content::BrowserContext* context =
render_process_host->GetBrowserContext();
+
+ // May be nullptr if using CEF Alloy with extensions disabled.
extensions::ExtensionRegistry* extension_registry =
extensions::ExtensionRegistry::Get(context);
+ if (extension_registry) {
extension_set = &extension_registry->enabled_extensions();
extensions::ProcessMap* process_map =
extensions::ProcessMap::Get(context);
@@ -311,6 +314,7 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
break;
}
}
+ }
}
#endif

View File

@@ -1232,6 +1232,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) {
}
- (void)viewDidChangeBackingProperties {
[super viewDidChangeBackingProperties];
const CGFloat device_scale_factor = [self getDeviceScaleFactor];
if (device_scale_factor == device_scale_factor_) {

View File

@@ -540,18 +540,7 @@ class DownloadTestHandler : public TestHandler {
mouse_event.x = 20;
mouse_event.y = 20;
mouse_event.modifiers = modifiers;
// Add some delay to avoid having events dropped or rate limited.
CefPostDelayedTask(
TID_UI,
base::BindOnce(&CefBrowserHost::SendMouseClickEvent, browser->GetHost(),
mouse_event, MBT_LEFT, false, 1),
50);
CefPostDelayedTask(
TID_UI,
base::BindOnce(&CefBrowserHost::SendMouseClickEvent, browser->GetHost(),
mouse_event, MBT_LEFT, true, 1),
100);
SendMouseClickEvent(browser, mouse_event);
}
const TestMode test_mode_;

View File

@@ -1883,10 +1883,7 @@ class LoadNavTestHandler : public TestHandler {
cef_mouse_button_type_t button_type =
(mode_ == MIDDLE_CLICK ? MBT_MIDDLE : MBT_LEFT);
browser->GetHost()->SendMouseClickEvent(mouse_event, button_type, false,
1);
browser->GetHost()->SendMouseClickEvent(mouse_event, button_type, true,
1);
SendMouseClickEvent(browser, mouse_event, button_type);
}
if (cancel_in_open_url_) {

File diff suppressed because it is too large Load Diff

View File

@@ -148,8 +148,7 @@ class PdfViewerTestHandler : public TestHandler, public CefContextMenuHandler {
}
// Send right-click mouse down and mouse up to tigger context menu.
browser->GetHost()->SendMouseClickEvent(mouse_event, MBT_RIGHT, false, 1);
browser->GetHost()->SendMouseClickEvent(mouse_event, MBT_RIGHT, true, 1);
SendMouseClickEvent(browser, mouse_event, MBT_RIGHT);
}
bool RunContextMenu(CefRefPtr<CefBrowser> browser,

View File

@@ -5,7 +5,7 @@
#include <string>
#include <vector>
#include "include/base/cef_bind.h"
#include "include/base/cef_callback.h"
#include "include/cef_parser.h"
#include "include/cef_permission_handler.h"
#include "include/cef_request_context_handler.h"
@@ -13,6 +13,7 @@
#include "include/wrapper/cef_stream_resource_handler.h"
#include "tests/ceftests/test_handler.h"
#include "tests/ceftests/test_suite.h"
#include "tests/ceftests/test_util.h"
#include "tests/gtest/include/gtest/gtest.h"
#include "tests/shared/browser/client_app_browser.h"
@@ -264,18 +265,7 @@ class PermissionPromptTestHandler : public TestHandler,
CefMouseEvent mouse_event;
mouse_event.x = 20;
mouse_event.y = 20;
// Add some delay to avoid having events dropped or rate limited.
CefPostDelayedTask(
TID_UI,
base::BindOnce(&CefBrowserHost::SendMouseClickEvent, browser->GetHost(),
mouse_event, MBT_LEFT, false, 1),
50);
CefPostDelayedTask(
TID_UI,
base::BindOnce(&CefBrowserHost::SendMouseClickEvent, browser->GetHost(),
mouse_event, MBT_LEFT, true, 1),
100);
SendMouseClickEvent(browser, mouse_event);
}
CefRefPtr<CefDictionaryValue> ParseURLData(const std::string& url) {

View File

@@ -324,18 +324,7 @@ class PopupTestHandler : public TestHandler {
mouse_event.x = 20;
mouse_event.y = 20;
mouse_event.modifiers = 0;
// Add some delay to avoid having events dropped or rate limited.
CefPostDelayedTask(
TID_UI,
base::BindOnce(&CefBrowserHost::SendMouseClickEvent,
browser->GetHost(), mouse_event, MBT_LEFT, false, 1),
50);
CefPostDelayedTask(
TID_UI,
base::BindOnce(&CefBrowserHost::SendMouseClickEvent,
browser->GetHost(), mouse_event, MBT_LEFT, true, 1),
100);
SendMouseClickEvent(browser, mouse_event);
} else {
ADD_FAILURE(); // Not reached.
}

View File

@@ -84,7 +84,7 @@ class ResourceManagerTestHandler : public RoutingTestHandler {
// Create the browser.
CreateBrowser(GetNextURL());
SetTestTimeout(IsChromeRuntimeEnabled() ? 10000 : 5000);
SetTestTimeout(5000);
}
cef_return_value_t OnBeforeResourceLoad(

View File

@@ -651,8 +651,8 @@ class HttpTestRunner : public base::RefCountedThreadSafe<HttpTestRunner> {
void SetTestTimeout(int timeout_ms) {
EXPECT_UI_THREAD();
if (CefCommandLine::GetGlobalCommandLine()->HasSwitch(
"disable-test-timeout")) {
const auto timeout = GetConfiguredTestTimeout(timeout_ms);
if (!timeout) {
return;
}
@@ -660,8 +660,8 @@ class HttpTestRunner : public base::RefCountedThreadSafe<HttpTestRunner> {
// test runner can be destroyed before the timeout expires.
GetUIThreadHelper()->PostDelayedTask(
base::BindOnce(&HttpTestRunner::OnTestTimeout, base::Unretained(this),
timeout_ms),
timeout_ms);
*timeout),
*timeout);
}
void OnTestTimeout(int timeout_ms) {

View File

@@ -7,16 +7,17 @@
#include "include/cef_task.h"
#include "include/wrapper/cef_closure_task.h"
#include "tests/ceftests/test_handler.h"
#include "tests/ceftests/test_util.h"
#include "tests/gtest/include/gtest/gtest.h"
namespace {
void WaitForEvent(CefRefPtr<CefWaitableEvent> event) {
if (CefCommandLine::GetGlobalCommandLine()->HasSwitch(
"disable-test-timeout")) {
const auto timeout = GetConfiguredTestTimeout(/*timeout_ms=*/1000);
if (!timeout) {
event->Wait();
} else {
EXPECT_TRUE(event->TimedWait(1000));
EXPECT_TRUE(event->TimedWait(*timeout));
}
}

View File

@@ -13,6 +13,7 @@
#include "include/wrapper/cef_closure_task.h"
#include "include/wrapper/cef_stream_resource_handler.h"
#include "tests/ceftests/test_request.h"
#include "tests/ceftests/test_util.h"
#include "tests/shared/common/client_switches.h"
namespace {
@@ -442,8 +443,8 @@ void TestHandler::SetTestTimeout(int timeout_ms, bool treat_as_error) {
return;
}
if (treat_as_error && CefCommandLine::GetGlobalCommandLine()->HasSwitch(
"disable-test-timeout")) {
const auto timeout = GetConfiguredTestTimeout(timeout_ms);
if (treat_as_error && !timeout) {
return;
}
@@ -451,8 +452,8 @@ void TestHandler::SetTestTimeout(int timeout_ms, bool treat_as_error) {
// can be destroyed before the timeout expires.
GetUIThreadHelper()->PostDelayedTask(
base::BindOnce(&TestHandler::OnTestTimeout, base::Unretained(this),
timeout_ms, treat_as_error),
timeout_ms);
*timeout, treat_as_error),
*timeout);
}
void TestHandler::TestComplete() {

View File

@@ -11,6 +11,7 @@
#include "include/wrapper/cef_helpers.h"
#include "tests/ceftests/test_request.h"
#include "tests/ceftests/test_server_observer.h"
#include "tests/ceftests/test_util.h"
#include "tests/ceftests/track_callback.h"
#include "tests/gtest/include/gtest/gtest.h"
@@ -165,11 +166,11 @@ void SignalIfDone(CefRefPtr<CefWaitableEvent> event,
}
void Wait(CefRefPtr<CefWaitableEvent> event) {
if (CefCommandLine::GetGlobalCommandLine()->HasSwitch(
"disable-test-timeout")) {
const auto timeout = GetConfiguredTestTimeout(/*timeout_ms=*/2000);
if (!timeout) {
event->Wait();
} else {
event->TimedWait(2000);
event->TimedWait(*timeout);
}
}

View File

@@ -373,8 +373,8 @@ class HttpTestRunner : public base::RefCountedThreadSafe<HttpTestRunner> {
void SetTestTimeout(int timeout_ms) {
EXPECT_UI_THREAD();
if (CefCommandLine::GetGlobalCommandLine()->HasSwitch(
"disable-test-timeout")) {
const auto timeout = GetConfiguredTestTimeout(timeout_ms);
if (!timeout) {
return;
}
@@ -382,8 +382,8 @@ class HttpTestRunner : public base::RefCountedThreadSafe<HttpTestRunner> {
// test runner can be destroyed before the timeout expires.
GetUIThreadHelper()->PostDelayedTask(
base::BindOnce(&HttpTestRunner::OnTestTimeout, base::Unretained(this),
timeout_ms),
timeout_ms);
*timeout),
*timeout);
}
void OnTestTimeout(int timeout_ms) {

View File

@@ -5,10 +5,14 @@
#include "tests/ceftests/test_util.h"
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include "include/base/cef_callback.h"
#include "include/cef_base.h"
#include "include/cef_command_line.h"
#include "include/cef_request_context_handler.h"
#include "include/wrapper/cef_closure_task.h"
#include "tests/gtest/include/gtest/gtest.h"
#include "tests/shared/common/string_util.h"
@@ -278,23 +282,19 @@ void TestStringVectorEqual(const std::vector<CefString>& val1,
}
bool TestOldResourceAPI() {
static int state = -1;
if (state == -1) {
CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine();
state = command_line->HasSwitch("test-old-resource-api") ? 1 : 0;
}
return state ? true : false;
static bool state = []() {
return CefCommandLine::GetGlobalCommandLine()->HasSwitch(
"test-old-resource-api");
}();
return state;
}
bool IsChromeRuntimeEnabled() {
static int state = -1;
if (state == -1) {
CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine();
state = command_line->HasSwitch("enable-chrome-runtime") ? 1 : 0;
}
return state ? true : false;
static bool state = []() {
return CefCommandLine::GetGlobalCommandLine()->HasSwitch(
"enable-chrome-runtime");
}();
return state;
}
bool IsBFCacheEnabled() {
@@ -303,15 +303,13 @@ bool IsBFCacheEnabled() {
return false;
}
// Enabled by default starting in M96.
static int state = -1;
if (state == -1) {
CefRefPtr<CefCommandLine> command_line =
CefCommandLine::GetGlobalCommandLine();
const std::string& value = command_line->GetSwitchValue("disable-features");
state = value.find("BackForwardCache") == std::string::npos ? 1 : 0;
}
return state ? true : false;
static bool state = []() {
const std::string& value =
CefCommandLine::GetGlobalCommandLine()->GetSwitchValue(
"disable-features");
return value.find("BackForwardCache") == std::string::npos;
}();
return state;
}
bool IsSameSiteBFCacheEnabled() {
@@ -325,6 +323,45 @@ bool IgnoreURL(const std::string& url) {
url.find("/favicon.ico") != std::string::npos;
}
std::optional<int> GetConfiguredTestTimeout(int timeout_ms) {
static std::optional<double> multiplier = []() -> std::optional<double> {
auto command_line = CefCommandLine::GetGlobalCommandLine();
if (command_line->HasSwitch("disable-test-timeout")) {
return std::nullopt;
}
const std::string& sval =
command_line->GetSwitchValue("test-timeout-multiplier");
if (!sval.empty()) {
if (double dval = std::atof(sval.c_str())) {
return dval;
}
}
return IsChromeRuntimeEnabled() ? 2.0 : 1.0;
}();
if (!multiplier) {
// Test timeout is disabled.
return std::nullopt;
}
return static_cast<int>(
std::round(static_cast<double>(timeout_ms) * (*multiplier)));
}
void SendMouseClickEvent(CefRefPtr<CefBrowser> browser,
const CefMouseEvent& mouse_event,
cef_mouse_button_type_t mouse_button_type) {
auto host = browser->GetHost();
CefPostDelayedTask(TID_UI,
base::BindOnce(&CefBrowserHost::SendMouseClickEvent, host,
mouse_event, mouse_button_type, false, 1),
50);
CefPostDelayedTask(TID_UI,
base::BindOnce(&CefBrowserHost::SendMouseClickEvent, host,
mouse_event, mouse_button_type, true, 1),
100);
}
CefRefPtr<CefRequestContext> CreateTestRequestContext(
TestRequestContextMode mode,
const std::string& cache_path) {

View File

@@ -6,6 +6,8 @@
#define CEF_TESTS_CEFTESTS_TEST_UTIL_H_
#pragma once
#include <optional>
#include "include/cef_process_message.h"
#include "include/cef_request.h"
#include "include/cef_request_context.h"
@@ -96,6 +98,16 @@ bool IsSameSiteBFCacheEnabled();
// Returns true if requests for |url| should be ignored by tests.
bool IgnoreURL(const std::string& url);
// Returns |timeout_ms| as scaled by the current configuration, or std::nullopt
// if timeouts are disabled.
std::optional<int> GetConfiguredTestTimeout(int timeout_ms);
// Send a mouse click event with the necessary delay to avoid having events
// dropped or rate limited.
void SendMouseClickEvent(CefRefPtr<CefBrowser> browser,
const CefMouseEvent& mouse_event,
cef_mouse_button_type_t mouse_button_type = MBT_LEFT);
// Return a RequestContext object matching the specified |mode|.
// |cache_path| may be specified for CUSTOM modes.
// Use the RC_TEST_GROUP_BASE macro to test all valid combinations.

View File

@@ -2760,7 +2760,7 @@ class RequestTestHandler : public TestHandler {
void RunTest() override {
// Time out the test after a reasonable period of time.
SetTestTimeout(IsChromeRuntimeEnabled() ? 10000 : 5000);
SetTestTimeout(5000);
// Start pre-setup actions.
PreSetupStart();

View File

@@ -8,6 +8,7 @@
#include "include/views/cef_window.h"
#include "include/views/cef_window_delegate.h"
#include "include/wrapper/cef_closure_task.h"
#include "tests/ceftests/test_util.h"
#include "tests/ceftests/thread_helper.h"
#include "tests/gtest/include/gtest/gtest.h"
@@ -125,14 +126,16 @@ void TestWindowDelegate::OnWindowCreated(CefRefPtr<CefWindow> window) {
// Close the window asynchronously.
CefPostTask(TID_UI,
base::BindOnce(&TestWindowDelegate::OnCloseWindow, this));
} else if (!CefCommandLine::GetGlobalCommandLine()->HasSwitch(
"disable-test-timeout")) {
// Timeout the test after a reasonable delay. Use a WeakPtr so that the
// delayed task doesn't keep this object alive.
CefPostDelayedTask(TID_UI,
base::BindOnce(&TestWindowDelegate::OnTimeoutWindow,
weak_ptr_factory_.GetWeakPtr()),
kTestTimeout);
} else {
const auto timeout = GetConfiguredTestTimeout(kTestTimeout);
if (timeout) {
// Timeout the test after a reasonable delay. Use a WeakPtr so that the
// delayed task doesn't keep this object alive.
CefPostDelayedTask(TID_UI,
base::BindOnce(&TestWindowDelegate::OnTimeoutWindow,
weak_ptr_factory_.GetWeakPtr()),
*timeout);
}
}
}

View File

@@ -100,6 +100,11 @@
window.testQuery({request: param});
}
function onFocusTest(ev) {
if (window.testQuery)
window.testQuery({request: "osrfocus" + ev.target.id});
}
function allowDrop(ev) {
ev.preventDefault();
}
@@ -169,7 +174,7 @@
</li>
<li id='LI07'>Invalidate should trigger OnPaint once</li>
<li id='LI08'>Click and write here with SendKeyEvent to trigger repaints:
<input id='editbox' type='text' value='' size="5"></li>
<input id='editbox' type='text' value='' size="5" onfocus="onFocusTest(event)"></li>
<li id='LI09'>Click here with SendMouseClickEvent to navigate:
<input id='btnnavigate' type='button' onclick='navigate()'
value='Click here to navigate' /></li>