Add support for notification replaceId in Mac WebKit and WK2
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Mar 2012 18:34:14 +0000 (18:34 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 5 Mar 2012 18:34:14 +0000 (18:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=80206
<rdar://problem/10965574>

Reviewed by Sam Weinig.

Source/WebKit/mac:

* WebView/WebNotification.h: Add replaceID method.
* WebView/WebNotification.mm:
(-[WebNotification replaceID]):

Source/WebKit2:

* UIProcess/API/C/WKNotification.cpp: Add WK API.
(WKNotificationCopyReplaceID):
* UIProcess/API/C/WKNotification.h:
* UIProcess/Notifications/WebNotification.cpp:
(WebKit::WebNotification::WebNotification):
* UIProcess/Notifications/WebNotification.h: Add replaceID member.
(WebKit::WebNotification::create):
(WebKit::WebNotification::replaceID):
(WebNotification):
* UIProcess/Notifications/WebNotificationManagerProxy.cpp:
(WebKit::WebNotificationManagerProxy::show):
* UIProcess/Notifications/WebNotificationManagerProxy.h:
(WebNotificationManagerProxy):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::showNotification):
* UIProcess/WebPageProxy.h:
(WebPageProxy):
* UIProcess/WebPageProxy.messages.in: Add replaceID to the showNotification message.
* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::show):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@109766 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebNotification.h
Source/WebKit/mac/WebView/WebNotification.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKNotification.cpp
Source/WebKit2/UIProcess/API/C/WKNotification.h
Source/WebKit2/UIProcess/Notifications/WebNotification.cpp
Source/WebKit2/UIProcess/Notifications/WebNotification.h
Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp
Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp

index 0fdec3fd455b0e1e1631d4bede2523088c9b5c41..288105bfc46ee58e090fca547cb65dffb4fb6ea6 100644 (file)
@@ -1,3 +1,15 @@
+2012-03-02  Jon Lee  <jonlee@apple.com>
+
+        Add support for notification replaceId in Mac WebKit and WK2
+        https://bugs.webkit.org/show_bug.cgi?id=80206
+        <rdar://problem/10965574>
+
+        Reviewed by Sam Weinig.
+
+        * WebView/WebNotification.h: Add replaceID method.
+        * WebView/WebNotification.mm:
+        (-[WebNotification replaceID]):
+
 2012-03-05  Adam Barth  <abarth@webkit.org>
 
         Geolocation should use a ScriptExecutionContext as its context object
 2012-03-05  Adam Barth  <abarth@webkit.org>
 
         Geolocation should use a ScriptExecutionContext as its context object
index c04b2ad072e4cf1432d810384bb2fe499f2a2d7c..8ecc1068674ec498316d63642313b09e0b1246a1 100644 (file)
@@ -36,6 +36,7 @@
 
 - (NSString *)title;
 - (NSString *)body;
 
 - (NSString *)title;
 - (NSString *)body;
+- (NSString *)replaceID;
 - (WebSecurityOrigin *)origin;
 - (uint64_t)notificationID;
 
 - (WebSecurityOrigin *)origin;
 - (uint64_t)notificationID;
 
index bbd0248f619d758fd30eb2a450a5e1c2a164cd68..557332cba1b08299c334e1a25268643d6014ee06 100644 (file)
@@ -101,6 +101,16 @@ Notification* core(WebNotification *notification)
 #endif
 }
 
 #endif
 }
 
