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

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

Issue 12326091: Made notification center notifications collapsed and expandable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, which led to many changes. Created 7 years, 9 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 const std::string& extension_id() const { return extension_id_; } 50 const std::string& extension_id() const { return extension_id_; }
51 51
52 // Begin unpacked values from optional_fields. 52 // Begin unpacked values from optional_fields.
53 int priority() const { return priority_; } 53 int priority() const { return priority_; }
54 base::Time timestamp() const { return timestamp_; } 54 base::Time timestamp() const { return timestamp_; }
55 const string16& expanded_message() const { return expanded_message_; } 55 const string16& expanded_message() const { return expanded_message_; }
56 const std::vector<NotificationItem>& items() const { return items_; } 56 const std::vector<NotificationItem>& items() const { return items_; }
57 // End unpacked values. 57 // End unpacked values.
58 58
59 // Images fetched asynchronously. 59 // Images fetched asynchronously.
60 const gfx::ImageSkia& primary_icon() const { return primary_icon_; } 60 const gfx::ImageSkia& icon() const { return icon_; }
61 void set_primary_icon(const gfx::ImageSkia& icon) { primary_icon_ = icon; } 61 void set_icon(const gfx::ImageSkia& icon) { icon_ = icon; }
62 62
63 const gfx::ImageSkia& image() const { return image_; } 63 const gfx::ImageSkia& image() const { return image_; }
64 void set_image(const gfx::ImageSkia& image) { image_ = image; } 64 void set_image(const gfx::ImageSkia& image) { image_ = image; }
65 65
66 // Buttons, with icons fetched asynchronously. 66 // Buttons, with icons fetched asynchronously.
67 const std::vector<ButtonInfo>& buttons() const { return buttons_; } 67 const std::vector<ButtonInfo>& buttons() const { return buttons_; }
68 bool SetButtonIcon(size_t index, const gfx::ImageSkia& icon); 68 bool SetButtonIcon(size_t index, const gfx::ImageSkia& icon);
69 69
70 // Status in MessageCenter.
71 bool is_read() const { return is_read_; }
72 void set_is_read(bool is_read) { is_read_ = is_read; }
73
74 bool shown_as_popup() const { return shown_as_popup_; } 70 bool shown_as_popup() const { return shown_as_popup_; }
75 void set_shown_as_popup(bool shown_as_popup) { 71 void set_shown_as_popup(bool shown_as_popup) {
76 shown_as_popup_ = shown_as_popup; 72 shown_as_popup_ = shown_as_popup;
77 } 73 }
78 74
75 // Read status in the message center.
76 bool is_read() const { return is_read_; }
77 void set_is_read(bool read) { is_read_ = read; }
78
79 // Expanded status in the message center (not the popups).
80 bool is_expanded() const { return is_expanded_; }
81 void set_is_expanded(bool expanded) { is_expanded_ = expanded; }
82
79 // Used to keep the order of notifications with the same timestamp. 83 // Used to keep the order of notifications with the same timestamp.
80 // The notification with lesser serial_number is considered 'older'. 84 // The notification with lesser serial_number is considered 'older'.
81 unsigned serial_number() { return serial_number_; } 85 unsigned serial_number() { return serial_number_; }
82 86
83 private: 87 private:
84 // Unpacks the provided |optional_fields| and applies the values to override 88 // Unpacks the provided |optional_fields| and applies the values to override
85 // the notification's data members. 89 // the notification's data members.
86 void ApplyOptionalFields(const DictionaryValue* optional_fields); 90 void ApplyOptionalFields(const DictionaryValue* optional_fields);
87 91
88 NotificationType type_; 92 NotificationType type_;
89 std::string id_; 93 std::string id_;
90 string16 title_; 94 string16 title_;
91 string16 message_; 95 string16 message_;
92 string16 display_source_; 96 string16 display_source_;
93 std::string extension_id_; 97 std::string extension_id_;
94 int priority_; 98 int priority_;
95 base::Time timestamp_; 99 base::Time timestamp_;
96 unsigned serial_number_; 100 unsigned serial_number_;
97 string16 expanded_message_; 101 string16 expanded_message_;
98 std::vector<NotificationItem> items_; 102 std::vector<NotificationItem> items_;
99 gfx::ImageSkia primary_icon_; 103 gfx::ImageSkia icon_;
dharcourt 2013/03/01 10:17:31 Cleanup: Since notifications don't have secondary
100 gfx::ImageSkia image_; 104 gfx::ImageSkia image_;
101 std::vector<ButtonInfo> buttons_; 105 std::vector<ButtonInfo> buttons_;
106 bool shown_as_popup_; // True if this has been shown as a popup.
102 bool is_read_; // True if this has been seen in the message center. 107 bool is_read_; // True if this has been seen in the message center.
103 bool shown_as_popup_; // True if this has been shown as a popup notification. 108 bool is_expanded_; // True if this has been expanded in the message center.
104 109
105 DISALLOW_COPY_AND_ASSIGN(Notification); 110 DISALLOW_COPY_AND_ASSIGN(Notification);
106 }; 111 };
107 112
108 } // namespace message_center 113 } // namespace message_center
109 114
110 #endif // UI_MESSAGE_CENTER_NOTIFICATION_H_ 115 #endif // UI_MESSAGE_CENTER_NOTIFICATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698