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

Side by Side Diff: chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.cc

Issue 1380103004: Delay fetching account info until OnRefreshTokensLoaded(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix iOs Created 5 years, 1 month 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 "chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.h" 5 #include "chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.h"
6 6
7 #include "base/profiler/scoped_tracker.h" 7 #include "base/profiler/scoped_tracker.h"
8 #include "components/signin/core/browser/signin_client.h" 8 #include "components/signin/core/browser/signin_client.h"
9 #include "components/signin/core/browser/signin_metrics.h" 9 #include "components/signin/core/browser/signin_metrics.h"
10 #include "components/signin/core/browser/webdata/token_web_data.h" 10 #include "components/signin/core/browser/webdata/token_web_data.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 return account_ids; 231 return account_ids;
232 } 232 }
233 233
234 net::URLRequestContextGetter* 234 net::URLRequestContextGetter*
235 MutableProfileOAuth2TokenServiceDelegate::GetRequestContext() const { 235 MutableProfileOAuth2TokenServiceDelegate::GetRequestContext() const {
236 return client_->GetURLRequestContext(); 236 return client_->GetURLRequestContext();
237 } 237 }
238 238
239 void MutableProfileOAuth2TokenServiceDelegate::LoadCredentials( 239 void MutableProfileOAuth2TokenServiceDelegate::LoadCredentials(
240 const std::string& primary_account_id) { 240 const std::string& primary_account_id) {
241 DCHECK(!primary_account_id.empty()); 241 if (primary_account_id.empty()) {
242 FireRefreshTokensLoaded();
243 return;
244 }
242 ValidateAccountId(primary_account_id); 245 ValidateAccountId(primary_account_id);
243 DCHECK(loading_primary_account_id_.empty()); 246 DCHECK(loading_primary_account_id_.empty());
244 DCHECK_EQ(0, web_data_service_request_); 247 DCHECK_EQ(0, web_data_service_request_);
245 248
246 refresh_tokens_.clear(); 249 refresh_tokens_.clear();
247 250
248 // If the account_id is an email address, then canonicalize it. This 251 // If the account_id is an email address, then canonicalize it. This
249 // is to support legacy account_ids, and will not be needed after 252 // is to support legacy account_ids, and will not be needed after
250 // switching to gaia-ids. 253 // switching to gaia-ids.
251 if (primary_account_id.find('@') != std::string::npos) { 254 if (primary_account_id.find('@') != std::string::npos) {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 CancelWebTokenFetch(); 512 CancelWebTokenFetch();
510 refresh_tokens_.clear(); 513 refresh_tokens_.clear();
511 } 514 }
512 515
513 void MutableProfileOAuth2TokenServiceDelegate::OnNetworkChanged( 516 void MutableProfileOAuth2TokenServiceDelegate::OnNetworkChanged(
514 net::NetworkChangeNotifier::ConnectionType type) { 517 net::NetworkChangeNotifier::ConnectionType type) {
515 // If our network has changed, reset the backoff timer so that errors caused 518 // If our network has changed, reset the backoff timer so that errors caused
516 // by a previous lack of network connectivity don't prevent new requests. 519 // by a previous lack of network connectivity don't prevent new requests.
517 backoff_entry_.Reset(); 520 backoff_entry_.Reset();
518 } 521 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698