From 344dd74e13651669f64e7c2e8b8466b9be847b54 Mon Sep 17 00:00:00 2001 From: "yael.aharon@nokia.com" Date: Wed, 8 Feb 2012 12:13:50 +0000 Subject: [PATCH] [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): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107068 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit2/ChangeLog | 31 ++++++++++++++++++++++ Source/WebKit2/UIProcess/API/C/WKNotification.cpp | 5 ++++ Source/WebKit2/UIProcess/API/C/WKNotification.h | 1 + .../UIProcess/Notifications/WebNotification.cpp | 3 ++- .../UIProcess/Notifications/WebNotification.h | 8 +++--- .../Notifications/WebNotificationManagerProxy.cpp | 4 +-- .../Notifications/WebNotificationManagerProxy.h | 2 +- Source/WebKit2/UIProcess/WebPageProxy.cpp | 4 +-- Source/WebKit2/UIProcess/WebPageProxy.h | 2 +- Source/WebKit2/UIProcess/WebPageProxy.messages.in | 2 +- .../Notifications/WebNotificationManager.cpp | 2 +- 11 files changed, 52 insertions(+), 12 deletions(-) diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog index f34dc38..5774e59 100644 --- a/Source/WebKit2/ChangeLog +++ b/Source/WebKit2/ChangeLog @@ -1,3 +1,34 @@ +2012-02-08 Yael Aharon + + [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 [GTK][WK2] enable-webaudio WebSetting diff --git a/Source/WebKit2/UIProcess/API/C/WKNotification.cpp b/Source/WebKit2/UIProcess/API/C/WKNotification.cpp index db7d1f0..634aa98 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNotification.cpp +++ b/Source/WebKit2/UIProcess/API/C/WKNotification.cpp @@ -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()); diff --git a/Source/WebKit2/UIProcess/API/C/WKNotification.h b/Source/WebKit2/UIProcess/API/C/WKNotification.h index 07311af..7c27238 100644 --- a/Source/WebKit2/UIProcess/API/C/WKNotification.h +++ b/Source/WebKit2/UIProcess/API/C/WKNotification.h @@ -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); diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotification.cpp index 065bbbf..d6b2092 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 9447da4..4a6fc7e 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 create(const String& title, const String& body, const String& originString, uint64_t notificationID) + static PassRefPtr 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 m_origin; uint64_t m_notificationID; }; diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.cpp index f17753c..0c0850b 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 notification = WebNotification::create(title, body, originString, notificationID); + RefPtr notification = WebNotification::create(title, body, iconURL, originString, notificationID); m_notifications.set(notificationID, notification); m_provider.show(page, notification.get()); } diff --git a/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h b/Source/WebKit2/UIProcess/Notifications/WebNotificationManagerProxy.h index 683e2d8..d62b9f2 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&); - 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); diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp index efcaacf..72a2c1a 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.cpp +++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp @@ -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) diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h index caa5df4..8fc6555 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.h +++ b/Source/WebKit2/UIProcess/WebPageProxy.h @@ -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&); diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in index 8c8ce49..717853b 100644 --- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in +++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in @@ -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) diff --git a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp index adad4df..84b52c2 100644 --- a/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp +++ b/Source/WebKit2/WebProcess/Notifications/WebNotificationManager.cpp @@ -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; -- 2.7.4