| 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 "ash/shell.h" |
| 7 #include "base/bind.h" | 8 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 9 #include "base/time.h" | 10 #include "base/time.h" |
| 10 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 11 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 12 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 12 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
| 13 #include "grit/browser_resources.h" | 14 #include "grit/browser_resources.h" |
| 14 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 15 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 16 #include "ui/base/resource/resource_bundle.h" | 17 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 void IdleLogoutDialogView::Show() { | 164 void IdleLogoutDialogView::Show() { |
| 164 KioskModeSettings* settings = | 165 KioskModeSettings* settings = |
| 165 IdleLogoutDialogView::provider_->GetKioskModeSettings(); | 166 IdleLogoutDialogView::provider_->GetKioskModeSettings(); |
| 166 | 167 |
| 167 // Setup the countdown label before showing. | 168 // Setup the countdown label before showing. |
| 168 countdown_end_time_ = base::Time::Now() + | 169 countdown_end_time_ = base::Time::Now() + |
| 169 settings->GetIdleLogoutWarningDuration(); | 170 settings->GetIdleLogoutWarningDuration(); |
| 170 | 171 |
| 171 UpdateCountdown(); | 172 UpdateCountdown(); |
| 172 | 173 |
| 173 views::Widget::CreateWindow(this); | 174 // If the apps list is displayed, we should show as it's child. Not doing |
| 174 GetWidget()->SetAlwaysOnTop(true); | 175 // so will cause the apps list to disappear. |
| 176 gfx::NativeWindow app_list = ash::Shell::GetInstance()->GetAppListWindow(); |
| 177 if (app_list) { |
| 178 views::Widget::CreateWindowWithParent(this, app_list); |
| 179 } else { |
| 180 views::Widget::CreateWindow(this); |
| 181 GetWidget()->SetAlwaysOnTop(true); |
| 182 } |
| 175 GetWidget()->Show(); | 183 GetWidget()->Show(); |
| 176 | 184 |
| 177 // Update countdown every 1 second. | 185 // Update countdown every 1 second. |
| 178 timer_.Start(FROM_HERE, | 186 timer_.Start(FROM_HERE, |
| 179 IdleLogoutDialogView::provider_->GetCountdownUpdateInterval(), | 187 IdleLogoutDialogView::provider_->GetCountdownUpdateInterval(), |
| 180 this, | 188 this, |
| 181 &IdleLogoutDialogView::UpdateCountdown); | 189 &IdleLogoutDialogView::UpdateCountdown); |
| 182 } | 190 } |
| 183 | 191 |
| 184 void IdleLogoutDialogView::Close() { | 192 void IdleLogoutDialogView::Close() { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 return g_instance; | 226 return g_instance; |
| 219 } | 227 } |
| 220 | 228 |
| 221 // static | 229 // static |
| 222 void IdleLogoutDialogView::set_settings_provider( | 230 void IdleLogoutDialogView::set_settings_provider( |
| 223 IdleLogoutSettingsProvider* provider) { | 231 IdleLogoutSettingsProvider* provider) { |
| 224 provider_ = provider; | 232 provider_ = provider; |
| 225 } | 233 } |
| 226 | 234 |
| 227 } // namespace chromeos | 235 } // namespace chromeos |
| OLD | NEW |