From 3839e65f910a7e110404e9d8cb8387366fcf0e1d Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 26 Feb 2019 18:03:29 +0100 Subject: API cleanup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on review feedback Change-Id: Ide40d4fd563ea682eaa2cc457d857445adea85cd Reviewed-by: Jüri Valdmann --- src/core/api/qwebengineurlrequestjob.cpp | 2 +- src/core/api/qwebengineurlrequestjob.h | 2 +- src/core/net/url_request_custom_job_delegate.cpp | 2 +- src/core/net/url_request_custom_job_delegate.h | 2 +- src/webenginewidgets/api/qwebengineprofile.cpp | 22 +++++++--------------- src/webenginewidgets/api/qwebengineprofile.h | 5 ++--- 6 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/core/api/qwebengineurlrequestjob.cpp b/src/core/api/qwebengineurlrequestjob.cpp index 41b43d42c..bc860b3b3 100644 --- a/src/core/api/qwebengineurlrequestjob.cpp +++ b/src/core/api/qwebengineurlrequestjob.cpp @@ -143,7 +143,7 @@ QUrl QWebEngineUrlRequestJob::initiator() const \since 5.13 Returns any HTTP headers added to the request. */ -const QMap &QWebEngineUrlRequestJob::requestHeaders() const +QMap QWebEngineUrlRequestJob::requestHeaders() const { return d_ptr->requestHeaders(); } diff --git a/src/core/api/qwebengineurlrequestjob.h b/src/core/api/qwebengineurlrequestjob.h index 55ec7c6d2..b2dd8baa3 100644 --- a/src/core/api/qwebengineurlrequestjob.h +++ b/src/core/api/qwebengineurlrequestjob.h @@ -73,7 +73,7 @@ public: QUrl requestUrl() const; QByteArray requestMethod() const; QUrl initiator() const; - const QMap &requestHeaders() const; + QMap requestHeaders() const; void reply(const QByteArray &contentType, QIODevice *device); void fail(Error error); diff --git a/src/core/net/url_request_custom_job_delegate.cpp b/src/core/net/url_request_custom_job_delegate.cpp index 83d47e291..b5a7a55a7 100644 --- a/src/core/net/url_request_custom_job_delegate.cpp +++ b/src/core/net/url_request_custom_job_delegate.cpp @@ -83,7 +83,7 @@ QUrl URLRequestCustomJobDelegate::initiator() const return m_initiatorOrigin; } -const QMap &URLRequestCustomJobDelegate::requestHeaders() const +QMap URLRequestCustomJobDelegate::requestHeaders() const { return m_requestHeaders; } diff --git a/src/core/net/url_request_custom_job_delegate.h b/src/core/net/url_request_custom_job_delegate.h index 9de0224f9..1bf3ade1f 100644 --- a/src/core/net/url_request_custom_job_delegate.h +++ b/src/core/net/url_request_custom_job_delegate.h @@ -81,7 +81,7 @@ public: QUrl url() const; QByteArray method() const; QUrl initiator() const; - const QMap &requestHeaders() const; + QMap requestHeaders() const; void reply(const QByteArray &contentType, QIODevice *device); void redirect(const QUrl& url); diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp index 32c000755..5b4b540cc 100644 --- a/src/webenginewidgets/api/qwebengineprofile.cpp +++ b/src/webenginewidgets/api/qwebengineprofile.cpp @@ -648,16 +648,7 @@ QWebEngineScriptCollection *QWebEngineProfile::scripts() const \since 5.13 \sa QWebEngineNotification */ -void QWebEngineProfile::setNotificationPresenter(const std::function ¬ificationPresenter) -{ - Q_D(QWebEngineProfile); - d->m_notificationPresenter = notificationPresenter; -} - -/*! - \overload -*/ -void QWebEngineProfile::setNotificationPresenter(std::function &¬ificationPresenter) +void QWebEngineProfile::setNotificationPresenter(std::function notificationPresenter) { Q_D(QWebEngineProfile); d->m_notificationPresenter = std::move(notificationPresenter); @@ -809,12 +800,13 @@ void QWebEngineProfile::removeAllUrlSchemeHandlers() /*! \since 5.13 - Sets this profile to be used for downloading and caching when needed during - certificate verification, for instance for OCSP, CRLs, and AIA. + Sets if this profile is to be used for downloading and caching when needed + during certificate verification, for instance for OCSP, CRLs, and AIA. Only one QWebEngineProfile can do this at a time, and it is recommended that the profile fullfilling this role has a disk HTTP cache to avoid - needlessly re-downloading. + needlessly re-downloading. If you set the option on a second profile, + it will be disabled on the profile it is currently set. Currently only affects Linux/NSS installations where it enables OCSP. @@ -823,10 +815,10 @@ void QWebEngineProfile::removeAllUrlSchemeHandlers() \sa isUsedForGlobalCertificateVerification(), httpCacheType() */ -void QWebEngineProfile::setUseForGlobalCertificateVerification() +void QWebEngineProfile::setUseForGlobalCertificateVerification(bool enabled) { Q_D(QWebEngineProfile); - d->profileAdapter()->setUseForGlobalCertificateVerification(); + d->profileAdapter()->setUseForGlobalCertificateVerification(enabled); } /*! diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h index 5ad999c00..6ffbd8a66 100644 --- a/src/webenginewidgets/api/qwebengineprofile.h +++ b/src/webenginewidgets/api/qwebengineprofile.h @@ -134,14 +134,13 @@ public: void setSpellCheckEnabled(bool enabled); bool isSpellCheckEnabled() const; - void setUseForGlobalCertificateVerification(); + void setUseForGlobalCertificateVerification(bool enabled = true); bool isUsedForGlobalCertificateVerification() const; QString downloadPath() const; void setDownloadPath(const QString &path); - void setNotificationPresenter(const std::function ¬ificationPresenter); - void setNotificationPresenter(std::function &¬ificationPresenter); + void setNotificationPresenter(std::function notificationPresenter); static QWebEngineProfile *defaultProfile(); -- cgit v1.2.3