Index: chrome/browser/notifications/notification_ui_manager_impl.cc |
diff --git a/chrome/browser/notifications/notification_ui_manager_impl.cc b/chrome/browser/notifications/notification_ui_manager_impl.cc |
index 5c19f040d9c53f8a47f5beba8f26c8ab37543c62..b1d271a6d377cb6b26508e28c38a5c2c9fbbdd6b 100644 |
--- a/chrome/browser/notifications/notification_ui_manager_impl.cc |
+++ b/chrome/browser/notifications/notification_ui_manager_impl.cc |
@@ -124,6 +124,22 @@ bool NotificationUIManagerImpl::CancelAllBySourceOrigin(const GURL& source) { |
return balloon_collection_->RemoveBySourceOrigin(source) || removed; |
} |
+bool NotificationUIManagerImpl::CancelAllByProfile(Profile* profile) { |
+ // Same pattern as CancelAllBySourceOrigin. |
+ bool removed = false; |
oshima
2012/11/29 02:21:50
is it ok to say
bool removed = balloon_collection_
stevenjb
2012/11/29 02:52:25
No, we set it in the for loop also. Should be clea
oshima
2012/11/29 16:57:48
I think you can because the loop changes the value
|
+ NotificationDeque::iterator iter; |
+ for (iter = show_queue_.begin(); iter != show_queue_.end();) { |
oshima
2012/11/29 02:21:50
Move the iter def into for, or if you want to keep
stevenjb
2012/11/29 02:52:25
I didn't write these iterators, I just copy/pasted
|
+ if ((*iter)->profile() == profile) { |
+ iter = show_queue_.erase(iter); |
+ removed = true; |
+ } else { |
+ ++iter; |
+ } |
+ } |
+ |
+ return balloon_collection_->RemoveByProfile(profile) || removed; |
+} |
+ |
void NotificationUIManagerImpl::CancelAll() { |
STLDeleteElements(&show_queue_); |
balloon_collection_->RemoveAll(); |