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

Side by Side Diff: content/child/notifications/notification_manager.cc

Issue 687183004: Remove the OnError method from notification delegates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/notifications/notification_manager.h" 5 #include "content/child/notifications/notification_manager.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/threading/thread_local.h" 8 #include "base/threading/thread_local.h"
9 #include "content/child/notifications/notification_dispatcher.h" 9 #include "content/child/notifications/notification_dispatcher.h"
10 #include "content/child/thread_safe_sender.h" 10 #include "content/child/thread_safe_sender.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 thread_safe_sender_->Send(new PlatformNotificationHostMsg_CheckPermission( 124 thread_safe_sender_->Send(new PlatformNotificationHostMsg_CheckPermission(
125 GURL(origin.string()), &permission)); 125 GURL(origin.string()), &permission));
126 126
127 return permission; 127 return permission;
128 } 128 }
129 129
130 bool NotificationManager::OnMessageReceived(const IPC::Message& message) { 130 bool NotificationManager::OnMessageReceived(const IPC::Message& message) {
131 bool handled = true; 131 bool handled = true;
132 IPC_BEGIN_MESSAGE_MAP(NotificationManager, message) 132 IPC_BEGIN_MESSAGE_MAP(NotificationManager, message)
133 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShow, OnShow); 133 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShow, OnShow);
134 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidError, OnError);
135 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClose, OnClose); 134 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClose, OnClose);
136 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClick, OnClick); 135 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClick, OnClick);
137 IPC_MESSAGE_UNHANDLED(handled = false) 136 IPC_MESSAGE_UNHANDLED(handled = false)
138 IPC_END_MESSAGE_MAP() 137 IPC_END_MESSAGE_MAP()
139 138
140 return handled; 139 return handled;
141 } 140 }
142 141
143 void NotificationManager::OnShow(int id) { 142 void NotificationManager::OnShow(int id) {
144 const auto& iter = active_notifications_.find(id); 143 const auto& iter = active_notifications_.find(id);
145 if (iter == active_notifications_.end()) 144 if (iter == active_notifications_.end())
146 return; 145 return;
147 146
148 iter->second->dispatchShowEvent(); 147 iter->second->dispatchShowEvent();
149 } 148 }
150 149
151 void NotificationManager::OnError(int id) {
152 const auto& iter = active_notifications_.find(id);
153 if (iter == active_notifications_.end())
154 return;
155
156 iter->second->dispatchErrorEvent();
157 }
158
159 void NotificationManager::OnClose(int id) { 150 void NotificationManager::OnClose(int id) {
160 const auto& iter = active_notifications_.find(id); 151 const auto& iter = active_notifications_.find(id);
161 if (iter == active_notifications_.end()) 152 if (iter == active_notifications_.end())
162 return; 153 return;
163 154
164 iter->second->dispatchCloseEvent(); 155 iter->second->dispatchCloseEvent();
165 active_notifications_.erase(iter); 156 active_notifications_.erase(iter);
166 } 157 }
167 158
168 void NotificationManager::OnClick(int id) { 159 void NotificationManager::OnClick(int id) {
169 const auto& iter = active_notifications_.find(id); 160 const auto& iter = active_notifications_.find(id);
170 if (iter == active_notifications_.end()) 161 if (iter == active_notifications_.end())
171 return; 162 return;
172 163
173 iter->second->dispatchClickEvent(); 164 iter->second->dispatchClickEvent();
174 } 165 }
175 166
176 } // namespace content 167 } // namespace content
OLDNEW
« no previous file with comments | « content/child/notifications/notification_manager.h ('k') | content/common/desktop_notification_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698