summaryrefslogtreecommitdiff
path: root/src/webenginequick/api
diff options
context:
space:
mode:
authorSzabolcs David <davidsz@inf.u-szeged.hu>2022-03-10 18:11:49 +0100
committerSzabolcs David <davidsz@inf.u-szeged.hu>2022-09-12 18:01:24 +0200
commit0ca4eba9612fbcba988ca06c47f5738d4cb71fbd (patch)
tree2a7b609c44f7c5c9a5fd993e154d3b16f32e031b /src/webenginequick/api
parent74163a6511278fa8273ca931ffdf9b9b3a8daae6 (diff)
downloadqtwebengine-0ca4eba9612fbcba988ca06c47f5738d4cb71fbd.tar.gz
Enable Push Messaging
Use Chrome's implementation of PushMessagingService. This feature relies on notification permissions, so it is not different from Web Notification from end-users perspective. We don't persist push subscriptions, because it seems these have to be consistent with persisting notification permissions. Make address of push service configurable by a profile setting. It is empty by default - which means the feature is disabled until the user sets the address of a push service. Task-number: QTBUG-98904 Task-number: QTBUG-53457 Change-Id: If44f459fecf2da482c28fee5562f62fe40de103e Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webenginequick/api')
-rw-r--r--src/webenginequick/api/qquickwebengineprofile.cpp43
-rw-r--r--src/webenginequick/api/qquickwebengineprofile.h5
2 files changed, 48 insertions, 0 deletions
diff --git a/src/webenginequick/api/qquickwebengineprofile.cpp b/src/webenginequick/api/qquickwebengineprofile.cpp
index 1cfaab3f5..131e59ad0 100644
--- a/src/webenginequick/api/qquickwebengineprofile.cpp
+++ b/src/webenginequick/api/qquickwebengineprofile.cpp
@@ -821,6 +821,49 @@ QString QQuickWebEngineProfile::downloadPath() const
}
/*!
+ \qmlproperty string WebEngineProfile::pushServiceEndpoint
+ \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.
+*/
+
+/*!
+ \property QQuickWebEngineProfile::pushServiceEndpoint
+ \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.
+*/
+
+QUrl QQuickWebEngineProfile::pushServiceEndpoint() const
+{
+ const Q_D(QQuickWebEngineProfile);
+ return d->profileAdapter()->pushServiceEndpoint();
+}
+
+void QQuickWebEngineProfile::setPushServiceEndpoint(const QUrl &endpoint)
+{
+ Q_D(QQuickWebEngineProfile);
+ if (pushServiceEndpoint() == endpoint)
+ return;
+ d->profileAdapter()->setPushServiceEndpoint(endpoint);
+ emit pushServiceEndpointChanged();
+}
+
+/*!
Returns the cookie store for this profile.
*/
diff --git a/src/webenginequick/api/qquickwebengineprofile.h b/src/webenginequick/api/qquickwebengineprofile.h
index 77e367d02..36789acf0 100644
--- a/src/webenginequick/api/qquickwebengineprofile.h
+++ b/src/webenginequick/api/qquickwebengineprofile.h
@@ -37,6 +37,7 @@ class Q_WEBENGINEQUICK_EXPORT QQuickWebEngineProfile : public QObject {
Q_PROPERTY(bool spellCheckEnabled READ isSpellCheckEnabled WRITE setSpellCheckEnabled NOTIFY spellCheckEnabledChanged FINAL REVISION(1,3))
Q_PROPERTY(QQuickWebEngineScriptCollection *userScripts READ userScripts)
Q_PROPERTY(QString downloadPath READ downloadPath WRITE setDownloadPath NOTIFY downloadPathChanged FINAL REVISION(1,5))
+ Q_PROPERTY(QUrl pushServiceEndpoint READ pushServiceEndpoint WRITE setPushServiceEndpoint NOTIFY pushServiceEndpointChanged FINAL REVISION(6,5))
QML_NAMED_ELEMENT(WebEngineProfile)
QML_ADDED_IN_VERSION(1, 1)
QML_EXTRA_VERSION(2, 0)
@@ -108,6 +109,9 @@ public:
QString downloadPath() const;
void setDownloadPath(const QString &path);
+ QUrl pushServiceEndpoint() const;
+ void setPushServiceEndpoint(const QUrl &endpoint);
+
QWebEngineClientCertificateStore *clientCertificateStore();
static QQuickWebEngineProfile *defaultProfile();
@@ -125,6 +129,7 @@ Q_SIGNALS:
Q_REVISION(1,3) void spellCheckLanguagesChanged();
Q_REVISION(1,3) void spellCheckEnabledChanged();
Q_REVISION(1,5) void downloadPathChanged();
+ Q_REVISION(6,5) void pushServiceEndpointChanged();
void downloadRequested(QQuickWebEngineDownloadRequest *download);
void downloadFinished(QQuickWebEngineDownloadRequest *download);