Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Unified Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 228703004: Start session fail causes restart chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chromeos/dbus/session_manager_client.h » ('j') | chromeos/dbus/session_manager_client.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8438ef1e7a3de7df41006a783917260b0ccd0519 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -199,6 +199,20 @@ class LoginUtilsImpl
// the authentication profile.
void CompleteProfileCreate(Profile* user_profile);
+ // Callback to resume profile preparing after start session
+ void onSessionStarted(const UserContext& user_context,
ygorshenin1 2014/04/10 15:39:22 Functions should start with a capital letter (http
Roman Sorokin (ftl) 2014/04/11 07:38:13 Done.
+ const std::string& display_email,
+ bool has_cookies,
+ LoginUtils::Delegate* delegate,
+ bool success);
+
+ // Complete profile preparation with having active session
+ 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 +405,46 @@ 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,
Nikita (slow) 2014/04/10 15:41:13 nit: Alignment should be fixed.
Roman Sorokin (ftl) 2014/04/11 07:38:13 Done.
+ 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,
« no previous file with comments | « no previous file | chromeos/dbus/session_manager_client.h » ('j') | chromeos/dbus/session_manager_client.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698