summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2022-12-15 15:21:25 +0100
committerMichal Klocek <michal.klocek@qt.io>2022-12-22 14:30:46 +0100
commit4bedbe65c8af21e29e3ed274334ce1d32c8f9279 (patch)
tree5fd643be4d32856ee6c5f6d3c03d80c87c45f82f
parent3172695838372b54c2a488975578eaedaf094e80 (diff)
Remove setPushServiceEndpoint from API
Use setPushServiceEnabled instead. Update also getter and documentation. Task-number: QTBUG-107442 Pick-to: 6.5 Change-Id: I299ce88b06edef0f1a0088fb10f4a142056039be Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
-rw-r--r--src/core/api/qwebengineprofile.cpp28
-rw-r--r--src/core/api/qwebengineprofile.h4
-rw-r--r--src/core/profile_adapter.cpp9
-rw-r--r--src/core/profile_adapter.h6
-rw-r--r--src/core/profile_qt.cpp7
-rw-r--r--src/core/profile_qt.h1
-rw-r--r--src/webenginequick/api/qquickwebengineprofile.cpp40
-rw-r--r--src/webenginequick/api/qquickwebengineprofile.h8
-rw-r--r--tests/auto/quick/publicapi/tst_publicapi.cpp4
9 files changed, 45 insertions, 62 deletions
diff --git a/src/core/api/qwebengineprofile.cpp b/src/core/api/qwebengineprofile.cpp
index 8c3dc8f3d..fe783b75e 100644
--- a/src/core/api/qwebengineprofile.cpp
+++ b/src/core/api/qwebengineprofile.cpp
@@ -392,36 +392,32 @@ void QWebEngineProfile::setDownloadPath(const QString &path)
/*!
\since 6.5
- The address used to create subscriptions for a push messaging service.
+ Returns \c true if the push messaging service is enabled.
+ \note By default the push messaging service is disabled.
- \note By default, the endpoint is an empty URL and push messaging is disabled.
-
- \sa setPushServiceEndpoint()
+ \sa setPushServiceEnabled()
*/
-QUrl QWebEngineProfile::pushServiceEndpoint() const
+bool QWebEngineProfile::isPushServiceEnabled() const
{
const Q_D(QWebEngineProfile);
- return d->profileAdapter()->pushServiceEndpoint();
+ return d->profileAdapter()->pushServiceEnabled();
}
/*!
\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/}
+ Enables the push messaging service if \a enable is \c true, otherwise disables it.
- If set back to the default empty URL, push messaging is disabled.
+ \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 pushServiceEndpoint()
+ \sa isPushServiceEnabled()
*/
-void QWebEngineProfile::setPushServiceEndpoint(const QUrl &endpoint)
+void QWebEngineProfile::setPushServiceEnabled(bool enable)
{
Q_D(QWebEngineProfile);
- d->profileAdapter()->setPushServiceEndpoint(endpoint);
+ d->profileAdapter()->setPushServiceEnabled(enable);
}
/*!
diff --git a/src/core/api/qwebengineprofile.h b/src/core/api/qwebengineprofile.h
index cd711727b..9fb4c8e74 100644
--- a/src/core/api/qwebengineprofile.h
+++ b/src/core/api/qwebengineprofile.h
@@ -98,8 +98,8 @@ public:
QString downloadPath() const;
void setDownloadPath(const QString &path);
- QUrl pushServiceEndpoint() const;
- void setPushServiceEndpoint(const QUrl &endpoint);
+ bool isPushServiceEnabled() const;
+ void setPushServiceEnabled(bool enabled);
void setNotificationPresenter(std::function<void(std::unique_ptr<QWebEngineNotification>)> notificationPresenter);
diff --git a/src/core/profile_adapter.cpp b/src/core/profile_adapter.cpp
index 36c756a7e..e9e9aaeda 100644
--- a/src/core/profile_adapter.cpp
+++ b/src/core/profile_adapter.cpp
@@ -63,6 +63,7 @@ ProfileAdapter::ProfileAdapter(const QString &storageName):
, m_httpCacheType(DiskHttpCache)
, m_persistentCookiesPolicy(AllowPersistentCookies)
, m_visitedLinksPolicy(TrackVisitedLinksOnDisk)
+ , m_pushServiceEnabled(false)
, m_httpCacheMaxSize(0)
{
WebEngineContext::current()->addProfileAdapter(this);
@@ -628,14 +629,14 @@ bool ProfileAdapter::isSpellCheckEnabled() const
#endif
}
-QUrl ProfileAdapter::pushServiceEndpoint() const
+bool ProfileAdapter::pushServiceEnabled() const
{
- return m_pushServiceEndpoint;
+ return m_pushServiceEnabled;
}
-void ProfileAdapter::setPushServiceEndpoint(const QUrl &endpoint)
+void ProfileAdapter::setPushServiceEnabled(bool enabled)
{
- m_pushServiceEndpoint = endpoint;
+ m_pushServiceEnabled = enabled;
}
void ProfileAdapter::addWebContentsAdapterClient(WebContentsAdapterClient *client)
diff --git a/src/core/profile_adapter.h b/src/core/profile_adapter.h
index 90c5238b2..ab4622a4b 100644
--- a/src/core/profile_adapter.h
+++ b/src/core/profile_adapter.h
@@ -101,8 +101,8 @@ public:
void setSpellCheckEnabled(bool enabled);
bool isSpellCheckEnabled() const;
- QUrl pushServiceEndpoint() const;
- void setPushServiceEndpoint(const QUrl &endpoint);
+ bool pushServiceEnabled() const;
+ void setPushServiceEnabled(bool enabled);
void addWebContentsAdapterClient(WebContentsAdapterClient *client);
void removeWebContentsAdapterClient(WebContentsAdapterClient *client);
@@ -216,7 +216,6 @@ private:
QString m_httpUserAgent;
HttpCacheType m_httpCacheType;
QString m_httpAcceptLanguage;
- QUrl m_pushServiceEndpoint;
PersistentCookiesPolicy m_persistentCookiesPolicy;
VisitedLinksPolicy m_visitedLinksPolicy;
QHash<QByteArray, QPointer<QWebEngineUrlSchemeHandler>> m_customUrlSchemeHandlers;
@@ -225,6 +224,7 @@ private:
QList<ProfileAdapterClient*> m_clients;
QList<WebContentsAdapterClient *> m_webContentsAdapterClients;
+ bool m_pushServiceEnabled;
int m_httpCacheMaxSize;
QrcUrlSchemeHandler m_qrcHandler;
std::unique_ptr<base::CancelableTaskTracker> m_cancelableTaskTracker;
diff --git a/src/core/profile_qt.cpp b/src/core/profile_qt.cpp
index b1db2a2ce..410340fb8 100644
--- a/src/core/profile_qt.cpp
+++ b/src/core/profile_qt.cpp
@@ -159,14 +159,9 @@ storage::SpecialStoragePolicy *ProfileQt::GetSpecialStoragePolicy()
return nullptr;
}
-std::string ProfileQt::GetPushMessagingEndpoint() const
-{
- return m_profileAdapter->pushServiceEndpoint().toString().toStdString();
-}
-
content::PushMessagingService *ProfileQt::GetPushMessagingService()
{
- if (!m_profileAdapter->pushServiceEndpoint().isEmpty())
+ if (m_profileAdapter->pushServiceEnabled())
return PushMessagingServiceFactory::GetForProfile(this);
else
return nullptr;
diff --git a/src/core/profile_qt.h b/src/core/profile_qt.h
index 787c13148..9fb8cb444 100644
--- a/src/core/profile_qt.h
+++ b/src/core/profile_qt.h
@@ -56,7 +56,6 @@ public:
content::PlatformNotificationService *GetPlatformNotificationService() override;
std::string GetMediaDeviceIDSalt() override;
content::FileSystemAccessPermissionContext *GetFileSystemAccessPermissionContext() override;
- std::string GetPushMessagingEndpoint() const override;
content::ReduceAcceptLanguageControllerDelegate *GetReduceAcceptLanguageControllerDelegate() override;
// Profile implementation:
diff --git a/src/webenginequick/api/qquickwebengineprofile.cpp b/src/webenginequick/api/qquickwebengineprofile.cpp
index 131e59ad0..1badd25be 100644
--- a/src/webenginequick/api/qquickwebengineprofile.cpp
+++ b/src/webenginequick/api/qquickwebengineprofile.cpp
@@ -821,46 +821,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();
}
/*!
diff --git a/src/webenginequick/api/qquickwebengineprofile.h b/src/webenginequick/api/qquickwebengineprofile.h
index 36789acf0..29d6ee0b2 100644
--- a/src/webenginequick/api/qquickwebengineprofile.h
+++ b/src/webenginequick/api/qquickwebengineprofile.h
@@ -37,7 +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))
+ Q_PROPERTY(bool isPushServiceEnabled READ isPushServiceEnabled WRITE setPushServiceEnabled NOTIFY pushServiceEnabledChanged FINAL REVISION(6,5))
QML_NAMED_ELEMENT(WebEngineProfile)
QML_ADDED_IN_VERSION(1, 1)
QML_EXTRA_VERSION(2, 0)
@@ -109,8 +109,8 @@ public:
QString downloadPath() const;
void setDownloadPath(const QString &path);
- QUrl pushServiceEndpoint() const;
- void setPushServiceEndpoint(const QUrl &endpoint);
+ bool isPushServiceEnabled() const;
+ void setPushServiceEnabled(bool enable);
QWebEngineClientCertificateStore *clientCertificateStore();
@@ -129,7 +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();
+ Q_REVISION(6,5) void pushServiceEnabledChanged();
void downloadRequested(QQuickWebEngineDownloadRequest *download);
void downloadFinished(QQuickWebEngineDownloadRequest *download);
diff --git a/tests/auto/quick/publicapi/tst_publicapi.cpp b/tests/auto/quick/publicapi/tst_publicapi.cpp
index 7e4acc97c..0cd031940 100644
--- a/tests/auto/quick/publicapi/tst_publicapi.cpp
+++ b/tests/auto/quick/publicapi/tst_publicapi.cpp
@@ -363,8 +363,8 @@ static const QStringList expectedAPI = QStringList()
<< "QQuickWebEngineProfile.persistentCookiesPolicyChanged() --> void"
<< "QQuickWebEngineProfile.persistentStoragePath --> QString"
<< "QQuickWebEngineProfile.persistentStoragePathChanged() --> void"
- << "QQuickWebEngineProfile.pushServiceEndpoint --> QUrl"
- << "QQuickWebEngineProfile.pushServiceEndpointChanged() --> void"
+ << "QQuickWebEngineProfile.isPushServiceEnabled --> bool"
+ << "QQuickWebEngineProfile.pushServiceEnabledChanged() --> void"
<< "QQuickWebEngineProfile.spellCheckEnabled --> bool"
<< "QQuickWebEngineProfile.spellCheckEnabledChanged() --> void"
<< "QQuickWebEngineProfile.spellCheckLanguages --> QStringList"