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 <utility> |
8 | 9 |
9 #include "ash/shell.h" | 10 #include "ash/shell.h" |
10 #include "ash/system/chromeos/label_tray_view.h" | 11 #include "ash/system/chromeos/label_tray_view.h" |
11 #include "ash/system/system_notifier.h" | 12 #include "ash/system/system_notifier.h" |
12 #include "ash/system/tray/system_tray.h" | 13 #include "ash/system/tray/system_tray.h" |
13 #include "ash/system/tray/system_tray_delegate.h" | 14 #include "ash/system/tray/system_tray_delegate.h" |
14 #include "ash/system/tray/system_tray_notifier.h" | 15 #include "ash/system/tray/system_tray_notifier.h" |
15 #include "base/logging.h" | 16 #include "base/logging.h" |
16 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
17 #include "grit/ash_resources.h" | 18 #include "grit/ash_resources.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 ComposeNotificationMessage() /* message */, | 155 ComposeNotificationMessage() /* message */, |
155 bundle.GetImageNamed( | 156 bundle.GetImageNamed( |
156 IDR_AURA_UBER_TRAY_NOTIFICATION_SESSION_LENGTH_LIMIT), | 157 IDR_AURA_UBER_TRAY_NOTIFICATION_SESSION_LENGTH_LIMIT), |
157 base::string16() /* display_source */, GURL(), | 158 base::string16() /* display_source */, GURL(), |
158 message_center::NotifierId( | 159 message_center::NotifierId( |
159 message_center::NotifierId::SYSTEM_COMPONENT, | 160 message_center::NotifierId::SYSTEM_COMPONENT, |
160 system_notifier::kNotifierSessionLengthTimeout), | 161 system_notifier::kNotifierSessionLengthTimeout), |
161 data, NULL /* delegate */)); | 162 data, NULL /* delegate */)); |
162 notification->SetSystemPriority(); | 163 notification->SetSystemPriority(); |
163 if (message_center->FindVisibleNotificationById(kNotificationId)) | 164 if (message_center->FindVisibleNotificationById(kNotificationId)) |
164 message_center->UpdateNotification(kNotificationId, notification.Pass()); | 165 message_center->UpdateNotification(kNotificationId, |
| 166 std::move(notification)); |
165 else | 167 else |
166 message_center->AddNotification(notification.Pass()); | 168 message_center->AddNotification(std::move(notification)); |
167 last_limit_state_ = limit_state_; | 169 last_limit_state_ = limit_state_; |
168 } | 170 } |
169 | 171 |
170 void TraySessionLengthLimit::UpdateTrayBubbleView() const { | 172 void TraySessionLengthLimit::UpdateTrayBubbleView() const { |
171 if (!tray_bubble_view_) | 173 if (!tray_bubble_view_) |
172 return; | 174 return; |
173 if (limit_state_ == LIMIT_NONE) | 175 if (limit_state_ == LIMIT_NONE) |
174 tray_bubble_view_->SetMessage(base::string16()); | 176 tray_bubble_view_->SetMessage(base::string16()); |
175 else | 177 else |
176 tray_bubble_view_->SetMessage(ComposeTrayBubbleMessage()); | 178 tray_bubble_view_->SetMessage(ComposeTrayBubbleMessage()); |
(...skipping 12 matching lines...) Expand all Loading... |
189 base::string16 TraySessionLengthLimit::ComposeTrayBubbleMessage() const { | 191 base::string16 TraySessionLengthLimit::ComposeTrayBubbleMessage() const { |
190 return l10n_util::GetStringFUTF16( | 192 return l10n_util::GetStringFUTF16( |
191 IDS_ASH_STATUS_TRAY_BUBBLE_SESSION_LENGTH_LIMIT, | 193 IDS_ASH_STATUS_TRAY_BUBBLE_SESSION_LENGTH_LIMIT, |
192 ui::TimeFormat::Detailed(ui::TimeFormat::FORMAT_DURATION, | 194 ui::TimeFormat::Detailed(ui::TimeFormat::FORMAT_DURATION, |
193 ui::TimeFormat::LENGTH_LONG, | 195 ui::TimeFormat::LENGTH_LONG, |
194 10, | 196 10, |
195 remaining_session_time_)); | 197 remaining_session_time_)); |
196 } | 198 } |
197 | 199 |
198 } // namespace ash | 200 } // namespace ash |
OLD | NEW |