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

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

Issue 982313002: Closing a persistent notification should be aware of the origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 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/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "base/threading/thread_local.h" 10 #include "base/threading/thread_local.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 active_page_notifications_.erase(iter.first); 127 active_page_notifications_.erase(iter.first);
128 return; 128 return;
129 } 129 }
130 130
131 // It should not be possible for Blink to call close() on a Notification which 131 // It should not be possible for Blink to call close() on a Notification which
132 // does not exist in either the pending or active notification lists. 132 // does not exist in either the pending or active notification lists.
133 NOTREACHED(); 133 NOTREACHED();
134 } 134 }
135 135
136 void NotificationManager::closePersistent( 136 void NotificationManager::closePersistent(
137 const blink::WebSerializedOrigin& origin,
138 const blink::WebString& persistent_notification_id) {
139 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ClosePersistent(
140 GURL(origin.string()),
141 base::UTF16ToUTF8(persistent_notification_id)));
142 }
143
144 void NotificationManager::closePersistent(
137 const blink::WebString& persistent_notification_id) { 145 const blink::WebString& persistent_notification_id) {
138 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ClosePersistent( 146 closePersistent(blink::WebSerializedOrigin(), persistent_notification_id);
139 base::UTF16ToUTF8(persistent_notification_id)));
140 } 147 }
141 148
142 void NotificationManager::notifyDelegateDestroyed( 149 void NotificationManager::notifyDelegateDestroyed(
143 blink::WebNotificationDelegate* delegate) { 150 blink::WebNotificationDelegate* delegate) {
144 if (pending_notifications_.CancelPageNotificationFetches(delegate)) 151 if (pending_notifications_.CancelPageNotificationFetches(delegate))
145 return; 152 return;
146 153
147 for (auto& iter : active_page_notifications_) { 154 for (auto& iter : active_page_notifications_) {
148 if (iter.second != delegate) 155 if (iter.second != delegate)
149 continue; 156 continue;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 GURL(origin.string()), 236 GURL(origin.string()),
230 icon, 237 icon,
231 ToPlatformNotificationData(notification_data))); 238 ToPlatformNotificationData(notification_data)));
232 239
233 // There currently isn't a case in which the promise would be rejected per 240 // There currently isn't a case in which the promise would be rejected per
234 // our implementation, so always resolve it here. 241 // our implementation, so always resolve it here.
235 callbacks->onSuccess(); 242 callbacks->onSuccess();
236 } 243 }
237 244
238 } // namespace content 245 } // namespace content
OLDNEW
« 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