summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-10-06 17:06:14 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-12-02 09:18:45 +0100
commit61de0e721f672e854551a8938d2d42ba946398cf (patch)
tree2a36dfb72417701b093cde8b333a434f8fcacd27 /src
parent5dc3a3fb5e3286a9643fece7c7f94cec7fc29f3e (diff)
Adaptations for Chromium 94
Change-Id: I9fb8998a3a7762b0aea70993ca231f0bbf4f7761 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src')
m---------src/3rdparty0
-rw-r--r--src/core/CMakeLists.txt4
-rw-r--r--src/core/api/CMakeLists.txt2
-rw-r--r--src/core/browser_accessibility_qt.cpp2
-rw-r--r--src/core/browser_message_filter_qt.cpp1
-rw-r--r--src/core/client_cert_select_controller.cpp2
-rw-r--r--src/core/clipboard_change_observer.h11
-rw-r--r--src/core/clipboard_qt.cpp80
-rw-r--r--src/core/clipboard_qt.h7
-rw-r--r--src/core/compositor/display_skia_output_device.cpp4
-rw-r--r--src/core/compositor/display_skia_output_device.h3
-rw-r--r--src/core/configure/BUILD.root.gn.in37
-rw-r--r--src/core/content_browser_client_qt.cpp104
-rw-r--r--src/core/content_browser_client_qt.h9
-rw-r--r--src/core/content_client_qt.cpp10
-rw-r--r--src/core/content_client_qt.h2
-rw-r--r--src/core/content_main_delegate_qt.cpp1
-rw-r--r--src/core/delegated_frame_host_client_qt.cpp4
-rw-r--r--src/core/devtools_frontend_qt.cpp82
-rw-r--r--src/core/doc/src/qtwebengine-platform-notes.qdoc6
-rw-r--r--src/core/extensions/component_extension_resource_manager_qt.cpp1
-rw-r--r--src/core/extensions/extensions_browser_client_qt.cpp16
-rw-r--r--src/core/extensions/extensions_browser_client_qt.h5
-rw-r--r--src/core/favicon_driver_qt.cpp14
-rw-r--r--src/core/favicon_driver_qt.h2
-rw-r--r--src/core/media_capture_devices_dispatcher.cpp18
-rw-r--r--src/core/media_capture_devices_dispatcher.h18
-rw-r--r--src/core/net/client_cert_store_data.cpp2
-rw-r--r--src/core/net/cookie_monster_delegate_qt.cpp2
-rw-r--r--src/core/net/custom_url_loader_factory.cpp1
-rw-r--r--src/core/net/proxying_url_loader_factory_qt.cpp1
-rw-r--r--src/core/net/ssl_host_state_delegate_qt.cpp10
-rw-r--r--src/core/net/ssl_host_state_delegate_qt.h2
-rw-r--r--src/core/net/system_network_context_manager.cpp36
-rw-r--r--src/core/ozone/gl_surface_egl_qt.cpp135
-rw-r--r--src/core/ozone/ozone_platform_qt.cpp12
-rw-r--r--src/core/ozone/platform_window_qt.cpp6
-rw-r--r--src/core/ozone/platform_window_qt.h2
-rw-r--r--src/core/ozone/surface_factory_qt.cpp7
-rw-r--r--src/core/ozone/surface_factory_qt.h4
-rw-r--r--src/core/pref_service_adapter.cpp1
-rw-r--r--src/core/printing/print_view_manager_base_qt.cpp37
-rw-r--r--src/core/printing/print_view_manager_base_qt.h5
-rw-r--r--src/core/printing/print_view_manager_qt.cpp16
-rw-r--r--src/core/printing/print_view_manager_qt.h4
-rw-r--r--src/core/profile_adapter.cpp1
-rw-r--r--src/core/profile_io_data_qt.cpp2
-rw-r--r--src/core/render_widget_host_view_qt.cpp12
-rw-r--r--src/core/render_widget_host_view_qt.h10
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp33
-rw-r--r--src/core/renderer/extensions/extensions_renderer_client_qt.cpp1
-rw-r--r--src/core/renderer/web_engine_page_render_frame.cpp2
-rw-r--r--src/core/renderer_host/web_channel_ipc_transport_host.cpp8
-rw-r--r--src/core/renderer_host/web_channel_ipc_transport_host.h8
-rw-r--r--src/core/touch_selection_controller_client_qt.h1
-rw-r--r--src/core/type_conversion.cpp13
-rw-r--r--src/core/type_conversion.h4
-rw-r--r--src/core/web_contents_adapter.cpp15
-rw-r--r--src/core/web_contents_adapter.h1
-rw-r--r--src/core/web_contents_delegate_qt.cpp4
-rw-r--r--src/core/web_contents_delegate_qt.h2
-rw-r--r--src/core/web_engine_context.cpp4
-rw-r--r--src/core/web_usb_detector_qt.cpp1
-rw-r--r--src/gn/CMakeLists.txt4
-rw-r--r--src/ninja/CMakeLists.txt4
-rw-r--r--src/pdf/CMakeLists.txt5
66 files changed, 473 insertions, 390 deletions
diff --git a/src/3rdparty b/src/3rdparty
-Subproject 39aa0ea99a30c9c15fb3640fe9a2638982548c0
+Subproject be03c63b39a476d9743ce5b915c731d15da29c3
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index bcec7ec18..7c17dc1f9 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.19)
find_package(Ninja 1.7.2 REQUIRED)
-find_package(Nodejs 10.19 REQUIRED)
+find_package(Nodejs 12 REQUIRED)
find_package(PkgConfig)
if(PkgConfig_FOUND)
pkg_check_modules(XSCRNSAVER xscrnsaver)
@@ -275,6 +275,7 @@ foreach(arch ${archs})
list(APPEND gnArgArg
qtwebengine_target="${buildDir}/${config}/${arch}:QtWebEngineCore"
+ enable_ipc_fuzzer=false
enable_media_remoting=false
enable_message_center=false
enable_nacl=false
@@ -286,6 +287,7 @@ foreach(arch ${archs})
angle_enable_swiftshader=false
enable_web_speech=false
enable_widevine=true
+ fatal_linker_warnings=false
has_native_accessibility=false
safe_browsing_mode=0
skia_use_dawn=false
diff --git a/src/core/api/CMakeLists.txt b/src/core/api/CMakeLists.txt
index f878f3465..ffc450039 100644
--- a/src/core/api/CMakeLists.txt
+++ b/src/core/api/CMakeLists.txt
@@ -80,7 +80,7 @@ qt_internal_add_docs(WebEngineCore
add_custom_command(
OUTPUT chromium_attributions.qdoc
- COMMAND ${Python2_EXECUTABLE} chromium/tools/licenses.py
+ COMMAND ${Python3_EXECUTABLE} chromium/tools/licenses.py
--file-template ../core/doc/about_credits.tmpl
--entry-template ../core/doc/about_credits_entry.tmpl
credits ${CMAKE_CURRENT_BINARY_DIR}/chromium_attributions.qdoc
diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp
index a377a0e65..76e76c12e 100644
--- a/src/core/browser_accessibility_qt.cpp
+++ b/src/core/browser_accessibility_qt.cpp
@@ -237,8 +237,6 @@ QAccessible::Role BrowserAccessibilityQt::role() const
case ax::mojom::Role::kAlert:
case ax::mojom::Role::kAlertDialog:
return QAccessible::AlertMessage;
- case ax::mojom::Role::kAnchor:
- return QAccessible::Link;
case ax::mojom::Role::kApplication:
return QAccessible::Document; // returning Application here makes Qt return the top level app object
case ax::mojom::Role::kArticle:
diff --git a/src/core/browser_message_filter_qt.cpp b/src/core/browser_message_filter_qt.cpp
index 22b86dba0..118b0eeb7 100644
--- a/src/core/browser_message_filter_qt.cpp
+++ b/src/core/browser_message_filter_qt.cpp
@@ -40,7 +40,6 @@
#include "browser_message_filter_qt.h"
#include "chrome/browser/profiles/profile.h"
-#include "content/public/browser/plugin_service.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
diff --git a/src/core/client_cert_select_controller.cpp b/src/core/client_cert_select_controller.cpp
index 7173af684..b515fd418 100644
--- a/src/core/client_cert_select_controller.cpp
+++ b/src/core/client_cert_select_controller.cpp
@@ -112,7 +112,7 @@ void ClientCertSelectController::select(const QSslCertificate &certificate)
}
QByteArray derCertificate = certificate.toDer();
scoped_refptr<net::X509Certificate> selectedCert =
- net::X509Certificate::CreateFromBytes(derCertificate.constData(), derCertificate.length());
+ net::X509Certificate::CreateFromBytes(base::make_span((const unsigned char *)derCertificate.constData(), derCertificate.length()));
for (auto &certInfo : m_clientCerts) {
scoped_refptr<net::X509Certificate> cert = certInfo->certificate();
if (cert->EqualsExcludingChain(selectedCert.get())) {
diff --git a/src/core/clipboard_change_observer.h b/src/core/clipboard_change_observer.h
index f9b33fc93..2ba189c97 100644
--- a/src/core/clipboard_change_observer.h
+++ b/src/core/clipboard_change_observer.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
@@ -41,22 +41,25 @@
#define CLIPBOARD_CHANGE_OBSERVER_H
#include <QClipboard>
-#include <QMap>
#include <QObject>
+#include "ui/base/clipboard/clipboard_sequence_number_token.h"
+
namespace QtWebEngineCore {
class ClipboardChangeObserver : public QObject {
Q_OBJECT
public:
ClipboardChangeObserver();
- quint64 getSequenceNumber(QClipboard::Mode mode) { return sequenceNumber.value(mode); }
+ const ui::ClipboardSequenceNumberToken &getPrimarySequenceNumber() { return m_primarySequenceNumber; }
+ const ui::ClipboardSequenceNumberToken &getSelectionSequenceNumber() { return m_selectionSequenceNumber; }
private Q_SLOTS:
void trackChange(QClipboard::Mode mode);
private:
- QMap<QClipboard::Mode, quint64> sequenceNumber;
+ ui::ClipboardSequenceNumberToken m_primarySequenceNumber;
+ ui::ClipboardSequenceNumberToken m_selectionSequenceNumber;
};
} // namespace QtWebEngineCore
diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp
index e778695b6..09c08d7f6 100644
--- a/src/core/clipboard_qt.cpp
+++ b/src/core/clipboard_qt.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
@@ -51,6 +51,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/clipboard/custom_data_helper.h"
#include "ui/base/clipboard/clipboard.h"
+#include "ui/base/clipboard/clipboard_monitor.h"
#include "ui/base/clipboard/clipboard_constants.h"
#include "ui/base/clipboard/clipboard_format_type.h"
#include "ui/base/ui_base_features.h"
@@ -77,7 +78,13 @@ ClipboardChangeObserver::ClipboardChangeObserver()
void ClipboardChangeObserver::trackChange(QClipboard::Mode mode)
{
- ++sequenceNumber[mode];
+ if (mode == QClipboard::Clipboard)
+ m_primarySequenceNumber = ui::ClipboardSequenceNumberToken();
+ else if (mode == QClipboard::Selection)
+ m_selectionSequenceNumber = ui::ClipboardSequenceNumberToken();
+ else
+ return;
+ ui::ClipboardMonitor::GetInstance()->NotifyClipboardDataChanged();
}
} // namespace QtWebEngineCore
@@ -114,7 +121,10 @@ extern void CFHtmlExtractMetadata(const std::string &cf_html, std::string *base_
size_t *html_start, size_t *fragment_start, size_t *fragment_end);
#endif // defined(Q_OS_WIN)
-void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects, std::unique_ptr<ui::DataTransferEndpoint> data_src)
+void ClipboardQt::WritePortableAndPlatformRepresentations(ui::ClipboardBuffer type,
+ const ObjectMap &objects,
+ std::vector<ui::Clipboard::PlatformRepresentation> platform_representations,
+ std::unique_ptr<ui::DataTransferEndpoint> data_src)
{
DCHECK(CalledOnValidThread());
DCHECK(IsSupportedClipboardBuffer(type));
@@ -122,6 +132,9 @@ void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const O
for (const auto &object : objects)
DispatchPortableRepresentation(object.first, object.second);
+ if (!platform_representations.empty())
+ DispatchPlatformRepresentations(std::move(platform_representations));
+
// Commit the accumulated data.
if (uncommittedData)
QGuiApplication::clipboard()->setMimeData(uncommittedData.take(),
@@ -132,24 +145,15 @@ void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const O
ObjectMap::const_iterator text_iter = objects.find(PortableFormat::kText);
if (text_iter != objects.end()) {
// Copy text and SourceTag to the selection clipboard.
- WritePortableRepresentations(ui::ClipboardBuffer::kSelection,
- ObjectMap(text_iter, text_iter + 1),
- nullptr);
+ WritePortableAndPlatformRepresentations(ui::ClipboardBuffer::kSelection,
+ ObjectMap(text_iter, text_iter + 1),
+ {},
+ nullptr);
}
}
m_dataSrc[type] = std::move(data_src);
}
-void ClipboardQt::WritePlatformRepresentations(ui::ClipboardBuffer buffer,
- std::vector<ui::Clipboard::PlatformRepresentation> platform_representations,
- std::unique_ptr<ui::DataTransferEndpoint> data_src)
-{
- DCHECK(CalledOnValidThread());
- DCHECK(IsSupportedClipboardBuffer(buffer));
- DispatchPlatformRepresentations(std::move(platform_representations));
- m_dataSrc[buffer] = std::move(data_src);
-}
-
void ClipboardQt::WriteText(const char *text_data, size_t text_len)
{
getUncommittedData()->setText(QString::fromUtf8(text_data, text_len));
@@ -244,11 +248,16 @@ void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type,
if (mimeData->hasImage() && !mimeData->formats().contains(QStringLiteral("image/png")))
types->push_back(toString16(QStringLiteral("image/png")));
const QStringList formats = mimeData->formats();
- for (const QString &mimeType : formats)
- types->push_back(toString16(mimeType));
-
- const QByteArray customData = mimeData->data(QString::fromLatin1(ui::kMimeTypeWebCustomData));
- ui::ReadCustomDataTypes(customData.constData(), customData.size(), types);
+ for (const QString &mimeType : formats) {
+ // Special handling for chromium/x-web-custom-data. We must read the data
+ // and deserialize it to find the list of mime types to report.
+ if (mimeType == QString::fromLatin1(ui::kMimeTypeWebCustomData)) {
+ const QByteArray customData = mimeData->data(QString::fromLatin1(ui::kMimeTypeWebCustomData));
+ ui::ReadCustomDataTypes(customData.constData(), customData.size(), types);
+ } else {
+ types->push_back(toString16(mimeType));
+ }
+ }
}
void ClipboardQt::ReadText(ui::ClipboardBuffer type,
@@ -410,10 +419,11 @@ void ClipboardQt::ReadData(const ui::ClipboardFormatType &format,
*result = std::string(byteArray.constData(), byteArray.length());
}
-uint64_t ClipboardQt::GetSequenceNumber(ui::ClipboardBuffer type) const
+const ui::ClipboardSequenceNumberToken &ClipboardQt::GetSequenceNumber(ui::ClipboardBuffer type) const
{
- return clipboardChangeObserver()->getSequenceNumber(type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard
- : QClipboard::Selection);
+ return type == ui::ClipboardBuffer::kCopyPaste
+ ? clipboardChangeObserver()->getPrimarySequenceNumber()
+ : clipboardChangeObserver()->getSelectionSequenceNumber();
}
const ui::DataTransferEndpoint *ClipboardQt::GetSource(ui::ClipboardBuffer buffer) const
@@ -458,23 +468,15 @@ bool ClipboardQt::IsSelectionBufferAvailable() const
std::vector<std::u16string> ClipboardQt::ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::DataTransferEndpoint *data_dst) const
{
- // based on ClipboardX11
- std::vector<std::u16string> types;
- if (IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(), buffer, data_dst))
- types.push_back(base::UTF8ToUTF16(ui::ClipboardFormatType::GetPlainTextType().GetName()));
- if (IsFormatAvailable(ui::ClipboardFormatType::GetHtmlType(), buffer, data_dst))
- types.push_back(base::UTF8ToUTF16(ui::ClipboardFormatType::GetHtmlType().GetName()));
- if (IsFormatAvailable(ui::ClipboardFormatType::GetRtfType(), buffer, data_dst))
- types.push_back(base::UTF8ToUTF16(ui::ClipboardFormatType::GetRtfType().GetName()));
- if (IsFormatAvailable(ui::ClipboardFormatType::GetBitmapType(), buffer, data_dst))
- types.push_back(base::UTF8ToUTF16(ui::kMimeTypePNG));
- if (IsFormatAvailable(ui::ClipboardFormatType::GetSvgType(), buffer, data_dst))
- types.push_back(base::UTF8ToUTF16(ui::kMimeTypeSvg));
+ Q_UNUSED(data_dst);
const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(
buffer == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection);
- if (base::FeatureList::IsEnabled(features::kClipboardFilenames) && mimeData->hasUrls())
- types.push_back(base::UTF8ToUTF16(ui::kMimeTypeURIList));
- // ### Should we add non-standard mime-types?
+ if (!mimeData)
+ return {};
+ std::vector<std::u16string> types;
+ const QStringList formats = mimeData->formats();
+ for (const QString &mimeType : formats)
+ types.push_back(toString16(mimeType));
return types;
}
diff --git a/src/core/clipboard_qt.h b/src/core/clipboard_qt.h
index cb7a373ca..a9a1ef7d8 100644
--- a/src/core/clipboard_qt.h
+++ b/src/core/clipboard_qt.h
@@ -47,7 +47,7 @@ namespace QtWebEngineCore {
class ClipboardQt : public ui::Clipboard
{
public:
- uint64_t GetSequenceNumber(ui::ClipboardBuffer type) const override;
+ const ui::ClipboardSequenceNumberToken &GetSequenceNumber(ui::ClipboardBuffer type) const override;
bool IsFormatAvailable(const ui::ClipboardFormatType &format,
ui::ClipboardBuffer buffer,
const ui::DataTransferEndpoint *data_dst) const override;
@@ -79,12 +79,9 @@ public:
std::vector<ui::FileInfo> *result) const override;
protected:
- void WritePortableRepresentations(
+ void WritePortableAndPlatformRepresentations(
ui::ClipboardBuffer buffer,
const ObjectMap &objects,
- std::unique_ptr<ui::DataTransferEndpoint> data_src) override;
- void WritePlatformRepresentations(
- ui::ClipboardBuffer buffer,
std::vector<Clipboard::PlatformRepresentation> platform_representations,
std::unique_ptr<ui::DataTransferEndpoint> data_src) override;
void WriteText(const char *text_data, size_t text_len) override;
diff --git a/src/core/compositor/display_skia_output_device.cpp b/src/core/compositor/display_skia_output_device.cpp
index 69cb65eeb..c33a31b87 100644
--- a/src/core/compositor/display_skia_output_device.cpp
+++ b/src/core/compositor/display_skia_output_device.cpp
@@ -188,8 +188,10 @@ void DisplaySkiaOutputDevice::DiscardBackbuffer()
{
}
-SkSurface *DisplaySkiaOutputDevice::BeginPaint(std::vector<GrBackendSemaphore> *)
+SkSurface *DisplaySkiaOutputDevice::BeginPaint(bool allocate_frame_buffer,
+ std::vector<GrBackendSemaphore> *)
{
+ Q_UNUSED(allocate_frame_buffer); // FIXME?
if (!m_backBuffer || m_backBuffer->shape() != m_shape)
m_backBuffer = std::make_unique<Buffer>(this);
return m_backBuffer->surface();
diff --git a/src/core/compositor/display_skia_output_device.h b/src/core/compositor/display_skia_output_device.h
index 2993e9147..b5503ee5e 100644
--- a/src/core/compositor/display_skia_output_device.h
+++ b/src/core/compositor/display_skia_output_device.h
@@ -70,7 +70,8 @@ public:
viz::OutputSurfaceFrame frame) override;
void EnsureBackbuffer() override;
void DiscardBackbuffer() override;
- SkSurface *BeginPaint(std::vector<GrBackendSemaphore> *semaphores) override;
+ SkSurface *BeginPaint(bool allocate_frame_buffer,
+ std::vector<GrBackendSemaphore> *semaphores) override;
void EndPaint() override;
// Overridden from Compositor.
diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in
index fc60562c5..4af30131b 100644
--- a/src/core/configure/BUILD.root.gn.in
+++ b/src/core/configure/BUILD.root.gn.in
@@ -213,6 +213,7 @@ source_set("qtwebengine_sources") {
"//chrome/browser/resources/net_internals:resources",
"//chrome/browser/resources/quota_internals:resources",
"//chrome/common:buildflags",
+ "//chromeos/components/chromebox_for_meetings/buildflags",
"//components/nacl/common:buildflags",
"//components/performance_manager",
"//components/plugins/renderer/",
@@ -334,12 +335,15 @@ source_set("qtwebengine_sources") {
]
}
if (enable_plugins) {
- sources += [
- "//chrome/renderer/pepper/pepper_flash_font_file_host.cc",
- "//chrome/renderer/pepper/pepper_flash_font_file_host.h",
- "//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
- "//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
- ]
+ sources += [
+ "//chrome/renderer/pepper/pepper_flash_font_file_host.cc",
+ "//chrome/renderer/pepper/pepper_flash_font_file_host.h",
+ "//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc",
+ "//chrome/renderer/pepper/pepper_shared_memory_message_filter.h",
+ ]
+ if (is_linux) {
+ deps += [ "//pdf:font_table_linux" ]
+ }
}
if (enable_basic_printing || enable_print_preview) {
sources += [
@@ -357,16 +361,17 @@ source_set("qtwebengine_sources") {
]
}
if (enable_pdf) {
- deps += [
- "//pdf",
- "//pdf:buildflags",
- "//pdf:pdf_ppapi",
- "//chrome/browser/resources/pdf:resources",
- "//components/pdf/browser:browser",
- "//components/pdf/renderer:renderer",
- "//components/printing/browser",
- "//components/printing/renderer",
- ]
+ deps += [
+ "//pdf",
+ "//pdf:buildflags",
+ "//pdf:pdf_ppapi",
+ "//chrome/browser/resources/pdf:resources",
+ "//components/pdf/browser",
+ "//components/pdf/common",
+ "//components/pdf/renderer",
+ "//components/printing/browser",
+ "//components/printing/renderer",
+ ]
}
if (enable_webrtc && enable_extensions) {
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index b9e685c2c..68f903154 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -75,7 +75,6 @@
#include "services/network/network_service.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h"
-#include "third_party/blink/public/mojom/insecure_input/insecure_input_service.mojom.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_switches.h"
#include "url/url_util_qt.h"
@@ -147,6 +146,7 @@
#include "common/extensions/extensions_client_qt.h"
#include "components/guest_view/browser/guest_view_base.h"
#include "extensions/browser/api/mime_handler_private/mime_handler_private.h"
+#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_message_filter.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h"
@@ -164,6 +164,15 @@
#include "net/plugin_response_interceptor_url_loader_throttle.h"
#endif
+#if QT_CONFIG(webengine_webchannel)
+#include "qtwebengine/browser/qtwebchannel.mojom.h"
+#include "renderer_host/web_channel_ipc_transport_host.h"
+#endif
+
+#if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW)
+#include "printing/print_view_manager_qt.h"
+#endif
+
#include <QGuiApplication>
#include <QStandardPaths>
#include <qpa/qplatformnativeinterface.h>
@@ -418,52 +427,6 @@ content::PlatformNotificationService *ContentBrowserClientQt::GetPlatformNotific
return profile->platformNotificationService();
}
-// This is a really complicated way of doing absolutely nothing, but Mojo demands it:
-class ServiceDriver
- : public blink::mojom::InsecureInputService
- , public content::WebContentsUserData<ServiceDriver>
-{
-public:
- static void CreateForRenderFrameHost(content::RenderFrameHost *renderFrameHost)
- {
- content::WebContents* web_contents = content::WebContents::FromRenderFrameHost(renderFrameHost);
- if (!web_contents)
- return;
- CreateForWebContents(web_contents);
- }
- static ServiceDriver* FromRenderFrameHost(content::RenderFrameHost *renderFrameHost)
- {
- content::WebContents* web_contents = content::WebContents::FromRenderFrameHost(renderFrameHost);
- if (!web_contents)
- return nullptr;
- return FromWebContents(web_contents);
- }
- static void BindInsecureInputService(content::RenderFrameHost *render_frame_host, mojo::PendingReceiver<blink::mojom::InsecureInputService> receiver)
- {
- CreateForRenderFrameHost(render_frame_host);
- ServiceDriver *driver = FromRenderFrameHost(render_frame_host);
-
- if (driver)
- driver->BindInsecureInputServiceReceiver(std::move(receiver));
- }
- void BindInsecureInputServiceReceiver(mojo::PendingReceiver<blink::mojom::InsecureInputService> receiver)
- {
- m_receivers.Add(this, std::move(receiver));
- }
-
- // blink::mojom::InsecureInputService:
- void DidEditFieldInInsecureContext() override
- { }
-
-private:
- WEB_CONTENTS_USER_DATA_KEY_DECL();
- explicit ServiceDriver(content::WebContents* /*web_contents*/) { }
- friend class content::WebContentsUserData<ServiceDriver>;
- mojo::ReceiverSet<blink::mojom::InsecureInputService> m_receivers;
-};
-
-WEB_CONTENTS_USER_DATA_KEY_IMPL(ServiceDriver)
-
void ContentBrowserClientQt::BindHostReceiverForRenderer(content::RenderProcessHost *render_process_host,
mojo::GenericPendingReceiver receiver)
{
@@ -512,7 +475,6 @@ void ContentBrowserClientQt::RegisterBrowserInterfaceBindersForFrame(
mojo::BinderMapWithContext<content::RenderFrameHost *> *map)
{
Q_UNUSED(render_frame_host);
- map->Add<blink::mojom::InsecureInputService>(base::BindRepeating(&ServiceDriver::BindInsecureInputService));
map->Add<network_hints::mojom::NetworkHintsHandler>(base::BindRepeating(&BindNetworkHintsHandler));
#if BUILDFLAG(ENABLE_EXTENSIONS)
map->Add<extensions::mime_handler::MimeHandlerService>(base::BindRepeating(&BindMimeHandlerService));
@@ -536,9 +498,45 @@ void ContentBrowserClientQt::ExposeInterfacesToRenderer(service_manager::BinderR
blink::AssociatedInterfaceRegistry *associated_registry,
content::RenderProcessHost *render_process_host)
{
- Q_UNUSED(associated_registry);
if (auto *manager = performance_manager::PerformanceManagerRegistry::GetInstance())
manager->CreateProcessNodeAndExposeInterfacesToRendererProcess(registry, render_process_host);
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ associated_registry->AddInterface(base::BindRepeating(&extensions::EventRouter::BindForRenderer,
+ render_process_host->GetID()));
+#else
+ Q_UNUSED(associated_registry);
+#endif
+}
+
+bool ContentBrowserClientQt::BindAssociatedReceiverFromFrame(content::RenderFrameHost *rfh,
+ const std::string &interface_name,
+ mojo::ScopedInterfaceEndpointHandle *handle)
+{
+#if QT_CONFIG(webengine_webchannel)
+ if (interface_name == qtwebchannel::mojom::WebChannelTransportHost::Name_) {
+ auto *web_contents = content::WebContents::FromRenderFrameHost(rfh);
+ auto *adapter = static_cast<WebContentsDelegateQt *>(web_contents->GetDelegate())->webContentsAdapter();
+ adapter->webChannelTransport()->BindReceiver(
+ mojo::PendingAssociatedReceiver<qtwebchannel::mojom::WebChannelTransportHost>(std::move(*handle)), rfh);
+ return true;
+ }
+#endif
+#if BUILDFLAG(ENABLE_PRINTING) && BUILDFLAG(ENABLE_PRINT_PREVIEW)
+ if (interface_name == printing::mojom::PrintManagerHost::Name_) {
+ mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> receiver(std::move(*handle));
+ PrintViewManagerQt::BindPrintManagerHost(std::move(receiver), rfh);
+ return true;
+ }
+#endif
+#if BUILDFLAG(ENABLE_EXTENSIONS)
+ if (interface_name == extensions::mojom::LocalFrameHost::Name_) {
+ extensions::ExtensionWebContentsObserverQt::BindLocalFrameHost(
+ mojo::PendingAssociatedReceiver<extensions::mojom::LocalFrameHost>(std::move(*handle)), rfh);
+ return true;
+ }
+#endif
+ DCHECK(!ContentBrowserClient::BindAssociatedReceiverFromFrame(rfh, interface_name, handle));
+ return false;
}
bool ContentBrowserClientQt::CanCreateWindow(
@@ -651,7 +649,7 @@ ContentBrowserClientQt::AllowServiceWorker(const GURL &scope,
// We control worker access to FS and indexed-db using cookie permissions, this is mirroring Chromium's logic.
void ContentBrowserClientQt::AllowWorkerFileSystem(const GURL &url,
content::BrowserContext *context,
- const std::vector<content::GlobalFrameRoutingId> &/*render_frames*/,
+ const std::vector<content::GlobalRenderFrameHostId> &/*render_frames*/,
base::OnceCallback<void(bool)> callback)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
@@ -664,7 +662,7 @@ void ContentBrowserClientQt::AllowWorkerFileSystem(const GURL &url,
bool ContentBrowserClientQt::AllowWorkerIndexedDB(const GURL &url,
content::BrowserContext *context,
- const std::vector<content::GlobalFrameRoutingId> &/*render_frames*/)
+ const std::vector<content::GlobalRenderFrameHostId> &/*render_frames*/)
{
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (!context || context->ShutdownStarted())
@@ -673,7 +671,7 @@ bool ContentBrowserClientQt::AllowWorkerIndexedDB(const GURL &url,
}
static void LaunchURL(const GURL& url,
- base::OnceCallback<content::WebContents*()> web_contents_getter,
+ base::RepeatingCallback<content::WebContents*()> web_contents_getter,
ui::PageTransition page_transition, bool is_main_frame, bool has_user_gesture)
{
Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
@@ -694,7 +692,7 @@ static void LaunchURL(const GURL& url,
bool ContentBrowserClientQt::HandleExternalProtocol(const GURL &url,
- base::OnceCallback<content::WebContents*()> web_contents_getter,
+ base::RepeatingCallback<content::WebContents*()> web_contents_getter,
int child_id,
int frame_tree_node_id,
content::NavigationUIData *navigation_data,
diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h
index d739c580e..4bae6186f 100644
--- a/src/core/content_browser_client_qt.h
+++ b/src/core/content_browser_client_qt.h
@@ -112,6 +112,9 @@ public:
void ExposeInterfacesToRenderer(service_manager::BinderRegistry *registry,
blink::AssociatedInterfaceRegistry *associated_registry,
content::RenderProcessHost *render_process_host) override;
+ bool BindAssociatedReceiverFromFrame(content::RenderFrameHost *render_frame_host,
+ const std::string &interface_name,
+ mojo::ScopedInterfaceEndpointHandle *handle) override;
bool CanCreateWindow(content::RenderFrameHost *opener,
const GURL &opener_url,
@@ -151,12 +154,12 @@ public:
void AllowWorkerFileSystem(const GURL &url,
content::BrowserContext *context,
- const std::vector<content::GlobalFrameRoutingId> &render_frames,
+ const std::vector<content::GlobalRenderFrameHostId> &render_frames,
base::OnceCallback<void(bool)> callback) override;
bool AllowWorkerIndexedDB(const GURL &url,
content::BrowserContext *context,
- const std::vector<content::GlobalFrameRoutingId> &render_frames) override;
+ const std::vector<content::GlobalRenderFrameHostId> &render_frames) override;
AllowWebBluetoothResult AllowWebBluetooth(content::BrowserContext *browser_context,
const url::Origin &requesting_origin,
const url::Origin &embedding_origin) override;
@@ -196,7 +199,7 @@ public:
bool HandleExternalProtocol(
const GURL &url,
- base::OnceCallback<content::WebContents*()> web_contents_getter,
+ base::RepeatingCallback<content::WebContents*()> web_contents_getter,
int child_id,
int frame_tree_node_id,
content::NavigationUIData *navigation_data,
diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp
index 100d3eae0..67e2bed4f 100644
--- a/src/core/content_client_qt.cpp
+++ b/src/core/content_client_qt.cpp
@@ -271,10 +271,12 @@ static bool IsWidevineAvailable(base::FilePath *cdm_path,
if (base::PathExists(*cdm_path)) {
// Add the supported codecs as if they came from the component manifest.
// This list must match the CDM that is being bundled with Chrome.
- capability->video_codecs.push_back(media::VideoCodec::kCodecVP8);
- capability->video_codecs.push_back(media::VideoCodec::kCodecVP9);
+ const std::vector<media::VideoCodecProfile> kAllProfiles = {};
+ capability->video_codecs.emplace(media::VideoCodec::kCodecVP8, kAllProfiles);
+ capability->video_codecs.emplace(media::VideoCodec::kCodecVP9, kAllProfiles);
+ capability->video_codecs.emplace(media::VideoCodec::kCodecAV1, kAllProfiles);
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
- capability->video_codecs.push_back(media::VideoCodec::kCodecH264);
+ capability->video_codecs.emplace(media::VideoCodec::kCodecH264, kAllProfiles);
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
// Add the supported encryption schemes as if they came from the
@@ -361,7 +363,7 @@ void ContentClientQt::AddAdditionalSchemes(Schemes* schemes)
#endif
}
-base::StringPiece ContentClientQt::GetDataResource(int resource_id, ui::ScaleFactor scale_factor)
+base::StringPiece ContentClientQt::GetDataResource(int resource_id, ui::ResourceScaleFactor scale_factor)
{
return ui::ResourceBundle::GetSharedInstance().GetRawDataResourceForScale(resource_id, scale_factor);
}
diff --git a/src/core/content_client_qt.h b/src/core/content_client_qt.h
index e32a291dd..d44563f41 100644
--- a/src/core/content_client_qt.h
+++ b/src/core/content_client_qt.h
@@ -56,7 +56,7 @@ public:
std::vector<media::CdmHostFilePath> *cdm_host_file_paths) override;
void AddAdditionalSchemes(Schemes* schemes) override;
- base::StringPiece GetDataResource(int, ui::ScaleFactor) override;
+ base::StringPiece GetDataResource(int, ui::ResourceScaleFactor) override;
base::RefCountedMemory* GetDataResourceBytes(int resource_id) override;
gfx::Image &GetNativeImageNamed(int resource_id) override;
std::u16string GetLocalizedString(int message_id) override;
diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp
index dd7d7e3a9..0c04fb071 100644
--- a/src/core/content_main_delegate_qt.cpp
+++ b/src/core/content_main_delegate_qt.cpp
@@ -83,6 +83,7 @@
#endif
#if defined(OS_MAC)
+#include "base/trace_event/trace_event.h"
#include "content/public/common/content_features.h"
#include "media/gpu/mac/vt_video_decode_accelerator_mac.h"
#endif
diff --git a/src/core/delegated_frame_host_client_qt.cpp b/src/core/delegated_frame_host_client_qt.cpp
index e10ff9dd3..2d3966bd5 100644
--- a/src/core/delegated_frame_host_client_qt.cpp
+++ b/src/core/delegated_frame_host_client_qt.cpp
@@ -65,7 +65,9 @@ void DelegatedFrameHostClientQt::OnFrameTokenChanged(uint32_t frame_token, base:
float DelegatedFrameHostClientQt::GetDeviceScaleFactor() const
{
- return p->m_screenInfo.device_scale_factor;
+ display::ScreenInfo screen_info;
+ p->GetScreenInfo(&screen_info);
+ return screen_info.device_scale_factor;
}
void DelegatedFrameHostClientQt::InvalidateLocalSurfaceIdOnEviction()
diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp
index 19f03f8c9..968302bec 100644
--- a/src/core/devtools_frontend_qt.cpp
+++ b/src/core/devtools_frontend_qt.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
@@ -391,28 +391,30 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message)
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;
+ base::Value::ListView params;
+ if (params_value)
+ params = params_value->GetList();
- if (method == "dispatchProtocolMessage" && params && params->GetSize() == 1) {
- std::string protocol_message;
- if (!params->GetString(0, &protocol_message))
+ if (method == "dispatchProtocolMessage" && params.size() == 1) {
+ const std::string *protocol_message = params[0].GetIfString();
+ if (!protocol_message)
return;
if (m_agentHost)
- m_agentHost->DispatchProtocolMessage(this, base::as_bytes(base::make_span(protocol_message)));
+ m_agentHost->DispatchProtocolMessage(this, base::as_bytes(base::make_span(*protocol_message)));
} else if (method == "loadCompleted") {
web_contents()->GetMainFrame()->ExecuteJavaScript(u"DevToolsAPI.setUseSoftMenu(true);",
base::NullCallback());
- } else if (method == "loadNetworkResource" && params->GetSize() == 3) {
+ } else if (method == "loadNetworkResource" && params.size() == 3) {
// TODO(pfeldman): handle some of the embedder messages in content.
- std::string url;
- std::string headers;
- int stream_id;
- if (!params->GetString(0, &url) || !params->GetString(1, &headers) || !params->GetInteger(2, &stream_id))
+ const std::string *url = params[0].GetIfString();
+ const std::string *headers = params[1].GetIfString();
+ absl::optional<int> stream_id = params[2].GetIfInt();
+ if (!url || !headers || !stream_id.has_value()) {
return;
+ }
- GURL gurl(url);
+ GURL gurl(*url);
if (!gurl.is_valid()) {
base::DictionaryValue response;
response.SetInteger("statusCode", 404);
@@ -451,7 +453,7 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message)
// TODO(caseq): this preserves behavior of URLFetcher-based implementation.
// We really need to pass proper first party origin from the front-end.
resource_request->site_for_cookies = net::SiteForCookies::FromUrl(gurl);
- resource_request->headers.AddHeadersFromString(headers);
+ resource_request->headers.AddHeadersFromString(*headers);
mojo::Remote<network::mojom::URLLoaderFactory> file_url_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory> network_url_loader_factory;
@@ -472,7 +474,7 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message)
auto simple_url_loader = network::SimpleURLLoader::Create(
std::move(resource_request), traffic_annotation);
auto resource_loader = std::make_unique<NetworkResourceLoader>(
- stream_id, request_id, this, std::move(simple_url_loader),
+ *stream_id, request_id, this, std::move(simple_url_loader),
url_loader_factory);
m_loaders.insert(std::move(resource_loader));
return;
@@ -484,17 +486,17 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message)
m_preferences = std::move(*m_prefStore->GetValues());
SendMessageAck(request_id, &m_preferences);
return;
- } else if (method == "setPreference") {
- std::string name;
- std::string value;
- if (!params->GetString(0, &name) || !params->GetString(1, &value))
+ } else if (method == "setPreference" && params.size() >= 2) {
+ const std::string *name = params[0].GetIfString();
+ const std::string *value = params[1].GetIfString();
+ if (!name || !value)
return;
- SetPreference(name, value);
- } else if (method == "removePreference") {
- std::string name;
- if (!params->GetString(0, &name))
+ SetPreference(*name, *value);
+ } else if (method == "removePreference" && params.size() >= 1) {
+ const std::string *name = params[0].GetIfString();
+ if (!name)
return;
- RemovePreference(name);
+ RemovePreference(*name);
} else if (method == "clearPreferences") {
ClearPreferences();
} else if (method == "requestFileSystems") {
@@ -505,27 +507,27 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message)
return;
m_agentHost->DetachClient(this);
m_agentHost->AttachClient(this);
- } else if (method == "inspectedURLChanged" && params && params->GetSize() >= 1) {
- std::string url;
- if (!params->GetString(0, &url))
+ } else if (method == "inspectedURLChanged" && params.size() >= 1) {
+ const std::string *url = params[0].GetIfString();
+ if (!url)
return;
const std::string kHttpPrefix = "http://";
const std::string kHttpsPrefix = "https://";
const std::string simplified_url =
- base::StartsWith(url, kHttpsPrefix, base::CompareCase::SENSITIVE)
- ? url.substr(kHttpsPrefix.length())
- : base::StartsWith(url, kHttpPrefix, base::CompareCase::SENSITIVE)
- ? url.substr(kHttpPrefix.length())
- : url;
+ base::StartsWith(*url, kHttpsPrefix, base::CompareCase::SENSITIVE)
+ ? url->substr(kHttpsPrefix.length())
+ : base::StartsWith(*url, kHttpPrefix, base::CompareCase::SENSITIVE)
+ ? url->substr(kHttpPrefix.length())
+ : *url;
// DevTools UI is not localized.
web_contents()->UpdateTitleForEntry(web_contents()->GetController().GetActiveEntry(),
base::UTF8ToUTF16(
base::StringPrintf("DevTools - %s", simplified_url.c_str())));
- } else if (method == "openInNewTab") {
- std::string urlString;
- if (!params->GetString(0, &urlString))
+ } else if (method == "openInNewTab" && params.size() >= 1) {
+ const std::string *urlString = params[0].GetIfString();
+ if (!urlString)
return;
- GURL url(urlString);
+ GURL url(*urlString);
if (!url.is_valid())
return;
content::OpenURLParams openParams(GURL(url),
@@ -547,11 +549,11 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(base::Value message)
Activate();
} else if (method == "closeWindow") {
web_contents()->Close();
- } else if (method == "setEyeDropperActive" && params->GetSize() == 1) {
- bool active;
- if (!params->GetBoolean(0, &active))
+ } else if (method == "setEyeDropperActive" && params.size() == 1) {
+ absl::optional<bool> active = params[0].GetIfBool();
+ if (!active)
return;
- SetEyeDropperActive(active);
+ SetEyeDropperActive(*active);
} else {
VLOG(1) << "Unimplemented devtools method: " << message;
return;
diff --git a/src/core/doc/src/qtwebengine-platform-notes.qdoc b/src/core/doc/src/qtwebengine-platform-notes.qdoc
index c94262950..e131ae1ca 100644
--- a/src/core/doc/src/qtwebengine-platform-notes.qdoc
+++ b/src/core/doc/src/qtwebengine-platform-notes.qdoc
@@ -62,10 +62,10 @@
On all platforms, the following tools are required at build time:
\list
- \li \l Python 2.7.5 or later. Python 3 is not supported.
+ \li \l Python 3.
\li Bison, Flex
\li GPerf
- \li Node.js version 8 or later (version 12 or later is recommended)
+ \li Node.js version 12 or later
\endlist
\section2 Windows
@@ -73,7 +73,7 @@
On Windows, the following additional tools are required:
\list
- \li Visual Studio 2017 version 15.8 or later, or clang-cl version 8 or later
+ \li Visual Studio 2019 or later, or clang-cl version 10 or later
\li Active Template Library (ATL), usually included in the Visual Studio
installation
\li Windows 10 SDK version 10.0.19041 or later
diff --git a/src/core/extensions/component_extension_resource_manager_qt.cpp b/src/core/extensions/component_extension_resource_manager_qt.cpp
index 2b6a24541..0bb6efc97 100644
--- a/src/core/extensions/component_extension_resource_manager_qt.cpp
+++ b/src/core/extensions/component_extension_resource_manager_qt.cpp
@@ -45,6 +45,7 @@
#include "component_extension_resource_manager_qt.h"
#include "base/check.h"
+#include "base/containers/contains.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/stl_util.h"
diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp
index fefc86b36..a01b074c2 100644
--- a/src/core/extensions/extensions_browser_client_qt.cpp
+++ b/src/core/extensions/extensions_browser_client_qt.cpp
@@ -68,6 +68,7 @@
#include "extensions/common/file_util.h"
#include "net/base/mime_util.h"
#include "qtwebengine/browser/extensions/api/generated_api_registration.h"
+#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/zlib/google/compression_utils.h"
@@ -129,12 +130,12 @@ public:
mojo::PendingReceiver<network::mojom::URLLoader> loader,
mojo::PendingRemote<network::mojom::URLLoaderClient> client_info,
const base::FilePath &filename, int resource_id,
- const std::string &content_security_policy, bool send_cors_header)
+ scoped_refptr<net::HttpResponseHeaders> headers)
{
// Owns itself. Will live as long as its URLLoader and URLLoaderClientPtr
// bindings are alive - essentially until either the client gives up or all
// file data has been sent to it.
- auto *bundle_loader = new ResourceBundleFileLoader(content_security_policy, send_cors_header);
+ auto *bundle_loader = new ResourceBundleFileLoader(std::move(headers));
bundle_loader->Start(request, std::move(loader), std::move(client_info), filename, resource_id);
}
@@ -153,9 +154,9 @@ public:
void ResumeReadingBodyFromNet() override {}
private:
- ResourceBundleFileLoader(const std::string &content_security_policy, bool send_cors_header)
+ ResourceBundleFileLoader(scoped_refptr<net::HttpResponseHeaders> headers)
+ : response_headers_(std::move(headers))
{
- response_headers_ = extensions::BuildHttpHeaders(content_security_policy, send_cors_header, base::Time());
}
~ResourceBundleFileLoader() override = default;
@@ -388,12 +389,11 @@ void ExtensionsBrowserClientQt::LoadResourceFromResourceBundle(const network::Re
mojo::PendingReceiver<network::mojom::URLLoader> loader,
const base::FilePath &resource_relative_path,
int resource_id,
- const std::string &content_security_policy,
- mojo::PendingRemote<network::mojom::URLLoaderClient> client,
- bool send_cors_header)
+ scoped_refptr<net::HttpResponseHeaders> headers,
+ mojo::PendingRemote<network::mojom::URLLoaderClient> client)
{
ResourceBundleFileLoader::CreateAndStart(request, std::move(loader), std::move(client), resource_relative_path,
- resource_id, content_security_policy, send_cors_header);
+ resource_id, headers);
}
diff --git a/src/core/extensions/extensions_browser_client_qt.h b/src/core/extensions/extensions_browser_client_qt.h
index 7c00adcad..9b07fa3e9 100644
--- a/src/core/extensions/extensions_browser_client_qt.h
+++ b/src/core/extensions/extensions_browser_client_qt.h
@@ -127,9 +127,8 @@ public:
mojo::PendingReceiver<network::mojom::URLLoader> loader,
const base::FilePath &resource_relative_path,
int resource_id,
- const std::string &content_security_policy,
- mojo::PendingRemote<network::mojom::URLLoaderClient> client,
- bool send_cors_header) override;
+ scoped_refptr<net::HttpResponseHeaders> headers,
+ mojo::PendingRemote<network::mojom::URLLoaderClient> client) override;
// Returns the locale used by the application.
std::string GetApplicationLocale() override;
diff --git a/src/core/favicon_driver_qt.cpp b/src/core/favicon_driver_qt.cpp
index bcba5299b..73c79fc1f 100644
--- a/src/core/favicon_driver_qt.cpp
+++ b/src/core/favicon_driver_qt.cpp
@@ -48,17 +48,19 @@
#include "content/public/browser/favicon_status.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/navigation_handle.h"
-#include "third_party/blink/public/common/manifest/manifest.h"
+#include "content/public/browser/page.h"
+#include "content/public/browser/render_frame_host.h"
+#include "third_party/blink/public/mojom/manifest/manifest.mojom.h"
namespace QtWebEngineCore {
namespace {
void ExtractManifestIcons(FaviconDriverQt::ManifestDownloadCallback callback,
- const GURL &manifest_url, const blink::Manifest &manifest)
+ const GURL &manifest_url, blink::mojom::ManifestPtr manifest)
{
std::vector<favicon::FaviconURL> candidates;
- for (const auto &icon : manifest.icons) {
+ for (const auto &icon : manifest->icons) {
candidates.emplace_back(icon.src, favicon_base::IconType::kWebManifestIcon, icon.sizes);
}
std::move(callback).Run(candidates);
@@ -186,7 +188,7 @@ int FaviconDriverQt::DownloadImage(const GURL &url, int max_image_size,
void FaviconDriverQt::DownloadManifest(const GURL &url, ManifestDownloadCallback callback)
{
- web_contents()->GetManifest(base::BindOnce(&ExtractManifestIcons, std::move(callback)));
+ web_contents()->GetMainFrame()->GetPage().GetManifest(base::BindOnce(&ExtractManifestIcons, std::move(callback)));
}
bool FaviconDriverQt::IsOffTheRecord()
@@ -270,7 +272,7 @@ void FaviconDriverQt::DidUpdateFaviconURL(
}
void FaviconDriverQt::DidUpdateWebManifestURL(content::RenderFrameHost *target_frame,
- const absl::optional<GURL> &manifest_url)
+ const GURL &manifest_url)
{
Q_UNUSED(target_frame);
@@ -280,7 +282,7 @@ void FaviconDriverQt::DidUpdateWebManifestURL(content::RenderFrameHost *target_f
if (!entry || !m_documentOnLoadCompleted)
return;
- m_manifestUrl = manifest_url.value_or(GURL());
+ m_manifestUrl = manifest_url;
// On regular page loads, DidUpdateManifestURL() is guaranteed to be called
// before DidUpdateFaviconURL(). However, a page can update the favicons via
diff --git a/src/core/favicon_driver_qt.h b/src/core/favicon_driver_qt.h
index 03ebd6536..4de85104a 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 absl::optional<GURL> &manifest_url) override;
+ const 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;
diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp
index c9256f8ac..c976798ae 100644
--- a/src/core/media_capture_devices_dispatcher.cpp
+++ b/src/core/media_capture_devices_dispatcher.cpp
@@ -290,9 +290,9 @@ private:
} // namespace
MediaCaptureDevicesDispatcher::PendingAccessRequest::PendingAccessRequest(const content::MediaStreamRequest &request,
- const RepeatingMediaResponseCallback &callback)
+ content::MediaResponseCallback callback)
: request(request)
- , callback(callback)
+ , callback(std::move(callback))
{
}
@@ -310,7 +310,7 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content:
return;
RequestsQueue &queue(it->second);
- content::MediaStreamRequest &request = queue.front().request;
+ content::MediaStreamRequest &request = queue.front()->request;
const QUrl requestSecurityOrigin(toQt(request.security_origin));
bool securityOriginsMatch = (requestSecurityOrigin.host() == securityOrigin.host()
@@ -347,7 +347,7 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content:
}
}
- content::MediaResponseCallback callback = std::move(queue.front().callback);
+ content::MediaResponseCallback callback = std::move(queue.front()->callback);
queue.pop_front();
if (!queue.empty()) {
@@ -475,7 +475,7 @@ void MediaCaptureDevicesDispatcher::enqueueMediaAccessRequest(content::WebConten
DCHECK_CURRENTLY_ON(BrowserThread::UI);
RequestsQueue &queue = m_pendingRequests[webContents];
- queue.push_back(PendingAccessRequest(request, base::AdaptCallbackForRepeating(std::move(callback))));
+ queue.push_back(std::make_unique<PendingAccessRequest>(request, std::move(callback)));
}
void MediaCaptureDevicesDispatcher::ProcessQueuedAccessRequest(content::WebContents *webContents)
@@ -487,7 +487,7 @@ void MediaCaptureDevicesDispatcher::ProcessQueuedAccessRequest(content::WebConte
return;
RequestsQueue &queue(it->second);
- content::MediaStreamRequest &request = queue.front().request;
+ content::MediaStreamRequest &request = queue.front()->request;
WebContentsAdapterClient *adapterClient = WebContentsViewQt::from(static_cast<content::WebContentsImpl *>(webContents)->GetView())->client();
adapterClient->runMediaAccessPermissionRequest(toQt(request.security_origin), mediaRequestFlagsForRequest(request));
@@ -541,9 +541,9 @@ void MediaCaptureDevicesDispatcher::updateMediaRequestStateOnUIThread(int render
for (auto &pair : m_pendingRequests) {
RequestsQueue &queue = pair.second;
for (auto it = queue.begin(); it != queue.end(); ++it) {
- if (it->request.render_process_id == render_process_id
- && it->request.render_frame_id == render_frame_id
- && it->request.page_request_id == page_request_id) {
+ if ((*it)->request.render_process_id == render_process_id
+ && (*it)->request.render_frame_id == render_frame_id
+ && (*it)->request.page_request_id == page_request_id) {
queue.erase(it);
return;
}
diff --git a/src/core/media_capture_devices_dispatcher.h b/src/core/media_capture_devices_dispatcher.h
index d2633cb83..91ddc30a8 100644
--- a/src/core/media_capture_devices_dispatcher.h
+++ b/src/core/media_capture_devices_dispatcher.h
@@ -41,14 +41,11 @@
#ifndef MEDIA_CAPTURE_DEVICES_DISPATCHER_H
#define MEDIA_CAPTURE_DEVICES_DISPATCHER_H
-#include <deque>
-#include <list>
-#include <map>
-
#include "web_contents_adapter_client.h"
#include "base/callback.h"
#include "base/containers/circular_deque.h"
+#include "base/containers/flat_map.h"
#include "base/memory/singleton.h"
#include "base/observer_list.h"
#include "chrome/browser/tab_contents/web_contents_collection.h"
@@ -92,20 +89,15 @@ private:
friend struct base::DefaultSingletonTraits<MediaCaptureDevicesDispatcher>;
- typedef base::RepeatingCallback<void(const blink::MediaStreamDevices &devices,
- blink::mojom::MediaStreamRequestResult result,
- std::unique_ptr<content::MediaStreamUI> ui)>
- RepeatingMediaResponseCallback;
-
struct PendingAccessRequest {
- PendingAccessRequest(const content::MediaStreamRequest &request, const RepeatingMediaResponseCallback &callback);
+ PendingAccessRequest(const content::MediaStreamRequest &request, content::MediaResponseCallback callback);
~PendingAccessRequest();
content::MediaStreamRequest request;
- RepeatingMediaResponseCallback callback;
+ content::MediaResponseCallback callback;
};
- typedef base::circular_deque<PendingAccessRequest> RequestsQueue;
- typedef std::map<content::WebContents *, RequestsQueue> RequestsQueues;
+ typedef base::circular_deque<std::unique_ptr<PendingAccessRequest>> RequestsQueue;
+ typedef base::flat_map<content::WebContents *, RequestsQueue> RequestsQueues;
MediaCaptureDevicesDispatcher();
virtual ~MediaCaptureDevicesDispatcher();
diff --git a/src/core/net/client_cert_store_data.cpp b/src/core/net/client_cert_store_data.cpp
index 314e64145..1a957e691 100644
--- a/src/core/net/client_cert_store_data.cpp
+++ b/src/core/net/client_cert_store_data.cpp
@@ -138,7 +138,7 @@ void ClientCertificateStoreData::add(const QSslCertificate &certificate, const Q
Entry *data = new Entry;
data->keyPtr = wrapOpenSSLPrivateKey(sslKeyInBytes);
- data->certPtr = net::X509Certificate::CreateFromBytes(certInBytes.data(), certInBytes.length());
+ data->certPtr = net::X509Certificate::CreateFromBytes(base::make_span((const unsigned char *)certInBytes.data(), certInBytes.length()));
data->key = privateKey;
data->certificate = certificate;
extraCerts.append(data);
diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp
index c3cfa000a..274326395 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(), absl::nullopt, &inclusion);
+ auto canonCookie = net::CanonicalCookie::Create(gurl, cookie_line, base::Time::Now(), absl::nullopt, 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 36b24d4b7..283576cac 100644
--- a/src/core/net/custom_url_loader_factory.cpp
+++ b/src/core/net/custom_url_loader_factory.cpp
@@ -51,6 +51,7 @@
#include "net/http/http_status_code.h"
#include "net/http/http_util.h"
#include "services/network/public/cpp/cors/cors.h"
+#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp
index 1620b665b..be2a6814b 100644
--- a/src/core/net/proxying_url_loader_factory_qt.cpp
+++ b/src/core/net/proxying_url_loader_factory_qt.cpp
@@ -50,6 +50,7 @@
#include "content/public/common/content_switches.h"
#include "net/http/http_status_code.h"
#include "services/network/public/cpp/cors/cors.h"
+#include "services/network/public/mojom/early_hints.mojom.h"
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-shared.h"
#include "url/url_util.h"
diff --git a/src/core/net/ssl_host_state_delegate_qt.cpp b/src/core/net/ssl_host_state_delegate_qt.cpp
index 3390c092a..ba2f46342 100644
--- a/src/core/net/ssl_host_state_delegate_qt.cpp
+++ b/src/core/net/ssl_host_state_delegate_qt.cpp
@@ -121,6 +121,16 @@ bool SSLHostStateDelegateQt::DidHostRunInsecureContent(const std::string &host,
return false;
}
+void SSLHostStateDelegateQt::AllowHttpForHost(const std::string &host, content::WebContents *web_contents)
+{
+ // Intentional no-op see aw_ssl_host_state_delegate
+}
+
+bool SSLHostStateDelegateQt::IsHttpAllowedForHost(const std::string &host, content::WebContents *web_contents)
+{
+ return false;
+}
+
// Revokes all SSL certificate error allow exceptions made by the user for
// |host|.
void SSLHostStateDelegateQt::RevokeUserAllowExceptions(const std::string &host)
diff --git a/src/core/net/ssl_host_state_delegate_qt.h b/src/core/net/ssl_host_state_delegate_qt.h
index 6b407353a..96eac63e7 100644
--- a/src/core/net/ssl_host_state_delegate_qt.h
+++ b/src/core/net/ssl_host_state_delegate_qt.h
@@ -71,6 +71,8 @@ public:
CertJudgment QueryPolicy(const std::string &host, const net::X509Certificate &cert, int error, content::WebContents *web_contents) override;
void HostRanInsecureContent(const std::string &host, int child_id, InsecureContentType content_type) override;
bool DidHostRunInsecureContent(const std::string &host, int child_id, InsecureContentType content_type) override;
+ void AllowHttpForHost(const std::string &host, content::WebContents *web_contents) override;
+ bool IsHttpAllowedForHost(const std::string &host, content::WebContents *web_contents) override;
void RevokeUserAllowExceptions(const std::string &host) override;
bool HasAllowException(const std::string &host, content::WebContents *web_contents) override;
diff --git a/src/core/net/system_network_context_manager.cpp b/src/core/net/system_network_context_manager.cpp
index 33d95300b..962266d78 100644
--- a/src/core/net/system_network_context_manager.cpp
+++ b/src/core/net/system_network_context_manager.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2019 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWebEngine module of the Qt Toolkit.
@@ -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 "crypto/sha2.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "net/base/port_util.h"
#include "net/net_buildflags.h"
@@ -222,6 +223,29 @@ void SystemNetworkContextManager::OnNetworkServiceCreated(network::mojom::Networ
network_service->SetUpHttpAuth(CreateHttpAuthStaticParams());
network_service->ConfigureHttpAuthPrefs(CreateHttpAuthDynamicParams());
+ // Configure the Certificate Transparency logs.
+ std::vector<std::pair<std::string, base::TimeDelta>> disqualified_logs =
+ certificate_transparency::GetDisqualifiedLogs();
+ std::vector<network::mojom::CTLogInfoPtr> log_list_mojo;
+ for (const auto &ct_log : certificate_transparency::GetKnownLogs()) {
+ network::mojom::CTLogInfoPtr log_info = network::mojom::CTLogInfo::New();
+ log_info->public_key = std::string(ct_log.log_key, ct_log.log_key_length);
+ log_info->name = ct_log.log_name;
+
+ std::string log_id = crypto::SHA256HashString(log_info->public_key);
+ auto it = std::lower_bound(
+ std::begin(disqualified_logs), std::end(disqualified_logs), log_id,
+ [](const auto& disqualified_log, const std::string& log_id) {
+ return disqualified_log.first < log_id;
+ });
+ if (it != std::end(disqualified_logs) && it->first == log_id)
+ log_info->disqualified_at = it->second;
+ log_list_mojo.push_back(std::move(log_info));
+ }
+ network_service->UpdateCtLogList(
+ std::move(log_list_mojo),
+ certificate_transparency::GetLogListTimestamp());
+
// The system NetworkContext is created first
network_service_network_context_.reset();
network_service->CreateNetworkContext(
@@ -275,16 +299,6 @@ void SystemNetworkContextManager::ConfigureDefaultNetworkContextParams(network::
// BrowserProcess itself, so will only be destroyed on shutdown, at which
// point, all NetworkContexts will be destroyed as well.
AddSSLConfigToNetworkContextParams(network_context_params);
-
- // CT is only enabled on Desktop platforms for now.
- network_context_params->enforce_chrome_ct_policy = true;
- for (const auto &ct_log : certificate_transparency::GetKnownLogs()) {
- // TODO(rsleevi): https://crbug.com/702062 - Remove this duplication.
- network::mojom::CTLogInfoPtr log_info = network::mojom::CTLogInfo::New();
- log_info->public_key = std::string(ct_log.log_key, ct_log.log_key_length);
- log_info->name = ct_log.log_name;
- network_context_params->ct_logs.push_back(std::move(log_info));
- }
}
network::mojom::NetworkContextParamsPtr SystemNetworkContextManager::CreateNetworkContextParams()
diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp
index 8c8ae98a7..f7d162923 100644
--- a/src/core/ozone/gl_surface_egl_qt.cpp
+++ b/src/core/ozone/gl_surface_egl_qt.cpp
@@ -60,71 +60,6 @@ using ui::GetLastEGLErrorString;
namespace gl {
-bool GLSurfaceEGLQt::g_egl_surfaceless_context_supported = false;
-bool GLSurfaceEGLQt::s_initialized = false;
-
-GLSurfaceEGLQt::~GLSurfaceEGLQt()
-{
- Destroy();
-}
-
-bool GLSurfaceEGLQt::InitializeOneOff()
-{
- if (s_initialized)
- return true;
-
- // Must be called before initializing the display.
- g_driver_egl.InitializeClientExtensionBindings();
-
- g_display = GLContextHelper::getEGLDisplay();
- if (!g_display) {
- LOG(ERROR) << "GLContextHelper::getEGLDisplay() failed.";
- return false;
- }
-
- g_config = GLContextHelper::getEGLConfig();
- if (!g_config) {
- LOG(ERROR) << "GLContextHelper::getEGLConfig() failed.";
- return false;
- }
-
- if (!eglInitialize(g_display, NULL, NULL)) {
- LOG(ERROR) << "eglInitialize failed with error " << GetLastEGLErrorString();
- return false;
- }
-
- g_client_extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
- g_extensions = eglQueryString(g_display, EGL_EXTENSIONS);
- g_egl_surfaceless_context_supported = ExtensionsContain(g_extensions, "EGL_KHR_surfaceless_context");
- if (g_egl_surfaceless_context_supported) {
- scoped_refptr<GLSurface> surface = new GLSurfacelessQtEGL(gfx::Size(1, 1));
- gl::GLContextAttribs attribs;
- scoped_refptr<GLContext> context = init::CreateGLContext(
- NULL, surface.get(), attribs);
-
- if (!context->MakeCurrent(surface.get()))
- g_egl_surfaceless_context_supported = false;
-
- // Ensure context supports GL_OES_surfaceless_context.
- if (g_egl_surfaceless_context_supported) {
- g_egl_surfaceless_context_supported = context->HasExtension(
- "GL_OES_surfaceless_context");
- context->ReleaseCurrent(surface.get());
- }
- }
-
- // Must be called after initializing the display.
- g_driver_egl.InitializeExtensionBindings();
-
- s_initialized = true;
- return true;
-}
-
-bool GLSurfaceEGLQt::InitializeExtensionSettingsOneOff()
-{
- return s_initialized;
-}
-
bool GLSurfaceEGL::InitializeExtensionSettingsOneOff()
{
return GLSurfaceEGLQt::InitializeExtensionSettingsOneOff();
@@ -242,12 +177,82 @@ DisplayType GLSurfaceEGL::GetDisplayType()
return DisplayType::DEFAULT;
}
+GLSurface *GLSurfaceEGL::createSurfaceless(const gfx::Size& size)
+{
+ return new GLSurfacelessQtEGL(size);
+}
+
+bool GLSurfaceEGLQt::g_egl_surfaceless_context_supported = false;
+bool GLSurfaceEGLQt::s_initialized = false;
+
GLSurfaceEGLQt::GLSurfaceEGLQt(const gfx::Size& size)
: GLSurfaceQt(size),
m_surfaceBuffer(0)
{
}
+GLSurfaceEGLQt::~GLSurfaceEGLQt()
+{
+ Destroy();
+}
+
+bool GLSurfaceEGLQt::InitializeOneOff()
+{
+ if (s_initialized)
+ return true;
+
+ // Must be called before initializing the display.
+ g_driver_egl.InitializeClientExtensionBindings();
+
+ g_display = GLContextHelper::getEGLDisplay();
+ if (!g_display) {
+ LOG(ERROR) << "GLContextHelper::getEGLDisplay() failed.";
+ return false;
+ }
+
+ g_config = GLContextHelper::getEGLConfig();
+ if (!g_config) {
+ LOG(ERROR) << "GLContextHelper::getEGLConfig() failed.";
+ return false;
+ }
+
+ if (!eglInitialize(g_display, NULL, NULL)) {
+ LOG(ERROR) << "eglInitialize failed with error " << GetLastEGLErrorString();
+ return false;
+ }
+
+ g_client_extensions = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
+ g_extensions = eglQueryString(g_display, EGL_EXTENSIONS);
+ g_egl_surfaceless_context_supported = ExtensionsContain(g_extensions, "EGL_KHR_surfaceless_context");
+ if (g_egl_surfaceless_context_supported) {
+ scoped_refptr<GLSurface> surface = new GLSurfacelessQtEGL(gfx::Size(1, 1));
+ gl::GLContextAttribs attribs;
+ scoped_refptr<GLContext> context = init::CreateGLContext(
+ NULL, surface.get(), attribs);
+
+ if (!context->MakeCurrent(surface.get()))
+ g_egl_surfaceless_context_supported = false;
+
+ // Ensure context supports GL_OES_surfaceless_context.
+ if (g_egl_surfaceless_context_supported) {
+ g_egl_surfaceless_context_supported = context->HasExtension(
+ "GL_OES_surfaceless_context");
+ context->ReleaseCurrent(surface.get());
+ }
+ }
+
+ // Must be called after initializing the display.
+ g_driver_egl.InitializeExtensionBindings();
+
+ s_initialized = true;
+ return true;
+}
+
+bool GLSurfaceEGLQt::InitializeExtensionSettingsOneOff()
+{
+ return s_initialized;
+}
+
bool GLSurfaceEGLQt::Initialize(GLSurfaceFormat format)
{
Q_ASSERT(!m_surfaceBuffer);
diff --git a/src/core/ozone/ozone_platform_qt.cpp b/src/core/ozone/ozone_platform_qt.cpp
index 33d7bd992..0affec0d3 100644
--- a/src/core/ozone/ozone_platform_qt.cpp
+++ b/src/core/ozone/ozone_platform_qt.cpp
@@ -92,6 +92,8 @@ private:
void InitializeUI(const ui::OzonePlatform::InitParams &) override;
void InitializeGPU(const ui::OzonePlatform::InitParams &) override;
+ void InitScreen(ui::PlatformScreen *) override {}
+
std::unique_ptr<QtWebEngineCore::SurfaceFactoryQt> surface_factory_ozone_;
std::unique_ptr<CursorFactory> cursor_factory_ozone_;
@@ -213,11 +215,6 @@ static std::string getCurrentKeyboardLayout()
void OzonePlatformQt::InitializeUI(const ui::OzonePlatform::InitParams &)
{
- overlay_manager_.reset(new StubOverlayManager());
- cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone());
- gpu_platform_support_host_.reset(ui::CreateStubGpuPlatformSupportHost());
- input_controller_ = CreateStubInputController();
-
#if BUILDFLAG(USE_XKBCOMMON)
std::string layout = getCurrentKeyboardLayout();
if (layout.empty()) {
@@ -231,6 +228,11 @@ void OzonePlatformQt::InitializeUI(const ui::OzonePlatform::InitParams &)
#endif // BUILDFLAG(USE_XKBCOMMON)
KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(m_keyboardLayoutEngine.get());
+
+ overlay_manager_.reset(new StubOverlayManager());
+ input_controller_ = CreateStubInputController();
+ cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone());
+ gpu_platform_support_host_.reset(ui::CreateStubGpuPlatformSupportHost());
}
void OzonePlatformQt::InitializeGPU(const ui::OzonePlatform::InitParams &)
diff --git a/src/core/ozone/platform_window_qt.cpp b/src/core/ozone/platform_window_qt.cpp
index 74b95d9a2..e8ac4d025 100644
--- a/src/core/ozone/platform_window_qt.cpp
+++ b/src/core/ozone/platform_window_qt.cpp
@@ -41,6 +41,7 @@
#include "base/bind.h"
#include "ozone/platform_window_qt.h"
+#include "ui/base/cursor/platform_cursor.h"
#include "ui/events/ozone/events_ozone.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/platform_window/platform_window_delegate.h"
@@ -64,6 +65,11 @@ gfx::Rect PlatformWindowQt::GetBounds() const
return bounds_;
}
+void PlatformWindowQt::Close()
+{
+ delegate_->OnClosed();
+}
+
void PlatformWindowQt::SetBounds(const gfx::Rect& bounds)
{
if (bounds == bounds_)
diff --git a/src/core/ozone/platform_window_qt.h b/src/core/ozone/platform_window_qt.h
index 2e5d189aa..6a0984da8 100644
--- a/src/core/ozone/platform_window_qt.h
+++ b/src/core/ozone/platform_window_qt.h
@@ -60,7 +60,7 @@ public:
void SetBounds(const gfx::Rect& bounds) override;
void Show(bool inactive = false) override { }
void Hide() override { }
- void Close() override { }
+ void Close() override;
bool IsVisible() const override { return true; }
void SetTitle(const std::u16string&) override { }
void SetCapture() override { }
diff --git a/src/core/ozone/surface_factory_qt.cpp b/src/core/ozone/surface_factory_qt.cpp
index e2ffabe0e..719c8174a 100644
--- a/src/core/ozone/surface_factory_qt.cpp
+++ b/src/core/ozone/surface_factory_qt.cpp
@@ -52,19 +52,20 @@ SurfaceFactoryQt::SurfaceFactoryQt()
{
#if defined(USE_GLX)
if (GLContextHelper::getGlxPlatformInterface()) {
- m_impl = { gl::kGLImplementationDesktopGL };
+ m_impl = { gl::GLImplementationParts(gl::kGLImplementationDesktopGL) };
m_ozone.reset(new ui::GLOzoneGLXQt());
} else
#endif
if (GLContextHelper::getEglPlatformInterface()) {
- m_impl = { gl::kGLImplementationDesktopGL, gl::kGLImplementationEGLGLES2 };
+ m_impl = { gl::GLImplementationParts(gl::kGLImplementationDesktopGL),
+ gl::GLImplementationParts(gl::kGLImplementationEGLGLES2) };
m_ozone.reset(new ui::GLOzoneEGLQt());
} else {
qFatal("No suitable graphics backend found\n");
}
}
-std::vector<gl::GLImplementation> SurfaceFactoryQt::GetAllowedGLImplementations()
+std::vector<gl::GLImplementationParts> SurfaceFactoryQt::GetAllowedGLImplementations()
{
return m_impl;
}
diff --git a/src/core/ozone/surface_factory_qt.h b/src/core/ozone/surface_factory_qt.h
index fa8331a78..da208f8e6 100644
--- a/src/core/ozone/surface_factory_qt.h
+++ b/src/core/ozone/surface_factory_qt.h
@@ -50,10 +50,10 @@ class SurfaceFactoryQt : public ui::SurfaceFactoryOzone
{
public:
SurfaceFactoryQt();
- std::vector<gl::GLImplementation> GetAllowedGLImplementations() override;
+ std::vector<gl::GLImplementationParts> GetAllowedGLImplementations() override;
ui::GLOzone *GetGLOzone(const gl::GLImplementationParts &implementation) override;
private:
- std::vector<gl::GLImplementation> m_impl;
+ std::vector<gl::GLImplementationParts> m_impl;
std::unique_ptr<ui::GLOzone> m_ozone;
};
diff --git a/src/core/pref_service_adapter.cpp b/src/core/pref_service_adapter.cpp
index 2f3b02e5b..59bf2224e 100644
--- a/src/core/pref_service_adapter.cpp
+++ b/src/core/pref_service_adapter.cpp
@@ -101,7 +101,6 @@ void PrefServiceAdapter::setup(const ProfileAdapter &profileAdapter)
registry->RegisterStringPref(language::prefs::kAcceptLanguages, std::string());
registry->RegisterListPref(spellcheck::prefs::kSpellCheckDictionaries);
registry->RegisterListPref(spellcheck::prefs::kSpellCheckForcedDictionaries);
- registry->RegisterListPref(spellcheck::prefs::kSpellCheckBlacklistedDictionaries);
registry->RegisterListPref(spellcheck::prefs::kSpellCheckBlocklistedDictionaries);
registry->RegisterStringPref(spellcheck::prefs::kSpellCheckDictionary, std::string());
registry->RegisterBooleanPref(spellcheck::prefs::kSpellCheckEnable, false);
diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp
index 19c44549d..a170c95ba 100644
--- a/src/core/printing/print_view_manager_base_qt.cpp
+++ b/src/core/printing/print_view_manager_base_qt.cpp
@@ -391,11 +391,6 @@ void PrintViewManagerBaseQt::PrintingFailed(int32_t cookie)
PrintManager::PrintingFailed(cookie);
ReleasePrinterQuery();
-
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_PRINT_JOB_RELEASED,
- content::Source<content::WebContents>(web_contents()),
- content::NotificationService::NoDetails());
}
void PrintViewManagerBaseQt::ScriptedPrint(printing::mojom::ScriptedPrintParamsPtr params,
@@ -462,23 +457,12 @@ void PrintViewManagerBaseQt::OnNotifyPrintJobEvent(const printing::JobEventDetai
switch (event_details.type()) {
case printing::JobEventDetails::FAILED: {
TerminatePrintJob(true);
-
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_PRINT_JOB_RELEASED,
- content::Source<content::WebContents>(web_contents()),
- content::NotificationService::NoDetails());
- break;
- }
- case printing::JobEventDetails::USER_INIT_DONE:
- case printing::JobEventDetails::DEFAULT_INIT_DONE:
- case printing::JobEventDetails::USER_INIT_CANCELED: {
- NOTREACHED();
- break;
- }
- case printing::JobEventDetails::ALL_PAGES_REQUESTED: {
- ShouldQuitFromInnerMessageLoop();
break;
}
+// case printing::JobEventDetails::ALL_PAGES_REQUESTED: {
+// ShouldQuitFromInnerMessageLoop();
+// break;
+// }
case printing::JobEventDetails::NEW_DOC:
#if defined(OS_WIN)
case printing::JobEventDetails::PAGE_DONE:
@@ -493,11 +477,6 @@ void PrintViewManagerBaseQt::OnNotifyPrintJobEvent(const printing::JobEventDetai
// of object registration.
m_didPrintingSucceed = true;
ReleasePrintJob();
-
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_PRINT_JOB_RELEASED,
- content::Source<content::WebContents>(web_contents()),
- content::NotificationService::NoDetails());
break;
}
default:
@@ -532,11 +511,9 @@ bool PrintViewManagerBaseQt::RenderAllMissingPagesNow()
// pages in an hurry if a print_job_ is still pending. No need to wait for it
// to actually spool the pages, only to have the renderer generate them. Run
// a message loop until we get our signal that the print job is satisfied.
- // PrintJob will send a ALL_PAGES_REQUESTED after having received all the
- // pages it needs. MessageLoop::current()->Quit() will be called as soon as
- // print_job_->document()->IsComplete() is true on either ALL_PAGES_REQUESTED
- // or in DidPrintPage(). The check is done in
- // ShouldQuitFromInnerMessageLoop().
+ // |quit_inner_loop_| will be called as soon as
+ // print_job_->document()->IsComplete() is true in DidPrintDocument(). The
+ // check is done in ShouldQuitFromInnerMessageLoop().
// BLOCKS until all the pages are received. (Need to enable recursive task)
if (!RunInnerMessageLoop()) {
// This function is always called from DisconnectFromCurrentPrintJob() so we
diff --git a/src/core/printing/print_view_manager_base_qt.h b/src/core/printing/print_view_manager_base_qt.h
index e6624e5cd..96c2d441c 100644
--- a/src/core/printing/print_view_manager_base_qt.h
+++ b/src/core/printing/print_view_manager_base_qt.h
@@ -143,9 +143,8 @@ private:
// Quits the current message loop if these conditions hold true: a document is
// loaded and is complete and waiting_for_pages_to_be_rendered_ is true. This
- // function is called in DidPrintDocument() or on ALL_PAGES_REQUESTED
- // notification. The inner message loop is created was created by
- // RenderAllMissingPagesNow().
+ // function is called in DidPrintDocument(). The inner message loop was
+ // created by RenderAllMissingPagesNow().
void ShouldQuitFromInnerMessageLoop();
// Terminates the print job. No-op if no print job has been created. If
diff --git a/src/core/printing/print_view_manager_qt.cpp b/src/core/printing/print_view_manager_qt.cpp
index f7e038f3e..90b320eb6 100644
--- a/src/core/printing/print_view_manager_qt.cpp
+++ b/src/core/printing/print_view_manager_qt.cpp
@@ -66,6 +66,7 @@
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h"
#include "printing/metafile_skia.h"
+#include "printing/mojom/print.mojom-shared.h"
#include "printing/print_job_constants.h"
#include "printing/units.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
@@ -123,7 +124,7 @@ static base::DictionaryValue *createPrintSettings()
printSettings->SetInteger(printing::kPreviewRequestID, internalRequestId);
// The following are standard settings that Chromium expects to be set.
- printSettings->SetInteger(printing::kSettingPrinterType, static_cast<int>(printing::PrinterType::kPdf));
+ printSettings->SetInteger(printing::kSettingPrinterType, static_cast<int>(printing::mojom::PrinterType::kPdf));
printSettings->SetInteger(printing::kSettingDpiHorizontal, printing::kPointsPerInch);
printSettings->SetInteger(printing::kSettingDpiVertical, printing::kPointsPerInch);
@@ -290,6 +291,19 @@ PrintViewManagerQt::PrintViewManagerQt(content::WebContents *contents)
}
+// static
+void PrintViewManagerQt::BindPrintManagerHost(mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> receiver,
+ content::RenderFrameHost *rfh)
+{
+ auto *web_contents = content::WebContents::FromRenderFrameHost(rfh);
+ if (!web_contents)
+ return;
+ auto *print_manager = PrintViewManagerQt::FromWebContents(web_contents);
+ if (!print_manager)
+ return;
+ print_manager->BindReceiver(std::move(receiver), rfh);
+}
+
void PrintViewManagerQt::resetPdfState()
{
m_pdfOutputPath.clear();
diff --git a/src/core/printing/print_view_manager_qt.h b/src/core/printing/print_view_manager_qt.h
index 7c7602e52..bc55c57fe 100644
--- a/src/core/printing/print_view_manager_qt.h
+++ b/src/core/printing/print_view_manager_qt.h
@@ -69,6 +69,10 @@ class PrintViewManagerQt
{
public:
~PrintViewManagerQt() override;
+
+ static void BindPrintManagerHost(mojo::PendingAssociatedReceiver<printing::mojom::PrintManagerHost> receiver,
+ content::RenderFrameHost *rfh);
+
typedef base::OnceCallback<void(QSharedPointer<QByteArray> result)> PrintToPDFCallback;
typedef base::OnceCallback<void(bool success)> PrintToPDFFileCallback;
diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp
index 14bc634c0..6e902ff5a 100644
--- a/src/core/profile_adapter.cpp
+++ b/src/core/profile_adapter.cpp
@@ -51,6 +51,7 @@
#include "content/public/browser/shared_cors_origin_access_list.h"
#include "content/public/browser/storage_partition.h"
#include "services/network/public/cpp/cors/origin_access_list.h"
+#include "services/network/public/mojom/network_context.mojom.h"
#include "url/url_util.h"
#include "api/qwebengineurlscheme.h"
diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp
index a7e86a154..24917fa81 100644
--- a/src/core/profile_io_data_qt.cpp
+++ b/src/core/profile_io_data_qt.cpp
@@ -259,7 +259,7 @@ void ProfileIODataQt::ConfigureNetworkContextParams(bool in_memory,
}
if (!m_inMemoryOnly && !in_memory) {
network_context_params->http_server_properties_path = toFilePath(m_dataPath).AppendASCII("Network Persistent State");
- network_context_params->transport_security_persister_path = toFilePath(m_dataPath);
+ network_context_params->transport_security_persister_file_path = toFilePath(m_dataPath).AppendASCII("TransportSecurity");
}
network_context_params->enforce_chrome_ct_policy = false;
diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp
index 791e9d75e..f2de01d6d 100644
--- a/src/core/render_widget_host_view_qt.cpp
+++ b/src/core/render_widget_host_view_qt.cpp
@@ -56,7 +56,6 @@
#include "components/viz/common/surfaces/frame_sink_id_allocator.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "content/browser/compositor/image_transport_factory.h"
-#include "content/browser/renderer_host/display_util.h"
#include "content/browser/renderer_host/frame_tree.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/cursor_manager.h"
@@ -71,6 +70,7 @@
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/resource/resource_bundle.h"
+#include "ui/display/display_util.h"
#include "ui/events/blink/blink_event_util.h"
#include "ui/events/event.h"
#include "ui/events/gesture_detection/gesture_configuration.h"
@@ -129,13 +129,13 @@ static inline ui::GestureProvider::Config QtGestureProviderConfig() {
extern display::Display toDisplayDisplay(int id, const QScreen *screen);
-static blink::ScreenInfo screenInfoFromQScreen(QScreen *screen)
+static display::ScreenInfo screenInfoFromQScreen(QScreen *screen)
{
- blink::ScreenInfo r;
+ display::ScreenInfo r;
if (!screen)
screen = qApp->primaryScreen();
if (screen)
- content::DisplayUtil::DisplayToScreenInfo(&r, toDisplayDisplay(0, screen));
+ display::DisplayUtil::DisplayToScreenInfo(&r, toDisplayDisplay(0, screen));
else
r.device_scale_factor = qGuiApp->devicePixelRatio();
return r;
@@ -680,7 +680,7 @@ void RenderWidgetHostViewQt::UpdateTooltip(const std::u16string &tooltip_text)
m_adapterClient->setToolTip(toQt(tooltip_text));
}
-void RenderWidgetHostViewQt::GetScreenInfo(blink::ScreenInfo *results)
+void RenderWidgetHostViewQt::GetScreenInfo(display::ScreenInfo *results)
{
*results = m_screenInfo;
}
@@ -889,7 +889,7 @@ bool RenderWidgetHostViewQt::isPopup() const
bool RenderWidgetHostViewQt::updateScreenInfo()
{
- blink::ScreenInfo oldScreenInfo = m_screenInfo;
+ display::ScreenInfo oldScreenInfo = m_screenInfo;
QScreen *screen = m_delegate->window() ? m_delegate->window()->screen() : nullptr;
m_screenInfo = screenInfoFromQScreen(screen);
diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h
index eeb05951e..d3062ee71 100644
--- a/src/core/render_widget_host_view_qt.h
+++ b/src/core/render_widget_host_view_qt.h
@@ -136,7 +136,7 @@ public:
void OnDidUpdateVisualPropertiesComplete(const cc::RenderFrameMetadata &metadata);
// Overridden from RenderWidgetHostViewBase:
- void GetScreenInfo(blink::ScreenInfo *results) override;
+ void GetScreenInfo(display::ScreenInfo *screen_info) override;
gfx::Rect GetBoundsInRootWindow() override;
void ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch,
blink::mojom::InputEventResultState ack_result) override;
@@ -156,6 +156,12 @@ public:
absl::optional<content::DisplayFeature> GetDisplayFeature() override;
void SetDisplayFeatureForTesting(const content::DisplayFeature*) override;
#if defined(OS_MAC)
+ void ShowSharePicker(
+ const std::string &title,
+ const std::string &text,
+ const std::string &url,
+ const std::vector<std::string> &file_paths,
+ blink::mojom::ShareService::ShareCallback callback) override { QT_NOT_YET_IMPLEMENTED }
void SetActive(bool active) override { QT_NOT_YET_IMPLEMENTED }
void SpeakSelection() override { QT_NOT_YET_IMPLEMENTED }
void ShowDefinitionForSelection() override { QT_NOT_YET_IMPLEMENTED }
@@ -230,7 +236,7 @@ private:
DelegatedFrameHostClientQt m_delegatedFrameHostClient { this };
// VIZ
- blink::ScreenInfo m_screenInfo;
+ display::ScreenInfo m_screenInfo;
std::unique_ptr<content::DelegatedFrameHost> m_delegatedFrameHost;
std::unique_ptr<ui::Layer> m_rootLayer;
std::unique_ptr<ui::Compositor> m_uiCompositor;
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index 84dd1c2a0..474c9e765 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -490,6 +490,32 @@ static void AddExternalClearKey(std::vector<std::unique_ptr<media::KeySystemProp
}
#if BUILDFLAG(ENABLE_WIDEVINE)
+media::SupportedCodecs GetVP9Codecs(const std::vector<media::VideoCodecProfile> &profiles)
+{
+ if (profiles.empty()) {
+ // If no profiles are specified, then all are supported.
+ return media::EME_CODEC_VP9_PROFILE0 | media::EME_CODEC_VP9_PROFILE2;
+ }
+
+ media::SupportedCodecs supported_vp9_codecs = media::EME_CODEC_NONE;
+ for (const auto& profile : profiles) {
+ switch (profile) {
+ case media::VP9PROFILE_PROFILE0:
+ supported_vp9_codecs |= media::EME_CODEC_VP9_PROFILE0;
+ break;
+ case media::VP9PROFILE_PROFILE2:
+ supported_vp9_codecs |= media::EME_CODEC_VP9_PROFILE2;
+ break;
+ default:
+ DVLOG(1) << "Unexpected " << GetCodecName(media::VideoCodec::kCodecVP9)
+ << " profile: " << GetProfileName(profile);
+ break;
+ }
+ }
+
+ return supported_vp9_codecs;
+}
+
static media::SupportedCodecs GetSupportedCodecs(const media::CdmCapability& capability,
bool is_secure)
{
@@ -518,13 +544,12 @@ static media::SupportedCodecs GetSupportedCodecs(const media::CdmCapability& cap
}
for (const auto &codec : capability.video_codecs) {
- switch (codec) {
+ switch (codec.first) {
case media::VideoCodec::kCodecVP8:
supported_codecs |= media::EME_CODEC_VP8;
break;
case media::VideoCodec::kCodecVP9:
- supported_codecs |= media::EME_CODEC_VP9_PROFILE0;
- supported_codecs |= media::EME_CODEC_VP9_PROFILE2;
+ supported_codecs |= GetVP9Codecs(codec.second);
break;
case media::VideoCodec::kCodecAV1:
supported_codecs |= media::EME_CODEC_AV1;
@@ -535,7 +560,7 @@ static media::SupportedCodecs GetSupportedCodecs(const media::CdmCapability& cap
break;
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
default:
- DVLOG(1) << "Unexpected supported codec: " << GetCodecName(codec);
+ DVLOG(1) << "Unexpected supported codec: " << GetCodecName(codec.first);
break;
}
}
diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp
index b1998e027..4c214c45f 100644
--- a/src/core/renderer/extensions/extensions_renderer_client_qt.cpp
+++ b/src/core/renderer/extensions/extensions_renderer_client_qt.cpp
@@ -51,6 +51,7 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
+#include "base/stl_util.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/content_switches.h"
#include "content/public/renderer/render_frame.h"
diff --git a/src/core/renderer/web_engine_page_render_frame.cpp b/src/core/renderer/web_engine_page_render_frame.cpp
index 33282f258..1d5796092 100644
--- a/src/core/renderer/web_engine_page_render_frame.cpp
+++ b/src/core/renderer/web_engine_page_render_frame.cpp
@@ -82,7 +82,7 @@ void WebEnginePageRenderFrame::FetchDocumentInnerText(uint64_t requestId,
blink::WebString text;
if (!m_needsLayout)
text = blink::WebFrameContentDumper::DumpFrameTreeAsText(
- frame, std::numeric_limits<std::size_t>::max());
+ frame, std::numeric_limits<int32_t>::max());
std::move(callback).Run(requestId, text.Utf8());
}
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 59f5808ec..fbf4cb9dd 100644
--- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp
+++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp
@@ -146,6 +146,14 @@ void WebChannelIPCTransportHost::RenderFrameDeleted(content::RenderFrameHost *rf
m_renderFrames.erase(rfh);
}
+void WebChannelIPCTransportHost::BindReceiver(
+ mojo::PendingAssociatedReceiver<qtwebchannel::mojom::WebChannelTransportHost> receiver,
+ content::RenderFrameHost *rfh)
+{
+ m_receiver.Bind(rfh, std::move(receiver));
+}
+
+
const mojo::AssociatedRemote<qtwebchannel::mojom::WebChannelTransportRender> &
WebChannelIPCTransportHost::GetWebChannelIPCTransportRemote(content::RenderFrameHost *rfh)
{
diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.h b/src/core/renderer_host/web_channel_ipc_transport_host.h
index 794238667..846a4da3d 100644
--- a/src/core/renderer_host/web_channel_ipc_transport_host.h
+++ b/src/core/renderer_host/web_channel_ipc_transport_host.h
@@ -42,8 +42,8 @@
#include "qtwebenginecoreglobal.h"
+#include "content/public/browser/render_frame_host_receiver_set.h"
#include "content/public/browser/web_contents_observer.h"
-#include "content/public/browser/web_contents_receiver_set.h"
#include "qtwebengine/browser/qtwebchannel.mojom.h"
#include <QWebChannelAbstractTransport>
@@ -68,6 +68,10 @@ public:
// QWebChannelAbstractTransport
void sendMessage(const QJsonObject &message) override;
+ void BindReceiver(
+ mojo::PendingAssociatedReceiver<qtwebchannel::mojom::WebChannelTransportHost> receiver,
+ content::RenderFrameHost *rfh);
+
private:
void setWorldId(content::RenderFrameHost *frame, uint32_t worldId);
void resetWorldId();
@@ -85,7 +89,7 @@ private:
// Empty only during construction/destruction. Synchronized to all the
// WebChannelIPCTransports/RenderFrames in the observed WebContents.
uint32_t m_worldId;
- content::WebContentsFrameReceiverSet<qtwebchannel::mojom::WebChannelTransportHost> m_receiver;
+ content::RenderFrameHostReceiverSet<qtwebchannel::mojom::WebChannelTransportHost> m_receiver;
std::map<content::RenderFrameHost *,
mojo::AssociatedRemote<qtwebchannel::mojom::WebChannelTransportRender>>
m_renderFrames;
diff --git a/src/core/touch_selection_controller_client_qt.h b/src/core/touch_selection_controller_client_qt.h
index 16d581ba8..e3e86a336 100644
--- a/src/core/touch_selection_controller_client_qt.h
+++ b/src/core/touch_selection_controller_client_qt.h
@@ -75,6 +75,7 @@ public:
void RunContextMenu() override;
bool ShouldShowQuickMenu() override { return false; }
std::u16string GetSelectedText() override { return std::u16string(); }
+ const char *GetType() override { return nullptr; } //FIXME?
// content::TouchSelectionControllerClientManager overrides
void DidStopFlinging() override;
diff --git a/src/core/type_conversion.cpp b/src/core/type_conversion.cpp
index e8f8131b6..af22aa2d9 100644
--- a/src/core/type_conversion.cpp
+++ b/src/core/type_conversion.cpp
@@ -39,6 +39,7 @@
#include "type_conversion.h"
+#include "base/containers/contains.h"
#include <components/favicon_base/favicon_util.h>
#include <net/cert/x509_certificate.h>
#include <net/cert/x509_util.h>
@@ -48,7 +49,6 @@
#include "third_party/blink/public/mojom/favicon/favicon_url.mojom.h"
#include <QtCore/qcoreapplication.h>
-#include <QtGui/qmatrix4x4.h>
#include <QtNetwork/qsslcertificate.h>
namespace QtWebEngineCore {
@@ -276,17 +276,6 @@ int flagsFromModifiers(Qt::KeyboardModifiers modifiers)
return modifierFlags;
}
-void convertToQt(const SkMatrix44 &m, QMatrix4x4 &c)
-{
- QMatrix4x4 qtMatrix(
- m.get(0, 0), m.get(0, 1), m.get(0, 2), m.get(0, 3),
- m.get(1, 0), m.get(1, 1), m.get(1, 2), m.get(1, 3),
- m.get(2, 0), m.get(2, 1), m.get(2, 2), m.get(2, 3),
- m.get(3, 0), m.get(3, 1), m.get(3, 2), m.get(3, 3));
- qtMatrix.optimize();
- c = qtMatrix;
-}
-
static QSslCertificate toCertificate(CRYPTO_BUFFER *buffer)
{
auto derCert = net::x509_util::CryptoBufferAsStringPiece(buffer);
diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h
index aeaece585..7f378457b 100644
--- a/src/core/type_conversion.h
+++ b/src/core/type_conversion.h
@@ -56,13 +56,11 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkPixelRef.h"
-#include "third_party/skia/include/core/SkMatrix44.h"
#include "ui/base/ime/text_input_type.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_f.h"
#include "url/gurl.h"
-QT_FORWARD_DECLARE_CLASS(QMatrix4x4)
QT_FORWARD_DECLARE_CLASS(QSslCertificate)
namespace gfx {
@@ -214,8 +212,6 @@ SkBitmap toSkBitmap(const QImage &image);
QIcon toQIcon(const gfx::Image &image);
QIcon toQIcon(const std::vector<SkBitmap> &bitmaps);
-void convertToQt(const SkMatrix44 &m, QMatrix4x4 &c);
-
inline QDateTime toQt(base::Time time)
{
return QDateTime::fromMSecsSinceEpoch(time.ToJavaTime());
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 7843c7708..9472e7748 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -76,6 +76,7 @@
#include "content/public/browser/download_request_utils.h"
#include "content/public/browser/host_zoom_map.h"
#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/navigation_entry_restore_context.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/common/content_switches.h"
@@ -151,16 +152,14 @@ static QVariant fromJSValue(const base::Value *result)
}
case base::Value::Type::INTEGER:
{
- int out;
- if (result->GetAsInteger(&out))
- ret.setValue(out);
+ if (auto out = result->GetIfInt())
+ ret.setValue(*out);
break;
}
case base::Value::Type::DOUBLE:
{
- double out;
- if (result->GetAsDouble(&out))
- ret.setValue(out);
+ if (auto out = result->GetIfDouble())
+ ret.setValue(*out);
break;
}
case base::Value::Type::STRING:
@@ -299,6 +298,8 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex,
int count;
input >> count >> *currentIndex;
+ std::unique_ptr<content::NavigationEntryRestoreContext> context = content::NavigationEntryRestoreContext::Create(); // FIXME?
+
entries->reserve(count);
// Logic taken from SerializedNavigationEntry::ReadFromPickle and ToNavigationEntries.
for (int i = 0; i < count; ++i) {
@@ -349,7 +350,7 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex,
nullptr);
entry->SetTitle(toString16(title));
- entry->SetPageState(blink::PageState::CreateFromEncodedData(std::string(pageState.data(), pageState.size())));
+ entry->SetPageState(blink::PageState::CreateFromEncodedData(std::string(pageState.data(), pageState.size())), context.get());
entry->SetHasPostData(hasPostData);
entry->SetOriginalRequestURL(toGurl(originalRequestUrl));
entry->SetIsOverridingUserAgent(isOverridingUserAgent);
diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h
index 26cfa1b64..3e1657634 100644
--- a/src/core/web_contents_adapter.h
+++ b/src/core/web_contents_adapter.h
@@ -208,6 +208,7 @@ public:
#if QT_CONFIG(webengine_webchannel)
QWebChannel *webChannel() const;
void setWebChannel(QWebChannel *, uint worldId);
+ WebChannelIPCTransportHost *webChannelTransport() { return m_webChannelTransport.get(); }
#endif
FindTextHelper *findTextHelper();
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 3e8d32b37..014bbe744 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -562,10 +562,10 @@ void WebContentsDelegateQt::WebContentsCreated(content::WebContents * /*source_c
static_cast<WebContentsViewQt *>(view)->setFactoryClient(m_viewClient);
}
-content::ColorChooser *WebContentsDelegateQt::OpenColorChooser(content::WebContents *source, SkColor color, const std::vector<blink::mojom::ColorSuggestionPtr> &suggestion)
+std::unique_ptr<content::ColorChooser> WebContentsDelegateQt::OpenColorChooser(content::WebContents *source, SkColor color, const std::vector<blink::mojom::ColorSuggestionPtr> &suggestion)
{
Q_UNUSED(suggestion);
- ColorChooserQt *colorChooser = new ColorChooserQt(source, toQt(color));
+ auto colorChooser = std::make_unique<ColorChooserQt>(source, toQt(color));
m_viewClient->showColorDialog(colorChooser->controller());
return colorChooser;
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index fc51f4e37..f32dc797b 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -126,7 +126,7 @@ public:
void CloseContents(content::WebContents *source) override;
void LoadProgressChanged(double progress) override;
bool HandleKeyboardEvent(content::WebContents *source, const content::NativeWebKeyboardEvent &event) override;
- content::ColorChooser* OpenColorChooser(content::WebContents *source, SkColor color, const std::vector<blink::mojom::ColorSuggestionPtr> &suggestions) override;
+ std::unique_ptr<content::ColorChooser> OpenColorChooser(content::WebContents *source, SkColor color, const std::vector<blink::mojom::ColorSuggestionPtr> &suggestions) override;
void WebContentsCreated(content::WebContents *source_contents, int opener_render_process_id, int opener_render_frame_id,
const std::string &frame_name, const GURL &target_url, content::WebContents *new_contents) override;
content::JavaScriptDialogManager *GetJavaScriptDialogManager(content::WebContents *source) override;
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index 09ca03ca2..94dd4119e 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -79,7 +79,9 @@
#include "content/public/browser/browser_main_runner.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
+#if QT_CONFIG(webengine_pepper_plugins)
#include "content/public/browser/plugin_service.h"
+#endif
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_features.h"
@@ -946,7 +948,7 @@ const char *qWebEngineChromiumVersion() noexcept
*/
const char *qWebEngineChromiumSecurityPatchVersion() noexcept
{
- return "92.0.4515.166"; // FIXME: Remember to update
+ return "94.0.4606.126"; // FIXME: Remember to update
}
QT_END_NAMESPACE
diff --git a/src/core/web_usb_detector_qt.cpp b/src/core/web_usb_detector_qt.cpp
index 0fd898333..5ae155a2e 100644
--- a/src/core/web_usb_detector_qt.cpp
+++ b/src/core/web_usb_detector_qt.cpp
@@ -43,6 +43,7 @@
#include "content/public/browser/device_service.h"
#include "device/base/features.h"
+#include "services/device/public/mojom/usb_device.mojom.h"
WebUsbDetectorQt::WebUsbDetectorQt() = default;
diff --git a/src/gn/CMakeLists.txt b/src/gn/CMakeLists.txt
index 4d25debb9..a76d1dcee 100644
--- a/src/gn/CMakeLists.txt
+++ b/src/gn/CMakeLists.txt
@@ -17,7 +17,7 @@ set(GN_SOURCE_DIR ${WEBENGINE_ROOT_SOURCE_DIR}/src/3rdparty/gn)
set(GN_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${WEBENGINE_ROOT_SOURCE_DIR}/cmake")
-find_package(Python2 REQUIRED)
+find_package(Python3 REQUIRED)
find_package(Ninja 1.7.2 REQUIRED)
if(WIN32)
@@ -30,7 +30,7 @@ file(MAKE_DIRECTORY ${GN_BINARY_DIR})
add_custom_command(
OUTPUT ${GN_EXECUTABLE}
WORKING_DIRECTORY ${GN_BINARY_DIR}
- COMMAND ${Python2_EXECUTABLE} ${GN_SOURCE_DIR}/build/gen.py
+ COMMAND ${Python3_EXECUTABLE} ${GN_SOURCE_DIR}/build/gen.py
--no-last-commit-position
--out-path ${GN_BINARY_DIR}/$<CONFIG>
--cc ${CMAKE_C_COMPILER}
diff --git a/src/ninja/CMakeLists.txt b/src/ninja/CMakeLists.txt
index f7ece52d4..6f43b89fc 100644
--- a/src/ninja/CMakeLists.txt
+++ b/src/ninja/CMakeLists.txt
@@ -10,7 +10,7 @@ project(Ninja
set(NINJA_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../3rdparty/ninja)
set(NINJA_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
-find_package(Python2 REQUIRED)
+find_package(Python3 REQUIRED)
if(WIN32)
set(NINJA_EXECUTABLE ninja.exe)
@@ -25,7 +25,7 @@ add_custom_command(
WORKING_DIRECTORY ${NINJA_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory ${NINJA_BINARY_DIR}/$<CONFIG>
COMMAND ${CMAKE_COMMAND} -E chdir ${NINJA_BINARY_DIR}/$<CONFIG>
- ${Python2_EXECUTABLE} ${NINJA_SOURCE_DIR}/configure.py --bootstrap
+ ${Python3_EXECUTABLE} ${NINJA_SOURCE_DIR}/configure.py --bootstrap
USES_TERMINAL
VERBATIM
)
diff --git a/src/pdf/CMakeLists.txt b/src/pdf/CMakeLists.txt
index 9e4004adf..12a1c8290 100644
--- a/src/pdf/CMakeLists.txt
+++ b/src/pdf/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(Nodejs 12 REQUIRED)
find_package(PkgConfig)
if(PkgConfig_FOUND)
create_pkg_config_host_wrapper(${CMAKE_CURRENT_BINARY_DIR})
@@ -99,10 +98,12 @@ foreach(arch ${archs})
list(APPEND gnArgArg
qtwebengine_target="${buildDir}/${config}/${arch}:QtPdf"
+ enable_ipc_fuzzer=false
enable_remoting=false
enable_resource_allowlist_generation=false
enable_web_speech=false
chrome_pgo_phase=0
+ strip_absolute_paths_from_debug_symbols=false
)
if(LINUX)