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

Unified Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.cc

Issue 13607006: rAc: don't clobber user input when accepting autofill popup suggestion (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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/autofill/autofill_dialog_views.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
index f86439de6e5f944b51dae4da3170ea821696c723..368594580ab9f392856c25ae4dd873b295a62553 100644
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
@@ -632,7 +632,8 @@ void AutofillDialogViews::UpdateNotificationArea() {
ContentsPreferredSizeChanged();
}
-void AutofillDialogViews::UpdateSection(DialogSection section) {
+void AutofillDialogViews::UpdateSection(DialogSection section,
+ bool clear_user_input) {
const DetailInputs& updated_inputs =
controller_->RequestedFieldsForSection(section);
DetailsGroup* group = GroupForSection(section);
@@ -641,8 +642,14 @@ void AutofillDialogViews::UpdateSection(DialogSection section) {
iter != updated_inputs.end(); ++iter) {
const DetailInput& input = *iter;
TextfieldMap::iterator text_mapping = group->textfields.find(&input);
- if (text_mapping != group->textfields.end())
+
+ // If there is already text in the input and |clear_user_input| is false,
+ // then leave the input alone.
+ if (text_mapping != group->textfields.end() &&
+ (text_mapping->second->textfield()->text().empty() ||
+ clear_user_input)) {
text_mapping->second->textfield()->SetText(iter->initial_value);
+ }
ComboboxMap::iterator combo_mapping = group->comboboxes.find(&input);
if (combo_mapping != group->comboboxes.end()) {

Powered by Google App Engine
This is Rietveld 408576698