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

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

Issue 2954093002: Adding an edit button for username correction while saving new credentials for password management. (Closed)
Patch Set: Initialized edit_button_ in the constructor Created 3 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 89a651df2e9d0c7abf027460c90248b3ea5f029a..4ca43f605e12be56a1cb4c48c16dfc5cd6f3ab91 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_;
views::Button* save_button_;
views::Button* never_button_;
@@ -317,7 +319,7 @@ class ManagePasswordsBubbleView::PendingView
ManagePasswordsBubbleView::PendingView::PendingView(
ManagePasswordsBubbleView* parent)
- : parent_(parent) {
+ : parent_(parent), edit_button_(nullptr) {
views::GridLayout* layout = new views::GridLayout(this);
layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0));
SetLayoutManager(layout);
@@ -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,13 @@ ManagePasswordsBubbleView::PendingView::PendingView(
}
// Button row.
- BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET);
- layout->StartRow(0, DOUBLE_BUTTON_COLUMN_SET);
+ ColumnSetType column_set_type =
+ edit_button_ ? 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 +375,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();
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | components/password_manager/core/common/password_manager_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698