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

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

Issue 5768001: Merge 68771 - Stray ++ causes crashes. Don't walk off the end of the array.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/597/src/
Patch Set: Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/notification_ui_manager.h" 5 #include "chrome/browser/notifications/notification_ui_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/stl_util-inl.h" 9 #include "base/stl_util-inl.h"
10 #include "chrome/browser/notifications/balloon_collection.h" 10 #include "chrome/browser/notifications/balloon_collection.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 // If it has been shown, remove it from the balloon collections. 82 // If it has been shown, remove it from the balloon collections.
83 return balloon_collection_->RemoveById(id); 83 return balloon_collection_->RemoveById(id);
84 } 84 }
85 85
86 bool NotificationUIManager::CancelAllBySourceOrigin(const GURL& source) { 86 bool NotificationUIManager::CancelAllBySourceOrigin(const GURL& source) {
87 // Same pattern as CancelById, but more complicated than the above 87 // Same pattern as CancelById, but more complicated than the above
88 // because there may be multiple notifications from the same source. 88 // because there may be multiple notifications from the same source.
89 bool removed = false; 89 bool removed = false;
90 NotificationDeque::iterator iter; 90 NotificationDeque::iterator iter;
91 for (iter = show_queue_.begin(); iter != show_queue_.end(); ++iter) { 91 for (iter = show_queue_.begin(); iter != show_queue_.end();) {
92 if ((*iter)->notification().origin_url() == source) { 92 if ((*iter)->notification().origin_url() == source) {
93 iter = show_queue_.erase(iter); 93 iter = show_queue_.erase(iter);
94 removed = true; 94 removed = true;
95 } else { 95 } else {
96 ++iter; 96 ++iter;
97 } 97 }
98 } 98 }
99 99
100 return balloon_collection_->RemoveBySourceOrigin(source) || removed; 100 return balloon_collection_->RemoveBySourceOrigin(source) || removed;
101 } 101 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 159
160 void NotificationUIManager::Observe(NotificationType type, 160 void NotificationUIManager::Observe(NotificationType type,
161 const NotificationSource& source, 161 const NotificationSource& source,
162 const NotificationDetails& details) { 162 const NotificationDetails& details) {
163 if (type == NotificationType::APP_TERMINATING) 163 if (type == NotificationType::APP_TERMINATING)
164 CancelAll(); 164 CancelAll();
165 else 165 else
166 NOTREACHED(); 166 NOTREACHED();
167 } 167 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698