diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-02-08 16:13:34 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-03-29 14:52:16 +0200 |
commit | d9ae75b3234392aebb714c1046a471386a63deed (patch) | |
tree | 5ea50ef1a82447ca85032028ca0c935265f0b4ae /src/core | |
parent | db59a3096b4f44aaacabdc5b455fbc0a3a6b8fb1 (diff) |
Adaptations for Chrome 98
Change-Id: I607604f85a111a69da77ca949dddf3399b9721b3
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'src/core')
115 files changed, 393 insertions, 926 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index d8e3b37d5..d0c64a848 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -4,7 +4,6 @@ find_package(Ninja 1.7.2 REQUIRED) find_package(Nodejs 12 REQUIRED) find_package(PkgConfig) if(PkgConfig_FOUND) - pkg_check_modules(XSCRNSAVER xscrnsaver) create_pkg_config_host_wrapper(${CMAKE_CURRENT_BINARY_DIR}) endif() @@ -207,8 +206,6 @@ foreach(arch ${archs}) SOURCES renderer/pepper/pepper_renderer_host_factory_qt.cpp renderer/pepper/pepper_renderer_host_factory_qt.h renderer/plugins/loadable_plugin_placeholder_qt.cpp renderer/plugins/loadable_plugin_placeholder_qt.h - renderer_host/pepper/pepper_host_factory_qt.cpp renderer_host/pepper/pepper_host_factory_qt.h - renderer_host/pepper/pepper_isolated_file_system_message_filter.cpp renderer_host/pepper/pepper_isolated_file_system_message_filter.h ) extend_gn_target(${buildGn} CONDITION QT_FEATURE_webengine_printing_and_pdf @@ -351,7 +348,6 @@ foreach(arch ${archs}) enable_session_service=false is_cfi=false use_ozone=true - use_x11=false ozone_auto_platforms=false ozone_platform_headless=false ozone_platform_external=true @@ -410,10 +406,6 @@ foreach(arch ${archs}) ARGS rtc_use_x11 CONDITION QT_FEATURE_webengine_ozone_x11 AND QT_FEATURE_webengine_webrtc ) - extend_gn_list(gnArgArg - ARGS use_xscrnsaver - CONDITION QT_FEATURE_webengine_ozone_x11 AND XSCRNSAVER_FOUND - ) if(QT_FEATURE_webengine_kerberos) list(APPEND gnArgArg diff --git a/src/core/accessibility_tree_formatter_qt.cpp b/src/core/accessibility_tree_formatter_qt.cpp index e53705c85..cb13f842d 100644 --- a/src/core/accessibility_tree_formatter_qt.cpp +++ b/src/core/accessibility_tree_formatter_qt.cpp @@ -217,7 +217,7 @@ std::string AccessibilityTreeFormatterQt::ProcessTreeForOutput(const base::Dicti std::unique_ptr<ui::AXTreeFormatter> AXInspectFactory::CreatePlatformFormatter() { - return AXInspectFactory::CreateFormatter(kQt); + return AXInspectFactory::CreateFormatter(ui::AXApiType::kQt); } // static @@ -225,16 +225,16 @@ std::unique_ptr<ui::AXEventRecorder> AXInspectFactory::CreatePlatformRecorder(Br base::ProcessId pid, const ui::AXTreeSelector &selector) { - return AXInspectFactory::CreateRecorder(kQt, manager, pid, selector); + return AXInspectFactory::CreateRecorder(ui::AXApiType::kQt, manager, pid, selector); } // static -std::unique_ptr<ui::AXTreeFormatter> AXInspectFactory::CreateFormatter(AXInspectFactory::Type type) +std::unique_ptr<ui::AXTreeFormatter> AXInspectFactory::CreateFormatter(ui::AXApiType::Type type) { switch (type) { - case kBlink: + case ui::AXApiType::kBlink: return std::make_unique<AccessibilityTreeFormatterBlink>(); - case kQt: + case ui::AXApiType::kQt: #if QT_CONFIG(accessibility) return std::make_unique<AccessibilityTreeFormatterQt>(); #else @@ -247,13 +247,13 @@ std::unique_ptr<ui::AXTreeFormatter> AXInspectFactory::CreateFormatter(AXInspect } // static -std::unique_ptr<ui::AXEventRecorder> AXInspectFactory::CreateRecorder(AXInspectFactory::Type type, +std::unique_ptr<ui::AXEventRecorder> AXInspectFactory::CreateRecorder(ui::AXApiType::Type type, BrowserAccessibilityManager *manager, base::ProcessId pid, const ui::AXTreeSelector &selector) { switch (type) { - case kQt: + case ui::AXApiType::kQt: return std::make_unique<AccessibilityEventRecorder>(manager); default: NOTREACHED() << "Unsupported inspect type " << type; diff --git a/src/core/api/configure.cmake b/src/core/api/configure.cmake index a9dd9eb09..9da8324e8 100644 --- a/src/core/api/configure.cmake +++ b/src/core/api/configure.cmake @@ -57,17 +57,17 @@ qt_feature("webengine-system-pulseaudio" PRIVATE AUTODETECT UNIX CONDITION PULSEAUDIO_FOUND ) -qt_feature("webengine-pepper-plugins" PRIVATE - LABEL "Pepper Plugins" - PURPOSE "Enables use of Pepper Flash plugins." - AUTODETECT NOT QT_FEATURE_webengine_embedded_build -) qt_feature("webengine-printing-and-pdf" PRIVATE LABEL "Printing and PDF" PURPOSE "Provides printing and output to PDF." AUTODETECT NOT QT_FEATURE_webengine_embedded_build CONDITION TARGET Qt::PrintSupport AND QT_FEATURE_printer ) +qt_feature("webengine-pepper-plugins" PRIVATE + LABEL "Pepper Plugins" + PURPOSE "Enables use of Pepper plugins." + AUTODETECT QT_FEATURE_webengine_printing_and_pdf +) qt_feature("webengine-webchannel" PUBLIC SECTION "WebEngine" LABEL "WebChannel support" @@ -102,7 +102,7 @@ qt_feature("webengine-extensions" PUBLIC LABEL "Extensions" PURPOSE "Enables Chromium extensions within certain limits. Currently used by the pdf viewer and hangout webrtc extension." AUTODETECT ON - CONDITION QT_FEATURE_webengine_printing_and_pdf OR QT_FEATURE_webengine_printing_and_pdf + CONDITION QT_FEATURE_webengine_printing_and_pdf OR QT_FEATURE_webengine_webrtc ) qt_feature("webengine-webrtc" PRIVATE LABEL "WebRTC" diff --git a/src/core/api/qwebenginecertificateerror.cpp b/src/core/api/qwebenginecertificateerror.cpp index 9e487b71a..0f6781384 100644 --- a/src/core/api/qwebenginecertificateerror.cpp +++ b/src/core/api/qwebenginecertificateerror.cpp @@ -98,7 +98,7 @@ QWebEngineCertificateError::~QWebEngineCertificateError() = default; \value CertificateKnownInterceptionBlocked The certificate is known to be used for interception by an entity other the device owner. (Added in 5.15) - \value SslObsoleteVersion The connection uses an obsolete version of SSL/TLS. (Added in Qt 6.2) + \value SslObsoleteVersion The connection uses an obsolete version of SSL/TLS. (Added in Qt 6.2, deprecated in Qt 6.4) \value CertificateSymantecLegacy The certificate is a legacy Symantec one that's no longer valid. (Added in Qt 6.2) */ diff --git a/src/core/api/qwebengineprofile.cpp b/src/core/api/qwebengineprofile.cpp index 5e48f4dd1..b206bcd02 100644 --- a/src/core/api/qwebengineprofile.cpp +++ b/src/core/api/qwebengineprofile.cpp @@ -49,6 +49,7 @@ #include "qtwebenginecoreglobal.h" #include "profile_adapter.h" #include "visited_links_manager_qt.h" +#include "web_engine_settings.h" #include <QDir> #include <QtWebEngineCore/qwebengineurlscheme.h> @@ -283,6 +284,11 @@ void QWebEngineProfilePrivate::removeWebContentsAdapterClient(QtWebEngineCore::W m_profileAdapter->removeWebContentsAdapterClient(adapter); } +QtWebEngineCore::WebEngineSettings *QWebEngineProfilePrivate::coreSettings() const +{ + return QtWebEngineCore::WebEngineSettings::get(settings()); +} + /*! Constructs a new off-the-record profile with the parent \a parent. diff --git a/src/core/api/qwebengineprofile_p.h b/src/core/api/qwebengineprofile_p.h index 396c8b9bf..925e096bd 100644 --- a/src/core/api/qwebengineprofile_p.h +++ b/src/core/api/qwebengineprofile_p.h @@ -62,6 +62,7 @@ namespace QtWebEngineCore { class ProfileAdapter; +class WebEngineSettings; } QT_BEGIN_NAMESPACE @@ -79,6 +80,7 @@ public: QtWebEngineCore::ProfileAdapter *profileAdapter() const; QWebEngineSettings *settings() const { return m_settings; } + QtWebEngineCore::WebEngineSettings *coreSettings() const override; void downloadDestroyed(quint32 downloadId); diff --git a/src/core/browser_accessibility_qt.cpp b/src/core/browser_accessibility_qt.cpp index 7b4a02647..edcb4286e 100644 --- a/src/core/browser_accessibility_qt.cpp +++ b/src/core/browser_accessibility_qt.cpp @@ -63,11 +63,9 @@ class BrowserAccessibilityQt : public BrowserAccessibility { public: - BrowserAccessibilityQt(); + BrowserAccessibilityQt(BrowserAccessibilityManager *manager, ui::AXNode *node); ~BrowserAccessibilityQt(); - void Init(BrowserAccessibilityManager *manager, ui::AXNode *node) override; - QtWebEngineCore::BrowserAccessibilityInterface *interface() const { return m_interface; } private: @@ -87,7 +85,6 @@ class BrowserAccessibilityInterface public: BrowserAccessibilityInterface(content::BrowserAccessibilityQt *chromiumInterface); - void init(); void destroy(); // QAccessibleInterface @@ -149,7 +146,7 @@ public: int selectedCellCount() const override; int selectedColumnCount() const override; int selectedRowCount() const override; - QList<QAccessibleInterface*> selectedCells() const override; + QList<QAccessibleInterface *> selectedCells() const override; QList<int> selectedColumns() const override; QList<int> selectedRows() const override; bool isColumnSelected(int column) const override; @@ -161,13 +158,13 @@ public: // QAccessibleTableCellInterface int columnExtent() const override; - QList<QAccessibleInterface*> columnHeaderCells() const override; + QList<QAccessibleInterface *> columnHeaderCells() const override; int columnIndex() const override; int rowExtent() const override; - QList<QAccessibleInterface*> rowHeaderCells() const override; + QList<QAccessibleInterface *> rowHeaderCells() const override; int rowIndex() const override; bool isSelected() const override; - QAccessibleInterface* table() const override; + QAccessibleInterface *table() const override; void modelChange(QAccessibleTableModelChangeEvent *event) override; @@ -181,9 +178,9 @@ private: namespace content { // static -BrowserAccessibility *BrowserAccessibility::Create() +std::unique_ptr<BrowserAccessibility> BrowserAccessibility::Create(BrowserAccessibilityManager *man, ui::AXNode *node) { - return new BrowserAccessibilityQt(); + return std::unique_ptr<BrowserAccessibility>(new BrowserAccessibilityQt(man, node)); } QAccessibleInterface *toQAccessibleInterface(BrowserAccessibility *obj) @@ -196,15 +193,10 @@ const QAccessibleInterface *toQAccessibleInterface(const BrowserAccessibility *o return static_cast<const BrowserAccessibilityQt *>(obj)->interface(); } -BrowserAccessibilityQt::BrowserAccessibilityQt() - : m_interface(new QtWebEngineCore::BrowserAccessibilityInterface(this)) -{ -} - -void BrowserAccessibilityQt::Init(BrowserAccessibilityManager *manager, ui::AXNode *node) +BrowserAccessibilityQt::BrowserAccessibilityQt(BrowserAccessibilityManager *manager, ui::AXNode *node) + : content::BrowserAccessibility(manager, node), + m_interface(new QtWebEngineCore::BrowserAccessibilityInterface(this)) { - BrowserAccessibility::Init(manager, node); - m_interface->init(); } BrowserAccessibilityQt::~BrowserAccessibilityQt() @@ -221,7 +213,21 @@ using namespace content; BrowserAccessibilityInterface::BrowserAccessibilityInterface(content::BrowserAccessibilityQt *chromiumInterface) : q(chromiumInterface) -{} +{ + Q_ASSERT(parent()); + Q_ASSERT(parent()->object()); + m_object = new QObject(parent()->object()); + QString name = toQt(q->GetAuthorUniqueId()); + if (!name.isEmpty()) + m_object->setObjectName(name); + + m_id = QAccessible::registerAccessibleInterface(this); +} + +void BrowserAccessibilityInterface::destroy() +{ + QAccessible::deleteAccessibleInterface(m_id); +} bool BrowserAccessibilityInterface::isValid() const { @@ -576,7 +582,50 @@ QAccessible::Role BrowserAccessibilityInterface::role() const case ax::mojom::Role::kMarquee: return QAccessible::Section; case ax::mojom::Role::kMath: + case ax::mojom::Role::kMathMLMath: return QAccessible::Equation; + case ax::mojom::Role::kMathMLFraction: + return QAccessible::Grouping; + case ax::mojom::Role::kMathMLIdentifier: + return QAccessible::StaticText; + case ax::mojom::Role::kMathMLMultiscripts: + return QAccessible::Section; + case ax::mojom::Role::kMathMLNoneScript: + return QAccessible::Section; + case ax::mojom::Role::kMathMLNumber: + return QAccessible::StaticText; + case ax::mojom::Role::kMathMLOperator: + return QAccessible::StaticText; + case ax::mojom::Role::kMathMLOver: + return QAccessible::Section; + case ax::mojom::Role::kMathMLPrescriptDelimiter: + return QAccessible::Section; + case ax::mojom::Role::kMathMLRoot: + return QAccessible::Section; + case ax::mojom::Role::kMathMLRow: + return QAccessible::Section; + case ax::mojom::Role::kMathMLSquareRoot: + return QAccessible::Section; + case ax::mojom::Role::kMathMLStringLiteral: + return QAccessible::StaticText; + case ax::mojom::Role::kMathMLSub: + return QAccessible::Section; + case ax::mojom::Role::kMathMLSubSup: + return QAccessible::Section; + case ax::mojom::Role::kMathMLSup: + return QAccessible::Section; + case ax::mojom::Role::kMathMLTable: + return QAccessible::Table; + case ax::mojom::Role::kMathMLTableCell: + return QAccessible::Cell; + case ax::mojom::Role::kMathMLTableRow: + return QAccessible::Row; + case ax::mojom::Role::kMathMLText: + return QAccessible::StaticText; + case ax::mojom::Role::kMathMLUnder: + return QAccessible::Section; + case ax::mojom::Role::kMathMLUnderOver: + return QAccessible::Section; case ax::mojom::Role::kMenu: return QAccessible::PopupMenu; case ax::mojom::Role::kMenuBar: @@ -653,10 +702,14 @@ QAccessible::Role BrowserAccessibilityInterface::role() const return QAccessible::Indicator; case ax::mojom::Role::kStrong: return QAccessible::StaticText; + case ax::mojom::Role::kSubscript: + return QAccessible::Grouping; case ax::mojom::Role::kSuggestion: return QAccessible::Section; + case ax::mojom::Role::kSuperscript: + return QAccessible::Grouping; case ax::mojom::Role::kSvgRoot: - return QAccessible::Graphic; + return QAccessible::WebDocument; case ax::mojom::Role::kSwitch: return QAccessible::Button; case ax::mojom::Role::kTable: @@ -798,26 +851,6 @@ QAccessible::State BrowserAccessibilityInterface::state() const return state; } -void BrowserAccessibilityInterface::init() -{ - if (m_id) - return; - Q_ASSERT(parent()); - Q_ASSERT(parent()->object()); - m_object = new QObject(parent()->object()); - QString name = toQt(q->GetAuthorUniqueId()); - if (!name.isEmpty()) - m_object->setObjectName(name); - - m_id = QAccessible::registerAccessibleInterface(this); -} - -void BrowserAccessibilityInterface::destroy() -{ - // delete this - QAccessible::deleteAccessibleInterface(m_id); -} - QStringList BrowserAccessibilityInterface::actionNames() const { QStringList actions; diff --git a/src/core/browser_main_parts_qt.cpp b/src/core/browser_main_parts_qt.cpp index 0ce3b1264..320d27a93 100644 --- a/src/core/browser_main_parts_qt.cpp +++ b/src/core/browser_main_parts_qt.cpp @@ -322,6 +322,8 @@ int BrowserMainPartsQt::PreCreateThreads() // Like ChromeBrowserMainExtraPartsViews::PreCreateThreads does. #if defined(Q_OS_WIN) display::Screen::SetScreenInstance(new display::win::ScreenWin); +#elif defined(Q_OS_DARWIN) + display::Screen::SetScreenInstance(display::CreateNativeScreen()); #else display::Screen::SetScreenInstance(new DesktopScreenQt); #endif diff --git a/src/core/browser_main_parts_qt.h b/src/core/browser_main_parts_qt.h index 3ba530987..af4f11d05 100644 --- a/src/core/browser_main_parts_qt.h +++ b/src/core/browser_main_parts_qt.h @@ -83,7 +83,6 @@ public: #endif private: - DISALLOW_COPY_AND_ASSIGN(BrowserMainPartsQt); std::unique_ptr<performance_manager::PerformanceManagerLifetime> performance_manager_lifetime_; std::unique_ptr<WebUsbDetectorQt> m_webUsbDetector; #if defined(OS_MAC) diff --git a/src/core/certificate_error_controller.cpp b/src/core/certificate_error_controller.cpp index 1151fb5c5..4232f02f6 100644 --- a/src/core/certificate_error_controller.cpp +++ b/src/core/certificate_error_controller.cpp @@ -78,9 +78,10 @@ ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateSymantecLegacy, net::ERR_CERT_SYMANTEC_LEGACY) ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateKnownInterceptionBlocked, net::ERR_CERT_KNOWN_INTERCEPTION_BLOCKED) -ASSERT_ENUMS_MATCH(QWebEngineCertificateError::SslObsoleteVersion, - net::ERR_SSL_OBSOLETE_VERSION) -// ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateErrorEnd, net::ERR_CERT_END) +// net::ERR_SSL_OBSOLETE_VERSION was removed again in Chromium 98 +//ASSERT_ENUMS_MATCH(QWebEngineCertificateError::SslObsoleteVersion, +// net::ERR_SSL_OBSOLETE_VERSION) +//ASSERT_ENUMS_MATCH(QWebEngineCertificateError::CertificateErrorEnd, net::ERR_CERT_END) // Copied from chrome/browser/ssl/ssl_error_handler.cc: static int IsCertErrorFatal(int cert_error) @@ -98,7 +99,6 @@ static int IsCertErrorFatal(int cert_error) case net::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED: case net::ERR_CERT_SYMANTEC_LEGACY: case net::ERR_CERT_KNOWN_INTERCEPTION_BLOCKED: - case net::ERR_SSL_OBSOLETE_VERSION: return false; case net::ERR_CERT_CONTAINS_ERRORS: case net::ERR_CERT_REVOKED: diff --git a/src/core/common/extensions/extensions_api_provider_qt.h b/src/core/common/extensions/extensions_api_provider_qt.h index 7d8c5f98b..41732c92a 100644 --- a/src/core/common/extensions/extensions_api_provider_qt.h +++ b/src/core/common/extensions/extensions_api_provider_qt.h @@ -41,8 +41,6 @@ #include "extensions/common/extensions_api_provider.h" -#include "base/macros.h" - namespace extensions { class ExtensionsAPIProviderQt : public ExtensionsAPIProvider @@ -64,8 +62,6 @@ public: // Registers permissions for any associated API features. void RegisterPermissions(PermissionsInfo* permissions_info) override; - -DISALLOW_COPY_AND_ASSIGN(ExtensionsAPIProviderQt); }; } diff --git a/src/core/common/extensions/extensions_client_qt.h b/src/core/common/extensions/extensions_client_qt.h index 2466e14e3..648021997 100644 --- a/src/core/common/extensions/extensions_client_qt.h +++ b/src/core/common/extensions/extensions_client_qt.h @@ -48,7 +48,6 @@ #include "base/compiler_specific.h" #include "base/lazy_instance.h" -#include "base/macros.h" #include "chrome/common/extensions/permissions/chrome_permission_message_provider.h" #include "extensions/common/features/feature_provider.h" #include "extensions/common/features/json_feature_provider_source.h" @@ -131,7 +130,6 @@ private: const ChromePermissionMessageProvider permission_message_provider_; mutable GURL update_url_; mutable GURL base_url_; - DISALLOW_COPY_AND_ASSIGN(ExtensionsClientQt); }; } // namespace extensions diff --git a/src/core/compositor/display_skia_output_device.cpp b/src/core/compositor/display_skia_output_device.cpp index c33a31b87..ca3333b47 100644 --- a/src/core/compositor/display_skia_output_device.cpp +++ b/src/core/compositor/display_skia_output_device.cpp @@ -42,7 +42,7 @@ #include "type_conversion.h" #include "gpu/command_buffer/service/skia_utils.h" -#include "skia/ext/legacy_display_globals.h" +#include "third_party/skia/include/core/SkSurfaceProps.h" namespace QtWebEngineCore { @@ -64,10 +64,14 @@ public: DCHECK(m_texture.isValid()); if (m_texture.backend() == GrBackendApi::kVulkan) { +#if BUILDFLAG(ENABLE_VULKAN) GrVkImageInfo info; bool result = m_texture.getVkImageInfo(&info); DCHECK(result); m_estimatedSize = info.fAlloc.fSize; +#else + NOTREACHED(); +#endif } else { auto info = SkImageInfo::Make(m_shape.sizeInPixels.width(), m_shape.sizeInPixels.height(), colorType, kUnpremul_SkAlphaType); @@ -75,7 +79,7 @@ public: } m_parent->memory_type_tracker_->TrackMemAlloc(m_estimatedSize); - SkSurfaceProps surfaceProps = skia::LegacyDisplayGlobals::GetSkSurfaceProps(); + SkSurfaceProps surfaceProps = SkSurfaceProps{0, kUnknown_SkPixelGeometry}; m_surface = SkSurface::MakeFromBackendTexture( m_parent->m_contextState->gr_context(), m_texture, m_parent->capabilities_.output_surface_origin == gfx::SurfaceOrigin::kTopLeft @@ -129,6 +133,7 @@ DisplaySkiaOutputDevice::DisplaySkiaOutputDevice( , m_contextState(contextState) { capabilities_.uses_default_gl_framebuffer = false; + capabilities_.supports_surfaceless = true; capabilities_.sk_color_types[static_cast<int>(gfx::BufferFormat::RGBA_8888)] = kRGBA_8888_SkColorType; diff --git a/src/core/configure/BUILD.root.gn.in b/src/core/configure/BUILD.root.gn.in index 485c14674..e685eabbf 100644 --- a/src/core/configure/BUILD.root.gn.in +++ b/src/core/configure/BUILD.root.gn.in @@ -146,10 +146,6 @@ shared_library("QtWebEngineCore") { deps += [ "//third_party/webrtc_overrides:webrtc_component" ] } - if (use_xscrnsaver) { - deps += [ "//ui/base/x" ] - } - if (is_win) { data_deps = [ ":QtWebEngineCoreSandbox" ] } @@ -214,6 +210,7 @@ source_set("qtwebengine_sources") { "//chrome/browser/resources/quota_internals:resources", "//chrome/common:buildflags", "//chromeos/components/chromebox_for_meetings/buildflags", + "//components/custom_handlers", "//components/nacl/common:buildflags", "//components/performance_manager", "//components/plugins/renderer/", @@ -226,8 +223,9 @@ source_set("qtwebengine_sources") { sources = [ "//chrome/browser/accessibility/accessibility_ui.cc", "//chrome/browser/accessibility/accessibility_ui.h", - "//chrome/browser/custom_handlers/protocol_handler_registry.cc", - "//chrome/browser/custom_handlers/protocol_handler_registry.h", + "//chrome/browser/custom_handlers/chrome_protocol_handler_registry_delegate.cc", + "//chrome/browser/custom_handlers/chrome_protocol_handler_registry_delegate.h", + "//chrome/browser/custom_handlers/protocol_handler_registry_factory.h", "//chrome/browser/custom_handlers/protocol_handler_registry_factory.cc", "//chrome/browser/custom_handlers/protocol_handler_registry_factory.h", "//chrome/browser/devtools/devtools_eye_dropper.cc", @@ -335,13 +333,17 @@ source_set("qtwebengine_sources") { } if (enable_plugins) { sources += [ - "//chrome/renderer/pepper/pepper_flash_font_file_host.cc", - "//chrome/renderer/pepper/pepper_flash_font_file_host.h", "//chrome/renderer/pepper/pepper_shared_memory_message_filter.cc", "//chrome/renderer/pepper/pepper_shared_memory_message_filter.h", ] - if (is_linux) { - deps += [ "//pdf:font_table_linux" ] + if (enable_pdf) { + sources += [ + "//chrome/renderer/pepper/pepper_flash_font_file_host.cc", + "//chrome/renderer/pepper/pepper_flash_font_file_host.h", + ] + if (is_linux) { + deps += [ "//pdf:font_table_linux" ] + } } } if (enable_basic_printing || enable_print_preview) { diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 3d3b7d46e..70c1ad839 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -41,9 +41,9 @@ #include "base/files/file_util.h" #include "base/task/post_task.h" -#include "chrome/browser/custom_handlers/protocol_handler_registry.h" #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" #include "chrome/browser/tab_contents/form_interaction_tab_helper.h" +#include "components/custom_handlers/protocol_handler_registry.h" #include "components/error_page/common/error.h" #include "components/error_page/common/localized_error.h" #include "components/navigation_interception/intercept_navigation_throttle.h" @@ -130,7 +130,6 @@ #if QT_CONFIG(webengine_pepper_plugins) #include "content/public/browser/browser_ppapi_host.h" #include "ppapi/host/ppapi_host.h" -#include "renderer_host/pepper/pepper_host_factory_qt.h" #endif #if QT_CONFIG(webengine_spellchecker) @@ -237,7 +236,7 @@ ContentBrowserClientQt::~ContentBrowserClientQt() { } -std::unique_ptr<content::BrowserMainParts> ContentBrowserClientQt::CreateBrowserMainParts(const content::MainFunctionParams&) +std::unique_ptr<content::BrowserMainParts> ContentBrowserClientQt::CreateBrowserMainParts(content::MainFunctionParams) { Q_ASSERT(!m_browserMainParts); auto browserMainParts = std::make_unique<BrowserMainPartsQt>(); @@ -414,14 +413,6 @@ void ContentBrowserClientQt::GetAdditionalMappedFilesForChildProcess(const base: } #endif -#if QT_CONFIG(webengine_pepper_plugins) -void ContentBrowserClientQt::DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) -{ - browser_host->GetPpapiHost()->AddHostFactoryFilter( - std::make_unique<QtWebEngineCore::PepperHostFactoryQt>(browser_host)); -} -#endif - std::unique_ptr<content::DevToolsManagerDelegate> ContentBrowserClientQt::CreateDevToolsManagerDelegate() { return std::make_unique<DevToolsManagerDelegateQt>(); @@ -626,17 +617,6 @@ bool ContentBrowserClientQt::WillCreateRestrictedCookieManager(network::mojom::R return false; // only made a proxy, still need the actual impl to be made. } -bool ContentBrowserClientQt::AllowAppCache(const GURL &manifest_url, - const net::SiteForCookies &site_for_cookies, - const absl::optional<url::Origin> & /*top_frame_origin*/, - content::BrowserContext *context) -{ - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - if (!context || context->ShutdownStarted()) - return false; - return static_cast<ProfileQt *>(context)->profileAdapter()->cookieStore()->d_func()->canAccessCookies(toQt(site_for_cookies.first_party_url()), toQt(manifest_url)); -} - content::AllowServiceWorkerResult ContentBrowserClientQt::AllowServiceWorker(const GURL &scope, const net::SiteForCookies &site_for_cookies, @@ -689,11 +669,9 @@ static void LaunchURL(const GURL& url, if (!webContents) return; - ProtocolHandlerRegistry* protocolHandlerRegistry = - ProtocolHandlerRegistryFactory::GetForBrowserContext( - webContents->GetBrowserContext()); - if (protocolHandlerRegistry && - protocolHandlerRegistry->IsHandledProtocol(url.scheme())) + custom_handlers::ProtocolHandlerRegistry *protocolHandlerRegistry = + ProtocolHandlerRegistryFactory::GetForBrowserContext(webContents->GetBrowserContext()); + if (protocolHandlerRegistry && protocolHandlerRegistry->IsHandledProtocol(url.scheme())) return; // Sandbox flag logic from chrome/browser/chrome_content_browser_client.cc: @@ -756,7 +734,7 @@ namespace { class ProtocolHandlerThrottle : public blink::URLLoaderThrottle { public: - explicit ProtocolHandlerThrottle(ProtocolHandlerRegistry *protocol_handler_registry) + explicit ProtocolHandlerThrottle(custom_handlers::ProtocolHandlerRegistry *protocol_handler_registry) : protocol_handler_registry_(protocol_handler_registry) { } @@ -787,7 +765,7 @@ private: *url = translated_url; } - ProtocolHandlerRegistry *protocol_handler_registry_; + custom_handlers::ProtocolHandlerRegistry *protocol_handler_registry_; }; } // namespace @@ -890,7 +868,7 @@ bool ContentBrowserClientQt::IsHandledURL(const GURL &url) bool ContentBrowserClientQt::HasCustomSchemeHandler(content::BrowserContext *browser_context, const std::string &scheme) { - if (ProtocolHandlerRegistry *protocol_handler_registry = + if (custom_handlers::ProtocolHandlerRegistry *protocol_handler_registry = ProtocolHandlerRegistryFactory::GetForBrowserContext(browser_context)) { return protocol_handler_registry->IsHandledProtocol(scheme); } @@ -1089,8 +1067,16 @@ void ContentBrowserClientQt::RegisterNonNetworkWorkerMainResourceURLLoaderFactor void ContentBrowserClientQt::RegisterNonNetworkServiceWorkerUpdateURLLoaderFactories(content::BrowserContext* browser_context, NonNetworkURLLoaderFactoryMap* factories) { - DCHECK(browser_context); - DCHECK(factories); + Profile *profile = Profile::FromBrowserContext(browser_context); + ProfileAdapter *profileAdapter = static_cast<ProfileQt *>(profile)->profileAdapter(); + + for (const QByteArray &scheme : profileAdapter->customUrlSchemes()) { + if (const url::CustomScheme *cs = url::CustomScheme::FindScheme(scheme.toStdString())) { + if (cs->flags & url::CustomScheme::ServiceWorkersAllowed) + factories->emplace(scheme.toStdString(), CreateCustomURLLoaderFactory(profileAdapter)); + } + } + #if BUILDFLAG(ENABLE_EXTENSIONS) factories->emplace( extensions::kExtensionScheme, diff --git a/src/core/content_browser_client_qt.h b/src/core/content_browser_client_qt.h index 1239c7353..1784d720d 100644 --- a/src/core/content_browser_client_qt.h +++ b/src/core/content_browser_client_qt.h @@ -78,7 +78,7 @@ class ContentBrowserClientQt : public content::ContentBrowserClient public: ContentBrowserClientQt(); ~ContentBrowserClientQt(); - std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(const content::MainFunctionParams&) override; + std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(content::MainFunctionParams) override; void RenderProcessWillLaunch(content::RenderProcessHost *host) override; gl::GLShareGroup* GetInProcessGpuShareGroup() override; content::MediaObserver* GetMediaObserver() override; @@ -145,11 +145,6 @@ public: int routing_id, mojo::PendingReceiver<network::mojom::RestrictedCookieManager> *receiver) override; - bool AllowAppCache(const GURL &manifest_url, - const net::SiteForCookies &site_for_cookies, - const absl::optional<url::Origin> &top_frame_origin, - content::BrowserContext *context) override; - content::AllowServiceWorkerResult AllowServiceWorker( const GURL &scope, const net::SiteForCookies &site_for_cookies, @@ -190,10 +185,6 @@ public: void GetAdditionalMappedFilesForChildProcess(const base::CommandLine& command_line, int child_process_id, content::PosixFileDescriptorInfo* mappings) override; #endif -#if QT_CONFIG(webengine_pepper_plugins) - void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override; -#endif - std::unique_ptr<content::LoginDelegate> CreateLoginDelegate( const net::AuthChallengeInfo &auth_info, content::WebContents *web_contents, diff --git a/src/core/content_client_qt.cpp b/src/core/content_client_qt.cpp index cf7775f01..6c914b772 100644 --- a/src/core/content_client_qt.cpp +++ b/src/core/content_client_qt.cpp @@ -305,7 +305,7 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo> const base::Version version; cdms->push_back(content::CdmInfo(kWidevineKeySystem, Robustness::kSoftwareSecure, std::move(capability), /*supports_sub_key_systems=*/false, kWidevineCdmDisplayName, - kWidevineCdmGuid, version, cdm_path, kWidevineCdmFileSystemId)); + kWidevineCdmType, version, cdm_path, kWidevineCdmFileSystemId)); } #endif // defined(WIDEVINE_CDM_AVAILABLE_NOT_COMPONENT) @@ -335,13 +335,13 @@ void ContentClientQt::AddContentDecryptionModules(std::vector<content::CdmInfo> cdms->push_back(content::CdmInfo(kExternalClearKeyDifferentGuidTestKeySystem, Robustness::kSoftwareSecure, capability, /*supports_sub_key_systems=*/false, media::kClearKeyCdmDisplayName, - media::kClearKeyCdmDifferentGuid, base::Version("0.1.0.0"), + media::kClearKeyCdmDifferentCdmType, base::Version("0.1.0.0"), clear_key_cdm_path, media::kClearKeyCdmFileSystemId)); cdms->push_back(content::CdmInfo(kExternalClearKeyKeySystem, Robustness::kSoftwareSecure, capability, /*supports_sub_key_systems=*/true, media::kClearKeyCdmDisplayName, - media::kClearKeyCdmGuid, base::Version("0.1.0.0"), + media::kClearKeyCdmType, base::Version("0.1.0.0"), clear_key_cdm_path, media::kClearKeyCdmFileSystemId)); } #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) diff --git a/src/core/content_main_delegate_qt.cpp b/src/core/content_main_delegate_qt.cpp index 0c04fb071..86357f406 100644 --- a/src/core/content_main_delegate_qt.cpp +++ b/src/core/content_main_delegate_qt.cpp @@ -120,9 +120,6 @@ struct LazyDirectoryListerCacher dict.SetString("headerDateModified", l10n_util::GetStringUTF16(IDS_DIRECTORY_LISTING_DATE_MODIFIED)); dict.SetString("language", l10n_util::GetLanguage(base::i18n::GetConfiguredLocale())); - dict.SetString("listingParsingErrorBoxText", - l10n_util::GetStringFUTF16(IDS_DIRECTORY_LISTING_PARSING_ERROR_BOX_TEXT, - toString16(QCoreApplication::applicationName()))); dict.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); std::string html = webui::GetI18nTemplateHtml( diff --git a/src/core/delegated_frame_host_client_qt.cpp b/src/core/delegated_frame_host_client_qt.cpp index 2d3966bd5..3db613dab 100644 --- a/src/core/delegated_frame_host_client_qt.cpp +++ b/src/core/delegated_frame_host_client_qt.cpp @@ -65,9 +65,7 @@ void DelegatedFrameHostClientQt::OnFrameTokenChanged(uint32_t frame_token, base: float DelegatedFrameHostClientQt::GetDeviceScaleFactor() const { - display::ScreenInfo screen_info; - p->GetScreenInfo(&screen_info); - return screen_info.device_scale_factor; + return p->GetScreenInfo().device_scale_factor; } void DelegatedFrameHostClientQt::InvalidateLocalSurfaceIdOnEviction() diff --git a/src/core/desktop_screen_qt.cpp b/src/core/desktop_screen_qt.cpp index fd7a2c54f..e81dbb9ac 100644 --- a/src/core/desktop_screen_qt.cpp +++ b/src/core/desktop_screen_qt.cpp @@ -46,6 +46,15 @@ #include <QGuiApplication> #include <QScreen> +#if defined(USE_OZONE) +#include "ui/ozone/buildflags.h" +#if BUILDFLAG(OZONE_PLATFORM_X11) +#define USE_XSCREENSAVER +#include "ui/base/x/x11_screensaver.h" +#include "ui/base/x/x11_util.h" +#endif +#endif + #include <cmath> namespace QtWebEngineCore { @@ -137,4 +146,22 @@ display::Display DesktopScreenQt::GetDisplayNearestWindow(gfx::NativeWindow /*wi return GetPrimaryDisplay(); } +bool DesktopScreenQt::SetScreenSaverSuspended(bool suspend) +{ +#if defined(USE_XSCREENSAVER) + return ui::SuspendX11ScreenSaver(suspend); +#else + return false; +#endif +} + +bool DesktopScreenQt::IsScreenSaverActive() const +{ +#if defined(USE_XSCREENSAVER) + return ui::IsXScreensaverActive(); +#else + return false; +#endif +} + } // namespace QtWebEngineCore diff --git a/src/core/desktop_screen_qt.h b/src/core/desktop_screen_qt.h index 1b2e095a4..387be2d34 100644 --- a/src/core/desktop_screen_qt.h +++ b/src/core/desktop_screen_qt.h @@ -53,6 +53,8 @@ public: ~DesktopScreenQt() override; display::Display GetDisplayNearestWindow(gfx::NativeWindow /*window*/) const override; + bool SetScreenSaverSuspended(bool suspend) override; + bool IsScreenSaverActive() const override; private: void initializeScreens(); diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp index 46dd4e0ba..6cae5ab8b 100644 --- a/src/core/devtools_frontend_qt.cpp +++ b/src/core/devtools_frontend_qt.cpp @@ -52,7 +52,6 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/json/string_escape.h" -#include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringprintf.h" @@ -184,8 +183,6 @@ private: DevToolsFrontendQt *const bindings_; std::unique_ptr<network::SimpleURLLoader> loader_; scoped_refptr<net::HttpResponseHeaders> response_headers_; - - DISALLOW_COPY_AND_ASSIGN(NetworkResourceLoader); }; // This constant should be in sync with diff --git a/src/core/devtools_frontend_qt.h b/src/core/devtools_frontend_qt.h index 015600cf1..1a5284a0e 100644 --- a/src/core/devtools_frontend_qt.h +++ b/src/core/devtools_frontend_qt.h @@ -47,7 +47,6 @@ #include "base/compiler_specific.h" #include "base/containers/unique_ptr_adapters.h" -#include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/values.h" @@ -136,8 +135,6 @@ private: base::DictionaryValue m_preferences; scoped_refptr<PersistentPrefStore> m_prefStore; base::WeakPtrFactory<DevToolsFrontendQt> m_weakFactory; - - DISALLOW_COPY_AND_ASSIGN(DevToolsFrontendQt); }; } // namespace QtWebEngineCore diff --git a/src/core/devtools_manager_delegate_qt.cpp b/src/core/devtools_manager_delegate_qt.cpp index 51f00d3e5..2c147206b 100644 --- a/src/core/devtools_manager_delegate_qt.cpp +++ b/src/core/devtools_manager_delegate_qt.cpp @@ -93,7 +93,6 @@ private: const std::string m_address; int m_port; int m_backlog; - DISALLOW_COPY_AND_ASSIGN(TCPServerSocketFactory); }; } // namespace diff --git a/src/core/doc/src/qwebenginesettings_lgpl.qdoc b/src/core/doc/src/qwebenginesettings_lgpl.qdoc index 6a7f1f958..0fe3620c7 100644 --- a/src/core/doc/src/qwebenginesettings_lgpl.qdoc +++ b/src/core/doc/src/qwebenginesettings_lgpl.qdoc @@ -56,7 +56,7 @@ \value CursiveFont \value FantasyFont \value PictographFont - (added in Qt 5.7) + (added in Qt 5.7, deprecated Qt 6.4) */ /*! diff --git a/src/core/download_manager_delegate_qt.h b/src/core/download_manager_delegate_qt.h index 7b8de08df..cecc93c00 100644 --- a/src/core/download_manager_delegate_qt.h +++ b/src/core/download_manager_delegate_qt.h @@ -103,7 +103,6 @@ private: base::WeakPtrFactory<DownloadManagerDelegateQt> m_weakPtrFactory; friend class DownloadManagerDelegateInstance; - DISALLOW_COPY_AND_ASSIGN(DownloadManagerDelegateQt); }; } // namespace QtWebEngineCore diff --git a/src/core/extensions/component_extension_resource_manager_qt.h b/src/core/extensions/component_extension_resource_manager_qt.h index b029a7f71..b1d2aa1ac 100644 --- a/src/core/extensions/component_extension_resource_manager_qt.h +++ b/src/core/extensions/component_extension_resource_manager_qt.h @@ -47,7 +47,6 @@ #include <map> #include "base/files/file_path.h" -#include "base/macros.h" #include "extensions/browser/component_extension_resource_manager.h" #include "ui/base/webui/resource_path.h" @@ -74,8 +73,6 @@ private: // A map from an extension ID to its i18n template replacements. std::map<std::string, ui::TemplateReplacements> template_replacements_; - - DISALLOW_COPY_AND_ASSIGN(ComponentExtensionResourceManagerQt); }; } // namespace extensions diff --git a/src/core/extensions/extension_system_factory_qt.h b/src/core/extensions/extension_system_factory_qt.h index 6e840b6d6..795ab8fd2 100644 --- a/src/core/extensions/extension_system_factory_qt.h +++ b/src/core/extensions/extension_system_factory_qt.h @@ -44,7 +44,6 @@ #ifndef EXTENSION_SYSTEM_FACTORY_QT_H_ #define EXTENSION_SYSTEM_FACTORY_QT_H_ -#include "base/macros.h" #include "base/memory/singleton.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" #include "extensions/browser/extension_system_provider.h" @@ -73,8 +72,6 @@ private: KeyedService *BuildServiceInstanceFor(content::BrowserContext *context) const override; content::BrowserContext *GetBrowserContextToUse(content::BrowserContext *context) const override; bool ServiceIsCreatedWithBrowserContext() const override; - - DISALLOW_COPY_AND_ASSIGN(ExtensionSystemFactoryQt); }; } // namespace extensions diff --git a/src/core/extensions/extension_system_qt.h b/src/core/extensions/extension_system_qt.h index 9ef87fa8a..d23cf7b2f 100644 --- a/src/core/extensions/extension_system_qt.h +++ b/src/core/extensions/extension_system_qt.h @@ -50,7 +50,6 @@ #include <string> #include "base/one_shot_event.h" -#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "build/build_config.h" #include "extensions/browser/extension_system.h" @@ -144,7 +143,6 @@ private: bool initialized_; base::WeakPtrFactory<ExtensionSystemQt> weak_ptr_factory_; - DISALLOW_COPY_AND_ASSIGN(ExtensionSystemQt); }; } // namespace extensions diff --git a/src/core/extensions/extension_web_contents_observer_qt.h b/src/core/extensions/extension_web_contents_observer_qt.h index 346e94d4a..2f8d9aff8 100644 --- a/src/core/extensions/extension_web_contents_observer_qt.h +++ b/src/core/extensions/extension_web_contents_observer_qt.h @@ -66,7 +66,6 @@ public: private: friend class content::WebContentsUserData<ExtensionWebContentsObserverQt>; WEB_CONTENTS_USER_DATA_KEY_DECL(); - DISALLOW_COPY_AND_ASSIGN(ExtensionWebContentsObserverQt); }; } // namespace extensions diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp index a01b074c2..f985bc71e 100644 --- a/src/core/extensions/extensions_browser_client_qt.cpp +++ b/src/core/extensions/extensions_browser_client_qt.cpp @@ -245,8 +245,6 @@ private: mojo::Remote<network::mojom::URLLoaderClient> client_; scoped_refptr<net::HttpResponseHeaders> response_headers_; base::WeakPtrFactory<ResourceBundleFileLoader> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(ResourceBundleFileLoader); }; } // namespace @@ -266,8 +264,6 @@ public: api::ChromeGeneratedFunctionRegistry::RegisterAll(registry); } -private: - DISALLOW_COPY_AND_ASSIGN(ChromeExtensionsBrowserAPIProvider); }; class QtWebEngineExtensionsBrowserAPIProvider : public ExtensionsBrowserAPIProvider @@ -281,9 +277,6 @@ public: // Generated APIs from QtWebEngine. api::QtWebEngineGeneratedFunctionRegistry::RegisterAll(registry); } - -private: - DISALLOW_COPY_AND_ASSIGN(QtWebEngineExtensionsBrowserAPIProvider); }; ExtensionsBrowserClientQt::ExtensionsBrowserClientQt() diff --git a/src/core/extensions/extensions_browser_client_qt.h b/src/core/extensions/extensions_browser_client_qt.h index 9b07fa3e9..bb6c613fa 100644 --- a/src/core/extensions/extensions_browser_client_qt.h +++ b/src/core/extensions/extensions_browser_client_qt.h @@ -146,8 +146,6 @@ private: std::unique_ptr<ComponentExtensionResourceManager> resource_manager_; //scoped_refptr<EventRouterForwarder> event_router_forwarder_; - - DISALLOW_COPY_AND_ASSIGN(ExtensionsBrowserClientQt); }; } // namespace extensions diff --git a/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp b/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp index 16a747929..4a845ad80 100644 --- a/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp +++ b/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp @@ -70,8 +70,9 @@ MimeHandlerViewGuestDelegateQt::~MimeHandlerViewGuestDelegateQt() delete m_contextMenuRequest; } -bool MimeHandlerViewGuestDelegateQt::HandleContextMenu(content::WebContents *web_contents, const content::ContextMenuParams ¶ms) +bool MimeHandlerViewGuestDelegateQt::HandleContextMenu(content::RenderFrameHost &render_frame_host, const content::ContextMenuParams ¶ms) { + content::WebContents *web_contents = content::WebContents::FromRenderFrameHost(&render_frame_host); content::WebContents *parent_web_contents = guest_view::GuestViewBase::GetTopLevelWebContents(web_contents); if (auto rwhv = static_cast<QtWebEngineCore::RenderWidgetHostViewQt *>(parent_web_contents->GetRenderWidgetHostView())) { if (rwhv->getTouchSelectionControllerClient()->handleContextMenu(params)) diff --git a/src/core/extensions/mime_handler_view_guest_delegate_qt.h b/src/core/extensions/mime_handler_view_guest_delegate_qt.h index c9b822aa1..16e2b5bfb 100644 --- a/src/core/extensions/mime_handler_view_guest_delegate_qt.h +++ b/src/core/extensions/mime_handler_view_guest_delegate_qt.h @@ -65,12 +65,11 @@ public: explicit MimeHandlerViewGuestDelegateQt(MimeHandlerViewGuest *guest); ~MimeHandlerViewGuestDelegateQt() override; - bool HandleContextMenu(content::WebContents *web_contents, + bool HandleContextMenu(content::RenderFrameHost &render_frame_host, const content::ContextMenuParams ¶ms) override; private: QWebEngineContextMenuRequest *m_contextMenuRequest; - DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuestDelegateQt); }; } // namespace extensions diff --git a/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp b/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp index 61f64dc0b..5bfd3a316 100644 --- a/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp +++ b/src/core/extensions/pdf_iframe_navigation_throttle_qt.cpp @@ -61,6 +61,9 @@ #include "ui/base/webui/jstemplate_builder.h" #include "ui/base/webui/web_ui_util.h" +#include "web_contents_delegate_qt.h" +#include "web_engine_settings.h" + namespace extensions { constexpr char kPDFMimeType[] = "application/pdf"; @@ -86,7 +89,7 @@ public: private: friend class content::WebContentsUserData<PdfWebContentsLifetimeHelper>; - content::WebContents* const web_contents_; + content::WebContents *const web_contents_; base::WeakPtrFactory<PdfWebContentsLifetimeHelper> weak_factory_{this}; WEB_CONTENTS_USER_DATA_KEY_DECL(); @@ -97,15 +100,25 @@ WEB_CONTENTS_USER_DATA_KEY_IMPL(PdfWebContentsLifetimeHelper); bool IsPDFPluginEnabled(content::NavigationHandle *navigation_handle, bool *is_stale) { content::WebContents *web_contents = navigation_handle->GetWebContents(); + Q_ASSERT(web_contents); + + if (web_contents->IsInnerWebContentsForGuest()) + web_contents = web_contents->GetOuterWebContents(); + + if (auto *delegate = static_cast<QtWebEngineCore::WebContentsDelegateQt *>(web_contents->GetDelegate())) { + const QtWebEngineCore::WebEngineSettings *settings = delegate->webEngineSettings(); + if (!settings->testAttribute(QWebEngineSettings::PdfViewerEnabled) + || !settings->testAttribute(QWebEngineSettings::PluginsEnabled)) + return false; + } + int process_id = web_contents->GetMainFrame()->GetProcess()->GetID(); - int routing_id = web_contents->GetMainFrame()->GetRoutingID(); content::WebPluginInfo plugin_info; - // Will check WebEngineSettings by PluginServiceFilterQt return content::PluginService::GetInstance()->GetPluginInfo( - process_id, routing_id, navigation_handle->GetURL(), - web_contents->GetMainFrame()->GetLastCommittedOrigin(), kPDFMimeType, - false /* allow_wildcard */, is_stale, &plugin_info, - nullptr /* actual_mime_type */); + process_id, navigation_handle->GetURL(), + kPDFMimeType, + false /* allow_wildcard */, is_stale, &plugin_info, + nullptr /* actual_mime_type */); } std::string GetPDFPlaceholderHTML(const GURL &pdf_url) diff --git a/src/core/extensions/pdf_web_contents_helper_client_qt.h b/src/core/extensions/pdf_web_contents_helper_client_qt.h index 9a37375b3..49c670174 100644 --- a/src/core/extensions/pdf_web_contents_helper_client_qt.h +++ b/src/core/extensions/pdf_web_contents_helper_client_qt.h @@ -5,7 +5,6 @@ #ifndef PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_ #define PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_ -#include "base/macros.h" #include "components/pdf/browser/pdf_web_contents_helper_client.h" namespace extensions { @@ -21,8 +20,6 @@ private: void UpdateContentRestrictions(content::WebContents *contents, int content_restrictions) override; void OnPDFHasUnsupportedFeature(content::WebContents *contents) override; void OnSaveURL(content::WebContents *contents) override; - - DISALLOW_COPY_AND_ASSIGN(PDFWebContentsHelperClientQt); }; } // namespace extensions diff --git a/src/core/extensions/plugin_service_filter_qt.cpp b/src/core/extensions/plugin_service_filter_qt.cpp index 778f803c3..51349ff68 100644 --- a/src/core/extensions/plugin_service_filter_qt.cpp +++ b/src/core/extensions/plugin_service_filter_qt.cpp @@ -39,10 +39,11 @@ #include "extensions/plugin_service_filter_qt.h" -#include "content/public/browser/render_frame_host.h" -#include "content/public/browser/web_contents.h" +#include "content/public/browser/render_process_host.h" -#include "web_contents_delegate_qt.h" +#include "profile_adapter.h" +#include "profile_adapter_client.h" +#include "profile_qt.h" #include "web_engine_settings.h" using namespace QtWebEngineCore; @@ -50,31 +51,24 @@ using namespace QtWebEngineCore; namespace extensions { // static -PluginServiceFilterQt *PluginServiceFilterQt::GetInstance() { +PluginServiceFilterQt *PluginServiceFilterQt::GetInstance() +{ return base::Singleton<PluginServiceFilterQt>::get(); } bool PluginServiceFilterQt::IsPluginAvailable(int render_process_id, - int render_frame_id, - const GURL &url, - const url::Origin &main_frame_origin, - content::WebPluginInfo *plugin) + const content::WebPluginInfo &plugin) { - content::RenderFrameHost *frame_host = content::RenderFrameHost::FromID(render_process_id, render_frame_id); - content::WebContents *web_contents = content::WebContents::FromRenderFrameHost(frame_host); - if (!web_contents) { - // Availability checked somewhere before/during WebContents initialization. Let it load and enable - // all the plugins at this phase. This information will be queried again when receiving the response - // for the requested content. Postponing our decision and enabling/blocking there makes WebEngineSettings - // modifiable in runtime without reconstructing WebContents. - return true; - } + Q_UNUSED(plugin); + content::RenderProcessHost *rph = content::RenderProcessHost::FromID(render_process_id); + if (!rph) + return false; - if (web_contents->IsInnerWebContentsForGuest()) - web_contents = web_contents->GetOuterWebContents(); - - if (auto *delegate = static_cast<WebContentsDelegateQt *>(web_contents->GetDelegate())) { - const WebEngineSettings *settings = delegate->webEngineSettings(); + ProfileQt *profile = static_cast<ProfileQt *>(rph->GetBrowserContext()); + for (auto *client : profile->profileAdapter()->clients()) { + const WebEngineSettings *settings = client->coreSettings(); + if (!settings) + return false; if (!settings->testAttribute(QWebEngineSettings::PdfViewerEnabled) || !settings->testAttribute(QWebEngineSettings::PluginsEnabled)) return false; diff --git a/src/core/extensions/plugin_service_filter_qt.h b/src/core/extensions/plugin_service_filter_qt.h index ea5f082f2..3a550f9e7 100644 --- a/src/core/extensions/plugin_service_filter_qt.h +++ b/src/core/extensions/plugin_service_filter_qt.h @@ -51,10 +51,7 @@ public: static PluginServiceFilterQt* GetInstance(); bool IsPluginAvailable(int render_process_id, - int render_frame_id, - const GURL &url, - const url::Origin &main_frame_origin, - content::WebPluginInfo *plugin) override; + const content::WebPluginInfo &plugin) override; bool CanLoadPlugin(int render_process_id, const base::FilePath &path) override; diff --git a/src/core/favicon_driver_qt.h b/src/core/favicon_driver_qt.h index 4de85104a..c3519ea58 100644 --- a/src/core/favicon_driver_qt.h +++ b/src/core/favicon_driver_qt.h @@ -160,7 +160,6 @@ private: FaviconStatusQt m_latestFavicon; WEB_CONTENTS_USER_DATA_KEY_DECL(); - DISALLOW_COPY_AND_ASSIGN(FaviconDriverQt); }; } // namespace QtWebEngineCore diff --git a/src/core/file_picker_controller.cpp b/src/core/file_picker_controller.cpp index 140cb7dba..6b11342c4 100644 --- a/src/core/file_picker_controller.cpp +++ b/src/core/file_picker_controller.cpp @@ -287,7 +287,7 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp const QMimeType &mimeType = mimeDatabase.mimeTypeForName(type); if (mimeType.isValid() && !mimeType.globPatterns().isEmpty()) { QString globs = mimeType.globPatterns().join(" "); - acceptedGlobs.append(globs); + acceptedGlobs.append(mimeType.globPatterns()); nameFilters.append(mimeType.comment() + " (" + globs + ")"); } } else if (type.endsWith("/*")) { @@ -298,7 +298,7 @@ QStringList FilePickerController::nameFilters(const QStringList &acceptedMimeTyp for (const QMimeType &m : allMimeTypes) { if (m.name().startsWith(type) && !m.globPatterns().isEmpty()) { QString globs = m.globPatterns().join(" "); - acceptedGlobs.append(globs); + acceptedGlobs.append(m.globPatterns()); nameFilters.append(m.comment() + " (" + globs + ")"); } } diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index c976798ae..63dcab1a2 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -283,8 +283,6 @@ private: const blink::MediaStreamDevices m_devices; bool m_started = false; base::OnceClosure m_onStop; // currently unused - - DISALLOW_COPY_AND_ASSIGN(MediaStreamUIQt); }; } // namespace diff --git a/src/core/media_capture_devices_dispatcher.h b/src/core/media_capture_devices_dispatcher.h index 91ddc30a8..3a03a2ff2 100644 --- a/src/core/media_capture_devices_dispatcher.h +++ b/src/core/media_capture_devices_dispatcher.h @@ -119,8 +119,6 @@ private: WebContentsCollection m_webContentsCollection; bool m_loopbackAudioSupported = false; - - DISALLOW_COPY_AND_ASSIGN(MediaCaptureDevicesDispatcher); }; } // namespace QtWebEngineCore diff --git a/src/core/net/client_cert_store_data.cpp b/src/core/net/client_cert_store_data.cpp index 1a957e691..ec360c2ad 100644 --- a/src/core/net/client_cert_store_data.cpp +++ b/src/core/net/client_cert_store_data.cpp @@ -41,7 +41,6 @@ #if QT_CONFIG(ssl) #include "base/logging.h" -#include "base/macros.h" #include "base/memory/ptr_util.h" #include "net/base/net_errors.h" #include "net/cert/x509_certificate.h" @@ -113,8 +112,6 @@ public: private: EVP_PKEY *m_key; BIO *m_mem; - - DISALLOW_COPY_AND_ASSIGN(SSLPlatformKeyOverride); }; scoped_refptr<net::SSLPrivateKey> wrapOpenSSLPrivateKey(const QByteArray &sslKeyInBytes) diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp index 274326395..fed552834 100644 --- a/src/core/net/cookie_monster_delegate_qt.cpp +++ b/src/core/net/cookie_monster_delegate_qt.cpp @@ -67,8 +67,6 @@ public: private: CookieMonsterDelegateQt *m_delegate; - - DISALLOW_COPY_AND_ASSIGN(CookieChangeListener); }; class CookieAccessFilter : public network::mojom::CookieRemoteAccessFilter @@ -85,8 +83,6 @@ public: private: CookieMonsterDelegateQt *m_delegate; - - DISALLOW_COPY_AND_ASSIGN(CookieAccessFilter); }; diff --git a/src/core/net/custom_url_loader_factory.cpp b/src/core/net/custom_url_loader_factory.cpp index 6cb272b1c..c6ca29f37 100644 --- a/src/core/net/custom_url_loader_factory.cpp +++ b/src/core/net/custom_url_loader_factory.cpp @@ -470,8 +470,6 @@ private: bool m_isLocal; base::WeakPtrFactory<CustomURLLoader> m_weakPtrFactory{this}; - - DISALLOW_COPY_AND_ASSIGN(CustomURLLoader); }; class CustomURLLoaderFactory : public network::mojom::URLLoaderFactory { @@ -527,7 +525,6 @@ public: const scoped_refptr<base::SequencedTaskRunner> m_taskRunner; mojo::ReceiverSet<network::mojom::URLLoaderFactory> m_receivers; QPointer<ProfileAdapter> m_profileAdapter; - DISALLOW_COPY_AND_ASSIGN(CustomURLLoaderFactory); }; } // namespace diff --git a/src/core/net/plugin_response_interceptor_url_loader_throttle.h b/src/core/net/plugin_response_interceptor_url_loader_throttle.h index d4ff87846..7d77b035e 100644 --- a/src/core/net/plugin_response_interceptor_url_loader_throttle.h +++ b/src/core/net/plugin_response_interceptor_url_loader_throttle.h @@ -40,7 +40,6 @@ #ifndef PLUGIN_RESPONSE_INTERCEPTOR_URL_LOADER_THROTTLE_H_ #define PLUGIN_RESPONSE_INTERCEPTOR_URL_LOADER_THROTTLE_H_ -#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "services/network/public/mojom/fetch_api.mojom-shared.h" #include "third_party/blink/public/common/loader/url_loader_throttle.h" @@ -71,8 +70,6 @@ private: base::WeakPtrFactory<PluginResponseInterceptorURLLoaderThrottle> weak_factory_{this}; - - DISALLOW_COPY_AND_ASSIGN(PluginResponseInterceptorURLLoaderThrottle); }; } // namespace QtWebEngineCore diff --git a/src/core/net/proxy_config_monitor.h b/src/core/net/proxy_config_monitor.h index fda6a6fb9..873725157 100644 --- a/src/core/net/proxy_config_monitor.h +++ b/src/core/net/proxy_config_monitor.h @@ -48,7 +48,6 @@ #include <memory> #include <string> -#include "base/macros.h" #include "build/buildflag.h" #include "extensions/buildflags/buildflags.h" #include "mojo/public/cpp/bindings/receiver_set.h" @@ -96,8 +95,6 @@ private: mojo::ReceiverSet<network::mojom::ProxyConfigPollerClient> poller_receiver_set_; mojo::RemoteSet<network::mojom::ProxyConfigClient> proxy_config_client_set_; - - DISALLOW_COPY_AND_ASSIGN(ProxyConfigMonitor); }; #endif // !PROXY_CONFIG_MONITOR_H diff --git a/src/core/net/proxy_config_service_qt.cpp b/src/core/net/proxy_config_service_qt.cpp index bc934c960..23538216e 100644 --- a/src/core/net/proxy_config_service_qt.cpp +++ b/src/core/net/proxy_config_service_qt.cpp @@ -71,7 +71,7 @@ net::ProxyServer ProxyConfigServiceQt::fromQNetworkProxy(const QNetworkProxy &qt } ProxyConfigServiceQt::ProxyConfigServiceQt(PrefService *prefService, - const scoped_refptr<base::SingleThreadTaskRunner> &taskRunner) + const scoped_refptr<base::SequencedTaskRunner> &taskRunner) : m_baseService(net::ConfiguredProxyResolutionService::CreateSystemProxyConfigService(taskRunner)) , m_usesSystemConfiguration(false) , m_registeredObserver(false) diff --git a/src/core/net/proxy_config_service_qt.h b/src/core/net/proxy_config_service_qt.h index c0928bc03..e7f2af56c 100644 --- a/src/core/net/proxy_config_service_qt.h +++ b/src/core/net/proxy_config_service_qt.h @@ -42,7 +42,7 @@ #include "base/memory/ref_counted.h" #include "base/observer_list.h" -#include "base/single_thread_task_runner.h" +#include "base/task/sequenced_task_runner.h" #include "net/proxy_resolution/proxy_config.h" #include "net/proxy_resolution/proxy_config_service.h" @@ -61,7 +61,7 @@ public: static net::ProxyServer fromQNetworkProxy(const QNetworkProxy &); explicit ProxyConfigServiceQt(PrefService *prefService, - const scoped_refptr<base::SingleThreadTaskRunner> &taskRunner); + const scoped_refptr<base::SequencedTaskRunner> &taskRunner); ~ProxyConfigServiceQt() override; // ProxyConfigService implementation: @@ -97,8 +97,6 @@ private: ProxyPrefs::ConfigState m_prefState; SEQUENCE_CHECKER(m_sequenceChecker); - - DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceQt); }; #endif // PROXY_CONFIG_SERVICE_QT_H diff --git a/src/core/net/proxying_restricted_cookie_manager_qt.h b/src/core/net/proxying_restricted_cookie_manager_qt.h index 37271dfd3..eae2eb9e6 100644 --- a/src/core/net/proxying_restricted_cookie_manager_qt.h +++ b/src/core/net/proxying_restricted_cookie_manager_qt.h @@ -40,7 +40,6 @@ #ifndef PROXYING_RESTRICTED_COOKIE_MANAGER_QT_H #define PROXYING_RESTRICTED_COOKIE_MANAGER_QT_H -#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "mojo/public/cpp/bindings/remote.h" #include "services/network/public/mojom/restricted_cookie_manager.mojom.h" @@ -106,8 +105,6 @@ private: mojo::Remote<network::mojom::RestrictedCookieManager> underlying_restricted_cookie_manager_; base::WeakPtrFactory<ProxyingRestrictedCookieManagerQt> weak_factory_; - - DISALLOW_COPY_AND_ASSIGN(ProxyingRestrictedCookieManagerQt); }; } // namespace QtWebEngineCore diff --git a/src/core/net/proxying_url_loader_factory_qt.cpp b/src/core/net/proxying_url_loader_factory_qt.cpp index 9bdebf6be..32f4045f7 100644 --- a/src/core/net/proxying_url_loader_factory_qt.cpp +++ b/src/core/net/proxying_url_loader_factory_qt.cpp @@ -192,7 +192,6 @@ private: mojo::Remote<network::mojom::URLLoaderFactory> target_factory_; base::WeakPtrFactory<InterceptedRequest> weak_factory_; - DISALLOW_COPY_AND_ASSIGN(InterceptedRequest); }; InterceptedRequest::InterceptedRequest(ProfileAdapter *profile_adapter, diff --git a/src/core/net/proxying_url_loader_factory_qt.h b/src/core/net/proxying_url_loader_factory_qt.h index ae8e41eaf..867c902ee 100644 --- a/src/core/net/proxying_url_loader_factory_qt.h +++ b/src/core/net/proxying_url_loader_factory_qt.h @@ -41,7 +41,6 @@ #define PROXYING_URL_LOADER_FACTORY_QT_H_ #include "base/callback.h" -#include "base/macros.h" #include "base/memory/weak_ptr.h" #include "mojo/public/cpp/bindings/receiver_set.h" #include "net/traffic_annotation/network_traffic_annotation.h" @@ -85,8 +84,6 @@ private: mojo::ReceiverSet<network::mojom::URLLoaderFactory> m_proxyReceivers; mojo::Remote<network::mojom::URLLoaderFactory> m_targetFactory; base::WeakPtrFactory<ProxyingURLLoaderFactoryQt> m_weakFactory; - - DISALLOW_COPY_AND_ASSIGN(ProxyingURLLoaderFactoryQt); }; } // namespace QtWebEngineCore diff --git a/src/core/net/system_network_context_manager.cpp b/src/core/net/system_network_context_manager.cpp index 5b61756d9..b2402759b 100644 --- a/src/core/net/system_network_context_manager.cpp +++ b/src/core/net/system_network_context_manager.cpp @@ -143,8 +143,6 @@ private: SEQUENCE_CHECKER(sequence_checker_); SystemNetworkContextManager *manager_; - - DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryForSystem); }; network::mojom::NetworkContext *SystemNetworkContextManager::GetContext() diff --git a/src/core/net/system_network_context_manager.h b/src/core/net/system_network_context_manager.h index 0078d710a..5dba29b3e 100644 --- a/src/core/net/system_network_context_manager.h +++ b/src/core/net/system_network_context_manager.h @@ -47,7 +47,6 @@ #include <memory> -#include "base/macros.h" #include "services/network/public/mojom/network_context.mojom.h" #include "services/network/public/mojom/network_service.mojom-forward.h" #include "services/network/public/mojom/url_loader_factory.mojom.h" @@ -149,8 +148,6 @@ private: mojo::Remote<network::mojom::URLLoaderFactory> url_loader_factory_; ProxyConfigMonitor proxy_config_monitor_; - - DISALLOW_COPY_AND_ASSIGN(SystemNetworkContextManager); }; #endif // SYSTEM_NETWORK_CONTEXT_MANAGER_H_ diff --git a/src/core/net/url_request_custom_job_proxy.h b/src/core/net/url_request_custom_job_proxy.h index 1d9eebb24..89ba920e2 100644 --- a/src/core/net/url_request_custom_job_proxy.h +++ b/src/core/net/url_request_custom_job_proxy.h @@ -41,7 +41,7 @@ #define URL_REQUEST_CUSTOM_JOB_PROXY_H_ #include "base/memory/weak_ptr.h" -#include "base/sequenced_task_runner.h" +#include "base/task/sequenced_task_runner.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "url/gurl.h" #include "url/origin.h" diff --git a/src/core/net/webui_controller_factory_qt.h b/src/core/net/webui_controller_factory_qt.h index b5f01a504..e3d24099c 100644 --- a/src/core/net/webui_controller_factory_qt.h +++ b/src/core/net/webui_controller_factory_qt.h @@ -40,7 +40,6 @@ #ifndef WEB_UI_CONTROLLER_FACTORY_QT_H_ #define WEB_UI_CONTROLLER_FACTORY_QT_H_ -#include "base/macros.h" #include "base/memory/singleton.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_controller_factory.h" @@ -62,8 +61,6 @@ protected: private: friend struct base::DefaultSingletonTraits<WebUIControllerFactoryQt>; - - DISALLOW_COPY_AND_ASSIGN(WebUIControllerFactoryQt); }; } // namespace QtWebEngineCore diff --git a/src/core/ozone/gl_ozone_glx_qt.h b/src/core/ozone/gl_ozone_glx_qt.h index 997142842..e2d33b92d 100644 --- a/src/core/ozone/gl_ozone_glx_qt.h +++ b/src/core/ozone/gl_ozone_glx_qt.h @@ -40,7 +40,6 @@ #ifndef UI_OZONE_GLX_QT_H_ #define UI_OZONE_GLX_QT_H_ -#include "base/macros.h" #include "ui/gl/gl_implementation.h" #include "ui/ozone/public/gl_ozone.h" @@ -75,9 +74,6 @@ public: scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface( const gfx::Size& size) override; - -private: - DISALLOW_COPY_AND_ASSIGN(GLOzoneGLXQt); }; } // namespace ui diff --git a/src/core/ozone/gl_surface_egl_qt.cpp b/src/core/ozone/gl_surface_egl_qt.cpp index 4c8e4fcb1..fa2fdc0bb 100644 --- a/src/core/ozone/gl_surface_egl_qt.cpp +++ b/src/core/ozone/gl_surface_egl_qt.cpp @@ -138,6 +138,21 @@ bool GLSurfaceEGL::IsRobustnessVideoMemoryPurgeSupported() return false; } +bool GLSurfaceEGL::IsANGLEContextVirtualizationSupported() +{ + return false; +} + +bool GLSurfaceEGL::IsANGLEVulkanImageClientBufferSupported() +{ + return false; +} + +bool GLSurfaceEGL::IsEGLQueryDeviceSupported() +{ + return false; +} + void GLSurfaceEGL::ShutdownOneOff() { } diff --git a/src/core/ozone/gl_surface_egl_qt.h b/src/core/ozone/gl_surface_egl_qt.h index dff25e433..4209d440e 100644 --- a/src/core/ozone/gl_surface_egl_qt.h +++ b/src/core/ozone/gl_surface_egl_qt.h @@ -69,7 +69,6 @@ public: private: EGLSurface m_surfaceBuffer; static bool s_initialized; - DISALLOW_COPY_AND_ASSIGN(GLSurfaceEGLQt); }; // The following comment is cited from chromium/ui/gl/gl_surface_egl.cc: @@ -89,9 +88,6 @@ public: const gfx::ColorSpace &color_space, bool has_alpha) override; EGLSurface GetHandle() override; void* GetShareHandle() override; - -private: - DISALLOW_COPY_AND_ASSIGN(GLSurfacelessQtEGL); }; } diff --git a/src/core/ozone/gl_surface_glx_qt.h b/src/core/ozone/gl_surface_glx_qt.h index fb17c5aca..96a17c41e 100644 --- a/src/core/ozone/gl_surface_glx_qt.h +++ b/src/core/ozone/gl_surface_glx_qt.h @@ -61,7 +61,6 @@ protected: private: static bool s_initialized; int m_surfaceBuffer; - DISALLOW_COPY_AND_ASSIGN(GLSurfaceGLXQt); }; } diff --git a/src/core/ozone/gl_surface_qt.cpp b/src/core/ozone/gl_surface_qt.cpp index 8af3bd3c1..7110a00df 100644 --- a/src/core/ozone/gl_surface_qt.cpp +++ b/src/core/ozone/gl_surface_qt.cpp @@ -130,7 +130,7 @@ bool InitializeGLOneOffPlatform() if (GetGLImplementation() == kGLImplementationEGLGLES2 || GetGLImplementation() == kGLImplementationEGLANGLE) return GLSurfaceEGLQt::InitializeOneOff(); - if (GetGLImplementation() == kGLImplementationDesktopGL) + if (GetGLImplementation() == kGLImplementationDesktopGL || GetGLImplementation() == kGLImplementationDesktopGLCoreProfile) return GLSurfaceWGLQt::InitializeOneOff(); return false; diff --git a/src/core/ozone/gl_surface_qt.h b/src/core/ozone/gl_surface_qt.h index 055b27875..926657348 100644 --- a/src/core/ozone/gl_surface_qt.h +++ b/src/core/ozone/gl_surface_qt.h @@ -73,9 +73,6 @@ public: static void* g_display; static const char* g_extensions; static const char* g_client_extensions; - -private: - DISALLOW_COPY_AND_ASSIGN(GLSurfaceQt); }; } diff --git a/src/core/ozone/gl_surface_wgl_qt.h b/src/core/ozone/gl_surface_wgl_qt.h index 2b562b61b..a0c51a801 100644 --- a/src/core/ozone/gl_surface_wgl_qt.h +++ b/src/core/ozone/gl_surface_wgl_qt.h @@ -65,7 +65,6 @@ protected: private: scoped_refptr<PbufferGLSurfaceWGL> m_surfaceBuffer; - DISALLOW_COPY_AND_ASSIGN(GLSurfaceWGLQt); }; } diff --git a/src/core/ozone/ozone_platform_qt.cpp b/src/core/ozone/ozone_platform_qt.cpp index 0affec0d3..5fe145732 100644 --- a/src/core/ozone/ozone_platform_qt.cpp +++ b/src/core/ozone/ozone_platform_qt.cpp @@ -41,11 +41,11 @@ #if defined(USE_OZONE) #include "ui/base/buildflags.h" -#include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" #include "ui/base/ime/input_method.h" #include "ui/display/types/native_display_delegate.h" #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h" #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h" +#include "ui/ozone/common/bitmap_cursor_factory.h" #include "ui/ozone/common/stub_client_native_pixmap_factory.h" #include "ui/ozone/common/stub_overlay_manager.h" #include "ui/ozone/public/gpu_platform_support_host.h" @@ -95,7 +95,7 @@ private: void InitScreen(ui::PlatformScreen *) override {} std::unique_ptr<QtWebEngineCore::SurfaceFactoryQt> surface_factory_ozone_; - std::unique_ptr<CursorFactory> cursor_factory_ozone_; + std::unique_ptr<CursorFactory> cursor_factory_; std::unique_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; std::unique_ptr<InputController> input_controller_; @@ -105,8 +105,6 @@ private: XkbEvdevCodes m_xkbEvdevCodeConverter; #endif std::unique_ptr<KeyboardLayoutEngine> m_keyboardLayoutEngine; - - DISALLOW_COPY_AND_ASSIGN(OzonePlatformQt); }; @@ -121,7 +119,7 @@ ui::SurfaceFactoryOzone* OzonePlatformQt::GetSurfaceFactoryOzone() ui::CursorFactory* OzonePlatformQt::GetCursorFactory() { - return cursor_factory_ozone_.get(); + return cursor_factory_.get(); } GpuPlatformSupportHost* OzonePlatformQt::GetGpuPlatformSupportHost() @@ -231,7 +229,7 @@ void OzonePlatformQt::InitializeUI(const ui::OzonePlatform::InitParams &) overlay_manager_.reset(new StubOverlayManager()); input_controller_ = CreateStubInputController(); - cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone()); + cursor_factory_.reset(new BitmapCursorFactory()); gpu_platform_support_host_.reset(ui::CreateStubGpuPlatformSupportHost()); } diff --git a/src/core/ozone/platform_window_qt.h b/src/core/ozone/platform_window_qt.h index 6a0984da8..07a3e8f95 100644 --- a/src/core/ozone/platform_window_qt.h +++ b/src/core/ozone/platform_window_qt.h @@ -42,6 +42,7 @@ #if defined(USE_OZONE) +#include "ui/base/cursor/platform_cursor.h" #include "ui/events/platform/platform_event_dispatcher.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/rect.h" @@ -92,8 +93,6 @@ public: private: PlatformWindowDelegate* delegate_; gfx::Rect bounds_; - - DISALLOW_COPY_AND_ASSIGN(PlatformWindowQt); }; } diff --git a/src/core/permission_manager_qt.cpp b/src/core/permission_manager_qt.cpp index 686e61216..657048dd4 100644 --- a/src/core/permission_manager_qt.cpp +++ b/src/core/permission_manager_qt.cpp @@ -89,7 +89,6 @@ static ProfileAdapter::PermissionType toQt(content::PermissionType type) case content::PermissionType::STORAGE_ACCESS_GRANT: case content::PermissionType::FONT_ACCESS: case content::PermissionType::DISPLAY_CAPTURE: - case content::PermissionType::FILE_HANDLING: case content::PermissionType::NUM: LOG(INFO) << "Unexpected unsupported permission type: " << static_cast<int>(type); break; @@ -132,8 +131,8 @@ PermissionManagerQt::~PermissionManagerQt() void PermissionManagerQt::permissionRequestReply(const QUrl &url, ProfileAdapter::PermissionType type, ProfileAdapter::PermissionState reply) { - // Normalize the QUrl to GURL origin form. - const GURL gorigin = toGurl(url).GetOrigin(); + // Normalize the QUrl to Chromium origin form. + const GURL gorigin = toGurl(url).DeprecatedGetOriginAsURL(); const QUrl origin = gorigin.is_empty() ? url : toQt(gorigin); if (origin.isEmpty()) return; @@ -323,7 +322,7 @@ blink::mojom::PermissionStatus PermissionManagerQt::GetPermissionStatusForFrame( return GetPermissionStatus( permission, requesting_origin, - content::WebContents::FromRenderFrameHost(render_frame_host)->GetLastCommittedURL().GetOrigin()); + render_frame_host->GetLastCommittedOrigin().GetURL()); } void PermissionManagerQt::ResetPermission( diff --git a/src/core/printing/print_view_manager_base_qt.cpp b/src/core/printing/print_view_manager_base_qt.cpp index 271dc0041..cfe9b5ce9 100644 --- a/src/core/printing/print_view_manager_base_qt.cpp +++ b/src/core/printing/print_view_manager_base_qt.cpp @@ -49,7 +49,6 @@ #include "base/memory/ref_counted_memory.h" #include "base/run_loop.h" -#include "base/single_thread_task_runner.h" #include "base/task/current_thread.h" #include "base/task/post_task.h" #include "base/timer/timer.h" @@ -464,9 +463,6 @@ void PrintViewManagerBaseQt::OnNotifyPrintJobEvent(const printing::JobEventDetai // break; // } case printing::JobEventDetails::NEW_DOC: -#if defined(OS_WIN) - case printing::JobEventDetails::PAGE_DONE: -#endif case printing::JobEventDetails::DOC_DONE: { // Don't care about the actual printing process. break; @@ -635,7 +631,7 @@ bool PrintViewManagerBaseQt::RunInnerMessageLoop() base::OneShotTimer quit_timer; base::RunLoop run_loop; quit_timer.Start(FROM_HERE, - base::TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), + base::Milliseconds(kPrinterSettingsTimeout), run_loop.QuitWhenIdleClosure()); m_quitInnerLoop = run_loop.QuitClosure(); diff --git a/src/core/printing/print_view_manager_base_qt.h b/src/core/printing/print_view_manager_base_qt.h index 96c2d441c..f3134832e 100644 --- a/src/core/printing/print_view_manager_base_qt.h +++ b/src/core/printing/print_view_manager_base_qt.h @@ -183,8 +183,6 @@ private: // rendered or the print settings are being loaded. base::OnceClosure m_quitInnerLoop; scoped_refptr<printing::PrintQueriesQueue> m_printerQueriesQueue; - - DISALLOW_COPY_AND_ASSIGN(PrintViewManagerBaseQt); }; } // namespace QtWebEngineCore diff --git a/src/core/printing/print_view_manager_qt.cpp b/src/core/printing/print_view_manager_qt.cpp index a044c918e..7eace04f5 100644 --- a/src/core/printing/print_view_manager_qt.cpp +++ b/src/core/printing/print_view_manager_qt.cpp @@ -331,9 +331,9 @@ void PrintViewManagerQt::NavigationStopped() PrintViewManagerBaseQt::NavigationStopped(); } -void PrintViewManagerQt::RenderProcessGone(base::TerminationStatus status) +void PrintViewManagerQt::PrimaryMainFrameRenderProcessGone(base::TerminationStatus status) { - PrintViewManagerBaseQt::RenderProcessGone(status); + PrintViewManagerBaseQt::PrimaryMainFrameRenderProcessGone(status); if (!m_pdfPrintCallback.is_null()) { base::PostTask(FROM_HERE, {content::BrowserThread::UI}, base::BindOnce(std::move(m_pdfPrintCallback), QSharedPointer<QByteArray>())); diff --git a/src/core/printing/print_view_manager_qt.h b/src/core/printing/print_view_manager_qt.h index bc55c57fe..49ccd8164 100644 --- a/src/core/printing/print_view_manager_qt.h +++ b/src/core/printing/print_view_manager_qt.h @@ -98,7 +98,7 @@ protected: void NavigationStopped() override; // Terminates or cancels the print job if one was pending. - void RenderProcessGone(base::TerminationStatus status) override; + void PrimaryMainFrameRenderProcessGone(base::TerminationStatus status) override; void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; @@ -126,7 +126,6 @@ private: std::unique_ptr<base::DictionaryValue> m_printSettings; friend class content::WebContentsUserData<PrintViewManagerQt>; - DISALLOW_COPY_AND_ASSIGN(PrintViewManagerQt); }; } // namespace QtWebEngineCore diff --git a/src/core/process_main.cpp b/src/core/process_main.cpp index 709f8bd6d..e9f4fd8d5 100644 --- a/src/core/process_main.cpp +++ b/src/core/process_main.cpp @@ -59,7 +59,7 @@ int processMain(int argc, const char **argv) #if defined(OS_WIN) HINSTANCE instance_handle = NULL; params.sandbox_info = QtWebEngineSandbox::staticSandboxInterfaceInfo(); - sandbox::SandboxInterfaceInfo sandbox_info = {0}; + sandbox::SandboxInterfaceInfo sandbox_info = {nullptr}; if (!params.sandbox_info) { content::InitializeSandboxInfo(&sandbox_info); params.sandbox_info = &sandbox_info; @@ -77,7 +77,7 @@ int processMain(int argc, const char **argv) } #endif // defined(OS_MAC) - return content::ContentMain(params); + return content::ContentMain(std::move(params)); } } // namespace QtWebEngineCore diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index fcb2c0bce..c33eadbb0 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -698,7 +698,11 @@ QString ProfileAdapter::determineDownloadPath(const QString &downloadDirectory, QString suggestedFilePath = suggestedFile.absoluteFilePath(); base::FilePath tmpFilePath(toFilePath(suggestedFilePath).NormalizePathSeparatorsTo('/')); - int uniquifier = base::GetUniquePathNumber(tmpFilePath); + int uniquifier = 0; + { + base::ScopedAllowBlocking allowBlock; + uniquifier = base::GetUniquePathNumber(tmpFilePath); + } if (uniquifier > 0) suggestedFilePath = toQt(tmpFilePath.InsertBeforeExtensionASCII(base::StringPrintf(" (%d)", uniquifier)).AsUTF8Unsafe()); else if (uniquifier == -1) { diff --git a/src/core/profile_adapter_client.h b/src/core/profile_adapter_client.h index 9329b504c..5a96fa60a 100644 --- a/src/core/profile_adapter_client.h +++ b/src/core/profile_adapter_client.h @@ -60,6 +60,7 @@ namespace QtWebEngineCore { class WebContentsAdapterClient; +class WebEngineSettings; class UserNotificationController; class Q_WEBENGINECORE_PRIVATE_EXPORT ProfileAdapterClient @@ -144,6 +145,7 @@ public: virtual void addWebContentsAdapterClient(WebContentsAdapterClient *adapter) = 0; virtual void removeWebContentsAdapterClient(WebContentsAdapterClient *adapter) = 0; + virtual WebEngineSettings *coreSettings() const = 0; static QString downloadInterruptReasonToString(DownloadInterruptReason reason); }; diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h index 5a0f2241e..246f67038 100644 --- a/src/core/profile_io_data_qt.h +++ b/src/core/profile_io_data_qt.h @@ -147,7 +147,6 @@ private: QString m_dataPath; bool m_clearHttpCacheInProgress = false; base::WeakPtrFactory<ProfileIODataQt> m_weakPtrFactory; // this should be always the last member - DISALLOW_COPY_AND_ASSIGN(ProfileIODataQt); friend class BrowsingDataRemoverObserverQt; }; diff --git a/src/core/profile_qt.h b/src/core/profile_qt.h index 8e6bacc3a..b9c2e0489 100644 --- a/src/core/profile_qt.h +++ b/src/core/profile_qt.h @@ -129,8 +129,6 @@ private: friend class ProfileAdapter; friend class ProfileIODataQt; - - DISALLOW_COPY_AND_ASSIGN(ProfileQt); }; } // namespace QtWebEngineCore diff --git a/src/core/register_protocol_handler_request_controller_impl.cpp b/src/core/register_protocol_handler_request_controller_impl.cpp index f16894799..961ca82b4 100644 --- a/src/core/register_protocol_handler_request_controller_impl.cpp +++ b/src/core/register_protocol_handler_request_controller_impl.cpp @@ -39,6 +39,7 @@ #include "register_protocol_handler_request_controller_impl.h" #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" +#include "components/custom_handlers/protocol_handler_registry.h" #include "content/public/browser/web_contents.h" #include "type_conversion.h" @@ -59,7 +60,7 @@ RegisterProtocolHandlerRequestControllerImpl::~RegisterProtocolHandlerRequestCon reject(); } -ProtocolHandlerRegistry *RegisterProtocolHandlerRequestControllerImpl::protocolHandlerRegistry() +custom_handlers::ProtocolHandlerRegistry *RegisterProtocolHandlerRequestControllerImpl::protocolHandlerRegistry() { content::WebContents *webContents = web_contents(); if (!webContents) @@ -70,13 +71,13 @@ ProtocolHandlerRegistry *RegisterProtocolHandlerRequestControllerImpl::protocolH void RegisterProtocolHandlerRequestControllerImpl::accepted() { - if (ProtocolHandlerRegistry *registry = protocolHandlerRegistry()) + if (custom_handlers::ProtocolHandlerRegistry *registry = protocolHandlerRegistry()) registry->OnAcceptRegisterProtocolHandler(m_handler); } void RegisterProtocolHandlerRequestControllerImpl::rejected() { - if (ProtocolHandlerRegistry *registry = protocolHandlerRegistry()) + if (custom_handlers::ProtocolHandlerRegistry *registry = protocolHandlerRegistry()) registry->OnIgnoreRegisterProtocolHandler(m_handler); } diff --git a/src/core/register_protocol_handler_request_controller_impl.h b/src/core/register_protocol_handler_request_controller_impl.h index fb2cadc96..102c943be 100644 --- a/src/core/register_protocol_handler_request_controller_impl.h +++ b/src/core/register_protocol_handler_request_controller_impl.h @@ -42,11 +42,12 @@ #include "register_protocol_handler_request_controller.h" -#include "chrome/browser/custom_handlers/protocol_handler_registry.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/common/custom_handlers/protocol_handler.h" +namespace custom_handlers { class ProtocolHandlerRegistry; +} namespace QtWebEngineCore { @@ -64,7 +65,7 @@ protected: void rejected() override; private: - ProtocolHandlerRegistry *protocolHandlerRegistry(); + custom_handlers::ProtocolHandlerRegistry *protocolHandlerRegistry(); content::ProtocolHandler m_handler; }; diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index e6d9a952f..c56894983 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -83,8 +83,8 @@ #endif #if defined(USE_AURA) +#include "ui/aura/cursor/cursors_aura.h" #include "ui/base/cursor/cursor_size.h" -#include "ui/base/cursor/cursors_aura.h" #endif #if defined(Q_OS_MACOS) @@ -227,7 +227,7 @@ RenderWidgetHostViewQt::RenderWidgetHostViewQt(content::RenderWidgetHost *widget m_touchSelectionControllerClient.reset(new TouchSelectionControllerClientQt(this)); ui::TouchSelectionController::Config config; - config.max_tap_duration = base::TimeDelta::FromMilliseconds(ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); + config.max_tap_duration = base::Milliseconds(ui::GestureConfiguration::GetInstance()->long_press_time_in_ms()); config.tap_slop = ui::GestureConfiguration::GetInstance()->max_touch_move_in_pixels_for_click(); config.enable_longpress_drag_selection = false; m_touchSelectionController.reset(new ui::TouchSelectionController(m_touchSelectionControllerClient.get(), config)); @@ -368,8 +368,9 @@ void RenderWidgetHostViewQt::CopyFromSurface(const gfx::Rect &src_rect, m_delegatedFrameHost->CopyFromCompositingSurface(src_rect, output_size, std::move(callback)); } -void RenderWidgetHostViewQt::Show() +void RenderWidgetHostViewQt::ShowWithVisibility(content::PageVisibilityState page_visibility) { + Q_ASSERT(page_visibility != content::PageVisibilityState::kHidden); if (m_delegate) m_delegate->show(); else @@ -442,13 +443,13 @@ bool RenderWidgetHostViewQt::updateCursorFromResource(ui::mojom::CursorType type { int resourceId; // GetCursorDataFor only knows hotspots for 1x and 2x cursor images, in physical pixels. - qreal hotspotDpr = m_screenInfo.device_scale_factor <= 1.0f ? 1.0f : 2.0f; + qreal hotspotDpr = GetScreenInfo().device_scale_factor <= 1.0f ? 1.0f : 2.0f; qreal hotX; qreal hotY; #if defined(USE_AURA) gfx::Point hotspot; - if (!ui::GetCursorDataFor(ui::CursorSize::kNormal, type, hotspotDpr, &resourceId, &hotspot)) + if (!aura::GetCursorDataFor(ui::CursorSize::kNormal, type, hotspotDpr, &resourceId, &hotspot)) return false; hotX = hotspot.x(); hotY = hotspot.y(); @@ -489,7 +490,7 @@ bool RenderWidgetHostViewQt::updateCursorFromResource(ui::mojom::CursorType type if (!imageSkia) return false; - QImage imageQt = toQImage(imageSkia->GetRepresentation(m_screenInfo.device_scale_factor)); + QImage imageQt = toQImage(imageSkia->GetRepresentation(GetScreenInfo().device_scale_factor)); // Convert hotspot coordinates into device-independent pixels. hotX /= hotspotDpr; @@ -681,9 +682,15 @@ void RenderWidgetHostViewQt::UpdateTooltip(const std::u16string &tooltip_text) m_adapterClient->setToolTip(toQt(tooltip_text)); } -void RenderWidgetHostViewQt::GetScreenInfo(display::ScreenInfo *results) +display::ScreenInfo RenderWidgetHostViewQt::GetScreenInfo() const { - *results = m_screenInfo; + return m_screenInfo; +} + +display::ScreenInfos RenderWidgetHostViewQt::GetScreenInfos() const +{ + // FIXME: Return more than the current screen. + return display::ScreenInfos(GetScreenInfo()); } gfx::Rect RenderWidgetHostViewQt::GetBoundsInRootWindow() @@ -1031,7 +1038,7 @@ void RenderWidgetHostViewQt::OnRenderFrameMetadataChangedAfterActivation(base::T m_touchSelectionControllerClient->UpdateClientSelectionBounds(m_selectionStart, m_selectionEnd); } - gfx::Vector2dF scrollOffset = metadata.root_scroll_offset.value_or(gfx::Vector2dF()); + gfx::PointF scrollOffset = metadata.root_scroll_offset.value_or(gfx::PointF()); gfx::SizeF contentsSize = metadata.root_layer_size; std::swap(m_lastScrollOffset, scrollOffset); std::swap(m_lastContentsSize, contentsSize); @@ -1053,7 +1060,7 @@ void RenderWidgetHostViewQt::synchronizeVisualProperties(const absl::optional<vi m_rootLayer->SetBounds(gfx::Rect(gfx::Point(), viewSizeInPixels)); m_uiCompositorLocalSurfaceIdAllocator.GenerateId(); m_uiCompositor->SetScaleAndSize( - m_screenInfo.device_scale_factor, + GetScreenInfo().device_scale_factor, viewSizeInPixels, m_uiCompositorLocalSurfaceIdAllocator.GetCurrentLocalSurfaceId()); m_delegatedFrameHost->EmbedSurface( diff --git a/src/core/render_widget_host_view_qt.h b/src/core/render_widget_host_view_qt.h index c26eaebbd..5105d6621 100644 --- a/src/core/render_widget_host_view_qt.h +++ b/src/core/render_widget_host_view_qt.h @@ -106,7 +106,7 @@ public: void CopyFromSurface(const gfx::Rect &src_rect, const gfx::Size &output_size, base::OnceCallback<void(const SkBitmap &)> callback) override; - void Show() override; + void ShowWithVisibility(content::PageVisibilityState page_visibility) override; void Hide() override; bool IsShowing() override; gfx::Rect GetViewBounds() override; @@ -136,7 +136,8 @@ public: void OnDidUpdateVisualPropertiesComplete(const cc::RenderFrameMetadata &metadata); // Overridden from RenderWidgetHostViewBase: - void GetScreenInfo(display::ScreenInfo *screen_info) override; + display::ScreenInfo GetScreenInfo() const override; + display::ScreenInfos GetScreenInfos() const override; gfx::Rect GetBoundsInRootWindow() override; void ProcessAckedTouchEvent(const content::TouchEventWithLatencyInfo &touch, blink::mojom::InputEventResultState ack_result) override; @@ -167,6 +168,10 @@ public: void ShowDefinitionForSelection() override { QT_NOT_YET_IMPLEMENTED } void SetWindowFrameInScreen(const gfx::Rect&) override { QT_NOT_YET_IMPLEMENTED } #endif // defined(OS_MAC) + void NotifyHostAndDelegateOnWasShown(blink::mojom::RecordContentToVisibleTimeRequestPtr) override { QT_NOT_YET_IMPLEMENTED } + void RequestPresentationTimeFromHostOrDelegate(blink::mojom::RecordContentToVisibleTimeRequestPtr) override { QT_NOT_YET_IMPLEMENTED } + void CancelPresentationTimeRequestForHostAndDelegate() override { QT_NOT_YET_IMPLEMENTED } + // Overridden from ui::GestureProviderClient. void OnGestureEvent(const ui::GestureEventData& gesture) override; @@ -196,7 +201,7 @@ public: // Called from WebContentsAdapter. gfx::SizeF lastContentsSize() const { return m_lastContentsSize; } - gfx::Vector2dF lastScrollOffset() const { return m_lastScrollOffset; } + gfx::PointF lastScrollOffset() const { return m_lastScrollOffset; } ui::TouchSelectionController *getTouchSelectionController() const { return m_touchSelectionController.get(); } TouchSelectionControllerClientQt *getTouchSelectionControllerClient() const { return m_touchSelectionControllerClient.get(); } @@ -231,7 +236,7 @@ private: bool m_isMouseLocked = false; bool m_visible = false; bool m_deferredShow = false; - gfx::Vector2dF m_lastScrollOffset; + gfx::PointF m_lastScrollOffset; gfx::SizeF m_lastContentsSize; DelegatedFrameHostClientQt m_delegatedFrameHostClient { this }; diff --git a/src/core/render_widget_host_view_qt_delegate_client.cpp b/src/core/render_widget_host_view_qt_delegate_client.cpp index e2fb0c694..ba08bdf0b 100644 --- a/src/core/render_widget_host_view_qt_delegate_client.cpp +++ b/src/core/render_widget_host_view_qt_delegate_client.cpp @@ -560,10 +560,10 @@ void RenderWidgetHostViewQtDelegateClient::handleTouchEvent(QTouchEvent *event) // Calculate a delta between event timestamps and Now() on the first received event, and // apply this delta to all successive events. This delta is most likely smaller than it // should by calculating it here but this will hopefully cause less than one frame of delay. - base::TimeTicks eventTimestamp = base::TimeTicks() + base::TimeDelta::FromMilliseconds(event->timestamp()); + base::TimeTicks eventTimestamp = base::TimeTicks() + base::Milliseconds(event->timestamp()); if (m_eventsToNowDelta == 0) m_eventsToNowDelta = (base::TimeTicks::Now() - eventTimestamp).InMicroseconds(); - eventTimestamp += base::TimeDelta::FromMicroseconds(m_eventsToNowDelta); + eventTimestamp += base::Microseconds(m_eventsToNowDelta); auto touchPoints = mapTouchPointIds(event->touchPoints()); // Make sure that POINTER_DOWN action is delivered before MOVE, and MOVE before POINTER_UP diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 24a2eefbe..b410ad377 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -335,8 +335,7 @@ bool ContentRendererClientQt::IsPluginHandledExternally(content::RenderFrame *re std::string mime_type; static_cast<content::RenderFrameImpl *>(render_frame)->GetPepperHost()->GetPluginInfo( - original_url, render_frame->GetWebFrame()->Top()->GetSecurityOrigin(), - original_mime_type, &found, &plugin_info, &mime_type); + original_url, original_mime_type, &found, &plugin_info, &mime_type); if (!found) return false; return extensions::MimeHandlerViewContainerManager::Get( @@ -364,8 +363,7 @@ bool ContentRendererClientQt::OverrideCreatePlugin(content::RenderFrame *render_ bool found = false; static_cast<content::RenderFrameImpl *>(render_frame)->GetPepperHost()->GetPluginInfo( - params.url, render_frame->GetWebFrame()->Top()->GetSecurityOrigin(), - params.mime_type.Utf8(), &found, &info, &mime_type); + params.url, params.mime_type.Utf8(), &found, &info, &mime_type); if (!found) *plugin = LoadablePluginPlaceholderQt::CreateLoadableMissingPlugin(render_frame, params)->plugin(); else @@ -402,89 +400,18 @@ void ContentRendererClientQt::GetInterface(const std::string &interface_name, mo #if BUILDFLAG(ENABLE_LIBRARY_CDMS) // External Clear Key (used for testing). -static void AddExternalClearKey(std::vector<std::unique_ptr<media::KeySystemProperties>> *concrete_key_systems) +static void AddExternalClearKey(std::vector<std::unique_ptr<media::KeySystemProperties>> *key_systems) { - // TODO(xhwang): Move these into an array so we can use a for loop to add - // supported key systems below. - static const char kExternalClearKeyKeySystem[] = - "org.chromium.externalclearkey"; - static const char kExternalClearKeyDecryptOnlyKeySystem[] = - "org.chromium.externalclearkey.decryptonly"; - static const char kExternalClearKeyMessageTypeTestKeySystem[] = - "org.chromium.externalclearkey.messagetypetest"; - static const char kExternalClearKeyFileIOTestKeySystem[] = - "org.chromium.externalclearkey.fileiotest"; - static const char kExternalClearKeyOutputProtectionTestKeySystem[] = - "org.chromium.externalclearkey.outputprotectiontest"; - static const char kExternalClearKeyPlatformVerificationTestKeySystem[] = - "org.chromium.externalclearkey.platformverificationtest"; - static const char kExternalClearKeyInitializeFailKeySystem[] = - "org.chromium.externalclearkey.initializefail"; - static const char kExternalClearKeyCrashKeySystem[] = - "org.chromium.externalclearkey.crash"; - static const char kExternalClearKeyVerifyCdmHostTestKeySystem[] = - "org.chromium.externalclearkey.verifycdmhosttest"; - static const char kExternalClearKeyStorageIdTestKeySystem[] = - "org.chromium.externalclearkey.storageidtest"; - static const char kExternalClearKeyDifferentGuidTestKeySystem[] = - "org.chromium.externalclearkey.differentguid"; - static const char kExternalClearKeyCdmProxyTestKeySystem[] = - "org.chromium.externalclearkey.cdmproxytest"; + static const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey"; + // TODO(xhwang): Actually use `capability` to determine capabilities. media::mojom::KeySystemCapabilityPtr capability; if (!content::IsKeySystemSupported(kExternalClearKeyKeySystem, &capability)) { DVLOG(1) << "External Clear Key not supported"; return; } - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyKeySystem)); - - // Add support of decrypt-only mode in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyDecryptOnlyKeySystem)); - - // A key system that triggers various types of messages in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyMessageTypeTestKeySystem)); - - // A key system that triggers the FileIO test in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyFileIOTestKeySystem)); - - // A key system that triggers the output protection test in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyOutputProtectionTestKeySystem)); - - // A key system that triggers the platform verification test in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyPlatformVerificationTestKeySystem)); - - // A key system that Chrome thinks is supported by ClearKeyCdm, but actually - // will be refused by ClearKeyCdm. This is to test the CDM initialization - // failure case. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyInitializeFailKeySystem)); - - // A key system that triggers a crash in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyCrashKeySystem)); - - // A key system that triggers the verify host files test in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyVerifyCdmHostTestKeySystem)); - - // A key system that fetches the Storage ID in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyStorageIdTestKeySystem)); - - // A key system that is registered with a different CDM GUID. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyDifferentGuidTestKeySystem)); - - // A key system that triggers CDM Proxy test in ClearKeyCdm. - concrete_key_systems->emplace_back( - new cdm::ExternalClearKeyProperties(kExternalClearKeyCdmProxyTestKeySystem)); + key_systems->push_back(std::make_unique<cdm::ExternalClearKeyProperties>()); } #if BUILDFLAG(ENABLE_WIDEVINE) @@ -600,7 +527,7 @@ static media::SupportedCodecs GetSupportedCodecs(const media::CdmCapability& cap return supported_codecs; } -static void AddWidevine(std::vector<std::unique_ptr<media::KeySystemProperties>> *concrete_key_systems) +static void AddWidevine(std::vector<std::unique_ptr<media::KeySystemProperties>> *key_systems) { media::mojom::KeySystemCapabilityPtr capability; if (!content::IsKeySystemSupported(kWidevineKeySystem, &capability)) { @@ -647,11 +574,11 @@ static void AddWidevine(std::vector<std::unique_ptr<media::KeySystemProperties>> auto persistent_state_support = media::EmeFeatureSupport::REQUESTABLE; auto distinctive_identifier_support = media::EmeFeatureSupport::NOT_SUPPORTED; - concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties( - codecs, encryption_schemes, hw_secure_codecs, - hw_secure_encryption_schemes, max_audio_robustness, max_video_robustness, - persistent_license_support, persistent_state_support, - distinctive_identifier_support)); + key_systems->emplace_back(new cdm::WidevineKeySystemProperties( + codecs, encryption_schemes, hw_secure_codecs, + hw_secure_encryption_schemes, max_audio_robustness, max_video_robustness, + persistent_license_support, persistent_state_support, + distinctive_identifier_support)); } #endif // BUILDFLAG(ENABLE_WIDEVINE) #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index 4e1759759..61d80b8f5 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -152,8 +152,6 @@ private: #if QT_CONFIG(webengine_webrtc) && QT_CONFIG(webengine_extensions) std::unique_ptr<chrome::WebRtcLoggingAgentImpl> m_webrtcLoggingAgentImpl; #endif - - DISALLOW_COPY_AND_ASSIGN(ContentRendererClientQt); }; } // namespace diff --git a/src/core/renderer/content_settings_observer_qt.h b/src/core/renderer/content_settings_observer_qt.h index 9268b4982..c1317eaf5 100644 --- a/src/core/renderer/content_settings_observer_qt.h +++ b/src/core/renderer/content_settings_observer_qt.h @@ -89,8 +89,6 @@ private: int m_currentRequestId; base::flat_map<int, base::OnceCallback<void(bool)>> m_permissionRequests; - - DISALLOW_COPY_AND_ASSIGN(ContentSettingsObserverQt); }; } // namespace QtWebEngineCore diff --git a/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h b/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h index 1a19bcbbb..b94ef7d27 100644 --- a/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h +++ b/src/core/renderer/extensions/extensions_dispatcher_delegate_qt.h @@ -40,7 +40,6 @@ #ifndef EXTENSIONSDISPATCHERDELEGATEQT_H #define EXTENSIONSDISPATCHERDELEGATEQT_H -#include "base/macros.h" #include "extensions/renderer/dispatcher_delegate.h" namespace QtWebEngineCore { @@ -54,8 +53,6 @@ public: private: // extensions::DispatcherDelegate implementation. void PopulateSourceMap(extensions::ResourceBundleSourceMap *source_map) override; - - DISALLOW_COPY_AND_ASSIGN(ExtensionsDispatcherDelegateQt); }; } // namespace QtWebEngineCore diff --git a/src/core/renderer/extensions/extensions_renderer_client_qt.h b/src/core/renderer/extensions/extensions_renderer_client_qt.h index 4907e0dc8..5b7cc8b0f 100644 --- a/src/core/renderer/extensions/extensions_renderer_client_qt.h +++ b/src/core/renderer/extensions/extensions_renderer_client_qt.h @@ -43,7 +43,6 @@ #include <memory> #include <string> -#include "base/macros.h" #include "extensions/renderer/extensions_renderer_client.h" #include "services/service_manager/public/cpp/binder_registry.h" #include "ui/base/page_transition_types.h" diff --git a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h index 385b7a4b0..432bc7013 100644 --- a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h +++ b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h @@ -40,7 +40,6 @@ #ifndef RENDERERPERMISSIONSPOLICYDELEGATEQT_H #define RENDERERPERMISSIONSPOLICYDELEGATEQT_H -#include "base/macros.h" #include "extensions/common/permissions/permissions_data.h" namespace extensions { @@ -56,9 +55,6 @@ public: ~RendererPermissionsPolicyDelegateQt() override; bool IsRestrictedUrl(const GURL &, std::string *) override; - -private: - DISALLOW_COPY_AND_ASSIGN(RendererPermissionsPolicyDelegateQt); }; } // namespace QtWebEngineCore diff --git a/src/core/renderer/extensions/resource_request_policy_qt.cpp b/src/core/renderer/extensions/resource_request_policy_qt.cpp index ad66ec4ab..6fa0842a6 100644 --- a/src/core/renderer/extensions/resource_request_policy_qt.cpp +++ b/src/core/renderer/extensions/resource_request_policy_qt.cpp @@ -97,7 +97,7 @@ bool ResourceRequestPolicyQt::CanRequestResource(const GURL &resource_url, // current extension or has a devtools scheme. GURL page_origin = url::Origin(frame->Top()->GetSecurityOrigin()).GetURL(); - GURL extension_origin = resource_url.GetOrigin(); + GURL extension_origin = resource_url.DeprecatedGetOriginAsURL(); // We always allow loads in the following cases, regardless of web accessible // resources: @@ -113,7 +113,7 @@ bool ResourceRequestPolicyQt::CanRequestResource(const GURL &resource_url, // of the frame, to account for about:blank subframes being scripted by an // extension parent (though we'll still need the frame origin check for // sandboxed frames). - if (frame_url.GetOrigin() == extension_origin || page_origin == extension_origin) + if (frame_url.DeprecatedGetOriginAsURL() == extension_origin || page_origin == extension_origin) return true; if (!ui::PageTransitionIsWebTriggerable(transition_type)) diff --git a/src/core/renderer/extensions/resource_request_policy_qt.h b/src/core/renderer/extensions/resource_request_policy_qt.h index f3c718c54..8041d42a1 100644 --- a/src/core/renderer/extensions/resource_request_policy_qt.h +++ b/src/core/renderer/extensions/resource_request_policy_qt.h @@ -42,7 +42,6 @@ #include <set> -#include "base/macros.h" #include "extensions/common/extension_id.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/page_transition_types.h" @@ -84,8 +83,6 @@ private: // The set of extension IDs with any potentially web- or webview-accessible // resources. std::set<ExtensionId> m_web_accessible_ids; - - DISALLOW_COPY_AND_ASSIGN(ResourceRequestPolicyQt); }; } // namespace extensions 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 83dcf8157..2cfbc2f6d 100644 --- a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp +++ b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.cpp @@ -46,9 +46,9 @@ #include "qtwebenginecoreglobal_p.h" #include "base/memory/ptr_util.h" -#include "chrome/renderer/pepper/pepper_flash_font_file_host.h" #include "chrome/renderer/pepper/pepper_uma_host.h" #if QT_CONFIG(webengine_printing_and_pdf) +#include "chrome/renderer/pepper/pepper_flash_font_file_host.h" #include "components/pdf/renderer/pepper_pdf_host.h" #endif // QT_CONFIG(webengine_printing_and_pdf) #include "content/public/renderer/renderer_ppapi_host.h" @@ -84,6 +84,7 @@ std::unique_ptr<ppapi::host::ResourceHost> PepperRendererHostFactoryQt::CreateRe // 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. +#if QT_CONFIG(webengine_printing_and_pdf) if (host_->GetPpapiHost()->permissions().HasPermission(ppapi::PERMISSION_FLASH) || host_->GetPpapiHost()->permissions().HasPermission(ppapi::PERMISSION_PDF)) { switch (message.type()) { @@ -97,7 +98,6 @@ std::unique_ptr<ppapi::host::ResourceHost> PepperRendererHostFactoryQt::CreateRe } } -#if QT_CONFIG(webengine_printing_and_pdf) if (host_->GetPpapiHost()->permissions().HasPermission(ppapi::PERMISSION_PDF)) { switch (message.type()) { case PpapiHostMsg_PDF_Create::ID: diff --git a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.h b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.h index ec3440a08..a545886ba 100644 --- a/src/core/renderer/pepper/pepper_renderer_host_factory_qt.h +++ b/src/core/renderer/pepper/pepper_renderer_host_factory_qt.h @@ -65,8 +65,6 @@ public: private: // Not owned by this object. content::RendererPpapiHost* host_; - - DISALLOW_COPY_AND_ASSIGN(PepperRendererHostFactoryQt); }; } // namespace QtWebEngineCore diff --git a/src/core/renderer/plugins/loadable_plugin_placeholder_qt.h b/src/core/renderer/plugins/loadable_plugin_placeholder_qt.h index f612cb8ec..77bb85d78 100644 --- a/src/core/renderer/plugins/loadable_plugin_placeholder_qt.h +++ b/src/core/renderer/plugins/loadable_plugin_placeholder_qt.h @@ -44,7 +44,6 @@ #ifndef LOADALBLE_PLUGIN_PLACEHOLDER_QT_H #define LOADALBLE_PLUGIN_PLACEHOLDER_QT_H -#include "base/macros.h" #include "components/plugins/renderer/loadable_plugin_placeholder.h" namespace QtWebEngineCore { @@ -73,8 +72,6 @@ private: // WebViewPlugin::Delegate (via PluginPlaceholder) methods: v8::Local<v8::Value> GetV8Handle(v8::Isolate* isolate) override; - - DISALLOW_COPY_AND_ASSIGN(LoadablePluginPlaceholderQt); }; } // namespace QtWebEngineCore diff --git a/src/core/renderer/print_web_view_helper_delegate_qt.cpp b/src/core/renderer/print_web_view_helper_delegate_qt.cpp index 5dcfaafd6..17b9e4da1 100644 --- a/src/core/renderer/print_web_view_helper_delegate_qt.cpp +++ b/src/core/renderer/print_web_view_helper_delegate_qt.cpp @@ -60,13 +60,23 @@ namespace QtWebEngineCore { PrintWebViewHelperDelegateQt::~PrintWebViewHelperDelegateQt() {} +bool IsPdfExtensionOrigin(const url::Origin& origin) +{ +#if BUILDFLAG(ENABLE_EXTENSIONS) + return origin.scheme() == extensions::kExtensionScheme + && origin.host() == extension_misc::kPdfExtensionId; +#else + Q_UNUSED(origin); + return false; +#endif +} + blink::WebElement PrintWebViewHelperDelegateQt::GetPdfElement(blink::WebLocalFrame *frame) { #if BUILDFLAG(ENABLE_EXTENSIONS) - GURL url = frame->GetDocument().Url(); - bool inside_print_preview = url.GetOrigin() == chrome::kChromeUIPrintURL; - bool inside_pdf_extension = url.SchemeIs(extensions::kExtensionScheme) && - url.host_piece() == extension_misc::kPdfExtensionId; + const url::Origin origin = frame->GetDocument().GetSecurityOrigin(); + bool inside_print_preview = origin == url::Origin::Create(GURL(chrome::kChromeUIPrintURL)); + bool inside_pdf_extension = IsPdfExtensionOrigin(origin); if (inside_print_preview || inside_pdf_extension) { // <object> with id="plugin" is created in // chrome/browser/resources/pdf/pdf_viewer_base.js. diff --git a/src/core/renderer/render_configuration.h b/src/core/renderer/render_configuration.h index 138a85bdc..bc8eccc20 100644 --- a/src/core/renderer/render_configuration.h +++ b/src/core/renderer/render_configuration.h @@ -71,8 +71,6 @@ private: mojo::AssociatedReceiverSet<qtwebengine::mojom::RendererConfiguration> m_rendererConfigurationReceivers; - - DISALLOW_COPY_AND_ASSIGN(RenderConfiguration); }; } // namespace QtWebEngineCore diff --git a/src/core/renderer/render_frame_observer_qt.h b/src/core/renderer/render_frame_observer_qt.h index 8803dde89..6013860be 100644 --- a/src/core/renderer/render_frame_observer_qt.h +++ b/src/core/renderer/render_frame_observer_qt.h @@ -82,8 +82,6 @@ public: } private: - DISALLOW_COPY_AND_ASSIGN(RenderFrameObserverQt); - void ReadyToCommitNavigation(blink::WebDocumentLoader *) override; bool m_isFrameDetached; diff --git a/src/core/renderer/user_resource_controller.cpp b/src/core/renderer/user_resource_controller.cpp index c480d9817..6486696c5 100644 --- a/src/core/renderer/user_resource_controller.cpp +++ b/src/core/renderer/user_resource_controller.cpp @@ -260,7 +260,7 @@ void UserResourceController::RenderFrameObserverHelper::DidDispatchDOMContentLoa FROM_HERE, base::BindOnce(&Runner::run, m_runner->AsWeakPtr(), QtWebEngineCore::UserScriptData::AfterLoad), - base::TimeDelta::FromMilliseconds(afterLoadTimeout)); + base::Milliseconds(afterLoadTimeout)); } void UserResourceController::RenderFrameObserverHelper::DidFinishLoad() diff --git a/src/core/renderer/web_channel_ipc_transport.cpp b/src/core/renderer/web_channel_ipc_transport.cpp index ef3fbeaaf..77f7cdcf1 100644 --- a/src/core/renderer/web_channel_ipc_transport.cpp +++ b/src/core/renderer/web_channel_ipc_transport.cpp @@ -74,7 +74,6 @@ private: gin::ObjectTemplateBuilder GetObjectTemplateBuilder(v8::Isolate *isolate) override; mojo::AssociatedRemote<qtwebchannel::mojom::WebChannelTransportHost> m_remote; content::RenderFrame *m_renderFrame = nullptr; - DISALLOW_COPY_AND_ASSIGN(WebChannelTransport); }; gin::WrapperInfo WebChannelTransport::kWrapperInfo = { gin::kEmbedderNativeGin }; diff --git a/src/core/renderer_host/pepper/pepper_host_factory_qt.cpp b/src/core/renderer_host/pepper/pepper_host_factory_qt.cpp deleted file mode 100644 index 6686f8b12..000000000 --- a/src/core/renderer_host/pepper/pepper_host_factory_qt.cpp +++ /dev/null @@ -1,98 +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/chrome_browser_pepper_host_factory.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_host_factory_qt.h" - -#include "base/memory/ptr_util.h" -#include "build/build_config.h" -#include "content/public/browser/browser_ppapi_host.h" -#include "ppapi/host/message_filter_host.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/host/resource_host.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/shared_impl/ppapi_permissions.h" - -#include "pepper_isolated_file_system_message_filter.h" - -using ppapi::host::MessageFilterHost; -using ppapi::host::ResourceMessageFilter; - -namespace QtWebEngineCore { - -PepperHostFactoryQt::PepperHostFactoryQt(content::BrowserPpapiHost* host) - : host_(host) -{ -} - -PepperHostFactoryQt::~PepperHostFactoryQt() {} - -std::unique_ptr<ppapi::host::ResourceHost> PepperHostFactoryQt::CreateResourceHost(ppapi::host::PpapiHost* host, - PP_Resource resource, - PP_Instance instance, - const IPC::Message& message) -{ - DCHECK(host == host_->GetPpapiHost()); - - - if (!host_->IsValidInstance(instance)) - return nullptr; - - // 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 - // thread). Currently these interfaces are available only for - // whitelisted apps which may not have access to the other private - // interfaces. - if (message.type() == PpapiHostMsg_IsolatedFileSystem_Create::ID) { - PepperIsolatedFileSystemMessageFilter* isolated_fs_filter = PepperIsolatedFileSystemMessageFilter::Create(instance, host_); - if (!isolated_fs_filter) - return nullptr; - return base::WrapUnique( - new MessageFilterHost(host_->GetPpapiHost(), instance, resource, isolated_fs_filter)); - } - - return nullptr; -} - -} // namespace QtWebEngineCore diff --git a/src/core/renderer_host/pepper/pepper_host_factory_qt.h b/src/core/renderer_host/pepper/pepper_host_factory_qt.h deleted file mode 100644 index 0446cf9e3..000000000 --- a/src/core/renderer_host/pepper/pepper_host_factory_qt.h +++ /dev/null @@ -1,73 +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_HOST_FACTORY_QT_H -#define PEPPER_HOST_FACTORY_QT_H - -#include "base/compiler_specific.h" -#include "ppapi/host/host_factory.h" -#include "ppapi/host/resource_host.h" -#include "ppapi/host/ppapi_host.h" - -namespace content { -class BrowserPpapiHost; -} // namespace content - -namespace QtWebEngineCore { - -class PepperHostFactoryQt final : public ppapi::host::HostFactory { -public: - // Non-owning pointer to the filter must outlive this class. - explicit PepperHostFactoryQt(content::BrowserPpapiHost* host); - ~PepperHostFactoryQt() override; - - virtual std::unique_ptr<ppapi::host::ResourceHost> CreateResourceHost( - ppapi::host::PpapiHost* host, - PP_Resource resource, - PP_Instance instance, - const IPC::Message& message) override; -private: - // Non-owning pointer. - content::BrowserPpapiHost* host_; - - DISALLOW_COPY_AND_ASSIGN(PepperHostFactoryQt); -}; -} // namespace QtWebEngineCore - -#endif // PEPPER_HOST_FACTORY_QT_H diff --git a/src/core/renderer_host/pepper/pepper_isolated_file_system_message_filter.cpp b/src/core/renderer_host/pepper/pepper_isolated_file_system_message_filter.cpp deleted file mode 100644 index f61c06ea9..000000000 --- a/src/core/renderer_host/pepper/pepper_isolated_file_system_message_filter.cpp +++ /dev/null @@ -1,135 +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_isolated_file_system_message_filter.cc: -// Copyright 2013 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_isolated_file_system_message_filter.h" - -#include "base/macros.h" -#include "base/task/post_task.h" -#include "chrome/common/chrome_switches.h" -#include "content/public/browser/browser_ppapi_host.h" -#include "content/public/browser/browser_task_traits.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/child_process_security_policy.h" -#include "content/public/browser/render_view_host.h" -#include "ppapi/c/pp_errors.h" -#include "ppapi/host/dispatch_host_message.h" -#include "ppapi/host/host_message_context.h" -#include "ppapi/host/ppapi_host.h" -#include "ppapi/proxy/ppapi_messages.h" -#include "ppapi/shared_impl/file_system_util.h" -#include "storage/browser/file_system/isolated_context.h" - -namespace QtWebEngineCore { - -// static -PepperIsolatedFileSystemMessageFilter* PepperIsolatedFileSystemMessageFilter::Create(PP_Instance instance, content::BrowserPpapiHost *host) -{ - int render_process_id; - int unused_render_frame_id; - if (!host->GetRenderFrameIDsForInstance(instance, &render_process_id, &unused_render_frame_id)) - return nullptr; - return new PepperIsolatedFileSystemMessageFilter(render_process_id, host->GetPpapiHost()); -} - -PepperIsolatedFileSystemMessageFilter::PepperIsolatedFileSystemMessageFilter(int render_process_id, - ppapi::host::PpapiHost *ppapi_host) - : m_render_process_id(render_process_id), - m_ppapi_host(ppapi_host) -{} - -PepperIsolatedFileSystemMessageFilter::~PepperIsolatedFileSystemMessageFilter() -{} - -scoped_refptr<base::SequencedTaskRunner> PepperIsolatedFileSystemMessageFilter::OverrideTaskRunnerForMessage(const IPC::Message &) -{ - // In order to reach ExtensionSystem, we need to get ProfileManager first. - // ProfileManager lives in UI thread, so we need to do this in UI thread. - return base::CreateSingleThreadTaskRunner({content::BrowserThread::UI}); -} - -int32_t PepperIsolatedFileSystemMessageFilter::OnResourceMessageReceived(const IPC::Message& msg, ppapi::host::HostMessageContext *context) -{ - PPAPI_BEGIN_MESSAGE_MAP(PepperIsolatedFileSystemMessageFilter, msg) - PPAPI_DISPATCH_HOST_RESOURCE_CALL(PpapiHostMsg_IsolatedFileSystem_BrowserOpen, OnOpenFileSystem) - PPAPI_END_MESSAGE_MAP() - return PP_ERROR_FAILED; -} - -int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem(ppapi::host::HostMessageContext *context, - PP_IsolatedFileSystemType_Private type) -{ - switch (type) { - case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID: - break; - case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX: - return PP_ERROR_NOTSUPPORTED; - case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE: - return OpenPluginPrivateFileSystem(context); - } - NOTREACHED(); - context->reply_msg = PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(std::string()); - return PP_ERROR_FAILED; -} - -int32_t PepperIsolatedFileSystemMessageFilter::OpenPluginPrivateFileSystem(ppapi::host::HostMessageContext *context) -{ - DCHECK(m_ppapi_host); - // Only plugins with private permission can open the filesystem. - if (!m_ppapi_host->permissions().HasPermission(ppapi::PERMISSION_PRIVATE)) - return PP_ERROR_NOACCESS; - - const std::string& root_name = ppapi::IsolatedFileSystemTypeToRootName(PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_PLUGINPRIVATE); - const std::string& fsid = - storage::IsolatedContext::GetInstance()->RegisterFileSystemForVirtualPath( - storage::kFileSystemTypePluginPrivate, root_name, base::FilePath()); - - // Grant full access of isolated filesystem to renderer process. - content::ChildProcessSecurityPolicy* policy = content::ChildProcessSecurityPolicy::GetInstance(); - policy->GrantCreateReadWriteFileSystem(m_render_process_id, fsid); - - context->reply_msg = PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(fsid); - return PP_OK; -} - -} // namespace chrome diff --git a/src/core/renderer_host/pepper/pepper_isolated_file_system_message_filter.h b/src/core/renderer_host/pepper/pepper_isolated_file_system_message_filter.h deleted file mode 100644 index 27c23d8e0..000000000 --- a/src/core/renderer_host/pepper/pepper_isolated_file_system_message_filter.h +++ /dev/null @@ -1,89 +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_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H -#define PEPPER_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H - -#include "base/macros.h" -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" -#include "ppapi/c/private/ppb_isolated_file_system_private.h" -#include "ppapi/host/resource_host.h" -#include "ppapi/host/resource_message_filter.h" - -namespace content { -class BrowserPpapiHost; -} - -namespace ppapi { -namespace host { -struct HostMessageContext; -} // namespace host -} // namespace ppapi - -namespace QtWebEngineCore { - -class PepperIsolatedFileSystemMessageFilter : public ppapi::host::ResourceMessageFilter { -public: - static PepperIsolatedFileSystemMessageFilter *Create(PP_Instance instance, content::BrowserPpapiHost *host); - - // ppapi::host::ResourceMessageFilter implementation. - scoped_refptr<base::SequencedTaskRunner> OverrideTaskRunnerForMessage(const IPC::Message &msg) override; - int32_t OnResourceMessageReceived(const IPC::Message &msg, ppapi::host::HostMessageContext *context) override; - -private: - PepperIsolatedFileSystemMessageFilter(int render_process_id, ppapi::host::PpapiHost *ppapi_host); - - ~PepperIsolatedFileSystemMessageFilter() override; - - - int32_t OnOpenFileSystem(ppapi::host::HostMessageContext *context, PP_IsolatedFileSystemType_Private type); - int32_t OpenPluginPrivateFileSystem(ppapi::host::HostMessageContext *context); - - const int m_render_process_id; - - // Not owned by this object. - ppapi::host::PpapiHost* m_ppapi_host; - - DISALLOW_COPY_AND_ASSIGN(PepperIsolatedFileSystemMessageFilter); -}; - -} // namespace QtWebEngineCore - -#endif // PEPPER_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp index fbf4cb9dd..90c86a758 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp +++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp @@ -66,8 +66,10 @@ WebChannelIPCTransportHost::WebChannelIPCTransportHost(content::WebContents *con , m_worldId(worldId) , m_receiver(contents, this) { - for (content::RenderFrameHost *frame : contents->GetAllFrames()) - setWorldId(frame, worldId); + contents->ForEachFrame(base::BindRepeating([](WebChannelIPCTransportHost *that, uint32_t worldId, content::RenderFrameHost *frame) { + that->setWorldId(frame, worldId); + }, + base::Unretained(this), worldId)); } WebChannelIPCTransportHost::~WebChannelIPCTransportHost() @@ -94,8 +96,10 @@ void WebChannelIPCTransportHost::setWorldId(uint32_t worldId) { if (m_worldId == worldId) return; - for (content::RenderFrameHost *frame : web_contents()->GetAllFrames()) - setWorldId(frame, worldId); + web_contents()->ForEachFrame(base::BindRepeating([](WebChannelIPCTransportHost *that, uint32_t worldId, content::RenderFrameHost *frame) { + that->setWorldId(frame, worldId); + }, + base::Unretained(this), worldId)); m_worldId = worldId; } @@ -109,11 +113,11 @@ void WebChannelIPCTransportHost::setWorldId(content::RenderFrameHost *frame, uin void WebChannelIPCTransportHost::resetWorldId() { - for (content::RenderFrameHost *frame : web_contents()->GetAllFrames()) { + web_contents()->ForEachFrame(base::BindRepeating([](WebChannelIPCTransportHost *that, content::RenderFrameHost *frame) { if (!frame->IsRenderFrameLive()) return; - GetWebChannelIPCTransportRemote(frame)->ResetWorldId(); - } + that->GetWebChannelIPCTransportRemote(frame)->ResetWorldId(); + }, this)); } void WebChannelIPCTransportHost::DispatchWebChannelMessage(const std::vector<uint8_t> &json) diff --git a/src/core/select_file_dialog_factory_qt.cpp b/src/core/select_file_dialog_factory_qt.cpp index 8fe0a0be5..0bec436af 100644 --- a/src/core/select_file_dialog_factory_qt.cpp +++ b/src/core/select_file_dialog_factory_qt.cpp @@ -107,8 +107,6 @@ public: private: WebContentsAdapterClient *m_client; QSharedPointer<FilePickerController> m_filePickerController; - - DISALLOW_COPY_AND_ASSIGN(SelectFileDialogQt); }; SelectFileDialogQt::SelectFileDialogQt(Listener *listener, diff --git a/src/core/select_file_dialog_factory_qt.h b/src/core/select_file_dialog_factory_qt.h index 572bf217f..2b790592a 100644 --- a/src/core/select_file_dialog_factory_qt.h +++ b/src/core/select_file_dialog_factory_qt.h @@ -63,8 +63,6 @@ public: private: content::WebContents *m_webContents; - - DISALLOW_COPY_AND_ASSIGN(SelectFilePolicyQt); }; // Implements a file Open / Save dialog for File System Access API. @@ -77,9 +75,6 @@ public: // Overridden from ui::SelectFileDialogFactory: ui::SelectFileDialog *Create(ui::SelectFileDialog::Listener *listener, std::unique_ptr<ui::SelectFilePolicy> policy) override; - -private: - DISALLOW_COPY_AND_ASSIGN(SelectFileDialogFactoryQt); }; } // namespace QtWebEngineCore diff --git a/src/core/touch_handle_drawable_qt.h b/src/core/touch_handle_drawable_qt.h index 46fa217b7..580b56018 100644 --- a/src/core/touch_handle_drawable_qt.h +++ b/src/core/touch_handle_drawable_qt.h @@ -78,8 +78,6 @@ private: ui::TouchHandleOrientation m_orientation; gfx::RectF m_relativeBounds; gfx::PointF m_originPosition; - - DISALLOW_COPY_AND_ASSIGN(TouchHandleDrawableQt); }; } // namespace QtWebEngineCore diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h index 7f378457b..540fe7b73 100644 --- a/src/core/type_conversion.h +++ b/src/core/type_conversion.h @@ -60,6 +60,7 @@ #include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect_f.h" #include "url/gurl.h" +#include "url/origin.h" QT_FORWARD_DECLARE_CLASS(QSslCertificate) @@ -134,11 +135,26 @@ inline GURL toGurl(const QUrl& url) return GURL(url.toEncoded().toStdString()); } +inline QUrl toQt(const url::Origin &origin) +{ + return QUrl::fromEncoded(toQByteArray(origin.Serialize())); +} + +inline url::Origin toOrigin(const QUrl &url) +{ + return url::Origin::Create(toGurl(url)); +} + inline QPoint toQt(const gfx::Point &point) { return QPoint(point.x(), point.y()); } +inline QPointF toQt(const gfx::PointF &point) +{ + return QPointF(point.x(), point.y()); +} + inline QPointF toQt(const gfx::Vector2dF &point) { return QPointF(point.x(), point.y()); diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 142b0ba2e..33490d84a 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -143,9 +143,8 @@ static QVariant fromJSValue(const base::Value *result) break; case base::Value::Type::BOOLEAN: { - bool out; - if (result->GetAsBoolean(&out)) - ret.setValue(out); + if (auto out = result->GetIfBool()) + ret.setValue(*out); break; } case base::Value::Type::INTEGER: @@ -544,7 +543,7 @@ void WebContentsAdapter::initializeRenderPrefs() // seconds const int qtCursorFlashTime = QGuiApplication::styleHints()->cursorFlashTime(); rendererPrefs->caret_blink_interval = - base::TimeDelta::FromMillisecondsD(0.5 * static_cast<double>(qtCursorFlashTime)); + base::Milliseconds(0.5 * static_cast<double>(qtCursorFlashTime)); rendererPrefs->user_agent_override = blink::UserAgentOverride::UserAgentOnly(m_profileAdapter->httpUserAgent().toStdString()); rendererPrefs->accept_languages = m_profileAdapter->httpAcceptLanguageWithoutQualities().toStdString(); #if QT_CONFIG(webengine_webrtc) @@ -1098,7 +1097,9 @@ void WebContentsAdapter::updateWebPreferences(const blink::web_pref::WebPreferen // In case of updating preferences during navigation, there might be a pending RVH what will // be active on successful navigation. - content::RenderFrameHost *pendingRFH = (static_cast<content::WebContentsImpl*>(m_webContents.get()))->GetFrameTree()->root()->render_manager()->speculative_frame_host(); + content::RenderFrameHost *pendingRFH = + (static_cast<content::WebContentsImpl*>(m_webContents.get())) + ->GetPrimaryFrameTree().root()->render_manager()->speculative_frame_host(); if (pendingRFH) { content::RenderViewHost *pendingRVH = pendingRFH->GetRenderViewHost(); Q_ASSERT(pendingRVH); @@ -1391,7 +1392,7 @@ void WebContentsAdapter::grantFeaturePermission(const QUrl &securityOrigin, Prof void WebContentsAdapter::grantMouseLockPermission(const QUrl &securityOrigin, bool granted) { CHECK_INITIALIZED(); - if (securityOrigin != toQt(m_webContents->GetLastCommittedURL().GetOrigin())) + if (securityOrigin != toQt(m_webContents->GetLastCommittedURL().DeprecatedGetOriginAsURL())) return; if (granted) { @@ -1416,7 +1417,7 @@ void WebContentsAdapter::grantMouseLockPermission(const QUrl &securityOrigin, bo void WebContentsAdapter::handlePendingMouseLockPermission() { CHECK_INITIALIZED(); - auto it = m_pendingMouseLockPermissions.find(toQt(m_webContents->GetLastCommittedURL().GetOrigin())); + auto it = m_pendingMouseLockPermissions.find(toQt(m_webContents->GetLastCommittedURL().DeprecatedGetOriginAsURL())); if (it != m_pendingMouseLockPermissions.end()) { m_webContents->GotResponseToLockMouseRequest(it.value() ? blink::mojom::PointerLockResult::kSuccess : blink::mojom::PointerLockResult::kPermissionDenied); @@ -1712,7 +1713,7 @@ void WebContentsAdapter::waitForUpdateDragActionCalled() static_cast<int>(timeout)); return; } - base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(1)); + base::PlatformThread::Sleep(base::Milliseconds(1)); } } diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index 98f2a8553..7173d05fc 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -63,6 +63,7 @@ #include "web_engine_settings.h" #include "certificate_error_controller.h" #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" +#include "components/custom_handlers/protocol_handler_registry.h" #include "components/error_page/common/error.h" #include "components/error_page/common/localized_error.h" #include "components/web_cache/browser/web_cache_manager.h" @@ -105,7 +106,6 @@ WebContentsDelegateQt::WebContentsDelegateQt(content::WebContents *webContents, : m_viewClient(adapterClient) , m_findTextHelper(new FindTextHelper(webContents, adapterClient)) , m_loadingState(determineLoadingState(webContents)) - , m_didStartLoadingSeen(m_loadingState == LoadingState::Loading) , m_frameFocusedObserver(adapterClient) { webContents->SetDelegate(this); @@ -290,7 +290,7 @@ void WebContentsDelegateQt::RenderFrameCreated(content::RenderFrameHost *render_ m_frameFocusedObserver.addNode(node); } -void WebContentsDelegateQt::RenderProcessGone(base::TerminationStatus status) +void WebContentsDelegateQt::PrimaryMainFrameRenderProcessGone(base::TerminationStatus status) { // RenderProcessHost::FastShutdownIfPossible results in TERMINATION_STATUS_STILL_RUNNING if (status != base::TERMINATION_STATUS_STILL_RUNNING) { @@ -444,34 +444,18 @@ void WebContentsDelegateQt::DidFinishNavigation(content::NavigationHandle *navig } } -void WebContentsDelegateQt::DidStartLoading() +void WebContentsDelegateQt::PrimaryPageChanged(content::Page &) { - // Based on TabLoadTracker::DidStartLoading + // Based on TabLoadTracker::PrimaryPageChanged - if (!web_contents()->IsLoadingToDifferentDocument()) + if (!web_contents()->ShouldShowLoadingUI()) return; - if (m_loadingState == LoadingState::Loading) { - DCHECK(m_didStartLoadingSeen); - return; - } - m_didStartLoadingSeen = true; -} - -void WebContentsDelegateQt::DidReceiveResponse() -{ - // Based on TabLoadTracker::DidReceiveResponse - - if (m_loadingState == LoadingState::Loading) { - DCHECK(m_didStartLoadingSeen); - return; - } // A transition to loading requires both DidStartLoading (navigation // committed) and DidReceiveResponse (data has been transmitted over the // network) events to occur. This is because NavigationThrottles can block // actual network requests, but not the rest of the state machinery. - if (m_didStartLoadingSeen) - setLoadingState(LoadingState::Loading); + setLoadingState(LoadingState::Loading); } void WebContentsDelegateQt::DidStopLoading() @@ -480,8 +464,7 @@ void WebContentsDelegateQt::DidStopLoading() // NOTE: PageAlmostIdle feature not implemented - if (m_loadingState == LoadingState::Loading) - setLoadingState(LoadingState::Loaded); + setLoadingState(LoadingState::Loaded); emitLoadFinished(); m_loadingInfo.clear(); @@ -503,8 +486,7 @@ void WebContentsDelegateQt::didFailLoad(const QUrl &url, int errorCode, const QS void WebContentsDelegateQt::DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code) { - if (m_loadingState == LoadingState::Loading) - setLoadingState(LoadingState::Loaded); + setLoadingState(LoadingState::Loaded); if (render_frame_host != web_contents()->GetMainFrame()) return; @@ -579,13 +561,13 @@ void WebContentsDelegateQt::EnterFullscreenModeForTab(content::RenderFrameHost * { Q_UNUSED(options); if (!m_viewClient->isFullScreenMode()) - m_viewClient->requestFullScreenMode(toQt(requesting_frame->GetLastCommittedURL()), true); + m_viewClient->requestFullScreenMode(toQt(requesting_frame->GetLastCommittedURL().DeprecatedGetOriginAsURL()), true); } void WebContentsDelegateQt::ExitFullscreenModeForTab(content::WebContents *web_contents) { if (m_viewClient->isFullScreenMode()) - m_viewClient->requestFullScreenMode(toQt(web_contents->GetLastCommittedURL().GetOrigin()), false); + m_viewClient->requestFullScreenMode(toQt(web_contents->GetLastCommittedURL().DeprecatedGetOriginAsURL()), false); } bool WebContentsDelegateQt::IsFullscreenForTabOrPending(const content::WebContents* web_contents) @@ -677,7 +659,7 @@ void WebContentsDelegateQt::RequestToLockMouse(content::WebContents *web_content if (last_unlocked_by_target) web_contents->GotResponseToLockMouseRequest(blink::mojom::PointerLockResult::kSuccess); else - m_viewClient->runMouseLockPermissionRequest(toQt(web_contents->GetLastCommittedURL().GetOrigin())); + m_viewClient->runMouseLockPermissionRequest(toQt(web_contents->GetLastCommittedURL().DeprecatedGetOriginAsURL())); } void WebContentsDelegateQt::overrideWebPreferences(content::WebContents *webContents, blink::web_pref::WebPreferences *webPreferences) @@ -791,10 +773,10 @@ void WebContentsDelegateQt::RegisterProtocolHandler(content::RenderFrameHost *fr { content::BrowserContext *context = frameHost->GetBrowserContext(); - ProtocolHandler handler = - ProtocolHandler::CreateProtocolHandler(protocol, url); + content::ProtocolHandler handler = + content::ProtocolHandler::CreateProtocolHandler(protocol, url); - ProtocolHandlerRegistry *registry = + custom_handlers::ProtocolHandlerRegistry *registry = ProtocolHandlerRegistryFactory::GetForBrowserContext(context); if (registry->SilentlyHandleRegisterHandlerRequest(handler)) return; @@ -808,10 +790,10 @@ void WebContentsDelegateQt::UnregisterProtocolHandler(content::RenderFrameHost * { content::BrowserContext* context = frameHost->GetBrowserContext(); - ProtocolHandler handler = - ProtocolHandler::CreateProtocolHandler(protocol, url); + content::ProtocolHandler handler = + content::ProtocolHandler::CreateProtocolHandler(protocol, url); - ProtocolHandlerRegistry* registry = + custom_handlers::ProtocolHandlerRegistry* registry = ProtocolHandlerRegistryFactory::GetForBrowserContext(context); registry->RemoveHandler(handler); } @@ -867,7 +849,7 @@ WebContentsDelegateQt::LoadingState WebContentsDelegateQt::determineLoadingState { // Based on TabLoadTracker::DetermineLoadingState - if (contents->IsLoadingToDifferentDocument() && !contents->IsWaitingForResponse()) + if (contents->ShouldShowLoadingUI() && !contents->IsWaitingForResponse()) return LoadingState::Loading; content::NavigationController &controller = contents->GetController(); diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index f32dc797b..669424712 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -154,13 +154,12 @@ public: // WebContentsObserver overrides void RenderFrameCreated(content::RenderFrameHost *render_frame_host) override; - void RenderProcessGone(base::TerminationStatus status) override; + void PrimaryMainFrameRenderProcessGone(base::TerminationStatus status) override; void RenderFrameHostChanged(content::RenderFrameHost *old_host, content::RenderFrameHost *new_host) override; void RenderViewHostChanged(content::RenderViewHost *old_host, content::RenderViewHost *new_host) override; void DidStartNavigation(content::NavigationHandle *navigation_handle) override; void DidFinishNavigation(content::NavigationHandle *navigation_handle) override; - void DidStartLoading() override; - void DidReceiveResponse() override; + void PrimaryPageChanged(content::Page &page) override; void DidStopLoading() override; void DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code) override; void DidFinishLoad(content::RenderFrameHost *render_frame_host, const GURL &validated_url) override; @@ -221,7 +220,6 @@ private: SavePageInfo m_savePageInfo; QSharedPointer<FilePickerController> m_filePickerController; LoadingState m_loadingState; - bool m_didStartLoadingSeen; FrameFocusedObserver m_frameFocusedObserver; QString m_title; diff --git a/src/core/web_contents_view_qt.cpp b/src/core/web_contents_view_qt.cpp index 4b1db2cb0..57d4141e6 100644 --- a/src/core/web_contents_view_qt.cpp +++ b/src/core/web_contents_view_qt.cpp @@ -237,7 +237,7 @@ void WebContentsViewQt::update(QWebEngineContextMenuRequest *request, #endif } -void WebContentsViewQt::ShowContextMenu(content::RenderFrameHost *, +void WebContentsViewQt::ShowContextMenu(content::RenderFrameHost &, const content::ContextMenuParams ¶ms) { if (auto rwhv = diff --git a/src/core/web_contents_view_qt.h b/src/core/web_contents_view_qt.h index 32fcef69a..43e28ac0c 100644 --- a/src/core/web_contents_view_qt.h +++ b/src/core/web_contents_view_qt.h @@ -107,6 +107,7 @@ public: gfx::Rect GetViewBounds() const override { return gfx::Rect(); } void FocusThroughTabTraversal(bool reverse) override; + void OnCapturerCountChanged() override { QT_NOT_YET_IMPLEMENTED } #if defined(OS_MAC) bool CloseTabAfterEventTrackingIfNeeded() override { QT_NOT_YET_IMPLEMENTED return false; } @@ -120,7 +121,7 @@ public: void UpdateDragCursor(ui::mojom::DragOperation dragOperation) override; - void ShowContextMenu(content::RenderFrameHost *, const content::ContextMenuParams ¶ms) override; + void ShowContextMenu(content::RenderFrameHost &, const content::ContextMenuParams ¶ms) override; void GotFocus(content::RenderWidgetHostImpl *render_widget_host) override; void LostFocus(content::RenderWidgetHostImpl *render_widget_host) override; diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 1ca524d3c..4f44bc92a 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -456,7 +456,6 @@ void WebEngineContext::destroy() GLContextHelper::destroy(); // These would normally be in the content-runner, but we allocated them separately: - m_startupData.reset(); m_mojoIpcSupport.reset(); m_discardableSharedMemoryManager.reset(); @@ -747,13 +746,13 @@ WebEngineContext::WebEngineContext() contentMainParams.setup_signal_handlers = false; #if defined(OS_WIN) contentMainParams.sandbox_info = QtWebEngineSandbox::staticSandboxInterfaceInfo(); - sandbox::SandboxInterfaceInfo sandbox_info = {0}; + sandbox::SandboxInterfaceInfo sandbox_info = {nullptr}; if (!contentMainParams.sandbox_info) { content::InitializeSandboxInfo(&sandbox_info); contentMainParams.sandbox_info = &sandbox_info; } #endif - m_contentRunner->Initialize(contentMainParams); + m_contentRunner->Initialize(std::move(contentMainParams)); mojo::core::Configuration mojoConfiguration; mojoConfiguration.is_broker_process = true; @@ -766,21 +765,21 @@ WebEngineContext::WebEngineContext() m_mainDelegate->PostEarlyInitialization(false); content::StartBrowserThreadPool(); content::BrowserTaskExecutor::PostFeatureListSetup(); - tracing::InitTracingPostThreadPoolStartAndFeatureList(); + tracing::InitTracingPostThreadPoolStartAndFeatureList(false); m_discardableSharedMemoryManager = std::make_unique<discardable_memory::DiscardableSharedMemoryManager>(); base::PowerMonitor::Initialize(std::make_unique<base::PowerMonitorDeviceSource>()); m_mojoIpcSupport = std::make_unique<content::MojoIpcSupport>(content::BrowserTaskExecutor::CreateIOThread()); download::SetIOTaskRunner(m_mojoIpcSupport->io_thread()->task_runner()); - m_startupData = m_mojoIpcSupport->CreateBrowserStartupData(); + std::unique_ptr<content::StartupData> startupData = m_mojoIpcSupport->CreateBrowserStartupData(); // Once the MessageLoop has been created, attach a top-level RunLoop. m_runLoop.reset(new base::RunLoop); m_runLoop->BeforeRun(); - content::MainFunctionParams mainParams(*base::CommandLine::ForCurrentProcess()); - mainParams.startup_data = m_startupData.get(); - m_browserRunner->Initialize(mainParams); + content::MainFunctionParams mainParams(base::CommandLine::ForCurrentProcess()); + mainParams.startup_data = std::move(startupData); + m_browserRunner->Initialize(std::move(mainParams)); m_devtoolsServer.reset(new DevToolsServerQt()); m_devtoolsServer->start(); diff --git a/src/core/web_engine_context.h b/src/core/web_engine_context.h index 27eae95bf..dcd6cf867 100644 --- a/src/core/web_engine_context.h +++ b/src/core/web_engine_context.h @@ -61,7 +61,6 @@ class GpuProcess; class GpuThreadController; class InProcessChildThreadParams; class MojoIpcSupport; -struct StartupData; } namespace discardable_memory { @@ -140,7 +139,6 @@ private: std::unique_ptr<content::ContentMainRunner> m_contentRunner; std::unique_ptr<content::BrowserMainRunner> m_browserRunner; std::unique_ptr<discardable_memory::DiscardableSharedMemoryManager> m_discardableSharedMemoryManager; - std::unique_ptr<content::StartupData> m_startupData; std::unique_ptr<content::MojoIpcSupport> m_mojoIpcSupport; std::unique_ptr<QObject> m_globalQObject; std::unique_ptr<ProfileAdapter> m_defaultProfileAdapter; diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index a04efdd1f..cfffc87ed 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -417,8 +417,6 @@ void WebEngineSettings::applySettingsToWebPreferences(blink::web_pref::WebPrefer toString16(fontFamily(QWebEngineSettings::CursiveFont)); prefs->fantasy_font_family_map[blink::web_pref::kCommonScript] = toString16(fontFamily(QWebEngineSettings::FantasyFont)); - prefs->pictograph_font_family_map[blink::web_pref::kCommonScript] = - toString16(fontFamily(QWebEngineSettings::PictographFont)); prefs->default_font_size = fontSize(QWebEngineSettings::DefaultFontSize); prefs->default_fixed_font_size = fontSize(QWebEngineSettings::DefaultFixedFontSize); prefs->minimum_font_size = fontSize(QWebEngineSettings::MinimumFontSize); diff --git a/src/core/web_usb_detector_qt.cpp b/src/core/web_usb_detector_qt.cpp index 5ae155a2e..df7d86c5b 100644 --- a/src/core/web_usb_detector_qt.cpp +++ b/src/core/web_usb_detector_qt.cpp @@ -37,6 +37,11 @@ ** ****************************************************************************/ +// based on chrome/browser/usb/web_usb_detector.cc +// Copyright 2015 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 file. + #include "web_usb_detector_qt.h" #include "qtwebenginecoreglobal_p.h" @@ -51,22 +56,12 @@ WebUsbDetectorQt::~WebUsbDetectorQt() = default; void WebUsbDetectorQt::Initialize() { -#if defined(OS_WIN) - // The WebUSB device detector is disabled on Windows due to jank and hangs - // caused by enumerating devices. The new USB backend is designed to resolve - // these issues so enable it for testing. https://crbug.com/656702 - if (!base::FeatureList::IsEnabled(device::kNewUsbBackend)) - return; -#endif // defined(OS_WIN) - if (!m_deviceManager) { // Receive mojo::Remote<UsbDeviceManager> from DeviceService. content::GetDeviceService().BindUsbDeviceManager( m_deviceManager.BindNewPipeAndPassReceiver()); } DCHECK(m_deviceManager); - m_deviceManager.set_disconnect_handler(base::BindOnce( - &WebUsbDetectorQt::OnDeviceManagerConnectionError, base::Unretained(this))); // Listen for added/removed device events. DCHECK(!m_clientReceiver.is_bound()); @@ -84,12 +79,3 @@ void WebUsbDetectorQt::OnDeviceRemoved(device::mojom::UsbDeviceInfoPtr device_in Q_UNUSED(device_info); QT_NOT_YET_IMPLEMENTED } - -void WebUsbDetectorQt::OnDeviceManagerConnectionError() -{ - m_deviceManager.reset(); - m_clientReceiver.reset(); - - // Try to reconnect the device manager. - Initialize(); -} diff --git a/src/core/web_usb_detector_qt.h b/src/core/web_usb_detector_qt.h index b1d7279bf..64ddea15b 100644 --- a/src/core/web_usb_detector_qt.h +++ b/src/core/web_usb_detector_qt.h @@ -40,7 +40,6 @@ #ifndef WEB_USB_DETECTOR_QT_H #define WEB_USB_DETECTOR_QT_H -#include "base/macros.h" #include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h" @@ -61,15 +60,11 @@ private: void OnDeviceAdded(device::mojom::UsbDeviceInfoPtr device_info) override; void OnDeviceRemoved(device::mojom::UsbDeviceInfoPtr device_info) override; - void OnDeviceManagerConnectionError(); - // Connection to |device_manager_instance_|. mojo::Remote<device::mojom::UsbDeviceManager> m_deviceManager; mojo::AssociatedReceiver<device::mojom::UsbDeviceManagerClient> m_clientReceiver { this }; base::WeakPtrFactory<WebUsbDetectorQt> m_weakFactory { this }; - - DISALLOW_COPY_AND_ASSIGN(WebUsbDetectorQt); }; #endif // WEB_USB_DETECTOR_QT_H |