Chromium Code Reviews| Index: chrome/browser/notifications/notification_ui_manager_mac.mm |
| diff --git a/chrome/browser/notifications/notification_ui_manager_mac.mm b/chrome/browser/notifications/notification_ui_manager_mac.mm |
| index 59339ed40bf91895d2bb76a061fc24ed3463761d..8fe70f570a5a9425a40a40680c4585ccca816826 100644 |
| --- a/chrome/browser/notifications/notification_ui_manager_mac.mm |
| +++ b/chrome/browser/notifications/notification_ui_manager_mac.mm |
| @@ -11,6 +11,7 @@ |
| #include "chrome/browser/notifications/notification.h" |
| #include "chrome/browser/notifications/balloon_notification_ui_manager.h" |
| #include "chrome/browser/notifications/message_center_notification_manager.h" |
| +#include "chrome/browser/profiles/profile.h" |
| #include "ui/message_center/message_center_util.h" |
| @class NSUserNotificationCenter; |
| @@ -161,6 +162,26 @@ void NotificationUIManagerMac::Add(const Notification& notification, |
| } |
| } |
| +std::set<std::string> |
| +NotificationUIManagerMac::GetAllIdsByProfileAndSourceOrigin( |
| + Profile* profile, |
|
jianli
2013/05/24 21:51:20
nit: 4-space indentation
dewittj
2013/05/24 23:03:22
wow, clang-format-diff has made me lazy. Done.
|
| + const GURL& source_origin) { |
| + std::set<std::string> notification_ids = |
| + BalloonNotificationUIManager::GetAllIdsByProfileAndSourceOrigin( |
| + profile, source_origin); |
| + |
| + for (NotificationMap::iterator it = notification_map_.begin(); |
| + it != notification_map_.end(); it++) { |
|
jianli
2013/05/24 21:51:20
nit: ++it
dewittj
2013/05/24 23:03:22
Done.
|
| + if (it->second->model->origin_url() == source_origin && |
|
jianli
2013/05/24 21:51:20
It might be better to use a temp variable to hold
dewittj
2013/05/24 23:03:22
Done.
|
| + profile->IsSameProfile(it->second->profile)) { |
| + // RemoveNotification will erase from the map, invalidating iterator |
|
jianli
2013/05/24 21:51:20
Not sure I understand this comment. RemoveNotifica
dewittj
2013/05/24 23:03:22
Done.
|
| + // references to the removed element. |
| + notification_ids.insert(it->second->model->notification_id()); |
| + } |
| + } |
| + |
| + return notification_ids; |
| +} |
|
jianli
2013/05/24 21:51:20
nit: empty line
dewittj
2013/05/24 23:03:22
Done.
|
| bool NotificationUIManagerMac::CancelById(const std::string& notification_id) { |
| NotificationMap::iterator it = notification_map_.find(notification_id); |
| if (it == notification_map_.end()) |