diff options
Diffstat (limited to 'google_apis')
-rw-r--r-- | google_apis/gaia/oauth2_token_service_delegate.cc | 13 | ||||
-rw-r--r-- | google_apis/gaia/oauth2_token_service_delegate.h | 2 |
2 files changed, 10 insertions, 5 deletions
diff --git a/google_apis/gaia/oauth2_token_service_delegate.cc b/google_apis/gaia/oauth2_token_service_delegate.cc index aed5db8..3c5f75b 100644 --- a/google_apis/gaia/oauth2_token_service_delegate.cc +++ b/google_apis/gaia/oauth2_token_service_delegate.cc @@ -24,16 +24,21 @@ OAuth2TokenServiceDelegate::OAuth2TokenServiceDelegate() OAuth2TokenServiceDelegate::~OAuth2TokenServiceDelegate() { } -void OAuth2TokenServiceDelegate::ValidateAccountId( +bool OAuth2TokenServiceDelegate::ValidateAccountId( const std::string& account_id) const { - DCHECK(!account_id.empty()); + bool valid = !account_id.empty(); // If the account is given as an email, make sure its a canonical email. // Note that some tests don't use email strings as account id, and after // the gaia id migration it won't be an email. So only check for // canonicalization if the account_id is suspected to be an email. - if (account_id.find('@') != std::string::npos) - DCHECK_EQ(gaia::CanonicalizeEmail(account_id), account_id); + if (account_id.find('@') != std::string::npos && + gaia::CanonicalizeEmail(account_id) != account_id) { + valid = false; + } + + DCHECK(valid); + return valid; } void OAuth2TokenServiceDelegate::AddObserver( diff --git a/google_apis/gaia/oauth2_token_service_delegate.h b/google_apis/gaia/oauth2_token_service_delegate.h index 3a2d39f..24bf063 100644 --- a/google_apis/gaia/oauth2_token_service_delegate.h +++ b/google_apis/gaia/oauth2_token_service_delegate.h @@ -48,7 +48,7 @@ class OAuth2TokenServiceDelegate { virtual void RevokeCredentials(const std::string& account_id) {} virtual net::URLRequestContextGetter* GetRequestContext() const; - void ValidateAccountId(const std::string& account_id) const; + bool ValidateAccountId(const std::string& account_id) const; // Add or remove observers of this token service. void AddObserver(OAuth2TokenService::Observer* observer); |