Update to Chromium version 109.0.5414.0 (#1070088)

- mac: Xcode 14.0 with macOS SDK 13.0 is now required.
- Remove CefRequestHandler::OnQuotaRequest because persistent quota is no
  longer supported (see https://crbug.com/1208141)
This commit is contained in:
Marshall Greenblatt
2022-11-15 12:50:53 -05:00
parent 74fc5d5573
commit 47d69a842a
86 changed files with 559 additions and 781 deletions

View File

@ -100,7 +100,6 @@
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/overlay_window.h"
#include "content/public/browser/page_navigator.h"
#include "content/public/browser/quota_permission_context.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
@ -109,7 +108,6 @@
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_ui_url_loader_factory.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/storage_quota_params.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/user_agent.h"
#include "crypto/crypto_buildflags.h"
@ -137,7 +135,6 @@
#include "services/network/public/cpp/network_switches.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/public/mojom/connector.mojom.h"
#include "storage/browser/quota/quota_settings.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "third_party/blink/public/mojom/badging/badging.mojom.h"
@ -173,59 +170,6 @@
namespace {
class CefQuotaCallbackImpl : public CefCallback {
public:
using CallbackType = content::QuotaPermissionContext::PermissionCallback;
explicit CefQuotaCallbackImpl(CallbackType callback)
: callback_(std::move(callback)) {}
CefQuotaCallbackImpl(const CefQuotaCallbackImpl&) = delete;
CefQuotaCallbackImpl& operator=(const CefQuotaCallbackImpl&) = delete;
~CefQuotaCallbackImpl() {
if (!callback_.is_null()) {
// The callback is still pending. Cancel it now.
if (CEF_CURRENTLY_ON_IOT()) {
RunNow(std::move(callback_), false);
} else {
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefQuotaCallbackImpl::RunNow,
std::move(callback_), false));
}
}
}
void Continue() override { ContinueNow(true); }
void Cancel() override { ContinueNow(false); }
[[nodiscard]] CallbackType Disconnect() { return std::move(callback_); }
private:
void ContinueNow(bool allow) {
if (CEF_CURRENTLY_ON_IOT()) {
if (!callback_.is_null()) {
RunNow(std::move(callback_), allow);
}
} else {
CEF_POST_TASK(CEF_IOT, base::BindOnce(&CefQuotaCallbackImpl::ContinueNow,
this, allow));
}
}
static void RunNow(CallbackType callback, bool allow) {
CEF_REQUIRE_IOT();
std::move(callback).Run(
allow ? content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_ALLOW
: content::QuotaPermissionContext::
QUOTA_PERMISSION_RESPONSE_DISALLOW);
}
CallbackType callback_;
IMPLEMENT_REFCOUNTING(CefQuotaCallbackImpl);
};
class CefSelectClientCertificateCallbackImpl
: public CefSelectClientCertificateCallback {
public:
@ -300,57 +244,6 @@ class CefSelectClientCertificateCallbackImpl
IMPLEMENT_REFCOUNTING(CefSelectClientCertificateCallbackImpl);
};
class CefQuotaPermissionContext : public content::QuotaPermissionContext {
public:
CefQuotaPermissionContext() = default;
CefQuotaPermissionContext(const CefQuotaPermissionContext&) = delete;
CefQuotaPermissionContext& operator=(const CefQuotaPermissionContext&) =
delete;
// The callback will be dispatched on the IO thread.
void RequestQuotaPermission(const content::StorageQuotaParams& params,
int render_process_id,
PermissionCallback callback) override {
if (params.storage_type != blink::mojom::StorageType::kPersistent) {
// To match Chrome behavior we only support requesting quota with this
// interface for Persistent storage type.
std::move(callback).Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
return;
}
bool handled = false;
CefRefPtr<AlloyBrowserHostImpl> browser =
AlloyBrowserHostImpl::GetBrowserForGlobalId(frame_util::MakeGlobalId(
render_process_id, params.render_frame_id));
if (browser) {
if (auto client = browser->GetClient()) {
if (auto handler = client->GetRequestHandler()) {
CefRefPtr<CefQuotaCallbackImpl> callbackImpl(
new CefQuotaCallbackImpl(std::move(callback)));
handled = handler->OnQuotaRequest(
browser.get(), params.origin_url.spec(), params.requested_size,
callbackImpl.get());
if (!handled) {
// May return nullptr if the client has already executed the
// callback.
callback = callbackImpl->Disconnect();
}
}
}
}
if (!handled && !callback.is_null()) {
// Disallow the request by default.
std::move(callback).Run(QUOTA_PERMISSION_RESPONSE_DISALLOW);
}
}
private:
~CefQuotaPermissionContext() override = default;
};
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
int GetCrashSignalFD() {
if (!crash_reporting::Enabled())
@ -787,11 +680,6 @@ AlloyContentBrowserClient::GetSystemNetworkContext() {
return SystemNetworkContextManager::GetInstance()->GetContext();
}
scoped_refptr<content::QuotaPermissionContext>
AlloyContentBrowserClient::CreateQuotaPermissionContext() {
return new CefQuotaPermissionContext();
}
content::MediaObserver* AlloyContentBrowserClient::GetMediaObserver() {
return CefMediaCaptureDevicesDispatcher::GetInstance();
}
@ -1309,6 +1197,7 @@ bool AlloyContentBrowserClient::HandleExternalProtocol(
web_contents_getter, std::move(receiver), std::move(request_handler));
return true;
}
std::unique_ptr<content::VideoOverlayWindow>
AlloyContentBrowserClient::CreateWindowForVideoPictureInPicture(
content::VideoPictureInPictureWindowController* controller) {
@ -1321,17 +1210,6 @@ AlloyContentBrowserClient::CreateWindowForVideoPictureInPicture(
return content::VideoOverlayWindow::Create(controller);
}
std::unique_ptr<content::DocumentOverlayWindow>
AlloyContentBrowserClient::CreateWindowForDocumentPictureInPicture(
content::DocumentPictureInPictureWindowController* controller) {
// Note: content::DocumentOverlayWindow::Create() is defined by
// platform-specific implementation in chrome/browser/ui/views. This layering
// hack, which goes through //content and ContentBrowserClient, allows us to
// work around the dependency constraints that disallow directly calling
// chrome/browser/ui/views code either from here or from other code in
// chrome/browser.
return content::DocumentOverlayWindow::Create(controller);
}
void AlloyContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
content::RenderFrameHost* render_frame_host,
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) {

View File

@ -75,8 +75,6 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
scoped_refptr<network::SharedURLLoaderFactory>
GetSystemSharedURLLoaderFactory() override;
network::mojom::NetworkContext* GetSystemNetworkContext() override;
scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext()
override;
content::MediaObserver* GetMediaObserver() override;
content::SpeechRecognitionManagerDelegate*
CreateSpeechRecognitionManagerDelegate() override;
@ -221,9 +219,6 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
std::unique_ptr<content::VideoOverlayWindow>
CreateWindowForVideoPictureInPicture(
content::VideoPictureInPictureWindowController* controller) override;
std::unique_ptr<content::DocumentOverlayWindow>
CreateWindowForDocumentPictureInPicture(
content::DocumentPictureInPictureWindowController* controller) override;
void RegisterBrowserInterfaceBindersForFrame(
content::RenderFrameHost* render_frame_host,
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) override;

View File

@ -136,7 +136,7 @@ bool ValidateCachePath(const base::FilePath& cache_path,
return false;
}
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::ScopedAllowBlockingForTesting allow_blocking;
if (!base::DirectoryExists(cache_path) &&
!base::CreateDirectory(cache_path)) {
LOG(ERROR) << "The cache_path directory (" << cache_path.value()

View File

@ -16,7 +16,8 @@ CefExtensionImpl::CefExtensionImpl(const extensions::Extension* extension,
: id_(extension->id()),
path_(extension->path().value()),
manifest_(new CefDictionaryValueImpl(
extension->manifest()->value()->CreateDeepCopy().release(),
static_cast<base::DictionaryValue*>(
new base::Value(extension->manifest()->value()->Clone())),
true,
true)),
loader_context_(loader_context),

View File

@ -56,7 +56,7 @@ CefMediaStreamRegistrar::CefMediaStreamRegistrar(CefBrowserHostBase* browser)
std::unique_ptr<content::MediaStreamUI>
CefMediaStreamRegistrar::MaybeCreateMediaStreamUI(bool has_video,
bool has_audio) const {
bool has_audio) {
// Only create the object if the callback will be executed.
if (auto client = browser_->GetClient()) {
if (auto handler = client->GetDisplayHandler()) {

View File

@ -25,7 +25,7 @@ class CefMediaStreamRegistrar {
std::unique_ptr<content::MediaStreamUI> MaybeCreateMediaStreamUI(
bool has_video,
bool has_audio) const;
bool has_audio);
private:
friend class CefMediaStreamUI;

View File

@ -16,7 +16,6 @@
#include "base/base_paths_win.h"
#include "base/files/file_util.h"
#include "base/memory/ref_counted_memory.h"
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/registry.h"
@ -43,7 +42,7 @@
namespace {
void WriteTempFileAndView(scoped_refptr<base::RefCountedString> str) {
void WriteTempFileAndView(const std::string& data) {
CEF_REQUIRE_BLOCKING();
base::FilePath tmp_file;
@ -54,7 +53,6 @@ void WriteTempFileAndView(scoped_refptr<base::RefCountedString> str) {
// program to open.
tmp_file = tmp_file.AddExtension(L"txt");
const std::string& data = str->data();
int write_ct = base::WriteFile(tmp_file, data.c_str(), data.size());
DCHECK_EQ(static_cast<int>(data.size()), write_ct);
@ -432,10 +430,7 @@ void CefBrowserPlatformDelegateNativeWin::SizeTo(int width, int height) {
}
void CefBrowserPlatformDelegateNativeWin::ViewText(const std::string& text) {
std::string str = text;
scoped_refptr<base::RefCountedString> str_ref =
base::RefCountedString::TakeString(&str);
CEF_POST_USER_VISIBLE_TASK(base::BindOnce(WriteTempFileAndView, str_ref));
CEF_POST_USER_VISIBLE_TASK(base::BindOnce(WriteTempFileAndView, text));
}
bool CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(

View File

@ -8,7 +8,7 @@
#if BUILDFLAG(OZONE_PLATFORM_X11)
#include "ui/base/x/x11_cursor.h"
#elif defined(USE_OZONE)
#elif BUILDFLAG(IS_OZONE)
#include "ui/ozone/common/bitmap_cursor.h"
#endif
@ -19,7 +19,7 @@ cef_cursor_handle_t ToCursorHandle(scoped_refptr<ui::PlatformCursor> cursor) {
// See https://crbug.com/1029142 for background.
return static_cast<cef_cursor_handle_t>(
ui::X11Cursor::FromPlatformCursor(cursor)->xcursor());
#elif defined(USE_OZONE)
#elif BUILDFLAG(IS_OZONE)
return static_cast<cef_cursor_handle_t>(
ui::BitmapCursor::FromPlatformCursor(cursor)->platform_data());
#else

View File

@ -32,7 +32,7 @@ base::FilePath FilePathFromASCII(const std::string& str) {
std::string GetMimeType(const std::string& filename) {
// Requests should not block on the disk! On POSIX this goes to disk.
// http://code.google.com/p/chromium/issues/detail?id=59849
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::ScopedAllowBlockingForTesting allow_blocking;
std::string mime_type;
const base::FilePath& file_path = FilePathFromASCII(filename);
@ -176,7 +176,8 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory {
<< action.resource_id << " URL: " << url.spec().c_str();
return nullptr;
}
action.bytes = base::RefCountedString::TakeString(&str);
action.bytes =
base::MakeRefCounted<base::RefCountedString>(std::move(str));
}
if (action.bytes) {

View File

@ -334,7 +334,7 @@ class CefBrowserURLRequest::Context
if (!extension.empty()) {
// Requests should not block on the disk! On POSIX this goes to
// disk. http://code.google.com/p/chromium/issues/detail?id=59849
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::ScopedAllowBlockingForTesting allow_blocking;
// Also remove the leading period.
net::GetMimeTypeFromExtension(extension.substr(1), &content_type);
}

View File

@ -111,7 +111,7 @@ class CefPermissionPrompt : public permissions::PermissionPrompt {
}
// Used to tie Delegate access to this object's lifespan.
DelegateCallback MakeDelegateCallback() const {
DelegateCallback MakeDelegateCallback() {
return base::BindOnce(&CefPermissionPrompt::NotifyDelegate,
weak_ptr_factory_.GetWeakPtr());
}

View File

@ -304,6 +304,10 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
registry->RegisterBooleanPref(prefs::kSearchSuggestEnabled, false);
registry->RegisterStringPref(prefs::kSessionExitType, std::string());
// Based on ChromeContentBrowserClient::RegisterProfilePrefs.
registry->RegisterBooleanPref(
prefs::kAccessControlAllowMethodsInCORSPreflightSpecConformant, true);
// Spell checking preferences.
// Modify defaults from SpellcheckServiceFactory::RegisterProfilePrefs.
std::string spellcheck_lang =

View File

@ -50,7 +50,7 @@ CefRefPtr<CefValue> GetPreference(PrefService* pref_service,
const PrefService::Preference* pref = pref_service->FindPreference(name);
if (!pref)
return nullptr;
return new CefValueImpl(pref->GetValue()->CreateDeepCopy().release());
return new CefValueImpl(new base::Value(pref->GetValue()->Clone()));
}
CefRefPtr<CefDictionaryValue> GetAllPreferences(PrefService* pref_service,

View File

@ -109,10 +109,6 @@ void CefPrefStore::CommitPendingWrite(
void CefPrefStore::SchedulePendingLossyWrites() {}
void CefPrefStore::ClearMutableValues() {
NOTIMPLEMENTED();
}
void CefPrefStore::OnStoreDeletionFromDisk() {}
void CefPrefStore::SetInitializationCompleted() {

View File

@ -51,7 +51,6 @@ class CefPrefStore : public PersistentPrefStore {
base::OnceClosure done_callback,
base::OnceClosure synchronous_done_callback) override;
void SchedulePendingLossyWrites() override;
void ClearMutableValues() override;
void OnStoreDeletionFromDisk() override;
// Marks the store as having completed initialization.

View File

@ -15,7 +15,7 @@ CefRefPtr<CefStreamReader> CefStreamReader::CreateForFile(
DCHECK(!fileName.empty());
// TODO(cef): Do not allow file IO on all threads (issue #1187).
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::ScopedAllowBlockingForTesting allow_blocking;
CefRefPtr<CefStreamReader> reader;
FILE* file = base::OpenFile(base::FilePath(fileName), "rb");
@ -48,7 +48,7 @@ CefRefPtr<CefStreamWriter> CefStreamWriter::CreateForFile(
DCHECK(!fileName.empty());
// TODO(cef): Do not allow file IO on all threads (issue #1187).
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::ScopedAllowBlockingForTesting allow_blocking;
CefRefPtr<CefStreamWriter> writer;
FILE* file = base::OpenFile(base::FilePath(fileName), "wb");

View File

@ -23,7 +23,7 @@
#include "ui/aura/test/ui_controls_factory_aura.h"
#include "ui/aura/window.h"
#include "ui/base/test/ui_controls_aura.h"
#if defined(USE_OZONE)
#if BUILDFLAG(IS_OZONE)
#include "ui/views/test/ui_controls_factory_desktop_aura_ozone.h"
#endif
#endif // defined(USE_AURA)
@ -44,7 +44,7 @@ void InitializeUITesting() {
#if BUILDFLAG(IS_WIN)
ui_controls::InstallUIControlsAura(
aura::test::CreateUIControlsAura(nullptr));
#elif defined(USE_OZONE)
#elif BUILDFLAG(IS_OZONE)
ui_controls::InstallUIControlsAura(
views::test::CreateUIControlsDesktopAuraOzone());
#endif

View File

@ -101,7 +101,7 @@ CefString CefFormatUrlForSecurityDisplay(const CefString& origin_url) {
CefString CefGetMimeType(const CefString& extension) {
// Requests should not block on the disk! On POSIX this goes to disk.
// http://code.google.com/p/chromium/issues/detail?id=59849
base::ThreadRestrictions::ScopedAllowIO allow_io;
base::ScopedAllowBlockingForTesting allow_blocking;
std::string mime_type;
net::GetMimeTypeFromExtension(extension, &mime_type);

View File

@ -65,7 +65,7 @@ CefRefPtr<CefValue> CefValueImpl::GetOrCreateRefOrCopy(
list_value, parent_value, read_only, controller));
}
return new CefValueImpl(value->CreateDeepCopy().release());
return new CefValueImpl(new base::Value(value->Clone()));
}
CefValueImpl::CefValueImpl() {}
@ -109,7 +109,7 @@ base::Value* CefValueImpl::CopyOrDetachValue(
->CopyOrDetachValue(new_controller);
}
return value_->CreateDeepCopy().release();
return new base::Value(value_->Clone());
}
void CefValueImpl::SwapValue(base::Value* new_value,
@ -226,7 +226,7 @@ CefRefPtr<CefValue> CefValueImpl::Copy() {
if (list_value_)
return new CefValueImpl(list_value_->Copy());
if (value_)
return new CefValueImpl(value_->CreateDeepCopy().release());
return new CefValueImpl(new base::Value(value_->Clone()));
return new CefValueImpl();
}
@ -483,7 +483,7 @@ CefBinaryValueImpl::CefBinaryValueImpl(char* data, size_t data_size)
base::Value* CefBinaryValueImpl::CopyValue() {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
return const_value().CreateDeepCopy().release();
return new base::Value(const_value().Clone());
}
base::Value* CefBinaryValueImpl::CopyOrDetachValue(
@ -551,9 +551,8 @@ bool CefBinaryValueImpl::IsEqual(CefRefPtr<CefBinaryValue> that) {
CefRefPtr<CefBinaryValue> CefBinaryValueImpl::Copy() {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
return new CefBinaryValueImpl(const_value().CreateDeepCopy().release(),
nullptr, CefBinaryValueImpl::kOwnerWillDelete,
nullptr);
return new CefBinaryValueImpl(new base::Value(const_value().Clone()), nullptr,
CefBinaryValueImpl::kOwnerWillDelete, nullptr);
}
size_t CefBinaryValueImpl::GetSize() {
@ -626,7 +625,8 @@ CefDictionaryValueImpl::CefDictionaryValueImpl(base::DictionaryValue* value,
base::DictionaryValue* CefDictionaryValueImpl::CopyValue() {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
return const_value().CreateDeepCopy().release();
return static_cast<base::DictionaryValue*>(
new base::Value(const_value().Clone()));
}
base::DictionaryValue* CefDictionaryValueImpl::CopyOrDetachValue(
@ -700,7 +700,8 @@ CefRefPtr<CefDictionaryValue> CefDictionaryValueImpl::Copy(
bool exclude_empty_children) {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
base::DictionaryValue* value = const_value().CreateDeepCopy().release();
base::DictionaryValue* value = static_cast<base::DictionaryValue*>(
new base::Value(const_value().Clone()));
if (exclude_empty_children) {
RemoveEmptyValueDicts(value->GetDict());
}
@ -1057,8 +1058,7 @@ CefListValueImpl::CefListValueImpl(base::ListValue* value,
base::ListValue* CefListValueImpl::CopyValue() {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
return static_cast<base::ListValue*>(
const_value().CreateDeepCopy().release());
return static_cast<base::ListValue*>(new base::Value(const_value().Clone()));
}
base::ListValue* CefListValueImpl::CopyOrDetachValue(
@ -1132,7 +1132,7 @@ CefRefPtr<CefListValue> CefListValueImpl::Copy() {
CEF_VALUE_VERIFY_RETURN(false, nullptr);
return new CefListValueImpl(
static_cast<base::ListValue*>(const_value().CreateDeepCopy().release()),
static_cast<base::ListValue*>(new base::Value(const_value().Clone())),
nullptr, CefListValueImpl::kOwnerWillDelete, false, nullptr);
}