Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1524)

Unified Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc

Issue 848723002: Credential Manager API: Showing both local and federated logins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adressed comments. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..6705bd903c0a1afabdb5d68f18ddc3867230b432 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -186,6 +186,12 @@ class ManagePasswordsBubbleView::AccountChooserView
// views::ButtonListener:
void ButtonPressed(views::Button* sender, const ui::Event& event) override;
+ // Adds |password_forms| to the |layout| remembering their |type|.
+ void AddCredentialItemsWithState(
vasilii 2015/01/21 17:47:35 What is the meaning of State here? With type proba
melandory 2015/01/22 10:47:34 Done.
+ views::GridLayout* layout,
vasilii 2015/01/21 17:47:35 nit: I think you can extract it with GetLayoutMana
melandory 2015/01/22 10:47:34 Then I need to cast it to GridLayout. I do not lik
+ const ScopedVector<autofill::PasswordForm>& password_forms,
+ password_manager::CredentialType type);
+
ManagePasswordsBubbleView* parent_;
views::LabelButton* cancel_button_;
};
@@ -207,13 +213,13 @@ 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);
- }
+ AddCredentialItemsWithState(
+ layout, parent_->model()->local_pending_credentials(),
+ password_manager::CredentialType::CREDENTIAL_TYPE_LOCAL);
+
+ AddCredentialItemsWithState(
+ layout, parent_->model()->federated_pending_credentials(),
+ password_manager::CredentialType::CREDENTIAL_TYPE_FEDERATED);
// Button row.
BuildColumnSet(layout, SINGLE_BUTTON_COLUMN_SET);
@@ -230,13 +236,25 @@ ManagePasswordsBubbleView::AccountChooserView::AccountChooserView(
ManagePasswordsBubbleView::AccountChooserView::~AccountChooserView() {
}
+void ManagePasswordsBubbleView::AccountChooserView::AddCredentialItemsWithState(
+ views::GridLayout* layout,
+ 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));
+ }
+}
+
void ManagePasswordsBubbleView::AccountChooserView::ButtonPressed(
views::Button* sender, const ui::Event& event) {
if (sender != cancel_button_) {
// 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();
}

Powered by Google App Engine
This is Rietveld 408576698