| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/signin/signin_manager.h" | 5 #include "chrome/browser/signin/signin_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 return; | 359 return; |
| 360 } | 360 } |
| 361 | 361 |
| 362 GoogleServiceSignoutDetails details(authenticated_username_); | 362 GoogleServiceSignoutDetails details(authenticated_username_); |
| 363 | 363 |
| 364 ClearTransientSigninData(); | 364 ClearTransientSigninData(); |
| 365 authenticated_username_.clear(); | 365 authenticated_username_.clear(); |
| 366 profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); | 366 profile_->GetPrefs()->ClearPref(prefs::kGoogleServicesUsername); |
| 367 profile_->GetPrefs()->ClearPref(prefs::kIsGooglePlusUser); | 367 profile_->GetPrefs()->ClearPref(prefs::kIsGooglePlusUser); |
| 368 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); | 368 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); |
| 369 token_service->ResetCredentialsInMemory(); | |
| 370 token_service->EraseTokensFromDB(); | |
| 371 content::NotificationService::current()->Notify( | 369 content::NotificationService::current()->Notify( |
| 372 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, | 370 chrome::NOTIFICATION_GOOGLE_SIGNED_OUT, |
| 373 content::Source<Profile>(profile_), | 371 content::Source<Profile>(profile_), |
| 374 content::Details<const GoogleServiceSignoutDetails>(&details)); | 372 content::Details<const GoogleServiceSignoutDetails>(&details)); |
| 373 token_service->ResetCredentialsInMemory(); |
| 374 token_service->EraseTokensFromDB(); |
| 375 } | 375 } |
| 376 | 376 |
| 377 bool SigninManager::AuthInProgress() const { | 377 bool SigninManager::AuthInProgress() const { |
| 378 return !possibly_invalid_username_.empty(); | 378 return !possibly_invalid_username_.empty(); |
| 379 } | 379 } |
| 380 | 380 |
| 381 void SigninManager::OnGetUserInfoKeyNotFound(const std::string& key) { | 381 void SigninManager::OnGetUserInfoKeyNotFound(const std::string& key) { |
| 382 DCHECK(key == kGetInfoEmailKey); | 382 DCHECK(key == kGetInfoEmailKey); |
| 383 LOG(ERROR) << "Account is not associated with a valid email address. " | 383 LOG(ERROR) << "Account is not associated with a valid email address. " |
| 384 << "Login failed."; | 384 << "Login failed."; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 void SigninManager::OnPreferenceChanged(PrefServiceBase* service, | 540 void SigninManager::OnPreferenceChanged(PrefServiceBase* service, |
| 541 const std::string& pref_name) { | 541 const std::string& pref_name) { |
| 542 DCHECK_EQ(std::string(prefs::kGoogleServicesUsernamePattern), pref_name); | 542 DCHECK_EQ(std::string(prefs::kGoogleServicesUsernamePattern), pref_name); |
| 543 if (!authenticated_username_.empty() && | 543 if (!authenticated_username_.empty() && |
| 544 !IsAllowedUsername(authenticated_username_)) { | 544 !IsAllowedUsername(authenticated_username_)) { |
| 545 // Signed in user is invalid according to the current policy so sign | 545 // Signed in user is invalid according to the current policy so sign |
| 546 // the user out. | 546 // the user out. |
| 547 SignOut(); | 547 SignOut(); |
| 548 } | 548 } |
| 549 } | 549 } |
| OLD | NEW |