summaryrefslogtreecommitdiffstats
path: root/src/webenginequick/api/qquickwebengineprofile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/webenginequick/api/qquickwebengineprofile.cpp')
-rw-r--r--src/webenginequick/api/qquickwebengineprofile.cpp98
1 files changed, 91 insertions, 7 deletions
diff --git a/src/webenginequick/api/qquickwebengineprofile.cpp b/src/webenginequick/api/qquickwebengineprofile.cpp
index 1cfaab3f5..7c3d11fcf 100644
--- a/src/webenginequick/api/qquickwebengineprofile.cpp
+++ b/src/webenginequick/api/qquickwebengineprofile.cpp
@@ -14,6 +14,7 @@
#include <QtWebEngineCore/qwebenginescriptcollection.h>
#include <QtWebEngineCore/private/qwebenginescriptcollection_p.h>
+#include <QtWebEngineCore/qwebengineclienthints.h>
#include <QtWebEngineCore/qwebenginecookiestore.h>
#include <QtWebEngineCore/qwebenginenotification.h>
#include <QtWebEngineCore/private/qwebenginedownloadrequest_p.h>
@@ -124,8 +125,18 @@ QT_BEGIN_NAMESPACE
\sa WebEngineProfile::presentNotification
*/
+/*!
+ \fn QQuickWebEngineProfile::clearHttpCacheCompleted()
+ \since 6.7
+
+ This signal is emitted when the clearHttpCache() operation is completed.
+
+ \sa clearHttpCache()
+*/
+
QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(ProfileAdapter *profileAdapter)
: m_settings(new QQuickWebEngineSettings())
+ , m_clientHints(new QWebEngineClientHints(profileAdapter))
, m_profileAdapter(profileAdapter)
{
profileAdapter->addClient(this);
@@ -209,10 +220,13 @@ void QQuickWebEngineProfilePrivate::downloadRequested(DownloadItemInfo &info)
Q_Q(QQuickWebEngineProfile);
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 = QWebEngineDownloadRequest::DownloadRequested;
+ itemPrivate->downloadState = info.accepted ? QWebEngineDownloadRequest::DownloadInProgress
+ : QWebEngineDownloadRequest::DownloadRequested;
itemPrivate->startTime = info.startTime;
+ itemPrivate->downloadUrl = info.url;
itemPrivate->totalBytes = info.totalBytes;
itemPrivate->mimeType = info.mimeType;
itemPrivate->downloadDirectory = QFileInfo(info.path).path();
@@ -276,6 +290,12 @@ void QQuickWebEngineProfilePrivate::showNotification(QSharedPointer<QtWebEngineC
Q_EMIT q->presentNotification(notification);
}
+void QQuickWebEngineProfilePrivate::clearHttpCacheCompleted()
+{
+ Q_Q(QQuickWebEngineProfile);
+ Q_EMIT q->clearHttpCacheCompleted();
+}
+
QQuickWebEngineScriptCollection *QQuickWebEngineProfilePrivate::getUserScripts()
{
Q_Q(QQuickWebEngineProfile);
@@ -322,16 +342,16 @@ QQuickWebEngineScriptCollection *QQuickWebEngineProfilePrivate::getUserScripts()
*/
/*!
- \qmlsignal WebEngineProfile::downloadRequested(WebEngineDownloadItem download)
+ \qmlsignal WebEngineProfile::downloadRequested(WebEngineDownloadRequest download)
This signal is emitted whenever a download has been triggered.
The \a download argument holds the state of the download.
- The download has to be explicitly accepted with WebEngineDownloadItem::accept() or the
+ The download has to be explicitly accepted with WebEngineDownloadRequest::accept() or the
download will be cancelled by default.
*/
/*!
- \qmlsignal WebEngineProfile::downloadFinished(WebEngineDownloadItem download)
+ \qmlsignal WebEngineProfile::downloadFinished(WebEngineDownloadRequest download)
This signal is emitted whenever downloading stops, because it finished successfully, was
cancelled, or was interrupted (for example, because connectivity was lost).
@@ -348,6 +368,15 @@ QQuickWebEngineScriptCollection *QQuickWebEngineProfilePrivate::getUserScripts()
*/
/*!
+ \qmlsignal WebEngineProfile::clearHttpCacheCompleted()
+ \since QtWebEngine 6.7
+
+ This signal is emitted when the clearHttpCache() operation is completed.
+
+ \sa clearHttpCache()
+*/
+
+/*!
Constructs a new profile with the parent \a parent.
*/
QQuickWebEngineProfile::QQuickWebEngineProfile(QObject *parent)
@@ -821,6 +850,41 @@ QString QQuickWebEngineProfile::downloadPath() const
}
/*!
+ \qmlproperty bool WebEngineProfile::isPushServiceEnabled
+ \since QtWebEngine 6.5
+
+ Whether the push messaging service is enabled.
+ \note By default the push messaging service is disabled.
+ \note \QWE uses the \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.
+*/
+
+/*!
+ \property QQuickWebEngineProfile::isPushServiceEnabled
+ \since QtWebEngine 6.5
+
+ Whether the push messaging service is enabled.
+ \note By default the push messaging service is disabled.
+ \note \QWE uses the \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.
+*/
+
+bool QQuickWebEngineProfile::isPushServiceEnabled() const
+{
+ const Q_D(QQuickWebEngineProfile);
+ return d->profileAdapter()->pushServiceEnabled();
+}
+
+void QQuickWebEngineProfile::setPushServiceEnabled(bool enabled)
+{
+ Q_D(QQuickWebEngineProfile);
+ if (isPushServiceEnabled() == enabled)
+ return;
+ d->profileAdapter()->setPushServiceEnabled(enabled);
+ emit pushServiceEnabledChanged();
+}
+
+/*!
Returns the cookie store for this profile.
*/
@@ -836,7 +900,11 @@ QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const
Removes the profile's cache entries.
- \sa WebEngineProfile::cachePath
+ \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 WebEngineProfile::cachePath clearHttpCacheCompleted()
*/
/*!
@@ -844,7 +912,11 @@ QWebEngineCookieStore *QQuickWebEngineProfile::cookieStore() const
Removes the profile's cache entries.
- \sa WebEngineProfile::clearHttpCache
+ \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 WebEngineProfile::clearHttpCache() clearHttpCacheCompleted()
*/
void QQuickWebEngineProfile::clearHttpCache()
{
@@ -952,6 +1024,18 @@ QWebEngineClientCertificateStore *QQuickWebEngineProfile::clientCertificateStore
#endif
}
+/*!
+ Return the Client Hints settings associated with this browsing context.
+
+ \since 6.8
+ \sa QWebEngineClientHints
+*/
+QWebEngineClientHints *QQuickWebEngineProfile::clientHints() const
+{
+ Q_D(const QQuickWebEngineProfile);
+ return d->m_clientHints.data();
+}
+
void QQuickWebEngineProfile::ensureQmlContext(const QObject *object)
{
if (!qmlContext(this)) {