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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 365463002: rAc: When filling partial autofill data, don't fill across dialog sections. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed comment Created 6 years, 5 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/autofill/autofill_dialog_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index b60a75f4844636d63d43591ab43b004140111dcf..756451133b1539e2a0872a20073ef7ff96d5c565 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -2151,6 +2151,7 @@ void AutofillDialogControllerImpl::UserEditedOrActivatedInput(
// |popup_input_type_| must be set before calling |Show()|.
popup_input_type_ = type;
+ popup_section_ = section;
// TODO(estade): do we need separators and control rows like 'Clear
// Form'?
@@ -2422,7 +2423,8 @@ void AutofillDialogControllerImpl::DidAcceptSuggestion(
base::string16 billing_country =
wrapper->GetInfo(AutofillType(ADDRESS_BILLING_COUNTRY));
- if (!snapshot.count(ADDRESS_BILLING_COUNTRY) &&
+ if (popup_section_ == ActiveBillingSection() &&
+ !snapshot.count(ADDRESS_BILLING_COUNTRY) &&
!billing_country.empty()) {
billing_rebuilt = RebuildInputsForCountry(
ActiveBillingSection(), billing_country, false);
@@ -2430,7 +2432,8 @@ void AutofillDialogControllerImpl::DidAcceptSuggestion(
base::string16 shipping_country =
wrapper->GetInfo(AutofillType(ADDRESS_HOME_COUNTRY));
- if (!snapshot.count(ADDRESS_HOME_COUNTRY) &&
+ if (popup_section_ == SECTION_SHIPPING &&
+ !snapshot.count(ADDRESS_HOME_COUNTRY) &&
!shipping_country.empty()) {
shipping_rebuilt = RebuildInputsForCountry(
SECTION_SHIPPING, shipping_country, false);
@@ -2444,14 +2447,9 @@ void AutofillDialogControllerImpl::DidAcceptSuggestion(
UpdateSection(SECTION_SHIPPING);
}
- for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) {
- DialogSection section = static_cast<DialogSection>(i);
- if (!SectionIsActive(section))
- continue;
-
- wrapper->FillInputs(MutableRequestedFieldsForSection(section));
- view_->FillSection(section, popup_input_type);
- }
+ DCHECK(SectionIsActive(popup_section_));
+ wrapper->FillInputs(MutableRequestedFieldsForSection(popup_section_));
+ view_->FillSection(popup_section_, popup_input_type);
GetMetricLogger().LogDialogPopupEvent(
AutofillMetrics::DIALOG_POPUP_FORM_FILLED);
@@ -2808,6 +2806,7 @@ AutofillDialogControllerImpl::AutofillDialogControllerImpl(
suggested_shipping_(this),
cares_about_shipping_(true),
popup_input_type_(UNKNOWN_TYPE),
+ popup_section_(SECTION_MIN),
waiting_for_explicit_sign_in_response_(false),
has_accepted_legal_documents_(false),
is_submitting_(false),
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller_impl.h ('k') | chrome/browser/ui/autofill/autofill_dialog_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698