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

Unified Diff: chrome/browser/sync/signin_manager.cc

Issue 8515030: Do not clear tokens from db when the user enters new credentials. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: For review. Created 9 years, 1 month 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 | « chrome/browser/sync/signin_manager.h ('k') | chrome/browser/sync/signin_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/signin_manager.cc
diff --git a/chrome/browser/sync/signin_manager.cc b/chrome/browser/sync/signin_manager.cc
index ca5be0ce97812aaf65d46fc7e85921a3fce185d5..c97b2054d993af814a46441db7209e7b993f10f8 100644
--- a/chrome/browser/sync/signin_manager.cc
+++ b/chrome/browser/sync/signin_manager.cc
@@ -80,12 +80,6 @@ void SigninManager::SetUsername(const std::string& username) {
void SigninManager::PrepareForSignin() {
DCHECK(!browser_sync::IsUsingOAuth());
DCHECK(username_.empty());
-#if !defined(OS_CHROMEOS)
- // The Sign out should clear the token service credentials.
- // Note: In CHROMEOS we might have valid credentials but still need to
- // set up 2-factor authentication.
- DCHECK(!profile_->GetTokenService()->AreCredentialsValid());
-#endif
}
// static
@@ -160,18 +154,24 @@ void SigninManager::ProvideSecondFactorAccessCode(
GaiaAuthFetcher::HostedAccountsNotAllowed);
}
-void SigninManager::SignOut() {
+void SigninManager::ClearInMemoryData() {
if (!profile_)
return;
CleanupNotificationRegistration();
-
client_login_.reset();
last_result_ = ClientLoginResult();
username_.clear();
oauth_username_.clear();
password_.clear();
had_two_factor_error_ = false;
+}
+
+void SigninManager::SignOut() {
+ if (!profile_)
+ return;
+
+ ClearInMemoryData();
profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername);
profile_->GetPrefs()->ClearPref(prefs::kSyncUsingOAuth);
profile_->GetPrefs()->ScheduleSavePersistentPrefs();
@@ -251,7 +251,7 @@ void SigninManager::OnClientLoginFailure(const GoogleServiceAuthError& error) {
return;
}
- SignOut();
+ ClearInMemoryData();
}
void SigninManager::OnOAuthGetAccessTokenSuccess(const std::string& token,
« no previous file with comments | « chrome/browser/sync/signin_manager.h ('k') | chrome/browser/sync/signin_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698