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

Side by Side Diff: components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.mm

Issue 1267843003: Fix reconcilor loop when the primary account is in an auth error state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/signin/ios/browser/profile_oauth2_token_service_ios_delegat e.h" 5 #include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegat e.h"
6 6
7 #include <Foundation/Foundation.h> 7 #include <Foundation/Foundation.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 return account_ids; 303 return account_ids;
304 } 304 }
305 305
306 bool ProfileOAuth2TokenServiceIOSDelegate::RefreshTokenIsAvailable( 306 bool ProfileOAuth2TokenServiceIOSDelegate::RefreshTokenIsAvailable(
307 const std::string& account_id) const { 307 const std::string& account_id) const {
308 DCHECK(thread_checker_.CalledOnValidThread()); 308 DCHECK(thread_checker_.CalledOnValidThread());
309 309
310 return accounts_.count(account_id) > 0; 310 return accounts_.count(account_id) > 0;
311 } 311 }
312 312
313 bool ProfileOAuth2TokenServiceIOSDelegate::RefreshTokenHasError(
314 const std::string& account_id) const {
315 DCHECK(thread_checker_.CalledOnValidThread());
316 auto it = accounts_.find(account_id);
317 // TODO(rogerta): should we distinguish between transient and persistent?
318 return it == accounts_.end() ? false : IsError(it->second->GetAuthStatus());
319 }
320
313 void ProfileOAuth2TokenServiceIOSDelegate::UpdateAuthError( 321 void ProfileOAuth2TokenServiceIOSDelegate::UpdateAuthError(
314 const std::string& account_id, 322 const std::string& account_id,
315 const GoogleServiceAuthError& error) { 323 const GoogleServiceAuthError& error) {
316 DCHECK(thread_checker_.CalledOnValidThread()); 324 DCHECK(thread_checker_.CalledOnValidThread());
317 325
318 // Do not report connection errors as these are not actually auth errors. 326 // Do not report connection errors as these are not actually auth errors.
319 // We also want to avoid masking a "real" auth error just because we 327 // We also want to avoid masking a "real" auth error just because we
320 // subsequently get a transient network error. 328 // subsequently get a transient network error.
321 if (error.state() == GoogleServiceAuthError::CONNECTION_FAILED || 329 if (error.state() == GoogleServiceAuthError::CONNECTION_FAILED ||
322 error.state() == GoogleServiceAuthError::SERVICE_UNAVAILABLE) { 330 error.state() == GoogleServiceAuthError::SERVICE_UNAVAILABLE) {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 void ProfileOAuth2TokenServiceIOSDelegate::ExcludeAllSecondaryAccounts() { 456 void ProfileOAuth2TokenServiceIOSDelegate::ExcludeAllSecondaryAccounts() {
449 client_->GetPrefs()->SetBoolean( 457 client_->GetPrefs()->SetBoolean(
450 prefs::kTokenServiceExcludeAllSecondaryAccounts, true); 458 prefs::kTokenServiceExcludeAllSecondaryAccounts, true);
451 } 459 }
452 460
453 void ProfileOAuth2TokenServiceIOSDelegate::ClearExcludedSecondaryAccounts() { 461 void ProfileOAuth2TokenServiceIOSDelegate::ClearExcludedSecondaryAccounts() {
454 client_->GetPrefs()->ClearPref( 462 client_->GetPrefs()->ClearPref(
455 prefs::kTokenServiceExcludeAllSecondaryAccounts); 463 prefs::kTokenServiceExcludeAllSecondaryAccounts);
456 client_->GetPrefs()->ClearPref(prefs::kTokenServiceExcludedSecondaryAccounts); 464 client_->GetPrefs()->ClearPref(prefs::kTokenServiceExcludedSecondaryAccounts);
457 } 465 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698