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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
11 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 11 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
12 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 12 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
13 #include "chrome/browser/chromeos/login/session/kiosk_auto_launcher_session_mana
ger_delegate.h" | 13 #include "chrome/browser/chromeos/login/session/kiosk_auto_launcher_session_mana
ger_delegate.h" |
14 #include "chrome/browser/chromeos/login/session/login_oobe_session_manager_deleg
ate.h" | 14 #include "chrome/browser/chromeos/login/session/login_oobe_session_manager_deleg
ate.h" |
15 #include "chrome/browser/chromeos/login/session/restore_after_crash_session_mana
ger_delegate.h" | 15 #include "chrome/browser/chromeos/login/session/restore_after_crash_session_mana
ger_delegate.h" |
16 #include "chrome/browser/chromeos/login/session/stub_login_session_manager_deleg
ate.h" | 16 #include "chrome/browser/chromeos/login/session/stub_login_session_manager_deleg
ate.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chromeos/chromeos_switches.h" | 18 #include "chromeos/chromeos_switches.h" |
| 19 #include "chromeos/cryptohome/cryptohome_parameters.h" |
19 #include "chromeos/login/user_names.h" | 20 #include "chromeos/login/user_names.h" |
20 #include "components/signin/core/account_id/account_id.h" | 21 #include "components/signin/core/account_id/account_id.h" |
21 | 22 |
22 namespace chromeos { | 23 namespace chromeos { |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) { | 27 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) { |
27 KioskAppManager* app_manager = KioskAppManager::Get(); | 28 KioskAppManager* app_manager = KioskAppManager::Get(); |
28 return command_line.HasSwitch(switches::kLoginManager) && | 29 return command_line.HasSwitch(switches::kLoginManager) && |
29 !command_line.HasSwitch(switches::kForceLoginManagerInTests) && | 30 !command_line.HasSwitch(switches::kForceLoginManagerInTests) && |
30 app_manager->IsAutoLaunchEnabled() && | 31 app_manager->IsAutoLaunchEnabled() && |
31 KioskAppLaunchError::Get() == KioskAppLaunchError::NONE; | 32 KioskAppLaunchError::Get() == KioskAppLaunchError::NONE; |
32 } | 33 } |
33 | 34 |
34 } // namespace | 35 } // namespace |
35 | 36 |
36 // static | 37 // static |
37 scoped_ptr<session_manager::SessionManager> | 38 scoped_ptr<session_manager::SessionManager> |
38 ChromeSessionManager::CreateSessionManager( | 39 ChromeSessionManager::CreateSessionManager( |
39 const base::CommandLine& parsed_command_line, | 40 const base::CommandLine& parsed_command_line, |
40 Profile* profile, | 41 Profile* profile, |
41 bool is_running_test) { | 42 bool is_running_test) { |
42 // Tests should be able to tune login manager before showing it. Thus only | 43 // Tests should be able to tune login manager before showing it. Thus only |
43 // show login UI (login and out-of-box) in normal (non-testing) mode with | 44 // show login UI (login and out-of-box) in normal (non-testing) mode with |
44 // --login-manager switch and if test passed --force-login-manager-in-tests. | 45 // --login-manager switch and if test passed --force-login-manager-in-tests. |
45 bool force_login_screen_in_test = | 46 bool force_login_screen_in_test = |
46 parsed_command_line.HasSwitch(switches::kForceLoginManagerInTests); | 47 parsed_command_line.HasSwitch(switches::kForceLoginManagerInTests); |
47 | 48 |
48 const AccountId login_account_id(AccountId::FromUserEmail( | 49 const std::string cryptohome_id = |
49 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser))); | 50 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser); |
| 51 const AccountId login_account_id( |
| 52 cryptohome::Identification::FromString(cryptohome_id).GetAccountId()); |
50 | 53 |
51 KioskAppManager::RemoveObsoleteCryptohomes(); | 54 KioskAppManager::RemoveObsoleteCryptohomes(); |
52 | 55 |
53 if (ShouldAutoLaunchKioskApp(parsed_command_line)) { | 56 if (ShouldAutoLaunchKioskApp(parsed_command_line)) { |
54 VLOG(1) << "Starting Chrome with KioskAutoLauncherSessionManagerDelegate"; | 57 VLOG(1) << "Starting Chrome with KioskAutoLauncherSessionManagerDelegate"; |
55 return scoped_ptr<session_manager::SessionManager>(new ChromeSessionManager( | 58 return scoped_ptr<session_manager::SessionManager>(new ChromeSessionManager( |
56 new KioskAutoLauncherSessionManagerDelegate())); | 59 new KioskAutoLauncherSessionManagerDelegate())); |
57 } else if (parsed_command_line.HasSwitch(switches::kLoginManager) && | 60 } else if (parsed_command_line.HasSwitch(switches::kLoginManager) && |
58 (!is_running_test || force_login_screen_in_test)) { | 61 (!is_running_test || force_login_screen_in_test)) { |
59 VLOG(1) << "Starting Chrome with LoginOobeSessionManagerDelegate"; | 62 VLOG(1) << "Starting Chrome with LoginOobeSessionManagerDelegate"; |
(...skipping 22 matching lines...) Expand all Loading... |
82 | 85 |
83 ChromeSessionManager::ChromeSessionManager( | 86 ChromeSessionManager::ChromeSessionManager( |
84 session_manager::SessionManagerDelegate* delegate) { | 87 session_manager::SessionManagerDelegate* delegate) { |
85 Initialize(delegate); | 88 Initialize(delegate); |
86 } | 89 } |
87 | 90 |
88 ChromeSessionManager::~ChromeSessionManager() { | 91 ChromeSessionManager::~ChromeSessionManager() { |
89 } | 92 } |
90 | 93 |
91 } // namespace chromeos | 94 } // namespace chromeos |
OLD | NEW |