| 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 "ui/message_center/notification_list.h" | 5 #include "ui/message_center/notification_list.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 bool NotificationList::SetNotificationButtonIcon( | 151 bool NotificationList::SetNotificationButtonIcon( |
| 152 const std::string& notification_id, int button_index, | 152 const std::string& notification_id, int button_index, |
| 153 const gfx::Image& image) { | 153 const gfx::Image& image) { |
| 154 Notifications::iterator iter = GetNotification(notification_id); | 154 Notifications::iterator iter = GetNotification(notification_id); |
| 155 if (iter == notifications_.end()) | 155 if (iter == notifications_.end()) |
| 156 return false; | 156 return false; |
| 157 (*iter)->SetButtonIcon(button_index, image); | 157 (*iter)->SetButtonIcon(button_index, image); |
| 158 return true; | 158 return true; |
| 159 } | 159 } |
| 160 | 160 |
| 161 bool NotificationList::SetNotificationSmallImage( |
| 162 const std::string& notification_id, |
| 163 const gfx::Image& image) { |
| 164 Notifications::iterator iter = GetNotification(notification_id); |
| 165 if (iter == notifications_.end()) |
| 166 return false; |
| 167 (*iter)->set_small_image(image); |
| 168 return true; |
| 169 } |
| 170 |
| 161 bool NotificationList::HasNotification(const std::string& id) { | 171 bool NotificationList::HasNotification(const std::string& id) { |
| 162 return GetNotification(id) != notifications_.end(); | 172 return GetNotification(id) != notifications_.end(); |
| 163 } | 173 } |
| 164 | 174 |
| 165 bool NotificationList::HasNotificationOfType(const std::string& id, | 175 bool NotificationList::HasNotificationOfType(const std::string& id, |
| 166 const NotificationType type) { | 176 const NotificationType type) { |
| 167 Notifications::iterator iter = GetNotification(id); | 177 Notifications::iterator iter = GetNotification(id); |
| 168 if (iter == notifications_.end()) | 178 if (iter == notifications_.end()) |
| 169 return false; | 179 return false; |
| 170 | 180 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 notification->set_shown_as_popup(message_center_visible_ | 354 notification->set_shown_as_popup(message_center_visible_ |
| 345 || quiet_mode_ | 355 || quiet_mode_ |
| 346 || notification->shown_as_popup()); | 356 || notification->shown_as_popup()); |
| 347 } | 357 } |
| 348 // Take ownership. The notification can only be removed from the list | 358 // Take ownership. The notification can only be removed from the list |
| 349 // in EraseNotification(), which will delete it. | 359 // in EraseNotification(), which will delete it. |
| 350 notifications_.insert(notification.release()); | 360 notifications_.insert(notification.release()); |
| 351 } | 361 } |
| 352 | 362 |
| 353 } // namespace message_center | 363 } // namespace message_center |
| OLD | NEW |