diff options
Diffstat (limited to 'src/core/api/qwebengineprofile.cpp')
-rw-r--r-- | src/core/api/qwebengineprofile.cpp | 79 |
1 files changed, 76 insertions, 3 deletions
diff --git a/src/core/api/qwebengineprofile.cpp b/src/core/api/qwebengineprofile.cpp index 4eacc8dc7..dbb98102c 100644 --- a/src/core/api/qwebengineprofile.cpp +++ b/src/core/api/qwebengineprofile.cpp @@ -3,6 +3,7 @@ #include "qwebengineprofile.h" #include "qwebengineprofile_p.h" +#include "qwebengineclienthints.h" #include "qwebenginecookiestore.h" #include "qwebenginedownloadrequest.h" #include "qwebenginedownloadrequest_p.h" @@ -128,11 +129,22 @@ void QWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineCore:: \sa QWebEngineDownloadRequest, QWebEnginePage::download() */ +/*! + \fn QWebEngineProfile::clearHttpCacheCompleted() + + \since 6.7 + + This signal is emitted when the clearHttpCache() operation is completed. + + \sa QWebEngineProfile::clearHttpCache() +*/ + QWebEngineProfilePrivate::QWebEngineProfilePrivate(ProfileAdapter* profileAdapter) : m_settings(new QWebEngineSettings()) , m_profileAdapter(profileAdapter) , m_scriptCollection(new QWebEngineScriptCollection( new QWebEngineScriptCollectionPrivate(profileAdapter->userResourceController()))) + , m_clientHints(new QWebEngineClientHints(profileAdapter)) { m_profileAdapter->addClient(this); } @@ -186,11 +198,14 @@ void QWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info) Q_Q(QWebEngineProfile); Q_ASSERT(!m_ongoingDownloads.contains(info.id)); - QWebEngineDownloadRequestPrivate *itemPrivate = new QWebEngineDownloadRequestPrivate(m_profileAdapter, info.url); + QWebEngineDownloadRequestPrivate *itemPrivate = + new QWebEngineDownloadRequestPrivate(m_profileAdapter); itemPrivate->downloadId = info.id; itemPrivate->downloadState = info.accepted ? QWebEngineDownloadRequest::DownloadInProgress : QWebEngineDownloadRequest::DownloadRequested; itemPrivate->startTime = info.startTime; + itemPrivate->downloadUrl = info.url; + itemPrivate->totalBytes = info.totalBytes; itemPrivate->downloadDirectory = QFileInfo(info.path).path(); itemPrivate->downloadFileName = QFileInfo(info.path).fileName(); itemPrivate->suggestedFileName = info.suggestedFileName; @@ -238,6 +253,12 @@ void QWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info) download->d_func()->update(info); } +void QWebEngineProfilePrivate::clearHttpCacheCompleted() +{ + Q_Q(QWebEngineProfile); + Q_EMIT q->clearHttpCacheCompleted(); +} + void QWebEngineProfilePrivate::addWebContentsAdapterClient(QtWebEngineCore::WebContentsAdapterClient *adapter) { Q_ASSERT(m_profileAdapter); @@ -390,6 +411,37 @@ void QWebEngineProfile::setDownloadPath(const QString &path) } /*! + \since 6.5 + + Returns \c true if the push messaging service is enabled. + \note By default the push messaging service is disabled. + + \sa setPushServiceEnabled() +*/ +bool QWebEngineProfile::isPushServiceEnabled() const +{ + const Q_D(QWebEngineProfile); + return d->profileAdapter()->pushServiceEnabled(); +} + +/*! + \since 6.5 + + Enables the push messaging service if \a enable is \c true, otherwise disables it. + + \note \QWE uses \l {https://firebase.google.com}{Firebase Cloud Messaging (FCM)} + as a browser push service. Therefore, all push messages will go through the + Google push service and its respective servers. + + \sa isPushServiceEnabled() +*/ +void QWebEngineProfile::setPushServiceEnabled(bool enable) +{ + Q_D(QWebEngineProfile); + d->profileAdapter()->setPushServiceEnabled(enable); +} + +/*! Returns the path used for caches. By default, this is below StandardPaths::CacheLocation in a QtWebengine/StorageName specific @@ -426,7 +478,7 @@ void QWebEngineProfile::setCachePath(const QString &path) "Windows NT 6.2" (Windows 8), unless the application does contain a manifest that declares newer Windows versions as supported. - \sa setHttpUserAgent() + \sa setHttpUserAgent(), {windows_manifest} {Windows Application Manifest} */ QString QWebEngineProfile::httpUserAgent() const { @@ -461,7 +513,10 @@ QWebEngineProfile::HttpCacheType QWebEngineProfile::httpCacheType() const /*! Sets the HTTP cache type to \a httpCacheType. - \sa httpCacheType(), setCachePath() + \note Setting the \a httpCacheType to NoCache on the profile, which has already some cache + entries does not trigger the removal of those entries. + + \sa httpCacheType(), setCachePath(), clearHttpCache() */ void QWebEngineProfile::setHttpCacheType(QWebEngineProfile::HttpCacheType httpCacheType) { @@ -780,6 +835,12 @@ void QWebEngineProfile::removeAllUrlSchemeHandlers() \since 5.7 Removes the profile's cache entries. + + \note Make sure that you do not start new navigation or any operation on the profile while + the clear operation is in progress. The clearHttpCacheCompleted() signal notifies about the + completion. + + \sa QWebEngineProfile::clearHttpCacheCompleted() */ void QWebEngineProfile::clearHttpCache() { @@ -868,6 +929,18 @@ void QWebEngineProfile::requestIconForIconURL(const QUrl &url, int desiredSizeIn iconAvailableCallback); } +/*! + Return the Client Hints settings associated with this browsing context. + + \since 6.8 + \sa QWebEngineClientHints +*/ +QWebEngineClientHints *QWebEngineProfile::clientHints() const +{ + Q_D(const QWebEngineProfile); + return d->m_clientHints.data(); +} + QT_END_NAMESPACE #include "moc_qwebengineprofile.cpp" |