summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2020-08-28 10:24:11 +0200
committerMichal Klocek <michal.klocek@qt.io>2020-11-18 19:03:19 +0100
commit6e81c97c32974cb761687dfb3afd3d5fa4944397 (patch)
tree8a9e9d5346fb003db3e7086bf784f92d369bb878 /src
parent2dcca95c142499baa7f10ffd99c9f085a06c52cf (diff)
Drop dependency on default notification presenter in profile
[ChangeLog] Set default notification presenter on all profiles. Change-Id: Iec96f97fdaddfefd5bbc0cccc54e6918d8e7ea7e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp4
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.cpp14
-rw-r--r--src/webenginewidgets/api/qwebengineprofile.h1
3 files changed, 15 insertions, 4 deletions
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index b56eb0bbd..4c191e100 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -39,7 +39,7 @@
#include "qwebenginepage.h"
#include "qwebenginepage_p.h"
-
+#include "qwebenginenotificationpresenter_p.h"
#include "authentication_dialog_controller.h"
#include "profile_adapter.h"
#include "color_chooser_controller.h"
@@ -158,6 +158,8 @@ QWebEnginePagePrivate::QWebEnginePagePrivate(QWebEngineProfile *_profile)
});
profile->d_ptr->addWebContentsAdapterClient(this);
+ if (!profile->notificationPresenter())
+ profile->setNotificationPresenter(&defaultNotificationPresenter);
}
QWebEnginePagePrivate::~QWebEnginePagePrivate()
diff --git a/src/webenginewidgets/api/qwebengineprofile.cpp b/src/webenginewidgets/api/qwebengineprofile.cpp
index 7aa168a6f..c2a6cdd45 100644
--- a/src/webenginewidgets/api/qwebengineprofile.cpp
+++ b/src/webenginewidgets/api/qwebengineprofile.cpp
@@ -43,7 +43,7 @@
#include "qwebenginecookiestore.h"
#include "qwebenginedownloadrequest.h"
#include "qwebenginedownloadrequest_p.h"
-#include "qwebenginenotificationpresenter_p.h"
+#include "qwebenginenotification.h"
#include "qwebenginepage.h"
#include "qwebenginepage_p.h"
#include "qwebenginesettings.h"
@@ -684,6 +684,16 @@ void QWebEngineProfile::setNotificationPresenter(std::function<void(std::unique_
}
/*!
+ Returns presenter responsible for presenting sent notifications
+ \since 6.0
+ */
+std::function<void(std::unique_ptr<QWebEngineNotification>)> QWebEngineProfile::notificationPresenter()
+{
+ Q_D(QWebEngineProfile);
+ return d->m_notificationPresenter;
+}
+
+/*!
Returns the default profile.
The default profile uses the storage name "Default".
@@ -695,8 +705,6 @@ QWebEngineProfile *QWebEngineProfile::defaultProfile()
static QWebEngineProfile* profile = new QWebEngineProfile(
new QWebEngineProfilePrivate(ProfileAdapter::createDefaultProfileAdapter()),
ProfileAdapter::globalQObjectRoot());
- if (!profile->d_ptr->m_notificationPresenter)
- profile->setNotificationPresenter(&defaultNotificationPresenter);
return profile;
}
diff --git a/src/webenginewidgets/api/qwebengineprofile.h b/src/webenginewidgets/api/qwebengineprofile.h
index a8bf70856..590f3d9ea 100644
--- a/src/webenginewidgets/api/qwebengineprofile.h
+++ b/src/webenginewidgets/api/qwebengineprofile.h
@@ -143,6 +143,7 @@ public:
void setDownloadPath(const QString &path);
void setNotificationPresenter(std::function<void(std::unique_ptr<QWebEngineNotification>)> notificationPresenter);
+ std::function<void(std::unique_ptr<QWebEngineNotification>)> notificationPresenter();
QWebEngineClientCertificateStore *clientCertificateStore();