diff options
author | Szabolcs David <davidsz@inf.u-szeged.hu> | 2022-03-10 18:11:49 +0100 |
---|---|---|
committer | Szabolcs David <davidsz@inf.u-szeged.hu> | 2022-09-12 18:01:24 +0200 |
commit | 0ca4eba9612fbcba988ca06c47f5738d4cb71fbd (patch) | |
tree | 2a7b609c44f7c5c9a5fd993e154d3b16f32e031b /src/core/api | |
parent | 74163a6511278fa8273ca931ffdf9b9b3a8daae6 (diff) | |
download | qtwebengine-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/core/api')
-rw-r--r-- | src/core/api/qwebengineprofile.cpp | 35 | ||||
-rw-r--r-- | src/core/api/qwebengineprofile.h | 3 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/core/api/qwebengineprofile.cpp b/src/core/api/qwebengineprofile.cpp index 4eacc8dc7..8c3dc8f3d 100644 --- a/src/core/api/qwebengineprofile.cpp +++ b/src/core/api/qwebengineprofile.cpp @@ -390,6 +390,41 @@ void QWebEngineProfile::setDownloadPath(const QString &path) } /*! + \since 6.5 + + The address used to create subscriptions for a push messaging service. + + \note By default, the endpoint is an empty URL and push messaging is disabled. + + \sa setPushServiceEndpoint() +*/ +QUrl QWebEngineProfile::pushServiceEndpoint() const +{ + const Q_D(QWebEngineProfile); + return d->profileAdapter()->pushServiceEndpoint(); +} + +/*! + \since 6.5 + + Enables push messaging feature by setting \a endpoint to a valid address used as a + push messaging service endpoint. 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/} + + If set back to the default empty URL, push messaging is disabled. + + \sa pushServiceEndpoint() +*/ +void QWebEngineProfile::setPushServiceEndpoint(const QUrl &endpoint) +{ + Q_D(QWebEngineProfile); + d->profileAdapter()->setPushServiceEndpoint(endpoint); +} + +/*! Returns the path used for caches. By default, this is below StandardPaths::CacheLocation in a QtWebengine/StorageName specific diff --git a/src/core/api/qwebengineprofile.h b/src/core/api/qwebengineprofile.h index c29202973..cd711727b 100644 --- a/src/core/api/qwebengineprofile.h +++ b/src/core/api/qwebengineprofile.h @@ -98,6 +98,9 @@ public: QString downloadPath() const; void setDownloadPath(const QString &path); + QUrl pushServiceEndpoint() const; + void setPushServiceEndpoint(const QUrl &endpoint); + void setNotificationPresenter(std::function<void(std::unique_ptr<QWebEngineNotification>)> notificationPresenter); QWebEngineClientCertificateStore *clientCertificateStore(); |