Index: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc |
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc |
index 8da3ab47bd39194b7c2c3eb122ae500284dc6021..87695132af029741d39e75357dc7e0923994b53a 100644 |
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc |
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc |
@@ -207,13 +207,23 @@ ManagePasswordsBubbleView::AccountChooserView::AccountChooserView( |
BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
AddTitleRow(layout, parent_->model()); |
- const auto& pending_credentials = parent_->model()->pending_credentials(); |
- for (autofill::PasswordForm* form : pending_credentials) { |
- CredentialsItemView* credential_view = new CredentialsItemView(this, *form); |
- // Add the title to the layout with appropriate padding. |
- layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
- layout->AddView(credential_view); |
- } |
+ auto add_credential_items_with_state = [&layout, this]( |
vasilii
2015/01/16 14:07:26
Why don't you write a private method given that yo
melandory
2015/01/19 15:40:15
I thought since this routine is used only by one m
|
+ const ScopedVector<autofill::PasswordForm>& password_forms, |
+ password_manager::CredentialType type) { |
+ for (autofill::PasswordForm* form : password_forms) { |
+ // Add the title to the layout with appropriate padding. |
+ layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
+ layout->AddView(new CredentialsItemView(this, *form, type)); |
+ } |
+ }; |
+ |
+ add_credential_items_with_state( |
+ parent_->model()->local_pending_credentials(), |
+ password_manager::CredentialType::CREDENTIAL_TYPE_LOCAL); |
+ |
+ add_credential_items_with_state( |
+ parent_->model()->federated_pending_credentials(), |
+ password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED); |
// Button row. |
BuildColumnSet(layout, SINGLE_BUTTON_COLUMN_SET); |
@@ -236,7 +246,8 @@ void ManagePasswordsBubbleView::AccountChooserView::ButtonPressed( |
// ManagePasswordsBubbleModel should care about calling a callback in case |
// the bubble is dismissed by any other means. |
CredentialsItemView* view = static_cast<CredentialsItemView*>(sender); |
- parent_->model()->OnChooseCredentials(view->form()); |
+ parent_->model()->OnChooseCredentials(view->form(), |
+ view->credential_type()); |
} else { |
parent_->model()->OnNopeClicked(); |
} |