| 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/kiosk_mode/kiosk_mode_screensaver.h" | 5 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_screensaver.h" |
| 6 | 6 |
| 7 #include "ash/screensaver/screensaver_view.h" | 7 #include "ash/screensaver/screensaver_view.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
| 14 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 14 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 15 #include "chrome/browser/chromeos/login/existing_user_controller.h" | 15 #include "chrome/browser/chromeos/login/existing_user_controller.h" |
| 16 #include "chrome/browser/chromeos/login/signin_specifics.h" |
| 16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 17 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 17 #include "chrome/browser/chromeos/policy/app_pack_updater.h" | 18 #include "chrome/browser/chromeos/policy/app_pack_updater.h" |
| 18 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 19 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 19 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 20 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 20 #include "chrome/browser/extensions/extension_garbage_collector_chromeos.h" | 21 #include "chrome/browser/extensions/extension_garbage_collector_chromeos.h" |
| 21 #include "chrome/browser/extensions/extension_service.h" | 22 #include "chrome/browser/extensions/extension_service.h" |
| 22 #include "chrome/browser/extensions/sandboxed_unpacker.h" | 23 #include "chrome/browser/extensions/sandboxed_unpacker.h" |
| 23 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 24 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 24 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 25 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| 26 #include "chromeos/login/auth/user_context.h" |
| 25 #include "chromeos/login/login_state.h" | 27 #include "chromeos/login/login_state.h" |
| 28 #include "chromeos/login/user_names.h" |
| 29 #include "components/user_manager/user_type.h" |
| 26 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 27 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
| 28 #include "extensions/browser/extension_system.h" | 32 #include "extensions/browser/extension_system.h" |
| 29 #include "extensions/common/extension.h" | 33 #include "extensions/common/extension.h" |
| 30 #include "extensions/common/file_util.h" | 34 #include "extensions/common/file_util.h" |
| 31 #include "ui/wm/core/user_activity_detector.h" | 35 #include "ui/wm/core/user_activity_detector.h" |
| 32 | 36 |
| 33 using extensions::Extension; | 37 using extensions::Extension; |
| 34 using extensions::ExtensionGarbageCollectorChromeOS; | 38 using extensions::ExtensionGarbageCollectorChromeOS; |
| 35 using extensions::SandboxedUnpacker; | 39 using extensions::SandboxedUnpacker; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 // Show the login spinner. | 284 // Show the login spinner. |
| 281 if (oobe_ui) | 285 if (oobe_ui) |
| 282 oobe_ui->ShowRetailModeLoginSpinner(); | 286 oobe_ui->ShowRetailModeLoginSpinner(); |
| 283 | 287 |
| 284 // Close the screensaver, our login spinner is already showing. | 288 // Close the screensaver, our login spinner is already showing. |
| 285 ash::CloseScreensaver(); | 289 ash::CloseScreensaver(); |
| 286 | 290 |
| 287 // Log us in. | 291 // Log us in. |
| 288 ExistingUserController* controller = | 292 ExistingUserController* controller = |
| 289 ExistingUserController::current_controller(); | 293 ExistingUserController::current_controller(); |
| 290 if (controller && !chromeos::LoginState::Get()->IsUserLoggedIn()) | 294 if (controller && !chromeos::LoginState::Get()->IsUserLoggedIn()) { |
| 291 controller->LoginAsRetailModeUser(); | 295 controller->Login(UserContext(user_manager::USER_TYPE_RETAIL_MODE, |
| 296 chromeos::login::kRetailModeUserName), |
| 297 SigninSpecifics()); |
| 298 } |
| 292 } else { | 299 } else { |
| 293 // No default host for the WebUiLoginDisplay means that we're already in the | 300 // No default host for the WebUiLoginDisplay means that we're already in the |
| 294 // process of logging in - shut down screensaver and do nothing else. | 301 // process of logging in - shut down screensaver and do nothing else. |
| 295 ash::CloseScreensaver(); | 302 ash::CloseScreensaver(); |
| 296 } | 303 } |
| 297 | 304 |
| 298 ShutdownKioskModeScreensaver(); | 305 ShutdownKioskModeScreensaver(); |
| 299 } | 306 } |
| 300 | 307 |
| 301 static KioskModeScreensaver* g_kiosk_mode_screensaver = NULL; | 308 static KioskModeScreensaver* g_kiosk_mode_screensaver = NULL; |
| 302 | 309 |
| 303 void InitializeKioskModeScreensaver() { | 310 void InitializeKioskModeScreensaver() { |
| 304 if (g_kiosk_mode_screensaver) { | 311 if (g_kiosk_mode_screensaver) { |
| 305 LOG(WARNING) << "Screensaver was already initialized"; | 312 LOG(WARNING) << "Screensaver was already initialized"; |
| 306 return; | 313 return; |
| 307 } | 314 } |
| 308 | 315 |
| 309 g_kiosk_mode_screensaver = new KioskModeScreensaver(); | 316 g_kiosk_mode_screensaver = new KioskModeScreensaver(); |
| 310 } | 317 } |
| 311 | 318 |
| 312 void ShutdownKioskModeScreensaver() { | 319 void ShutdownKioskModeScreensaver() { |
| 313 delete g_kiosk_mode_screensaver; | 320 delete g_kiosk_mode_screensaver; |
| 314 g_kiosk_mode_screensaver = NULL; | 321 g_kiosk_mode_screensaver = NULL; |
| 315 } | 322 } |
| 316 | 323 |
| 317 } // namespace chromeos | 324 } // namespace chromeos |
| OLD | NEW |