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

Side by Side Diff: chrome/browser/notifications/message_center_notification_manager.cc

Issue 12631017: Remove notifications when apps and OTR Profiles are removed. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/notifications/message_center_notification_manager.h" 5 #include "chrome/browser/notifications/message_center_notification_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return removed; 84 return removed;
85 } 85 }
86 86
87 bool MessageCenterNotificationManager::CancelAllByProfile(Profile* profile) { 87 bool MessageCenterNotificationManager::CancelAllByProfile(Profile* profile) {
88 // Same pattern as CancelAllBySourceOrigin. 88 // Same pattern as CancelAllBySourceOrigin.
89 bool removed = NotificationUIManagerImpl::CancelAllByProfile(profile); 89 bool removed = NotificationUIManagerImpl::CancelAllByProfile(profile);
90 90
91 for (NotificationMap::iterator loopiter = profile_notifications_.begin(); 91 for (NotificationMap::iterator loopiter = profile_notifications_.begin();
92 loopiter != profile_notifications_.end(); ) { 92 loopiter != profile_notifications_.end(); ) {
93 NotificationMap::iterator curiter = loopiter++; 93 NotificationMap::iterator curiter = loopiter++;
94 if ((*curiter).second->profile()->IsSameProfile(profile)) { 94 if ((*curiter).second->profile() == profile) {
95 // This action occurs when profile is unloaded. Closing notifications is 95 // This action occurs when profile is unloaded. Closing notifications is
96 // not by user, so |false|. 96 // not by user, so |false|.
97 RemoveProfileNotification((*curiter).second, false); 97 RemoveProfileNotification((*curiter).second, false);
98 removed = true; 98 removed = true;
99 } 99 }
100 } 100 }
101 return removed; 101 return removed;
102 } 102 }
103 103
104 void MessageCenterNotificationManager::CancelAll() { 104 void MessageCenterNotificationManager::CancelAll() {
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 403
404 MessageCenterNotificationManager::ProfileNotification* 404 MessageCenterNotificationManager::ProfileNotification*
405 MessageCenterNotificationManager::FindProfileNotification( 405 MessageCenterNotificationManager::FindProfileNotification(
406 const std::string& id) const { 406 const std::string& id) const {
407 NotificationMap::const_iterator iter = profile_notifications_.find(id); 407 NotificationMap::const_iterator iter = profile_notifications_.find(id);
408 // If the notification is shown in UI, it must be in the map. 408 // If the notification is shown in UI, it must be in the map.
409 DCHECK(iter != profile_notifications_.end()); 409 DCHECK(iter != profile_notifications_.end());
410 DCHECK((*iter).second); 410 DCHECK((*iter).second);
411 return (*iter).second; 411 return (*iter).second;
412 } 412 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698