Update to Chromium version 96.0.4664.0 (#929512)

This commit is contained in:
Marshall Greenblatt
2021-10-18 18:17:16 -04:00
parent 4dd314dec3
commit 6872dadd74
103 changed files with 897 additions and 675 deletions

View File

@ -348,7 +348,8 @@ AlloyBrowserContext::GetDownloadManagerDelegate() {
}
content::BrowserPluginGuestManager* AlloyBrowserContext::GetGuestManager() {
DCHECK(extensions::ExtensionsEnabled());
if (!extensions::ExtensionsEnabled())
return nullptr;
return guest_view::GuestViewManager::FromBrowserContext(this);
}

View File

@ -96,7 +96,7 @@ class AlloyBrowserContext : public ChromeProfileAlloy,
// Values checked in ProfileNetworkContextService::CreateNetworkContextParams
// when creating the NetworkContext.
bool ShouldRestoreOldSessionCookies() const override {
bool ShouldRestoreOldSessionCookies() override {
return ShouldPersistSessionCookies();
}
bool ShouldPersistSessionCookies() const override {

View File

@ -51,7 +51,7 @@
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "net/base/net_errors.h"
#include "third_party/blink/public/mojom/page/widget.mojom-test-utils.h"
#include "third_party/blink/public/mojom/widget/platform_widget.mojom-test-utils.h"
#include "ui/events/base_event_utils.h"
using content::KeyboardEventProcessingResult;
@ -126,8 +126,7 @@ class CefWidgetHostInterceptor
DISALLOW_COPY_AND_ASSIGN(CefWidgetHostInterceptor);
};
static constexpr base::TimeDelta kRecentlyAudibleTimeout =
base::TimeDelta::FromSeconds(2);
static constexpr base::TimeDelta kRecentlyAudibleTimeout = base::Seconds(2);
} // namespace

View File

@ -1206,7 +1206,7 @@ void AlloyContentBrowserClient::OnNetworkServiceCreated(
network_service);
}
void AlloyContentBrowserClient::ConfigureNetworkContextParams(
bool AlloyContentBrowserClient::ConfigureNetworkContextParams(
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@ -1216,10 +1216,9 @@ void AlloyContentBrowserClient::ConfigureNetworkContextParams(
// This method may be called during shutdown when using multi-threaded
// message loop mode. In that case exit early to avoid crashes.
if (!SystemNetworkContextManager::GetInstance()) {
// This must match the value expected in
// Cancel NetworkContext creation in
// StoragePartitionImpl::InitNetworkContext.
network_context_params->context_name = "magic_shutting_down";
return;
return false;
}
auto cef_context = CefBrowserContext::FromBrowserContext(context);
@ -1243,6 +1242,8 @@ void AlloyContentBrowserClient::ConfigureNetworkContextParams(
// TODO(cef): Remove this and add required NetworkIsolationKeys,
// this is currently not the case and this was not required pre M84.
network_context_params->require_network_isolation_key = false;
return true;
}
// The sandbox may block read/write access from the NetworkService to
@ -1271,6 +1272,7 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
network::mojom::WebSandboxFlags sandbox_flags,
ui::PageTransition page_transition,
bool has_user_gesture,
const absl::optional<url::Origin>& initiating_origin,
@ -1283,6 +1285,7 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& resource_request,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver =

View File

@ -172,7 +172,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
network::mojom::URLLoaderFactoryOverridePtr* factory_override) override;
void OnNetworkServiceCreated(
network::mojom::NetworkService* network_service) override;
void ConfigureNetworkContextParams(
bool ConfigureNetworkContextParams(
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
@ -187,6 +187,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
network::mojom::WebSandboxFlags sandbox_flags,
ui::PageTransition page_transition,
bool has_user_gesture,
const absl::optional<url::Origin>& initiating_origin,
@ -196,6 +197,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& request,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
override;

View File

@ -153,15 +153,6 @@ bool ChromeProfileAlloy::WasCreatedByVersionOrLater(
return false;
}
void ChromeProfileAlloy::SetExitType(ExitType exit_type) {
NOTREACHED();
}
Profile::ExitType ChromeProfileAlloy::GetLastSessionExitType() const {
NOTREACHED();
return EXIT_NORMAL;
}
base::Time ChromeProfileAlloy::GetCreationTime() const {
NOTREACHED();
return base::Time();

View File

@ -44,8 +44,6 @@ class ChromeProfileAlloy : public Profile {
void set_last_selected_directory(const base::FilePath& path) override;
GURL GetHomePage() override;
bool WasCreatedByVersionOrLater(const std::string& version) override;
void SetExitType(ExitType exit_type) override;
ExitType GetLastSessionExitType() const override;
base::Time GetCreationTime() const override;
void SetCreationTimeForTesting(base::Time creation_time) override;
void RecordPrimaryMainFrameNavigation() override;

View File

@ -16,7 +16,7 @@
CefBrowserFrame::CefBrowserFrame(
content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<cef::mojom::BrowserFrame> receiver)
: DocumentServiceBase(render_frame_host, std::move(receiver)) {}
: FrameServiceBase(render_frame_host, std::move(receiver)) {}
CefBrowserFrame::~CefBrowserFrame() = default;

View File

@ -7,18 +7,18 @@
#pragma once
#include "libcef/browser/frame_host_impl.h"
#include "libcef/browser/frame_service_base.h"
#include "cef/libcef/common/mojom/cef.mojom.h"
#include "content/public/browser/document_service_base.h"
#include "mojo/public/cpp/bindings/binder_map.h"
// Implementation of the BrowserFrame mojo interface.
// This is implemented separately from CefFrameHostImpl to better manage the
// association with the RenderFrameHost (which may be speculative, etc.), and so
// that messages are always routed to the most appropriate CefFrameHostImpl
// instance. Lifespan is tied to the RFH via DocumentServiceBase.
// instance. Lifespan is tied to the RFH via FrameServiceBase.
class CefBrowserFrame
: public content::DocumentServiceBase<cef::mojom::BrowserFrame> {
: public content::FrameServiceBase<cef::mojom::BrowserFrame> {
public:
CefBrowserFrame(content::RenderFrameHost* render_frame_host,
mojo::PendingReceiver<cef::mojom::BrowserFrame> receiver);
@ -39,7 +39,7 @@ class CefBrowserFrame
absl::optional<std::vector<cef::mojom::DraggableRegionEntryPtr>> regions)
override;
// DocumentServiceBase methods:
// FrameServiceBase methods:
bool ShouldCloseOnFinishNavigation() const override { return false; }
CefRefPtr<CefFrameHostImpl> GetFrameHost(

View File

@ -247,7 +247,7 @@ void CefBrowserHostBase::DownloadImage(
return;
web_contents->DownloadImage(
gurl, is_favicon, max_image_size,
gurl, is_favicon, gfx::Size(max_image_size, max_image_size),
max_image_size * gfx::ImageSkia::GetMaxSupportedScale(), bypass_cache,
base::BindOnce(
[](uint32 max_image_size,

View File

@ -17,7 +17,7 @@
#include "base/callback_forward.h"
#include "extensions/common/mojom/view_type.mojom-forward.h"
#include "third_party/blink/public/common/page/drag_operation.h"
#include "third_party/blink/public/mojom/page/drag.mojom-forward.h"
#include "third_party/blink/public/mojom/drag/drag.mojom-forward.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
#include "ui/base/window_open_disposition.h"

View File

@ -26,6 +26,7 @@
#include "base/command_line.h"
#include "base/path_service.h"
#include "chrome/browser/chrome_browser_main.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/navigation_throttle.h"
@ -44,6 +45,7 @@ void HandleExternalProtocolHelper(
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& resource_request) {
// Match the logic of the original call in
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
@ -53,6 +55,7 @@ void HandleExternalProtocolHelper(
navigation_data,
resource_request.resource_type ==
static_cast<int>(blink::mojom::ResourceType::kMainFrame),
sandbox_flags,
static_cast<ui::PageTransition>(resource_request.transition_type),
resource_request.has_user_gesture, resource_request.request_initiator,
nullptr);
@ -238,6 +241,7 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
network::mojom::WebSandboxFlags sandbox_flags,
ui::PageTransition page_transition,
bool has_user_gesture,
const absl::optional<url::Origin>& initiating_origin,
@ -254,14 +258,15 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
// handling.
return ChromeContentBrowserClient::HandleExternalProtocol(
url, web_contents_getter, child_id, frame_tree_node_id, navigation_data,
is_main_frame, page_transition, has_user_gesture, initiating_origin,
nullptr);
is_main_frame, sandbox_flags, page_transition, has_user_gesture,
initiating_origin, nullptr);
}
bool ChromeContentBrowserClientCef::HandleExternalProtocol(
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& resource_request,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver =
@ -272,7 +277,7 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
web_contents_getter, frame_tree_node_id, resource_request,
base::BindRepeating(HandleExternalProtocolHelper, base::Unretained(this),
web_contents_getter, frame_tree_node_id,
navigation_data, resource_request));
navigation_data, sandbox_flags, resource_request));
net_service::ProxyURLLoaderFactory::CreateProxy(
web_contents_getter, std::move(receiver), std::move(request_handler));
@ -288,13 +293,21 @@ ChromeContentBrowserClientCef::CreateThrottlesForNavigation(
return throttles;
}
void ChromeContentBrowserClientCef::ConfigureNetworkContextParams(
bool ChromeContentBrowserClientCef::ConfigureNetworkContextParams(
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,
network::mojom::NetworkContextParams* network_context_params,
cert_verifier::mojom::CertVerifierCreationParams*
cert_verifier_creation_params) {
// This method may be called during shutdown when using multi-threaded
// message loop mode. In that case exit early to avoid crashes.
if (!SystemNetworkContextManager::GetInstance()) {
// Cancel NetworkContext creation in
// StoragePartitionImpl::InitNetworkContext.
return false;
}
ChromeContentBrowserClient::ConfigureNetworkContextParams(
context, in_memory, relative_partition_path, network_context_params,
cert_verifier_creation_params);
@ -314,6 +327,8 @@ void ChromeContentBrowserClientCef::ConfigureNetworkContextParams(
accept_language_list != network_context_params->accept_language) {
network_context_params->accept_language = accept_language_list;
}
return true;
}
std::unique_ptr<content::LoginDelegate>

View File

@ -63,6 +63,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
bool is_main_frame,
network::mojom::WebSandboxFlags sandbox_flags,
ui::PageTransition page_transition,
bool has_user_gesture,
const absl::optional<url::Origin>& initiating_origin,
@ -72,13 +73,14 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
content::WebContents::Getter web_contents_getter,
int frame_tree_node_id,
content::NavigationUIData* navigation_data,
network::mojom::WebSandboxFlags sandbox_flags,
const network::ResourceRequest& request,
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
override;
std::vector<std::unique_ptr<content::NavigationThrottle>>
CreateThrottlesForNavigation(
content::NavigationHandle* navigation_handle) override;
void ConfigureNetworkContextParams(
bool ConfigureNetworkContextParams(
content::BrowserContext* context,
bool in_memory,
const base::FilePath& relative_partition_path,

View File

@ -10,11 +10,11 @@
#include <limits>
#include <utility>
#include "components/value_store/value_store_factory.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/browser/api/storage/backend_task_runner.h"
#include "extensions/browser/api/storage/value_store_util.h"
#include "extensions/browser/api/storage/weak_unlimited_settings_storage.h"
#include "extensions/browser/value_store/value_store_factory.h"
#include "extensions/common/api/storage.h"
#include "extensions/common/extension.h"
#include "extensions/common/permissions/permissions_data.h"

View File

@ -41,7 +41,6 @@
#include "extensions/browser/null_app_sorting.h"
#include "extensions/browser/quota_service.h"
#include "extensions/browser/renderer_startup_helper.h"
#include "extensions/browser/runtime_data.h"
#include "extensions/browser/service_worker_manager.h"
#include "extensions/browser/state_store.h"
#include "extensions/browser/unloaded_extension_reason.h"
@ -387,7 +386,6 @@ void CefExtensionSystem::Shutdown() {
void CefExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
DCHECK(!initialized_);
service_worker_manager_.reset(new ServiceWorkerManager(browser_context_));
runtime_data_.reset(new RuntimeData(registry_));
quota_service_.reset(new QuotaService);
app_sorting_.reset(new NullAppSorting);
}
@ -396,10 +394,6 @@ ExtensionService* CefExtensionSystem::extension_service() {
return nullptr;
}
RuntimeData* CefExtensionSystem::runtime_data() {
return runtime_data_.get();
}
ManagementPolicy* CefExtensionSystem::management_policy() {
return nullptr;
}
@ -420,6 +414,10 @@ StateStore* CefExtensionSystem::rules_store() {
return rules_store_.get();
}
StateStore* CefExtensionSystem::dynamic_user_scripts_store() {
return nullptr;
}
scoped_refptr<value_store::ValueStoreFactory>
CefExtensionSystem::store_factory() {
return store_factory_;

View File

@ -84,12 +84,12 @@ class CefExtensionSystem : public ExtensionSystem {
// ExtensionSystem implementation:
void InitForRegularProfile(bool extensions_enabled) override;
ExtensionService* extension_service() override;
RuntimeData* runtime_data() override;
ManagementPolicy* management_policy() override;
ServiceWorkerManager* service_worker_manager() override;
UserScriptManager* user_script_manager() override;
StateStore* state_store() override;
StateStore* rules_store() override;
StateStore* dynamic_user_scripts_store() override;
scoped_refptr<value_store::ValueStoreFactory> store_factory() override;
InfoMap* info_map() override;
QuotaService* quota_service() override;
@ -170,7 +170,6 @@ class CefExtensionSystem : public ExtensionSystem {
scoped_refptr<InfoMap> info_map_;
std::unique_ptr<ServiceWorkerManager> service_worker_manager_;
std::unique_ptr<RuntimeData> runtime_data_;
std::unique_ptr<QuotaService> quota_service_;
std::unique_ptr<AppSorting> app_sorting_;

View File

@ -9,9 +9,8 @@
#include "content/public/browser/notification_source.h"
#include "content/public/browser/web_contents.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/notification_types.h"
#include "extensions/browser/runtime_data.h"
#include "extensions/browser/process_util.h"
#include "third_party/blink/public/common/input/web_gesture_event.h"
using content::NativeWebKeyboardEvent;
@ -44,9 +43,9 @@ void CefExtensionViewHost::OnDidStopFirstLoad() {
}
void CefExtensionViewHost::LoadInitialURL() {
if (!ExtensionSystem::Get(browser_context())
->runtime_data()
->IsBackgroundPageReady(extension())) {
if (process_util::GetPersistentBackgroundPageState(*extension(),
browser_context()) ==
process_util::PersistentBackgroundPageState::kNotReady) {
// Make sure the background page loads before any others.
registrar_.Add(this,
extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY,
@ -86,9 +85,9 @@ void CefExtensionViewHost::Observe(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_BACKGROUND_PAGE_READY);
DCHECK(ExtensionSystem::Get(browser_context())
->runtime_data()
->IsBackgroundPageReady(extension()));
DCHECK_EQ(process_util::PersistentBackgroundPageState::kReady,
process_util::GetPersistentBackgroundPageState(*extension(),
browser_context()));
LoadInitialURL();
}

View File

@ -52,6 +52,6 @@ void CefExtensionWebContentsObserver::RenderFrameCreated(
}
}
WEB_CONTENTS_USER_DATA_KEY_IMPL(CefExtensionWebContentsObserver)
WEB_CONTENTS_USER_DATA_KEY_IMPL(CefExtensionWebContentsObserver);
} // namespace extensions

View File

@ -6,8 +6,8 @@
#ifndef CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_API_CLIENT_H_
#define CEF_LIBCEF_BROWSER_EXTENSIONS_EXTENSIONS_API_CLIENT_H_
#include "components/value_store/value_store_factory.h"
#include "extensions/browser/api/extensions_api_client.h"
#include "extensions/browser/value_store/value_store_factory.h"
namespace extensions {

View File

@ -13,7 +13,7 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "extensions/browser/value_store/value_store.h"
#include "components/value_store/value_store.h"
namespace value_store {

View File

@ -9,7 +9,7 @@
#include "base/containers/contains.h"
#include "base/memory/ptr_util.h"
#include "extensions/browser/value_store/leveldb_value_store.h"
#include "components/value_store/leveldb_value_store.h"
namespace {

View File

@ -10,7 +10,7 @@
#include <memory>
#include "base/files/file_path.h"
#include "extensions/browser/value_store/value_store_factory.h"
#include "components/value_store/value_store_factory.h"
namespace value_store {

View File

@ -0,0 +1,125 @@
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CEF_LIBCEF_BROWSER_FRAME_SERVICE_BASE_H_
#define CEF_LIBCEF_BROWSER_FRAME_SERVICE_BASE_H_
#include <utility>
#include "base/bind.h"
#include "base/logging.h"
#include "base/threading/thread_checker.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "url/origin.h"
namespace content {
// Base class for mojo interface implementations tied to a document's lifetime.
// The service will be destroyed when any of the following happens:
// 1. mojo interface connection error happened,
// 2. the RenderFrameHost was deleted, or
// 3. navigation was committed on the RenderFrameHost (not same document) and
// ShouldCloseOnFinishNavigation() returns true.
//
// WARNING: To avoid race conditions, subclasses MUST only get the origin via
// origin() instead of from |render_frame_host| passed in the constructor.
// See https://crbug.com/769189 for an example of such a race.
//
// Based on the old implementation of DocumentServiceBase that existed prior to
// https://crrev.com/2809effa24. CEF requires the old implementation to support
// bindings that outlive navigation.
template <typename Interface>
class FrameServiceBase : public Interface, public WebContentsObserver {
public:
FrameServiceBase(RenderFrameHost* render_frame_host,
mojo::PendingReceiver<Interface> pending_receiver)
: WebContentsObserver(
WebContents::FromRenderFrameHost(render_frame_host)),
render_frame_host_(render_frame_host),
origin_(render_frame_host_->GetLastCommittedOrigin()),
receiver_(this, std::move(pending_receiver)) {
// |this| owns |receiver_|, so unretained is safe.
receiver_.set_disconnect_handler(
base::BindOnce(&FrameServiceBase::Close, base::Unretained(this)));
}
protected:
// Make the destructor private since |this| can only be deleted by Close().
virtual ~FrameServiceBase() = default;
// All subclasses should use this function to obtain the origin instead of
// trying to get it from the RenderFrameHost pointer directly.
const url::Origin& origin() const { return origin_; }
// Returns the RenderFrameHost held by this object.
RenderFrameHost* render_frame_host() const { return render_frame_host_; }
// Subclasses can use this to check thread safety.
// For example: DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
THREAD_CHECKER(thread_checker_);
private:
// Disallow calling web_contents() directly from the subclasses to ensure that
// tab-level state doesn't get queried or updated when the RenderFrameHost is
// not active.
// Use WebContents::From(render_frame_host()) instead, but please keep in mind
// that the render_frame_host() might not be active. See
// RenderFrameHost::IsActive() for details.
using WebContentsObserver::web_contents;
// WebContentsObserver implementation.
void RenderFrameDeleted(RenderFrameHost* render_frame_host) final {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (render_frame_host == render_frame_host_) {
DVLOG(1) << __func__ << ": RenderFrame destroyed.";
Close();
}
}
void DidFinishNavigation(NavigationHandle* navigation_handle) final {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
if (!ShouldCloseOnFinishNavigation())
return;
if (!navigation_handle->HasCommitted() ||
navigation_handle->IsSameDocument() ||
navigation_handle->IsPageActivation()) {
return;
}
if (navigation_handle->GetRenderFrameHost() == render_frame_host_) {
// FrameServiceBase is destroyed either when RenderFrameHost is
// destroyed (covered by RenderFrameDeleted) or when a new document
// commits in the same RenderFrameHost (covered by DidFinishNavigation).
// Only committed non-same-document non-bfcache non-prerendering
// activation navigations replace a document in existing RenderFrameHost.
DVLOG(1) << __func__ << ": Close connection on navigation.";
Close();
}
}
// Used for CEF bindings that outlive navigation.
virtual bool ShouldCloseOnFinishNavigation() const { return true; }
// Stops observing WebContents and delete |this|.
void Close() {
DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
DVLOG(1) << __func__;
delete this;
}
RenderFrameHost* const render_frame_host_ = nullptr;
const url::Origin origin_;
mojo::Receiver<Interface> receiver_;
};
} // namespace content
#endif // CEF_LIBCEF_BROWSER_FRAME_SERVICE_BASE_H_

View File

@ -184,7 +184,7 @@ void CefMediaRouterManager::CreateRoute(
source_id, sink_id, origin, nullptr /* web_contents */,
base::BindOnce(&CefMediaRouterManager::OnCreateRoute,
weak_ptr_factory_.GetWeakPtr(), std::move(callback)),
base::TimeDelta::FromMilliseconds(kTimeoutMs), false /* incognito */);
base::Milliseconds(kTimeoutMs), false /* incognito */);
}
void CefMediaRouterManager::SendRouteMessage(

View File

@ -559,7 +559,7 @@ void CefBrowserPlatformDelegateNativeMac::TranslateWebMouseEvent(
// timestamp
result.SetTimeStamp(base::TimeTicks() +
base::TimeDelta::FromSeconds(currentEventTimestamp()));
base::Seconds(currentEventTimestamp()));
result.pointer_type = blink::WebPointerProperties::PointerType::kMouse;
}

View File

@ -21,6 +21,7 @@
#include "ui/base/l10n/l10n_util_win.h"
#include "ui/base/models/image_model.h"
#include "ui/base/models/menu_model.h"
#include "ui/color/color_provider_manager.h"
#include "ui/events/keycodes/keyboard_codes.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/font_list.h"
@ -295,11 +296,33 @@ class CefNativeMenuWin::MenuHostWindow {
ui::NativeTheme* native_theme =
ui::NativeTheme::GetInstanceForNativeUi();
// Logic from Widget::GetColorProviderKey() prior to
// https://crrev.com/e24ffe177b.
// TODO(cef): Use |native_theme->GetColorProviderKey(nullptr)| after M97
// Chromium update.
const auto color_scheme = native_theme->GetDefaultSystemColorScheme();
ui::ColorProviderManager::Key color_provider_key(
(color_scheme == ui::NativeTheme::ColorScheme::kDark)
? ui::ColorProviderManager::ColorMode::kDark
: ui::ColorProviderManager::ColorMode::kLight,
(color_scheme ==
ui::NativeTheme::ColorScheme::kPlatformHighContrast)
? ui::ColorProviderManager::ContrastMode::kHigh
: ui::ColorProviderManager::ContrastMode::kNormal,
native_theme->is_custom_system_theme()
? ui::ColorProviderManager::SystemTheme::kCustom
: ui::ColorProviderManager::SystemTheme::kDefault,
/*custom_theme=*/nullptr);
auto* color_provider =
ui::ColorProviderManager::Get().GetColorProviderFor(
color_provider_key);
// We currently don't support items with both icons and checkboxes.
const gfx::ImageSkia skia_icon =
icon.IsImage() ? icon.GetImage().AsImageSkia()
: ui::ThemedVectorIcon(icon.GetVectorIcon())
.GetImageSkia(native_theme, 16);
.GetImageSkia(color_provider, 16);
DCHECK(type != ui::MenuModel::TYPE_CHECK);
std::unique_ptr<SkCanvas> canvas = skia::CreatePlatformCanvas(

View File

@ -81,15 +81,17 @@ void GetCookieListCallback(const AllowCookieCallback& allow_cookie_callback,
std::move(done_callback), included_cookies));
}
void LoadCookiesOnUIThread(content::BrowserContext* browser_context,
const GURL& url,
const net::CookieOptions& options,
const AllowCookieCallback& allow_cookie_callback,
DoneCookieCallback done_callback) {
void LoadCookiesOnUIThread(
content::BrowserContext* browser_context,
const GURL& url,
const net::CookieOptions& options,
const net::CookiePartitionKeychain& cookie_partition_keychain,
const AllowCookieCallback& allow_cookie_callback,
DoneCookieCallback done_callback) {
CEF_REQUIRE_UIT();
GetCookieManager(browser_context)
->GetCookieList(
url, options,
url, options, cookie_partition_keychain,
base::BindOnce(GetCookieListCallback, allow_cookie_callback,
std::move(done_callback)));
}
@ -199,9 +201,10 @@ void LoadCookies(content::BrowserContext* browser_context,
}
CEF_POST_TASK(
CEF_UIT, base::BindOnce(LoadCookiesOnUIThread, browser_context,
request.url, GetCookieOptions(request),
allow_cookie_callback, std::move(done_callback)));
CEF_UIT,
base::BindOnce(LoadCookiesOnUIThread, browser_context, request.url,
GetCookieOptions(request), net::CookiePartitionKeychain(),
allow_cookie_callback, std::move(done_callback)));
}
void SaveCookies(content::BrowserContext* browser_context,

View File

@ -257,7 +257,7 @@ bool CefCookieManagerImpl::VisitUrlCookiesInternal(
return false;
GetCookieManager(browser_context)
->GetCookieList(url, options,
->GetCookieList(url, options, net::CookiePartitionKeychain(),
base::BindOnce(&GetCookiesCallbackImpl, visitor,
browser_context_getter_));
return true;

View File

@ -17,7 +17,7 @@
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_text_utils.h"
#include "ui/accessibility/ax_tree_update.h"
#include "ui/gfx/transform.h"
#include "ui/gfx/geometry/transform.h"
namespace {
using ui::ToString;

View File

@ -723,6 +723,12 @@ void CefRenderWidgetHostViewOSR::GetScreenInfo(display::ScreenInfo* results) {
*results = ScreenInfoFrom(screen_info);
}
display::ScreenInfos CefRenderWidgetHostViewOSR::GetScreenInfos() {
display::ScreenInfo screen_info;
GetScreenInfo(&screen_info);
return display::ScreenInfos(screen_info);
}
void CefRenderWidgetHostViewOSR::TransformPointToRootSurface(
gfx::PointF* point) {}
@ -1516,14 +1522,11 @@ bool CefRenderWidgetHostViewOSR::SetDeviceScaleFactor() {
void CefRenderWidgetHostViewOSR::SetCurrentDeviceScaleFactor(float scale) {
// Initialize a display struct as needed, to cache the scale factor.
if (display_list_.displays().empty()) {
display_list_ = display::DisplayList(
{display::Display(display::kDefaultDisplayId)},
display::kDefaultDisplayId, display::kDefaultDisplayId);
if (screen_infos_.screen_infos.empty()) {
screen_infos_ = display::ScreenInfos(display::ScreenInfo());
}
display::Display current_display = display_list_.GetCurrentDisplay();
current_display.set_device_scale_factor(scale);
display_list_.UpdateDisplay(current_display);
screen_infos_.mutable_current().device_scale_factor = scale;
UpdateScreenInfo();
}
bool CefRenderWidgetHostViewOSR::SetViewBounds() {

View File

@ -159,6 +159,7 @@ class CefRenderWidgetHostViewOSR
const gfx::Size& output_size,
base::OnceCallback<void(const SkBitmap&)> callback) override;
void GetScreenInfo(display::ScreenInfo* results) override;
display::ScreenInfos GetScreenInfos() override;
void TransformPointToRootSurface(gfx::PointF* point) override;
gfx::Rect GetBoundsInRootWindow() override;

View File

@ -22,6 +22,7 @@
#include "base/values.h"
#include "content/public/browser/global_routing_id.h"
#include "printing/metafile.h"
#include "printing/mojom/print.mojom-shared.h"
#include "printing/print_job_constants.h"
#include "printing/print_settings.h"
@ -175,7 +176,7 @@ void CefPrintDialogLinux::ShowDialog(
SetHandler();
if (!handler_.get()) {
std::move(callback).Run(PrintingContextLinux::CANCEL);
std::move(callback).Run(printing::mojom::ResultCode::kCanceled);
return;
}
@ -291,11 +292,11 @@ void CefPrintDialogLinux::OnPrintContinue(
CefPrintSettingsImpl* impl =
static_cast<CefPrintSettingsImpl*>(settings.get());
context_->InitWithSettings(impl->TakeOwnership());
std::move(callback_).Run(PrintingContextLinux::OK);
std::move(callback_).Run(printing::mojom::ResultCode::kSuccess);
}
void CefPrintDialogLinux::OnPrintCancel() {
std::move(callback_).Run(PrintingContextLinux::CANCEL);
std::move(callback_).Run(printing::mojom::ResultCode::kCanceled);
}
void CefPrintDialogLinux::OnJobCompleted() {

View File

@ -44,8 +44,7 @@
#define CEF_POST_TASK(id, task) base::PostTask(FROM_HERE, {id}, task)
#define CEF_POST_DELAYED_TASK(id, task, delay_ms) \
base::PostDelayedTask(FROM_HERE, {id}, task, \
base::TimeDelta::FromMilliseconds(delay_ms))
base::PostDelayedTask(FROM_HERE, {id}, task, base::Milliseconds(delay_ms))
// Post a blocking task with the specified |priority|. Tasks that have not
// started executing at shutdown will never run. However, any task that has

View File

@ -13,6 +13,7 @@
#include "libcef/browser/views/view_util.h"
#include "base/logging.h"
#include "ui/views/accessibility/accessibility_paint_checks.h"
#include "ui/views/background.h"
#include "ui/views/view.h"
@ -46,6 +47,10 @@ CEF_VIEW_VIEW_T class CefViewView : public ViewsViewClass {
// Use our defaults instead of the Views framework defaults.
ParentClass::SetBackground(
views::CreateSolidBackground(view_util::kDefaultBackgroundColor));
// TODO(crbug.com/1218186): Remove this, if this view is focusable then it
// needs to add a name so that the screen reader knows what to announce.
ParentClass::SetProperty(views::kSkipAccessibilityPaintChecks, true);
}
// Returns the CefViewDelegate-derived delegate associated with this view.

View File

@ -23,15 +23,28 @@
#include "ui/aura/test/ui_controls_factory_aura.h"
#include "ui/aura/window.h"
#include "ui/base/test/ui_controls_aura.h"
#if defined(OS_LINUX) && defined(USE_X11)
#include "ui/views/test/ui_controls_factory_desktop_aurax11.h"
#endif
#if defined(USE_OZONE)
#include "ui/ozone/public/ozone_ui_controls_test_helper.h"
#include "ui/views/test/ui_controls_factory_desktop_aura_ozone.h"
#endif
#endif // defined(USE_AURA)
#if defined(OS_WIN)
#include "ui/display/win/screen_win.h"
#endif
#if defined(USE_AURA) && defined(USE_OZONE)
// Stub implementation for function called from
// $root_gen_dir/ui/ozone/test_constructor_list.cc to avoid
// //ui/ozone/platform/wayland:ui_test_support dependencies.
namespace ui {
OzoneUIControlsTestHelper* CreateOzoneUIControlsTestHelperWayland() {
NOTREACHED();
return nullptr;
}
} // namespace ui
#endif
namespace {
// Based on chrome/test/base/interactive_ui_tests_main.cc.
@ -41,14 +54,14 @@ void InitializeUITesting() {
ui_controls::EnableUIControls();
#if defined(USE_AURA)
#if defined(OS_LINUX) && defined(USE_X11)
ui_controls::InstallUIControlsAura(
views::test::CreateUIControlsDesktopAura());
#else
#if defined(OS_WIN)
ui_controls::InstallUIControlsAura(
aura::test::CreateUIControlsAura(nullptr));
#elif defined(USE_OZONE)
ui_controls::InstallUIControlsAura(
views::test::CreateUIControlsDesktopAuraOzone());
#endif
#endif
#endif // defined(USE_AURA)
initialized = true;
}

View File

@ -5,6 +5,7 @@
#ifndef CEF_LIBCEF_COMMON_CEF_CRASH_REPORT_UPLOAD_THREAD_H_
#define CEF_LIBCEF_COMMON_CEF_CRASH_REPORT_UPLOAD_THREAD_H_
#include "base/macros.h"
#include "third_party/crashpad/crashpad/handler/crash_report_upload_thread.h"
class CefCrashReportUploadThread : public crashpad::CrashReportUploadThread {

View File

@ -40,7 +40,7 @@ bool CefPostDelayedTask(CefThreadId threadId,
if (task_runner.get()) {
return task_runner->PostDelayedTask(
FROM_HERE, base::BindOnce(&CefTask::Execute, task.get()),
base::TimeDelta::FromMilliseconds(delay_ms));
base::Milliseconds(delay_ms));
}
LOG(WARNING) << "No task runner for threadId " << threadId;

View File

@ -145,5 +145,5 @@ bool CefTaskRunnerImpl::PostDelayedTask(CefRefPtr<CefTask> task,
int64 delay_ms) {
return task_runner_->PostDelayedTask(
FROM_HERE, base::BindOnce(&CefTask::Execute, task.get()),
base::TimeDelta::FromMilliseconds(delay_ms));
base::Milliseconds(delay_ms));
}

View File

@ -57,5 +57,5 @@ void CefWaitableEventImpl::Wait() {
bool CefWaitableEventImpl::TimedWait(int64 max_ms) {
if (!AllowWait())
return false;
return event_.TimedWait(base::TimeDelta::FromMilliseconds(max_ms));
return event_.TimedWait(base::Milliseconds(max_ms));
}

View File

@ -66,7 +66,8 @@ class CefWebURLLoaderClient : public blink::WebURLLoaderClient {
const WebString& new_method,
const WebURLResponse& passed_redirect_response,
bool& report_raw_headers,
std::vector<std::string>* removed_headers) override;
std::vector<std::string>* removed_headers,
bool insecure_scheme_was_upgraded) override;
protected:
// The context_ pointer will outlive this object.
@ -398,7 +399,8 @@ bool CefWebURLLoaderClient::WillFollowRedirect(
const WebString& new_method,
const WebURLResponse& passed_redirect_response,
bool& report_raw_headers,
std::vector<std::string>* removed_headers) {
std::vector<std::string>* removed_headers,
bool insecure_scheme_was_upgraded) {
if (request_flags_ & UR_FLAG_STOP_ON_REDIRECT) {
context_->OnStopRedirect(new_url, passed_redirect_response);
return false;

View File

@ -33,9 +33,9 @@
#define CEF_POST_TASK_RT(task) \
CEF_RENDER_TASK_RUNNER()->PostTask(FROM_HERE, task)
#define CEF_POST_DELAYED_TASK_RT(task, delay_ms) \
CEF_RENDER_TASK_RUNNER()->PostDelayedTask( \
FROM_HERE, task, base::TimeDelta::FromMilliseconds(delay_ms))
#define CEF_POST_DELAYED_TASK_RT(task, delay_ms) \
CEF_RENDER_TASK_RUNNER()->PostDelayedTask(FROM_HERE, task, \
base::Milliseconds(delay_ms))
// Use this template in conjuction with RefCountedThreadSafe when you want to
// ensure that an object is deleted on the render thread.