OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_H_ | 5 #ifndef UI_MESSAGE_CENTER_NOTIFICATION_H_ |
6 #define UI_MESSAGE_CENTER_NOTIFICATION_H_ | 6 #define UI_MESSAGE_CENTER_NOTIFICATION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 ButtonInfo(const base::string16& title); | 34 ButtonInfo(const base::string16& title); |
35 }; | 35 }; |
36 | 36 |
37 class MESSAGE_CENTER_EXPORT RichNotificationData { | 37 class MESSAGE_CENTER_EXPORT RichNotificationData { |
38 public: | 38 public: |
39 RichNotificationData(); | 39 RichNotificationData(); |
40 RichNotificationData(const RichNotificationData& other); | 40 RichNotificationData(const RichNotificationData& other); |
41 ~RichNotificationData(); | 41 ~RichNotificationData(); |
42 | 42 |
43 int priority; | 43 int priority; |
44 bool is_web_notification; | |
45 bool never_timeout; | 44 bool never_timeout; |
46 base::Time timestamp; | 45 base::Time timestamp; |
47 base::string16 context_message; | 46 base::string16 context_message; |
48 gfx::Image image; | 47 gfx::Image image; |
49 gfx::Image small_image; | 48 gfx::Image small_image; |
50 std::vector<NotificationItem> items; | 49 std::vector<NotificationItem> items; |
51 int progress; | 50 int progress; |
52 std::vector<ButtonInfo> buttons; | 51 std::vector<ButtonInfo> buttons; |
53 bool should_make_spoken_feedback_for_popup_updates; | 52 bool should_make_spoken_feedback_for_popup_updates; |
54 bool clickable; | 53 bool clickable; |
(...skipping 14 matching lines...) Expand all Loading... |
69 const RichNotificationData& optional_fields, | 68 const RichNotificationData& optional_fields, |
70 NotificationDelegate* delegate); | 69 NotificationDelegate* delegate); |
71 | 70 |
72 Notification(const std::string& id, const Notification& other); | 71 Notification(const std::string& id, const Notification& other); |
73 | 72 |
74 Notification(const Notification& other); | 73 Notification(const Notification& other); |
75 | 74 |
76 virtual ~Notification(); | 75 virtual ~Notification(); |
77 | 76 |
78 // Copies the internal on-memory state from |base|, i.e. shown_as_popup, | 77 // Copies the internal on-memory state from |base|, i.e. shown_as_popup, |
79 // is_read, is_web_notification and never_timeout. | 78 // is_read and never_timeout. |
80 void CopyState(Notification* base); | 79 void CopyState(Notification* base); |
81 | 80 |
82 NotificationType type() const { return type_; } | 81 NotificationType type() const { return type_; } |
83 void set_type(NotificationType type) { type_ = type; } | 82 void set_type(NotificationType type) { type_ = type; } |
84 | 83 |
85 // Uniquely identifies a notification in the message center. For | 84 // Uniquely identifies a notification in the message center. For |
86 // notification front ends that support multiple profiles, this id should | 85 // notification front ends that support multiple profiles, this id should |
87 // identify a unique profile + frontend_notification_id combination. You can | 86 // identify a unique profile + frontend_notification_id combination. You can |
88 // Use this id against the MessageCenter interface but not the | 87 // Use this id against the MessageCenter interface but not the |
89 // NotificationUIManager interface. | 88 // NotificationUIManager interface. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 } | 186 } |
188 | 187 |
189 // Read status in the message center. | 188 // Read status in the message center. |
190 bool IsRead() const; | 189 bool IsRead() const; |
191 void set_is_read(bool read) { is_read_ = read; } | 190 void set_is_read(bool read) { is_read_ = read; } |
192 | 191 |
193 // Used to keep the order of notifications with the same timestamp. | 192 // Used to keep the order of notifications with the same timestamp. |
194 // The notification with lesser serial_number is considered 'older'. | 193 // The notification with lesser serial_number is considered 'older'. |
195 unsigned serial_number() { return serial_number_; } | 194 unsigned serial_number() { return serial_number_; } |
196 | 195 |
197 // Gets and sets whether this was shown using the Web Notifications API. | |
198 bool is_web_notification() const { | |
199 return optional_fields_.is_web_notification; | |
200 } | |
201 void set_is_web_notification(bool is_web_notification) { | |
202 optional_fields_.is_web_notification = is_web_notification; | |
203 } | |
204 | |
205 // Gets and sets whether the notifiction should remain onscreen permanently. | 196 // Gets and sets whether the notifiction should remain onscreen permanently. |
206 bool never_timeout() const { return optional_fields_.never_timeout; } | 197 bool never_timeout() const { return optional_fields_.never_timeout; } |
207 void set_never_timeout(bool never_timeout) { | 198 void set_never_timeout(bool never_timeout) { |
208 optional_fields_.never_timeout = never_timeout; | 199 optional_fields_.never_timeout = never_timeout; |
209 } | 200 } |
210 | 201 |
211 bool clickable() const { return optional_fields_.clickable; } | 202 bool clickable() const { return optional_fields_.clickable; } |
212 void set_clickable(bool clickable) { | 203 void set_clickable(bool clickable) { |
213 optional_fields_.clickable = clickable; | 204 optional_fields_.clickable = clickable; |
214 } | 205 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 bool is_read_; // True if this has been seen in the message center. | 264 bool is_read_; // True if this has been seen in the message center. |
274 | 265 |
275 // A proxy object that allows access back to the JavaScript object that | 266 // A proxy object that allows access back to the JavaScript object that |
276 // represents the notification, for firing events. | 267 // represents the notification, for firing events. |
277 scoped_refptr<NotificationDelegate> delegate_; | 268 scoped_refptr<NotificationDelegate> delegate_; |
278 }; | 269 }; |
279 | 270 |
280 } // namespace message_center | 271 } // namespace message_center |
281 | 272 |
282 #endif // UI_MESSAGE_CENTER_NOTIFICATION_H_ | 273 #endif // UI_MESSAGE_CENTER_NOTIFICATION_H_ |
OLD | NEW |