From 7869ec5823da36a3ce33b379d3d664204756cad5 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 22 Oct 2020 14:18:16 +0200 Subject: Adaptations for Chromium 86 Change-Id: I7e0ebecdbb68cfff0b574c966f3fa80d28680e1c Reviewed-by: Peter Varga --- src/core/accessibility_tree_formatter_qt.cpp | 6 ++ src/core/api/core_api.pro | 1 + src/core/browser_main_parts_qt.cpp | 4 +- src/core/browsing_data_remover_delegate_qt.cpp | 4 +- src/core/browsing_data_remover_delegate_qt.h | 2 +- src/core/clipboard_qt.cpp | 69 +++++++++++++++----- src/core/clipboard_qt.h | 45 ++++++++----- .../common/extensions/extensions_client_qt.cpp | 12 ++-- src/core/common/extensions/extensions_client_qt.h | 10 +-- src/core/content_browser_client_qt.cpp | 13 ++-- src/core/content_browser_client_qt.h | 2 +- src/core/content_main_delegate_qt.cpp | 5 +- src/core/desktop_screen_qt.cpp | 76 ++-------------------- src/core/desktop_screen_qt.h | 27 ++------ src/core/file_picker_controller.cpp | 42 ++++++++---- src/core/file_picker_controller.h | 18 ++--- src/core/net/cookie_monster_delegate_qt.cpp | 4 +- src/core/net/cookie_monster_delegate_qt.h | 2 +- src/core/net/custom_url_loader_factory.cpp | 6 +- src/core/net/proxying_url_loader_factory_qt.cpp | 6 +- src/core/net/system_network_context_manager.cpp | 2 +- src/core/ozone/gl_surface_egl_qt.cpp | 5 ++ src/core/permission_manager_qt.cpp | 3 + src/core/pref_service_adapter.cpp | 6 +- src/core/printing/print_view_manager_base_qt.cpp | 10 +-- src/core/printing/print_view_manager_base_qt.h | 4 +- src/core/printing/print_view_manager_qt.cpp | 17 +++-- src/core/printing/print_view_manager_qt.h | 5 +- src/core/printing/printing_message_filter_qt.cpp | 41 ++++++------ src/core/profile_io_data_qt.cpp | 2 +- src/core/profile_io_data_qt.h | 2 +- src/core/qtwebengine_sources.gni | 1 + src/core/quota_permission_context_qt.cpp | 18 +++-- src/core/quota_permission_context_qt.h | 2 - src/core/quota_request_controller_impl.cpp | 7 +- src/core/render_widget_host_view_qt.cpp | 8 +-- src/core/render_widget_host_view_qt.h | 4 +- src/core/renderer/content_renderer_client_qt.cpp | 12 +--- src/core/renderer/content_renderer_client_qt.h | 3 - src/core/renderer/render_frame_observer_qt.cpp | 2 +- src/core/renderer/render_frame_observer_qt.h | 2 +- src/core/renderer/user_resource_controller.cpp | 4 +- src/core/resource_bundle_qt.cpp | 4 +- src/core/type_conversion.h | 38 ----------- src/core/user_script.cpp | 4 +- src/core/web_contents_adapter.cpp | 22 +++---- src/core/web_contents_delegate_qt.cpp | 18 ++--- src/core/web_contents_delegate_qt.h | 6 +- src/core/web_engine_context.cpp | 6 +- src/core/web_engine_library_info.cpp | 5 +- src/webenginewidgets/api/qwebenginepage.cpp | 2 +- .../tst_qwebenginedownloaditem.cpp | 4 +- .../widgets/qwebenginepage/tst_qwebenginepage.cpp | 10 ++- tools/scripts/git_submodule.py | 5 +- tools/scripts/take_snapshot.py | 1 + tools/scripts/version_resolver.py | 6 +- 56 files changed, 297 insertions(+), 348 deletions(-) diff --git a/src/core/accessibility_tree_formatter_qt.cpp b/src/core/accessibility_tree_formatter_qt.cpp index df652c6ab..56cec2feb 100644 --- a/src/core/accessibility_tree_formatter_qt.cpp +++ b/src/core/accessibility_tree_formatter_qt.cpp @@ -68,6 +68,7 @@ private: const std::string GetAllowString() override; const std::string GetDenyString() override; const std::string GetDenyNodeString() override; + const std::string GetRunUntilEventString() override; void RecursiveBuildAccessibilityTree(const content::BrowserAccessibility &node, base::DictionaryValue *dict) const; void AddProperties(const BrowserAccessibility &node, base::DictionaryValue *dict) const; base::string16 ProcessTreeForOutput(const base::DictionaryValue &node, base::DictionaryValue * = nullptr) override; @@ -232,6 +233,11 @@ const std::string AccessibilityTreeFormatterQt::GetDenyNodeString() return "@QT-DENY-NODE:"; } +const std::string AccessibilityTreeFormatterQt::GetRunUntilEventString() +{ + return "@QT-RUN-UNTIL-EVENT:"; +} + #endif // QT_CONFIG(accessibility) // static diff --git a/src/core/api/core_api.pro b/src/core/api/core_api.pro index d53fb6942..2ddd0d69f 100644 --- a/src/core/api/core_api.pro +++ b/src/core/api/core_api.pro @@ -26,6 +26,7 @@ CHROMIUM_SRC_DIR = $$QTWEBENGINE_ROOT/$$getChromiumSrcDir() CHROMIUM_GEN_DIR = $$OUT_PWD/../$$getConfigDir()/gen INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core \ $$CHROMIUM_GEN_DIR \ + $$CHROMIUM_SRC_DIR/third_party/abseil-cpp \ $$CHROMIUM_SRC_DIR gcc: QMAKE_CXXFLAGS_WARN_ON = -Wno-unused-parameter diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp index 9b8bbf91f..3ffff5778 100644 --- a/src/core/browser_main_parts_qt.cpp +++ b/src/core/browser_main_parts_qt.cpp @@ -41,9 +41,9 @@ #include "api/qwebenginemessagepumpscheduler_p.h" -#include "base/message_loop/message_loop_current.h" #include "base/message_loop/message_pump_for_ui.h" #include "base/process/process.h" +#include "base/task/current_thread.h" #include "base/task/sequence_manager/sequence_manager_impl.h" #include "base/task/sequence_manager/thread_controller_with_message_pump_impl.h" #include "base/threading/thread_restrictions.h" @@ -149,7 +149,7 @@ private: void ensureDelegate() { if (!m_delegate) { - auto seqMan = base::MessageLoopCurrent::GetCurrentSequenceManagerImpl(); + auto seqMan = base::CurrentThread::Get()->GetCurrentSequenceManagerImpl(); m_delegate = static_cast( seqMan->controller_.get()); } diff --git a/src/core/browsing_data_remover_delegate_qt.cpp b/src/core/browsing_data_remover_delegate_qt.cpp index 5b0adc343..6e79ab6c6 100644 --- a/src/core/browsing_data_remover_delegate_qt.cpp +++ b/src/core/browsing_data_remover_delegate_qt.cpp @@ -73,7 +73,7 @@ void BrowsingDataRemoverDelegateQt::RemoveEmbedderData(const base::Time &delete_ uint64_t remove_mask, content::BrowsingDataFilterBuilder *filter_builder, uint64_t origin_type_mask, - base::OnceClosure callback) + base::OnceCallback callback) { Q_UNUSED(delete_begin); Q_UNUSED(delete_end); @@ -83,7 +83,7 @@ void BrowsingDataRemoverDelegateQt::RemoveEmbedderData(const base::Time &delete_ if (remove_mask & content::BrowsingDataRemover::DATA_TYPE_CACHE) web_cache::WebCacheManager::GetInstance()->ClearCache(); - std::move(callback).Run(); + std::move(callback).Run(0); } std::vector BrowsingDataRemoverDelegateQt::GetDomainsForDeferredCookieDeletion(uint64_t) diff --git a/src/core/browsing_data_remover_delegate_qt.h b/src/core/browsing_data_remover_delegate_qt.h index 2c3a718db..a10409f39 100644 --- a/src/core/browsing_data_remover_delegate_qt.h +++ b/src/core/browsing_data_remover_delegate_qt.h @@ -58,7 +58,7 @@ public: uint64_t remove_mask, content::BrowsingDataFilterBuilder *filter_builder, uint64_t origin_type_mask, - base::OnceClosure callback) override; + base::OnceCallback callback) override; std::vector GetDomainsForDeferredCookieDeletion(uint64_t) override; }; diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index f47aa8b6c..e353ebc7c 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -106,7 +106,7 @@ Clipboard *Clipboard::Create() namespace QtWebEngineCore { -void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects) +void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects, std::unique_ptr data_src) { DCHECK(CalledOnValidThread()); DCHECK(IsSupportedClipboardBuffer(type)); @@ -125,12 +125,15 @@ void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const O if (text_iter != objects.end()) { // Copy text and SourceTag to the selection clipboard. WritePortableRepresentations(ui::ClipboardBuffer::kSelection, - ObjectMap(text_iter, text_iter + 1)); + ObjectMap(text_iter, text_iter + 1), + std::move(data_src)); } } } -void ClipboardQt::WritePlatformRepresentations(ui::ClipboardBuffer buffer, std::vector platform_representations) +void ClipboardQt::WritePlatformRepresentations(ui::ClipboardBuffer buffer, + std::vector platform_representations, + std::unique_ptr data_src) { DCHECK(CalledOnValidThread()); DCHECK(IsSupportedClipboardBuffer(buffer)); @@ -188,7 +191,9 @@ void ClipboardQt::WriteData(const ui::ClipboardFormatType &format, const char *d getUncommittedData()->setData(QString::fromStdString(format.GetName()), QByteArray(data_data, data_len)); } -bool ClipboardQt::IsFormatAvailable(const ui::ClipboardFormatType &format, ui::ClipboardBuffer type) const +bool ClipboardQt::IsFormatAvailable(const ui::ClipboardFormatType &format, + ui::ClipboardBuffer type, + const ui::ClipboardDataEndpoint *data_dst) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); @@ -201,7 +206,9 @@ void ClipboardQt::Clear(ui::ClipboardBuffer type) : QClipboard::Selection); } -void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type, std::vector *types) const +void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type, + const ui::ClipboardDataEndpoint *data_dst, + std::vector *types) const { if (!types) { NOTREACHED(); @@ -223,7 +230,9 @@ void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type, std::vectormimeData( type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); @@ -231,7 +240,9 @@ void ClipboardQt::ReadText(ui::ClipboardBuffer type, base::string16 *result) con *result = toString16(mimeData->text()); } -void ClipboardQt::ReadAsciiText(ui::ClipboardBuffer type, std::string *result) const +void ClipboardQt::ReadAsciiText(ui::ClipboardBuffer type, + const ui::ClipboardDataEndpoint *data_dst, + std::string *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); @@ -239,7 +250,9 @@ void ClipboardQt::ReadAsciiText(ui::ClipboardBuffer type, std::string *result) c *result = mimeData->text().toStdString(); } -void ClipboardQt::ReadHTML(ui::ClipboardBuffer type, base::string16 *markup, std::string *src_url, +void ClipboardQt::ReadHTML(ui::ClipboardBuffer type, + const ui::ClipboardDataEndpoint *data_dst, + base::string16 *markup, std::string *src_url, uint32_t *fragment_start, uint32_t *fragment_end) const { markup->clear(); @@ -256,7 +269,9 @@ void ClipboardQt::ReadHTML(ui::ClipboardBuffer type, base::string16 *markup, std *fragment_end = static_cast(markup->length()); } -void ClipboardQt::ReadRTF(ui::ClipboardBuffer type, std::string *result) const +void ClipboardQt::ReadRTF(ui::ClipboardBuffer type, + const ui::ClipboardDataEndpoint *data_dst, + std::string *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); @@ -266,7 +281,9 @@ void ClipboardQt::ReadRTF(ui::ClipboardBuffer type, std::string *result) const *result = std::string(byteArray.constData(), byteArray.length()); } -void ClipboardQt::ReadImage(ui::ClipboardBuffer type, ReadImageCallback callback) const +void ClipboardQt::ReadImage(ui::ClipboardBuffer type, + const ui::ClipboardDataEndpoint *data_dst, + ReadImageCallback callback) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); @@ -292,7 +309,9 @@ void ClipboardQt::ReadImage(ui::ClipboardBuffer type, ReadImageCallback callback return std::move(callback).Run(bitmap); } -void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type, base::string16 *result) const +void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type, + const ui::ClipboardDataEndpoint *data_dst, + base::string16 *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( clipboard_type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); @@ -302,12 +321,14 @@ void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const base: ui::ReadCustomDataForType(customData.constData(), customData.size(), type, result); } -void ClipboardQt::ReadBookmark(base::string16 *title, std::string *url) const +void ClipboardQt::ReadBookmark(const ui::ClipboardDataEndpoint *data_dst, base::string16 *title, std::string *url) const { NOTIMPLEMENTED(); } -void ClipboardQt::ReadData(const ui::ClipboardFormatType &format, std::string *result) const +void ClipboardQt::ReadData(const ui::ClipboardFormatType &format, + const ui::ClipboardDataEndpoint *data_dst, + std::string *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(); if (!mimeData) @@ -322,17 +343,29 @@ uint64_t ClipboardQt::GetSequenceNumber(ui::ClipboardBuffer type) const : QClipboard::Selection); } -std::vector ClipboardQt::ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer) const +void ClipboardQt::SetClipboardDlpController(std::unique_ptr) +{ + NOTIMPLEMENTED(); +} + +#if defined(USE_OZONE) +bool ClipboardQt::IsSelectionBufferAvailable() const +{ + return QGuiApplication::clipboard()->supportsSelection(); +} +#endif + +std::vector ClipboardQt::ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::ClipboardDataEndpoint *data_dst) const { // based on ClipboardAura std::vector types; - if (IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(), buffer)) + if (IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextType(), buffer, data_dst)) types.push_back(base::UTF8ToUTF16(ui::ClipboardFormatType::GetPlainTextType().GetName())); - if (IsFormatAvailable(ui::ClipboardFormatType::GetHtmlType(), buffer)) + if (IsFormatAvailable(ui::ClipboardFormatType::GetHtmlType(), buffer, data_dst)) types.push_back(base::UTF8ToUTF16(ui::ClipboardFormatType::GetHtmlType().GetName())); - if (IsFormatAvailable(ui::ClipboardFormatType::GetRtfType(), buffer)) + if (IsFormatAvailable(ui::ClipboardFormatType::GetRtfType(), buffer, data_dst)) types.push_back(base::UTF8ToUTF16(ui::ClipboardFormatType::GetRtfType().GetName())); - if (IsFormatAvailable(ui::ClipboardFormatType::GetBitmapType(), buffer)) + if (IsFormatAvailable(ui::ClipboardFormatType::GetBitmapType(), buffer, data_dst)) types.push_back(base::UTF8ToUTF16(ui::kMimeTypePNG)); return types; diff --git a/src/core/clipboard_qt.h b/src/core/clipboard_qt.h index 79ffbb0b9..f079888f5 100644 --- a/src/core/clipboard_qt.h +++ b/src/core/clipboard_qt.h @@ -44,30 +44,43 @@ namespace QtWebEngineCore { -class ClipboardQt : public ui::Clipboard { +class ClipboardQt : public ui::Clipboard +{ public: uint64_t GetSequenceNumber(ui::ClipboardBuffer type) const override; - bool IsFormatAvailable(const ui::ClipboardFormatType &format, ui::ClipboardBuffer type) const override; + bool IsFormatAvailable(const ui::ClipboardFormatType &format, + ui::ClipboardBuffer buffer, + const ui::ClipboardDataEndpoint *data_dst) const override; void Clear(ui::ClipboardBuffer type) override; - void ReadAvailableTypes(ui::ClipboardBuffer type, std::vector *types) const override; - void ReadText(ui::ClipboardBuffer type, base::string16 *result) const override; - void ReadAsciiText(ui::ClipboardBuffer type, std::string *result) const override; - void ReadHTML(ui::ClipboardBuffer type, base::string16 *markup, std::string *src_url, uint32_t *fragment_start, + void ReadAvailableTypes(ui::ClipboardBuffer type, + const ui::ClipboardDataEndpoint *data_dst, + std::vector *types) const override; + void ReadText(ui::ClipboardBuffer type, const ui::ClipboardDataEndpoint *data_dst, base::string16 *result) const override; + void ReadAsciiText(ui::ClipboardBuffer type, const ui::ClipboardDataEndpoint *data_dst, std::string *result) const override; + void ReadHTML(ui::ClipboardBuffer type, const ui::ClipboardDataEndpoint *data_dst, base::string16 *markup, std::string *src_url, uint32_t *fragment_start, uint32_t *fragment_end) const override; - void ReadRTF(ui::ClipboardBuffer type, std::string *result) const override; - void ReadImage(ui::ClipboardBuffer buffer, ReadImageCallback callback) const override; - void ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type, base::string16 *result) const override; - void ReadBookmark(base::string16 *title, std::string *url) const override; - void ReadData(const ui::ClipboardFormatType &format, std::string *result) const override; - + void ReadRTF(ui::ClipboardBuffer type, const ui::ClipboardDataEndpoint *data_dst, std::string *result) const override; + void ReadImage(ui::ClipboardBuffer buffer, const ui::ClipboardDataEndpoint *data_dst, ReadImageCallback callback) const override; + void ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type, const ui::ClipboardDataEndpoint *data_dst, base::string16 *result) const override; + void ReadBookmark(const ui::ClipboardDataEndpoint *data_dst, base::string16 *title, std::string *url) const override; + void ReadData(const ui::ClipboardFormatType &format, const ui::ClipboardDataEndpoint *data_dst, std::string *result) const override; + void SetClipboardDlpController(std::unique_ptr) override; +#if defined(USE_OZONE) + bool IsSelectionBufferAvailable() const override; +#endif void OnPreShutdown() override {} - std::vector ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer) const override; + std::vector ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::ClipboardDataEndpoint *data_dst) const override; protected: - void WritePortableRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects) override; - void WritePlatformRepresentations(ui::ClipboardBuffer type, - std::vector platform_representations) override; + void WritePortableRepresentations( + ui::ClipboardBuffer buffer, + const ObjectMap &objects, + std::unique_ptr data_src) override; + void WritePlatformRepresentations( + ui::ClipboardBuffer buffer, + std::vector platform_representations, + std::unique_ptr data_src) override; void WriteText(const char *text_data, size_t text_len) override; void WriteHTML(const char *markup_data, size_t markup_len, const char *url_data, size_t url_len) override; void WriteRTF(const char *rtf_data, size_t data_len) override; diff --git a/src/core/common/extensions/extensions_client_qt.cpp b/src/core/common/extensions/extensions_client_qt.cpp index dd1de1483..c4cc2321a 100644 --- a/src/core/common/extensions/extensions_client_qt.cpp +++ b/src/core/common/extensions/extensions_client_qt.cpp @@ -108,18 +108,18 @@ void ExtensionsClientQt::FilterHostPermissions(const URLPatternSet &hosts, { } -// Replaces the scripting whitelist with |whitelist|. Used in the renderer{} +// Replaces the scripting allowlist with |allowlist|. Used in the renderer{} // only used for testing in the browser process. -void ExtensionsClientQt::SetScriptingWhitelist(const ExtensionsClient::ScriptingWhitelist &whitelist) +void ExtensionsClientQt::SetScriptingAllowlist(const ExtensionsClient::ScriptingAllowlist &allowlist) { - scripting_whitelist_ = whitelist; + scripting_allowlist_ = allowlist; } -// Return the whitelist of extensions that can run content scripts on +// Return the allowlist of extensions that can run content scripts on // any origin. -const ExtensionsClient::ScriptingWhitelist &ExtensionsClientQt::GetScriptingWhitelist() const +const ExtensionsClient::ScriptingAllowlist &ExtensionsClientQt::GetScriptingAllowlist() const { - return scripting_whitelist_; + return scripting_allowlist_; } // Get the set of chrome:// hosts that |extension| can run content scripts on. diff --git a/src/core/common/extensions/extensions_client_qt.h b/src/core/common/extensions/extensions_client_qt.h index e689f76b7..2466e14e3 100644 --- a/src/core/common/extensions/extensions_client_qt.h +++ b/src/core/common/extensions/extensions_client_qt.h @@ -87,13 +87,13 @@ public: URLPatternSet *new_hosts, PermissionIDSet *permissions) const override; - // Replaces the scripting whitelist with |whitelist|. Used in the renderer; + // Replaces the scripting allowlist with |allowlist|. Used in the renderer; // only used for testing in the browser process. - void SetScriptingWhitelist(const ScriptingWhitelist &whitelist) override; + void SetScriptingAllowlist(const ScriptingAllowlist &allowlist) override; - // Return the whitelist of extensions that can run content scripts on + // Return the allowlist of extensions that can run content scripts on // any origin. - const ScriptingWhitelist &GetScriptingWhitelist() const override; + const ScriptingAllowlist &GetScriptingAllowlist() const override; // Get the set of chrome:// hosts that |extension| can run content scripts on. URLPatternSet GetPermittedChromeSchemeHosts(const Extension *extension, @@ -127,7 +127,7 @@ public: static ExtensionsClientQt *GetInstance(); private: - ScriptingWhitelist scripting_whitelist_; + ScriptingAllowlist scripting_allowlist_; const ChromePermissionMessageProvider permission_message_provider_; mutable GURL update_url_; mutable GURL base_url_; diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 9c5299565..84296b032 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -55,11 +55,7 @@ #include "components/navigation_interception/navigation_params.h" #include "components/network_hints/browser/simple_network_hints_handler_impl.h" #include "components/performance_manager/embedder/performance_manager_registry.h" -#include "components/performance_manager/graph/process_node_impl.h" -#include "components/performance_manager/performance_manager_impl.h" -#include "components/performance_manager/public/mojom/coordination_unit.mojom.h" #include "components/performance_manager/public/performance_manager.h" -#include "components/performance_manager/render_process_user_data.h" #include "components/spellcheck/spellcheck_buildflags.h" #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/browser/web_contents/web_contents_impl.h" @@ -97,11 +93,11 @@ #include "qtwebengine/browser/qtwebengine_content_renderer_overlay_manifest.h" #include "net/ssl/client_cert_identity.h" #include "net/ssl/client_cert_store.h" +#include "sandbox/policy/switches.h" #include "services/network/network_service.h" #include "services/network/public/cpp/features.h" #include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/service.h" -#include "services/service_manager/sandbox/switches.h" #include "storage/browser/quota/quota_settings.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" #include "third_party/blink/public/common/loader/url_loader_throttle.h" @@ -274,7 +270,7 @@ public: } void* GetHandle() override { return m_handle; } - unsigned int CheckStickyGraphicsResetStatus() override + unsigned int CheckStickyGraphicsResetStatusImpl() override { #if QT_CONFIG(opengl) if (QOpenGLContext *context = qt_gl_global_share_context()) { @@ -287,7 +283,7 @@ public: // We don't care about the rest, this context shouldn't be used except for its handle. bool Initialize(gl::GLSurface *, const gl::GLContextAttribs &) override { Q_UNREACHABLE(); return false; } - bool MakeCurrent(gl::GLSurface *) override { Q_UNREACHABLE(); return false; } + bool MakeCurrentImpl(gl::GLSurface *) override { Q_UNREACHABLE(); return false; } void ReleaseCurrent(gl::GLSurface *) override { Q_UNREACHABLE(); } bool IsCurrent(gl::GLSurface *) override { Q_UNREACHABLE(); return false; } scoped_refptr CreateGPUTimingClient() override @@ -1098,6 +1094,7 @@ std::vector ContentBrowserClientQt::GetNetworkContextsParentDire } void ContentBrowserClientQt::RegisterNonNetworkNavigationURLLoaderFactories(int frame_tree_node_id, + base::UkmSourceId ukm_source_id, NonNetworkURLLoaderFactoryMap *factories) { content::WebContents *web_contents = content::WebContents::FromFrameTreeNodeId(frame_tree_node_id); @@ -1110,7 +1107,7 @@ void ContentBrowserClientQt::RegisterNonNetworkNavigationURLLoaderFactories(int #if BUILDFLAG(ENABLE_EXTENSIONS) factories->emplace( extensions::kExtensionScheme, - extensions::CreateExtensionNavigationURLLoaderFactory(profile, + extensions::CreateExtensionNavigationURLLoaderFactory(profile, ukm_source_id, !!extensions::WebViewGuest::FromWebContents(web_contents))); #endif } diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index a78787c5c..bf2ebae36 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -250,7 +250,7 @@ public: network::mojom::CertVerifierCreationParams *cert_verifier_creation_params) override; std::vector GetNetworkContextsParentDirectory() override; - void RegisterNonNetworkNavigationURLLoaderFactories(int frame_tree_node_id, NonNetworkURLLoaderFactoryMap *factories) override; + void RegisterNonNetworkNavigationURLLoaderFactories(int frame_tree_node_id, base::UkmSourceId ukm_source_id, NonNetworkURLLoaderFactoryMap *factories) override; void RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id, NonNetworkURLLoaderFactoryMap* factories) override; void RegisterNonNetworkWorkerMainResourceURLLoaderFactories(content::BrowserContext* browser_context, diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index cf8582ef2..9971a4ac5 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -42,6 +42,7 @@ #include "base/command_line.h" #include "base/i18n/rtl.h" #include "base/logging.h" +#include "base/no_destructor.h" #include "base/path_service.h" #include "base/strings/string_number_conversions.h" #include "chrome/grit/generated_resources.h" @@ -55,8 +56,8 @@ #include "ui/base/webui/jstemplate_builder.h" #include "net/grit/net_resources.h" #include "net/base/net_module.h" +#include "sandbox/policy/switches.h" #include "services/service_manager/embedder/switches.h" -#include "services/service_manager/sandbox/switches.h" #include "url/url_util_qt.h" #include "content_client_qt.h" @@ -260,7 +261,7 @@ content::ContentRendererClient *ContentMainDelegateQt::CreateContentRendererClie #if defined(OS_LINUX) base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess(); std::string process_type = parsedCommandLine->GetSwitchValueASCII(switches::kProcessType); - bool no_sandbox = parsedCommandLine->HasSwitch(service_manager::switches::kNoSandbox); + bool no_sandbox = parsedCommandLine->HasSwitch(sandbox::policy::switches::kNoSandbox); // Reload locale if the renderer process is sandboxed if (process_type == switches::kRendererProcess && !no_sandbox) { diff --git a/src/core/desktop_screen_qt.cpp b/src/core/desktop_screen_qt.cpp index a6734231f..1f715444b 100644 --- a/src/core/desktop_screen_qt.cpp +++ b/src/core/desktop_screen_qt.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. @@ -40,82 +40,20 @@ #include "desktop_screen_qt.h" #include "ui/display/display.h" -#include "ui/gfx/geometry/point.h" - -#include namespace QtWebEngineCore { -gfx::Point DesktopScreenQt::GetCursorScreenPoint() -{ - Q_UNREACHABLE(); - return gfx::Point(); -} - -bool DesktopScreenQt::IsWindowUnderCursor(gfx::NativeWindow) -{ - Q_UNREACHABLE(); - return false; -} - -gfx::NativeWindow DesktopScreenQt::GetWindowAtScreenPoint(const gfx::Point& point) -{ - Q_UNREACHABLE(); - return gfx::NativeWindow(); -} - -int DesktopScreenQt::GetNumDisplays() const -{ - Q_UNREACHABLE(); - return 0; -} - -std::vector& DesktopScreenQt::GetAllDisplays() const -{ - static std::vector empty; - return empty; -} - -display::Display DesktopScreenQt::GetDisplayNearestWindow(gfx::NativeWindow window) const -{ - // RenderViewHostImpl::OnStartDragging uses this to determine - // the scale factor for the view. - return display::Display(0); -} - -display::Display DesktopScreenQt::GetDisplayNearestPoint(const gfx::Point& point) const +DesktopScreenQt::DesktopScreenQt() { - Q_UNREACHABLE(); - return display::Display(); + ProcessDisplayChanged(display::Display::GetDefaultDisplay(), true /* is_primary */); } -display::Display DesktopScreenQt::GetDisplayMatching(const gfx::Rect& match_rect) const -{ - Q_UNREACHABLE(); - return display::Display(); -} - -display::Display DesktopScreenQt::GetPrimaryDisplay() const -{ - return display::Display(0); -} - -void DesktopScreenQt::AddObserver(display::DisplayObserver *observer) -{ - m_observers.insert(observer); -} - -void DesktopScreenQt::RemoveObserver(display::DisplayObserver *observer) -{ - m_observers.erase(observer); -} +DesktopScreenQt::~DesktopScreenQt() +{} -gfx::NativeWindow DesktopScreenQt::GetLocalProcessWindowAtPoint( - const gfx::Point &point, - const std::set &ignore) +display::Display DesktopScreenQt::GetDisplayNearestWindow(gfx::NativeWindow /*window*/) const { - Q_UNREACHABLE(); - return gfx::NativeWindow(); + return GetPrimaryDisplay(); } } // namespace QtWebEngineCore diff --git a/src/core/desktop_screen_qt.h b/src/core/desktop_screen_qt.h index f6b252789..f47cfabbc 100644 --- a/src/core/desktop_screen_qt.h +++ b/src/core/desktop_screen_qt.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. @@ -40,32 +40,17 @@ #ifndef DESKTOP_SCREEN_QT_H #define DESKTOP_SCREEN_QT_H -#include "ui/display/screen.h" - -#include +#include "ui/display/screen_base.h" namespace QtWebEngineCore { -class DesktopScreenQt : public display::Screen +class DesktopScreenQt : public display::ScreenBase { public: - // Overridden from gfx::Screen: - gfx::Point GetCursorScreenPoint() override; - bool IsWindowUnderCursor(gfx::NativeWindow) override; - gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; - int GetNumDisplays() const override; - std::vector& GetAllDisplays() const override; - display::Display GetDisplayNearestWindow(gfx::NativeWindow window) const override; - display::Display GetDisplayNearestPoint(const gfx::Point& point) const override; - display::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; - display::Display GetPrimaryDisplay() const override; - void AddObserver(display::DisplayObserver* observer) override; - void RemoveObserver(display::DisplayObserver* observer) override; + DesktopScreenQt(); + ~DesktopScreenQt() override; - gfx::NativeWindow GetLocalProcessWindowAtPoint(const gfx::Point &point, - const std::set &ignore) override; -private: - std::set m_observers; + display::Display GetDisplayNearestWindow(gfx::NativeWindow /*window*/) const override; }; } // namespace QtWebEngineCore diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 65e2c6f00..334321273 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -53,16 +53,32 @@ namespace QtWebEngineCore { -FilePickerController::FilePickerController(FileChooserMode mode, std::unique_ptr listener, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject *parent) +class FilePickerControllerPrivate { +public: + FilePickerController::FileChooserMode mode; + scoped_refptr listener; + QString defaultFileName; + QStringList acceptedMimeTypes; +}; + +FilePickerController *createFilePickerController( + FilePickerController::FileChooserMode mode, scoped_refptr listener, + const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject *parent = nullptr) +{ + auto priv = new FilePickerControllerPrivate{mode, listener, defaultFileName, acceptedMimeTypes}; + return new FilePickerController(priv, parent); +} + +FilePickerController::FilePickerController(FilePickerControllerPrivate *priv, QObject *parent) : QObject(parent) - , m_defaultFileName(defaultFileName) - , m_acceptedMimeTypes(acceptedMimeTypes) - , m_listener(std::move(listener)) - , m_mode(mode) + , d_ptr(priv) { } -FilePickerController::~FilePickerController() = default; +FilePickerController::~FilePickerController() +{ + delete d_ptr; +} void FilePickerController::accepted(const QStringList &files) { @@ -178,7 +194,7 @@ ASSERT_ENUMS_MATCH(FilePickerController::Save, blink::mojom::FileChooserParams_M void FilePickerController::filesSelectedInChooser(const QStringList &filesList) { QStringList files(filesList); - if (this->m_mode == UploadFolder && !filesList.isEmpty() + if (d_ptr->mode == UploadFolder && !filesList.isEmpty() && QFileInfo(filesList.first()).isDir()) // Enumerate the directory files = listRecursively(QDir(filesList.first())); @@ -189,26 +205,26 @@ void FilePickerController::filesSelectedInChooser(const QStringList &filesList) } if (files.isEmpty()) - m_listener->FileSelectionCanceled(); + d_ptr->listener->FileSelectionCanceled(); else - m_listener->FileSelected(std::move(chooser_files), + d_ptr->listener->FileSelected(std::move(chooser_files), /* FIXME? */ base::FilePath(), - static_cast(this->m_mode)); + static_cast(d_ptr->mode)); } QStringList FilePickerController::acceptedMimeTypes() const { - return m_acceptedMimeTypes; + return d_ptr->acceptedMimeTypes; } FilePickerController::FileChooserMode FilePickerController::mode() const { - return m_mode; + return d_ptr->mode; } QString FilePickerController::defaultFileName() const { - return m_defaultFileName; + return d_ptr->defaultFileName; } QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTypes) diff --git a/src/core/file_picker_controller.h b/src/core/file_picker_controller.h index 0b680161a..0b84c889e 100644 --- a/src/core/file_picker_controller.h +++ b/src/core/file_picker_controller.h @@ -53,17 +53,12 @@ #include "qtwebenginecoreglobal_p.h" -#include - #include #include -namespace content { - class FileSelectListener; -} - namespace QtWebEngineCore { +class FilePickerControllerPrivate; class Q_WEBENGINECORE_PRIVATE_EXPORT FilePickerController : public QObject { Q_OBJECT public: @@ -74,8 +69,9 @@ public: Save }; - FilePickerController(FileChooserMode mode, std::unique_ptr listener, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject * = 0); + FilePickerController(FilePickerControllerPrivate *priv, QObject *parent = nullptr); ~FilePickerController() override; + QStringList acceptedMimeTypes() const; QString defaultFileName() const; FileChooserMode mode() const; @@ -89,13 +85,9 @@ public Q_SLOTS: private: void filesSelectedInChooser(const QStringList &filesList); - QString m_defaultFileName; - QStringList m_acceptedMimeTypes; - std::unique_ptr m_listener; - FileChooserMode m_mode; - + FilePickerControllerPrivate *d_ptr; }; -} // namespace +} // namespace QtWebEngineCore #endif // FILE_PICKER_CONTROLLER_H diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp index 3d3403a54..792d34373 100644 --- a/src/core/net/cookie_monster_delegate_qt.cpp +++ b/src/core/net/cookie_monster_delegate_qt.cpp @@ -273,10 +273,10 @@ void CookieMonsterDelegateQt::GetAllCookiesCallbackOnUIThread(qint64 callbackId, m_client->d_func()->onGetAllCallbackResult(callbackId, rawCookies); } -void CookieMonsterDelegateQt::SetCookieCallbackOnUIThread(qint64 callbackId, net::CookieInclusionStatus status) +void CookieMonsterDelegateQt::SetCookieCallbackOnUIThread(qint64 callbackId, net::CookieAccessResult status) { if (m_client) - m_client->d_func()->onSetCallbackResult(callbackId, status.IsInclude()); + m_client->d_func()->onSetCallbackResult(callbackId, status.status.IsInclude()); } void CookieMonsterDelegateQt::DeleteCookiesCallbackOnUIThread(qint64 callbackId, uint numCookies) diff --git a/src/core/net/cookie_monster_delegate_qt.h b/src/core/net/cookie_monster_delegate_qt.h index 6e9007443..fe1ed5be6 100644 --- a/src/core/net/cookie_monster_delegate_qt.h +++ b/src/core/net/cookie_monster_delegate_qt.h @@ -120,7 +120,7 @@ public: private: void GetAllCookiesCallbackOnUIThread(qint64 callbackId, const net::CookieList &cookies); - void SetCookieCallbackOnUIThread(qint64 callbackId, net::CookieInclusionStatus status); + void SetCookieCallbackOnUIThread(qint64 callbackId, net::CookieAccessResult status); void DeleteCookiesCallbackOnUIThread(qint64 callbackId, uint numCookies); }; diff --git a/src/core/net/custom_url_loader_factory.cpp b/src/core/net/custom_url_loader_factory.cpp index 26436f36a..43facd30c 100644 --- a/src/core/net/custom_url_loader_factory.cpp +++ b/src/core/net/custom_url_loader_factory.cpp @@ -288,9 +288,9 @@ private: if (!m_redirect.is_empty()) { m_head->content_length = m_head->encoded_body_length = -1; - net::URLRequest::FirstPartyURLPolicy first_party_url_policy = - m_request.update_first_party_url_on_redirect ? net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT - : net::URLRequest::NEVER_CHANGE_FIRST_PARTY_URL; + net::RedirectInfo::FirstPartyURLPolicy first_party_url_policy = + m_request.update_first_party_url_on_redirect ? net::RedirectInfo::FirstPartyURLPolicy::UPDATE_URL_ON_REDIRECT + : net::RedirectInfo::FirstPartyURLPolicy::NEVER_CHANGE_URL; net::RedirectInfo redirectInfo = net::RedirectInfo::ComputeRedirectInfo( m_request.method, m_request.url, m_request.site_for_cookies, diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp index f63e78861..dfc17e440 100644 --- a/src/core/net/proxying_url_loader_factory_qt.cpp +++ b/src/core/net/proxying_url_loader_factory_qt.cpp @@ -308,9 +308,9 @@ void InterceptedRequest::ContinueAfterIntercept() } if (info.shouldRedirectRequest) { - net::URLRequest::FirstPartyURLPolicy first_party_url_policy = - request_.update_first_party_url_on_redirect ? net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT - : net::URLRequest::NEVER_CHANGE_FIRST_PARTY_URL; + net::RedirectInfo::FirstPartyURLPolicy first_party_url_policy = + request_.update_first_party_url_on_redirect ? net::RedirectInfo::FirstPartyURLPolicy::UPDATE_URL_ON_REDIRECT + : net::RedirectInfo::FirstPartyURLPolicy::NEVER_CHANGE_URL; net::RedirectInfo redirectInfo = net::RedirectInfo::ComputeRedirectInfo( request_.method, request_.url, request_.site_for_cookies, first_party_url_policy, request_.referrer_policy, request_.referrer.spec(), diff --git a/src/core/net/system_network_context_manager.cpp b/src/core/net/system_network_context_manager.cpp index affc228cf..99a207c0e 100644 --- a/src/core/net/system_network_context_manager.cpp +++ b/src/core/net/system_network_context_manager.cpp @@ -101,7 +101,7 @@ network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams() network::mojom::HttpAuthDynamicParamsPtr auth_dynamic_params = network::mojom::HttpAuthDynamicParams::New(); auto *command_line = base::CommandLine::ForCurrentProcess(); - auth_dynamic_params->server_allowlist = command_line->GetSwitchValueASCII(switches::kAuthServerWhitelist); + auth_dynamic_params->server_allowlist = command_line->GetSwitchValueASCII(switches::kAuthServerAllowlist); // auth_dynamic_params->delegate_allowlist = command_line->GetSwitchValueASCII(switches::kAuthNegotiateDelegateWhitelist); // auth_dynamic_params->enable_negotiate_port = command_line->HasSwitch(switches::kEnableAuthNegotiatePort); diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp index 4a168ce3c..c4910fddb 100644 --- a/src/core/ozone/gl_surface_egl_qt.cpp +++ b/src/core/ozone/gl_surface_egl_qt.cpp @@ -186,6 +186,11 @@ bool GLSurfaceEGL::IsANGLEPowerPreferenceSupported() return false; } +bool GLSurfaceEGL::IsDisplaySemaphoreShareGroupSupported() +{ + return false; +} + void GLSurfaceEGL::ShutdownOneOff() { } diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index a1b481946..c79a7ae45 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -86,6 +86,9 @@ static ProfileAdapter::PermissionType toQt(content::PermissionType type) case content::PermissionType::AR: case content::PermissionType::VR: case content::PermissionType::STORAGE_ACCESS_GRANT: + case content::PermissionType::CAMERA_PAN_TILT_ZOOM: // FIXME: This one seems to be checked together with webrtc + case content::PermissionType::WINDOW_PLACEMENT: + case content::PermissionType::FONT_ACCESS: case content::PermissionType::NUM: LOG(INFO) << "Unsupported permission type: " << static_cast(type); break; diff --git a/src/core/pref_service_adapter.cpp b/src/core/pref_service_adapter.cpp index 65dfb73ee..ff653c066 100644 --- a/src/core/pref_service_adapter.cpp +++ b/src/core/pref_service_adapter.cpp @@ -101,7 +101,7 @@ 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); registry->RegisterBooleanPref(spellcheck::prefs::kSpellCheckUseSpellingService, false); @@ -120,8 +120,8 @@ void PrefServiceAdapter::setup(const ProfileAdapter &profileAdapter) registry->RegisterBooleanPref(extensions::pref_names::kStorageGarbageCollect, false); registry->RegisterListPref(extensions::pref_names::kAllowedInstallSites); registry->RegisterStringPref(extensions::pref_names::kLastChromeVersion, std::string()); - registry->RegisterListPref(extensions::pref_names::kNativeMessagingBlacklist); - registry->RegisterListPref(extensions::pref_names::kNativeMessagingWhitelist); + registry->RegisterListPref(extensions::pref_names::kNativeMessagingBlocklist); + registry->RegisterListPref(extensions::pref_names::kNativeMessagingAllowlist); registry->RegisterBooleanPref(extensions::pref_names::kNativeMessagingUserLevelHosts, true); #endif // BUILDFLAG(ENABLE_EXTENSIONS) diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp index 0c49a7bbc..0f7ec1c70 100644 --- a/src/core/printing/print_view_manager_base_qt.cpp +++ b/src/core/printing/print_view_manager_base_qt.cpp @@ -48,9 +48,9 @@ #include "web_engine_context.h" #include "base/memory/ref_counted_memory.h" -#include "base/message_loop/message_loop_current.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" +#include "base/task/current_thread.h" #include "base/task/post_task.h" #include "base/timer/timer.h" #include "base/values.h" @@ -149,7 +149,7 @@ printing::PrintedDocument *PrintViewManagerBaseQt::GetDocument(int cookie) // IPC handlers void PrintViewManagerBaseQt::OnDidPrintDocument(content::RenderFrameHost* /*render_frame_host*/, - const PrintHostMsg_DidPrintDocument_Params ¶ms, + const printing::mojom::DidPrintDocumentParams ¶ms, std::unique_ptr helper) { printing::PrintedDocument *document = GetDocument(params.document_cookie); @@ -157,13 +157,13 @@ void PrintViewManagerBaseQt::OnDidPrintDocument(content::RenderFrameHost* /*rend return; const auto &content = params.content; - if (!content.metafile_data_region.IsValid()) { + if (!content->metafile_data_region.IsValid()) { NOTREACHED() << "invalid memory handle"; web_contents()->Stop(); return; } - auto data = base::RefCountedSharedMemoryMapping::CreateFromWholeRegion(content.metafile_data_region); + auto data = base::RefCountedSharedMemoryMapping::CreateFromWholeRegion(content->metafile_data_region); if (!data) { NOTREACHED() << "couldn't map"; web_contents()->Stop(); @@ -457,7 +457,7 @@ bool PrintViewManagerBaseQt::RunInnerMessageLoop() { // Need to enable recursive task. { - base::MessageLoopCurrent::ScopedNestableTaskAllower allow; + base::CurrentThread::ScopedNestableTaskAllower allow; run_loop.Run(); } diff --git a/src/core/printing/print_view_manager_base_qt.h b/src/core/printing/print_view_manager_base_qt.h index 1217e8c11..8d6c3fc7a 100644 --- a/src/core/printing/print_view_manager_base_qt.h +++ b/src/core/printing/print_view_manager_base_qt.h @@ -51,8 +51,6 @@ #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" -struct PrintHostMsg_DidPrintDocument_Params; - namespace base { class RefCountedBytes; } @@ -100,7 +98,7 @@ protected: // printing::PrintManager implementation: void OnDidPrintDocument(content::RenderFrameHost *render_frame_host, - const PrintHostMsg_DidPrintDocument_Params ¶ms, + const printing::mojom::DidPrintDocumentParams ¶ms, std::unique_ptr helper) override; void OnGetDefaultPrintSettings(content::RenderFrameHost* render_frame_host, IPC::Message* reply_msg) override; diff --git a/src/core/printing/print_view_manager_qt.cpp b/src/core/printing/print_view_manager_qt.cpp index 617bc9ed3..5d9e1bf7a 100644 --- a/src/core/printing/print_view_manager_qt.cpp +++ b/src/core/printing/print_view_manager_qt.cpp @@ -162,14 +162,14 @@ static base::DictionaryValue *createPrintSettingsFromQPageLayout(const QPageLayo marginsDict->SetInteger(printing::kSettingMarginRight, pageMarginsInPoints.right()); printSettings->Set(printing::kSettingMarginsCustom, std::move(marginsDict)); - printSettings->SetInteger(printing::kSettingMarginsType, printing::CUSTOM_MARGINS); + printSettings->SetInteger(printing::kSettingMarginsType, (int)printing::mojom::MarginType::kCustomMargins); // pageSizeInMillimeter is in portrait orientation. Transpose it if necessary. printSettings->SetBoolean(printing::kSettingLandscape, pageLayout.orientation() == QPageLayout::Landscape); } else { // QPrinter will handle margins pageSizeInMillimeter = pageLayout.paintRect(QPageLayout::Millimeter); - printSettings->SetInteger(printing::kSettingMarginsType, printing::NO_MARGINS); + printSettings->SetInteger(printing::kSettingMarginsType, (int)printing::mojom::MarginType::kNoMargins); // pageSizeInMillimeter already contains the orientation. printSettings->SetBoolean(printing::kSettingLandscape, false); @@ -261,10 +261,9 @@ bool PrintViewManagerQt::PrintToPDFInternal(const QPageLayout &pageLayout, m_printSettings.reset(createPrintSettingsFromQPageLayout(pageLayout, useCustomMargins)); m_printSettings->SetBoolean(printing::kSettingShouldPrintBackgrounds, - web_contents()->GetRenderViewHost()-> - GetWebkitPreferences().should_print_backgrounds); + web_contents()->GetOrCreateWebPreferences().should_print_backgrounds); m_printSettings->SetInteger(printing::kSettingColor, - printInColor ? printing::COLOR : printing::GRAYSCALE); + int(printInColor ? printing::mojom::ColorModel::kColor : printing::mojom::ColorModel::kGrayscale)); if (web_contents()->IsCrashed()) return false; @@ -356,7 +355,7 @@ void PrintViewManagerQt::OnRequestPrintPreview( } void PrintViewManagerQt::OnMetafileReadyForPrinting(content::RenderFrameHost* rfh, - const PrintHostMsg_DidPreviewDocument_Params& params, + const printing::mojom::DidPreviewDocumentParams& params, const PrintHostMsg_PreviewIds &ids) { StopWorker(params.document_cookie); @@ -369,11 +368,11 @@ void PrintViewManagerQt::OnMetafileReadyForPrinting(content::RenderFrameHost* rf resetPdfState(); if (!pdf_print_callback.is_null()) { - QSharedPointer data_array = GetStdVectorFromHandle(params.content.metafile_data_region); + QSharedPointer data_array = GetStdVectorFromHandle(params.content->metafile_data_region); base::PostTask(FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(pdf_print_callback, data_array)); } else { - scoped_refptr data_bytes = GetBytesFromHandle(params.content.metafile_data_region); + scoped_refptr data_bytes = GetBytesFromHandle(params.content->metafile_data_region); base::PostTask(FROM_HERE, {base::ThreadPool(), base::MayBlock()}, base::BindOnce(&SavePdfFile, data_bytes, pdfOutputPath, pdf_save_callback)); } @@ -411,7 +410,7 @@ void PrintViewManagerQt::RenderProcessGone(base::TerminationStatus status) } void PrintViewManagerQt::OnDidPreviewPage(content::RenderFrameHost* rfh, - const PrintHostMsg_DidPreviewPage_Params& params, + const printing::mojom::DidPreviewPageParams ¶ms, const PrintHostMsg_PreviewIds& ids) { // just consume the message, this is just for sending 'page-preview-ready' for webui diff --git a/src/core/printing/print_view_manager_qt.h b/src/core/printing/print_view_manager_qt.h index 06c2f47ea..1c1b7558c 100644 --- a/src/core/printing/print_view_manager_qt.h +++ b/src/core/printing/print_view_manager_qt.h @@ -62,7 +62,6 @@ #include struct PrintHostMsg_RequestPrintPreview_Params; -struct PrintHostMsg_DidPreviewDocument_Params; namespace content { class RenderViewHost; @@ -122,12 +121,12 @@ protected: void OnDidShowPrintDialog(); void OnRequestPrintPreview(const PrintHostMsg_RequestPrintPreview_Params&); void OnMetafileReadyForPrinting(content::RenderFrameHost* rfh, - const PrintHostMsg_DidPreviewDocument_Params& params, + const printing::mojom::DidPreviewDocumentParams& params, const PrintHostMsg_PreviewIds &ids); void OnSetupScriptedPrintPreview(content::RenderFrameHost* rfh, IPC::Message* reply_msg); void OnDidPreviewPage(content::RenderFrameHost* rfh, - const PrintHostMsg_DidPreviewPage_Params& params, + const printing::mojom::DidPreviewPageParams& params, const PrintHostMsg_PreviewIds& ids); void OnShowScriptedPrintPreview(content::RenderFrameHost* rfh, bool source_is_modifiable); diff --git a/src/core/printing/printing_message_filter_qt.cpp b/src/core/printing/printing_message_filter_qt.cpp index 5b9228d20..c95e334d8 100644 --- a/src/core/printing/printing_message_filter_qt.cpp +++ b/src/core/printing/printing_message_filter_qt.cpp @@ -106,7 +106,7 @@ void PrintingMessageFilterQt::OnGetDefaultPrintSettings(IPC::Message* reply_msg) printing::PrinterQuery::GetSettingsAskParam::DEFAULTS, 0, false, - printing::DEFAULT_MARGINS, + printing::mojom::MarginType::kDefaultMargins, false, false, base::BindOnce(&PrintingMessageFilterQt::OnGetDefaultPrintSettingsReply, @@ -115,28 +115,25 @@ void PrintingMessageFilterQt::OnGetDefaultPrintSettings(IPC::Message* reply_msg) reply_msg)); } -void PrintingMessageFilterQt::OnGetDefaultPrintSettingsReply( - std::unique_ptr printer_query, - IPC::Message* reply_msg) { - PrintMsg_Print_Params params; - if (!printer_query.get() || - printer_query->last_status() != printing::PrintingContext::OK) { - params.Reset(); - } else { - RenderParamsFromPrintSettings(printer_query->settings(), ¶ms); - params.document_cookie = printer_query->cookie(); - } - PrintHostMsg_GetDefaultPrintSettings::WriteReplyParams(reply_msg, params); - Send(reply_msg); - // If printing was enabled. - if (printer_query.get()) { - // If user hasn't cancelled. - if (printer_query->cookie() && printer_query->settings().dpi()) { - queue_->QueuePrinterQuery(std::move(printer_query)); - } else { - printer_query->StopWorker(); +void PrintingMessageFilterQt::OnGetDefaultPrintSettingsReply(std::unique_ptr printer_query, + IPC::Message *reply_msg) +{ + printing::mojom::PrintParams params; + if (printer_query && printer_query->last_status() == printing::PrintingContext::OK) { + printing::RenderParamsFromPrintSettings(printer_query->settings(), ¶ms); + params.document_cookie = printer_query->cookie(); + } + PrintHostMsg_GetDefaultPrintSettings::WriteReplyParams(reply_msg, params); + Send(reply_msg); + // If printing was enabled. + if (printer_query) { + // If user hasn't cancelled. + if (printer_query->cookie() && printer_query->settings().dpi()) { + queue_->QueuePrinterQuery(std::move(printer_query)); + } else { + printer_query->StopWorker(); + } } - } } void PrintingMessageFilterQt::OnScriptedPrint( diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index 5bf8eb266..68e674f01 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -160,7 +160,7 @@ BrowsingDataRemoverObserverQt::BrowsingDataRemoverObserverQt(ProfileIODataQt *pr { } -void BrowsingDataRemoverObserverQt::OnBrowsingDataRemoverDone() +void BrowsingDataRemoverObserverQt::OnBrowsingDataRemoverDone(uint64_t) { Q_ASSERT(m_profileIOData->m_clearHttpCacheInProgress); m_profileIOData->removeBrowsingDataRemoverObserver(); diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h index 3eb3856df..f2a6a7822 100644 --- a/src/core/profile_io_data_qt.h +++ b/src/core/profile_io_data_qt.h @@ -70,7 +70,7 @@ class BrowsingDataRemoverObserverQt : public content::BrowsingDataRemover::Obser public: BrowsingDataRemoverObserverQt(ProfileIODataQt *profileIOData); - void OnBrowsingDataRemoverDone() override; + void OnBrowsingDataRemoverDone(uint64_t) override; private: ProfileIODataQt *m_profileIOData; diff --git a/src/core/qtwebengine_sources.gni b/src/core/qtwebengine_sources.gni index cbe51d052..39c670224 100644 --- a/src/core/qtwebengine_sources.gni +++ b/src/core/qtwebengine_sources.gni @@ -181,6 +181,7 @@ source_set("qtwebengine_sources") { deps += [ "//pdf", "//pdf:buildflags", + "//pdf:pdf_ppapi", "//components/pdf/browser:browser", "//components/pdf/renderer:renderer", "//components/printing/browser", diff --git a/src/core/quota_permission_context_qt.cpp b/src/core/quota_permission_context_qt.cpp index c7f1e856c..549414d33 100644 --- a/src/core/quota_permission_context_qt.cpp +++ b/src/core/quota_permission_context_qt.cpp @@ -61,7 +61,7 @@ void QuotaPermissionContextQt::RequestQuotaPermission(const StorageQuotaParams & if (params.storage_type != blink::mojom::StorageType::kPersistent) { // For now we only support requesting quota with this interface // for Persistent storage type. - std::move(callback).Run(QUOTA_PERMISSION_RESPONSE_DISALLOW); + dispatchCallbackOnIOThread(std::move(callback), QUOTA_PERMISSION_RESPONSE_DISALLOW); return; } @@ -74,16 +74,26 @@ void QuotaPermissionContextQt::RequestQuotaPermission(const StorageQuotaParams & } RenderFrameHost *renderFrameHost = RenderFrameHost::FromID(render_process_id, params.render_frame_id); - if (!renderFrameHost) + if (!renderFrameHost) { + LOG(WARNING) << "Attempt to request quota from frameless renderer: " + << render_process_id << "," << params.render_frame_id; + dispatchCallbackOnIOThread(std::move(callback), QUOTA_PERMISSION_RESPONSE_CANCELLED); return; + } WebContents *webContents = WebContents::FromRenderFrameHost(renderFrameHost); - if (!webContents) + if (!webContents) { + LOG(ERROR) << "Attempt to request quota from frame missing webcontents"; + dispatchCallbackOnIOThread(std::move(callback), QUOTA_PERMISSION_RESPONSE_CANCELLED); return; + } WebContentsAdapterClient *client = WebContentsViewQt::from(static_cast(webContents)->GetView())->client(); - if (!client) + if (!client) { + LOG(ERROR) << "Attempt to request quota from content missing webcontents client"; + dispatchCallbackOnIOThread(std::move(callback), QUOTA_PERMISSION_RESPONSE_CANCELLED); return; + } QWebEngineQuotaRequest request( QSharedPointer::create(this, params, std::move(callback))); diff --git a/src/core/quota_permission_context_qt.h b/src/core/quota_permission_context_qt.h index 6d678c92a..528928c1a 100644 --- a/src/core/quota_permission_context_qt.h +++ b/src/core/quota_permission_context_qt.h @@ -42,8 +42,6 @@ #include "content/public/browser/quota_permission_context.h" -#include // Needed for override - namespace QtWebEngineCore { class QuotaPermissionContextQt : public content::QuotaPermissionContext { diff --git a/src/core/quota_request_controller_impl.cpp b/src/core/quota_request_controller_impl.cpp index 514b85954..ea2526d45 100644 --- a/src/core/quota_request_controller_impl.cpp +++ b/src/core/quota_request_controller_impl.cpp @@ -55,17 +55,18 @@ QuotaRequestControllerImpl::QuotaRequestControllerImpl(QuotaPermissionContextQt QuotaRequestControllerImpl::~QuotaRequestControllerImpl() { - reject(); + if (m_callback) + m_context->dispatchCallbackOnIOThread(std::move(m_callback), content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_CANCELLED); } void QuotaRequestControllerImpl::accepted() { - m_context->dispatchCallbackOnIOThread(std::move(m_callback), QuotaPermissionContextQt::QUOTA_PERMISSION_RESPONSE_ALLOW); + m_context->dispatchCallbackOnIOThread(std::move(m_callback), content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_ALLOW); } void QuotaRequestControllerImpl::rejected() { - m_context->dispatchCallbackOnIOThread(std::move(m_callback), QuotaPermissionContextQt::QUOTA_PERMISSION_RESPONSE_DISALLOW); + m_context->dispatchCallbackOnIOThread(std::move(m_callback), content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_DISALLOW); } } // namespace QtWebEngineCore diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 93281f4c9..a76896c00 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -260,9 +260,9 @@ private: const QTouchEvent::TouchPoint& touchPoint(size_t i) const { return touchPoints[i].second; } }; -static content::ScreenInfo screenInfoFromQScreen(QScreen *screen) +static blink::ScreenInfo screenInfoFromQScreen(QScreen *screen) { - content::ScreenInfo r; + blink::ScreenInfo r; if (screen) { r.device_scale_factor = screen->devicePixelRatio(); r.depth_per_component = 8; @@ -758,7 +758,7 @@ void RenderWidgetHostViewQt::DisplayTooltipText(const base::string16 &tooltip_te m_adapterClient->setToolTip(toQt(tooltip_text)); } -void RenderWidgetHostViewQt::GetScreenInfo(content::ScreenInfo *results) +void RenderWidgetHostViewQt::GetScreenInfo(blink::ScreenInfo *results) { *results = m_screenInfo; } @@ -1048,7 +1048,7 @@ void RenderWidgetHostViewQt::visualPropertiesChanged() m_windowRectInDips = toGfx(m_delegate->windowGeometry()); QWindow *window = m_delegate->window(); - content::ScreenInfo oldScreenInfo = m_screenInfo; + blink::ScreenInfo oldScreenInfo = m_screenInfo; m_screenInfo = screenInfoFromQScreen(window ? window->screen() : nullptr); if (m_viewRectInDips != oldViewRect || m_windowRectInDips != oldWindowRect) diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index d69b86cd9..496a643ad 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -158,7 +158,7 @@ public: viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(const cc::RenderFrameMetadata &metadata) override; void OnDidUpdateVisualPropertiesComplete(const cc::RenderFrameMetadata &metadata); - void GetScreenInfo(content::ScreenInfo *results) override; + void GetScreenInfo(blink::ScreenInfo *results) override; gfx::Rect GetBoundsInRootWindow() override; void ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, blink::mojom::InputEventResultState ack_result) override; @@ -252,7 +252,7 @@ private: gfx::Rect m_viewRectInDips; // Geometry of the window, including frame, in screen DIPs. gfx::Rect m_windowRectInDips; - content::ScreenInfo m_screenInfo; + blink::ScreenInfo m_screenInfo; scoped_refptr m_taskRunner; diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 4a420c14e..818b3c8f4 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -50,7 +50,6 @@ #include "components/cdm/renderer/external_clear_key_key_system_properties.h" #include "components/cdm/renderer/widevine_key_system_properties.h" #include "components/error_page/common/error.h" -#include "components/error_page/common/error_page_params.h" #include "components/error_page/common/localized_error.h" #include "components/network_hints/renderer/web_prescient_networking_impl.h" #if QT_CONFIG(webengine_printing_and_pdf) @@ -103,7 +102,6 @@ #include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/connector.h" -#include "services/service_manager/public/cpp/service_binding.h" #include "components/grit/components_resources.h" @@ -304,8 +302,7 @@ void ContentRendererClientQt::GetNavigationErrorStringsInternal(content::RenderF error_page::LocalizedError::GetPageState( error.reason(), error.domain(), error.url(), isPost, false, error.stale_copy_in_cache(), false, - RenderConfiguration::is_incognito_process(), false, false, false, locale, - std::unique_ptr()); + RenderConfiguration::is_incognito_process(), false, false, false, locale); resourceId = IDR_NET_ERROR_HTML; @@ -389,13 +386,6 @@ content::BrowserPluginDelegate *ContentRendererClientQt::CreateBrowserPluginDele #endif } -void ContentRendererClientQt::BindReceiverOnMainThread(mojo::GenericPendingReceiver receiver) -{ - std::string interface_name = *receiver.interface_name(); - auto pipe = receiver.PassPipe(); - m_registry.TryBindInterface(interface_name, &pipe); -} - void ContentRendererClientQt::GetInterface(const std::string &interface_name, mojo::ScopedMessagePipeHandle interface_pipe) { content::RenderThread::Get()->BindHostReceiver(mojo::GenericPendingReceiver(interface_name, std::move(interface_pipe))); diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index 2e2643f6d..bac723a4c 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -127,7 +127,6 @@ public: GURL *new_url, bool *attach_same_site_cookies) override; - void BindReceiverOnMainThread(mojo::GenericPendingReceiver receiver) override; bool RequiresWebComponentsV0(const GURL &url) override; #if BUILDFLAG(ENABLE_PLUGINS) @@ -154,8 +153,6 @@ private: QScopedPointer m_spellCheck; #endif - service_manager::BinderRegistry m_registry; - DISALLOW_COPY_AND_ASSIGN(ContentRendererClientQt); }; diff --git a/src/core/renderer/render_frame_observer_qt.cpp b/src/core/renderer/render_frame_observer_qt.cpp index cc01acec6..fd900c292 100644 --- a/src/core/renderer/render_frame_observer_qt.cpp +++ b/src/core/renderer/render_frame_observer_qt.cpp @@ -77,7 +77,7 @@ void RenderFrameObserverQt::DidCreatePepperPlugin(content::RendererPpapiHost *ho } #endif -void RenderFrameObserverQt::FrameDetached() +void RenderFrameObserverQt::WillDetach() { m_isFrameDetached = true; } diff --git a/src/core/renderer/render_frame_observer_qt.h b/src/core/renderer/render_frame_observer_qt.h index 6bdf4ad23..237185f8c 100644 --- a/src/core/renderer/render_frame_observer_qt.h +++ b/src/core/renderer/render_frame_observer_qt.h @@ -68,7 +68,7 @@ public: void DidCreatePepperPlugin(content::RendererPpapiHost *host) override; #endif void OnDestruct() override; - void FrameDetached() override; + void WillDetach() override; bool isFrameDetached() const; diff --git a/src/core/renderer/user_resource_controller.cpp b/src/core/renderer/user_resource_controller.cpp index 0c807d07a..c7b220fe6 100644 --- a/src/core/renderer/user_resource_controller.cpp +++ b/src/core/renderer/user_resource_controller.cpp @@ -153,7 +153,7 @@ private: void DidCommitProvisionalLoad(ui::PageTransition transition) override; void DidFinishDocumentLoad() override; void DidFinishLoad() override; - void FrameDetached() override; + void WillDetach() override; void OnDestruct() override; void AddScript(const QtWebEngineCore::UserScriptData &data) override; void RemoveScript(const QtWebEngineCore::UserScriptData &data) override; @@ -274,7 +274,7 @@ void UserResourceController::RenderFrameObserverHelper::DidFinishLoad() QtWebEngineCore::UserScriptData::AfterLoad)); } -void UserResourceController::RenderFrameObserverHelper::FrameDetached() +void UserResourceController::RenderFrameObserverHelper::WillDetach() { m_runner.reset(); } diff --git a/src/core/resource_bundle_qt.cpp b/src/core/resource_bundle_qt.cpp index dbcd66f26..d31b4d2e4 100644 --- a/src/core/resource_bundle_qt.cpp +++ b/src/core/resource_bundle_qt.cpp @@ -42,7 +42,7 @@ #include "base/metrics/histogram_macros.h" #include "base/notreached.h" #include "content/public/common/content_switches.h" -#include "services/service_manager/sandbox/switches.h" +#include "sandbox/policy/switches.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/data_pack.h" #include "ui/base/resource/resource_bundle.h" @@ -77,7 +77,7 @@ bool ResourceBundle::LocaleDataPakExists(const std::string& locale) #if defined(OS_LINUX) base::CommandLine *parsed_command_line = base::CommandLine::ForCurrentProcess(); std::string process_type = parsed_command_line->GetSwitchValueASCII(switches::kProcessType); - bool no_sandbox = parsed_command_line->HasSwitch(service_manager::switches::kNoSandbox); + bool no_sandbox = parsed_command_line->HasSwitch(sandbox::policy::switches::kNoSandbox); if (process_type == switches::kRendererProcess && !no_sandbox) { // The Renderer Process is sandboxed thus only one locale is available in it. // The particular one is passed by the --lang command line option. diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h index f09fd3fa3..1152ed9a9 100644 --- a/src/core/type_conversion.h +++ b/src/core/type_conversion.h @@ -52,7 +52,6 @@ #include #include "base/files/file_path.h" #include "base/time/time.h" -#include "content/public/common/file_chooser_file_info.h" #include "favicon_manager.h" #include "net/cookies/canonical_cookie.h" #include "third_party/blink/public/mojom/favicon/favicon_url.mojom-forward.h" @@ -261,43 +260,6 @@ inline base::FilePath toFilePath(const QString &str) return base::FilePath(toFilePathString(str)); } -template -inline T fileListingHelper(const QString &) -// Clang is still picky about this though it should be supported eventually. -// See http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#941 -#ifndef Q_CC_CLANG -= delete; -#else -{ return T(); } -#endif - -template <> -inline content::FileChooserFileInfo fileListingHelper(const QString &file) -{ - content::FileChooserFileInfo choose_file; - base::FilePath fp(toFilePath(file)); - choose_file.file_path = fp; - choose_file.display_name = fp.BaseName().value(); - return choose_file; -} - -template <> -inline base::FilePath fileListingHelper(const QString &file) -{ - return base::FilePath(toFilePathString(file)); -} - - -template -inline std::vector toVector(const QStringList &fileList) -{ - std::vector selectedFiles; - selectedFiles.reserve(fileList.size()); - for (const QString &file : fileList) - selectedFiles.push_back(fileListingHelper(file)); - return selectedFiles; -} - int flagsFromModifiers(Qt::KeyboardModifiers modifiers); inline QStringList fromVector(const std::vector &vector) diff --git a/src/core/user_script.cpp b/src/core/user_script.cpp index 3f6721eca..f4daaf7c6 100644 --- a/src/core/user_script.cpp +++ b/src/core/user_script.cpp @@ -234,10 +234,10 @@ void UserScript::parseMetadataHeader() line = base::StringPiece(script_text.data() + line_start, line_end - line_start); if (!in_metadata) { - if (line.starts_with(kUserScriptBegin)) + if (base::StartsWith(line, kUserScriptBegin)) in_metadata = true; } else { - if (line.starts_with(kUserScriptEnd)) + if (base::StartsWith(line, kUserScriptEnd)) break; std::string value; diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 44c4b5f37..df98337a1 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -62,6 +62,7 @@ #include "base/command_line.h" #include "base/run_loop.h" +#include "base/task/current_thread.h" #include "base/task/post_task.h" #include "base/task/sequence_manager/sequence_manager_impl.h" #include "base/task/sequence_manager/thread_controller_with_message_pump_impl.h" @@ -1057,13 +1058,10 @@ void WebContentsAdapter::runJavaScript(const QString &javaScript, quint32 worldI content::RenderViewHost *rvh = m_webContents->GetRenderViewHost(); Q_ASSERT(rvh); // static_cast(rvh->GetMainFrame())->NotifyUserActivation(); - if (worldId == 0) { + if (worldId == 0) rvh->GetMainFrame()->ExecuteJavaScript(toString16(javaScript), base::NullCallback()); - return; - } - - content::RenderFrameHost::JavaScriptResultCallback callback = base::BindOnce(&callbackOnEvaluateJS, m_adapterClient, CallbackDirectory::NoCallbackId); - rvh->GetMainFrame()->ExecuteJavaScriptInIsolatedWorld(toString16(javaScript), std::move(callback), worldId); + else + rvh->GetMainFrame()->ExecuteJavaScriptInIsolatedWorld(toString16(javaScript), base::NullCallback(), worldId); } quint64 WebContentsAdapter::runJavaScriptCallbackResult(const QString &javaScript, quint32 worldId) @@ -1094,10 +1092,10 @@ quint64 WebContentsAdapter::fetchDocumentInnerText() return m_nextRequestId++; } -void WebContentsAdapter::updateWebPreferences(const content::WebPreferences & webPreferences) +void WebContentsAdapter::updateWebPreferences(const content::WebPreferences &webPreferences) { CHECK_INITIALIZED(); - m_webContents->GetRenderViewHost()->UpdateWebkitPreferences(webPreferences); + m_webContents->SetWebPreferences(webPreferences); // In case of updating preferences during navigation, there might be a pending RVH what will // be active on successful navigation. @@ -1105,7 +1103,7 @@ void WebContentsAdapter::updateWebPreferences(const content::WebPreferences & we if (pendingRFH) { content::RenderViewHost *pendingRVH = pendingRFH->GetRenderViewHost(); Q_ASSERT(pendingRVH); - pendingRVH->UpdateWebkitPreferences(webPreferences); + static_cast(pendingRVH)->SendWebPreferencesToRenderer(); } } @@ -1528,7 +1526,7 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD } { - base::MessageLoopCurrent::ScopedNestableTaskAllower allow; + base::CurrentThread::ScopedNestableTaskAllower allow; drag->exec(allowedActions); } @@ -1672,7 +1670,7 @@ void WebContentsAdapter::waitForUpdateDragActionCalled() const qint64 timeout = 3000; QElapsedTimer t; t.start(); - auto seqMan = base::MessageLoopCurrent::GetCurrentSequenceManagerImpl(); + auto seqMan = base::CurrentThread::GetCurrentSequenceManagerImpl(); base::MessagePump::Delegate *delegate = static_cast( seqMan->controller_.get()); @@ -2055,6 +2053,6 @@ ASSERT_ENUMS_MATCH(ReferrerPolicy::OriginWhenCrossOrigin, network::mojom::Referr //ASSERT_ENUMS_MATCH(ReferrerPolicy::NoReferrerWhenDowngradeOriginWhenCrossOrigin, network::mojom::ReferrerPolicy::kNoReferrerWhenDowngradeOriginWhenCrossOrigin) ASSERT_ENUMS_MATCH(ReferrerPolicy::SameOrigin, network::mojom::ReferrerPolicy::kSameOrigin) ASSERT_ENUMS_MATCH(ReferrerPolicy::StrictOrigin, network::mojom::ReferrerPolicy::kStrictOrigin) -ASSERT_ENUMS_MATCH(ReferrerPolicy::Last, network::mojom::ReferrerPolicy::kLast) +ASSERT_ENUMS_MATCH(ReferrerPolicy::Last, network::mojom::ReferrerPolicy::kMaxValue) } // namespace QtWebEngineCore diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 436906072..6fc94a8a8 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -604,8 +604,10 @@ ASSERT_ENUMS_MATCH(FilePickerController::OpenMultiple, blink::mojom::FileChooser ASSERT_ENUMS_MATCH(FilePickerController::UploadFolder, blink::mojom::FileChooserParams::Mode::kUploadFolder) ASSERT_ENUMS_MATCH(FilePickerController::Save, blink::mojom::FileChooserParams::Mode::kSave) +extern FilePickerController *createFilePickerController(FilePickerController::FileChooserMode mode, scoped_refptr listener, const QString &defaultFileName, const QStringList &acceptedMimeTypes, QObject *parent = nullptr); + void WebContentsDelegateQt::RunFileChooser(content::RenderFrameHost * /*frameHost*/, - std::unique_ptr listener, + scoped_refptr listener, const blink::mojom::FileChooserParams& params) { QStringList acceptedMimeTypes; @@ -613,8 +615,8 @@ void WebContentsDelegateQt::RunFileChooser(content::RenderFrameHost * /*frameHos for (std::vector::const_iterator it = params.accept_types.begin(); it < params.accept_types.end(); ++it) acceptedMimeTypes.append(toQt(*it)); - m_filePickerController.reset(new FilePickerController(static_cast(params.mode), - std::move(listener), toQt(params.default_file_name.value()), acceptedMimeTypes)); + m_filePickerController.reset(createFilePickerController(static_cast(params.mode), + listener, toQt(params.default_file_name.value()), acceptedMimeTypes)); // Defer the call to not block base::MessageLoop::RunTask with modal dialogs. QTimer::singleShot(0, [this] () { @@ -795,9 +797,9 @@ bool WebContentsDelegateQt::CheckMediaAccessPermission(content::RenderFrameHost } } -void WebContentsDelegateQt::RegisterProtocolHandler(content::WebContents *webContents, const std::string &protocol, const GURL &url, bool) +void WebContentsDelegateQt::RegisterProtocolHandler(content::RenderFrameHost *frameHost, const std::string &protocol, const GURL &url, bool) { - content::BrowserContext *context = webContents->GetBrowserContext(); + content::BrowserContext *context = frameHost->GetBrowserContext(); if (context->IsOffTheRecord()) return; @@ -810,13 +812,13 @@ void WebContentsDelegateQt::RegisterProtocolHandler(content::WebContents *webCon return; QWebEngineRegisterProtocolHandlerRequest request( - QSharedPointer::create(webContents, handler)); + QSharedPointer::create(content::WebContents::FromRenderFrameHost(frameHost), handler)); m_viewClient->runRegisterProtocolHandlerRequest(std::move(request)); } -void WebContentsDelegateQt::UnregisterProtocolHandler(content::WebContents *webContents, const std::string &protocol, const GURL &url, bool) +void WebContentsDelegateQt::UnregisterProtocolHandler(content::RenderFrameHost *frameHost, const std::string &protocol, const GURL &url, bool) { - content::BrowserContext* context = webContents->GetBrowserContext(); + content::BrowserContext* context = frameHost->GetBrowserContext(); if (context->IsOffTheRecord()) return; diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 56a4393a6..1b071b7d9 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -133,7 +133,7 @@ public: void ExitFullscreenModeForTab(content::WebContents*) override; bool IsFullscreenForTabOrPending(const content::WebContents* web_contents) override; void RunFileChooser(content::RenderFrameHost* render_frame_host, - std::unique_ptr listener, + scoped_refptr listener, const blink::mojom::FileChooserParams& params) override; bool DidAddMessageToConsole(content::WebContents *source, blink::mojom::ConsoleMessageLevel log_level, const base::string16 &message, int32_t line_no, const base::string16 &source_id) override; @@ -146,8 +146,8 @@ public: void RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target) override; void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) override; bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host, const GURL& security_origin, blink::mojom::MediaStreamType type) override; - void RegisterProtocolHandler(content::WebContents* web_contents, const std::string& protocol, const GURL& url, bool user_gesture) override; - void UnregisterProtocolHandler(content::WebContents* web_contents, const std::string& protocol, const GURL& url, bool user_gesture) override; + void RegisterProtocolHandler(content::RenderFrameHost* frame_host, const std::string& protocol, const GURL& url, bool user_gesture) override; + void UnregisterProtocolHandler(content::RenderFrameHost* frame_host, const std::string& protocol, const GURL& url, bool user_gesture) override; bool TakeFocus(content::WebContents *source, bool reverse) override; void ContentsZoomChange(bool zoom_in) override; diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 3696e4865..e451ed547 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -88,10 +88,10 @@ #include "mojo/core/embedder/embedder.h" #include "net/base/port_util.h" #include "ppapi/buildflags/buildflags.h" +#include "sandbox/policy/switches.h" #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/network_switches.h" #include "services/network/public/mojom/network_context.mojom.h" -#include "services/service_manager/sandbox/switches.h" #include "services/tracing/public/cpp/trace_startup.h" #include "services/tracing/public/cpp/tracing_features.h" #include "third_party/blink/public/common/features.h" @@ -585,10 +585,10 @@ WebEngineContext::WebEngineContext() bool disable_sandbox = qEnvironmentVariableIsSet(kDisableSandboxEnv); if (!disable_sandbox) { #if defined(Q_OS_LINUX) - parsedCommandLine->AppendSwitch(service_manager::switches::kDisableSetuidSandbox); + parsedCommandLine->AppendSwitch(sandbox::policy::switches::kDisableSetuidSandbox); #endif } else { - parsedCommandLine->AppendSwitch(service_manager::switches::kNoSandbox); + parsedCommandLine->AppendSwitch(sandbox::policy::switches::kNoSandbox); qInfo() << "Sandboxing disabled by user."; } diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index 99369e57f..2d710322e 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -45,9 +45,10 @@ #include "base/files/file_util.h" #include "components/spellcheck/spellcheck_buildflags.h" #include "content/public/common/content_paths.h" +#include "sandbox/policy/switches.h" #include "ui/base/ui_base_paths.h" #include "ui/base/ui_base_switches.h" -#include "services/service_manager/sandbox/switches.h" + #include "type_conversion.h" #include @@ -184,7 +185,7 @@ QString subProcessPath() #if defined(OS_WIN) base::CommandLine *parsedCommandLine = base::CommandLine::ForCurrentProcess(); - if (!parsedCommandLine->HasSwitch(service_manager::switches::kNoSandbox)) { + if (!parsedCommandLine->HasSwitch(sandbox::policy::switches::kNoSandbox)) { if (WebEngineLibraryInfo::isUNCPath(processPath) || WebEngineLibraryInfo::isRemoteDrivePath(processPath)) qCritical("Can not launch QtWebEngineProcess from network path if sandbox is enabled: %s.", processPath.toUtf8().constData()); } diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 72311f1a8..f6e4e9f9b 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -2218,7 +2218,7 @@ QWebEnginePage *QWebEnginePage::createWindow(WebWindowType type) if (newView) return newView->page(); } - return 0; + return nullptr; } /*! diff --git a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp index ac38e2ed2..ec88fc581 100644 --- a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp +++ b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp @@ -302,7 +302,7 @@ void tst_QWebEngineDownloadItem::downloadLink_data() /* fileMimeTypeDeclared */ << QByteArrayLiteral("text/plain") /* fileMimeTypeDetected */ << QByteArrayLiteral("text/plain") /* fileDisposition */ << QByteArrayLiteral("") - /* fileHasReferer */ << false // crbug.com/455987 + /* fileHasReferer */ << true /* fileAction */ << FileIsDownloaded; // ... same with the content disposition header save for the download type. @@ -326,7 +326,7 @@ void tst_QWebEngineDownloadItem::downloadLink_data() /* fileMimeTypeDeclared */ << QByteArrayLiteral("text/plain") /* fileMimeTypeDetected */ << QByteArrayLiteral("text/plain") /* fileDisposition */ << QByteArrayLiteral("attachment") - /* fileHasReferer */ << false // crbug.com/455987 + /* fileHasReferer */ << true /* fileAction */ << FileIsDownloaded; // The file's extension has no effect. diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index d7361d9f0..d8089f136 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -521,7 +521,7 @@ void tst_QWebEnginePage::consoleOutput() class TestPage : public QWebEnginePage { Q_OBJECT public: - TestPage(QObject* parent = 0) : QWebEnginePage(parent) + TestPage(QObject *parent = nullptr) : QWebEnginePage(parent) { connect(this, SIGNAL(geometryChangeRequested(QRect)), this, SLOT(slotGeometryChangeRequested(QRect))); } @@ -1714,12 +1714,15 @@ void tst_QWebEnginePage::savePage() void tst_QWebEnginePage::openWindowDefaultSize() { TestPage page; + QSignalSpy spyFinished(&page, &QWebEnginePage::loadFinished); QSignalSpy windowCreatedSpy(&page, SIGNAL(windowCreated())); QWebEngineView view; page.setView(&view); + page.settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true); + page.setUrl(QUrl("about:blank")); view.show(); + QTRY_COMPARE(spyFinished.count(), 1); - page.settings()->setAttribute(QWebEngineSettings::JavascriptCanOpenWindows, true); // Open a default window. page.runJavaScript("window.open()"); QTRY_COMPARE(windowCreatedSpy.count(), 1); @@ -4703,7 +4706,10 @@ void tst_QWebEnginePage::audioMuted() void tst_QWebEnginePage::closeContents() { TestPage page; + QSignalSpy spyFinished(&page, &QWebEnginePage::loadFinished); QSignalSpy windowCreatedSpy(&page, &TestPage::windowCreated); + page.setUrl(QUrl("about:blank")); + QTRY_COMPARE(spyFinished.count(), 1); page.runJavaScript("var dialog = window.open('', '', 'width=100, height=100');"); QTRY_COMPARE(windowCreatedSpy.count(), 1); diff --git a/tools/scripts/git_submodule.py b/tools/scripts/git_submodule.py index edaed1ed2..43a652b11 100644 --- a/tools/scripts/git_submodule.py +++ b/tools/scripts/git_submodule.py @@ -47,6 +47,7 @@ class DEPSParser: def __init__(self): self.global_scope = { 'Var': lambda var_name: '{%s}' % var_name, + 'Str': str, 'deps_os': {}, } self.local_scope = {} @@ -229,8 +230,8 @@ class Submodule: # supermodule. if self.topmost_supermodule_path_prefix: if not os.path.isdir(self.path): - print '-- skipping ' + self.path + ' as dir has been stripped. --' - return + print '-- creating ' + self.path + ' as dir is missing. --' + os.makedirs(self.path) os.chdir(self.topmost_supermodule_path_prefix) if os.path.isdir(self.path): diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py index 11a04720a..7f1ae2b2b 100755 --- a/tools/scripts/take_snapshot.py +++ b/tools/scripts/take_snapshot.py @@ -141,6 +141,7 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/android_') or file_path.startswith('third_party/angle/third_party/deqp') or file_path.startswith('third_party/angle/third_party/glmark2') + or file_path.startswith('third_party/angle/third_party/VK-GL-CTS') or file_path.startswith('third_party/angle/third_party/vulkan-validation-layers') or file_path.startswith('third_party/apache-') or file_path.startswith('third_party/arcode-android-sdk') diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index 7d0973bf0..a8ea07786 100644 --- a/tools/scripts/version_resolver.py +++ b/tools/scripts/version_resolver.py @@ -38,8 +38,8 @@ import json import urllib2 import git_submodule as GitSubmodule -chromium_version = '85.0.4183.140' -chromium_branch = '4183' +chromium_version = '86.0.4240.124' +chromium_branch = '4240' ninja_version = 'v1.8.2' json_url = 'http://omahaproxy.appspot.com/all.json' @@ -89,8 +89,6 @@ def readSubmodules(): submodule_dict[sub.path] = sub extradeps_dirs = parser.get_recursedeps() - # Add buildtools submodules - extradeps_dirs.append('buildtools') for extradeps_dir in extradeps_dirs: if extradeps_dir.startswith('src/'): -- cgit v1.2.3