Chromium Code Reviews| Index: components/signin/core/browser/account_fetcher_service.cc |
| diff --git a/components/signin/core/browser/account_fetcher_service.cc b/components/signin/core/browser/account_fetcher_service.cc |
| index 22c804f6b496723a0a935e75abe82b37765e7d51..b6953d818cc5043e8566397b53f9ee91a3462497 100644 |
| --- a/components/signin/core/browser/account_fetcher_service.cc |
| +++ b/components/signin/core/browser/account_fetcher_service.cc |
| @@ -70,12 +70,10 @@ void AccountFetcherService::RegisterPrefs( |
| void AccountFetcherService::Initialize( |
| SigninClient* signin_client, |
| OAuth2TokenService* token_service, |
| - AccountTrackerService* account_tracker_service, |
| - invalidation::InvalidationService* invalidation_service) { |
| + AccountTrackerService* account_tracker_service) { |
| DCHECK(signin_client); |
| DCHECK(!signin_client_); |
| signin_client_ = signin_client; |
| - invalidation_service_ = invalidation_service; |
| DCHECK(account_tracker_service); |
| DCHECK(!account_tracker_service_); |
| account_tracker_service_ = account_tracker_service; |
| @@ -98,21 +96,6 @@ void AccountFetcherService::Shutdown() { |
| shutdown_called_ = true; |
| } |
| -void AccountFetcherService::EnableNetworkFetches() { |
| - DCHECK(CalledOnValidThread()); |
| - DCHECK(!network_fetches_enabled_); |
| - network_fetches_enabled_ = true; |
| - // If there are accounts in |pending_user_info_fetches_|, they were deemed |
| - // invalid after being loaded from prefs and need to be fetched now instead of |
| - // waiting after the timer. |
| - for (const std::string& account_id : pending_user_info_fetches_) |
| - StartFetchingUserInfo(account_id); |
| - pending_user_info_fetches_.clear(); |
| - |
| - // Now that network fetches are enabled, schedule the next refresh. |
| - ScheduleNextRefresh(); |
| -} |
| - |
| bool AccountFetcherService::IsAllUserInfoFetched() const { |
| return user_info_requests_.empty(); |
| } |
| @@ -122,6 +105,13 @@ void AccountFetcherService::FetchUserInfoBeforeSignin( |
| RefreshAccountInfo(account_id, false); |
| } |
| +void AccountFetcherService::SetupInvalidations( |
| + invalidation::InvalidationService* invalidation_service) { |
| + DCHECK(!invalidation_service_); |
| + DCHECK(!child_info_request_); |
| + invalidation_service_ = invalidation_service; |
| +} |
| + |
| void AccountFetcherService::RefreshAllAccountInfo(bool only_fetch_if_invalid) { |
| std::vector<std::string> accounts = token_service_->GetAccounts(); |
| for (std::vector<std::string>::const_iterator it = accounts.begin(); |
| @@ -180,10 +170,8 @@ void AccountFetcherService::ScheduleNextRefresh() { |
| void AccountFetcherService::StartFetchingUserInfo( |
| const std::string& account_id) { |
| DCHECK(CalledOnValidThread()); |
| - if (!network_fetches_enabled_) { |
| - pending_user_info_fetches_.push_back(account_id); |
| + if (!network_fetches_enabled_) |
| return; |
|
Roger Tawa OOO till Jul 10th
2015/10/23 12:42:12
Let's change this silent drop to:
DCHECK(networ
knn
2015/10/23 13:32:52
Done. Silently dropping in OnRefreshToken{Availabl
|
| - } |
| if (!ContainsKey(user_info_requests_, account_id)) { |
| DVLOG(1) << "StartFetching " << account_id; |
| @@ -315,8 +303,11 @@ void AccountFetcherService::OnRefreshTokenRevoked( |
| } |
| void AccountFetcherService::OnRefreshTokensLoaded() { |
| - // OnRefreshTokenAvailable has been called for all accounts by this point. |
| - // Maybe remove this after further investigation. |
| + DCHECK(CalledOnValidThread()); |
| + if (!network_fetches_enabled_) { |
| + network_fetches_enabled_ = true; |
| + ScheduleNextRefresh(); |
| + } |
| RefreshAllAccountInfo(true); |
| UpdateChildInfo(); |
| } |