Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Unified Diff: content/child/notifications/notification_manager.cc

Issue 681783004: Implement the PageNotificationDelegate for the new Web Notification path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/Ids/ids/ Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/notifications/notification_manager.h ('k') | content/common/platform_notification_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/notifications/notification_manager.cc
diff --git a/content/child/notifications/notification_manager.cc b/content/child/notifications/notification_manager.cc
index 4c18798ac094ce53f8431ab98499592703faaea7..9271f877e4940cf4aeac20a43a2b3db0792a476a 100644
--- a/content/child/notifications/notification_manager.cc
+++ b/content/child/notifications/notification_manager.cc
@@ -128,8 +128,49 @@ WebNotificationPermission NotificationManager::checkPermission(
}
bool NotificationManager::OnMessageReceived(const IPC::Message& message) {
- // TODO(peter): Implement the message handlers for browser -> renderer events.
- return false;
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(NotificationManager, message)
+ IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShow, OnShow);
+ IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidError, OnError);
+ IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClose, OnClose);
+ IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClick, OnClick);
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+
+ return handled;
+}
+
+void NotificationManager::OnShow(int id) {
+ const auto& iter = active_notifications_.find(id);
+ if (iter == active_notifications_.end())
+ return;
+
+ iter->second->dispatchShowEvent();
+}
+
+void NotificationManager::OnError(int id) {
+ const auto& iter = active_notifications_.find(id);
+ if (iter == active_notifications_.end())
+ return;
+
+ iter->second->dispatchErrorEvent();
+}
+
+void NotificationManager::OnClose(int id) {
+ const auto& iter = active_notifications_.find(id);
+ if (iter == active_notifications_.end())
+ return;
+
+ iter->second->dispatchCloseEvent();
+ active_notifications_.erase(iter);
+}
+
+void NotificationManager::OnClick(int id) {
+ const auto& iter = active_notifications_.find(id);
+ if (iter == active_notifications_.end())
+ return;
+
+ iter->second->dispatchClickEvent();
}
} // namespace content
« no previous file with comments | « content/child/notifications/notification_manager.h ('k') | content/common/platform_notification_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698