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

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

Issue 296593003: Make various string_util functions take StringPieces instead of char[]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resync Created 6 years, 7 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 | « components/autofill/core/browser/credit_card.cc ('k') | components/autofill/core/browser/validation.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 57afcc9f8a90002ed936661d5926176604a6d8d6..66971ae05f5892286d11496557ca233f549cc025 100644
--- a/components/autofill/core/browser/phone_number.cc
+++ b/components/autofill/core/browser/phone_number.cc
@@ -17,12 +17,6 @@
namespace autofill {
namespace {
-const base::char16 kPhoneNumberSeparators[] = { ' ', '.', '(', ')', '-', 0 };
-
-void StripPunctuation(base::string16* number) {
- base::RemoveChars(*number, kPhoneNumberSeparators, number);
-}
-
// Returns the region code for this phone number, which is an ISO 3166 2-letter
// country code. The returned value is based on the |profile|; if the |profile|
// does not have a country code associated with it, falls back to the country
@@ -150,7 +144,7 @@ void PhoneNumber::GetMatchingTypes(const base::string16& text,
const std::string& app_locale,
ServerFieldTypeSet* matching_types) const {
base::string16 stripped_text = text;
- StripPunctuation(&stripped_text);
+ base::RemoveChars(stripped_text, base::ASCIIToUTF16(" .()-"), &stripped_text);
FormGroup::GetMatchingTypes(stripped_text, app_locale, matching_types);
// For US numbers, also compare to the three-digit prefix and the four-digit
« no previous file with comments | « components/autofill/core/browser/credit_card.cc ('k') | components/autofill/core/browser/validation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698