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

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

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

Powered by Google App Engine
This is Rietveld 408576698