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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "base/android/jni_weak_ref.h" | 10 #include "base/android/jni_weak_ref.h" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/browser/sync/profile_sync_service_factory.h" | 14 #include "chrome/browser/sync/profile_sync_service_factory.h" |
15 #include "chrome/grit/generated_resources.h" | 15 #include "chrome/grit/generated_resources.h" |
16 #include "components/autofill/core/common/password_form.h" | 16 #include "components/autofill/core/common/password_form.h" |
17 #include "components/browser_sync/profile_sync_service.h" | 17 #include "components/browser_sync/profile_sync_service.h" |
| 18 #include "components/password_manager/core/browser/affiliation_utils.h" |
| 19 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
18 #include "components/password_manager/core/browser/password_manager_constants.h" | 20 #include "components/password_manager/core/browser/password_manager_constants.h" |
19 #include "components/password_manager/core/browser/password_ui_utils.h" | 21 #include "components/password_manager/core/browser/password_ui_utils.h" |
| 22 #include "components/password_manager/core/common/experiments.h" |
20 #include "jni/PasswordUIView_jni.h" | 23 #include "jni/PasswordUIView_jni.h" |
21 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
22 | 25 |
23 using base::android::ConvertUTF16ToJavaString; | 26 using base::android::ConvertUTF16ToJavaString; |
24 using base::android::ConvertUTF8ToJavaString; | 27 using base::android::ConvertUTF8ToJavaString; |
25 using base::android::JavaParamRef; | 28 using base::android::JavaParamRef; |
26 using base::android::ScopedJavaLocalRef; | 29 using base::android::ScopedJavaLocalRef; |
27 | 30 |
28 namespace { | 31 namespace { |
29 | 32 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 password_manager_presenter_.RemovePasswordException(index); | 142 password_manager_presenter_.RemovePasswordException(index); |
140 } | 143 } |
141 | 144 |
142 ScopedJavaLocalRef<jstring> GetAccountDashboardURL( | 145 ScopedJavaLocalRef<jstring> GetAccountDashboardURL( |
143 JNIEnv* env, | 146 JNIEnv* env, |
144 const JavaParamRef<jclass>&) { | 147 const JavaParamRef<jclass>&) { |
145 return ConvertUTF8ToJavaString( | 148 return ConvertUTF8ToJavaString( |
146 env, password_manager::kPasswordManagerAccountDashboardURL); | 149 env, password_manager::kPasswordManagerAccountDashboardURL); |
147 } | 150 } |
148 | 151 |
| 152 static jboolean ShouldUseSmartLockBranding(JNIEnv* env, |
| 153 const JavaParamRef<jclass>&) { |
| 154 const browser_sync::ProfileSyncService* sync_service = |
| 155 ProfileSyncServiceFactory::GetForProfile( |
| 156 ProfileManager::GetLastUsedProfile()); |
| 157 return password_bubble_experiment::IsSmartLockBrandingEnabled(sync_service); |
| 158 } |
| 159 |
149 // static | 160 // static |
150 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 161 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
151 PasswordUIViewAndroid* controller = new PasswordUIViewAndroid(env, obj); | 162 PasswordUIViewAndroid* controller = new PasswordUIViewAndroid(env, obj); |
152 return reinterpret_cast<intptr_t>(controller); | 163 return reinterpret_cast<intptr_t>(controller); |
153 } | 164 } |
154 | 165 |
155 bool PasswordUIViewAndroid::RegisterPasswordUIViewAndroid(JNIEnv* env) { | 166 bool PasswordUIViewAndroid::RegisterPasswordUIViewAndroid(JNIEnv* env) { |
156 return RegisterNativesImpl(env); | 167 return RegisterNativesImpl(env); |
157 } | 168 } |
OLD | NEW |