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

Unified Diff: components/signin/core/browser/signin_manager.cc

Issue 479353003: Add IsAuthenticated() method to SigninManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments Created 6 years, 4 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: components/signin/core/browser/signin_manager.cc
diff --git a/components/signin/core/browser/signin_manager.cc b/components/signin/core/browser/signin_manager.cc
index 7358cbb7fbb8d07d103927613209a7ceb7656a31..710c21ff1def3022b771d3038ac59a9c8202eda4 100644
--- a/components/signin/core/browser/signin_manager.cc
+++ b/components/signin/core/browser/signin_manager.cc
@@ -131,7 +131,7 @@ void SigninManager::StartSignInWithRefreshToken(
const std::string& username,
const std::string& password,
const OAuthTokenFetchedCallback& callback) {
- DCHECK(GetAuthenticatedUsername().empty() ||
+ DCHECK(!IsAuthenticated() ||
gaia::AreEmailsSame(username, GetAuthenticatedUsername()));
if (!PrepareForSignin(SIGNIN_TYPE_WITH_REFRESH_TOKEN, username, password))
@@ -178,7 +178,7 @@ void SigninManager::SignOut(
DCHECK(IsInitialized());
signin_metrics::LogSignout(signout_source_metric);
- if (GetAuthenticatedUsername().empty()) {
+ if (!IsAuthenticated()) {
if (AuthInProgress()) {
// If the user is in the process of signing in, then treat a call to
// SignOut as a cancellation request.
@@ -269,7 +269,7 @@ void SigninManager::Shutdown() {
}
void SigninManager::OnGoogleServicesUsernamePatternChanged() {
- if (!GetAuthenticatedUsername().empty() &&
+ if (IsAuthenticated() &&
!IsAllowedUsername(GetAuthenticatedUsername())) {
// Signed in user is invalid according to the current policy so sign
// the user out.
@@ -351,7 +351,7 @@ void SigninManager::CompletePendingSignin() {
}
DCHECK(!temp_refresh_token_.empty());
- DCHECK(!GetAuthenticatedUsername().empty());
+ DCHECK(IsAuthenticated());
token_service_->UpdateCredentials(GetAuthenticatedUsername(),
temp_refresh_token_);
temp_refresh_token_.clear();
« no previous file with comments | « components/signin/core/browser/account_reconcilor.cc ('k') | components/signin/core/browser/signin_manager_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698