OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/system/chromeos/session/tray_session_length_limit.h" | 5 #include "ash/system/chromeos/session/tray_session_length_limit.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/system/chromeos/label_tray_view.h" | 10 #include "ash/system/chromeos/label_tray_view.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 last_limit_state_ = limit_state_; | 142 last_limit_state_ = limit_state_; |
143 return; | 143 return; |
144 } | 144 } |
145 | 145 |
146 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 146 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
147 message_center::RichNotificationData data; | 147 message_center::RichNotificationData data; |
148 data.should_make_spoken_feedback_for_popup_updates = | 148 data.should_make_spoken_feedback_for_popup_updates = |
149 (limit_state_ != last_limit_state_); | 149 (limit_state_ != last_limit_state_); |
150 scoped_ptr<message_center::Notification> notification( | 150 scoped_ptr<message_center::Notification> notification( |
151 new message_center::Notification( | 151 new message_center::Notification( |
152 message_center::NOTIFICATION_TYPE_SIMPLE, | 152 message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, |
153 kNotificationId, | |
154 base::string16() /* title */, | 153 base::string16() /* title */, |
155 ComposeNotificationMessage() /* message */, | 154 ComposeNotificationMessage() /* message */, |
156 bundle.GetImageNamed( | 155 bundle.GetImageNamed( |
157 IDR_AURA_UBER_TRAY_NOTIFICATION_SESSION_LENGTH_LIMIT), | 156 IDR_AURA_UBER_TRAY_NOTIFICATION_SESSION_LENGTH_LIMIT), |
158 base::string16() /* display_source */, | 157 base::string16() /* display_source */, GURL(), |
159 message_center::NotifierId( | 158 message_center::NotifierId( |
160 message_center::NotifierId::SYSTEM_COMPONENT, | 159 message_center::NotifierId::SYSTEM_COMPONENT, |
161 system_notifier::kNotifierSessionLengthTimeout), | 160 system_notifier::kNotifierSessionLengthTimeout), |
162 data, | 161 data, NULL /* delegate */)); |
163 NULL /* delegate */)); | |
164 notification->SetSystemPriority(); | 162 notification->SetSystemPriority(); |
165 if (message_center->FindVisibleNotificationById(kNotificationId)) | 163 if (message_center->FindVisibleNotificationById(kNotificationId)) |
166 message_center->UpdateNotification(kNotificationId, notification.Pass()); | 164 message_center->UpdateNotification(kNotificationId, notification.Pass()); |
167 else | 165 else |
168 message_center->AddNotification(notification.Pass()); | 166 message_center->AddNotification(notification.Pass()); |
169 last_limit_state_ = limit_state_; | 167 last_limit_state_ = limit_state_; |
170 } | 168 } |
171 | 169 |
172 void TraySessionLengthLimit::UpdateTrayBubbleView() const { | 170 void TraySessionLengthLimit::UpdateTrayBubbleView() const { |
173 if (!tray_bubble_view_) | 171 if (!tray_bubble_view_) |
(...skipping 17 matching lines...) Expand all Loading... |
191 base::string16 TraySessionLengthLimit::ComposeTrayBubbleMessage() const { | 189 base::string16 TraySessionLengthLimit::ComposeTrayBubbleMessage() const { |
192 return l10n_util::GetStringFUTF16( | 190 return l10n_util::GetStringFUTF16( |
193 IDS_ASH_STATUS_TRAY_BUBBLE_SESSION_LENGTH_LIMIT, | 191 IDS_ASH_STATUS_TRAY_BUBBLE_SESSION_LENGTH_LIMIT, |
194 ui::TimeFormat::Detailed(ui::TimeFormat::FORMAT_DURATION, | 192 ui::TimeFormat::Detailed(ui::TimeFormat::FORMAT_DURATION, |
195 ui::TimeFormat::LENGTH_LONG, | 193 ui::TimeFormat::LENGTH_LONG, |
196 10, | 194 10, |
197 remaining_session_time_)); | 195 remaining_session_time_)); |
198 } | 196 } |
199 | 197 |
200 } // namespace ash | 198 } // namespace ash |
OLD | NEW |