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

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

Issue 2952503002: [Payment Request] Updates name, phone number, and email labels (Closed)
Patch Set: 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
« 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: 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 cce44f4c7cf54036a3e2f5e9eeffaad137ced83e..de40f85089796003ef33eb9e77693ffc7ce68eff 100644
--- a/ios/chrome/browser/payments/payment_request_util.mm
+++ b/ios/chrome/browser/payments/payment_request_util.mm
@@ -11,6 +11,7 @@
#include "components/autofill/core/browser/autofill_profile.h"
#include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/browser/personal_data_manager.h"
+#include "components/payments/core/payment_request_data_util.h"
#include "components/payments/core/strings_util.h"
#include "components/strings/grit/components_strings.h"
#include "ios/chrome/browser/application_context.h"
@@ -26,9 +27,10 @@ namespace payment_request_util {
NSString* GetNameLabelFromAutofillProfile(
const autofill::AutofillProfile& profile) {
- return base::SysUTF16ToNSString(
+ base::string16 label =
profile.GetInfo(autofill::AutofillType(autofill::NAME_FULL),
- GetApplicationContext()->GetApplicationLocale()));
+ GetApplicationContext()->GetApplicationLocale());
+ return !label.empty() ? base::SysUTF16ToNSString(label) : nil;
}
NSString* GetShippingAddressLabelFromAutofillProfile(
@@ -47,13 +49,16 @@ NSString* GetBillingAddressLabelFromAutofillProfile(
NSString* GetPhoneNumberLabelFromAutofillProfile(
const autofill::AutofillProfile& profile) {
- base::string16 label = profile.GetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER);
+ base::string16 label = payments::data_util::GetFormattedPhoneNumberForDisplay(
+ profile, GetApplicationContext()->GetApplicationLocale());
return !label.empty() ? base::SysUTF16ToNSString(label) : nil;
}
NSString* GetEmailLabelFromAutofillProfile(
const autofill::AutofillProfile& profile) {
- base::string16 label = profile.GetRawInfo(autofill::EMAIL_ADDRESS);
+ base::string16 label =
+ profile.GetInfo(autofill::AutofillType(autofill::EMAIL_ADDRESS),
+ GetApplicationContext()->GetApplicationLocale());
return !label.empty() ? base::SysUTF16ToNSString(label) : nil;
}
« 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