Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/android/profiles/profile_downloader_android.h" | 5 #include "chrome/browser/android/profiles/profile_downloader_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/profile_android.h" | 10 #include "chrome/browser/profiles/profile_android.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 void StartFetchingAccountInfoFor( | 178 void StartFetchingAccountInfoFor( |
| 179 JNIEnv* env, | 179 JNIEnv* env, |
| 180 jclass clazz, | 180 jclass clazz, |
| 181 jobject jprofile, | 181 jobject jprofile, |
| 182 jstring jemail, | 182 jstring jemail, |
| 183 jint image_side_pixels, | 183 jint image_side_pixels, |
| 184 jboolean is_pre_signin) { | 184 jboolean is_pre_signin) { |
| 185 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); | 185 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); |
| 186 const std::string email = | 186 const std::string email = |
| 187 base::android::ConvertJavaStringToUTF8(env, jemail); | 187 base::android::ConvertJavaStringToUTF8(env, jemail); |
| 188 // TODO(rogerta): the java code will need to pass in the gaia-id | 188 |
| 189 // of the account instead of the email when chrome uses gaia-id as key. | 189 std::string account_id = gaia::CanonicalizeEmail(gaia::SanitizeEmail(email)); |
| 190 DCHECK_EQ(AccountTrackerService::MIGRATION_NOT_STARTED, | 190 AccountTrackerService* account_tracker_service = |
| 191 AccountTrackerServiceFactory::GetForProfile(profile)-> | 191 AccountTrackerServiceFactory::GetForProfile(profile); |
| 192 GetMigrationState()); | 192 if (account_tracker_service->GetMigrationState() != |
| 193 AccountInfoRetriever* retriever = | 193 AccountTrackerService::MIGRATION_NOT_STARTED) { |
| 194 new AccountInfoRetriever( | 194 std::string accountid = |
|
Roger Tawa OOO till Jul 10th
2015/08/12 15:28:46
This variable name is too similar with account_id.
gogerald1
2015/08/13 18:12:12
Acknowledged.
| |
| 195 profile, gaia::CanonicalizeEmail(gaia::SanitizeEmail(email)), email, | 195 account_tracker_service->FindAccountInfoByEmail(email).gaia; |
|
Roger Tawa OOO till Jul 10th
2015/08/12 15:28:46
If migration state != NOT_STARTED, then FindAccoun
gogerald1
2015/08/13 18:12:12
Done.
| |
| 196 image_side_pixels, is_pre_signin); | 196 if (!accountid.empty()) |
| 197 account_id = accountid; | |
| 198 } | |
| 199 | |
| 200 AccountInfoRetriever* retriever = new AccountInfoRetriever( | |
| 201 profile, account_id, email, image_side_pixels, is_pre_signin); | |
| 197 retriever->Start(); | 202 retriever->Start(); |
| 198 } | 203 } |
| 199 | 204 |
| 200 // static | 205 // static |
| 201 bool RegisterProfileDownloader(JNIEnv* env) { | 206 bool RegisterProfileDownloader(JNIEnv* env) { |
| 202 return RegisterNativesImpl(env); | 207 return RegisterNativesImpl(env); |
| 203 } | 208 } |
| OLD | NEW |