| 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 "chrome/browser/chromeos/login/session/chrome_session_manager.h" | 5 #include "chrome/browser/chromeos/login/session/chrome_session_manager.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 14 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.h" | 16 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.h" |
| 17 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 17 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
| 18 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 18 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 19 #include "chrome/browser/chromeos/arc/arc_service_launcher.h" | 19 #include "chrome/browser/chromeos/arc/arc_service_launcher.h" |
| 20 #include "chrome/browser/chromeos/boot_times_recorder.h" | 20 #include "chrome/browser/chromeos/boot_times_recorder.h" |
| 21 #include "chrome/browser/chromeos/idle_detector.h" | |
| 22 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" | 21 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" |
| 23 #include "chrome/browser/chromeos/login/login_wizard.h" | 22 #include "chrome/browser/chromeos/login/login_wizard.h" |
| 24 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 23 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 25 #include "chrome/browser/chromeos/login/wizard_controller.h" | 24 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 26 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 25 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/browser/signin/signin_manager_factory.h" | 27 #include "chrome/browser/signin/signin_manager_factory.h" |
| 29 #include "chrome/browser/ui/ash/ash_util.h" | 28 #include "chrome/browser/ui/ash/ash_util.h" |
| 30 #include "chrome/common/chrome_switches.h" | 29 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 32 #include "chromeos/audio/cras_audio_handler.h" | 31 #include "chromeos/audio/cras_audio_handler.h" |
| 33 #include "chromeos/chromeos_switches.h" | 32 #include "chromeos/chromeos_switches.h" |
| 34 #include "chromeos/cryptohome/cryptohome_parameters.h" | 33 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 35 #include "chromeos/dbus/dbus_thread_manager.h" | 34 #include "chromeos/dbus/dbus_thread_manager.h" |
| 36 #include "chromeos/dbus/session_manager_client.h" | 35 #include "chromeos/dbus/session_manager_client.h" |
| 37 #include "components/arc/arc_bridge_service.h" | 36 #include "components/arc/arc_bridge_service.h" |
| 38 #include "components/prefs/pref_service.h" | 37 #include "components/prefs/pref_service.h" |
| 39 #include "components/signin/core/account_id/account_id.h" | 38 #include "components/signin/core/account_id/account_id.h" |
| 40 #include "components/signin/core/browser/signin_manager.h" | 39 #include "components/signin/core/browser/signin_manager.h" |
| 41 #include "components/user_manager/user_manager.h" | 40 #include "components/user_manager/user_manager.h" |
| 42 #include "components/user_manager/user_names.h" | 41 #include "components/user_manager/user_names.h" |
| 43 #include "content/public/browser/notification_service.h" | 42 #include "content/public/browser/notification_service.h" |
| 44 #include "content/public/common/content_switches.h" | 43 #include "content/public/common/content_switches.h" |
| 45 | 44 |
| 46 namespace chromeos { | 45 namespace chromeos { |
| 47 | 46 |
| 48 namespace { | 47 namespace { |
| 49 | 48 |
| 50 // Duration of user inactivity before preloading the lock screen. | |
| 51 constexpr int kIdleSecondsBeforePreloadingLockScreen = 8; | |
| 52 | |
| 53 // Whether kiosk auto launch should be started. | 49 // Whether kiosk auto launch should be started. |
| 54 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) { | 50 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) { |
| 55 KioskAppManager* app_manager = KioskAppManager::Get(); | 51 KioskAppManager* app_manager = KioskAppManager::Get(); |
| 56 return command_line.HasSwitch(switches::kLoginManager) && | 52 return command_line.HasSwitch(switches::kLoginManager) && |
| 57 !command_line.HasSwitch(switches::kForceLoginManagerInTests) && | 53 !command_line.HasSwitch(switches::kForceLoginManagerInTests) && |
| 58 app_manager->IsAutoLaunchEnabled() && | 54 app_manager->IsAutoLaunchEnabled() && |
| 59 KioskAppLaunchError::Get() == KioskAppLaunchError::NONE; | 55 KioskAppLaunchError::Get() == KioskAppLaunchError::NONE; |
| 60 } | 56 } |
| 61 | 57 |
| 62 // Starts kiosk app auto launch and shows the splash screen. | 58 // Starts kiosk app auto launch and shows the splash screen. |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 221 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
| 226 if (user_manager) | 222 if (user_manager) |
| 227 user_manager->OnSessionStarted(); | 223 user_manager->OnSessionStarted(); |
| 228 | 224 |
| 229 content::NotificationService::current()->Notify( | 225 content::NotificationService::current()->Notify( |
| 230 chrome::NOTIFICATION_SESSION_STARTED, | 226 chrome::NOTIFICATION_SESSION_STARTED, |
| 231 content::Source<session_manager::SessionManager>(this), | 227 content::Source<session_manager::SessionManager>(this), |
| 232 content::Details<const user_manager::User>( | 228 content::Details<const user_manager::User>( |
| 233 user_manager->GetActiveUser())); | 229 user_manager->GetActiveUser())); |
| 234 | 230 |
| 235 if (chromeos::WebUIScreenLocker::ShouldShareLockScreen()) { | 231 chromeos::WebUIScreenLocker::RequestPreload(); |
| 236 idle_detector_ = base::MakeUnique<chromeos::IdleDetector>( | |
| 237 base::Bind(&chromeos::WebUIScreenLocker::Preload)); | |
| 238 idle_detector_->Start( | |
| 239 base::TimeDelta::FromSeconds(kIdleSecondsBeforePreloadingLockScreen)); | |
| 240 } | |
| 241 } | 232 } |
| 242 | 233 |
| 243 void ChromeSessionManager::NotifyUserLoggedIn(const AccountId& user_account_id, | 234 void ChromeSessionManager::NotifyUserLoggedIn(const AccountId& user_account_id, |
| 244 const std::string& user_id_hash, | 235 const std::string& user_id_hash, |
| 245 bool browser_restart) { | 236 bool browser_restart) { |
| 246 BootTimesRecorder* btl = BootTimesRecorder::Get(); | 237 BootTimesRecorder* btl = BootTimesRecorder::Get(); |
| 247 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); | 238 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); |
| 248 session_manager::SessionManager::NotifyUserLoggedIn( | 239 session_manager::SessionManager::NotifyUserLoggedIn( |
| 249 user_account_id, user_id_hash, browser_restart); | 240 user_account_id, user_id_hash, browser_restart); |
| 250 btl->AddLoginTimeMarker("UserLoggedIn-End", false); | 241 btl->AddLoginTimeMarker("UserLoggedIn-End", false); |
| 251 } | 242 } |
| 252 | 243 |
| 253 } // namespace chromeos | 244 } // namespace chromeos |
| OLD | NEW |