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

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

Issue 1395093002: Fix system notifications incorrectly marked as type WEB_PAGE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@timeout
Patch Set: Fix typo Created 5 years, 2 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
« no previous file with comments | « ui/message_center/notification.h ('k') | ui/message_center/popup_timer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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_delegate.h" 8 #include "ui/message_center/notification_delegate.h"
9 #include "ui/message_center/notification_types.h" 9 #include "ui/message_center/notification_types.h"
10 10
11 namespace { 11 namespace {
12 unsigned g_next_serial_number_ = 0; 12 unsigned g_next_serial_number_ = 0;
13 } 13 }
14 14
15 namespace message_center { 15 namespace message_center {
16 16
17 NotificationItem::NotificationItem(const base::string16& title, 17 NotificationItem::NotificationItem(const base::string16& title,
18 const base::string16& message) 18 const base::string16& message)
19 : title(title), 19 : title(title),
20 message(message) { 20 message(message) {
21 } 21 }
22 22
23 ButtonInfo::ButtonInfo(const base::string16& title) 23 ButtonInfo::ButtonInfo(const base::string16& title)
24 : title(title) { 24 : title(title) {
25 } 25 }
26 26
27 RichNotificationData::RichNotificationData() 27 RichNotificationData::RichNotificationData()
28 : priority(DEFAULT_PRIORITY), 28 : priority(DEFAULT_PRIORITY),
29 is_web_notification(false),
30 never_timeout(false), 29 never_timeout(false),
31 timestamp(base::Time::Now()), 30 timestamp(base::Time::Now()),
32 context_message(base::string16()), 31 context_message(base::string16()),
33 progress(0), 32 progress(0),
34 should_make_spoken_feedback_for_popup_updates(true), 33 should_make_spoken_feedback_for_popup_updates(true),
35 clickable(true), 34 clickable(true),
36 silent(false) {} 35 silent(false) {}
37 36
38 RichNotificationData::RichNotificationData(const RichNotificationData& other) 37 RichNotificationData::RichNotificationData(const RichNotificationData& other)
39 : priority(other.priority), 38 : priority(other.priority),
40 is_web_notification(other.is_web_notification),
41 never_timeout(other.never_timeout), 39 never_timeout(other.never_timeout),
42 timestamp(other.timestamp), 40 timestamp(other.timestamp),
43 context_message(other.context_message), 41 context_message(other.context_message),
44 image(other.image), 42 image(other.image),
45 small_image(other.small_image), 43 small_image(other.small_image),
46 items(other.items), 44 items(other.items),
47 progress(other.progress), 45 progress(other.progress),
48 buttons(other.buttons), 46 buttons(other.buttons),
49 should_make_spoken_feedback_for_popup_updates( 47 should_make_spoken_feedback_for_popup_updates(
50 other.should_make_spoken_feedback_for_popup_updates), 48 other.should_make_spoken_feedback_for_popup_updates),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 132
135 bool Notification::IsRead() const { 133 bool Notification::IsRead() const {
136 return is_read_ || optional_fields_.priority == MIN_PRIORITY; 134 return is_read_ || optional_fields_.priority == MIN_PRIORITY;
137 } 135 }
138 136
139 void Notification::CopyState(Notification* base) { 137 void Notification::CopyState(Notification* base) {
140 shown_as_popup_ = base->shown_as_popup(); 138 shown_as_popup_ = base->shown_as_popup();
141 is_read_ = base->is_read_; 139 is_read_ = base->is_read_;
142 if (!delegate_.get()) 140 if (!delegate_.get())
143 delegate_ = base->delegate(); 141 delegate_ = base->delegate();
144 optional_fields_.is_web_notification = base->is_web_notification();
145 optional_fields_.never_timeout = base->never_timeout(); 142 optional_fields_.never_timeout = base->never_timeout();
146 } 143 }
147 144
148 void Notification::SetButtonIcon(size_t index, const gfx::Image& icon) { 145 void Notification::SetButtonIcon(size_t index, const gfx::Image& icon) {
149 if (index >= optional_fields_.buttons.size()) 146 if (index >= optional_fields_.buttons.size())
150 return; 147 return;
151 optional_fields_.buttons[index].icon = icon; 148 optional_fields_.buttons[index].icon = icon;
152 } 149 }
153 150
154 void Notification::SetSystemPriority() { 151 void Notification::SetSystemPriority() {
(...skipping 18 matching lines...) Expand all
173 NOTIFICATION_TYPE_SIMPLE, notification_id, title, message, icon, 170 NOTIFICATION_TYPE_SIMPLE, notification_id, title, message, icon,
174 base::string16() /* display_source */, GURL(), 171 base::string16() /* display_source */, GURL(),
175 NotifierId(NotifierId::SYSTEM_COMPONENT, system_component_id), 172 NotifierId(NotifierId::SYSTEM_COMPONENT, system_component_id),
176 RichNotificationData(), 173 RichNotificationData(),
177 new HandleNotificationClickedDelegate(click_callback))); 174 new HandleNotificationClickedDelegate(click_callback)));
178 notification->SetSystemPriority(); 175 notification->SetSystemPriority();
179 return notification.Pass(); 176 return notification.Pass();
180 } 177 }
181 178
182 } // namespace message_center 179 } // namespace message_center
OLDNEW
« no previous file with comments | « ui/message_center/notification.h ('k') | ui/message_center/popup_timer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698