summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/Notifications
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit2/UIProcess/Notifications')
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotification.cpp3
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotification.h8
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp12
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h3
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in1
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp16
-rw-r--r--Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h2
7 files changed, 38 insertions, 7 deletions
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp
index 065bbbf7f..d6b209286 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp
@@ -33,9 +33,10 @@
namespace WebKit {
-WebNotification::WebNotification(const String& title, const String& body, const String& originString, uint64_t notificationID)
+WebNotification::WebNotification(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID)
: m_title(title)
, m_body(body)
+ , m_iconURL(iconURL)
, m_origin(WebSecurityOrigin::createFromString(originString))
, m_notificationID(notificationID)
{
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotification.h b/Source/WebKit2/UIProcess/Notifications/WebNotification.h
index 9447da427..4a6fc7e49 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotification.h
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotification.h
@@ -45,24 +45,26 @@ class WebNotification : public APIObject {
public:
static const Type APIType = TypeNotification;
- static PassRefPtr<WebNotification> create(const String& title, const String& body, const String& originString, uint64_t notificationID)
+ static PassRefPtr<WebNotification> create(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID)
{
- return adoptRef(new WebNotification(title, body, originString, notificationID));
+ return adoptRef(new WebNotification(title, body, iconURL, originString, notificationID));
}
const String& title() const { return m_title; }
const String& body() const { return m_body; }
+ const String& iconURL() const { return m_iconURL; }
WebSecurityOrigin* origin() const { return m_origin.get(); }
uint64_t notificationID() const { return m_notificationID; }
private:
- WebNotification(const String& title, const String& body, const String& originString, uint64_t notificationID);
+ WebNotification(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID);
virtual Type type() const { return APIType; }
String m_title;
String m_body;
+ String m_iconURL;
RefPtr<WebSecurityOrigin> m_origin;
uint64_t m_notificationID;
};
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp
index e74ad07b7..0c0850bee 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp
@@ -77,12 +77,12 @@ void WebNotificationManagerProxy::didReceiveMessage(CoreIPC::Connection* connect
didReceiveWebNotificationManagerProxyMessage(connection, messageID, arguments);
}
-void WebNotificationManagerProxy::show(WebPageProxy* page, const String& title, const String& body, const String& originString, uint64_t notificationID)
+void WebNotificationManagerProxy::show(WebPageProxy* page, const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID)
{
if (!isNotificationIDValid(notificationID))
return;
- RefPtr<WebNotification> notification = WebNotification::create(title, body, originString, notificationID);
+ RefPtr<WebNotification> notification = WebNotification::create(title, body, iconURL, originString, notificationID);
m_notifications.set(notificationID, notification);
m_provider.show(page, notification.get());
}
@@ -111,6 +111,14 @@ void WebNotificationManagerProxy::didDestroyNotification(uint64_t notificationID
m_provider.didDestroyNotification(notification.get());
}
+void WebNotificationManagerProxy::clearNotifications(const Vector<uint64_t>& notificationIDs)
+{
+ m_provider.clearNotifications(notificationIDs);
+ size_t count = notificationIDs.size();
+ for (size_t i = 0; i < count; ++i)
+ m_notifications.remove(notificationIDs[i]);
+}
+
void WebNotificationManagerProxy::providerDidShowNotification(uint64_t notificationID)
{
if (!m_context)
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h
index 8f4b9e9de..d62b9f28f 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h
@@ -60,7 +60,7 @@ public:
void initializeProvider(const WKNotificationProvider*);
void populateCopyOfNotificationPermissions(HashMap<String, bool>&);
- void show(WebPageProxy*, const String& title, const String& body, const String& originString, uint64_t notificationID);
+ void show(WebPageProxy*, const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID);
void providerDidShowNotification(uint64_t notificationID);
void providerDidClickNotification(uint64_t notificationID);
@@ -80,6 +80,7 @@ private:
// Message handlers
void cancel(uint64_t notificationID);
void didDestroyNotification(uint64_t notificationID);
+ void clearNotifications(const Vector<uint64_t>& notificationIDs);
typedef HashMap<uint64_t, RefPtr<WebNotification> > WebNotificationMap;
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in
index a06fd0292..a06e92812 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.messages.in
@@ -23,4 +23,5 @@
messages -> WebNotificationManagerProxy {
Cancel(uint64_t notificationID);
DidDestroyNotification(uint64_t notificationID);
+ ClearNotifications(Vector<uint64_t> notificationIDs);
}
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp
index afd13bccd..133e79aaa 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.cpp
@@ -27,9 +27,11 @@
#include "WebNotificationProvider.h"
#include "ImmutableDictionary.h"
+#include "MutableArray.h"
#include "WKAPICast.h"
#include "WebNotification.h"
#include "WebNotificationManagerProxy.h"
+#include "WebNumber.h"
#include "WebSecurityOrigin.h"
namespace WebKit {
@@ -58,6 +60,20 @@ void WebNotificationProvider::didDestroyNotification(WebNotification* notificati
m_client.didDestroyNotification(toAPI(notification), m_client.clientInfo);
}
+void WebNotificationProvider::clearNotifications(const Vector<uint64_t>& notificationIDs)
+{
+ if (!m_client.clearNotifications)
+ return;
+
+ RefPtr<MutableArray> arrayIDs = MutableArray::create();
+ size_t count = notificationIDs.size();
+ arrayIDs->reserveCapacity(count);
+ for (size_t i = 0; i < count; ++i)
+ arrayIDs->append(WebUInt64::create(notificationIDs[i]).leakRef());
+
+ m_client.clearNotifications(toAPI(arrayIDs.get()), m_client.clientInfo);
+}
+
void WebNotificationProvider::addNotificationManager(WebNotificationManagerProxy* manager)
{
if (!m_client.addNotificationManager)
diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h b/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h
index 8503ee27c..574b887a4 100644
--- a/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h
+++ b/Source/WebKit2/UIProcess/Notifications/WebNotificationProvider.h
@@ -29,6 +29,7 @@
#include "APIClient.h"
#include "WKNotificationProvider.h"
#include <wtf/Forward.h>
+#include <wtf/Vector.h>
namespace WebKit {
@@ -43,6 +44,7 @@ public:
void show(WebPageProxy*, WebNotification*);
void cancel(WebNotification*);
void didDestroyNotification(WebNotification*);
+ void clearNotifications(const Vector<uint64_t>& notificationIDs);
void addNotificationManager(WebNotificationManagerProxy*);
void removeNotificationManager(WebNotificationManagerProxy*);