Chromium Code Reviews| Index: chrome/browser/ui/views/passwords/manage_password_items_view.cc |
| diff --git a/chrome/browser/ui/views/passwords/manage_password_items_view.cc b/chrome/browser/ui/views/passwords/manage_password_items_view.cc |
| index b7e3817756faa38862857cacb443b34ca916d694..726cf29eeb466e8d04e379b2144cc722213829cb 100644 |
| --- a/chrome/browser/ui/views/passwords/manage_password_items_view.cc |
| +++ b/chrome/browser/ui/views/passwords/manage_password_items_view.cc |
| @@ -155,6 +155,7 @@ class ManagePasswordItemsView::PasswordFormRow : public views::ButtonListener, |
| const autofill::PasswordForm* password_form_; |
| // The UI elements pointers are weak and owned by their parent. |
| views::Link* undo_link_; |
| + views::Link* update_link_; |
| views::ImageButton* delete_button_; |
| const int fixed_height_; |
| bool deleted_; |
| @@ -200,7 +201,8 @@ void ManagePasswordItemsView::PasswordFormRow::AddCredentialsRow( |
| views::GridLayout* layout) { |
| ResetControls(); |
| int column_set_id = |
| - host_->model_->state() == password_manager::ui::PENDING_PASSWORD_STATE |
| + host_->model_->state() == password_manager::ui::PENDING_PASSWORD_STATE && |
| + !host_->model_->account_for_update_selection() |
|
vabr (Chromium)
2015/06/19 18:03:16
nit: Is this how clang-format indented the line? L
dvadym
2015/07/23 09:45:43
This change was removed.
|
| ? TWO_COLUMN_SET |
| : THREE_COLUMN_SET; |
| BuildColumnSetIfNeeded(layout, column_set_id); |
| @@ -213,10 +215,21 @@ void ManagePasswordItemsView::PasswordFormRow::AddCredentialsRow( |
| views::GridLayout::FILL, views::GridLayout::FILL, |
| 0, fixed_height_); |
| if (column_set_id == THREE_COLUMN_SET) { |
| - delete_button_ = GenerateDeleteButton(this).release(); |
| - layout->AddView(delete_button_, 1, 1, |
| - views::GridLayout::TRAILING, views::GridLayout::FILL, |
| - 0, fixed_height_); |
| + if (host_->model_->account_for_update_selection()) { |
| + update_link_ = new views::Link( |
| + l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_UPDATE_LINK)); |
| + update_link_->SetHorizontalAlignment(gfx::ALIGN_RIGHT); |
| + update_link_->set_listener(this); |
| + update_link_->SetUnderline(false); |
| + update_link_->SetFontList( |
| + ui::ResourceBundle::GetSharedInstance().GetFontList( |
| + ui::ResourceBundle::SmallFont)); |
| + layout->AddView(update_link_); |
| + } else { |
| + delete_button_ = GenerateDeleteButton(this).release(); |
| + layout->AddView(delete_button_, 1, 1, views::GridLayout::TRAILING, |
| + views::GridLayout::FILL, 0, fixed_height_); |
| + } |
| } |
| } |
| @@ -246,9 +259,13 @@ void ManagePasswordItemsView::PasswordFormRow::ButtonPressed( |
| void ManagePasswordItemsView::PasswordFormRow::LinkClicked(views::Link* sender, |
| int event_flags) { |
| - DCHECK_EQ(undo_link_, sender); |
| - deleted_ = false; |
| - host_->NotifyPasswordFormStatusChanged(*password_form_, deleted_); |
| + DCHECK(sender == undo_link_ || sender == update_link_); |
| + if (sender == undo_link_) { |
| + deleted_ = false; |
| + host_->NotifyPasswordFormStatusChanged(*password_form_, deleted_); |
| + } else { |
| + host_->NotifyAccountForUpdateWasSelected(*password_form_); |
| + } |
| } |
| void ManagePasswordItemsView::PasswordFormRow::ResetControls() { |
| @@ -291,6 +308,11 @@ void ManagePasswordItemsView::NotifyPasswordFormStatusChanged( |
| : ManagePasswordsBubbleModel::ADD_PASSWORD); |
| } |
| +void ManagePasswordItemsView::NotifyAccountForUpdateWasSelected( |
| + const autofill::PasswordForm& password_form) { |
| + model_->OnUpdateClicked(password_form); |
| +} |
| + |
| void ManagePasswordItemsView::Refresh() { |
| DCHECK_NE(password_manager::ui::PENDING_PASSWORD_STATE, model_->state()); |
| RemoveAllChildViews(true); |