Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: ui/message_center/notification.h

Issue 1292003004: Elide origins displayed on web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
26 NotificationItem(const base::string16& title, const base::string16& message); 26 NotificationItem(const base::string16& title, const base::string16& message);
27 }; 27 };
28 28
29 struct MESSAGE_CENTER_EXPORT ButtonInfo { 29 struct MESSAGE_CENTER_EXPORT ButtonInfo {
30 base::string16 title; 30 base::string16 title;
31 gfx::Image icon; 31 gfx::Image icon;
32 32
33 ButtonInfo(const base::string16& title); 33 ButtonInfo(const base::string16& title);
34 }; 34 };
35 35
36 struct MESSAGE_CENTER_EXPORT ContextMessage {
Jun Mukai 2015/08/14 17:17:07 I prefer to keep string16 for context message. Cou
Miguel Garcia 2015/08/14 18:28:45 Will give a shot, now that you mention it I recall
Jun Mukai 2015/08/17 18:36:14 string16 is the text representation on UI side, so
37 ContextMessage(std::string msg, bool origin)
38 : message(msg), is_origin(origin) {}
39 std::string message;
40 bool is_origin;
41 };
42
36 class MESSAGE_CENTER_EXPORT RichNotificationData { 43 class MESSAGE_CENTER_EXPORT RichNotificationData {
37 public: 44 public:
38 RichNotificationData(); 45 RichNotificationData();
39 RichNotificationData(const RichNotificationData& other); 46 RichNotificationData(const RichNotificationData& other);
40 ~RichNotificationData(); 47 ~RichNotificationData();
41 48
42 int priority; 49 int priority;
43 bool never_timeout; 50 bool never_timeout;
44 base::Time timestamp; 51 base::Time timestamp;
45 base::string16 context_message; 52 ContextMessage context_message;
46 gfx::Image image; 53 gfx::Image image;
47 gfx::Image small_image; 54 gfx::Image small_image;
48 std::vector<NotificationItem> items; 55 std::vector<NotificationItem> items;
49 int progress; 56 int progress;
50 std::vector<ButtonInfo> buttons; 57 std::vector<ButtonInfo> buttons;
51 bool should_make_spoken_feedback_for_popup_updates; 58 bool should_make_spoken_feedback_for_popup_updates;
52 bool clickable; 59 bool clickable;
53 std::vector<int> vibration_pattern; 60 std::vector<int> vibration_pattern;
54 bool silent; 61 bool silent;
55 }; 62 };
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 123
117 // This property currently has no effect on non-Android platforms. 124 // This property currently has no effect on non-Android platforms.
118 bool silent() const { return optional_fields_.silent; } 125 bool silent() const { return optional_fields_.silent; }
119 void set_silent(bool silent) { optional_fields_.silent = silent; } 126 void set_silent(bool silent) { optional_fields_.silent = silent; }
120 127
121 base::Time timestamp() const { return optional_fields_.timestamp; } 128 base::Time timestamp() const { return optional_fields_.timestamp; }
122 void set_timestamp(const base::Time& timestamp) { 129 void set_timestamp(const base::Time& timestamp) {
123 optional_fields_.timestamp = timestamp; 130 optional_fields_.timestamp = timestamp;
124 } 131 }
125 132
126 const base::string16& context_message() const { 133 const ContextMessage context_message() const {
127 return optional_fields_.context_message; 134 return optional_fields_.context_message;
128 } 135 }
129 void set_context_message(const base::string16& context_message) { 136
130 optional_fields_.context_message = context_message; 137 void set_context_message(const std::string& context_message, bool is_origin) {
138 optional_fields_.context_message.message = context_message;
139 optional_fields_.context_message.is_origin = is_origin;
131 } 140 }
132 141
133 const std::vector<NotificationItem>& items() const { 142 const std::vector<NotificationItem>& items() const {
134 return optional_fields_.items; 143 return optional_fields_.items;
135 } 144 }
136 void set_items(const std::vector<NotificationItem>& items) { 145 void set_items(const std::vector<NotificationItem>& items) {
137 optional_fields_.items = items; 146 optional_fields_.items = items;
138 } 147 }
139 148
140 int progress() const { return optional_fields_.progress; } 149 int progress() const { return optional_fields_.progress; }
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 bool is_read_; // True if this has been seen in the message center. 249 bool is_read_; // True if this has been seen in the message center.
241 250
242 // A proxy object that allows access back to the JavaScript object that 251 // A proxy object that allows access back to the JavaScript object that
243 // represents the notification, for firing events. 252 // represents the notification, for firing events.
244 scoped_refptr<NotificationDelegate> delegate_; 253 scoped_refptr<NotificationDelegate> delegate_;
245 }; 254 };
246 255
247 } // namespace message_center 256 } // namespace message_center
248 257
249 #endif // UI_MESSAGE_CENTER_NOTIFICATION_H_ 258 #endif // UI_MESSAGE_CENTER_NOTIFICATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698