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_infobar_delegate_andro
id.h" | 5 #include "chrome/browser/password_manager/account_chooser_infobar_delegate_andro
id.h" |
6 | 6 |
7 #include "chrome/browser/infobars/infobar_service.h" | 7 #include "chrome/browser/infobars/infobar_service.h" |
8 #include "chrome/browser/ui/android/infobars/account_chooser_infobar.h" | 8 #include "chrome/browser/ui/android/infobars/account_chooser_infobar.h" |
9 #include "components/autofill/core/common/password_form.h" | 9 #include "components/autofill/core/common/password_form.h" |
10 #include "components/password_manager/content/common/credential_manager_types.h" | 10 #include "components/password_manager/content/common/credential_manager_types.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 void AccountChooserInfoBarDelegateAndroid::ChooseCredential( | 29 void AccountChooserInfoBarDelegateAndroid::ChooseCredential( |
30 size_t credential_index, | 30 size_t credential_index, |
31 password_manager::CredentialType credential_type) { | 31 password_manager::CredentialType credential_type) { |
32 using namespace password_manager; | 32 using namespace password_manager; |
33 if (credential_type == CredentialType::CREDENTIAL_TYPE_EMPTY) { | 33 if (credential_type == CredentialType::CREDENTIAL_TYPE_EMPTY) { |
34 ui_controller_->ChooseCredential(autofill::PasswordForm(), credential_type); | 34 ui_controller_->ChooseCredential(autofill::PasswordForm(), credential_type); |
35 return; | 35 return; |
36 } | 36 } |
37 DCHECK(credential_type == CredentialType::CREDENTIAL_TYPE_LOCAL || | 37 DCHECK(credential_type == CredentialType::CREDENTIAL_TYPE_LOCAL || |
38 credential_type == CredentialType::CREDENTIAL_TYPE_FEDERATED); | 38 credential_type == CredentialType::CREDENTIAL_TYPE_FEDERATED); |
39 auto& credentials_forms = | 39 const auto& credentials_forms = |
40 (credential_type == CredentialType::CREDENTIAL_TYPE_LOCAL) | 40 (credential_type == CredentialType::CREDENTIAL_TYPE_LOCAL) |
41 ? ui_controller_->local_credentials_forms() | 41 ? ui_controller_->GetCurrentForms() |
42 : ui_controller_->federated_credentials_forms(); | 42 : ui_controller_->GetFederatedForms(); |
43 if (credential_index < credentials_forms.size()) { | 43 if (credential_index < credentials_forms.size()) { |
44 ui_controller_->ChooseCredential(*credentials_forms[credential_index], | 44 ui_controller_->ChooseCredential(*credentials_forms[credential_index], |
45 credential_type); | 45 credential_type); |
46 } | 46 } |
47 } | 47 } |
48 | 48 |
49 void AccountChooserInfoBarDelegateAndroid::InfoBarDismissed() { | 49 void AccountChooserInfoBarDelegateAndroid::InfoBarDismissed() { |
50 ChooseCredential(-1, password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY); | 50 ChooseCredential(-1, password_manager::CredentialType::CREDENTIAL_TYPE_EMPTY); |
51 } | 51 } |
52 | 52 |
53 infobars::InfoBarDelegate::Type | 53 infobars::InfoBarDelegate::Type |
54 AccountChooserInfoBarDelegateAndroid::GetInfoBarType() const { | 54 AccountChooserInfoBarDelegateAndroid::GetInfoBarType() const { |
55 return PAGE_ACTION_TYPE; | 55 return PAGE_ACTION_TYPE; |
56 } | 56 } |
OLD | NEW |