Chromium Code Reviews| Index: chrome/browser/signin/oauth2_token_service_delegate_android.cc |
| diff --git a/chrome/browser/signin/oauth2_token_service_delegate_android.cc b/chrome/browser/signin/oauth2_token_service_delegate_android.cc |
| index 4c322a4eeb6f49c3fc75a59e7cfcadbe250f84f7..5a926d51b2cd03df36b8a826ffcab22286fbcdb5 100644 |
| --- a/chrome/browser/signin/oauth2_token_service_delegate_android.cc |
| +++ b/chrome/browser/signin/oauth2_token_service_delegate_android.cc |
| @@ -131,6 +131,13 @@ std::string AndroidAccessTokenFetcher::CombineScopes( |
| bool OAuth2TokenServiceDelegateAndroid::is_testing_profile_ = false; |
| +OAuth2TokenServiceDelegateAndroid::ErrorInfo::ErrorInfo() |
| + : error(GoogleServiceAuthError::NONE) {} |
| + |
| +OAuth2TokenServiceDelegateAndroid::ErrorInfo::ErrorInfo( |
| + const GoogleServiceAuthError& error) |
| + : error(error) {} |
| + |
| OAuth2TokenServiceDelegateAndroid::OAuth2TokenServiceDelegateAndroid() { |
| DVLOG(1) << "OAuth2TokenServiceDelegateAndroid::ctor"; |
| JNIEnv* env = AttachCurrentThread(); |
| @@ -182,10 +189,24 @@ bool OAuth2TokenServiceDelegateAndroid::RefreshTokenIsAvailable( |
| return refresh_token_is_available == JNI_TRUE; |
| } |
| +bool OAuth2TokenServiceDelegateAndroid::RefreshTokenHasError( |
| + const std::string& account_id) const { |
| + auto it = errors_.find(account_id); |
| + // TODO(rogerta): should we distinguish between transient and persistent? |
| + return it == errors_.end() |
| + ? false |
| + : it->second.error.state() != GoogleServiceAuthError::NONE; |
|
anthonyvd
2015/08/11 15:43:10
Any way to put at least part of this in the base c
Roger Tawa OOO till Jul 10th
2015/08/11 16:25:25
Done.
|
| +} |
| + |
| void OAuth2TokenServiceDelegateAndroid::UpdateAuthError( |
| const std::string& account_id, |
| const GoogleServiceAuthError& error) { |
| - // TODO(rogerta): do we need to update anything, or does the system handle it? |
| + if (error.state() == GoogleServiceAuthError::NONE) { |
| + errors_.erase(account_id); |
| + } else { |
| + // TODO(rogerta): should we distinguish between transient and persistent? |
| + errors_[account_id] = ErrorInfo(error); |
| + } |
| } |
| std::vector<std::string> OAuth2TokenServiceDelegateAndroid::GetAccounts() { |