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

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

Issue 11414243: interactive autocomplete dialog - fill in shipping name (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix sync Created 8 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/autofill_dialog_controller.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller.cc b/chrome/browser/ui/autofill/autofill_dialog_controller.cc
index 0aa8aa8132421e2ea0bfde025963b7a4e0f1bc5b..0c9b56492abb72f4a5d84779789b037adb78837d 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller.cc
@@ -35,21 +35,28 @@ bool InputTypeMatchesFieldType(const DetailInput& input,
return input.type == field.type();
}
-// Returns true if |input| should be used for a site-requested |field|. If
-// non-empty, |section_suffix| overrides the section specified by |input|.
-bool DetailInputMatchesFieldWithSection(const std::string& section_suffix,
- const DetailInput& input,
- const AutofillField& field) {
- bool right_section = section_suffix.empty() ||
- EndsWith(field.section(), section_suffix, false);
- return InputTypeMatchesFieldType(input, field) && right_section;
-}
-
// Returns true if |input| should be used for a site-requested |field|.
bool DetailInputMatchesField(const DetailInput& input,
const AutofillField& field) {
- std::string section_suffix = input.section_suffix ? input.section_suffix : "";
- return DetailInputMatchesFieldWithSection(section_suffix, input, field);
+ bool right_section = !input.section_suffix ||
+ EndsWith(field.section(), input.section_suffix, false);
+ return InputTypeMatchesFieldType(input, field) && right_section;
+}
+
+// Returns true if |input| should be used to fill a site-requested |field| which
+// is notated with a "shipping" tag, for use when the user has decided to use
+// the billing address as the shipping address.
+bool DetailInputMatchesShippingField(const DetailInput& input,
+ const AutofillField& field) {
+ if (input.section_suffix &&
+ std::string(input.section_suffix) == "billing") {
+ return InputTypeMatchesFieldType(input, field);
+ }
+
+ if (field.type() == NAME_FULL)
+ return input.type == CREDIT_CARD_NAME;
+
+ return DetailInputMatchesField(input, field);
}
// Looks through |input_template| for the types in |requested_data|. Appends
@@ -316,7 +323,10 @@ void AutofillDialogController::ViewClosed(DialogAction action) {
if (view_->UseBillingForShipping()) {
FillOutputForSectionWithComparator(
SECTION_BILLING,
- base::Bind(DetailInputMatchesFieldWithSection, "shipping"));
+ base::Bind(DetailInputMatchesShippingField));
+ FillOutputForSectionWithComparator(
+ SECTION_CC,
+ base::Bind(DetailInputMatchesShippingField));
} else {
FillOutputForSection(SECTION_SHIPPING);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698