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

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

Issue 23678007: OAuth2LoginManager+MergeSessionThrottle hardening, multi-profle support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
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 cbcc9734816c88b02ac2f7ee44e80bca94e92519..0351bcc4e5c15ac390c07f6c3648f186867f94eb 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -102,6 +102,7 @@ class LoginUtilsImpl
public:
LoginUtilsImpl()
: using_oauth_(false),
+ should_finalize_profile_(false),
has_web_auth_cookies_(false),
login_manager_(OAuthLoginManager::Create(this)),
delegate_(NULL),
@@ -135,6 +136,7 @@ class LoginUtilsImpl
virtual void InitRlzDelayed(Profile* user_profile) OVERRIDE;
// OAuthLoginManager::Delegate overrides.
+ virtual void OnStartMergeSession(Profile* user_profile) OVERRIDE;
virtual void OnCompletedMergeSession() OVERRIDE;
virtual void OnCompletedAuthentication(Profile* user_profile) OVERRIDE;
virtual void OnFoundStoredTokens() OVERRIDE;
@@ -187,6 +189,8 @@ class LoginUtilsImpl
UserContext user_context_;
bool using_oauth_;
+ bool should_finalize_profile_;
+
// True if the authentication profile's cookie jar should contain
// authentication cookies from the authentication extension log in flow.
bool has_web_auth_cookies_;
@@ -459,8 +463,8 @@ void LoginUtilsImpl::UserProfileInitialized(Profile* user_profile) {
}
void LoginUtilsImpl::CompleteProfileCreate(Profile* user_profile) {
+ should_finalize_profile_ = true;
RestoreAuthSession(user_profile, has_web_auth_cookies_);
- FinalizePrepareProfile(user_profile);
}
void LoginUtilsImpl::RestoreAuthSession(Profile* user_profile,
@@ -476,7 +480,7 @@ void LoginUtilsImpl::RestoreAuthSession(Profile* user_profile,
return;
UserManager::Get()->SetMergeSessionState(
- UserManager::MERGE_STATUS_IN_PROCESS);
+ UserManager::MERGE_STATUS_PREPARING);
// Remove legacy OAuth1 token if we have one. If it's valid, we should already
// have OAuth2 refresh token in TokenService that could be used to retrieve
@@ -735,6 +739,16 @@ void LoginUtilsImpl::OnCompletedAuthentication(Profile* user_profile) {
StartSignedInServices(user_profile);
}
+void LoginUtilsImpl::OnStartMergeSession(Profile* user_profile) {
+ UserManager::Get()->SetMergeSessionState(
+ UserManager::MERGE_STATUS_IN_PROCESS);
+
+ if (should_finalize_profile_)
+ FinalizePrepareProfile(user_profile);
+
+ should_finalize_profile_ = false;
+}
+
void LoginUtilsImpl::OnCompletedMergeSession() {
UserManager::Get()->SetMergeSessionState(UserManager::MERGE_STATUS_DONE);
}

Powered by Google App Engine
This is Rietveld 408576698