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

Unified Diff: chrome/browser/notifications/notification_ui_manager_impl.cc

Issue 11414215: Add CloseAllByProfile to NotificationUIManager and call before destroyng a Profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698