| OLD | NEW |
| 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/balloon_collection_base.h" | 5 #include "chrome/browser/notifications/balloon_collection_base.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "chrome/browser/notifications/balloon.h" | 8 #include "chrome/browser/notifications/balloon.h" |
| 9 #include "chrome/browser/notifications/notification.h" | 9 #include "chrome/browser/notifications/notification.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 void BalloonCollectionBase::CloseAll() { | 69 void BalloonCollectionBase::CloseAll() { |
| 70 // Use a local list of balloons to close to avoid breaking | 70 // Use a local list of balloons to close to avoid breaking |
| 71 // iterator changes on each close. | 71 // iterator changes on each close. |
| 72 Balloons to_close = balloons_; | 72 Balloons to_close = balloons_; |
| 73 for (Balloons::iterator iter = to_close.begin(); | 73 for (Balloons::iterator iter = to_close.begin(); |
| 74 iter != to_close.end(); ++iter) | 74 iter != to_close.end(); ++iter) |
| 75 (*iter)->CloseByScript(); | 75 (*iter)->CloseByScript(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 Balloon* BalloonCollectionBase::FindBalloon( | 78 Balloon* BalloonCollectionBase::FindBalloonById( |
| 79 const Notification& notification) { | 79 const std::string& notification_id) { |
| 80 Balloons::iterator iter; | 80 Balloons::iterator iter; |
| 81 for (iter = balloons_.begin(); iter != balloons_.end(); ++iter) { | 81 for (iter = balloons_.begin(); iter != balloons_.end(); ++iter) { |
| 82 if ((*iter)->notification().notification_id() == | 82 if ((*iter)->notification().notification_id() == notification_id) { |
| 83 notification.notification_id()) { | |
| 84 return *iter; | 83 return *iter; |
| 85 } | 84 } |
| 86 } | 85 } |
| 87 return NULL; | 86 return NULL; |
| 88 } | 87 } |
| 88 |
| 89 Balloon* BalloonCollectionBase::FindBalloon(const Notification& notification) { |
| 90 return FindBalloonById(notification.notification_id()); |
| 91 } |
| OLD | NEW |