+- (NSString *)replaceID
+{
+#if ENABLE(NOTIFICATIONS)
+    ASSERT(core(self));
+    return core(self)->replaceId();
+#else
+    return nil;
+#endif
+}
+
 - (WebSecurityOrigin *)origin
 {
 #if ENABLE(NOTIFICATIONS)
 - (WebSecurityOrigin *)origin
 {
 #if ENABLE(NOTIFICATIONS)
index 7e53fdb2324935a39e93c32069adff4183674e84..18744eb29efea2d90bd97f023c83fb43bc8c3567 100644 (file)
@@ -1,3 +1,32 @@
+2012-03-02  Jon Lee  <jonlee@apple.com>
+
+        Add support for notification replaceId in Mac WebKit and WK2
+        https://bugs.webkit.org/show_bug.cgi?id=80206
+        <rdar://problem/10965574>
+
+        Reviewed by Sam Weinig.
+
+        * UIProcess/API/C/WKNotification.cpp: Add WK API.
+        (WKNotificationCopyReplaceID):
+        * UIProcess/API/C/WKNotification.h:
+        * UIProcess/Notifications/WebNotification.cpp:
+        (WebKit::WebNotification::WebNotification):
+        * UIProcess/Notifications/WebNotification.h: Add replaceID member.
+        (WebKit::WebNotification::create):
+        (WebKit::WebNotification::replaceID):
+        (WebNotification):
+        * UIProcess/Notifications/WebNotificationManagerProxy.cpp:
+        (WebKit::WebNotificationManagerProxy::show):
+        * UIProcess/Notifications/WebNotificationManagerProxy.h:
+        (WebNotificationManagerProxy):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::showNotification):
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        * UIProcess/WebPageProxy.messages.in: Add replaceID to the showNotification message.
+        * WebProcess/Notifications/WebNotificationManager.cpp:
+        (WebKit::WebNotificationManager::show):
+
 2012-03-05  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r109748.
 2012-03-05  Sheriff Bot  <webkit.review.bot@gmail.com>
 
         Unreviewed, rolling out r109748.
index 634aa9824877545fd3097cb9c5c3fe48bc7084eb..5dfcbba29fb33d8303522e13f04a84b0006a1951 100644 (file)
@@ -52,6 +52,11 @@ WKStringRef WKNotificationCopyIconURL(WKNotificationRef notification)
     return toCopiedAPI(toImpl(notification)->iconURL());
 }
 
     return toCopiedAPI(toImpl(notification)->iconURL());
 }
 
