Index: components/autofill/core/browser/phone_number.cc |
diff --git a/components/autofill/core/browser/phone_number.cc b/components/autofill/core/browser/phone_number.cc |
index 66971ae05f5892286d11496557ca233f549cc025..2ae24f46e023fa9bbec542c51b934bc75ac8983d 100644 |
--- a/components/autofill/core/browser/phone_number.cc |
+++ b/components/autofill/core/browser/phone_number.cc |
@@ -134,9 +134,14 @@ bool PhoneNumber::SetInfo(const AutofillType& type, |
if (number_.empty()) |
return true; |
- // Store a formatted (i.e., pretty printed) version of the number. |
+ // Store a formatted (i.e., pretty printed) version of the number, but only if |
+ // the number doesn't contain any other formatting. If there is formatting, |
+ // assume the user provided it and wants to keep it. |
UpdateCacheIfNeeded(app_locale); |
- number_ = cached_parsed_phone_.GetFormattedNumber(); |
+ if (base::ContainsOnlyChars(number_, |
+ base::ASCIIToUTF16("0123456789"))) { |
Ilya Sherman
2014/07/08 23:53:54
The '+' sign should also be treated as an unformat
Evan Stade
2014/07/08 23:58:31
Done.
|
+ number_ = cached_parsed_phone_.GetFormattedNumber(); |
+ } |
return !number_.empty(); |
} |