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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 base::string16 full_name = downloader->GetProfileFullName(); | 82 base::string16 full_name = downloader->GetProfileFullName(); |
83 base::string16 given_name = downloader->GetProfileGivenName(); | 83 base::string16 given_name = downloader->GetProfileGivenName(); |
84 SkBitmap bitmap = downloader->GetProfilePicture(); | 84 SkBitmap bitmap = downloader->GetProfilePicture(); |
85 ScopedJavaLocalRef<jobject> jbitmap; | 85 ScopedJavaLocalRef<jobject> jbitmap; |
86 if (!bitmap.isNull() && bitmap.bytesPerPixel() != 0) | 86 if (!bitmap.isNull() && bitmap.bytesPerPixel() != 0) |
87 jbitmap = gfx::ConvertToJavaBitmap(&bitmap); | 87 jbitmap = gfx::ConvertToJavaBitmap(&bitmap); |
88 | 88 |
89 JNIEnv* env = base::android::AttachCurrentThread(); | 89 JNIEnv* env = base::android::AttachCurrentThread(); |
90 Java_ProfileDownloader_onProfileDownloadSuccess( | 90 Java_ProfileDownloader_onProfileDownloadSuccess( |
91 env, | 91 env, base::android::ConvertUTF8ToJavaString(env, email_), |
92 base::android::ConvertUTF8ToJavaString(env, email_).obj(), | 92 base::android::ConvertUTF16ToJavaString(env, full_name), |
93 base::android::ConvertUTF16ToJavaString(env, full_name).obj(), | 93 base::android::ConvertUTF16ToJavaString(env, given_name), jbitmap); |
94 base::android::ConvertUTF16ToJavaString(env, given_name).obj(), | |
95 jbitmap.obj()); | |
96 Shutdown(); | 94 Shutdown(); |
97 } | 95 } |
98 | 96 |
99 void OnProfileDownloadFailure( | 97 void OnProfileDownloadFailure( |
100 ProfileDownloader* downloader, | 98 ProfileDownloader* downloader, |
101 ProfileDownloaderDelegate::FailureReason reason) override { | 99 ProfileDownloaderDelegate::FailureReason reason) override { |
102 LOG(ERROR) << "Failed to download the profile information: " << reason; | 100 LOG(ERROR) << "Failed to download the profile information: " << reason; |
103 Shutdown(); | 101 Shutdown(); |
104 } | 102 } |
105 | 103 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 profile, | 207 profile, |
210 account_tracker_service->FindAccountInfoByEmail(email).account_id, email, | 208 account_tracker_service->FindAccountInfoByEmail(email).account_id, email, |
211 image_side_pixels, is_pre_signin); | 209 image_side_pixels, is_pre_signin); |
212 retriever->Start(); | 210 retriever->Start(); |
213 } | 211 } |
214 | 212 |
215 // static | 213 // static |
216 bool RegisterProfileDownloader(JNIEnv* env) { | 214 bool RegisterProfileDownloader(JNIEnv* env) { |
217 return RegisterNativesImpl(env); | 215 return RegisterNativesImpl(env); |
218 } | 216 } |
OLD | NEW |