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

Unified Diff: components/autofill/core/browser/phone_number.cc

Issue 374053007: Change PhoneNumber::SetInfo to only apply formatting where there is none (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | components/autofill/core/browser/phone_number_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | components/autofill/core/browser/phone_number_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698