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

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

Issue 228593002: Password bubble: Keep the bubble in sync with the password store. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 bf0d1849f1c25b9a746cb28bfaa9dc838b7d394a..0066c96cae19bb93295643957308791312ae8171 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -320,7 +320,6 @@ void ManagePasswordsBubbleView::Init() {
// TODO(mkwst): Do we really want the "No passwords" case? It would probably
// be better to only clear the pending password upon navigation, rather than
// as soon as the bubble closes.
- int num_items_displayed = 0;
if (!manage_passwords_bubble_model_->best_matches().empty()) {
for (autofill::PasswordFormMap::const_iterator i(
manage_passwords_bubble_model_->best_matches().begin());
@@ -330,14 +329,14 @@ void ManagePasswordsBubbleView::Init() {
*i->second,
first_field_width,
second_field_width,
- num_items_displayed == 0 ? ManagePasswordItemView::FIRST_ITEM
- : ManagePasswordItemView::SUBSEQUENT_ITEM);
+ i == manage_passwords_bubble_model_->best_matches().begin()
+ ? ManagePasswordItemView::FIRST_ITEM
+ : ManagePasswordItemView::SUBSEQUENT_ITEM);
layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
layout->AddView(item);
- num_items_displayed++;
}
- } else if (!manage_passwords_bubble_model_->password_submitted()) {
+ } else {
views::Label* empty_label = new views::Label(
l10n_util::GetStringUTF16(IDS_MANAGE_PASSWORDS_NO_PASSWORDS));
empty_label->SetMultiLine(true);
@@ -346,22 +345,6 @@ void ManagePasswordsBubbleView::Init() {
layout->AddView(empty_label);
}
- // If the user just saved a password, it won't be in the 'best matches' list
- // we just walked through. Display it explicitly.
- if (manage_passwords_bubble_model_->password_submitted()) {
- ManagePasswordItemView* item = new ManagePasswordItemView(
- manage_passwords_bubble_model_,
- manage_passwords_bubble_model_->pending_credentials(),
- first_field_width,
- second_field_width,
- num_items_displayed ? ManagePasswordItemView::FIRST_ITEM
- : ManagePasswordItemView::SUBSEQUENT_ITEM);
-
- layout->StartRow(0, SINGLE_VIEW_COLUMN_SET);
- layout->AddView(item);
- num_items_displayed++;
- }
-
// Build a "manage" link and "done" button, and throw them both into a new
// row
// containing a double-view columnset.

Powered by Google App Engine
This is Rietveld 408576698