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; | |
44 bool never_timeout; | 45 bool never_timeout; |
45 base::Time timestamp; | 46 base::Time timestamp; |
46 base::string16 context_message; | 47 base::string16 context_message; |
47 gfx::Image image; | 48 gfx::Image image; |
48 gfx::Image small_image; | 49 gfx::Image small_image; |
49 std::vector<NotificationItem> items; | 50 std::vector<NotificationItem> items; |
50 int progress; | 51 int progress; |
51 std::vector<ButtonInfo> buttons; | 52 std::vector<ButtonInfo> buttons; |
52 bool should_make_spoken_feedback_for_popup_updates; | 53 bool should_make_spoken_feedback_for_popup_updates; |
53 bool clickable; | 54 bool clickable; |
(...skipping 14 matching lines...) Expand all Loading... | |
68 const RichNotificationData& optional_fields, | 69 const RichNotificationData& optional_fields, |
69 NotificationDelegate* delegate); | 70 NotificationDelegate* delegate); |
70 | 71 |
71 Notification(const std::string& id, const Notification& other); | 72 Notification(const std::string& id, const Notification& other); |
72 | 73 |
73 Notification(const Notification& other); | 74 Notification(const Notification& other); |
74 | 75 |
75 virtual ~Notification(); | 76 virtual ~Notification(); |
76 | 77 |
77 // Copies the internal on-memory state from |base|, i.e. shown_as_popup, | 78 // Copies the internal on-memory state from |base|, i.e. shown_as_popup, |
78 // is_read, and never_timeout. | 79 // is_read, is_web_notification and never_timeout. |
79 void CopyState(Notification* base); | 80 void CopyState(Notification* base); |
80 | 81 |
81 NotificationType type() const { return type_; } | 82 NotificationType type() const { return type_; } |
82 void set_type(NotificationType type) { type_ = type; } | 83 void set_type(NotificationType type) { type_ = type; } |
83 | 84 |
84 // Uniquely identifies a notification in the message center. For | 85 // Uniquely identifies a notification in the message center. For |
85 // notification front ends that support multiple profiles, this id should | 86 // notification front ends that support multiple profiles, this id should |
86 // identify a unique profile + frontend_notification_id combination. You can | 87 // identify a unique profile + frontend_notification_id combination. You can |
87 // Use this id against the MessageCenter interface but not the | 88 // Use this id against the MessageCenter interface but not the |
88 // NotificationUIManager interface. | 89 // NotificationUIManager interface. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 } | 187 } |
187 | 188 |
188 // Read status in the message center. | 189 // Read status in the message center. |
189 bool IsRead() const; | 190 bool IsRead() const; |
190 void set_is_read(bool read) { is_read_ = read; } | 191 void set_is_read(bool read) { is_read_ = read; } |
191 | 192 |
192 // Used to keep the order of notifications with the same timestamp. | 193 // Used to keep the order of notifications with the same timestamp. |
193 // The notification with lesser serial_number is considered 'older'. | 194 // The notification with lesser serial_number is considered 'older'. |
194 unsigned serial_number() { return serial_number_; } | 195 unsigned serial_number() { return serial_number_; } |
195 | 196 |
196 // Marks this explicitly to prevent the timeout dismiss of notification. | 197 // Gets and sets whether this was shown using the Web Notifications API. |
197 // This is used by webkit notifications to keep the existing behavior. | 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; | |
Peter Beverloo
2015/10/08 07:23:06
why can't we use notifier_id_type==NotifierId::WEB
| |
203 } | |
204 | |
205 // Gets and sets whether the notifiction should remain onscreen permanently. | |
206 bool never_timeout() const { return optional_fields_.never_timeout; } | |
198 void set_never_timeout(bool never_timeout) { | 207 void set_never_timeout(bool never_timeout) { |
199 optional_fields_.never_timeout = never_timeout; | 208 optional_fields_.never_timeout = never_timeout; |
200 } | 209 } |
201 | 210 |
202 bool never_timeout() const { return optional_fields_.never_timeout; } | |
203 | |
204 bool clickable() const { return optional_fields_.clickable; } | 211 bool clickable() const { return optional_fields_.clickable; } |
205 void set_clickable(bool clickable) { | 212 void set_clickable(bool clickable) { |
206 optional_fields_.clickable = clickable; | 213 optional_fields_.clickable = clickable; |
207 } | 214 } |
208 | 215 |
209 NotificationDelegate* delegate() const { return delegate_.get(); } | 216 NotificationDelegate* delegate() const { return delegate_.get(); } |
210 | 217 |
211 const RichNotificationData& rich_notification_data() const { | 218 const RichNotificationData& rich_notification_data() const { |
212 return optional_fields_; | 219 return optional_fields_; |
213 } | 220 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
266 bool is_read_; // True if this has been seen in the message center. | 273 bool is_read_; // True if this has been seen in the message center. |
267 | 274 |
268 // A proxy object that allows access back to the JavaScript object that | 275 // A proxy object that allows access back to the JavaScript object that |
269 // represents the notification, for firing events. | 276 // represents the notification, for firing events. |
270 scoped_refptr<NotificationDelegate> delegate_; | 277 scoped_refptr<NotificationDelegate> delegate_; |
271 }; | 278 }; |
272 | 279 |
273 } // namespace message_center | 280 } // namespace message_center |
274 | 281 |
275 #endif // UI_MESSAGE_CENTER_NOTIFICATION_H_ | 282 #endif // UI_MESSAGE_CENTER_NOTIFICATION_H_ |
OLD | NEW |