diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-02-23 14:43:14 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-04-15 18:11:44 +0200 |
commit | 027e7e574e7a4488d47cd4133e98d518210b1e56 (patch) | |
tree | c45f05457509b7d99c39a3889119c04c4aee39e3 | |
parent | 2dce0008ce53d27d281ad2dc00eb32d25ae5fc84 (diff) |
Adaptations for Chromium 88
Change-Id: Ie66e95dbb9fbcafe961bb98d5c277f8c32d66b96
Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io>
50 files changed, 241 insertions, 1181 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject d13920f28c2f3922e0cf793996ea33d02b81a0a +Subproject 23f869c7ce3e2b04cb09ddb5719ed96c61026b2 diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json index 5819fb860..0ea575c35 100644 --- a/src/buildtools/configure.json +++ b/src/buildtools/configure.json @@ -238,8 +238,7 @@ }, "headers": [ "vpx/vpx_encoder.h", "vpx/vp8cx.h", "vpx/vpx_image.h" ], "sources": [ - { "type": "pkgConfig", "args": "vpx" }, - "-lvpx" + { "type": "pkgConfig", "args": "vpx >= 1.10.0" } ] } }, diff --git a/src/core/accessibility_tree_formatter_qt.cpp b/src/core/accessibility_tree_formatter_qt.cpp index 51d33534b..e30ebb617 100644 --- a/src/core/accessibility_tree_formatter_qt.cpp +++ b/src/core/accessibility_tree_formatter_qt.cpp @@ -58,18 +58,17 @@ public: explicit AccessibilityTreeFormatterQt(); ~AccessibilityTreeFormatterQt() override; - std::unique_ptr<base::DictionaryValue> BuildAccessibilityTreeForSelector(const content::AccessibilityTreeFormatter::TreeSelector &) - { return nullptr; } - std::unique_ptr<base::DictionaryValue> BuildAccessibilityTreeForWindow(gfx::AcceleratedWidget) override { return nullptr; } std::unique_ptr<base::DictionaryValue> BuildAccessibilityTree(content::BrowserAccessibility *) override; + base::Value BuildTreeForWindow(gfx::AcceleratedWidget hwnd) const override + { + return base::Value{}; + } + base::Value BuildTreeForSelector(const AXTreeSelector &selector) const override + { + return base::Value{}; + } private: - base::FilePath::StringType GetExpectedFileSuffix() override; - const std::string GetAllowEmptyString() override; - 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; std::string ProcessTreeForOutput(const base::DictionaryValue &node, base::DictionaryValue * = nullptr) override; @@ -209,40 +208,10 @@ std::string AccessibilityTreeFormatterQt::ProcessTreeForOutput(const base::Dicti return line + "\n"; } -base::FilePath::StringType AccessibilityTreeFormatterQt::GetExpectedFileSuffix() -{ - return FILE_PATH_LITERAL("-expected-qt.txt"); -} - -const std::string AccessibilityTreeFormatterQt::GetAllowEmptyString() -{ - return "@QT-ALLOW-EMPTY:"; -} - -const std::string AccessibilityTreeFormatterQt::GetAllowString() -{ - return "@QT-ALLOW:"; -} - -const std::string AccessibilityTreeFormatterQt::GetDenyString() -{ - return "@QT-DENY:"; -} - -const std::string AccessibilityTreeFormatterQt::GetDenyNodeString() -{ - return "@QT-DENY-NODE:"; -} - -const std::string AccessibilityTreeFormatterQt::GetRunUntilEventString() -{ - return "@QT-RUN-UNTIL-EVENT:"; -} - #endif // QT_CONFIG(accessibility) // static -std::unique_ptr<AccessibilityTreeFormatter> AccessibilityTreeFormatter::Create() +std::unique_ptr<ui::AXTreeFormatter> AccessibilityTreeFormatter::Create() { #if QT_CONFIG(accessibility) return std::unique_ptr<AccessibilityTreeFormatter>(new AccessibilityTreeFormatterQt()); diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp index 1d635a6e9..2d1d9f1ae 100644 --- a/src/core/browser_accessibility_manager_qt.cpp +++ b/src/core/browser_accessibility_manager_qt.cpp @@ -151,7 +151,7 @@ void BrowserAccessibilityManagerQt::FireGeneratedEvent(ui::AXEventGenerator::Eve BrowserAccessibilityQt *iface = static_cast<BrowserAccessibilityQt*>(node); switch (event_type) { - case ui::AXEventGenerator::Event::VALUE_CHANGED: + case ui::AXEventGenerator::Event::VALUE_IN_TEXT_FIELD_CHANGED: if (iface->role() == QAccessible::EditableText) { QAccessibleTextUpdateEvent event(iface, -1, QString(), QString()); QAccessible::updateAccessibility(&event); diff --git a/src/core/browser_message_filter_qt.cpp b/src/core/browser_message_filter_qt.cpp index 54d6551e4..500644593 100644 --- a/src/core/browser_message_filter_qt.cpp +++ b/src/core/browser_message_filter_qt.cpp @@ -56,11 +56,6 @@ BrowserMessageFilterQt::BrowserMessageFilterQt(int /*render_process_id*/, Profil { } -// The following is based on chrome/browser/plugins/plugin_info_message_filter.cc: -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE.Chromium file. - bool BrowserMessageFilterQt::OnMessageReceived(const IPC::Message& message) { IPC_BEGIN_MESSAGE_MAP(BrowserMessageFilterQt, message) diff --git a/src/core/clipboard_qt.cpp b/src/core/clipboard_qt.cpp index 65e3e90ac..ca222813d 100644 --- a/src/core/clipboard_qt.cpp +++ b/src/core/clipboard_qt.cpp @@ -51,7 +51,6 @@ #include "ui/base/clipboard/custom_data_helper.h" #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/clipboard_constants.h" -#include "ui/base/clipboard/clipboard_data_endpoint.h" #include "ui/base/clipboard/clipboard_format_type.h" #include <QGuiApplication> @@ -107,7 +106,7 @@ Clipboard *Clipboard::Create() namespace QtWebEngineCore { -void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects, std::unique_ptr<ui::ClipboardDataEndpoint> data_src) +void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const ObjectMap &objects, std::unique_ptr<ui::DataTransferEndpoint> data_src) { DCHECK(CalledOnValidThread()); DCHECK(IsSupportedClipboardBuffer(type)); @@ -134,7 +133,7 @@ void ClipboardQt::WritePortableRepresentations(ui::ClipboardBuffer type, const O void ClipboardQt::WritePlatformRepresentations(ui::ClipboardBuffer buffer, std::vector<ui::Clipboard::PlatformRepresentation> platform_representations, - std::unique_ptr<ui::ClipboardDataEndpoint> data_src) + std::unique_ptr<ui::DataTransferEndpoint> data_src) { DCHECK(CalledOnValidThread()); DCHECK(IsSupportedClipboardBuffer(buffer)); @@ -194,7 +193,7 @@ void ClipboardQt::WriteData(const ui::ClipboardFormatType &format, const char *d bool ClipboardQt::IsFormatAvailable(const ui::ClipboardFormatType &format, ui::ClipboardBuffer type, - const ui::ClipboardDataEndpoint *data_dst) const + const ui::DataTransferEndpoint *data_dst) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( type == ui::ClipboardBuffer::kCopyPaste ? QClipboard::Clipboard : QClipboard::Selection); @@ -208,7 +207,7 @@ void ClipboardQt::Clear(ui::ClipboardBuffer type) } void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type, - const ui::ClipboardDataEndpoint *data_dst, + const ui::DataTransferEndpoint *data_dst, std::vector<base::string16> *types) const { if (!types) { @@ -232,7 +231,7 @@ void ClipboardQt::ReadAvailableTypes(ui::ClipboardBuffer type, } void ClipboardQt::ReadText(ui::ClipboardBuffer type, - const ui::ClipboardDataEndpoint *data_dst, + const ui::DataTransferEndpoint *data_dst, base::string16 *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( @@ -242,7 +241,7 @@ void ClipboardQt::ReadText(ui::ClipboardBuffer type, } void ClipboardQt::ReadAsciiText(ui::ClipboardBuffer type, - const ui::ClipboardDataEndpoint *data_dst, + const ui::DataTransferEndpoint *data_dst, std::string *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( @@ -252,7 +251,7 @@ void ClipboardQt::ReadAsciiText(ui::ClipboardBuffer type, } void ClipboardQt::ReadHTML(ui::ClipboardBuffer type, - const ui::ClipboardDataEndpoint *data_dst, + const ui::DataTransferEndpoint *data_dst, base::string16 *markup, std::string *src_url, uint32_t *fragment_start, uint32_t *fragment_end) const { @@ -271,7 +270,7 @@ void ClipboardQt::ReadHTML(ui::ClipboardBuffer type, } void ClipboardQt::ReadRTF(ui::ClipboardBuffer type, - const ui::ClipboardDataEndpoint *data_dst, + const ui::DataTransferEndpoint *data_dst, std::string *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( @@ -283,7 +282,7 @@ void ClipboardQt::ReadRTF(ui::ClipboardBuffer type, } void ClipboardQt::ReadImage(ui::ClipboardBuffer type, - const ui::ClipboardDataEndpoint *data_dst, + const ui::DataTransferEndpoint *data_dst, ReadImageCallback callback) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( @@ -311,7 +310,7 @@ void ClipboardQt::ReadImage(ui::ClipboardBuffer type, } void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type, - const ui::ClipboardDataEndpoint *data_dst, + const ui::DataTransferEndpoint *data_dst, base::string16 *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( @@ -322,13 +321,13 @@ void ClipboardQt::ReadCustomData(ui::ClipboardBuffer clipboard_type, const base: ui::ReadCustomDataForType(customData.constData(), customData.size(), type, result); } -void ClipboardQt::ReadBookmark(const ui::ClipboardDataEndpoint *data_dst, base::string16 *title, std::string *url) const +void ClipboardQt::ReadBookmark(const ui::DataTransferEndpoint *data_dst, base::string16 *title, std::string *url) const { NOTIMPLEMENTED(); } void ClipboardQt::ReadSvg(ui::ClipboardBuffer clipboard_type, - const ui::ClipboardDataEndpoint *, + const ui::DataTransferEndpoint *, base::string16 *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData( @@ -347,7 +346,7 @@ void ClipboardQt::WriteSvg(const char *svg_data, size_t data_len) } void ClipboardQt::ReadData(const ui::ClipboardFormatType &format, - const ui::ClipboardDataEndpoint *data_dst, + const ui::DataTransferEndpoint *data_dst, std::string *result) const { const QMimeData *mimeData = QGuiApplication::clipboard()->mimeData(); @@ -371,7 +370,7 @@ bool ClipboardQt::IsSelectionBufferAvailable() const } #endif -std::vector<base::string16> ClipboardQt::ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::ClipboardDataEndpoint *data_dst) const +std::vector<base::string16> ClipboardQt::ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::DataTransferEndpoint *data_dst) const { // based on ClipboardAura std::vector<base::string16> types; diff --git a/src/core/clipboard_qt.h b/src/core/clipboard_qt.h index b4c9d4c7d..e313f7de8 100644 --- a/src/core/clipboard_qt.h +++ b/src/core/clipboard_qt.h @@ -50,37 +50,37 @@ public: uint64_t GetSequenceNumber(ui::ClipboardBuffer type) const override; bool IsFormatAvailable(const ui::ClipboardFormatType &format, ui::ClipboardBuffer buffer, - const ui::ClipboardDataEndpoint *data_dst) const override; + const ui::DataTransferEndpoint *data_dst) const override; void Clear(ui::ClipboardBuffer type) override; void ReadAvailableTypes(ui::ClipboardBuffer type, - const ui::ClipboardDataEndpoint *data_dst, + const ui::DataTransferEndpoint *data_dst, std::vector<base::string16> *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, + void ReadText(ui::ClipboardBuffer type, const ui::DataTransferEndpoint *data_dst, base::string16 *result) const override; + void ReadAsciiText(ui::ClipboardBuffer type, const ui::DataTransferEndpoint *data_dst, std::string *result) const override; + void ReadHTML(ui::ClipboardBuffer type, const ui::DataTransferEndpoint *data_dst, base::string16 *markup, std::string *src_url, uint32_t *fragment_start, uint32_t *fragment_end) 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 ReadRTF(ui::ClipboardBuffer type, const ui::DataTransferEndpoint *data_dst, std::string *result) const override; + void ReadImage(ui::ClipboardBuffer buffer, const ui::DataTransferEndpoint *data_dst, ReadImageCallback callback) const override; + void ReadCustomData(ui::ClipboardBuffer clipboard_type, const base::string16 &type, const ui::DataTransferEndpoint *data_dst, base::string16 *result) const override; + void ReadBookmark(const ui::DataTransferEndpoint *data_dst, base::string16 *title, std::string *url) const override; + void ReadData(const ui::ClipboardFormatType &format, const ui::DataTransferEndpoint *data_dst, std::string *result) const override; #if defined(USE_OZONE) bool IsSelectionBufferAvailable() const override; #endif void OnPreShutdown() override {} - void ReadSvg(ui::ClipboardBuffer, const ui::ClipboardDataEndpoint *, base::string16 *) const override; + void ReadSvg(ui::ClipboardBuffer, const ui::DataTransferEndpoint *, base::string16 *) const override; void WriteSvg(const char *, size_t) override; - std::vector<base::string16> ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::ClipboardDataEndpoint *data_dst) const override; + std::vector<base::string16> ReadAvailablePlatformSpecificFormatNames(ui::ClipboardBuffer buffer, const ui::DataTransferEndpoint *data_dst) const override; protected: void WritePortableRepresentations( ui::ClipboardBuffer buffer, const ObjectMap &objects, - std::unique_ptr<ui::ClipboardDataEndpoint> data_src) override; + std::unique_ptr<ui::DataTransferEndpoint> data_src) override; void WritePlatformRepresentations( ui::ClipboardBuffer buffer, std::vector<Clipboard::PlatformRepresentation> platform_representations, - std::unique_ptr<ui::ClipboardDataEndpoint> data_src) override; + std::unique_ptr<ui::DataTransferEndpoint> 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/compositor/display_gl_output_surface.cpp b/src/core/compositor/display_gl_output_surface.cpp index 16a925bd4..b44a08452 100644 --- a/src/core/compositor/display_gl_output_surface.cpp +++ b/src/core/compositor/display_gl_output_surface.cpp @@ -279,16 +279,6 @@ unsigned DisplayGLOutputSurface::UpdateGpuFence() return 0; } -scoped_refptr<gpu::GpuTaskSchedulerHelper> DisplayGLOutputSurface::GetGpuTaskSchedulerHelper() -{ - return m_vizContextProvider->GetGpuTaskSchedulerHelper(); -} - -gpu::MemoryTracker *DisplayGLOutputSurface::GetMemoryTracker() -{ - return m_vizContextProvider->GetMemoryTracker(); -} - void DisplayGLOutputSurface::SetUpdateVSyncParametersCallback(viz::UpdateVSyncParametersCallback callback) { m_vizContextProvider->SetUpdateVSyncParametersCallback(std::move(callback)); diff --git a/src/core/compositor/display_gl_output_surface.h b/src/core/compositor/display_gl_output_surface.h index 5c6b1ab23..71856e70b 100644 --- a/src/core/compositor/display_gl_output_surface.h +++ b/src/core/compositor/display_gl_output_surface.h @@ -85,8 +85,6 @@ public: void SetUpdateVSyncParametersCallback(viz::UpdateVSyncParametersCallback callback) override; void SetDisplayTransformHint(gfx::OverlayTransform transform) override; gfx::OverlayTransform GetDisplayTransform() override; - scoped_refptr<gpu::GpuTaskSchedulerHelper> GetGpuTaskSchedulerHelper() override; - gpu::MemoryTracker *GetMemoryTracker() override; // Overridden from Compositor. void swapFrame() override; diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 3bf381a6d..1b8ba26e8 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -44,6 +44,8 @@ #include "chrome/browser/custom_handlers/protocol_handler_registry.h" #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" #include "chrome/browser/tab_contents/form_interaction_tab_helper.h" +#include "components/error_page/common/error.h" +#include "components/error_page/common/localized_error.h" #include "components/navigation_interception/intercept_navigation_throttle.h" #include "components/navigation_interception/navigation_params.h" #include "components/network_hints/browser/simple_network_hints_handler_impl.h" @@ -167,11 +169,6 @@ #include "net/plugin_response_interceptor_url_loader_throttle.h" #endif -#if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) -#include "media/mojo/interfaces/constants.mojom.h" -#include "media/mojo/services/media_service_factory.h" -#endif - #include <QGuiApplication> #include <QStandardPaths> #include <qpa/qplatformnativeinterface.h> @@ -559,13 +556,6 @@ void ContentBrowserClientQt::ExposeInterfacesToRenderer(service_manager::BinderR void ContentBrowserClientQt::RunServiceInstance(const service_manager::Identity &identity, mojo::PendingReceiver<service_manager::mojom::Service> *receiver) { -#if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) - if (identity.name() == media::mojom::kMediaServiceName) { - service_manager::Service::RunAsyncUntilTermination(media::CreateMediaService(std::move(*receiver))); - return; - } -#endif - content::ContentBrowserClient::RunServiceInstance(identity, receiver); } @@ -674,26 +664,11 @@ bool ContentBrowserClientQt::AllowAppCache(const GURL &manifest_url, } content::AllowServiceWorkerResult -ContentBrowserClientQt::AllowServiceWorkerOnIO(const GURL &scope, - const GURL &site_for_cookies, - const base::Optional<url::Origin> & /*top_frame_origin*/, - const GURL & /*script_url*/, - content::ResourceContext *context) -{ - DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - // FIXME: Chrome also checks if javascript is enabled here to check if has been disabled since the service worker - // was started. - return ProfileIODataQt::FromResourceContext(context)->canGetCookies(toQt(site_for_cookies), toQt(scope)) - ? content::AllowServiceWorkerResult::Yes() - : content::AllowServiceWorkerResult::No(); -} - -content::AllowServiceWorkerResult -ContentBrowserClientQt::AllowServiceWorkerOnUI(const GURL &scope, - const GURL &site_for_cookies, - const base::Optional<url::Origin> & /*top_frame_origin*/, - const GURL & /*script_url*/, - content::BrowserContext *context) +ContentBrowserClientQt::AllowServiceWorker(const GURL &scope, + const GURL &site_for_cookies, + const base::Optional<url::Origin> & /*top_frame_origin*/, + const GURL & /*script_url*/, + content::BrowserContext *context) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!context || context->ShutdownStarted()) @@ -905,6 +880,21 @@ bool ContentBrowserClientQt::IsHandledURL(const GURL &url) return url::IsHandledProtocol(url.scheme()); } +bool ContentBrowserClientQt::HasErrorPage(int httpStatusCode, content::WebContents *contents) +{ + if (contents) { + WebEngineSettings *settings = nullptr; + WebContentsDelegateQt *delegate = + static_cast<WebContentsDelegateQt*>(contents->GetDelegate()); + if (delegate) + settings = delegate->webEngineSettings(); + if (settings && !settings->testAttribute(QWebEngineSettings::ErrorPageEnabled)) + return false; + } + // Use an internal error page, if we have one for the status code. + return error_page::LocalizedError::HasStrings(error_page::Error::kHttpErrorDomain, httpStatusCode); +} + std::unique_ptr<content::LoginDelegate> ContentBrowserClientQt::CreateLoginDelegate( const net::AuthChallengeInfo &authInfo, content::WebContents *web_contents, @@ -1044,11 +1034,9 @@ std::vector<base::FilePath> ContentBrowserClientQt::GetNetworkContextsParentDire } void ContentBrowserClientQt::RegisterNonNetworkNavigationURLLoaderFactories(int frame_tree_node_id, - base::UkmSourceId ukm_source_id, - NonNetworkURLLoaderFactoryDeprecatedMap *uniquely_owned_factories, + ukm::SourceIdObj ukm_source_id, NonNetworkURLLoaderFactoryMap *factories) { - Q_UNUSED(uniquely_owned_factories); content::WebContents *web_contents = content::WebContents::FromFrameTreeNodeId(frame_tree_node_id); Profile *profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); ProfileAdapter *profileAdapter = static_cast<ProfileQt *>(profile)->profileAdapter(); @@ -1093,10 +1081,8 @@ void ContentBrowserClientQt::RegisterNonNetworkServiceWorkerUpdateURLLoaderFacto } void ContentBrowserClientQt::RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id, - NonNetworkURLLoaderFactoryDeprecatedMap *uniquely_owned_factories, NonNetworkURLLoaderFactoryMap *factories) { - Q_UNUSED(uniquely_owned_factories); content::RenderProcessHost *process_host = content::RenderProcessHost::FromID(render_process_id); Profile *profile = Profile::FromBrowserContext(process_host->GetBrowserContext()); ProfileAdapter *profileAdapter = static_cast<ProfileQt *>(profile)->profileAdapter(); @@ -1203,7 +1189,7 @@ bool ContentBrowserClientQt::WillCreateURLLoaderFactory( URLLoaderFactoryType type, const url::Origin &request_initiator, base::Optional<int64_t> navigation_id, - base::UkmSourceId ukm_source_id, + ukm::SourceIdObj ukm_source_id, mojo::PendingReceiver<network::mojom::URLLoaderFactory> *factory_receiver, mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient> *header_client, bool *bypass_redirect_checks, diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index 8b891131f..a5fcc64ef 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -145,13 +145,7 @@ public: const GURL &first_party, const base::Optional<url::Origin> &top_frame_origin, content::BrowserContext *context) override; - content::AllowServiceWorkerResult AllowServiceWorkerOnIO( - const GURL &scope, - const GURL &site_for_cookies, - const base::Optional<url::Origin> &top_frame_origin, - const GURL &script_url, - content::ResourceContext *context) override; - content::AllowServiceWorkerResult AllowServiceWorkerOnUI( + content::AllowServiceWorkerResult AllowServiceWorker( const GURL &scope, const GURL &site_for_cookies, const base::Optional<url::Origin> &top_frame_origin, @@ -223,6 +217,7 @@ public: content::NavigationHandle *navigation_handle) override; bool IsHandledURL(const GURL &url) override; + bool HasErrorPage(int http_status_code, content::WebContents *contents) override; bool WillCreateURLLoaderFactory(content::BrowserContext *browser_context, content::RenderFrameHost *frame, @@ -230,7 +225,7 @@ public: URLLoaderFactoryType type, const url::Origin &request_initiator, base::Optional<int64_t> navigation_id, - base::UkmSourceId ukm_source_id, + ukm::SourceIdObj ukm_source_id, mojo::PendingReceiver<network::mojom::URLLoaderFactory> *factory_receiver, mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient> *header_client, bool *bypass_redirect_checks, @@ -246,11 +241,10 @@ public: network::mojom::CertVerifierCreationParams *cert_verifier_creation_params) override; std::vector<base::FilePath> GetNetworkContextsParentDirectory() override; - void RegisterNonNetworkNavigationURLLoaderFactories(int frame_tree_node_id, base::UkmSourceId ukm_source_id, - NonNetworkURLLoaderFactoryDeprecatedMap *uniquely_owned_factories, + void RegisterNonNetworkNavigationURLLoaderFactories(int frame_tree_node_id, + ukm::SourceIdObj ukm_source_id, NonNetworkURLLoaderFactoryMap *factories) override; void RegisterNonNetworkSubresourceURLLoaderFactories(int render_process_id, int render_frame_id, - NonNetworkURLLoaderFactoryDeprecatedMap *uniquely_owned_factories, NonNetworkURLLoaderFactoryMap *factories) override; void RegisterNonNetworkWorkerMainResourceURLLoaderFactories(content::BrowserContext* browser_context, NonNetworkURLLoaderFactoryMap* factories) override; diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index 560cdbf54..36f4e380d 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -135,12 +135,6 @@ static QString getProgramFilesDir(bool x86Dir = false) #include "content/public/common/pepper_plugin_info.h" #include "ppapi/shared_impl/ppapi_permissions.h" -static const int32_t kPepperFlashPermissions = ppapi::PERMISSION_DEV | - ppapi::PERMISSION_PRIVATE | - ppapi::PERMISSION_BYPASS_USER_GESTURE | - ppapi::PERMISSION_FLASH | - ppapi::PERMISSION_SOCKET; - namespace switches { const char kPpapiFlashPath[] = "ppapi-flash-path"; const char kPpapiFlashVersion[] = "ppapi-flash-version"; @@ -160,95 +154,6 @@ static QString ppapiPluginsPath() return potentialPluginsPath; } - -content::PepperPluginInfo CreatePepperFlashInfo(const base::FilePath& path, const std::string& version) -{ - content::PepperPluginInfo plugin; - - plugin.is_out_of_process = true; - plugin.name = content::kFlashPluginName; - plugin.path = path; - plugin.permissions = kPepperFlashPermissions; - - std::vector<std::string> flash_version_numbers = base::SplitString(version, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); - if (flash_version_numbers.size() < 1) - flash_version_numbers.push_back("11"); - else if (flash_version_numbers[0].empty()) - flash_version_numbers[0] = "11"; - if (flash_version_numbers.size() < 2) - flash_version_numbers.push_back("2"); - if (flash_version_numbers.size() < 3) - flash_version_numbers.push_back("999"); - if (flash_version_numbers.size() < 4) - flash_version_numbers.push_back("999"); - - // E.g., "Shockwave Flash 10.2 r154": - plugin.description = plugin.name + " " + flash_version_numbers[0] + "." + flash_version_numbers[1] + " r" + flash_version_numbers[2]; - plugin.version = base::JoinString(flash_version_numbers, "."); - content::WebPluginMimeType swf_mime_type(content::kFlashPluginSwfMimeType, - content::kFlashPluginSwfExtension, - content::kFlashPluginSwfDescription); - plugin.mime_types.push_back(swf_mime_type); - content::WebPluginMimeType spl_mime_type(content::kFlashPluginSplMimeType, - content::kFlashPluginSplExtension, - content::kFlashPluginSplDescription); - plugin.mime_types.push_back(spl_mime_type); - - return plugin; -} - -void AddPepperFlashFromSystem(std::vector<content::PepperPluginInfo>* plugins) -{ - QStringList pluginPaths; -#if defined(Q_OS_WIN) - QString winDir = QDir::fromNativeSeparators(qEnvironmentVariable("WINDIR")); - if (winDir.isEmpty()) - winDir = QString::fromLatin1("C:/Windows"); - QDir pluginDir(winDir + "/System32/Macromed/Flash"); - pluginDir.setFilter(QDir::Files); - const QFileInfoList infos = pluginDir.entryInfoList(QStringList("pepflashplayer*.dll")); - for (const QFileInfo &info : infos) - pluginPaths << info.absoluteFilePath(); - pluginPaths << ppapiPluginsPath() + QStringLiteral("/pepflashplayer.dll"); -#endif -#if defined(Q_OS_OSX) - pluginPaths << "/Library/Internet Plug-Ins/PepperFlashPlayer/PepperFlashPlayer.plugin"; // System path - QDir potentialDir(QDir::homePath() + "/Library/Application Support/Google/Chrome/PepperFlash"); - if (potentialDir.exists()) { - QFileInfoList versionDirs = potentialDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed); - for (int i = 0; i < versionDirs.size(); ++i) { - pluginPaths << versionDirs.at(i).absoluteFilePath() + "/PepperFlashPlayer.plugin"; - } - } - pluginPaths << ppapiPluginsPath() + QStringLiteral("/PepperFlashPlayer.plugin"); -#endif -#if defined(Q_OS_LINUX) - pluginPaths << "/opt/google/chrome/PepperFlash/libpepflashplayer.so" // Google Chrome - << "/usr/lib/pepperflashplugin-nonfree/libpepflashplayer.so" // Ubuntu, package pepperflashplugin-nonfree - << "/usr/lib/adobe-flashplugin/libpepflashplayer.so" // Ubuntu, package adobe-flashplugin - << "/usr/lib/PepperFlash/libpepflashplayer.so" // Arch - << "/usr/lib64/chromium/PepperFlash/libpepflashplayer.so"; // OpenSuSE - pluginPaths << ppapiPluginsPath() + QStringLiteral("/libpepflashplayer.so"); -#endif - std::string flash_version = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kPpapiFlashVersion); - for (auto it = pluginPaths.constBegin(); it != pluginPaths.constEnd(); ++it) { - if (!QFile::exists(*it)) - continue; - plugins->push_back(CreatePepperFlashInfo(QtWebEngineCore::toFilePath(*it), flash_version)); - } -} - -void AddPepperFlashFromCommandLine(std::vector<content::PepperPluginInfo>* plugins) -{ - const base::CommandLine::StringType flash_path = base::CommandLine::ForCurrentProcess()->GetSwitchValueNative(switches::kPpapiFlashPath); - if (flash_path.empty() || !QFile::exists(QtWebEngineCore::toQt(flash_path))) - return; - - // Read pepper flash plugin version from command-line. (e.g. 16.0.0.235) - std::string flash_version = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kPpapiFlashVersion); - plugins->push_back(CreatePepperFlashInfo(base::FilePath(flash_path), flash_version)); -} - void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { #if QT_CONFIG(webengine_printing_and_pdf) @@ -273,8 +178,6 @@ namespace QtWebEngineCore { void ContentClientQt::AddPepperPlugins(std::vector<content::PepperPluginInfo>* plugins) { ComputeBuiltInPlugins(plugins); - AddPepperFlashFromSystem(plugins); - AddPepperFlashFromCommandLine(plugins); } } // namespace QtWebEngineCore diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index 59d7050a4..a8e8b7c8a 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -194,11 +194,11 @@ void ContentMainDelegateQt::PreSandboxStartup() false //enable_tickcount ); - if (logging::GetMinLogLevel() >= logging::LOG_INFO) { + if (logging::GetMinLogLevel() >= logging::LOGGING_INFO) { if (parsedCommandLine->HasSwitch(switches::kLoggingLevel)) { std::string logLevelValue = parsedCommandLine->GetSwitchValueASCII(switches::kLoggingLevel); int level = 0; - if (base::StringToInt(logLevelValue, &level) && level >= logging::LOG_INFO && level < logging::LOG_NUM_SEVERITIES) + if (base::StringToInt(logLevelValue, &level) && level >= logging::LOGGING_INFO && level < logging::LOGGING_NUM_SEVERITIES) logging::SetMinLogLevel(level); } } diff --git a/src/core/content_utility_client_qt.cpp b/src/core/content_utility_client_qt.cpp index 3582e15a7..f3b1e764d 100644 --- a/src/core/content_utility_client_qt.cpp +++ b/src/core/content_utility_client_qt.cpp @@ -56,12 +56,9 @@ auto RunProxyResolver(mojo::PendingReceiver<proxy_resolver::mojom::ProxyResolver return std::make_unique<proxy_resolver::ProxyResolverFactoryImpl>(std::move(receiver)); } -mojo::ServiceFactory *ContentUtilityClientQt::GetIOThreadServiceFactory() +void ContentUtilityClientQt::RegisterIOThreadServices(mojo::ServiceFactory &services) { - static base::NoDestructor<mojo::ServiceFactory> factory { - RunProxyResolver, - }; - return factory.get(); + services.Add(RunProxyResolver); } } // namespace diff --git a/src/core/content_utility_client_qt.h b/src/core/content_utility_client_qt.h index fc1d1eb05..bcdf077f3 100644 --- a/src/core/content_utility_client_qt.h +++ b/src/core/content_utility_client_qt.h @@ -53,7 +53,7 @@ public: ~ContentUtilityClientQt() override; // content::ContentUtilityClient: - mojo::ServiceFactory *GetIOThreadServiceFactory() override; + void RegisterIOThreadServices(mojo::ServiceFactory &services) override; }; } // namespace diff --git a/src/core/core_chromium.pri b/src/core/core_chromium.pri index 90c44b69c..b3cd7d518 100644 --- a/src/core/core_chromium.pri +++ b/src/core/core_chromium.pri @@ -252,18 +252,14 @@ qtConfig(webengine-ozone-x11) { qtConfig(webengine-pepper-plugins) { SOURCES += \ - renderer_host/pepper/pepper_flash_browser_host_qt.cpp \ renderer_host/pepper/pepper_host_factory_qt.cpp \ renderer_host/pepper/pepper_isolated_file_system_message_filter.cpp \ - renderer/pepper/pepper_flash_renderer_host_qt.cpp \ renderer/pepper/pepper_renderer_host_factory_qt.cpp \ renderer/plugins/loadable_plugin_placeholder_qt.cpp HEADERS += \ - renderer_host/pepper/pepper_flash_browser_host_qt.h \ renderer_host/pepper/pepper_host_factory_qt.h \ renderer_host/pepper/pepper_isolated_file_system_message_filter.h \ - renderer/pepper/pepper_flash_renderer_host_qt.h \ renderer/pepper/pepper_renderer_host_factory_qt.h \ renderer/plugins/loadable_plugin_placeholder_qt.h } diff --git a/src/core/location_provider_qt.cpp b/src/core/location_provider_qt.cpp index 94f6c6c9a..71f95157b 100644 --- a/src/core/location_provider_qt.cpp +++ b/src/core/location_provider_qt.cpp @@ -228,14 +228,14 @@ inline void QtPositioningHelper::postToLocationProvider(const base::Closure &tas } LocationProviderQt::LocationProviderQt() - : m_positioningHelper(0) + : m_positioningHelper(nullptr) { } LocationProviderQt::~LocationProviderQt() { if (m_positioningHelper) { - m_positioningHelper->m_locationProvider = 0; + m_positioningHelper->m_locationProvider = nullptr; m_positioningHelper->m_locationProviderFactory.InvalidateWeakPtrs(); m_positioningHelper->deleteLater(); } diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index cf31b9b59..3a1c20718 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -227,8 +227,13 @@ WebContentsAdapterClient::MediaRequestFlags mediaRequestFlagsForRequest(const co request.video_type == MediaStreamType::DISPLAY_VIDEO_CAPTURE) return {WebContentsAdapterClient::MediaDesktopAudioCapture, WebContentsAdapterClient::MediaDesktopVideoCapture}; + if (request.audio_type == MediaStreamType::DISPLAY_AUDIO_CAPTURE && + request.video_type == MediaStreamType::DISPLAY_VIDEO_CAPTURE_THIS_TAB) + return {WebContentsAdapterClient::MediaDesktopAudioCapture, WebContentsAdapterClient::MediaDesktopVideoCapture}; + if (request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE || - request.video_type == MediaStreamType::DISPLAY_VIDEO_CAPTURE) + request.video_type == MediaStreamType::DISPLAY_VIDEO_CAPTURE || + request.video_type == MediaStreamType::DISPLAY_VIDEO_CAPTURE_THIS_TAB) return {WebContentsAdapterClient::MediaDesktopVideoCapture}; return {}; @@ -249,21 +254,41 @@ public: { if (m_started && m_delegate) m_delegate->removeDevices(m_devices); + m_onStop.Reset(); } private: - gfx::NativeViewId OnStarted(base::OnceClosure, SourceCallback) override + gfx::NativeViewId OnStarted(base::OnceClosure stop, SourceCallback source, + const std::string& label, + std::vector<content::DesktopMediaID> screen_capture_ids, + StateChangeCallback state_change) override { - DCHECK(!m_started); + if (m_started) { + // Ignore possibly-compromised renderers that might call + // MediaStreamDispatcherHost::OnStreamStarted() more than once. + // See: https://crbug.com/1155426 + return 0; + } m_started = true; + m_onStop = std::move(stop); if (m_delegate) m_delegate->addDevices(m_devices); return 0; } + void OnDeviceStopped(const std::string &label, const content::DesktopMediaID &media_id) override + { + NOTIMPLEMENTED(); + } + + void SetStopCallback(base::OnceClosure stop) override + { + m_onStop = std::move(stop); + } base::WeakPtr<WebContentsDelegateQt> m_delegate; const blink::MediaStreamDevices m_devices; bool m_started = false; + base::OnceClosure m_onStop; // currently unused DISALLOW_COPY_AND_ASSIGN(MediaStreamUIQt); }; @@ -441,7 +466,8 @@ void MediaCaptureDevicesDispatcher::processDesktopCaptureAccessRequest(content:: } // Audio is only supported for screen capture streams. - bool audioRequested = request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE; + bool audioRequested = (request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE || + request.audio_type == MediaStreamType::DISPLAY_AUDIO_CAPTURE); bool audioSupported = (mediaId.type == content::DesktopMediaID::TYPE_SCREEN && m_loopbackAudioSupported); bool captureAudio = (audioRequested && audioSupported); diff --git a/src/core/net/client_cert_override.cpp b/src/core/net/client_cert_override.cpp index d768092e8..9c2ff31d7 100644 --- a/src/core/net/client_cert_override.cpp +++ b/src/core/net/client_cert_override.cpp @@ -40,7 +40,6 @@ #include "client_cert_override.h" #include "base/bind.h" -#include "base/bind_helpers.h" #include "base/task/post_task.h" #include "base/callback_forward.h" #include "content/public/browser/browser_task_traits.h" diff --git a/src/core/ozone/gl_context_qt.cpp b/src/core/ozone/gl_context_qt.cpp index f4d3f1618..1b1cef485 100644 --- a/src/core/ozone/gl_context_qt.cpp +++ b/src/core/ozone/gl_context_qt.cpp @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); -GLContextHelper* GLContextHelper::contextHelper = 0; +GLContextHelper* GLContextHelper::contextHelper = nullptr; namespace { @@ -95,7 +95,7 @@ void GLContextHelper::initialize() void GLContextHelper::destroy() { delete contextHelper; - contextHelper = 0; + contextHelper = nullptr; } bool GLContextHelper::initializeContextOnBrowserThread(gl::GLContext* context, gl::GLSurface* surface, gl::GLContextAttribs attribs) diff --git a/src/core/ozone/gl_surface_glx_qt.cpp b/src/core/ozone/gl_surface_glx_qt.cpp index 188a92729..4f4bd1371 100644 --- a/src/core/ozone/gl_surface_glx_qt.cpp +++ b/src/core/ozone/gl_surface_glx_qt.cpp @@ -45,7 +45,6 @@ #include "ozone/gl_surface_glx_qt.h" #include "ui/gl/gl_bindings.h" #include "ui/gl/gl_surface_glx.h" -#include "ui/gfx/x/x11_types.h" namespace gl { @@ -58,6 +57,7 @@ GLSurfaceGLXQt::~GLSurfaceGLXQt() void GLSurfaceGLX::ShutdownOneOff() { + s_initialized = false; } bool GLSurfaceGLX::IsCreateContextSupported() @@ -120,8 +120,6 @@ bool GLSurfaceGLXQt::InitializeOneOff() if (s_initialized) return true; - XInitThreads(); - g_display = GLContextHelper::getXDisplay(); if (!g_display) { LOG(ERROR) << "GLContextHelper::getXDisplay() failed."; diff --git a/src/core/ozone/gl_surface_glx_qt.h b/src/core/ozone/gl_surface_glx_qt.h index e894423b7..fb17c5aca 100644 --- a/src/core/ozone/gl_surface_glx_qt.h +++ b/src/core/ozone/gl_surface_glx_qt.h @@ -42,8 +42,6 @@ #include "gl_surface_qt.h" -#include "ui/gfx/x/x11_types.h" - namespace gl { class GLSurfaceGLXQt: public GLSurfaceQt { @@ -62,7 +60,7 @@ protected: private: static bool s_initialized; - XID m_surfaceBuffer; + int m_surfaceBuffer; DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLXQt); }; diff --git a/src/core/ozone/platform_window_qt.cpp b/src/core/ozone/platform_window_qt.cpp index 757c042f0..42af77774 100644 --- a/src/core/ozone/platform_window_qt.cpp +++ b/src/core/ozone/platform_window_qt.cpp @@ -59,7 +59,7 @@ PlatformWindowQt::~PlatformWindowQt() ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); } -gfx::Rect PlatformWindowQt::GetBounds() +gfx::Rect PlatformWindowQt::GetBounds() const { return bounds_; } diff --git a/src/core/ozone/platform_window_qt.h b/src/core/ozone/platform_window_qt.h index b1021df9d..dbeb320ac 100644 --- a/src/core/ozone/platform_window_qt.h +++ b/src/core/ozone/platform_window_qt.h @@ -56,7 +56,7 @@ public: PlatformWindowQt(PlatformWindowDelegate* delegate, const gfx::Rect& bounds); ~PlatformWindowQt() override; // PlatformWindow: - gfx::Rect GetBounds() override; + gfx::Rect GetBounds() const override; void SetBounds(const gfx::Rect& bounds) override; void Show(bool inactive = false) override { } void Hide() override { } diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp index ad35209f1..3e740726a 100644 --- a/src/core/printing/print_view_manager_base_qt.cpp +++ b/src/core/printing/print_view_manager_base_qt.cpp @@ -132,6 +132,66 @@ void GetDefaultPrintSettingsOnIO(printing::mojom::PrintManagerHost::GetDefaultPr std::move(printer_query), std::move(callback))); } +// Runs |callback| with |params| to reply to +// mojom::PrintManagerHost::UpdatePrintSettings. +void UpdatePrintSettingsReply(printing::mojom::PrintManagerHost::UpdatePrintSettingsCallback callback, + printing::mojom::PrintPagesParamsPtr params, bool canceled) +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + if (!params) { + // Fills |params| with initial values. + params = printing::mojom::PrintPagesParams::New(); + params->params = printing::mojom::PrintParams::New(); + } + std::move(callback).Run(std::move(params), canceled); +} + +void UpdatePrintSettingsReplyOnIO(scoped_refptr<printing::PrintQueriesQueue> queue, + std::unique_ptr<printing::PrinterQuery> printer_query, + printing::mojom::PrintManagerHost::UpdatePrintSettingsCallback callback, + int process_id, int routing_id) +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + DCHECK(printer_query); + auto params = printing::mojom::PrintPagesParams::New(); + params->params = printing::mojom::PrintParams::New(); + if (printer_query->last_status() == printing::PrintingContext::OK) { + RenderParamsFromPrintSettings(printer_query->settings(), params->params.get()); + params->params->document_cookie = printer_query->cookie(); + params->pages = printing::PageRange::GetPages(printer_query->settings().ranges()); + } + bool canceled = printer_query->last_status() == printing::PrintingContext::CANCEL; + + content::GetUIThreadTaskRunner({})->PostTask( + FROM_HERE, + base::BindOnce(&UpdatePrintSettingsReply, std::move(callback), std::move(params), canceled)); + + if (printer_query->cookie() && printer_query->settings().dpi()) { + queue->QueuePrinterQuery(std::move(printer_query)); + } else { + printer_query->StopWorker(); + } +} + +void UpdatePrintSettingsOnIO(int32_t cookie, + printing::mojom::PrintManagerHost::UpdatePrintSettingsCallback callback, + scoped_refptr<printing::PrintQueriesQueue> queue, + base::Value job_settings, + int process_id, int routing_id) +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::IO); + std::unique_ptr<printing::PrinterQuery> printer_query = queue->PopPrinterQuery(cookie); + if (!printer_query) + printer_query = queue->CreatePrinterQuery(content::ChildProcessHost::kInvalidUniqueID, MSG_ROUTING_NONE); + + auto *printer_query_ptr = printer_query.get(); + printer_query_ptr->SetSettings( + std::move(job_settings), + base::BindOnce(&UpdatePrintSettingsReplyOnIO, + queue, std::move(printer_query), std::move(callback), + process_id, routing_id)); +} + } // namespace PrintViewManagerBaseQt::PrintViewManagerBaseQt(content::WebContents *contents) @@ -602,4 +662,25 @@ void PrintViewManagerBaseQt::SendPrintingEnabled(bool enabled, content::RenderFr GetPrintRenderFrame(rfh)->SetPrintingEnabled(enabled); } +void PrintViewManagerBaseQt::UpdatePrintSettings(int32_t cookie, base::Value job_settings, + UpdatePrintSettingsCallback callback) +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + + if (!job_settings.FindIntKey(printing::kSettingPrinterType)) { + UpdatePrintSettingsReply(std::move(callback), nullptr, false); + return; + } + + content::RenderFrameHost *render_frame_host = + print_manager_host_receivers_.GetCurrentTargetFrame(); + + content::GetIOThreadTaskRunner({})->PostTask( + FROM_HERE, + base::BindOnce(&UpdatePrintSettingsOnIO, cookie, std::move(callback), + m_printerQueriesQueue, std::move(job_settings), + render_frame_host->GetProcess()->GetID(), + render_frame_host->GetRoutingID())); +} + } // namespace QtWebEngineCore diff --git a/src/core/printing/print_view_manager_base_qt.h b/src/core/printing/print_view_manager_base_qt.h index 3086d5d3a..14adb928a 100644 --- a/src/core/printing/print_view_manager_base_qt.h +++ b/src/core/printing/print_view_manager_base_qt.h @@ -82,6 +82,8 @@ public: // mojom::PrintManagerHost: void DidGetPrintedPagesCount(int32_t cookie, uint32_t number_pages) override; void GetDefaultPrintSettings(GetDefaultPrintSettingsCallback callback) override; + void UpdatePrintSettings(int32_t cookie, base::Value job_settings, + UpdatePrintSettingsCallback callback) override; void ShowInvalidPrinterSettingsError() override; void PrintingFailed(int32_t cookie) override; diff --git a/src/core/printing/printing_message_filter_qt.cpp b/src/core/printing/printing_message_filter_qt.cpp index 8d6833dce..f31a8a6a8 100644 --- a/src/core/printing/printing_message_filter_qt.cpp +++ b/src/core/printing/printing_message_filter_qt.cpp @@ -51,8 +51,6 @@ #include "chrome/browser/printing/printer_query.h" #include "components/printing/browser/print_manager_utils.h" #include "components/printing/common/print_messages.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/common/child_process_host.h" namespace QtWebEngineCore { @@ -75,8 +73,6 @@ bool PrintingMessageFilterQt::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(PrintingMessageFilterQt, message) IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_ScriptedPrint, OnScriptedPrint) - IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_UpdatePrintSettings, - OnUpdatePrintSettings) IPC_MESSAGE_HANDLER(PrintHostMsg_CheckForCancel, OnCheckForCancel) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() @@ -127,61 +123,9 @@ void PrintingMessageFilterQt::OnScriptedPrintReply( } } -void PrintingMessageFilterQt::OnUpdatePrintSettings(int document_cookie, - base::Value job_settings, - IPC::Message* reply_msg) { - if (!job_settings.is_dict() || - !job_settings.FindIntKey(printing::kSettingPrinterType)) { - // Reply with null query. - OnUpdatePrintSettingsReply(nullptr, reply_msg); - return; - } - - std::unique_ptr<printing::PrinterQuery> printer_query = - queue_->PopPrinterQuery(document_cookie); - if (!printer_query.get()) { - printer_query = queue_->CreatePrinterQuery( - content::ChildProcessHost::kInvalidUniqueID, MSG_ROUTING_NONE); - } - auto* printer_query_ptr = printer_query.get(); - printer_query_ptr->SetSettings( - std::move(job_settings), - base::BindOnce(&PrintingMessageFilterQt::OnUpdatePrintSettingsReply, this, - std::move(printer_query), reply_msg)); -} - -void PrintingMessageFilterQt::OnUpdatePrintSettingsReply(std::unique_ptr<printing::PrinterQuery> printer_query, - IPC::Message* reply_msg) { - printing::mojom::PrintPagesParams params; - params.params = printing::mojom::PrintParams::New(); - if (!printer_query.get() || - printer_query->last_status() != printing::PrintingContext::OK) { - params.params.reset(); - } else { - RenderParamsFromPrintSettings(printer_query->settings(), params.params.get()); - params.params->document_cookie = printer_query->cookie(); - params.pages = printing::PageRange::GetPages(printer_query->settings().ranges()); - } - - PrintHostMsg_UpdatePrintSettings::WriteReplyParams( - reply_msg, - params, - printer_query.get() && - (printer_query->last_status() == printing::PrintingContext::CANCEL)); - Send(reply_msg); - // If user hasn't cancelled. - if (printer_query) { - if (printer_query->cookie() && printer_query->settings().dpi()) { - queue_->QueuePrinterQuery(std::move(printer_query)); - } else { - printer_query->StopWorker(); - } - } -} - void PrintingMessageFilterQt::OnCheckForCancel(const printing::mojom::PreviewIds& ids, bool* cancel) { *cancel = false; } -} // namespace printing +} // namespace QtWebEngineCore diff --git a/src/core/printing/printing_message_filter_qt.h b/src/core/printing/printing_message_filter_qt.h index 3a449af70..4597f7e6a 100644 --- a/src/core/printing/printing_message_filter_qt.h +++ b/src/core/printing/printing_message_filter_qt.h @@ -58,6 +58,7 @@ class PrinterQuery; } namespace QtWebEngineCore { + // This class filters out incoming printing related IPC messages for the // renderer process on the IPC thread. class PrintingMessageFilterQt : public content::BrowserMessageFilter { @@ -83,15 +84,6 @@ class PrintingMessageFilterQt : public content::BrowserMessageFilter { void OnScriptedPrintReply(std::unique_ptr<printing::PrinterQuery> printer_query, IPC::Message* reply_msg); - // Modify the current print settings based on |job_settings|. The task is - // handled by the print worker thread and the UI thread. The reply occurs on - // the IO thread. - void OnUpdatePrintSettings(int document_cookie, - base::Value job_settings, - IPC::Message* reply_msg); - void OnUpdatePrintSettingsReply(std::unique_ptr<printing::PrinterQuery> printer_query, - IPC::Message* reply_msg); - // Check to see if print preview has been cancelled. void OnCheckForCancel(const printing::mojom::PreviewIds& ids, bool* cancel); @@ -102,6 +94,6 @@ class PrintingMessageFilterQt : public content::BrowserMessageFilter { DISALLOW_COPY_AND_ASSIGN(PrintingMessageFilterQt); }; -} // namespace printing +} // namespace QtWebEngineCore #endif // PRINTING_PRINTING_MESSAGE_FILTER_QT_H_ diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index de28aee6c..bc138b7d0 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -585,7 +585,7 @@ void ProfileAdapter::setHttpAcceptLanguage(const QString &httpAcceptLanguage) std::vector<content::WebContentsImpl *> list = content::WebContentsImpl::GetAllWebContents(); for (content::WebContentsImpl *web_contents : list) { if (web_contents->GetBrowserContext() == m_profile.data()) { - blink::mojom::RendererPreferences *rendererPrefs = web_contents->GetMutableRendererPrefs(); + blink::RendererPreferences *rendererPrefs = web_contents->GetMutableRendererPrefs(); rendererPrefs->accept_languages = http_accept_language; web_contents->SyncRendererPrefs(); } diff --git a/src/core/qtwebengine_resources.gni b/src/core/qtwebengine_resources.gni index 3bf1a5d57..7ba7050df 100644 --- a/src/core/qtwebengine_resources.gni +++ b/src/core/qtwebengine_resources.gni @@ -34,6 +34,7 @@ repack("qtwebengine_repack_resources") { "$root_gen_dir/net/net_resources.pak", "$root_gen_dir/third_party/blink/public/resources/blink_resources.pak", "$root_gen_dir/ui/resources/webui_resources.pak", + "$root_gen_dir/ui/resources/webui_generated_resources.pak", ] output = "$root_out_dir/qtwebengine_resources.pak" deps = [ @@ -51,6 +52,7 @@ repack("qtwebengine_repack_resources") { "//net:net_resources_grit", "//third_party/blink/public:resources_grit", "//ui/resources:webui_resources_grd_grit", + "//ui/resources:webui_generated_resources_grd", ] if (enable_extensions) { diff --git a/src/core/qtwebengine_sources.gni b/src/core/qtwebengine_sources.gni index 8f3c1ae20..473c58d72 100644 --- a/src/core/qtwebengine_sources.gni +++ b/src/core/qtwebengine_sources.gni @@ -179,8 +179,6 @@ source_set("qtwebengine_sources") { if (enable_plugins) { sources += [ - "//chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.cc", - "//chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h", "//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", diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 14622142c..61fae5dca 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -1072,4 +1072,14 @@ ui::Compositor *RenderWidgetHostViewQt::GetCompositor() return m_uiCompositor.get(); } +base::Optional<content::DisplayFeature> RenderWidgetHostViewQt::GetDisplayFeature() +{ + return base::nullopt; +} + +void RenderWidgetHostViewQt::SetDisplayFeatureForTesting(const content::DisplayFeature *) +{ + NOTIMPLEMENTED(); +} + } // namespace QtWebEngineCore diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index e01d91c84..7e7b13fda 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -151,6 +151,8 @@ public: void DidStopFlinging() override; std::unique_ptr<content::SyntheticGestureTarget> CreateSyntheticGestureTarget() override; ui::Compositor *GetCompositor() override; + base::Optional<content::DisplayFeature> GetDisplayFeature() override; + void SetDisplayFeatureForTesting(const content::DisplayFeature*) override; #if defined(OS_MAC) void SetActive(bool active) override { QT_NOT_YET_IMPLEMENTED } void SpeakSelection() override { QT_NOT_YET_IMPLEMENTED } diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index ad559ae54..de3a76d78 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -261,16 +261,6 @@ void ContentRendererClientQt::RunScriptsAtDocumentIdle(content::RenderFrame *ren #endif } -bool ContentRendererClientQt::HasErrorPage(int httpStatusCode) -{ - // Use an internal error page, if we have one for the status code. - if (!error_page::LocalizedError::HasStrings(error_page::Error::kHttpErrorDomain, httpStatusCode)) { - return false; - } - - return true; -} - // To tap into the chromium localized strings. Ripped from the chrome layer (highly simplified). void ContentRendererClientQt::PrepareErrorPage(content::RenderFrame *renderFrame, const blink::WebURLError &web_error, @@ -284,13 +274,13 @@ void ContentRendererClientQt::PrepareErrorPage(content::RenderFrame *renderFrame } void ContentRendererClientQt::PrepareErrorPageForHttpStatusError(content::RenderFrame *renderFrame, - const GURL &unreachable_url, + const blink::WebURLError &error, const std::string &httpMethod, int http_status, std::string *errorHtml) { GetNavigationErrorStringsInternal(renderFrame, httpMethod, - error_page::Error::HttpError(unreachable_url, http_status), + error_page::Error::HttpError(error.url(), http_status), errorHtml); } @@ -386,7 +376,7 @@ bool ContentRendererClientQt::OverrideCreatePlugin(content::RenderFrame *render_ if (!found) *plugin = LoadablePluginPlaceholderQt::CreateLoadableMissingPlugin(render_frame, params)->plugin(); else - *plugin = render_frame->CreatePlugin(info, params, nullptr); + *plugin = render_frame->CreatePlugin(info, params); #endif // BUILDFLAG(ENABLE_PLUGINS) return true; } @@ -633,10 +623,4 @@ void ContentRendererClientQt::WillSendRequest(blink::WebLocalFrame *frame, #endif } -bool ContentRendererClientQt::RequiresWebComponentsV0(const GURL &url) -{ - Q_UNUSED(url); - return false; -} - } // namespace QtWebEngineCore diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index a0faec531..3b2e5e9d6 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -92,17 +92,16 @@ public: void RenderThreadStarted() override; void ExposeInterfacesToBrowser(mojo::BinderMap* binders) override; void RenderFrameCreated(content::RenderFrame *render_frame) override; - bool HasErrorPage(int http_status_code) override; void PrepareErrorPage(content::RenderFrame *render_frame, const blink::WebURLError &error, const std::string &http_method, std::string *error_html) override; void PrepareErrorPageForHttpStatusError(content::RenderFrame *render_frame, - const GURL &unreachable_url, + const blink::WebURLError &error, const std::string &http_method, int http_status, - std::string *error_html) override; + std::string *error_html) override; uint64_t VisitedLinkHash(const char *canonical_url, size_t length) override; bool IsLinkVisited(uint64_t linkHash) override; @@ -129,8 +128,6 @@ public: GURL *new_url, bool *attach_same_site_cookies) override; - bool RequiresWebComponentsV0(const GURL &url) override; - #if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) chrome::WebRtcLoggingAgentImpl *GetWebRtcLoggingAgent(); #endif diff --git a/src/core/renderer/pepper/pepper_flash_renderer_host_qt.cpp b/src/core/renderer/pepper/pepper_flash_renderer_host_qt.cpp deleted file mode 100644 index 9af05fd08..000000000 --- a/src/core/renderer/pepper/pepper_flash_renderer_host_qt.cpp +++ /dev/null @@ -1,432 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// This is based on chrome/renderer/pepper/pepper_flash_renderer_host.cc: -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE.Chromium file. - -#include "pepper_flash_renderer_host_qt.h" - -#include <map> -#include <vector> - -#include "base/lazy_instance.h" -#include "base/macros.h" -#include "base/metrics/histogram_macros.h" -#include "base/strings/string_util.h" -#include "content/public/renderer/pepper_plugin_instance.h" -#include "content/public/renderer/render_thread.h" -#include "content/public/renderer/renderer_ppapi_host.h" -#include "ipc/ipc_message_macros.h" -#include "net/http/http_util.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/c/trusted/ppb_browser_font_trusted.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/proxy/host_dispatcher.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/proxy/resource_message_params.h" -#include "ppapi/proxy/serialized_structs.h" -#include "ppapi/thunk/enter.h" -#include "ppapi/thunk/ppb_image_data_api.h" -#include "skia/ext/platform_canvas.h" -#include "third_party/skia/include/core/SkCanvas.h" -#include "third_party/skia/include/core/SkMatrix.h" -#include "third_party/skia/include/core/SkPaint.h" -#include "third_party/skia/include/core/SkPoint.h" -#include "third_party/skia/include/core/SkTextBlob.h" -#include "third_party/skia/include/core/SkTypeface.h" -#include "third_party/skia/include/private/SkTemplates.h" -#include "ui/gfx/geometry/rect.h" -#include "url/gurl.h" - -using ppapi::thunk::EnterResourceNoLock; -using ppapi::thunk::PPB_ImageData_API; - -namespace { - -// Some non-simple HTTP request headers that Flash may set. -// (Please see http://www.w3.org/TR/cors/#simple-header for the definition of -// simple headers.) -// -// The list and the enum defined below are used to collect data about request -// headers used in PPB_Flash.Navigate() calls, in order to understand the impact -// of rejecting PPB_Flash.Navigate() requests with non-simple headers. -// -// TODO(yzshen): We should be able to remove the histogram recording code once -// we get the answer. -const char* const kRejectedHttpRequestHeaders[] = { - "authorization", // - "cache-control", // - "content-encoding", // - "content-md5", // - "content-type", // If the media type is not one of those covered by the - // simple header definition. - "expires", // - "from", // - "if-match", // - "if-none-match", // - "if-range", // - "if-unmodified-since", // - "pragma", // - "referer" // -}; - -// Please note that new entries should be added right above -// FLASH_NAVIGATE_USAGE_ENUM_COUNT, and existing entries shouldn't be re-ordered -// or removed, since this ordering is used in a histogram. -enum FlashNavigateUsage { - // This section must be in the same order as kRejectedHttpRequestHeaders. - REJECT_AUTHORIZATION = 0, - REJECT_CACHE_CONTROL, - REJECT_CONTENT_ENCODING, - REJECT_CONTENT_MD5, - REJECT_CONTENT_TYPE, - REJECT_EXPIRES, - REJECT_FROM, - REJECT_IF_MATCH, - REJECT_IF_NONE_MATCH, - REJECT_IF_RANGE, - REJECT_IF_UNMODIFIED_SINCE, - REJECT_PRAGMA, - REJECT_REFERER, - - // The navigate request is rejected because of headers not listed above - // (e.g., custom headers). - REJECT_OTHER_HEADERS, - - // Total number of rejected navigate requests. - TOTAL_REJECTED_NAVIGATE_REQUESTS, - - // Total number of navigate requests. - TOTAL_NAVIGATE_REQUESTS, - FLASH_NAVIGATE_USAGE_ENUM_COUNT -}; - -static base::LazyInstance<std::map<std::string, FlashNavigateUsage>>:: - DestructorAtExit g_rejected_headers = LAZY_INSTANCE_INITIALIZER; - -bool IsSimpleHeader(const std::string& lower_case_header_name, - const std::string& header_value) -{ - if (lower_case_header_name == "accept" || - lower_case_header_name == "accept-language" || - lower_case_header_name == "content-language") - return true; - - if (lower_case_header_name == "content-type") { - std::string lower_case_mime_type; - std::string lower_case_charset; - bool had_charset = false; - net::HttpUtil::ParseContentType(header_value, - &lower_case_mime_type, - &lower_case_charset, - &had_charset, - NULL); - return lower_case_mime_type == "application/x-www-form-urlencoded" || - lower_case_mime_type == "multipart/form-data" || - lower_case_mime_type == "text/plain"; - } - - return false; -} - -void RecordFlashNavigateUsage(FlashNavigateUsage usage) -{ - DCHECK_NE(FLASH_NAVIGATE_USAGE_ENUM_COUNT, usage); - UMA_HISTOGRAM_ENUMERATION( - "Plugin.FlashNavigateUsage", - usage, - FLASH_NAVIGATE_USAGE_ENUM_COUNT); -} - -} // namespace - -namespace QtWebEngineCore { - -PepperFlashRendererHostQt::PepperFlashRendererHostQt( - content::RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource) - : ResourceHost(host->GetPpapiHost(), instance, resource), - host_(host), - weak_factory_(this) -{ -} - -PepperFlashRendererHostQt::~PepperFlashRendererHostQt() { - // This object may be destroyed in the middle of a sync message. If that is - // the case, make sure we respond to all the pending navigate calls. - std::vector<ppapi::host::ReplyMessageContext>::reverse_iterator it; - for (it = navigate_replies_.rbegin(); it != navigate_replies_.rend(); ++it) - SendReply(*it, IPC::Message()); -} - -int32_t PepperFlashRendererHostQt::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) -{ - PPAPI_BEGIN_MESSAGE_MAP(PepperFlashRendererHostQt, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_GetProxyForURL, - OnGetProxyForURL) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_SetInstanceAlwaysOnTop, - OnSetInstanceAlwaysOnTop) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_DrawGlyphs, - OnDrawGlyphs) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_Navigate, OnNavigate) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_IsRectTopmost, - OnIsRectTopmost) - PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Flash_InvokePrinting, - OnInvokePrinting) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperFlashRendererHostQt::OnGetProxyForURL( - ppapi::host::HostMessageContext* host_context, - const std::string& url) -{ - GURL gurl(url); - if (!gurl.is_valid()) - return PP_ERROR_FAILED; - std::string proxy; - bool result = content::RenderThread::Get()->ResolveProxy(gurl, &proxy); - if (!result) - return PP_ERROR_FAILED; - host_context->reply_msg = PpapiPluginMsg_Flash_GetProxyForURLReply(proxy); - return PP_OK; -} - -int32_t PepperFlashRendererHostQt::OnSetInstanceAlwaysOnTop( - ppapi::host::HostMessageContext* host_context, - bool on_top) -{ - content::PepperPluginInstance* plugin_instance = - host_->GetPluginInstance(pp_instance()); - if (plugin_instance) - plugin_instance->SetAlwaysOnTop(on_top); - return PP_OK; -} - -int32_t PepperFlashRendererHostQt::OnDrawGlyphs( - ppapi::host::HostMessageContext* host_context, - ppapi::proxy::PPBFlash_DrawGlyphs_Params params) -{ - if (params.glyph_indices.size() != params.glyph_advances.size() || - params.glyph_indices.empty()) - return PP_ERROR_FAILED; - - int weight = (params.font_desc.weight + 1) * 100; - SkFontStyle::Slant slant = SkFontStyle::kUpright_Slant; - if (params.font_desc.italic) - slant = SkFontStyle::kItalic_Slant; - SkFontStyle style(weight, SkFontStyle::kNormal_Width, slant); - sk_sp<SkTypeface> typeface( - SkTypeface::MakeFromName(params.font_desc.face.c_str(), style)); - if (!typeface) - return PP_ERROR_FAILED; - - EnterResourceNoLock<PPB_ImageData_API> enter(params.image_data.host_resource(), true); - if (enter.failed()) - return PP_ERROR_FAILED; - - PPB_ImageData_API* image = static_cast<PPB_ImageData_API*>(enter.object()); - SkCanvas* canvas = image->GetCanvas(); - bool needs_unmapping = false; - if (!canvas) { - needs_unmapping = true; - image->Map(); - canvas = image->GetCanvas(); - if (!canvas) - return PP_ERROR_FAILED; // Failure mapping. - } - - SkAutoCanvasRestore acr(canvas, true); - - // Clip is applied in pixels before the transform. - SkRect clip_rect = { - SkIntToScalar(params.clip.point.x), SkIntToScalar(params.clip.point.y), - SkIntToScalar(params.clip.point.x + params.clip.size.width), - SkIntToScalar(params.clip.point.y + params.clip.size.height)}; - canvas->clipRect(clip_rect); - - SkMatrix matrix; - matrix.set(SkMatrix::kMScaleX, SkFloatToScalar(params.transformation[0][0])); - matrix.set(SkMatrix::kMSkewX, SkFloatToScalar(params.transformation[0][1])); - matrix.set(SkMatrix::kMTransX, SkFloatToScalar(params.transformation[0][2])); - matrix.set(SkMatrix::kMSkewY, SkFloatToScalar(params.transformation[1][0])); - matrix.set(SkMatrix::kMScaleY, SkFloatToScalar(params.transformation[1][1])); - matrix.set(SkMatrix::kMTransY, SkFloatToScalar(params.transformation[1][2])); - matrix.set(SkMatrix::kMPersp0, SkFloatToScalar(params.transformation[2][0])); - matrix.set(SkMatrix::kMPersp1, SkFloatToScalar(params.transformation[2][1])); - matrix.set(SkMatrix::kMPersp2, SkFloatToScalar(params.transformation[2][2])); - canvas->concat(matrix); - - SkPaint paint; - paint.setColor(params.color); - - SkFont font(std::move(typeface), SkIntToScalar(params.font_desc.size)); - font.setHinting(SkFontHinting::kFull); - if (params.allow_subpixel_aa) { - font.setSubpixel(true); - font.setEdging(SkFont::Edging::kSubpixelAntiAlias); - } - - SkScalar x = SkIntToScalar(params.position.x); - SkScalar y = SkIntToScalar(params.position.y); - - // Build up the skia advances. - size_t glyph_count = params.glyph_indices.size(); - if (glyph_count) { - SkTextBlobBuilder builder; - auto rec = builder.allocRunPos(font, glyph_count); - memcpy(rec.glyphs, ¶ms.glyph_indices[0], glyph_count * 2); - SkPoint* pos = reinterpret_cast<SkPoint*>(rec.pos); - for (uint32_t i = 0; i < glyph_count; i++) { - pos[i].set(x, y); - x += SkFloatToScalar(params.glyph_advances[i].x); - y += SkFloatToScalar(params.glyph_advances[i].y); - } - canvas->drawTextBlob(builder.make(), 0, 0, paint); - } - - if (needs_unmapping) - image->Unmap(); - - return PP_OK; -} - -// CAUTION: This code is subtle because Navigate is a sync call which may -// cause re-entrancy or cause the instance to be destroyed. If the instance -// is destroyed we need to ensure that we respond to all outstanding sync -// messages so that the plugin process does not remain blocked. -int32_t PepperFlashRendererHostQt::OnNavigate( - ppapi::host::HostMessageContext* host_context, - const ppapi::URLRequestInfoData& data, - const std::string& target, - bool from_user_action) -{ - // If our PepperPluginInstance is already destroyed, just return a failure. - content::PepperPluginInstance* plugin_instance = - host_->GetPluginInstance(pp_instance()); - if (!plugin_instance) - return PP_ERROR_FAILED; - - std::map<std::string, FlashNavigateUsage>& rejected_headers = - g_rejected_headers.Get(); - if (rejected_headers.empty()) { - for (size_t i = 0; i < base::size(kRejectedHttpRequestHeaders); ++i) - rejected_headers[kRejectedHttpRequestHeaders[i]] = - static_cast<FlashNavigateUsage>(i); - } - - net::HttpUtil::HeadersIterator header_iter( - data.headers.begin(), data.headers.end(), "\n\r"); - bool rejected = false; - while (header_iter.GetNext()) { - std::string lower_case_header_name = - base::ToLowerASCII(header_iter.name()); - if (!IsSimpleHeader(lower_case_header_name, header_iter.values())) { - rejected = true; - - std::map<std::string, FlashNavigateUsage>::const_iterator iter = - rejected_headers.find(lower_case_header_name); - FlashNavigateUsage usage = - iter != rejected_headers.end() ? iter->second : REJECT_OTHER_HEADERS; - RecordFlashNavigateUsage(usage); - } - } - - RecordFlashNavigateUsage(TOTAL_NAVIGATE_REQUESTS); - if (rejected) { - RecordFlashNavigateUsage(TOTAL_REJECTED_NAVIGATE_REQUESTS); - return PP_ERROR_NOACCESS; - } - - // Navigate may call into Javascript (e.g. with a "javascript:" URL), - // or do things like navigate away from the page, either one of which will - // need to re-enter into the plugin. It is safe, because it is essentially - // equivalent to NPN_GetURL, where Flash would expect re-entrancy. - ppapi::proxy::HostDispatcher* host_dispatcher = - ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); - host_dispatcher->set_allow_plugin_reentrancy(); - - // Grab a weak pointer to ourselves on the stack so we can check if we are - // still alive. - base::WeakPtr<PepperFlashRendererHostQt> weak_ptr = weak_factory_.GetWeakPtr(); - // Keep track of reply contexts in case we are destroyed during a Navigate - // call. Even if we are destroyed, we still need to send these replies to - // unblock the plugin process. - navigate_replies_.push_back(host_context->MakeReplyMessageContext()); - plugin_instance->Navigate(data, target.c_str(), from_user_action); - // This object might have been destroyed by this point. If it is destroyed - // the reply will be sent in the destructor. Otherwise send the reply here. - if (weak_ptr.get()) { - SendReply(navigate_replies_.back(), IPC::Message()); - navigate_replies_.pop_back(); - } - - // Return PP_OK_COMPLETIONPENDING so that no reply is automatically sent. - return PP_OK_COMPLETIONPENDING; -} - -int32_t PepperFlashRendererHostQt::OnIsRectTopmost( - ppapi::host::HostMessageContext* host_context, - const PP_Rect& rect) -{ - content::PepperPluginInstance* plugin_instance = - host_->GetPluginInstance(pp_instance()); - if (plugin_instance && - plugin_instance->IsRectTopmost( - gfx::Rect( - rect.point.x, - rect.point.y, - rect.size.width, - rect.size.height))) - return PP_OK; - return PP_ERROR_FAILED; -} - -int32_t PepperFlashRendererHostQt::OnInvokePrinting( - ppapi::host::HostMessageContext* host_context) -{ - return PP_ERROR_FAILED; -} - -} //QtWebEngineCore diff --git a/src/core/renderer/pepper/pepper_flash_renderer_host_qt.h b/src/core/renderer/pepper/pepper_flash_renderer_host_qt.h deleted file mode 100644 index ae6bc0876..000000000 --- a/src/core/renderer/pepper/pepper_flash_renderer_host_qt.h +++ /dev/null @@ -1,107 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PEPPER_FLASH_RENDERER_HOST_QT_H -#define PEPPER_FLASH_RENDERER_HOST_QT_H - -#include <string> -#include <vector> - -#include "base/memory/weak_ptr.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/resource_host.h" - -struct PP_Rect; - -namespace ppapi { -struct URLRequestInfoData; -} - -namespace ppapi { -namespace proxy { -struct PPBFlash_DrawGlyphs_Params; -} -} - -namespace content { -class RendererPpapiHost; -} - -namespace QtWebEngineCore { - -class PepperFlashRendererHostQt : public ppapi::host::ResourceHost { -public: - PepperFlashRendererHostQt(content::RendererPpapiHost* host, - PP_Instance instance, - PP_Resource resource); - ~PepperFlashRendererHostQt() override; - - // ppapi::host::ResourceHost override. - int32_t OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) override; - -private: - int32_t OnGetProxyForURL(ppapi::host::HostMessageContext* host_context, - const std::string& url); - int32_t OnSetInstanceAlwaysOnTop( - ppapi::host::HostMessageContext* host_context, - bool on_top); - int32_t OnDrawGlyphs(ppapi::host::HostMessageContext* host_context, - ppapi::proxy::PPBFlash_DrawGlyphs_Params params); - int32_t OnNavigate(ppapi::host::HostMessageContext* host_context, - const ppapi::URLRequestInfoData& data, - const std::string& target, - bool from_user_action); - int32_t OnIsRectTopmost(ppapi::host::HostMessageContext* host_context, - const PP_Rect& rect); - int32_t OnInvokePrinting(ppapi::host::HostMessageContext* host_context); - - // A stack of ReplyMessageContexts to track Navigate() calls which have not - // yet been replied to. - std::vector<ppapi::host::ReplyMessageContext> navigate_replies_; - - content::RendererPpapiHost* host_; - base::WeakPtrFactory<PepperFlashRendererHostQt> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(PepperFlashRendererHostQt); -}; - -} //QtWebEngineCore -#endif // PEPPER_FLASH_RENDERER_HOST_QT_H diff --git a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp index 1b9de4d4d..83dcf8157 100644 --- a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp +++ b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp @@ -43,7 +43,6 @@ // found in the LICENSE.Chromium file. #include "pepper_renderer_host_factory_qt.h" -#include "pepper_flash_renderer_host_qt.h" #include "qtwebenginecoreglobal_p.h" #include "base/memory/ptr_util.h" @@ -82,25 +81,6 @@ std::unique_ptr<ppapi::host::ResourceHost> PepperRendererHostFactoryQt::CreateRe if (!host_->IsValidInstance(instance)) return nullptr; - if (host_->GetPpapiHost()->permissions().HasPermission(ppapi::PERMISSION_FLASH)) { - switch (message.type()) { - case PpapiHostMsg_Flash_Create::ID: - return base::WrapUnique(new PepperFlashRendererHostQt(host_, instance, resource)); - case PpapiHostMsg_FlashMenu_Create::ID: { - ppapi::host::ReplyMessageContext reply_context( - ppapi::proxy::ResourceMessageReplyParams(resource, 0), - NULL, - MSG_ROUTING_NONE); - reply_context.params.set_result(PP_ERROR_USERCANCEL); - host_->GetPpapiHost()->SendReply(reply_context, PpapiPluginMsg_FlashMenu_ShowReply(-1)); - break; - } - case PpapiHostMsg_FlashFullscreen_Create::ID: - // Not implemented - break; - } - } - // TODO(raymes): PDF also needs access to the FlashFontFileHost currently. // We should either rename PPB_FlashFont_File to PPB_FontFile_Private or get // rid of its use in PDF if possible. @@ -114,9 +94,6 @@ std::unique_ptr<ppapi::host::ResourceHost> PepperRendererHostFactoryQt::CreateRe return base::WrapUnique(new PepperFlashFontFileHost(host_, instance, resource, description, charset)); break; } - case PpapiHostMsg_FlashDRM_Create::ID: - // Not implemented - break; } } diff --git a/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp b/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp deleted file mode 100644 index 8fa277e78..000000000 --- a/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// This is based on chrome/browser/renderer_host/pepper/pepper_flash_browser_host.cc: -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE.Chromium file. - -#include "pepper_flash_browser_host_qt.h" - -#include "base/time/time.h" -#include "content/public/browser/browser_ppapi_host.h" -#include "ipc/ipc_message_macros.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/proxy/resource_message_params.h" -#include "ppapi/shared_impl/time_conversion.h" -#include "qtwebenginecoreglobal_p.h" - -#if defined(OS_WIN) -#include <windows.h> -#elif defined(OS_MAC) -#include <CoreServices/CoreServices.h> -#endif - -using content::BrowserPpapiHost; - -namespace QtWebEngineCore { - -PepperFlashBrowserHostQt::PepperFlashBrowserHostQt(BrowserPpapiHost* host, - PP_Instance instance, - PP_Resource resource) - : ResourceHost(host->GetPpapiHost(), instance, resource), - weak_factory_(this) -{ -} - -PepperFlashBrowserHostQt::~PepperFlashBrowserHostQt() {} - -int32_t PepperFlashBrowserHostQt::OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) -{ - PPAPI_BEGIN_MESSAGE_MAP(PepperFlashBrowserHostQt, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Flash_UpdateActivity, - OnUpdateActivity) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_Flash_GetLocalTimeZoneOffset, - OnGetLocalTimeZoneOffset) - PPAPI_DISPATCH_HOST_RESOURCE_CALL_0(PpapiHostMsg_Flash_GetLocalDataRestrictions, - OnGetLocalDataRestrictions) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperFlashBrowserHostQt::OnUpdateActivity(ppapi::host::HostMessageContext* host_context) -{ -#if defined(OS_WIN) - // Reading then writing back the same value to the screensaver timeout system - // setting resets the countdown which prevents the screensaver from turning - // on "for a while". As long as the plugin pings us with this message faster - // than the screensaver timeout, it won't go on. - int value = 0; - if (SystemParametersInfo(SPI_GETSCREENSAVETIMEOUT, 0, &value, 0)) - SystemParametersInfo(SPI_SETSCREENSAVETIMEOUT, value, NULL, 0); -#elif defined(OS_MAC) - UpdateSystemActivity(OverallAct); -#endif - return PP_OK; -} - -int32_t PepperFlashBrowserHostQt::OnGetLocalTimeZoneOffset( - ppapi::host::HostMessageContext* host_context, - const base::Time& t) -{ - // The reason for this processing being in the browser process is that on - // Linux, the localtime calls require filesystem access prohibited by the - // sandbox. - host_context->reply_msg = PpapiPluginMsg_Flash_GetLocalTimeZoneOffsetReply( - ppapi::PPGetLocalTimeZoneOffset(t)); - return PP_OK; -} - -int32_t PepperFlashBrowserHostQt::OnGetLocalDataRestrictions( - ppapi::host::HostMessageContext* context) -{ - QT_NOT_YET_IMPLEMENTED - return PP_OK; -} - -} // namespace QtWebEngineCore diff --git a/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.h b/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.h deleted file mode 100644 index d6d2c8656..000000000 --- a/src/core/renderer_host/pepper/pepper_flash_browser_host_qt.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PEPPER_FLASH_BROWSER_HOST_QT_H -#define PEPPER_FLASH_BROWSER_HOST_QT_H - -#include "base/memory/weak_ptr.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/resource_host.h" - -namespace base { -class Time; -} - -namespace content { -class BrowserPpapiHost; -} - -class GURL; - -namespace QtWebEngineCore { - -class PepperFlashBrowserHostQt : public ppapi::host::ResourceHost { -public: - PepperFlashBrowserHostQt(content::BrowserPpapiHost* host, - PP_Instance instance, - PP_Resource resource); - ~PepperFlashBrowserHostQt() override; - - // ppapi::host::ResourceHost override. - int32_t OnResourceMessageReceived( - const IPC::Message& msg, - ppapi::host::HostMessageContext* context) override; - -private: - int32_t OnUpdateActivity(ppapi::host::HostMessageContext* host_context); - int32_t OnGetLocalTimeZoneOffset( - ppapi::host::HostMessageContext* host_context, - const base::Time& t); - int32_t OnGetLocalDataRestrictions(ppapi::host::HostMessageContext* context); - - base::WeakPtrFactory<PepperFlashBrowserHostQt> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(PepperFlashBrowserHostQt); -}; - -} // namespace QtWebEngineCore - -#endif // PEPPER_FLASH_BROWSER_HOST_QT_H diff --git a/src/core/renderer_host/pepper/pepper_host_factory_qt.cpp b/src/core/renderer_host/pepper/pepper_host_factory_qt.cpp index 00ab4963b..6686f8b12 100644 --- a/src/core/renderer_host/pepper/pepper_host_factory_qt.cpp +++ b/src/core/renderer_host/pepper/pepper_host_factory_qt.cpp @@ -46,7 +46,6 @@ #include "base/memory/ptr_util.h" #include "build/build_config.h" -#include "chrome/browser/renderer_host/pepper/pepper_flash_clipboard_message_filter.h" #include "content/public/browser/browser_ppapi_host.h" #include "ppapi/host/message_filter_host.h" #include "ppapi/host/ppapi_host.h" @@ -54,7 +53,6 @@ #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/shared_impl/ppapi_permissions.h" -#include "pepper_flash_browser_host_qt.h" #include "pepper_isolated_file_system_message_filter.h" using ppapi::host::MessageFilterHost; @@ -80,19 +78,6 @@ std::unique_ptr<ppapi::host::ResourceHost> PepperHostFactoryQt::CreateResourceHo if (!host_->IsValidInstance(instance)) return nullptr; - // Flash interfaces. - if (host_->GetPpapiHost()->permissions().HasPermission(ppapi::PERMISSION_FLASH)) { - switch (message.type()) { - case PpapiHostMsg_Flash_Create::ID: - return base::WrapUnique(new PepperFlashBrowserHostQt(host_, instance, resource)); - case PpapiHostMsg_FlashClipboard_Create::ID: { - scoped_refptr<ResourceMessageFilter> clipboard_filter(new PepperFlashClipboardMessageFilter); - return base::WrapUnique(new MessageFilterHost( - host_->GetPpapiHost(), instance, resource, clipboard_filter)); - } - } - } - // Permissions for the following interfaces will be checked at the // time of the corresponding instance's methods calls (because // permission check can be performed only on the UI diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index ca39faf7d..695ef24c1 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -84,11 +84,11 @@ #include "content/public/common/content_constants.h" #include "content/public/common/content_switches.h" #include "content/public/common/drop_data.h" -#include "content/public/common/page_state.h" #include "content/public/common/page_zoom.h" #include "content/public/common/url_constants.h" #include "extensions/buildflags/buildflags.h" #include "third_party/blink/public/common/page/page_zoom.h" +#include "third_party/blink/public/common/page_state/page_state.h" #include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h" #include "third_party/blink/public/common/web_preferences/web_preferences.h" #include "third_party/blink/public/mojom/frame/media_player_action.mojom.h" @@ -356,7 +356,7 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex, nullptr); entry->SetTitle(toString16(title)); - entry->SetPageState(content::PageState::CreateFromEncodedData(std::string(pageState.data(), pageState.size()))); + entry->SetPageState(blink::PageState::CreateFromEncodedData(std::string(pageState.data(), pageState.size()))); entry->SetHasPostData(hasPostData); entry->SetOriginalRequestURL(toGurl(originalRequestUrl)); entry->SetIsOverridingUserAgent(isOverridingUserAgent); @@ -436,7 +436,7 @@ QSharedPointer<WebContentsAdapter> WebContentsAdapter::createFromSerializedNavig // TODO(joth): This is duplicated from chrome/.../session_restore.cc and // should be shared e.g. in NavigationController. http://crbug.com/68222 const int id = newWebContents->GetMainFrame()->GetProcess()->GetID(); - const content::PageState& pageState = controller.GetActiveEntry()->GetPageState(); + const blink::PageState& pageState = controller.GetActiveEntry()->GetPageState(); const std::vector<base::FilePath>& filePaths = pageState.GetReferencedFiles(); for (std::vector<base::FilePath>::const_iterator file = filePaths.begin(); file != filePaths.end(); ++file) content::ChildProcessSecurityPolicy::GetInstance()->GrantReadFile(id, *file); @@ -552,7 +552,7 @@ void WebContentsAdapter::initialize(content::SiteInstance *site) void WebContentsAdapter::initializeRenderPrefs() { - blink::mojom::RendererPreferences *rendererPrefs = m_webContents->GetMutableRendererPrefs(); + blink::RendererPreferences *rendererPrefs = m_webContents->GetMutableRendererPrefs(); rendererPrefs->use_custom_colors = true; // Qt returns a flash time (the whole cycle) in ms, chromium expects just the interval in // seconds diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 773bef8da..e71e78d3c 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -77,7 +77,6 @@ #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" -#include "content/public/common/frame_navigate_params.h" #include "content/public/common/url_constants.h" #include "net/base/data_url.h" #include "net/base/url_util.h" @@ -867,15 +866,6 @@ void WebContentsDelegateQt::ContentsZoomChange(bool zoom_in) adapter->setZoomFactor(adapter->currentZoomFactor() - 0.1f); } -bool WebContentsDelegateQt::ShouldNavigateOnBackForwardMouseButtons() -{ -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - return false; -#else - return true; -#endif -} - void WebContentsDelegateQt::ResourceLoadComplete(content::RenderFrameHost* render_frame_host, const content::GlobalRequestID& request_id, const blink::mojom::ResourceLoadInfo& resource_load_info) @@ -956,6 +946,7 @@ int &WebContentsDelegateQt::streamCount(blink::mojom::MediaStreamType type) case blink::mojom::MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE: case blink::mojom::MediaStreamType::DISPLAY_VIDEO_CAPTURE: case blink::mojom::MediaStreamType::DISPLAY_AUDIO_CAPTURE: + case blink::mojom::MediaStreamType::DISPLAY_VIDEO_CAPTURE_THIS_TAB: return m_desktopStreamCount; case blink::mojom::MediaStreamType::NO_SERVICE: diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index ff4352131..ca2cf2e0e 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -171,7 +171,6 @@ public: void OnVisibilityChanged(content::Visibility visibility) override; void DidFirstVisuallyNonEmptyPaint() override; void ActivateContents(content::WebContents* contents) override; - bool ShouldNavigateOnBackForwardMouseButtons() override; void ResourceLoadComplete(content::RenderFrameHost* render_frame_host, const content::GlobalRequestID& request_id, const blink::mojom::ResourceLoadInfo& resource_load_info) override; diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp index 9041f1489..10154e733 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -156,11 +156,6 @@ void WebContentsViewQt::SetInitialFocus() void WebContentsViewQt::FocusThroughTabTraversal(bool reverse) { content::WebContentsImpl *web_contents = static_cast<content::WebContentsImpl*>(m_webContents); - content::RenderWidgetHostView *fullscreen_view = web_contents->GetFullscreenRenderWidgetHostView(); - if (fullscreen_view) { - fullscreen_view->Focus(); - return; - } web_contents->GetRenderViewHost()->SetInitialFocus(reverse); } diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 94f214a07..bb79666d2 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -744,7 +744,7 @@ WebEngineContext::WebEngineContext() // Explicitly tell Chromium about default-on features we do not support disableFeatures.push_back(features::kBackgroundFetch.name); - disableFeatures.push_back(features::kSmsReceiver.name); + disableFeatures.push_back(features::kWebOTP.name); disableFeatures.push_back(features::kWebPayments.name); disableFeatures.push_back(features::kWebUsb.name); disableFeatures.push_back(media::kPictureInPicture.name); diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index d7feb0e41..461647e67 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -51,8 +51,8 @@ #include "content/public/common/content_switches.h" #include "media/base/media_switches.h" #include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h" +#include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h" #include "third_party/blink/public/common/web_preferences/web_preferences.h" -#include "third_party/blink/public/mojom/renderer_preferences.mojom.h" #include "ui/base/ui_base_switches.h" #include "ui/events/event_switches.h" #include "ui/native_theme/native_theme.h" @@ -396,8 +396,8 @@ void WebEngineSettings::applySettingsToWebPreferences(blink::web_pref::WebPrefer prefs->hide_scrollbars = !testAttribute(QWebEngineSettings::ShowScrollBars); if (isAttributeExplicitlySet(QWebEngineSettings::PlaybackRequiresUserGesture)) { prefs->autoplay_policy = testAttribute(QWebEngineSettings::PlaybackRequiresUserGesture) - ? blink::web_pref::AutoplayPolicy::kUserGestureRequired - : blink::web_pref::AutoplayPolicy::kNoUserGestureRequired; + ? blink::mojom::AutoplayPolicy::kUserGestureRequired + : blink::mojom::AutoplayPolicy::kNoUserGestureRequired; } prefs->dom_paste_enabled = testAttribute(QWebEngineSettings::JavascriptCanPaste); prefs->dns_prefetching_enabled = testAttribute(QWebEngineSettings::DnsPrefetchEnabled); @@ -428,10 +428,10 @@ void WebEngineSettings::applySettingsToWebPreferences(blink::web_pref::WebPrefer if (webTheme) { switch (webTheme->GetPreferredColorScheme()) { case ui::NativeTheme::PreferredColorScheme::kDark: - prefs->preferred_color_scheme = blink::PreferredColorScheme::kDark; + prefs->preferred_color_scheme = blink::mojom::PreferredColorScheme::kDark; break; case ui::NativeTheme::PreferredColorScheme::kLight: - prefs->preferred_color_scheme = blink::PreferredColorScheme::kLight; + prefs->preferred_color_scheme = blink::mojom::PreferredColorScheme::kLight; break; } } @@ -460,7 +460,7 @@ void WebEngineSettings::applySettingsToWebPreferences(blink::web_pref::WebPrefer } } -bool WebEngineSettings::applySettingsToRendererPreferences(blink::mojom::RendererPreferences *prefs) +bool WebEngineSettings::applySettingsToRendererPreferences(blink::RendererPreferences *prefs) { bool changed = false; #if QT_CONFIG(webengine_webrtc) diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h index 8dc98aae4..5d00a5d6f 100644 --- a/src/core/web_engine_settings.h +++ b/src/core/web_engine_settings.h @@ -64,9 +64,7 @@ class WebContents; } namespace blink { -namespace mojom { -class RendererPreferences; -} +struct RendererPreferences; namespace web_pref { struct WebPreferences; } @@ -115,7 +113,7 @@ private: void initDefaults(); void doApply(); void applySettingsToWebPreferences(blink::web_pref::WebPreferences *); - bool applySettingsToRendererPreferences(blink::mojom::RendererPreferences *); + bool applySettingsToRendererPreferences(blink::RendererPreferences *); void setWebContentsAdapter(WebContentsAdapter *adapter) { m_adapter = adapter; } WebContentsAdapter* m_adapter; diff --git a/tools/scripts/take_snapshot.py b/tools/scripts/take_snapshot.py index b2c1276af..cc18847b2 100755 --- a/tools/scripts/take_snapshot.py +++ b/tools/scripts/take_snapshot.py @@ -198,7 +198,6 @@ def isInChromiumBlacklist(file_path): or file_path.startswith('third_party/skia/infra') or file_path.startswith('third_party/skia/site/dev/tools/calendar.mskp') or file_path.startswith('third_party/sqlite/sqlite-src-') - or file_path.startswith('third_party/speech-dispatcher') or file_path.startswith('third_party/spirv-cross/spirv-cross/reference/') or file_path.startswith('third_party/swiftshader/third_party/') or file_path.startswith('third_party/wayland') diff --git a/tools/scripts/version_resolver.py b/tools/scripts/version_resolver.py index dd5470f88..264484d4c 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 = '87.0.4280.144' -chromium_branch = '4280' +chromium_version = '88.0.4324.187' +chromium_branch = '4324' ninja_version = 'v1.8.2' json_url = 'http://omahaproxy.appspot.com/all.json' @@ -54,6 +54,14 @@ submodule_blacklist = [ , 'chrome/tools/test/reference_build/chrome_mac' , 'chrome/tools/test/reference_build/chrome_linux' , 'chrome/tools/test/reference_build/chrome_win' + # buildtools duplicates: + , 'buildtools/clang_format/script' + , 'buildtools/linux64' + , 'buildtools/mac' + , 'buildtools/win' + , 'buildtools/third_party/libc++/trunk' + , 'buildtools/third_party/libc++abi/trunk' + , 'buildtools/third_party/libunwind/trunk' ] sys.path.append(os.path.join(qtwebengine_root, 'tools', 'scripts')) |