OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/ui/idle_logout_dialog_view.h" | 5 #include "chrome/browser/chromeos/ui/idle_logout_dialog_view.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 views::GridLayout::USE_PREF, 0, 0); | 133 views::GridLayout::USE_PREF, 0, 0); |
134 layout->StartRow(0, 0); | 134 layout->StartRow(0, 0); |
135 layout->AddView(warning_label_); | 135 layout->AddView(warning_label_); |
136 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); | 136 layout->AddPaddingRow(0, views::kUnrelatedControlVerticalSpacing); |
137 layout->StartRow(0, 0); | 137 layout->StartRow(0, 0); |
138 layout->AddView(restart_label_); | 138 layout->AddView(restart_label_); |
139 } | 139 } |
140 | 140 |
141 void IdleLogoutDialogView::Show() { | 141 void IdleLogoutDialogView::Show() { |
142 // Setup the countdown label before showing. | 142 // Setup the countdown label before showing. |
143 countdown_end_time_ = base::Time::Now() + base::TimeDelta::FromSeconds( | 143 countdown_end_time_ = base::Time::Now() + |
144 chromeos::KioskModeHelper::Get()->GetIdleLogoutWarningTimeout()); | 144 chromeos::KioskModeHelper::Get()->GetIdleLogoutWarningTimeout(); |
145 UpdateCountdownTimer(); | 145 UpdateCountdownTimer(); |
146 | 146 |
147 views::Widget::CreateWindow(this); | 147 views::Widget::CreateWindow(this); |
148 GetWidget()->SetAlwaysOnTop(true); | 148 GetWidget()->SetAlwaysOnTop(true); |
149 GetWidget()->Show(); | 149 GetWidget()->Show(); |
150 | 150 |
151 // Update countdown every 1 second. | 151 // Update countdown every 1 second. |
152 timer_.Start(FROM_HERE, | 152 timer_.Start(FROM_HERE, |
153 base::TimeDelta::FromSeconds(kCountdownUpdateInterval), | 153 base::TimeDelta::FromSeconds(kCountdownUpdateInterval), |
154 this, | 154 this, |
(...skipping 22 matching lines...) Expand all Loading... |
177 IDS_IDLE_LOGOUT_WARNING_RESTART_1S)); | 177 IDS_IDLE_LOGOUT_WARNING_RESTART_1S)); |
178 } else { | 178 } else { |
179 // Set the label - the logout probably won't be instant. | 179 // Set the label - the logout probably won't be instant. |
180 restart_label_->SetText(l10n_util::GetStringUTF16( | 180 restart_label_->SetText(l10n_util::GetStringUTF16( |
181 IDS_IDLE_LOGOUT_WARNING_RESTART_NOW)); | 181 IDS_IDLE_LOGOUT_WARNING_RESTART_NOW)); |
182 | 182 |
183 // Logout the current user. | 183 // Logout the current user. |
184 BrowserList::AttemptUserExit(); | 184 BrowserList::AttemptUserExit(); |
185 } | 185 } |
186 } | 186 } |
OLD | NEW |