| 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 #ifndef UI_MESSAGE_CENTER_NOTIFICATION_LIST_H_ | 5 #ifndef UI_MESSAGE_CENTER_NOTIFICATION_LIST_H_ |
| 6 #define UI_MESSAGE_CENTER_NOTIFICATION_LIST_H_ | 6 #define UI_MESSAGE_CENTER_NOTIFICATION_LIST_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "base/timer.h" | 13 #include "base/timer.h" |
| 14 #include "ui/gfx/image/image.h" | 14 #include "ui/gfx/image/image.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
| 16 #include "ui/message_center/message_center_export.h" | 16 #include "ui/message_center/message_center_export.h" |
| 17 #include "ui/message_center/notification.h" | 17 #include "ui/message_center/notification.h" |
| 18 #include "ui/message_center/notification_types.h" | 18 #include "ui/message_center/notification_types.h" |
| 19 | 19 |
| 20 namespace base { | 20 namespace base { |
| 21 class DictionaryValue; | 21 class DictionaryValue; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace message_center { | 24 namespace message_center { |
| 25 |
| 26 class NotificationDelegate; |
| 27 |
| 25 namespace test { | 28 namespace test { |
| 26 class NotificationListTest; | 29 class NotificationListTest; |
| 27 } | 30 } |
| 28 | 31 |
| 29 // Comparers used to auto-sort the lists of Notifications. | 32 // Comparers used to auto-sort the lists of Notifications. |
| 30 struct MESSAGE_CENTER_EXPORT ComparePriorityTimestampSerial { | 33 struct MESSAGE_CENTER_EXPORT ComparePriorityTimestampSerial { |
| 31 bool operator()(Notification* n1, Notification* n2); | 34 bool operator()(Notification* n1, Notification* n2); |
| 32 }; | 35 }; |
| 33 | 36 |
| 34 struct CompareTimestampSerial { | 37 struct CompareTimestampSerial { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 54 // ids don't matter. | 57 // ids don't matter. |
| 55 void SetMessageCenterVisible(bool visible, | 58 void SetMessageCenterVisible(bool visible, |
| 56 std::set<std::string>* updated_ids); | 59 std::set<std::string>* updated_ids); |
| 57 | 60 |
| 58 void AddNotification(NotificationType type, | 61 void AddNotification(NotificationType type, |
| 59 const std::string& id, | 62 const std::string& id, |
| 60 const string16& title, | 63 const string16& title, |
| 61 const string16& message, | 64 const string16& message, |
| 62 const string16& display_source, | 65 const string16& display_source, |
| 63 const std::string& extension_id, | 66 const std::string& extension_id, |
| 64 const base::DictionaryValue* optional_fields); | 67 const base::DictionaryValue* optional_fields, |
| 68 NotificationDelegate* delegate); |
| 65 | 69 |
| 66 void UpdateNotificationMessage(const std::string& old_id, | 70 void UpdateNotificationMessage(const std::string& old_id, |
| 67 const std::string& new_id, | 71 const std::string& new_id, |
| 68 const string16& title, | 72 const string16& title, |
| 69 const string16& message, | 73 const string16& message, |
| 70 const base::DictionaryValue* optional_fields); | 74 const base::DictionaryValue* optional_fields, |
| 75 NotificationDelegate* delegate); |
| 71 | 76 |
| 72 void RemoveNotification(const std::string& id); | 77 void RemoveNotification(const std::string& id); |
| 73 | 78 |
| 74 void RemoveAllNotifications(); | 79 void RemoveAllNotifications(); |
| 75 | 80 |
| 76 Notifications GetNotificationsBySource(const std::string& id); | 81 Notifications GetNotificationsBySource(const std::string& id); |
| 77 Notifications GetNotificationsByExtension(const std::string& id); | 82 Notifications GetNotificationsByExtension(const std::string& id); |
| 78 | 83 |
| 79 // Returns true if the notification exists and was updated. | 84 // Returns true if the notification exists and was updated. |
| 80 bool SetNotificationIcon(const std::string& notification_id, | 85 bool SetNotificationIcon(const std::string& notification_id, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 108 // true in case marking the notification as read too. | 113 // true in case marking the notification as read too. |
| 109 void MarkSinglePopupAsShown(const std::string& id, | 114 void MarkSinglePopupAsShown(const std::string& id, |
| 110 bool mark_notification_as_read); | 115 bool mark_notification_as_read); |
| 111 | 116 |
| 112 // Marks a specific popup item as displayed. | 117 // Marks a specific popup item as displayed. |
| 113 void MarkSinglePopupAsDisplayed(const std::string& id); | 118 void MarkSinglePopupAsDisplayed(const std::string& id); |
| 114 | 119 |
| 115 // Marks the specified notification as expanded in the notification center. | 120 // Marks the specified notification as expanded in the notification center. |
| 116 void MarkNotificationAsExpanded(const std::string& id); | 121 void MarkNotificationAsExpanded(const std::string& id); |
| 117 | 122 |
| 123 NotificationDelegate* GetNotificationDelegate(const std::string& id); |
| 124 |
| 118 bool quiet_mode() const { return quiet_mode_; } | 125 bool quiet_mode() const { return quiet_mode_; } |
| 119 | 126 |
| 120 // Sets the current quiet mode status to |quiet_mode|. The new status is not | 127 // Sets the current quiet mode status to |quiet_mode|. The new status is not |
| 121 // expired. | 128 // expired. |
| 122 void SetQuietMode(bool quiet_mode); | 129 void SetQuietMode(bool quiet_mode); |
| 123 | 130 |
| 124 // Sets the current quiet mode to true. The quiet mode will expire in the | 131 // Sets the current quiet mode to true. The quiet mode will expire in the |
| 125 // specified time-delta from now. | 132 // specified time-delta from now. |
| 126 void EnterQuietModeWithExpire(const base::TimeDelta& expires_in); | 133 void EnterQuietModeWithExpire(const base::TimeDelta& expires_in); |
| 127 | 134 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 149 size_t unread_count_; | 156 size_t unread_count_; |
| 150 bool quiet_mode_; | 157 bool quiet_mode_; |
| 151 scoped_ptr<base::OneShotTimer<NotificationList> > quiet_mode_timer_; | 158 scoped_ptr<base::OneShotTimer<NotificationList> > quiet_mode_timer_; |
| 152 | 159 |
| 153 DISALLOW_COPY_AND_ASSIGN(NotificationList); | 160 DISALLOW_COPY_AND_ASSIGN(NotificationList); |
| 154 }; | 161 }; |
| 155 | 162 |
| 156 } // namespace message_center | 163 } // namespace message_center |
| 157 | 164 |
| 158 #endif // UI_MESSAGE_CENTER_NOTIFICATION_LIST_H_ | 165 #endif // UI_MESSAGE_CENTER_NOTIFICATION_LIST_H_ |
| OLD | NEW |