diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-04 21:20:15 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-04 21:20:15 +0000 |
commit | 9b435be91a7f625b984dc4a49bee1f3c43cd6f87 (patch) | |
tree | 4be834f1a88aef4ba9ff356615043b97e4ee9442 /chrome/browser/autofill/phone_number.h | |
parent | e0b421291b0644eebf04660d993995e638251bf0 (diff) | |
download | chromium_src-9b435be91a7f625b984dc4a49bee1f3c43cd6f87.zip chromium_src-9b435be91a7f625b984dc4a49bee1f3c43cd6f87.tar.gz chromium_src-9b435be91a7f625b984dc4a49bee1f3c43cd6f87.tar.bz2 |
AutoFill phone number parser changes.
Moved the PersonalDataManager::ParsePhoneNumber() method into the PhoneNumber class. Made some bug fixes to the parser. Extended its functionality to strip separator characters. Added unit tests to cover the parser.
BUG=none
TEST=PhoneNumberTest
Review URL: http://codereview.chromium.org/669026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autofill/phone_number.h')
-rw-r--r-- | chrome/browser/autofill/phone_number.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/chrome/browser/autofill/phone_number.h b/chrome/browser/autofill/phone_number.h index c7cfc59..5e8affe 100644 --- a/chrome/browser/autofill/phone_number.h +++ b/chrome/browser/autofill/phone_number.h @@ -26,6 +26,15 @@ class PhoneNumber : public FormGroup { virtual string16 GetFieldText(const AutoFillType& type) const; virtual void SetInfo(const AutoFillType& type, const string16& value); + // Parses |value| to extract the components of a phone number. |number| + // returns the trailing 7 digits, |city_code| returns the next 3 digits, and + // |country_code| returns any remaining digits. + // Separator characters are stripped before parsing the digits. + static void ParsePhoneNumber(const string16& value, + string16* number, + string16* city_code, + string16* country_code); + protected: explicit PhoneNumber(const PhoneNumber& phone_number); @@ -74,7 +83,7 @@ class PhoneNumber : public FormGroup { bool Validate(const string16& number) const; // Removes any punctuation characters from |number|. - void StripPunctuation(string16* number) const; + static void StripPunctuation(string16* number); // The pieces of the phone number. string16 country_code_; |