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/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 14 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
15 #include "chrome/browser/chrome_notification_types.h" | 15 #include "chrome/browser/chrome_notification_types.h" |
16 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.h" | 16 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_manager.h" |
17 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" | 17 #include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h" |
18 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 18 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
19 #include "chrome/browser/chromeos/arc/arc_service_launcher.h" | 19 #include "chrome/browser/chromeos/arc/arc_service_launcher.h" |
20 #include "chrome/browser/chromeos/boot_times_recorder.h" | 20 #include "chrome/browser/chromeos/boot_times_recorder.h" |
21 #include "chrome/browser/chromeos/idle_detector.h" | 21 #include "chrome/browser/chromeos/idle_detector.h" |
22 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" | 22 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" |
23 #include "chrome/browser/chromeos/login/login_wizard.h" | 23 #include "chrome/browser/chromeos/login/login_wizard.h" |
24 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 24 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
25 #include "chrome/browser/chromeos/login/wizard_controller.h" | 25 #include "chrome/browser/chromeos/login/wizard_controller.h" |
26 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 26 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
27 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
28 #include "chrome/browser/signin/signin_manager_factory.h" | 28 #include "chrome/browser/signin/signin_manager_factory.h" |
29 #include "chrome/browser/ui/ash/ash_util.h" | 29 #include "chrome/browser/ui/ash/ash_util.h" |
30 #include "chrome/browser/ui/ash/session_controller_client.h" | |
31 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/pref_names.h" | 31 #include "chrome/common/pref_names.h" |
33 #include "chromeos/audio/cras_audio_handler.h" | 32 #include "chromeos/audio/cras_audio_handler.h" |
34 #include "chromeos/chromeos_switches.h" | 33 #include "chromeos/chromeos_switches.h" |
35 #include "chromeos/cryptohome/cryptohome_parameters.h" | 34 #include "chromeos/cryptohome/cryptohome_parameters.h" |
36 #include "chromeos/dbus/dbus_thread_manager.h" | 35 #include "chromeos/dbus/dbus_thread_manager.h" |
37 #include "chromeos/dbus/session_manager_client.h" | 36 #include "chromeos/dbus/session_manager_client.h" |
38 #include "components/arc/arc_bridge_service.h" | 37 #include "components/arc/arc_bridge_service.h" |
39 #include "components/prefs/pref_service.h" | 38 #include "components/prefs/pref_service.h" |
40 #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... |
128 session_manager::SessionManager::Get()->SessionStarted(); | 127 session_manager::SessionManager::Get()->SessionStarted(); |
129 | 128 |
130 // 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. |
131 // 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 |
132 // PreProfileInit(). Restore sessions for other users in the background. | 131 // PreProfileInit(). Restore sessions for other users in the background. |
133 user_session_mgr->RestoreActiveSessions(); | 132 user_session_mgr->RestoreActiveSessions(); |
134 } | 133 } |
135 | 134 |
136 bool is_running_test = command_line->HasSwitch(::switches::kTestName) || | 135 bool is_running_test = command_line->HasSwitch(::switches::kTestName) || |
137 command_line->HasSwitch(::switches::kTestType); | 136 command_line->HasSwitch(::switches::kTestType); |
138 if (is_running_test) { | 137 |
139 // Some browser tests (e.g. BrowserTest.GetSizeForNewRenderView) require | 138 if (!is_running_test) { |
140 // that ash is synchronously initialized before the first test window opens. | |
141 // Ensure the session-related mojo messages are sent to ash. | |
142 SessionControllerClient::FlushForTesting(); | |
143 } else { | |
144 // Enable CrasAudioHandler logging when chrome restarts after crashing. | 139 // Enable CrasAudioHandler logging when chrome restarts after crashing. |
145 if (chromeos::CrasAudioHandler::IsInitialized()) | 140 if (chromeos::CrasAudioHandler::IsInitialized()) |
146 chromeos::CrasAudioHandler::Get()->LogErrors(); | 141 chromeos::CrasAudioHandler::Get()->LogErrors(); |
147 | 142 |
148 // We did not log in (we crashed or are debugging), so we need to | 143 // We did not log in (we crashed or are debugging), so we need to |
149 // restore Sync. | 144 // restore Sync. |
150 UserSessionManager::GetInstance()->RestoreAuthenticationSession( | 145 UserSessionManager::GetInstance()->RestoreAuthenticationSession( |
151 user_profile); | 146 user_profile); |
152 } | 147 } |
153 } | 148 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 const std::string& user_id_hash, | 245 const std::string& user_id_hash, |
251 bool browser_restart) { | 246 bool browser_restart) { |
252 BootTimesRecorder* btl = BootTimesRecorder::Get(); | 247 BootTimesRecorder* btl = BootTimesRecorder::Get(); |
253 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); | 248 btl->AddLoginTimeMarker("UserLoggedIn-Start", false); |
254 session_manager::SessionManager::NotifyUserLoggedIn( | 249 session_manager::SessionManager::NotifyUserLoggedIn( |
255 user_account_id, user_id_hash, browser_restart); | 250 user_account_id, user_id_hash, browser_restart); |
256 btl->AddLoginTimeMarker("UserLoggedIn-End", false); | 251 btl->AddLoginTimeMarker("UserLoggedIn-End", false); |
257 } | 252 } |
258 | 253 |
259 } // namespace chromeos | 254 } // namespace chromeos |
OLD | NEW |