Chromium Code Reviews| Index: chrome/browser/android/signin/account_tracker_service_android.cc |
| diff --git a/chrome/browser/android/signin/account_tracker_service_android.cc b/chrome/browser/android/signin/account_tracker_service_android.cc |
| index 26a2590c2742db764da83d3f120c735f0903d525..7cfadaf8c3324c1f92540cb5390080cd09d9bd90 100644 |
| --- a/chrome/browser/android/signin/account_tracker_service_android.cc |
| +++ b/chrome/browser/android/signin/account_tracker_service_android.cc |
| @@ -6,12 +6,15 @@ |
| #include "base/android/jni_array.h" |
| #include "chrome/browser/profiles/profile_manager.h" |
| +#include "chrome/browser/signin/account_fetcher_service_factory.h" |
| #include "chrome/browser/signin/account_tracker_service_factory.h" |
| +#include "components/signin/core/browser/account_fetcher_service.h" |
| #include "components/signin/core/browser/account_info.h" |
| #include "jni/AccountTrackerService_jni.h" |
| AccountTrackerServiceAndroid::AccountTrackerServiceAndroid(JNIEnv* env, |
| - jobject obj) { |
| + jobject obj) |
| + : seeded_accounts_info_(false) { |
| java_account_tracker_service_.Reset(env, obj); |
| } |
| @@ -29,12 +32,16 @@ void AccountTrackerServiceAndroid::SeedAccountsInfo(JNIEnv* env, |
| DVLOG(1) << "AccountTrackerServiceAndroid::SeedAccountsInfo: " |
| << " number of accounts " << gaia_ids.size(); |
| Profile* profile = ProfileManager::GetActiveUserProfile(); |
| - AccountTrackerService* account_tracker_service_ = |
| + AccountTrackerService* account_tracker_service = |
| AccountTrackerServiceFactory::GetForProfile(profile); |
| for (unsigned int i = 0; i < gaia_ids.size(); i++) { |
| - account_tracker_service_->SeedAccountInfo(gaia_ids[i], account_names[i]); |
| + account_tracker_service->SeedAccountInfo(gaia_ids[i], account_names[i]); |
| } |
| + if (!seeded_accounts_info_) |
| + AccountFetcherServiceFactory::GetForProfile(profile) |
|
Mike Lerman
2015/10/01 13:54:44
nit: add { and } for multi-line statement.
|
| + ->EnableNetworkFetches(); |
| + seeded_accounts_info_ = true; |
| } |
|
Roger Tawa OOO till Jul 10th
2015/10/01 14:17:38
I suspect this could come up in other situations t
anthonyvd
2015/10/01 14:33:20
Agreed that EnableNetworkFetches should be idempot
|
| static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |