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 #include <memory> |
8 #include <utility> | 9 #include <utility> |
9 | 10 |
10 #include "ash/shell.h" | 11 #include "ash/shell.h" |
11 #include "ash/system/chromeos/label_tray_view.h" | 12 #include "ash/system/chromeos/label_tray_view.h" |
12 #include "ash/system/system_notifier.h" | 13 #include "ash/system/system_notifier.h" |
13 #include "ash/system/tray/system_tray.h" | 14 #include "ash/system/tray/system_tray.h" |
14 #include "ash/system/tray/system_tray_delegate.h" | 15 #include "ash/system/tray/system_tray_delegate.h" |
15 #include "ash/system/tray/system_tray_notifier.h" | 16 #include "ash/system/tray/system_tray_notifier.h" |
16 #include "base/logging.h" | 17 #include "base/logging.h" |
17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // For LIMIT_NONE, there's nothing more to do. | 142 // For LIMIT_NONE, there's nothing more to do. |
142 if (limit_state_ == LIMIT_NONE) { | 143 if (limit_state_ == LIMIT_NONE) { |
143 last_limit_state_ = limit_state_; | 144 last_limit_state_ = limit_state_; |
144 return; | 145 return; |
145 } | 146 } |
146 | 147 |
147 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 148 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
148 message_center::RichNotificationData data; | 149 message_center::RichNotificationData data; |
149 data.should_make_spoken_feedback_for_popup_updates = | 150 data.should_make_spoken_feedback_for_popup_updates = |
150 (limit_state_ != last_limit_state_); | 151 (limit_state_ != last_limit_state_); |
151 scoped_ptr<message_center::Notification> notification( | 152 std::unique_ptr<message_center::Notification> notification( |
152 new message_center::Notification( | 153 new message_center::Notification( |
153 message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, | 154 message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, |
154 base::string16() /* title */, | 155 base::string16() /* title */, |
155 ComposeNotificationMessage() /* message */, | 156 ComposeNotificationMessage() /* message */, |
156 bundle.GetImageNamed( | 157 bundle.GetImageNamed( |
157 IDR_AURA_UBER_TRAY_NOTIFICATION_SESSION_LENGTH_LIMIT), | 158 IDR_AURA_UBER_TRAY_NOTIFICATION_SESSION_LENGTH_LIMIT), |
158 base::string16() /* display_source */, GURL(), | 159 base::string16() /* display_source */, GURL(), |
159 message_center::NotifierId( | 160 message_center::NotifierId( |
160 message_center::NotifierId::SYSTEM_COMPONENT, | 161 message_center::NotifierId::SYSTEM_COMPONENT, |
161 system_notifier::kNotifierSessionLengthTimeout), | 162 system_notifier::kNotifierSessionLengthTimeout), |
(...skipping 29 matching lines...) Expand all Loading... |
191 base::string16 TraySessionLengthLimit::ComposeTrayBubbleMessage() const { | 192 base::string16 TraySessionLengthLimit::ComposeTrayBubbleMessage() const { |
192 return l10n_util::GetStringFUTF16( | 193 return l10n_util::GetStringFUTF16( |
193 IDS_ASH_STATUS_TRAY_BUBBLE_SESSION_LENGTH_LIMIT, | 194 IDS_ASH_STATUS_TRAY_BUBBLE_SESSION_LENGTH_LIMIT, |
194 ui::TimeFormat::Detailed(ui::TimeFormat::FORMAT_DURATION, | 195 ui::TimeFormat::Detailed(ui::TimeFormat::FORMAT_DURATION, |
195 ui::TimeFormat::LENGTH_LONG, | 196 ui::TimeFormat::LENGTH_LONG, |
196 10, | 197 10, |
197 remaining_session_time_)); | 198 remaining_session_time_)); |
198 } | 199 } |
199 | 200 |
200 } // namespace ash | 201 } // namespace ash |
OLD | NEW |