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

Side by Side Diff: chrome/browser/android/signin/account_tracker_service_android.cc

Issue 1256283002: GAIA ID migration for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 5 years, 3 months 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/android/signin/account_tracker_service_android.h"
6
7 #include "base/android/jni_array.h"
8 #include "chrome/browser/profiles/profile_manager.h"
9 #include "chrome/browser/signin/account_tracker_service_factory.h"
10 #include "components/signin/core/browser/account_info.h"
11 #include "jni/AccountTrackerService_jni.h"
12
13 AccountTrackerServiceAndroid::AccountTrackerServiceAndroid(JNIEnv* env,
14 jobject obj) {
15 java_account_tracker_service_.Reset(env, obj);
16 }
17
18 void AccountTrackerServiceAndroid::SeedAccountsInfo(JNIEnv* env,
19 jobject obj,
20 jobjectArray gaiaIds,
21 jobjectArray accountNames) {
22 std::vector<std::string> gaia_ids;
23 std::vector<std::string> account_names;
24 base::android::AppendJavaStringArrayToStringVector(env, gaiaIds, &gaia_ids);
25 base::android::AppendJavaStringArrayToStringVector(env, accountNames,
26 &account_names);
27 DCHECK_EQ(gaia_ids.size(), account_names.size());
28
29 DVLOG(1) << "AccountTrackerServiceAndroid::SeedAccountsInfo: "
30 << " number of accounts " << gaia_ids.size();
31 Profile* profile = ProfileManager::GetActiveUserProfile();
32 AccountTrackerService* account_tracker_service_ =
33 AccountTrackerServiceFactory::GetForProfile(profile);
34
35 for (unsigned int i = 0; i < gaia_ids.size(); i++) {
36 account_tracker_service_->SeedAccountInfo(gaia_ids[i], account_names[i]);
37 }
38 }
39
40 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
41 AccountTrackerServiceAndroid* account_tracker_service_android =
42 new AccountTrackerServiceAndroid(env, obj);
43 return reinterpret_cast<intptr_t>(account_tracker_service_android);
44 }
45
46 // static
47 bool AccountTrackerServiceAndroid::Register(JNIEnv* env) {
48 return RegisterNativesImpl(env);
49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698