summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-09-04 11:31:59 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-12-02 09:18:42 +0100
commit5dc3a3fb5e3286a9643fece7c7f94cec7fc29f3e (patch)
tree1a7d2baf14aa414321914b7fa9ea70591c1577ea /src
parent4f285f7b2a1316bbad6e74258305613933f574c8 (diff)
Adaptations for Chromium 92
Change-Id: I1849c130ca75615802744275f6e4212a755c39b4 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/core/CMakeLists.txt7
-rw-r--r--src/core/accessibility_tree_formatter_qt.cpp7
-rw-r--r--src/core/api/configure.cmake6
-rw-r--r--src/core/browser_accessibility_qt.cpp4
-rw-r--r--src/core/browser_main_parts_qt.cpp4
-rw-r--r--src/core/browser_main_parts_qt.h4
-rw-r--r--src/core/browser_message_filter_qt.cpp12
-rw-r--r--src/core/browser_message_filter_qt.h2
-rw-r--r--src/core/client_cert_select_controller.cpp8
-rw-r--r--src/core/clipboard_qt.cpp6
-rw-r--r--src/core/clipboard_qt.h1
-rw-r--r--src/core/common/qt_messages.h1
-rw-r--r--src/core/compositor/display_gl_output_surface.cpp2
-rw-r--r--src/core/configure/BUILD.root.gn.in2
-rw-r--r--src/core/content_browser_client_qt.cpp14
-rw-r--r--src/core/content_browser_client_qt.h8
-rw-r--r--src/core/content_client_qt.cpp37
-rw-r--r--src/core/content_main_delegate_qt.cpp2
-rw-r--r--src/core/devtools_frontend_qt.cpp47
-rw-r--r--src/core/devtools_frontend_qt.h2
-rw-r--r--src/core/download_manager_delegate_qt.cpp12
-rw-r--r--src/core/extensions/extension_system_qt.cpp30
-rw-r--r--src/core/extensions/extension_web_contents_observer_qt.cpp4
-rw-r--r--src/core/extensions/extensions_browser_client_qt.cpp2
-rw-r--r--src/core/favicon_driver_qt.cpp11
-rw-r--r--src/core/favicon_driver_qt.h4
-rw-r--r--src/core/location_provider_qt.cpp10
-rw-r--r--src/core/login_delegate_qt.cpp2
-rw-r--r--src/core/net/client_cert_store_data.h4
-rw-r--r--src/core/net/cookie_monster_delegate_qt.cpp2
-rw-r--r--src/core/net/custom_url_loader_factory.cpp4
-rw-r--r--src/core/net/proxying_url_loader_factory_qt.cpp6
-rw-r--r--src/core/net/system_network_context_manager.cpp7
-rw-r--r--src/core/net/system_network_context_manager.h3
-rw-r--r--src/core/net/url_request_custom_job_proxy.cpp2
-rw-r--r--src/core/net/url_request_custom_job_proxy.h4
-rw-r--r--src/core/ozone/BUILD.gn1
-rw-r--r--src/core/ozone/platform_window_qt.cpp4
-rw-r--r--src/core/ozone/platform_window_qt.h2
-rw-r--r--src/core/platform_notification_service_qt.cpp3
-rw-r--r--src/core/platform_notification_service_qt.h1
-rw-r--r--src/core/pref_service_adapter.cpp5
-rw-r--r--src/core/printing/print_view_manager_base_qt.cpp4
-rw-r--r--src/core/printing/print_view_manager_qt.cpp33
-rw-r--r--src/core/printing/print_view_manager_qt.h10
-rw-r--r--src/core/profile_adapter.cpp28
-rw-r--r--src/core/profile_io_data_qt.cpp16
-rw-r--r--src/core/render_widget_host_view_qt.cpp43
-rw-r--r--src/core/render_widget_host_view_qt.h8
-rw-r--r--src/core/render_widget_host_view_qt_delegate_client.cpp2
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp72
-rw-r--r--src/core/renderer/extensions/resource_request_policy_qt.cpp2
-rw-r--r--src/core/renderer/extensions/resource_request_policy_qt.h4
-rw-r--r--src/core/renderer/render_configuration.cpp4
-rw-r--r--src/core/renderer/user_resource_controller.cpp4
-rw-r--r--src/core/renderer/web_channel_ipc_transport.cpp29
-rw-r--r--src/core/renderer/web_engine_page_render_frame.cpp2
-rw-r--r--src/core/renderer_host/web_channel_ipc_transport_host.cpp9
-rw-r--r--src/core/tools/CMakeLists.txt3
-rw-r--r--src/core/tools/main.cpp11
-rw-r--r--src/core/type_conversion.h31
-rw-r--r--src/core/web_contents_adapter.cpp28
-rw-r--r--src/core/web_contents_delegate_qt.cpp10
-rw-r--r--src/core/web_engine_context.cpp28
-rw-r--r--src/core/web_engine_settings.cpp3
65 files changed, 363 insertions, 320 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index f991e90df..bcec7ec18 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -1,7 +1,6 @@
cmake_minimum_required(VERSION 3.19)
find_package(Ninja 1.7.2 REQUIRED)
-find_package(Python2 2.7.5 REQUIRED)
find_package(Nodejs 10.19 REQUIRED)
find_package(PkgConfig)
if(PkgConfig_FOUND)
@@ -426,9 +425,13 @@ foreach(arch ${archs})
)
endif()
+ if(NOT CLANG)
+ list(APPEND gnArgArg
+ enable_location_source=false)
+ endif()
+
if(WIN32)
list(APPEND gnArgArg
- enable_location_source=false
enable_session_service=false
ninja_use_custom_environment_files=false
com_init_check_hook_disabled=true
diff --git a/src/core/accessibility_tree_formatter_qt.cpp b/src/core/accessibility_tree_formatter_qt.cpp
index 5bbaeca2a..7e84dfb8a 100644
--- a/src/core/accessibility_tree_formatter_qt.cpp
+++ b/src/core/accessibility_tree_formatter_qt.cpp
@@ -189,12 +189,11 @@ std::string AccessibilityTreeFormatterQt::ProcessTreeForOutput(const base::Dicti
WriteAttribute(true, base::StringPrintf("%s", role_value.c_str()), &line);
const base::ListValue *states_value = nullptr;
- node.GetList("states", &states_value);
- if (states_value) {
- for (const auto &state : *states_value) {
+ if (node.GetList("states", &states_value)) {
+ for (const auto &state : states_value->GetList()) {
std::string state_value;
if (state.GetAsString(&state_value))
- WriteAttribute(true, state_value, &line);
+ WriteAttribute(false, state_value, &line);
}
}
diff --git a/src/core/api/configure.cmake b/src/core/api/configure.cmake
index e79bbbae3..164c48a1f 100644
--- a/src/core/api/configure.cmake
+++ b/src/core/api/configure.cmake
@@ -95,9 +95,9 @@ qt_feature("webengine-native-spellchecker" PUBLIC
qt_feature("webengine-extensions" PUBLIC
SECTION "WebEngine"
LABEL "Extensions"
- PURPOSE "Enables Chromium extensions within certain limits. Currently used for enabling the pdf viewer."
- AUTODETECT QT_FEATURE_webengine_printing_and_pdf
- CONDITION QT_FEATURE_webengine_printing_and_pdf
+ PURPOSE "Enables Chromium extensions within certain limits. Currently used by the pdf viewer and hangout webrtc extension."
+ AUTODETECT ON
+ CONDITION QT_FEATURE_webengine_printing_and_pdf OR QT_FEATURE_webengine_printing_and_pdf
)
qt_feature("webengine-webrtc" PRIVATE
LABEL "WebRTC"
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp
index d7b9c2bb9..a377a0e65 100644
--- a/src/core/browser_accessibility_qt.cpp
+++ b/src/core/browser_accessibility_qt.cpp
@@ -221,9 +221,7 @@ QAccessible::Role BrowserAccessibilityQt::role() const
// Internal roles (matching auralinux and win)
case ax::mojom::Role::kKeyboard:
- case ax::mojom::Role::kIgnored:
case ax::mojom::Role::kImeCandidate:
- case ax::mojom::Role::kPresentational:
return QAccessible::NoRole;
// Used by Chromium to distinguish between the root of the tree
@@ -837,7 +835,7 @@ QAccessibleInterface *BrowserAccessibilityQt::cellAt(int row, int column) const
if (row < 0 || row >= rows || column < 0 || column >= columns)
return 0;
- base::Optional<int> cell_id = GetCellId(row, column);
+ absl::optional<int> cell_id = GetCellId(row, column);
BrowserAccessibility* cell = cell_id ? manager()->GetFromID(*cell_id) : nullptr;
if (cell) {
QAccessibleInterface *iface = static_cast<BrowserAccessibilityQt*>(cell);
diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp
index 438da7df8..32d8d839c 100644
--- a/src/core/browser_main_parts_qt.cpp
+++ b/src/core/browser_main_parts_qt.cpp
@@ -248,11 +248,11 @@ int BrowserMainPartsQt::PreEarlyInitialization()
return content::RESULT_CODE_NORMAL_EXIT;
}
-void BrowserMainPartsQt::PreMainMessageLoopStart()
+void BrowserMainPartsQt::PreCreateMainMessageLoop()
{
}
-void BrowserMainPartsQt::PostMainMessageLoopStart()
+void BrowserMainPartsQt::PostCreateMainMessageLoop()
{
if (!device_event_log::IsInitialized())
device_event_log::Initialize(0 /* default max entries */);
diff --git a/src/core/browser_main_parts_qt.h b/src/core/browser_main_parts_qt.h
index 69e129af2..f8a754632 100644
--- a/src/core/browser_main_parts_qt.h
+++ b/src/core/browser_main_parts_qt.h
@@ -68,8 +68,8 @@ public:
~BrowserMainPartsQt() override = default;
int PreEarlyInitialization() override;
- void PreMainMessageLoopStart() override;
- void PostMainMessageLoopStart() override;
+ void PreCreateMainMessageLoop() override;
+ void PostCreateMainMessageLoop() override;
int PreMainMessageLoopRun() override;
void PostMainMessageLoopRun() override;
int PreCreateThreads() override;
diff --git a/src/core/browser_message_filter_qt.cpp b/src/core/browser_message_filter_qt.cpp
index 500644593..22b86dba0 100644
--- a/src/core/browser_message_filter_qt.cpp
+++ b/src/core/browser_message_filter_qt.cpp
@@ -85,14 +85,14 @@ void BrowserMessageFilterQt::OnRequestStorageAccessSync(int render_frame_id,
IPC::Message* reply_msg)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
- base::Callback<void(bool)> callback = base::Bind(
+ auto callback = base::BindOnce(
&BrowserMessageFilterQt::OnRequestStorageAccessSyncResponse,
base::WrapRefCounted(this), reply_msg);
OnRequestStorageAccess(render_frame_id,
origin_url,
top_origin_url,
storage_type,
- callback);
+ std::move(callback));
}
void BrowserMessageFilterQt::OnRequestStorageAccessSyncResponse(IPC::Message *reply_msg, bool allowed)
@@ -108,14 +108,14 @@ void BrowserMessageFilterQt::OnRequestStorageAccessAsync(int render_frame_id,
int storage_type)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
- base::Callback<void(bool)> callback = base::Bind(
+ auto callback = base::BindOnce(
&BrowserMessageFilterQt::OnRequestStorageAccessAsyncResponse,
base::WrapRefCounted(this), render_frame_id, request_id);
OnRequestStorageAccess(render_frame_id,
origin_url,
top_origin_url,
storage_type,
- callback);
+ std::move(callback));
}
void BrowserMessageFilterQt::OnRequestStorageAccessAsyncResponse(int render_frame_id,
@@ -129,12 +129,12 @@ void BrowserMessageFilterQt::OnRequestStorageAccess(int /*render_frame_id*/,
const GURL &origin_url,
const GURL &top_origin_url,
int /*storage_type*/,
- base::Callback<void(bool)> callback)
+ base::OnceCallback<void(bool)> callback)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
bool allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url));
- callback.Run(allowed);
+ std::move(callback).Run(allowed);
}
} // namespace QtWebEngineCore
diff --git a/src/core/browser_message_filter_qt.h b/src/core/browser_message_filter_qt.h
index 85de0486a..c6e4e8d9d 100644
--- a/src/core/browser_message_filter_qt.h
+++ b/src/core/browser_message_filter_qt.h
@@ -84,7 +84,7 @@ private:
const GURL &origin_url,
const GURL &top_origin_url,
int storage_type,
- base::Callback<void(bool)> callback);
+ base::OnceCallback<void(bool)> callback);
ProfileIODataQt *m_profileData;
};
diff --git a/src/core/client_cert_select_controller.cpp b/src/core/client_cert_select_controller.cpp
index 2f2d24716..7173af684 100644
--- a/src/core/client_cert_select_controller.cpp
+++ b/src/core/client_cert_select_controller.cpp
@@ -93,8 +93,8 @@ void ClientCertSelectController::select(int index)
scoped_refptr<net::X509Certificate> cert = certInfo->certificate();
net::ClientCertIdentity::SelfOwningAcquirePrivateKey(
std::move(certInfo),
- base::Bind(&content::ClientCertificateDelegate::ContinueWithCertificate,
- base::Passed(std::move(m_delegate)), std::move(cert)));
+ base::BindOnce(&content::ClientCertificateDelegate::ContinueWithCertificate,
+ std::move(m_delegate), std::move(cert)));
return;
}
std::vector<std::string> pem_encoded;
@@ -119,8 +119,8 @@ void ClientCertSelectController::select(const QSslCertificate &certificate)
m_selected = true;
net::ClientCertIdentity::SelfOwningAcquirePrivateKey(
std::move(certInfo),
- base::Bind(&content::ClientCertificateDelegate::ContinueWithCertificate,
- base::Passed(std::move(m_delegate)), std::move(cert)));
+ base::BindOnce(&content::ClientCertificateDelegate::ContinueWithCertificate,
+ std::move(m_delegate), std::move(cert)));
return;
}
}
diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp
index 786129b40..e778695b6 100644
--- a/src/core/clipboard_qt.cpp
+++ b/src/core/clipboard_qt.cpp
@@ -357,6 +357,12 @@ void ClipboardQt::ReadImage(ui::ClipboardBuffer type,
return std::move(callback).Run(bitmap);
}
+void ClipboardQt::ReadPng(ui::ClipboardBuffer type, const ui::DataTransferEndpoint *, ui::Clipboard::ReadPngCallback callback) const
+{
+ // TODO(crbug.com/1201018): Implement this.
+ NOTIMPLEMENTED();
+}
+
void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const std::u16string &type,
const ui::DataTransferEndpoint *data_dst,
std::u16string *result) const
diff --git a/src/core/clipboard_qt.h b/src/core/clipboard_qt.h
index caf26073b..cb7a373ca 100644
--- a/src/core/clipboard_qt.h
+++ b/src/core/clipboard_qt.h
@@ -69,6 +69,7 @@ public:
#endif
void OnPreShutdown() override {}
void ReadSvg(ui::ClipboardBuffer, const ui::DataTransferEndpoint *, std::u16string *) const override;
+ void ReadPng(ui::ClipboardBuffer, const ui::DataTransferEndpoint *, ui::Clipboard::ReadPngCallback) const override;
std::vector<std::u16string> ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::DataTransferEndpoint *data_dst) const override;
diff --git a/src/core/common/qt_messages.h b/src/core/common/qt_messages.h
index de0257254..940019c16 100644
--- a/src/core/common/qt_messages.h
+++ b/src/core/common/qt_messages.h
@@ -6,6 +6,7 @@
#include "content/public/common/common_param_traits.h"
#include "ipc/ipc_message_macros.h"
+#include "ipc/ipc_message_start.h"
#include "url/gurl.h"
#define IPC_MESSAGE_START QtMsgStart
diff --git a/src/core/compositor/display_gl_output_surface.cpp b/src/core/compositor/display_gl_output_surface.cpp
index dfc3cb7c6..68ba957b0 100644
--- a/src/core/compositor/display_gl_output_surface.cpp
+++ b/src/core/compositor/display_gl_output_surface.cpp
@@ -231,7 +231,7 @@ void DisplayGLOutputSurface::swapBuffersOnVizThread()
}
const auto now = base::TimeTicks::Now();
- m_client->DidReceiveSwapBuffersAck(gfx::SwapTimings{now, now});
+ m_client->DidReceiveSwapBuffersAck(gfx::SwapTimings{now, now}, gfx::GpuFenceHandle());
m_client->DidReceivePresentationFeedback(
gfx::PresentationFeedback(now, base::TimeDelta(),
gfx::PresentationFeedback::Flags::kVSync));
diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in
index 2ba599e45..fc60562c5 100644
--- a/src/core/configure/BUILD.root.gn.in
+++ b/src/core/configure/BUILD.root.gn.in
@@ -121,6 +121,7 @@ shared_library("QtWebEngineCore") {
"//components/proxy_config",
"//components/user_prefs",
"//content/public/app",
+ "//content/public/browser",
"//content",
"//media:media_buildflags",
"//net",
@@ -131,7 +132,6 @@ shared_library("QtWebEngineCore") {
"//ui/gl",
"//qtwebengine/browser:interfaces",
"//qtwebengine/userscript",
- "//qtwebengine/browser:service_manifests",
"//qtwebengine/common:mojo_bindings",
":qtwebengine_sources",
":qtwebengine_resources",
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 929506dc8..b9e685c2c 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -40,7 +40,6 @@
#include "content_browser_client_qt.h"
#include "base/files/file_util.h"
-#include "base/optional.h"
#include "base/task/post_task.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
@@ -192,9 +191,6 @@ bool IsHandledProtocol(base::StringPiece scheme)
content::kChromeUIScheme,
url::kDataScheme,
url::kAboutScheme,
-#if !BUILDFLAG(DISABLE_FTP_SUPPORT)
- url::kFtpScheme,
-#endif // !BUILDFLAG(DISABLE_FTP_SUPPORT)
url::kBlobScheme,
url::kFileSystemScheme,
url::kQrcScheme,
@@ -626,7 +622,7 @@ bool ContentBrowserClientQt::WillCreateRestrictedCookieManager(network::mojom::R
bool ContentBrowserClientQt::AllowAppCache(const GURL &manifest_url,
const GURL &first_party,
- const base::Optional<url::Origin> &top_frame_origin,
+ const absl::optional<url::Origin> &top_frame_origin,
content::BrowserContext *context)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -638,7 +634,7 @@ bool ContentBrowserClientQt::AllowAppCache(const GURL &manifest_url,
content::AllowServiceWorkerResult
ContentBrowserClientQt::AllowServiceWorker(const GURL &scope,
const GURL &site_for_cookies,
- const base::Optional<url::Origin> & /*top_frame_origin*/,
+ const absl::optional<url::Origin> & /*top_frame_origin*/,
const GURL & /*script_url*/,
content::BrowserContext *context)
{
@@ -705,7 +701,7 @@ bool ContentBrowserClientQt::HandleExternalProtocol(const GURL &url,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin> &initiating_origin,
+ const absl::optional<url::Origin> &initiating_origin,
mojo::PendingRemote<network::mojom::URLLoaderFactory> *out_factory)
{
Q_UNUSED(child_id);
@@ -1103,7 +1099,7 @@ void ContentBrowserClientQt::RegisterNonNetworkSubresourceURLLoaderFactories(int
if (install_file_scheme && factories->find(url::kFileScheme) == factories->end()) {
auto file_factory = content::CreateFileURLLoaderFactory(profile->GetPath(),
- content::BrowserContext::GetSharedCorsOriginAccessList(profile));
+ profile->GetSharedCorsOriginAccessList());
factories->emplace(url::kFileScheme, std::move(file_factory));
}
@@ -1174,7 +1170,7 @@ bool ContentBrowserClientQt::WillCreateURLLoaderFactory(
int render_process_id,
URLLoaderFactoryType type,
const url::Origin &request_initiator,
- base::Optional<int64_t> navigation_id,
+ absl::optional<int64_t> navigation_id,
ukm::SourceIdObj ukm_source_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> *factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient> *header_client,
diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h
index 4d4a3ae90..d739c580e 100644
--- a/src/core/content_browser_client_qt.h
+++ b/src/core/content_browser_client_qt.h
@@ -140,12 +140,12 @@ public:
bool AllowAppCache(const GURL &manifest_url,
const GURL &first_party,
- const base::Optional<url::Origin> &top_frame_origin,
+ const absl::optional<url::Origin> &top_frame_origin,
content::BrowserContext *context) override;
content::AllowServiceWorkerResult AllowServiceWorker(
const GURL &scope,
const GURL &site_for_cookies,
- const base::Optional<url::Origin> &top_frame_origin,
+ const absl::optional<url::Origin> &top_frame_origin,
const GURL &script_url,
content::BrowserContext *context) override;
@@ -203,7 +203,7 @@ public:
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture,
- const base::Optional<url::Origin> &initiating_origin,
+ const absl::optional<url::Origin> &initiating_origin,
mojo::PendingRemote<network::mojom::URLLoaderFactory> *out_factory) override;
std::vector<std::unique_ptr<blink::URLLoaderThrottle>> CreateURLLoaderThrottles(
@@ -224,7 +224,7 @@ public:
int render_process_id,
URLLoaderFactoryType type,
const url::Origin &request_initiator,
- base::Optional<int64_t> navigation_id,
+ absl::optional<int64_t> navigation_id,
ukm::SourceIdObj ukm_source_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> *factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient> *header_client,
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index ed98dd48d..100d3eae0 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -90,6 +90,8 @@ const char kPdfPluginMimeType[] = "application/x-google-chrome-pdf";
const char kPdfPluginPath[] = "internal-pdf-viewer";
#endif // QT_CONFIG(webengine_printing_and_pdf)
+using Robustness = content::CdmInfo::Robustness;
+
static QString webenginePluginsPath()
{
// Look for plugins in /plugins/webengine or application dir.
@@ -184,7 +186,7 @@ namespace QtWebEngineCore {
#if defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT)
static bool IsWidevineAvailable(base::FilePath *cdm_path,
- content::CdmCapability *capability)
+ media::CdmCapability *capability)
{
QStringList pluginPaths;
const base::CommandLine::StringType widevine_argument = base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(switches::kCdmWidevinePath);
@@ -298,12 +300,12 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo>
if (cdms) {
#if defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT)
base::FilePath cdm_path;
- content::CdmCapability capability;
+ media::CdmCapability capability;
if (IsWidevineAvailable(&cdm_path, &capability)) {
const base::Version version;
- cdms->push_back(content::CdmInfo(kWidevineCdmDisplayName, kWidevineCdmGuid, version, cdm_path,
- kWidevineCdmFileSystemId, std::move(capability),
- kWidevineKeySystem, false));
+ cdms->push_back(content::CdmInfo(kWidevineKeySystem, Robustness::kSoftwareSecure, std::move(capability),
+ /*supports_sub_key_systems=*/false, kWidevineCdmDisplayName,
+ kWidevineCdmGuid, version, cdm_path, kWidevineCdmFileSystemId));
}
#endif // defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT)
@@ -321,8 +323,8 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo>
"org.chromium.externalclearkey.differentguid";
// Supported codecs are hard-coded in ExternalClearKeyProperties.
- content::CdmCapability capability(
- {}, {media::EncryptionScheme::kCenc, media::EncryptionScheme::kCbcs},
+ media::CdmCapability capability(
+ {}, {}, {media::EncryptionScheme::kCenc, media::EncryptionScheme::kCbcs},
{media::CdmSessionType::kTemporary,
media::CdmSessionType::kPersistentLicense});
@@ -330,16 +332,17 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo>
// Otherwise, it'll be treated as a sub-key-system of normal
// kExternalClearKeyKeySystem. See MultipleCdmTypes test in
// ECKEncryptedMediaTest.
- cdms->push_back(content::CdmInfo(media::kClearKeyCdmDisplayName, media::kClearKeyCdmDifferentGuid,
- base::Version("0.1.0.0"), clear_key_cdm_path,
- media::kClearKeyCdmFileSystemId, capability,
- kExternalClearKeyDifferentGuidTestKeySystem, false));
-
- // Supported codecs are hard-coded in ExternalClearKeyProperties.
- cdms->push_back(content::CdmInfo(media::kClearKeyCdmDisplayName, media::kClearKeyCdmGuid,
- base::Version("0.1.0.0"), clear_key_cdm_path,
- media::kClearKeyCdmFileSystemId, capability,
- kExternalClearKeyKeySystem, true));
+ cdms->push_back(content::CdmInfo(kExternalClearKeyDifferentGuidTestKeySystem,
+ Robustness::kSoftwareSecure, capability,
+ /*supports_sub_key_systems=*/false, media::kClearKeyCdmDisplayName,
+ media::kClearKeyCdmDifferentGuid, base::Version("0.1.0.0"),
+ clear_key_cdm_path, media::kClearKeyCdmFileSystemId));
+
+ cdms->push_back(content::CdmInfo(kExternalClearKeyKeySystem,
+ Robustness::kSoftwareSecure, capability,
+ /*supports_sub_key_systems=*/true, media::kClearKeyCdmDisplayName,
+ media::kClearKeyCdmGuid, base::Version("0.1.0.0"),
+ clear_key_cdm_path, media::kClearKeyCdmFileSystemId));
}
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
}
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp
index ec0e63858..dd7d7e3a9 100644
--- a/src/core/content_main_delegate_qt.cpp
+++ b/src/core/content_main_delegate_qt.cpp
@@ -219,7 +219,7 @@ void ContentMainDelegateQt::PreSandboxStartup()
#endif
#if defined(OS_MAC)
- if (base::FeatureList::IsEnabled(features::kMacV2GPUSandbox)) {
+ {
TRACE_EVENT0("gpu", "Initialize VideoToolbox");
media::InitializeVideoToolbox();
}
diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp
index 8a23d326f..19f03f8c9 100644
--- a/src/core/devtools_frontend_qt.cpp
+++ b/src/core/devtools_frontend_qt.cpp
@@ -301,8 +301,8 @@ void DevToolsFrontendQt::ReadyToCommitNavigation(content::NavigationHandle *navi
else if (!m_frontendHost)
m_frontendHost = content::DevToolsFrontendHost::Create(
frame,
- base::Bind(&DevToolsFrontendQt::HandleMessageFromDevToolsFrontend,
- base::Unretained(this)));
+ base::BindRepeating(&DevToolsFrontendQt::HandleMessageFromDevToolsFrontend,
+ base::Unretained(this)));
}
}
@@ -374,27 +374,35 @@ void DevToolsFrontendQt::CreateJsonPreferences(bool clear)
m_prefStore = scoped_refptr<PersistentPrefStore>(jsonPrefStore);
}
-void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(const std::string &message)
+void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message)
{
- if (!m_agentHost)
- return;
- std::string method;
- base::ListValue *params = nullptr;
- base::DictionaryValue *dict = nullptr;
- std::unique_ptr<base::Value> parsed_message = base::JSONReader::ReadDeprecated(message);
- if (!parsed_message || !parsed_message->GetAsDictionary(&dict) || !dict->GetString("method", &method))
+ const std::string *method_ptr = nullptr;
+ base::Value *params_value = nullptr;
+ if (message.is_dict()) {
+ method_ptr = message.FindStringKey("method");
+ params_value = message.FindKey("params");
+ }
+ if (!method_ptr || (params_value && !params_value->is_list())) {
+ LOG(ERROR) << "Invalid message was sent to embedder: " << message;
return;
- int request_id = 0;
- dict->GetInteger("id", &request_id);
- dict->GetList("params", &params);
+ }
+ base::Value empty_params(base::Value::Type::LIST);
+ if (!params_value)
+ params_value = &empty_params;
+
+ int request_id = message.FindIntKey("id").value_or(0);
+ base::ListValue *params;
+ params_value->GetAsList(&params);
+ const std::string &method = *method_ptr;
if (method == "dispatchProtocolMessage" && params && params->GetSize() == 1) {
std::string protocol_message;
if (!params->GetString(0, &protocol_message))
return;
- m_agentHost->DispatchProtocolMessage(this, base::as_bytes(base::make_span(protocol_message)));
+ if (m_agentHost)
+ m_agentHost->DispatchProtocolMessage(this, base::as_bytes(base::make_span(protocol_message)));
} else if (method == "loadCompleted") {
- web_contents()->GetMainFrame()->ExecuteJavaScript(base::ASCIIToUTF16("DevToolsAPI.setUseSoftMenu(true);"),
+ web_contents()->GetMainFrame()->ExecuteJavaScript(u"DevToolsAPI.setUseSoftMenu(true);",
base::NullCallback());
} else if (method == "loadNetworkResource" && params->GetSize() == 3) {
// TODO(pfeldman): handle some of the embedder messages in content.
@@ -457,8 +465,7 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(const std::string &me
SendMessageAck(request_id, &response);
return;
} else {
- auto *partition = content::BrowserContext::GetStoragePartitionForUrl(
- web_contents()->GetBrowserContext(), gurl);
+ auto *partition = web_contents()->GetBrowserContext()->GetStoragePartitionForUrl(gurl);
network_url_loader_factory = partition->GetURLLoaderFactoryForBrowserProcess();
url_loader_factory = network_url_loader_factory.get();
}
@@ -491,7 +498,7 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(const std::string &me
} else if (method == "clearPreferences") {
ClearPreferences();
} else if (method == "requestFileSystems") {
- web_contents()->GetMainFrame()->ExecuteJavaScript(base::ASCIIToUTF16("DevToolsAPI.fileSystemsLoaded([]);"),
+ web_contents()->GetMainFrame()->ExecuteJavaScript(u"DevToolsAPI.fileSystemsLoaded([]);",
base::NullCallback());
} else if (method == "reattach") {
if (!m_agentHost)
@@ -561,8 +568,8 @@ void DevToolsFrontendQt::SetEyeDropperActive(bool active)
if (active) {
m_eyeDropper.reset(new DevToolsEyeDropper(
m_inspectedContents,
- base::Bind(&DevToolsFrontendQt::ColorPickedInEyeDropper,
- base::Unretained(this))));
+ base::BindRepeating(&DevToolsFrontendQt::ColorPickedInEyeDropper,
+ base::Unretained(this))));
} else {
m_eyeDropper.reset();
}
diff --git a/src/core/devtools_frontend_qt.h b/src/core/devtools_frontend_qt.h
index 441e5171e..68e6c1b42 100644
--- a/src/core/devtools_frontend_qt.h
+++ b/src/core/devtools_frontend_qt.h
@@ -101,7 +101,7 @@ protected:
void DispatchProtocolMessage(content::DevToolsAgentHost* agent_host, base::span<const uint8_t> message) override;
void SetPreferences(const std::string& json);
- virtual void HandleMessageFromDevToolsFrontend(const std::string& message);
+ void HandleMessageFromDevToolsFrontend(base::Value message);
private:
// WebContentsObserver overrides
diff --git a/src/core/download_manager_delegate_qt.cpp b/src/core/download_manager_delegate_qt.cpp
index 58f6507a7..2a8a964f4 100644
--- a/src/core/download_manager_delegate_qt.cpp
+++ b/src/core/download_manager_delegate_qt.cpp
@@ -83,7 +83,7 @@ void DownloadManagerDelegateQt::GetNextId(content::DownloadIdCallback callback)
download::DownloadItem *DownloadManagerDelegateQt::findDownloadById(quint32 downloadId)
{
- content::DownloadManager* dlm = content::BrowserContext::GetDownloadManager(m_profileAdapter->profile());
+ content::DownloadManager *dlm = m_profileAdapter->profile()->GetDownloadManager();
return dlm->GetDownload(downloadId);
}
@@ -94,7 +94,7 @@ void DownloadManagerDelegateQt::cancelDownload(content::DownloadTargetCallback c
download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
download::DownloadItem::UNKNOWN,
base::FilePath(),
- base::nullopt,
+ absl::nullopt,
download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED);
}
@@ -135,7 +135,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *
download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download::DownloadItem::VALIDATED,
item->GetForcedFilePath(),
- base::nullopt,
+ absl::nullopt,
download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE);
return true;
}
@@ -227,7 +227,7 @@ bool DownloadManagerDelegateQt::DetermineDownloadTarget(download::DownloadItem *
download::DownloadDangerType::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
download::DownloadItem::VALIDATED,
filePathForCallback.AddExtension(toFilePathString("download")),
- base::nullopt,
+ absl::nullopt,
download::DownloadInterruptReason::DOWNLOAD_INTERRUPT_REASON_NONE);
} else
cancelDownload(std::move(*callback));
@@ -316,8 +316,8 @@ void DownloadManagerDelegateQt::ChooseSavePath(content::WebContents *web_content
return;
std::move(callback).Run(toFilePath(info.path), static_cast<content::SavePageType>(info.savePageFormat),
- base::Bind(&DownloadManagerDelegateQt::savePackageDownloadCreated,
- m_weakPtrFactory.GetWeakPtr()));
+ base::BindOnce(&DownloadManagerDelegateQt::savePackageDownloadCreated,
+ m_weakPtrFactory.GetWeakPtr()));
}
void DownloadManagerDelegateQt::savePackageDownloadCreated(download::DownloadItem *item)
diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp
index 7c5780ef2..a9699f30d 100644
--- a/src/core/extensions/extension_system_qt.cpp
+++ b/src/core/extensions/extension_system_qt.cpp
@@ -175,12 +175,12 @@ void ExtensionSystemQt::LoadExtension(std::string extension_id, std::unique_ptr<
LOG(ERROR) << error;
base::PostTask(FROM_HERE, {content::BrowserThread::IO},
- base::Bind(&InfoMap::AddExtension,
- base::Unretained(info_map()),
- base::RetainedRef(extension),
- base::Time::Now(),
- true,
- false));
+ base::BindOnce(&InfoMap::AddExtension,
+ base::Unretained(info_map()),
+ base::RetainedRef(extension),
+ base::Time::Now(),
+ true,
+ false));
extension_registry_->AddEnabled(extension.get());
NotifyExtensionLoaded(extension.get());
@@ -204,9 +204,9 @@ void ExtensionSystemQt::NotifyExtensionLoaded(const Extension *extension)
// extension.
RegisterExtensionWithRequestContexts(
extension,
- base::Bind(&ExtensionSystemQt::OnExtensionRegisteredWithRequestContexts,
- weak_ptr_factory_.GetWeakPtr(),
- base::WrapRefCounted(extension)));
+ base::BindRepeating(&ExtensionSystemQt::OnExtensionRegisteredWithRequestContexts,
+ weak_ptr_factory_.GetWeakPtr(),
+ base::WrapRefCounted(extension)));
// Tell renderers about the loaded extension.
renderer_helper_->OnExtensionLoaded(*extension);
@@ -361,7 +361,7 @@ void ExtensionSystemQt::Init(bool extensions_enabled)
ready_.Signal();
{
- std::string pdf_manifest = ui::ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_PDF_MANIFEST).as_string();
+ std::string pdf_manifest = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(IDR_PDF_MANIFEST);
base::ReplaceFirstSubstringAfterOffset(&pdf_manifest, 0, "<NAME>", "chromium-pdf");
std::unique_ptr<base::DictionaryValue> pdfManifestDict = ParseManifest(pdf_manifest);
@@ -374,7 +374,7 @@ void ExtensionSystemQt::Init(bool extensions_enabled)
#if BUILDFLAG(ENABLE_HANGOUT_SERVICES_EXTENSION)
{
- std::string hangout_manifest = ui::ResourceBundle::GetSharedInstance().GetRawDataResource(IDR_HANGOUT_SERVICES_MANIFEST).as_string();
+ std::string hangout_manifest = ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(IDR_HANGOUT_SERVICES_MANIFEST);
std::unique_ptr<base::DictionaryValue> hangoutManifestDict = ParseManifest(hangout_manifest);
base::FilePath path;
base::PathService::Get(base::DIR_QT_LIBRARY_DATA, &path);
@@ -411,9 +411,9 @@ void ExtensionSystemQt::RegisterExtensionWithRequestContexts(const Extension *ex
base::PostTaskAndReply(
FROM_HERE, {BrowserThread::IO},
- base::Bind(&InfoMap::AddExtension, info_map(),
- base::RetainedRef(extension), install_time, incognito_enabled,
- notifications_disabled),
+ base::BindOnce(&InfoMap::AddExtension, info_map(),
+ base::RetainedRef(extension), install_time, incognito_enabled,
+ notifications_disabled),
std::move(callback));
}
@@ -422,7 +422,7 @@ void ExtensionSystemQt::UnregisterExtensionWithRequestContexts(const std::string
{
base::PostTask(
FROM_HERE, {BrowserThread::IO},
- base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
+ base::BindOnce(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
}
bool ExtensionSystemQt::is_ready() const
diff --git a/src/core/extensions/extension_web_contents_observer_qt.cpp b/src/core/extensions/extension_web_contents_observer_qt.cpp
index 0959806f6..947815d7b 100644
--- a/src/core/extensions/extension_web_contents_observer_qt.cpp
+++ b/src/core/extensions/extension_web_contents_observer_qt.cpp
@@ -48,9 +48,9 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
-#include "content/public/common/url_constants.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/manifest.h"
+#include "third_party/blink/public/common/chrome_debug_urls.h"
#include "render_widget_host_view_qt.h"
@@ -86,7 +86,7 @@ void ExtensionWebContentsObserverQt::RenderFrameCreated(content::RenderFrameHost
auto *policy = content::ChildProcessSecurityPolicy::GetInstance();
if (extension->is_extension() && Manifest::IsComponentLocation(extension->location()))
- policy->GrantRequestOrigin(process_id, url::Origin::Create(GURL(content::kChromeUIResourcesURL)));
+ policy->GrantRequestOrigin(process_id, url::Origin::Create(GURL(blink::kChromeUIResourcesURL)));
}
void ExtensionWebContentsObserverQt::RenderViewReady()
diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp
index 8a921aa8b..fefc86b36 100644
--- a/src/core/extensions/extensions_browser_client_qt.cpp
+++ b/src/core/extensions/extensions_browser_client_qt.cpp
@@ -142,7 +142,7 @@ public:
void FollowRedirect(const std::vector<std::string> &removed_headers,
const net::HttpRequestHeaders &modified_headers,
const net::HttpRequestHeaders &modified_cors_exempt_headers,
- const base::Optional<GURL> &new_url) override
+ const absl::optional<GURL> &new_url) override
{
NOTREACHED() << "No redirects for local file loads.";
}
diff --git a/src/core/favicon_driver_qt.cpp b/src/core/favicon_driver_qt.cpp
index 2ec36f826..bcba5299b 100644
--- a/src/core/favicon_driver_qt.cpp
+++ b/src/core/favicon_driver_qt.cpp
@@ -256,22 +256,21 @@ void FaviconDriverQt::DidUpdateFaviconURL(
// We update |m_faviconUrls| even if the list is believed to be partial
// (checked below), because callers of our getter favicon_urls() expect so.
- std::vector<blink::mojom::FaviconURL> faviconUrls;
+ std::vector<blink::mojom::FaviconURLPtr> faviconUrls;
for (const auto &candidate : candidates)
- faviconUrls.push_back(*candidate);
- m_faviconUrls = faviconUrls;
+ faviconUrls.push_back(candidate.Clone());
+ m_faviconUrls = std::move(faviconUrls);
if (!m_documentOnLoadCompleted)
return;
OnUpdateCandidates(entry->GetURL(),
- favicon::FaviconURLsFromContentFaviconURLs(
- m_faviconUrls.value_or(std::vector<blink::mojom::FaviconURL>())),
+ favicon::FaviconURLsFromContentFaviconURLs(candidates),
m_manifestUrl);
}
void FaviconDriverQt::DidUpdateWebManifestURL(content::RenderFrameHost *target_frame,
- const base::Optional<GURL> &manifest_url)
+ const absl::optional<GURL> &manifest_url)
{
Q_UNUSED(target_frame);
diff --git a/src/core/favicon_driver_qt.h b/src/core/favicon_driver_qt.h
index 0e9b7d46f..03ebd6536 100644
--- a/src/core/favicon_driver_qt.h
+++ b/src/core/favicon_driver_qt.h
@@ -122,7 +122,7 @@ private:
void DidUpdateFaviconURL(content::RenderFrameHost *render_frame_host,
const std::vector<blink::mojom::FaviconURLPtr> &candidates) override;
void DidUpdateWebManifestURL(content::RenderFrameHost *target_frame,
- const base::Optional<GURL> &manifest_url) override;
+ const absl::optional<GURL> &manifest_url) override;
void DidStartNavigation(content::NavigationHandle *navigation_handle) override;
void DidFinishNavigation(content::NavigationHandle *navigation_handle) override;
void DocumentOnLoadCompletedInMainFrame(content::RenderFrameHost *render_frame_host) override;
@@ -152,7 +152,7 @@ private:
bool m_documentOnLoadCompleted = false;
// nullopt until the actual list is reported via DidUpdateFaviconURL().
- base::Optional<std::vector<blink::mojom::FaviconURL>> m_faviconUrls;
+ absl::optional<std::vector<blink::mojom::FaviconURLPtr>> m_faviconUrls;
// Web Manifest URL or empty URL if none.
GURL m_manifestUrl;
diff --git a/src/core/location_provider_qt.cpp b/src/core/location_provider_qt.cpp
index b5d0f21f2..09938ca4f 100644
--- a/src/core/location_provider_qt.cpp
+++ b/src/core/location_provider_qt.cpp
@@ -77,7 +77,7 @@ private:
QGeoPositionInfoSource *m_positionInfoSource;
base::WeakPtrFactory<LocationProviderQt> m_locationProviderFactory;
- void postToLocationProvider(const base::Closure &task);
+ void postToLocationProvider(base::OnceClosure task);
friend class LocationProviderQt;
};
@@ -188,7 +188,7 @@ void QtPositioningHelper::updatePosition(const QGeoPositionInfo &pos)
newPos.heading = pos.hasAttribute(QGeoPositionInfo::Direction) ? pos.attribute(QGeoPositionInfo::Direction) : -1;
if (m_locationProvider)
- postToLocationProvider(base::Bind(&LocationProviderQt::updatePosition, m_locationProviderFactory.GetWeakPtr(), newPos));
+ postToLocationProvider(base::BindOnce(&LocationProviderQt::updatePosition, m_locationProviderFactory.GetWeakPtr(), newPos));
}
void QtPositioningHelper::error(QGeoPositionInfoSource::Error positioningError)
@@ -212,12 +212,12 @@ void QtPositioningHelper::error(QGeoPositionInfoSource::Error positioningError)
break;
}
if (m_locationProvider)
- postToLocationProvider(base::Bind(&LocationProviderQt::updatePosition, m_locationProviderFactory.GetWeakPtr(), newPos));
+ postToLocationProvider(base::BindOnce(&LocationProviderQt::updatePosition, m_locationProviderFactory.GetWeakPtr(), newPos));
}
-inline void QtPositioningHelper::postToLocationProvider(const base::Closure &task)
+inline void QtPositioningHelper::postToLocationProvider(base::OnceClosure task)
{
- static_cast<device::GeolocationProviderImpl*>(device::GeolocationProvider::GetInstance())->task_runner()->PostTask(FROM_HERE, task);
+ static_cast<device::GeolocationProviderImpl*>(device::GeolocationProvider::GetInstance())->task_runner()->PostTask(FROM_HERE, std::move(task));
}
LocationProviderQt::LocationProviderQt()
diff --git a/src/core/login_delegate_qt.cpp b/src/core/login_delegate_qt.cpp
index 7942c8279..c00866e6e 100644
--- a/src/core/login_delegate_qt.cpp
+++ b/src/core/login_delegate_qt.cpp
@@ -145,7 +145,7 @@ void LoginDelegateQt::sendAuthToRequester(bool success, const QString &user, con
if (success && web_contents())
std::move(m_auth_required_callback).Run(net::AuthCredentials(toString16(user), toString16(password)));
else
- std::move(m_auth_required_callback).Run(base::nullopt);
+ std::move(m_auth_required_callback).Run(absl::nullopt);
}
}
diff --git a/src/core/net/client_cert_store_data.h b/src/core/net/client_cert_store_data.h
index 4976ac936..312396d1c 100644
--- a/src/core/net/client_cert_store_data.h
+++ b/src/core/net/client_cert_store_data.h
@@ -40,8 +40,8 @@
#ifndef CLIENT_CERT_STORE_DATA_H
#define CLIENT_CERT_STORE_DATA_H
-#include "qtwebenginecoreglobal.h"
-#include "qtnetworkglobal.h"
+#include <QtWebEngineCore/qtwebenginecoreglobal.h>
+#include <QtNetwork/qtnetworkglobal.h>
#if QT_CONFIG(ssl)
#include "base/memory/ref_counted.h"
diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp
index 2fbacd73b..c3cfa000a 100644
--- a/src/core/net/cookie_monster_delegate_qt.cpp
+++ b/src/core/net/cookie_monster_delegate_qt.cpp
@@ -139,7 +139,7 @@ void CookieMonsterDelegateQt::setCookie(const QNetworkCookie &cookie, const QUrl
std::string cookie_line = cookie.toRawForm().toStdString();
net::CookieInclusionStatus inclusion;
- auto canonCookie = net::CanonicalCookie::Create(gurl, cookie_line, base::Time::Now(), base::nullopt, &inclusion);
+ auto canonCookie = net::CanonicalCookie::Create(gurl, cookie_line, base::Time::Now(), absl::nullopt, &inclusion);
if (!inclusion.IsInclude()) {
LOG(WARNING) << "QWebEngineCookieStore::setCookie() - Tried to set invalid cookie";
return;
diff --git a/src/core/net/custom_url_loader_factory.cpp b/src/core/net/custom_url_loader_factory.cpp
index 9239d70ae..36b24d4b7 100644
--- a/src/core/net/custom_url_loader_factory.cpp
+++ b/src/core/net/custom_url_loader_factory.cpp
@@ -91,7 +91,7 @@ public:
void FollowRedirect(const std::vector<std::string> &removed_headers,
const net::HttpRequestHeaders &modified_headers,
const net::HttpRequestHeaders &modified_cors_exempt_headers, // FIXME: do something with this?
- const base::Optional<GURL> &new_url) override
+ const absl::optional<GURL> &new_url) override
{
// We can be asked for follow our own redirect
scoped_refptr<URLRequestCustomJobProxy> proxy = new URLRequestCustomJobProxy(this, m_proxy->m_scheme, m_proxy->m_profileAdapter);
@@ -297,7 +297,7 @@ private:
m_request.site_for_cookies,
first_party_url_policy, m_request.referrer_policy,
m_request.referrer.spec(), net::HTTP_SEE_OTHER,
- m_redirect, base::nullopt, false /*insecure_scheme_was_upgraded*/);
+ m_redirect, absl::nullopt, false /*insecure_scheme_was_upgraded*/);
m_client->OnReceiveRedirect(redirectInfo, std::move(m_head));
m_head = nullptr;
// ### should m_request be updated with RedirectInfo? (see FollowRedirect)
diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp
index 76e433fab..1620b665b 100644
--- a/src/core/net/proxying_url_loader_factory_qt.cpp
+++ b/src/core/net/proxying_url_loader_factory_qt.cpp
@@ -135,7 +135,7 @@ public:
void FollowRedirect(const std::vector<std::string> &removed_headers,
const net::HttpRequestHeaders &modified_headers,
const net::HttpRequestHeaders &modified_cors_exempt_headers,
- const base::Optional<GURL> &new_url) override;
+ const absl::optional<GURL> &new_url) override;
void SetPriority(net::RequestPriority priority, int32_t intra_priority_value) override;
void PauseReadingBodyFromNet() override;
void ResumeReadingBodyFromNet() override;
@@ -352,7 +352,7 @@ void InterceptedRequest::ContinueAfterIntercept()
net::RedirectInfo redirectInfo = net::RedirectInfo::ComputeRedirectInfo(
request_.method, request_.url, request_.site_for_cookies,
first_party_url_policy, request_.referrer_policy, request_.referrer.spec(),
- net::HTTP_TEMPORARY_REDIRECT, toGurl(info.url), base::nullopt,
+ net::HTTP_TEMPORARY_REDIRECT, toGurl(info.url), absl::nullopt,
false /*insecure_scheme_was_upgraded*/);
// FIXME: Should probably create a new header.
@@ -431,7 +431,7 @@ void InterceptedRequest::OnComplete(const network::URLLoaderCompletionStatus &st
void InterceptedRequest::FollowRedirect(const std::vector<std::string> &removed_headers,
const net::HttpRequestHeaders &modified_headers,
const net::HttpRequestHeaders &modified_cors_exempt_headers,
- const base::Optional<GURL> &new_url)
+ const absl::optional<GURL> &new_url)
{
if (target_loader_)
target_loader_->FollowRedirect(removed_headers, modified_headers, modified_cors_exempt_headers, new_url);
diff --git a/src/core/net/system_network_context_manager.cpp b/src/core/net/system_network_context_manager.cpp
index 5eb11dab9..33d95300b 100644
--- a/src/core/net/system_network_context_manager.cpp
+++ b/src/core/net/system_network_context_manager.cpp
@@ -53,6 +53,7 @@
#include "components/network_session_configurator/common/network_switches.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/common/content_switches.h"
+#include "mojo/public/cpp/bindings/pending_remote.h"
#include "net/base/port_util.h"
#include "net/net_buildflags.h"
#include "services/cert_verifier/public/mojom/cert_verifier_service_factory.mojom.h"
@@ -60,8 +61,8 @@
#include "services/network/public/cpp/cross_thread_pending_shared_url_loader_factory.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
-#include "services/network/public/mojom/host_resolver.mojom.h"
-#include "services/network/public/mojom/url_loader_factory.mojom.h"
+#include "services/network/public/mojom/cert_verifier_service.mojom.h"
+#include "services/network/public/mojom/network_context.mojom.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
namespace {
@@ -247,7 +248,7 @@ void SystemNetworkContextManager::OnNetworkServiceCreated(network::mojom::Networ
// Configure the stub resolver. This must be done after the system
// NetworkContext is created, but before anything has the chance to use it.
// bool stub_resolver_enabled;
- // base::Optional<std::vector<network::mojom::DnsOverHttpsServerPtr>> dns_over_https_servers;
+ // absl::optional<std::vector<network::mojom::DnsOverHttpsServerPtr>> dns_over_https_servers;
// GetStubResolverConfig(local_state_, &stub_resolver_enabled, &dns_over_https_servers);
// content::GetNetworkService()->ConfigureStubHostResolver(stub_resolver_enabled, std::move(dns_over_https_servers));
}
diff --git a/src/core/net/system_network_context_manager.h b/src/core/net/system_network_context_manager.h
index a234ead94..0078d710a 100644
--- a/src/core/net/system_network_context_manager.h
+++ b/src/core/net/system_network_context_manager.h
@@ -50,8 +50,7 @@
#include "base/macros.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/network_service.mojom-forward.h"
-#include "services/network/public/mojom/url_loader_factory.mojom-forward.h"
-
+#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "net/proxy_config_monitor.h"
namespace cert_verifier {
diff --git a/src/core/net/url_request_custom_job_proxy.cpp b/src/core/net/url_request_custom_job_proxy.cpp
index b57583341..758688709 100644
--- a/src/core/net/url_request_custom_job_proxy.cpp
+++ b/src/core/net/url_request_custom_job_proxy.cpp
@@ -158,7 +158,7 @@ void URLRequestCustomJobProxy::readyRead()
}
void URLRequestCustomJobProxy::initialize(GURL url, std::string method,
- base::Optional<url::Origin> initiator,
+ absl::optional<url::Origin> initiator,
std::map<std::string, std::string> headers)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
diff --git a/src/core/net/url_request_custom_job_proxy.h b/src/core/net/url_request_custom_job_proxy.h
index b14322f91..1d9eebb24 100644
--- a/src/core/net/url_request_custom_job_proxy.h
+++ b/src/core/net/url_request_custom_job_proxy.h
@@ -41,8 +41,8 @@
#define URL_REQUEST_CUSTOM_JOB_PROXY_H_
#include "base/memory/weak_ptr.h"
-#include "base/optional.h"
#include "base/sequenced_task_runner.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
#include "url/origin.h"
#include <QtCore/QPointer>
@@ -90,7 +90,7 @@ public:
void abort();
void fail(int error);
void release();
- void initialize(GURL url, std::string method, base::Optional<url::Origin> initiatorOrigin, std::map<std::string, std::string> headers);
+ void initialize(GURL url, std::string method, absl::optional<url::Origin> initiatorOrigin, std::map<std::string, std::string> headers);
void readyRead();
// IO thread owned:
diff --git a/src/core/ozone/BUILD.gn b/src/core/ozone/BUILD.gn
index e0f9b8a41..61ca197e5 100644
--- a/src/core/ozone/BUILD.gn
+++ b/src/core/ozone/BUILD.gn
@@ -21,6 +21,7 @@ source_set("qt") {
deps = [
"//base",
+ "//ui/base:buildflags",
"//ui/ozone:ozone_base",
"//ui/ozone/common",
]
diff --git a/src/core/ozone/platform_window_qt.cpp b/src/core/ozone/platform_window_qt.cpp
index 42af77774..74b95d9a2 100644
--- a/src/core/ozone/platform_window_qt.cpp
+++ b/src/core/ozone/platform_window_qt.cpp
@@ -80,8 +80,8 @@ bool PlatformWindowQt::CanDispatchEvent(const ui::PlatformEvent& /*ne*/)
uint32_t PlatformWindowQt::DispatchEvent(const ui::PlatformEvent& native_event)
{
DispatchEventFromNativeUiEvent(
- native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent,
- base::Unretained(delegate_)));
+ native_event, base::BindOnce(&PlatformWindowDelegate::DispatchEvent,
+ base::Unretained(delegate_)));
return ui::POST_DISPATCH_STOP_PROPAGATION;
}
diff --git a/src/core/ozone/platform_window_qt.h b/src/core/ozone/platform_window_qt.h
index c0dc8ccc3..2e5d189aa 100644
--- a/src/core/ozone/platform_window_qt.h
+++ b/src/core/ozone/platform_window_qt.h
@@ -71,7 +71,7 @@ public:
void Minimize() override { }
void Restore() override { }
PlatformWindowState GetPlatformWindowState() const override { return PlatformWindowState::kUnknown; }
- void SetCursor(PlatformCursor) override { }
+ void SetCursor(scoped_refptr<PlatformCursor>) override { }
void MoveCursorTo(const gfx::Point&) override { }
void ConfineCursorToBounds(const gfx::Rect&) override { }
void SetRestoredBoundsInPixels(const gfx::Rect& bounds) override { }
diff --git a/src/core/platform_notification_service_qt.cpp b/src/core/platform_notification_service_qt.cpp
index 5f3017dcf..63569ece1 100644
--- a/src/core/platform_notification_service_qt.cpp
+++ b/src/core/platform_notification_service_qt.cpp
@@ -90,7 +90,7 @@ struct PersistentNotificationDelegate : UserNotificationController::Delegate {
virtual void clicked() override {
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (auto inst = content::NotificationEventDispatcher::GetInstance())
- inst->DispatchNotificationClickEvent(browser_context, notification_id, origin, base::nullopt, base::nullopt, base::DoNothing());
+ inst->DispatchNotificationClickEvent(browser_context, notification_id, origin, absl::nullopt, absl::nullopt, base::DoNothing());
}
virtual void closed(bool by_user) override {
@@ -114,6 +114,7 @@ PlatformNotificationServiceQt::~PlatformNotificationServiceQt() {}
void PlatformNotificationServiceQt::DisplayNotification(
const std::string &notification_id,
const GURL &origin,
+ const GURL &document_url,
const blink::PlatformNotificationData &notificationData,
const blink::NotificationResources &notificationResources)
{
diff --git a/src/core/platform_notification_service_qt.h b/src/core/platform_notification_service_qt.h
index 12aa2619b..b55708686 100644
--- a/src/core/platform_notification_service_qt.h
+++ b/src/core/platform_notification_service_qt.h
@@ -58,6 +58,7 @@ public:
// |cancel_callback| argument. This method must be called on the UI thread.
void DisplayNotification(const std::string& notification_id,
const GURL& origin,
+ const GURL& document_url,
const blink::PlatformNotificationData& notificationData,
const blink::NotificationResources& notificationResources) override;
diff --git a/src/core/pref_service_adapter.cpp b/src/core/pref_service_adapter.cpp
index 9fcb16584..2f3b02e5b 100644
--- a/src/core/pref_service_adapter.cpp
+++ b/src/core/pref_service_adapter.cpp
@@ -183,9 +183,10 @@ void PrefServiceAdapter::setSpellCheckLanguages(const QStringList &languages)
QStringList PrefServiceAdapter::spellCheckLanguages() const
{
QStringList spellcheck_dictionaries;
- for (const auto &value : *m_prefService->GetList(spellcheck::prefs::kSpellCheckDictionaries)) {
+ const auto &list = m_prefService->GetList(spellcheck::prefs::kSpellCheckDictionaries);
+ for (size_t i = 0; i < list->GetSize(); ++i) {
std::string dictionary;
- if (value.GetAsString(&dictionary))
+ if (list->GetString(i, &dictionary))
spellcheck_dictionaries.append(QString::fromStdString(dictionary));
}
diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp
index 5bed60183..19c44549d 100644
--- a/src/core/printing/print_view_manager_base_qt.cpp
+++ b/src/core/printing/print_view_manager_base_qt.cpp
@@ -293,8 +293,8 @@ void PrintViewManagerBaseQt::UpdatePrintingEnabled()
enabled = true;
#endif
web_contents()->ForEachFrame(
- base::Bind(&PrintViewManagerBaseQt::SendPrintingEnabled,
- base::Unretained(this), enabled));
+ base::BindRepeating(&PrintViewManagerBaseQt::SendPrintingEnabled,
+ base::Unretained(this), enabled));
}
void PrintViewManagerBaseQt::NavigationStopped()
diff --git a/src/core/printing/print_view_manager_qt.cpp b/src/core/printing/print_view_manager_qt.cpp
index 250a80f3c..f7e038f3e 100644
--- a/src/core/printing/print_view_manager_qt.cpp
+++ b/src/core/printing/print_view_manager_qt.cpp
@@ -99,7 +99,7 @@ GetBytesFromHandle(const base::ReadOnlySharedMemoryRegion &handle)
// Write the PDF file to disk.
static void SavePdfFile(scoped_refptr<base::RefCountedBytes> data,
const base::FilePath &path,
- const QtWebEngineCore::PrintViewManagerQt::PrintToPDFFileCallback &saveCallback)
+ QtWebEngineCore::PrintViewManagerQt::PrintToPDFFileCallback saveCallback)
{
DCHECK_GT(data->size(), 0U);
@@ -110,7 +110,7 @@ static void SavePdfFile(scoped_refptr<base::RefCountedBytes> data,
base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
bool success = file.IsValid() && metafile.SaveTo(&file);
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(saveCallback, success));
+ base::BindOnce(std::move(saveCallback), success));
}
static base::DictionaryValue *createPrintSettings()
@@ -210,22 +210,22 @@ void PrintViewManagerQt::PrintToPDFFileWithCallback(const QPageLayout &pageLayou
const QPageRanges &pageRanges,
bool printInColor,
const QString &filePath,
- const PrintToPDFFileCallback& callback)
+ PrintToPDFFileCallback callback)
{
if (callback.is_null())
return;
if (m_printSettings || !filePath.length()) {
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(callback, false));
+ base::BindOnce(std::move(callback), false));
return;
}
m_pdfOutputPath = toFilePath(filePath);
- m_pdfSaveCallback = callback;
+ m_pdfSaveCallback = std::move(callback);
if (!PrintToPDFInternal(pageLayout, pageRanges, printInColor)) {
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(callback, false));
+ base::BindOnce(std::move(m_pdfSaveCallback), false));
resetPdfState();
}
}
@@ -234,7 +234,7 @@ void PrintViewManagerQt::PrintToPDFWithCallback(const QPageLayout &pageLayout,
const QPageRanges &pageRanges,
bool printInColor,
bool useCustomMargins,
- const PrintToPDFCallback& callback)
+ PrintToPDFCallback callback)
{
if (callback.is_null())
return;
@@ -242,14 +242,14 @@ void PrintViewManagerQt::PrintToPDFWithCallback(const QPageLayout &pageLayout,
// If there already is a pending print in progress, don't try starting another one.
if (m_printSettings) {
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(callback, QSharedPointer<QByteArray>()));
+ base::BindOnce(std::move(callback), QSharedPointer<QByteArray>()));
return;
}
- m_pdfPrintCallback = callback;
+ m_pdfPrintCallback = std::move(callback);
if (!PrintToPDFInternal(pageLayout, pageRanges, printInColor, useCustomMargins)) {
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(callback, QSharedPointer<QByteArray>()));
+ base::BindOnce(std::move(m_pdfPrintCallback), QSharedPointer<QByteArray>()));
resetPdfState();
}
@@ -311,7 +311,7 @@ void PrintViewManagerQt::NavigationStopped()
{
if (!m_pdfPrintCallback.is_null()) {
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(m_pdfPrintCallback, QSharedPointer<QByteArray>()));
+ base::BindOnce(std::move(m_pdfPrintCallback), QSharedPointer<QByteArray>()));
}
resetPdfState();
PrintViewManagerBaseQt::NavigationStopped();
@@ -322,7 +322,7 @@ void PrintViewManagerQt::RenderProcessGone(base::TerminationStatus status)
PrintViewManagerBaseQt::RenderProcessGone(status);
if (!m_pdfPrintCallback.is_null()) {
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(m_pdfPrintCallback, QSharedPointer<QByteArray>()));
+ base::BindOnce(std::move(m_pdfPrintCallback), QSharedPointer<QByteArray>()));
}
resetPdfState();
}
@@ -376,6 +376,11 @@ void PrintViewManagerQt::CheckForCancel(int32_t preview_ui_id,
std::move(callback).Run(false);
}
+void PrintViewManagerQt::SetAccessibilityTree(int32_t, const ui::AXTreeUpdate &)
+{
+ // FIXME!
+}
+
void PrintViewManagerQt::MetafileReadyForPrinting(printing::mojom::DidPreviewDocumentParamsPtr params,
int32_t preview_ui_id)
{
@@ -392,11 +397,11 @@ void PrintViewManagerQt::MetafileReadyForPrinting(printing::mojom::DidPreviewDoc
if (!pdf_print_callback.is_null()) {
QSharedPointer<QByteArray> data_array = GetStdVectorFromHandle(params->content->metafile_data_region);
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
- base::BindOnce(pdf_print_callback, data_array));
+ base::BindOnce(std::move(pdf_print_callback), data_array));
} else {
scoped_refptr<base::RefCountedBytes> data_bytes = GetBytesFromHandle(params->content->metafile_data_region);
base::ThreadPool::PostTask(FROM_HERE, { base::MayBlock() },
- base::BindOnce(&SavePdfFile, data_bytes, pdfOutputPath, pdf_save_callback));
+ base::BindOnce(&SavePdfFile, data_bytes, pdfOutputPath, std::move(pdf_save_callback)));
}
}
diff --git a/src/core/printing/print_view_manager_qt.h b/src/core/printing/print_view_manager_qt.h
index 893161464..7c7602e52 100644
--- a/src/core/printing/print_view_manager_qt.h
+++ b/src/core/printing/print_view_manager_qt.h
@@ -69,20 +69,20 @@ class PrintViewManagerQt
{
public:
~PrintViewManagerQt() override;
- typedef base::Callback<void(QSharedPointer<QByteArray> result)> PrintToPDFCallback;
- typedef base::Callback<void(bool success)> PrintToPDFFileCallback;
+ typedef base::OnceCallback<void(QSharedPointer<QByteArray> result)> PrintToPDFCallback;
+ typedef base::OnceCallback<void(bool success)> PrintToPDFFileCallback;
// Method to print a page to a Pdf document with page size \a pageSize in location \a filePath.
void PrintToPDFFileWithCallback(const QPageLayout &pageLayout,
const QPageRanges &pageRanges,
bool printInColor,
const QString &filePath,
- const PrintToPDFFileCallback& callback);
+ PrintToPDFFileCallback callback);
void PrintToPDFWithCallback(const QPageLayout &pageLayout,
const QPageRanges &pageRanges,
bool printInColor,
bool useCustomMargins,
- const PrintToPDFCallback &callback);
+ PrintToPDFCallback callback);
protected:
explicit PrintViewManagerQt(content::WebContents*);
@@ -107,7 +107,7 @@ protected:
CheckForCancelCallback callback) override;
void MetafileReadyForPrinting(printing::mojom::DidPreviewDocumentParamsPtr params,
int32_t preview_ui_id) override;
-
+ void SetAccessibilityTree(int32_t, const ui::AXTreeUpdate &) override;
private:
void resetPdfState();
diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp
index 7f7b7181e..14bc634c0 100644
--- a/src/core/profile_adapter.cpp
+++ b/src/core/profile_adapter.cpp
@@ -118,13 +118,13 @@ ProfileAdapter::ProfileAdapter(const QString &storageName):
ProfileAdapter::~ProfileAdapter()
{
m_cancelableTaskTracker->TryCancelAll();
- content::BrowserContext::NotifyWillBeDestroyed(m_profile.data());
+ m_profile->NotifyWillBeDestroyed();
while (!m_webContentsAdapterClients.isEmpty()) {
m_webContentsAdapterClients.first()->releaseProfile();
}
WebEngineContext::current()->removeProfileAdapter(this);
if (m_downloadManagerDelegate) {
- m_profile->GetDownloadManager(m_profile.data())->Shutdown();
+ m_profile->GetDownloadManager()->Shutdown();
m_downloadManagerDelegate.reset();
}
#if QT_CONFIG(ssl)
@@ -337,10 +337,10 @@ void ProfileAdapter::setHttpUserAgent(const QString &userAgent)
if (web_contents->GetBrowserContext() == m_profile.data())
web_contents->SetUserAgentOverride(blink::UserAgentOverride::UserAgentOnly(stdUserAgent), true);
- content::BrowserContext::ForEachStoragePartition(
- m_profile.get(), base::BindRepeating([](const std::string &user_agent, content::StoragePartition *storage_partition) {
- storage_partition->GetNetworkContext()->SetUserAgent(user_agent);
- }, stdUserAgent));
+ m_profile->ForEachStoragePartition(
+ base::BindRepeating([](const std::string &user_agent, content::StoragePartition *storage_partition) {
+ storage_partition->GetNetworkContext()->SetUserAgent(user_agent);
+ }, stdUserAgent));
}
ProfileAdapter::HttpCacheType ProfileAdapter::httpCacheType() const
@@ -479,10 +479,10 @@ const QList<QByteArray> ProfileAdapter::customUrlSchemes() const
void ProfileAdapter::updateCustomUrlSchemeHandlers()
{
- content::BrowserContext::ForEachStoragePartition(
- m_profile.get(), base::BindRepeating([](content::StoragePartition *storage_partition) {
- storage_partition->ResetURLLoaderFactories();
- }));
+ m_profile->ForEachStoragePartition(
+ base::BindRepeating([](content::StoragePartition *storage_partition) {
+ storage_partition->ResetURLLoaderFactories();
+ }));
}
void ProfileAdapter::removeUrlSchemeHandler(QWebEngineUrlSchemeHandler *handler)
@@ -601,10 +601,10 @@ void ProfileAdapter::setHttpAcceptLanguage(const QString &httpAcceptLanguage)
}
}
- content::BrowserContext::ForEachStoragePartition(
- m_profile.get(), base::BindRepeating([](std::string accept_language, content::StoragePartition *storage_partition) {
- storage_partition->GetNetworkContext()->SetAcceptLanguage(accept_language);
- }, http_accept_language));
+ m_profile->ForEachStoragePartition(
+ base::BindRepeating([](std::string accept_language, content::StoragePartition *storage_partition) {
+ storage_partition->GetNetworkContext()->SetAcceptLanguage(accept_language);
+ }, http_accept_language));
}
void ProfileAdapter::clearHttpCache()
diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp
index f235cdb57..a7e86a154 100644
--- a/src/core/profile_io_data_qt.cpp
+++ b/src/core/profile_io_data_qt.cpp
@@ -105,7 +105,7 @@ void ProfileIODataQt::shutdownOnUIThread()
if (m_clearHttpCacheInProgress) {
m_clearHttpCacheInProgress = false;
content::BrowsingDataRemover *remover =
- content::BrowserContext::GetBrowsingDataRemover(m_profileAdapter->profile());
+ m_profileAdapter->profile()->GetBrowsingDataRemover();
remover->RemoveObserver(&m_removerObserver);
}
@@ -150,7 +150,7 @@ void ProfileIODataQt::clearHttpCache()
if (!m_clearHttpCacheInProgress) {
m_clearHttpCacheInProgress = true;
content::BrowsingDataRemover *remover =
- content::BrowserContext::GetBrowsingDataRemover(m_profileAdapter->profile());
+ m_profileAdapter->profile()->GetBrowsingDataRemover();
remover->AddObserver(&m_removerObserver);
remover->RemoveAndReply(base::Time(), base::Time::Max(),
content::BrowsingDataRemover::DATA_TYPE_CACHE,
@@ -163,7 +163,7 @@ void ProfileIODataQt::clearHttpCache()
void ProfileIODataQt::removeBrowsingDataRemoverObserver()
{
content::BrowsingDataRemover *remover =
- content::BrowserContext::GetBrowsingDataRemover(m_profileAdapter->profile());
+ m_profileAdapter->profile()->GetBrowsingDataRemover();
remover->RemoveObserver(&m_removerObserver);
}
@@ -198,8 +198,8 @@ void ProfileIODataQt::resetNetworkContext()
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
setFullConfiguration();
- content::BrowserContext::ForEachStoragePartition(
- m_profile, base::BindRepeating([](content::StoragePartition *storage) {
+ m_profile->ForEachStoragePartition(
+ base::BindRepeating([](content::StoragePartition *storage) {
auto storage_impl = static_cast<content::StoragePartitionImpl *>(storage);
storage_impl->ResetURLLoaderFactories();
storage_impl->ResetNetworkContext();
@@ -262,15 +262,11 @@ void ProfileIODataQt::ConfigureNetworkContextParams(bool in_memory,
network_context_params->transport_security_persister_path = toFilePath(m_dataPath);
}
-#if !BUILDFLAG(DISABLE_FTP_SUPPORT)
- network_context_params->enable_ftp_url_support = true;
-#endif // !BUILDFLAG(DISABLE_FTP_SUPPORT)
-
network_context_params->enforce_chrome_ct_policy = false;
// Should be initialized with existing per-profile CORS access lists.
network_context_params->cors_origin_access_list =
- content::BrowserContext::GetSharedCorsOriginAccessList(m_profile)->GetOriginAccessList().CreateCorsOriginAccessPatternsList();
+ m_profile->GetSharedCorsOriginAccessList()->GetOriginAccessList().CreateCorsOriginAccessPatternsList();
m_proxyConfigMonitor->AddToNetworkContextParams(network_context_params);
}
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 4e2ab2ea9..791e9d75e 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -597,6 +597,11 @@ void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor)
if (updateCursorFromResource(cursorInfo.type()))
return;
break;
+ case ui::mojom::CursorType::kEastWestNoResize:
+ case ui::mojom::CursorType::kNorthEastSouthWestNoResize:
+ case ui::mojom::CursorType::kNorthSouthNoResize:
+ case ui::mojom::CursorType::kNorthWestSouthEastNoResize:
+ // Use forbidden cursor matching webcursor_mac.mm and win_cursor_factory.cc
case ui::mojom::CursorType::kNoDrop:
case ui::mojom::CursorType::kNotAllowed:
shape = Qt::ForbiddenCursor;
@@ -664,12 +669,12 @@ void RenderWidgetHostViewQt::Destroy()
delete this;
}
-void RenderWidgetHostViewQt::SetTooltipText(const std::u16string &tooltip_text)
+void RenderWidgetHostViewQt::UpdateTooltipUnderCursor(const std::u16string &tooltip_text)
{
- DisplayTooltipText(tooltip_text);
+ UpdateTooltip(tooltip_text);
}
-void RenderWidgetHostViewQt::DisplayTooltipText(const std::u16string &tooltip_text)
+void RenderWidgetHostViewQt::UpdateTooltip(const std::u16string &tooltip_text)
{
if (host()->delegate() && m_adapterClient)
m_adapterClient->setToolTip(toQt(tooltip_text));
@@ -748,15 +753,22 @@ void RenderWidgetHostViewQt::OnTextSelectionChanged(content::TextInputManager *t
Q_UNUSED(text_input_manager);
Q_UNUSED(updated_view);
- const content::TextInputManager::TextSelection *selection = GetTextInputManager()->GetTextSelection(updated_view);
- if (!selection)
- return;
+ // We obtain the TextSelection from focused RWH which is obtained from the
+ // frame tree.
+ content::RenderWidgetHostViewBase *focused_view =
+ GetFocusedWidget() ? GetFocusedWidget()->GetView() : nullptr;
+
+ if (!focused_view)
+ return;
#if defined(USE_OZONE)
- if (!selection->selected_text().empty() && selection->user_initiated()) {
- // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard.
- ui::ScopedClipboardWriter clipboard_writer(ui::ClipboardBuffer::kSelection);
- clipboard_writer.WriteText(selection->selected_text());
+ if (ui::Clipboard::IsSupportedClipboardBuffer(ui::ClipboardBuffer::kSelection)) {
+ const content::TextInputManager::TextSelection *selection = GetTextInputManager()->GetTextSelection(focused_view);
+ if (selection->selected_text().length() && selection->user_initiated()) {
+ // Set the ClipboardBuffer::kSelection to the ui::Clipboard.
+ ui::ScopedClipboardWriter clipboard_writer(ui::ClipboardBuffer::kSelection);
+ clipboard_writer.WriteText(selection->selected_text());
+ }
}
#endif // defined(USE_OZONE)
@@ -988,9 +1000,8 @@ void RenderWidgetHostViewQt::TakeFallbackContentFrom(content::RenderWidgetHostVi
{
DCHECK(!static_cast<RenderWidgetHostViewBase*>(view)->IsRenderWidgetHostViewChildFrame());
RenderWidgetHostViewQt *viewQt = static_cast<RenderWidgetHostViewQt *>(view);
- base::Optional<SkColor> color = viewQt->GetBackgroundColor();
- if (color)
- SetBackgroundColor(*color);
+ CopyBackgroundColorIfPresentFrom(*viewQt);
+
m_delegatedFrameHost->TakeFallbackContentFrom(viewQt->m_delegatedFrameHost.get());
host()->GetContentRenderingTimeoutFrom(viewQt->host());
}
@@ -1029,7 +1040,7 @@ void RenderWidgetHostViewQt::OnRenderFrameMetadataChangedAfterActivation(base::T
m_adapterClient->updateContentsSize(toQt(m_lastContentsSize));
}
-void RenderWidgetHostViewQt::synchronizeVisualProperties(const base::Optional<viz::LocalSurfaceId> &childSurfaceId)
+void RenderWidgetHostViewQt::synchronizeVisualProperties(const absl::optional<viz::LocalSurfaceId> &childSurfaceId)
{
if (childSurfaceId)
m_dfhLocalSurfaceIdAllocator.UpdateFromChild(*childSurfaceId);
@@ -1062,9 +1073,9 @@ ui::Compositor *RenderWidgetHostViewQt::GetCompositor()
return m_uiCompositor.get();
}
-base::Optional<content::DisplayFeature> RenderWidgetHostViewQt::GetDisplayFeature()
+absl::optional<content::DisplayFeature> RenderWidgetHostViewQt::GetDisplayFeature()
{
- return base::nullopt;
+ return absl::nullopt;
}
void RenderWidgetHostViewQt::SetDisplayFeatureForTesting(const content::DisplayFeature *)
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index 73ec729a4..eeb05951e 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -125,8 +125,8 @@ public:
content::RenderWidgetHostViewBase *target_view,
gfx::PointF *transformed_point) override;
void Destroy() override;
- void SetTooltipText(const std::u16string &tooltip_text) override;
- void DisplayTooltipText(const std::u16string& tooltip_text) override;
+ void UpdateTooltipUnderCursor(const std::u16string &tooltip_text) override;
+ void UpdateTooltip(const std::u16string& tooltip_text) override;
void WheelEventAck(const blink::WebMouseWheelEvent &event,
blink::mojom::InputEventResultState ack_result) override;
void GestureEventAck(const blink::WebGestureEvent &event,
@@ -153,7 +153,7 @@ public:
void DidStopFlinging() override;
std::unique_ptr<content::SyntheticGestureTarget> CreateSyntheticGestureTarget() override;
ui::Compositor *GetCompositor() override;
- base::Optional<content::DisplayFeature> GetDisplayFeature() override;
+ absl::optional<content::DisplayFeature> GetDisplayFeature() override;
void SetDisplayFeatureForTesting(const content::DisplayFeature*) override;
#if defined(OS_MAC)
void SetActive(bool active) override { QT_NOT_YET_IMPLEMENTED }
@@ -198,7 +198,7 @@ public:
ui::TextInputType getTextInputType() const;
void synchronizeVisualProperties(
- const base::Optional<viz::LocalSurfaceId> &childSurfaceId);
+ const absl::optional<viz::LocalSurfaceId> &childSurfaceId);
private:
friend class DelegatedFrameHostClientQt;
diff --git a/src/core/render_widget_host_view_qt_delegate_client.cpp b/src/core/render_widget_host_view_qt_delegate_client.cpp
index d28e789ee..1af0b782d 100644
--- a/src/core/render_widget_host_view_qt_delegate_client.cpp
+++ b/src/core/render_widget_host_view_qt_delegate_client.cpp
@@ -235,7 +235,7 @@ void RenderWidgetHostViewQtDelegateClient::visualPropertiesChanged()
m_rwhv->host()->SendScreenRects();
if (m_viewRectInDips.size() != oldViewRect.size() || screenInfoChanged)
- m_rwhv->synchronizeVisualProperties(base::nullopt);
+ m_rwhv->synchronizeVisualProperties(absl::nullopt);
}
bool RenderWidgetHostViewQtDelegateClient::forwardEvent(QEvent *event)
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index aac6fc430..84dd1c2a0 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -490,28 +490,34 @@ static void AddExternalClearKey(std::vector<std::unique_ptr<media::KeySystemProp
}
#if BUILDFLAG(ENABLE_WIDEVINE)
-static media::SupportedCodecs GetSupportedCodecs(const std::vector<media::VideoCodec> &supported_video_codecs,
+static media::SupportedCodecs GetSupportedCodecs(const media::CdmCapability& capability,
bool is_secure)
{
media::SupportedCodecs supported_codecs = media::EME_CODEC_NONE;
- // Audio codecs are always supported because the CDM only does decrypt-only
- // for audio. The only exception is when |is_secure| is true and there's no
- // secure video decoder available, which is a signal that secure hardware
- // decryption is not available either.
- // TODO(sandersd): Distinguish these from those that are directly supported,
- // as those may offer a higher level of protection.
- if (!supported_video_codecs.empty() || !is_secure) {
- supported_codecs |= media::EME_CODEC_OPUS;
- supported_codecs |= media::EME_CODEC_VORBIS;
- supported_codecs |= media::EME_CODEC_FLAC;
+ for (const auto& codec : capability.audio_codecs) {
+ switch (codec) {
+ case media::AudioCodec::kCodecOpus:
+ supported_codecs |= media::EME_CODEC_OPUS;
+ break;
+ case media::AudioCodec::kCodecVorbis:
+ supported_codecs |= media::EME_CODEC_VORBIS;
+ break;
+ case media::AudioCodec::kCodecFLAC:
+ supported_codecs |= media::EME_CODEC_FLAC;
+ break;
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
- supported_codecs |= media::EME_CODEC_AAC;
-#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
+ case media::AudioCodec::kCodecAAC:
+ supported_codecs |= media::EME_CODEC_AAC;
+ break;
+#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
+ default:
+ DVLOG(1) << "Unexpected supported codec: " << GetCodecName(codec);
+ break;
+ }
}
- // Video codecs are determined by what was registered for the CDM.
- for (const auto &codec : supported_video_codecs) {
+ for (const auto &codec : capability.video_codecs) {
switch (codec) {
case media::VideoCodec::kCodecVP8:
supported_codecs |= media::EME_CODEC_VP8;
@@ -520,6 +526,9 @@ static media::SupportedCodecs GetSupportedCodecs(const std::vector<media::VideoC
supported_codecs |= media::EME_CODEC_VP9_PROFILE0;
supported_codecs |= media::EME_CODEC_VP9_PROFILE2;
break;
+ case media::VideoCodec::kCodecAV1:
+ supported_codecs |= media::EME_CODEC_AV1;
+ break;
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
case media::VideoCodec::kCodecH264:
supported_codecs |= media::EME_CODEC_AVC1;
@@ -543,11 +552,27 @@ static void AddWidevine(std::vector<std::unique_ptr<media::KeySystemProperties>>
}
// Codecs and encryption schemes.
- auto codecs = GetSupportedCodecs(capability->video_codecs, /*is_secure=*/false);
- const auto &encryption_schemes = capability->encryption_schemes;
- auto hw_secure_codecs = GetSupportedCodecs(capability->hw_secure_video_codecs,
- /*is_secure=*/true);
- const auto &hw_secure_encryption_schemes = capability->hw_secure_encryption_schemes;
+ media::SupportedCodecs codecs = media::EME_CODEC_NONE;
+ media::SupportedCodecs hw_secure_codecs = media::EME_CODEC_NONE;
+ base::flat_set<media::EncryptionScheme> encryption_schemes;
+ base::flat_set<media::EncryptionScheme> hw_secure_encryption_schemes;
+ if (capability->sw_secure_capability) {
+ codecs = GetSupportedCodecs(capability->sw_secure_capability.value(), /*is_secure=*/false);
+ encryption_schemes = capability->sw_secure_capability->encryption_schemes;
+ if (!base::Contains(capability->sw_secure_capability->session_types, media::CdmSessionType::kTemporary)) {
+ DVLOG(1) << "Temporary sessions must be supported.";
+ return;
+ }
+ }
+
+ if (capability->hw_secure_capability) {
+ hw_secure_codecs = GetSupportedCodecs(capability->hw_secure_capability.value(), /*is_secure=*/true);
+ hw_secure_encryption_schemes = capability->hw_secure_capability->encryption_schemes;
+ if (!base::Contains(capability->hw_secure_capability->session_types, media::CdmSessionType::kTemporary)) {
+ DVLOG(1) << "Temporary sessions must be supported.";
+ return;
+ }
+ }
// Robustness.
using Robustness = cdm::WidevineKeySystemProperties::Robustness;
@@ -559,13 +584,6 @@ static void AddWidevine(std::vector<std::unique_ptr<media::KeySystemProperties>>
max_video_robustness = Robustness::HW_SECURE_ALL;
}
- // Session types.
- bool cdm_supports_temporary_session = base::Contains(capability->session_types, media::CdmSessionType::kTemporary);
- if (!cdm_supports_temporary_session) {
- DVLOG(1) << "Temporary session must be supported.";
- return;
- }
-
auto persistent_license_support = media::EmeSessionTypeSupport::NOT_SUPPORTED;
// Others.
diff --git a/src/core/renderer/extensions/resource_request_policy_qt.cpp b/src/core/renderer/extensions/resource_request_policy_qt.cpp
index 70e97819c..ad66ec4ab 100644
--- a/src/core/renderer/extensions/resource_request_policy_qt.cpp
+++ b/src/core/renderer/extensions/resource_request_policy_qt.cpp
@@ -86,7 +86,7 @@ void ResourceRequestPolicyQt::OnExtensionUnloaded(const ExtensionId &extension_i
bool ResourceRequestPolicyQt::CanRequestResource(const GURL &resource_url,
blink::WebLocalFrame *frame,
ui::PageTransition transition_type,
- const base::Optional<url::Origin>& initiator_origin)
+ const absl::optional<url::Origin>& initiator_origin)
{
CHECK(resource_url.SchemeIs(kExtensionScheme));
diff --git a/src/core/renderer/extensions/resource_request_policy_qt.h b/src/core/renderer/extensions/resource_request_policy_qt.h
index 567eefaeb..f3c718c54 100644
--- a/src/core/renderer/extensions/resource_request_policy_qt.h
+++ b/src/core/renderer/extensions/resource_request_policy_qt.h
@@ -43,8 +43,8 @@
#include <set>
#include "base/macros.h"
-#include "base/optional.h"
#include "extensions/common/extension_id.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/base/page_transition_types.h"
#include "url/origin.h"
@@ -76,7 +76,7 @@ public:
bool CanRequestResource(const GURL &resource_url,
blink::WebLocalFrame *frame,
ui::PageTransition transition_type,
- const base::Optional<url::Origin> &initiator_origin);
+ const absl::optional<url::Origin> &initiator_origin);
private:
Dispatcher *m_dispatcher;
diff --git a/src/core/renderer/render_configuration.cpp b/src/core/renderer/render_configuration.cpp
index ef9da7af7..7870e80d5 100644
--- a/src/core/renderer/render_configuration.cpp
+++ b/src/core/renderer/render_configuration.cpp
@@ -54,8 +54,8 @@ void RenderConfiguration::RegisterMojoInterfaces(
blink::AssociatedInterfaceRegistry *associated_interfaces)
{
associated_interfaces->AddInterface(
- base::Bind(&RenderConfiguration::OnRendererConfigurationAssociatedRequest,
- base::Unretained(this)));
+ base::BindRepeating(&RenderConfiguration::OnRendererConfigurationAssociatedRequest,
+ base::Unretained(this)));
}
void RenderConfiguration::UnregisterMojoInterfaces(
diff --git a/src/core/renderer/user_resource_controller.cpp b/src/core/renderer/user_resource_controller.cpp
index 029d02c8c..daefb1f1a 100644
--- a/src/core/renderer/user_resource_controller.cpp
+++ b/src/core/renderer/user_resource_controller.cpp
@@ -207,7 +207,7 @@ void UserResourceController::runScripts(QtWebEngineCore::UserScriptData::Injecti
continue;
blink::WebScriptSource source(blink::WebString::FromUTF8(script.source), script.url);
if (script.worldId)
- frame->ExecuteScriptInIsolatedWorld(script.worldId, source);
+ frame->ExecuteScriptInIsolatedWorld(script.worldId, source, blink::BackForwardCacheAware::kAllow); // FIXME, check
else
frame->ExecuteScript(source);
}
@@ -390,7 +390,7 @@ void UserResourceController::RegisterMojoInterfaces(
blink::AssociatedInterfaceRegistry *associated_interfaces)
{
associated_interfaces->AddInterface(
- base::Bind(&UserResourceController::BindReceiver, base::Unretained(this)));
+ base::BindRepeating(&UserResourceController::BindReceiver, base::Unretained(this)));
}
void UserResourceController::UnregisterMojoInterfaces(
diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp
index c86888a2d..ef3fbeaaf 100644
--- a/src/core/renderer/web_channel_ipc_transport.cpp
+++ b/src/core/renderer/web_channel_ipc_transport.cpp
@@ -83,14 +83,20 @@ void WebChannelTransport::Install(blink::WebLocalFrame *frame, uint worldId)
{
v8::Isolate *isolate = blink::MainThreadIsolate();
v8::HandleScope handleScope(isolate);
+ v8::MicrotasksScope microtasks_scope(
+ isolate, v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::Local<v8::Context> context;
if (worldId == 0)
context = frame->MainWorldScriptContext();
else
context = frame->IsolatedWorldScriptContext(worldId);
+ if (context.IsEmpty())
+ return;
v8::Context::Scope contextScope(context);
gin::Handle<WebChannelTransport> transport = gin::CreateHandle(isolate, new WebChannelTransport);
+ if (transport.IsEmpty())
+ return;
v8::Local<v8::Object> global = context->Global();
v8::Local<v8::Value> qtObjectValue;
@@ -113,6 +119,8 @@ void WebChannelTransport::Uninstall(blink::WebLocalFrame *frame, uint worldId)
context = frame->MainWorldScriptContext();
else
context = frame->IsolatedWorldScriptContext(worldId);
+ if (context.IsEmpty())
+ return;
v8::Context::Scope contextScope(context);
v8::Local<v8::Object> global(context->Global());
@@ -224,17 +232,18 @@ void WebChannelIPCTransport::DispatchWebChannelMessage(const std::vector<uint8_t
v8::Context::Scope contextScope(context);
v8::Local<v8::Object> global(context->Global());
- v8::MaybeLocal<v8::Value> qtObjectValue(global->Get(context, gin::StringToV8(isolate, "qt")));
- if (qtObjectValue.IsEmpty() || !qtObjectValue.ToLocalChecked()->IsObject())
+ v8::Local<v8::Value> qtObjectValue;
+ if (!global->Get(context, gin::StringToV8(isolate, "qt")).ToLocal(&qtObjectValue) || !qtObjectValue->IsObject())
return;
- v8::Local<v8::Object> qtObject = v8::Local<v8::Object>::Cast(qtObjectValue.ToLocalChecked());
- v8::MaybeLocal<v8::Value> webChannelObjectValue(
- qtObject->Get(context, gin::StringToV8(isolate, "webChannelTransport")));
- if (webChannelObjectValue.IsEmpty() || !webChannelObjectValue.ToLocalChecked()->IsObject())
+ v8::Local<v8::Object> qtObject = v8::Local<v8::Object>::Cast(qtObjectValue);
+ v8::Local<v8::Value> webChannelObjectValue;
+ if (!qtObject->Get(context, gin::StringToV8(isolate, "webChannelTransport")).ToLocal(&webChannelObjectValue)
+ || !webChannelObjectValue->IsObject())
return;
- v8::Local<v8::Object> webChannelObject = v8::Local<v8::Object>::Cast(webChannelObjectValue.ToLocalChecked());
- v8::MaybeLocal<v8::Value> callbackValue(webChannelObject->Get(context, gin::StringToV8(isolate, "onmessage")));
- if (callbackValue.IsEmpty() || !callbackValue.ToLocalChecked()->IsFunction()) {
+ v8::Local<v8::Object> webChannelObject = v8::Local<v8::Object>::Cast(webChannelObjectValue);
+ v8::Local<v8::Value> callbackValue;
+ if (!webChannelObject->Get(context, gin::StringToV8(isolate, "onmessage")).ToLocal(&callbackValue)
+ || !callbackValue->IsFunction()) {
LOG(WARNING) << "onmessage is not a callable property of qt.webChannelTransport. Some things might not work as "
"expected.";
return;
@@ -249,7 +258,7 @@ void WebChannelIPCTransport::DispatchWebChannelMessage(const std::vector<uint8_t
v8::PropertyAttribute(v8::ReadOnly | v8::DontDelete));
DCHECK(!wasSet.IsNothing() && wasSet.FromJust());
- v8::Local<v8::Function> callback = v8::Local<v8::Function>::Cast(callbackValue.ToLocalChecked());
+ v8::Local<v8::Function> callback = v8::Local<v8::Function>::Cast(callbackValue);
v8::Local<v8::Value> argv[] = { messageObject };
frame->CallFunctionEvenIfScriptDisabled(callback, webChannelObject, 1, argv);
}
diff --git a/src/core/renderer/web_engine_page_render_frame.cpp b/src/core/renderer/web_engine_page_render_frame.cpp
index ad5aa4b93..33282f258 100644
--- a/src/core/renderer/web_engine_page_render_frame.cpp
+++ b/src/core/renderer/web_engine_page_render_frame.cpp
@@ -88,7 +88,7 @@ void WebEnginePageRenderFrame::FetchDocumentInnerText(uint64_t requestId,
void WebEnginePageRenderFrame::SetBackgroundColor(uint32_t color)
{
- render_frame()->GetWebFrame()->View()->SetBaseBackgroundColorOverride(color);
+ render_frame()->GetWebFrame()->View()->SetBaseBackgroundColorOverrideForInspector(color);
}
void WebEnginePageRenderFrame::OnDestruct()
diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp
index 43c3347bc..59f5808ec 100644
--- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp
+++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp
@@ -60,15 +60,6 @@ inline QDebug operator<<(QDebug stream, content::RenderFrameHost *frame)
return stream << "frame " << frame->GetRoutingID() << " in process " << frame->GetProcess()->GetID();
}
-template<class T>
-inline QDebug operator<<(QDebug stream, const base::Optional<T> &opt)
-{
- if (opt)
- return stream << *opt;
- else
- return stream << "nullopt";
-}
-
WebChannelIPCTransportHost::WebChannelIPCTransportHost(content::WebContents *contents, uint worldId, QObject *parent)
: QWebChannelAbstractTransport(parent)
, content::WebContentsObserver(contents)
diff --git a/src/core/tools/CMakeLists.txt b/src/core/tools/CMakeLists.txt
index 63cb234d6..3ee972e8f 100644
--- a/src/core/tools/CMakeLists.txt
+++ b/src/core/tools/CMakeLists.txt
@@ -10,8 +10,11 @@ if(QT_FEATURE_webengine_spellchecker)
INSTALL_DIR ${INSTALL_LIBEXECDIR}
TOOLS_TARGET WebEngineCore
SOURCES main.cpp
+ INCLUDE_DIRECTORIES
+ ../../3rdparty/chromium/third_party/abseil-cpp
)
qt_internal_return_unless_building_tools()
+
qt_skip_warnings_are_errors(${dict_target_name})
add_dependencies(${dict_target_name} WebEngineCore)
qt_internal_extend_target(${dict_target_name} CONDITION WIN32
diff --git a/src/core/tools/main.cpp b/src/core/tools/main.cpp
index 7d3515a82..a23de0f8b 100644
--- a/src/core/tools/main.cpp
+++ b/src/core/tools/main.cpp
@@ -48,13 +48,16 @@ inline base::FilePath toFilePath(const QString &str)
return base::FilePath(toFilePathString(str));
}
-inline QString toQt(const std::u16string &string)
+#if defined(Q_OS_WIN)
+inline QString toQt(const std::wstring &string)
{
-#if defined(OS_WIN)
return QString::fromStdWString(string);
-#else
- return QString::fromUtf16(reinterpret_cast<const char16_t *>(string.data()), string.size());
+}
#endif
+
+inline QString toQt(const std::u16string &string)
+{
+ return QString::fromStdU16String(string);
}
inline QString toQt(const std::string &string)
diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h
index c9f2b1473..aeaece585 100644
--- a/src/core/type_conversion.h
+++ b/src/core/type_conversion.h
@@ -76,24 +76,23 @@ class X509Certificate;
namespace QtWebEngineCore {
-inline QString toQt(const std::u16string &string)
-{
#if defined(OS_WIN)
+inline QString toQt(const std::wstring &string)
+{
return QString::fromStdWString(string);
-#else
- return QString::fromUtf16(reinterpret_cast<const char16_t *>(string.data()), string.size());
+}
#endif
+
+inline QString toQt(const std::u16string &string)
+{
+ return QString::fromStdU16String(string);
}
-inline QString toQt(const base::Optional<std::u16string> &string)
+inline QString toQt(const absl::optional<std::u16string> &string)
{
if (!string.has_value())
return QString();
-#if defined(OS_WIN)
- return QString::fromStdWString(string->data());
-#else
- return QString::fromUtf16(string->data());
-#endif
+ return QString::fromStdU16String(*string);
}
inline QString toQString(const std::string &string)
@@ -114,18 +113,14 @@ inline QString toQt(const std::string &string)
inline std::u16string toString16(const QString &qString)
{
-#if defined(OS_WIN)
- return std::u16string(qString.toStdWString());
-#else
- return std::u16string((const char16_t *)qString.utf16());
-#endif
+ return qString.toStdU16String();
}
-inline base::Optional<std::u16string> toOptionalString16(const QString &qString)
+inline absl::optional<std::u16string> toOptionalString16(const QString &qString)
{
if (qString.isNull())
- return base::nullopt;
- return base::make_optional(toString16(qString));
+ return absl::nullopt;
+ return absl::make_optional(qString.toStdU16String());
}
inline QUrl toQt(const GURL &url)
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 763564ad1..7843c7708 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -338,7 +338,7 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex,
std::unique_ptr<content::NavigationEntry> entry = content::NavigationController::CreateNavigationEntry(
toGurl(virtualUrl),
content::Referrer(toGurl(referrerUrl), static_cast<network::mojom::ReferrerPolicy>(referrerPolicy)),
- base::nullopt, // optional initiator_origin
+ absl::nullopt, // optional initiator_origin
// Use a transition type of reload so that we don't incorrectly
// increase the typed count.
ui::PAGE_TRANSITION_RELOAD,
@@ -529,7 +529,7 @@ void WebContentsAdapter::initialize(content::SiteInstance *site)
Q_ASSERT(rvh);
if (!rvh->IsRenderViewLive())
static_cast<content::WebContentsImpl*>(m_webContents.get())->CreateRenderViewForRenderManager(
- rvh, base::nullopt, nullptr);
+ rvh, absl::nullopt, nullptr);
m_webContentsDelegate->RenderViewHostChanged(nullptr, rvh);
@@ -1116,7 +1116,7 @@ void WebContentsAdapter::download(const QUrl &url, const QString &suggestedFileN
{
CHECK_INITIALIZED();
content::BrowserContext *bctx = m_webContents->GetBrowserContext();
- content::DownloadManager *dlm = content::BrowserContext::GetDownloadManager(bctx);
+ content::DownloadManager *dlm = bctx->GetDownloadManager();
DownloadManagerDelegateQt *dlmd = m_profileAdapter->downloadManagerDelegate();
if (!dlm)
@@ -1319,14 +1319,14 @@ void WebContentsAdapter::printToPDF(const QPageLayout &pageLayout, const QPageRa
{
#if QT_CONFIG(webengine_printing_and_pdf)
CHECK_INITIALIZED();
- PrintViewManagerQt::PrintToPDFFileCallback callback = base::Bind(&callbackOnPdfSavingFinished,
- m_adapterClient,
- filePath);
+ PrintViewManagerQt::PrintToPDFFileCallback callback = base::BindOnce(&callbackOnPdfSavingFinished,
+ m_adapterClient,
+ filePath);
PrintViewManagerQt::FromWebContents(m_webContents.get())->PrintToPDFFileWithCallback(pageLayout,
pageRanges,
true,
filePath,
- callback);
+ std::move(callback));
#endif // QT_CONFIG(webengine_printing_and_pdf)
}
@@ -1337,14 +1337,14 @@ quint64 WebContentsAdapter::printToPDFCallbackResult(const QPageLayout &pageLayo
{
#if QT_CONFIG(webengine_printing_and_pdf)
CHECK_INITIALIZED(0);
- PrintViewManagerQt::PrintToPDFCallback callback = base::Bind(&callbackOnPrintingFinished,
- m_adapterClient,
- m_nextRequestId);
+ PrintViewManagerQt::PrintToPDFCallback callback = base::BindOnce(&callbackOnPrintingFinished,
+ m_adapterClient,
+ m_nextRequestId);
PrintViewManagerQt::FromWebContents(m_webContents.get())->PrintToPDFWithCallback(pageLayout,
pageRanges,
colorMode,
useCustomMargins,
- callback);
+ std::move(callback));
return m_nextRequestId++;
#else
Q_UNUSED(pageLayout);
@@ -1426,8 +1426,10 @@ void WebContentsAdapter::setBackgroundColor(const QColor &color)
{
CHECK_INITIALIZED();
SkColor c = toSk(color);
- if (content::RenderWidgetHostView *rwhv = m_webContents->GetRenderWidgetHostView())
+ if (content::RenderWidgetHostView *rwhv = m_webContents->GetRenderWidgetHostView()) {
rwhv->SetBackgroundColor(c);
+ ((content::RenderWidgetHostViewBase *)rwhv)->SetContentBackgroundColor(c);
+ }
if (color != Qt::transparent)
m_pageHost->SetBackgroundColor(c);
}
@@ -2037,7 +2039,7 @@ void WebContentsAdapter::undiscard()
Q_ASSERT(rvh);
if (!rvh->IsRenderViewLive())
static_cast<content::WebContentsImpl *>(m_webContents.get())
- ->CreateRenderViewForRenderManager(rvh, base::nullopt, nullptr);
+ ->CreateRenderViewForRenderManager(rvh, absl::nullopt, nullptr);
m_webContentsDelegate->RenderViewHostChanged(nullptr, rvh);
m_adapterClient->initializationFinished();
m_adapterClient->selectionChanged();
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 3adffd1ab..3e8d32b37 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -180,6 +180,10 @@ static bool shouldUseActualURL(content::NavigationEntry *entry)
if (entry->GetPageType() != content::PAGE_TYPE_NORMAL)
return false;
+ // Show the virtual URL based on custom base, if present
+ if (!entry->GetBaseURLForDataURL().is_empty())
+ return false;
+
// Show invalid data URL
std::string mime_type, charset, data;
if (!net::DataURL::Parse(entry->GetURL(), &mime_type, &charset, &data))
@@ -215,8 +219,8 @@ void WebContentsDelegateQt::NavigationStateChanged(content::WebContents* source,
}
}
-QUrl WebContentsDelegateQt::url(content::WebContents* source) const {
-
+QUrl WebContentsDelegateQt::url(content::WebContents *source) const
+{
content::NavigationEntry *entry = source->GetController().GetVisibleEntry();
QUrl newUrl;
if (entry) {
@@ -227,7 +231,7 @@ QUrl WebContentsDelegateQt::url(content::WebContents* source) const {
GURL strippedUrl = net::SimplifyUrlForRequest(url);
newUrl = QUrl(QString("%1:%2").arg(content::kViewSourceScheme, QString::fromStdString(strippedUrl.spec())));
}
- // If there is a visible entry there are special cases when we dont wan't to use the actual URL
+ // If there is a visible entry there are special cases where we dont wan't to use the actual URL
if (newUrl.isEmpty())
newUrl = shouldUseActualURL(entry) ? toQt(url) : toQt(entry->GetVirtualURL());
}
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index fb1fe710d..09ca03ca2 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -42,11 +42,13 @@
#include <math.h>
#include "base/base_switches.h"
+#include "base/bind.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/power_monitor/power_monitor.h"
#include "base/power_monitor/power_monitor_device_source.h"
#include "base/run_loop.h"
+#include "base/strings/string_split.h"
#include "base/task/post_task.h"
#include "base/task/sequence_manager/thread_controller_with_message_pump_impl.h"
#include "base/task/thread_pool/thread_pool_instance.h"
@@ -314,26 +316,14 @@ static void setupProxyPac(base::CommandLine *commandLine)
}
}
-static bool waitForViz = false;
-static void completeVizCleanup()
-{
- waitForViz = false;
-}
-
static void cleanupVizProcess()
{
auto gpuChildThread = content::GpuChildThread::instance();
if (!gpuChildThread)
return;
- auto vizMain = gpuChildThread->viz_main();
- auto vizCompositorThreadRunner = vizMain->viz_compositor_thread_runner();
- if (!vizCompositorThreadRunner)
- return;
- waitForViz = true;
content::GetHostFrameSinkManager()->SetConnectionLostCallback(base::DoNothing());
auto factory = static_cast<content::VizProcessTransportFactory*>(content::ImageTransportFactory::GetInstance());
factory->PrepareForShutDown();
- vizCompositorThreadRunner->CleanupForShutdown(base::BindOnce(&completeVizCleanup));
}
static QStringList parseEnvCommandLine(const QString &cmdLine)
@@ -446,10 +436,6 @@ void WebEngineContext::destroy()
// on IO thread (triggered by ~BrowserMainRunner). But by that time the UI
// task runner is not working anymore so we need to do this earlier.
cleanupVizProcess();
- while (waitForViz) {
- flushMessages();
- QThread::msleep(50);
- }
destroyGpuProcess();
// Flush the UI message loop before quitting.
flushMessages();
@@ -773,7 +759,9 @@ WebEngineContext::WebEngineContext()
#endif
#endif //QT_CONFIG(opengl)
} else {
+ parsedCommandLine->AppendSwitchASCII(switches::kUseGL, "disabled");
parsedCommandLine->AppendSwitch(switches::kDisableGpu);
+ parsedCommandLine->AppendSwitch(switches::kInProcessGPU);
}
registerMainThreadFactories();
@@ -793,8 +781,8 @@ WebEngineContext::WebEngineContext()
mojoConfiguration.is_broker_process = true;
mojo::core::Init(mojoConfiguration);
- // This block mirrors ContentMainRunnerImpl::RunServiceManager():
- m_mainDelegate->PreCreateMainMessageLoop();
+ // This block mirrors ContentMainRunnerImpl::RunBrowser():
+ m_mainDelegate->PreBrowserMain();
base::MessagePump::OverrideMessagePumpForUIFactory(messagePumpFactory);
content::BrowserTaskExecutor::Create();
m_mainDelegate->PostEarlyInitialization(false);
@@ -839,7 +827,7 @@ WebEngineContext::WebEngineContext()
// be created from the FILE thread, and that GetPluginInfoArray is synchronous, it
// can't loads plugins synchronously from the IO thread to serve the render process' request
// and we need to make sure that it happened beforehand.
- content::PluginService::GetInstance()->GetPlugins(base::Bind(&dummyGetPluginCallback));
+ content::PluginService::GetInstance()->GetPlugins(base::BindOnce(&dummyGetPluginCallback));
#endif
#if QT_CONFIG(webengine_printing_and_pdf)
@@ -903,7 +891,7 @@ base::CommandLine* WebEngineContext::commandLine() {
argv.resize(appArgs.size());
#if defined(Q_OS_WIN)
for (int i = 0; i < appArgs.size(); ++i)
- argv[i] = toString16(appArgs[i]);
+ argv[i] = appArgs[i].toStdWString();
#else
for (int i = 0; i < appArgs.size(); ++i)
argv[i] = appArgs[i].toStdString();
diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp
index 45d5bcfc8..007249f42 100644
--- a/src/core/web_engine_settings.cpp
+++ b/src/core/web_engine_settings.cpp
@@ -50,6 +50,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
#include "media/base/media_switches.h"
+#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h"
#include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
@@ -438,7 +439,7 @@ void WebEngineSettings::applySettingsToWebPreferences(blink::web_pref::WebPrefer
}
// Apply native CaptionStyle parameters.
- base::Optional<ui::CaptionStyle> style;
+ absl::optional<ui::CaptionStyle> style;
if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kForceCaptionStyle)) {
style = ui::CaptionStyle::FromSpec(
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kForceCaptionStyle));