| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 const std::vector<const autofill::PasswordForm*>& | 199 const std::vector<const autofill::PasswordForm*>& |
| 200 AccountChooserDialogAndroid::federated_credentials_forms() const { | 200 AccountChooserDialogAndroid::federated_credentials_forms() const { |
| 201 return passwords_data_.federated_credentials_forms(); | 201 return passwords_data_.federated_credentials_forms(); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void AccountChooserDialogAndroid::ChooseCredential( | 204 void AccountChooserDialogAndroid::ChooseCredential( |
| 205 size_t index, | 205 size_t index, |
| 206 password_manager::CredentialType type) { | 206 password_manager::CredentialType type) { |
| 207 using namespace password_manager; | 207 using namespace password_manager; |
| 208 if (type == CredentialType::CREDENTIAL_TYPE_EMPTY) { | 208 if (type == CredentialType::CREDENTIAL_TYPE_EMPTY) { |
| 209 passwords_data_.ChooseCredential(autofill::PasswordForm(), type); | 209 passwords_data_.ChooseCredential(nullptr); |
| 210 return; | 210 return; |
| 211 } | 211 } |
| 212 DCHECK(type == CredentialType::CREDENTIAL_TYPE_PASSWORD || | 212 DCHECK_EQ(CredentialType::CREDENTIAL_TYPE_PASSWORD, type); |
| 213 type == CredentialType::CREDENTIAL_TYPE_FEDERATED); | |
| 214 const auto& credentials_forms = | 213 const auto& credentials_forms = |
| 215 (type == CredentialType::CREDENTIAL_TYPE_PASSWORD) | 214 (type == CredentialType::CREDENTIAL_TYPE_PASSWORD) |
| 216 ? local_credentials_forms() | 215 ? local_credentials_forms() |
| 217 : federated_credentials_forms(); | 216 : federated_credentials_forms(); |
| 218 if (index < credentials_forms.size()) { | 217 if (index < credentials_forms.size()) { |
| 219 passwords_data_.ChooseCredential(*credentials_forms[index], type); | 218 passwords_data_.ChooseCredential(credentials_forms[index]); |
| 220 } | 219 } |
| 221 } | 220 } |
| 222 | 221 |
| 223 bool RegisterAccountChooserDialogAndroid(JNIEnv* env) { | 222 bool RegisterAccountChooserDialogAndroid(JNIEnv* env) { |
| 224 return RegisterNativesImpl(env); | 223 return RegisterNativesImpl(env); |
| 225 } | 224 } |
| OLD | NEW |