| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/password_ui_view_android.h" | 5 #include "chrome/browser/android/password_ui_view_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_helper.h" | 7 #include "base/android/jni_helper.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "chrome/browser/profiles/profile_manager.h" | 9 #include "chrome/browser/profiles/profile_manager.h" |
| 10 #include "components/autofill/core/common/password_form.h" | 10 #include "components/autofill/core/common/password_form.h" |
| 11 #include "jni/PasswordUIView_jni.h" | 11 #include "jni/PasswordUIView_jni.h" |
| 12 | 12 |
| 13 using base::android::ConvertUTF16ToJavaString; | 13 using base::android::ConvertUTF16ToJavaString; |
| 14 using base::android::ConvertUTF8ToJavaString; | 14 using base::android::ConvertUTF8ToJavaString; |
| 15 using base::android::ScopedJavaLocalRef; | 15 using base::android::ScopedJavaLocalRef; |
| 16 | 16 |
| 17 PasswordUIViewAndroid::PasswordUIViewAndroid(JNIEnv* env, jobject obj) | 17 PasswordUIViewAndroid::PasswordUIViewAndroid(JNIEnv* env, jobject obj) |
| 18 : password_manager_presenter_(this), weak_java_ui_controller_(env, obj) {} | 18 : password_manager_presenter_(this), weak_java_ui_controller_(env, obj) {} |
| 19 | 19 |
| 20 PasswordUIViewAndroid::~PasswordUIViewAndroid() {} | 20 PasswordUIViewAndroid::~PasswordUIViewAndroid() {} |
| 21 | 21 |
| 22 void PasswordUIViewAndroid::Destroy(JNIEnv*, jobject) { delete this; } | 22 void PasswordUIViewAndroid::Destroy(JNIEnv*, jobject) { delete this; } |
| 23 | 23 |
| 24 Profile* PasswordUIViewAndroid::GetProfile() { | 24 Profile* PasswordUIViewAndroid::GetProfile() { |
| 25 return ProfileManager::GetLastUsedProfile(); | 25 return ProfileManager::GetLastUsedProfile(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 void PasswordUIViewAndroid::ShowPassword( | 28 void PasswordUIViewAndroid::ShowPassword( |
| 29 size_t index, const string16& password_value) { | 29 size_t index, const base::string16& password_value) { |
| 30 NOTIMPLEMENTED(); | 30 NOTIMPLEMENTED(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void PasswordUIViewAndroid::SetPasswordList( | 33 void PasswordUIViewAndroid::SetPasswordList( |
| 34 const ScopedVector<autofill::PasswordForm>& password_list, | 34 const ScopedVector<autofill::PasswordForm>& password_list, |
| 35 bool show_passwords) { | 35 bool show_passwords) { |
| 36 // Android just ignores the |show_passwords| argument. | 36 // Android just ignores the |show_passwords| argument. |
| 37 JNIEnv* env = base::android::AttachCurrentThread(); | 37 JNIEnv* env = base::android::AttachCurrentThread(); |
| 38 ScopedJavaLocalRef<jobject> ui_controller = weak_java_ui_controller_.get(env); | 38 ScopedJavaLocalRef<jobject> ui_controller = weak_java_ui_controller_.get(env); |
| 39 if (!ui_controller.is_null()) { | 39 if (!ui_controller.is_null()) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 // static | 88 // static |
| 89 static jlong Init(JNIEnv* env, jobject obj) { | 89 static jlong Init(JNIEnv* env, jobject obj) { |
| 90 PasswordUIViewAndroid* controller = new PasswordUIViewAndroid(env, obj); | 90 PasswordUIViewAndroid* controller = new PasswordUIViewAndroid(env, obj); |
| 91 return reinterpret_cast<intptr_t>(controller); | 91 return reinterpret_cast<intptr_t>(controller); |
| 92 } | 92 } |
| 93 | 93 |
| 94 bool PasswordUIViewAndroid::RegisterPasswordUIViewAndroid(JNIEnv* env) { | 94 bool PasswordUIViewAndroid::RegisterPasswordUIViewAndroid(JNIEnv* env) { |
| 95 return RegisterNativesImpl(env); | 95 return RegisterNativesImpl(env); |
| 96 } | 96 } |
| OLD | NEW |