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" |
(...skipping 26 matching lines...) Expand all Loading... | |
37 ChromeSessionManager::CreateSessionManager( | 37 ChromeSessionManager::CreateSessionManager( |
38 const base::CommandLine& parsed_command_line, | 38 const base::CommandLine& parsed_command_line, |
39 Profile* profile, | 39 Profile* profile, |
40 bool is_running_test) { | 40 bool is_running_test) { |
41 // Tests should be able to tune login manager before showing it. Thus only | 41 // Tests should be able to tune login manager before showing it. Thus only |
42 // show login UI (login and out-of-box) in normal (non-testing) mode with | 42 // show login UI (login and out-of-box) in normal (non-testing) mode with |
43 // --login-manager switch and if test passed --force-login-manager-in-tests. | 43 // --login-manager switch and if test passed --force-login-manager-in-tests. |
44 bool force_login_screen_in_test = | 44 bool force_login_screen_in_test = |
45 parsed_command_line.HasSwitch(switches::kForceLoginManagerInTests); | 45 parsed_command_line.HasSwitch(switches::kForceLoginManagerInTests); |
46 | 46 |
47 std::string login_user_id = | 47 const user_manager::UserID login_user_id = |
Denis Kuznetsov (DE-MUC)
2015/06/10 16:50:45
auto
| |
48 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser); | 48 user_manager::UserID::FromUserEmail(parsed_command_line.GetSwitchValueASCI I(switches::kLoginUser)); |
49 | 49 |
50 KioskAppManager::RemoveObsoleteCryptohomes(); | 50 KioskAppManager::RemoveObsoleteCryptohomes(); |
51 | 51 |
52 if (ShouldAutoLaunchKioskApp(parsed_command_line)) { | 52 if (ShouldAutoLaunchKioskApp(parsed_command_line)) { |
53 VLOG(1) << "Starting Chrome with KioskAutoLauncherSessionManagerDelegate"; | 53 VLOG(1) << "Starting Chrome with KioskAutoLauncherSessionManagerDelegate"; |
54 return scoped_ptr<session_manager::SessionManager>(new ChromeSessionManager( | 54 return scoped_ptr<session_manager::SessionManager>(new ChromeSessionManager( |
55 new KioskAutoLauncherSessionManagerDelegate())); | 55 new KioskAutoLauncherSessionManagerDelegate())); |
56 } else if (parsed_command_line.HasSwitch(switches::kLoginManager) && | 56 } else if (parsed_command_line.HasSwitch(switches::kLoginManager) && |
57 (!is_running_test || force_login_screen_in_test)) { | 57 (!is_running_test || force_login_screen_in_test)) { |
58 VLOG(1) << "Starting Chrome with LoginOobeSessionManagerDelegate"; | 58 VLOG(1) << "Starting Chrome with LoginOobeSessionManagerDelegate"; |
59 return scoped_ptr<session_manager::SessionManager>( | 59 return scoped_ptr<session_manager::SessionManager>( |
60 new ChromeSessionManager(new LoginOobeSessionManagerDelegate())); | 60 new ChromeSessionManager(new LoginOobeSessionManagerDelegate())); |
61 } else if (!base::SysInfo::IsRunningOnChromeOS() && | 61 } else if (!base::SysInfo::IsRunningOnChromeOS() && |
62 login_user_id == login::kStubUser) { | 62 login_user_id == login::GetStubUserID()) { |
63 VLOG(1) << "Starting Chrome with StubLoginSessionManagerDelegate"; | 63 VLOG(1) << "Starting Chrome with StubLoginSessionManagerDelegate"; |
64 return scoped_ptr<session_manager::SessionManager>(new ChromeSessionManager( | 64 return scoped_ptr<session_manager::SessionManager>(new ChromeSessionManager( |
65 new StubLoginSessionManagerDelegate(profile, login_user_id))); | 65 new StubLoginSessionManagerDelegate(profile, login_user_id))); |
66 } else { | 66 } else { |
67 VLOG(1) << "Starting Chrome with RestoreAfterCrashSessionManagerDelegate"; | 67 VLOG(1) << "Starting Chrome with RestoreAfterCrashSessionManagerDelegate"; |
68 // Restarting Chrome inside existing user session. Possible cases: | 68 // Restarting Chrome inside existing user session. Possible cases: |
69 // 1. Chrome is restarted after crash. | 69 // 1. Chrome is restarted after crash. |
70 // 2. Chrome is restarted for Guest session. | 70 // 2. Chrome is restarted for Guest session. |
71 // 3. Chrome is started in browser_tests skipping the login flow. | 71 // 3. Chrome is started in browser_tests skipping the login flow. |
72 // 4. Chrome is started on dev machine i.e. not on Chrome OS device w/o | 72 // 4. Chrome is started on dev machine i.e. not on Chrome OS device w/o |
73 // login flow. In that case --login-user=[chromeos::login::kStubUser] is | 73 // login flow. In that case --login-user=[chromeos::login::kStubUser] is |
74 // added. See PreEarlyInitialization(). | 74 // added. See PreEarlyInitialization(). |
75 return scoped_ptr<session_manager::SessionManager>(new ChromeSessionManager( | 75 return scoped_ptr<session_manager::SessionManager>(new ChromeSessionManager( |
76 new RestoreAfterCrashSessionManagerDelegate(profile, login_user_id))); | 76 new RestoreAfterCrashSessionManagerDelegate(profile, login_user_id))); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 ChromeSessionManager::ChromeSessionManager( | 80 ChromeSessionManager::ChromeSessionManager( |
81 session_manager::SessionManagerDelegate* delegate) { | 81 session_manager::SessionManagerDelegate* delegate) { |
82 Initialize(delegate); | 82 Initialize(delegate); |
83 } | 83 } |
84 | 84 |
85 ChromeSessionManager::~ChromeSessionManager() { | 85 ChromeSessionManager::~ChromeSessionManager() { |
86 } | 86 } |
87 | 87 |
88 } // namespace chromeos | 88 } // namespace chromeos |
OLD | NEW |