Chromium Code Reviews| 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 89a651df2e9d0c7abf027460c90248b3ea5f029a..0170fbd16bacb233dc04858c9ca22e2af1881867 100644 |
| --- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc |
| +++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc |
| @@ -24,6 +24,7 @@ |
| #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" |
| #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" |
| #include "chrome/grit/generated_resources.h" |
| +#include "components/password_manager/core/common/password_manager_features.h" |
| #include "components/strings/grit/components_strings.h" |
| #include "ui/base/l10n/l10n_util.h" |
| #include "ui/base/material_design/material_design_controller.h" |
| @@ -288,8 +289,8 @@ void ManagePasswordsBubbleView::AutoSigninView::OnTimer() { |
| // ManagePasswordsBubbleView::PendingView ------------------------------------- |
| // A view offering the user the ability to save credentials. Contains a |
| -// single ManagePasswordItemsView, along with a "Save Passwords" button |
| -// and a "Never" button. |
| +// single ManagePasswordItemsView, along with a "Save Passwords" button, |
| +// a "Never" button and an "Edit" button to edit username field. |
| class ManagePasswordsBubbleView::PendingView |
| : public views::View, |
| public views::ButtonListener, |
| @@ -309,6 +310,7 @@ class ManagePasswordsBubbleView::PendingView |
| ManagePasswordsBubbleView* parent_; |
| + views::Button* edit_button_; |
|
vasilii
2017/06/23 13:27:19
potentially uninitialized in the constructor
irmakk
2017/06/23 14:10:02
Done.
|
| views::Button* save_button_; |
| views::Button* never_button_; |
| @@ -328,6 +330,11 @@ ManagePasswordsBubbleView::PendingView::PendingView( |
| item = new ManagePasswordItemsView(parent_->model(), |
| &parent->model()->pending_password()); |
| } |
| + if (base::FeatureList::IsEnabled( |
| + password_manager::features::kEnableUsernameCorrection)) { |
| + edit_button_ = views::MdTextButton::CreateSecondaryUiButton( |
| + this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_EDIT_BUTTON)); |
| + } |
| save_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( |
| this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON)); |
| never_button_ = views::MdTextButton::CreateSecondaryUiButton( |
| @@ -349,8 +356,16 @@ ManagePasswordsBubbleView::PendingView::PendingView( |
| } |
| // Button row. |
| - BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); |
| - layout->StartRow(0, DOUBLE_BUTTON_COLUMN_SET); |
| + ColumnSetType column_set_type = |
| + base::FeatureList::IsEnabled( |
| + password_manager::features::kEnableUsernameCorrection) |
|
vasilii
2017/06/23 13:27:19
I'd rather check |edit_button_| here.
There are ca
irmakk
2017/06/23 14:10:02
Done.
|
| + ? TRIPLE_BUTTON_COLUMN_SET |
| + : DOUBLE_BUTTON_COLUMN_SET; |
| + BuildColumnSet(layout, column_set_type); |
| + layout->StartRow(0, column_set_type); |
| + if (column_set_type == TRIPLE_BUTTON_COLUMN_SET) { |
| + layout->AddView(edit_button_); |
| + } |
| layout->AddView(save_button_); |
| layout->AddView(never_button_); |
| @@ -363,7 +378,10 @@ ManagePasswordsBubbleView::PendingView::~PendingView() { |
| void ManagePasswordsBubbleView::PendingView::ButtonPressed( |
| views::Button* sender, |
| const ui::Event& event) { |
| - if (sender == save_button_) { |
| + // TODO(https://crbug.com/734965): Implement edit button logic. |
| + if (sender == edit_button_) { |
| + return; |
| + } else if (sender == save_button_) { |
| parent_->model()->OnSaveClicked(); |
| if (parent_->model()->ReplaceToShowPromotionIfNeeded()) { |
| parent_->Refresh(); |