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

Unified Diff: ios/chrome/browser/payments/payment_request_util.mm

Issue 2744823003: [Payment Request] Generic edit form (Closed)
Patch Set: Created 3 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: ios/chrome/browser/payments/payment_request_util.mm
diff --git a/ios/chrome/browser/payments/payment_request_util.mm b/ios/chrome/browser/payments/payment_request_util.mm
index ceb9ef7c2ac4c093005317193b8fa39a22e40d91..e7cc46dcca9116cc9f19d8deb31e4cd623075997 100644
--- a/ios/chrome/browser/payments/payment_request_util.mm
+++ b/ios/chrome/browser/payments/payment_request_util.mm
@@ -31,7 +31,7 @@ NSString* GetNameLabelFromAutofillProfile(
GetApplicationContext()->GetApplicationLocale()));
}
-NSString* GetAddressLabelFromAutofillProfile(
+NSString* GetShippingAddressLabelFromAutofillProfile(
const autofill::AutofillProfile& profile) {
// Name and country are not included in the shipping address label.
std::vector<autofill::ServerFieldType> label_fields;
@@ -50,6 +50,24 @@ NSString* GetAddressLabelFromAutofillProfile(
return !label.empty() ? base::SysUTF16ToNSString(label) : nil;
}
+NSString* GetBillingAddressLabelFromAutofillProfile(
lpromero 2017/03/13 16:54:09 This could go in its own CL maybe? Also, could you
Moe 2017/03/16 01:35:32 Done. Moved to its own CL.
+ const autofill::AutofillProfile& profile) {
+ // Name, company, and country are not included in the billing address label.
+ std::vector<autofill::ServerFieldType> label_fields;
+ label_fields.push_back(autofill::ADDRESS_HOME_LINE1);
+ label_fields.push_back(autofill::ADDRESS_HOME_LINE2);
+ label_fields.push_back(autofill::ADDRESS_HOME_DEPENDENT_LOCALITY);
+ label_fields.push_back(autofill::ADDRESS_HOME_CITY);
+ label_fields.push_back(autofill::ADDRESS_HOME_STATE);
+ label_fields.push_back(autofill::ADDRESS_HOME_ZIP);
+ label_fields.push_back(autofill::ADDRESS_HOME_SORTING_CODE);
+
+ base::string16 label = profile.ConstructInferredLabel(
+ label_fields, label_fields.size(),
+ GetApplicationContext()->GetApplicationLocale());
+ return !label.empty() ? base::SysUTF16ToNSString(label) : nil;
+}
+
NSString* GetPhoneNumberLabelFromAutofillProfile(
const autofill::AutofillProfile& profile) {
base::string16 label = profile.GetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER);

Powered by Google App Engine
This is Rietveld 408576698