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 <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 AddSessionLengthLimitObserver(this); | 52 AddSessionLengthLimitObserver(this); |
53 Update(); | 53 Update(); |
54 } | 54 } |
55 | 55 |
56 TraySessionLengthLimit::~TraySessionLengthLimit() { | 56 TraySessionLengthLimit::~TraySessionLengthLimit() { |
57 Shell::GetInstance()->system_tray_notifier()-> | 57 Shell::GetInstance()->system_tray_notifier()-> |
58 RemoveSessionLengthLimitObserver(this); | 58 RemoveSessionLengthLimitObserver(this); |
59 } | 59 } |
60 | 60 |
61 // Add view to tray bubble. | 61 // Add view to tray bubble. |
62 views::View* TraySessionLengthLimit::CreateDefaultView( | 62 views::View* TraySessionLengthLimit::CreateDefaultView(LoginStatus status) { |
63 user::LoginStatus status) { | |
64 CHECK(!tray_bubble_view_); | 63 CHECK(!tray_bubble_view_); |
65 UpdateState(); | 64 UpdateState(); |
66 if (limit_state_ == LIMIT_NONE) | 65 if (limit_state_ == LIMIT_NONE) |
67 return NULL; | 66 return NULL; |
68 tray_bubble_view_ = new LabelTrayView( | 67 tray_bubble_view_ = new LabelTrayView( |
69 NULL /* click_listener */, | 68 NULL /* click_listener */, |
70 IDR_AURA_UBER_TRAY_BUBBLE_SESSION_LENGTH_LIMIT); | 69 IDR_AURA_UBER_TRAY_BUBBLE_SESSION_LENGTH_LIMIT); |
71 tray_bubble_view_->SetMessage(ComposeTrayBubbleMessage()); | 70 tray_bubble_view_->SetMessage(ComposeTrayBubbleMessage()); |
72 return tray_bubble_view_; | 71 return tray_bubble_view_; |
73 } | 72 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 base::string16 TraySessionLengthLimit::ComposeTrayBubbleMessage() const { | 191 base::string16 TraySessionLengthLimit::ComposeTrayBubbleMessage() const { |
193 return l10n_util::GetStringFUTF16( | 192 return l10n_util::GetStringFUTF16( |
194 IDS_ASH_STATUS_TRAY_BUBBLE_SESSION_LENGTH_LIMIT, | 193 IDS_ASH_STATUS_TRAY_BUBBLE_SESSION_LENGTH_LIMIT, |
195 ui::TimeFormat::Detailed(ui::TimeFormat::FORMAT_DURATION, | 194 ui::TimeFormat::Detailed(ui::TimeFormat::FORMAT_DURATION, |
196 ui::TimeFormat::LENGTH_LONG, | 195 ui::TimeFormat::LENGTH_LONG, |
197 10, | 196 10, |
198 remaining_session_time_)); | 197 remaining_session_time_)); |
199 } | 198 } |
200 | 199 |
201 } // namespace ash | 200 } // namespace ash |
OLD | NEW |