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 #include "ui/message_center/notification.h" | 5 #include "ui/message_center/notification.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/message_center/notification_types.h" | 8 #include "ui/message_center/notification_types.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 11 matching lines...) Expand all Loading... | |
22 ButtonInfo::ButtonInfo(const string16& title) | 22 ButtonInfo::ButtonInfo(const string16& title) |
23 : title(title) { | 23 : title(title) { |
24 } | 24 } |
25 | 25 |
26 Notification::Notification(NotificationType type, | 26 Notification::Notification(NotificationType type, |
27 const std::string& id, | 27 const std::string& id, |
28 const string16& title, | 28 const string16& title, |
29 const string16& message, | 29 const string16& message, |
30 const string16& display_source, | 30 const string16& display_source, |
31 const std::string& extension_id, | 31 const std::string& extension_id, |
32 const DictionaryValue* optional_fields) | 32 const DictionaryValue* optional_fields, |
33 : type_(type), | 33 NotificationDelegate* delegate) |
34 id_(id), | 34 : type_(type), |
35 title_(title), | 35 id_(id), |
36 message_(message), | 36 title_(title), |
37 display_source_(display_source), | 37 message_(message), |
38 extension_id_(extension_id), | 38 display_source_(display_source), |
39 priority_(DEFAULT_PRIORITY), | 39 extension_id_(extension_id), |
40 timestamp_(base::Time::Now()), | 40 priority_(DEFAULT_PRIORITY), |
41 serial_number_(g_next_serial_number_++), | 41 timestamp_(base::Time::Now()), |
42 shown_as_popup_(false), | 42 serial_number_(g_next_serial_number_++), |
43 is_read_(false), | 43 shown_as_popup_(false), |
44 is_expanded_(false), | 44 is_read_(false), |
45 never_timeout_(false) { | 45 is_expanded_(false), |
46 never_timeout_(false), | |
47 delegate_(delegate) { | |
46 // This can override some data members initialized to deafule values above. | 48 // This can override some data members initialized to deafule values above. |
47 ApplyOptionalFields(optional_fields); | 49 ApplyOptionalFields(optional_fields); |
48 } | 50 } |
49 | 51 |
50 Notification::~Notification() { | 52 Notification::~Notification() { |
51 } | 53 } |
52 | 54 |
53 void Notification::CopyState(Notification* base) { | 55 void Notification::CopyState(Notification* base) { |
54 shown_as_popup_ = base->shown_as_popup(); | 56 shown_as_popup_ = base->shown_as_popup(); |
55 is_read_ = base->is_read(); | 57 is_read_ = base->is_read(); |
56 is_expanded_ = base->is_expanded(); | 58 is_expanded_ = base->is_expanded(); |
57 never_timeout_ = base->never_timeout(); | 59 never_timeout_ = base->never_timeout(); |
60 delegate_ = base->delegate(); | |
Jun Mukai
2013/05/22 23:08:30
Does this really work well with updating of webkit
dewittj
2013/05/24 01:03:51
Done.
| |
58 } | 61 } |
59 | 62 |
60 bool Notification::SetButtonIcon(size_t index, const gfx::Image& icon) { | 63 bool Notification::SetButtonIcon(size_t index, const gfx::Image& icon) { |
61 if (index >= buttons_.size()) | 64 if (index >= buttons_.size()) |
62 return false; | 65 return false; |
63 buttons_[index].icon = icon; | 66 buttons_[index].icon = icon; |
64 return true; | 67 return true; |
65 } | 68 } |
66 | 69 |
67 void Notification::ApplyOptionalFields(const DictionaryValue* fields) { | 70 void Notification::ApplyOptionalFields(const DictionaryValue* fields) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 item->GetString(kItemTitleKey, &title); | 102 item->GetString(kItemTitleKey, &title); |
100 item->GetString(kItemMessageKey, &message); | 103 item->GetString(kItemMessageKey, &message); |
101 items_.push_back(NotificationItem(title, message)); | 104 items_.push_back(NotificationItem(title, message)); |
102 } | 105 } |
103 } | 106 } |
104 | 107 |
105 fields->GetBoolean(kPrivateNeverTimeoutKey, &never_timeout_); | 108 fields->GetBoolean(kPrivateNeverTimeoutKey, &never_timeout_); |
106 } | 109 } |
107 | 110 |
108 } // namespace message_center | 111 } // namespace message_center |
OLD | NEW |