Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1165)

Side by Side Diff: chrome/browser/chromeos/login/session/chrome_session_manager.cc

Issue 2610373002: cros: Only preload the lock screen; do not reuse it. (Closed)
Patch Set: Initial upload Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/browser/ui/ash/session_controller_client.h" 29 #include "chrome/browser/ui/ash/session_controller_client.h"
31 #include "chrome/common/chrome_switches.h" 30 #include "chrome/common/chrome_switches.h"
32 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
33 #include "chromeos/audio/cras_audio_handler.h" 32 #include "chromeos/audio/cras_audio_handler.h"
34 #include "chromeos/chromeos_switches.h" 33 #include "chromeos/chromeos_switches.h"
35 #include "chromeos/cryptohome/cryptohome_parameters.h" 34 #include "chromeos/cryptohome/cryptohome_parameters.h"
36 #include "chromeos/dbus/dbus_thread_manager.h" 35 #include "chromeos/dbus/dbus_thread_manager.h"
37 #include "chromeos/dbus/session_manager_client.h" 36 #include "chromeos/dbus/session_manager_client.h"
38 #include "components/arc/arc_bridge_service.h" 37 #include "components/arc/arc_bridge_service.h"
39 #include "components/prefs/pref_service.h" 38 #include "components/prefs/pref_service.h"
40 #include "components/signin/core/account_id/account_id.h" 39 #include "components/signin/core/account_id/account_id.h"
41 #include "components/signin/core/browser/signin_manager.h" 40 #include "components/signin/core/browser/signin_manager.h"
42 #include "components/user_manager/user_manager.h" 41 #include "components/user_manager/user_manager.h"
43 #include "components/user_manager/user_names.h" 42 #include "components/user_manager/user_names.h"
44 #include "content/public/browser/notification_service.h" 43 #include "content/public/browser/notification_service.h"
45 #include "content/public/common/content_switches.h" 44 #include "content/public/common/content_switches.h"
46 45
47 namespace chromeos { 46 namespace chromeos {
48 47
49 namespace { 48 namespace {
50 49
51 // Duration of user inactivity before preloading the lock screen.
52 constexpr int kIdleSecondsBeforePreloadingLockScreen = 8;
53
54 // Whether kiosk auto launch should be started. 50 // Whether kiosk auto launch should be started.
55 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) { 51 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) {
56 KioskAppManager* app_manager = KioskAppManager::Get(); 52 KioskAppManager* app_manager = KioskAppManager::Get();
57 return command_line.HasSwitch(switches::kLoginManager) && 53 return command_line.HasSwitch(switches::kLoginManager) &&
58 !command_line.HasSwitch(switches::kForceLoginManagerInTests) && 54 !command_line.HasSwitch(switches::kForceLoginManagerInTests) &&
59 app_manager->IsAutoLaunchEnabled() && 55 app_manager->IsAutoLaunchEnabled() &&
60 KioskAppLaunchError::Get() == KioskAppLaunchError::NONE; 56 KioskAppLaunchError::Get() == KioskAppLaunchError::NONE;
61 } 57 }
62 58
63 // Starts kiosk app auto launch and shows the splash screen. 59 // Starts kiosk app auto launch and shows the splash screen.
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); 227 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
232 if (user_manager) 228 if (user_manager)
233 user_manager->OnSessionStarted(); 229 user_manager->OnSessionStarted();
234 230
235 content::NotificationService::current()->Notify( 231 content::NotificationService::current()->Notify(
236 chrome::NOTIFICATION_SESSION_STARTED, 232 chrome::NOTIFICATION_SESSION_STARTED,
237 content::Source<session_manager::SessionManager>(this), 233 content::Source<session_manager::SessionManager>(this),
238 content::Details<const user_manager::User>( 234 content::Details<const user_manager::User>(
239 user_manager->GetActiveUser())); 235 user_manager->GetActiveUser()));
240 236
241 if (chromeos::WebUIScreenLocker::ShouldShareLockScreen()) { 237 chromeos::WebUIScreenLocker::RequestPreload();
242 idle_detector_ = base::MakeUnique<chromeos::IdleDetector>(
243 base::Bind(&chromeos::WebUIScreenLocker::Preload));
244 idle_detector_->Start(
245 base::TimeDelta::FromSeconds(kIdleSecondsBeforePreloadingLockScreen));
246 }
247 } 238 }
248 239
249 void ChromeSessionManager::NotifyUserLoggedIn(const AccountId& user_account_id, 240 void ChromeSessionManager::NotifyUserLoggedIn(const AccountId& user_account_id,
250 const std::string& user_id_hash, 241 const std::string& user_id_hash,
251 bool browser_restart) { 242 bool browser_restart) {
252 BootTimesRecorder* btl = BootTimesRecorder::Get(); 243 BootTimesRecorder* btl = BootTimesRecorder::Get();
253 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); 244 btl->AddLoginTimeMarker("UserLoggedIn-Start", false);
254 session_manager::SessionManager::NotifyUserLoggedIn( 245 session_manager::SessionManager::NotifyUserLoggedIn(
255 user_account_id, user_id_hash, browser_restart); 246 user_account_id, user_id_hash, browser_restart);
256 btl->AddLoginTimeMarker("UserLoggedIn-End", false); 247 btl->AddLoginTimeMarker("UserLoggedIn-End", false);
257 } 248 }
258 249
259 } // namespace chromeos 250 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698