| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/password_manager/account_chooser_dialog_android.h" | 5 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 AccountChooserDialogAndroid::~AccountChooserDialogAndroid() {} | 121 AccountChooserDialogAndroid::~AccountChooserDialogAndroid() {} |
| 122 | 122 |
| 123 void AccountChooserDialogAndroid::ShowDialog() { | 123 void AccountChooserDialogAndroid::ShowDialog() { |
| 124 JNIEnv* env = AttachCurrentThread(); | 124 JNIEnv* env = AttachCurrentThread(); |
| 125 bool is_smartlock_branding_enabled = | 125 bool is_smartlock_branding_enabled = |
| 126 password_bubble_experiment::IsSmartLockUser( | 126 password_bubble_experiment::IsSmartLockUser( |
| 127 ProfileSyncServiceFactory::GetForProfile( | 127 ProfileSyncServiceFactory::GetForProfile( |
| 128 Profile::FromBrowserContext(web_contents_->GetBrowserContext()))); | 128 Profile::FromBrowserContext(web_contents_->GetBrowserContext()))); |
| 129 base::string16 title; | 129 base::string16 title; |
| 130 gfx::Range title_link_range = gfx::Range(); | 130 gfx::Range title_link_range = gfx::Range(); |
| 131 GetAccountChooserDialogTitleTextAndLinkRange(is_smartlock_branding_enabled, | 131 GetAccountChooserDialogTitleTextAndLinkRange( |
| 132 &title, &title_link_range); | 132 is_smartlock_branding_enabled, local_credentials_forms().size() > 1, |
| 133 &title, &title_link_range); |
| 133 gfx::NativeWindow native_window = web_contents_->GetTopLevelNativeWindow(); | 134 gfx::NativeWindow native_window = web_contents_->GetTopLevelNativeWindow(); |
| 134 size_t credential_array_size = | 135 size_t credential_array_size = |
| 135 local_credentials_forms().size() + federated_credentials_forms().size(); | 136 local_credentials_forms().size() + federated_credentials_forms().size(); |
| 136 ScopedJavaLocalRef<jobjectArray> java_credentials_array = | 137 ScopedJavaLocalRef<jobjectArray> java_credentials_array = |
| 137 CreateNativeCredentialArray(env, credential_array_size); | 138 CreateNativeCredentialArray(env, credential_array_size); |
| 138 AddElementsToJavaCredentialArray( | 139 AddElementsToJavaCredentialArray( |
| 139 env, java_credentials_array, local_credentials_forms(), | 140 env, java_credentials_array, local_credentials_forms(), |
| 140 password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD); | 141 password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD); |
| 141 AddElementsToJavaCredentialArray( | 142 AddElementsToJavaCredentialArray( |
| 142 env, java_credentials_array, federated_credentials_forms(), | 143 env, java_credentials_array, federated_credentials_forms(), |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 ? local_credentials_forms() | 216 ? local_credentials_forms() |
| 216 : federated_credentials_forms(); | 217 : federated_credentials_forms(); |
| 217 if (index < credentials_forms.size()) { | 218 if (index < credentials_forms.size()) { |
| 218 passwords_data_.ChooseCredential(credentials_forms[index]); | 219 passwords_data_.ChooseCredential(credentials_forms[index]); |
| 219 } | 220 } |
| 220 } | 221 } |
| 221 | 222 |
| 222 bool RegisterAccountChooserDialogAndroid(JNIEnv* env) { | 223 bool RegisterAccountChooserDialogAndroid(JNIEnv* env) { |
| 223 return RegisterNativesImpl(env); | 224 return RegisterNativesImpl(env); |
| 224 } | 225 } |
| OLD | NEW |