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..2f6902c4abc61631bb1889d5a0fe17625d5f497c 100644 |
--- a/components/autofill/content/browser/wallet/wallet_address.cc |
+++ b/components/autofill/content/browser/wallet/wallet_address.cc |
@@ -11,6 +11,7 @@ |
#include "components/autofill/core/browser/autofill_country.h" |
#include "components/autofill/core/browser/autofill_profile.h" |
#include "components/autofill/core/browser/autofill_type.h" |
+#include "components/autofill/core/browser/phone_number.h" |
#include "components/autofill/core/browser/state_names.h" |
namespace autofill { |
@@ -104,6 +105,7 @@ Address::Address(const AutofillProfile& profile) |
locality_name_(profile.GetRawInfo(ADDRESS_HOME_CITY)), |
postal_code_number_(profile.GetRawInfo(ADDRESS_HOME_ZIP)), |
phone_number_(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)), |
+ phone_object_(phone_number_, country_name_code_), |
is_complete_address_(true) { |
state_names::GetNameAndAbbreviation(profile.GetRawInfo(ADDRESS_HOME_STATE), |
NULL, |
@@ -128,9 +130,9 @@ Address::Address(const std::string& country_name_code, |
administrative_area_name_(administrative_area_name), |
postal_code_number_(postal_code_number), |
phone_number_(phone_number), |
+ phone_object_(phone_number_, country_name_code_), |
aruslan
2013/10/01 01:51:17
We couldn't have any issues with the field declara
Evan Stade
2013/10/01 02:00:36
I did this to match L108, and yes it's safe.
|
object_id_(object_id), |
- is_complete_address_(true) { |
-} |
+ is_complete_address_(true) {} |
Address::~Address() {} |
@@ -262,6 +264,15 @@ 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::PhoneObject(phone_number(), country_name_code()). |
+ GetNationallyFormattedNumber(); |
+} |
+ |
string16 Address::GetInfo(const AutofillType& type, |
const std::string& app_locale) const { |
if (type.html_type() == HTML_TYPE_COUNTRY_CODE) { |
@@ -299,7 +310,9 @@ string16 Address::GetInfo(const AutofillType& type, |
} |
case PHONE_HOME_WHOLE_NUMBER: |
- return phone_number(); |
+ // Wallet doesn't store user phone number formatting, so just strip all |
+ // formatting. |
+ return phone_object_.GetWholeNumber(); |
// TODO(estade): implement more. |
default: |