+WKStringRef WKNotificationCopyReplaceID(WKNotificationRef notification)
+{
+    return toCopiedAPI(toImpl(notification)->replaceID());
+}
+
 WKSecurityOriginRef WKNotificationGetSecurityOrigin(WKNotificationRef notification)
 {
     return toAPI(toImpl(notification)->origin());
 WKSecurityOriginRef WKNotificationGetSecurityOrigin(WKNotificationRef notification)
 {
     return toAPI(toImpl(notification)->origin());
index 7c2723896b8e0c4064d828b480e30592623989a8..11ea9727537e03deb380aaafb9882cf2b61dded3 100644 (file)
@@ -37,6 +37,7 @@ WK_EXPORT WKTypeID WKNotificationGetTypeID();
 WK_EXPORT WKStringRef WKNotificationCopyTitle(WKNotificationRef notification);
 WK_EXPORT WKStringRef WKNotificationCopyBody(WKNotificationRef notification);
 WK_EXPORT WKStringRef WKNotificationCopyIconURL(WKNotificationRef notification);
 WK_EXPORT WKStringRef WKNotificationCopyTitle(WKNotificationRef notification);
 WK_EXPORT WKStringRef WKNotificationCopyBody(WKNotificationRef notification);
 WK_EXPORT WKStringRef WKNotificationCopyIconURL(WKNotificationRef notification);
+WK_EXPORT WKStringRef WKNotificationCopyReplaceID(WKNotificationRef notification);
 WK_EXPORT WKSecurityOriginRef WKNotificationGetSecurityOrigin(WKNotificationRef notification);
 WK_EXPORT uint64_t WKNotificationGetID(WKNotificationRef notification);
 
 WK_EXPORT WKSecurityOriginRef WKNotificationGetSecurityOrigin(WKNotificationRef notification);
 WK_EXPORT uint64_t WKNotificationGetID(WKNotificationRef notification);
 
index d6b2092863559727b240b9da764a381cac9caece..99ba0ede1b099d9d91d63e29af8c45907dea1401 100644 (file)
 
 namespace WebKit {
 
 
 namespace WebKit {
 
-WebNotification::WebNotification(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID)
+WebNotification::WebNotification(const String& title, const String& body, const String& iconURL, const String& replaceID, const String& originString, uint64_t notificationID)
     : m_title(title)
     , m_body(body)
     , m_iconURL(iconURL)
     : m_title(title)
     , m_body(body)
     , m_iconURL(iconURL)
+    , m_replaceID(replaceID)
     , m_origin(WebSecurityOrigin::createFromString(originString))
     , m_notificationID(notificationID)
 {
     , m_origin(WebSecurityOrigin::createFromString(originString))
     , m_notificationID(notificationID)
 {
index 4a6fc7e4923839492f4dd3b37e51d74978f77ddc..19bda4050d077ad377d2c4ce130683f9cc1df210 100644 (file)
@@ -45,26 +45,28 @@ class WebNotification : public APIObject {
 public:
     static const Type APIType = TypeNotification;
     
 public:
     static const Type APIType = TypeNotification;
     
-    static PassRefPtr<WebNotification> create(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID)
+    static PassRefPtr<WebNotification> create(const String& title, const String& body, const String& iconURL, const String& replaceID, const String& originString, uint64_t notificationID)
     {
     {
-        return adoptRef(new WebNotification(title, body, iconURL, originString, notificationID));
+        return adoptRef(new WebNotification(title, body, iconURL, replaceID, originString, notificationID));
     }
     
     const String& title() const { return m_title; }
     const String& body() const { return m_body; }
     const String& iconURL() const { return m_iconURL; }
     }
     
     const String& title() const { return m_title; }
     const String& body() const { return m_body; }
     const String& iconURL() const { return m_iconURL; }
+    const String& replaceID() const { return m_replaceID; }
     WebSecurityOrigin* origin() const { return m_origin.get(); }
     
     uint64_t notificationID() const { return m_notificationID; }
 
 private:
     WebSecurityOrigin* origin() const { return m_origin.get(); }
     
     uint64_t notificationID() const { return m_notificationID; }
 
 private:
-    WebNotification(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID);
+    WebNotification(const String& title, const String& body, const String& iconURL, const String& replaceID, const String& originString, uint64_t notificationID);
 
     virtual Type type() const { return APIType; }
     
     String m_title;
     String m_body;
     String m_iconURL;
 
     virtual Type type() const { return APIType; }
     
     String m_title;
     String m_body;
     String m_iconURL;
+    String m_replaceID;
     RefPtr<WebSecurityOrigin> m_origin;
     uint64_t m_notificationID;
 };
     RefPtr<WebSecurityOrigin> m_origin;
     uint64_t m_notificationID;
 };
index 0c0850bee2c8456ec136578705eba44bf5a15307..27a889e2624ed3a6e48a92382c10b2b6dec19a5e 100644 (file)
@@ -77,12 +77,12 @@ void WebNotificationManagerProxy::didReceiveMessage(CoreIPC::Connection* connect
     didReceiveWebNotificationManagerProxyMessage(connection, messageID, arguments);
 }
 
     didReceiveWebNotificationManagerProxyMessage(connection, messageID, arguments);
 }
 
-void WebNotificationManagerProxy::show(WebPageProxy* page, const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID)
+void WebNotificationManagerProxy::show(WebPageProxy* page, const String& title, const String& body, const String& iconURL, const String& replaceID, const String& originString, uint64_t notificationID)
 {
     if (!isNotificationIDValid(notificationID))
         return;
     
 {
     if (!isNotificationIDValid(notificationID))
         return;
     
-    RefPtr<WebNotification> notification = WebNotification::create(title, body, iconURL, originString, notificationID);
+    RefPtr<WebNotification> notification = WebNotification::create(title, body, iconURL, replaceID, originString, notificationID);
     m_notifications.set(notificationID, notification);
     m_provider.show(page, notification.get());
 }
     m_notifications.set(notificationID, notification);
     m_provider.show(page, notification.get());
 }
index d62b9f28fbfb8c82a024530231d020b2a1535de1..fdeeeb36f8836040587483827dc2d3b95a39eca1 100644 (file)
@@ -60,7 +60,7 @@ public:
     void initializeProvider(const WKNotificationProvider*);
     void populateCopyOfNotificationPermissions(HashMap<String, bool>&);
 
     void initializeProvider(const WKNotificationProvider*);
     void populateCopyOfNotificationPermissions(HashMap<String, bool>&);
 
-    void show(WebPageProxy*, const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID);
+    void show(WebPageProxy*, const String& title, const String& body, const String& iconURL, const String& replaceID, const String& originString, uint64_t notificationID);
 
     void providerDidShowNotification(uint64_t notificationID);
     void providerDidClickNotification(uint64_t notificationID);
 
     void providerDidShowNotification(uint64_t notificationID);
     void providerDidClickNotification(uint64_t notificationID);
index e750679eb5a2121ea088d7ad0e5548af621ed675..c3d4122ac4d6a0cab43cb3e3a54c7005cf512ed2 100644 (file)
@@ -3419,9 +3419,9 @@ void WebPageProxy::requestNotificationPermission(uint64_t requestID, const Strin
         request->deny();
 }
 
         request->deny();
 }
 
-void WebPageProxy::showNotification(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID)
+void WebPageProxy::showNotification(const String& title, const String& body, const String& iconURL, const String& replaceID, const String& originString, uint64_t notificationID)
 {
 {
-    m_process->context()->notificationManagerProxy()->show(this, title, body, iconURL, originString, notificationID);
+    m_process->context()->notificationManagerProxy()->show(this, title, body, iconURL, replaceID, originString, notificationID);
 }
 
 float WebPageProxy::headerHeight(WebFrameProxy* frame)
 }
 
 float WebPageProxy::headerHeight(WebFrameProxy* frame)
index e523bf14bf83c956a171adc37af5824beff48f40..f34de732838fb27063ccd3a476fb2ea4d45e3b39 100644 (file)
@@ -730,7 +730,7 @@ private:
     void reattachToWebProcessWithItem(WebBackForwardListItem*);
 
     void requestNotificationPermission(uint64_t notificationID, const String& originString);
     void reattachToWebProcessWithItem(WebBackForwardListItem*);
 
     void requestNotificationPermission(uint64_t notificationID, const String& originString);
-    void showNotification(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID);
+    void showNotification(const String& title, const String& body, const String& iconURL, const String& replaceID, const String& originString, uint64_t notificationID);
     
 #if USE(TILED_BACKING_STORE)
     void pageDidRequestScroll(const WebCore::IntPoint&);
     
 #if USE(TILED_BACKING_STORE)
     void pageDidRequestScroll(const WebCore::IntPoint&);
index 9bc2485e4968fe8a1d6fa556ec8f55878fa5e56a..347aa933d9548aa2eb4aee6d055c55d704d6d5bb 100644 (file)
@@ -208,7 +208,7 @@ messages -> WebPageProxy {
     
     # Notification messages
     RequestNotificationPermission(uint64_t requestID, WTF::String originIdentifier)
     
     # Notification messages
     RequestNotificationPermission(uint64_t requestID, WTF::String originIdentifier)
-    ShowNotification(WTF::String title, WTF::String body, WTF::String iconURL, WTF::String originIdentifier, uint64_t notificationID)
+    ShowNotification(WTF::String title, WTF::String body, WTF::String iconURL, WTF::String replaceID, WTF::String originIdentifier, uint64_t notificationID)
 
     # Spelling and grammar messages
 #if USE(UNIFIED_TEXT_CHECKING)  
 
     # Spelling and grammar messages
 #if USE(UNIFIED_TEXT_CHECKING)  
index 90a7f40218b7358a678bf4ecd7569dfe4ea95c78..a249a139e12bc985b5811f1a8212c0aade67bf40 100644 (file)
@@ -117,7 +117,7 @@ bool WebNotificationManager::show(Notification* notification, WebPage* page)
     NotificationContextMap::iterator it = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<uint64_t>()).first;
     it->second.append(notificationID);
     
     NotificationContextMap::iterator it = m_notificationContextMap.add(notification->scriptExecutionContext(), Vector<uint64_t>()).first;
     it->second.append(notificationID);
     
-    m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->contents().title, notification->contents().body, notification->iconURL().string(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
+    m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->contents().title, notification->contents().body, notification->iconURL().string(), notification->replaceId(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
     return true;
 #else
     return false;
     return true;
 #else
     return false;