diff options
Diffstat (limited to 'src')
89 files changed, 916 insertions, 463 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject dc5221146d665f5634fab11fb4c9b5515c1ab07 +Subproject 88a931558e2e960eacccb32483713fcc4bbaf43 diff --git a/src/buildtools/config/common.pri b/src/buildtools/config/common.pri index 23a134774..97d39535c 100644 --- a/src/buildtools/config/common.pri +++ b/src/buildtools/config/common.pri @@ -137,3 +137,5 @@ qtConfig(webengine-kerberos) { ccache { gn_args += cc_wrapper=\"ccache\" } + +qtConfig(force_asserts): gn_args += dcheck_always_on=true diff --git a/src/buildtools/config/linux.pri b/src/buildtools/config/linux.pri index 493ea9766..f3c4fc953 100644 --- a/src/buildtools/config/linux.pri +++ b/src/buildtools/config/linux.pri @@ -179,7 +179,7 @@ host_build { } else { gn_args += use_system_harfbuzz=false } - !qtConfig(webengine-system-glib): gn_args += use_glib=false + gn_args += use_glib=false qtConfig(webengine-pulseaudio) { gn_args += use_pulseaudio=true } else { diff --git a/src/buildtools/configure.json b/src/buildtools/configure.json index 535d8358b..a36d05320 100644 --- a/src/buildtools/configure.json +++ b/src/buildtools/configure.json @@ -150,9 +150,9 @@ ] }, "webengine-icu": { - "label": "icu >= 63", + "label": "icu >= 64", "sources": [ - { "type": "pkgConfig", "args": "icu-uc >= 63 icu-i18n >= 63" } + { "type": "pkgConfig", "args": "icu-uc >= 64 icu-i18n >= 64" } ] }, "webengine-webp": { diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp index 0fddacb15..9e2a4a5b1 100644 --- a/src/core/api/qtwebenginecoreglobal.cpp +++ b/src/core/api/qtwebenginecoreglobal.cpp @@ -108,7 +108,7 @@ Q_WEBENGINECORE_PRIVATE_EXPORT void initialize() QCoreApplication *app = QCoreApplication::instance(); if (!app) { - qFatal("QtWebEngine::initialize() must be called after the construction of the application object."); + qFatal("QtWebEngine::initialize() but no core application instance."); return; } @@ -126,7 +126,7 @@ Q_WEBENGINECORE_PRIVATE_EXPORT void initialize() shareContext = new QOpenGLContext; QSurfaceFormat format = QSurfaceFormat::defaultFormat(); - format.setOption(QSurfaceFormat::ResetNotification); +// format.setOption(QSurfaceFormat::ResetNotification); shareContext->setFormat(format); shareContext->create(); qAddPostRoutine(deleteShareContext); diff --git a/src/core/api/qwebenginefindtextresult.cpp b/src/core/api/qwebenginefindtextresult.cpp index ce1be359e..c0adc6177 100644 --- a/src/core/api/qwebenginefindtextresult.cpp +++ b/src/core/api/qwebenginefindtextresult.cpp @@ -44,7 +44,7 @@ QT_BEGIN_NAMESPACE class QWebEngineFindTextResultPrivate : public QSharedData { public: int numberOfMatches = 0; - int activeMatchOrdinal = 0; + int activeMatch = 0; }; /*! @@ -54,6 +54,18 @@ public: \inmodule QtWebEngineCore + The string search can be initiated by the \l QWebEnginePage::findText() or + \l{WebEngineView::findText()}{WebEngineView.findText()} method. The results of the search + are highlighted in the view. The details of this result are passed as a + QWebEngineFindTextResult object that can be used to show a status message, + such as "2 of 2 matches". For example: + + \code + QObject::connect(view.page(), &QWebEnginePage::findTextFinished, [](const QWebEngineFindTextResult &result) { + qInfo() << result.activeMatch() << "of" << result.numberOfMatches() << "matches"; + }); + \endcode + Results are passed to the user in the \l QWebEnginePage::findTextFinished() and \l{WebEngineView::findTextFinished()}{WebEngineView.findTextFinished()} signals. @@ -67,11 +79,11 @@ QWebEngineFindTextResult::QWebEngineFindTextResult() /*! \internal */ -QWebEngineFindTextResult::QWebEngineFindTextResult(int numberOfMatches, int activeMatchOrdinal) +QWebEngineFindTextResult::QWebEngineFindTextResult(int numberOfMatches, int activeMatch) : d(new QWebEngineFindTextResultPrivate) { d->numberOfMatches = numberOfMatches; - d->activeMatchOrdinal = activeMatchOrdinal; + d->activeMatch = activeMatch; } /*! \internal @@ -103,12 +115,12 @@ int QWebEngineFindTextResult::numberOfMatches() const } /*! - \property QWebEngineFindTextResult::activeMatchOrdinal + \property QWebEngineFindTextResult::activeMatch \brief The index of the currently highlighted match. */ -int QWebEngineFindTextResult::activeMatchOrdinal() const +int QWebEngineFindTextResult::activeMatch() const { - return d->activeMatchOrdinal; + return d->activeMatch; } QT_END_NAMESPACE diff --git a/src/core/api/qwebenginefindtextresult.h b/src/core/api/qwebenginefindtextresult.h index 073a8135f..246e689c3 100644 --- a/src/core/api/qwebenginefindtextresult.h +++ b/src/core/api/qwebenginefindtextresult.h @@ -55,11 +55,11 @@ class QWebEngineFindTextResultPrivate; class Q_WEBENGINECORE_EXPORT QWebEngineFindTextResult { Q_GADGET Q_PROPERTY(int numberOfMatches READ numberOfMatches CONSTANT FINAL) - Q_PROPERTY(int activeMatchOrdinal READ activeMatchOrdinal CONSTANT FINAL) + Q_PROPERTY(int activeMatch READ activeMatch CONSTANT FINAL) public: int numberOfMatches() const; - int activeMatchOrdinal() const; + int activeMatch() const; QWebEngineFindTextResult(); QWebEngineFindTextResult(const QWebEngineFindTextResult &other); @@ -67,7 +67,7 @@ public: ~QWebEngineFindTextResult(); private: - QWebEngineFindTextResult(int numberOfMatches, int activeMatchOrdinal); + QWebEngineFindTextResult(int numberOfMatches, int activeMatch); QSharedDataPointer<QWebEngineFindTextResultPrivate> d; diff --git a/src/core/api/qwebengineurlrequestinfo.cpp b/src/core/api/qwebengineurlrequestinfo.cpp index 5492b21d4..e44410099 100644 --- a/src/core/api/qwebengineurlrequestinfo.cpp +++ b/src/core/api/qwebengineurlrequestinfo.cpp @@ -216,7 +216,7 @@ QWebEngineUrlRequestInfo::ResourceType QWebEngineUrlRequestInfo::resourceType() \value NavigationTypeFormSubmitted Navigation submits a form. \value NavigationTypeBackForward Navigation initiated by a history action. \value NavigationTypeReload Navigation initiated by refreshing the page. - \value NavigationTypeRedirect Navigation triggered automatically by page content or remote server. + \value NavigationTypeRedirect Navigation triggered automatically by page content or remote server. (Added in Qt 5.14) \value NavigationTypeOther None of the above. */ diff --git a/src/core/browser_accessibility_manager_qt.cpp b/src/core/browser_accessibility_manager_qt.cpp index 7fb1386c5..8e3ee5940 100644 --- a/src/core/browser_accessibility_manager_qt.cpp +++ b/src/core/browser_accessibility_manager_qt.cpp @@ -146,6 +146,24 @@ void BrowserAccessibilityManagerQt::FireBlinkEvent(ax::mojom::Event event_type, break; } } + +void BrowserAccessibilityManagerQt::FireGeneratedEvent(ui::AXEventGenerator::Event event_type, + BrowserAccessibility* node) +{ + BrowserAccessibilityQt *iface = static_cast<BrowserAccessibilityQt*>(node); + + switch (event_type) { + case ui::AXEventGenerator::Event::VALUE_CHANGED: + if (iface->role() == QAccessible::EditableText) { + QAccessibleTextUpdateEvent event(iface, -1, QString(), QString()); + QAccessible::updateAccessibility(&event); + } + break; + default: + break; + } +} + #endif // QT_NO_ACCESSIBILITY } diff --git a/src/core/browser_accessibility_manager_qt.h b/src/core/browser_accessibility_manager_qt.h index 87c8875ba..16e2d1fe7 100644 --- a/src/core/browser_accessibility_manager_qt.h +++ b/src/core/browser_accessibility_manager_qt.h @@ -60,6 +60,8 @@ public: ~BrowserAccessibilityManagerQt() override; void FireBlinkEvent(ax::mojom::Event event_type, BrowserAccessibility* node) override; + void FireGeneratedEvent(ui::AXEventGenerator::Event event_type, + BrowserAccessibility* node) override; QAccessibleInterface *rootParentAccessible(); bool isValid() const { return m_valid; } diff --git a/src/core/browser_message_filter_qt.cpp b/src/core/browser_message_filter_qt.cpp index c8fc88017..a4b75f075 100644 --- a/src/core/browser_message_filter_qt.cpp +++ b/src/core/browser_message_filter_qt.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWebEngine module of the Qt Toolkit. @@ -40,19 +40,19 @@ #include "browser_message_filter_qt.h" #include "chrome/browser/profiles/profile.h" -#include "common/qt_messages.h" #include "content/public/browser/plugin_service.h" #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context_getter.h" -#include "type_conversion.h" -#include "net/network_delegate_qt.h" +#include "common/qt_messages.h" +#include "profile_io_data_qt.h" +#include "type_conversion.h" namespace QtWebEngineCore { BrowserMessageFilterQt::BrowserMessageFilterQt(int /*render_process_id*/, Profile *profile) : BrowserMessageFilter(QtMsgStart) - , m_profile(profile) + , m_profileData(ProfileIODataQt::FromBrowserContext(profile)) { } @@ -81,8 +81,7 @@ void BrowserMessageFilterQt::OnAllowDatabase(int /*render_frame_id*/, const GURL &top_origin_url, bool* allowed) { - NetworkDelegateQt *networkDelegate = static_cast<NetworkDelegateQt *>(m_profile->GetRequestContext()->GetURLRequestContext()->network_delegate()); - *allowed = networkDelegate->canGetCookies(top_origin_url, origin_url); + *allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url)); } void BrowserMessageFilterQt::OnAllowDOMStorage(int /*render_frame_id*/, @@ -91,8 +90,7 @@ void BrowserMessageFilterQt::OnAllowDOMStorage(int /*render_frame_id*/, bool /*local*/, bool *allowed) { - NetworkDelegateQt *networkDelegate = static_cast<NetworkDelegateQt *>(m_profile->GetRequestContext()->GetURLRequestContext()->network_delegate()); - *allowed = networkDelegate->canGetCookies(top_origin_url, origin_url); + *allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url)); } void BrowserMessageFilterQt::OnAllowIndexedDB(int /*render_frame_id*/, @@ -100,8 +98,7 @@ void BrowserMessageFilterQt::OnAllowIndexedDB(int /*render_frame_id*/, const GURL &top_origin_url, bool *allowed) { - NetworkDelegateQt *networkDelegate = static_cast<NetworkDelegateQt *>(m_profile->GetRequestContext()->GetURLRequestContext()->network_delegate()); - *allowed = networkDelegate->canGetCookies(top_origin_url, origin_url); + *allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url)); } void BrowserMessageFilterQt::OnRequestFileSystemAccessSync(int render_frame_id, @@ -153,9 +150,7 @@ void BrowserMessageFilterQt::OnRequestFileSystemAccess(int /*render_frame_id*/, base::Callback<void(bool)> callback) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); - - NetworkDelegateQt *networkDelegate = static_cast<NetworkDelegateQt *>(m_profile->GetRequestContext()->GetURLRequestContext()->network_delegate()); - bool allowed = networkDelegate->canGetCookies(top_origin_url, origin_url); + bool allowed = m_profileData->canGetCookies(toQt(top_origin_url), toQt(origin_url)); callback.Run(allowed); } diff --git a/src/core/browser_message_filter_qt.h b/src/core/browser_message_filter_qt.h index 3963fb9d5..4abc612f8 100644 --- a/src/core/browser_message_filter_qt.h +++ b/src/core/browser_message_filter_qt.h @@ -49,6 +49,8 @@ class Profile; namespace QtWebEngineCore { +class ProfileIODataQt; + class BrowserMessageFilterQt : public content::BrowserMessageFilter { public: @@ -91,7 +93,7 @@ private: const GURL &top_origin_url, base::Callback<void(bool)> callback); - Profile *m_profile; + ProfileIODataQt *m_profileData; }; } // namespace QtWebEngineCore diff --git a/src/core/certificate_error_controller.cpp b/src/core/certificate_error_controller.cpp index bc83ed802..f3b16357b 100644 --- a/src/core/certificate_error_controller.cpp +++ b/src/core/certificate_error_controller.cpp @@ -93,7 +93,7 @@ CertificateErrorControllerPrivate::CertificateErrorControllerPrivate(int cert_er if (auto cert = ssl_info.cert.get()) { validStart = toQt(cert->valid_start()); validExpiry = toQt(cert->valid_expiry()); - chain = toCertificateChain(cert); + certificateChain = toCertificateChain(cert); } } @@ -187,9 +187,9 @@ QString CertificateErrorController::errorString() const return getQStringForMessageId(IDS_CERT_ERROR_UNKNOWN_ERROR_DESCRIPTION); } -QList<QSslCertificate> CertificateErrorController::chain() const +QList<QSslCertificate> CertificateErrorController::certificateChain() const { - return d->chain; + return d->certificateChain; } QT_END_NAMESPACE diff --git a/src/core/certificate_error_controller.h b/src/core/certificate_error_controller.h index 7f5300dc8..d7e057adf 100644 --- a/src/core/certificate_error_controller.h +++ b/src/core/certificate_error_controller.h @@ -96,7 +96,7 @@ public: QString errorString() const; QDateTime validStart() const; QDateTime validExpiry() const; - QList<QSslCertificate> chain() const; + QList<QSslCertificate> certificateChain() const; void accept(bool); diff --git a/src/core/certificate_error_controller_p.h b/src/core/certificate_error_controller_p.h index a11f2b6f0..ceae99853 100644 --- a/src/core/certificate_error_controller_p.h +++ b/src/core/certificate_error_controller_p.h @@ -71,7 +71,7 @@ public: bool fatalError; bool strictEnforcement; const base::Callback<void(content::CertificateRequestResultType)> callback; - QList<QSslCertificate> chain; + QList<QSslCertificate> certificateChain; }; QT_END_NAMESPACE diff --git a/src/core/chromium_overrides.cpp b/src/core/chromium_overrides.cpp index 4920540a0..9d3e3f08a 100644 --- a/src/core/chromium_overrides.cpp +++ b/src/core/chromium_overrides.cpp @@ -118,7 +118,7 @@ std::unique_ptr<base::ListValue> GetFontList_SlowBlocking() // TODO(yusukes): Support localized family names. font_list->Append(std::move(font_item)); } - return std::move(font_list); + return font_list; } } // namespace content @@ -142,8 +142,8 @@ namespace content { std::vector<AccessibilityTreeFormatter::TestPass> AccessibilityTreeFormatter::GetTestPasses() { return { - {"blink", &AccessibilityTreeFormatterBlink::CreateBlink}, - {"native", &AccessibilityTreeFormatter::Create}, + {"blink", &AccessibilityTreeFormatterBlink::CreateBlink, nullptr}, + {"native", &AccessibilityTreeFormatter::Create, nullptr}, }; } } // namespace content diff --git a/src/core/compositor/compositor_resource_fence.h b/src/core/compositor/compositor_resource_fence.h index 196297f78..574416b8b 100644 --- a/src/core/compositor/compositor_resource_fence.h +++ b/src/core/compositor/compositor_resource_fence.h @@ -52,7 +52,7 @@ public: REQUIRE_ADOPTION_FOR_REFCOUNTED_TYPE(); CompositorResourceFence() {} - CompositorResourceFence(const gl::TransferableFence &sync) : m_sync(sync) {}; + CompositorResourceFence(const gl::TransferableFence &sync) : m_sync(sync) {} ~CompositorResourceFence() { release(); } // May be used only by Qt Quick render thread. diff --git a/src/core/compositor/delegated_frame_node.cpp b/src/core/compositor/delegated_frame_node.cpp index 2a0df3acd..4d74937d9 100644 --- a/src/core/compositor/delegated_frame_node.cpp +++ b/src/core/compositor/delegated_frame_node.cpp @@ -858,7 +858,7 @@ void DelegatedFrameNode::handleQuad( const viz::TextureDrawQuad *tquad = viz::TextureDrawQuad::MaterialCast(quad); const CompositorResource *resource = findAndHoldResource(tquad->resource_id(), resourceTracker); QSGTexture *texture = - initAndHoldTexture(resource, quad->ShouldDrawWithBlending(), apiDelegate); + initAndHoldTexture(resource, quad->ShouldDrawWithBlending(true), apiDelegate); QSizeF textureSize; if (texture) textureSize = texture->textureSize(); @@ -909,7 +909,7 @@ void DelegatedFrameNode::handleQuad( const viz::TileDrawQuad *tquad = viz::TileDrawQuad::MaterialCast(quad); const CompositorResource *resource = findAndHoldResource(tquad->resource_id(), resourceTracker); nodeHandler->setupTextureContentNode( - initAndHoldTexture(resource, quad->ShouldDrawWithBlending(), apiDelegate), + initAndHoldTexture(resource, quad->ShouldDrawWithBlending(true), apiDelegate), toQt(quad->rect), toQt(tquad->tex_coord_rect), QSGImageNode::NoTransform, currentLayerChain); break; @@ -930,10 +930,10 @@ void DelegatedFrameNode::handleQuad( aResource = findAndHoldResource(vquad->a_plane_resource_id(), resourceTracker); nodeHandler->setupYUVVideoNode( - initAndHoldTexture(yResource, quad->ShouldDrawWithBlending()), - initAndHoldTexture(uResource, quad->ShouldDrawWithBlending()), - initAndHoldTexture(vResource, quad->ShouldDrawWithBlending()), - aResource ? initAndHoldTexture(aResource, quad->ShouldDrawWithBlending()) : 0, + initAndHoldTexture(yResource, quad->ShouldDrawWithBlending(true)), + initAndHoldTexture(uResource, quad->ShouldDrawWithBlending(true)), + initAndHoldTexture(vResource, quad->ShouldDrawWithBlending(true)), + aResource ? initAndHoldTexture(aResource, quad->ShouldDrawWithBlending(true)) : 0, toQt(vquad->ya_tex_coord_rect), toQt(vquad->uv_tex_coord_rect), toQt(vquad->ya_tex_size), toQt(vquad->uv_tex_size), vquad->video_color_space, vquad->resource_multiplier, vquad->resource_offset, toQt(quad->rect), @@ -945,7 +945,7 @@ void DelegatedFrameNode::handleQuad( const viz::StreamVideoDrawQuad *squad = viz::StreamVideoDrawQuad::MaterialCast(quad); const CompositorResource *resource = findAndHoldResource(squad->resource_id(), resourceTracker); MailboxTexture *texture = static_cast<MailboxTexture *>( - initAndHoldTexture(resource, quad->ShouldDrawWithBlending(), apiDelegate, GL_TEXTURE_EXTERNAL_OES)); + initAndHoldTexture(resource, quad->ShouldDrawWithBlending(true), apiDelegate, GL_TEXTURE_EXTERNAL_OES)); QMatrix4x4 qMatrix; // convertToQt(squad->matrix.matrix(), qMatrix); diff --git a/src/core/compositor/stream_video_node.cpp b/src/core/compositor/stream_video_node.cpp index 29922f866..fb9501f24 100644 --- a/src/core/compositor/stream_video_node.cpp +++ b/src/core/compositor/stream_video_node.cpp @@ -47,7 +47,7 @@ class StreamVideoMaterialShader : public QSGMaterialShader { public: StreamVideoMaterialShader(TextureTarget target) : m_target(target) { } - virtual void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial); + virtual void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; char const *const *attributeNames() const override { static const char *names[] = { @@ -100,7 +100,7 @@ protected: return shader2DRect; } - virtual void initialize() { + virtual void initialize() override { m_id_matrix = program()->uniformLocation("matrix"); m_id_sTexture = program()->uniformLocation("s_texture"); m_id_texMatrix = program()->uniformLocation("texMatrix"); diff --git a/src/core/configure.json b/src/core/configure.json index 9ee66bf61..d7f5a92f1 100644 --- a/src/core/configure.json +++ b/src/core/configure.json @@ -94,10 +94,6 @@ "label": "thumb instruction set", "type": "hasThumbFlag" }, - "webengine-extensions-gcc-version" : { - "label": "GCC 6 or newer", - "type": "hasGcc6OrNewer" - }, "webengine-noexecstack" : { "label": "linker supports -z noexecstack", "type": "linkerSupportsFlag", @@ -194,7 +190,7 @@ "label": "Extensions", "purpose": "Enables Chromium extensions within certain limits. Currently used for enabling the pdf viewer.", "section": "WebEngine", - "condition": "features.webengine-printing-and-pdf && (tests.webengine-extensions-gcc-version || config.clang || !config.gcc)", + "condition": "features.webengine-printing-and-pdf", "autoDetect": "features.webengine-printing-and-pdf", "output": [ "publicFeature" ] }, diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 6fcd9ad5b..29b6e09ed 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -252,7 +252,7 @@ void ShareGroupQtQuick::AboutToAddFirstContext() // This currently has to be setup by ::main in all applications using QQuickWebEngineView with delegated rendering. QOpenGLContext *shareContext = qt_gl_global_share_context(); if (!shareContext) { - qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function."); + qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function before QCoreApplication is created."); } m_shareContextQtQuick = new QtShareGLContext(shareContext); #endif diff --git a/src/core/extensions/extension_system_qt.cpp b/src/core/extensions/extension_system_qt.cpp index 7278e50c1..fbe98099c 100644 --- a/src/core/extensions/extension_system_qt.cpp +++ b/src/core/extensions/extension_system_qt.cpp @@ -102,8 +102,7 @@ namespace extensions { namespace { -std::string GenerateId(const base::DictionaryValue *manifest, - const base::FilePath &path) +std::string GenerateId(const base::DictionaryValue *manifest, const base::FilePath &path) { std::string raw_key; std::string id_input; @@ -130,49 +129,36 @@ std::unique_ptr<base::DictionaryValue> ParseManifest(const std::string &manifest } // namespace // Dummy Content Verifier Delegate. Added to prevent crashes. -class ContentVerifierDelegateQt - : public ContentVerifierDelegate { - public: - ~ContentVerifierDelegateQt() override {} - - // This should return what verification mode is appropriate for the given - // extension, if any. - bool ShouldBeVerified(const Extension& extension) override +class ContentVerifierDelegateQt : public ContentVerifierDelegate +{ +public: + ~ContentVerifierDelegateQt() override {} + + // This should return what verification mode is appropriate for the given + // extension, if any. + bool ShouldBeVerified(const Extension &extension) override { return false; } + + // Should return the public key to use for validating signatures via the two + // out parameters. + ContentVerifierKey GetPublicKey() override { return ContentVerifierKey(); } + // This should return a URL that can be used to fetch the + // verified_contents.json containing signatures for the given extension + // id/version pair. + GURL GetSignatureFetchUrl(const std::string &extension_id, const base::Version &version) override { return GURL(); } + + // This should return the set of file paths for images used within the + // browser process. (These may get transcoded during the install process). + std::set<base::FilePath> GetBrowserImagePaths(const extensions::Extension *extension) override { - return false; + return std::set<base::FilePath>(); } - // Should return the public key to use for validating signatures via the two - // out parameters. - ContentVerifierKey GetPublicKey() override { - return ContentVerifierKey(); - } - // This should return a URL that can be used to fetch the - // verified_contents.json containing signatures for the given extension - // id/version pair. - GURL GetSignatureFetchUrl(const std::string& extension_id, - const base::Version& version) override { - return GURL(); - } - - // This should return the set of file paths for images used within the - // browser process. (These may get transcoded during the install process). - std::set<base::FilePath> GetBrowserImagePaths( - const extensions::Extension* extension) override { - return std::set<base::FilePath>(); - } - - // Called when the content verifier detects that a read of a file inside - // an extension did not match its expected hash. - void VerifyFailed(const std::string& extension_id, - ContentVerifyJob::FailureReason reason) override { - - } - - // Called when ExtensionSystem is shutting down. - void Shutdown() override { - - } + // Called when the content verifier detects that a read of a file inside + // an extension did not match its expected hash. + void VerifyFailed(const std::string &extension_id, ContentVerifyJob::FailureReason reason) override {} + + // Called when ExtensionSystem is shutting down. + void Shutdown() override {} }; void ExtensionSystemQt::LoadExtension(std::string extension_id, std::unique_ptr<base::DictionaryValue> manifest, const base::FilePath &directory) diff --git a/src/core/extensions/extension_system_qt.h b/src/core/extensions/extension_system_qt.h index 4370f5cc3..04bffb74d 100644 --- a/src/core/extensions/extension_system_qt.h +++ b/src/core/extensions/extension_system_qt.h @@ -90,8 +90,8 @@ public: ManagementPolicy *management_policy() override; ServiceWorkerManager *service_worker_manager() override; SharedUserScriptMaster *shared_user_script_master() override; - StateStore* state_store() override; - StateStore* rules_store() override; + StateStore *state_store() override; + StateStore *rules_store() override; scoped_refptr<ValueStoreFactory> store_factory() override; InfoMap *info_map() override; QuotaService *quota_service() override; diff --git a/src/core/extensions/extension_web_contents_observer_qt.h b/src/core/extensions/extension_web_contents_observer_qt.h index 5f32562fc..a528b3856 100644 --- a/src/core/extensions/extension_web_contents_observer_qt.h +++ b/src/core/extensions/extension_web_contents_observer_qt.h @@ -50,8 +50,8 @@ namespace extensions { class ExtensionWebContentsObserverQt - : public ExtensionWebContentsObserver, - public content::WebContentsUserData<ExtensionWebContentsObserverQt> + : public ExtensionWebContentsObserver + , public content::WebContentsUserData<ExtensionWebContentsObserverQt> { public: explicit ExtensionWebContentsObserverQt(content::WebContents *web_contents); diff --git a/src/core/extensions/extensions_browser_api_provider_qt.cpp b/src/core/extensions/extensions_browser_api_provider_qt.cpp index cc1932c64..731dfb0fd 100644 --- a/src/core/extensions/extensions_browser_api_provider_qt.cpp +++ b/src/core/extensions/extensions_browser_api_provider_qt.cpp @@ -42,16 +42,13 @@ #include "extensions/browser/api/generated_api_registration.h" namespace extensions { -ExtensionsBrowserAPIProviderQt::ExtensionsBrowserAPIProviderQt() = - default; -ExtensionsBrowserAPIProviderQt::~ExtensionsBrowserAPIProviderQt() = - default; +ExtensionsBrowserAPIProviderQt::ExtensionsBrowserAPIProviderQt() = default; +ExtensionsBrowserAPIProviderQt::~ExtensionsBrowserAPIProviderQt() = default; -void ExtensionsBrowserAPIProviderQt::RegisterExtensionFunctions( - ExtensionFunctionRegistry* registry) { +void ExtensionsBrowserAPIProviderQt::RegisterExtensionFunctions(ExtensionFunctionRegistry *registry) +{ api::GeneratedFunctionRegistry::RegisterAll(registry); } } - diff --git a/src/core/extensions/extensions_browser_api_provider_qt.h b/src/core/extensions/extensions_browser_api_provider_qt.h index 612df3825..f1d10ac95 100644 --- a/src/core/extensions/extensions_browser_api_provider_qt.h +++ b/src/core/extensions/extensions_browser_api_provider_qt.h @@ -45,7 +45,8 @@ namespace extensions { -class ExtensionsBrowserAPIProviderQt : public ExtensionsBrowserAPIProvider { +class ExtensionsBrowserAPIProviderQt : public ExtensionsBrowserAPIProvider +{ public: ExtensionsBrowserAPIProviderQt(); ~ExtensionsBrowserAPIProviderQt() override; diff --git a/src/core/extensions/extensions_browser_client_qt.cpp b/src/core/extensions/extensions_browser_client_qt.cpp index eb8c12bff..59c15d2f5 100644 --- a/src/core/extensions/extensions_browser_client_qt.cpp +++ b/src/core/extensions/extensions_browser_client_qt.cpp @@ -97,72 +97,57 @@ void DetermineCharset(const std::string &mime_type, if (base::StartsWith(mime_type, "text/", base::CompareCase::INSENSITIVE_ASCII)) { // All of our HTML files should be UTF-8 and for other resource types // (like images), charset doesn't matter. - DCHECK(base::IsStringUTF8(base::StringPiece(reinterpret_cast<const char*>(data->front()), data->size()))); + DCHECK(base::IsStringUTF8(base::StringPiece(reinterpret_cast<const char *>(data->front()), data->size()))); *out_charset = "utf-8"; } } // A request for an extension resource in a Chrome .pak file. These are used // by component extensions. -class URLRequestResourceBundleJob : public net::URLRequestSimpleJob { +class URLRequestResourceBundleJob : public net::URLRequestSimpleJob +{ public: - URLRequestResourceBundleJob(net::URLRequest *request, - net::NetworkDelegate *network_delegate, - const base::FilePath &filename, - int resource_id, - const std::string &content_security_policy, - bool send_cors_header) - : net::URLRequestSimpleJob(request, network_delegate) - , filename_(filename) - , resource_id_(resource_id) - , weak_factory_(this) + URLRequestResourceBundleJob(net::URLRequest *request, net::NetworkDelegate *network_delegate, + const base::FilePath &filename, int resource_id, + const std::string &content_security_policy, bool send_cors_header) + : net::URLRequestSimpleJob(request, network_delegate) + , filename_(filename) + , resource_id_(resource_id) + , weak_factory_(this) { // Leave cache headers out of resource bundle requests. response_info_.headers = extensions::BuildHttpHeaders(content_security_policy, send_cors_header, base::Time()); } - int GetRefCountedData(std::string* mime_type, - std::string* charset, - scoped_refptr<base::RefCountedMemory>* data, + int GetRefCountedData(std::string *mime_type, std::string *charset, scoped_refptr<base::RefCountedMemory> *data, net::CompletionOnceCallback callback) const override { - const ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); + const ui::ResourceBundle &rb = ui::ResourceBundle::GetSharedInstance(); *data = rb.LoadDataResourceBytes(resource_id_); // Add the Content-Length header now that we know the resource length. - response_info_.headers->AddHeader( - base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentLength, - base::NumberToString((*data)->size()).c_str())); + response_info_.headers->AddHeader(base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentLength, + base::NumberToString((*data)->size()).c_str())); - std::string* read_mime_type = new std::string; + std::string *read_mime_type = new std::string; base::PostTaskWithTraitsAndReplyWithResult( - FROM_HERE, {base::MayBlock()}, - base::BindOnce(&net::GetMimeTypeFromFile, filename_, - base::Unretained(read_mime_type)), - base::BindOnce(&URLRequestResourceBundleJob::OnMimeTypeRead, - weak_factory_.GetWeakPtr(), mime_type, charset, *data, - base::Owned(read_mime_type), std::move(callback))); + FROM_HERE, { base::MayBlock() }, + base::BindOnce(&net::GetMimeTypeFromFile, filename_, base::Unretained(read_mime_type)), + base::BindOnce(&URLRequestResourceBundleJob::OnMimeTypeRead, weak_factory_.GetWeakPtr(), mime_type, + charset, *data, base::Owned(read_mime_type), std::move(callback))); return net::ERR_IO_PENDING; } - void GetResponseInfo(net::HttpResponseInfo* info) override - { - *info = response_info_; - } + void GetResponseInfo(net::HttpResponseInfo *info) override { *info = response_info_; } private: ~URLRequestResourceBundleJob() override {} - void OnMimeTypeRead(std::string *out_mime_type, - std::string *charset, - scoped_refptr<base::RefCountedMemory> data, - std::string *read_mime_type, - net::CompletionOnceCallback callback, - bool read_result) + void OnMimeTypeRead(std::string *out_mime_type, std::string *charset, scoped_refptr<base::RefCountedMemory> data, + std::string *read_mime_type, net::CompletionOnceCallback callback, bool read_result) { response_info_.headers->AddHeader( - base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentType, - read_mime_type->c_str())); + base::StringPrintf("%s: %s", net::HttpRequestHeaders::kContentType, read_mime_type->c_str())); *out_mime_type = *read_mime_type; DetermineCharset(*read_mime_type, data.get(), charset); int result = read_result ? net::OK : net::ERR_INVALID_URL; @@ -444,8 +429,7 @@ bool ExtensionsBrowserClientQt::IsBackgroundUpdateAllowed() return true; } -bool ExtensionsBrowserClientQt::IsMinBrowserVersionSupported( - const std::string &min_version) +bool ExtensionsBrowserClientQt::IsMinBrowserVersionSupported(const std::string &min_version) { return true; } @@ -482,7 +466,7 @@ KioskDelegate *ExtensionsBrowserClientQt::GetKioskDelegate() return nullptr; } -bool ExtensionsBrowserClientQt::IsScreensaverInDemoMode(const std::string& app_id) +bool ExtensionsBrowserClientQt::IsScreensaverInDemoMode(const std::string &app_id) { return false; } diff --git a/src/core/extensions/extensions_browser_client_qt.h b/src/core/extensions/extensions_browser_client_qt.h index 056e65c9e..41cb2ce20 100644 --- a/src/core/extensions/extensions_browser_client_qt.h +++ b/src/core/extensions/extensions_browser_client_qt.h @@ -90,8 +90,7 @@ public: void GetEarlyExtensionPrefsObservers(content::BrowserContext *context, std::vector<EarlyExtensionPrefsObserver *> *observers) const override; ProcessManagerDelegate *GetProcessManagerDelegate() const override; - std::unique_ptr<ExtensionHostDelegate> - CreateExtensionHostDelegate() override; + std::unique_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() override; bool DidVersionUpdate(content::BrowserContext *context) override; void PermitExternalProtocolHandler() override; bool IsRunningInForcedAppMode() override; @@ -110,8 +109,7 @@ public: ExtensionCache *GetExtensionCache() override; bool IsBackgroundUpdateAllowed() override; bool IsMinBrowserVersionSupported(const std::string &min_version) override; - ExtensionWebContentsObserver *GetExtensionWebContentsObserver( - content::WebContents *web_contents) override; + ExtensionWebContentsObserver *GetExtensionWebContentsObserver(content::WebContents *web_contents) override; KioskDelegate *GetKioskDelegate() override; // Whether the browser context is associated with Chrome OS lock screen. @@ -138,7 +136,7 @@ public: // Returns the locale used by the application. std::string GetApplicationLocale() override; - bool IsScreensaverInDemoMode(const std::string& app_id) override; + bool IsScreensaverInDemoMode(const std::string &app_id) override; // Sets the API client. void SetAPIClientForTest(ExtensionsAPIClient *api_client); 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 438b8a83e..022bc7db6 100644 --- a/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp +++ b/src/core/extensions/mime_handler_view_guest_delegate_qt.cpp @@ -52,7 +52,7 @@ namespace extensions { -MimeHandlerViewGuestDelegateQt::MimeHandlerViewGuestDelegateQt(MimeHandlerViewGuest *guest) +MimeHandlerViewGuestDelegateQt::MimeHandlerViewGuestDelegateQt(MimeHandlerViewGuest *) : MimeHandlerViewGuestDelegate() { } 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 b679c7a38..6cd80689c 100644 --- a/src/core/extensions/mime_handler_view_guest_delegate_qt.h +++ b/src/core/extensions/mime_handler_view_guest_delegate_qt.h @@ -66,8 +66,6 @@ public: const content::ContextMenuParams ¶ms) override; private: - MimeHandlerViewGuest *guest_; // Owns us. - DISALLOW_COPY_AND_ASSIGN(MimeHandlerViewGuestDelegateQt); }; 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 a22feb138..9a37375b3 100644 --- a/src/core/extensions/pdf_web_contents_helper_client_qt.h +++ b/src/core/extensions/pdf_web_contents_helper_client_qt.h @@ -10,20 +10,21 @@ namespace extensions { -class PDFWebContentsHelperClientQt : public pdf::PDFWebContentsHelperClient { +class PDFWebContentsHelperClientQt : public pdf::PDFWebContentsHelperClient +{ public: PDFWebContentsHelperClientQt(); ~PDFWebContentsHelperClientQt() override; private: // pdf::PDFWebContentsHelperClient: - void UpdateContentRestrictions(content::WebContents* contents, int content_restrictions) override; - void OnPDFHasUnsupportedFeature(content::WebContents* contents) override; - void OnSaveURL(content::WebContents* contents) override; + 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 +} // namespace extensions -#endif // PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_ +#endif // PDF_WEB_CONTENTS_HELPER_CLIENT_QT_H_ diff --git a/src/core/find_text_helper.cpp b/src/core/find_text_helper.cpp index effda529f..065fed38f 100644 --- a/src/core/find_text_helper.cpp +++ b/src/core/find_text_helper.cpp @@ -135,7 +135,7 @@ bool FindTextHelper::isFindTextInProgress() const } void FindTextHelper::handleFindReply(content::WebContents *source, int requestId, int numberOfMatches, - const gfx::Rect &selectionRect, int activeMatchOrdinal, bool finalUpdate) + const gfx::Rect &selectionRect, int activeMatch, bool finalUpdate) { Q_UNUSED(selectionRect); @@ -146,7 +146,7 @@ void FindTextHelper::handleFindReply(content::WebContents *source, int requestId Q_ASSERT(m_currentFindRequestId == requestId); m_lastCompletedFindRequestId = requestId; - m_viewClient->findTextFinished(QWebEngineFindTextResult(numberOfMatches, activeMatchOrdinal)); + m_viewClient->findTextFinished(QWebEngineFindTextResult(numberOfMatches, activeMatch)); invokeResultCallback(requestId, numberOfMatches); } diff --git a/src/core/find_text_helper.h b/src/core/find_text_helper.h index e8f186272..9843dc8b5 100644 --- a/src/core/find_text_helper.h +++ b/src/core/find_text_helper.h @@ -78,7 +78,7 @@ public: void startFinding(const QString &findText, bool caseSensitively, bool findBackward); void stopFinding(); bool isFindTextInProgress() const; - void handleFindReply(content::WebContents *source, int requestId, int numberOfMatches, const gfx::Rect &selectionRect, int activeMatchOrdinal, bool finalUpdate); + void handleFindReply(content::WebContents *source, int requestId, int numberOfMatches, const gfx::Rect &selectionRect, int activeMatch, bool finalUpdate); void handleLoadCommitted(); private: diff --git a/src/core/media_capture_devices_dispatcher.cpp b/src/core/media_capture_devices_dispatcher.cpp index 04c68de4c..c94ff7eee 100644 --- a/src/core/media_capture_devices_dispatcher.cpp +++ b/src/core/media_capture_devices_dispatcher.cpp @@ -90,22 +90,25 @@ const blink::MediaStreamDevice *findDeviceWithId(const blink::MediaStreamDevices return 0; } -// Based on chrome/browser/media/desktop_capture_access_handler.cc: -void getDevicesForDesktopCapture(blink::MediaStreamDevices *devices, content::DesktopMediaID mediaId, bool captureAudio) +// Based on chrome/browser/media/webrtc/desktop_capture_devices_util.cc: +void getDevicesForDesktopCapture(blink::MediaStreamDevices *devices, + content::DesktopMediaID mediaId, + bool captureAudio, + MediaStreamType videoType, + MediaStreamType audioType) { DCHECK_CURRENTLY_ON(BrowserThread::UI); // Add selected desktop source to the list. - devices->push_back(blink::MediaStreamDevice(MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE, mediaId.ToString(), "Screen")); + devices->push_back(blink::MediaStreamDevice(videoType, mediaId.ToString(), mediaId.ToString())); if (captureAudio) { if (mediaId.type == content::DesktopMediaID::TYPE_WEB_CONTENTS) { devices->push_back( - blink::MediaStreamDevice(MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE, - mediaId.ToString(), "Tab audio")); + blink::MediaStreamDevice(audioType, mediaId.ToString(), "Tab audio")); } else { // Use the special loopback device ID for system audio capture. devices->push_back(blink::MediaStreamDevice( - MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE, + audioType, media::AudioDeviceDescription::kLoopbackInputDeviceId, "System Audio")); } @@ -154,19 +157,27 @@ content::DesktopMediaID getDefaultScreenId() WebContentsAdapterClient::MediaRequestFlags mediaRequestFlagsForRequest(const content::MediaStreamRequest &request) { - WebContentsAdapterClient::MediaRequestFlags requestFlags = WebContentsAdapterClient::MediaNone; + if (request.audio_type == MediaStreamType::DEVICE_AUDIO_CAPTURE && + request.video_type == MediaStreamType::DEVICE_VIDEO_CAPTURE) + return {WebContentsAdapterClient::MediaAudioCapture, WebContentsAdapterClient::MediaVideoCapture}; - if (request.audio_type == MediaStreamType::DEVICE_AUDIO_CAPTURE) - requestFlags |= WebContentsAdapterClient::MediaAudioCapture; - else if (request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE) - requestFlags |= WebContentsAdapterClient::MediaDesktopAudioCapture; + if (request.audio_type == MediaStreamType::DEVICE_AUDIO_CAPTURE && + request.video_type == MediaStreamType::NO_SERVICE) + return {WebContentsAdapterClient::MediaAudioCapture}; - if (request.video_type == MediaStreamType::DEVICE_VIDEO_CAPTURE) - requestFlags |= WebContentsAdapterClient::MediaVideoCapture; - else if (request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE) - requestFlags |= WebContentsAdapterClient::MediaDesktopVideoCapture; + if (request.audio_type == MediaStreamType::NO_SERVICE && + request.video_type == MediaStreamType::DEVICE_VIDEO_CAPTURE) + return {WebContentsAdapterClient::MediaVideoCapture}; - return requestFlags; + if (request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE && + request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE) + return {WebContentsAdapterClient::MediaDesktopAudioCapture, WebContentsAdapterClient::MediaDesktopVideoCapture}; + + if (request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE || + request.video_type == MediaStreamType::DISPLAY_VIDEO_CAPTURE) + return {WebContentsAdapterClient::MediaDesktopVideoCapture}; + + return {}; } // Based on MediaStreamCaptureIndicator::UIDelegate @@ -235,14 +246,13 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content: if (!securityOriginsMatch) qWarning("Security origin mismatch for media access permission: %s requested and %s provided\n", qPrintable(requestSecurityOrigin.toString()), qPrintable(securityOrigin.toString())); - bool microphoneRequested = - (request.audio_type != MediaStreamType::NO_SERVICE && (authorizationFlags & WebContentsAdapterClient::MediaAudioCapture)); - bool webcamRequested = - (request.video_type != MediaStreamType::NO_SERVICE && (authorizationFlags & WebContentsAdapterClient::MediaVideoCapture)); - bool desktopAudioRequested = - (request.audio_type != MediaStreamType::NO_SERVICE && (authorizationFlags & WebContentsAdapterClient::MediaDesktopAudioCapture)); - bool desktopVideoRequested = - (request.video_type != MediaStreamType::NO_SERVICE && (authorizationFlags & WebContentsAdapterClient::MediaDesktopVideoCapture)); + WebContentsAdapterClient::MediaRequestFlags requestFlags = mediaRequestFlagsForRequest(request); + WebContentsAdapterClient::MediaRequestFlags finalFlags = requestFlags & authorizationFlags; + + bool microphoneRequested = finalFlags.testFlag(WebContentsAdapterClient::MediaAudioCapture); + bool webcamRequested = finalFlags.testFlag(WebContentsAdapterClient::MediaVideoCapture); + bool desktopAudioRequested = finalFlags.testFlag(WebContentsAdapterClient::MediaDesktopAudioCapture); + bool desktopVideoRequested = finalFlags.testFlag(WebContentsAdapterClient::MediaDesktopVideoCapture); if (securityOriginsMatch) { if (microphoneRequested || webcamRequested) { @@ -258,7 +268,8 @@ void MediaCaptureDevicesDispatcher::handleMediaAccessPermissionResponse(content: break; } } else if (desktopVideoRequested) { - getDevicesForDesktopCapture(&devices, getDefaultScreenId(), desktopAudioRequested); + getDevicesForDesktopCapture(&devices, getDefaultScreenId(), desktopAudioRequested, + request.video_type, request.audio_type); } } @@ -315,13 +326,13 @@ void MediaCaptureDevicesDispatcher::processMediaAccessRequest(WebContentsAdapter { DCHECK_CURRENTLY_ON(BrowserThread::UI); - // Let's not support tab capture for now. - if (request.video_type == MediaStreamType::GUM_TAB_VIDEO_CAPTURE || request.audio_type == MediaStreamType::GUM_TAB_AUDIO_CAPTURE) { + WebContentsAdapterClient::MediaRequestFlags flags = mediaRequestFlagsForRequest(request); + if (!flags) { std::move(callback).Run(blink::MediaStreamDevices(), MediaStreamRequestResult::NOT_SUPPORTED, std::unique_ptr<content::MediaStreamUI>()); return; } - if (request.video_type == MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE || request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE) { + if (flags.testFlag(WebContentsAdapterClient::MediaDesktopVideoCapture)) { const bool screenCaptureEnabled = adapterClient->webEngineSettings()->testAttribute(WebEngineSettings::ScreenCaptureEnabled); const bool originIsSecure = content::IsOriginSecure(request.security_origin); @@ -339,18 +350,13 @@ void MediaCaptureDevicesDispatcher::processMediaAccessRequest(WebContentsAdapter enqueueMediaAccessRequest(webContents, request, std::move(callback)); // We might not require this approval for pepper requests. - adapterClient->runMediaAccessPermissionRequest(toQt(request.security_origin), mediaRequestFlagsForRequest(request)); + adapterClient->runMediaAccessPermissionRequest(toQt(request.security_origin), flags); } void MediaCaptureDevicesDispatcher::processDesktopCaptureAccessRequest(content::WebContents *webContents, const content::MediaStreamRequest &request, content::MediaResponseCallback callback) { blink::MediaStreamDevices devices; - if (request.video_type != MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE || request.requested_video_device_id.empty()) { - std::move(callback).Run(devices, MediaStreamRequestResult::INVALID_STATE, std::unique_ptr<content::MediaStreamUI>()); - return; - } - content::WebContents *const web_contents_for_stream = content::WebContents::FromRenderFrameHost( content::RenderFrameHost::FromID(request.render_process_id, request.render_frame_id)); content::RenderFrameHost *const main_frame = web_contents_for_stream ? web_contents_for_stream->GetMainFrame() : NULL; @@ -375,7 +381,7 @@ void MediaCaptureDevicesDispatcher::processDesktopCaptureAccessRequest(content:: // Audio is only supported for screen capture streams. bool capture_audio = (mediaId.type == content::DesktopMediaID::TYPE_SCREEN && request.audio_type == MediaStreamType::GUM_DESKTOP_AUDIO_CAPTURE); - getDevicesForDesktopCapture(&devices, mediaId, capture_audio); + getDevicesForDesktopCapture(&devices, mediaId, capture_audio, request.video_type, request.audio_type); if (devices.empty()) std::move(callback).Run(devices, MediaStreamRequestResult::INVALID_STATE, diff --git a/src/core/net/client_cert_override.h b/src/core/net/client_cert_override.h index 4f2734485..7fd28eaeb 100644 --- a/src/core/net/client_cert_override.h +++ b/src/core/net/client_cert_override.h @@ -71,5 +71,3 @@ private: } // QtWebEngineCore #endif - - diff --git a/src/core/net/client_cert_store_data.cpp b/src/core/net/client_cert_store_data.cpp index 5a62cb6fe..314e64145 100644 --- a/src/core/net/client_cert_store_data.cpp +++ b/src/core/net/client_cert_store_data.cpp @@ -59,7 +59,8 @@ namespace { -class SSLPlatformKeyOverride : public net::ThreadedSSLPrivateKey::Delegate { +class SSLPlatformKeyOverride : public net::ThreadedSSLPrivateKey::Delegate +{ public: SSLPlatformKeyOverride(const QByteArray &sslKeyInBytes) { @@ -126,7 +127,7 @@ scoped_refptr<net::SSLPrivateKey> wrapOpenSSLPrivateKey(const QByteArray &sslKey net::GetSSLPlatformKeyTaskRunner()); } -} // namespace +} // namespace namespace QtWebEngineCore { diff --git a/src/core/net/client_cert_store_data.h b/src/core/net/client_cert_store_data.h index 7f83f4b60..e47a909e4 100644 --- a/src/core/net/client_cert_store_data.h +++ b/src/core/net/client_cert_store_data.h @@ -57,8 +57,10 @@ class X509Certificate; namespace QtWebEngineCore { -struct ClientCertificateStoreData { - struct Entry { +struct ClientCertificateStoreData +{ + struct Entry + { QSslKey key; QSslCertificate certificate; scoped_refptr<net::X509Certificate> certPtr; @@ -69,7 +71,7 @@ struct ClientCertificateStoreData { void remove(const QSslCertificate &certificate); void clear(); - QVector<Entry*> extraCerts; + QVector<Entry *> extraCerts; }; } // namespace QtWebEngineCore diff --git a/src/core/net/cookie_monster_delegate_qt.cpp b/src/core/net/cookie_monster_delegate_qt.cpp index 5f7b75f57..dad9a8db5 100644 --- a/src/core/net/cookie_monster_delegate_qt.cpp +++ b/src/core/net/cookie_monster_delegate_qt.cpp @@ -52,7 +52,8 @@ namespace QtWebEngineCore { -static GURL sourceUrlForCookie(const QNetworkCookie &cookie) { +static GURL sourceUrlForCookie(const QNetworkCookie &cookie) +{ QString urlFragment = QStringLiteral("%1%2").arg(cookie.domain()).arg(cookie.path()); return net::cookie_util::CookieOriginToURL(urlFragment.toStdString(), /* is_https */ cookie.isSecure()); } @@ -70,11 +71,10 @@ CookieMonsterDelegateQt::~CookieMonsterDelegateQt() void CookieMonsterDelegateQt::AddStore(net::CookieStore *store) { - std::unique_ptr<net::CookieChangeSubscription> sub = - store->GetChangeDispatcher().AddCallbackForAllChanges( + std::unique_ptr<net::CookieChangeSubscription> sub = store->GetChangeDispatcher().AddCallbackForAllChanges( base::Bind(&CookieMonsterDelegateQt::OnCookieChanged, - // this object's destruction will deregister the subscription. - base::Unretained(this))); + // this object's destruction will deregister the subscription. + base::Unretained(this))); m_subscriptions.push_back(std::move(sub)); } @@ -87,7 +87,7 @@ bool CookieMonsterDelegateQt::hasCookieMonster() void CookieMonsterDelegateQt::getAllCookies(quint64 callbackId) { net::CookieMonster::GetCookieListCallback callback = - base::BindOnce(&CookieMonsterDelegateQt::GetAllCookiesCallbackOnIOThread, this, callbackId); + base::BindOnce(&CookieMonsterDelegateQt::GetAllCookiesCallbackOnIOThread, this, callbackId); base::PostTaskWithTraits(FROM_HERE, {content::BrowserThread::IO}, base::BindOnce(&CookieMonsterDelegateQt::GetAllCookiesOnIOThread, this, std::move(callback))); @@ -115,9 +115,8 @@ void CookieMonsterDelegateQt::setCookie(quint64 callbackId, const QNetworkCookie gurl, cookie.toRawForm().toStdString(), std::move(callback))); } -void CookieMonsterDelegateQt::SetCookieOnIOThread( - const GURL& url, const std::string& cookie_line, - net::CookieMonster::SetCookiesCallback callback) +void CookieMonsterDelegateQt::SetCookieOnIOThread(const GURL &url, const std::string &cookie_line, + net::CookieMonster::SetCookiesCallback callback) { net::CookieOptions options; options.set_include_httponly(); @@ -138,7 +137,7 @@ void CookieMonsterDelegateQt::deleteCookie(const QNetworkCookie &cookie, const Q gurl, cookie.name().toStdString())); } -void CookieMonsterDelegateQt::DeleteCookieOnIOThread(const GURL& url, const std::string& cookie_name) +void CookieMonsterDelegateQt::DeleteCookieOnIOThread(const GURL &url, const std::string &cookie_name) { if (m_cookieMonster) { net::CookieMonster::GetCookieListCallback callback = @@ -147,7 +146,8 @@ void CookieMonsterDelegateQt::DeleteCookieOnIOThread(const GURL& url, const std: } } -void CookieMonsterDelegateQt::GetCookiesToDeleteCallback(const std::string& cookie_name, const net::CookieList &cookies, const net::CookieStatusList &statusList) +void CookieMonsterDelegateQt::GetCookiesToDeleteCallback(const std::string &cookie_name, const net::CookieList &cookies, + const net::CookieStatusList &statusList) { Q_UNUSED(statusList); if (!m_cookieMonster) @@ -197,7 +197,7 @@ void CookieMonsterDelegateQt::DeleteAllOnIOThread(net::CookieMonster::DeleteCall m_cookieMonster->DeleteAllAsync(std::move(callback)); } -void CookieMonsterDelegateQt::setCookieMonster(net::CookieMonster* monster) +void CookieMonsterDelegateQt::setCookieMonster(net::CookieMonster *monster) { if (monster == m_cookieMonster) return; @@ -246,7 +246,7 @@ bool CookieMonsterDelegateQt::canGetCookies(const QUrl &firstPartyUrl, const QUr return m_client->d_func()->canAccessCookies(firstPartyUrl, url); } -void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie& cookie, net::CookieChangeCause cause) +void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie &cookie, net::CookieChangeCause cause) { if (!m_client) return; diff --git a/src/core/net/cookie_monster_delegate_qt.h b/src/core/net/cookie_monster_delegate_qt.h index 2ac04acb4..23b803790 100644 --- a/src/core/net/cookie_monster_delegate_qt.h +++ b/src/core/net/cookie_monster_delegate_qt.h @@ -72,13 +72,14 @@ namespace QtWebEngineCore { // cookies for the file:// scheme, which is disabled by default in Chromium. // Since qrc:// is similar to file:// and there are some unknowns about how // to correctly handle file:// cookies, qrc:// should only be used for testing. -static const char* const kCookieableSchemes[] = - { "http", "https", "qrc", "ws", "wss" }; +static const char *const kCookieableSchemes[] = { "http", "https", "qrc", "ws", "wss" }; -class Q_WEBENGINECORE_PRIVATE_EXPORT CookieMonsterDelegateQt : public base::RefCountedThreadSafe<CookieMonsterDelegateQt> { +class Q_WEBENGINECORE_PRIVATE_EXPORT CookieMonsterDelegateQt : public base::RefCountedThreadSafe<CookieMonsterDelegateQt> +{ QPointer<QWebEngineCookieStore> m_client; net::CookieMonster *m_cookieMonster; std::vector<std::unique_ptr<net::CookieChangeSubscription>> m_subscriptions; + public: CookieMonsterDelegateQt(); ~CookieMonsterDelegateQt(); @@ -91,7 +92,7 @@ public: void deleteSessionCookies(quint64 callbackId); void deleteAllCookies(quint64 callbackId); - void setCookieMonster(net::CookieMonster* monster); + void setCookieMonster(net::CookieMonster *monster); void setClient(QWebEngineCookieStore *client); bool canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url) const; @@ -102,13 +103,16 @@ public: private: void GetAllCookiesOnIOThread(net::CookieMonster::GetCookieListCallback callback); - void SetCookieOnIOThread(const GURL& url, const std::string& cookie_line, net::CookieMonster::SetCookiesCallback callback); - void DeleteCookieOnIOThread(const GURL& url, const std::string& cookie_name); + void SetCookieOnIOThread(const GURL &url, const std::string &cookie_line, + net::CookieMonster::SetCookiesCallback callback); + void DeleteCookieOnIOThread(const GURL &url, const std::string &cookie_name); void DeleteSessionCookiesOnIOThread(net::CookieMonster::DeleteCallback callback); void DeleteAllOnIOThread(net::CookieMonster::DeleteCallback callback); - void GetCookiesToDeleteCallback(const std::string& cookie_name, const net::CookieList &cookies, const net::CookieStatusList &statusList); - void GetAllCookiesCallbackOnIOThread(qint64 callbackId, const net::CookieList &cookies, const net::CookieStatusList &statusList); + void GetCookiesToDeleteCallback(const std::string &cookie_name, const net::CookieList &cookies, + const net::CookieStatusList &statusList); + void GetAllCookiesCallbackOnIOThread(qint64 callbackId, const net::CookieList &cookies, + const net::CookieStatusList &statusList); void SetCookieCallbackOnIOThread(qint64 callbackId, net::CanonicalCookie::CookieInclusionStatus status); void DeleteCookiesCallbackOnIOThread(qint64 callbackId, uint numCookies); diff --git a/src/core/net/custom_protocol_handler.h b/src/core/net/custom_protocol_handler.h index 7b189763c..625afc1d5 100644 --- a/src/core/net/custom_protocol_handler.h +++ b/src/core/net/custom_protocol_handler.h @@ -71,7 +71,8 @@ class ProfileAdapter; // Implements a ProtocolHandler for custom URL schemes. // If |network_delegate_| is NULL then all file requests will fail with ERR_ACCESS_DENIED. -class Q_WEBENGINECORE_PRIVATE_EXPORT CustomProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { +class Q_WEBENGINECORE_PRIVATE_EXPORT CustomProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler +{ public: CustomProtocolHandler(QPointer<ProfileAdapter> profileAdapter); diff --git a/src/core/net/network_delegate_qt.cpp b/src/core/net/network_delegate_qt.cpp index 68bf34d31..7d3801ffe 100644 --- a/src/core/net/network_delegate_qt.cpp +++ b/src/core/net/network_delegate_qt.cpp @@ -139,11 +139,11 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet // Deprecated =begin // quick peek if deprecated - QWebEngineUrlRequestInterceptor* profileInterceptor = m_profileIOData->requestInterceptor(); - if (profileInterceptor && profileInterceptor->property("deprecated").toBool()) { - profileInterceptor = nullptr; - if (QWebEngineUrlRequestInterceptor* interceptor = m_profileIOData->acquireInterceptor()) { - interceptor->interceptRequest(requestInfo); + + if (m_profileIOData->isInterceptorDeprecated()) { + QWebEngineUrlRequestInterceptor *profileInterceptor = m_profileIOData->acquireInterceptor(); + if (profileInterceptor && m_profileIOData->isInterceptorDeprecated()) { + profileInterceptor->interceptRequest(requestInfo); m_profileIOData->releaseInterceptor(); if (requestInfo.changed()) { int result = infoPrivate->shouldBlockRequest ? net::ERR_BLOCKED_BY_CLIENT : net::OK; @@ -177,7 +177,9 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet if (!resourceInfo) return net::OK; - if (!m_profileIOData->hasPageInterceptors() && !profileInterceptor && !content::IsResourceTypeFrame(resourceType)) + // try to bail out + if (!m_profileIOData->hasPageInterceptors() && (!m_profileIOData->requestInterceptor() || m_profileIOData->isInterceptorDeprecated()) && + !content::IsResourceTypeFrame(resourceType)) return net::OK; auto webContentsGetter = resourceInfo->GetWebContentsGetterForRequest(); @@ -188,32 +190,26 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, net::Complet std::move(requestInfo), webContentsGetter, std::move(callback), - profileInterceptor ? m_profileIOData->profileAdapter() : nullptr + m_profileIOData->profileAdapter() ); // We'll run the callback after we notified the UI thread. return net::ERR_IO_PENDING; } -void NetworkDelegateQt::OnURLRequestDestroyed(net::URLRequest*) -{ -} +void NetworkDelegateQt::OnURLRequestDestroyed(net::URLRequest *) {} -void NetworkDelegateQt::OnCompleted(net::URLRequest */*request*/, bool /*started*/, int /*net_error*/) -{ -} +void NetworkDelegateQt::OnCompleted(net::URLRequest * /*request*/, bool /*started*/, int /*net_error*/) {} -bool NetworkDelegateQt::OnCanSetCookie(const net::URLRequest& request, - const net::CanonicalCookie & /*cookie*/, - net::CookieOptions*, - bool allowedFromCaller) +bool NetworkDelegateQt::OnCanSetCookie(const net::URLRequest &request, const net::CanonicalCookie & /*cookie*/, + net::CookieOptions *, bool allowedFromCaller) { if (!allowedFromCaller) return false; return canSetCookies(request.site_for_cookies(), request.url(), std::string()); } -bool NetworkDelegateQt::OnCanGetCookies(const net::URLRequest& request, const net::CookieList&, bool allowedFromCaller) +bool NetworkDelegateQt::OnCanGetCookies(const net::URLRequest &request, const net::CookieList &, bool allowedFromCaller) { if (!allowedFromCaller) return false; @@ -223,8 +219,8 @@ bool NetworkDelegateQt::OnCanGetCookies(const net::URLRequest& request, const ne bool NetworkDelegateQt::OnForcePrivacyMode(const GURL &url, const GURL &site_for_cookies) const { return false; -// FIXME: This is what the NetworkContext implementation does (changes tst_QWebEngineCookieStore tests since 72) -// return !canGetCookies(site_for_cookies, url); + // FIXME: This is what the NetworkContext implementation does (changes tst_QWebEngineCookieStore tests since 72) + // return !canGetCookies(site_for_cookies, url); } bool NetworkDelegateQt::canSetCookies(const GURL &first_party, const GURL &url, const std::string &cookie_line) const @@ -244,71 +240,64 @@ int NetworkDelegateQt::OnBeforeStartTransaction(net::URLRequest *, net::Completi return net::OK; } -void NetworkDelegateQt::OnBeforeSendHeaders(net::URLRequest* request, const net::ProxyInfo& proxy_info, - const net::ProxyRetryInfoMap& proxy_retry_info, net::HttpRequestHeaders* headers) -{ -} +void NetworkDelegateQt::OnBeforeSendHeaders(net::URLRequest *request, const net::ProxyInfo &proxy_info, + const net::ProxyRetryInfoMap &proxy_retry_info, + net::HttpRequestHeaders *headers) +{} -void NetworkDelegateQt::OnStartTransaction(net::URLRequest *request, const net::HttpRequestHeaders &headers) -{ -} +void NetworkDelegateQt::OnStartTransaction(net::URLRequest *request, const net::HttpRequestHeaders &headers) {} -int NetworkDelegateQt::OnHeadersReceived(net::URLRequest*, net::CompletionOnceCallback, const net::HttpResponseHeaders*, scoped_refptr<net::HttpResponseHeaders>*, GURL*) +int NetworkDelegateQt::OnHeadersReceived(net::URLRequest *, net::CompletionOnceCallback, const net::HttpResponseHeaders *, + scoped_refptr<net::HttpResponseHeaders> *, GURL *) { return net::OK; } -void NetworkDelegateQt::OnBeforeRedirect(net::URLRequest*, const GURL&) -{ -} +void NetworkDelegateQt::OnBeforeRedirect(net::URLRequest *, const GURL &) {} -void NetworkDelegateQt::OnResponseStarted(net::URLRequest*, int) -{ -} +void NetworkDelegateQt::OnResponseStarted(net::URLRequest *, int) {} -void NetworkDelegateQt::OnNetworkBytesReceived(net::URLRequest*, int64_t) -{ -} +void NetworkDelegateQt::OnNetworkBytesReceived(net::URLRequest *, int64_t) {} -void NetworkDelegateQt::OnNetworkBytesSent(net::URLRequest*, int64_t) -{ -} +void NetworkDelegateQt::OnNetworkBytesSent(net::URLRequest *, int64_t) {} -void NetworkDelegateQt::OnPACScriptError(int, const base::string16&) -{ -} +void NetworkDelegateQt::OnPACScriptError(int, const base::string16 &) {} -net::NetworkDelegate::AuthRequiredResponse NetworkDelegateQt::OnAuthRequired(net::URLRequest*, const net::AuthChallengeInfo&, AuthCallback, net::AuthCredentials*) +net::NetworkDelegate::AuthRequiredResponse NetworkDelegateQt::OnAuthRequired(net::URLRequest *, + const net::AuthChallengeInfo &, + AuthCallback, net::AuthCredentials *) { return AUTH_REQUIRED_RESPONSE_NO_ACTION; } -bool NetworkDelegateQt::OnCanAccessFile(const net::URLRequest&, const base::FilePath&, const base::FilePath&) const +bool NetworkDelegateQt::OnCanAccessFile(const net::URLRequest &, const base::FilePath &, const base::FilePath &) const { return true; } -bool NetworkDelegateQt::OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest&, const GURL&, const GURL&) const +bool NetworkDelegateQt::OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest &, const GURL &, + const GURL &) const { return false; } -bool NetworkDelegateQt::OnCanQueueReportingReport(const url::Origin& origin) const +bool NetworkDelegateQt::OnCanQueueReportingReport(const url::Origin &origin) const { return false; } -void NetworkDelegateQt::OnCanSendReportingReports(std::set<url::Origin> origins, base::OnceCallback<void(std::set<url::Origin>)> result_callback) const +void NetworkDelegateQt::OnCanSendReportingReports(std::set<url::Origin> origins, + base::OnceCallback<void(std::set<url::Origin>)> result_callback) const { std::move(result_callback).Run(std::set<url::Origin>()); } -bool NetworkDelegateQt::OnCanSetReportingClient(const url::Origin& origin, const GURL& endpoint) const +bool NetworkDelegateQt::OnCanSetReportingClient(const url::Origin &origin, const GURL &endpoint) const { return false; } -bool NetworkDelegateQt::OnCanUseReportingClient(const url::Origin& origin, const GURL& endpoint) const +bool NetworkDelegateQt::OnCanUseReportingClient(const url::Origin &origin, const GURL &endpoint) const { return false; } diff --git a/src/core/net/network_delegate_qt.h b/src/core/net/network_delegate_qt.h index 53debadcd..f294c6c7c 100644 --- a/src/core/net/network_delegate_qt.h +++ b/src/core/net/network_delegate_qt.h @@ -54,36 +54,44 @@ namespace QtWebEngineCore { class ProfileIODataQt; -class NetworkDelegateQt : public net::NetworkDelegate { +class NetworkDelegateQt : public net::NetworkDelegate +{ ProfileIODataQt *m_profileIOData; + public: NetworkDelegateQt(ProfileIODataQt *data); // net::NetworkDelegate implementation - int OnBeforeURLRequest(net::URLRequest* request, net::CompletionOnceCallback callback, GURL* new_url) override; - void OnURLRequestDestroyed(net::URLRequest* request) override; - bool OnCanSetCookie(const net::URLRequest& request, const net::CanonicalCookie& cookie, net::CookieOptions* options, bool) override; - int OnBeforeStartTransaction(net::URLRequest *request, const net::CompletionOnceCallback callback, net::HttpRequestHeaders *headers) override; - void OnBeforeSendHeaders(net::URLRequest* request, const net::ProxyInfo& proxy_info, - const net::ProxyRetryInfoMap& proxy_retry_info, net::HttpRequestHeaders* headers) override; + int OnBeforeURLRequest(net::URLRequest *request, net::CompletionOnceCallback callback, GURL *new_url) override; + void OnURLRequestDestroyed(net::URLRequest *request) override; + bool OnCanSetCookie(const net::URLRequest &request, const net::CanonicalCookie &cookie, net::CookieOptions *options, + bool) override; + int OnBeforeStartTransaction(net::URLRequest *request, const net::CompletionOnceCallback callback, + net::HttpRequestHeaders *headers) override; + void OnBeforeSendHeaders(net::URLRequest *request, const net::ProxyInfo &proxy_info, + const net::ProxyRetryInfoMap &proxy_retry_info, net::HttpRequestHeaders *headers) override; void OnStartTransaction(net::URLRequest *request, const net::HttpRequestHeaders &headers) override; - int OnHeadersReceived(net::URLRequest*, net::CompletionOnceCallback, const net::HttpResponseHeaders*, scoped_refptr<net::HttpResponseHeaders>*, GURL*) override; - void OnBeforeRedirect(net::URLRequest*, const GURL&) override; - void OnResponseStarted(net::URLRequest*, int) override; - void OnNetworkBytesReceived(net::URLRequest*, int64_t) override; + int OnHeadersReceived(net::URLRequest *, net::CompletionOnceCallback, const net::HttpResponseHeaders *, + scoped_refptr<net::HttpResponseHeaders> *, GURL *) override; + void OnBeforeRedirect(net::URLRequest *, const GURL &) override; + void OnResponseStarted(net::URLRequest *, int) override; + void OnNetworkBytesReceived(net::URLRequest *, int64_t) override; void OnNetworkBytesSent(net::URLRequest *, int64_t) override; void OnCompleted(net::URLRequest *request, bool started, int net_error) override; - void OnPACScriptError(int, const base::string16&) override; - net::NetworkDelegate::AuthRequiredResponse OnAuthRequired(net::URLRequest*, const net::AuthChallengeInfo&, AuthCallback, net::AuthCredentials*) override; - bool OnCanGetCookies(const net::URLRequest&, const net::CookieList&, bool) override; - bool OnCanAccessFile(const net::URLRequest&, const base::FilePath&, const base::FilePath&) const override; - bool OnForcePrivacyMode(const GURL&, const GURL&) const override; - bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest&, const GURL&, const GURL&) const override; + void OnPACScriptError(int, const base::string16 &) override; + net::NetworkDelegate::AuthRequiredResponse OnAuthRequired(net::URLRequest *, const net::AuthChallengeInfo &, + AuthCallback, net::AuthCredentials *) override; + bool OnCanGetCookies(const net::URLRequest &, const net::CookieList &, bool) override; + bool OnCanAccessFile(const net::URLRequest &, const base::FilePath &, const base::FilePath &) const override; + bool OnForcePrivacyMode(const GURL &, const GURL &) const override; + bool OnCancelURLRequestWithPolicyViolatingReferrerHeader(const net::URLRequest &, const GURL &, + const GURL &) const override; - bool OnCanQueueReportingReport(const url::Origin& origin) const override; - void OnCanSendReportingReports(std::set<url::Origin> origins, base::OnceCallback<void(std::set<url::Origin>)> result_callback) const override; - bool OnCanSetReportingClient(const url::Origin& origin, const GURL& endpoint) const override; - bool OnCanUseReportingClient(const url::Origin& origin, const GURL& endpoint) const override; + bool OnCanQueueReportingReport(const url::Origin &origin) const override; + void OnCanSendReportingReports(std::set<url::Origin> origins, + base::OnceCallback<void(std::set<url::Origin>)> result_callback) const override; + bool OnCanSetReportingClient(const url::Origin &origin, const GURL &endpoint) const override; + bool OnCanUseReportingClient(const url::Origin &origin, const GURL &endpoint) const override; bool canSetCookies(const GURL &first_party, const GURL &url, const std::string &cookie_line) const; bool canGetCookies(const GURL &first_party, const GURL &url) const; diff --git a/src/core/net/proxy_config_service_qt.cpp b/src/core/net/proxy_config_service_qt.cpp index 00ff1c54d..8016c7e83 100644 --- a/src/core/net/proxy_config_service_qt.cpp +++ b/src/core/net/proxy_config_service_qt.cpp @@ -70,14 +70,14 @@ net::ProxyServer ProxyConfigServiceQt::fromQNetworkProxy(const QNetworkProxy &qt } ProxyConfigServiceQt::ProxyConfigServiceQt(std::unique_ptr<ProxyConfigService> baseService, - const net::ProxyConfigWithAnnotation& initialConfig, ProxyPrefs::ConfigState initialState) - : m_baseService(baseService.release()), - m_usesSystemConfiguration(false), - m_registeredObserver(false), - m_prefConfig(initialConfig), - m_perfState(initialState) -{ -} + const net::ProxyConfigWithAnnotation &initialConfig, + ProxyPrefs::ConfigState initialState) + : m_baseService(baseService.release()) + , m_usesSystemConfiguration(false) + , m_registeredObserver(false) + , m_prefConfig(initialConfig) + , m_perfState(initialState) +{} ProxyConfigServiceQt::~ProxyConfigServiceQt() { diff --git a/src/core/net/proxy_config_service_qt.h b/src/core/net/proxy_config_service_qt.h index 09e88d445..4d8619055 100644 --- a/src/core/net/proxy_config_service_qt.h +++ b/src/core/net/proxy_config_service_qt.h @@ -51,14 +51,14 @@ #include <QNetworkProxy> class ProxyConfigServiceQt - : public net::ProxyConfigService - , public net::ProxyConfigService::Observer { + : public net::ProxyConfigService + , public net::ProxyConfigService::Observer +{ public: - static net::ProxyServer fromQNetworkProxy(const QNetworkProxy &); explicit ProxyConfigServiceQt(std::unique_ptr<ProxyConfigService> baseService, - const net::ProxyConfigWithAnnotation& initialConfig, + const net::ProxyConfigWithAnnotation &initialConfig, ProxyPrefs::ConfigState initialState); ~ProxyConfigServiceQt() override; diff --git a/src/core/net/qrc_url_scheme_handler.h b/src/core/net/qrc_url_scheme_handler.h index f6ca92879..586147cdf 100644 --- a/src/core/net/qrc_url_scheme_handler.h +++ b/src/core/net/qrc_url_scheme_handler.h @@ -45,7 +45,8 @@ namespace QtWebEngineCore { -class QrcUrlSchemeHandler final : public QWebEngineUrlSchemeHandler { +class QrcUrlSchemeHandler final : public QWebEngineUrlSchemeHandler +{ public: void requestStarted(QWebEngineUrlRequestJob *) override; }; diff --git a/src/core/net/restricted_cookie_manager_qt.cpp b/src/core/net/restricted_cookie_manager_qt.cpp index e01969f4d..7f1ca163e 100644 --- a/src/core/net/restricted_cookie_manager_qt.cpp +++ b/src/core/net/restricted_cookie_manager_qt.cpp @@ -58,7 +58,8 @@ namespace QtWebEngineCore { -class RestrictedCookieManagerListenerQt : public network::mojom::CookieChangeListener { +class RestrictedCookieManagerListenerQt : public network::mojom::CookieChangeListener +{ public: RestrictedCookieManagerListenerQt(const GURL &url, const GURL &site_for_cookies, @@ -181,4 +182,4 @@ bool RestrictedCookieManagerQt::allowCookies(const GURL &url, const GURL &site_f return m_profileIoData->canGetCookies(toQt(site_for_cookies), toQt(url)); } -} // namespace QtWebEngineCore +} // namespace QtWebEngineCore diff --git a/src/core/net/restricted_cookie_manager_qt.h b/src/core/net/restricted_cookie_manager_qt.h index a277c7c96..9154f671d 100644 --- a/src/core/net/restricted_cookie_manager_qt.h +++ b/src/core/net/restricted_cookie_manager_qt.h @@ -85,7 +85,7 @@ public: CookiesEnabledForCallback callback) override; // Internal: - bool allowCookies(const GURL& url, const GURL &site_for_cookies) const; + bool allowCookies(const GURL &url, const GURL &site_for_cookies) const; private: base::WeakPtr<ProfileIODataQt> m_profileIoData; @@ -95,6 +95,6 @@ private: DISALLOW_COPY_AND_ASSIGN(RestrictedCookieManagerQt); }; -} // namespace QtWebEngineCore +} // namespace QtWebEngineCore -#endif // RESTRICTED_COOKIE_MANAGER_QT_H +#endif // RESTRICTED_COOKIE_MANAGER_QT_H diff --git a/src/core/net/ssl_host_state_delegate_qt.cpp b/src/core/net/ssl_host_state_delegate_qt.cpp index b6cdf68dc..0885475be 100644 --- a/src/core/net/ssl_host_state_delegate_qt.cpp +++ b/src/core/net/ssl_host_state_delegate_qt.cpp @@ -67,19 +67,15 @@ bool CertPolicy::Check(const net::X509Certificate &cert, int error) const return false; } -void CertPolicy::Allow(const net::X509Certificate& cert, int error) +void CertPolicy::Allow(const net::X509Certificate &cert, int error) { net::SHA256HashValue fingerprint = cert.CalculateChainFingerprint256(); m_allowed[fingerprint] |= error; } -SSLHostStateDelegateQt::SSLHostStateDelegateQt() -{ -} +SSLHostStateDelegateQt::SSLHostStateDelegateQt() {} -SSLHostStateDelegateQt::~SSLHostStateDelegateQt() -{ -} +SSLHostStateDelegateQt::~SSLHostStateDelegateQt() {} void SSLHostStateDelegateQt::AllowCert(const std::string &host, const net::X509Certificate &cert, int error) { @@ -87,7 +83,7 @@ void SSLHostStateDelegateQt::AllowCert(const std::string &host, const net::X509C } // Clear all allow preferences. -void SSLHostStateDelegateQt::Clear(const base::Callback<bool(const std::string&)>& host_filter) +void SSLHostStateDelegateQt::Clear(const base::Callback<bool(const std::string &)> &host_filter) { if (host_filter.is_null()) { m_certPolicyforHost.clear(); @@ -107,9 +103,10 @@ void SSLHostStateDelegateQt::Clear(const base::Callback<bool(const std::string&) // Queries whether |cert| is allowed for |host| and |error|. Returns true in // |expired_previous_decision| if a previous user decision expired immediately // prior to this query, otherwise false. -content::SSLHostStateDelegate::CertJudgment SSLHostStateDelegateQt::QueryPolicy( - const std::string &host, const net::X509Certificate &cert, - int error, bool */*expired_previous_decision*/) +content::SSLHostStateDelegate::CertJudgment SSLHostStateDelegateQt::QueryPolicy(const std::string &host, + const net::X509Certificate &cert, + int error, + bool * /*expired_previous_decision*/) { return m_certPolicyforHost[host].Check(cert, error) ? SSLHostStateDelegate::ALLOWED : SSLHostStateDelegate::DENIED; } diff --git a/src/core/net/ssl_host_state_delegate_qt.h b/src/core/net/ssl_host_state_delegate_qt.h index 28e239304..e361aa0be 100644 --- a/src/core/net/ssl_host_state_delegate_qt.h +++ b/src/core/net/ssl_host_state_delegate_qt.h @@ -45,19 +45,21 @@ namespace QtWebEngineCore { -class CertPolicy { +class CertPolicy +{ public: CertPolicy(); ~CertPolicy(); - bool Check(const net::X509Certificate& cert, int error) const; - void Allow(const net::X509Certificate& cert, int error); + bool Check(const net::X509Certificate &cert, int error) const; + void Allow(const net::X509Certificate &cert, int error); bool HasAllowException() const { return m_allowed.size() > 0; } private: std::map<net::SHA256HashValue, int> m_allowed; }; -class SSLHostStateDelegateQt : public content::SSLHostStateDelegate { +class SSLHostStateDelegateQt : public content::SSLHostStateDelegate +{ public: SSLHostStateDelegateQt(); @@ -65,11 +67,11 @@ public: // content::SSLHostStateDelegate implementation: void AllowCert(const std::string &, const net::X509Certificate &cert, int error) override; - void Clear(const base::Callback<bool(const std::string&)>& host_filter) override; - CertJudgment QueryPolicy(const std::string &host, const net::X509Certificate &cert, - int error, bool *expired_previous_decision) override; - void HostRanInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) override; - bool DidHostRunInsecureContent(const std::string& host, int child_id, InsecureContentType content_type) override; + void Clear(const base::Callback<bool(const std::string &)> &host_filter) override; + CertJudgment QueryPolicy(const std::string &host, const net::X509Certificate &cert, int error, + bool *expired_previous_decision) override; + void HostRanInsecureContent(const std::string &host, int child_id, InsecureContentType content_type) override; + bool DidHostRunInsecureContent(const std::string &host, int child_id, InsecureContentType content_type) override; void RevokeUserAllowExceptions(const std::string &host) override; bool HasAllowException(const std::string &host) override; diff --git a/src/core/net/url_request_context_getter_qt.h b/src/core/net/url_request_context_getter_qt.h index b6135cb16..a6ef6eae0 100644 --- a/src/core/net/url_request_context_getter_qt.h +++ b/src/core/net/url_request_context_getter_qt.h @@ -46,11 +46,13 @@ namespace QtWebEngineCore { class ProfileIODataQt; -class URLRequestContextGetterQt : public net::URLRequestContextGetter { +class URLRequestContextGetterQt : public net::URLRequestContextGetter +{ public: URLRequestContextGetterQt(ProfileIODataQt *data); net::URLRequestContext *GetURLRequestContext() override; scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() const override; + private: virtual ~URLRequestContextGetterQt(); ProfileIODataQt *m_profileIOData; diff --git a/src/core/net/url_request_custom_job.cpp b/src/core/net/url_request_custom_job.cpp index 56ba79f35..607e8d232 100644 --- a/src/core/net/url_request_custom_job.cpp +++ b/src/core/net/url_request_custom_job.cpp @@ -41,6 +41,7 @@ #include "url_request_custom_job_proxy.h" #include "api/qwebengineurlscheme.h" + #include "base/strings/stringprintf.h" #include "base/task/post_task.h" #include "content/public/browser/browser_task_traits.h" @@ -67,7 +68,6 @@ URLRequestCustomJob::URLRequestCustomJob(URLRequest *request, , m_pendingReadBuffer(nullptr) , m_corsEnabled(QWebEngineUrlScheme::schemeByName(QByteArray::fromStdString(scheme)) .flags().testFlag(QWebEngineUrlScheme::CorsEnabled)) - , m_httpStatusCode(500) { } @@ -132,7 +132,7 @@ bool URLRequestCustomJob::GetMimeType(std::string *mimeType) const return false; } -bool URLRequestCustomJob::GetCharset(std::string* charset) +bool URLRequestCustomJob::GetCharset(std::string *charset) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (m_charset.size() > 0) { @@ -142,27 +142,38 @@ bool URLRequestCustomJob::GetCharset(std::string* charset) return false; } -void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo* info) +void URLRequestCustomJob::GetResponseInfo(HttpResponseInfo *info) { // Based on net::URLRequestRedirectJob::StartAsync() - if (!m_corsEnabled) + if (m_error) return; std::string headers; - headers += base::StringPrintf("HTTP/1.1 %i OK\n", m_httpStatusCode); - if (m_redirect.is_valid()) + if (m_redirect.is_valid()) { + headers += "HTTP/1.1 303 See Other\n"; headers += base::StringPrintf("Location: %s\n", m_redirect.spec().c_str()); - std::string origin; - if (request_->extra_request_headers().GetHeader("Origin", &origin)) { - headers += base::StringPrintf("Access-Control-Allow-Origin: %s\n", origin.c_str()); - headers += "Access-Control-Allow-Credentials: true\n"; + } else { + headers += base::StringPrintf("HTTP/1.1 %i OK\n", 200); + if (m_mimeType.size() > 0) { + headers += base::StringPrintf("Content-Type: %s", m_mimeType.c_str()); + if (m_charset.size() > 0) + headers += base::StringPrintf("; charset=%s", m_charset.c_str()); + headers += "\n"; + } + } + if (m_corsEnabled) { + std::string origin; + if (request_->extra_request_headers().GetHeader("Origin", &origin)) { + headers += base::StringPrintf("Access-Control-Allow-Origin: %s\n", origin.c_str()); + headers += "Access-Control-Allow-Credentials: true\n"; + } } info->headers = new HttpResponseHeaders(HttpUtil::AssembleRawHeaders(headers)); } -bool URLRequestCustomJob::IsRedirectResponse(GURL* location, int* http_status_code, bool* /*insecure_scheme_was_upgraded*/) +bool URLRequestCustomJob::IsRedirectResponse(GURL *location, int *http_status_code, bool * /*insecure_scheme_was_upgraded*/) { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); if (m_redirect.is_valid()) { diff --git a/src/core/net/url_request_custom_job.h b/src/core/net/url_request_custom_job.h index e1e8e9fba..af5a6f8e0 100644 --- a/src/core/net/url_request_custom_job.h +++ b/src/core/net/url_request_custom_job.h @@ -53,7 +53,8 @@ class URLRequestCustomJobDelegate; class URLRequestCustomJobProxy; // A request job that handles reading custom URL schemes -class URLRequestCustomJob : public net::URLRequestJob { +class URLRequestCustomJob : public net::URLRequestJob +{ public: URLRequestCustomJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate, @@ -61,11 +62,11 @@ public: QPointer<ProfileAdapter> profileAdapter); void Start() override; void Kill() override; - int ReadRawData(net::IOBuffer *buf, int buf_size) override; + int ReadRawData(net::IOBuffer *buf, int buf_size) override; bool GetMimeType(std::string *mimeType) const override; bool GetCharset(std::string *charset) override; - void GetResponseInfo(net::HttpResponseInfo* info) override; - bool IsRedirectResponse(GURL* location, int* http_status_code, bool* insecure_scheme_was_upgraded) override; + void GetResponseInfo(net::HttpResponseInfo *info) override; + bool IsRedirectResponse(GURL *location, int *http_status_code, bool *insecure_scheme_was_upgraded) override; protected: virtual ~URLRequestCustomJob(); @@ -82,7 +83,6 @@ private: int m_pendingReadPos; net::IOBuffer *m_pendingReadBuffer; const bool m_corsEnabled; - int m_httpStatusCode; friend class URLRequestCustomJobProxy; diff --git a/src/core/net/url_request_custom_job_delegate.cpp b/src/core/net/url_request_custom_job_delegate.cpp index b5a7a55a7..f73296cf0 100644 --- a/src/core/net/url_request_custom_job_delegate.cpp +++ b/src/core/net/url_request_custom_job_delegate.cpp @@ -117,7 +117,7 @@ void URLRequestCustomJobDelegate::redirect(const QUrl &url) void URLRequestCustomJobDelegate::fail(Error error) { - int net_error = 0; + int net_error = 0; switch (error) { case NoError: break; diff --git a/src/core/net/url_request_custom_job_delegate.h b/src/core/net/url_request_custom_job_delegate.h index 0ab1a82c7..93ae39e84 100644 --- a/src/core/net/url_request_custom_job_delegate.h +++ b/src/core/net/url_request_custom_job_delegate.h @@ -64,7 +64,8 @@ namespace QtWebEngineCore { class URLRequestCustomJobProxy; -class Q_WEBENGINECORE_PRIVATE_EXPORT URLRequestCustomJobDelegate : public QObject { +class Q_WEBENGINECORE_PRIVATE_EXPORT URLRequestCustomJobDelegate : public QObject +{ Q_OBJECT public: ~URLRequestCustomJobDelegate(); @@ -84,7 +85,7 @@ public: QMap<QByteArray, QByteArray> requestHeaders() const; void reply(const QByteArray &contentType, QIODevice *device); - void redirect(const QUrl& url); + void redirect(const QUrl &url); void abort(); void fail(Error); diff --git a/src/core/net/url_request_custom_job_proxy.cpp b/src/core/net/url_request_custom_job_proxy.cpp index b9ccf7ea4..72d14450e 100644 --- a/src/core/net/url_request_custom_job_proxy.cpp +++ b/src/core/net/url_request_custom_job_proxy.cpp @@ -100,7 +100,6 @@ void URLRequestCustomJobProxy::reply(std::string mimeType, QIODevice *device) m_job->set_expected_content_size(size); if (m_job->m_device && m_job->m_device->isReadable()) { m_started = true; - m_job->m_httpStatusCode = 200; m_job->NotifyHeadersComplete(); } else { fail(ERR_INVALID_URL); @@ -115,7 +114,6 @@ void URLRequestCustomJobProxy::redirect(GURL url) if (m_job->m_device || m_job->m_error) return; m_job->m_redirect = url; - m_job->m_httpStatusCode = 303; m_started = true; m_job->NotifyHeadersComplete(); } @@ -140,7 +138,6 @@ void URLRequestCustomJobProxy::fail(int error) if (!m_job) return; m_job->m_error = error; - m_job->m_httpStatusCode = 500; if (m_job->m_device) m_job->m_device->close(); if (!m_started) diff --git a/src/core/net/url_request_custom_job_proxy.h b/src/core/net/url_request_custom_job_proxy.h index aa55db07c..d4cd7e208 100644 --- a/src/core/net/url_request_custom_job_proxy.h +++ b/src/core/net/url_request_custom_job_proxy.h @@ -56,8 +56,8 @@ class ProfileAdapter; // Used to comunicate between URLRequestCustomJob living on the IO thread // and URLRequestCustomJobDelegate living on the UI thread. -class URLRequestCustomJobProxy - : public base::RefCountedThreadSafe<URLRequestCustomJobProxy> { +class URLRequestCustomJobProxy : public base::RefCountedThreadSafe<URLRequestCustomJobProxy> +{ public: URLRequestCustomJobProxy(URLRequestCustomJob *job, diff --git a/src/core/net/url_request_notification.cpp b/src/core/net/url_request_notification.cpp index e37ad35bc..fa6d61f65 100644 --- a/src/core/net/url_request_notification.cpp +++ b/src/core/net/url_request_notification.cpp @@ -53,11 +53,13 @@ namespace QtWebEngineCore { // Calls cancel() when the URLRequest is destroyed. -class UserData : public base::SupportsUserData::Data { +class UserData : public base::SupportsUserData::Data +{ public: UserData(URLRequestNotification *ptr) : m_ptr(ptr) {} ~UserData() { m_ptr->cancel(); } static const char key[]; + private: URLRequestNotification *m_ptr; }; @@ -69,13 +71,10 @@ static content::ResourceType fromQt(QWebEngineUrlRequestInfo::ResourceType resou return static_cast<content::ResourceType>(resourceType); } -URLRequestNotification::URLRequestNotification(net::URLRequest *request, - bool isMainFrameRequest, - GURL *newUrl, - QWebEngineUrlRequestInfo &&requestInfo, - content::ResourceRequestInfo::WebContentsGetter webContentsGetter, - net::CompletionOnceCallback callback, - QPointer<ProfileAdapter> adapter) +URLRequestNotification::URLRequestNotification(net::URLRequest *request, bool isMainFrameRequest, GURL *newUrl, + QWebEngineUrlRequestInfo &&requestInfo, + content::ResourceRequestInfo::WebContentsGetter webContentsGetter, + net::CompletionOnceCallback callback, QPointer<ProfileAdapter> adapter) : m_request(request) , m_isMainFrameRequest(isMainFrameRequest) , m_newUrl(newUrl) @@ -107,8 +106,8 @@ void URLRequestNotification::notify() if (webContents) { - if (m_profileAdapter) { - QWebEngineUrlRequestInterceptor* interceptor = m_profileAdapter->requestInterceptor(); + if (m_profileAdapter && m_profileAdapter->requestInterceptor()) { + QWebEngineUrlRequestInterceptor *interceptor = m_profileAdapter->requestInterceptor(); if (!interceptor->property("deprecated").toBool()) interceptor->interceptRequest(m_requestInfo); } @@ -152,7 +151,7 @@ void URLRequestNotification::notify() base::BindOnce(&URLRequestNotification::complete, base::Unretained(this), result)); } -void URLRequestNotification::cancel() +void URLRequestNotification::cancel() { DCHECK_CURRENTLY_ON(content::BrowserThread::IO); diff --git a/src/core/net/url_request_notification.h b/src/core/net/url_request_notification.h index 790ffeb7a..a43fdff00 100644 --- a/src/core/net/url_request_notification.h +++ b/src/core/net/url_request_notification.h @@ -58,7 +58,8 @@ class ProfileAdapter; class ProfileIoDataQt; // Notifies WebContentsAdapterClient of a new URLRequest. -class URLRequestNotification { +class URLRequestNotification +{ public: URLRequestNotification(net::URLRequest *request, bool isMainFrameRequest, diff --git a/src/core/net/webui_controller_factory_qt.cpp b/src/core/net/webui_controller_factory_qt.cpp index 2bfd242e7..8c045bb7b 100644 --- a/src/core/net/webui_controller_factory_qt.cpp +++ b/src/core/net/webui_controller_factory_qt.cpp @@ -109,7 +109,7 @@ typedef std::unique_ptr<WebUIController> (*WebUIFactoryFunction)(WebUI *web_ui, // Template for defining WebUIFactoryFunction. template<class T> -std::unique_ptr<WebUIController> NewWebUI(WebUI *web_ui, const GURL &/*url*/) +std::unique_ptr<WebUIController> NewWebUI(WebUI *web_ui, const GURL & /*url*/) { return std::unique_ptr<WebUIController>(new T(web_ui)); } @@ -130,8 +130,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI *web_ui, Profile *profile, co return &NewWebUI<QuotaInternalsUI>; if (url.SchemeIs(content::kChromeDevToolsScheme)) { -// if (!DevToolsUIBindings::IsValidFrontendURL(url)) -// return nullptr; + // if (!DevToolsUIBindings::IsValidFrontendURL(url)) + // return nullptr; return &NewWebUI<DevToolsUI>; } if (url.host() == chrome::kChromeUIAccessibilityHost) diff --git a/src/core/net/webui_controller_factory_qt.h b/src/core/net/webui_controller_factory_qt.h index 20ea62193..1cc76349b 100644 --- a/src/core/net/webui_controller_factory_qt.h +++ b/src/core/net/webui_controller_factory_qt.h @@ -55,7 +55,8 @@ class RefCountedMemory; namespace QtWebEngineCore { -class WebUIControllerFactoryQt : public content::WebUIControllerFactory { +class WebUIControllerFactoryQt : public content::WebUIControllerFactory +{ public: content::WebUI::TypeID GetWebUIType(content::BrowserContext *browserContext, const GURL &url) override; bool UseWebUIForURL(content::BrowserContext *browserContext, const GURL &url) override; @@ -76,4 +77,4 @@ private: } // namespace QtWebEngineCore -#endif // WEB_UI_CONTROLLER_FACTORY_QT_H_ +#endif // WEB_UI_CONTROLLER_FACTORY_QT_H_ diff --git a/src/core/ozone/gl_surface_qt.cpp b/src/core/ozone/gl_surface_qt.cpp index 58a225b4e..e9da5e6a5 100644 --- a/src/core/ozone/gl_surface_qt.cpp +++ b/src/core/ozone/gl_surface_qt.cpp @@ -140,7 +140,7 @@ bool InitializeGLOneOffPlatform() { VSyncProviderWin::InitializeOneOff(); - if (GetGLImplementation() == kGLImplementationEGLGLES2) + if (GetGLImplementation() == kGLImplementationEGLGLES2 || GetGLImplementation() == kGLImplementationEGLANGLE) return GLSurfaceEGLQt::InitializeOneOff(); if (GetGLImplementation() == kGLImplementationDesktopGL) { @@ -173,6 +173,7 @@ CreateOffscreenGLSurfaceWithFormat(const gfx::Size& size, GLSurfaceFormat format return surface; break; } + case kGLImplementationEGLANGLE: case kGLImplementationEGLGLES2: { surface = new GLSurfaceEGLQt(size); if (surface->Initialize(format)) diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp index 551663cf0..d421edf00 100644 --- a/src/core/profile_adapter.cpp +++ b/src/core/profile_adapter.cpp @@ -183,7 +183,16 @@ void ProfileAdapter::setRequestInterceptor(QWebEngineUrlRequestInterceptor *inte { if (m_requestInterceptor == interceptor) return; + + if (m_requestInterceptor) + disconnect(m_requestInterceptor, &QObject::destroyed, this, nullptr); m_requestInterceptor = interceptor; + if (m_requestInterceptor) + connect(m_requestInterceptor, &QObject::destroyed, this, [this] () { + m_profile->m_profileIOData->updateRequestInterceptor(); + Q_ASSERT(!m_profile->m_profileIOData->requestInterceptor()); + }); + if (m_profile->m_urlRequestContextGetter.get()) m_profile->m_profileIOData->updateRequestInterceptor(); } diff --git a/src/core/profile_io_data_qt.cpp b/src/core/profile_io_data_qt.cpp index 2e0e378ac..68be09ad2 100644 --- a/src/core/profile_io_data_qt.cpp +++ b/src/core/profile_io_data_qt.cpp @@ -613,7 +613,6 @@ void ProfileIODataQt::setRequestContextData(content::ProtocolHandlerMap *protoco void ProfileIODataQt::setFullConfiguration() { Q_ASSERT(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - m_requestInterceptor = m_profileAdapter->requestInterceptor(); m_persistentCookiesPolicy = m_profileAdapter->persistentCookiesPolicy(); m_cookiesPath = m_profileAdapter->cookiesPath(); m_httpAcceptLanguage = m_profileAdapter->httpAcceptLanguage(); @@ -738,9 +737,18 @@ void ProfileIODataQt::updateRequestInterceptor() const std::lock_guard<QRecursiveMutex> lock(m_mutex); m_requestInterceptor = m_profileAdapter->requestInterceptor(); m_hasPageInterceptors = m_profileAdapter->hasPageRequestInterceptor(); + if (m_requestInterceptor) + m_isInterceptorDeprecated = m_requestInterceptor->property("deprecated").toBool(); + else + m_isInterceptorDeprecated = false; // We in this case do not need to regenerate any Chromium classes. } +bool ProfileIODataQt::isInterceptorDeprecated() const +{ + return m_isInterceptorDeprecated; +} + QWebEngineUrlRequestInterceptor *ProfileIODataQt::acquireInterceptor() { m_mutex.lock(); diff --git a/src/core/profile_io_data_qt.h b/src/core/profile_io_data_qt.h index 8f11a9ce2..ec0a3dac9 100644 --- a/src/core/profile_io_data_qt.h +++ b/src/core/profile_io_data_qt.h @@ -130,7 +130,8 @@ public: void setGlobalCertificateVerification(); // Used in NetworkDelegateQt::OnBeforeURLRequest. - QWebEngineUrlRequestInterceptor *acquireInterceptor(); + bool isInterceptorDeprecated() const; // Remove for Qt6 + QWebEngineUrlRequestInterceptor *acquireInterceptor(); // Remove for Qt6 void releaseInterceptor(); QWebEngineUrlRequestInterceptor *requestInterceptor(); @@ -220,6 +221,7 @@ private: base::WeakPtrFactory<ProfileIODataQt> m_weakPtrFactory; // this should be always the last member QString m_dataPath; bool m_pendingStorageRequestGeneration = false; + volatile bool m_isInterceptorDeprecated = false; // Remove for Qt6 DISALLOW_COPY_AND_ASSIGN(ProfileIODataQt); friend class BrowsingDataRemoverObserverQt; diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp index 94b22fbea..be55e7c49 100644 --- a/src/core/profile_qt.cpp +++ b/src/core/profile_qt.cpp @@ -235,6 +235,7 @@ net::URLRequestContextGetter *ProfileQt::CreateRequestContext( m_profileIOData->setRequestContextData(protocol_handlers, std::move(request_interceptors)); m_profileIOData->updateStorageSettings(); + m_profileIOData->updateRequestInterceptor(); m_urlRequestContextGetter = new URLRequestContextGetterQt(m_profileIOData.get()); return m_urlRequestContextGetter.get(); } diff --git a/src/core/render_widget_host_view_qt.cpp b/src/core/render_widget_host_view_qt.cpp index 7633aa44c..e2fd074ae 100644 --- a/src/core/render_widget_host_view_qt.cpp +++ b/src/core/render_widget_host_view_qt.cpp @@ -538,6 +538,7 @@ void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor) ui::CursorType auraType = ui::CursorType::kNull; #endif switch (cursorInfo.type) { + case ui::CursorType::kNull: case ui::CursorType::kPointer: shape = Qt::ArrowCursor; break; @@ -561,6 +562,7 @@ void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor) case ui::CursorType::kEastWestResize: case ui::CursorType::kEastPanning: case ui::CursorType::kWestPanning: + case ui::CursorType::kMiddlePanningHorizontal: shape = Qt::SizeHorCursor; break; case ui::CursorType::kNorthResize: @@ -568,6 +570,7 @@ void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor) case ui::CursorType::kNorthSouthResize: case ui::CursorType::kNorthPanning: case ui::CursorType::kSouthPanning: + case ui::CursorType::kMiddlePanningVertical: shape = Qt::SizeVerCursor; break; case ui::CursorType::kNorthEastResize: @@ -597,9 +600,15 @@ void RenderWidgetHostViewQt::DisplayCursor(const content::WebCursor &webCursor) case ui::CursorType::kProgress: shape = Qt::BusyCursor; break; + case ui::CursorType::kDndNone: + case ui::CursorType::kDndMove: + shape = Qt::DragMoveCursor; + break; + case ui::CursorType::kDndCopy: case ui::CursorType::kCopy: shape = Qt::DragCopyCursor; break; + case ui::CursorType::kDndLink: case ui::CursorType::kAlias: shape = Qt::DragLinkCursor; break; @@ -1009,15 +1018,22 @@ QSGNode *RenderWidgetHostViewQt::updatePaintNode(QSGNode *oldNode) void RenderWidgetHostViewQt::notifyShown() { if (m_enableViz) { + // Handle possible frame eviction: + if (!m_dfhLocalSurfaceIdAllocator.HasValidLocalSurfaceIdAllocation()) + m_dfhLocalSurfaceIdAllocator.GenerateId(); if (m_visible) return; m_visible = true; + } + + host()->WasShown(base::nullopt); + + if (m_enableViz) { m_delegatedFrameHost->AttachToCompositor(m_uiCompositor.get()); m_delegatedFrameHost->WasShown(GetLocalSurfaceIdAllocation().local_surface_id(), m_viewRectInDips.size(), base::nullopt); } - host()->WasShown(base::nullopt); } void RenderWidgetHostViewQt::notifyHidden() @@ -1304,6 +1320,14 @@ void RenderWidgetHostViewQt::handleKeyEvent(QKeyEvent *ev) } } + // Ignore autorepeating KeyRelease events so that the generated web events + // conform to the spec, which requires autorepeat to result in a sequence of + // keypress events and only one final keyup event: + // https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Auto-repeat_handling + // https://w3c.github.io/uievents/#dom-keyboardevent-repeat + if (ev->type() == QEvent::KeyRelease && ev->isAutoRepeat()) + return; + content::NativeWebKeyboardEvent webEvent = WebEventFactory::toWebKeyboardEvent(ev); if (webEvent.GetType() == blink::WebInputEvent::kRawKeyDown && !m_editCommand.empty()) { ui::LatencyInfo latency; diff --git a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.cpp b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.cpp index 39412b76c..aef4903b7 100644 --- a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.cpp +++ b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.cpp @@ -47,8 +47,7 @@ namespace QtWebEngineCore { -RendererPermissionsPolicyDelegateQt::RendererPermissionsPolicyDelegateQt(extensions::Dispatcher *dispatcher) - : m_dispatcher(dispatcher) +RendererPermissionsPolicyDelegateQt::RendererPermissionsPolicyDelegateQt(extensions::Dispatcher *) { extensions::PermissionsData::SetPolicyDelegate(this); } 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 e2af47657..385b7a4b0 100644 --- a/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h +++ b/src/core/renderer/extensions/renderer_permissions_policy_delegate_qt.h @@ -58,8 +58,6 @@ public: bool IsRestrictedUrl(const GURL &, std::string *) override; private: - extensions::Dispatcher *m_dispatcher; - DISALLOW_COPY_AND_ASSIGN(RendererPermissionsPolicyDelegateQt); }; diff --git a/src/core/renderer/extensions/resource_request_policy_qt.cpp b/src/core/renderer/extensions/resource_request_policy_qt.cpp index a64b1fef8..efe44521d 100644 --- a/src/core/renderer/extensions/resource_request_policy_qt.cpp +++ b/src/core/renderer/extensions/resource_request_policy_qt.cpp @@ -154,9 +154,9 @@ bool ResourceRequestPolicyQt::CanRequestResource(const GURL &resource_url, // hybrid hosted/packaged apps. The one exception is access to icons, since // some extensions want to be able to do things like create their own // launchers. - base::StringPiece resource_root_relative_path = + /*base::StringPiece resource_root_relative_path = resource_url.path_piece().empty() ? base::StringPiece() - : resource_url.path_piece().substr(1); + : resource_url.path_piece().substr(1);*/ if (extension->is_hosted_app() /*&& !IconsInfo::GetIcons(extension).ContainsPath(resource_root_relative_path)*/) { LOG(ERROR) << "Denying load of " << resource_url.spec() << " from " << "hosted app."; diff --git a/src/core/renderer/render_frame_observer_qt.h b/src/core/renderer/render_frame_observer_qt.h index 3c54761f3..fb9fd3869 100644 --- a/src/core/renderer/render_frame_observer_qt.h +++ b/src/core/renderer/render_frame_observer_qt.h @@ -78,7 +78,7 @@ public: private: DISALLOW_COPY_AND_ASSIGN(RenderFrameObserverQt); - void ReadyToCommitNavigation(blink::WebDocumentLoader *); + void ReadyToCommitNavigation(blink::WebDocumentLoader *) override; bool m_isFrameDetached; service_manager::BinderRegistry registry_; 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 e1929e4cd..4547b7fcf 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp +++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp @@ -52,11 +52,9 @@ #include <QJsonObject> #include <QLoggingCategory> -#include <QtCore/private/qjson_p.h> - namespace QtWebEngineCore { -Q_LOGGING_CATEGORY(log, "qt.webengine.webchanneltransport"); +Q_LOGGING_CATEGORY(log, "qt.webengine.webchanneltransport") inline QDebug operator<<(QDebug stream, content::RenderFrameHost *frame) { @@ -142,12 +140,8 @@ void WebChannelIPCTransportHost::DispatchWebChannelMessage(const std::vector<uin return; } - QJsonDocument doc; - // QJsonDocument::fromRawData does not check the length before it starts - // parsing the QJsonPrivate::Header and QJsonPrivate::Base structures. - if (binaryJson.size() >= sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base)) - doc = QJsonDocument::fromRawData(reinterpret_cast<const char *>(binaryJson.data()), - binaryJson.size()); + QJsonDocument doc = QJsonDocument::fromRawData( + reinterpret_cast<const char *>(binaryJson.data()), binaryJson.size()); if (!doc.isObject()) { qCCritical(log).nospace() << "received invalid webchannel message from " << frame; diff --git a/src/core/type_conversion.cpp b/src/core/type_conversion.cpp index ddadeb9f2..aea924dbd 100644 --- a/src/core/type_conversion.cpp +++ b/src/core/type_conversion.cpp @@ -58,6 +58,7 @@ QImage toQImage(const SkBitmap &bitmap) case kUnknown_SkColorType: case kRGBA_F16_SkColorType: case kRGBA_F32_SkColorType: + case kRGBA_F16Norm_SkColorType: qWarning("Unknown or unsupported skia image format"); break; case kAlpha_8_SkColorType: diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h index dfd8e8fef..2275ae82e 100644 --- a/src/core/type_conversion.h +++ b/src/core/type_conversion.h @@ -217,7 +217,7 @@ inline QDateTime toQt(base::Time time) } inline base::Time toTime(const QDateTime &dateTime) { - return base::Time::FromInternalValue(dateTime.toMSecsSinceEpoch()); + return base::Time::FromJavaTime(dateTime.toMSecsSinceEpoch()); } inline QNetworkCookie toQt(const net::CanonicalCookie & cookie) diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index 3eb52409d..4cfcf6acd 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -134,7 +134,7 @@ namespace QtWebEngineCore { static const int kTestWindowWidth = 800; static const int kTestWindowHeight = 600; -static const int kHistoryStreamVersion = 3; +static const int kHistoryStreamVersion = 4; static QVariant fromJSValue(const base::Value *result) { @@ -279,6 +279,9 @@ static void serializeNavigationHistory(content::NavigationController &controller output << entry->GetIsOverridingUserAgent(); output << static_cast<qint64>(entry->GetTimestamp().ToInternalValue()); output << entry->GetHttpStatusCode(); + // kHistoryStreamVersion >= 4 + content::FaviconStatus &favicon = entry->GetFavicon(); + output << (favicon.valid ? toQt(favicon.url) : QUrl()); } } } @@ -287,8 +290,8 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex, { int version; input >> version; - if (version != kHistoryStreamVersion) { - // We do not try to decode previous history stream versions. + if (version < 3 || version > kHistoryStreamVersion) { + // We do not try to decode history stream versions before 3. // Make sure that our history is cleared and mark the rest of the stream as invalid. input.setStatus(QDataStream::ReadCorruptData); *currentIndex = -1; @@ -301,7 +304,7 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex, entries->reserve(count); // Logic taken from SerializedNavigationEntry::ReadFromPickle and ToNavigationEntries. for (int i = 0; i < count; ++i) { - QUrl virtualUrl, referrerUrl, originalRequestUrl; + QUrl virtualUrl, referrerUrl, originalRequestUrl, iconUrl; QString title; QByteArray pageState; qint32 transitionType, referrerPolicy; @@ -319,6 +322,9 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex, input >> isOverridingUserAgent; input >> timestamp; input >> httpStatusCode; + // kHistoryStreamVersion >= 4 + if (version >= 4) + input >> iconUrl; // If we couldn't unpack the entry successfully, abort everything. if (input.status() != QDataStream::Ok) { @@ -351,6 +357,14 @@ static void deserializeNavigationHistory(QDataStream &input, int *currentIndex, entry->SetIsOverridingUserAgent(isOverridingUserAgent); entry->SetTimestamp(base::Time::FromInternalValue(timestamp)); entry->SetHttpStatusCode(httpStatusCode); + if (iconUrl.isValid()) { + // Note: we don't set .image below as we don't have it and chromium will refetch favicon + // anyway. However, we set .url and .valid to let QWebEngineHistory items restored from + // a stream receive valid icon URLs via our getNavigationEntryIconUrl calls. + content::FaviconStatus &favicon = entry->GetFavicon(); + favicon.url = toGurl(iconUrl); + favicon.valid = true; + } entries->push_back(std::move(entry)); } } @@ -778,7 +792,7 @@ QUrl WebContentsAdapter::iconUrl() const { CHECK_INITIALIZED(QUrl()); if (content::NavigationEntry* entry = m_webContents->GetController().GetVisibleEntry()) { - content::FaviconStatus favicon = entry->GetFavicon(); + content::FaviconStatus &favicon = entry->GetFavicon(); if (favicon.valid) return toQt(favicon.url); } @@ -935,7 +949,7 @@ QUrl WebContentsAdapter::getNavigationEntryIconUrl(int index) content::NavigationEntry *entry = m_webContents->GetController().GetEntryAtIndex(index); if (!entry) return QUrl(); - content::FaviconStatus favicon = entry->GetFavicon(); + content::FaviconStatus &favicon = entry->GetFavicon(); return favicon.valid ? toQt(favicon.url) : QUrl(); } @@ -1439,8 +1453,7 @@ void WebContentsAdapter::startDragging(QObject *dragSource, const content::DropD }); QMimeData *mimeData = mimeDataFromDropData(*m_currentDropData); - if (handleDropDataFileContents(dropData, mimeData)) - allowedActions = Qt::MoveAction; + handleDropDataFileContents(dropData, mimeData); drag->setMimeData(mimeData); if (!pixmap.isNull()) { diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index d4dfaba28..a4ceb3a97 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -378,6 +378,7 @@ ProxyAuthentication WebEngineContext::qProxyNetworkAuthentication(QString host, const static char kChromiumFlagsEnv[] = "QTWEBENGINE_CHROMIUM_FLAGS"; const static char kDisableSandboxEnv[] = "QTWEBENGINE_DISABLE_SANDBOX"; +const static char kDisableInProcGpuThread[] = "QTWEBENGINE_DISABLE_GPU_THREAD"; static void appendToFeatureList(std::string &featureList, const char *feature) { @@ -508,6 +509,7 @@ WebEngineContext::WebEngineContext() #ifndef QT_NO_OPENGL threadedGpu = QOpenGLContext::supportsThreadedOpenGL(); #endif + threadedGpu = threadedGpu && !qEnvironmentVariableIsSet(kDisableInProcGpuThread); bool enableViz = ((threadedGpu && !parsedCommandLine->HasSwitch("disable-viz-display-compositor")) || parsedCommandLine->HasSwitch("enable-viz-display-compositor")); @@ -585,7 +587,7 @@ WebEngineContext::WebEngineContext() || usingANGLE()) { if (qt_gl_global_share_context()->isOpenGLES()) { - glType = gl::kGLImplementationEGLName; + glType = usingANGLE() ? gl::kGLImplementationANGLEName : gl::kGLImplementationEGLName; } else { QOpenGLContext context; QSurfaceFormat format; diff --git a/src/core/web_engine_settings.cpp b/src/core/web_engine_settings.cpp index 9bc1279ba..49006ec20 100644 --- a/src/core/web_engine_settings.cpp +++ b/src/core/web_engine_settings.cpp @@ -53,7 +53,9 @@ #include "content/public/common/webrtc_ip_handling_policy.h" #include "media/base/media_switches.h" #include "third_party/blink/public/mojom/renderer_preferences.mojom.h" +#include "ui/base/ui_base_switches.h" #include "ui/events/event_switches.h" +#include "ui/native_theme/native_theme.h" #include <QFont> #include <QTimer> @@ -399,6 +401,50 @@ void WebEngineSettings::applySettingsToWebPreferences(content::WebPreferences *p prefs->minimum_font_size = fontSize(MinimumFontSize); prefs->minimum_logical_font_size = fontSize(MinimumLogicalFontSize); prefs->default_encoding = defaultTextEncoding().toStdString(); + + // Set the theme colors. Based on chrome_content_browser_client.cc: + const ui::NativeTheme *webTheme = ui::NativeTheme::GetInstanceForWeb(); + if (webTheme) { +#if !defined(OS_MACOSX) + // Mac has a concept of high contrast that does not relate to forced colors. + prefs->forced_colors = webTheme->UsesHighContrastColors() + ? blink::ForcedColors::kActive + : blink::ForcedColors::kNone; +#endif // !defined(OS_MACOSX) + switch (webTheme->GetPreferredColorScheme()) { + case ui::NativeTheme::PreferredColorScheme::kDark: + prefs->preferred_color_scheme = blink::PreferredColorScheme::kDark; + break; + case ui::NativeTheme::PreferredColorScheme::kLight: + prefs->preferred_color_scheme = blink::PreferredColorScheme::kLight; + break; + case ui::NativeTheme::PreferredColorScheme::kNoPreference: + prefs->preferred_color_scheme = blink::PreferredColorScheme::kNoPreference; + } + } + + // Apply native CaptionStyle parameters. + base::Optional<ui::CaptionStyle> style; + if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kForceCaptionStyle)) { + style = ui::CaptionStyle::FromSpec( + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(switches::kForceCaptionStyle)); + } + + // Apply system caption style. + if (!style && webTheme) + style = webTheme->GetSystemCaptionStyle(); + + if (style) { + prefs->text_track_background_color = style->background_color; + prefs->text_track_text_color = style->text_color; + prefs->text_track_text_size = style->text_size; + prefs->text_track_text_shadow = style->text_shadow; + prefs->text_track_font_family = style->font_family; + prefs->text_track_font_variant = style->font_variant; + prefs->text_track_window_color = style->window_color; + prefs->text_track_window_padding = style->window_padding; + prefs->text_track_window_radius = style->window_radius; + } } bool WebEngineSettings::applySettingsToRendererPreferences(blink::mojom::RendererPreferences *prefs) diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp index 3598c1c78..ba04806d5 100644 --- a/src/core/web_event_factory.cpp +++ b/src/core/web_event_factory.cpp @@ -1292,6 +1292,7 @@ static inline WebInputEvent::Modifiers modifiersForEvent(const QInputEvent* even if (keyEvent->isAutoRepeat()) result |= WebInputEvent::kIsAutoRepeat; result |= modifierForKeyCode(qtKeyForKeyEvent(keyEvent)); + break; } default: break; diff --git a/src/webengine/api/qquickwebenginedownloaditem_p.h b/src/webengine/api/qquickwebenginedownloaditem_p.h index 96ef0daf0..beb359622 100644 --- a/src/webengine/api/qquickwebenginedownloaditem_p.h +++ b/src/webengine/api/qquickwebenginedownloaditem_p.h @@ -137,10 +137,10 @@ public: Q_PROPERTY(bool isPaused READ isPaused NOTIFY isPausedChanged REVISION 5 FINAL) Q_PROPERTY(bool isSavePageDownload READ isSavePageDownload CONSTANT REVISION 6 FINAL) Q_PROPERTY(QQuickWebEngineView *view READ view CONSTANT REVISION 7 FINAL) - Q_PROPERTY(QUrl url READ url CONSTANT REVISION 8 FINAL) - Q_PROPERTY(QString suggestedFileName READ suggestedFileName CONSTANT REVISION 8 FINAL) - Q_PROPERTY(QString downloadDirectory READ downloadDirectory WRITE setDownloadDirectory NOTIFY downloadDirectoryChanged REVISION 8 FINAL) - Q_PROPERTY(QString downloadFileName READ downloadFileName WRITE setDownloadFileName NOTIFY downloadFileNameChanged REVISION 8 FINAL) + Q_PROPERTY(QUrl url READ url CONSTANT REVISION 10 FINAL) + Q_PROPERTY(QString suggestedFileName READ suggestedFileName CONSTANT REVISION 10 FINAL) + Q_PROPERTY(QString downloadDirectory READ downloadDirectory WRITE setDownloadDirectory NOTIFY downloadDirectoryChanged REVISION 10 FINAL) + Q_PROPERTY(QString downloadFileName READ downloadFileName WRITE setDownloadFileName NOTIFY downloadFileNameChanged REVISION 10 FINAL) Q_INVOKABLE void accept(); Q_INVOKABLE void cancel(); @@ -181,8 +181,8 @@ Q_SIGNALS: Q_REVISION(4) void interruptReasonChanged(); Q_REVISION(5) void isFinishedChanged(); Q_REVISION(5) void isPausedChanged(); - Q_REVISION(8) void downloadDirectoryChanged(); - Q_REVISION(8) void downloadFileNameChanged(); + Q_REVISION(10) void downloadDirectoryChanged(); + Q_REVISION(10) void downloadFileNameChanged(); private: QQuickWebEngineDownloadItem(QQuickWebEngineDownloadItemPrivate*, QObject *parent = 0); diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h index 4a88e3c28..618f9407e 100644 --- a/src/webengine/api/qquickwebengineview_p.h +++ b/src/webengine/api/qquickwebengineview_p.h @@ -139,8 +139,8 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem { Q_PROPERTY(QQuickWebEngineTestSupport *testSupport READ testSupport WRITE setTestSupport NOTIFY testSupportChanged FINAL) #endif - Q_PROPERTY(LifecycleState lifecycleState READ lifecycleState WRITE setLifecycleState NOTIFY lifecycleStateChanged REVISION 11 FINAL) - Q_PROPERTY(LifecycleState recommendedState READ recommendedState NOTIFY recommendedStateChanged REVISION 11 FINAL) + Q_PROPERTY(LifecycleState lifecycleState READ lifecycleState WRITE setLifecycleState NOTIFY lifecycleStateChanged REVISION 10 FINAL) + Q_PROPERTY(LifecycleState recommendedState READ recommendedState NOTIFY recommendedStateChanged REVISION 10 FINAL) public: QQuickWebEngineView(QQuickItem *parent = 0); @@ -573,9 +573,9 @@ Q_SIGNALS: Q_REVISION(8) void printRequested(); Q_REVISION(9) void selectClientCertificate(QQuickWebEngineClientCertificateSelection *clientCertSelection); Q_REVISION(10) void tooltipRequested(QQuickWebEngineTooltipRequest *request); - Q_REVISION(11) void lifecycleStateChanged(LifecycleState state); - Q_REVISION(11) void recommendedStateChanged(LifecycleState state); - Q_REVISION(11) void findTextFinished(const QWebEngineFindTextResult &result); + Q_REVISION(10) void lifecycleStateChanged(LifecycleState state); + Q_REVISION(10) void recommendedStateChanged(LifecycleState state); + Q_REVISION(10) void findTextFinished(const QWebEngineFindTextResult &result); #if QT_CONFIG(webengine_testsupport) void testSupportChanged(); diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp index a11618dba..4346832c9 100644 --- a/src/webengine/api/qtwebengineglobal.cpp +++ b/src/webengine/api/qtwebengineglobal.cpp @@ -38,6 +38,7 @@ ****************************************************************************/ #include "qtwebengineglobal.h" +#include <QCoreApplication> namespace QtWebEngineCore { @@ -62,8 +63,8 @@ namespace QtWebEngine { /*! \fn QtWebEngine::initialize() - Sets up an OpenGL Context that can be shared between threads. This has to be done after - QGuiApplication is created, but before a Qt Quick window is created. + Sets up an OpenGL Context that can be shared between threads. This has to be done before + QGuiApplication is created and before window's QPlatformOpenGLContext is created. This has the same effect as setting the Qt::AA_ShareOpenGLContexts attribute with QCoreApplication::setAttribute before constructing @@ -71,7 +72,15 @@ namespace QtWebEngine { */ void initialize() { - QtWebEngineCore::initialize(); + QCoreApplication *app = QCoreApplication::instance(); + if (app) { + qWarning("QtWebEngine::initialize() called with QCoreApplication object already created and should be call before. "\ + "This is depreciated and may fail in the future."); + QtWebEngineCore::initialize(); + return; + } + // call initialize the same way as widgets do + qAddPreRoutine(QtWebEngineCore::initialize); } } // namespace QtWebEngine diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc index 6aa1af89e..3533b0327 100644 --- a/src/webengine/doc/src/qtwebengine-overview.qdoc +++ b/src/webengine/doc/src/qtwebengine-overview.qdoc @@ -89,7 +89,7 @@ \l{https://chromium.googlesource.com/chromium/src/+/master/docs/chromium_browser_vs_google_chrome.md}{overview} that is part of the documentation in the \l {Chromium Project} upstream source tree. - This version of \QWE is based on Chromium version 73.0.3683, with additional security + This version of \QWE is based on Chromium version 77.0.3865, with additional security fixes from newer versions. \section2 Qt WebEngine Process diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc index 5d32fa6c7..1b8320c0c 100644 --- a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc +++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the documentation of the Qt Toolkit. @@ -75,7 +75,7 @@ \li Visual Studio 2017 version 15.8 or later \li Active Template Library (ATL), usually included in the Visual Studio installation - \li Windows 10 SDK + \li Windows 10 SDK version 10.0.18362 or later \endlist \QWE can only be built on 64-bit Windows, with a x64-bit toolchain. diff --git a/src/webengine/doc/src/webengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview_lgpl.qdoc index 3a7717bd2..df956f03e 100644 --- a/src/webengine/doc/src/webengineview_lgpl.qdoc +++ b/src/webengine/doc/src/webengineview_lgpl.qdoc @@ -1599,7 +1599,7 @@ */ /*! - \qmlproperty int FindTextResult::activeMatchOrdinal + \qmlproperty int FindTextResult::activeMatch \readonly \brief The index of the currently highlighted match. @@ -1607,7 +1607,7 @@ /*! \qmlsignal WebEngineView::findTextFinished(FindTextResult result) - \since QtWebEngine 1.11 + \since QtWebEngine 1.10 This signal is emitted when a string search on a page is completed. \a result is the result of the string search. diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp index 5fb48d867..3acf7d058 100644 --- a/src/webengine/plugin/plugin.cpp +++ b/src/webengine/plugin/plugin.cpp @@ -97,7 +97,6 @@ public: qmlRegisterType<QQuickWebEngineView, 8>(uri, 1, 8, "WebEngineView"); qmlRegisterType<QQuickWebEngineView, 9>(uri, 1, 9, "WebEngineView"); qmlRegisterType<QQuickWebEngineView, 10>(uri, 1, 10, "WebEngineView"); - qmlRegisterType<QQuickWebEngineView, 11>(uri, 1, 11, "WebEngineView"); qmlRegisterType<QQuickWebEngineProfile>(uri, 1, 1, "WebEngineProfile"); qmlRegisterType<QQuickWebEngineProfile, 1>(uri, 1, 2, "WebEngineProfile"); qmlRegisterType<QQuickWebEngineProfile, 2>(uri, 1, 3, "WebEngineProfile"); @@ -122,7 +121,7 @@ public: msgUncreatableType("WebEngineDownloadItem")); qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 7>(uri, 1, 8, "WebEngineDownloadItem", msgUncreatableType("WebEngineDownloadItem")); - qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 8>(uri, 1, 10, "WebEngineDownloadItem", + qmlRegisterUncreatableType<QQuickWebEngineDownloadItem, 10>(uri, 1, 10, "WebEngineDownloadItem", msgUncreatableType("WebEngineDownloadItem")); qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest>(uri, 1, 1, "WebEngineNewViewRequest", msgUncreatableType("WebEngineNewViewRequest")); qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest, 1>(uri, 1, 5, "WebEngineNewViewRequest", tr("Cannot create separate instance of WebEngineNewViewRequest")); @@ -174,7 +173,7 @@ public: qmlRegisterUncreatableType<QQuickWebEngineTooltipRequest>(uri, 1, 10, "TooltipRequest", msgUncreatableType("TooltipRequest")); qRegisterMetaType<QWebEngineFindTextResult>(); - qmlRegisterUncreatableType<QWebEngineFindTextResult>(uri, 1, 11, "FindTextResult", msgUncreatableType("FindTextResult")); + qmlRegisterUncreatableType<QWebEngineFindTextResult>(uri, 1, 10, "FindTextResult", msgUncreatableType("FindTextResult")); } private: diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes index 0037861e5..a23d1c3c0 100644 --- a/src/webengine/plugin/plugins.qmltypes +++ b/src/webengine/plugin/plugins.qmltypes @@ -4,11 +4,285 @@ import QtQuick.tooling 1.2 // It is used for QML tooling purposes only. // // This file was auto-generated by: -// 'qmlplugindump -nonrelocatable -defaultplatform -dependencies dependencies.json QtWebEngine 1.9' +// 'qmlplugindump -nonrelocatable -defaultplatform -dependencies dependencies.json QtWebEngine 1.10' Module { dependencies: ["QtQuick 2.8"] Component { + name: "QAbstractItemModel" + prototype: "QObject" + Enum { + name: "LayoutChangeHint" + values: { + "NoLayoutChangeHint": 0, + "VerticalSortHint": 1, + "HorizontalSortHint": 2 + } + } + Enum { + name: "CheckIndexOption" + values: { + "NoOption": 0, + "IndexIsValid": 1, + "DoNotUseParent": 2, + "ParentIsInvalid": 4 + } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + Parameter { name: "roles"; type: "QVector<int>" } + } + Signal { + name: "dataChanged" + Parameter { name: "topLeft"; type: "QModelIndex" } + Parameter { name: "bottomRight"; type: "QModelIndex" } + } + Signal { + name: "headerDataChanged" + Parameter { name: "orientation"; type: "Qt::Orientation" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + } + Signal { name: "layoutChanged" } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + Parameter { name: "hint"; type: "QAbstractItemModel::LayoutChangeHint" } + } + Signal { + name: "layoutAboutToBeChanged" + Parameter { name: "parents"; type: "QList<QPersistentModelIndex>" } + } + Signal { name: "layoutAboutToBeChanged" } + Signal { + name: "rowsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "rowsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsInserted" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsAboutToBeRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { + name: "columnsRemoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "first"; type: "int" } + Parameter { name: "last"; type: "int" } + } + Signal { name: "modelAboutToBeReset" } + Signal { name: "modelReset" } + Signal { + name: "rowsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationRow"; type: "int" } + } + Signal { + name: "rowsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "row"; type: "int" } + } + Signal { + name: "columnsAboutToBeMoved" + Parameter { name: "sourceParent"; type: "QModelIndex" } + Parameter { name: "sourceStart"; type: "int" } + Parameter { name: "sourceEnd"; type: "int" } + Parameter { name: "destinationParent"; type: "QModelIndex" } + Parameter { name: "destinationColumn"; type: "int" } + } + Signal { + name: "columnsMoved" + Parameter { name: "parent"; type: "QModelIndex" } + Parameter { name: "start"; type: "int" } + Parameter { name: "end"; type: "int" } + Parameter { name: "destination"; type: "QModelIndex" } + Parameter { name: "column"; type: "int" } + } + Method { name: "submit"; type: "bool" } + Method { name: "revert" } + Method { + name: "hasIndex" + type: "bool" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "hasIndex" + type: "bool" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + } + Method { + name: "index" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "index" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + } + Method { + name: "parent" + type: "QModelIndex" + Parameter { name: "child"; type: "QModelIndex" } + } + Method { + name: "sibling" + type: "QModelIndex" + Parameter { name: "row"; type: "int" } + Parameter { name: "column"; type: "int" } + Parameter { name: "idx"; type: "QModelIndex" } + } + Method { + name: "rowCount" + type: "int" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "rowCount"; type: "int" } + Method { + name: "columnCount" + type: "int" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "columnCount"; type: "int" } + Method { + name: "hasChildren" + type: "bool" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { name: "hasChildren"; type: "bool" } + Method { + name: "data" + type: "QVariant" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "data" + type: "QVariant" + Parameter { name: "index"; type: "QModelIndex" } + } + Method { + name: "setData" + type: "bool" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "setData" + type: "bool" + Parameter { name: "index"; type: "QModelIndex" } + Parameter { name: "value"; type: "QVariant" } + } + Method { + name: "headerData" + type: "QVariant" + Parameter { name: "section"; type: "int" } + Parameter { name: "orientation"; type: "Qt::Orientation" } + Parameter { name: "role"; type: "int" } + } + Method { + name: "headerData" + type: "QVariant" + Parameter { name: "section"; type: "int" } + Parameter { name: "orientation"; type: "Qt::Orientation" } + } + Method { + name: "fetchMore" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "canFetchMore" + type: "bool" + Parameter { name: "parent"; type: "QModelIndex" } + } + Method { + name: "flags" + type: "Qt::ItemFlags" + Parameter { name: "index"; type: "QModelIndex" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "hits"; type: "int" } + Parameter { name: "flags"; type: "Qt::MatchFlags" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + Parameter { name: "hits"; type: "int" } + } + Method { + name: "match" + type: "QModelIndexList" + Parameter { name: "start"; type: "QModelIndex" } + Parameter { name: "role"; type: "int" } + Parameter { name: "value"; type: "QVariant" } + } + } + Component { name: "QAbstractListModel"; prototype: "QAbstractItemModel" } + Component { name: "QQuickWebEngineAction" prototype: "QObject" exports: ["QtWebEngine/WebEngineAction 1.8"] @@ -202,6 +476,7 @@ Module { prototype: "QObject" exports: [ "QtWebEngine/WebEngineDownloadItem 1.1", + "QtWebEngine/WebEngineDownloadItem 1.10", "QtWebEngine/WebEngineDownloadItem 1.2", "QtWebEngine/WebEngineDownloadItem 1.3", "QtWebEngine/WebEngineDownloadItem 1.4", @@ -211,7 +486,7 @@ Module { "QtWebEngine/WebEngineDownloadItem 1.8" ] isCreatable: false - exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6, 7] + exportMetaObjectRevisions: [0, 10, 1, 2, 3, 4, 5, 6, 7] Enum { name: "DownloadState" values: { @@ -294,12 +569,18 @@ Module { isReadonly: true isPointer: true } + Property { name: "url"; revision: 10; type: "QUrl"; isReadonly: true } + Property { name: "suggestedFileName"; revision: 10; type: "string"; isReadonly: true } + Property { name: "downloadDirectory"; revision: 10; type: "string" } + Property { name: "downloadFileName"; revision: 10; type: "string" } Signal { name: "savePageFormatChanged"; revision: 2 } Signal { name: "mimeTypeChanged"; revision: 1 } Signal { name: "typeChanged"; revision: 3 } Signal { name: "interruptReasonChanged"; revision: 4 } Signal { name: "isFinishedChanged"; revision: 5 } Signal { name: "isPausedChanged"; revision: 5 } + Signal { name: "downloadDirectoryChanged"; revision: 10 } + Signal { name: "downloadFileNameChanged"; revision: 10 } Method { name: "accept" } Method { name: "cancel" } Method { name: "pause" } @@ -625,10 +906,11 @@ Module { "QtWebEngine/WebEngineSettings 1.5", "QtWebEngine/WebEngineSettings 1.6", "QtWebEngine/WebEngineSettings 1.7", - "QtWebEngine/WebEngineSettings 1.8" + "QtWebEngine/WebEngineSettings 1.8", + "QtWebEngine/WebEngineSettings 1.9" ] isCreatable: false - exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6, 7] + exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6, 7, 8] Enum { name: "UnknownUrlSchemePolicy" values: { @@ -704,12 +986,32 @@ Module { } } Component { + name: "QQuickWebEngineTooltipRequest" + prototype: "QObject" + exports: ["QtWebEngine/TooltipRequest 1.10"] + isCreatable: false + exportMetaObjectRevisions: [0] + Enum { + name: "RequestType" + values: { + "Show": 0, + "Hide": 1 + } + } + Property { name: "x"; type: "int"; isReadonly: true } + Property { name: "y"; type: "int"; isReadonly: true } + Property { name: "text"; type: "string"; isReadonly: true } + Property { name: "type"; type: "RequestType"; isReadonly: true } + Property { name: "accepted"; type: "bool" } + } + Component { name: "QQuickWebEngineView" defaultProperty: "data" prototype: "QQuickItem" exports: [ "QtWebEngine/WebEngineView 1.0", "QtWebEngine/WebEngineView 1.1", + "QtWebEngine/WebEngineView 1.10", "QtWebEngine/WebEngineView 1.2", "QtWebEngine/WebEngineView 1.3", "QtWebEngine/WebEngineView 1.4", @@ -719,7 +1021,7 @@ Module { "QtWebEngine/WebEngineView 1.8", "QtWebEngine/WebEngineView 1.9" ] - exportMetaObjectRevisions: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + exportMetaObjectRevisions: [0, 1, 10, 2, 3, 4, 5, 6, 7, 8, 9] Enum { name: "NavigationRequestAction" values: { @@ -735,7 +1037,8 @@ Module { "FormSubmittedNavigation": 2, "BackForwardNavigation": 3, "ReloadNavigation": 4, - "OtherNavigation": 5 + "OtherNavigation": 5, + "RedirectNavigation": 6 } } Enum { @@ -994,6 +1297,14 @@ Module { "Landscape": 1 } } + Enum { + name: "LifecycleState" + values: { + "Active": 0, + "Frozen": 1, + "Discarded": 2 + } + } Property { name: "url"; type: "QUrl" } Property { name: "icon"; type: "QUrl"; isReadonly: true } Property { name: "loading"; type: "bool"; isReadonly: true } @@ -1035,7 +1346,8 @@ Module { Property { name: "webChannelWorld"; revision: 3; type: "uint" } Property { name: "inspectedView"; revision: 7; type: "QQuickWebEngineView"; isPointer: true } Property { name: "devToolsView"; revision: 7; type: "QQuickWebEngineView"; isPointer: true } - Property { name: "testSupport"; type: "QQuickWebEngineTestSupport"; isPointer: true } + Property { name: "lifecycleState"; revision: 10; type: "LifecycleState" } + Property { name: "recommendedState"; revision: 10; type: "LifecycleState"; isReadonly: true } Signal { name: "loadingChanged" Parameter { name: "loadRequest"; type: "QQuickWebEngineLoadRequest"; isPointer: true } @@ -1194,6 +1506,26 @@ Module { isPointer: true } } + Signal { + name: "tooltipRequested" + revision: 10 + Parameter { name: "request"; type: "QQuickWebEngineTooltipRequest"; isPointer: true } + } + Signal { + name: "lifecycleStateChanged" + revision: 10 + Parameter { name: "state"; type: "LifecycleState" } + } + Signal { + name: "recommendedStateChanged" + revision: 10 + Parameter { name: "state"; type: "LifecycleState" } + } + Signal { + name: "findTextFinished" + revision: 10 + Parameter { name: "result"; type: "QWebEngineFindTextResult" } + } Method { name: "runJavaScript" Parameter { type: "string" } @@ -1320,26 +1652,25 @@ Module { } } Component { + name: "QWebEngineFindTextResult" + exports: ["QtWebEngine/FindTextResult 1.10"] + isCreatable: false + exportMetaObjectRevisions: [0] + Property { name: "numberOfMatches"; type: "int"; isReadonly: true } + Property { name: "activeMatchOrdinal"; type: "int"; isReadonly: true } + } + Component { name: "QWebEngineNotification" prototype: "QObject" exports: ["QtWebEngine/WebEngineNotification 1.9"] isCreatable: false exportMetaObjectRevisions: [0] - Enum { - name: "Direction" - values: { - "LeftToRight": 0, - "RightToLeft": 1, - "DirectionAuto": 2 - } - } Property { name: "origin"; type: "QUrl"; isReadonly: true } - Property { name: "icon"; type: "QIcon"; isReadonly: true } Property { name: "title"; type: "string"; isReadonly: true } Property { name: "message"; type: "string"; isReadonly: true } Property { name: "tag"; type: "string"; isReadonly: true } Property { name: "language"; type: "string"; isReadonly: true } - Property { name: "direction"; type: "Direction"; isReadonly: true } + Property { name: "direction"; type: "Qt::LayoutDirection"; isReadonly: true } Signal { name: "closed" } Method { name: "show" } Method { name: "click" } diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.cpp b/src/webenginewidgets/api/qwebenginecertificateerror.cpp index 45277e19d..3f20b6483 100644 --- a/src/webenginewidgets/api/qwebenginecertificateerror.cpp +++ b/src/webenginewidgets/api/qwebenginecertificateerror.cpp @@ -79,7 +79,7 @@ public: QUrl url; bool overridable; QString errorDescription; - QList<QSslCertificate> chain; + QList<QSslCertificate> certificateChain; bool answered = false, deferred = false; QWeakPointer<CertificateErrorController> controller; @@ -107,7 +107,7 @@ QWebEngineCertificateError::QWebEngineCertificateError(const QSharedPointer<Cert controller->overridable(), controller->errorString())) { d->controller = controller; - d->chain = controller->chain(); + d->certificateChain = controller->certificateChain(); } QWebEngineCertificateError::QWebEngineCertificateError(const QWebEngineCertificateError &) = default; @@ -255,9 +255,9 @@ bool QWebEngineCertificateError::answered() const Chain starts with the peer's immediate certificate and ending with the CA's certificate. */ -QList<QSslCertificate> QWebEngineCertificateError::chain() const +QList<QSslCertificate> QWebEngineCertificateError::certificateChain() const { - return d->chain; + return d->certificateChain; } QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebenginecertificateerror.h b/src/webenginewidgets/api/qwebenginecertificateerror.h index b2dd65a9f..d3a19edfc 100644 --- a/src/webenginewidgets/api/qwebenginecertificateerror.h +++ b/src/webenginewidgets/api/qwebenginecertificateerror.h @@ -90,7 +90,7 @@ public: void ignoreCertificateError(); bool answered() const; - QList<QSslCertificate> chain() const; + QList<QSslCertificate> certificateChain() const; private: friend class QWebEnginePagePrivate; diff --git a/src/webenginewidgets/api/qwebenginedownloaditem.h b/src/webenginewidgets/api/qwebenginedownloaditem.h index 27fca6f8a..8d98799a3 100644 --- a/src/webenginewidgets/api/qwebenginedownloaditem.h +++ b/src/webenginewidgets/api/qwebenginedownloaditem.h @@ -118,8 +118,12 @@ public: qint64 receivedBytes() const; QUrl url() const; QString mimeType() const; - QString Q_DECL_DEPRECATED path() const; - void Q_DECL_DEPRECATED setPath(QString path); +#if QT_DEPRECATED_SINCE(5, 14) + QT_DEPRECATED_VERSION_X(5, 14, "Use downloadDirectory() and downloadFileName() instead") + QString path() const; + QT_DEPRECATED_VERSION_X(5, 14, "Use setDownloadDirectory() and setDownloadFileName() instead") + void setPath(QString path); +#endif bool isFinished() const; bool isPaused() const; SavePageFormat savePageFormat() const; diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index db3efa521..524df0425 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -2671,16 +2671,13 @@ void QContextMenuBuilder::addMenuItem(ContextMenuItem menuItem) switch (menuItem) { case ContextMenuItem::Back: - action = new QAction(QIcon::fromTheme(QStringLiteral("go-previous")), QWebEnginePage::tr("&Back"), m_menu); - QObject::connect(action, &QAction::triggered, thisRef->d_ptr->view, &QWebEngineView::back); + action = thisRef->action(QWebEnginePage::Back); break; case ContextMenuItem::Forward: - action = new QAction(QIcon::fromTheme(QStringLiteral("go-next")), QWebEnginePage::tr("&Forward"), m_menu); - QObject::connect(action, &QAction::triggered, thisRef->d_ptr->view, &QWebEngineView::forward); + action = thisRef->action(QWebEnginePage::Forward); break; case ContextMenuItem::Reload: - action = new QAction(QIcon::fromTheme(QStringLiteral("view-refresh")), QWebEnginePage::tr("&Reload"), m_menu); - QObject::connect(action, &QAction::triggered, thisRef->d_ptr->view, &QWebEngineView::reload); + action = thisRef->action(QWebEnginePage::Reload); break; case ContextMenuItem::Cut: action = thisRef->action(QWebEnginePage::Cut); |