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 |
(...skipping 27 matching lines...) Expand all Loading... |
38 // Auto-sorted set. Matches the order in which Notifications are shown in | 38 // Auto-sorted set. Matches the order in which Notifications are shown in |
39 // Notification Center. | 39 // Notification Center. |
40 typedef std::set<Notification*, ComparePriorityTimestampSerial> Notifications; | 40 typedef std::set<Notification*, ComparePriorityTimestampSerial> Notifications; |
41 | 41 |
42 // Auto-sorted set used to return the Notifications to be shown as popup | 42 // Auto-sorted set used to return the Notifications to be shown as popup |
43 // toasts. | 43 // toasts. |
44 typedef std::set<Notification*, CompareTimestampSerial> PopupNotifications; | 44 typedef std::set<Notification*, CompareTimestampSerial> PopupNotifications; |
45 | 45 |
46 class MESSAGE_CENTER_EXPORT Delegate { | 46 class MESSAGE_CENTER_EXPORT Delegate { |
47 public: | 47 public: |
48 Delegate() {} | 48 virtual ~Delegate(); |
49 virtual ~Delegate() {} | |
50 | 49 |
51 // Removes notifications | 50 // Removes notifications |
52 virtual void SendRemoveNotification(const std::string& id, | 51 virtual void SendRemoveNotification(const std::string& id, |
53 bool by_user) = 0; | 52 bool by_user) = 0; |
54 virtual void SendRemoveAllNotifications(bool by_user) = 0; | |
55 | |
56 // Disables notifications | |
57 virtual void DisableNotificationByExtension(const std::string& id) = 0; | |
58 virtual void DisableNotificationByUrl(const std::string& id) = 0; | |
59 | |
60 // Requests the Delegate to show the settings page. | |
61 virtual void ShowNotificationSettings(const std::string& id) = 0; | |
62 | |
63 // Requests the Delegate to show the settings dialog. | |
64 virtual void ShowNotificationSettingsDialog(gfx::NativeView context) = 0; | |
65 | |
66 // Called when a notification is clicked on. | |
67 virtual void OnNotificationClicked(const std::string& id) = 0; | |
68 | 53 |
69 // Called when the quiet mode status has been changed. | 54 // Called when the quiet mode status has been changed. |
70 virtual void OnQuietModeChanged(bool quiet_mode) = 0; | 55 virtual void OnQuietModeChanged(bool quiet_mode) = 0; |
71 | |
72 // Called when a button in a notification is clicked. |button_index| | |
73 // indicates which button was clicked, zero-indexed (button one is 0, | |
74 // button two is 1). | |
75 virtual void OnButtonClicked(const std::string& id, int button_index) = 0; | |
76 | |
77 // Returns the list of notifications to display. | |
78 virtual NotificationList* GetNotificationList() = 0; | |
79 }; | 56 }; |
80 | 57 |
81 explicit NotificationList(Delegate* delegate); | 58 explicit NotificationList(Delegate* delegate); |
82 virtual ~NotificationList(); | 59 virtual ~NotificationList(); |
83 | 60 |
84 // Affects whether or not a message has been "read". | 61 // Affects whether or not a message has been "read". |
85 void SetMessageCenterVisible(bool visible); | 62 void SetMessageCenterVisible(bool visible); |
86 | 63 |
87 void AddNotification(NotificationType type, | 64 void AddNotification(NotificationType type, |
88 const std::string& id, | 65 const std::string& id, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 PopupNotifications GetPopupNotifications(); | 109 PopupNotifications GetPopupNotifications(); |
133 | 110 |
134 // Marks the popups for the |priority| as shown. | 111 // Marks the popups for the |priority| as shown. |
135 void MarkPopupsAsShown(int priority); | 112 void MarkPopupsAsShown(int priority); |
136 | 113 |
137 // Marks a specific popup item as shown. Set |mark_notification_as_read| to | 114 // Marks a specific popup item as shown. Set |mark_notification_as_read| to |
138 // true in case marking the notification as read too. | 115 // true in case marking the notification as read too. |
139 void MarkSinglePopupAsShown(const std::string& id, | 116 void MarkSinglePopupAsShown(const std::string& id, |
140 bool mark_notification_as_read); | 117 bool mark_notification_as_read); |
141 | 118 |
| 119 // Marks the specified notification as expanded in the notification center. |
| 120 void MarkNotificationAsExpanded(const std::string& id); |
| 121 |
142 bool quiet_mode() const { return quiet_mode_; } | 122 bool quiet_mode() const { return quiet_mode_; } |
143 | 123 |
144 // Sets the current quiet mode status to |quiet_mode|. The new status is not | 124 // Sets the current quiet mode status to |quiet_mode|. The new status is not |
145 // expired. | 125 // expired. |
146 void SetQuietMode(bool quiet_mode); | 126 void SetQuietMode(bool quiet_mode); |
147 | 127 |
148 // Sets the current quiet mode to true. The quiet mode will expire in the | 128 // Sets the current quiet mode to true. The quiet mode will expire in the |
149 // specified time-delta from now. | 129 // specified time-delta from now. |
150 void EnterQuietModeWithExpire(const base::TimeDelta& expires_in); | 130 void EnterQuietModeWithExpire(const base::TimeDelta& expires_in); |
151 | 131 |
(...skipping 23 matching lines...) Expand all Loading... |
175 size_t unread_count_; | 155 size_t unread_count_; |
176 bool quiet_mode_; | 156 bool quiet_mode_; |
177 scoped_ptr<base::OneShotTimer<NotificationList> > quiet_mode_timer_; | 157 scoped_ptr<base::OneShotTimer<NotificationList> > quiet_mode_timer_; |
178 | 158 |
179 DISALLOW_COPY_AND_ASSIGN(NotificationList); | 159 DISALLOW_COPY_AND_ASSIGN(NotificationList); |
180 }; | 160 }; |
181 | 161 |
182 } // namespace message_center | 162 } // namespace message_center |
183 | 163 |
184 #endif // UI_MESSAGE_CENTER_NOTIFICATION_LIST_H_ | 164 #endif // UI_MESSAGE_CENTER_NOTIFICATION_LIST_H_ |
OLD | NEW |