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

Unified Diff: components/autofill/content/browser/wallet/wallet_address.cc

Issue 24538008: rAc: phone number cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixme Created 7 years, 3 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: components/autofill/content/browser/wallet/wallet_address.cc
diff --git a/components/autofill/content/browser/wallet/wallet_address.cc b/components/autofill/content/browser/wallet/wallet_address.cc
index 8ab59982f2bfcc88a162b1a307713e96922c9722..7b950650894849029c754aedf3476b10b70fd2a4 100644
--- a/components/autofill/content/browser/wallet/wallet_address.cc
+++ b/components/autofill/content/browser/wallet/wallet_address.cc
@@ -127,9 +127,12 @@ Address::Address(const std::string& country_name_code,
locality_name_(locality_name),
administrative_area_name_(administrative_area_name),
postal_code_number_(postal_code_number),
- phone_number_(phone_number),
object_id_(object_id),
is_complete_address_(true) {
+ // Wallet doesn't store user phone number formatting, so just strip all
+ // formatting.
+ i18n::PhoneObject phone(phone_number, country_name_code);
+ phone_number_ = phone.GetWholeNumber();
}
Address::~Address() {}
@@ -262,6 +265,14 @@ string16 Address::DisplayNameDetail() const {
#endif
}
+string16 Address::DisplayPhoneNumber() const {
+ // Return a formatted phone number. Wallet doesn't store user formatting, so
+ // impose our own. phone_number() always includes a country code, so using
+ // PhoneObject to format it would result in an internationalized format. Since
+ // Wallet only supports the US right now, stick to national formatting.
+ return i18n::FormatPhoneNumberForRegion(phone_number(), country_name_code());
+}
+
string16 Address::GetInfo(const AutofillType& type,
const std::string& app_locale) const {
if (type.html_type() == HTML_TYPE_COUNTRY_CODE) {

Powered by Google App Engine
This is Rietveld 408576698