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

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

Issue 1151373006: Update Confirmation UI for saved password change (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed reviewer comments Created 5 years, 6 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 78078fa4c7f58563f09f60fa269f996709be451a..068a53f90f0f012c97fc3abff20c3e35a83cfbaf 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -375,6 +375,8 @@ class ManagePasswordsBubbleView::PendingView
views::BlueButton* save_button_;
+ views::LabelButton* nope_button_;
+
// The combobox doesn't take ownership of its model. If we created a
// combobox we need to ensure that we delete the model here, and because the
// combobox uses the model in it's destructor, we need to make sure we
@@ -387,26 +389,42 @@ class ManagePasswordsBubbleView::PendingView
ManagePasswordsBubbleView::PendingView::PendingView(
ManagePasswordsBubbleView* parent)
- : parent_(parent) {
+ : parent_(parent), save_button_(nullptr), nope_button_(nullptr) {
views::GridLayout* layout = new views::GridLayout(this);
layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0));
SetLayoutManager(layout);
- std::vector<const autofill::PasswordForm*> credentials(
- 1, &parent->model()->pending_password());
+ std::vector<const autofill::PasswordForm*> credentials;
+ if (parent->model()->account_for_update_selection()) {
vabr (Chromium) 2015/06/19 18:03:16 Should you actually create a separate view rather
dvadym 2015/06/22 14:43:33 Yeah, this is a good question that constantly appe
+ for (auto local_credential : parent->model()->local_credentials())
+ credentials.push_back(local_credential);
+ } else {
+ credentials.push_back(&parent->model()->pending_password());
+ }
// Create the pending credential item, save button and refusal combobox.
ManagePasswordItemsView* item =
new ManagePasswordItemsView(parent_->model(), credentials);
- save_button_ = new views::BlueButton(
- this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON));
- save_button_->SetFontList(ui::ResourceBundle::GetSharedInstance().GetFontList(
- ui::ResourceBundle::SmallFont));
-
- combobox_model_.reset(new SavePasswordRefusalComboboxModel);
- refuse_combobox_.reset(new views::Combobox(combobox_model_.get()));
- refuse_combobox_->set_listener(this);
- refuse_combobox_->SetStyle(views::Combobox::STYLE_ACTION);
- // TODO(mkwst): Need a mechanism to pipe a font list down into a combobox.
+ if (parent->model()->is_password_change_form_without_username()) {
+ nope_button_ = new views::LabelButton(
+ this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CANCEL_BUTTON));
+ nope_button_->SetStyle(views::Button::STYLE_BUTTON);
+ nope_button_->SetFontList(
+ ui::ResourceBundle::GetSharedInstance().GetFontList(
+ ui::ResourceBundle::SmallFont));
+ } else {
+ combobox_model_.reset(new SavePasswordRefusalComboboxModel);
+ refuse_combobox_.reset(new views::Combobox(combobox_model_.get()));
+ refuse_combobox_->set_listener(this);
+ refuse_combobox_->SetStyle(views::Combobox::STYLE_ACTION);
+ // TODO(mkwst): Need a mechanism to pipe a font list down into a combobox.
+ }
+ if (!parent->model()->account_for_update_selection()) {
+ save_button_ =
+ new views::BlueButton(this, parent_->model()->save_button_text());
+ save_button_->SetFontList(
+ ui::ResourceBundle::GetSharedInstance().GetFontList(
+ ui::ResourceBundle::SmallFont));
+ }
// Title row.
views::StyledLabel* title_label =
@@ -429,11 +447,22 @@ ManagePasswordsBubbleView::PendingView::PendingView(
layout->AddView(item);
// Button row.
- BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET);
- layout->StartRowWithPadding(
- 0, DOUBLE_BUTTON_COLUMN_SET, 0, views::kRelatedControlVerticalSpacing);
- layout->AddView(save_button_);
- layout->AddView(refuse_combobox_.get());
+ ColumnSetType button_column_type =
+ parent->model()->account_for_update_selection()
+ ? SINGLE_BUTTON_COLUMN_SET
+ : DOUBLE_BUTTON_COLUMN_SET;
+ BuildColumnSet(layout, button_column_type);
+ layout->StartRowWithPadding(0, button_column_type, 0,
+ views::kRelatedControlVerticalSpacing);
+ if (parent->model()->account_for_update_selection()) {
+ layout->AddView(nope_button_);
+ } else {
+ layout->AddView(save_button_);
+ if (parent->model()->is_password_change_form_without_username())
+ layout->AddView(nope_button_);
+ else
+ layout->AddView(refuse_combobox_.get());
+ }
// Extra padding for visual awesomeness.
layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing);
@@ -447,8 +476,9 @@ ManagePasswordsBubbleView::PendingView::~PendingView() {
void ManagePasswordsBubbleView::PendingView::ButtonPressed(
views::Button* sender,
const ui::Event& event) {
- DCHECK(sender == save_button_);
- parent_->model()->OnSaveClicked();
+ DCHECK(sender == save_button_ || sender == nope_button_);
+ if (sender == save_button_)
+ parent_->model()->OnSaveClicked();
parent_->Close();
}

Powered by Google App Engine
This is Rietveld 408576698