| 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/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/kiosk_app_launch_error.h" | 15 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
| 16 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 16 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 17 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 17 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 18 #include "chrome/browser/chromeos/login/login_wizard.h" | 18 #include "chrome/browser/chromeos/login/login_wizard.h" |
| 19 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 19 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 20 #include "chrome/browser/chromeos/login/wizard_controller.h" | 20 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 21 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 21 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/signin/signin_manager_factory.h" | 23 #include "chrome/browser/signin/signin_manager_factory.h" |
| 24 #include "chrome/browser/ui/ash/ash_util.h" |
| 24 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 25 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 25 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 26 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
| 27 #include "chromeos/audio/cras_audio_handler.h" | 28 #include "chromeos/audio/cras_audio_handler.h" |
| 28 #include "chromeos/chromeos_switches.h" | 29 #include "chromeos/chromeos_switches.h" |
| 29 #include "chromeos/cryptohome/cryptohome_parameters.h" | 30 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 30 #include "chromeos/dbus/dbus_thread_manager.h" | 31 #include "chromeos/dbus/dbus_thread_manager.h" |
| 31 #include "chromeos/dbus/session_manager_client.h" | 32 #include "chromeos/dbus/session_manager_client.h" |
| 32 #include "components/arc/arc_bridge_service.h" | 33 #include "components/arc/arc_bridge_service.h" |
| 33 #include "components/arc/arc_service_manager.h" | 34 #include "components/arc/arc_service_manager.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 | 165 |
| 165 } // namespace | 166 } // namespace |
| 166 | 167 |
| 167 ChromeSessionManager::ChromeSessionManager() {} | 168 ChromeSessionManager::ChromeSessionManager() {} |
| 168 ChromeSessionManager::~ChromeSessionManager() {} | 169 ChromeSessionManager::~ChromeSessionManager() {} |
| 169 | 170 |
| 170 void ChromeSessionManager::Initialize( | 171 void ChromeSessionManager::Initialize( |
| 171 const base::CommandLine& parsed_command_line, | 172 const base::CommandLine& parsed_command_line, |
| 172 Profile* profile, | 173 Profile* profile, |
| 173 bool is_running_test) { | 174 bool is_running_test) { |
| 175 // Keep Chrome alive for mash. |
| 176 // TODO(xiyuan): Remove this when session manager is moved out of Chrome. |
| 177 if (chrome::IsRunningInMash() && |
| 178 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 179 ::switches::kDisableZeroBrowsersOpenForTests)) { |
| 180 g_browser_process->platform_part()->RegisterKeepAlive(); |
| 181 } |
| 182 |
| 174 // Tests should be able to tune login manager before showing it. Thus only | 183 // Tests should be able to tune login manager before showing it. Thus only |
| 175 // show login UI (login and out-of-box) in normal (non-testing) mode with | 184 // show login UI (login and out-of-box) in normal (non-testing) mode with |
| 176 // --login-manager switch and if test passed --force-login-manager-in-tests. | 185 // --login-manager switch and if test passed --force-login-manager-in-tests. |
| 177 bool force_login_screen_in_test = | 186 bool force_login_screen_in_test = |
| 178 parsed_command_line.HasSwitch(switches::kForceLoginManagerInTests); | 187 parsed_command_line.HasSwitch(switches::kForceLoginManagerInTests); |
| 179 | 188 |
| 180 const std::string cryptohome_id = | 189 const std::string cryptohome_id = |
| 181 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser); | 190 parsed_command_line.GetSwitchValueASCII(switches::kLoginUser); |
| 182 const AccountId login_account_id( | 191 const AccountId login_account_id( |
| 183 cryptohome::Identification::FromString(cryptohome_id).GetAccountId()); | 192 cryptohome::Identification::FromString(cryptohome_id).GetAccountId()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 user_manager->OnSessionStarted(); | 234 user_manager->OnSessionStarted(); |
| 226 | 235 |
| 227 content::NotificationService::current()->Notify( | 236 content::NotificationService::current()->Notify( |
| 228 chrome::NOTIFICATION_SESSION_STARTED, | 237 chrome::NOTIFICATION_SESSION_STARTED, |
| 229 content::Source<session_manager::SessionManager>(this), | 238 content::Source<session_manager::SessionManager>(this), |
| 230 content::Details<const user_manager::User>( | 239 content::Details<const user_manager::User>( |
| 231 user_manager->GetActiveUser())); | 240 user_manager->GetActiveUser())); |
| 232 } | 241 } |
| 233 | 242 |
| 234 } // namespace chromeos | 243 } // namespace chromeos |
| OLD | NEW |