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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 const JavaParamRef<jobject>& jprofile, | 186 const JavaParamRef<jobject>& jprofile, |
187 const JavaParamRef<jstring>& jemail, | 187 const JavaParamRef<jstring>& jemail, |
188 jint image_side_pixels, | 188 jint image_side_pixels, |
189 jboolean is_pre_signin) { | 189 jboolean is_pre_signin) { |
190 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); | 190 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); |
191 const std::string email = | 191 const std::string email = |
192 base::android::ConvertJavaStringToUTF8(env, jemail); | 192 base::android::ConvertJavaStringToUTF8(env, jemail); |
193 AccountTrackerService* account_tracker_service = | 193 AccountTrackerService* account_tracker_service = |
194 AccountTrackerServiceFactory::GetForProfile(profile); | 194 AccountTrackerServiceFactory::GetForProfile(profile); |
195 | 195 |
| 196 AccountInfo account_info = |
| 197 account_tracker_service->FindAccountInfoByEmail(email); |
| 198 |
| 199 if (account_info.account_id.empty()) { |
| 200 LOG(ERROR) << "Attempted to get AccountInfo for account not in the " |
| 201 << "AccountTrackerService"; |
| 202 return; |
| 203 } |
| 204 |
196 AccountInfoRetriever* retriever = new AccountInfoRetriever( | 205 AccountInfoRetriever* retriever = new AccountInfoRetriever( |
197 profile, | 206 profile, |
198 account_tracker_service->FindAccountInfoByEmail(email).account_id, email, | 207 account_tracker_service->FindAccountInfoByEmail(email).account_id, email, |
199 image_side_pixels, is_pre_signin); | 208 image_side_pixels, is_pre_signin); |
200 retriever->Start(); | 209 retriever->Start(); |
201 } | 210 } |
202 | 211 |
203 // static | 212 // static |
204 bool RegisterProfileDownloader(JNIEnv* env) { | 213 bool RegisterProfileDownloader(JNIEnv* env) { |
205 return RegisterNativesImpl(env); | 214 return RegisterNativesImpl(env); |
206 } | 215 } |
OLD | NEW |