Index: chrome/browser/chromeos/login/login_utils.cc |
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc |
index 2ae990b3f7a275b10821343db9a9f96b6652a1a3..215c77b0b1b2e570cf3764a0cdf96da046c00806 100644 |
--- a/chrome/browser/chromeos/login/login_utils.cc |
+++ b/chrome/browser/chromeos/login/login_utils.cc |
@@ -199,6 +199,19 @@ class LoginUtilsImpl |
// the authentication profile. |
void CompleteProfileCreate(Profile* user_profile); |
+ // Callback to resume profile preparing after start session |
Nikita (slow)
2014/04/18 05:22:59
nit: Add dot at the end, otherwise comment looks l
Roman Sorokin (ftl)
2014/04/22 08:28:47
Done.
|
+ void OnSessionStarted(const UserContext& user_context, |
+ const std::string& display_email, |
+ bool has_cookies, |
+ LoginUtils::Delegate* delegate, |
+ bool success); |
+ |
+ // Complete profile preparation with having active session |
Nikita (slow)
2014/04/18 05:22:59
nit: same here.
Roman Sorokin (ftl)
2014/04/22 08:28:47
Done.
|
+ void CompletePrepareProfileWithActiveSession(const UserContext& user_context, |
+ const std::string& display_email, |
+ bool has_cookies, |
+ LoginUtils::Delegate* delegate); |
+ |
// Finalized profile preparation. |
void FinalizePrepareProfile(Profile* user_profile); |
@@ -391,10 +404,42 @@ void LoginUtilsImpl::PrepareProfile( |
if (!has_active_session) { |
btl->AddLoginTimeMarker("StartSession-Start", false); |
DBusThreadManager::Get()->GetSessionManagerClient()->StartSession( |
- user_context.username); |
- btl->AddLoginTimeMarker("StartSession-End", false); |
+ user_context.username, |
+ base::Bind(&LoginUtilsImpl::OnSessionStarted, |
+ AsWeakPtr(), |
+ user_context, |
+ display_email, |
+ has_cookies, |
+ delegate)); |
+ return; |
+ } |
+ CompletePrepareProfileWithActiveSession( |
+ user_context, display_email, has_cookies, delegate); |
+} |
+ |
+void LoginUtilsImpl::OnSessionStarted(const UserContext& user_context, |
+ const std::string& display_email, |
+ bool has_cookies, |
+ LoginUtils::Delegate* delegate, |
+ bool success) { |
+ BootTimesLoader* btl = BootTimesLoader::Get(); |
+ btl->AddLoginTimeMarker("StartSession-End", false); |
+ |
+ if (!success) { |
+ LOG(ERROR) << "StartSession failed"; |
+ chrome::AttemptUserExit(); |
+ return; |
} |
+ CompletePrepareProfileWithActiveSession( |
+ user_context, display_email, has_cookies, delegate); |
+} |
+void LoginUtilsImpl::CompletePrepareProfileWithActiveSession( |
+ const UserContext& user_context, |
+ const std::string& display_email, |
+ bool has_cookies, |
+ LoginUtils::Delegate* delegate) { |
+ BootTimesLoader* btl = BootTimesLoader::Get(); |
btl->AddLoginTimeMarker("UserLoggedIn-Start", false); |
UserManager* user_manager = UserManager::Get(); |
user_manager->UserLoggedIn(user_context.username, |