Chromium Code Reviews| 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/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" | 20 #include "chrome/browser/chromeos/idle_detector.h" |
| 21 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" | 21 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" |
| 22 #include "chrome/browser/chromeos/login/login_wizard.h" | 22 #include "chrome/browser/chromeos/login/login_wizard.h" |
| 23 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 23 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 24 #include "chrome/browser/chromeos/login/wizard_controller.h" | 24 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 25 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 25 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/signin/signin_manager_factory.h" | 27 #include "chrome/browser/signin/signin_manager_factory.h" |
| 28 #include "chrome/browser/ui/ash/ash_util.h" | 28 #include "chrome/browser/ui/ash/ash_util.h" |
| 29 #include "chrome/browser/ui/ash/session_controller_client.h" | |
| 29 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
| 31 #include "chromeos/audio/cras_audio_handler.h" | 32 #include "chromeos/audio/cras_audio_handler.h" |
| 32 #include "chromeos/chromeos_switches.h" | 33 #include "chromeos/chromeos_switches.h" |
| 33 #include "chromeos/cryptohome/cryptohome_parameters.h" | 34 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 34 #include "chromeos/dbus/dbus_thread_manager.h" | 35 #include "chromeos/dbus/dbus_thread_manager.h" |
| 35 #include "chromeos/dbus/session_manager_client.h" | 36 #include "chromeos/dbus/session_manager_client.h" |
| 36 #include "components/arc/arc_bridge_service.h" | 37 #include "components/arc/arc_bridge_service.h" |
| 37 #include "components/prefs/pref_service.h" | 38 #include "components/prefs/pref_service.h" |
| 38 #include "components/signin/core/account_id/account_id.h" | 39 #include "components/signin/core/account_id/account_id.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 session_manager::SessionManager::Get()->SessionStarted(); | 127 session_manager::SessionManager::Get()->SessionStarted(); |
| 127 | 128 |
| 128 // Now is the good time to retrieve other logged in users for this session. | 129 // Now is the good time to retrieve other logged in users for this session. |
| 129 // First user has been already marked as logged in and active in | 130 // First user has been already marked as logged in and active in |
| 130 // PreProfileInit(). Restore sessions for other users in the background. | 131 // PreProfileInit(). Restore sessions for other users in the background. |
| 131 user_session_mgr->RestoreActiveSessions(); | 132 user_session_mgr->RestoreActiveSessions(); |
| 132 } | 133 } |
| 133 | 134 |
| 134 bool is_running_test = command_line->HasSwitch(::switches::kTestName) || | 135 bool is_running_test = command_line->HasSwitch(::switches::kTestName) || |
| 135 command_line->HasSwitch(::switches::kTestType); | 136 command_line->HasSwitch(::switches::kTestType); |
| 136 | 137 if (is_running_test) { |
| 137 if (!is_running_test) { | 138 // Some browser tests (e.g. BrowserTest.GetSizeForNewRenderView) require |
| 139 // that ash is synchronously initialized before the first test window opens. | |
| 140 // Ensure the session-related mojo messages are sent to ash. | |
| 141 SessionControllerClient::FlushForTesting(); | |
|
James Cook
2016/12/16 01:28:27
xiyuan, this seemed better than just pumping the m
| |
| 142 } else { | |
| 138 // Enable CrasAudioHandler logging when chrome restarts after crashing. | 143 // Enable CrasAudioHandler logging when chrome restarts after crashing. |
| 139 if (chromeos::CrasAudioHandler::IsInitialized()) | 144 if (chromeos::CrasAudioHandler::IsInitialized()) |
| 140 chromeos::CrasAudioHandler::Get()->LogErrors(); | 145 chromeos::CrasAudioHandler::Get()->LogErrors(); |
| 141 | 146 |
| 142 // We did not log in (we crashed or are debugging), so we need to | 147 // We did not log in (we crashed or are debugging), so we need to |
| 143 // restore Sync. | 148 // restore Sync. |
| 144 UserSessionManager::GetInstance()->RestoreAuthenticationSession( | 149 UserSessionManager::GetInstance()->RestoreAuthenticationSession( |
| 145 user_profile); | 150 user_profile); |
| 146 } | 151 } |
| 147 } | 152 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 const std::string& user_id_hash, | 249 const std::string& user_id_hash, |
| 245 bool browser_restart) { | 250 bool browser_restart) { |
| 246 BootTimesRecorder* btl = BootTimesRecorder::Get(); | 251 BootTimesRecorder* btl = BootTimesRecorder::Get(); |
| 247 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); | 252 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); |
| 248 session_manager::SessionManager::NotifyUserLoggedIn( | 253 session_manager::SessionManager::NotifyUserLoggedIn( |
| 249 user_account_id, user_id_hash, browser_restart); | 254 user_account_id, user_id_hash, browser_restart); |
| 250 btl->AddLoginTimeMarker("UserLoggedIn-End", false); | 255 btl->AddLoginTimeMarker("UserLoggedIn-End", false); |
| 251 } | 256 } |
| 252 | 257 |
| 253 } // namespace chromeos | 258 } // namespace chromeos |
| OLD | NEW |