| OLD | NEW |
| 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/core/browser/account_fetcher_service.h" | 5 #include "components/signin/core/browser/account_fetcher_service.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/profiler/scoped_tracker.h" | 10 #include "base/profiler/scoped_tracker.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // Now that network fetches are enabled, schedule the next refresh. | 112 // Now that network fetches are enabled, schedule the next refresh. |
| 113 ScheduleNextRefresh(); | 113 ScheduleNextRefresh(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool AccountFetcherService::IsAllUserInfoFetched() const { | 116 bool AccountFetcherService::IsAllUserInfoFetched() const { |
| 117 return user_info_requests_.empty(); | 117 return user_info_requests_.empty(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void AccountFetcherService::FetchUserInfoBeforeSignin( | 120 void AccountFetcherService::FetchUserInfoBeforeSignin( |
| 121 const std::string& account_id) { | 121 const std::string& account_id) { |
| 122 LOG(WARNING) << "Fetching account info before signin for account id: " |
| 123 << account_id; |
| 122 RefreshAccountInfo(account_id, false); | 124 RefreshAccountInfo(account_id, false); |
| 123 } | 125 } |
| 124 | 126 |
| 125 void AccountFetcherService::RefreshAllAccountInfo(bool only_fetch_if_invalid) { | 127 void AccountFetcherService::RefreshAllAccountInfo(bool only_fetch_if_invalid) { |
| 126 std::vector<std::string> accounts = token_service_->GetAccounts(); | 128 std::vector<std::string> accounts = token_service_->GetAccounts(); |
| 127 for (std::vector<std::string>::const_iterator it = accounts.begin(); | 129 for (std::vector<std::string>::const_iterator it = accounts.begin(); |
| 128 it != accounts.end(); ++it) { | 130 it != accounts.end(); ++it) { |
| 129 RefreshAccountInfo(*it, only_fetch_if_invalid); | 131 RefreshAccountInfo(*it, only_fetch_if_invalid); |
| 130 } | 132 } |
| 131 } | 133 } |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 UpdateChildInfo(); | 315 UpdateChildInfo(); |
| 314 account_tracker_service_->StopTrackingAccount(account_id); | 316 account_tracker_service_->StopTrackingAccount(account_id); |
| 315 } | 317 } |
| 316 | 318 |
| 317 void AccountFetcherService::OnRefreshTokensLoaded() { | 319 void AccountFetcherService::OnRefreshTokensLoaded() { |
| 318 // OnRefreshTokenAvailable has been called for all accounts by this point. | 320 // OnRefreshTokenAvailable has been called for all accounts by this point. |
| 319 // Maybe remove this after further investigation. | 321 // Maybe remove this after further investigation. |
| 320 RefreshAllAccountInfo(true); | 322 RefreshAllAccountInfo(true); |
| 321 UpdateChildInfo(); | 323 UpdateChildInfo(); |
| 322 } | 324 } |
| OLD | NEW |