diff options
77 files changed, 271 insertions, 280 deletions
diff --git a/src/3rdparty b/src/3rdparty -Subproject 10fd63a07a381a3ab3b27ef8906817173e3ffbb +Subproject 3d95374cb8de20b3e15538f1ecb5b78bf9d1cdc diff --git a/src/core/api/qtwebenginecoreglobal.cpp b/src/core/api/qtwebenginecoreglobal.cpp index 3544ae10f..abdb92e28 100644 --- a/src/core/api/qtwebenginecoreglobal.cpp +++ b/src/core/api/qtwebenginecoreglobal.cpp @@ -89,7 +89,7 @@ static void deleteShareContext() // after the QGuiApplication creation, when AA_ShareOpenGLContexts fills // the same need but the flag has to be set earlier. -QWEBENGINECORE_PRIVATE_EXPORT void initialize() +Q_WEBENGINECORE_PRIVATE_EXPORT void initialize() { #ifndef QT_NO_OPENGL #ifdef Q_OS_WIN32 diff --git a/src/core/api/qtwebenginecoreglobal.h b/src/core/api/qtwebenginecoreglobal.h index bcff622b7..c425d1478 100644 --- a/src/core/api/qtwebenginecoreglobal.h +++ b/src/core/api/qtwebenginecoreglobal.h @@ -46,9 +46,9 @@ QT_BEGIN_NAMESPACE #if defined(BUILDING_CHROMIUM) -# define QWEBENGINECORE_EXPORT Q_DECL_EXPORT +# define Q_WEBENGINECORE_EXPORT Q_DECL_EXPORT #else -# define QWEBENGINECORE_EXPORT Q_DECL_IMPORT +# define Q_WEBENGINECORE_EXPORT Q_DECL_IMPORT #endif #define ASSERT_ENUMS_MATCH(A, B) Q_STATIC_ASSERT_X(static_cast<int>(A) == static_cast<int>(B), "The enum values must match"); diff --git a/src/core/api/qtwebenginecoreglobal_p.h b/src/core/api/qtwebenginecoreglobal_p.h index 27bf2d9f9..655b2a814 100644 --- a/src/core/api/qtwebenginecoreglobal_p.h +++ b/src/core/api/qtwebenginecoreglobal_p.h @@ -63,6 +63,6 @@ #define QT_NOT_USED Q_UNREACHABLE(); // This will assert in debug. #endif -#define QWEBENGINECORE_PRIVATE_EXPORT QWEBENGINECORE_EXPORT +#define Q_WEBENGINECORE_PRIVATE_EXPORT Q_WEBENGINECORE_EXPORT #endif // QTWEBENGINECOREGLOBAL_P_H diff --git a/src/core/api/qwebengineclientcertificatestore.h b/src/core/api/qwebengineclientcertificatestore.h index d9a1a0545..68705e80b 100644 --- a/src/core/api/qwebengineclientcertificatestore.h +++ b/src/core/api/qwebengineclientcertificatestore.h @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE #if QT_CONFIG(ssl) -class QWEBENGINECORE_EXPORT QWebEngineClientCertificateStore { +class Q_WEBENGINECORE_EXPORT QWebEngineClientCertificateStore { public: void add(const QSslCertificate &certificate, const QSslKey &privateKey); diff --git a/src/core/api/qwebenginecookiestore.h b/src/core/api/qwebenginecookiestore.h index 89e72dfb0..36bb64ccf 100644 --- a/src/core/api/qwebenginecookiestore.h +++ b/src/core/api/qwebenginecookiestore.h @@ -57,7 +57,7 @@ class CookieMonsterDelegateQt; QT_BEGIN_NAMESPACE class QWebEngineCookieStorePrivate; -class QWEBENGINECORE_EXPORT QWebEngineCookieStore : public QObject { +class Q_WEBENGINECORE_EXPORT QWebEngineCookieStore : public QObject { Q_OBJECT public: diff --git a/src/core/api/qwebenginecookiestore_p.h b/src/core/api/qwebenginecookiestore_p.h index 93198d8ed..3df0e3590 100644 --- a/src/core/api/qwebenginecookiestore_p.h +++ b/src/core/api/qwebenginecookiestore_p.h @@ -66,7 +66,7 @@ class CookieMonsterDelegateQt; QT_BEGIN_NAMESPACE -class QWEBENGINECORE_PRIVATE_EXPORT QWebEngineCookieStorePrivate +class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineCookieStorePrivate { Q_DECLARE_PUBLIC(QWebEngineCookieStore) struct CookieData { diff --git a/src/core/api/qwebenginehttprequest.h b/src/core/api/qwebenginehttprequest.h index c6b5a6b63..8735dfb8e 100644 --- a/src/core/api/qwebenginehttprequest.h +++ b/src/core/api/qwebenginehttprequest.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QWebEngineHttpRequestPrivate; -class QWEBENGINECORE_EXPORT QWebEngineHttpRequest +class Q_WEBENGINECORE_EXPORT QWebEngineHttpRequest { public: enum Method { diff --git a/src/core/api/qwebenginemessagepumpscheduler_p.h b/src/core/api/qwebenginemessagepumpscheduler_p.h index 4c9e4d600..46ed62f54 100644 --- a/src/core/api/qwebenginemessagepumpscheduler_p.h +++ b/src/core/api/qwebenginemessagepumpscheduler_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE -class QWEBENGINECORE_PRIVATE_EXPORT QWebEngineMessagePumpScheduler : public QObject +class Q_WEBENGINECORE_PRIVATE_EXPORT QWebEngineMessagePumpScheduler : public QObject { Q_OBJECT public: diff --git a/src/core/api/qwebenginenotification.cpp b/src/core/api/qwebenginenotification.cpp index 89fd1eff9..0b1d48ce9 100644 --- a/src/core/api/qwebenginenotification.cpp +++ b/src/core/api/qwebenginenotification.cpp @@ -58,8 +58,8 @@ using QtWebEngineCore::UserNotificationController; Web engine notifications are passed to the user in the \l QWebEngineProfile::setNotificationPresenter() and - \l QQuickWebEngineProfile::userNotification() calls and the - \l WebEngineProfile::userNotification() signal. + \l QQuickWebEngineProfile::presentNotification() calls and the + \l WebEngineProfile::presentNotification() signal. */ class QWebEngineNotificationPrivate : public UserNotificationController::Client { @@ -77,7 +77,7 @@ public: } // UserNotificationController::Client: - virtual void notificationClosed(const UserNotificationController *) Q_DECL_OVERRIDE + virtual void notificationClosed(const UserNotificationController *) override { Q_EMIT q->closed(); } @@ -86,14 +86,6 @@ public: QWebEngineNotification *q; }; - -/*! - Creates a null QWebEngineNotification. - - \sa isNull() -*/ -QWebEngineNotification::QWebEngineNotification() { } - /*! \internal */ QWebEngineNotification::QWebEngineNotification(const QSharedPointer<UserNotificationController> &controller) @@ -102,25 +94,10 @@ QWebEngineNotification::QWebEngineNotification(const QSharedPointer<UserNotifica /*! \internal */ -QWebEngineNotification::QWebEngineNotification(const QWebEngineNotification &other) - : QObject() - , d_ptr(new QWebEngineNotificationPrivate(this, other.d_ptr->controller)) -{ } - -/*! \internal -*/ QWebEngineNotification::~QWebEngineNotification() { } -/*! \internal -*/ -const QWebEngineNotification &QWebEngineNotification::operator=(const QWebEngineNotification &other) -{ - d_ptr.reset(new QWebEngineNotificationPrivate(this, other.d_ptr->controller)); - return *this; -} - /*! Returns \c true if the two notifications belong to the same message chain. That is, if their tag() and origin() are the same. This means one is @@ -128,13 +105,15 @@ const QWebEngineNotification &QWebEngineNotification::operator=(const QWebEngine \sa tag(), origin() */ -bool QWebEngineNotification::matches(const QWebEngineNotification &other) const +bool QWebEngineNotification::matches(const QWebEngineNotification *other) const { + if (!other) + return false; if (!d_ptr) - return !other.d_ptr; - if (!other.d_ptr) + return !other->d_ptr; + if (!other->d_ptr) return false; - return tag() == other.tag() && origin() == other.origin(); + return tag() == other->tag() && origin() == other->origin(); } /*! @@ -187,15 +166,14 @@ QUrl QWebEngineNotification::origin() const } /*! - \property QWebEngineNotification::icon - \brief The icon to be shown with the notification. + Returns the icon to be shown with the notification. - If no icon is set by the sender, an null QIcon is returned. + If no icon is set by the sender, a null QImage is returned. */ -QIcon QWebEngineNotification::icon() const +QImage QWebEngineNotification::icon() const { Q_D(const QWebEngineNotification); - return d ? d->controller->icon() : QIcon(); + return d ? d->controller->icon() : QImage(); } /*! @@ -224,14 +202,6 @@ Qt::LayoutDirection QWebEngineNotification::direction() const } /*! - Returns \c true if the notification is not a default constructed null notification. -*/ -bool QWebEngineNotification::isValid() const -{ - return !d_ptr.isNull(); -} - -/*! Creates and dispatches a JavaScript \e {show event} on notification. Should be called by the notification platform when the notification has been shown to user. diff --git a/src/core/api/qwebenginenotification.h b/src/core/api/qwebenginenotification.h index 0012e5d78..08fd629be 100644 --- a/src/core/api/qwebenginenotification.h +++ b/src/core/api/qwebenginenotification.h @@ -46,7 +46,6 @@ #include <QtCore/QScopedPointer> #include <QtCore/QSharedPointer> #include <QtCore/QUrl> -#include <QtGui/QIcon> namespace QtWebEngineCore { class UserNotificationController; @@ -56,10 +55,9 @@ QT_BEGIN_NAMESPACE class QWebEngineNotificationPrivate; -class QWEBENGINECORE_EXPORT QWebEngineNotification : public QObject { +class Q_WEBENGINECORE_EXPORT QWebEngineNotification : public QObject { Q_OBJECT Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL) - Q_PROPERTY(QIcon icon READ icon CONSTANT FINAL) Q_PROPERTY(QString title READ title CONSTANT FINAL) Q_PROPERTY(QString message READ message CONSTANT FINAL) Q_PROPERTY(QString tag READ tag CONSTANT FINAL) @@ -67,23 +65,18 @@ class QWEBENGINECORE_EXPORT QWebEngineNotification : public QObject { Q_PROPERTY(Qt::LayoutDirection direction READ direction CONSTANT FINAL) public: - QWebEngineNotification(); - QWebEngineNotification(const QWebEngineNotification &other); - virtual ~QWebEngineNotification(); - const QWebEngineNotification &operator=(const QWebEngineNotification &other); + virtual ~QWebEngineNotification() override; - bool matches(const QWebEngineNotification &other) const; + bool matches(const QWebEngineNotification *other) const; QUrl origin() const; - QIcon icon() const; + QImage icon() const; QString title() const; QString message() const; QString tag() const; QString language() const; Qt::LayoutDirection direction() const; - bool isValid() const; - public Q_SLOTS: void show() const; void click() const; @@ -93,8 +86,9 @@ Q_SIGNALS: void closed(); private: - QWebEngineNotification(const QSharedPointer<QtWebEngineCore::UserNotificationController> &controller); + Q_DISABLE_COPY(QWebEngineNotification) Q_DECLARE_PRIVATE(QWebEngineNotification) + QWebEngineNotification(const QSharedPointer<QtWebEngineCore::UserNotificationController> &controller); QScopedPointer<QWebEngineNotificationPrivate> d_ptr; friend class QQuickWebEngineProfilePrivate; friend class QWebEngineProfilePrivate; diff --git a/src/core/api/qwebenginequotarequest.h b/src/core/api/qwebenginequotarequest.h index a759f5bb6..1f6333b3b 100644 --- a/src/core/api/qwebenginequotarequest.h +++ b/src/core/api/qwebenginequotarequest.h @@ -51,7 +51,7 @@ class QuotaRequestController; QT_BEGIN_NAMESPACE -class QWEBENGINECORE_EXPORT QWebEngineQuotaRequest { +class Q_WEBENGINECORE_EXPORT QWebEngineQuotaRequest { Q_GADGET Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL) Q_PROPERTY(qint64 requestedSize READ requestedSize CONSTANT FINAL) diff --git a/src/core/api/qwebengineregisterprotocolhandlerrequest.h b/src/core/api/qwebengineregisterprotocolhandlerrequest.h index 12b1d6edf..281e81e73 100644 --- a/src/core/api/qwebengineregisterprotocolhandlerrequest.h +++ b/src/core/api/qwebengineregisterprotocolhandlerrequest.h @@ -51,7 +51,7 @@ class WebContentsDelegateQt; QT_BEGIN_NAMESPACE -class QWEBENGINECORE_EXPORT QWebEngineRegisterProtocolHandlerRequest { +class Q_WEBENGINECORE_EXPORT QWebEngineRegisterProtocolHandlerRequest { Q_GADGET Q_PROPERTY(QUrl origin READ origin CONSTANT FINAL) Q_PROPERTY(QString scheme READ scheme CONSTANT FINAL) diff --git a/src/core/api/qwebengineurlrequestinfo.h b/src/core/api/qwebengineurlrequestinfo.h index e1f9ca6ef..f37693cda 100644 --- a/src/core/api/qwebengineurlrequestinfo.h +++ b/src/core/api/qwebengineurlrequestinfo.h @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE class QWebEngineUrlRequestInfoPrivate; -class QWEBENGINECORE_EXPORT QWebEngineUrlRequestInfo { +class Q_WEBENGINECORE_EXPORT QWebEngineUrlRequestInfo { public: enum ResourceType { ResourceTypeMainFrame = 0, // top level page diff --git a/src/core/api/qwebengineurlrequestinterceptor.h b/src/core/api/qwebengineurlrequestinterceptor.h index 2b07681ca..027486b40 100644 --- a/src/core/api/qwebengineurlrequestinterceptor.h +++ b/src/core/api/qwebengineurlrequestinterceptor.h @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE -class QWEBENGINECORE_EXPORT QWebEngineUrlRequestInterceptor : public QObject +class Q_WEBENGINECORE_EXPORT QWebEngineUrlRequestInterceptor : public QObject { Q_OBJECT Q_DISABLE_COPY(QWebEngineUrlRequestInterceptor) diff --git a/src/core/api/qwebengineurlrequestjob.h b/src/core/api/qwebengineurlrequestjob.h index b2dd8baa3..dee09b6e1 100644 --- a/src/core/api/qwebengineurlrequestjob.h +++ b/src/core/api/qwebengineurlrequestjob.h @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE class QIODevice; -class QWEBENGINECORE_EXPORT QWebEngineUrlRequestJob : public QObject { +class Q_WEBENGINECORE_EXPORT QWebEngineUrlRequestJob : public QObject { Q_OBJECT public: ~QWebEngineUrlRequestJob(); diff --git a/src/core/api/qwebengineurlscheme.h b/src/core/api/qwebengineurlscheme.h index da3010335..f3ceb0596 100644 --- a/src/core/api/qwebengineurlscheme.h +++ b/src/core/api/qwebengineurlscheme.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QWebEngineUrlSchemePrivate; -class QWEBENGINECORE_EXPORT QWebEngineUrlScheme { +class Q_WEBENGINECORE_EXPORT QWebEngineUrlScheme { Q_GADGET public: enum class Syntax { diff --git a/src/core/api/qwebengineurlschemehandler.h b/src/core/api/qwebengineurlschemehandler.h index 549778561..be80241f1 100644 --- a/src/core/api/qwebengineurlschemehandler.h +++ b/src/core/api/qwebengineurlschemehandler.h @@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE class QWebEngineUrlRequestJob; -class QWEBENGINECORE_EXPORT QWebEngineUrlSchemeHandler : public QObject { +class Q_WEBENGINECORE_EXPORT QWebEngineUrlSchemeHandler : public QObject { Q_OBJECT public: QWebEngineUrlSchemeHandler(QObject *parent = Q_NULLPTR); diff --git a/src/core/authentication_dialog_controller.h b/src/core/authentication_dialog_controller.h index aec91aac5..631a95c34 100644 --- a/src/core/authentication_dialog_controller.h +++ b/src/core/authentication_dialog_controller.h @@ -59,7 +59,7 @@ namespace QtWebEngineCore { class AuthenticationDialogControllerPrivate; -class QWEBENGINECORE_PRIVATE_EXPORT AuthenticationDialogController : public QObject { +class Q_WEBENGINECORE_PRIVATE_EXPORT AuthenticationDialogController : public QObject { Q_OBJECT public: ~AuthenticationDialogController(); diff --git a/src/core/certificate_error_controller.h b/src/core/certificate_error_controller.h index 6e1e87cb0..5bea61c9b 100644 --- a/src/core/certificate_error_controller.h +++ b/src/core/certificate_error_controller.h @@ -60,7 +60,7 @@ QT_BEGIN_NAMESPACE class CertificateErrorControllerPrivate; -class QWEBENGINECORE_PRIVATE_EXPORT CertificateErrorController { +class Q_WEBENGINECORE_PRIVATE_EXPORT CertificateErrorController { public: CertificateErrorController(CertificateErrorControllerPrivate *p); ~CertificateErrorController(); diff --git a/src/core/client_cert_select_controller.h b/src/core/client_cert_select_controller.h index 8f4f78d94..f121c1155 100644 --- a/src/core/client_cert_select_controller.h +++ b/src/core/client_cert_select_controller.h @@ -72,7 +72,7 @@ class SSLCertRequestInfo; QT_BEGIN_NAMESPACE -class QWEBENGINECORE_PRIVATE_EXPORT ClientCertSelectController { +class Q_WEBENGINECORE_PRIVATE_EXPORT ClientCertSelectController { public: ClientCertSelectController(net::SSLCertRequestInfo *certRequestInfo, std::vector<std::unique_ptr<net::ClientCertIdentity>> clientCerts, diff --git a/src/core/color_chooser_controller.h b/src/core/color_chooser_controller.h index e5daa09a8..66222bb77 100644 --- a/src/core/color_chooser_controller.h +++ b/src/core/color_chooser_controller.h @@ -62,7 +62,7 @@ namespace QtWebEngineCore { class ColorChooserControllerPrivate; -class QWEBENGINECORE_PRIVATE_EXPORT ColorChooserController : public QObject { +class Q_WEBENGINECORE_PRIVATE_EXPORT ColorChooserController : public QObject { Q_OBJECT public: ~ColorChooserController(); diff --git a/src/core/compositor/delegated_frame_node.cpp b/src/core/compositor/delegated_frame_node.cpp index 4fb05051b..5f474cbfb 100644 --- a/src/core/compositor/delegated_frame_node.cpp +++ b/src/core/compositor/delegated_frame_node.cpp @@ -1019,6 +1019,7 @@ QSGTexture *DelegatedFrameNode::initAndHoldTexture(const CompositorResource *res texture->setFiltering(filtering); return texture.data(); } else { +#if QT_CONFIG(opengl) QSharedPointer<MailboxTexture> &texture = findTexture(m_sgObjects.mailboxTextures, m_previousSGObjects.mailboxTextures, resource->id); if (texture) @@ -1026,6 +1027,10 @@ QSGTexture *DelegatedFrameNode::initAndHoldTexture(const CompositorResource *res texture = createMailboxTexture(resource, hasAlphaChannel, target); texture->setFiltering(filtering); return texture.data(); +#else + Q_UNREACHABLE(); + return nullptr; +#endif } } diff --git a/src/core/configure.json b/src/core/configure.json index f111247e4..6bc6a213c 100644 --- a/src/core/configure.json +++ b/src/core/configure.json @@ -86,9 +86,9 @@ ] }, "webengine-harfbuzz": { - "label": "harfbuzz >= 2.0.0", + "label": "harfbuzz >= 2.2.0", "sources": [ - { "type": "pkgConfig", "args": "harfbuzz >= 2.0.0" } + { "type": "pkgConfig", "args": "harfbuzz >= 2.2.0" } ] }, "webengine-glib": { diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp index 0977f5afb..9eedee42a 100644 --- a/src/core/devtools_frontend_qt.cpp +++ b/src/core/devtools_frontend_qt.cpp @@ -48,6 +48,7 @@ #include "profile_qt.h" #include "web_contents_adapter.h" +#include "base/base64.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" #include "base/json/string_escape.h" @@ -73,12 +74,10 @@ #include "content/public/common/content_client.h" #include "content/public/common/url_constants.h" #include "ipc/ipc_channel.h" -#include "net/base/io_buffer.h" -#include "net/base/net_errors.h" #include "net/http/http_response_headers.h" #include "net/traffic_annotation/network_traffic_annotation.h" -#include "net/url_request/url_fetcher.h" -#include "net/url_request/url_fetcher_response_writer.h" +#include "services/network/public/cpp/simple_url_loader.h" +#include "services/network/public/cpp/simple_url_loader_stream_consumer.h" #include <QDebug> using namespace QtWebEngineCore; @@ -103,66 +102,77 @@ std::unique_ptr<base::DictionaryValue> BuildObjectForResponse(const net::HttpRes return response; } -// ResponseWriter ------------------------------------------------------------- - -class ResponseWriter : public net::URLFetcherResponseWriter { -public: - ResponseWriter(base::WeakPtr<DevToolsFrontendQt> shell_devtools_, int stream_id); - ~ResponseWriter() override; - - // URLFetcherResponseWriter overrides: - int Initialize(net::CompletionOnceCallback callback) override; - int Write(net::IOBuffer *buffer, int num_bytes, net::CompletionOnceCallback callback) override; - int Finish(int net_error, net::CompletionOnceCallback callback) override; +static std::string GetFrontendURL() +{ + return "chrome-devtools://devtools/bundled/devtools_app.html"; +} -private: - base::WeakPtr<DevToolsFrontendQt> shell_devtools_; - int stream_id_; +} // namespace - DISALLOW_COPY_AND_ASSIGN(ResponseWriter); -}; +namespace QtWebEngineCore { -ResponseWriter::ResponseWriter(base::WeakPtr<DevToolsFrontendQt> shell_devtools, int stream_id) - : shell_devtools_(shell_devtools), stream_id_(stream_id) -{} +class DevToolsFrontendQt::NetworkResourceLoader + : public network::SimpleURLLoaderStreamConsumer { +public: + NetworkResourceLoader(int stream_id, + int request_id, + DevToolsFrontendQt *bindings, + std::unique_ptr<network::SimpleURLLoader> loader, + network::mojom::URLLoaderFactory *url_loader_factory) + : stream_id_(stream_id), + request_id_(request_id), + bindings_(bindings), + loader_(std::move(loader)) + { + loader_->SetOnResponseStartedCallback(base::BindOnce( + &NetworkResourceLoader::OnResponseStarted, base::Unretained(this))); + loader_->DownloadAsStream(url_loader_factory, this); + } -ResponseWriter::~ResponseWriter() {} +private: + void OnResponseStarted(const GURL &final_url, + const network::ResourceResponseHead &response_head) + { + response_headers_ = response_head.headers; + } -int ResponseWriter::Initialize(net::CompletionOnceCallback callback) -{ - return net::OK; -} + void OnDataReceived(base::StringPiece chunk, base::OnceClosure resume) override + { + base::Value chunkValue; + + bool encoded = !base::IsStringUTF8(chunk); + if (encoded) { + std::string encoded_string; + base::Base64Encode(chunk, &encoded_string); + chunkValue = base::Value(std::move(encoded_string)); + } else { + chunkValue = base::Value(chunk); + } + base::Value id(stream_id_); + base::Value encodedValue(encoded); -int ResponseWriter::Write(net::IOBuffer *buffer, int num_bytes, net::CompletionOnceCallback callback) -{ - std::string chunk = std::string(buffer->data(), num_bytes); - if (!base::IsStringUTF8(chunk)) - return num_bytes; - - base::Value *id = new base::Value(stream_id_); - base::Value *chunkValue = new base::Value(chunk); - - base::PostTaskWithTraits( - FROM_HERE, {content::BrowserThread::UI}, - base::BindOnce(&DevToolsFrontendQt::CallClientFunction, - shell_devtools_, "DevToolsAPI.streamWrite", - base::Owned(id), base::Owned(chunkValue), nullptr)); - return num_bytes; -} + bindings_->CallClientFunction("DevToolsAPI.streamWrite", &id, &chunkValue, &encodedValue); + std::move(resume).Run(); + } -int ResponseWriter::Finish(int net_error, net::CompletionOnceCallback callback) -{ - return net::OK; -} + void OnComplete(bool success) override + { + Q_UNUSED(success); + auto response = BuildObjectForResponse(response_headers_.get()); + bindings_->SendMessageAck(request_id_, response.get()); + bindings_->m_loaders.erase(bindings_->m_loaders.find(this)); + } -static std::string GetFrontendURL() -{ - return "chrome-devtools://devtools/bundled/devtools_app.html"; -} + void OnRetry(base::OnceClosure start_retry) override { NOTREACHED(); } -} // namespace + const int stream_id_; + const int request_id_; + DevToolsFrontendQt *const bindings_; + std::unique_ptr<network::SimpleURLLoader> loader_; + scoped_refptr<net::HttpResponseHeaders> response_headers_; -namespace QtWebEngineCore { + DISALLOW_COPY_AND_ASSIGN(NetworkResourceLoader); +}; // This constant should be in sync with // the constant at devtools_ui_bindings.cc. @@ -222,8 +232,6 @@ DevToolsFrontendQt::DevToolsFrontendQt(QSharedPointer<WebContentsAdapter> webCon DevToolsFrontendQt::~DevToolsFrontendQt() { - for (const auto &pair : m_pendingRequests) - delete pair.first; } void DevToolsFrontendQt::Activate() @@ -400,20 +408,29 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(const std::string &me setting: "It's not possible to disable this feature from settings." chrome_policy { - DeveloperToolsDisabled { + DeveloperToolsAvailability { policy_options {mode: MANDATORY} - DeveloperToolsDisabled: true + DeveloperToolsAvailability: 2 } } })"); - net::URLFetcher *fetcher = net::URLFetcher::Create(gurl, net::URLFetcher::GET, this, traffic_annotation).release(); - m_pendingRequests[fetcher] = request_id; - fetcher->SetRequestContext(content::BrowserContext::GetDefaultStoragePartition( - web_contents()->GetBrowserContext())->GetURLRequestContext()); - fetcher->SetExtraRequestHeaders(headers); - fetcher->SaveResponseWithWriter(std::unique_ptr<net::URLFetcherResponseWriter>( - new ResponseWriter(m_weakFactory.GetWeakPtr(), stream_id))); - fetcher->Start(); + auto resource_request = std::make_unique<network::ResourceRequest>(); + resource_request->url = gurl; + // TODO(caseq): this preserves behavior of URLFetcher-based implementation. + // We really need to pass proper first party origin from the front-end. + resource_request->site_for_cookies = gurl; + resource_request->headers.AddHeadersFromString(headers); + + auto *partition = content::BrowserContext::GetStoragePartitionForSite( + web_contents()->GetBrowserContext(), gurl); + auto factory = partition->GetURLLoaderFactoryForBrowserProcess(); + + auto simple_url_loader = network::SimpleURLLoader::Create( + std::move(resource_request), traffic_annotation); + auto resource_loader = std::make_unique<NetworkResourceLoader>( + stream_id, request_id, this, std::move(simple_url_loader), + factory.get()); + m_loaders.insert(std::move(resource_loader)); return; } else if (method == "getPreferences") { m_preferences = std::move(*m_prefStore->GetValues()); @@ -493,21 +510,6 @@ void DevToolsFrontendQt::DispatchProtocolMessage(content::DevToolsAgentHost *age } } -void DevToolsFrontendQt::OnURLFetchComplete(const net::URLFetcher *source) -{ - // TODO(pfeldman): this is a copy of chrome's devtools_ui_bindings.cc. - // We should handle some of the commands including this one in content. - DCHECK(source); - PendingRequestsMap::iterator it = m_pendingRequests.find(source); - DCHECK(it != m_pendingRequests.end()); - - auto response = BuildObjectForResponse(source->GetResponseHeaders()); - - SendMessageAck(it->second, response.get()); - m_pendingRequests.erase(it); - delete source; -} - void DevToolsFrontendQt::CallClientFunction(const std::string &function_name, const base::Value *arg1, const base::Value *arg2, diff --git a/src/core/devtools_frontend_qt.h b/src/core/devtools_frontend_qt.h index 88cc7aeac..fed2d47fc 100644 --- a/src/core/devtools_frontend_qt.h +++ b/src/core/devtools_frontend_qt.h @@ -41,10 +41,12 @@ #define DEVTOOLS_FRONTEND_QT_H #include <memory> +#include <set> #include "web_contents_delegate_qt.h" #include "base/compiler_specific.h" +#include "base/containers/unique_ptr_adapters.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" @@ -52,7 +54,6 @@ #include "content/public/browser/devtools_agent_host.h" #include "content/public/browser/devtools_frontend_host.h" #include "content/public/browser/web_contents_observer.h" -#include "net/url_request/url_fetcher_delegate.h" namespace base { class Value; @@ -69,8 +70,7 @@ class PersistentPrefStore; namespace QtWebEngineCore { class DevToolsFrontendQt : public content::WebContentsObserver - , public content::DevToolsAgentHostClient - , public net::URLFetcherDelegate { + , public content::DevToolsAgentHostClient { public: static DevToolsFrontendQt *Show(QSharedPointer<WebContentsAdapter> frontendAdapter, content::WebContents *inspectedContents); @@ -108,9 +108,6 @@ private: void DocumentAvailableInMainFrame() override; void WebContentsDestroyed() override; - // net::URLFetcherDelegate overrides. - void OnURLFetchComplete(const net::URLFetcher* source) override; - void SendMessageAck(int request_id, const base::Value* arg1); void SetPreference(const std::string &name, const std::string &value); void RemovePreference(const std::string &name); @@ -125,8 +122,10 @@ private: int m_inspect_element_at_x; int m_inspect_element_at_y; std::unique_ptr<content::DevToolsFrontendHost> m_frontendHost; - using PendingRequestsMap = std::map<const net::URLFetcher*, int>; - PendingRequestsMap m_pendingRequests; + + class NetworkResourceLoader; + std::set<std::unique_ptr<NetworkResourceLoader>, base::UniquePtrComparator> m_loaders; + base::DictionaryValue m_preferences; scoped_refptr<PersistentPrefStore> m_prefStore; base::WeakPtrFactory<DevToolsFrontendQt> m_weakFactory; diff --git a/src/core/favicon_manager.h b/src/core/favicon_manager.h index 60d194c4b..75d6aa75b 100644 --- a/src/core/favicon_manager.h +++ b/src/core/favicon_manager.h @@ -82,7 +82,7 @@ namespace QtWebEngineCore { class WebContentsAdapterClient; // Based on src/3rdparty/chromium/content/public/common/favicon_url.h -class QWEBENGINECORE_PRIVATE_EXPORT FaviconInfo { +class Q_WEBENGINECORE_PRIVATE_EXPORT FaviconInfo { public: enum FaviconTypeFlag { InvalidIcon = 0, @@ -109,7 +109,7 @@ public: }; -class QWEBENGINECORE_PRIVATE_EXPORT FaviconManager { +class Q_WEBENGINECORE_PRIVATE_EXPORT FaviconManager { public: FaviconManager(content::WebContents *, WebContentsAdapterClient *); diff --git a/src/core/file_picker_controller.h b/src/core/file_picker_controller.h index 613d3ad9b..dc8c0eddf 100644 --- a/src/core/file_picker_controller.h +++ b/src/core/file_picker_controller.h @@ -64,7 +64,7 @@ namespace content { namespace QtWebEngineCore { -class QWEBENGINECORE_PRIVATE_EXPORT FilePickerController : public QObject { +class Q_WEBENGINECORE_PRIVATE_EXPORT FilePickerController : public QObject { Q_OBJECT public: enum FileChooserMode { diff --git a/src/core/javascript_dialog_controller.h b/src/core/javascript_dialog_controller.h index 1ba94e095..ba9f51944 100644 --- a/src/core/javascript_dialog_controller.h +++ b/src/core/javascript_dialog_controller.h @@ -59,7 +59,7 @@ namespace QtWebEngineCore { class JavaScriptDialogControllerPrivate; -class QWEBENGINECORE_PRIVATE_EXPORT JavaScriptDialogController : public QObject { +class Q_WEBENGINECORE_PRIVATE_EXPORT JavaScriptDialogController : public QObject { Q_OBJECT public: ~JavaScriptDialogController(); diff --git a/src/core/net/cookie_monster_delegate_qt.h b/src/core/net/cookie_monster_delegate_qt.h index 7933ba329..88e92b560 100644 --- a/src/core/net/cookie_monster_delegate_qt.h +++ b/src/core/net/cookie_monster_delegate_qt.h @@ -75,7 +75,7 @@ namespace QtWebEngineCore { static const char* const kCookieableSchemes[] = { "http", "https", "qrc", "ws", "wss" }; -class QWEBENGINECORE_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; diff --git a/src/core/net/custom_protocol_handler.cpp b/src/core/net/custom_protocol_handler.cpp index 5132782c2..7e8ee47ab 100644 --- a/src/core/net/custom_protocol_handler.cpp +++ b/src/core/net/custom_protocol_handler.cpp @@ -54,7 +54,7 @@ CustomProtocolHandler::CustomProtocolHandler(QPointer<ProfileAdapter> profileAda net::URLRequestJob *CustomProtocolHandler::MaybeCreateJob(net::URLRequest *request, net::NetworkDelegate *networkDelegate) const { if (!networkDelegate) - return new net::URLRequestErrorJob(request, Q_NULLPTR, net::ERR_ACCESS_DENIED); + return new net::URLRequestErrorJob(request, nullptr, net::ERR_ACCESS_DENIED); return new URLRequestCustomJob(request, networkDelegate, request->url().scheme(), m_profileAdapter); } diff --git a/src/core/net/custom_protocol_handler.h b/src/core/net/custom_protocol_handler.h index d5b512b03..7b189763c 100644 --- a/src/core/net/custom_protocol_handler.h +++ b/src/core/net/custom_protocol_handler.h @@ -71,7 +71,7 @@ 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 QWEBENGINECORE_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/url_request_custom_job_delegate.h b/src/core/net/url_request_custom_job_delegate.h index 1bf3ade1f..0ab1a82c7 100644 --- a/src/core/net/url_request_custom_job_delegate.h +++ b/src/core/net/url_request_custom_job_delegate.h @@ -64,7 +64,7 @@ namespace QtWebEngineCore { class URLRequestCustomJobProxy; -class QWEBENGINECORE_PRIVATE_EXPORT URLRequestCustomJobDelegate : public QObject { +class Q_WEBENGINECORE_PRIVATE_EXPORT URLRequestCustomJobDelegate : public QObject { Q_OBJECT public: ~URLRequestCustomJobDelegate(); diff --git a/src/core/printing/pdfium_document_wrapper_qt.cpp b/src/core/printing/pdfium_document_wrapper_qt.cpp index 6dbdf64ef..1be27f1c6 100644 --- a/src/core/printing/pdfium_document_wrapper_qt.cpp +++ b/src/core/printing/pdfium_document_wrapper_qt.cpp @@ -48,7 +48,7 @@ namespace QtWebEngineCore { int PdfiumDocumentWrapperQt::m_libraryUsers = 0; -class QWEBENGINECORE_PRIVATE_EXPORT PdfiumPageWrapperQt { +class PdfiumPageWrapperQt { public: PdfiumPageWrapperQt(FPDF_DOCUMENT data, int pageIndex, int targetWidth, int targetHeight) : m_pageData(FPDF_LoadPage(data, pageIndex)) diff --git a/src/core/printing/pdfium_document_wrapper_qt.h b/src/core/printing/pdfium_document_wrapper_qt.h index f4ac557a0..2dab268fc 100644 --- a/src/core/printing/pdfium_document_wrapper_qt.h +++ b/src/core/printing/pdfium_document_wrapper_qt.h @@ -58,7 +58,7 @@ namespace QtWebEngineCore { class PdfiumPageWrapperQt; -class QWEBENGINECORE_PRIVATE_EXPORT PdfiumDocumentWrapperQt +class Q_WEBENGINECORE_PRIVATE_EXPORT PdfiumDocumentWrapperQt { public: PdfiumDocumentWrapperQt(const void *pdfData, size_t size, const QSize &imageSize, diff --git a/src/core/process_main.h b/src/core/process_main.h index d171828d5..00c029d9f 100644 --- a/src/core/process_main.h +++ b/src/core/process_main.h @@ -52,6 +52,6 @@ namespace QtWebEngine { -QWEBENGINECORE_PRIVATE_EXPORT int processMain(int argc, const char **argv); +Q_WEBENGINECORE_PRIVATE_EXPORT int processMain(int argc, const char **argv); } // namespace diff --git a/src/core/profile_adapter.h b/src/core/profile_adapter.h index 48094a3d8..1f94f59a9 100644 --- a/src/core/profile_adapter.h +++ b/src/core/profile_adapter.h @@ -78,7 +78,7 @@ class UserResourceControllerHost; class VisitedLinksManagerQt; class WebContentsAdapterClient; -class QWEBENGINECORE_PRIVATE_EXPORT ProfileAdapter : public QObject +class Q_WEBENGINECORE_PRIVATE_EXPORT ProfileAdapter : public QObject { public: explicit ProfileAdapter(const QString &storagePrefix = QString()); diff --git a/src/core/profile_adapter_client.h b/src/core/profile_adapter_client.h index 8ee9d240e..b463043da 100644 --- a/src/core/profile_adapter_client.h +++ b/src/core/profile_adapter_client.h @@ -61,7 +61,7 @@ namespace QtWebEngineCore { class WebContentsAdapterClient; class UserNotificationController; -class QWEBENGINECORE_PRIVATE_EXPORT ProfileAdapterClient +class Q_WEBENGINECORE_PRIVATE_EXPORT ProfileAdapterClient { public: // Keep in sync with content::DownloadItem::DownloadState diff --git a/src/core/render_view_context_menu_qt.h b/src/core/render_view_context_menu_qt.h index d8ca2775c..e1ee301fc 100644 --- a/src/core/render_view_context_menu_qt.h +++ b/src/core/render_view_context_menu_qt.h @@ -55,7 +55,7 @@ namespace QtWebEngineCore { -class QWEBENGINECORE_PRIVATE_EXPORT RenderViewContextMenuQt +class Q_WEBENGINECORE_PRIVATE_EXPORT RenderViewContextMenuQt { public: enum ContextMenuItem { diff --git a/src/core/render_widget_host_view_qt_delegate.h b/src/core/render_widget_host_view_qt_delegate.h index e2c98360d..cbf92a8d4 100644 --- a/src/core/render_widget_host_view_qt_delegate.h +++ b/src/core/render_widget_host_view_qt_delegate.h @@ -74,7 +74,7 @@ namespace QtWebEngineCore { class WebContentsAdapterClient; -class QWEBENGINECORE_PRIVATE_EXPORT RenderWidgetHostViewQtDelegateClient { +class Q_WEBENGINECORE_PRIVATE_EXPORT RenderWidgetHostViewQtDelegateClient { public: virtual ~RenderWidgetHostViewQtDelegateClient() { } virtual QSGNode *updatePaintNode(QSGNode *) = 0; @@ -86,7 +86,7 @@ public: virtual void closePopup() = 0; }; -class QWEBENGINECORE_PRIVATE_EXPORT RenderWidgetHostViewQtDelegate { +class Q_WEBENGINECORE_PRIVATE_EXPORT RenderWidgetHostViewQtDelegate { public: virtual ~RenderWidgetHostViewQtDelegate() { } virtual void initAsPopup(const QRect&) = 0; diff --git a/src/core/renderer_host/user_resource_controller_host.h b/src/core/renderer_host/user_resource_controller_host.h index 40b685163..16a73f5fb 100644 --- a/src/core/renderer_host/user_resource_controller_host.h +++ b/src/core/renderer_host/user_resource_controller_host.h @@ -66,7 +66,7 @@ namespace QtWebEngineCore { class WebContentsAdapter; -class QWEBENGINECORE_PRIVATE_EXPORT UserResourceControllerHost { +class Q_WEBENGINECORE_PRIVATE_EXPORT UserResourceControllerHost { public: UserResourceControllerHost(); diff --git a/src/core/touch_handle_drawable_client.h b/src/core/touch_handle_drawable_client.h index 42d907d75..a2c87948a 100644 --- a/src/core/touch_handle_drawable_client.h +++ b/src/core/touch_handle_drawable_client.h @@ -45,7 +45,7 @@ namespace QtWebEngineCore { -class QWEBENGINECORE_PRIVATE_EXPORT TouchHandleDrawableClient { +class Q_WEBENGINECORE_PRIVATE_EXPORT TouchHandleDrawableClient { public: virtual ~TouchHandleDrawableClient() { } diff --git a/src/core/touch_selection_menu_controller.h b/src/core/touch_selection_menu_controller.h index fd61ae709..34137b05b 100644 --- a/src/core/touch_selection_menu_controller.h +++ b/src/core/touch_selection_menu_controller.h @@ -47,7 +47,7 @@ namespace QtWebEngineCore { class TouchSelectionControllerClientQt; -class QWEBENGINECORE_PRIVATE_EXPORT TouchSelectionMenuController : public QObject { +class Q_WEBENGINECORE_PRIVATE_EXPORT TouchSelectionMenuController : public QObject { Q_OBJECT public: enum TouchSelectionCommand { diff --git a/src/core/user_notification_controller.cpp b/src/core/user_notification_controller.cpp index 82cb57e51..d169bf854 100644 --- a/src/core/user_notification_controller.cpp +++ b/src/core/user_notification_controller.cpp @@ -86,7 +86,7 @@ public: std::unique_ptr<UserNotificationController::Delegate> m_delegate; blink::NotificationResources m_resources; UserNotificationController::Client *m_client; - QIcon m_icon; + QImage m_icon; QImage m_image; QImage m_badge; bool m_iconGenerated; @@ -155,15 +155,12 @@ QUrl UserNotificationController::origin() const return toQt(d->m_origin); } -QIcon UserNotificationController::icon() const +QImage UserNotificationController::icon() const { if (!d->m_iconGenerated) { d->m_iconGenerated = true; - if (!d->m_resources.notification_icon.isNull()) { - QImage image = toQImage(d->m_resources.notification_icon); - if (!image.isNull()) - d->m_icon = QIcon(QPixmap::fromImage(std::move(image), Qt::NoFormatConversion)); - } + if (!d->m_resources.notification_icon.isNull()) + d->m_icon = toQImage(d->m_resources.notification_icon); } return d->m_icon; } diff --git a/src/core/user_notification_controller.h b/src/core/user_notification_controller.h index 840074843..bab85c7ec 100644 --- a/src/core/user_notification_controller.h +++ b/src/core/user_notification_controller.h @@ -58,7 +58,7 @@ namespace QtWebEngineCore { class UserNotificationControllerPrivate; // Works as an accessor and owner of chromium objects related to showing desktop notifications. -class QWEBENGINECORE_EXPORT UserNotificationController : public QEnableSharedFromThis<UserNotificationController> { +class Q_WEBENGINECORE_EXPORT UserNotificationController : public QEnableSharedFromThis<UserNotificationController> { public: struct Delegate { virtual ~Delegate() { } @@ -86,7 +86,7 @@ public: void closeNotification(); QUrl origin() const; - QIcon icon() const; + QImage icon() const; QImage image() const; QImage badge() const; QString title() const; diff --git a/src/core/user_script.h b/src/core/user_script.h index 5ad53fdc1..8f65f4b74 100644 --- a/src/core/user_script.h +++ b/src/core/user_script.h @@ -63,7 +63,7 @@ namespace QtWebEngineCore { class UserResourceControllerHost; -class QWEBENGINECORE_PRIVATE_EXPORT UserScript : public QSharedData { +class Q_WEBENGINECORE_PRIVATE_EXPORT UserScript : public QSharedData { public: enum InjectionPoint { AfterLoad, diff --git a/src/core/visited_links_manager_qt.h b/src/core/visited_links_manager_qt.h index 5bbcc5983..ecac8f30f 100644 --- a/src/core/visited_links_manager_qt.h +++ b/src/core/visited_links_manager_qt.h @@ -70,7 +70,7 @@ namespace QtWebEngineCore { class ProfileQt; class VisitedLinkDelegateQt; -class QWEBENGINECORE_PRIVATE_EXPORT VisitedLinksManagerQt { +class Q_WEBENGINECORE_PRIVATE_EXPORT VisitedLinksManagerQt { public: virtual~VisitedLinksManagerQt(); diff --git a/src/core/web_contents_adapter.h b/src/core/web_contents_adapter.h index c6e4f2256..79aa68456 100644 --- a/src/core/web_contents_adapter.h +++ b/src/core/web_contents_adapter.h @@ -91,7 +91,7 @@ class RenderViewObserverHostQt; class WebChannelIPCTransportHost; class WebEngineContext; -class QWEBENGINECORE_PRIVATE_EXPORT WebContentsAdapter : public QEnableSharedFromThis<WebContentsAdapter> { +class Q_WEBENGINECORE_PRIVATE_EXPORT WebContentsAdapter : public QEnableSharedFromThis<WebContentsAdapter> { public: static QSharedPointer<WebContentsAdapter> createFromSerializedNavigationHistory(QDataStream &input, WebContentsAdapterClient *adapterClient); WebContentsAdapter(); diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index beb41e17f..b388b28d0 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -343,7 +343,7 @@ private: }; -class QWEBENGINECORE_PRIVATE_EXPORT WebContentsAdapterClient { +class Q_WEBENGINECORE_PRIVATE_EXPORT WebContentsAdapterClient { public: // This must match window_open_disposition_list.h. enum WindowOpenDisposition { diff --git a/src/core/web_engine_error.h b/src/core/web_engine_error.h index 20af6d31f..cda9e4625 100644 --- a/src/core/web_engine_error.h +++ b/src/core/web_engine_error.h @@ -53,7 +53,7 @@ #include "qtwebenginecoreglobal_p.h" -class QWEBENGINECORE_PRIVATE_EXPORT WebEngineError +class Q_WEBENGINECORE_PRIVATE_EXPORT WebEngineError { public: diff --git a/src/core/web_engine_settings.h b/src/core/web_engine_settings.h index d7eeaa560..b2a45098a 100644 --- a/src/core/web_engine_settings.h +++ b/src/core/web_engine_settings.h @@ -68,7 +68,7 @@ namespace QtWebEngineCore { class WebContentsAdapter; -class QWEBENGINECORE_PRIVATE_EXPORT WebEngineSettings { +class Q_WEBENGINECORE_PRIVATE_EXPORT WebEngineSettings { public: // Attributes. Names match the ones from the public widgets API. enum Attribute { diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp index ac75b5356..4832ba303 100644 --- a/src/webengine/api/qquickwebengineprofile.cpp +++ b/src/webengine/api/qquickwebengineprofile.cpp @@ -152,7 +152,7 @@ ASSERT_ENUMS_MATCH(QQuickWebEngineDownloadItem::MimeHtmlSaveFormat, QtWebEngineC */ /*! - \fn QQuickWebEngineProfile::userNotification(QWebEngineNotification *notification) + \fn QQuickWebEngineProfile::presentNotification(QWebEngineNotification *notification) This signal is emitted whenever there is a newly created user notification. The \a notification argument holds the notification instance to query data and interact with. @@ -304,7 +304,7 @@ void QQuickWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineC Q_Q(QQuickWebEngineProfile); auto notification = new QWebEngineNotification(controller); QQmlEngine::setObjectOwnership(notification, QQmlEngine::JavaScriptOwnership); - Q_EMIT q->userNotification(notification); + Q_EMIT q->presentNotification(notification); } void QQuickWebEngineProfilePrivate::userScripts_append(QQmlListProperty<QQuickWebEngineScript> *p, QQuickWebEngineScript *script) @@ -387,7 +387,7 @@ void QQuickWebEngineProfilePrivate::userScripts_clear(QQmlListProperty<QQuickWeb */ /*! - \qmlsignal WebEngineProfile::userNotification(WebEngineNotification notification) + \qmlsignal WebEngineProfile::presentNotification(WebEngineNotification notification) \since QtWebEngine 1.9 This signal is emitted whenever there is a newly created user notification. diff --git a/src/webengine/api/qquickwebengineprofile.h b/src/webengine/api/qquickwebengineprofile.h index e6f9fb73d..e5f7ff713 100644 --- a/src/webengine/api/qquickwebengineprofile.h +++ b/src/webengine/api/qquickwebengineprofile.h @@ -176,7 +176,7 @@ Q_SIGNALS: void downloadRequested(QQuickWebEngineDownloadItem *download); void downloadFinished(QQuickWebEngineDownloadItem *download); - Q_REVISION(5) void userNotification(QWebEngineNotification *notification); + Q_REVISION(5) void presentNotification(QWebEngineNotification *notification); private: Q_DECLARE_PRIVATE(QQuickWebEngineProfile) diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes index cc2ed502d..0037861e5 100644 --- a/src/webengine/plugin/plugins.qmltypes +++ b/src/webengine/plugin/plugins.qmltypes @@ -531,7 +531,7 @@ Module { Parameter { name: "download"; type: "QQuickWebEngineDownloadItem"; isPointer: true } } Signal { - name: "userNotification" + name: "presentNotification" revision: 5 Parameter { name: "notification"; type: "QWebEngineNotification"; isPointer: true } } diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index d324fe75d..cd4b8ed81 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -324,7 +324,7 @@ void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> d return; } - QQmlComponent *dialogComponent = Q_NULLPTR; + QQmlComponent *dialogComponent = nullptr; switch (dialogComponentType) { FOR_EACH_COMPONENT_TYPE(ASSIGN_DIALOG_COMPONENT_DATA_CASE_STATEMENT, NO_SEPARATOR) default: diff --git a/src/webenginewidgets/api/qwebenginenotificationpresenter.cpp b/src/webenginewidgets/api/qwebenginenotificationpresenter.cpp index da97c4662..667605c37 100644 --- a/src/webenginewidgets/api/qwebenginenotificationpresenter.cpp +++ b/src/webenginewidgets/api/qwebenginenotificationpresenter.cpp @@ -39,6 +39,7 @@ #include "qwebenginenotificationpresenter_p.h" +#include <QApplication> #include <QSystemTrayIcon> QT_BEGIN_NAMESPACE @@ -55,50 +56,53 @@ DefaultNotificationPresenter::~DefaultNotificationPresenter() { } -void DefaultNotificationPresenter::show(const QWebEngineNotification ¬ification) +void DefaultNotificationPresenter::show(std::unique_ptr<QWebEngineNotification> notification) { - if (m_activeNotification.isValid()) { - m_activeNotification.close(); - m_activeNotification.disconnect(this); + Q_ASSERT(notification); + if (m_activeNotification) { + m_activeNotification->close(); + m_activeNotification->disconnect(this); } - m_activeNotification = notification; + m_activeNotification = std::move(notification); #ifndef QT_NO_SYSTEMTRAYICON - if (m_activeNotification.isValid() && m_systemTrayIcon) { + if (m_activeNotification && m_systemTrayIcon) { + m_systemTrayIcon->setIcon(qApp->windowIcon()); m_systemTrayIcon->show(); - QIcon icon = notification.icon(); - if (!icon.isNull()) - m_systemTrayIcon->showMessage(notification.title(), notification.message(), icon); + QImage notificationIconImage = m_activeNotification->icon(); + m_notificationIcon = QIcon(QPixmap::fromImage(std::move(notificationIconImage), Qt::NoFormatConversion)); + if (!m_notificationIcon.isNull()) + m_systemTrayIcon->showMessage(m_activeNotification->title(), m_activeNotification->message(), m_notificationIcon); else - m_systemTrayIcon->showMessage(notification.title(), notification.message()); - notification.show(); - connect(&m_activeNotification, &QWebEngineNotification::closed, this, &DefaultNotificationPresenter::closeNotification); + m_systemTrayIcon->showMessage(m_activeNotification->title(), m_activeNotification->message()); + m_activeNotification->show(); + connect(m_activeNotification.get(), &QWebEngineNotification::closed, this, &DefaultNotificationPresenter::closeNotification); } #endif } void DefaultNotificationPresenter::messageClicked() { - if (m_activeNotification.isValid()) - m_activeNotification.click(); + if (m_activeNotification) + m_activeNotification->click(); } void DefaultNotificationPresenter::closeNotification() { #ifndef QT_NO_SYSTEMTRAYICON const QWebEngineNotification *canceled = static_cast<const QWebEngineNotification *>(QObject::sender()); - if (m_systemTrayIcon && canceled->matches(m_activeNotification)) + if (m_systemTrayIcon && canceled->matches(m_activeNotification.get())) m_systemTrayIcon->hide(); #endif } -void defaultNotificationPresenter(const QWebEngineNotification ¬ification) +void defaultNotificationPresenter(std::unique_ptr<QWebEngineNotification> notification) { static DefaultNotificationPresenter *presenter = nullptr; if (!presenter) presenter = new DefaultNotificationPresenter(); - presenter->show(notification); + presenter->show(std::move(notification)); } diff --git a/src/webenginewidgets/api/qwebenginenotificationpresenter_p.h b/src/webenginewidgets/api/qwebenginenotificationpresenter_p.h index a66dbc1b2..49d774806 100644 --- a/src/webenginewidgets/api/qwebenginenotificationpresenter_p.h +++ b/src/webenginewidgets/api/qwebenginenotificationpresenter_p.h @@ -54,6 +54,9 @@ #include <QtWebEngineCore/QWebEngineNotification> #include <QtCore/QObject> +#include <QtGui/QIcon> + +#include <memory> QT_BEGIN_NAMESPACE @@ -65,7 +68,7 @@ public: DefaultNotificationPresenter(QObject *parent = nullptr); virtual ~DefaultNotificationPresenter(); - void show(const QWebEngineNotification ¬ification); + void show(std::unique_ptr<QWebEngineNotification> notification); private Q_SLOTS: void messageClicked(); @@ -73,10 +76,11 @@ private Q_SLOTS: private: QSystemTrayIcon *m_systemTrayIcon; - QWebEngineNotification m_activeNotification; + QIcon m_notificationIcon; + std::unique_ptr<QWebEngineNotification> m_activeNotification; }; -void defaultNotificationPresenter(const QWebEngineNotification ¬ification); +void defaultNotificationPresenter(std::unique_ptr<QWebEngineNotification> notification); QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index d69ddb343..47b3f4363 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -141,10 +141,12 @@ using QtWebEngineCore::ProfileAdapter; Both session and persistent cookies are saved to and restored from disk. */ -void QWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineCore::UserNotificationController> ¬ification) +void QWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineCore::UserNotificationController> &controller) { - if (m_notificationPresenter) - m_notificationPresenter(QWebEngineNotification(notification)); + if (m_notificationPresenter) { + std::unique_ptr<QWebEngineNotification> notification(new QWebEngineNotification(controller)); + m_notificationPresenter(std::move(notification)); + } } /*! @@ -668,7 +670,7 @@ QWebEngineScriptCollection *QWebEngineProfile::scripts() const \since 5.13 \sa QWebEngineNotification */ -void QWebEngineProfile::setNotificationPresenter(std::function<void(const QWebEngineNotification &)> notificationPresenter) +void QWebEngineProfile::setNotificationPresenter(std::function<void(std::unique_ptr<QWebEngineNotification>)> notificationPresenter) { Q_D(QWebEngineProfile); d->m_notificationPresenter = std::move(notificationPresenter); diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h index e3ddb594a..794ba6279 100644 --- a/src/webenginewidgets/api/qwebengineprofile.h +++ b/src/webenginewidgets/api/qwebengineprofile.h @@ -47,6 +47,7 @@ #include <QtCore/qstring.h> #include <functional> +#include <memory> QT_BEGIN_NAMESPACE @@ -141,7 +142,7 @@ public: QString downloadPath() const; void setDownloadPath(const QString &path); - void setNotificationPresenter(std::function<void(const QWebEngineNotification &)> notificationPresenter); + void setNotificationPresenter(std::function<void(std::unique_ptr<QWebEngineNotification>)> notificationPresenter); QWebEngineClientCertificateStore *clientCertificateStore(); diff --git a/src/webenginewidgets/api/qwebengineprofile_p.h b/src/webenginewidgets/api/qwebengineprofile_p.h index 91c43cf0a..64e9500b0 100644 --- a/src/webenginewidgets/api/qwebengineprofile_p.h +++ b/src/webenginewidgets/api/qwebengineprofile_p.h @@ -100,7 +100,7 @@ private: QPointer<QtWebEngineCore::ProfileAdapter> m_profileAdapter; QScopedPointer<QWebEngineScriptCollection> m_scriptCollection; QMap<quint32, QPointer<QWebEngineDownloadItem> > m_ongoingDownloads; - std::function<void(const QWebEngineNotification &)> m_notificationPresenter; + std::function<void(std::unique_ptr<QWebEngineNotification>)> m_notificationPresenter; }; QT_END_NAMESPACE diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index 966b30100..91fc86cdf 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -119,7 +119,7 @@ static QAccessibleInterface *webAccessibleFactory(const QString &, QObject *obje { if (QWebEngineView *v = qobject_cast<QWebEngineView*>(object)) return new QWebEngineViewAccessible(v); - return Q_NULLPTR; + return nullptr; } #endif // QT_NO_ACCESSIBILITY @@ -459,7 +459,7 @@ QAccessibleInterface *QWebEngineViewAccessible::child(int index) const { if (index == 0 && view() && view()->page()) return view()->page()->d_func()->adapter->browserAccessible(); - return Q_NULLPTR; + return nullptr; } int QWebEngineViewAccessible::indexOfChild(const QAccessibleInterface *c) const diff --git a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp index 951360c05..140314681 100644 --- a/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp +++ b/src/webenginewidgets/render_widget_host_view_qt_delegate_widget.cpp @@ -197,7 +197,7 @@ void RenderWidgetHostViewQtDelegateWidget::removeParentBeforeParentDelete() { // Unset the parent, because parent is being destroyed, but the owner of this // RenderWidgetHostViewQtDelegateWidget is actually a RenderWidgetHostViewQt instance. - setParent(Q_NULLPTR); + setParent(nullptr); // If this widget represents a popup window, make sure to close it, so that if the popup was the // last visible top level window, the application event loop can quit if it deems it necessarry. diff --git a/tests/auto/quick/dialogs/BLACKLIST b/tests/auto/quick/dialogs/BLACKLIST deleted file mode 100644 index 19380e01e..000000000 --- a/tests/auto/quick/dialogs/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[authenticationDialogRequested:Proxy Authentication Dialog] -* diff --git a/tests/auto/quick/dialogs/server.cpp b/tests/auto/quick/dialogs/server.cpp index dc9cfe582..dfc7c97ad 100644 --- a/tests/auto/quick/dialogs/server.cpp +++ b/tests/auto/quick/dialogs/server.cpp @@ -33,7 +33,6 @@ Server::Server(QObject *parent) : QObject(parent) { - m_data.clear(); connect(&m_server, &QTcpServer::newConnection, this, &Server::handleNewConnection); } @@ -42,6 +41,11 @@ bool Server::isListening() return m_server.isListening(); } +void Server::setReply(const QByteArray &reply) +{ + m_reply = reply; +} + void Server::run() { if (!m_server.listen(QHostAddress::LocalHost, 5555)) @@ -69,12 +73,7 @@ void Server::handleReadReady() if (!m_data.endsWith("\r\n\r\n")) return; - if (m_data.contains(QByteArrayLiteral("OPEN_AUTH"))) - socket->write("HTTP/1.1 401 Unauthorized\nWWW-Authenticate: " - "Basic realm=\"Very Restricted Area\"\r\n\r\n"); - if (m_data.contains(QByteArrayLiteral("OPEN_PROXY"))) - socket->write("HTTP/1.1 407 Proxy Auth Required\nProxy-Authenticate: " - "Basic realm=\"Proxy requires authentication\"\r\n\r\n"); + socket->write(m_reply); m_data.clear(); socket->disconnectFromHost(); } diff --git a/tests/auto/quick/dialogs/server.h b/tests/auto/quick/dialogs/server.h index 24da47523..fa9a73811 100644 --- a/tests/auto/quick/dialogs/server.h +++ b/tests/auto/quick/dialogs/server.h @@ -40,6 +40,7 @@ public: explicit Server(QObject *parent = nullptr); bool isListening(); + void setReply(const QByteArray &reply); public slots: void run(); @@ -50,6 +51,7 @@ private slots: private: QByteArray m_data; + QByteArray m_reply; QTcpServer m_server; }; diff --git a/tests/auto/quick/dialogs/tst_dialogs.cpp b/tests/auto/quick/dialogs/tst_dialogs.cpp index cecea1831..26a0fe034 100644 --- a/tests/auto/quick/dialogs/tst_dialogs.cpp +++ b/tests/auto/quick/dialogs/tst_dialogs.cpp @@ -145,12 +145,19 @@ void tst_Dialogs::authenticationDialogRequested_data() QTest::addColumn<QUrl>("url"); QTest::addColumn<QQuickWebEngineAuthenticationDialogRequest::AuthenticationType>("type"); QTest::addColumn<QString>("realm"); - QTest::newRow("Http Authentication Dialog") << QUrl("http://localhost:5555/OPEN_AUTH") + QTest::addColumn<QByteArray>("reply"); + QTest::newRow("Http Authentication Dialog") << QUrl("http://localhost:5555/") << QQuickWebEngineAuthenticationDialogRequest::AuthenticationTypeHTTP - << QStringLiteral("Very Restricted Area"); - QTest::newRow("Proxy Authentication Dialog") << QUrl("http://localhost.:5555/OPEN_PROXY") + << QStringLiteral("Very Restricted Area") + << QByteArrayLiteral("HTTP/1.1 401 Unauthorized\nWWW-Authenticate: " + "Basic realm=\"Very Restricted Area\"\r\n\r\n"); + QTest::newRow("Proxy Authentication Dialog")<< QUrl("http://qt.io/") << QQuickWebEngineAuthenticationDialogRequest::AuthenticationTypeProxy - << QStringLiteral("Proxy requires authentication"); + << QStringLiteral("Proxy requires authentication") + << QByteArrayLiteral("HTTP/1.1 407 Proxy Auth Required\nProxy-Authenticate: " + "Basic realm=\"Proxy requires authentication\"\r\n" + "content-length: 0\r\n\r\n"); + } void tst_Dialogs::authenticationDialogRequested() @@ -159,7 +166,9 @@ void tst_Dialogs::authenticationDialogRequested() QFETCH(QQuickWebEngineAuthenticationDialogRequest::AuthenticationType, type); QFETCH(QString, realm); + QFETCH(QByteArray, reply); Server server; + server.setReply(reply); server.run(); QTRY_VERIFY2(server.isListening(), "Could not setup authentication server"); diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp index 3e5d24381..ed4a030df 100644 --- a/tests/auto/quick/publicapi/tst_publicapi.cpp +++ b/tests/auto/quick/publicapi/tst_publicapi.cpp @@ -332,7 +332,7 @@ static const QStringList expectedAPI = QStringList() << "QQuickWebEngineProfile.downloadRequested(QQuickWebEngineDownloadItem*) --> void" << "QQuickWebEngineProfile.downloadPath --> QString" << "QQuickWebEngineProfile.downloadPathChanged() --> void" - << "QQuickWebEngineProfile.userNotification(QWebEngineNotification*) --> void" + << "QQuickWebEngineProfile.presentNotification(QWebEngineNotification*) --> void" << "QQuickWebEngineProfile.httpAcceptLanguage --> QString" << "QQuickWebEngineProfile.httpAcceptLanguageChanged() --> void" << "QQuickWebEngineProfile.httpCacheMaximumSize --> int" @@ -765,7 +765,6 @@ static const QStringList expectedAPI = QStringList() << "QWebEngineRegisterProtocolHandlerRequest.reject() --> void" << "QWebEngineRegisterProtocolHandlerRequest.scheme --> QString" << "QWebEngineNotification.origin --> QUrl" - << "QWebEngineNotification.icon --> QIcon" << "QWebEngineNotification.title --> QString" << "QWebEngineNotification.message --> QString" << "QWebEngineNotification.tag --> QString" diff --git a/tests/auto/quick/qmltests/data/tst_notification.qml b/tests/auto/quick/qmltests/data/tst_notification.qml index af4aebafc..773bf4a8e 100644 --- a/tests/auto/quick/qmltests/data/tst_notification.qml +++ b/tests/auto/quick/qmltests/data/tst_notification.qml @@ -107,7 +107,7 @@ TestWebEngineView { verify(permissionRequested) let title = 'Title', message = 'Message', notification = null - view.profile.userNotification.connect(function (n) { notification = n }) + view.profile.presentNotification.connect(function (n) { notification = n }) view.runJavaScript('sendNotification("' + title + '", "' + message + '")') tryVerify(function () { return notification !== null }) diff --git a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp index eb76be6db..74c04635f 100644 --- a/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp +++ b/tests/auto/quick/qquickwebengineview/tst_qquickwebengineview.cpp @@ -878,7 +878,7 @@ public: setAcceptHoverEvents(true); } - bool event(QEvent *event) Q_DECL_OVERRIDE + bool event(QEvent *event) override { switch (event->type()) { case QEvent::TabletPress: diff --git a/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp b/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp index 2b9742b99..b587f3b27 100644 --- a/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp +++ b/tests/auto/quick/qquickwebengineviewgraphics/tst_qquickwebengineviewgraphics.cpp @@ -46,7 +46,7 @@ public: Qt::QueuedConnection); } - virtual void exposeEvent(QExposeEvent *e) Q_DECL_OVERRIDE { + virtual void exposeEvent(QExposeEvent *e) override { QQuickView::exposeEvent(e); emit _q_exposeChanged(); } diff --git a/tests/auto/widgets/accessibility/tst_accessibility.cpp b/tests/auto/widgets/accessibility/tst_accessibility.cpp index 6efbf53ed..b0165cfbc 100644 --- a/tests/auto/widgets/accessibility/tst_accessibility.cpp +++ b/tests/auto/widgets/accessibility/tst_accessibility.cpp @@ -134,7 +134,7 @@ void tst_Accessibility::hierarchy() QVERIFY(windowRect.contains(inputRect)); QPoint inputCenter = inputRect.center(); QAccessibleInterface *hitTest = view; - QAccessibleInterface *child = Q_NULLPTR; + QAccessibleInterface *child = nullptr; while (hitTest) { child = hitTest; hitTest = hitTest->childAt(inputCenter.x(), inputCenter.y()); diff --git a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp index 8af559e21..8669c8f94 100644 --- a/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp +++ b/tests/auto/widgets/qwebenginedownloaditem/tst_qwebenginedownloaditem.cpp @@ -920,7 +920,7 @@ void tst_QWebEngineDownloadItem::downloadUniqueFilename() void tst_QWebEngineDownloadItem::downloadUniqueFileNameWithTimeStamp() { #ifdef Q_OS_WIN - QSKIP("QTBUG-74764: The download completes after the test fails thus would ruin subsequent tests on Windows.") + QSKIP("QTBUG-74764: The download completes after the test fails thus would ruin subsequent tests on Windows."); #endif // Set up HTTP server QString baseName("test(1.test)"); diff --git a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp index 3792b5522..9ba242e68 100644 --- a/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp +++ b/tests/auto/widgets/qwebenginepage/tst_qwebenginepage.cpp @@ -1550,7 +1550,7 @@ public: JavaScriptCallback() { } JavaScriptCallback(const QVariant& _expected) : expected(_expected) { } - void check(const QVariant& result) Q_DECL_OVERRIDE + void check(const QVariant& result) override { QVERIFY(result.isValid()); QCOMPARE(result, expected); @@ -1563,7 +1563,7 @@ private: class JavaScriptCallbackNull : public JavaScriptCallbackBase { public: - void check(const QVariant& result) Q_DECL_OVERRIDE + void check(const QVariant& result) override { QVERIFY(result.isNull()); // FIXME: Returned null values are currently invalid QVariants. @@ -1574,7 +1574,7 @@ public: class JavaScriptCallbackUndefined : public JavaScriptCallbackBase { public: - void check(const QVariant& result) Q_DECL_OVERRIDE + void check(const QVariant& result) override { QVERIFY(result.isNull()); QVERIFY(!result.isValid()); @@ -3327,27 +3327,33 @@ void tst_QWebEnginePage::sendNotification() QVERIFY(page.spyRequest.wasCalled()); QCOMPARE(page.getPermission(), "granted"); - CallbackSpy<QWebEngineNotification> presenter; - page.profile()->setNotificationPresenter([callback = presenter.ref()] (const QWebEngineNotification ¬ification) mutable { callback(notification); }); + std::unique_ptr<QWebEngineNotification> activeNotification; + CallbackSpy<bool> presenter; + page.profile()->setNotificationPresenter( + [&] (std::unique_ptr<QWebEngineNotification> notification) + { + activeNotification = std::move(notification); + presenter(true); + }); QString title("Title"), message("Message"); page.sendNotification(title, message); - auto notification = presenter.waitForResult(); + presenter.waitForResult(); QVERIFY(presenter.wasCalled()); - QVERIFY(notification.isValid()); - QCOMPARE(notification.title(), title); - QCOMPARE(notification.message(), message); - QCOMPARE(notification.origin(), origin); - QCOMPARE(notification.direction(), Qt::RightToLeft); - QCOMPARE(notification.language(), "de"); - QCOMPARE(notification.tag(), "tst"); - - notification.show(); + QVERIFY(activeNotification); + QCOMPARE(activeNotification->title(), title); + QCOMPARE(activeNotification->message(), message); + QCOMPARE(activeNotification->origin(), origin); + QCOMPARE(activeNotification->direction(), Qt::RightToLeft); + QCOMPARE(activeNotification->language(), "de"); + QCOMPARE(activeNotification->tag(), "tst"); + + activeNotification->show(); QTRY_VERIFY2(page.messages.contains("onshow"), page.messages.join("\n").toLatin1().constData()); - notification.click(); + activeNotification->click(); QTRY_VERIFY2(page.messages.contains("onclick"), page.messages.join("\n").toLatin1().constData()); - notification.close(); + activeNotification->close(); QTRY_VERIFY2(page.messages.contains("onclose"), page.messages.join("\n").toLatin1().constData()); } diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp index 8bd68bb97..ebd25e892 100644 --- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp +++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp @@ -374,17 +374,17 @@ public: { } - qint64 readData(char *, qint64) Q_DECL_OVERRIDE + qint64 readData(char *, qint64) override { m_job->fail(QWebEngineUrlRequestJob::RequestFailed); return -1; } - qint64 writeData(const char *, qint64) Q_DECL_OVERRIDE + qint64 writeData(const char *, qint64) override { m_job->fail(QWebEngineUrlRequestJob::RequestFailed); return -1; } - void close() Q_DECL_OVERRIDE + void close() override { QIODevice::close(); deleteLater(); diff --git a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp index 17177c7fb..16a3d32b6 100644 --- a/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp +++ b/tests/auto/widgets/qwebengineview/tst_qwebengineview.cpp @@ -588,8 +588,8 @@ class KeyEventRecordingWidget : public QWidget { public: QList<QKeyEvent> pressEvents; QList<QKeyEvent> releaseEvents; - void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE { pressEvents << *e; } - void keyReleaseEvent(QKeyEvent *e) Q_DECL_OVERRIDE { releaseEvents << *e; } + void keyPressEvent(QKeyEvent *e) override { pressEvents << *e; } + void keyReleaseEvent(QKeyEvent *e) override { releaseEvents << *e; } }; void tst_QWebEngineView::unhandledKeyEventPropagation() @@ -879,7 +879,7 @@ public: explicit KeyboardAndMouseEventRecordingWidget(QWidget *parent = 0) : QWidget(parent), m_eventCounter(0) {} - bool event(QEvent *event) Q_DECL_OVERRIDE + bool event(QEvent *event) override { QString eventString; switch (event->type()) { diff --git a/tests/quicktestbrowser/ApplicationRoot.qml b/tests/quicktestbrowser/ApplicationRoot.qml index e2248e350..a2e83e1e6 100644 --- a/tests/quicktestbrowser/ApplicationRoot.qml +++ b/tests/quicktestbrowser/ApplicationRoot.qml @@ -53,7 +53,7 @@ QtObject { var newWindow = browserWindowComponent.createObject(root) newWindow.currentWebView.profile = profile profile.downloadRequested.connect(newWindow.onDownloadRequested) - profile.userNotification.connect(newWindow.onUserNotification) + profile.presentNotification.connect(newWindow.onPresentNotification) return newWindow } function createDialog(profile) { diff --git a/tests/quicktestbrowser/BrowserWindow.qml b/tests/quicktestbrowser/BrowserWindow.qml index 381e9c142..6c3c160ac 100644 --- a/tests/quicktestbrowser/BrowserWindow.qml +++ b/tests/quicktestbrowser/BrowserWindow.qml @@ -511,7 +511,7 @@ ApplicationWindow { standardButtons: StandardButton.Ok } - function onUserNotification(notification) { + function onPresentNotification(notification) { notificationDialog.title = notification.title notificationDialog.text = notification.origin.toString() + '\n' + notification.message notificationDialog.open() |