[WK2] Text notifications should have an iconURL
authoryael.aharon@nokia.com <yael.aharon@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2012 12:13:50 +0000 (12:13 +0000)
committeryael.aharon@nokia.com <yael.aharon@nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 8 Feb 2012 12:13:50 +0000 (12:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=77968

Reviewed by Simon Hausmann.

Per http://www.w3.org/TR/notifications simple text notifications should have an iconURL.
Add an iconURL to WebNotification and add a public API to access it.

* UIProcess/API/C/WKNotification.cpp:
(WKNotificationCopyiconURL):
* UIProcess/API/C/WKNotification.h:
* UIProcess/Notifications/WebNotification.cpp:
(WebKit::WebNotification::WebNotification):
* UIProcess/Notifications/WebNotification.h:
(WebKit::WebNotification::create):
(WebKit::WebNotification::iconURL):
(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:
* WebProcess/Notifications/WebNotificationManager.cpp:
(WebKit::WebNotificationManager::show):

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

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 f34dc38..5774e59 100644 (file)
@@ -1,3 +1,34 @@
+2012-02-08  Yael Aharon  <yael.aharon@nokia.com>
+
+        [WK2] Text notifications should have an iconURL
+        https://bugs.webkit.org/show_bug.cgi?id=77968
+
+        Reviewed by Simon Hausmann.
+        
+        Per http://www.w3.org/TR/notifications simple text notifications should have an iconURL.
+        Add an iconURL to WebNotification and add a public API to access it.
+       
+        * UIProcess/API/C/WKNotification.cpp:
+        (WKNotificationCopyiconURL):
+        * UIProcess/API/C/WKNotification.h:
+        * UIProcess/Notifications/WebNotification.cpp:
+        (WebKit::WebNotification::WebNotification):
+        * UIProcess/Notifications/WebNotification.h:
+        (WebKit::WebNotification::create):
+        (WebKit::WebNotification::iconURL):
+        (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:
+        * WebProcess/Notifications/WebNotificationManager.cpp:
+        (WebKit::WebNotificationManager::show):
+
 2012-02-08  Philippe Normand  <pnormand@igalia.com>
 
         [GTK][WK2] enable-webaudio WebSetting
index db7d1f0..634aa98 100644 (file)
@@ -47,6 +47,11 @@ WKStringRef WKNotificationCopyBody(WKNotificationRef notification)
     return toCopiedAPI(toImpl(notification)->body());
 }
 
+WKStringRef WKNotificationCopyIconURL(WKNotificationRef notification)
+{
+    return toCopiedAPI(toImpl(notification)->iconURL());
+}
+
 WKSecurityOriginRef WKNotificationGetSecurityOrigin(WKNotificationRef notification)
 {
     return toAPI(toImpl(notification)->origin());
index 07311af..7c27238 100644 (file)
@@ -36,6 +36,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 WKSecurityOriginRef WKNotificationGetSecurityOrigin(WKNotificationRef notification);
 WK_EXPORT uint64_t WKNotificationGetID(WKNotificationRef notification);
 
index 065bbbf..d6b2092 100644 (file)
 
 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)
 {
index 9447da4..4a6fc7e 100644 (file)
@@ -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;
 };
index f17753c..0c0850b 100644 (file)
@@ -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());
 }
index 683e2d8..d62b9f2 100644 (file)
@@ -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);
index efcaacf..72a2c1a 100644 (file)
@@ -3377,9 +3377,9 @@ void WebPageProxy::requestNotificationPermission(uint64_t requestID, const Strin
         request->deny();
 }
 
-void WebPageProxy::showNotification(const String& title, const String& body, const String& originString, uint64_t notificationID)
+void WebPageProxy::showNotification(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID)
 {
-    m_process->context()->notificationManagerProxy()->show(this, title, body, originString, notificationID);
+    m_process->context()->notificationManagerProxy()->show(this, title, body, iconURL, originString, notificationID);
 }
 
 float WebPageProxy::headerHeight(WebFrameProxy* frame)
index caa5df4..8fc6555 100644 (file)
@@ -725,7 +725,7 @@ private:
     void reattachToWebProcessWithItem(WebBackForwardListItem*);
 
     void requestNotificationPermission(uint64_t notificationID, const String& originString);
-    void showNotification(const String& title, const String& body, const String& originString, uint64_t notificationID);
+    void showNotification(const String& title, const String& body, const String& iconURL, const String& originString, uint64_t notificationID);
     
 #if USE(TILED_BACKING_STORE)
     void pageDidRequestScroll(const WebCore::IntPoint&);
index 8c8ce49..717853b 100644 (file)
@@ -206,7 +206,7 @@ messages -> WebPageProxy {
     
     # Notification messages
     RequestNotificationPermission(uint64_t requestID, WTF::String originIdentifier)
-    ShowNotification(WTF::String title, WTF::String body, WTF::String originIdentifier, uint64_t notificationID)
+    ShowNotification(WTF::String title, WTF::String body, WTF::String iconURL, WTF::String originIdentifier, uint64_t notificationID)
 
     # Spelling and grammar messages
 #if USE(UNIFIED_TEXT_CHECKING)  
index adad4df..84b52c2 100644 (file)
@@ -121,7 +121,7 @@ bool WebNotificationManager::show(Notification* notification, WebPage* page)
     }
     it->second.append(notificationID);
     
-    m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->contents().title, notification->contents().body, notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
+    m_process->connection()->send(Messages::WebPageProxy::ShowNotification(notification->contents().title, notification->contents().body, notification->iconURL().string(), notification->scriptExecutionContext()->securityOrigin()->toString(), notificationID), page->pageID());
     return true;
 #else
     return false;