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

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

Issue 20136004: Allow partial update for notification update API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix trybots Created 7 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 | Annotate | Revision Log
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 base::Time timestamp; 43 base::Time timestamp;
44 string16 expanded_message; 44 string16 expanded_message;
45 gfx::Image image; 45 gfx::Image image;
46 std::vector<NotificationItem> items; 46 std::vector<NotificationItem> items;
47 int progress; 47 int progress;
48 std::vector<ButtonInfo> buttons; 48 std::vector<ButtonInfo> buttons;
49 }; 49 };
50 50
51 class MESSAGE_CENTER_EXPORT Notification { 51 class MESSAGE_CENTER_EXPORT Notification {
52 public: 52 public:
53 Notification();
53 Notification(NotificationType type, 54 Notification(NotificationType type,
54 const std::string& id, 55 const std::string& id,
55 const string16& title, 56 const string16& title,
56 const string16& message, 57 const string16& message,
57 const gfx::Image& icon, 58 const gfx::Image& icon,
58 const string16& display_source, 59 const string16& display_source,
59 const std::string& extension_id, 60 const std::string& extension_id,
60 const RichNotificationData& optional_fields, 61 const RichNotificationData& optional_fields,
61 NotificationDelegate* delegate); 62 NotificationDelegate* delegate);
62 63
63 Notification(const Notification& other); 64 Notification(const Notification& other);
64 Notification& operator=(const Notification& other); 65 Notification& operator=(const Notification& other);
65 virtual ~Notification(); 66 virtual ~Notification();
66 67
67 // Copies the internal on-memory state from |base|, i.e. shown_as_popup, 68 // Copies the internal on-memory state from |base|, i.e. shown_as_popup,
68 // is_read, is_expanded, and never_timeout. 69 // is_read, is_expanded, and never_timeout.
69 void CopyState(Notification* base); 70 void CopyState(Notification* base);
70 71
71 NotificationType type() const { return type_; } 72 NotificationType type() const { return type_; }
73 void set_type(NotificationType type) { type_ = type; }
74
72 const std::string& id() const { return id_; } 75 const std::string& id() const { return id_; }
76
73 const string16& title() const { return title_; } 77 const string16& title() const { return title_; }
78 void set_title(const string16& title) { title_ = title; }
79
74 const string16& message() const { return message_; } 80 const string16& message() const { return message_; }
81 void set_message(const string16& message) { message_ = message; }
75 82
76 // A display string for the source of the notification. 83 // A display string for the source of the notification.
77 const string16& display_source() const { return display_source_; } 84 const string16& display_source() const { return display_source_; }
78 const std::string& extension_id() const { return extension_id_; } 85 const std::string& extension_id() const { return extension_id_; }
79 void set_extension_id(const std::string& extension_id) { 86 void set_extension_id(const std::string& extension_id) {
80 extension_id_ = extension_id; 87 extension_id_ = extension_id;
81 } 88 }
82 89
83 // Begin unpacked values from optional_fields. 90 // Begin unpacked values from optional_fields.
84 int priority() const { return optional_fields_.priority; } 91 int priority() const { return optional_fields_.priority; }
92 void set_priority(int priority) { optional_fields_.priority = priority; }
93
85 base::Time timestamp() const { return optional_fields_.timestamp; } 94 base::Time timestamp() const { return optional_fields_.timestamp; }
95 void set_timestamp(const base::Time& timestamp) {
96 optional_fields_.timestamp = timestamp;
97 }
98
86 const string16& expanded_message() const { 99 const string16& expanded_message() const {
87 return optional_fields_.expanded_message; 100 return optional_fields_.expanded_message;
88 } 101 }
102 void set_expanded_message(const string16& expanded_message) {
103 optional_fields_.expanded_message = expanded_message;
104 }
105
89 const std::vector<NotificationItem>& items() const { 106 const std::vector<NotificationItem>& items() const {
90 return optional_fields_.items; 107 return optional_fields_.items;
91 } 108 }
109 void set_items(const std::vector<NotificationItem>& items) {
110 optional_fields_.items = items;
111 }
112
92 int progress() const { return optional_fields_.progress; } 113 int progress() const { return optional_fields_.progress; }
114 void set_progress(int progress) { optional_fields_.progress = progress; }
93 // End unpacked values. 115 // End unpacked values.
94 116
95 // Images fetched asynchronously. 117 // Images fetched asynchronously.
96 const gfx::Image& icon() const { return icon_; } 118 const gfx::Image& icon() const { return icon_; }
97 void set_icon(const gfx::Image& icon) { icon_ = icon; } 119 void set_icon(const gfx::Image& icon) { icon_ = icon; }
98 120
99 const gfx::Image& image() const { return optional_fields_.image; } 121 const gfx::Image& image() const { return optional_fields_.image; }
100 void set_image(const gfx::Image& image) { optional_fields_.image = image; } 122 void set_image(const gfx::Image& image) { optional_fields_.image = image; }
101 123
102 // Buttons, with icons fetched asynchronously. 124 // Buttons, with icons fetched asynchronously.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 bool is_expanded_; // True if this has been expanded in the message center. 192 bool is_expanded_; // True if this has been expanded in the message center.
171 193
172 // A proxy object that allows access back to the JavaScript object that 194 // A proxy object that allows access back to the JavaScript object that
173 // represents the notification, for firing events. 195 // represents the notification, for firing events.
174 scoped_refptr<NotificationDelegate> delegate_; 196 scoped_refptr<NotificationDelegate> delegate_;
175 }; 197 };
176 198
177 } // namespace message_center 199 } // namespace message_center
178 200
179 #endif // UI_MESSAGE_CENTER_NOTIFICATION_H_ 201 #endif // UI_MESSAGE_CENTER_NOTIFICATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698