| 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..b7b0ad798276c2fc0f40e73a8c8a9d9a89355da8 100644
|
| --- a/components/signin/core/browser/account_fetcher_service.cc
|
| +++ b/components/signin/core/browser/account_fetcher_service.cc
|
| @@ -11,6 +11,7 @@
|
| #include "base/trace_event/trace_event.h"
|
| #include "components/pref_registry/pref_registry_syncable.h"
|
| #include "components/signin/core/browser/account_info_fetcher.h"
|
| +#include "components/signin/core/browser/account_seeding_tracker.h"
|
| #include "components/signin/core/browser/account_tracker_service.h"
|
| #include "components/signin/core/browser/child_account_info_fetcher.h"
|
| #include "components/signin/core/browser/refresh_token_annotation_request.h"
|
| @@ -55,7 +56,8 @@ AccountFetcherService::AccountFetcherService()
|
| invalidation_service_(nullptr),
|
| network_fetches_enabled_(false),
|
| shutdown_called_(false),
|
| - child_info_request_(nullptr) {}
|
| + child_info_request_(nullptr),
|
| + account_seeding_tracker_(nullptr) {}
|
|
|
| AccountFetcherService::~AccountFetcherService() {
|
| DCHECK(shutdown_called_);
|
| @@ -79,6 +81,8 @@ void AccountFetcherService::Initialize(
|
| DCHECK(account_tracker_service);
|
| DCHECK(!account_tracker_service_);
|
| account_tracker_service_ = account_tracker_service;
|
| + account_seeding_tracker_.reset(
|
| + new AccountSeedingTracker(account_tracker_service));
|
| DCHECK(token_service);
|
| DCHECK(!token_service_);
|
| token_service_ = token_service;
|
| @@ -122,6 +126,20 @@ void AccountFetcherService::FetchUserInfoBeforeSignin(
|
| RefreshAccountInfo(account_id, false);
|
| }
|
|
|
| +#if defined(OS_ANDROID)
|
| +void AccountFetcherService::OnAccountsSeeded() {
|
| + std::vector<std::string> newly_seeded_acounts(
|
| + account_seeding_tracker_->GetNewlySeededAccounts());
|
| + for (const std::string& account : newly_seeded_acounts)
|
| + StartFetchingUserInfo(account);
|
| + UpdateChildInfo();
|
| +}
|
| +
|
| +bool AccountFetcherService::AreAllAccountsSeeded() {
|
| + return account_seeding_tracker_->AreAllAccountsSeeded();
|
| +}
|
| +#endif
|
| +
|
| 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();
|
| @@ -146,6 +164,8 @@ void AccountFetcherService::UpdateChildInfo() {
|
| ResetChildInfo();
|
| if (!AccountSupportsUserInfo(candidate))
|
| return;
|
| + if (!account_seeding_tracker_->IsAccountSeeded(candidate))
|
| + return;
|
| child_request_account_id_ = candidate;
|
| StartFetchingChildInfo(candidate);
|
| } else {
|
| @@ -184,6 +204,8 @@ void AccountFetcherService::StartFetchingUserInfo(
|
| pending_user_info_fetches_.push_back(account_id);
|
| return;
|
| }
|
| + if (!account_seeding_tracker_->IsAccountSeeded(account_id))
|
| + return;
|
|
|
| if (!ContainsKey(user_info_requests_, account_id)) {
|
| DVLOG(1) << "StartFetching " << account_id;
|
|
|