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.cpp107
1 files changed, 76 insertions, 31 deletions
diff --git a/src/webenginequick/api/qquickwebengineprofile.cpp b/src/webenginequick/api/qquickwebengineprofile.cpp
index 131e59ad0..edca5e99c 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>
@@ -104,6 +105,8 @@ QT_BEGIN_NAMESPACE
The download item is parented by the profile. If it is not accepted, it
will be deleted immediately after the signal emission.
This signal cannot be used with a queued connection.
+
+ \note To use from C++ static_cast \a download to QWebEngineDownloadRequest
*/
/*!
@@ -112,6 +115,8 @@ QT_BEGIN_NAMESPACE
This signal is emitted whenever downloading stops, because it finished successfully, was
cancelled, or was interrupted (for example, because connectivity was lost).
The \a download argument holds the state of the finished download instance.
+
+ \note To use from C++ static_cast \a download to QWebEngineDownloadRequest
*/
/*!
@@ -124,8 +129,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 +224,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 +294,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 +346,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 +372,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,46 +854,38 @@ QString QQuickWebEngineProfile::downloadPath() const
}
/*!
- \qmlproperty string WebEngineProfile::pushServiceEndpoint
+ \qmlproperty bool WebEngineProfile::isPushServiceEnabled
\since QtWebEngine 6.5
- The address used to create subscriptions for a push messaging service.
-
- Subscription requests for the push service will be sent to the concatenation
- of \a endpoint and a subscription ID (which is provided by the browser engine).
-
- \note Default endpoint used by Google Chrome browser is \c {https://fcm.googleapis.com/fcm/send/}
-
- \note By default, the endpoint is an empty URL and push messaging is disabled.
+ 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::pushServiceEndpoint
+ \property QQuickWebEngineProfile::isPushServiceEnabled
\since QtWebEngine 6.5
- The address used to create subscriptions for a push messaging service.
-
- Subscription requests for the push service will be sent to the concatenation
- of \a endpoint and a subscription ID (which is provided by the browser engine).
-
- \note Default endpoint used by Google Chrome browser is \c {https://fcm.googleapis.com/fcm/send/}
-
- \note By default, the endpoint is an empty URL and push messaging is disabled.
+ 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.
*/
-QUrl QQuickWebEngineProfile::pushServiceEndpoint() const
+bool QQuickWebEngineProfile::isPushServiceEnabled() const
{
const Q_D(QQuickWebEngineProfile);
- return d->profileAdapter()->pushServiceEndpoint();
+ return d->profileAdapter()->pushServiceEnabled();
}
-void QQuickWebEngineProfile::setPushServiceEndpoint(const QUrl &endpoint)
+void QQuickWebEngineProfile::setPushServiceEnabled(bool enabled)
{
Q_D(QQuickWebEngineProfile);
- if (pushServiceEndpoint() == endpoint)
+ if (isPushServiceEnabled() == enabled)
return;
- d->profileAdapter()->setPushServiceEndpoint(endpoint);
- emit pushServiceEndpointChanged();
+ d->profileAdapter()->setPushServiceEnabled(enabled);
+ emit pushServiceEnabledChanged();
}
/*!
@@ -879,7 +904,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()
*/
/*!
@@ -887,7 +916,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()
{
@@ -995,6 +1028,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)) {