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/time.h" | 9 #include "base/time.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 bool NotificationList::SetNotificationSecondaryIcon( | 194 bool NotificationList::SetNotificationSecondaryIcon( |
195 const std::string& id, | 195 const std::string& id, |
196 const gfx::ImageSkia& image) { | 196 const gfx::ImageSkia& image) { |
197 Notifications::iterator iter; | 197 Notifications::iterator iter; |
198 if (!GetNotification(id, &iter)) | 198 if (!GetNotification(id, &iter)) |
199 return false; | 199 return false; |
200 iter->secondary_icon = image; | 200 iter->secondary_icon = image; |
201 return true; | 201 return true; |
202 } | 202 } |
203 | 203 |
| 204 bool NotificationList::SetNotificationImage(const std::string& id, |
| 205 const gfx::ImageSkia& image) { |
| 206 Notifications::iterator iter; |
| 207 if (!GetNotification(id, &iter)) |
| 208 return false; |
| 209 iter->image = image; |
| 210 return true; |
| 211 } |
| 212 |
204 bool NotificationList::HasNotification(const std::string& id) { | 213 bool NotificationList::HasNotification(const std::string& id) { |
205 Notifications::iterator dummy; | 214 Notifications::iterator dummy; |
206 return GetNotification(id, &dummy); | 215 return GetNotification(id, &dummy); |
207 } | 216 } |
208 | 217 |
209 bool NotificationList::HasPopupNotifications() { | 218 bool NotificationList::HasPopupNotifications() { |
210 for (int i = ui::notifications::DEFAULT_PRIORITY; | 219 for (int i = ui::notifications::DEFAULT_PRIORITY; |
211 i <= ui::notifications::MAX_PRIORITY; ++i) { | 220 i <= ui::notifications::MAX_PRIORITY; ++i) { |
212 Notifications notifications = notifications_[i]; | 221 Notifications notifications = notifications_[i]; |
213 if (!notifications.empty() && !notifications.front().shown_as_popup) | 222 if (!notifications.empty() && !notifications.front().shown_as_popup) |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 popup_count++; | 387 popup_count++; |
379 // No limits for HIGH/MAX priority. | 388 // No limits for HIGH/MAX priority. |
380 if (priority == ui::notifications::DEFAULT_PRIORITY && | 389 if (priority == ui::notifications::DEFAULT_PRIORITY && |
381 popup_count >= kMaxVisiblePopupNotifications) { | 390 popup_count >= kMaxVisiblePopupNotifications) { |
382 break; | 391 break; |
383 } | 392 } |
384 } | 393 } |
385 } | 394 } |
386 | 395 |
387 } // namespace message_center | 396 } // namespace message_center |
OLD | NEW |