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/sys_info.h" | 11 #include "base/sys_info.h" |
12 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 12 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
13 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 13 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
14 #include "chrome/browser/chromeos/login/session/kiosk_auto_launcher_session_mana
ger_delegate.h" | 14 #include "chrome/browser/chromeos/login/session/kiosk_auto_launcher_session_mana
ger_delegate.h" |
15 #include "chrome/browser/chromeos/login/session/login_oobe_session_manager_deleg
ate.h" | 15 #include "chrome/browser/chromeos/login/session/login_oobe_session_manager_deleg
ate.h" |
16 #include "chrome/browser/chromeos/login/session/restore_after_crash_session_mana
ger_delegate.h" | 16 #include "chrome/browser/chromeos/login/session/restore_after_crash_session_mana
ger_delegate.h" |
17 #include "chrome/browser/chromeos/login/session/stub_login_session_manager_deleg
ate.h" | 17 #include "chrome/browser/chromeos/login/session/stub_login_session_manager_deleg
ate.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chromeos/chromeos_switches.h" | 19 #include "chromeos/chromeos_switches.h" |
20 #include "chromeos/cryptohome/cryptohome_parameters.h" | 20 #include "chromeos/cryptohome/cryptohome_parameters.h" |
21 #include "chromeos/login/user_names.h" | |
22 #include "components/signin/core/account_id/account_id.h" | 21 #include "components/signin/core/account_id/account_id.h" |
| 22 #include "components/user_manager/user_names.h" |
23 | 23 |
24 namespace chromeos { | 24 namespace chromeos { |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) { | 28 bool ShouldAutoLaunchKioskApp(const base::CommandLine& command_line) { |
29 KioskAppManager* app_manager = KioskAppManager::Get(); | 29 KioskAppManager* app_manager = KioskAppManager::Get(); |
30 return command_line.HasSwitch(switches::kLoginManager) && | 30 return command_line.HasSwitch(switches::kLoginManager) && |
31 !command_line.HasSwitch(switches::kForceLoginManagerInTests) && | 31 !command_line.HasSwitch(switches::kForceLoginManagerInTests) && |
32 app_manager->IsAutoLaunchEnabled() && | 32 app_manager->IsAutoLaunchEnabled() && |
(...skipping 25 matching lines...) Expand all Loading... |
58 VLOG(1) << "Starting Chrome with KioskAutoLauncherSessionManagerDelegate"; | 58 VLOG(1) << "Starting Chrome with KioskAutoLauncherSessionManagerDelegate"; |
59 return std::unique_ptr<session_manager::SessionManager>( | 59 return std::unique_ptr<session_manager::SessionManager>( |
60 new ChromeSessionManager( | 60 new ChromeSessionManager( |
61 new KioskAutoLauncherSessionManagerDelegate())); | 61 new KioskAutoLauncherSessionManagerDelegate())); |
62 } else if (parsed_command_line.HasSwitch(switches::kLoginManager) && | 62 } else if (parsed_command_line.HasSwitch(switches::kLoginManager) && |
63 (!is_running_test || force_login_screen_in_test)) { | 63 (!is_running_test || force_login_screen_in_test)) { |
64 VLOG(1) << "Starting Chrome with LoginOobeSessionManagerDelegate"; | 64 VLOG(1) << "Starting Chrome with LoginOobeSessionManagerDelegate"; |
65 return std::unique_ptr<session_manager::SessionManager>( | 65 return std::unique_ptr<session_manager::SessionManager>( |
66 new ChromeSessionManager(new LoginOobeSessionManagerDelegate())); | 66 new ChromeSessionManager(new LoginOobeSessionManagerDelegate())); |
67 } else if (!base::SysInfo::IsRunningOnChromeOS() && | 67 } else if (!base::SysInfo::IsRunningOnChromeOS() && |
68 login_account_id == login::StubAccountId()) { | 68 login_account_id == user_manager::StubAccountId()) { |
69 VLOG(1) << "Starting Chrome with StubLoginSessionManagerDelegate"; | 69 VLOG(1) << "Starting Chrome with StubLoginSessionManagerDelegate"; |
70 return std::unique_ptr<session_manager::SessionManager>( | 70 return std::unique_ptr<session_manager::SessionManager>( |
71 new ChromeSessionManager(new StubLoginSessionManagerDelegate( | 71 new ChromeSessionManager(new StubLoginSessionManagerDelegate( |
72 profile, login_account_id.GetUserEmail()))); | 72 profile, login_account_id.GetUserEmail()))); |
73 } else { | 73 } else { |
74 VLOG(1) << "Starting Chrome with RestoreAfterCrashSessionManagerDelegate"; | 74 VLOG(1) << "Starting Chrome with RestoreAfterCrashSessionManagerDelegate"; |
75 // Restarting Chrome inside existing user session. Possible cases: | 75 // Restarting Chrome inside existing user session. Possible cases: |
76 // 1. Chrome is restarted after crash. | 76 // 1. Chrome is restarted after crash. |
77 // 2. Chrome is restarted for Guest session. | 77 // 2. Chrome is restarted for Guest session. |
78 // 3. Chrome is started in browser_tests skipping the login flow. | 78 // 3. Chrome is started in browser_tests skipping the login flow. |
79 // 4. Chrome is started on dev machine i.e. not on Chrome OS device w/o | 79 // 4. Chrome is started on dev machine i.e. not on Chrome OS device w/o |
80 // login flow. In that case --login-user=[chromeos::login::kStubUser] is | 80 // login flow. In that case |
| 81 // --login-user=[user_manager::kStubUser] is |
81 // added. See PreEarlyInitialization(). | 82 // added. See PreEarlyInitialization(). |
82 return std::unique_ptr<session_manager::SessionManager>( | 83 return std::unique_ptr<session_manager::SessionManager>( |
83 new ChromeSessionManager(new RestoreAfterCrashSessionManagerDelegate( | 84 new ChromeSessionManager(new RestoreAfterCrashSessionManagerDelegate( |
84 profile, login_account_id.GetUserEmail()))); | 85 profile, login_account_id.GetUserEmail()))); |
85 } | 86 } |
86 } | 87 } |
87 | 88 |
88 ChromeSessionManager::ChromeSessionManager( | 89 ChromeSessionManager::ChromeSessionManager( |
89 session_manager::SessionManagerDelegate* delegate) { | 90 session_manager::SessionManagerDelegate* delegate) { |
90 Initialize(delegate); | 91 Initialize(delegate); |
91 } | 92 } |
92 | 93 |
93 ChromeSessionManager::~ChromeSessionManager() { | 94 ChromeSessionManager::~ChromeSessionManager() { |
94 } | 95 } |
95 | 96 |
96 } // namespace chromeos | 97 } // namespace chromeos |
OLD | NEW |