| 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_string.h" | 7 #include "base/android/jni_string.h" |
| 8 #include "base/android/jni_weak_ref.h" | 8 #include "base/android/jni_weak_ref.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
| 12 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/sync/profile_sync_service.h" | 14 #include "chrome/browser/sync/profile_sync_service.h" |
| 14 #include "chrome/browser/sync/profile_sync_service_factory.h" | 15 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 16 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
| 17 #include "components/autofill/core/common/password_form.h" | 18 #include "components/autofill/core/common/password_form.h" |
| 18 #include "components/password_manager/core/browser/affiliation_utils.h" | 19 #include "components/password_manager/core/browser/affiliation_utils.h" |
| 19 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 20 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
| 20 #include "components/password_manager/core/common/experiments.h" | 21 #include "components/password_manager/core/common/experiments.h" |
| 21 #include "components/password_manager/core/common/password_manager_switches.h" | 22 #include "components/password_manager/core/common/password_manager_switches.h" |
| 22 #include "jni/PasswordUIView_jni.h" | 23 #include "jni/PasswordUIView_jni.h" |
| 23 | 24 |
| 24 using base::android::ConvertUTF16ToJavaString; | 25 using base::android::ConvertUTF16ToJavaString; |
| 25 using base::android::ConvertUTF8ToJavaString; | 26 using base::android::ConvertUTF8ToJavaString; |
| 26 using base::android::ScopedJavaLocalRef; | 27 using base::android::ScopedJavaLocalRef; |
| 27 | 28 |
| 28 PasswordUIViewAndroid::PasswordUIViewAndroid(JNIEnv* env, jobject obj) | 29 PasswordUIViewAndroid::PasswordUIViewAndroid(JNIEnv* env, jobject obj) |
| 29 : password_manager_presenter_(this), weak_java_ui_controller_(env, obj) {} | 30 : password_manager_presenter_(this), weak_java_ui_controller_(env, obj) {} |
| 30 | 31 |
| 31 PasswordUIViewAndroid::~PasswordUIViewAndroid() {} | 32 PasswordUIViewAndroid::~PasswordUIViewAndroid() {} |
| 32 | 33 |
| 33 void PasswordUIViewAndroid::Destroy(JNIEnv*, jobject) { delete this; } | 34 void PasswordUIViewAndroid::Destroy(JNIEnv*, jobject) { delete this; } |
| 34 | 35 |
| 35 Profile* PasswordUIViewAndroid::GetProfile() { | 36 Profile* PasswordUIViewAndroid::GetProfile() { |
| 36 return ProfileManager::GetLastUsedProfile(); | 37 return g_browser_process->profile_manager()->GetLastUsedProfile(); |
| 37 } | 38 } |
| 38 | 39 |
| 39 void PasswordUIViewAndroid::ShowPassword( | 40 void PasswordUIViewAndroid::ShowPassword( |
| 40 size_t index, const base::string16& password_value) { | 41 size_t index, const base::string16& password_value) { |
| 41 NOTIMPLEMENTED(); | 42 NOTIMPLEMENTED(); |
| 42 } | 43 } |
| 43 | 44 |
| 44 void PasswordUIViewAndroid::SetPasswordList( | 45 void PasswordUIViewAndroid::SetPasswordList( |
| 45 const ScopedVector<autofill::PasswordForm>& password_list, | 46 const ScopedVector<autofill::PasswordForm>& password_list, |
| 46 bool show_passwords) { | 47 bool show_passwords) { |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 115 |
| 115 static jboolean ShouldDisplayManageAccountLink( | 116 static jboolean ShouldDisplayManageAccountLink( |
| 116 JNIEnv* env, jclass) { | 117 JNIEnv* env, jclass) { |
| 117 return password_manager::ManageAccountLinkExperimentEnabled(); | 118 return password_manager::ManageAccountLinkExperimentEnabled(); |
| 118 } | 119 } |
| 119 | 120 |
| 120 static jboolean ShouldUseSmartLockBranding( | 121 static jboolean ShouldUseSmartLockBranding( |
| 121 JNIEnv* env, jclass) { | 122 JNIEnv* env, jclass) { |
| 122 const ProfileSyncService* sync_service = | 123 const ProfileSyncService* sync_service = |
| 123 ProfileSyncServiceFactory::GetForProfile( | 124 ProfileSyncServiceFactory::GetForProfile( |
| 124 ProfileManager::GetLastUsedProfile()); | 125 g_browser_process->profile_manager()->GetLastUsedProfile()); |
| 125 return password_bubble_experiment::IsSmartLockBrandingEnabled(sync_service); | 126 return password_bubble_experiment::IsSmartLockBrandingEnabled(sync_service); |
| 126 } | 127 } |
| 127 | 128 |
| 128 // static | 129 // static |
| 129 static jlong Init(JNIEnv* env, jobject obj) { | 130 static jlong Init(JNIEnv* env, jobject obj) { |
| 130 PasswordUIViewAndroid* controller = new PasswordUIViewAndroid(env, obj); | 131 PasswordUIViewAndroid* controller = new PasswordUIViewAndroid(env, obj); |
| 131 return reinterpret_cast<intptr_t>(controller); | 132 return reinterpret_cast<intptr_t>(controller); |
| 132 } | 133 } |
| 133 | 134 |
| 134 bool PasswordUIViewAndroid::RegisterPasswordUIViewAndroid(JNIEnv* env) { | 135 bool PasswordUIViewAndroid::RegisterPasswordUIViewAndroid(JNIEnv* env) { |
| 135 return RegisterNativesImpl(env); | 136 return RegisterNativesImpl(env); |
| 136 } | 137 } |
| OLD | NEW |