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 |